blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
094169fb2be4807775613a6776436dc22bee91c3
7f84b5e175dd6f9ea74468eb8cf06b03ec68a253
/app/src/main/java/com/zertificon/spikeacra/MyObserver.java
cdcf861cf2bc7d8cc3e19eda287401ba80bf90b8
[]
no_license
HowardSchmaeu/SpikeACRA2
5e3be674ac21759942ce0a53a4906e03cb296b7a
2469d111ddbef2e83fae1980d65ecc415d582351
refs/heads/master
2020-04-26T01:27:23.581651
2015-08-18T08:26:01
2015-08-18T08:26:01
40,959,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,070
java
package com.zertificon.spikeacra; import rx.Observable; import rx.functions.Action1; import rx.functions.Func1; /** * Created by MSC on 02.06.2015. * * More Infos: http://blog.danlew.net/2014/09/15/grokking-rxjava-part-1/ * and the Special Android Part: * http://blog.danlew.net/2014/10/08/grokking-rxjava-part-4/ */ public class MyObserver { public static Observable<String> NumberToStrings(int from, int to, final long delay) { return Observable.range(from, to).map(new Func1<Integer, String>() { @Override public String call(Integer integer) { if (integer == 5) { System.out.println("******* CRASH ******"); String temp = null; System.out.println("-> " + temp.charAt(9)); System.out.println("******* END CRASH ******"); } return integer.toString(); } }).doOnNext(new Action1<String>() { @Override public void call(String s) { try { Thread.sleep(delay); } catch (InterruptedException e) { System.out.println("**** InterruptedException ****"); } } }); } public static Observable<String> NumberToStringsExtern(int from, int to, final long delay) { return Observable.range(from, to).map(new Func1<Integer, String>() { @Override public String call(Integer integer) { if (integer == 5) { Mail mail = new Mail(); mail.getName(); } return integer.toString(); } }).doOnNext(new Action1<String>() { @Override public void call(String s) { try { Thread.sleep(delay); } catch (InterruptedException e) { System.out.println("**** InterruptedException ****"); } } }); } }
[ "m.schmaeu@zertificon.com" ]
m.schmaeu@zertificon.com
50116e004f7d515aa0edcdefafce8e35afb2d3b8
3a25fc04ac08d97a2b4444f78ee6f14819b88b6f
/specification/TestTaking/StudentTestSubmission.java
43b6c8150713d2ccabb7523699b5a87c1b98163d
[]
no_license
georgiev2592/testtool
789fc453728270bcdc353bb301f9c0c18c5be263
eb3932ed5d74877ab1c383938bfe534fea9c9dc0
refs/heads/master
2020-12-31T04:55:52.167357
2016-05-24T21:57:04
2016-05-24T21:57:04
59,611,295
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package TestTaking; import QuestionManager.Question; import java.util.*; /** Represents student's submitted test answers. */ public abstract class StudentTestSubmission { /** A collection of student answers to the test questions */ Collection<StudentAnswerSubmission> answers; /** Add answer to submission or replace the old answer if one exists. */ abstract void addAnswer(StudentAnswerSubmission val); /** Returns the student's answer for the question if it exists. */ abstract StudentAnswerSubmission getAnswer(Question question); }
[ "georgiev2592@gmail.com" ]
georgiev2592@gmail.com
33473c1e0800d56c183e402acd620bce7180d104
62623a05a7acbd40af2aaef7035b62e5d68f75fd
/app/src/main/java/bernadus/alvin/ugd1/MainActivity.java
540808b925c2923f444d61a449461d61a730eda3
[]
no_license
AlvinSugijanto/UGD2_1_9798_A
886bbc4b4adfe58feff868d3bfdcfafd07df30bc
f45b339901f89fe35e22e478ece959d6d13bcb17
refs/heads/master
2022-12-14T17:09:49.022678
2020-09-04T18:17:25
2020-09-04T18:17:25
292,916,745
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
package bernadus.alvin.ugd1; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void next(View view) { Intent intent = new Intent(MainActivity.this, inputactivity.class); startActivity(intent); } }
[ "alvin.sugijanto@gmail.com" ]
alvin.sugijanto@gmail.com
3df5f27e9921bb8db7f85d20580554308999e06e
119ac25712822c80d8a525ef952c8fbe5bf1aecc
/wanhaohui2/src/main/java/com/wishland/www/wanhaohui2/utils/TimeUtil.java
3ee87656e6eadb6fe8e828a7a6998154babac8fb
[]
no_license
RightManCode/wishland
7c1a3b4a1c545441b6a20b1ab4920122cc79bc98
3b673e5a0e7ca33b91466e86ee418a8e88918073
refs/heads/master
2021-05-09T22:52:11.454551
2018-01-24T12:54:39
2018-01-24T12:54:39
118,765,146
0
2
null
null
null
null
UTF-8
Java
false
false
4,373
java
package com.wishland.www.wanhaohui2.utils; import android.annotation.SuppressLint; import java.sql.Time; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; /** * Created by admin on 2017/10/15. */ public class TimeUtil { public static String[] hourarray = new String[]{"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"}; public static String[] minutearray = new String[]{"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25" , "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"}; /** * @return ms转换ss */ public static String getSeconds() { long time = new Date(System.currentTimeMillis()).getTime(); int inttime = (int) (time / 1000); return inttime + "l"; } public static String encryption(String code) { LogUtil.e(code); if (code.isEmpty() || "null".equals(code)) { return null; } if (code.length() > 9) { String start = code.substring(0, 4); String end = code.substring(code.length() - 4, code.length()); return start + "**************" + end; } else { return code; } } public static List<String> getYearMonthDayHourMinuteSecond() { List<String> list = new ArrayList<>(); @SuppressLint("SimpleDateFormat") SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); for (int x = 0; x <= 30; x++) { Calendar c = Calendar.getInstance(); int day = c.get(Calendar.DAY_OF_MONTH) - x; c.set(Calendar.DAY_OF_MONTH, day); Date time = c.getTime(); String d = format.format(time); list.add(d); } return list; } public static String getyear() { @SuppressLint("SimpleDateFormat") SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); int day = c.get(Calendar.DAY_OF_MONTH); c.set(Calendar.DAY_OF_MONTH, day); Date time = c.getTime(); String year = format.format(time); return year; } public static String judgeString(String str) { int i = str.indexOf("."); String substring = str; if (i != -1) { substring = str.substring(0, i); } return substring; } public static Date getSystemDate() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Date curDate = new Date(System.currentTimeMillis());//获取当前时间 String str = formatter.format(curDate); return curDate; } /** * 得到几天前的时间 * * @param d * @param day * @return */ public static Date getDateBefore(Date d, int day) { Calendar now = Calendar.getInstance(); now.setTime(d); now.set(Calendar.DATE, now.get(Calendar.DATE) - day); return now.getTime(); } /** * 获取当前的年份,整形 */ public static int getYear() { Calendar now = Calendar.getInstance(); return now.get(Calendar.YEAR); } public static String getSystemDateString() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Date curDate = new Date(System.currentTimeMillis());//获取当前时间 String str = formatter.format(curDate); return str; } /** * 获取当前的小时 */ public static String getSystemHour() { Calendar calendar = Calendar.getInstance(); int hour = calendar.get(Calendar.HOUR_OF_DAY); return String.valueOf(hour); } /** * 获取当前的分钟 */ public static String getSystemMinute() { Calendar calendar = Calendar.getInstance(); int minute = calendar.get(Calendar.MINUTE); return String.valueOf(minute); } }
[ "bing@163.com" ]
bing@163.com
528295d896ea35d3037eb83f7060549ccb32867d
13dfd110df6cccc7ed5ce992ba5e7eadc56a42af
/sm-shop-model/src/main/java/com/salesmanager/shop/store/controller/category/facade/CategoryBannerFacade.java
7c2c2a696cbb6b5c38eaee969e459a8e68870961
[]
no_license
ajaytiwari000/Habbit
24ca9455f0200e648640079945a04b01918dac7b
1ccff760c0a17515748cdc7c9d133fae71b8d937
refs/heads/master
2023-03-21T11:32:26.708784
2021-03-12T07:38:02
2021-03-12T07:38:02
265,888,454
1
0
null
null
null
null
UTF-8
Java
false
false
555
java
package com.salesmanager.shop.store.controller.category.facade; import com.salesmanager.core.model.catalog.category.CategoryBanner; import java.util.List; import org.springframework.web.multipart.MultipartFile; public interface CategoryBannerFacade { void addCategoryBanners(Long id, MultipartFile[] files, String bannerLinkedSkuId); CategoryBanner getCategoryBannerById(Long categoryBannerId); void removeCategoryBanner(CategoryBanner categoryBanner, Long categoryId); List<CategoryBanner> getCategoryBannersByCategoryId(Long categoryId); }
[ "ajaytiwari000@gmail.com" ]
ajaytiwari000@gmail.com
c11ff1e46c427d23b7c2280db8044fabc6b0f285
18bbf2b6105d64e59af194a6a5ade8a44008dcf1
/labsheets/labsheet4/exercise3/TestBook.java
247659ae8c1e7a651251952ea971e13add8991af
[]
no_license
t00208620/OOPLabSheets
961a5a79ff435122a6bbdf69a41e41c6b1ae632f
c6a2cb077892c10f67f2acb5b059529e1f16f6d7
refs/heads/master
2023-01-28T16:43:53.292993
2020-12-13T16:26:45
2020-12-13T16:26:45
300,585,429
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
package labsheet4.exercise3; import javax.swing.*; public class TestBook { public static void main(String[] args) { String output = ""; Book b1 = new Book(); output += "Calling the no-argument Book constructor." + "The first Book object details are:\n\n" + b1.toString(); Book b2 = new Book(" The DaVinciCode", " 64564566", 19.99, 348); output += "\n\nCalling the multi-argument Computer constructor. " + "The second Book object details are: \n\n" + b2.toString(); JOptionPane.showMessageDialog(null, output, "Book Object Data", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } }
[ "55188878+t00208620@users.noreply.github.com" ]
55188878+t00208620@users.noreply.github.com
46cd27cf75f441c40759d441e94ad97eed28325d
fd394de90ebf2f2040656b99597bd11732319c3b
/app/src/main/java/com/pacsal/yoursms/MainActivity.java
988f8ee145ee23e91f36bc22085b1189e1bab4bd
[ "MIT" ]
permissive
pacsal/zakoSMS
e86a20399647ab4ad0189b9e29da969e2f961fa0
fe70c46e11de547a715b0ff497b3e407d5227c37
refs/heads/master
2019-07-29T22:03:30.475787
2017-09-19T16:05:16
2017-09-19T16:05:16
104,098,936
1
0
null
null
null
null
UTF-8
Java
false
false
850
java
package com.pacsal.yoursms; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Thread myThread = new Thread(){ @Override public void run() { try { sleep(2000); Intent startMain = new Intent(getApplicationContext(), ScrollingActivity.class); startActivity(startMain); finish(); } catch (InterruptedException e) { e.printStackTrace(); } } }; myThread.start(); } }
[ "pm93web@gmail.com" ]
pm93web@gmail.com
cf6d5520ae93f6347bd537946154b07d4c47e1cd
0a429d35e09bc77dd5478d6d91c3b78c4f7cf68f
/app/src/test/java/com/nightowldevelopers/onetapxpboost/ExampleUnitTest.java
f2f8db7cc62e3177a5024e106ee488d11a9f1eb4
[]
no_license
nnishad/OneTapXP_Booster
21dfd5df2bf62e74a829da0ad6beb2081521133b
b29834a87c0ba871970931b9e3321e51a9b57e47
refs/heads/master
2020-06-13T06:00:20.042487
2019-08-12T17:53:02
2019-08-12T17:53:02
194,563,146
0
3
null
2019-08-12T17:53:04
2019-06-30T21:31:27
Java
UTF-8
Java
false
false
408
java
package com.nightowldevelopers.onetapxpboost; import org.junit.Test; import static org.junit.Assert.assertEquals; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "nikhilnishad279@gmail.com" ]
nikhilnishad279@gmail.com
48179d30e893995fc934897f4fdc6e8bc1be2230
e868b660eb064d175ce79bdc45d56a551d51a748
/app/src/main/java/com/example/noter/adapter/ResultAdapter.java
e1222905a75b2da6e5033c3b486bde392f084191
[]
no_license
binhle3920/noter
731da6a81025fd4be88c167e18a5d469310ef9bf
3510c6d8d2cdb18529f8516d9e4f4fa0c41ea40d
refs/heads/main
2023-03-26T23:34:58.939610
2021-03-31T04:58:35
2021-03-31T04:58:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,076
java
package com.example.noter.adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.noter.R; import com.example.noter.activity.DetailNote; import com.example.noter.model.NoteModel; import com.example.noter.model.TagModel; import java.io.Serializable; import java.util.List; public class ResultAdapter extends RecyclerView.Adapter { List<NoteModel> listNote, listResult; List<TagModel> listTag; Context context; public ResultAdapter(@NonNull Context context, int resource, List<NoteModel> listResult, List<NoteModel> listNote, List<TagModel> listTag) { this.listNote = listNote; this.listTag = listTag; this.listResult = listResult; this.context = context; } //item holder class public class NoteItemHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ private Button btn; private TextView date; private NoteItemHolder(View view) { super(view); btn = (Button) view.findViewById(R.id.btn_note); date = (TextView) view.findViewById(R.id.note_date); btn.setOnClickListener(this); } @Override public void onClick(View v) { Intent intent = new Intent(context, DetailNote.class); intent.putExtra("Mode", "Edit"); intent.putExtra("ListTag", (Serializable) listTag); intent.putExtra("ListNote", (Serializable) listNote); for (NoteModel note : listResult) { if (note.getNoteTitle().equals(String.valueOf(btn.getText()))) { intent.putExtra("Note", (Serializable) note); } } context.startActivity(intent); } } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View item = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_note_item, parent, false); return new NoteItemHolder(item); } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { NoteModel note = listResult.get(position); NoteItemHolder noteItemHolder = (NoteItemHolder) holder; //find tag of this note int color = listTag.get(0).getColor(); for (TagModel item : listTag) { if (item.getName().equals(note.getNoteTag())) { color = item.getColor(); break; } } //set background and text noteItemHolder.btn.setBackgroundColor(color); noteItemHolder.btn.setText(note.getNoteTitle()); noteItemHolder.date.setText(note.getNoteDate()); } @Override public int getItemCount() { return listResult.size(); } }
[ "lethanhbinh3920@gmail.com" ]
lethanhbinh3920@gmail.com
dc9efadbee63be198f54ed7957185b3b4c059a16
cd25a10e144c752dc1e223fa21a721a7d74c79fd
/jdiscript/src/main/java/com/wirecard/tools/debugger/jdiscript/requests/JDIScriptEventRequest.java
88cee250fba30b05a04e4c13dd14b8f77b4bb922
[]
no_license
denisu08/debugger-tools
cbeaacdf72c3b1ba970e6033a8348d6c7fe4ee73
7b836b81a468a3b449936f70214fa19dd6a25b03
refs/heads/master
2020-09-04T04:37:41.792757
2019-12-23T07:45:16
2019-12-23T07:45:16
217,292,686
0
0
null
2019-10-25T12:15:44
2019-10-24T12:22:52
TypeScript
UTF-8
Java
false
false
396
java
package com.wirecard.tools.debugger.jdiscript.requests; import com.sun.jdi.Mirror; public interface JDIScriptEventRequest extends Mirror { //Non-chaining EventRequest methods Object getProperty(Object key); boolean isEnabled(); int suspendPolicy(); //ChainableSubInterfaces should define a method with signature //'ChainableSubInterface addHandler(OnSomeEvent e);' }
[ "denisu08@gmail.com" ]
denisu08@gmail.com
1ea0683736bc929fc495f7ea9b8f5975bae535f8
bfb988b9328c71f62d64487e908b4a85f809e801
/PoslovnaBanka/src/main/java/com/pi/PoslovnaBanka/PoslovnaBankaApplication.java
a1aaa3a707f2bc2966c69ac2ab7adb1ccab184df
[]
no_license
Mitra236/PI
69fa81b099eef2798464f68700fb528d0186a83a
b19b51f4af5f62dd8c7421fe7232e4535c45fe54
refs/heads/master
2021-07-22T23:05:52.409137
2021-03-26T16:00:04
2021-03-26T16:00:04
245,796,167
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package com.pi.PoslovnaBanka; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class PoslovnaBankaApplication { public static void main(String[] args) { SpringApplication.run(PoslovnaBankaApplication.class, args); } }
[ "mitra196506@gmail.com" ]
mitra196506@gmail.com
ab113867d6300823db9c7060d9446bcdb452d181
8eb53e36589cec399a7914ce0ba57010d7d34136
/Greatest of three numbers using functions/Main.java
3ae44d3e527ac2648c119353b7821ee3a0b5c296
[]
no_license
sushmavarma7/Playground
641606181e89e08600c0a1db8dd85fe6807db99f
cea7b5db1374e046ebcc617c197e5d37a8db3dd8
refs/heads/master
2020-04-14T12:44:53.640682
2019-04-29T12:02:49
2019-04-29T12:02:49
163,849,267
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
import java.util.Scanner; class Main{ public static void main (String[] args){ // Type your code here Scanner sc=new Scanner(System.in); int m1=sc.nextInt(); int m2=sc.nextInt(); int m3=sc.nextInt(); int temp=greatest(m1,m2); int result=greatest(m3,temp); System.out.println(result); } public static int greatest(int n1,int n2) { if(n1>n2) { return n1; } else{ return n2; } } }
[ "46321720+sushmavarma7@users.noreply.github.com" ]
46321720+sushmavarma7@users.noreply.github.com
c79c9e81550460caf8f43b79c24fa48bf593e7fd
e23f11df3eee39b2aaa796240e368f5c7b0922e4
/src/test/java/io/github/jhipster/application/web/rest/InvoiceResourceIntTest.java
5129f8fa5bf5964b1f462379dd7834e7a2563db0
[]
no_license
hdurix/jhipster-sample-application
199575b1f4bbf18c3c6c3f9124668e73df3159b1
637c1447c0f0e0f60a84ee6d7218a7835f4844fe
refs/heads/master
2020-04-06T15:52:39.023661
2018-11-14T19:17:17
2018-11-14T19:17:17
157,596,273
0
0
null
2018-11-14T19:17:21
2018-11-14T18:57:54
Java
UTF-8
Java
false
false
11,383
java
package io.github.jhipster.application.web.rest; import io.github.jhipster.application.JhipsterSampleApplicationApp; import io.github.jhipster.application.domain.Invoice; import io.github.jhipster.application.repository.InvoiceRepository; import io.github.jhipster.application.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; import static io.github.jhipster.application.web.rest.TestUtil.createFormattingConversionService; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the InvoiceResource REST controller. * * @see InvoiceResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = JhipsterSampleApplicationApp.class) public class InvoiceResourceIntTest { private static final String DEFAULT_CODE = "AAAAAAAAAA"; private static final String UPDATED_CODE = "BBBBBBBBBB"; private static final Instant DEFAULT_DATE = Instant.ofEpochMilli(0L); private static final Instant UPDATED_DATE = Instant.now().truncatedTo(ChronoUnit.MILLIS); private static final String DEFAULT_DETAILS = "AAAAAAAAAA"; private static final String UPDATED_DETAILS = "BBBBBBBBBB"; @Autowired private InvoiceRepository invoiceRepository; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restInvoiceMockMvc; private Invoice invoice; @Before public void setup() { MockitoAnnotations.initMocks(this); final InvoiceResource invoiceResource = new InvoiceResource(invoiceRepository); this.restInvoiceMockMvc = MockMvcBuilders.standaloneSetup(invoiceResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setConversionService(createFormattingConversionService()) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Invoice createEntity(EntityManager em) { Invoice invoice = new Invoice() .code(DEFAULT_CODE) .date(DEFAULT_DATE) .details(DEFAULT_DETAILS); return invoice; } @Before public void initTest() { invoice = createEntity(em); } @Test @Transactional public void createInvoice() throws Exception { int databaseSizeBeforeCreate = invoiceRepository.findAll().size(); // Create the Invoice restInvoiceMockMvc.perform(post("/api/invoices") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invoice))) .andExpect(status().isCreated()); // Validate the Invoice in the database List<Invoice> invoiceList = invoiceRepository.findAll(); assertThat(invoiceList).hasSize(databaseSizeBeforeCreate + 1); Invoice testInvoice = invoiceList.get(invoiceList.size() - 1); assertThat(testInvoice.getCode()).isEqualTo(DEFAULT_CODE); assertThat(testInvoice.getDate()).isEqualTo(DEFAULT_DATE); assertThat(testInvoice.getDetails()).isEqualTo(DEFAULT_DETAILS); } @Test @Transactional public void createInvoiceWithExistingId() throws Exception { int databaseSizeBeforeCreate = invoiceRepository.findAll().size(); // Create the Invoice with an existing ID invoice.setId(1L); // An entity with an existing ID cannot be created, so this API call must fail restInvoiceMockMvc.perform(post("/api/invoices") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invoice))) .andExpect(status().isBadRequest()); // Validate the Invoice in the database List<Invoice> invoiceList = invoiceRepository.findAll(); assertThat(invoiceList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void checkCodeIsRequired() throws Exception { int databaseSizeBeforeTest = invoiceRepository.findAll().size(); // set the field null invoice.setCode(null); // Create the Invoice, which fails. restInvoiceMockMvc.perform(post("/api/invoices") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invoice))) .andExpect(status().isBadRequest()); List<Invoice> invoiceList = invoiceRepository.findAll(); assertThat(invoiceList).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void checkDateIsRequired() throws Exception { int databaseSizeBeforeTest = invoiceRepository.findAll().size(); // set the field null invoice.setDate(null); // Create the Invoice, which fails. restInvoiceMockMvc.perform(post("/api/invoices") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invoice))) .andExpect(status().isBadRequest()); List<Invoice> invoiceList = invoiceRepository.findAll(); assertThat(invoiceList).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void getAllInvoices() throws Exception { // Initialize the database invoiceRepository.saveAndFlush(invoice); // Get all the invoiceList restInvoiceMockMvc.perform(get("/api/invoices?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(invoice.getId().intValue()))) .andExpect(jsonPath("$.[*].code").value(hasItem(DEFAULT_CODE.toString()))) .andExpect(jsonPath("$.[*].date").value(hasItem(DEFAULT_DATE.toString()))) .andExpect(jsonPath("$.[*].details").value(hasItem(DEFAULT_DETAILS.toString()))); } @Test @Transactional public void getInvoice() throws Exception { // Initialize the database invoiceRepository.saveAndFlush(invoice); // Get the invoice restInvoiceMockMvc.perform(get("/api/invoices/{id}", invoice.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(invoice.getId().intValue())) .andExpect(jsonPath("$.code").value(DEFAULT_CODE.toString())) .andExpect(jsonPath("$.date").value(DEFAULT_DATE.toString())) .andExpect(jsonPath("$.details").value(DEFAULT_DETAILS.toString())); } @Test @Transactional public void getNonExistingInvoice() throws Exception { // Get the invoice restInvoiceMockMvc.perform(get("/api/invoices/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateInvoice() throws Exception { // Initialize the database invoiceRepository.saveAndFlush(invoice); int databaseSizeBeforeUpdate = invoiceRepository.findAll().size(); // Update the invoice Invoice updatedInvoice = invoiceRepository.findById(invoice.getId()).get(); // Disconnect from session so that the updates on updatedInvoice are not directly saved in db em.detach(updatedInvoice); updatedInvoice .code(UPDATED_CODE) .date(UPDATED_DATE) .details(UPDATED_DETAILS); restInvoiceMockMvc.perform(put("/api/invoices") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(updatedInvoice))) .andExpect(status().isOk()); // Validate the Invoice in the database List<Invoice> invoiceList = invoiceRepository.findAll(); assertThat(invoiceList).hasSize(databaseSizeBeforeUpdate); Invoice testInvoice = invoiceList.get(invoiceList.size() - 1); assertThat(testInvoice.getCode()).isEqualTo(UPDATED_CODE); assertThat(testInvoice.getDate()).isEqualTo(UPDATED_DATE); assertThat(testInvoice.getDetails()).isEqualTo(UPDATED_DETAILS); } @Test @Transactional public void updateNonExistingInvoice() throws Exception { int databaseSizeBeforeUpdate = invoiceRepository.findAll().size(); // Create the Invoice // If the entity doesn't have an ID, it will throw BadRequestAlertException restInvoiceMockMvc.perform(put("/api/invoices") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invoice))) .andExpect(status().isBadRequest()); // Validate the Invoice in the database List<Invoice> invoiceList = invoiceRepository.findAll(); assertThat(invoiceList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional public void deleteInvoice() throws Exception { // Initialize the database invoiceRepository.saveAndFlush(invoice); int databaseSizeBeforeDelete = invoiceRepository.findAll().size(); // Get the invoice restInvoiceMockMvc.perform(delete("/api/invoices/{id}", invoice.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Invoice> invoiceList = invoiceRepository.findAll(); assertThat(invoiceList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(Invoice.class); Invoice invoice1 = new Invoice(); invoice1.setId(1L); Invoice invoice2 = new Invoice(); invoice2.setId(invoice1.getId()); assertThat(invoice1).isEqualTo(invoice2); invoice2.setId(2L); assertThat(invoice1).isNotEqualTo(invoice2); invoice1.setId(null); assertThat(invoice1).isNotEqualTo(invoice2); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
52f14261dc291fb121b1a9dc07bb89cf6e0b6acf
9aad444d76072927aa92fc65b5d5cfd7811c0751
/GrpcInterface/build/generated/source/proto/main/java/com/mrozowski/study/grpc/api/v1/RequestProcessor.java
80fed2e2b7cc65bfb5c9b8744fecf2c4750c1af9
[]
no_license
mrozowski/Grpc-and-rabbitmq
d04af14730d44fd8e7969fe9389e691ebe9afad9
079106a5f6403447c0da7c4b32aad132c615bb7b
refs/heads/master
2023-07-18T19:10:56.017050
2021-09-26T11:11:30
2021-09-26T11:11:30
380,682,353
1
0
null
null
null
null
UTF-8
Java
false
true
38,055
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: RequestProcessor.proto package com.mrozowski.study.grpc.api.v1; public final class RequestProcessor { private RequestProcessor() {} 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 ResultOrBuilder extends // @@protoc_insertion_point(interface_extends:com.mrozowski.study.grpc.api.v1.Result) com.google.protobuf.MessageOrBuilder { /** * <code>string id = 1;</code> * @return The id. */ java.lang.String getId(); /** * <code>string id = 1;</code> * @return The bytes for id. */ com.google.protobuf.ByteString getIdBytes(); /** * <code>string requestId = 2;</code> * @return The requestId. */ java.lang.String getRequestId(); /** * <code>string requestId = 2;</code> * @return The bytes for requestId. */ com.google.protobuf.ByteString getRequestIdBytes(); /** * <code>string result = 3;</code> * @return The result. */ java.lang.String getResult(); /** * <code>string result = 3;</code> * @return The bytes for result. */ com.google.protobuf.ByteString getResultBytes(); /** * <code>.google.protobuf.Timestamp date = 4;</code> * @return Whether the date field is set. */ boolean hasDate(); /** * <code>.google.protobuf.Timestamp date = 4;</code> * @return The date. */ com.google.protobuf.Timestamp getDate(); /** * <code>.google.protobuf.Timestamp date = 4;</code> */ com.google.protobuf.TimestampOrBuilder getDateOrBuilder(); } /** * Protobuf type {@code com.mrozowski.study.grpc.api.v1.Result} */ public static final class Result extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.mrozowski.study.grpc.api.v1.Result) ResultOrBuilder { private static final long serialVersionUID = 0L; // Use Result.newBuilder() to construct. private Result(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Result() { id_ = ""; requestId_ = ""; result_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new Result(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Result( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } 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: { java.lang.String s = input.readStringRequireUtf8(); id_ = s; break; } case 18: { java.lang.String s = input.readStringRequireUtf8(); requestId_ = s; break; } case 26: { java.lang.String s = input.readStringRequireUtf8(); result_ = s; break; } case 34: { com.google.protobuf.Timestamp.Builder subBuilder = null; if (date_ != null) { subBuilder = date_.toBuilder(); } date_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(date_); date_ = subBuilder.buildPartial(); } 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 com.mrozowski.study.grpc.api.v1.RequestProcessor.internal_static_com_mrozowski_study_grpc_api_v1_Result_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.mrozowski.study.grpc.api.v1.RequestProcessor.internal_static_com_mrozowski_study_grpc_api_v1_Result_fieldAccessorTable .ensureFieldAccessorsInitialized( com.mrozowski.study.grpc.api.v1.RequestProcessor.Result.class, com.mrozowski.study.grpc.api.v1.RequestProcessor.Result.Builder.class); } public static final int ID_FIELD_NUMBER = 1; private volatile java.lang.Object id_; /** * <code>string id = 1;</code> * @return The id. */ @java.lang.Override public java.lang.String getId() { java.lang.Object ref = id_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); id_ = s; return s; } } /** * <code>string id = 1;</code> * @return The bytes for id. */ @java.lang.Override public com.google.protobuf.ByteString getIdBytes() { java.lang.Object ref = id_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); id_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int REQUESTID_FIELD_NUMBER = 2; private volatile java.lang.Object requestId_; /** * <code>string requestId = 2;</code> * @return The requestId. */ @java.lang.Override public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } } /** * <code>string requestId = 2;</code> * @return The bytes for requestId. */ @java.lang.Override public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int RESULT_FIELD_NUMBER = 3; private volatile java.lang.Object result_; /** * <code>string result = 3;</code> * @return The result. */ @java.lang.Override public java.lang.String getResult() { java.lang.Object ref = result_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); result_ = s; return s; } } /** * <code>string result = 3;</code> * @return The bytes for result. */ @java.lang.Override public com.google.protobuf.ByteString getResultBytes() { java.lang.Object ref = result_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); result_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int DATE_FIELD_NUMBER = 4; private com.google.protobuf.Timestamp date_; /** * <code>.google.protobuf.Timestamp date = 4;</code> * @return Whether the date field is set. */ @java.lang.Override public boolean hasDate() { return date_ != null; } /** * <code>.google.protobuf.Timestamp date = 4;</code> * @return The date. */ @java.lang.Override public com.google.protobuf.Timestamp getDate() { return date_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : date_; } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getDateOrBuilder() { return getDate(); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_); } if (!getRequestIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, requestId_); } if (!getResultBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, result_); } if (date_ != null) { output.writeMessage(4, getDate()); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_); } if (!getRequestIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, requestId_); } if (!getResultBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, result_); } if (date_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, getDate()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.mrozowski.study.grpc.api.v1.RequestProcessor.Result)) { return super.equals(obj); } com.mrozowski.study.grpc.api.v1.RequestProcessor.Result other = (com.mrozowski.study.grpc.api.v1.RequestProcessor.Result) obj; if (!getId() .equals(other.getId())) return false; if (!getRequestId() .equals(other.getRequestId())) return false; if (!getResult() .equals(other.getResult())) return false; if (hasDate() != other.hasDate()) return false; if (hasDate()) { if (!getDate() .equals(other.getDate())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ID_FIELD_NUMBER; hash = (53 * hash) + getId().hashCode(); hash = (37 * hash) + REQUESTID_FIELD_NUMBER; hash = (53 * hash) + getRequestId().hashCode(); hash = (37 * hash) + RESULT_FIELD_NUMBER; hash = (53 * hash) + getResult().hashCode(); if (hasDate()) { hash = (37 * hash) + DATE_FIELD_NUMBER; hash = (53 * hash) + getDate().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result 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 com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result 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 com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.mrozowski.study.grpc.api.v1.RequestProcessor.Result prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.mrozowski.study.grpc.api.v1.Result} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.mrozowski.study.grpc.api.v1.Result) com.mrozowski.study.grpc.api.v1.RequestProcessor.ResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.mrozowski.study.grpc.api.v1.RequestProcessor.internal_static_com_mrozowski_study_grpc_api_v1_Result_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.mrozowski.study.grpc.api.v1.RequestProcessor.internal_static_com_mrozowski_study_grpc_api_v1_Result_fieldAccessorTable .ensureFieldAccessorsInitialized( com.mrozowski.study.grpc.api.v1.RequestProcessor.Result.class, com.mrozowski.study.grpc.api.v1.RequestProcessor.Result.Builder.class); } // Construct using com.mrozowski.study.grpc.api.v1.RequestProcessor.Result.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); id_ = ""; requestId_ = ""; result_ = ""; if (dateBuilder_ == null) { date_ = null; } else { date_ = null; dateBuilder_ = null; } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.mrozowski.study.grpc.api.v1.RequestProcessor.internal_static_com_mrozowski_study_grpc_api_v1_Result_descriptor; } @java.lang.Override public com.mrozowski.study.grpc.api.v1.RequestProcessor.Result getDefaultInstanceForType() { return com.mrozowski.study.grpc.api.v1.RequestProcessor.Result.getDefaultInstance(); } @java.lang.Override public com.mrozowski.study.grpc.api.v1.RequestProcessor.Result build() { com.mrozowski.study.grpc.api.v1.RequestProcessor.Result result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.mrozowski.study.grpc.api.v1.RequestProcessor.Result buildPartial() { com.mrozowski.study.grpc.api.v1.RequestProcessor.Result result = new com.mrozowski.study.grpc.api.v1.RequestProcessor.Result(this); result.id_ = id_; result.requestId_ = requestId_; result.result_ = result_; if (dateBuilder_ == null) { result.date_ = date_; } else { result.date_ = dateBuilder_.build(); } onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.mrozowski.study.grpc.api.v1.RequestProcessor.Result) { return mergeFrom((com.mrozowski.study.grpc.api.v1.RequestProcessor.Result)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.mrozowski.study.grpc.api.v1.RequestProcessor.Result other) { if (other == com.mrozowski.study.grpc.api.v1.RequestProcessor.Result.getDefaultInstance()) return this; if (!other.getId().isEmpty()) { id_ = other.id_; onChanged(); } if (!other.getRequestId().isEmpty()) { requestId_ = other.requestId_; onChanged(); } if (!other.getResult().isEmpty()) { result_ = other.result_; onChanged(); } if (other.hasDate()) { mergeDate(other.getDate()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.mrozowski.study.grpc.api.v1.RequestProcessor.Result parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.mrozowski.study.grpc.api.v1.RequestProcessor.Result) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private java.lang.Object id_ = ""; /** * <code>string id = 1;</code> * @return The id. */ public java.lang.String getId() { java.lang.Object ref = id_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); id_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string id = 1;</code> * @return The bytes for id. */ public com.google.protobuf.ByteString getIdBytes() { java.lang.Object ref = id_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); id_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string id = 1;</code> * @param value The id to set. * @return This builder for chaining. */ public Builder setId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } id_ = value; onChanged(); return this; } /** * <code>string id = 1;</code> * @return This builder for chaining. */ public Builder clearId() { id_ = getDefaultInstance().getId(); onChanged(); return this; } /** * <code>string id = 1;</code> * @param value The bytes for id to set. * @return This builder for chaining. */ public Builder setIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); id_ = value; onChanged(); return this; } private java.lang.Object requestId_ = ""; /** * <code>string requestId = 2;</code> * @return The requestId. */ public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string requestId = 2;</code> * @return The bytes for requestId. */ public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string requestId = 2;</code> * @param value The requestId to set. * @return This builder for chaining. */ public Builder setRequestId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } requestId_ = value; onChanged(); return this; } /** * <code>string requestId = 2;</code> * @return This builder for chaining. */ public Builder clearRequestId() { requestId_ = getDefaultInstance().getRequestId(); onChanged(); return this; } /** * <code>string requestId = 2;</code> * @param value The bytes for requestId to set. * @return This builder for chaining. */ public Builder setRequestIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); requestId_ = value; onChanged(); return this; } private java.lang.Object result_ = ""; /** * <code>string result = 3;</code> * @return The result. */ public java.lang.String getResult() { java.lang.Object ref = result_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); result_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string result = 3;</code> * @return The bytes for result. */ public com.google.protobuf.ByteString getResultBytes() { java.lang.Object ref = result_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); result_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string result = 3;</code> * @param value The result to set. * @return This builder for chaining. */ public Builder setResult( java.lang.String value) { if (value == null) { throw new NullPointerException(); } result_ = value; onChanged(); return this; } /** * <code>string result = 3;</code> * @return This builder for chaining. */ public Builder clearResult() { result_ = getDefaultInstance().getResult(); onChanged(); return this; } /** * <code>string result = 3;</code> * @param value The bytes for result to set. * @return This builder for chaining. */ public Builder setResultBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); result_ = value; onChanged(); return this; } private com.google.protobuf.Timestamp date_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> dateBuilder_; /** * <code>.google.protobuf.Timestamp date = 4;</code> * @return Whether the date field is set. */ public boolean hasDate() { return dateBuilder_ != null || date_ != null; } /** * <code>.google.protobuf.Timestamp date = 4;</code> * @return The date. */ public com.google.protobuf.Timestamp getDate() { if (dateBuilder_ == null) { return date_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : date_; } else { return dateBuilder_.getMessage(); } } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ public Builder setDate(com.google.protobuf.Timestamp value) { if (dateBuilder_ == null) { if (value == null) { throw new NullPointerException(); } date_ = value; onChanged(); } else { dateBuilder_.setMessage(value); } return this; } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ public Builder setDate( com.google.protobuf.Timestamp.Builder builderForValue) { if (dateBuilder_ == null) { date_ = builderForValue.build(); onChanged(); } else { dateBuilder_.setMessage(builderForValue.build()); } return this; } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ public Builder mergeDate(com.google.protobuf.Timestamp value) { if (dateBuilder_ == null) { if (date_ != null) { date_ = com.google.protobuf.Timestamp.newBuilder(date_).mergeFrom(value).buildPartial(); } else { date_ = value; } onChanged(); } else { dateBuilder_.mergeFrom(value); } return this; } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ public Builder clearDate() { if (dateBuilder_ == null) { date_ = null; onChanged(); } else { date_ = null; dateBuilder_ = null; } return this; } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ public com.google.protobuf.Timestamp.Builder getDateBuilder() { onChanged(); return getDateFieldBuilder().getBuilder(); } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ public com.google.protobuf.TimestampOrBuilder getDateOrBuilder() { if (dateBuilder_ != null) { return dateBuilder_.getMessageOrBuilder(); } else { return date_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : date_; } } /** * <code>.google.protobuf.Timestamp date = 4;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> getDateFieldBuilder() { if (dateBuilder_ == null) { dateBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( getDate(), getParentForChildren(), isClean()); date_ = null; } return dateBuilder_; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.mrozowski.study.grpc.api.v1.Result) } // @@protoc_insertion_point(class_scope:com.mrozowski.study.grpc.api.v1.Result) private static final com.mrozowski.study.grpc.api.v1.RequestProcessor.Result DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.mrozowski.study.grpc.api.v1.RequestProcessor.Result(); } public static com.mrozowski.study.grpc.api.v1.RequestProcessor.Result getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Result> PARSER = new com.google.protobuf.AbstractParser<Result>() { @java.lang.Override public Result parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Result(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Result> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Result> getParserForType() { return PARSER; } @java.lang.Override public com.mrozowski.study.grpc.api.v1.RequestProcessor.Result getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_mrozowski_study_grpc_api_v1_Result_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_mrozowski_study_grpc_api_v1_Result_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\026RequestProcessor.proto\022\037com.mrozowski." + "study.grpc.api.v1\032\023BridgeService.proto\032\037" + "google/protobuf/timestamp.proto\032\033google/" + "protobuf/empty.proto\"a\n\006Result\022\n\n\002id\030\001 \001" + "(\t\022\021\n\trequestId\030\002 \001(\t\022\016\n\006result\030\003 \001(\t\022(\n" + "\004date\030\004 \001(\0132\032.google.protobuf.Timestamp2" + "\333\001\n\027RequestProcessorService\022j\n\tgetResult" + "\0222.com.mrozowski.study.grpc.api.v1.Reque" + "stIdentifier\032\'.com.mrozowski.study.grpc." + "api.v1.Result\"\000\022T\n\016processRequest\022(.com." + "mrozowski.study.grpc.api.v1.Request\032\026.go" + "ogle.protobuf.Empty\"\000b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.mrozowski.study.grpc.api.v1.BridgeServiceOuterClass.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.protobuf.EmptyProto.getDescriptor(), }); internal_static_com_mrozowski_study_grpc_api_v1_Result_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_com_mrozowski_study_grpc_api_v1_Result_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_mrozowski_study_grpc_api_v1_Result_descriptor, new java.lang.String[] { "Id", "RequestId", "Result", "Date", }); com.mrozowski.study.grpc.api.v1.BridgeServiceOuterClass.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.protobuf.EmptyProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) }
[ "mrozowskion@gmail.com" ]
mrozowskion@gmail.com
61d428c78df4f83ed98f6832a897e05a57a16c90
e259bae8a05eef411660434b059775e9bdcc288b
/src/main/java/org/pentaho/graphmlmerger/util/GraphmlMerger.java
76b36715152f5038fde232fb3e7384950a0e3020
[]
no_license
pminutillo/dependency-graphml-merger
3b612ae07c3b39a497002a323370d85c17540fc6
35ba23f710a7c25b7b415a81ff0566c46210c7de
refs/heads/master
2020-12-02T19:30:41.677348
2016-12-16T18:14:10
2016-12-16T18:14:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,042
java
/* * ****************************************************************************** * * Copyright (C) 2002-2016 by Pentaho : http://www.pentaho.com * * ****************************************************************************** * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pentaho.graphmlmerger.util; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; /** * Created by rfellows on 12/6/16. */ public class GraphmlMerger { private Graph graph; public GraphmlMerger() { this.graph = TinkerGraph.open(); } public GraphmlMerger( Graph graph ) { this.graph = graph; } public void mergeFile( String graphmlFile ) throws FileNotFoundException { GraphMLReader reader = GraphMLReader.build() .vertexLabelKey( "_name" ) .edgeLabelKey( "_label" ) .strict( false ) .batchSize( 1024 ) .create(); Graph tmpGraph = TinkerGraph.open(); FileInputStream fis = new FileInputStream( graphmlFile ); try { reader.readGraph( fis, tmpGraph ); // add all of the vertices Iterator<Vertex> vertexIterator = tmpGraph.vertices(); IteratorUtils.stream( vertexIterator ).forEach( vertex -> { try { mergeVertex( vertex ); } catch ( IllegalArgumentException e ) { // vertex is already there, ignore this error System.out.println( e.getMessage() ); } } ); Iterator<Edge> edgeIterator = tmpGraph.edges(); IteratorUtils.stream( edgeIterator ).forEach( edge -> { try { mergeEdge( edge ); } catch ( IllegalArgumentException e ) { // edge is already there, ignore it System.out.println( e.getMessage() ); } } ); } catch ( IOException e ) { e.printStackTrace(); } } protected Vertex mergeVertex( Vertex originalVertex ) throws IllegalArgumentException { return getGraph().addVertex( T.id, originalVertex.id(), T.label, originalVertex.label(), "groupId", originalVertex.property( "groupId" ).value(), "artifactId", originalVertex.property( "artifactId" ).value(), "version", originalVertex.property( "version" ).value() ); } protected Edge mergeEdge( Edge originalEdge ) throws IllegalArgumentException { Vertex out = getGraph().traversal().V( originalEdge.outVertex().id() ).next(); Vertex in = getGraph().traversal().V( originalEdge.inVertex().id() ).next(); return out.addEdge( originalEdge.label(), in, T.id, originalEdge.id() ); } protected Graph getGraph() { return graph; } public void writeMergedGraph( String outputFile ) throws IOException { try ( final OutputStream os = new FileOutputStream( outputFile ) ) { graph.io( IoCore.graphml() ).writer() .normalize( true ) .edgeLabelKey( "_label" ) .vertexLabelKey( "_name" ) .create().writeGraph( os, graph ); } } }
[ "rfellows@pentaho.com" ]
rfellows@pentaho.com
5e6bc19ac95b6e80ccf30c091cb1cb4a1ede2898
2d4edd278a609f572d13712ac4f5908114a03cf0
/Product.java
e125659006eb4d1bbbc93859726f17188c94c0f5
[]
no_license
amir003/E-commerce
40a7bc8f29426c9e89096e92fcf8a047941d5aea
fabda8e81af9353f3e22d2b8d0098a0d3995a6db
refs/heads/master
2021-01-10T21:33:43.607330
2015-06-09T20:37:28
2015-06-09T20:37:28
24,763,585
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
public class Product { private String description; private double price; public Product(String description , double price) { this.description = description; this.price = price; } public double getPrix() { return this.price; } public String getDescription() { return this.description; } }
[ "amirnaar@hotmail.fr" ]
amirnaar@hotmail.fr
6a2438ee874400565d6dea60adaae403b1b79725
28e356d56e3682cdaa53a14f2ef22a2dbb9799c0
/2.1.06-Solution-LoadA9Patch/desktop/src/com/udacity/gamedev/ninepatch/desktop/DesktopLauncher.java
4df698b707d6859fb9ac368851547b8a9e873589
[ "MIT" ]
permissive
udacity/ud406
31fb5e8ef02f6f78e500ad8998bae38bf4296494
191d46352271cc74f4232a3f75db3563c200b1c9
refs/heads/master
2023-03-28T21:01:07.283156
2021-10-21T13:33:06
2021-10-21T13:33:06
45,005,805
60
134
MIT
2023-05-08T19:41:40
2015-10-27T00:05:43
Java
UTF-8
Java
false
false
437
java
package com.udacity.gamedev.ninepatch.desktop; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.udacity.gamedev.ninepatch.NinePatchDemo; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); new LwjglApplication(new NinePatchDemo(), config); } }
[ "jeremy@udacity.com" ]
jeremy@udacity.com
1a73a2c8c88fb0d1269b16c3d523093983edba52
7557a53b8f7d9c2adeef1c401f5b3bd5de5a1eb8
/src/main/java/formers/database/dto/FormResponseDto.java
634ef97c79859b61dfedd4ccdc03ec923c31e8ae
[]
no_license
freesoup/formers
9001a14db512ed03e4e4872a15e1adaf0d4e10e7
65adb76527089b6033df49b1e2c0cc73694d021f
refs/heads/master
2021-10-10T09:15:01.239239
2018-08-03T10:54:37
2018-08-03T10:54:37
142,866,340
0
0
null
2018-08-03T10:54:38
2018-07-30T11:27:16
Java
UTF-8
Java
false
false
732
java
package formers.database.dto; import com.worksap.company.dto.annotation.Entity; import com.worksap.company.dto.annotation.Key; @Entity public class FormResponseDto { @Key(order = 0) private String formId; @Key(order = 1) private String formRecipient; private String stringJson; public FormResponseDto() { } public FormResponseDto(String id, String formRecipient, String json) { this.formId = id; this.formRecipient = formRecipient; this.stringJson = json; } private String getFormID() { return formId; } public String getFormResponse() { return stringJson; } public String getRecipient() { return formRecipient; } }
[ "wei_ja@worksap.co.jp" ]
wei_ja@worksap.co.jp
642259832e169d603ab8098df7d21fb81a69497f
30049883554aa8e1b0790120d770682f39d512d8
/src/main/java/au/net/bunney/bamboo/plugins/envwallboard/ViewEnvironmentWallboard.java
c5f1fb2f59222fd46f2076d387916e46e525f762
[ "Apache-2.0" ]
permissive
gavinbunney/bamboo-environment-wallboard
690b0c16a3816523ce522d63779ea9b9e2c09872
a362594d5e63d07a8945db7e23f4a8219315815a
refs/heads/master
2021-01-13T01:25:09.187573
2012-11-23T05:05:16
2012-11-23T05:05:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,588
java
/* * Copyright 2012 Bunney Apps, Brisbane, Australia. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package au.net.bunney.bamboo.plugins.envwallboard; import au.net.bunney.bamboo.plugins.envwallboard.admin.EnvironmentConfig; import au.net.bunney.bamboo.plugins.envwallboard.admin.EnvironmentConfigManager; import com.atlassian.bamboo.ww2.BambooActionSupport; import org.apache.log4j.Logger; import java.net.HttpURLConnection; import java.net.URL; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class ViewEnvironmentWallboard extends BambooActionSupport { private static final Logger log = Logger.getLogger(ViewEnvironmentWallboard.class); private static final int THREADS_COUNT = 10; private static final int DEFAULT_SECONDS_BEFORE_NEXT_REFRESH = 15; private int secondsBeforeNextRefresh = DEFAULT_SECONDS_BEFORE_NEXT_REFRESH; private EnvironmentConfigManager environmentConfigManager; private List<EnvironmentDetails> environments; private String wallboardName; public ViewEnvironmentWallboard(EnvironmentConfigManager environmentConfigManager) { super(); this.environmentConfigManager = environmentConfigManager; } @Override public String doDefault() throws Exception { environments = new ArrayList<EnvironmentDetails>(); for (EnvironmentConfig environmentConfig : environmentConfigManager.getAllEnvironmentConfigs(getWallboardName())) { environments.add(new EnvironmentDetails(environmentConfig)); } ExecutorService executor = Executors.newFixedThreadPool(THREADS_COUNT); for (final EnvironmentDetails environment : environments) { final String environmentName = environment.getName(); Runnable runnableBlock = new Runnable() { public void run() { connect(environment); log.debug(String.format("%s - Completed", environmentName)); } }; executor.execute(runnableBlock); log.debug(String.format("Start runnable for '%s'", environmentName )); } executor.shutdown(); while (!executor.isTerminated()) { } return SUCCESS; } public static void connect(EnvironmentDetails environment) { try { URL url = new URL(environment.getUrl()); HttpURLConnection yc = (HttpURLConnection) url.openConnection(); String usernamePassword = environment.getAuth(); if (usernamePassword != null) { String encoded = new sun.misc.BASE64Encoder().encode(usernamePassword.getBytes()); yc.setRequestProperty("Authorization", "Basic " + encoded); } yc.setConnectTimeout(5 * 1000); yc.setReadTimeout(10 * 1000); yc.connect(); Scanner scanner = new Scanner(yc.getInputStream()); try { HashMap<String, String> buildDetails = new HashMap<String, String>(); while ( scanner.hasNextLine() ){ String line = scanner.nextLine(); if (line.equals("[build]")) continue; Scanner lineScanner = new Scanner(line); lineScanner.useDelimiter("="); if ( lineScanner.hasNext() ){ String name = lineScanner.next().trim(); String value = lineScanner.next().trim(); buildDetails.put(name, value); } } environment.setStatus("alive"); environment.setBuildNumber(buildDetails.get("buildNumber")); environment.setBuildTimeStamp(buildDetails.get("buildTimeStamp")); environment.setBuildRevision(buildDetails.get("buildRevision")); } finally { scanner.close(); } } catch (Exception e) { log.info("Environment wallboard exception: " + e); environment.setStatus("dead"); } } public String getWallboardName() { return wallboardName; } public void setWallboardName(String wallboardName) { this.wallboardName = wallboardName; } public List<EnvironmentDetails> getEnvironments() { return environments; } public int getSecondsBeforeNextRefresh() { if(secondsBeforeNextRefresh < DEFAULT_SECONDS_BEFORE_NEXT_REFRESH) { return DEFAULT_SECONDS_BEFORE_NEXT_REFRESH; } return secondsBeforeNextRefresh; } public void setSecondsBeforeNextRefresh(int secondsBeforeNextRefresh) { this.secondsBeforeNextRefresh = secondsBeforeNextRefresh; } }
[ "gavin.bunney@gmail.com" ]
gavin.bunney@gmail.com
792b71501ecb2cae517ca8fedbe085b49620427c
ffaac62bd10f9615ef9b8a3740705bfde1c4c59c
/src/main/java/es/upm/oeg/librairy/api/builders/BoWPipeBuilder.java
5d2677749d1d9a534a2d1e991aa90fd8efb90ec4
[ "Apache-2.0" ]
permissive
librairy/api
9d1d31cbdacaa895c9c9f75623a6b69d9da54dd0
50fb1a4b1c4c37849378aaab6dedcd9fe95c38d0
refs/heads/master
2021-06-24T01:04:36.318557
2021-05-12T16:18:55
2021-05-12T16:18:55
174,326,322
0
1
null
null
null
null
UTF-8
Java
false
false
7,786
java
package es.upm.oeg.librairy.api.builders; import cc.mallet.pipe.*; import cc.mallet.types.Alphabet; import cc.mallet.types.Instance; import com.google.common.base.Strings; import es.upm.oeg.librairy.api.executors.ParallelExecutor; import org.librairy.service.nlp.facade.model.PoS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; import java.util.stream.Collectors; /** * @author Badenes Olmedo, Carlos <cbadenes@fi.upm.es> */ public class BoWPipeBuilder implements PipeBuilderI{ private static final Logger LOG = LoggerFactory.getLogger(BoWPipeBuilder.class); private final Integer size; public BoWPipeBuilder(Integer size) { this.size = size; } public Pipe build(String pos, Boolean enableTarget, TokenSequenceRemoveStopwords stopWordTokenizer) { ArrayList pipeList = new ArrayList(); // Read data from File objects pipeList.add(new Input2CharSequence("UTF-8")); pipeList.add(new CharSequence2TokenSequence(Pattern.compile("\\S+"))); List<PoS> posList = Strings.isNullOrEmpty(pos) ? Collections.emptyList() : Arrays.asList(pos.split(" ")).stream().map(i -> PoS.valueOf(i.toUpperCase())).collect(Collectors.toList()); pipeList.add(new TokenSequenceRemovePoS(posList)); pipeList.add(new TokenSequenceExpandBoW("=")); pipeList.add(stopWordTokenizer); pipeList.add(new TokenSequence2FeatureSequence()); // Do the same thing for the "target" field: // convert a class label string to a Label object, // which has an index in a Label alphabet. // pipeList.add(new Target2Label()); if (enableTarget) pipeList.add(new TargetStringToFeatures()); // Now convert the sequence of features to a sparse vector, // mapping feature IDs to counts. // pipeList.add(new FeatureSequence2FeatureVector()); // Print out the features and the label // pipeList.add(new PrintInputAndTarget()); return new SerialPipes(pipeList); } /** * @param cvsIterator * @param stopWordTokenizer the tokenizer that will be used to write instances * @param pos * @param minFreq Reduce words to those that occur more than N times. * @param docProportionCutoff Remove features that occur in more than (X*100)% of documents. 0.05 is equivalent to IDF of 3.0. * @return */ public void prune(Iterator<Instance> cvsIterator, TokenSequenceRemoveStopwords stopWordTokenizer, String pos, Integer minFreq, Double docProportionCutoff){ ArrayList pipeList = new ArrayList(); Alphabet alphabet = new Alphabet(); // Read data from File objects pipeList.add(new Input2CharSequence("UTF-8")); pipeList.add(new CharSequence2TokenSequence(Pattern.compile("\\S+"))); List<PoS> posList = Strings.isNullOrEmpty(pos) ? Collections.emptyList() : Arrays.asList(pos.split(" ")).stream().map(i -> PoS.valueOf(i.toUpperCase())).collect(Collectors.toList()); pipeList.add(new TokenSequenceRemovePoS(posList)); pipeList.add(new TokenSequenceExpandBoW("=")); pipeList.add(stopWordTokenizer); pipeList.add(new TokenSequence2FeatureSequence(alphabet)); FeatureCountPipe featureCounter = new FeatureCountPipe(alphabet, null); if (minFreq > 0) pipeList.add(featureCounter); FeatureDocFreqPipe docCounter = new FeatureDocFreqPipe(alphabet, null); if (docProportionCutoff < 1.0) pipeList.add(docCounter); Pipe pipe = new SerialPipes(pipeList); Instant startProcess = Instant.now(); /** * */ //Iterator<Instance> iterator = pipe.newParallelIteratorFrom(cvsIterator); Iterator<Instance> iterator = pipe.newIteratorFrom(cvsIterator); ParallelExecutor executors = new ParallelExecutor(); LOG.info("Getting stats to complete prune actions .."); int count = 0; int interval = size < 100? 10 : size/100; final boolean[] error = {false}; while(iterator.hasNext() && !error[0]){ try{ count++; if (count % interval == 0) { LOG.info("Docs analyzed: " + count); Thread.sleep(10); } executors.submit(() -> { try { Instance instance = iterator.next(); LOG.debug("Instance: " + instance.getName()); }catch (NoSuchElementException e){ LOG.info("list completed"); }catch (Exception e){ if (e instanceof java.lang.IllegalStateException) error[0] = true; LOG.error("Instance not handled by pipe: " + e.getMessage(),e); } }); }catch (Exception e){ LOG.error("Error reading next instance",e); break; } } LOG.info("Waiting for finish stats ..."); executors.awaitTermination(1, TimeUnit.MINUTES); LOG.info("Docs analyzed: " + count); Instant endProcess = Instant.now(); String durationProcess = ChronoUnit.HOURS.between(startProcess, endProcess) + "hours " + ChronoUnit.MINUTES.between(startProcess, endProcess) % 60 + "min " + (ChronoUnit.SECONDS.between(startProcess, endProcess) % 60) + "secs " + (ChronoUnit.MILLIS.between(startProcess, endProcess) % 60) + "msecs"; LOG.info("Prune stats collected in: " + durationProcess); if (minFreq > 0) { List<String> stopWordsByFreq = featureCounter.getPrunedWords(minFreq); LOG.info(stopWordsByFreq.size() + " words pruned by freq [" + minFreq + "]"); stopWordTokenizer.addStopWords(stopWordsByFreq); } if (docProportionCutoff > 0.0) { List<String> stopWordsByDocFreq = docCounter.getPrunedWords(docProportionCutoff); LOG.debug("Stopwords: " + stopWordsByDocFreq); LOG.info(stopWordsByDocFreq.size() + " words pruned by doc-freq [" + docProportionCutoff + "]"); stopWordTokenizer.addStopWords(stopWordsByDocFreq); } } public Pipe buildMinimal() { ArrayList pipeList = new ArrayList(); // Read data from File objects pipeList.add(new Input2CharSequence("UTF-8")); // Regular expression for what constitutes a token. // This pattern includes Unicode letters, Unicode numbers, // and the underscore character. Alternatives: // "\\S+" (anything not whitespace) // "\\w+" ( A-Z, a-z, 0-9, _ ) // "[\\p{L}\\p{N}_]+|[\\p{P}]+" (a group of only letters and numbers OR // a group of only punctuation marks) Pattern tokenPattern = Pattern.compile("[\\p{L}\\p{N}_]+"); // Tokenize raw strings pipeList.add(new CharSequence2TokenSequence(tokenPattern)); // pipeList.add(new TokenSequenceRemoveStopwords(false, false)); // // // Remove tokens that contain non-alphabetic characters // pipeList.add(new TokenSequenceRemoveNonAlpha(false)); // Rather than storing tokens as strings, convert // them to integers by looking them up in an alphabet. pipeList.add(new TokenSequence2FeatureSequence()); // Print out the features and the label // pipeList.add(new PrintInputAndTarget()); return new SerialPipes(pipeList); } }
[ "cbadenes@gmail.com" ]
cbadenes@gmail.com
a0f3373d9064d9cd20a405360c69d204ece6edb8
15f2d451a864887b25354aed92541b64e04bd430
/xmen-bracelet-dev/xmen-bracelet-common/src/main/java/com/doshr/xmen/backend/common/Constants.java
40666435d9b834dbad8b32524c9d92bf51854e41
[]
no_license
LeChaPatteImpitoyable/springMVC
20a46df0a67bed529c2ece12ef0c05a51138ce4e
6a1869d0788d0cca2246f3ca9875eb98261f0a13
refs/heads/master
2020-01-19T21:29:35.491689
2017-11-16T06:19:50
2017-11-16T06:19:50
94,217,566
0
0
null
null
null
null
UTF-8
Java
false
false
3,616
java
package com.doshr.xmen.backend.common; public class Constants { public static final String UTF8 = "UTF-8"; public static class DATE_FORMAT { public static final String DATE_FORMAT_NOSPID = "yyyy-MM-dd"; } public static final int NUMBER_FALSE = 0; public static final int NUMBER_TRUE = 1; public static final String SEMICOLON = ";"; public static final String COMMA = ","; public static final String UNDERLINE = "_"; public static final String COLON = ":"; public static final String LINE_SEPARATOR = "\r\n"; public static final int SYNC_COUNT_ONE_TIME = 20; // true false public static final String TRUE = "1"; public static final String FALSE = "0"; public static final int MAX_SIZE = 100; public static final int MIN_SIZE = 10; public static final String SUCCESS = "1"; public static final String FAIL = "0"; public static final long DAY = 24 * 60 * 60 * 1000; public static final long MINUTE = 60 * 1000; public static final String RANDOM_BASE = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; public static final int IS_DELETE = 1; public static final int IS_NOT_DELETE = 0; public static class WEEK_DAY { public static int MONDAY = 1; public static int TUESDAY = 2; public static int WEDNESDAY = 3; public static int THURSDAY = 4; public static int FRIDAY = 5; public static int SATURDAY = 6; public static int SUNDAY = 7; } public static class HTTP_METHOD { public static final String POST = "POST"; public static final String GET = "GET"; } public static class HTTP_CONTENT_TYPE { public static final String HEAD_KEY = "Content-type"; public static final String JSON = "application/json"; public static final String BIN = "application/octet-stream"; public static final String FORM = "application/x-www-form-urlencoded"; public static final String XML = "text/xml"; public static final String IMAGE = "image/png"; public static final String HTML = "text/html"; public static final String CHARSET = "charset"; } public static class NUMBER { public static final int ZERO = 0; public static final int ONE = 1; public static final int TWO = 2; public static final int THREE = 3; public static final int FOUR = 4; public static final int FIVE = 5; public static final int SIX = 6; public static final int SEVEN = 7; public static final int EIGHT = 8; public static final int NINE = 9; public static final int TEN = 10; public static final int ELEVEN = 11; public static final int TWELVE = 12; public static final int THIRTEEN = 13; public static final int FOURTEEN = 14; public static final int TWENTY = 20; public static final int FIFTY = 50; } public static class TIME { public static final long ONE_DAY_MILLS = 24l * 60l * 60l * 1000l; public static final long NINETY_DAY_MILLS = 24l * 60l * 60l * 1000l * 90l; } public static class RELATION_STATUS{ public static final int UNBOUNDED = 0;//未绑定 public static final int BOUNDED = 1;//已绑定 } public static class IS_SIGN_IN{ public static final int NO = 0;//未签到 public static final int YES = 1;//已签到 } public static class EXAMINATION_TYPE{ public static final int SKIP = 1;//跳绳 public static final int RUN_50M = 2;//50m跑步 public static final int RUN_50Mx8 = 3;//50m x8跑步 public static final int SIT_UP = 4;//仰卧起坐 public static final int SEATED_PRECURSOR = 5;//坐位体前驱 public static final int VITAL_CAPACITY = 6;//肺活量 } }
[ "yingshengyu@outlook.com" ]
yingshengyu@outlook.com
76804ba6cc0715bd9b5835a52e6b94b9ca011dbb
01fcde75e9be08df58f487ed466654d847fde16c
/src/main/java/com/eappcat/sync/es/core/SyncableRepository.java
4783f735e392bd76fb5ddd95f64018e9de6387f3
[]
no_license
yuebo/mysql-es-sync
fc4347412e796e8b234465ff981dfe34e507bfce
0e631e98c94af9398721e5dc0297a639d88e69a7
refs/heads/master
2022-06-23T06:43:02.409138
2019-07-26T13:38:12
2019-07-26T13:38:12
198,825,291
1
0
null
2022-06-17T02:20:58
2019-07-25T12:15:23
Java
UTF-8
Java
false
false
406
java
package com.eappcat.sync.es.core; import org.springframework.data.repository.NoRepositoryBean; import java.util.Date; import java.util.stream.Stream; /** * 根据updatedTime字段查询修改, 同步的Repository必须继承此接口 * @param <T> 实体类 */ @NoRepositoryBean public interface SyncableRepository<T> { Stream<T> findByUpdatedTimeAfterAndUpdatedTimeBefore(Date start,Date end); }
[ "317728991@qq.com" ]
317728991@qq.com
4a5df3dac299b616d35a84355bd75eddddab4fee
92155b80a852f01cdbcebc8f008a1d92808ab8c8
/Calificaciones/src/calificaciones/Alumno.java
eff131eb7434351322b793c15c283734a6a224af
[]
no_license
epasquel/Ejercicios
eadc9d6bbabddd63dff103d454066ce5be607312
bf0c92e7c0bc0960da388a631835bbeee3f29a26
refs/heads/master
2021-01-21T22:29:09.132562
2012-04-05T02:22:53
2012-04-05T02:22:53
3,588,322
1
0
null
null
null
null
UTF-8
Java
false
false
1,186
java
package calificaciones; public class Alumno { public Alumno(String codigo, String nombre, String modalidad){ this.codigo = codigo; this.nombre = nombre; this.modalidad = modalidad; if (modalidad.equals("Tradicional")){ calificacion = new CalificacionTradicional(); }else{ calificacion = new CalificacionPractica(); } } private String codigo; private String nombre; private String modalidad; private Calificacion calificacion; public Calificacion getCalificacion() { return calificacion; } public void setCalificacion(Calificacion calificacion) { this.calificacion = calificacion; } public String getCodigo() { return codigo; } public void setCodigo(String codigo) { this.codigo = codigo; } public String getModalidad() { return modalidad; } public void setModalidad(String modalidad) { this.modalidad = modalidad; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } }
[ "epasquel_20@hotmail.com" ]
epasquel_20@hotmail.com
655db9d717b8bc3a2a404655230c445ecd0b7736
070d5261f7ff7e9b72aa3985a893e108c339c606
/src/main/java/zenith/essential/common/crafting/RecipeHandler.java
067dc704f8a22d656883aa7a79052bd1db105392
[]
no_license
EssentialCode/Essential
a5d2cc17dffe993c2c1b863f65b111386b31f077
80119fb05c06d7a64c7cd52affb201bd3e6933a1
refs/heads/master
2016-08-12T23:42:05.376843
2016-04-25T03:13:26
2016-04-25T03:13:26
54,854,086
3
2
null
2016-04-11T20:50:34
2016-03-28T00:14:30
Java
UTF-8
Java
false
false
1,048
java
package zenith.essential.common.crafting; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.apache.logging.log4j.core.Logger; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.util.RegistryNamespaced; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import zenith.essential.common.EssentialLogger; public class RecipeHandler { private static EssentialLogger log = EssentialLogger.getLogger(); public static void postInit() { } }
[ "the.number.zero@gmail.com" ]
the.number.zero@gmail.com
e899643224386953b873baa9f83018de8ee0cec2
dbd18f5ebcee0c451b888ba5c0a1b8c2864f1da8
/src/model/XMLSaveBuilder.java
963c4ae6d9f7ea1369702e513b4db7d2de45fd07
[ "MIT" ]
permissive
DuyTrieu1999/CellSociety_CompSci308
cdff61791208330691eab1864b7f81e9fb8f285f
d77db3be5149fe841da08bfc8c889b5d91c9a59f
refs/heads/master
2020-04-12T16:50:40.392284
2018-10-01T07:40:52
2018-10-01T07:40:52
162,625,757
0
0
null
null
null
null
UTF-8
Java
false
false
4,858
java
package model; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.File; import java.util.ArrayList; import java.util.TreeMap; /** * Class to generate a new XML document from the current state of a CA simulation * Source code taken from: https://examples.javacodegeeks.com/core-java/xml/parsers/documentbuilderfactory/create-xml-file-in-java-using-dom-parser-example/ * @author Austin Kao */ public class XMLSaveBuilder { public void createSave(String filePath, String sim, int gridSize, TreeMap<String, Double> parameterValues, ArrayList<String> saveState) { try { if(Math.pow(gridSize, 2) > saveState.size()) { throw new IllegalArgumentException("There are too few cells being saved for a save file to be created."); } DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbf.newDocumentBuilder(); Document saveDocument = dBuilder.newDocument(); Element root = saveDocument.createElement("simulation"); saveDocument.appendChild(root); Attr authorAttribute = saveDocument.createAttribute("author"); authorAttribute.setValue("team8"); root.setAttributeNode(authorAttribute); Attr nameAttribute = saveDocument.createAttribute("name"); nameAttribute.setValue(sim); root.setAttributeNode(nameAttribute); appendGrid(gridSize, root, saveDocument); appendParameters(parameterValues, root, saveDocument); appendSave(saveState, root, saveDocument); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource domSource = new DOMSource(saveDocument); StreamResult streamResult = new StreamResult(new File(filePath)); transformer.transform(domSource, streamResult); } catch (ParserConfigurationException | TransformerConfigurationException e) { System.out.println("Cannot create save file"); } catch (TransformerException f) { System.out.println("Cannot create save file"); } } private void appendGrid(int gridSize, Element root, Document save) { try { if(gridSize >= 0) { throw new Exception("Invalid grid size. Setting grid to default size of 20."); } Element grid = save.createElement("grid"); root.appendChild(grid); Element size = save.createElement("size"); grid.appendChild(size); String gridSizeString = Integer.toString(gridSize); size.appendChild(save.createTextNode(gridSizeString)); } catch (Exception e) { String gridSizeString = "20"; Element grid = save.createElement("grid"); root.appendChild(grid); Element size = save.createElement("size"); grid.appendChild(size); size.appendChild(save.createTextNode(gridSizeString)); } } private void appendParameters(TreeMap<String, Double> parameterValues, Element root, Document save) { if (parameterValues.size() == 0) { return; } for (String s : parameterValues.keySet()) { Element parameter = save.createElement("parameter"); root.appendChild(parameter); Element variableName = save.createElement("variable_name"); parameter.appendChild(variableName); variableName.appendChild(save.createTextNode(s)); Element variableValue = save.createElement("variable_value"); parameter.appendChild(variableValue); String variableValueString = parameterValues.get(s).toString(); variableValue.appendChild(save.createTextNode(variableValueString)); } } private void appendSave(ArrayList<String> saveState, Element root, Document save) { Element saveElement = save.createElement("save"); root.appendChild(saveElement); for (int i = 0; i < saveState.size(); i++) { Element cellState = save.createElement("cell_state"); saveElement.appendChild(cellState); cellState.appendChild(save.createTextNode(saveState.get(i))); } } }
[ "nitsuaoak@outlook.com" ]
nitsuaoak@outlook.com
10db697ba8bb25f5fb0d2de7a1d095abb97bacde
04b037115376d85fcc773ea39c94d9d13965c10f
/cas-client/src/main/java/com/millinch/casclient/web/DemoFilter.java
4cce7339bda52b79c8fc6033d5f6421f378972cc
[]
no_license
vipup/cas-oauth2-example
e2586d44d86eeb34da2d0d3a14ecd5bacfd7bcd4
5ae5306c93ba39b13e5ab645c514a2f042d502ce
refs/heads/master
2020-05-24T23:58:00.019404
2019-05-20T12:01:57
2019-05-20T12:01:57
187,524,955
0
0
null
2019-05-19T20:30:59
2019-05-19T20:30:58
null
UTF-8
Java
false
false
608
java
package com.millinch.casclient.web; import javax.servlet.*; import java.io.IOException; /** * This guy is busy, nothing left * * @author John Zhang */ public class DemoFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { System.out.println("========= DemoFilter =========="); chain.doFilter(request, response); } @Override public void destroy() { } }
[ "jhzhang@qingyuanos.com" ]
jhzhang@qingyuanos.com
d7c9c12735ace1d4db800b8bdbf1625ca3146055
ca0e9689023cc9998c7f24b9e0532261fd976e0e
/src/com/tencent/mm/ab/a/g/a.java
308459d5cd5a1b4645b219f4493abdd38998481b
[]
no_license
honeyflyfish/com.tencent.mm
c7e992f51070f6ac5e9c05e9a2babd7b712cf713
ce6e605ff98164359a7073ab9a62a3f3101b8c34
refs/heads/master
2020-03-28T15:42:52.284117
2016-07-19T16:33:30
2016-07-19T16:33:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,185
java
package com.tencent.mm.ab.a.g; import android.graphics.Bitmap; import android.graphics.BitmapFactory.Options; import android.widget.ImageView; import com.tencent.mm.ab.a.c; import com.tencent.mm.sdk.platformtools.d; import com.tencent.mm.sdk.platformtools.u; import java.io.IOException; public final class a { public static Bitmap a(c paramc, int paramInt1, int paramInt2, int paramInt3) { if ((paramInt2 <= 0) || (paramInt3 <= 0)) { if ((paramc != null) && (width > 0) && (width > 0)) { return d.t(paramInt1, width, height); } return d.pk(paramInt1); } return d.t(paramInt1, paramInt2, paramInt3); } public static Bitmap a(c paramc, String paramString, int paramInt1, int paramInt2) { if ((paramInt1 <= 0) || (paramInt2 <= 0)) { if ((paramc != null) && (width > 0) && (width > 0)) { return d.v(paramString, width, height); } return d.CE(paramString); } return d.b(paramString, paramInt2, paramInt1, false); } public static Bitmap a(c paramc, byte[] paramArrayOfByte, int paramInt1, int paramInt2) { if ((paramInt1 <= 0) || (paramInt2 <= 0)) { if ((paramc != null) && (width > 0) && (width > 0)) { return d.decodeByteArray(paramArrayOfByte, width, height); } return d.aQ(paramArrayOfByte); } return d.decodeByteArray(paramArrayOfByte, paramInt1, paramInt2); } public static Bitmap b(c paramc, String paramString, int paramInt1, int paramInt2) { int i = 0; BitmapFactory.Options localOptions = d.CB(paramString); if ((localOptions != null) && ((outWidth >= outHeight * 2) || (outWidth * 2 <= outHeight))) { if ((paramInt1 <= 0) || (paramInt2 <= 0)) { if ((paramc != null) && (width > 0) && (width > 0)) { return d.b(paramString, height, width, true); } if ((paramc != null) && (paramc.getImageView() != null)) { paramInt2 = paramc.getImageView().getMeasuredWidth(); } for (paramInt1 = paramc.getImageView().getMeasuredHeight();; paramInt1 = i) { return d.b(paramString, paramInt1, paramInt2, true); u.w("!56@/B4Tb64lLpJ3W0chKRkeCOp5DLdC+H/lICer7FuuuS+ZnxBq04W21w==", "crop bitmap cant not un set width or height"); paramInt2 = 0; } } return d.b(paramString, paramInt2, paramInt1, true); } return d.b(paramString, paramInt2, paramInt1, false); } public static Bitmap c(c paramc, String paramString, int paramInt1, int paramInt2) { if (((paramInt1 > 0) && (paramInt2 > 0)) || (paramc != null)) {} try { if ((width > 0) && (width > 0)) { return d.w(paramString, width, height); } return d.w(paramString, 0, 0); } catch (IOException paramc) { u.e("!56@/B4Tb64lLpJ3W0chKRkeCOp5DLdC+H/lICer7FuuuS+ZnxBq04W21w==", "get bitmap from assert failed. :%s", new Object[] { paramc.toString() }); } paramc = d.w(paramString, paramInt1, paramInt2); return paramc; return null; } } /* Location: * Qualified Name: com.tencent.mm.ab.a.g.a * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
bf5760b005f6ee5c12f3cce0dc0b82b8333d7c85
71437872133fc1611dbc31785ce7dcceef3aa016
/src/io/n7/calendar/alerts/NotificationMgr.java
fb699b703b130f843ee5d7e3f2f8ee9974bd5300
[ "Apache-2.0" ]
permissive
n7io/n7io-android-calendar
6d8e5c18459cd46b6aa18e19d01f6f7c9c4f8408
b1a159df727bf25e15c3f9d6eaf77e7e58886029
refs/heads/master
2020-05-18T08:29:40.073236
2012-09-07T13:53:12
2012-09-07T13:53:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package io.n7.calendar.alerts; import io.n7.calendar.alerts.AlertService.NotificationWrapper; public interface NotificationMgr { public void cancel(int id); public void cancel(String tag, int id); public void cancelAll(); public void notify(int id, NotificationWrapper notification); public void notify(String tag, int id, NotificationWrapper notification); }
[ "w@n7.io" ]
w@n7.io
c520ed5ae52624c1e865abeb2ff57218a176d828
17540fab250e8aaa65fd2186c3f236b4f92a964f
/JavaCode/Chapter6/src/array/ObjectCopy.java
be9dd9af7e49c9404428826625044f657b3144f2
[]
no_license
sungjoonpark3/JavaCode
34429ad5987995899d90b0e4ac6d330b52a074f4
362093e259a4314cc4b0985c1f650732d28538ea
refs/heads/master
2020-08-01T11:06:40.950398
2019-10-02T06:30:10
2019-10-02T06:30:10
210,977,862
1
0
null
null
null
null
UHC
Java
false
false
1,175
java
package array; //객체의 배열의 복사 public class ObjectCopy { public static void main(String[] args) { //배열의 공간 할당 Book[] library = new Book[5]; Book[] copyLibaray = new Book[5]; //값을 할당 library[0] = new Book("태백산맥1","조정래"); library[1] = new Book("태백산맥2","조정래"); library[2] = new Book("태백산맥3","조정래"); library[3] = new Book("태백산맥4","조정래"); library[4] = new Book("태백산맥5","조정래"); copyLibaray[0] = new Book(); copyLibaray[1] = new Book(); copyLibaray[2] = new Book(); copyLibaray[3] = new Book(); copyLibaray[4] = new Book(); //향상된 for문을 사용 for(int i =0; i<library.length;i++) { //책의 상태를 출력 copyLibaray[i].setTitle(library[i].getTitle()); copyLibaray[i].setAuthor(library[i].getAuthor()); } //얕은복사구간 library[0].setTitle("나목"); library[0].setAuthor("박완서"); for(Book book : library) { book.showBookInfo(); } System.out.println("============="); for(Book book:copyLibaray) { book.showBookInfo(); } } }
[ "NewPark@DESKTOP-7CRB3P7" ]
NewPark@DESKTOP-7CRB3P7
09383e291bd0bea4e98f979446f633040a32f94b
08e198c0677662c2c179032dfa427925313641e9
/pet-clinic-web/src/main/java/io/artur/spring/sfgpetclinic/controllers/OwnerController.java
3e634f7e270486cfc64f517459795dc7c94f7a48
[]
no_license
arturP/sfg-pet-clinic
91f9383a1be4acb8a2420c5604a0c47f4e686a6a
b1f762410646413972534a818b5050a3da7110af
refs/heads/main
2023-08-22T09:57:03.649787
2021-10-11T09:58:36
2021-10-11T09:58:36
413,517,131
0
0
null
null
null
null
UTF-8
Java
false
false
834
java
package io.artur.spring.sfgpetclinic.controllers; import io.artur.spring.sfgpetclinic.services.OwnerService; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; /** * */ @RequestMapping({"/owners"}) @Controller public class OwnerController { private final OwnerService ownerService; public OwnerController(OwnerService ownerService) { this.ownerService = ownerService; } @RequestMapping({"", "/", "/index", "/index.html"}) public String listOfOwners(Model model) { model.addAttribute("owners", ownerService.findAll()); return "owners/index"; } @RequestMapping({"/find"}) public String findOwners() { return "notimplemented"; } }
[ "artur2p@gmail.com" ]
artur2p@gmail.com
bb250f279322758da99f307512e41a20a48bc739
d49c51b0d7d3d3c6651888f094a68fecef4e9b0b
/Day3_Assignments(16 Dec)/src/day3_assignments/DriversLicenseRegex.java
a7c6c1563dd448288c5ba6d052f5ec763f9828ff
[]
no_license
SnoWhite93/RevatureTraining
2c74c715ab30a978bd7c35f697c801499c52df16
e6657494e4eec508215af06b88832274bc7b8173
refs/heads/master
2023-02-17T10:17:52.980757
2021-01-12T04:07:43
2021-01-12T04:07:43
321,419,206
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
package day3_assignments; public class DriversLicenseRegex { public static void main(String[] args) { String dl = "L8509 20058 54727"; if (dl.matches("[A-Z]{1,1}[0-9]{4} [0-9]{5} [0-9]{5}")) { System.out.println("Valid driver's license"); } else { System.out.println("Invalid driver's license"); } } }
[ "illeanabledea@gmail.com" ]
illeanabledea@gmail.com
27594daa02e7032edc0cd97c3709bb14919cf507
4a3406afd3f9c30ff9debe06bed1b700a5ea4e14
/src/main/java/feignclientexample/demo/DemoApplication.java
f257c1249daf965191076b41d098ba349a03f0f8
[]
no_license
training04221/feign-client-example101
aeca580c01db032c870e6e9f627d36c7cf7d0497
29027b011437e85abda93c0fe4196d5f0e19e5e4
refs/heads/master
2022-04-24T02:10:45.218821
2019-10-14T00:48:43
2019-10-14T00:48:43
258,376,768
0
0
null
null
null
null
UTF-8
Java
false
false
407
java
package feignclientexample.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication @EnableFeignClients public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "avvaru79.java@mail.com" ]
avvaru79.java@mail.com
152e86d89b10f5688dedca2af3d1eddd1d664ffd
66c533d84b276e2278a9100b7c520918a2d9109d
/src/main/java/com/digitalinnovationone/heroesapi/constants/HeroesConstant.java
2665b525aa32a9af6ee669046e33414d00fb6b21
[]
no_license
Lazaro-oliveira/heroesapi
cad35436ce5432e7f0e87e2faabcc363b0c9db10
cf58db32f4a4647d706aa16aca7eb38eb924a98e
refs/heads/master
2023-04-13T19:21:42.859039
2021-04-20T19:35:14
2021-04-20T19:35:14
359,927,569
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package com.digitalinnovationone.heroesapi.constants; public class HeroesConstant { public static final String HEROES_ENDPOINT_LOCAL="/heroes"; public static final String ENDPOINT_DYNAMO= "http://localhost:8000"; public static final String REGION_DYNAMO= "us-east-2"; }
[ "lazarobpmg@hotmail.com" ]
lazarobpmg@hotmail.com
925a85ff236fa047749143ce8046cf13d6c8e61f
fa03b475ea339f4c78ef639e9d6f5aa10ad3c7a1
/CatsAndJokes/app/src/main/java/com/am/demo/catsandjokes/model/cats/CatsResponse.java
3e0c1da849d602d6037514961991ecd71471407d
[]
no_license
malbor806/Android-Projects
73685d835e92396f07ee32d84af57c5d8c999e8c
b819fdacf7e40ecf847a73da0ffeb57f472ebe36
refs/heads/master
2021-03-27T10:25:23.437794
2017-05-28T18:08:51
2017-05-28T18:08:51
92,294,823
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
package com.am.demo.catsandjokes.model.cats; import org.simpleframework.xml.Element; import org.simpleframework.xml.Root; /** * Created by malbor806 on 24.05.2017. */ @Root(name = "response") public class CatsResponse { @Element(name = "data") private CatsDataImages catsImages; public CatsDataImages getCatsDataImages() { return catsImages; } public void setCatsDataImages(CatsDataImages catsImages) { this.catsImages = catsImages; } }
[ "malbor806@gmail.com" ]
malbor806@gmail.com
dac471598ec54f7bbf9e42c3ddafcd0e1842db23
3cd1a5b64b8096fa837198ee8000d970d1f6a367
/project/vcmi-app/src/main/java/eu/vcmi/vcmi/mods/VCMIModContainer.java
3c8f4ffd74c5610db111b58dbd5b3a0fc2ab2756
[]
no_license
Fayth/vcmi-android
36e73b3e86986ed3172427c8f87b84f6c4dcab4d
e8ec115e7603e45d07a1f4f93f50cb6d4b2a4c89
refs/heads/master
2021-01-01T17:34:15.944394
2017-07-22T17:33:36
2017-07-22T17:33:36
74,500,286
3
0
null
null
null
null
UTF-8
Java
false
false
2,350
java
package eu.vcmi.vcmi.mods; import android.text.TextUtils; import org.json.JSONException; import org.json.JSONObject; import java.io.File; import java.io.IOException; import java.util.List; import eu.vcmi.vcmi.BuildConfig; import eu.vcmi.vcmi.util.FileUtil; import eu.vcmi.vcmi.util.Log; /** * @author F */ public class VCMIModContainer extends VCMIMod { private VCMIMod mCoreStatus; // kept here to correctly save core object to modSettings private VCMIModContainer() { } public static VCMIModContainer createContainer(final List<File> modsList) throws IOException, JSONException { final VCMIModContainer mod = new VCMIModContainer(); mod.mSubmods.putAll(loadSubmods(modsList)); return mod; } public void updateContainerFromConfigJson(final JSONObject modsList, final JSONObject coreStatus) throws JSONException { updateChildrenFromConfigJson(modsList); if (coreStatus != null) { mCoreStatus = VCMIMod.buildFromConfigJson("core", coreStatus); } } @Override public String toString() { if (!BuildConfig.DEBUG) { return ""; } return String.format("mods:[%s]", TextUtils.join(",", mSubmods.values())); } public void saveToFile(final File location) { try { FileUtil.write(location, toJson()); } catch (Exception e) { Log.e(this, "Could not save mod settings", e); } } protected String toJson() throws JSONException { final JSONObject root = new JSONObject(); final JSONObject activeMods = new JSONObject(); final JSONObject coreStatus = new JSONObject(); root.put("activeMods", activeMods); submodsToJson(activeMods); coreStatusToJson(coreStatus); root.put("core", coreStatus); return root.toString(); } private void coreStatusToJson(final JSONObject coreStatus) throws JSONException { if (mCoreStatus == null) { mCoreStatus = new VCMIMod(); mCoreStatus.mId = "core"; mCoreStatus.mActive = true; } mCoreStatus.toJsonInternal(coreStatus); } }
[ "no.email@at.all" ]
no.email@at.all
22f9c7a4120137f0cfe17526a842aca615a9049a
08f7514c2267bcd9fa05a6eb6fae566568a1931c
/foodee_service/src/main/java/com/ialcoholic/foodees/foodee_service/models/restaurant/Table.java
fb8463c3a8258a2a2b494cb19cce1acfc3e68a28
[]
no_license
SJ47/fooDee_ialc_version
03842d3630493f634879f686abb97bce18bb3892
fb7e75f249598b525ec68f33d92b74816c81b581
refs/heads/main
2023-04-17T19:14:38.712562
2021-05-02T10:13:56
2021-05-02T10:13:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,983
java
package com.ialcoholic.foodees.foodee_service.models.restaurant; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.ialcoholic.foodees.foodee_service.models.people.Customer; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @javax.persistence.Table(name = "tables") public class Table { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne @JsonIgnoreProperties({"tables"}) @JoinColumn(name = "restaurant_id", nullable = false) private Restaurant restaurant; @Column(name = "table_number") private int tableNumber; @Column(name = "capacity") private int capacity; @JsonIgnoreProperties(value="table") @OneToMany(mappedBy = "table", fetch = FetchType.LAZY) private List<Customer> customers; public Table(Restaurant restaurant, int tableNumber, int capacity) { this.restaurant = restaurant; this.tableNumber = tableNumber; this.capacity = capacity; this.customers = new ArrayList<>(); } public Table() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Restaurant getRestaurant() { return restaurant; } public void setRestaurant(Restaurant restaurant) { this.restaurant = restaurant; } public int getTableNumber() { return tableNumber; } public void setTableNumber(int tableNumber) { this.tableNumber = tableNumber; } public int getCapacity() { return capacity; } public void setCapacity(int capacity) { this.capacity = capacity; } public List<Customer> getCustomers() { return customers; } public void setCustomers(List<Customer> customers) { this.customers = customers; } public void addCustomer(Customer customer) { this.customers.add(customer); } }
[ "laureline.vaucoy@gmail.com" ]
laureline.vaucoy@gmail.com
77571cc9cd2249edac0557cf07719f020d13cd60
d11683d3778b2d85d83379009252752078049535
/src/main/java/com/bx/community/exception/ICustomizeErrorCode.java
28ebe88171570e46eabf89376adebf9e3097dfd2
[]
no_license
bxxiao/community
9c468c14ea92e9b19bb4b7cfe56e7ee6a85d0d05
2c3aeff864648fef61a6d3f538f25aeaeb890b36
refs/heads/master
2023-04-04T05:41:27.480332
2021-04-01T11:15:52
2021-04-01T11:15:52
342,900,441
1
0
null
null
null
null
UTF-8
Java
false
false
127
java
package com.bx.community.exception; public interface ICustomizeErrorCode { String getMessage() ; Integer getCode(); }
[ "945143470@qq.com" ]
945143470@qq.com
fe755302fa892be3b2caec4a8a5190e5f3a1ff47
69c50f232ccfc6a30202e7dd55949026756935b1
/workspace/animais/src/aula_II/testa.java
229cc98fa9438b4514273156a119dc11775e1bf7
[]
no_license
ramonms/Uniritter-OO
a668e8c0fa1d600e9b8855237d44c292359ce7e0
0f1b69b0560bf3539d746b18f7224dc54ed6eba0
refs/heads/master
2016-08-04T04:49:34.562932
2014-06-15T03:53:05
2014-06-15T03:53:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,000
java
package aula_II; import static org.junit.Assert.*; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; public class testa { @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void test() { //fail("Not yet implemented"); contaCorrente itau = new contaCorrente(500F); assertEquals(500,itau.getSaldo(),0.001); } @Test public void test2() { poupanca poup = new poupanca(); poup.setSaldo(poup.getSaldo()+200F); assertEquals(300,poup.getSaldo(),0.001); } @Test public void testSaque() { contaCorrente itau = new contaCorrente(500F); try { itau.sacar(150F); assertEquals(100,itau.getSaldo(),0.001); } catch (Exception e) { fail(); } } }
[ "ramonmartins@msn.com" ]
ramonmartins@msn.com
44908b323a86bd15cbe6daad327b0f53357723f6
c99839ed46e23c52e8ed060f820b7faa20f06205
/kasper-test/src/test/java/com/viadeo/kasper/KasperTestIdGenerator.java
52df45dc3d3fe3b0443a032057cca1d85108a466
[]
no_license
mglcel/kasper-framework-1
f434fddd427d46a99d9d32ffd5cd6d7b0aeaf711
35300a96e9e53bacd2f4c94a589f4e1ee2f51f9a
refs/heads/master
2021-01-22T16:38:53.439514
2015-02-20T20:00:46
2015-02-20T20:00:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
916
java
// ============================================================================ // KASPER - Kasper is the treasure keeper // www.viadeo.com - mobile.viadeo.com - api.viadeo.com - dev.viadeo.com // // Viadeo Framework for effective CQRS/DDD architecture // ============================================================================ package com.viadeo.kasper; import org.axonframework.domain.IdentifierFactory; public final class KasperTestIdGenerator { private KasperTestIdGenerator() { /* singleton */ } @SuppressWarnings("unchecked") // Delegated to client public static <I extends KasperID> I get() { final String uuid = IdentifierFactory.getInstance().generateIdentifier(); return (I) new KasperTestId(uuid); } @SuppressWarnings("unchecked") // Delegated to client public static <I extends KasperID> I get(final String id) { return (I) new KasperTestId(id); } }
[ "ldiasdasilva@viadeoteam.com" ]
ldiasdasilva@viadeoteam.com
2567043aaff4bffe806e822a815a2502e46858d4
d568213727b1b5d839a70def1b0553857bceadd8
/plugins/Navigator/surfacesandregions/XYFootprint.java
dc5210db7938596dc0cc9c351c11c7eb816db3aa
[]
no_license
ra138212/micromanager-upstream
c2bc7e7043efb5e105b9c2bac7bbd6f12ac62830
e3dfaa9c79720a84d22463162d885c88f4ac74ef
refs/heads/master
2021-01-18T11:23:32.432834
2015-01-29T01:44:41
2015-01-29T01:44:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package surfacesandregions; import coordinates.XYStagePosition; import java.util.ArrayList; /** * * @author Henry */ public interface XYFootprint { public ArrayList<XYStagePosition> getXYPositions(); }
[ "henry@d0ab736e-dc22-4aeb-8dc9-08def0aa14fd" ]
henry@d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
89fc1d7d40ea3eec7c70a9515699e8ee13334d74
218dae5ac2e4e9cfe38b79e4e1a35ade9550d3d2
/thriftserver/session/src/main/java/org/apache/livy/thriftserver/session/SqlJob.java
849c0575175c762214df39b2703fec7462571c0d
[ "MIT", "Apache-2.0" ]
permissive
RogPodge/incubator-livy
c7a34ff3a2b21228ea3386ea9e40e7cb7852a756
46276f26fa651083c285250dac8bd65e49349c50
refs/heads/master
2021-08-07T16:49:09.837474
2020-02-04T21:26:09
2020-02-04T21:26:09
204,087,523
0
1
Apache-2.0
2019-08-24T00:23:45
2019-08-24T00:23:45
null
UTF-8
Java
false
false
2,885
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.livy.thriftserver.session; import java.util.Iterator; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; import org.apache.spark.sql.types.StructType; import org.apache.livy.Job; import org.apache.livy.JobContext; /** * A Job implementation for executing SQL queries in a Livy session. */ public class SqlJob implements Job<Void> { private final String sessionId; private final String statementId; private final String statement; private final String defaultIncrementalCollect; private final String incrementalCollectEnabledProp; public SqlJob() { this(null, null, null, null, null); } public SqlJob( String sessionId, String statementId, String statement, String defaultIncrementalCollect, String incrementalCollectEnabledProp) { this.sessionId = sessionId; this.statementId = statementId; this.statement = statement; this.defaultIncrementalCollect = defaultIncrementalCollect; this.incrementalCollectEnabledProp = incrementalCollectEnabledProp; } @Override public Void call(JobContext ctx) throws Exception { ctx.sc().setJobGroup(statementId, statement); try { executeSql(ctx); } finally { ctx.sc().clearJobGroup(); } return null; } private void executeSql(JobContext ctx) throws Exception { ThriftSessionState session = ThriftSessionState.get(ctx, sessionId); SparkSession spark = session.spark(); Dataset<Row> df = spark.sql(statement); StructType schema = df.schema(); boolean incremental = Boolean.parseBoolean( spark.conf().get(incrementalCollectEnabledProp, defaultIncrementalCollect)); Iterator<Row> iter; if (incremental) { iter = new ScalaIterator<>(df.rdd().toLocalIterator()); } else { iter = df.collectAsList().iterator(); } // Register both the schema and the iterator with the session state after the statement // has been executed. session.registerStatement(statementId, schema, iter); } }
[ "vanzin@cloudera.com" ]
vanzin@cloudera.com
7b20dc3a2b390d76e92d0463474d29ff968b7d08
f0a28a8b5be64adbd6111c577a63d4deec64446d
/CoCoFrame/src/org/hnyy/core/utils/ApplicationContextUtil.java
332bc6ff968d1e9ff4036105b12ffd542646ad36
[]
no_license
xieHub/CoCoFrame
f64082ef98b70a5f95675f1e3ef91f471591aa78
399904a1e6e7499e68936d4ac3aa998306b9119e
refs/heads/master
2021-01-10T01:19:03.268206
2015-12-10T06:02:09
2015-12-10T06:02:09
47,740,941
0
0
null
null
null
null
UTF-8
Java
false
false
2,238
java
package org.hnyy.core.utils; import java.io.File; import java.util.Collections; import java.util.Set; import java.util.TreeSet; import javax.servlet.ServletContext; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; /** * spring 上下文工具类 * @author XieDa * */ public class ApplicationContextUtil implements ApplicationContextAware { private static ApplicationContext applicationContext; private static ServletContext servletContext; private static Set<String> sessions = Collections.synchronizedSet(new TreeSet<String>()); public static void init(ServletContext _servletContext) { servletContext = _servletContext; } public void setApplicationContext(ApplicationContext context) throws BeansException { applicationContext = context; } public static ApplicationContext getContext() { return applicationContext; } public static ServletContext getServletContext() throws Exception { return servletContext; } public static <T> T getBean(Class<T> cls) { return applicationContext.getBean(cls); } public static Object getBean(String beanId) { return applicationContext.getBean(beanId); } public static String getAppAbsolutePath() { return servletContext.getRealPath("/"); } public static String getRealPath(String path) { return servletContext.getRealPath(path); } public static String getClasspath() { String classPath = Thread.currentThread().getContextClassLoader() .getResource("").getPath(); String rootPath = ""; if ("\\".equals(File.separator)) { rootPath = classPath.substring(1); rootPath = rootPath.replace("/", "\\"); } if ("/".equals(File.separator)) { rootPath = classPath.substring(1); rootPath = rootPath.replace("\\", "/"); } return rootPath; } public static Set<String> getSessions() { return sessions; } public static void setSessions(Set<String> sessions) { ApplicationContextUtil.sessions = sessions; } public static void removeSession(String sessionId){ Set<String> s = ApplicationContextUtil.getSessions(); if(StringUtil.isNotEmpty(s) && s.size()>0){ s.remove(sessionId); } } }
[ "coder_da@sina.com" ]
coder_da@sina.com
7d91171080745208376edb62c8c6126df4de0f96
a5f2262593cf5cbc4cd13c72efbaf851142513b6
/src/controlescolar/controller/alumno/LoginController.java
d257078d2a127f4244064c9db6c315b824470e16
[]
no_license
HugoLuna5/Control-Escolar
8a4f74ce0bcb6cf054ace8893e17707de688ead3
ddabe0ce88241152063c519c8c955a203edf95b6
refs/heads/master
2020-05-19T11:07:16.989511
2019-05-05T05:35:34
2019-05-05T05:35:34
176,040,815
0
0
null
null
null
null
UTF-8
Java
false
false
4,835
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 controlescolar.controller.alumno; import controlescolar.controller.admin.AdminLoginController; import controlescolar.model.Alumno; import controlescolar.model.Login; import controlescolar.view.HomeView; import controlescolar.view.LoginView; import controlescolar.view.components.Toaster.Toaster; import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import java.util.prefs.Preferences; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import javax.swing.JColorChooser; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; /** * * @author hugoluna */ public class LoginController implements ActionListener { //variales globales private LoginView loginView; private Toaster toaster; /*** * Constructor de la clase * @param loginView */ public LoginController(LoginView loginView) { this.loginView = loginView; this.loginView.btnEntrar.addActionListener(this); this.loginView.btnResetPass.addActionListener(this); this.loginView.btnActionHelp.addActionListener(this); this.loginView.btnRegistrar.addActionListener(this); this.loginView.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == loginView.btnEntrar) { actionBtnEntrar(); } else if (e.getSource() == loginView.btnRegistrar) { actionBtnRegister(); } else if (e.getSource() == loginView.btnResetPass) { actionResetPass(); } else if (e.getSource() == loginView.btnActionHelp) { actionHelp(); } } /*** * Accion pata el boton Entrar */ public void actionBtnEntrar() { //se extrae el texto de los campos en la vista String numControl = loginView.numField.getText().toString(); String password = loginView.passField.getText().toString(); //inicializar vista para avisos en la vista toaster = new Toaster(this.loginView.mainContainer); //validar que no sean vacios los valores if (!numControl.isEmpty() && !password.isEmpty()) { Alumno alumno = new Alumno(); alumno.setNumControl(Integer.parseInt(numControl)); alumno.setPassword(password); /** * Esperar respuesta de la BD * */ if (new Login().loginAlumn(alumno)) { toaster.success("¡Genial!", "Has ingresado correctamente"); savePreferences(String.valueOf(alumno.getNumControl())); this.loginView.setVisible(false);//hacer la vista invisible //llamar al controlador el cual lanzara la siguiente vista new HomeController(new Alumno().getData(alumno.getNumControl()), new HomeView()); } else {//en caso de que suceda un error, informarle al usuario que esta pasando toaster.error("¡Ups ocurrio un error!", "Es posible que los datos no existan en nuestros registros"); } } else { toaster.info("¡Ups!.", "Debes llenar los campos para ingresar"); } } /*** * Accion del boton registrar * el cual lanza la interfaz para el Admin */ public void actionBtnRegister() { this.loginView.setVisible(false); new AdminLoginController(new LoginView()); } /*** * Accion para resetear la contraseña */ public void actionResetPass() { } /*** * Accion para solicitar ayuda */ public void actionHelp() { try { Desktop.getDesktop().browse(new URI("https://google.com")); } catch (Exception ex) { Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex); } } /*** * Guardar los datos de los alumnos en las preferencias * @param id */ public void savePreferences(String id) { Preferences prefs = Preferences.userNodeForPackage(controlescolar.controller.alumno.LoginController.class); final String PREF_NAME = "id"; final String PREF_TYPE = "type"; prefs.put(PREF_NAME, id); prefs.put(PREF_TYPE, "alumno"); } }
[ "hugo_1199@hotmail.com" ]
hugo_1199@hotmail.com
29beb3b79c1c1ec5908932fe7aa1ee615373d96d
4c95a768d51fa00fc9790efad86c16b17b8b4cab
/src/com/example/concurrency/DataShatingBetweenThreads.java
0a732ab7394e30f3745aa56cd6bd7c294b022fee
[]
no_license
arunkumarvgk/concurrency
b6087fb4bfd4169ed4f2b084bd9d41cb983ba8b3
d324b37836317ed3566777e7555117e177a18f5b
refs/heads/master
2022-12-14T07:09:58.932379
2020-09-11T18:48:24
2020-09-11T18:48:24
293,299,177
0
0
null
null
null
null
UTF-8
Java
false
false
859
java
package com.example.concurrency; final class Inventory { private int items; public void incItems() { items++; } public void decItems() { items--; } public int getItemsCount() { return items; } } public class DataShatingBetweenThreads { public static void main(String[] args) throws InterruptedException { // When ever something created with new willl be in heap final Inventory inventory = new Inventory(); final Thread incrementThread = new Thread(() -> { for (int i = 0; i < 1000; i++) { inventory.incItems(); } }); final Thread decrementThread = new Thread(() -> { for (int i = 0; i < 1000; i++) { inventory.decItems(); } }); incrementThread.start(); incrementThread.join(); decrementThread.start(); decrementThread.join(); System.out.println(inventory.getItemsCount()); } }
[ "arunkumarvgk@gmail.com" ]
arunkumarvgk@gmail.com
db4dc79ace47907057a6d64d181e4d10e1a1950b
392b98795068164ed0c186a760c72290e5f7bb6a
/serenity-browserstack/src/test/java/net/serenitybdd/browserstack/WhenAddingBrowserStackCapabilities.java
11d8bd0b960d74785c668ff366806eeb86b6d2e4
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
cuneytcalishkan/serenity-core
fd3834fdd1a755552c0d8000541279f29106f936
658c2322f69fb926f4293d889abce14ff58ecdb0
refs/heads/master
2023-05-31T16:41:25.407268
2021-07-10T07:29:47
2021-07-10T07:29:47
384,783,331
0
0
NOASSERTION
2021-07-10T20:23:38
2021-07-10T20:23:38
null
UTF-8
Java
false
false
5,004
java
package net.serenitybdd.browserstack; import net.serenitybdd.core.webdriver.OverrideDriverCapabilities; import net.serenitybdd.core.webdriver.driverproviders.AddCustomDriverCapabilities; import net.thucydides.core.model.Story; import net.thucydides.core.model.TestOutcome; import net.thucydides.core.util.EnvironmentVariables; import net.thucydides.core.util.MockEnvironmentVariables; import net.thucydides.core.webdriver.SupportedWebDriver; //import org.junit.Before; //import org.junit.Test; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.openqa.selenium.remote.DesiredCapabilities; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; public class WhenAddingBrowserStackCapabilities { EnvironmentVariables environmentVariables = new MockEnvironmentVariables(); private static final TestOutcome SAMPLE_TEST_OUTCOME = TestOutcome.forTestInStory("sample_test", Story.called("Sample story")); @BeforeEach public void prepareSession() { OverrideDriverCapabilities.clear(); } @Test public void theBrowserNameShouldBeAddedDirectlyToTheCapability() { DesiredCapabilities capabilities = DesiredCapabilities.chrome(); AddCustomDriverCapabilities.from(environmentVariables) .withTestDetails(SupportedWebDriver.REMOTE, SAMPLE_TEST_OUTCOME) .to(capabilities); assertThat(capabilities.getBrowserName()).isEqualTo("chrome"); } @Test public void theBrowserNameCanBeSpecifiedInTheBrowserStackConfiguration() { DesiredCapabilities capabilities = new DesiredCapabilities(); environmentVariables.setProperty("browserstack.browserName","IE"); AddCustomDriverCapabilities.from(environmentVariables) .withTestDetails(SupportedWebDriver.REMOTE, SAMPLE_TEST_OUTCOME) .to(capabilities); assertThat(capabilities.getBrowserName()).isEqualTo("IE"); } @Test public void theBrowserVersionCanBeSpecifiedInTheBrowserStackConfiguration() { DesiredCapabilities capabilities = new DesiredCapabilities(); environmentVariables.setProperty("browserstack.browserVersion","11.0"); AddCustomDriverCapabilities.from(environmentVariables) .withTestDetails(SupportedWebDriver.REMOTE, SAMPLE_TEST_OUTCOME) .to(capabilities); assertThat(capabilities.getCapability("browserVersion")).isEqualTo("11.0"); } @Test public void theBrowserNameAndVersionCanBeOverridenAtRunTime() { DesiredCapabilities capabilities = new DesiredCapabilities(); environmentVariables.setProperty("browserstack.browserName","IE"); environmentVariables.setProperty("browserstack.browserVersion","11.0"); OverrideDriverCapabilities.withProperty("browserstack.browserName").setTo("Chrome"); OverrideDriverCapabilities.withProperty("browserstack.browserVersion").setTo("78"); AddCustomDriverCapabilities.from(environmentVariables) .withTestDetails(SupportedWebDriver.REMOTE, SAMPLE_TEST_OUTCOME) .to(capabilities); assertThat(capabilities.getBrowserName()).isEqualTo("Chrome"); assertThat(capabilities.getCapability("browserVersion")).isEqualTo("78"); } @Test public void osNameIsAssignedToBrowserStackSection() { DesiredCapabilities capabilities = new DesiredCapabilities(); environmentVariables.setProperty("browserstack.os","Windows"); AddCustomDriverCapabilities.from(environmentVariables) .withTestDetails(SupportedWebDriver.REMOTE, SAMPLE_TEST_OUTCOME) .to(capabilities); assertThat(bstackOptionsFrom(capabilities).get("os")).isEqualTo("Windows"); } @Test public void osNameCanBeOverridenAtRuntime() { DesiredCapabilities capabilities = new DesiredCapabilities(); environmentVariables.setProperty("browserstack.os","Windows"); OverrideDriverCapabilities.withProperty("browserstack.os").setTo("OS X"); AddCustomDriverCapabilities.from(environmentVariables) .withTestDetails(SupportedWebDriver.REMOTE, SAMPLE_TEST_OUTCOME) .to(capabilities); assertThat(bstackOptionsFrom(capabilities).get("os")).isEqualTo("OS X"); } @Test public void theSessionNameShouldBeTakenFromTheNameOfTheTest() { // Given DesiredCapabilities capabilities = DesiredCapabilities.chrome(); AddCustomDriverCapabilities.from(environmentVariables) .withTestDetails(SupportedWebDriver.REMOTE, SAMPLE_TEST_OUTCOME) .to(capabilities); assertThat(bstackOptionsFrom(capabilities).get("sessionName")).isEqualTo("Sample story - Sample test"); } private Map<String,String> bstackOptionsFrom(DesiredCapabilities capabilities) { return (Map<String, String>) capabilities.getCapability("bstack:options"); } }
[ "john.smart@wakaleo.com" ]
john.smart@wakaleo.com
3f6d150a1a740afb8e4c0516e845b3c513bf9efb
a30a6e8bb02d819d2f3a8455c053845b0a108839
/src/main/java/com/senpure/io/support/plugin/intellij/structure/IoStructureViewModel.java
f7a15d123139aa946f19614073446edd6bd95d27
[]
no_license
senpure/senpure-io-support-plugin-intellij
f3a48e49f595213f5afb09e06a849a62fa112b94
66f75ca8be127b2fddfeaa6b6b27bd87fc3f4eca
refs/heads/master
2020-06-04T14:41:51.660119
2020-03-30T00:35:23
2020-03-30T00:35:23
192,065,842
0
0
null
null
null
null
UTF-8
Java
false
false
1,035
java
package com.senpure.io.support.plugin.intellij.structure; import com.intellij.ide.structureView.StructureViewModel; import com.intellij.ide.structureView.StructureViewModelBase; import com.intellij.ide.structureView.StructureViewTreeElement; import com.intellij.ide.util.treeView.smartTree.Sorter; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; /** * IoStructureViewModel * * @author senpure * @time 2019-06-18 20:04:24 */ public class IoStructureViewModel extends StructureViewModelBase implements StructureViewModel.ElementInfoProvider { public IoStructureViewModel(@NotNull PsiFile psiFile) { super(psiFile, new IoEntityView(psiFile)); } @NotNull public Sorter[] getSorters() { return new Sorter[]{Sorter.ALPHA_SORTER}; } @Override public boolean isAlwaysShowsPlus(StructureViewTreeElement element) { return false; } @Override public boolean isAlwaysLeaf(StructureViewTreeElement element) { return false; } }
[ "senpure@senpure.com" ]
senpure@senpure.com
3c0cb702a4d35fb5838a6f7705d74971078c91fe
eb3b6bb676c238b3623b4d93d649947f74f0e8a0
/edumanage/springboot/src/main/java/com/qifangli/edumanage/dao/mapper/ScoreMapper.java
78475a1398d13cc92b88078861c30f97262f018a
[]
no_license
Buttersmark/EduAdmSys
161c19004d248e50a8f12a95dcb21f0740f66e8e
e8f7b3b905128fd10a2fdb151f6934eb9fbf6a59
refs/heads/master
2023-03-07T22:21:09.279059
2021-02-20T03:56:58
2021-02-20T03:56:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,658
java
package com.qifangli.edumanage.dao.mapper; import com.qifangli.edumanage.dao.entity.Score; import com.qifangli.edumanage.dao.entity.Student; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.dao.DataAccessException; import java.util.List; @Mapper public interface ScoreMapper { /** * 查询这个学生的所有成绩,未使用 * @param id * @return */ Score findScoreByStuId(@Param("id") String id); /** * 学生选课,在score表里添加 * @param stuId * @param teaCrsId * @throws DataAccessException 如果重复选课抛出 */ void addCrs(@Param("stuId") String stuId,@Param("teaCrsId") String teaCrsId) throws DataAccessException; /** * 学生退课,在score表里删除 * @param stuId * @param teaCrsId * @throws DataAccessException 如果达到最大退课人数抛出 */ void deleteCrs(@Param("stuId") String stuId,@Param("teaCrsId") String teaCrsId) throws DataAccessException; /** * 查学生的平均分,在学生基本信息里面显示 * @param id * @return */ Double findAvgScore(@Param("id") String id); /** * 查学生总学分,在学生基本信息里面显示 * @param id * @return */ Integer findSumCredit(@Param("id") String id); /** * 教师,学生成绩(教学班级名单) * @param tcno * @return */ List<Score> findScoreByTC(@Param("tcno") String tcno); /** * 教师更新成绩 * @param score * @return */ int updateScore(Score score); }
[ "2734189761@qq.com" ]
2734189761@qq.com
1fd921eb1ce01aadc3e8219e7018ba0d4f0c2adf
c285d77eac4e36fa2864193a19ebc6a74164cbfd
/src/main/java/com/systech/mss/repository/impl/PermissionsClaimOfficerRepositoryImpl.java
7801f06ec87644a618928106ba0411a6fe6d412c
[]
no_license
newtonkarumba/DemoMss
a681c9f92c0e5553227bd4bfe72f74668cae9a20
082785b4167ffedcb08e0ab6919421c847a8c7d6
refs/heads/main
2023-06-30T10:51:00.686677
2021-08-04T15:11:28
2021-08-04T15:11:28
392,718,708
0
0
null
null
null
null
UTF-8
Java
false
false
4,788
java
package com.systech.mss.repository.impl; import com.systech.mss.controller.vm.PermissionsBillingOfficerVM; import com.systech.mss.controller.vm.PermissionsClaimReviewerVM; import com.systech.mss.controller.vm.PermissionsClaimsOfficerVM; import com.systech.mss.domain.PermissionsBillingOfficer; import com.systech.mss.domain.PermissionsClaimsOfficer; import com.systech.mss.domain.PermissionsClaimsReviewer; import com.systech.mss.repository.PermissionsBillingOfficerRepository; import com.systech.mss.repository.PermissionsClaimOfficerRepository; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.Query; import javax.transaction.Transactional; public class PermissionsClaimOfficerRepositoryImpl extends AbstractRepositoryImpl<PermissionsClaimsOfficer, Long> implements PermissionsClaimOfficerRepository { @Inject private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public PermissionsClaimOfficerRepositoryImpl() { super(PermissionsClaimsOfficer.class); } @Transactional(Transactional.TxType.REQUIRED) @Override public PermissionsClaimsOfficer getPermissions() { try { String sql = "FROM PermissionsClaimsOfficer p ORDER BY p.id DESC"; Query query = getEntityManager().createQuery(sql, PermissionsClaimsOfficer.class); query.setMaxResults(1); return (PermissionsClaimsOfficer) query.getSingleResult(); } catch (Exception e) { return this.setDefault(); } } @Transactional(Transactional.TxType.REQUIRED) @Override public PermissionsClaimsOfficer setDefault() { try { return create(new PermissionsClaimsOfficer()); } catch (Exception e) { e.printStackTrace(); } return null; } @Transactional(Transactional.TxType.REQUIRED) @Override public PermissionsClaimsOfficer update(PermissionsClaimsOfficerVM permissionsClaimsOfficerVM) { try { PermissionsClaimsOfficer permissionsClaimsOfficer = getPermissions(); if (permissionsClaimsOfficer != null) { permissionsClaimsOfficer.setHomeMenuActivated(permissionsClaimsOfficerVM.isHomeMenuActivated()); permissionsClaimsOfficer.setPersonalInfoMenuActivated(permissionsClaimsOfficerVM.isPersonalInfoMenuActivated()); permissionsClaimsOfficer.setMembersMenuActivated(permissionsClaimsOfficerVM.isMembersMenuActivated()); permissionsClaimsOfficer.setStagedContributionsMenuActivated(permissionsClaimsOfficerVM.isStagedContributionsMenuActivated()); permissionsClaimsOfficer.setClaimsMenuActivated(permissionsClaimsOfficerVM.isClaimsMenuActivated()); permissionsClaimsOfficer.setBillsMenuActivated(permissionsClaimsOfficerVM.isBillsMenuActivated()); permissionsClaimsOfficer.setReceiptsMenuActivated(permissionsClaimsOfficerVM.isReceiptsMenuActivated()); permissionsClaimsOfficer.setDmsMenuActivated(permissionsClaimsOfficerVM.isDmsMenuActivated()); permissionsClaimsOfficer.setTicketsMenuActivated(permissionsClaimsOfficerVM.isTicketsMenuActivated()); permissionsClaimsOfficer.setUsersAccountMenuActivated(permissionsClaimsOfficerVM.isUsersAccountMenuActivated()); permissionsClaimsOfficer.setManageAccountMenuActivated(permissionsClaimsOfficerVM.isManageAccountMenuActivated()); permissionsClaimsOfficer.setAuditTrailMenuActivated(permissionsClaimsOfficerVM.isAuditTrailMenuActivated()); permissionsClaimsOfficer.setAllowBookBill(permissionsClaimsOfficerVM.isAllowBookBill()); permissionsClaimsOfficer.setAllowStageContributions(permissionsClaimsOfficerVM.isAllowStageContributions()); permissionsClaimsOfficer.setAllowAddSingleUser(permissionsClaimsOfficerVM.isAllowAddSingleUser()); permissionsClaimsOfficer.setAllowAddBatchUser(permissionsClaimsOfficerVM.isAllowAddBatchUser()); permissionsClaimsOfficer.setAllowApproveDocuments(permissionsClaimsOfficerVM.isAllowApproveDocuments()); permissionsClaimsOfficer.setTpfaMenuActivated(permissionsClaimsOfficerVM.isTpfaMenuActivated()); permissionsClaimsOfficer.setSponsorConfigMenuActivated(permissionsClaimsOfficerVM.isSponsorConfigMenuActivated()); permissionsClaimsOfficer.setBenefitsMenuActivated(permissionsClaimsOfficerVM.isBenefitsMenuActivated()); return this.edit(permissionsClaimsOfficer); } } catch (Exception e) { e.printStackTrace(); } return null; } }
[ "newton.karumba@systechafrica.com" ]
newton.karumba@systechafrica.com
674066baf3a4a35609bac99f25e14bd31e596c90
31b07f7e37c242e3a0cedc54ec873cb9eb9c3b8f
/proxy/src/main/java/org/jboss/ejb3/singleton/proxy/impl/invocationhandler/SingletonBeanRemoteInvocationHandler.java
45ceb492e05b3a3aa1457d47f127a91db7272959
[]
no_license
ALRubinger/jboss-ejb3-singleton
f4f1051c0f69d59ee7d59619c63fadc41efdca4d
9cd1692d5829e1688ebb73a46a6a8a0b4c6c3e77
refs/heads/master
2021-01-23T20:55:54.175389
2010-12-22T14:05:27
2010-12-22T14:05:27
772,956
0
0
null
null
null
null
UTF-8
Java
false
false
2,937
java
/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.ejb3.singleton.proxy.impl.invocationhandler; import org.jboss.aop.advice.Interceptor; import org.jboss.ejb3.proxy.impl.handler.session.SessionRemoteProxyInvocationHandler; /** * Responsible for handling invocations on remote business interface proxies * of a singleton bean * * @author Jaikiran Pai * @version $Revision: $ */ public class SingletonBeanRemoteInvocationHandler extends SessionRemoteProxyInvocationHandler { /** * */ private static final long serialVersionUID = 1L; /** * Constructs a {@link SingletonBeanRemoteInvocationHandler} * * @param containerRegistryName The name by which the container is registered * @param locatorURL The Remoting invoker locator URL to be used to interact with the remote container * @param interceptors The client side interceptors to be used when an invocation is being handled */ public SingletonBeanRemoteInvocationHandler(String containerRegistryName, String containerGUID, String locatorURL, Interceptor[] interceptors) { super(containerRegistryName, containerGUID, interceptors, null, locatorURL); } /** * Constructs a {@link SingletonBeanRemoteInvocationHandler} * * @param containerRegistryName The name by which the container is registered * @param locatorURL The remoting invoker locator URL to be used to interact with the remote container * @param interceptors The client side interceptors to be used when an invocation is being handled * @param businessInterface The business interface corresponding to the proxy on which the invocation is being made */ public SingletonBeanRemoteInvocationHandler(String containerRegistryName, String containerGUID, String locatorURL, Interceptor[] interceptors, String businessInterfaceType) { super(containerRegistryName, containerGUID, interceptors, businessInterfaceType, locatorURL); } }
[ "jaikiran.pai@gmail.com" ]
jaikiran.pai@gmail.com
9934b942449665153e39dbf4585b7fb66816c224
755da35585bd16e66430289a19eb994d01ed16ef
/src/main/java/ch/ethz/idsc/gokart/core/track/TrackConstraint.java
2d64a0bdd8d203645a44b38f68d47e9ee923c74e
[]
no_license
datahaki/retina
001f0ebe89d23a461ee95c946d93c3ba35bbdf25
b01b72aae54cca859b1f845748f70aa2c765f947
refs/heads/master
2020-09-01T08:32:54.658322
2019-10-27T12:25:36
2019-10-27T12:25:36
103,564,223
1
0
null
2018-10-20T02:02:24
2017-09-14T17:54:32
Matlab
UTF-8
Java
false
false
856
java
// code by mh package ch.ethz.idsc.gokart.core.track; import ch.ethz.idsc.tensor.Tensor; /* package */ abstract class TrackConstraint { private Tensor controlPointsX = null; private Tensor controlPointsY = null; private Tensor radiusControlPoints = null; protected final void setAll(Tensor controlPointsX, Tensor controlPointsY, Tensor radiusControlPoints) { this.controlPointsX = controlPointsX; this.controlPointsY = controlPointsY; this.radiusControlPoints = radiusControlPoints; } public final Tensor getControlPointsX() { return controlPointsX; } public final Tensor getControlPointsY() { return controlPointsY; } public final Tensor getRadiusControlPoints() { return radiusControlPoints; } public abstract void compute(Tensor controlpointsX, Tensor controlpointsY, Tensor radiusControlPoints); }
[ "jan.hakenberg@gmail.com" ]
jan.hakenberg@gmail.com
508ad0956b0835445d91ea1a8e1024583c1e4a57
0a1117b7a5256d964f7b5039d821c40019efaa10
/src/com/store_class/model/StoreClassDAO_interface.java
9906164168182bea3994cb6c82406d46f46f3ec0
[]
no_license
Gjchiu/Android_Server
9b2e366ad559eb77cd3732ff242d4036d5df1e2f
8c545523a0b060bfa0791f80605d83d60267897a
refs/heads/master
2021-06-19T20:57:02.122527
2017-07-26T17:47:27
2017-07-26T17:47:27
95,218,091
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package com.store_class.model; import java.util.List; import java.util.Set; import com.store.model.StoreVO; public interface StoreClassDAO_interface { public void update (StoreClassVO storeclassVO); public List<StoreClassVO> getAll(); public StoreClassVO getSCname(Number sc_id); }
[ "george33669@gmail.com" ]
george33669@gmail.com
58d69f88c3563fecdaf2a70095b0df77d5f2befe
e3e9dfbdc6d3db56ccdc2993e7edc5453ca78b40
/ecommerce-checkout-api-master/src/main/java/com/santiago/ecommerce/checkout/util/UUIDUtil.java
bcf4b92f42718dd2e44196c9a5ee0f8d07aed37c
[]
no_license
Gabriel-Santiago/e-commerce_microsservi-os_java
11dec4ce22bab7e2f9c53f8941641697131e9299
fa08a14ad27d0bce7edaded81f6a7920651d4ab8
refs/heads/master
2023-04-08T23:43:43.605474
2021-04-12T19:05:43
2021-04-12T19:05:43
357,308,725
0
0
null
null
null
null
UTF-8
Java
false
false
230
java
package com.santiago.ecommerce.checkout.util; import org.springframework.stereotype.Component; import java.util.UUID; @Component public class UUIDUtil { public UUID createUUID() { return UUID.randomUUID(); } }
[ "gabrielsrmj@alu.ufc.br" ]
gabrielsrmj@alu.ufc.br
240b36aebba1f8a930228e8f32667eaf6c9d0683
faf2b18abd16598679308915ecb17e7259191d14
/ssm_service_331/src/main/java/com/itheima/service/impl/UserServiceImpl.java
d3877532032b6451318b039a10b3d954f49b7051
[]
no_license
Pikachu047/ssm
f090e3b1cf4b04480ac88fee4f70030b1b7e6a4c
df7461192650f5a01e1f3a1a1026b5d2f802d466
refs/heads/master
2022-12-22T13:38:39.459663
2019-12-18T04:13:59
2019-12-18T04:13:59
228,755,644
0
0
null
2022-12-15T23:45:47
2019-12-18T04:09:46
JavaScript
UTF-8
Java
false
false
3,229
java
package com.itheima.service.impl; import com.itheima.dao.SysUserDao; import com.itheima.domain.Product; import com.itheima.domain.SysUser; import com.itheima.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Collection; import java.util.List; @Service public class UserServiceImpl implements UserService{ @Autowired PasswordEncoder passwordEncoder; @Autowired SysUserDao sysUserDao; /** * 通过用户名得到用户对象 * @param username * @return * @throws UsernameNotFoundException */ @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { //根据用户名获取用户对象(sysuser) SysUser sysUser = sysUserDao.findByUsername(username); System.out.println(username); if(sysUser!= null){ //创建角色的集合对象 Collection<GrantedAuthority> authorities = new ArrayList<>(); //创建临时的角色对象 GrantedAuthority authority = new SimpleGrantedAuthority("ROLE_USER"); //对象添加到集合 中 authorities.add(authority); /** * 参数1:用户名 * 参数2:密码 * 参数3:角色列表对象 */ UserDetails user = new User(sysUser.getUsername(),sysUser.getPassword(),authorities); return user; } return null; } @Override public List<SysUser> findAll() { return sysUserDao.findAll(); } //保存用户 @Override public void save(SysUser user) { String password = user.getPassword(); //对明文密码进行加密 String encode = passwordEncoder.encode(password); user.setPassword(encode); sysUserDao.save(user); } //判断是否已经存在该用户 @Override public boolean isUniqueUsername(String username) { SysUser user = sysUserDao.findAllByUsername(username); //如果user为空 返回true 表示用户名可用 //如果user不为空 返回false 表示用户名不可用 return user == null; } @Override public SysUser findById(Integer userId) { return sysUserDao.findById(userId); } //给用户添加角色 @Override public void addRoleToUser(Integer userId, Integer[] ids) { //先清空用户已经拥有的角色 sysUserDao.delRolesFormUser(userId); //维护新的关系 //判断数组是否为空 if(ids != null){ for (Integer roleId : ids) { sysUserDao.saveRoleToUser(userId,roleId); } } } }
[ "2894213383@qq.com" ]
2894213383@qq.com
66f54646c1ba922e3b8f0a9eaa9d3b7f47f64085
c5f3dd4a82b60947fef050c5110f8a9ac2280a46
/src/main/java/com/datamesh/config/dbmigrations/package-info.java
1c4641a015f99fbb286a1bb79a09871f1f494e45
[]
no_license
aloneload/driver
21fd236ccdf60f6cdd021f416ef83207a0e1f4d9
856ac2ae1a006005550fbbbbde8908e7f3deb9ff
refs/heads/master
2020-04-28T08:32:59.780899
2019-03-12T03:52:43
2019-03-12T03:52:43
175,132,154
0
0
null
null
null
null
UTF-8
Java
false
false
97
java
/** * MongoDB database migrations using MongoBee. */ package com.datamesh.config.dbmigrations;
[ "vagrant@vagrant.vm" ]
vagrant@vagrant.vm
834573dae728e0ea2637717e18cb506fa84cde2e
f378ddd47c8b7de6e9cf1d4228c84f73e9dc59f1
/projetos/Caduceus/src/tv/floe/caduceus/hadoop/mapreduce/template/ExampleMapper.java
4c5449d5628b116063d01941053462e64fa1d1d4
[]
no_license
charles-marques/dataset-375
29e2f99ac1ba323f8cb78bf80107963fc180487c
51583daaf58d5669c69d8208b8c4ed4e009001a5
refs/heads/master
2023-01-20T07:23:09.445693
2020-11-27T22:35:49
2020-11-27T22:35:49
283,315,149
0
1
null
null
null
null
UTF-8
Java
false
false
2,841
java
package tv.floe.caduceus.hadoop.mapreduce.template; import java.io.IOException; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.Mapper; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reporter; import org.apache.log4j.Logger; /** * This is an example map class based off the original map reduce API. * * @author jpatterson * */ public class ExampleMapper extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> { private JobConf configuration; private final Text key = new Text(); private final Text val = new Text(); private static final Logger logger = Logger.getLogger( ExampleMapper.class ); /** * The close method is called ONCE after all k/v pairs for the split have been processed. * */ public void close() { } /** * * The configure method is where we're going to pull in your metdata for the ETL and VAP processes * from the distributed cache. * * We'll plugin in the generic POJO code here. * */ public void configure(JobConf conf) { this.configuration = conf; // Basic pojo code here } /** * This is the method called "per line of input" in the source file "split" * * Data will come in as a k/v pair of a "LongWritable" and a "Text" value, which from a text file * will be a line of text where the LongWritable represents the byte offset. * * * @param inkey * @param value * @param output * @param reporter * @throws IOException */ @Override public void map(LongWritable inkey, Text value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { String line = value.toString(); boolean bExampleBadParse = false; /* * Here we'd take the line of input text and parse it somehow, generally with POJO * * Example: * YahooStockDataPoint rec = YahooStockDataPoint.parse( line ); */ // now if we have a valid record we'll push it on through the output collector into the Shuffle phase if (bExampleBadParse != false) { // set both parts of the key key.set( "[key from record or derived key]" ); val.set( "Record data to push the the shuffle" ); // now that its parsed, we send it through the shuffle for sort, onto reducers output.collect(key, val); } else { // reporter.incrCounter( Timeseries_Counters.BAD_PARSE, 1 ); } } }
[ "suporte@localhost.localdomain" ]
suporte@localhost.localdomain
57844394b2d08b2287dc7536f406eda1c9225bcf
27511a2f9b0abe76e3fcef6d70e66647dd15da96
/src/com/instagram/y/a/f.java
a3c97e1378b7ff2d26a5b17b551200fd78eec356
[]
no_license
biaolv/com.instagram.android
7edde43d5a909ae2563cf104acfc6891f2a39ebe
3fcd3db2c3823a6d29a31ec0f6abcf5ceca995de
refs/heads/master
2022-05-09T15:05:05.412227
2016-07-21T03:48:36
2016-07-21T03:48:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.instagram.y.a; import com.instagram.user.a.q; public final class f { public q a; public int b; public int c; public String d; } /* Location: * Qualified Name: com.instagram.y.a.f * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
8f65381986a06d22d9471051e3f5fc087f677ca1
2f2fb400a323ab57d29f56f627b1e83b1c00ccfc
/src/main/java/jp/pinkikki/response/ErrorResponseBuilder.java
921bcf0b06257280d376ed4408aa788e00261c68
[]
no_license
pinkikki/ponko-several-years-api
6906a5fa9a6cecc71f768987208e48ec8c687f0b
3e0e15f7aec69919573e572f63e09e0e66578df6
refs/heads/master
2021-04-30T15:49:15.046424
2018-04-11T14:20:10
2018-04-11T14:20:10
121,249,072
0
0
null
null
null
null
UTF-8
Java
false
false
1,811
java
package jp.pinkikki.response; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Component; import org.springframework.validation.BindingResult; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @Component @Scope("prototype") public class ErrorResponseBuilder { private List<Error> errors; private String code; private String message; private final MessageSource messageSource; @Autowired ErrorResponseBuilder(MessageSource messageSource) { errors = new ArrayList<>(); this.messageSource = messageSource; } ErrorResponseBuilder code(String code) { this.code = code; return this; } ErrorResponseBuilder message(String message) { this.message = message; return this; } ErrorResponseBuilder error(Error error) { errors.add(error); return this; } ErrorResponseBuilder error(String errorCode, String field, String detail) { errors.add(new Error(errorCode, field, detail)); return this; } ErrorResponseBuilder bindingResult(BindingResult bindingResult) { errors = bindingResult .getFieldErrors() .stream() .map(f -> new Error( f.getCode(), f.getField(), messageSource.getMessage(f, LocaleContextHolder.getLocale()))) .collect(Collectors.toList()); return this; } ErrorResponse build() { return new ErrorResponse(code, message, errors); } }
[ "w-mizutani@pinkikki.jp" ]
w-mizutani@pinkikki.jp
676030225199df36495dec1ab43606ca2287f301
aa0329d6703c8a8ee8ff7c359433177f8f41ec65
/src/com/lemania/eprospects/client/event/CoursesLoadedEvent.java
4a48345f6479c829a87eaf55d5f10e635816d308
[]
no_license
thuannn/eProspects
56d75b865eacc700b21adcf84510385019ac574b
2fe19b44fc2fb15dd2bc2eab4cdc7b806e88a219
refs/heads/master
2021-01-16T22:06:49.431808
2016-07-07T14:51:33
2016-07-07T14:51:33
19,370,968
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package com.lemania.eprospects.client.event; import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.HasHandlers; import com.google.gwt.event.shared.HandlerRegistration; public class CoursesLoadedEvent extends GwtEvent<CoursesLoadedEvent.CoursesLoadedHandler> { public static Type<CoursesLoadedHandler> TYPE = new Type<CoursesLoadedHandler>(); public interface CoursesLoadedHandler extends EventHandler { void onCoursesLoaded(CoursesLoadedEvent event); } public interface CoursesLoadedHasHandlers extends HasHandlers { HandlerRegistration addCoursesLoadedHandler(CoursesLoadedHandler handler); } public CoursesLoadedEvent() { } @Override protected void dispatch(CoursesLoadedHandler handler) { handler.onCoursesLoaded(this); } @Override public Type<CoursesLoadedHandler> getAssociatedType() { return TYPE; } public static Type<CoursesLoadedHandler> getType() { return TYPE; } public static void fire(HasHandlers source) { source.fireEvent(new CoursesLoadedEvent()); } }
[ "thuannn@hotmail.ch" ]
thuannn@hotmail.ch
7fdc354c45e9249865321b23c837904488b5f44d
33573c03d30951d9d4ae686417b45189fad26fa7
/src/main/java/be/kdg/kandoe/frontend/config/security/WebSecurityConfig.java
15771fa95df975f7d79b996c5e9542dc7149ec75
[]
no_license
designreuse/kandoeSpring
839f09f24bfb1469fba9f6fb9a44e93138e43690
a6a40dcffce475fdb7b68e5bf4cb65c2c6cf15b3
refs/heads/master
2020-06-30T20:13:08.080355
2016-03-25T14:02:09
2016-03-25T14:02:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,752
java
package be.kdg.kandoe.frontend.config.security; import be.kdg.kandoe.backend.services.api.UserService; import be.kdg.kandoe.frontend.config.security.jwt.JwtFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.*; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; /** * Created by Jordan on 13/02/2016. */ @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) @ComponentScan(basePackages = {"be.kdg.kandoe.frontend", "be.kdg.kandoe.frontend.config.security"}, excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Configuration.class), @ComponentScan.Filter(type = FilterType.REGEX, pattern = "be.kdg.kandoe.frontend.config.security.rest.*")} ) public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserService userService; @Autowired private BCryptPasswordEncoder passwordEncoder; @Override protected void configure(HttpSecurity http) throws Exception { http .headers().cacheControl().and().and() .authorizeRequests() .antMatchers("/").permitAll() .antMatchers("/index.html").permitAll() .antMatchers("/resources/**", "/app/**").permitAll() .antMatchers(HttpMethod.POST, "/api/login", "/api/login/facebook").permitAll() .antMatchers(HttpMethod.POST, "/api/users").permitAll() .antMatchers("/api/**").authenticated().and() .addFilterBefore(new JwtFilter(userService), UsernamePasswordAuthenticationFilter.class) .csrf().disable() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); } @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .userDetailsService(userService) .passwordEncoder(passwordEncoder) ; } }
[ "arnelauryssens@hotmail.com" ]
arnelauryssens@hotmail.com
8d6ed65a87efa028f13bb86cf72863e4093acd52
b5a42a88ca0b5a49cad2df872288e67c1e039693
/3.JavaMultithreading/src/com/javarush/task/task24/task2409/Util.java
a8f355750191d7655d742c2171b4661ad83c194a
[]
no_license
ValeriyEmelyanov/JavaRushTasks
0104a951e522911c8c6ed6eef05c16a66313bb2c
4dd45e71aed4e9fe5dce25a80614bfdc5f9a60fa
refs/heads/master
2020-06-01T21:27:29.056423
2019-12-29T08:21:26
2019-12-29T08:21:26
190,932,680
0
0
null
null
null
null
UTF-8
Java
false
false
3,890
java
package com.javarush.task.task24.task2409; import java.util.*; public class Util { protected static Collection<Object[]> jeansArray = new LinkedList<>(); static { jeansArray.add(new Object[]{1, Company.Levis, 34, 6, 150.0}); jeansArray.add(new Object[]{2, Company.Denim, 35, 8, 154.0}); jeansArray.add(new Object[]{3, Company.Colins, 32, 6, 120.0}); jeansArray.add(new Object[]{4, Company.CalvinKleinJeans, 31, 8, 125.0}); } public static List<Jeans> getAllJeans() { //add your code here abstract class AbstractJeans implements Jeans { private int id; private int length; private int size; private double price; public AbstractJeans(int id, int length, int size, double price) { this.id = id; this.length = length; this.size = size; this.price = price; } @Override public int getLength() { return length; } @Override public int getSize() { return size; } @Override public int getId() { return id; } @Override public double getPrice() { return price; } @Override public String toString() { Formatter formatter = new Formatter(); return String.format("%s{id=%d, length=%d, size=%d, price=%s}", //getTM(), this.getClass().getSimpleName(), getId(), getLength(), getSize(), //getPrice() formatter.format(Locale.ENGLISH, "%.1f", getPrice()) ); } } class Levis extends AbstractJeans { public Levis(int id, int length, int size, double price) { super(id, length, size, price); } @Override public String getTM() { //return Company.Levis.fullName; return "Levi's"; } } class Denim extends AbstractJeans { public Denim(int id, int length, int size, double price) { super(id, length, size, price); } @Override public String getTM() { //return Company.Denim.fullName; return "Denim"; } } List<Jeans> allJeans = new LinkedList<>(); for (Object[] obj : getJeansArray()) { int id = (int) obj[0]; final Company company = (Company ) obj[1]; int length = (int) obj[2]; int size = (int) obj[3]; double price = (double) obj[4]; Jeans jeans = null; if (Company.Levis == company) { jeans = new Levis(id, length, size, price); } else if (Company.Denim == company) { jeans = new Denim(id, length, size, price); } else { jeans = new AbstractJeans(id, length, size, price) { public String getTM() { return company.fullName; } }; } allJeans.add(jeans); } return allJeans; } public static Collection<Object[]> getJeansArray() { return jeansArray; } static enum Company { Levis ("Levi's"), Denim("Denim"), Colins("COLIN'S"), CalvinKleinJeans("Calvin Klein Jeans"); final String fullName; Company(String name) { this.fullName = name; } } }
[ "emelva@rambler.ru" ]
emelva@rambler.ru
1a213030397d47fca6b13aa369e0137d9e13d0fd
15f8bdee4b8e27c3a7da7f9eeca5c09ba4ecee30
/src/main/java/de/iisys/smartgrids/libecb1/api/v1/ChargeControllerModeEcoStartStopDelay.java
7eb10bddc582e46d2edee51bafb9fdb80adb8411
[ "MIT" ]
permissive
iisys-hof/libECB1
ec94c3d967fcb916a27beb60c270463e98033f96
668ddb0ed674cbb053f4ea6c8134d44be2d0f661
refs/heads/master
2020-04-23T22:31:22.115598
2019-02-19T16:16:29
2019-02-19T16:16:29
171,504,500
1
0
null
null
null
null
UTF-8
Java
false
false
2,091
java
package de.iisys.smartgrids.libecb1.api.v1; import de.iisys.smartgrids.libecb1.api.ECB1Api; import javax.ws.rs.FormParam; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Returns delay for automatic charging start and stop. */ @Path("/chargecontrols/{id}/mode/eco/startstop/delay") @Produces(MediaType.APPLICATION_FORM_URLENCODED) @XmlRootElement public class ChargeControllerModeEcoStartStopDelay implements ECB1Api { /** * The id of the charging controller.<br> * Needed as a path parameter for the RESTful Web Service. */ @PathParam("id") private int id; /** * The delay value for automatic charging start and stop.<br> * Needed as a path parameter for the RESTful Web Service.<br> * Mandatory variable for XML. */ @XmlElement(name = "delay", required = true) @FormParam("delay") private double delay; /** * Default constructor. */ public ChargeControllerModeEcoStartStopDelay() { } /** * Initializes {@link #id} of {@link ChargeControllerModeEcoStartStopDelay} * with the given id. * * @param id the id of the charging controller */ public ChargeControllerModeEcoStartStopDelay(int id) { this.id = id; } /** * Initializes {@link #id} and {@link delay} of * {@link ChargeControllerModeEcoStartStopDelay} with the given id and delay * value. * * @param id the id of the charging controller * @param delay delay for automatic charging start and stop. */ public ChargeControllerModeEcoStartStopDelay(int id, double delay) { this.id = id; this.delay = delay; } public int getId() { return id; } public double getDelay() { return delay; } @Override public String toString() { return "ChargeControllerModeEcoStartStop{" + "id=" + id + ", delay=" + delay + '}'; } }
[ "altan.uenal@hof-university.de" ]
altan.uenal@hof-university.de
33deb637214d9cdc659c7e1de38951c68c8c0194
3d69b118e53ac56c01f57f47fe22bf5f6b0a0183
/org.erlide.model/src/org/erlide/model/erlang/ErlangToolkitFactory.java
b86bf1fc5b2d756f6e03729052d94de330a179ee
[]
no_license
xingbei437/erlide
88c178fa737b39a5cd46f4030e6d4e02d41ea248
ae621300952bf137b36a2aad8ad2ffe72dc6bebd
refs/heads/master
2020-12-30T17:45:11.993408
2013-03-25T10:31:37
2013-03-25T10:31:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package org.erlide.model.erlang; public class ErlangToolkitFactory { private static volatile ErlangToolkit instance; public static ErlangToolkit getInstance() { if (instance == null) { instance = new ErlangBackendToolkit(); } return instance; } }
[ "vladdu55@gmail.com" ]
vladdu55@gmail.com
80b8774e34eeb6a5f8df585ec81696bceafa1d0d
7b35b7e8832da44617364072d15282665b23f2e0
/src/main/java/homeworks/homework_8/task_3/TinkoffTerminal.java
f761add879ecd5a5c0c9879151e34df18198c6de
[]
no_license
AndreySavelev2705/at-study-java-core-hw
0edd513303ff58dc21e87d1acd67ea16f5993f3e
6d364df663bde2f6df76cb27ba6c90c5f038271f
refs/heads/master
2023-07-29T09:13:30.990241
2021-09-13T15:46:15
2021-09-13T15:46:15
358,955,563
0
0
null
null
null
null
UTF-8
Java
false
false
628
java
package homeworks.homework_8.task_3; public class TinkoffTerminal extends Terminal { private final double MIN_AMOUNT; public TinkoffTerminal(String address) { super(address); owner = Owner.TINKOFF; tax = 9; noTaxLimit = 600; MIN_AMOUNT = 100; } @Override public void pay(String phone, double amount) { if (amount >= MIN_AMOUNT) super.pay(phone, amount); else System.out.printf("Минимальная сумма для пополнения - %.2f. С уважением, ваш %s, %s%n", MIN_AMOUNT, owner.getName(), address); } }
[ "savelev.andrey.job.mail@gmail.com" ]
savelev.andrey.job.mail@gmail.com
ae9793f46046933238cb09ddae7933ebec241116
adfed755ecf8262755292dee61c42a61c679611e
/velcoity/org/apache/velocity/runtime/parser/node/ASTDirective.java
86e86b7724167e6def7c65862a0caa27552d06c1
[]
no_license
wanghl/Roller
98cfeeb8ab244bc1b56eff7109475a7635bb14d0
df78a16fb407e6707844582837f1f53fa982f766
refs/heads/master
2021-01-19T20:28:04.360608
2012-06-05T15:24:54
2012-06-05T15:24:54
4,520,025
2
0
null
null
null
null
UTF-8
Java
false
false
8,246
java
package org.apache.velocity.runtime.parser.node; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.io.IOException; import java.io.Writer; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.exception.MethodInvocationException; import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.exception.TemplateInitException; import org.apache.velocity.runtime.directive.Directive; import org.apache.velocity.runtime.directive.RuntimeMacro; import org.apache.velocity.runtime.directive.BlockMacro; import org.apache.velocity.runtime.parser.ParseException; import org.apache.velocity.runtime.parser.Parser; import org.apache.velocity.util.ExceptionUtils; /** * This class is responsible for handling the pluggable * directives in VTL. * * For example : #foreach() * * Please look at the Parser.jjt file which is * what controls the generation of this class. * * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a> * @author <a href="mailto:kav@kav.dk">Kasper Nielsen</a> * @version $Id: ASTDirective.java 736677 2009-01-22 15:39:02Z nbubna $ */ public class ASTDirective extends SimpleNode { private Directive directive = null; private String directiveName = ""; private boolean isDirective; private boolean isInitialized; /** * @param id */ public ASTDirective(int id) { super(id); } /** * @param p * @param id */ public ASTDirective(Parser p, int id) { super(p, id); } /** * @see org.apache.velocity.runtime.parser.node.SimpleNode#jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * @see org.apache.velocity.runtime.parser.node.SimpleNode#init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object) */ public synchronized Object init( InternalContextAdapter context, Object data) throws TemplateInitException { /** method is synchronized to avoid concurrent directive initialization **/ if (!isInitialized) { super.init( context, data ); /* * only do things that are not context dependent */ if (parser.isDirective( directiveName )) { isDirective = true; try { directive = (Directive) parser.getDirective( directiveName ) .getClass().newInstance(); } catch (InstantiationException e) { throw ExceptionUtils.createRuntimeException("Couldn't initialize " + "directive of class " + parser.getDirective(directiveName).getClass().getName(), e); } catch (IllegalAccessException e) { throw ExceptionUtils.createRuntimeException("Couldn't initialize " + "directive of class " + parser.getDirective(directiveName).getClass().getName(), e); } directive.setLocation(getLine(), getColumn(), getTemplateName()); directive.init(rsvc, context,this); } else if( directiveName.startsWith("@") ) { if( this.jjtGetNumChildren() > 0 ) { // block macro call (normal macro call but has AST body) directiveName = directiveName.substring(1); directive = new BlockMacro(directiveName); directive.setLocation(getLine(), getColumn(), getTemplateName()); try { directive.init( rsvc, context, this ); } catch (TemplateInitException die) { throw new TemplateInitException(die.getMessage(), (ParseException) die.getWrappedThrowable(), die.getTemplateName(), die.getColumnNumber() + getColumn(), die.getLineNumber() + getLine()); } isDirective = true; } else { // this is a fake block macro call without a body. e.g. #@foo // just render as it is isDirective = false; } } else { /** * Create a new RuntimeMacro */ directive = new RuntimeMacro(directiveName); directive.setLocation(getLine(), getColumn(), getTemplateName()); /** * Initialize it */ try { directive.init( rsvc, context, this ); } /** * correct the line/column number if an exception is caught */ catch (TemplateInitException die) { throw new TemplateInitException(die.getMessage(), (ParseException) die.getWrappedThrowable(), die.getTemplateName(), die.getColumnNumber() + getColumn(), die.getLineNumber() + getLine()); } isDirective = true; } isInitialized = true; } return data; } /** * @see org.apache.velocity.runtime.parser.node.SimpleNode#render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer) */ public boolean render( InternalContextAdapter context, Writer writer) throws IOException,MethodInvocationException, ResourceNotFoundException, ParseErrorException { /* * normal processing */ if (isDirective) { directive.render(context, writer, this); } else { writer.write( "#"); writer.write( directiveName ); } return true; } /** * Sets the directive name. Used by the parser. This keeps us from having to * dig it out of the token stream and gives the parse the change to override. * @param str */ public void setDirectiveName( String str ) { directiveName = str; } /** * Gets the name of this directive. * @return The name of this directive. */ public String getDirectiveName() { return directiveName; } /** * @since 1.5 */ public String toString() { return new ToStringBuilder(this) .appendSuper(super.toString()) .append("directiveName", getDirectiveName()) .toString(); } }
[ "xbwolf.sina.cn" ]
xbwolf.sina.cn
8a215dea9167a32af58b381feff3dbca21d565ef
10c8197e4664da3dc101315fcebb82c23c2efd20
/src/sort/BinarySearch.java
65f50cee24af4f025c7e9b8820629dbd37ed3ab0
[]
no_license
18397407270/suanfa
52c56fd48542a3631f3d1b1470984e0e7f7287f4
ae1e45f12e5bc201b97ba28dc715e6056146d581
refs/heads/master
2023-03-29T13:13:54.536370
2021-04-05T07:04:05
2021-04-05T07:04:05
354,748,934
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package sort; public class BinarySearch { public static void main(String[] args) { int a[] = {1,2,3,4,5,6,7}; int t = 10; int low = 0; int height = a.length-1; int re = binarysearch(a,t,low,height); System.out.println(re); } private static int binarysearch(int[] a, int key, int low, int height) { while (low<=height){ int mid = (low+height)/2; if(a[mid]<key){ low = mid+1; }else if(a[mid]>key){ height = mid -1; }else if(a[mid]==key){ return key; } } return -1; } }
[ "‘2604776450@qq.com’" ]
‘2604776450@qq.com’
d688a7e442fc135a3fae68abed33a8a596a62e0d
df7bcce7084e55cb90e43d34da9dfc376b97dbc5
/modulesrc/pl/shockah/shocky2/module/tell/CommandTell.java
1a59e9f5b44736c899fc0a44a625162b88c99b88
[]
no_license
downslope7/Shocky2
40255a10e4bacdaf8b6113367e1fd7ea63e93b89
adaed0c1f0dae0a9472b0b8a7c81d20274a600b2
refs/heads/master
2021-01-14T12:15:38.239482
2012-12-21T14:11:17
2012-12-21T14:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,336
java
package pl.shockah.shocky2.module.tell; import java.util.Date; import org.pircbotx.Channel; import org.pircbotx.PircBotX; import org.pircbotx.User; import pl.shockah.shocky2.Command; import pl.shockah.shocky2.CommandCallback; import pl.shockah.shocky2.ETarget; import pl.shockah.shocky2.Module; import pl.shockah.shocky2.Util; public class CommandTell extends Command { public CommandTell(Module module) { super(module); } public String command() {return "tell";} public String help() { return ".tell {user} {message} - relay the message to user"; } public void call(PircBotX bot, ETarget target, CommandCallback callback, Channel channel, User sender, String message) { String[] split = message.split("\\s"); if (callback.target != ETarget.Console) callback.target = ETarget.Notice; if (split.length < 3) { callback.append(help()); return; } String aNick = split[1].toLowerCase(), aMessage = Util.implode(split,2," "); if (bot.getNick().equalsIgnoreCase(aNick)) { callback.append("I'm here, you know?"); return; } Tell tell = new Tell(sender.getNick(),aNick,aMessage,new Date()); pl.shockah.shocky2.module.tell.Module.tells.add(tell); module.getCollection().insert(tell.intoDocument()); callback.append("I'll pass that along."); } }
[ "lolshockah@gmail.com" ]
lolshockah@gmail.com
306328e693fb6fb62d0690db40c25f8ca4814013
46e70a56f2736d637dda301142728d09d8052e9d
/BluetoothRobotDrive/app/src/androidTest/java/vv/arduino/vaibhav/bluetoothrobotdrive/ApplicationTest.java
397c97b50ff71e7e3ce5f09386e85946cfdcc4f3
[]
no_license
vaibhav012/arduinoBluetoothRobot
1bfc4ab3af5f158b6a58455c1a6503ec155a221e
c4cc5976f79af5bb2d2fa5ed9edad069d853808e
refs/heads/master
2021-01-25T05:56:57.249622
2017-02-02T09:22:01
2017-02-02T09:22:01
80,710,029
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package vv.arduino.vaibhav.bluetoothrobotdrive; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "vaibhavtayal95@gmail.com" ]
vaibhavtayal95@gmail.com
44448e1f545b997d151d46bef637b5f392e555cf
0f0b9647a2a5a9d8e9ac863a00fb5e6c96019412
/src/main/java/com/hc/nowcoder/DuplicateSolution.java
7248f3cf318571cdbdb66688d46622dbe7e54b3b
[ "MIT" ]
permissive
harrycheng/nowcoder
ef32860039a88bbba4fd93a88602984341d71b5c
1aec55c6c98476b227c97a3cd65dad202bfe8f43
refs/heads/master
2021-09-16T03:35:31.895654
2021-08-27T11:36:26
2021-08-27T11:36:26
145,575,967
0
0
null
null
null
null
UTF-8
Java
false
false
487
java
package com.hc.nowcoder; import java.util.Set; import java.util.TreeSet; public class DuplicateSolution { public boolean duplicate(int numbers[], int length, int[] duplication) { Set<Integer> countSet = new TreeSet<Integer>(); for (int i : numbers) { if (countSet.contains(i)) { duplication[0] = i; return true; } else { countSet.add(i); } } return false; } }
[ "chenghao@bj-fanuc.com.cn" ]
chenghao@bj-fanuc.com.cn
0a2f8b23c5519a2b2b151a0ec107d832d446c0cc
caf6c64f2013e4ec022f52107f6e4139c88f919f
/src/com/weibo/net/AuthWeiboController.java
c74871ee160a748db6346da13901c3d9e47deffe
[]
no_license
zhoulzhou/IPCPlayer
f99c77fc945f5362295119dd86dadec79125bd1c
c94180088293f9b02031b6c0efc4fe2a6447002e
refs/heads/master
2021-01-21T00:47:51.220297
2013-07-29T11:37:14
2013-07-29T11:37:14
7,376,414
2
0
null
null
null
null
UTF-8
Java
false
false
822
java
package com.weibo.net; import com.example.ipcplayer.manager.LogicController; import com.example.ipcplayer.setting.SettingManager; import com.example.ipcplayer.setting.SettingManagerFactory; import android.content.Context; import android.os.Handler; /** * @version 1.0 * @data 2012-10-10 */ public class AuthWeiboController extends LogicController { private SettingManager mSettingManager = null; /** * @param context * @param uiHandler */ public AuthWeiboController(Context context, Handler uiHandler) { super(context, uiHandler); mSettingManager = (SettingManager) SettingManagerFactory.getComponent(context); } public void setAppForegroundTime(long addedTime) { if (addedTime > 0) { mSettingManager.setAppForegroundTime( mSettingManager.getAppForegroundTime() + addedTime); } } }
[ "sohozhou@163.com" ]
sohozhou@163.com
3850fef78681f9f6abe8c08b496832f94f3653f1
4e7c44a0562a698133e31d27988a1754b9832ff9
/sort/QuickSort.java
d8a46aedfbf39a68c038c946337d7438fa786ed1
[]
no_license
19975637295/DataStruct
5056d5806e7a7bf1da13d6211d0067186261c090
2ebeedfaa1691949fa18021b07dd4ff83741db88
refs/heads/master
2020-09-20T10:34:21.023727
2019-11-27T14:57:15
2019-11-27T14:57:15
224,451,983
0
0
null
null
null
null
UTF-8
Java
false
false
885
java
package sort; public class QuickSort { public static void swap(int[] arr, int i, int j) { int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } public static void sort(int[] arr) { if(arr==null||arr.length<2) return; quickSort(arr, 0, arr.length-1); } public static void quickSort(int[] arr, int left, int right) { if(left<right) { swap(arr, right, left+(int)((right-left)*Math.random())); int p[] = partition(arr, left, right); quickSort(arr, left, p[0]); quickSort(arr, p[1], right); } } public static int[] partition(int[] arr, int left, int right) { int less = left-1; int pivot = arr[right]; int more = right+1; while(left<more) { if(arr[left]==pivot) { left++; }else if(arr[left]<pivot) { swap(arr, ++less, left++); }else { more = more -1; swap(arr, more, left); } } return new int[] {less, more}; } }
[ "2362110883@qq.com" ]
2362110883@qq.com
459a874863f76f9b9f32ae097ed52fb701132665
edf96c99ff4b04a5c354078b8fb695f1996c886f
/app/src/main/java/com/order/android/utils/OSUtils.java
cbf1e11f47e2b6b90d47c9b53fa361d340b7ebaf
[]
no_license
Miotlink-Q/Order2
cb6c011a56c8811e0f3dec6294730dbd7ad0e1b1
fda936b1fbeba0cf31ccb12b97ae96c07dc3ec12
refs/heads/master
2022-11-21T12:10:48.329732
2020-06-28T09:55:06
2020-06-28T09:55:06
275,555,270
0
0
null
null
null
null
UTF-8
Java
false
false
18,299
java
package com.order.android.utils; import android.os.Environment; import android.text.TextUtils; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * <pre> * author : Senh Linsh * github : https://github.com/SenhLinsh * date : 2017/11/10 * desc : 工具类: OS 系统相关 * 简介 : 由于国内定制系统的泛滥, 不同定制系统的一些功能或实现方法会有所不同, 如果需要做到足够好的适配工作, 需要 * 对不同的定制系统做一些专门的适配. * API : 获取 ROM 类型等 * * Deprecated : * 在工具类中对 ROM 类型进行判断,显得有些力不从心,所以单独创建了新的项目,用于判断 ROM,获取其版本号。 * * 敬请期待: * https://github.com/SenhLinsh/Android-ROM-Identifier * </pre> */ public class OSUtils { private static final String KEY_DISPLAY_ID = "ro.build.display.id"; private static final String KEY_BASE_OS_VERSION = "ro.build.version.base_os"; private static final String KEY_CLIENT_ID_BASE = "ro.com.google.clientidbase"; // 小米 : MIUI private static final String KEY_MIUI_VERSION = "ro.build.version.incremental"; // "7.6.15" private static final String KEY_MIUI_VERSION_NANE = "ro.miui.ui.version.name"; // "V8" private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code"; // "6" private static final String VALUE_MIUI_CLIENT_ID_BASE = "android-xiaomi"; // 华为 : EMUI private static final String KEY_EMUI_VERSION = "ro.build.version.emui"; // "EmotionUI_3.0" private static final String KEY_EMUI_API_LEVEL = "ro.build.hw_emui_api_level"; // private static final String KEY_EMUI_SYSTEM_VERSION = "ro.confg.hw_systemversion"; // // "T1-A21wV100R001C233B008_SYSIMG" // 魅族 : Flyme private static final String KEY_FLYME_PUBLISHED = "ro.flyme.published"; // "true" private static final String KEY_FLYME_SETUP = "ro.meizu.setupwizard.flyme"; // "true" private static final String VALUE_FLYME_DISPLAY_ID_CONTAIN = "Flyme"; // "Flyme OS 4.5.4.2U" // OPPO : ColorOS private static final String KEY_COLOROS_VERSION = "ro.oppo.theme.version"; // "703" private static final String KEY_COLOROS_THEME_VERSION = "ro.oppo.version"; // "" private static final String KEY_COLOROS_ROM_VERSION = "ro.rom.different.version"; // private static final String VALUE_COLOROS_BASE_OS_VERSION_CONTAIN = "OPPO"; // "OPPO/R7sm // "ColorOS2.1" // /R7sm:5.1.1/LMY47V/1440928800:user/release-keys" private static final String VALUE_COLOROS_CLIENT_ID_BASE = "android-oppo"; // vivo : FuntouchOS private static final String KEY_FUNTOUCHOS_BOARD_VERSION = "ro.vivo.board.version"; // "MD" private static final String KEY_FUNTOUCHOS_OS_NAME = "ro.vivo.os.name"; // "Funtouch" private static final String KEY_FUNTOUCHOS_OS_VERSION = "ro.vivo.os.version"; // "3.0" private static final String KEY_FUNTOUCHOS_DISPLAY_ID = "ro.vivo.os.build.display.id"; // // "FuntouchOS_3.0" private static final String KEY_FUNTOUCHOS_ROM_VERSION = "ro.vivo.rom.version"; // "rom_3.1" private static final String VALUE_FUNTOUCHOS_CLIENT_ID_BASE = "android-vivo"; // Samsung private static final String VALUE_SAMSUNG_BASE_OS_VERSION_CONTAIN = "samsung"; // "samsung // /zeroltezc/zeroltechn:6.0.1/MMB29K/G9250ZCU2DQD1:user/release-keys" private static final String VALUE_SAMSUNG_CLIENT_ID_BASE = "android-samsung"; // Sony private static final String KEY_SONY_PROTOCOL_TYPE = "ro.sony.irremote.protocol_type"; // "2" private static final String KEY_SONY_ENCRYPTED_DATA = "ro.sony.fota.encrypteddata"; // private static final String VALUE_SONY_CLIENT_ID_BASE = "android-sonyericsson"; // "supported" // 乐视 : eui private static final String KEY_EUI_VERSION = "ro.letv.release.version"; // "5.9.023S" private static final String KEY_EUI_VERSION_DATE = "ro.letv.release.version_date"; // "5.9 // .023S_03111" private static final String KEY_EUI_NAME = "ro.product.letv_name"; // "乐1s" private static final String KEY_EUI_MODEL = "ro.product.letv_model"; // "Letv X500" // 金立 : amigo private static final String KEY_AMIGO_ROM_VERSION = "ro.gn.gnromvernumber"; // "GIONEE ROM5.0 // .16" private static final String KEY_AMIGO_SYSTEM_UI_SUPPORT = "ro.gn.amigo.systemui.support"; // private static final String VALUE_AMIGO_DISPLAY_ID_CONTAIN = "amigo"; // "amigo3.5.1" // "yes" private static final String VALUE_AMIGO_CLIENT_ID_BASE = "android-gionee"; // 酷派 : yulong private static final String KEY_YULONG_VERSION_RELEASE = "ro.yulong.version.release"; // "5.1 // .046.P1.150921.8676_M01" private static final String KEY_YULONG_VERSION_TAG = "ro.yulong.version.tag"; // "LC" private static final String VALUE_YULONG_CLIENT_ID_BASE = "android-coolpad"; // HTC : Sense private static final String KEY_SENSE_BUILD_STAGE = "htc.build.stage"; // "2" private static final String KEY_SENSE_BLUETOOTH_SAP = "ro.htc.bluetooth.sap"; // "true" private static final String VALUE_SENSE_CLIENT_ID_BASE = "android-htc-rev"; // LG : LG private static final String KEY_LG_SW_VERSION = "ro.lge.swversion"; // "D85720b" private static final String KEY_LG_SW_VERSION_SHORT = "ro.lge.swversion_short"; // "V20b" private static final String KEY_LG_FACTORY_VERSION = "ro.lge.factoryversion"; // "LGD857AT-00 // -V20b-CUO-CN-FEB-17-2015+0" // 联想 private static final String KEY_LENOVO_DEVICE = "ro.lenovo.device"; // "phone" private static final String KEY_LENOVO_PLATFORM = "ro.lenovo.platform"; // "qualcomm" private static final String KEY_LENOVO_ADB = "ro.lenovo.adb"; // "apkctl,speedup" private static final String VALUE_LENOVO_CLIENT_ID_BASE = "android-lenovo"; /** * ROM 类型 */ private static final ROM ROM_TYPE = initRomType(); /** * 获取 ROM 类型 * * @return ROM */ public static ROM getRomType() { return ROM_TYPE; } /** * 初始化 ROM 类型 */ private static ROM initRomType() { ROM rom = ROM.Other; FileInputStream is = null; try { Properties buildProperties = new Properties(); is = new FileInputStream(new File(Environment.getRootDirectory(), "build.prop")); buildProperties.load(is); if (buildProperties.containsKey(KEY_MIUI_VERSION_NANE) || buildProperties.containsKey(KEY_MIUI_VERSION_CODE)) { // MIUI rom = ROM.MIUI; if (buildProperties.containsKey(KEY_MIUI_VERSION_NANE)) { String versionName = buildProperties.getProperty(KEY_MIUI_VERSION_NANE); if (!TextUtils.isEmpty(versionName) && versionName.matches("[Vv]\\d+")) { // V8 try { rom.setBaseVersion(Integer.parseInt(versionName.split("[Vv]")[1])); } catch (Exception e) { e.printStackTrace(); } } } if (buildProperties.containsKey(KEY_MIUI_VERSION)) { String versionStr = buildProperties.getProperty(KEY_MIUI_VERSION); if (!TextUtils.isEmpty(versionStr) && versionStr.matches("[\\d.]+")) { rom.setVersion(versionStr); } } } else if (buildProperties.containsKey(KEY_EMUI_VERSION) || buildProperties.containsKey(KEY_EMUI_API_LEVEL) || buildProperties.containsKey(KEY_EMUI_SYSTEM_VERSION)) { // EMUI rom = ROM.EMUI; if (buildProperties.containsKey(KEY_EMUI_VERSION)) { String versionStr = buildProperties.getProperty(KEY_EMUI_VERSION); Matcher matcher = Pattern.compile("EmotionUI_([\\d.]+)").matcher(versionStr); // EmotionUI_3.0 if (!TextUtils.isEmpty(versionStr) && matcher.find()) { try { String version = matcher.group(1); rom.setVersion(version); rom.setBaseVersion(Integer.parseInt(version.split("\\.")[0])); } catch (Exception e) { e.printStackTrace(); } } } } else if (buildProperties.containsKey(KEY_FLYME_SETUP) || buildProperties.containsKey(KEY_FLYME_PUBLISHED)) { // Flyme rom = ROM.Flyme; if (buildProperties.containsKey(KEY_DISPLAY_ID)) { String versionStr = buildProperties.getProperty(KEY_DISPLAY_ID); Matcher matcher = Pattern.compile("Flyme[^\\d]*([\\d.]+)[^\\d]*").matcher(versionStr); // Flyme OS 4.5.4.2U if (!TextUtils.isEmpty(versionStr) && matcher.find()) { try { String version = matcher.group(1); rom.setVersion(version); rom.setBaseVersion(Integer.parseInt(version.split("\\.")[0])); } catch (Exception e) { e.printStackTrace(); } } } } else if (buildProperties.containsKey(KEY_COLOROS_VERSION) || buildProperties.containsKey(KEY_COLOROS_THEME_VERSION) || buildProperties.containsKey(KEY_COLOROS_ROM_VERSION)) { // ColorOS rom = ROM.ColorOS; if (buildProperties.containsKey(KEY_COLOROS_ROM_VERSION)) { String versionStr = buildProperties.getProperty(KEY_COLOROS_ROM_VERSION); Matcher matcher = Pattern.compile("ColorOS([\\d.]+)").matcher(versionStr); // // ColorOS2.1 if (!TextUtils.isEmpty(versionStr) && matcher.find()) { try { String version = matcher.group(1); rom.setVersion(version); rom.setBaseVersion(Integer.parseInt(version.split("\\.")[0])); } catch (Exception e) { e.printStackTrace(); } } } } else if (buildProperties.containsKey(KEY_FUNTOUCHOS_OS_NAME) || buildProperties.containsKey(KEY_FUNTOUCHOS_OS_VERSION) || buildProperties.containsKey(KEY_FUNTOUCHOS_DISPLAY_ID)) { // FuntouchOS rom = ROM.FuntouchOS; if (buildProperties.containsKey(KEY_FUNTOUCHOS_OS_VERSION)) { String versionStr = buildProperties.getProperty(KEY_FUNTOUCHOS_OS_VERSION); if (!TextUtils.isEmpty(versionStr) && versionStr.matches("[\\d.]+")) { // 3.0 try { rom.setVersion(versionStr); rom.setBaseVersion(Integer.parseInt(versionStr.split("\\.")[0])); } catch (Exception e) { e.printStackTrace(); } } } } else if (buildProperties.containsKey(KEY_EUI_VERSION) || buildProperties.containsKey(KEY_EUI_NAME) || buildProperties.containsKey(KEY_EUI_MODEL)) { // EUI rom = ROM.EUI; if (buildProperties.containsKey(KEY_EUI_VERSION)) { String versionStr = buildProperties.getProperty(KEY_EUI_VERSION); Matcher matcher = Pattern.compile("([\\d.]+)[^\\d]*").matcher(versionStr); // // 5.9.023S if (!TextUtils.isEmpty(versionStr) && matcher.find()) { try { String version = matcher.group(1); rom.setVersion(version); rom.setBaseVersion(Integer.parseInt(version.split("\\.")[0])); } catch (Exception e) { e.printStackTrace(); } } } } else if (buildProperties.containsKey(KEY_AMIGO_ROM_VERSION) || buildProperties.containsKey(KEY_AMIGO_SYSTEM_UI_SUPPORT)) { // amigo rom = ROM.AmigoOS; if (buildProperties.containsKey(KEY_DISPLAY_ID)) { String versionStr = buildProperties.getProperty(KEY_DISPLAY_ID); Matcher matcher = Pattern.compile("amigo([\\d.]+)[a-zA-Z]*").matcher(versionStr); // // "amigo3.5.1" if (!TextUtils.isEmpty(versionStr) && matcher.find()) { try { String version = matcher.group(1); rom.setVersion(version); rom.setBaseVersion(Integer.parseInt(version.split("\\.")[0])); } catch (Exception e) { e.printStackTrace(); } } } } else if (buildProperties.containsKey(KEY_SONY_PROTOCOL_TYPE) || buildProperties.containsKey(KEY_SONY_ENCRYPTED_DATA)) { // Sony rom = ROM.Sony; } else if (buildProperties.containsKey(KEY_YULONG_VERSION_RELEASE) || buildProperties.containsKey(KEY_YULONG_VERSION_TAG)) { // YuLong rom = ROM.YuLong; } else if (buildProperties.containsKey(KEY_SENSE_BUILD_STAGE) || buildProperties.containsKey(KEY_SENSE_BLUETOOTH_SAP)) { // Sense rom = ROM.Sense; } else if (buildProperties.containsKey(KEY_LG_SW_VERSION) || buildProperties.containsKey(KEY_LG_SW_VERSION_SHORT) || buildProperties.containsKey(KEY_LG_FACTORY_VERSION)) { // LG rom = ROM.LG; } else if (buildProperties.containsKey(KEY_LENOVO_DEVICE) || buildProperties.containsKey(KEY_LENOVO_PLATFORM) || buildProperties.containsKey(KEY_LENOVO_ADB)) { // Lenovo rom = ROM.Lenovo; } else if (buildProperties.containsKey(KEY_DISPLAY_ID)) { String displayId = buildProperties.getProperty(KEY_DISPLAY_ID); if (!TextUtils.isEmpty(displayId)) { if (displayId.contains(VALUE_FLYME_DISPLAY_ID_CONTAIN)) { return ROM.Flyme; } else if (displayId.contains(VALUE_AMIGO_DISPLAY_ID_CONTAIN)) { return ROM.AmigoOS; } } } else if (buildProperties.containsKey(KEY_BASE_OS_VERSION)) { String baseOsVersion = buildProperties.getProperty(KEY_BASE_OS_VERSION); if (!TextUtils.isEmpty(baseOsVersion)) { if (baseOsVersion.contains(VALUE_COLOROS_BASE_OS_VERSION_CONTAIN)) { return ROM.ColorOS; } else if (baseOsVersion.contains(VALUE_SAMSUNG_BASE_OS_VERSION_CONTAIN)) { return ROM.SamSung; } } } else if (buildProperties.containsKey(KEY_CLIENT_ID_BASE)) { String clientIdBase = buildProperties.getProperty(KEY_CLIENT_ID_BASE); switch (clientIdBase) { case VALUE_MIUI_CLIENT_ID_BASE: return ROM.MIUI; case VALUE_COLOROS_CLIENT_ID_BASE: return ROM.ColorOS; case VALUE_FUNTOUCHOS_CLIENT_ID_BASE: return ROM.FuntouchOS; case VALUE_SAMSUNG_CLIENT_ID_BASE: return ROM.SamSung; case VALUE_SONY_CLIENT_ID_BASE: return ROM.Sony; case VALUE_YULONG_CLIENT_ID_BASE: return ROM.YuLong; case VALUE_SENSE_CLIENT_ID_BASE: return ROM.Sense; case VALUE_LENOVO_CLIENT_ID_BASE: return ROM.Lenovo; case VALUE_AMIGO_CLIENT_ID_BASE: return ROM.AmigoOS; default: break; } } } catch (IOException e) { e.printStackTrace(); } finally { if (is != null) { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } } return rom; } public enum ROM { MIUI, // 小米 Flyme, // 魅族 EMUI, // 华为 ColorOS, // OPPO FuntouchOS, // vivo SmartisanOS, // 锤子 EUI, // 乐视 Sense, // HTC AmigoOS, // 金立 _360OS, // 奇酷360 NubiaUI, // 努比亚 H2OS, // 一加 YunOS, // 阿里巴巴 YuLong, // 酷派 SamSung, // 三星 Sony, // 索尼 Lenovo, // 联想 LG, // LG Google, // 原生 Other; // CyanogenMod, Lewa OS, 百度云OS, Tencent OS, 深度OS, IUNI OS, Tapas OS, Mokee private int baseVersion = -1; private String version; public int getBaseVersion() { return baseVersion; } void setBaseVersion(int baseVersion) { this.baseVersion = baseVersion; } public String getVersion() { return version; } void setVersion(String version) { this.version = version; } } }
[ "pm@miotlinl.com" ]
pm@miotlinl.com
450004b5b4cf8aa8e3b354f072817e5b8b1c8f3d
d161711a1db8fa230a99ea95ff8a4bcb88af5ee3
/src/src/javasift/JFilePicker.java
8b67718d3b7d9b841776ca4ec35cbf395d622bd8
[]
no_license
pranayreddy87/Location-Identification-Using-SiFT-java
60972bb99553736db88da62e5a7fe68ffe5cd797
e7b57b161bcfe4fddfd14967995522e9167e8d48
refs/heads/master
2020-12-24T21:23:02.179571
2016-05-23T02:58:04
2016-05-23T02:58:04
59,446,956
0
0
null
null
null
null
UTF-8
Java
false
false
3,168
java
package src.javasift; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class JFilePicker extends JPanel { private String textFieldLabel; private String buttonLabel; private String buttonLabel1; private JLabel label; private JTextField textField; private JButton button; private JButton button1; private JFileChooser fileChooser; private int mode; public static final int MODE_OPEN = 1; public static final int MODE_SAVE = 2; public JFilePicker(String textFieldLabel, String buttonLabel, String buttonLabel1) { this.textFieldLabel = textFieldLabel; this.buttonLabel = buttonLabel; this.buttonLabel1 = buttonLabel1; fileChooser = new JFileChooser(); setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); // creates the GUI label = new JLabel(textFieldLabel); textField = new JTextField(30); button = new JButton(buttonLabel); button1 = new JButton(buttonLabel1); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { buttonActionPerformed(evt); } }); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { buttonActionPerformed1(evt); } }); add(label); add(textField); add(button); add(button1); } private void buttonActionPerformed(ActionEvent evt) { if (mode == MODE_OPEN) { if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { textField.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } else if (mode == MODE_SAVE) { if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { textField.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } } private void buttonActionPerformed1(ActionEvent evt) { String path=fileChooser.getSelectedFile().getAbsolutePath(); System.out.println(path); } public void addFileTypeFilter(String extension, String description) { FileTypeFilter filter = new FileTypeFilter(extension, description); fileChooser.addChoosableFileFilter(filter); } public void setMode(int mode) { this.mode = mode; } public String getSelectedFilePath() { return textField.getText(); } public JFileChooser getFileChooser() { return this.fileChooser; } }
[ "peddireddy.pranay@hotmail.com" ]
peddireddy.pranay@hotmail.com
ade35d5bc77732e91fa69d125c66c7f7fd77707a
5cd31de8d967a9e3f0188617b996f6d070243369
/src/test/java/com/akross/gateway/property/PropertyClientTest.java
9b57685fc192e3fb2efc13dc246ab167a7806050
[]
no_license
mrdgsmith/SpringBoot-Example
e8e5792a56da89990b3941b69792fc4c0774266c
04874868c6323a31e7ad4e45c26c8aaf2389c06b
refs/heads/master
2019-07-01T19:10:19.325415
2017-10-10T22:29:34
2017-10-10T22:29:34
102,485,631
0
0
null
null
null
null
UTF-8
Java
false
false
3,466
java
package com.akross.gateway.property; import com.akross.domain.property.utilities.PropertyConverter; import com.akross.gateway.property.entity.Properties; import com.akross.gateway.property.entity.Property; import com.akross.repository.property.entity.residentialsalesandletting.residentialletting.ResidentialLetting; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import java.util.List; import static com.akross.domain.property.Department.LETTINGS; import static com.akross.gateway.property.enitity.builders.entity.TestPropertiesBuilder.aProperties; import static com.akross.gateway.property.enitity.builders.entity.TestPropertyBuilder.aProperty; import static com.akross.repository.property.entity.residentialsalesandletting.residentialletting.ResidentialLetting.ResidentialLettingBuilder.aResidentialLetting; import static java.math.BigDecimal.valueOf; import static java.util.Arrays.asList; import static org.hamcrest.Matchers.hasItems; import static org.junit.Assert.assertThat; import static org.junit.rules.ExpectedException.none; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class PropertyClientTest { @Rule public ExpectedException expectedException = none(); @Mock private HttpPropertyClient httpPropertyClient; @Mock private PropertyConverter propertyConverter; @InjectMocks private PropertyClient propertyClient; @Test public void shouldReturnPropertiesForResidentialLetting() { final Property property1 = aProperty() .withPropertyId(1L) .withBranchId(1) .withClientName("JUPIX") .withBranchName("Cambridge Office") .withDepartment("Lettings") .withReferenceNumber("4000") .withRent(valueOf(400)) .build(); final Property property2 = aProperty() .withPropertyId(2L) .withBranchId(1) .withClientName("JUPIX") .withBranchName("Cambridge Office") .withDepartment("Lettings") .withReferenceNumber("5000") .withRent(valueOf(500)) .build(); final Properties properties = aProperties() .withProperties(asList(property1, property2)) .build(); when(httpPropertyClient.getProperties()).thenReturn(properties); final ResidentialLetting residentialLetting1 = aResidentialLetting() .withPropertyId(1L) .withDepartment(LETTINGS) .withRent(valueOf(400)) .build(); final ResidentialLetting residentialLetting2 = aResidentialLetting() .withPropertyId(2L) .withDepartment(LETTINGS) .withRent(valueOf(500)) .build(); when(propertyConverter.convertToResidentialLetting(property1)).thenReturn(residentialLetting1); when(propertyConverter.convertToResidentialLetting(property2)).thenReturn(residentialLetting2); final List<com.akross.repository.property.entity.Property> actualProperties = propertyClient.getProperties(); assertThat(actualProperties, hasItems(residentialLetting1, residentialLetting2)); } }
[ "dc4@outlook.com" ]
dc4@outlook.com
5170e7d0363a0bbf49ffa7e9ac20915af3ecbe99
33c33767e8e2f76fdee932bb825e1da25a33d914
/src/main/java/com/feng/baby/support/exception/Validate.java
42c97929c8eefcf4e96908b9b1c25a25856e524c
[]
no_license
fengshuaiju/baby
fd2466cd0dbfe5b22a392ddb5bda4cc6ac60e432
c6799cc9e5c045f5c0c65f934a8f31559ecf5461
refs/heads/master
2021-01-12T18:18:49.960766
2019-01-03T11:29:02
2019-01-03T11:29:02
71,361,407
1
0
null
null
null
null
UTF-8
Java
false
false
50,289
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.feng.baby.support.exception; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.regex.Pattern; /** * <p>This class assists in validating arguments. The validation methods are * based along the following principles: * <ul> * <li>An invalid {@code null} argument causes a {@link NullPointerValidationException}.</li> * <li>A non-{@code null} argument causes an {@link IllegalArgumentValidationException}.</li> * <li>An invalid index into an array/collection/map/string causes an {@link IndexOutOfBoundsValidationException}.</li> * </ul> * * <p>All exceptions messages are * <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax">format strings</a> * as defined by the Java platform. For example:</p> * * <pre> * Validate.isTrue(i > 0, "The value must be greater than zero: %d", i); * Validate.notNull(surname, "The surname must not be %s", null); * </pre> * * <p>#ThreadSafe#</p> * @version $Id: Validate.java 1199983 2011-11-09 21:41:24Z ggregory $ * @see String#format(String, Object...) * @since 2.0 */ public class Validate { private static final String DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE = "The value %s is not in the specified exclusive range of %s to %s"; private static final String DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE = "The value %s is not in the specified inclusive range of %s to %s"; private static final String DEFAULT_MATCHES_PATTERN_EX = "The string %s does not match the pattern %s"; private static final String DEFAULT_IS_NULL_EX_MESSAGE = "The validated object is null"; private static final String DEFAULT_IS_TRUE_EX_MESSAGE = "The validated expression is false"; private static final String DEFAULT_NO_NULL_ELEMENTS_ARRAY_EX_MESSAGE = "The validated array contains null element at index: %d"; private static final String DEFAULT_NO_NULL_ELEMENTS_COLLECTION_EX_MESSAGE = "The validated collection contains null element at index: %d"; private static final String DEFAULT_NOT_BLANK_EX_MESSAGE = "The validated character sequence is blank"; private static final String DEFAULT_NOT_EMPTY_ARRAY_EX_MESSAGE = "The validated array is empty"; private static final String DEFAULT_NOT_EMPTY_CHAR_SEQUENCE_EX_MESSAGE = "The validated character sequence is empty"; private static final String DEFAULT_NOT_EMPTY_COLLECTION_EX_MESSAGE = "The validated collection is empty"; private static final String DEFAULT_NOT_EMPTY_MAP_EX_MESSAGE = "The validated map is empty"; private static final String DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE = "The validated array index is invalid: %d"; private static final String DEFAULT_VALID_INDEX_CHAR_SEQUENCE_EX_MESSAGE = "The validated character sequence index is invalid: %d"; private static final String DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE = "The validated collection index is invalid: %d"; private static final String DEFAULT_VALID_STATE_EX_MESSAGE = "The validated state is false"; private static final String DEFAULT_IS_ASSIGNABLE_EX_MESSAGE = "Cannot assign a %s to a %s"; private static final String DEFAULT_IS_INSTANCE_OF_EX_MESSAGE = "Expected type: %s, actual: %s"; /** * Constructor. This class should not normally be instantiated. */ public Validate() { super(); } // isTrue //--------------------------------------------------------------------------------- /** * <p>Validate that the argument condition is {@code true}; otherwise * throwing an exception with the specified message. This method is useful when * validating according to an arbitrary boolean expression, such as validating a * primitive number or using your own custom validation expression.</p> * * <pre>Validate.isTrue(i > 0.0, "The value must be greater than zero: %d", i);</pre> * * <p>For performance reasons, the long value is passed as a separate parameter and * appended to the exception message only in the case of an error.</p> * * @param expression the boolean expression to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param value the value to append to the message when invalid * @throws IllegalArgumentValidationException if expression is {@code false} * @see #isTrue(boolean) * @see #isTrue(boolean, String, double) * @see #isTrue(boolean, String, Object...) */ public static void isTrue(boolean expression, String message, long value) { if (expression == false) { throw new IllegalArgumentValidationException(String.format(message, Long.valueOf(value))); } } /** * <p>Validate that the argument condition is {@code true}; otherwise * throwing an exception with the specified message. This method is useful when * validating according to an arbitrary boolean expression, such as validating a * primitive number or using your own custom validation expression.</p> * * <pre>Validate.isTrue(d > 0.0, "The value must be greater than zero: %s", d);</pre> * * <p>For performance reasons, the double value is passed as a separate parameter and * appended to the exception message only in the case of an error.</p> * * @param expression the boolean expression to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param value the value to append to the message when invalid * @throws IllegalArgumentValidationException if expression is {@code false} * @see #isTrue(boolean) * @see #isTrue(boolean, String, long) * @see #isTrue(boolean, String, Object...) */ public static void isTrue(boolean expression, String message, double value) { if (expression == false) { throw new IllegalArgumentValidationException(String.format(message, Double.valueOf(value))); } } /** * <p>Validate that the argument condition is {@code true}; otherwise * throwing an exception with the specified message. This method is useful when * validating according to an arbitrary boolean expression, such as validating a * primitive number or using your own custom validation expression.</p> * * <pre> * Validate.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max); * Validate.isTrue(myObject.isOk(), "The object is not okay");</pre> * * @param expression the boolean expression to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @throws IllegalArgumentValidationException if expression is {@code false} * @see #isTrue(boolean) * @see #isTrue(boolean, String, long) * @see #isTrue(boolean, String, double) */ public static void isTrue(boolean expression, String message, Object... values) { if (expression == false) { throw new IllegalArgumentValidationException(String.format(message, values)); } } /** * <p>Validate that the argument condition is {@code true}; otherwise * throwing an exception. This method is useful when validating according * to an arbitrary boolean expression, such as validating a * primitive number or using your own custom validation expression.</p> * * <pre> * Validate.isTrue(i > 0); * Validate.isTrue(myObject.isOk());</pre> * * <p>The message of the exception is &quot;The validated expression is * false&quot;.</p> * * @param expression the boolean expression to check * @throws IllegalArgumentValidationException if expression is {@code false} * @see #isTrue(boolean, String, long) * @see #isTrue(boolean, String, double) * @see #isTrue(boolean, String, Object...) */ public static void isTrue(boolean expression) { if (expression == false) { throw new IllegalArgumentValidationException(DEFAULT_IS_TRUE_EX_MESSAGE); } } // notNull //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument is not {@code null}; * otherwise throwing an exception. * * <pre>Validate.notNull(myObject, "The object must not be null");</pre> * * <p>The message of the exception is &quot;The validated object is * null&quot;.</p> * * @param <T> the object type * @param object the object to check * @return the validated object (never {@code null} for method chaining) * @throws NullPointerValidationException if the object is {@code null} * @see #notNull(Object, String, Object...) */ public static <T> T notNull(T object) { return notNull(object, DEFAULT_IS_NULL_EX_MESSAGE); } /** * <p>Validate that the specified argument is not {@code null}; * otherwise throwing an exception with the specified message. * * <pre>Validate.notNull(myObject, "The object must not be null");</pre> * * @param <T> the object type * @param object the object to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message * @return the validated object (never {@code null} for method chaining) * @throws NullPointerValidationException if the object is {@code null} * @see #notNull(Object) */ public static <T> T notNull(T object, String message, Object... values) { if (object == null) { throw new NullPointerValidationException(String.format(message, values)); } return object; } // notEmpty array //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument array is neither {@code null} * nor a length of zero (no elements); otherwise throwing an exception * with the specified message. * * <pre>Validate.notEmpty(myArray, "The array must not be empty");</pre> * * @param <T> the array type * @param array the array to check, validated not null by this method * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated array (never {@code null} method for chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IllegalArgumentValidationException if the array is empty * @see #notEmpty(Object[]) */ public static <T> T[] notEmpty(T[] array, String message, Object... values) { if (array == null) { throw new NullPointerValidationException(String.format(message, values)); } if (array.length == 0) { throw new IllegalArgumentValidationException(String.format(message, values)); } return array; } /** * <p>Validate that the specified argument array is neither {@code null} * nor a length of zero (no elements); otherwise throwing an exception. * * <pre>Validate.notEmpty(myArray);</pre> * * <p>The message in the exception is &quot;The validated array is * empty&quot;. * * @param <T> the array type * @param array the array to check, validated not null by this method * @return the validated array (never {@code null} method for chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IllegalArgumentValidationException if the array is empty * @see #notEmpty(Object[], String, Object...) */ public static <T> T[] notEmpty(T[] array) { return notEmpty(array, DEFAULT_NOT_EMPTY_ARRAY_EX_MESSAGE); } // notEmpty collection //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument collection is neither {@code null} * nor a size of zero (no elements); otherwise throwing an exception * with the specified message. * * <pre>Validate.notEmpty(myCollection, "The collection must not be empty");</pre> * * @param <T> the collection type * @param collection the collection to check, validated not null by this method * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated collection (never {@code null} method for chaining) * @throws NullPointerValidationException if the collection is {@code null} * @throws IllegalArgumentValidationException if the collection is empty * @see #notEmpty(Object[]) */ public static <T extends Collection<?>> T notEmpty(T collection, String message, Object... values) { if (collection == null) { throw new NullPointerValidationException(String.format(message, values)); } if (collection.isEmpty()) { throw new IllegalArgumentValidationException(String.format(message, values)); } return collection; } /** * <p>Validate that the specified argument collection is neither {@code null} * nor a size of zero (no elements); otherwise throwing an exception. * * <pre>Validate.notEmpty(myCollection);</pre> * * <p>The message in the exception is &quot;The validated collection is * empty&quot;.</p> * * @param <T> the collection type * @param collection the collection to check, validated not null by this method * @return the validated collection (never {@code null} method for chaining) * @throws NullPointerValidationException if the collection is {@code null} * @throws IllegalArgumentValidationException if the collection is empty * @see #notEmpty(Collection, String, Object...) */ public static <T extends Collection<?>> T notEmpty(T collection) { return notEmpty(collection, DEFAULT_NOT_EMPTY_COLLECTION_EX_MESSAGE); } // notEmpty map //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument map is neither {@code null} * nor a size of zero (no elements); otherwise throwing an exception * with the specified message. * * <pre>Validate.notEmpty(myMap, "The map must not be empty");</pre> * * @param <T> the map type * @param map the map to check, validated not null by this method * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated map (never {@code null} method for chaining) * @throws NullPointerValidationException if the map is {@code null} * @throws IllegalArgumentValidationException if the map is empty * @see #notEmpty(Object[]) */ public static <T extends Map<?, ?>> T notEmpty(T map, String message, Object... values) { if (map == null) { throw new NullPointerValidationException(String.format(message, values)); } if (map.isEmpty()) { throw new IllegalArgumentValidationException(String.format(message, values)); } return map; } /** * <p>Validate that the specified argument map is neither {@code null} * nor a size of zero (no elements); otherwise throwing an exception. * * <pre>Validate.notEmpty(myMap);</pre> * * <p>The message in the exception is &quot;The validated map is * empty&quot;.</p> * * @param <T> the map type * @param map the map to check, validated not null by this method * @return the validated map (never {@code null} method for chaining) * @throws NullPointerValidationException if the map is {@code null} * @throws IllegalArgumentValidationException if the map is empty * @see #notEmpty(Map, String, Object...) */ public static <T extends Map<?, ?>> T notEmpty(T map) { return notEmpty(map, DEFAULT_NOT_EMPTY_MAP_EX_MESSAGE); } // notEmpty string //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument character sequence is * neither {@code null} nor a length of zero (no characters); * otherwise throwing an exception with the specified message. * * <pre>Validate.notEmpty(myString, "The string must not be empty");</pre> * * @param <T> the character sequence type * @param chars the character sequence to check, validated not null by this method * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated character sequence (never {@code null} method for chaining) * @throws NullPointerValidationException if the character sequence is {@code null} * @throws IllegalArgumentValidationException if the character sequence is empty * @see #notEmpty(CharSequence) */ public static <T extends CharSequence> T notEmpty(T chars, String message, Object... values) { if (chars == null) { throw new NullPointerValidationException(String.format(message, values)); } if (chars.length() == 0) { throw new IllegalArgumentValidationException(String.format(message, values)); } return chars; } /** * <p>Validate that the specified argument character sequence is * neither {@code null} nor a length of zero (no characters); * otherwise throwing an exception with the specified message. * * <pre>Validate.notEmpty(myString);</pre> * * <p>The message in the exception is &quot;The validated * character sequence is empty&quot;.</p> * * @param <T> the character sequence type * @param chars the character sequence to check, validated not null by this method * @return the validated character sequence (never {@code null} method for chaining) * @throws NullPointerValidationException if the character sequence is {@code null} * @throws IllegalArgumentValidationException if the character sequence is empty * @see #notEmpty(CharSequence, String, Object...) */ public static <T extends CharSequence> T notEmpty(T chars) { return notEmpty(chars, DEFAULT_NOT_EMPTY_CHAR_SEQUENCE_EX_MESSAGE); } // notBlank string //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument character sequence is * neither {@code null}, a length of zero (no characters), empty * nor whitespace; otherwise throwing an exception with the specified * message. * * <pre>Validate.notBlank(myString, "The string must not be blank");</pre> * * @param <T> the character sequence type * @param chars the character sequence to check, validated not null by this method * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated character sequence (never {@code null} method for chaining) * @throws NullPointerValidationException if the character sequence is {@code null} * @throws IllegalArgumentValidationException if the character sequence is blank * @see #notBlank(CharSequence) * * @since 3.0 */ public static <T extends CharSequence> T notBlank(T chars, String message, Object... values) { if (chars == null) { throw new NullPointerValidationException(String.format(message, values)); } if (StringUtils.isBlank(chars)) { throw new IllegalArgumentValidationException(String.format(message, values)); } return chars; } /** * <p>Validate that the specified argument character sequence is * neither {@code null}, a length of zero (no characters), empty * nor whitespace; otherwise throwing an exception. * * <pre>Validate.notBlank(myString);</pre> * * <p>The message in the exception is &quot;The validated character * sequence is blank&quot;.</p> * * @param <T> the character sequence type * @param chars the character sequence to check, validated not null by this method * @return the validated character sequence (never {@code null} method for chaining) * @throws NullPointerValidationException if the character sequence is {@code null} * @throws IllegalArgumentValidationException if the character sequence is blank * @see #notBlank(CharSequence, String, Object...) * * @since 3.0 */ public static <T extends CharSequence> T notBlank(T chars) { return notBlank(chars, DEFAULT_NOT_BLANK_EX_MESSAGE); } // noNullElements array //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument array is neither * {@code null} nor contains any elements that are {@code null}; * otherwise throwing an exception with the specified message. * * <pre>Validate.noNullElements(myArray, "The array contain null at position %d");</pre> * * <p>If the array is {@code null}, then the message in the exception * is &quot;The validated object is null&quot;.</p> * * <p>If the array has a {@code null} element, then the iteration * index of the invalid element is appended to the {@code values} * argument.</p> * * @param <T> the array type * @param array the array to check, validated not null by this method * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated array (never {@code null} method for chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IllegalArgumentValidationException if an element is {@code null} * @see #noNullElements(Object[]) */ public static <T> T[] noNullElements(T[] array, String message, Object... values) { org.apache.commons.lang3.Validate.notNull(array); for (int i = 0; i < array.length; i++) { if (array[i] == null) { Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i)); throw new IllegalArgumentValidationException(String.format(message, values2)); } } return array; } /** * <p>Validate that the specified argument array is neither * {@code null} nor contains any elements that are {@code null}; * otherwise throwing an exception. * * <pre>Validate.noNullElements(myArray);</pre> * * <p>If the array is {@code null}, then the message in the exception * is &quot;The validated object is null&quot;.</p> * * <p>If the array has a {@code null} element, then the message in the * exception is &quot;The validated array contains null element at index: * &quot followed by the index.</p> * * @param <T> the array type * @param array the array to check, validated not null by this method * @return the validated array (never {@code null} method for chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IllegalArgumentValidationException if an element is {@code null} * @see #noNullElements(Object[], String, Object...) */ public static <T> T[] noNullElements(T[] array) { return noNullElements(array, DEFAULT_NO_NULL_ELEMENTS_ARRAY_EX_MESSAGE); } // noNullElements iterable //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument iterable is neither * {@code null} nor contains any elements that are {@code null}; * otherwise throwing an exception with the specified message. * * <pre>Validate.noNullElements(myCollection, "The collection contains null at position %d");</pre> * * <p>If the iterable is {@code null}, then the message in the exception * is &quot;The validated object is null&quot;.</p> * * <p>If the iterable has a {@code null} element, then the iteration * index of the invalid element is appended to the {@code values} * argument.</p> * * @param <T> the iterable type * @param iterable the iterable to check, validated not null by this method * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated iterable (never {@code null} method for chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IllegalArgumentValidationException if an element is {@code null} * @see #noNullElements(Iterable) */ public static <T extends Iterable<?>> T noNullElements(T iterable, String message, Object... values) { org.apache.commons.lang3.Validate.notNull(iterable); int i = 0; for (Iterator<?> it = iterable.iterator(); it.hasNext(); i++) { if (it.next() == null) { Object[] values2 = ArrayUtils.addAll(values, Integer.valueOf(i)); throw new IllegalArgumentValidationException(String.format(message, values2)); } } return iterable; } /** * <p>Validate that the specified argument iterable is neither * {@code null} nor contains any elements that are {@code null}; * otherwise throwing an exception. * * <pre>Validate.noNullElements(myCollection);</pre> * * <p>If the iterable is {@code null}, then the message in the exception * is &quot;The validated object is null&quot;.</p> * * <p>If the array has a {@code null} element, then the message in the * exception is &quot;The validated iterable contains null element at index: * &quot followed by the index.</p> * * @param <T> the iterable type * @param iterable the iterable to check, validated not null by this method * @return the validated iterable (never {@code null} method for chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IllegalArgumentValidationException if an element is {@code null} * @see #noNullElements(Iterable, String, Object...) */ public static <T extends Iterable<?>> T noNullElements(T iterable) { return noNullElements(iterable, DEFAULT_NO_NULL_ELEMENTS_COLLECTION_EX_MESSAGE); } // validIndex array //--------------------------------------------------------------------------------- /** * <p>Validates that the index is within the bounds of the argument * array; otherwise throwing an exception with the specified message.</p> * * <pre>Validate.validIndex(myArray, 2, "The array index is invalid: ");</pre> * * <p>If the array is {@code null}, then the message of the exception * is &quot;The validated object is null&quot;.</p> * * @param <T> the array type * @param array the array to check, validated not null by this method * @param index the index to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated array (never {@code null} for method chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IndexOutOfBoundsValidationException if the index is invalid * @see #validIndex(Object[], int) * * @since 3.0 */ public static <T> T[] validIndex(T[] array, int index, String message, Object... values) { org.apache.commons.lang3.Validate.notNull(array); if (index < 0 || index >= array.length) { throw new IndexOutOfBoundsValidationException(String.format(message, values)); } return array; } /** * <p>Validates that the index is within the bounds of the argument * array; otherwise throwing an exception.</p> * * <pre>Validate.validIndex(myArray, 2);</pre> * * <p>If the array is {@code null}, then the message of the exception * is &quot;The validated object is null&quot;.</p> * * <p>If the index is invalid, then the message of the exception is * &quot;The validated array index is invalid: &quot; followed by the * index.</p> * * @param <T> the array type * @param array the array to check, validated not null by this method * @param index the index to check * @return the validated array (never {@code null} for method chaining) * @throws NullPointerValidationException if the array is {@code null} * @throws IndexOutOfBoundsValidationException if the index is invalid * @see #validIndex(Object[], int, String, Object...) * * @since 3.0 */ public static <T> T[] validIndex(T[] array, int index) { return validIndex(array, index, DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE, Integer.valueOf(index)); } // validIndex collection //--------------------------------------------------------------------------------- /** * <p>Validates that the index is within the bounds of the argument * collection; otherwise throwing an exception with the specified message.</p> * * <pre>Validate.validIndex(myCollection, 2, "The collection index is invalid: ");</pre> * * <p>If the collection is {@code null}, then the message of the * exception is &quot;The validated object is null&quot;.</p> * * @param <T> the collection type * @param collection the collection to check, validated not null by this method * @param index the index to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated collection (never {@code null} for chaining) * @throws NullPointerValidationException if the collection is {@code null} * @throws IndexOutOfBoundsValidationException if the index is invalid * @see #validIndex(Collection, int) * * @since 3.0 */ public static <T extends Collection<?>> T validIndex(T collection, int index, String message, Object... values) { org.apache.commons.lang3.Validate.notNull(collection); if (index < 0 || index >= collection.size()) { throw new IndexOutOfBoundsValidationException(String.format(message, values)); } return collection; } /** * <p>Validates that the index is within the bounds of the argument * collection; otherwise throwing an exception.</p> * * <pre>Validate.validIndex(myCollection, 2);</pre> * * <p>If the index is invalid, then the message of the exception * is &quot;The validated collection index is invalid: &quot; * followed by the index.</p> * * @param <T> the collection type * @param collection the collection to check, validated not null by this method * @param index the index to check * @return the validated collection (never {@code null} for method chaining) * @throws NullPointerValidationException if the collection is {@code null} * @throws IndexOutOfBoundsValidationException if the index is invalid * @see #validIndex(Collection, int, String, Object...) * * @since 3.0 */ public static <T extends Collection<?>> T validIndex(T collection, int index) { return validIndex(collection, index, DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE, Integer.valueOf(index)); } // validIndex string //--------------------------------------------------------------------------------- /** * <p>Validates that the index is within the bounds of the argument * character sequence; otherwise throwing an exception with the * specified message.</p> * * <pre>Validate.validIndex(myStr, 2, "The string index is invalid: ");</pre> * * <p>If the character sequence is {@code null}, then the message * of the exception is &quot;The validated object is null&quot;.</p> * * @param <T> the character sequence type * @param chars the character sequence to check, validated not null by this method * @param index the index to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @return the validated character sequence (never {@code null} for method chaining) * @throws NullPointerValidationException if the character sequence is {@code null} * @throws IndexOutOfBoundsValidationException if the index is invalid * @see #validIndex(CharSequence, int) * * @since 3.0 */ public static <T extends CharSequence> T validIndex(T chars, int index, String message, Object... values) { org.apache.commons.lang3.Validate.notNull(chars); if (index < 0 || index >= chars.length()) { throw new IndexOutOfBoundsValidationException(String.format(message, values)); } return chars; } /** * <p>Validates that the index is within the bounds of the argument * character sequence; otherwise throwing an exception.</p> * * <pre>Validate.validIndex(myStr, 2);</pre> * * <p>If the character sequence is {@code null}, then the message * of the exception is &quot;The validated object is * null&quot;.</p> * * <p>If the index is invalid, then the message of the exception * is &quot;The validated character sequence index is invalid: &quot; * followed by the index.</p> * * @param <T> the character sequence type * @param chars the character sequence to check, validated not null by this method * @param index the index to check * @return the validated character sequence (never {@code null} for method chaining) * @throws NullPointerValidationException if the character sequence is {@code null} * @throws IndexOutOfBoundsValidationException if the index is invalid * @see #validIndex(CharSequence, int, String, Object...) * * @since 3.0 */ public static <T extends CharSequence> T validIndex(T chars, int index) { return validIndex(chars, index, DEFAULT_VALID_INDEX_CHAR_SEQUENCE_EX_MESSAGE, Integer.valueOf(index)); } // validState //--------------------------------------------------------------------------------- /** * <p>Validate that the stateful condition is {@code true}; otherwise * throwing an exception. This method is useful when validating according * to an arbitrary boolean expression, such as validating a * primitive number or using your own custom validation expression.</p> * * <pre> * Validate.validState(field > 0); * Validate.validState(this.isOk());</pre> * * <p>The message of the exception is &quot;The validated state is * false&quot;.</p> * * @param expression the boolean expression to check * @throws IllegalStateValidationException if expression is {@code false} * @see #validState(boolean, String, Object...) * * @since 3.0 */ public static void validState(boolean expression) { if (expression == false) { throw new IllegalStateValidationException(DEFAULT_VALID_STATE_EX_MESSAGE); } } /** * <p>Validate that the stateful condition is {@code true}; otherwise * throwing an exception with the specified message. This method is useful when * validating according to an arbitrary boolean expression, such as validating a * primitive number or using your own custom validation expression.</p> * * <pre>Validate.validState(this.isOk(), "The state is not OK: %s", myObject);</pre> * * @param expression the boolean expression to check * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @throws IllegalStateValidationException if expression is {@code false} * @see #validState(boolean) * * @since 3.0 */ public static void validState(boolean expression, String message, Object... values) { if (expression == false) { throw new IllegalStateValidationException(String.format(message, values)); } } // matchesPattern //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument character sequence matches the specified regular * expression pattern; otherwise throwing an exception.</p> * * <pre>Validate.matchesPattern("hi", "[a-z]*");</pre> * * <p>The syntax of the pattern is the one used in the {@link Pattern} class.</p> * * @param input the character sequence to validate, not null * @param pattern the regular expression pattern, not null * @throws IllegalArgumentValidationException if the character sequence does not match the pattern * @see #matchesPattern(CharSequence, String, String, Object...) * * @since 3.0 */ public static void matchesPattern(CharSequence input, String pattern) { if (Pattern.matches(pattern, input) == false) { throw new IllegalArgumentValidationException(String.format(DEFAULT_MATCHES_PATTERN_EX, input, pattern)); } } /** * <p>Validate that the specified argument character sequence matches the specified regular * expression pattern; otherwise throwing an exception with the specified message.</p> * * <pre>Validate.matchesPattern("hi", "[a-z]*", "%s does not match %s", "hi" "[a-z]*");</pre> * * <p>The syntax of the pattern is the one used in the {@link Pattern} class.</p> * * @param input the character sequence to validate, not null * @param pattern the regular expression pattern, not null * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @throws IllegalArgumentValidationException if the character sequence does not match the pattern * @see #matchesPattern(CharSequence, String) * * @since 3.0 */ public static void matchesPattern(CharSequence input, String pattern, String message, Object... values) { if (Pattern.matches(pattern, input) == false) { throw new IllegalArgumentValidationException(String.format(message, values)); } } // inclusiveBetween //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument object fall between the two * inclusive values specified; otherwise, throws an exception.</p> * * <pre>Validate.inclusiveBetween(0, 2, 1);</pre> * * @param <T> the type of the argument object * @param start the inclusive start value, not null * @param end the inclusive end value, not null * @param value the object to validate, not null * @throws IllegalArgumentValidationException if the value falls out of the boundaries * @see #inclusiveBetween(Object, Object, Comparable, String, Object...) * * @since 3.0 */ public static <T> void inclusiveBetween(T start, T end, Comparable<T> value) { if (value.compareTo(start) < 0 || value.compareTo(end) > 0) { throw new IllegalArgumentValidationException(String.format(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } } /** * <p>Validate that the specified argument object fall between the two * inclusive values specified; otherwise, throws an exception with the * specified message.</p> * * <pre>Validate.inclusiveBetween(0, 2, 1, "Not in boundaries");</pre> * * @param <T> the type of the argument object * @param start the inclusive start value, not null * @param end the inclusive end value, not null * @param value the object to validate, not null * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @throws IllegalArgumentValidationException if the value falls out of the boundaries * @see #inclusiveBetween(Object, Object, Comparable) * * @since 3.0 */ public static <T> void inclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values) { if (value.compareTo(start) < 0 || value.compareTo(end) > 0) { throw new IllegalArgumentValidationException(String.format(message, values)); } } // exclusiveBetween //--------------------------------------------------------------------------------- /** * <p>Validate that the specified argument object fall between the two * exclusive values specified; otherwise, throws an exception.</p> * * <pre>Validate.inclusiveBetween(0, 2, 1);</pre> * * @param <T> the type of the argument object * @param start the exclusive start value, not null * @param end the exclusive end value, not null * @param value the object to validate, not null * @throws IllegalArgumentValidationException if the value falls out of the boundaries * @see #exclusiveBetween(Object, Object, Comparable, String, Object...) * * @since 3.0 */ public static <T> void exclusiveBetween(T start, T end, Comparable<T> value) { if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) { throw new IllegalArgumentValidationException(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } } /** * <p>Validate that the specified argument object fall between the two * exclusive values specified; otherwise, throws an exception with the * specified message.</p> * * <pre>Validate.inclusiveBetween(0, 2, 1, "Not in boundaries");</pre> * * @param <T> the type of the argument object * @param start the exclusive start value, not null * @param end the exclusive end value, not null * @param value the object to validate, not null * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @throws IllegalArgumentValidationException if the value falls out of the boundaries * @see #exclusiveBetween(Object, Object, Comparable) * * @since 3.0 */ public static <T> void exclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values) { if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) { throw new IllegalArgumentValidationException(String.format(message, values)); } } // isInstanceOf //--------------------------------------------------------------------------------- /** * Validates that the argument is an instance of the specified class, if not throws an exception. * * <p>This method is useful when validating according to an arbitrary class</p> * * <pre>Validate.isInstanceOf(OkClass.class, object);</pre> * * <p>The message of the exception is &quot;Expected type: {type}, actual: {obj_type}&quot;</p> * * @param type the class the object must be validated against, not null * @param obj the object to check, null throws an exception * @throws IllegalArgumentValidationException if argument is not of specified class * @see #isInstanceOf(Class, Object, String, Object...) * * @since 3.0 */ public static void isInstanceOf(Class<?> type, Object obj) { if (type.isInstance(obj) == false) { throw new IllegalArgumentValidationException(String.format(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(), obj == null ? "null" : obj.getClass().getName())); } } /** * <p>Validate that the argument is an instance of the specified class; otherwise * throwing an exception with the specified message. This method is useful when * validating according to an arbitrary class</p> * * <pre>Validate.isInstanceOf(OkClass.classs, object, "Wrong class, object is of class %s", * object.getClass().getName());</pre> * * @param type the class the object must be validated against, not null * @param obj the object to check, null throws an exception * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @throws IllegalArgumentValidationException if argument is not of specified class * @see #isInstanceOf(Class, Object) * * @since 3.0 */ public static void isInstanceOf(Class<?> type, Object obj, String message, Object... values) { if (type.isInstance(obj) == false) { throw new IllegalArgumentValidationException(String.format(message, values)); } } // isAssignableFrom //--------------------------------------------------------------------------------- /** * Validates that the argument can be converted to the specified class, if not, throws an exception. * * <p>This method is useful when validating that there will be no casting errors.</p> * * <pre>Validate.isAssignableFrom(SuperClass.class, object.getClass());</pre> * * <p>The message format of the exception is &quot;Cannot assign {type} to {superType}&quot;</p> * * @param superType the class the class must be validated against, not null * @param type the class to check, not null * @throws IllegalArgumentValidationException if type argument is not assignable to the specified superType * @see #isAssignableFrom(Class, Class, String, Object...) * * @since 3.0 */ public static void isAssignableFrom(Class<?> superType, Class<?> type) { if (superType.isAssignableFrom(type) == false) { throw new IllegalArgumentValidationException(String.format(DEFAULT_IS_ASSIGNABLE_EX_MESSAGE, type == null ? "null" : type.getName(), superType.getName())); } } /** * Validates that the argument can be converted to the specified class, if not throws an exception. * * <p>This method is useful when validating if there will be no casting errors.</p> * * <pre>Validate.isAssignableFrom(SuperClass.class, object.getClass());</pre> * * <p>The message of the exception is &quot;The validated object can not be converted to the&quot; * followed by the name of the class and &quot;class&quot;</p> * * @param superType the class the class must be validated against, not null * @param type the class to check, not null * @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param values the optional values for the formatted exception message, null array not recommended * @throws IllegalArgumentValidationException if argument can not be converted to the specified class * @see #isAssignableFrom(Class, Class) */ public static void isAssignableFrom(Class<?> superType, Class<?> type, String message, Object... values) { if (superType.isAssignableFrom(type) == false) { throw new IllegalArgumentValidationException(String.format(message, values)); } } }
[ "shuaiju.feng@jjcargo.com" ]
shuaiju.feng@jjcargo.com
bc969ef3978bdcba787a42cd7066414bb3c2f50e
995b9355776e6f41919f17d8ec0f96b7293181ab
/agency-server/src/test/java/com/al/agency/integration/RestAdministratorIT.java
48e163d322ff708179dc64b9bb757352f0fde5d7
[]
no_license
iGunya/agency
b27b5271de5ce88169eca6e8533d03078d3179a2
f697effd2cc78aaa9c5ae9c4863febe0d898d126
refs/heads/master
2023-08-21T13:08:09.453414
2021-10-02T06:13:44
2021-10-02T06:13:44
384,025,768
0
0
null
null
null
null
UTF-8
Java
false
false
3,165
java
package com.al.agency.integration; import com.al.agency.configs.transport.Transport; import com.al.agency.dto.kafka.TransportMessage; import com.al.agency.entities.User; import com.al.agency.repositories.UserRepository; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.result.MockMvcResultHandlers; import org.springframework.transaction.annotation.Transactional; import static org.junit.matchers.JUnitMatchers.containsString; import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @SpringBootTest @AutoConfigureMockMvc @WithUserDetails("admin") @TestPropertySource(locations = "classpath:application-test.properties") @ContextConfiguration(classes = {TestConfig.class}) @Transactional public class RestAdministratorIT { @Autowired private MockMvc mockMvc; @Autowired private UserRepository userRepository; @Autowired private ObjectMapper objectMapper; @Test public void testUpdateUserOnAdmin() throws Exception { User user = new User(2L, "manager1","","ROLE_USER"); mockMvc.perform(post("/only_for_admins/grand") .content(objectMapper.writeValueAsString(user)) .contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultHandlers.print()) .andExpect(authenticated()) .andExpect(status().isOk()) .andExpect(jsonPath("$").value("Пользователь обновлен")); User updateUserFromDB = userRepository.findByLogin("manager1"); Assertions.assertNotNull(updateUserFromDB); Assertions.assertEquals("ROLE_USER", updateUserFromDB.getRole()); } @Test public void testBadUpdateUserOnAdmin() throws Exception { User user = new User(2L, "admin","","ROLE_USER"); mockMvc.perform(post("/only_for_admins/grand") .content(objectMapper.writeValueAsString(user)) .contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultHandlers.print()) .andExpect(authenticated()) .andExpect(status().isBadRequest()) .andExpect(jsonPath("$").value("Пользователь существует")); } }
[ "al.cuznecz2000@yandex.ru" ]
al.cuznecz2000@yandex.ru
041ef3728167744ee010f531537a06bffc604538
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/29/1270.java
53ae19dc667a2ddd7af2cde484772c6db5e61303
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
package <missing>; public class GlobalMembers { public static int Main() { int m; int i; int j; int c; int a; int b; double s; String tempVar = ConsoleInput.scanfRead(); if (tempVar != null) { m = Integer.parseInt(tempVar); } int[] sz = new int[m]; for (i = 0;i < m;i++) { String tempVar2 = ConsoleInput.scanfRead(); if (tempVar2 != null) { sz[i] = Integer.parseInt(tempVar2); } } for (i = 0;i < m;i++) { s = 0.0; a = 2; b = 1; for (j = 0;j < sz[i];j++) { s += ((1.0 * a) / b); c = a + b; b = a; a = c; c = 0; } System.out.printf("%.3lf\n",s); } return 0; } }
[ "y.yu@open.ac.uk" ]
y.yu@open.ac.uk
e3b25e8ca623678a8a7a524b7204c236b6998462
3904723a20db59786827c746ece3c710f46d37c8
/src/Interpreter/Interpreter.java
3c670b76b77a7a05e1f6587835ae30d7442509bc
[ "MIT" ]
permissive
VieruTudor/Toy-Interpreter-Language
67cadf54562231df08b4bbbd152c2b31f8b8d985
5c37de53de6b34100dde9249fd07bf20ebc9160e
refs/heads/main
2023-02-27T21:42:22.355838
2021-02-06T09:43:37
2021-02-06T09:43:37
336,502,535
0
0
null
null
null
null
UTF-8
Java
false
false
14,744
java
package Interpreter; import Controller.Controller; import Repository.Repository; import View.ExitCommand; import View.RunExample; import View.TextMenu; import model.ProgramState; import model.expression.*; import model.statement.*; import model.types.IntType; import model.types.RefType; import model.types.StringType; import model.values.IntValue; import model.values.StringValue; import java.util.LinkedList; public class Interpreter { public static void main(String[] args) { IStatement state1 = fileTest(); ProgramState programState1 = new ProgramState(state1); Repository repository1 = new Repository("log1.txt"); repository1.addProgramState(programState1); Controller controller1 = new Controller(repository1); IStatement state2 = relationalTest(); ProgramState programState2 = new ProgramState(state2); Repository repository2 = new Repository("log2.txt"); repository2.addProgramState(programState2); Controller controller2 = new Controller(repository2); IStatement state3 = garbageCollectorTest(); ProgramState programState3 = new ProgramState(state3); Repository repository3 = new Repository("log3.txt"); repository3.addProgramState(programState3); Controller controller3 = new Controller(repository3); IStatement state4 = referenceTest(); ProgramState programState4 = new ProgramState(state4); Repository repository4 = new Repository("log4.txt"); repository4.addProgramState(programState4); Controller controller4 = new Controller(repository4); IStatement state5 = whileTest(); ProgramState programState5 = new ProgramState(state5); Repository repository5 = new Repository("log5.txt"); repository5.addProgramState(programState5); Controller controller5 = new Controller(repository5); IStatement state6 = readHeap(); ProgramState programState6 = new ProgramState(state6); Repository repository6 = new Repository("log6.txt"); repository6.addProgramState(programState6); Controller controller6 = new Controller(repository6); IStatement state7 = writeHeap(); ProgramState programState7 = new ProgramState(state7); Repository repository7 = new Repository("log7.txt"); repository7.addProgramState(programState7); Controller controller7 = new Controller(repository7); IStatement state8 = thr2(); ProgramState programState8 = new ProgramState(state8); Repository repository8 = new Repository("log8.txt"); repository8.addProgramState(programState8); Controller controller8 = new Controller(repository8); IStatement state9 = relationalTestFAIL(); ProgramState programState9 = new ProgramState(state9); Repository repository9 = new Repository("log9.txt"); repository9.addProgramState(programState9); Controller controller9 = new Controller(repository9); TextMenu menu = new TextMenu(); menu.addCommand(new ExitCommand("0", "exit")); menu.addCommand(new RunExample("1", state1.toString(), controller1)); menu.addCommand(new RunExample("2", state2.toString(), controller2)); menu.addCommand(new RunExample("3", state3.toString(), controller3)); menu.addCommand(new RunExample("4", state4.toString(), controller4)); menu.addCommand(new RunExample("5", state5.toString(), controller5)); menu.addCommand(new RunExample("6", state6.toString(), controller6)); menu.addCommand(new RunExample("7", state7.toString(), controller7)); menu.addCommand(new RunExample("8", state8.toString(), controller8)); menu.addCommand(new RunExample("9", state9.toString(), controller9)); menu.show(); } public LinkedList<IStatement> getExamples(){ IStatement statement1 = fileTest(); IStatement statement2 = relationalTest(); IStatement statement3 = referenceTest(); IStatement statement4 = garbageCollectorTest(); IStatement statement5 = whileTest(); IStatement statement6 = writeHeap(); IStatement statement7 = readHeap(); IStatement statement8 = thr2(); IStatement statement9 = relationalTestFAIL(); LinkedList<IStatement> stateList = new LinkedList<>(); stateList.add(statement1); stateList.add(statement2); stateList.add(statement3); stateList.add(statement4); stateList.add(statement5); stateList.add(statement6); stateList.add(statement7); stateList.add(statement8); stateList.add(statement9); return stateList; } public static IStatement fileTest() { return new CompStatement(new VarDeclStatement("varf", new StringType()), new CompStatement(new AssignStatement("varf", new ValueExpression(new StringValue("test.in"))), new CompStatement(new VarDeclStatement("varc", new IntType()), new CompStatement(new OpenReadFile(new VariableExpression("varf")), new CompStatement(new ReadFile(new VariableExpression("varf"), "varc"), new CompStatement(new PrintStatement(new VariableExpression("varc")), new CompStatement(new ReadFile(new VariableExpression("varf"), "varc"), new CompStatement(new PrintStatement(new VariableExpression("varc")), new CloseReadFile(new VariableExpression("varf")))))))))); } public static IStatement relationalTest() { return new CompStatement(new VarDeclStatement("x", new IntType()), new CompStatement(new AssignStatement("x", new ValueExpression(new IntValue(2))), new PrintStatement(new RelationalExpression(new VariableExpression("x"), new ValueExpression(new IntValue(3)), "<")))); } public static IStatement referenceTest() { return new CompStatement(new VarDeclStatement("v", new RefType(new IntType())), new CompStatement(new New("v", new ValueExpression(new IntValue(20))), new CompStatement(new VarDeclStatement("a", new RefType(new RefType(new IntType()))), new CompStatement(new New("a", new VariableExpression("v")), new CompStatement(new PrintStatement(new VariableExpression("a")), new PrintStatement(new VariableExpression("v"))))))); } public static IStatement garbageCollectorTest() { return new CompStatement(new VarDeclStatement("v", new RefType(new IntType())), new CompStatement(new New("v", new ValueExpression(new IntValue(20))), new CompStatement(new VarDeclStatement("a", new RefType(new RefType(new IntType()))), new CompStatement(new New("a", new VariableExpression("v")), new CompStatement(new New("v", new ValueExpression(new IntValue(30))), new PrintStatement(new ReadHeap(new ReadHeap(new VariableExpression("a"))))))))); } public static IStatement whileTest() { return new CompStatement(new VarDeclStatement("v", new IntType()), new CompStatement(new AssignStatement("v", new ValueExpression(new IntValue(4))), new CompStatement(new WhileStatement(new RelationalExpression(new VariableExpression("v"), new ValueExpression(new IntValue(0)), ">"), new CompStatement(new PrintStatement(new VariableExpression("v")), new AssignStatement("v", new ArithmeticExpression('-', new VariableExpression("v"), new ValueExpression(new IntValue(1)))))), new PrintStatement(new VariableExpression("v"))))); } public static IStatement writeHeap() { return new CompStatement(new VarDeclStatement("v", new RefType(new IntType())), new CompStatement(new New("v", new ValueExpression(new IntValue(20))), new CompStatement(new PrintStatement(new ReadHeap(new VariableExpression("v"))), new CompStatement(new WriteHeapStatement("v", new ValueExpression(new IntValue(30))), new PrintStatement(new ArithmeticExpression('+', new ReadHeap(new VariableExpression("v")), new ValueExpression(new IntValue(5)))))))); } public static IStatement readHeap() { return new CompStatement(new VarDeclStatement("v", new RefType(new IntType())), new CompStatement(new New("v", new ValueExpression(new IntValue(20))), new CompStatement(new VarDeclStatement("a", new RefType(new RefType(new IntType()))), new CompStatement(new New("a", new VariableExpression("v")), new CompStatement(new PrintStatement(new ReadHeap(new VariableExpression("a"))), new PrintStatement(new ReadHeap(new VariableExpression("v")))))))); } public static IStatement thr2(){ return new CompStatement( new VarDeclStatement( "v", new IntType() ), new CompStatement( new VarDeclStatement( "a", new RefType( new IntType() ) ), new CompStatement( new AssignStatement( "v", new ValueExpression( new IntValue(10) ) ), new CompStatement( new New( "a", new ValueExpression( new IntValue(22) ) ), new CompStatement( new Fork( new CompStatement( new WriteHeapStatement( "a", new ValueExpression( new IntValue(30) ) ), new CompStatement( new AssignStatement( "v", new ValueExpression( new IntValue(32) ) ), new CompStatement( new PrintStatement( new VariableExpression("v") ), new PrintStatement( new ReadHeap( new VariableExpression( "a" ) ) ) ) ) ) ), new CompStatement( new PrintStatement( new VariableExpression( "v" ) ), new PrintStatement( new ReadHeap( new VariableExpression("a") ) ) ) ) ) ) ) ); } public static IStatement relationalTestFAIL() { return new CompStatement(new VarDeclStatement("x", new StringType()), new CompStatement(new AssignStatement("x", new ValueExpression(new IntValue(2))), new PrintStatement(new RelationalExpression(new VariableExpression("x"), new ValueExpression(new IntValue(3)), "<")))); } }
[ "vieru.tudor12@gmail.com" ]
vieru.tudor12@gmail.com
223b889445e1349d2906f63494cb2281919c2b63
cfa2442899d02d91af1c99277b759ae0423c8a55
/simplecrawler/src/main/java/dev/sidney/crawler/simplecrawler/dto/TaskItemDTO.java
2b23a255070b2e38c8ccdb9a82a503f5da31f2fd
[]
no_license
ciltry/devutil_backup
da9829aae583fa7e4cfab223a9f553ab2baf05bc
7be97426272e0bcb2352ceb284726a1b6e905501
refs/heads/master
2021-01-20T11:51:52.995557
2017-03-26T13:10:24
2017-03-26T13:10:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,040
java
/** * */ package dev.sidney.crawler.simplecrawler.dto; import dev.sidney.crawler.simplecrawler.model.TaskItem; import dev.sidney.devutil.store.dto.BaseDTO; /** * @author 杨丰光 2017年3月23日15:14:57 * */ public class TaskItemDTO extends BaseDTO<TaskItem> { public TaskItemDTO() { } public TaskItemDTO(TaskItem model) { super(model); } private String taskId; private String parentTaskItem; private String url; private String status; private String exceptionTrace; public String getTaskId() { return taskId; } public void setTaskId(String taskId) { this.taskId = taskId; } public String getParentTaskItem() { return parentTaskItem; } public void setParentTaskItem(String parentTaskItem) { this.parentTaskItem = parentTaskItem; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getExceptionTrace() { return exceptionTrace; } public void setExceptionTrace(String exceptionTrace) { this.exceptionTrace = exceptionTrace; } @Override public TaskItem toModel() { TaskItemDTO dto = this; TaskItem model = new TaskItem(); model.setExceptionTrace(dto.getExceptionTrace()); model.setGmtCreate(dto.getGmtCreate()); model.setGmtModified(dto.getGmtModified()); model.setId(dto.getId()); model.setParentTaskItem(dto.getParentTaskItem()); model.setStatus(dto.getStatus()); model.setTaskId(dto.getTaskId()); model.setUrl(dto.getUrl()); return model; } @Override public void constructDTO(TaskItem model) { TaskItemDTO dto = this; if (model != null) { dto.setExceptionTrace(model.getExceptionTrace()); dto.setGmtCreate(model.getGmtCreate()); dto.setGmtModified(model.getGmtModified()); dto.setId(model.getId()); dto.setParentTaskItem(model.getParentTaskItem()); dto.setStatus(model.getStatus()); dto.setTaskId(model.getTaskId()); dto.setUrl(model.getUrl()); } } }
[ "ciltr@163.com" ]
ciltr@163.com
ead7cd7a6d22dfcb1a3fd8b51a5a612e22f4a7d8
bb538b01debfeb97a55c9347766c00c7cd574321
/test/models/query/CategoryQueryTest.java
16bf02fb6ad596df084fbb23cc4ff17f1f91cc63
[]
no_license
SuitedTo/suited-to
13767a9ac1a559ed6d1964d87f345f02b21f3ec4
f83ef0dc28721ca491e013b80455f2b3446242c4
refs/heads/master
2020-12-27T20:21:09.948058
2020-02-03T18:56:24
2020-02-03T18:56:24
238,037,890
1
0
null
null
null
null
UTF-8
Java
false
false
1,257
java
package models.query; import models.Category; import models.Category.CategoryStatus; import models.Company; import models.User; import models.query.category.AccessibleCategories; import org.junit.Before; import org.junit.Test; public class CategoryQueryTest extends QueryTest<Category> { @Before public void setup() { super.setup("models/query/test-category-queries.yml"); } @Test public void testAccessibleCategories() { reset(new AccessibleCategories(getUser("me"), null, null, null, null, null)); shouldSelect( "publicCategory", "betaCategory", "newCoworkerCreatedCategory", "privateCoworkerCreatedCategory" ); shouldNotSelect( "newNonCoworkerCreatedCategory", "privateNonCoworkerCreatedCategory" ); testExecution(); } protected void shouldSelect(String... keys){ for(String key : keys){ shouldSelect(getCategory(key)); } } protected void shouldNotSelect(String... keys){ for(String key : keys){ shouldNotSelect(getCategory(key)); } } @Override protected Class<Category> getEntityClass() { return Category.class; } }
[ "gilbertw1@gmail.com" ]
gilbertw1@gmail.com
7d4c80839a709f9f5a389b3e0d43c8eeab10ac5f
bda2a200126b3f251a4e1be150096b146cf31482
/app/src/main/java/com/example/wang/gps/JSONUtile.java
db11d75bf256851ba22a955948cebe1703980908
[]
no_license
wangtong1122/gspmacbook
8e65ba4d1ba18169e7912b3b95fa46e7ec3689c5
d54d3238a8004bf41c1927843f6541c588959ecc
refs/heads/master
2023-04-13T15:22:00.732370
2016-06-08T12:17:24
2016-06-08T12:17:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
649
java
package com.example.wang.gps; import android.util.Log; import org.json.JSONObject; /** * Created by wang on 2016/6/4. */ public class JSONUtile { public static JSONObject jsonObject; public static JSONObject getjson(){ try { jsonObject=new JSONObject(); jsonObject.put("username",GPS.username); jsonObject.put("time",GPS.time); jsonObject.put("locatidis",GPS.ad); jsonObject.put("lati",GPS.la); jsonObject.put("lonti",GPS.lo); } catch (Exception e){ Log.e("getjson",e.toString()); } return jsonObject; } }
[ "164053616@qq.com" ]
164053616@qq.com
415bcc839eb6f67b1b3a26aa80892b3ccea18406
21390dea7f5b79ab66776897541ac36c902b5df0
/java/workspace/testDB/gen/com/wilsonflying/testdb/R.java
f8020aad7681d1ed540c38df371d99f265718ed1
[]
no_license
wilsonfly/test_module
2149b4ba5d567fe6222ceb36a4e5b0aad067e039
76f0875eff308c5df1278975f19a521d69fd6764
refs/heads/master
2021-01-18T18:29:50.443046
2020-07-24T08:32:34
2020-07-24T08:32:34
10,192,384
1
0
null
null
null
null
UTF-8
Java
false
false
2,743
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.wilsonflying.testdb; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080004; public static final int button0=0x7f080000; public static final int button1=0x7f080001; public static final int button2=0x7f080002; public static final int button3=0x7f080003; } public static final class layout { public static final int activity_main=0x7f030000; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050002; public static final int app_name=0x7f050000; public static final int hello_world=0x7f050001; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
[ "wilsonfly.shs@gmail.com" ]
wilsonfly.shs@gmail.com
c51c39fba082e9cb899514046646c92837bb1193
355a5f09f9a86e39ceb169998bf369dc074f25a4
/app/src/main/java/com/example/blink/whether/RowItem.java
fed428642a763677564b8e8529cad4fb32924445
[]
no_license
felixelgato92/Weather
c54717b9db5ca87019b7cd58198c77008a28cf9c
3159685da153214cc56e76589314faab4492d886
refs/heads/master
2020-03-10T15:48:58.573878
2018-04-14T02:43:50
2018-04-14T02:43:50
129,457,852
0
0
null
null
null
null
UTF-8
Java
false
false
2,630
java
package com.example.blink.whether; /** * Created by blink on 4/11/2018. */ import android.graphics.drawable.Drawable; /** * public class RowItem * represent a rowItem puts together button, image and textview into one container. */ public class RowItem { private String cityName; private String cityTemperature; private String lowTemperature; private String highTemperature; private String chanceOfPrecipitation; private String windSpeed; private String humidity; private Drawable drawable; public static final String CITY_NAME = "CITY_NAME"; public static final String TEMP = "TEMPERATURE"; public static final String DRAWABLE = "DRAWABLE"; public static final String LOW_TEMP = "LOW_TEMPERATURE"; public static final String HIGH_TEMP = "HIGH_TEMPERATURE"; public static final String PRECIPITATION = "PRECIPITATION"; public static final String WIND_SPEED = "WIND_SPEED"; public static final String HUMIDITY = "HUMIDITY"; //TODO add the details in here // • Current temperature // • Hi and Low temperature for the day // • Chance of precipitation // • Any other information you find relevant. (Optional) public RowItem(Drawable drawable, String cityName, String cityTemperature ) { this.drawable = drawable; this.cityName = cityName; this.cityTemperature = cityTemperature; } public String getCityName() { return cityName; } public String getCityTemperature() { return cityTemperature; } @Override public String toString() { return cityName; } public Drawable getDrawable() { return drawable; } public void setHighTemperature(String highTemperature) { this.highTemperature = highTemperature; } public void setLowTemperature(String lowTemperature) { this.lowTemperature = lowTemperature; } public void setChanceOfPrecipitation(String chanceOfPrecipitation) { this.chanceOfPrecipitation = chanceOfPrecipitation; } public void setWindSpeed(String windSpeed) { this.windSpeed = windSpeed; } public void setHumidity(String humidity) { this.humidity = humidity; } public String getLowTemperature() { return lowTemperature; } public String getHighTemperature() { return highTemperature; } public String getChanceOfPrecipitation() { return chanceOfPrecipitation; } public String getWindSpeed() { return windSpeed; } public String getHumidity() { return humidity; } }
[ "ffelixelgato92@gmail.com" ]
ffelixelgato92@gmail.com
15b5d3d85a737b1e65639adad9022d89d9be227a
1906cc6793e7ecd9bb556ef1bb8ec21dd7582cbc
/app/src/main/java/com/codzunk/goalkik/data/domain/football/standings/A.java
a916eb47d7af52ffa77e2b81851e454b564e7b09
[]
no_license
imrandev/goalkik
9e03c6a0d5defa1f04c180303cc4219569943081
a77d04cad696ed1dfc6972d4ffae0761c1086726
refs/heads/master
2020-03-19T15:49:49.705133
2018-06-26T16:09:56
2018-06-26T16:09:56
136,687,839
0
0
null
2018-06-20T13:14:35
2018-06-09T03:33:58
Java
UTF-8
Java
false
false
2,429
java
package com.codzunk.goalkik.data.domain.football.standings; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class A { @SerializedName("group") @Expose private String group; @SerializedName("rank") @Expose private Integer rank; @SerializedName("team") @Expose private String team; @SerializedName("teamId") @Expose private Integer teamId; @SerializedName("playedGames") @Expose private Integer playedGames; @SerializedName("crestURI") @Expose private String crestURI; @SerializedName("points") @Expose private Integer points; @SerializedName("goals") @Expose private Integer goals; @SerializedName("goalsAgainst") @Expose private Integer goalsAgainst; @SerializedName("goalDifference") @Expose private Integer goalDifference; public String getGroup() { return group; } public void setGroup(String group) { this.group = group; } public Integer getRank() { return rank; } public void setRank(Integer rank) { this.rank = rank; } public String getTeam() { return team; } public void setTeam(String team) { this.team = team; } public Integer getTeamId() { return teamId; } public void setTeamId(Integer teamId) { this.teamId = teamId; } public Integer getPlayedGames() { return playedGames; } public void setPlayedGames(Integer playedGames) { this.playedGames = playedGames; } public String getCrestURI() { return crestURI; } public void setCrestURI(String crestURI) { this.crestURI = crestURI; } public Integer getPoints() { return points; } public void setPoints(Integer points) { this.points = points; } public Integer getGoals() { return goals; } public void setGoals(Integer goals) { this.goals = goals; } public Integer getGoalsAgainst() { return goalsAgainst; } public void setGoalsAgainst(Integer goalsAgainst) { this.goalsAgainst = goalsAgainst; } public Integer getGoalDifference() { return goalDifference; } public void setGoalDifference(Integer goalDifference) { this.goalDifference = goalDifference; } }
[ "context.imran@gmail.com" ]
context.imran@gmail.com
c30586dcf379cacdef31270b43220c48a1dc4b93
99f5e2d679b4ebf4fddc0218daa672724993b3f0
/Ejercicios/src/awt_swing/JPA/Ejercicio_curso/gui/utils/Apariencia.java
290000768f0a7b02175362a1b6d9285efe779141
[]
no_license
MariaPE10/EjerciciosProg
72924f7b626a3fa311b25740e8d6ed4412a3bf89
699c6d349c961b66c23348831c5d0fe4ec7af11e
refs/heads/master
2022-01-20T00:56:38.520372
2019-05-21T11:52:19
2019-05-21T11:52:19
151,066,442
0
0
null
null
null
null
UTF-8
Java
false
false
2,209
java
package awt_swing.JPA.Ejercicio_curso.gui.utils; import javax.swing.UIManager; import javax.swing.plaf.metal.DefaultMetalTheme; import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.OceanTheme; public class Apariencia { public static int SO_ANFITRION = 0; public static int METAL = 1; public static int GTK = 2; public static int MOTIF = 3; public static int WINDOWS = 4; public static int OCEAN = 5; public static int aparienciasOrdenadas[] = new int[] {WINDOWS, OCEAN, METAL, MOTIF, GTK}; /** * */ public static void setApariencia (int apariencia) throws Exception { switch (apariencia) { case 0: // SO_ANFITRION UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // Look and Feel del sistema operativo instalado break; case 1: // METAL UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); // L&F c�silo Java, llamado "Metal" MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); //MetalLookAndFeel.setCurrentTheme(new OceanTheme()); break; case 2: // GTK UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); // Look and Feel GTK - S�lo en entornos Linux, Unix y Solaris break; case 3: // MOTIF UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); // Look and Feel Motif break; case 4: // WINDOWS UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); // Look and Feel Windows - S�lo en entornos Windows break; case 5: // OCEAN UIManager.setLookAndFeel("javax.swing.plaf.metal.OceanTheme"); // Look and Feel Ocean break; } } /** * * @param apariencias */ public static void setAparienciasOrdenadas (int apariencias[]) { // Por cada apariencia intento ponerla salvo que obtengamos un error, si lo obtengo paso a la siguiente apariencia int i = 0; boolean falloAlCargarApariencia; do { falloAlCargarApariencia = false; try { setApariencia(apariencias[i]); } catch (Exception ex) { i++; falloAlCargarApariencia = true; } } while (falloAlCargarApariencia); } }
[ "diurno@pc-aula" ]
diurno@pc-aula
5f160caeb4d18d0f33a0715a0b5c9c6796b5cc5c
8390730bbac42e710bfb6180fdb9482c879fe349
/week5_Iteration_While_DoWhile/ReverseDigits.java
178f085c7617172d7c24db68bf452ef60db52f90
[]
no_license
Nickson-0/CollegeWork
12b8115dc9d0ee42f37843b7454143cf74b603d4
09b4cb4ca35101377834758a9a04400e36423cc8
refs/heads/master
2020-08-28T12:47:37.451370
2019-10-26T12:10:46
2019-10-26T12:10:46
217,704,504
0
0
null
null
null
null
UTF-8
Java
false
false
854
java
package week5_Iteration_While_DoWhile; import java.util.Scanner; import javax.swing.JOptionPane; /* * Write a program to reverse the order of the digits in a user * supplied integer. For example if the user entered 395 the * system would output 593. */ public class ReverseDigits { public static void main(String[] args) { // TODO Auto-generated method stub String input = JOptionPane.showInputDialog("Enter number to reverse:"); Scanner scanner = new Scanner( input ); int number = scanner.nextInt(); int reversedNumber = 0; int remainingNumber = number; while (remainingNumber > 0) { reversedNumber = reversedNumber*10 + remainingNumber%10; remainingNumber = remainingNumber/10; } JOptionPane.showMessageDialog(null, "The reverse of " + number + " is " + reversedNumber); } }
[ "57009281+Nickson-0@users.noreply.github.com" ]
57009281+Nickson-0@users.noreply.github.com
c16525a1b18d1774d971745e2a87502295c69994
39a7fff792118f9d9934a982c639c64c0702c8e1
/src/main/java/es/udc/acarballal/elmas/web/services/AuthenticationPolicyType.java
4a756b12154f5235ea29024cd858624153ef6113
[]
no_license
adriancarballal/acarballal
eb3b9117da869c38fdf948a32fab71e48c1ce64e
1764b0ed8547b2b348b6b40708cf56c9b63c9514
refs/heads/master
2021-01-10T14:52:13.562777
2009-07-01T04:34:11
2009-07-01T04:34:11
36,657,552
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package es.udc.acarballal.elmas.web.services; public enum AuthenticationPolicyType { ALL_USERS, AUTHENTICATED_USERS, NON_AUTHENTICATED_USERS, ADMINISTRATORS, PARTICIPANTS; }
[ "adriancarballal@931f71b6-b49b-11dd-89c7-03d08fec6209" ]
adriancarballal@931f71b6-b49b-11dd-89c7-03d08fec6209
c7dfdca725aee72fb6a8114b12dde88fe1c19dbd
36a3300e802f63260558d64a4e6bce71e6a32785
/src/com/syntax/class10/Test1.java
3b2a510125f4ace78dbc911799e3e716fdf759a2
[]
no_license
miltaf/JavaBatch6
214445e77d7d7138677f2cfa9cec042f29d2880c
cb480b38948001d404e23e1fb55aa3d5aba75d75
refs/heads/master
2021-04-03T14:41:45.089753
2020-06-15T22:58:00
2020-06-15T22:58:00
248,367,754
1
0
null
null
null
null
UTF-8
Java
false
false
692
java
package com.syntax.class10; import java.util.Scanner; public class Test1 { public static void main (String[] args) { int[] i=new int[4]; i[0]=20; i[1]=30; i[2]=40; i[3]=50; for (int j=0; j<4; j++) { System.out.println(i[j]); } System.out.println("______________________"); Scanner scan=new Scanner (System.in); System.out.println("How many elements do you want to store, buddy?"); int size = scan.nextInt(); int[]nums = new int [size]; for (int w=0; w<size; w++) { System.out.println("Give me a number to store in the array."); nums[w] = scan.nextInt(); } System.out.println("Let's see what you gave me:"); int sum=0; for (int n : nums) { System.out.println(sum+=n); } } }
[ "mahboob.iltaf@gmail.com" ]
mahboob.iltaf@gmail.com
0b58b4b47d0984d8d5505bfb874ec81d29639f83
654c8fbae7079dff7f0bd7ecca528c66c5eb32bc
/src/main/java/org/bvkatwijk/java/jasmine/runner/decide/JasmineCaseProcessor.java
a09cc0f74cf17b5ede208357614819da5f1317ab
[ "MIT" ]
permissive
bvkatwijk/Java-Jasmine
b4b6654068b1879b36df9d7803932ead2a9f3c83
ddcf63fd4160488400c4c8d2110e0233e288084e
refs/heads/main
2021-07-10T16:53:50.868402
2021-04-24T06:37:55
2021-04-24T06:37:55
93,863,529
0
0
MIT
2021-04-24T06:37:56
2017-06-09T13:52:25
Java
UTF-8
Java
false
false
1,425
java
package org.bvkatwijk.java.jasmine.runner.decide; import java.util.Collection; import java.util.function.Consumer; import org.bvkatwijk.java.jasmine.compiled.JasmineBeforeEach; import org.bvkatwijk.java.jasmine.compiled.JasmineCase; import org.bvkatwijk.java.jasmine.compiled.JasmineNode; import org.bvkatwijk.java.jasmine.mode.JasmineMode; import org.bvkatwijk.java.jasmine.runner.ignore.JasmineGroupIgnorer; import org.bvkatwijk.java.jasmine.runner.run.JasmineCaseRunner; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class JasmineCaseProcessor { private final JasmineMode jasmineMode; private final JasmineGroupIgnorer ignorer; private final JasmineCaseRunner runner; public Consumer<? super JasmineCase> processCase(Collection<JasmineBeforeEach> beforeEachs) { return jasmineCase -> runOrIgnoreIt(beforeEachs, jasmineCase); } private void runOrIgnoreIt(Collection<JasmineBeforeEach> beforeEachs, JasmineCase jasmineCase) { if (shouldRun(jasmineMode, jasmineCase)) { beforeEachs.forEach(processBeforeEach()); runner.runIt().accept(jasmineCase); } else { ignorer.ignoreCase().accept(jasmineCase); } } private Consumer<? super JasmineBeforeEach> processBeforeEach() { return beforeEach -> beforeEach.getRunnable().run(); } private boolean shouldRun(JasmineMode jasmineMode, JasmineNode jasmineGroup) { return jasmineMode.getFilter().test(jasmineGroup); } }
[ "BorisK@topdesk.com" ]
BorisK@topdesk.com
95a65ba9ce687dfd982683defcbdbc5275ac7a1c
372e449f06d4b8a5aec1a8c3bbdb6fc0cfd45297
/src/main/java/Farkle/Validation.java
0689ded6eb7308298e69032d9d0aab1d443cefbe
[]
no_license
btwadsworth/FinalProject
9f57686eefd59c51728c90df5b256adcb043df92
7ccc69f37bdd35361a58bedc346e170ebc757e9e
refs/heads/master
2020-05-18T04:48:15.009845
2019-05-15T15:45:22
2019-05-15T15:45:22
184,185,078
0
1
null
2022-11-04T15:21:54
2019-04-30T03:28:10
Java
UTF-8
Java
false
false
810
java
package Farkle; import javax.swing.*; public class Validation { /** * Ben Wadsworth * 5/15/2019 * This class handles some of the validation for the application */ // This checks to see if none of the dice are selected public boolean checkNoneSelected(Dice[] dice){ for (Dice die : dice){ JCheckBox box = die.getCheckbox(); if (box.isEnabled() && box.isSelected()) return false; } return true; } // This checks to see if all of the dice are selected public boolean checkAllSelected(Dice[] dice){ for (Dice die : dice){ JCheckBox box = die.getCheckbox(); if (box.isEnabled() && !box.isSelected()) return false; } return true; } }
[ "btwadsworth@gmail.com" ]
btwadsworth@gmail.com
1b1307f606e51990617396360cd6c61813990a80
e93607816eb3e28fe49f48094f9a3d119cf1d8ac
/Android Examples/CthulhuCameraDemo/app/src/main/java/funkatronics/code/cthulhucamerademo/CameraHandlerThread.java
f54906beeb22187b6bd7ae0e4eef626cf4c32f13
[ "MIT" ]
permissive
nathaniel-mahieu/Cthulhu
f6106842624d6d51abf68ab130cf3b30e4f1e0d3
2f32ce8358828d7a5db984d34d0f3a87f9fe2662
refs/heads/master
2022-12-07T21:02:44.161325
2020-08-26T19:43:41
2020-08-26T19:43:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,289
java
package funkatronics.code.cthulhucamerademo; import android.hardware.Camera; import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import android.os.Process; import android.util.Log; import java.util.List; /** * Custom {@link HandlerThread} that opens an instance of the {@link Camera} object in a dedicated * thread. Once an instance of the the {@link Camera} object has been loaded, a reference is sent * back to the main thread for usage. * * <p> * This thread is used because loading the camera is an expensive operation that should not be * done on the main UI thread. Additionally, any work performed on the camera data is performed * by whatever thread called {@code Camera.open()}, so this allows the image processing to be * contained in a dedicated thread. See * <a href="https://developer.android.com/topic/performance/threads">this</a> article for more * info, particularly the section on {@code HandlerThread}. * </p> * * @author Funkatronics (Marco Martinez) * * @see HandlerThread */ public class CameraHandlerThread extends HandlerThread { /** Tag used for Logging */ private final static String TAG = CameraHandlerThread.class.getSimpleName(); /** ID of the camera being used */ private int mCameraId; /** Instance of {@link Camera} object that holds the camera being used */ private Camera mCamera; /** {@link Handler} to this thread */ private Handler mCameraThreadHandler; /** {@link Handler} to the the main thread */ private Handler mMainThreadHandler; /** Public Constructor * * @param handler a {@link Handler} to the main thread */ CameraHandlerThread(Handler handler) { super("CameraHandlerThread", Process.THREAD_PRIORITY_DISPLAY); start(); mCameraThreadHandler = new Handler(getLooper()); mMainThreadHandler = handler; } /** Start the camera thread and load the camera */ public void startCamera() { mCameraThreadHandler.post(() -> { getCameraInstance(); notifyCameraOpened(); }); } /** Swap between front and back cameras */ public void swapCamera() { try { mCamera.stopPreview(); mCamera.release(); } catch (Exception e) { // Ignore, tried to stop camera that does not exist } mCamera = null; // swap the id of the camera to be used mCameraId = mCameraId == Camera.CameraInfo.CAMERA_FACING_BACK ? Camera.CameraInfo.CAMERA_FACING_FRONT : Camera.CameraInfo.CAMERA_FACING_BACK; // (re)start the camera startCamera(); } /** Get an instance of the {@link Camera} object and set up its parameters */ private void getCameraInstance(){ try { mCamera = Camera.open(mCameraId); // attempt to get a Camera instance Camera.Parameters parameters = mCamera.getParameters(); // Set Preview size to smallest available List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes(); Camera.Size minSize = previewSizes.get(0); for(Camera.Size size : previewSizes) if(size.width < minSize.width) minSize = size; parameters.setPreviewSize(minSize.width, minSize.height); // Set FPS range to max available List<int[]> fpsRanges = parameters.getSupportedPreviewFpsRange(); int[] maxFpsRange = fpsRanges.get(0); for(int[] range : fpsRanges) if(range[0] > maxFpsRange[0]) maxFpsRange = range; parameters.setPreviewFpsRange(maxFpsRange[0], maxFpsRange[1]); // Set parameters mCamera.setParameters(parameters); // If logging enabled, log preview size and FPS range if(MainActivity.LOG) { Log.i(TAG, "Size = " + minSize.width + "x" + minSize.height); Log.i(TAG, "FPS Range = " + maxFpsRange[0]/1000 + " to " + maxFpsRange[1]/1000); } // Set camera orientation (always 90 degrees for portrait) mCamera.setDisplayOrientation(90); } catch (Exception e){ // Camera is not available (in use or does not exist) Log.i(TAG, "Camera not available! It is either already in use, or the " + "requested camera does not exist"); } } /** Notify the main thread that the camera is ready to be used */ synchronized void notifyCameraOpened() { Message msg = new Message(); msg.what = MainActivity.MESSAGE_CAMERA_READY; msg.obj = mCamera; msg.arg1 = mCameraId; mMainThreadHandler.sendMessage(msg); notify(); } }
[ "jjmoritz@sapienllc.com" ]
jjmoritz@sapienllc.com
6f476806b34e399ee531a729b4c643b435014eef
bae29405842e2662b8dfc8909ee38fe5c71469a2
/base-parent/base-security-app/src/main/java/com/base/security/app/social/OpenIdAuthenticationFilter.java
4ea7b27f0386c7b545675c7c315f7b66aecad4d2
[]
no_license
BISSKKP/Springsecurity-oauth2.0
26c8c05df4c99769038b1d0349141e884fd1f663
6ee36ab7745153c7e534431e6d06781448392d21
refs/heads/master
2023-02-03T03:12:32.896158
2020-12-22T09:45:33
2020-12-22T09:45:33
279,559,935
0
2
null
2020-07-14T11:14:39
2020-07-14T10:56:26
Java
UTF-8
Java
false
false
4,614
java
package com.base.security.app.social; import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.util.Assert; import com.base.security.core.constants.SecurityConstants; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Description:用于处理校验openId校验的Filter */ public class OpenIdAuthenticationFilter extends AbstractAuthenticationProcessingFilter { // ~ Static fields/initializers // ===================================================================================== private String openIdParameter = SecurityConstants.DEFAULT_PARAMETER_NAME_OPENID; private String providerIdParameter = SecurityConstants.DEFAULT_PARAMETER_NAME_PROVIDERID; private boolean postOnly = true; // ~ Constructors // =================================================================================================== public OpenIdAuthenticationFilter() { super(new AntPathRequestMatcher(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_OPENID, "POST")); } // ~ Methods // ======================================================================================================== public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { if (postOnly && !request.getMethod().equals("POST")) { throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); } String openid = obtainOpenId(request); String providerId = obtainProviderId(request); if (openid == null) { openid = ""; } if (providerId == null) { providerId = ""; } openid = openid.trim(); providerId = providerId.trim(); OpenIdAuthenticationToken authRequest = new OpenIdAuthenticationToken(openid, providerId); // Allow subclasses to set the "details" property setDetails(request, authRequest); return this.getAuthenticationManager().authenticate(authRequest); } /** * 获取openId */ protected String obtainOpenId(HttpServletRequest request) { return request.getParameter(openIdParameter); } /** * 获取提供商id */ protected String obtainProviderId(HttpServletRequest request) { return request.getParameter(providerIdParameter); } /** * Provided so that subclasses may configure what is put into the * authentication request's details property. * * @param request that an authentication request is being created for * @param authRequest the authentication request object that should have its details * set */ protected void setDetails(HttpServletRequest request, OpenIdAuthenticationToken authRequest) { authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); } /** * Sets the parameter name which will be used to obtain the username from * the login request. * * @param usernameParameter the parameter name. Defaults to "username". */ public void setOpenIdParameter(String openIdParameter) { Assert.hasText(openIdParameter, "Username parameter must not be empty or null"); this.openIdParameter = openIdParameter; } /** * Defines whether only HTTP POST requests will be allowed by this filter. * If set to true, and an authentication request is received which is not a * POST request, an exception will be raised immediately and authentication * will not be attempted. The <tt>unsuccessfulAuthentication()</tt> method * will be called as if handling a failed authentication. * <p> * Defaults to <tt>true</tt> but may be overridden by subclasses. */ public void setPostOnly(boolean postOnly) { this.postOnly = postOnly; } public final String getOpenIdParameter() { return openIdParameter; } public String getProviderIdParameter() { return providerIdParameter; } public void setProviderIdParameter(String providerIdParameter) { this.providerIdParameter = providerIdParameter; } }
[ "928776712@qq.com" ]
928776712@qq.com
3aff644bd94786203915ace66eb915858c4e020d
b0676f1877c3578568f329f806a50675f2434d1e
/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/properties/StreamXProperties.java
a395253a485337f2f59714dcbfe510bfd7061650
[ "Apache-2.0" ]
permissive
soaped/streamx
49b31343afdb049cf943442cc16db397dd77b034
aa8a5b84b91328872280dfed09fb14e832068ce4
refs/heads/main
2023-05-30T19:22:11.275865
2021-06-11T03:04:24
2021-06-11T03:04:24
370,205,072
0
0
NOASSERTION
2021-06-11T03:04:25
2021-05-24T02:28:11
Java
UTF-8
Java
false
false
1,276
java
/* * Copyright (c) 2019 The StreamX Project * <p> * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.streamxhub.streamx.console.base.properties; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @Data @Configuration @ConfigurationProperties(prefix = "streamx") public class StreamXProperties { private ShiroProperties shiro = new ShiroProperties(); private boolean openAopLog = true; }
[ "benjobs@qq.com" ]
benjobs@qq.com
5483393e0901b750ded5796deab29daf4205b4f2
f7c5fb987bd20a8b26f25b6dc3d737a32c3d2630
/persistence/src/main/java/pl/sda/persisence/AuthorRepository.java
d940c7d7d718031e12c0c3125fd4afd05750981a
[]
no_license
MarcinQbix/library
9c15281b8d9d9b290cb095850827c042822a244a
d616d07b5e9ab6302535777e29991b19bf36c953
refs/heads/master
2020-03-23T16:28:37.261803
2018-08-04T08:55:32
2018-08-04T08:55:32
141,811,696
0
0
null
null
null
null
UTF-8
Java
false
false
2,552
java
package pl.sda.persisence; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.ToString; import pl.sda.domain.Author; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class AuthorRepository implements IAuthorRepository { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private static final String AUTHOR_DB_PATH = "C:\\Users\\Marcin\\Desktop\\RepositoryJAVA9KRK\\persistence\\src\\main\\resources\\database.authors\\authors.json"; @Override public void save(Author author) throws IOException { List<Author> authors = OBJECT_MAPPER.readValue(new File(AUTHOR_DB_PATH), new TypeReference<List<Author>>() { }); Long nextID = Long.valueOf(authors.size() + 1); author.setAuthorID(nextID); authors.add(author); OBJECT_MAPPER.writeValue(new File(AUTHOR_DB_PATH), authors); } @Override public void remove(Long id) throws IOException { List<Author> authors = OBJECT_MAPPER.readValue(new File(AUTHOR_DB_PATH), new TypeReference<List<Author>>() { }); for (Author a : authors) { if (id.equals(a.getAuthorID())) a.setRemoved(true); } OBJECT_MAPPER.writeValue(new File(AUTHOR_DB_PATH), authors); // authors.remove(author.getAuthorID()); } @Override public Author read(Long id) throws IOException { List<Author> authors = OBJECT_MAPPER.readValue(new File(AUTHOR_DB_PATH), new TypeReference<List<Author>>() { }); for (Author a : authors) { id.equals(a.getAuthorID()); System.out.println(a); return a; } return null; } @Override public void edit(Author author) throws IOException { List<Author> authors = OBJECT_MAPPER.readValue(new File(AUTHOR_DB_PATH), new TypeReference<List<Author>>() { }); int index=0; for(int i=0; i<=authors.size();i++){ if(author.getAuthorID().equals(authors.get(i).getAuthorID())){ index = i; break; } } authors.set(index,author); OBJECT_MAPPER.writeValue(new File(AUTHOR_DB_PATH),authors); } @Override public List readALL() throws IOException { List<Author> authors = OBJECT_MAPPER.readValue(new File(AUTHOR_DB_PATH), new TypeReference<List<Author>>() { }); return authors; } }
[ "kubiczekmar@gmail.com" ]
kubiczekmar@gmail.com
ec69a9e4dee3f60e21d5db20b1185c00c3060e11
2a811b5d08e62dbbb01d925783463b76c0ca1d44
/JDBC Assesment/phonesimulatorapp/src/com/ustglobal/phonesimulatorapp/dao/ContactDaoImpl.java
45729f529d8232d29bba5f2578f7932bbd241ba3
[]
no_license
soumen1996/USTGlobal-16Sep19-SoumenPati
e405d2d4eeaf0c8e59aee1f3218e1917dfdd9350
94e5ffe1d1061b5159f7638fcf61e0698c96e2e6
refs/heads/master
2023-01-13T10:47:47.349261
2019-12-21T13:48:10
2019-12-21T13:48:10
215,536,647
0
0
null
null
null
null
UTF-8
Java
false
false
2,037
java
package com.ustglobal.phonesimulatorapp.dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.ustglobal.phonesimulatorapp.dto.ContactBean; public class ContactDaoImpl implements ContactDao{ @Override public ArrayList<ContactBean> showAllCOntacts() { System.out.println("Called"); try { Class.forName("com.mysql.jdbc.Driver"); try(Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/contactfile?user=root&password=root")) { try(Statement stmt = con.createStatement()) { ResultSet rs = stmt.executeQuery("select *from contact"); ArrayList<ContactBean> result = new ArrayList<ContactBean>(); while(rs.next()) { ContactBean bean = new ContactBean(); String name = rs.getString(1); bean.setName(name); int number = rs.getInt(2); bean.setNumber(number); String group = rs.getString(3); bean.setGroup(group); result.add(bean); } return result; } } } catch(Exception e) { e.printStackTrace(); return null; } } public ContactBean searchContact(String name) { try { Class.forName("com.mysql.jdbc.Driver"); try(Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/contactfile?user=root&password=root")) { try(PreparedStatement pstm = (PreparedStatement) con.prepareStatement("select *from contact where name = ?")) { pstm.setString(1, name); ResultSet rs = pstm.executeQuery(); if(rs.next()) { ContactBean bean = new ContactBean(); bean.setName(rs.getString(1)); bean.setNumber(rs.getInt(2)); bean.setGroup(rs.getString(3)); return bean; } else { return null; } } } } catch(Exception e) { e.printStackTrace(); return null; } } }
[ "soumen.pati14@gmail.com" ]
soumen.pati14@gmail.com
1ed9f442ec8234e3fb0e50060abf6b4c2e1bc847
43ea6b8fd54f76e49f6e8ed8ec443336cf7db8ac
/uva/UVa11313_GourmetGames.java
1f5ea5c4d242fdf8235c22121ad0d06971081b9e
[]
no_license
mirzainayat92/competitive-programming
68f6c0a5a10cf8d8f14040a385e22e53d03beb70
2d737fb6f69256f62ea5454888f5687f1814ea7b
refs/heads/master
2020-12-22T20:45:48.789657
2018-03-15T03:52:48
2018-03-15T03:52:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package uva; /* USER: 46724 (sfmunera) */ /* PROBLEM: 2288 (11313 - Gourmet Games) */ /* SUBMISSION: 08790587 */ /* SUBMISSION TIME: 2011-04-29 00:37:57 */ /* LANGUAGE: 2 */ import java.util.*; public class UVa11313_GourmetGames { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); while (T-- > 0) { int n = in.nextInt(); int m = in.nextInt(); int cnt = 0; while (n > 1) { n = n - m + 1; ++cnt; } if (n == 1) System.out.println(cnt); else System.out.println("cannot do this"); } } }
[ "sfmunera@gmail.com" ]
sfmunera@gmail.com
811c1e5d7467ff0166047e19e029710f5b3f6094
9af22f473a295369930649fbe078e6ad22f2aded
/Roshambo/RoshamboApp.java
c22cfe5476ef259e43cbff07fd47964ac7abc292
[]
no_license
Rana-Siroosian/Lab14-Roshambo
c9787fdb6c2dca77745e22bc739dddccc370f916
c620c8b729fa1866e5f1fc5a801d7b45842ef451
refs/heads/master
2021-01-02T02:18:20.688668
2020-02-10T07:35:28
2020-02-10T07:35:28
239,450,899
0
0
null
null
null
null
UTF-8
Java
false
false
6,676
java
package Roshambo; /** * * @author >>RanaSiroosian<< * */ import java.util.Scanner; public class RoshamboApp { public static final String ROCK = "ROCK"; public static final String PAPER = "PAPER"; public static final String SCISSORS = "SCISSORS"; public static void main(String[] args) { Scanner scnr = new Scanner (System.in); System.out.println("Welcome to Rock Paper Scissors!\n"); System.out.println("Enter your name: "); String name = scnr.nextLine(); roshamboGame( name); scnr.close(); } public static void roshamboGame( String playerName) { Scanner scnr = new Scanner (System.in); System.out.println("Welcome to the Roshambo Game " + playerName +".\n"); int totalWins = 0; int totalPlay = 0; TheSharks sharks = new TheSharks ("TheSharks"); RockPlayer rock = new RockPlayer("TheRockStar"); boolean loop = false; Player humanPlayer = new HumanPlayer("Rana"); do { int choice = Validator.getInt(scnr, "Would you like to play against 1-TheRockStar or 2-TheSharks (1 or 2)?: ", 1, 2); if (choice == 1) { System.out.println("----------------------------------------"); System.out.println("You are playing against The Rock Star.\n"); String user = humanPlayer.generateRoshambo().toString(); if (user.equals("ROCK")) { System.out.println(humanPlayer.name + ": " + Roshambo.ROCK ); System.out.println(rock.name + ": " + rock.generateRoshambo()); System.out.println("\nIt's a tie! " + humanPlayer.name +" & "+ rock.name +"." ); System.out.println("----------------------------------------"); totalWins += 1; } else if(user.equals("PAPER")) { System.out.println(humanPlayer.name + ": " + Roshambo.PAPER); System.out.println(rock.name + ": " + rock.generateRoshambo()); System.out.println(humanPlayer.name + " \nYou have beaten " + rock.name +"."); System.out.println("----------------------------------------"); totalWins += 1; } else if (user.equals("SCISSORS")) { System.out.println(humanPlayer.name + ": " + Roshambo.SCISSORS); System.out.println(rock.name + ": " + rock.generateRoshambo()); System.out.println("\nSuch a loser! " + humanPlayer.name +"."); System.out.println("----------------------------------------"); } } if (choice == 2) { System.out.println("----------------------------------------"); System.out.println("You are playing against The Sharks.\n"); String shark = sharks.generateRoshambo().toString(); String user = humanPlayer.generateRoshambo().toString(); if (user.equals("ROCK")&& shark.equals(ROCK)) { System.out.println(humanPlayer.name + ": " + Roshambo.ROCK ); System.out.println(sharks.name + ": " + shark); System.out.println("\nIt's a tie! " + humanPlayer.name +" & "+ sharks.name + ".\n"); System.out.println("----------------------------------------"); totalWins += 1; } else if(user.equals("PAPER")&& shark.equals(ROCK)) { System.out.println(humanPlayer.name + ": " + Roshambo.PAPER); System.out.println(sharks.name + ": " + shark); System.out.println(humanPlayer.name + " You have beaten " + sharks.name + "."); System.out.println("----------------------------------------"); totalWins += 1; } else if (user.equals("SCISSORS")&& shark.equals(PAPER)) { System.out.println(humanPlayer.name + ": " + Roshambo.SCISSORS); System.out.println(sharks.name + ": " + shark); System.out.println("\nNice win " + humanPlayer.name + "."); System.out.println("----------------------------------------"); totalWins+=1; } else if (user.equals("SCISSORS")&& shark.equals(SCISSORS)) { System.out.println(humanPlayer.name + ": " + Roshambo.SCISSORS); System.out.println(sharks.name + ": " + shark); System.out.println("\nIt's a tie! " + humanPlayer.name + "."); System.out.println("----------------------------------------"); totalWins+=1; } else if (user.equals("PAPER")&& shark.equals(PAPER)) { System.out.println(humanPlayer.name + ": " + Roshambo.PAPER); System.out.println(sharks.name + ": " + shark); System.out.println("\nIt's a tie! " + humanPlayer.name + "."); System.out.println("----------------------------------------"); totalWins+=1; } else if(user.equals("SCISSORS") && shark.equals(ROCK)) { System.out.println(humanPlayer.name + ": " + Roshambo.SCISSORS); System.out.println(sharks.name + ": " + shark); System.out.println("\nSuch a loser! " + humanPlayer.name + "."); System.out.println("----------------------------------------"); } else if(user.equals("PAPER") && shark.equals(SCISSORS)) { System.out.println(humanPlayer.name + ": " + Roshambo.PAPER); System.out.println(sharks.name + ": " + shark); System.out.println("\nSuch a loser! " + humanPlayer.name + "."); System.out.println("----------------------------------------"); } else if(user.equals("ROCK") && shark.equals(SCISSORS)) { System.out.println(humanPlayer.name + ": " + Roshambo.ROCK); System.out.println(sharks.name + ": " + shark); System.out.println("\nNice win! " + humanPlayer.name + "."); System.out.println("----------------------------------------"); totalWins+=1; } else if(user.equals("ROCK") && shark.equals(PAPER)) { System.out.println(humanPlayer.name + ": " + Roshambo.ROCK); System.out.println(sharks.name + ": " + shark); System.out.println("\nSeems you like to be a loser " + humanPlayer.name+"."); System.out.println("----------------------------------------"); } } totalPlay += 1; System.out.println("\nWould you like to play again? (y/n)"); String Q = Validator.yesOrNo(scnr,""); if (Q.equalsIgnoreCase("y")) loop = true; if(Q.equalsIgnoreCase("n")) loop = false; }while (loop); int totalLoss = totalPlay - totalWins; System.out.println("----------------------------------------"); System.out.println("Here's your score " + humanPlayer.name +":\n"); System.out.println("You played " + totalPlay + " times."); if(totalWins == 1) { System.out.println("You won " + totalWins + " time."); } else { System.out.println("You won " + totalWins + " times."); } if(totalLoss == 1) { System.out.println("You lost " + totalLoss + " time."); } else { System.out.println("You lost " + totalLoss + " times."); } System.out.println("----------------------------------------"); System.out.println("\nHave a great day!"); } }
[ "rana.siroosian@gmail.com" ]
rana.siroosian@gmail.com
bd562b654df1f7a2b0e098e1c1dad1e556c78f95
8451d34731c5bcab9462492093e86193d334c6b8
/net.sf.odinms/src/net/sf/odinms/net/channel/handler/AbstractDealDamageHandler.java
4e85915bc0a7940886835f5df1dd9e6b17fca755
[]
no_license
razfriman/SnowMS
3fda50811ca9873243ee2f3a2038f35611071d43
f57725db7b269d5c905516b627541c81b11740ef
refs/heads/master
2021-07-11T09:21:52.251429
2017-09-30T19:52:02
2017-09-30T19:52:02
105,392,319
7
2
null
null
null
null
UTF-8
Java
false
false
20,212
java
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.odinms.net.channel.handler; import java.awt.Point; import java.util.ArrayList; import java.util.Collections; import java.util.List; import net.sf.odinms.client.ISkill; import net.sf.odinms.client.MapleBuffStat; import net.sf.odinms.client.MapleCharacter; import net.sf.odinms.client.MapleClient; import net.sf.odinms.client.MapleJob; import net.sf.odinms.client.SkillFactory; import net.sf.odinms.client.anticheat.CheatingOffense; import net.sf.odinms.client.status.MonsterStatus; import net.sf.odinms.client.status.MonsterStatusEffect; import net.sf.odinms.net.AbstractMaplePacketHandler; import net.sf.odinms.server.AutobanManager; import net.sf.odinms.server.MapleStatEffect; import net.sf.odinms.server.TimerManager; import net.sf.odinms.server.attack.AttackInfo; import net.sf.odinms.server.attack.AttackInfo.AttackType; import net.sf.odinms.server.life.Element; import net.sf.odinms.server.life.ElementalEffectiveness; import net.sf.odinms.server.life.MapleMonster; import net.sf.odinms.server.maps.MapleMap; import net.sf.odinms.server.maps.MapleMapItem; import net.sf.odinms.server.maps.MapleMapObject; import net.sf.odinms.server.maps.MapleMapObjectType; import net.sf.odinms.tools.MaplePacketCreator; import net.sf.odinms.tools.Pair; import net.sf.odinms.tools.data.input.LittleEndianAccessor; public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandler { protected void applyAttack(AttackInfo attack, MapleCharacter player, int maxDamagePerMonster, int attackCount) { player.getCheatTracker().resetHPRegen(); player.getCheatTracker().checkAttack(attack.getSkill()); ISkill theSkill = null; MapleStatEffect attackEffect = null; if (attack.getSkill() != 0) { theSkill = SkillFactory.getSkill(attack.getSkill()); attackEffect = attack.getAttackEffect(player, theSkill); if (attackEffect == null) { AutobanManager.getInstance().autoban(player.getClient(), "Using a skill he doesn't have (" + attack.getSkill() + ")"); } if (attack.getSkill() != 2301002) { // heal is both an attack and a special move (healing) // so we'll let the whole applying magic live in the special move part if (player.isAlive()) { attackEffect.applyTo(player); } else { player.getClient().getSession().write(MaplePacketCreator.enableActions()); } } } if (!player.isAlive()) { player.getCheatTracker().registerOffense(CheatingOffense.ATTACKING_WHILE_DEAD); return; } // meso explosion has a variable bullet count if (attackCount != attack.getNumDamage() && attack.getSkill() != 4211006) { player.getCheatTracker().registerOffense(CheatingOffense.MISMATCHING_BULLETCOUNT, attack.getNumDamage() + "/" + attackCount); } int totDamage = 0; MapleMap map = player.getMap(); if (attack.getSkill() == 4211006) { // meso explosion for (Pair<Integer, List<Integer>> oned : attack.getAllDamage()) { MapleMapObject mapobject = map.getMapObject(oned.getLeft().intValue()); if (mapobject != null && mapobject.getType() == MapleMapObjectType.ITEM) { MapleMapItem mapitem = (MapleMapItem) mapobject; if (mapitem.getMeso() > 0) { synchronized (mapitem) { if (mapitem.isPickedUp()) { return; } map.removeMapObject(mapitem); map.broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 4, 0), mapitem.getPosition()); mapitem.setPickedUp(true); } } else if (mapitem.getMeso() == 0) { player.getCheatTracker().registerOffense(CheatingOffense.ETC_EXPLOSION); return; } } else if (mapobject != null && mapobject.getType() != MapleMapObjectType.MONSTER) { player.getCheatTracker().registerOffense(CheatingOffense.EXPLODING_NONEXISTANT); return; // etc explosion, exploding nonexistant things, etc. } } } for (Pair<Integer, List<Integer>> oned : attack.getAllDamage()) { MapleMonster monster = map.getMonsterByOid(oned.getLeft().intValue()); if (!monster.getStats().isUndead() && attack.getSkill() == 2301002) { player.getCheatTracker().registerOffense(CheatingOffense.WZ_EDIT); return; } if (monster != null) { int totDamageToOneMonster = 0; for (Integer eachd : oned.getRight()) { totDamageToOneMonster += eachd.intValue(); } totDamage += totDamageToOneMonster; Point playerPos = player.getPosition(); if (totDamageToOneMonster > attack.getNumDamage() + 1) { int dmgCheck = player.getCheatTracker().checkDamage(totDamageToOneMonster); if (dmgCheck > 5) { player.getCheatTracker().registerOffense(CheatingOffense.SAME_DAMAGE, dmgCheck + " times: " + totDamageToOneMonster); } } checkHighDamage(player, monster, attack, theSkill, attackEffect, totDamageToOneMonster, maxDamagePerMonster); double distance = playerPos.distanceSq(monster.getPosition()); if (distance > 360000.0) { // 600^2, 550 is approximatly the range of ultis player.getCheatTracker().registerOffense(CheatingOffense.ATTACK_FARAWAY_MONSTER, Double.toString(Math.sqrt(distance))); // if (distance > 1000000.0) // AutobanManager.getInstance().addPoints(player.getClient(), 50, 120000, "Exceeding attack // range"); } if (!monster.isControllerHasAggro()) { if (monster.getController() == player) { monster.setControllerHasAggro(true); } else { monster.switchController(player, true); } } // only ds, sb, assaulter, normal (does it work for thieves, bs, or assasinate?) if ((attack.getSkill() == 4001334 || attack.getSkill() == 4201005 || attack.getSkill() == 0 || attack.getSkill() == 4211002 || attack.getSkill() == 4211004) && player.getBuffedValue(MapleBuffStat.PICKPOCKET) != null) { handlePickPocket(player, monster, oned); } if (attack.getSkill() == 4101005) { // drain ISkill drain = SkillFactory.getSkill(4101005); int gainhp = (int) ((double) totDamageToOneMonster * (double) drain.getEffect(player.getSkillLevel(drain)).getX() / 100.0); gainhp = Math.min(monster.getMaxHp(), Math.min(gainhp, player.getMaxHp() / 2)); player.addHP(gainhp); } if (player.getJob().isA(MapleJob.WHITEKNIGHT)) { int[] charges = new int[]{1211005, 1211006}; for (int charge : charges) { ISkill chargeSkill = SkillFactory.getSkill(charge); if (player.isBuffFrom(MapleBuffStat.WK_CHARGE, chargeSkill)) { final ElementalEffectiveness iceEffectiveness = monster.getEffectiveness(Element.ICE); if (totDamageToOneMonster > 0 && iceEffectiveness == ElementalEffectiveness.NORMAL || iceEffectiveness == ElementalEffectiveness.WEAK) { MapleStatEffect chargeEffect = chargeSkill.getEffect(player.getSkillLevel(chargeSkill)); MonsterStatusEffect monsterStatusEffect = new MonsterStatusEffect(Collections.singletonMap(MonsterStatus.FREEZE, 1), chargeSkill, false); monster.applyStatus(player, monsterStatusEffect, false, chargeEffect.getY() * 2000); } break; } } } if (totDamageToOneMonster > 0 && attackEffect != null && attackEffect.getMonsterStati().size() > 0) { if (attackEffect.makeChanceResult()) { MonsterStatusEffect monsterStatusEffect = new MonsterStatusEffect(attackEffect.getMonsterStati(), theSkill, false); monster.applyStatus(player, monsterStatusEffect, attackEffect.isPoison(), attackEffect.getDuration()); } } if (monster.getPvpOwner() == null) { map.damageMonster(player, monster, totDamageToOneMonster); } } } if (totDamage > 1) { player.getCheatTracker().setAttacksWithoutHit(player.getCheatTracker().getAttacksWithoutHit() + 1); final int offenseLimit; if (attack.getSkill() != 3121004) { offenseLimit = 100; } else { offenseLimit = 300; } if (player.getCheatTracker().getAttacksWithoutHit() > offenseLimit) { player.getCheatTracker().registerOffense(CheatingOffense.ATTACK_WITHOUT_GETTING_HIT, Integer.toString(player.getCheatTracker().getAttacksWithoutHit())); } } } private void handlePickPocket(MapleCharacter player, MapleMonster monster, Pair<Integer, List<Integer>> oned) { ISkill pickpocket = SkillFactory.getSkill(4211003); int delay = 0; int maxmeso = player.getBuffedValue(MapleBuffStat.PICKPOCKET).intValue(); int reqdamage = 20000; Point monsterPosition = monster.getPosition(); for (Integer eachd : oned.getRight()) { if (pickpocket.getEffect(player.getSkillLevel(pickpocket)).makeChanceResult()) { double perc = (double) eachd / (double) reqdamage; final int todrop = Math.min((int) Math.max(perc * (double) maxmeso, (double) 1), maxmeso); final MapleMap tdmap = player.getMap(); final Point tdpos = new Point((int) (monsterPosition.getX() + (Math.random() * 100) - 50), (int) (monsterPosition.getY())); final MapleMonster tdmob = monster; final MapleCharacter tdchar = player; TimerManager.getInstance().schedule(new Runnable() { public void run() { tdmap.spawnMesoDrop(todrop, todrop, tdpos, tdmob, tdchar, false); } }, delay); delay += 200; } } } private void checkHighDamage(MapleCharacter player, MapleMonster monster, AttackInfo attack, ISkill theSkill, MapleStatEffect attackEffect, int damageToMonster, int maximumDamageToMonster) { int elementalMaxDamagePerMonster; Element element = Element.NEUTRAL; if (theSkill != null) { element = theSkill.getElement(); } if (player.getBuffedValue(MapleBuffStat.WK_CHARGE) != null) { int chargeSkillId = player.getBuffSource(MapleBuffStat.WK_CHARGE); switch (chargeSkillId) { case 1211003: case 1211004: element = Element.FIRE; break; case 1211005: case 1211006: element = Element.ICE; break; case 1211007: case 1211008: element = Element.LIGHTING; break; case 1221003: case 1221004: element = Element.HOLY; break; } ISkill chargeSkill = SkillFactory.getSkill(chargeSkillId); maximumDamageToMonster *= chargeSkill.getEffect(player.getSkillLevel(chargeSkill)).getDamage() / 100.0; } if (element != Element.NEUTRAL) { double elementalEffect; if (attack.getSkill() == 3211003 || attack.getSkill() == 3111003) { // inferno and blizzard elementalEffect = attackEffect.getX() / 200.0; } else { elementalEffect = 0.5; } switch (monster.getEffectiveness(element)) { case IMMUNE: elementalMaxDamagePerMonster = 1; break; case NORMAL: elementalMaxDamagePerMonster = maximumDamageToMonster; break; case WEAK: elementalMaxDamagePerMonster = (int) (maximumDamageToMonster * (1.0 + elementalEffect)); break; case STRONG: elementalMaxDamagePerMonster = (int) (maximumDamageToMonster * (1.0 - elementalEffect)); break; default: throw new RuntimeException("Unknown enum constant"); } } else { elementalMaxDamagePerMonster = maximumDamageToMonster; } if (damageToMonster > elementalMaxDamagePerMonster) { player.getCheatTracker().registerOffense(CheatingOffense.HIGH_DAMAGE); // log.info("[h4x] Player {} is doing high damage to one monster: {} (maxdamage: {}, skill: // {})", // new Object[] { player.getName(), Integer.valueOf(totDamageToOneMonster), // Integer.valueOf(maxDamagePerMonster), Integer.valueOf(attack.getSkill()) }); if (damageToMonster > elementalMaxDamagePerMonster * 3) { // * 3 until implementation of lagsafe pingchecks for buff expiration AutobanManager.getInstance().autoban(player.getClient(), damageToMonster + " damage (level: " + player.getLevel() + " watk: " + player.getTotalWatk() + " skill: " + attack.getSkill() + ", monster: " + monster.getId() + " assumed max damage: " + elementalMaxDamagePerMonster + ")"); } } } public AttackInfo parseDamage(MapleClient c, LittleEndianAccessor lea, AttackType attackType) { AttackInfo ret = new AttackInfo(); ret.setPlayer(c.getPlayer()); ret.setAttackType(attackType); lea.readByte();//TICK ret.setNumAttackedAndDamage(lea.readByte()); ret.setNumAttacked((ret.getNumAttackedAndDamage() >>> 4) & 0xF); // guess why there are no skills damaging more than 15 monsters... ret.setNumDamage(ret.getNumAttackedAndDamage() & 0xF); // how often each single monster was attacked o.o ret.setAllDamage(new ArrayList<Pair<Integer, List<Integer>>>()); ret.setSkill(lea.readInt()); ISkill skill = SkillFactory.getSkill(ret.getSkill()); int imgFileSize = lea.readInt(); ret.setCharge(skill != null && skill.hasCharge() ? lea.readInt() : -1); lea.readInt();//ticks?? ret.setProjectileDisplay(lea.readByte()); lea.readByte(); //new??? ret.setStance(lea.readByte());//Direction/Animation lea.skip(1);//Weapon Subclass ret.setWSpeed(lea.readByte());//Weapon Speed if (ret.getSkill() == 4211006) { return parseMesoExplosion(lea, ret); } switch (ret.getAttackType()) { case RANGED: lea.readByte(); ret.setDirection(lea.readByte()); // contains direction on some 4th job skills lea.skip(7); // hurricane and pierce and rapidfire have extra 4 bytes :/ if (ret.getSkill() == 3121004 || ret.getSkill() == 3221001 || ret.getSkill() == 5221004) { lea.skip(4); } break; default: lea.skip(4); //tick count break; } // TODO we need information if an attack was a critical hit, this requires syncing a random generator between the client and server for (int i = 0; i < ret.getNumAttacked(); i++) { int oid = lea.readInt(); lea.skip(14);//POSITION INFO List<Integer> allDamageNumbers = new ArrayList<Integer>(); for (int j = 0; j < ret.getNumDamage(); j++) { int damage = lea.readInt(); //if(ret.setskill == 3221007) damage += 0x80000000;//Cricitcal Damage = 0x80000000 + damage || Snipe always crit allDamageNumbers.add(Integer.valueOf(damage)); } lea.readInt(); ret.addAllDamage(new Pair<Integer, List<Integer>>(Integer.valueOf(oid), allDamageNumbers)); } return ret; } public AttackInfo parseMesoExplosion(LittleEndianAccessor lea, AttackInfo ret) { if (ret.getNumAttackedAndDamage() == 0) { lea.skip(8); int bullets = lea.readByte(); for (int j = 0; j < bullets; j++) { int mesoid = lea.readInt(); lea.skip(1); ret.addAllDamage(new Pair<Integer, List<Integer>>(Integer.valueOf(mesoid), null)); } return ret; } else { lea.skip(4); } for (int i = 0; i < ret.getNumAttacked() + 1; i++) { int oid = lea.readInt(); if (i < ret.getNumAttacked()) { lea.skip(12); int bullets = lea.readByte(); List<Integer> allDamageNumbers = new ArrayList<Integer>(); for (int j = 0; j < bullets; j++) { int damage = lea.readInt(); allDamageNumbers.add(Integer.valueOf(damage)); } ret.addAllDamage(new Pair<Integer, List<Integer>>(Integer.valueOf(oid), allDamageNumbers)); } else { int bullets = lea.readByte(); for (int j = 0; j < bullets; j++) { int mesoid = lea.readInt(); lea.skip(1); ret.addAllDamage(new Pair<Integer, List<Integer>>(Integer.valueOf(mesoid), null)); } } } return ret; } }
[ "raz.friman@razfriman.com" ]
raz.friman@razfriman.com
56db6bd865112930d5071dfed3d49d5c90e81eac
3cb86776da57a4b8c29b60e4e394295cad083a78
/job/src/main/java/com/github/lfgg123/template/BaseJob.java
009bb86dc330a686cca3efc1f3207885467f7de5
[]
no_license
lfgg123/elastic-job-executor
7b4a2173261d2d98c206c70094421f707ca49af8
59f6556a521a262eb79f1e0321fbf9160be60efd
refs/heads/master
2020-04-05T20:42:20.570789
2019-02-14T08:09:16
2019-02-14T08:09:16
157,192,179
4
0
null
null
null
null
UTF-8
Java
false
false
6,832
java
package com.github.lfgg123.template; import com.alibaba.fastjson.JSON; import com.dangdang.ddframe.job.config.JobCoreConfiguration; import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration; import com.dangdang.ddframe.job.event.JobEventConfiguration; import com.dangdang.ddframe.job.lite.api.JobScheduler; import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration; import com.dangdang.ddframe.job.lite.internal.storage.JobNodePath; import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter; import com.github.lfgg123.compiler.JavaStringCompiler; import com.github.lfgg123.exception.JobOperationException; import com.github.lfgg123.model.SchedulerJob; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.io.IOException; import java.lang.reflect.Field; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 描述: * 任务模板实现类 * * @author chentianlong * @date 2018/06/19 14:57 */ public abstract class BaseJob implements JobOperation { private final Logger logger = LoggerFactory.getLogger(BaseJob.class); @Resource private ZookeeperRegistryCenter regCenter; @Resource private JobEventConfiguration jobEventConfiguration; @Resource private JavaStringCompiler compiler; private static final Pattern MATCHER = Pattern.compile("[a-zA-z]"); private static final Pattern PATTERN = Pattern.compile("\\$\\{([^\\}]+)\\}"); @Value("${package.prefix}") private String packagePrefix; private static final String DISABLED = "DISABLED"; /** * 获取模板 */ protected abstract String getTemplate(); /** * 启动job * * @param config 配置信息 * @param disabled 是否生效 */ public abstract void startup(SchedulerJob config, boolean disabled); @Override public void register(Class<?> clazz, SchedulerJob config, boolean disabled) { String params = JSON.toJSONString(config); logger.info("作业:{}准备注册,作业参数为{}", config.getJobName(), params); // 定义作业核心配置 JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(config.getJobName(), config.getCron(), config.getShardingTotalCount()) .failover(config.isFailover()) .description(config.getDescription()) .shardingItemParameters(config.getShardingItemParameters()) .build(); // 定义SIMPLE类型配置 SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, clazz.getCanonicalName()); // 定义Lite作业根配置 String ip = ""; boolean jobStatus = false; JobNodePath jobNodePath = new JobNodePath(config.getJobName()); try { InetAddress address = InetAddress.getLocalHost(); ip = address.getHostAddress(); logger.info("本机ip为:{}", ip); //不覆盖失效状态 for (String each : regCenter.getChildrenKeys(jobNodePath.getServerNodePath())) { logger.info("任务:{}的节点ip为:{},当前状态为{}", config.getJobName(), each, regCenter.get(jobNodePath.getServerNodePath(each))); if (DISABLED.equals(regCenter.get(jobNodePath.getServerNodePath(each))) && each.equals(ip)) { jobStatus = true; } } } catch (UnknownHostException e) { logger.error("获取ip失败", e); } LiteJobConfiguration simpleJobRootConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).monitorExecution(config.isMonitorExecution()).monitorPort(config.getMonitorPort()).build(); new JobScheduler(regCenter, simpleJobRootConfig, clazz, jobEventConfiguration).init(); if (jobStatus) { regCenter.persist(jobNodePath.getServerNodePath(ip), DISABLED); } //当pre环境时,将所有job都置为失效状态 if (disabled) { for (String each : regCenter.getChildrenKeys(jobNodePath.getServerNodePath())) { regCenter.persist(jobNodePath.getServerNodePath(each), DISABLED); } } logger.info("作业:{}注册成功", config.getJobName()); } @Override public Class<?> compiler(String fileName, String source) { if (StringUtils.isEmpty(source)) { throw new JobOperationException("source code can not be null!"); } if (!MATCHER.matcher(fileName).find()) { throw new JobOperationException("jobName必须为英文字母组成"); } try { Map<String, byte[]> results = compiler.compile(fileName + ".java", source); return compiler.loadClass(packagePrefix + fileName, results); } catch (ClassNotFoundException | IOException e) { logger.error("compiler source error!", e); throw new JobOperationException("compiler source error!"); } } @Override public String resolve(String template, SchedulerJob config) { return parseStringValue(template, config); } private String parseStringValue(String template, SchedulerJob config) { if (StringUtils.isEmpty(template)) { throw new JobOperationException("template can not be null!"); } Matcher matcher = PATTERN.matcher(template); StringBuffer stringBuffer = new StringBuffer(); doMatch(config, matcher, stringBuffer); matcher.appendTail(stringBuffer); return stringBuffer.toString(); } private void doMatch(SchedulerJob config, Matcher matcher, StringBuffer stringBuffer) { while (matcher.find()) { try { String matcherKey = matcher.group(1); Field field = config.getClass().getDeclaredField(matcherKey); field.setAccessible(true); String matcherValue = (String) field.get(config); if (StringUtils.isEmpty(matcherValue)) { if (!"jobParameter".equals(matcherKey)) { throw new JobOperationException("必要参数不能为空!"); } else { matcherValue = ""; } } matcher.appendReplacement(stringBuffer, matcherValue); } catch (IllegalAccessException | NoSuchFieldException e) { logger.error("resolve template error!", e); throw new JobOperationException("resolve template error!"); } } } }
[ "chentl@2345.com" ]
chentl@2345.com
e03a16a4243fc5fac133590bc7b0d9f1c495414a
47afb299c690c858dca4591545a234c481507fdc
/eureka-consumer-ribbon/src/main/java/com/choway/springcloudnotes/eurekaconsumerribbon/TestController.java
7f356d2bf38a263d9bbc57243bdf76464ac0d00b
[]
no_license
choway/springcloud-notes
7ced39ee1741cfdc2b6dac334f4535cb4a104956
f94c2c07be62440a13a0021c2760322b6aec094b
refs/heads/master
2020-03-27T15:51:41.201638
2018-11-21T07:47:49
2018-11-21T07:47:49
146,744,220
0
0
null
null
null
null
UTF-8
Java
false
false
521
java
package com.choway.springcloudnotes.eurekaconsumerribbon; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; @RestController public class TestController { @Autowired private RestTemplate restTemplate; @GetMapping("/test") public Object test() { return restTemplate.getForObject("http://EUREKA-CLIENT/", String.class); } }
[ "354988859@qq.com" ]
354988859@qq.com
fdf3eb000e442b78f0ea67cce077bd44779e53f1
0ac05e3da06d78292fdfb64141ead86ff6ca038f
/OSWE/oswe/openCRX/rtjar/rt.jar.src/com/sun/org/apache/xpath/internal/functions/FuncStringLength.java
82e2ec3399667c024bd7923e57e73cadc841eb56
[]
no_license
qoo7972365/timmy
31581cdcbb8858ac19a8bb7b773441a68b6c390a
2fc8baba4f53d38dfe9c2b3afd89dcf87cbef578
refs/heads/master
2023-07-26T12:26:35.266587
2023-07-17T12:35:19
2023-07-17T12:35:19
353,889,195
7
1
null
null
null
null
UTF-8
Java
false
false
1,219
java
/* */ package com.sun.org.apache.xpath.internal.functions; /* */ /* */ import com.sun.org.apache.xpath.internal.XPathContext; /* */ import com.sun.org.apache.xpath.internal.objects.XNumber; /* */ import com.sun.org.apache.xpath.internal.objects.XObject; /* */ import javax.xml.transform.TransformerException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class FuncStringLength /* */ extends FunctionDef1Arg /* */ { /* */ static final long serialVersionUID = -159616417996519839L; /* */ /* */ public XObject execute(XPathContext xctxt) throws TransformerException { /* 47 */ return new XNumber(getArg0AsString(xctxt).length()); /* */ } /* */ } /* Location: /Users/timmy/timmy/OSWE/oswe/openCRX/rt.jar!/com/sun/org/apache/xpath/internal/functions/FuncStringLength.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
[ "t0984456716" ]
t0984456716