blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
f24734b1f0dda8fe11c55614d3c233f9f78e2106
e9ea97be53f799856ab89da1c96f0bf7cd30f2c4
/Polymorphism/src/animals/Main.java
e81fefc5cd374f70945b9c5d3c070ae75e8ff190
[]
no_license
Chris-Mk/OOP
65bdb5b409ad2ed2bf7992702268523e246e7da6
6d2414e45de389ecfbd9e9a8f978598870457a3f
refs/heads/master
2020-06-25T09:51:02.168026
2019-10-12T13:15:51
2019-10-12T13:15:51
199,277,053
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package animals; public class Main { public static void main(String[] args) { Animal cat = new Cat("Oscar", "Whiskas"); Animal dog = new Dog("Rocky", "Meat"); System.out.println(cat.explainSelf()); System.out.println(dog.explainSelf()); } }
[ "noreply@github.com" ]
Chris-Mk.noreply@github.com
5173ec086b5d1e0b355c314f7ff65a423016f4aa
9ab54a7d05a669e9643382047564091a0d2276b6
/Calculadora/src/TextPanel.java
3df446217926a805b92f6b6d4826dc7fdb65a2ce
[]
no_license
Diegoecj/proyectosJava
9396e5d6d7520e1e63904d3d69e6500e2c0b0768
c03cdf8d4d5b9f945075577116128c6d4699f79c
refs/heads/master
2020-04-24T15:35:23.790200
2014-02-25T03:23:02
2014-02-25T03:23:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
997
java
import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class TextPanel extends JPanel { private JTextArea textArea; private JTextArea textArea2; private JButton btn; private JButton btn2; //constructor public TextPanel(){ setLayout(new BorderLayout()); btn=new JButton("1"); btn2=new JButton("2"); btn.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub textArea.append("1"); //textArea2.append("3"); } }); textArea=new JTextArea(); textArea2=new JTextArea(); add(btn,BorderLayout.SOUTH); add(btn2,BorderLayout.WEST); add(new JScrollPane(textArea),BorderLayout.CENTER); //add(new JScrollPane(textArea2),BorderLayout.CENTER); } }
[ "ddiego_msd@hotmail.com" ]
ddiego_msd@hotmail.com
371212ad63bc8844eed2c0bb5fd965fd997739ea
4547c4a06d74a2ab14acea62b84c238abdcf7b09
/src/com/app/pictolike/SignUpActivity.java
12f7bce9e4e72f1cf40a59d9fed9e025fda8b66c
[]
no_license
pictodroid/StageSignIn
65bc37ebd9dfcad8269fb0bd02557a69c84b7238
51707a34415fb39f49f5e461b79ac15bdfc7d4f2
refs/heads/master
2016-09-10T16:26:03.372549
2014-10-10T19:42:23
2014-10-10T19:42:23
24,165,267
0
0
null
null
null
null
UTF-8
Java
false
false
6,685
java
package com.app.pictolike; import java.util.Calendar; import java.util.Scanner; import android.app.ActionBar; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.provider.Settings.Secure; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.DatePicker; import android.widget.EditText; import android.widget.Toast; import com.app.pictolike.mysql.MySQLCommand; import com.app.pictolike.mysql.MySQLConnect; public class SignUpActivity extends Activity { private Calendar cal; private int day; private int month; private int year; EditText m_edtUserName; EditText m_edtEmail; EditText m_edtPassword; EditText m_edtBirthday; String sel_gen= "" ; private MySQLCommand.OnCompleteListener m_oSqlListener = new MySQLCommand.OnCompleteListener() { @Override public void OnComplete(Object result) { Boolean b = (Boolean) result; if (b.booleanValue()) { Toast.makeText(SignUpActivity.this, "Sign up successfully", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(SignUpActivity.this, SignInActivity.class); //intent.putExtra("username", m_edtUserName.getText().toString()+""); startActivity(intent); finish(); } else { Toast.makeText(SignUpActivity.this, "Sign up failed", Toast.LENGTH_SHORT).show(); } } }; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); /** Code to change Action Bar Color */ ActionBar bar = getActionBar(); bar.hide(); //ColorDrawable cd = new ColorDrawable(0xFFFBAC00); //bar.setBackgroundDrawable(cd); setContentView(R.layout.activty_signup); m_edtUserName = (EditText) findViewById(R.id.reg_email_edittext); m_edtEmail = (EditText) findViewById(R.id.reg_email_edittext); m_edtPassword = (EditText) findViewById(R.id.reg_password_edittext); m_edtBirthday= (EditText) findViewById(R.id. reg_birthday_edittext); cal = Calendar.getInstance(); day = cal.get(Calendar.DAY_OF_MONTH); month = cal.get(Calendar.MONTH); year = cal.get(Calendar.YEAR); findViewById(R.id. reg_birthday_edittext).setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { //onSignUp(); showDialog(0); Log.d("Birthday", "Inside Birthday Button"); } }); findViewById(R.id.reg_email_edittext).setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { //onSignUp(); Log.d("Email Button", "Inside Email Button"); } }); findViewById(R.id.reg_password_edittext).setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { //onSignUp(); Log.d("Password Button", "Inside password Button"); } }); findViewById(R.id.image_gen_male).setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { //onSignUp(); Log.d("male gender Button", "select status"); sel_gen= "male"; } }); findViewById(R.id.image_gen_female).setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { //onSignUp(); Log.d("female gender Button", "select status"); sel_gen= "female"; } }); findViewById(R.id.sign_up_btn).setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if(validate()){ onSignUp(); } Log.d("Login Button", "select status"); } }); } public boolean validate(){ if(m_edtEmail.getText().toString().isEmpty()){ Toast.makeText(SignUpActivity.this, "Please Fill Email", Toast.LENGTH_SHORT).show(); return false; } if(SignUpEventHandler.EmailInputCheck(m_edtEmail.getText())){ Toast.makeText(SignUpActivity.this, "Wrong Input Email Address", Toast.LENGTH_SHORT).show(); return false; } else if(m_edtPassword.getText().toString().isEmpty()){ Toast.makeText(SignUpActivity.this, "Please Fill Password", Toast.LENGTH_SHORT).show(); return false; } else if(m_edtBirthday.getText().toString().isEmpty()){ Toast.makeText(SignUpActivity.this, "Please Select Birthday", Toast.LENGTH_SHORT).show(); return false; } else if(sel_gen.isEmpty()){ Toast.makeText(SignUpActivity.this, "Please Select Gender", Toast.LENGTH_SHORT).show(); return false; } else { return true; } } public void onSignUp() { String email = m_edtEmail.getText().toString(); String name = m_edtUserName.getText().toString(); String password= m_edtPassword.getText().toString(); String birthday= m_edtBirthday.getText().toString(); MySQLConnect.signup(name, email, password, birthday, sel_gen, m_oSqlListener); String deviceId = userPhoneIDExport(); } public String userPhoneIDExport() { String deviceId = Secure.getString(this.getContentResolver(), Secure.ANDROID_ID); return deviceId; } class FinddayFromFile extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { String Day=""; try{ Scanner sc=new Scanner(getResources().openRawResource(R.raw.weekday)); while(sc.hasNext()) { String str=sc.nextLine(); if(str.contains(params[0])) { Day=str; break; } } sc.close(); }catch(Exception e) { Log.e("error", e.toString()); } if(!Day.equals("")) { String array[]=Day.split(","); Log.d(array[0], array[1]); return array[1]; } else return ""; } @Override protected void onPostExecute(String result) { if(!result.equals("")) Toast.makeText(SignUpActivity.this,"did you know that you were born on a "+result+"?!" ,Toast.LENGTH_LONG).show(); super.onPostExecute(result); } } @Override @Deprecated protected Dialog onCreateDialog(int id) { return new DatePickerDialog(this, datePickerListener, year, month, day); } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { m_edtBirthday.setText(selectedDay + " / " + (selectedMonth + 1) + " / " + selectedYear); new FinddayFromFile().execute((selectedMonth + 1)+"-"+selectedDay+"-"+selectedYear); } }; }
[ "hup128@psu.edu" ]
hup128@psu.edu
a0fbd952c30401ae82f03f93049c3529736ffd2d
6832918e1b21bafdc9c9037cdfbcfe5838abddc4
/jdk_8_maven/cs/graphql/petclinic-graphql/src/main/java/org/springframework/samples/petclinic/model/Person.java
5e8655d920741d24bb026ccf3b8916a7449ae737
[ "Apache-2.0", "GPL-1.0-or-later", "LGPL-2.0-or-later" ]
permissive
EMResearch/EMB
200c5693fb169d5f5462d9ebaf5b61c46d6f9ac9
092c92f7b44d6265f240bcf6b1c21b8a5cba0c7f
refs/heads/master
2023-09-04T01:46:13.465229
2023-04-12T12:09:44
2023-04-12T12:09:44
94,008,854
25
14
Apache-2.0
2023-09-13T11:23:37
2017-06-11T14:13:22
Java
UTF-8
Java
false
false
1,440
java
/* * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.samples.petclinic.model; import org.hibernate.validator.constraints.NotEmpty; import javax.persistence.Column; import javax.persistence.MappedSuperclass; /** * Simple JavaBean domain object representing an person. * * @author Ken Krebs */ @MappedSuperclass public class Person extends BaseEntity { @Column(name = "first_name") @NotEmpty protected String firstName; @Column(name = "last_name") @NotEmpty protected String lastName; public String getFirstName() { return this.firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return this.lastName; } public void setLastName(String lastName) { this.lastName = lastName; } }
[ "arcuri82@gmail.com" ]
arcuri82@gmail.com
0c1a78f25a41c9b9289d206d64ffec19793feb0e
9f8da47949dfcba19ab791f53d4fb5c84be5a315
/src/main/java/bumblebee/core/exceptions/BusinessException.java
5eafe625580410cc898eb10c4be94d2ad118dd91
[]
no_license
webgoal/bumblebee
aafbf0580e86accd56652d44d98663ef4a09e7bc
cce1e294998f23a7ab96a7600db6703768d80cbe
refs/heads/master
2022-10-01T10:35:02.928786
2022-09-03T05:04:07
2022-09-03T05:04:07
58,248,419
1
0
null
null
null
null
UTF-8
Java
false
false
211
java
package bumblebee.core.exceptions; public class BusinessException extends RuntimeException { private static final long serialVersionUID = 1L; public BusinessException(Throwable cause) { super(cause); } }
[ "altiereslopes@webgoal.com.br" ]
altiereslopes@webgoal.com.br
cd17ca94ac264f94b9f0600f16a7e1014288a7d4
bfa4da4077803410e30232f0f8d101b8283d19d0
/src/OperateTest.java
239ffd1cddb9d85f684f63fcea5c7abe0efb6776
[]
no_license
LannibaleS/JAVA
2f3b28f945f094fb419a90e983bb0d380aff4c9c
de530c8d8357d33a941a1dd2ce545c2c37207683
refs/heads/master
2020-07-09T13:32:56.527239
2016-09-08T13:41:43
2016-09-08T13:41:43
67,700,536
0
0
null
null
null
null
GB18030
Java
false
false
962
java
public class OperateTest { public static void main(String[] args){ //1、最有效率2*8 System.out.println(2<<3); //2、两个整数变量的值进行互换,不要第三方变量 int a=3 , b=7; //通过求和的方式,有个弊端,两个数据较大,会超出int的范围 a = a + b; //a = 3+7 =10 b = a - b; //b = 3+7-7 = 3 a = a - b; //a = 3 + 7 - 3 = 7 //通过位运算 a = a^b; // a = 3^7 b = a^b; // b = 3^7^7 = 3 System.out.println("b="+b); a = a^b; // a = 3^7^3 = 7 System.out.println("a="+a); //三元运算符,格式:(条件表达式)?表达式1:表达式2 int x = 2,y; y = x>1?100:200; System.out.println("y="+y); //需求:三个数,想知道最大的是哪一个 int w = 14, e = 456, r = 678, max; max = w > e ? (w > r ? w : r) : (e > r ? e : r); //a > b ? (a > c ? a : c) : (b > c ? b : c); System.out.println("max="+max); } }
[ "651041029@qq.com" ]
651041029@qq.com
e994de9b1eb1ead237bb9da91e4f1fa7175ad087
32e121db9a490b3417cc04c7aecafe532a9a2a05
/main/java/com/example/alejandrotorresruiz/taller/Activities/SettingsActivity.java
a635884eaa355f3c8102d52a1ab407b0204c6eee
[]
no_license
AlejandroTorresDEV/GestionTallerMecanico
2ba551c17af911d4661b527de66ade40c856de6b
b55dbe2b0d78a0c5fc45c29d7278a8ccceaf74c9
refs/heads/master
2020-05-07T17:56:35.809025
2019-04-11T18:19:01
2019-04-11T18:19:01
180,747,925
0
0
null
null
null
null
UTF-8
Java
false
false
10,157
java
package com.example.alejandrotorresruiz.taller.Activities; import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.RingtonePreference; import android.support.v7.app.ActionBar; import android.text.TextUtils; import android.view.MenuItem; import com.example.alejandrotorresruiz.taller.R; import java.util.List; /** * A {@link PreferenceActivity} that presents a set of application settings. On * handset devices, settings are presented as a single list. On tablets, * settings are split by category, with category headers shown to the left of * the list of settings. * <p> * See <a href="http://developer.android.com/design/patterns/settings.html"> * Android Design: Settings</a> for design guidelines and the <a * href="http://developer.android.com/guide/topics/ui/settings.html">Settings * API Guide</a> for more information on developing a Settings UI. */ public class SettingsActivity extends AppCompatPreferenceActivity { /** * A preference value change listener that updates the preference's summary * to reflect its new value. */ private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list. ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); // Set the summary to reflect the new value. preference.setSummary( index >= 0 ? listPreference.getEntries()[index] : null); } else if (preference instanceof RingtonePreference) { // For ringtone preferences, look up the correct display value // using RingtoneManager. if (TextUtils.isEmpty(stringValue)) { // Empty values correspond to 'silent' (no ringtone). preference.setSummary(R.string.pref_ringtone_silent); } else { Ringtone ringtone = RingtoneManager.getRingtone( preference.getContext(), Uri.parse(stringValue)); if (ringtone == null) { // Clear the summary if there was a lookup error. preference.setSummary(null); } else { // Set the summary to reflect the new ringtone display // name. String name = ringtone.getTitle(preference.getContext()); preference.setSummary(name); } } } else { // For all other preferences, set the summary to the value's // simple string representation. preference.setSummary(stringValue); } return true; } }; /** * Helper method to determine if the device has an extra-large screen. For * example, 10" tablets are extra-large. */ private static boolean isXLargeTablet(Context context) { return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE; } /** * Binds a preference's summary to its value. More specifically, when the * preference's value is changed, its summary (line of text below the * preference title) is updated to reflect the value. The summary is also * immediately updated upon calling this method. The exact display format is * dependent on the type of preference. * * @see #sBindPreferenceSummaryToValueListener */ private static void bindPreferenceSummaryToValue(Preference preference) { // Set the listener to watch for value changes. preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); // Trigger the listener immediately with the preference's // current value. sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, PreferenceManager .getDefaultSharedPreferences(preference.getContext()) .getString(preference.getKey(), "")); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setupActionBar(); } /** * Set up the {@link android.app.ActionBar}, if the API is available. */ private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); } } /** * {@inheritDoc} */ @Override public boolean onIsMultiPane() { return isXLargeTablet(this); } /** * {@inheritDoc} */ @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.xml.pref_headers, target); } /** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); } /** * This fragment shows general preferences only. It is used when the * activity is showing a two-pane settings UI. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static class GeneralPreferenceFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); setHasOptionsMenu(true); // Bind the summaries of EditText/List/Dialog/Ringtone preferences // to their values. When their values change, their summaries are // updated to reflect the new value, per the Android Design // guidelines. bindPreferenceSummaryToValue(findPreference("example_text")); bindPreferenceSummaryToValue(findPreference("example_list")); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { startActivity(new Intent(getActivity(), SettingsActivity.class)); return true; } return super.onOptionsItemSelected(item); } } /** * This fragment shows notification preferences only. It is used when the * activity is showing a two-pane settings UI. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static class NotificationPreferenceFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_notification); setHasOptionsMenu(true); // Bind the summaries of EditText/List/Dialog/Ringtone preferences // to their values. When their values change, their summaries are // updated to reflect the new value, per the Android Design // guidelines. bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone")); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { startActivity(new Intent(getActivity(), SettingsActivity.class)); return true; } return super.onOptionsItemSelected(item); } } /** * This fragment shows data and sync preferences only. It is used when the * activity is showing a two-pane settings UI. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static class DataSyncPreferenceFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_data_sync); setHasOptionsMenu(true); // Bind the summaries of EditText/List/Dialog/Ringtone preferences // to their values. When their values change, their summaries are // updated to reflect the new value, per the Android Design // guidelines. bindPreferenceSummaryToValue(findPreference("sync_frequency")); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { startActivity(new Intent(getActivity(), SettingsActivity.class)); return true; } return super.onOptionsItemSelected(item); } } }
[ "alejandrotorresruiz@MacBook-Pro-de-Alejandro.local" ]
alejandrotorresruiz@MacBook-Pro-de-Alejandro.local
2e4a7c5d722fd030f227117904d16a9ab49c4994
1b24036bc4381dcb337be0b71ed00bdbce49fea1
/src/main/java/com/job5156/task/count/CountTouch.java
d84795b81b7120465ddc47b9444ab29697cf92d4
[]
no_license
miketom156/easy-run
a328d0942fedcb1241cbf600724d71db26349164
3ee8c067c43b407b73345d12e76bbdfa1e949524
refs/heads/master
2020-05-17T10:56:32.580587
2015-08-24T02:20:23
2015-08-24T02:20:23
41,276,378
0
1
null
null
null
null
UTF-8
Java
false
false
7,531
java
package com.job5156.task.count; import com.job5156.common.ApiCallTypeEnum; import com.job5156.common.util.HibernateCountUtil; import com.job5156.common.util.HibernateUtil; import com.job5156.model.statistics.CountAccessModeDaily; import com.job5156.model.statistics.SysCountMobileApp; import org.apache.log4j.Logger; import org.joda.time.DateTime; import org.springframework.jdbc.core.JdbcTemplate; import java.text.SimpleDateFormat; import java.util.Date; /** * Created with IntelliJ IDEA. * User: DJH * Date: 14-10-10 * Time: 上午8:10 * 用于统计触屏版网页的访问量 */ public class CountTouch { private static Logger logger = Logger.getLogger(CountTouch.class); private JdbcTemplate jdbcTemplateCount = HibernateCountUtil.getJdbcTemplate(); private static final Integer RET_SUC = 1; /** * 每天1:45统计触屏版网站的前一天的访问量 */ public void countVistorsAndPV() { DateTime jodaCountDay = DateTime.now().minusDays(1).withTimeAtStartOfDay(); String countDayStr = jodaCountDay.toString("yyyy-MM-dd"); logger.info("开始执行" + countDayStr + "触屏版访问统计。"); countVistorsAndPV(jodaCountDay.toDate()); logger.info(countDayStr + "的触屏版访问统计执行完毕。"); } /** * 统计指定天 * @param countDay */ public void countVistorsAndPV(Date countDay) { Date start = new DateTime(countDay).withTimeAtStartOfDay().toDate(); Date end = new DateTime(countDay).plusDays(1).withTimeAtStartOfDay().toDate(); //查询出一天内访问的ip数量作为访问人数 Integer ipCount = getPeriodIpCount(start, end); //查出一天内接口的调用次数作为pv Integer totalCount = getPeriodCount(start, end); //查出一天内访问注册接口的次数 Integer totalRegisterCount = getPeriodCountByUrl(new String[]{"/touch/reg/save","/touch/act/reg/step1/save"}, start, end,RET_SUC); //查出一天内访问刷新简历接口的次数 Integer totalRefreshCount = getPeriodIpCountByUrl(new String[]{"/touch/resume/refresh/post"}, start, end,RET_SUC); //查出一天内访问应聘接口的次数 Integer totalApplyCount = getPeriodCountByUrl(new String[]{"/api/touch/apply.json"}, start, end,RET_SUC); //查出一天内访问应聘接口的ip数 Integer totalApplyIpCount = getPeriodIpCountByUrl(new String[]{"/api/touch/apply.json"}, start, end,RET_SUC); //查出一天内的登陆人数 Integer totalLoginCount = getPeriodIpCountByUrl(new String[]{"/api/touch/login","/touch/login/post"}, start, end,RET_SUC); //插入sys_count_mobile_app表(暂时忽略设备类型和操作系统) CountAccessModeDaily countAccessModeDaily = new CountAccessModeDaily(); countAccessModeDaily.setAllAccessCount(totalCount); countAccessModeDaily.setDeviceAccessCount(ipCount); countAccessModeDaily.setApiCallType(ApiCallTypeEnum.TOUCH.getEnName()); countAccessModeDaily.setCountDate(start); countAccessModeDaily.setApplicantApiCallCount(totalApplyCount); countAccessModeDaily.setApplicantApiCallPerCount(totalApplyIpCount); countAccessModeDaily.setResumeRefreshApiCallCount(totalRefreshCount); countAccessModeDaily.setResumeAddApiCallCount(totalRegisterCount); countAccessModeDaily.setPerLoginCount(totalLoginCount); save(countAccessModeDaily); } public void save(CountAccessModeDaily countAccessModeDaily) { HibernateCountUtil.currentSession().save(countAccessModeDaily); } public Integer getCountBySql(String sql) { return jdbcTemplateCount.queryForObject(sql, Integer.class); } /** * 获取时间范围内访问过的ip数量 * * @param start * @param end * @return */ public Integer getPeriodIpCount(Date start, Date end) { String sql = "select count(distinct ip) from log_mobile_web_usage where create_time between '" + new DateTime(start).toString("yyyy-MM-dd HH:mm:ss") + "' and '" + new DateTime(end).toString("yyyy-MM-dd HH:mm:ss")+"'"; return getCountBySql(sql); } /** * 获取时间范围内访问次数 * * @param start * @param end * @return */ public Integer getPeriodCount(Date start, Date end) { String sql = "select count(*) from log_mobile_web_usage where create_time between '"+ new DateTime(start).toString("yyyy-MM-dd HH:mm:ss") + "' and '" + new DateTime(end).toString("yyyy-MM-dd HH:mm:ss")+"'"; return getCountBySql(sql); } /** * 获取时间范围内访问次数 * * @param start * @param end * @return */ public Integer getPeriodCountByUrl(String url, Date start, Date end) { String sql = "select count(*) from log_mobile_web_usage where url='"+url+"' and create_time between '"+ new DateTime(start).toString("yyyy-MM-dd HH:mm:ss") + "' and '" + new DateTime(end).toString("yyyy-MM-dd HH:mm:ss")+"'"; return getCountBySql(sql); } /** * 获取时间范围内访问ip数 * * @param start * @param end * @return */ public Integer getPeriodIpCountByUrl(String url, Date start, Date end) { String sql = "select count(distinct ip) from log_mobile_web_usage where url='"+url+"' and create_time between '"+ new DateTime(start).toString("yyyy-MM-dd HH:mm:ss") + "' and '" + new DateTime(end).toString("yyyy-MM-dd HH:mm:ss")+"'"; return getCountBySql(sql); } /** * 获取时间范围内访问次数 * * @param start * @param end * @param ret * @return */ public Integer getPeriodCountByUrl(String[] urls, Date start, Date end,Integer ret) { String sql = "select count(*) from log_mobile_web_usage where create_time between '"+ new DateTime(start).toString("yyyy-MM-dd HH:mm:ss") + "' and '" + new DateTime(end).toString("yyyy-MM-dd HH:mm:ss")+"'"+ " and ret = " +ret+" "; if(urls!=null && urls.length>0){ sql+="and ("; for(int i =0;i<urls.length;i++){ if(i == 0){ sql+=" url = '"+urls[i]+"'"; }else{ sql+=" or url = '"+urls[i]+"'"; } } sql+=")"; } return getCountBySql(sql); } /** * 获取时间范围内访问ip数 * * @param start * @param end * @param ret * @return */ public Integer getPeriodIpCountByUrl(String[] urls, Date start, Date end,Integer ret) { String sql = "select count(distinct ip) from log_mobile_web_usage where create_time between '"+ new DateTime(start).toString("yyyy-MM-dd HH:mm:ss") + "' and '" + new DateTime(end).toString("yyyy-MM-dd HH:mm:ss")+"'"+ " and ret = " +ret+" "; if(urls!=null && urls.length>0){ sql+="and ("; for(int i =0;i<urls.length;i++){ if(i == 0){ sql+=" url = '"+urls[i]+"'"; }else{ sql+=" or url = '"+urls[i]+"'"; } } sql+=")"; } return getCountBySql(sql); } }
[ "790260645@qq.com" ]
790260645@qq.com
3031e316bb41524c5d4c52e2bf804812615ed4ab
5034fe38d1a395b06774b9fc9630d5787a8356f8
/src/main/java/mariot7/decorativestyles/blocks/WhiteCobblestone.java
bf6dd94c6c93b18a800ccfb0c10255309e10d6a9
[]
no_license
mariot7/Decorative-Styles
7fe41bd567998edd880385e35a7caa0d3bce1fef
1ef131f4bb2778f2eb481c9f6e81ed2838e2bf12
refs/heads/master
2021-01-18T23:44:58.124400
2016-09-27T22:18:21
2016-09-27T22:18:21
62,554,398
2
0
null
null
null
null
UTF-8
Java
false
false
348
java
package mariot7.decorativestyles.blocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; public class WhiteCobblestone extends Block{ public WhiteCobblestone(Material materialIn) { super(materialIn); this.setHardness(1.5F); this.setSoundType(SoundType.STONE); } }
[ "mariot789@gmail.com" ]
mariot789@gmail.com
521ca097771d4ba18dce235dd5e30cca6702ad38
88b237552d6e00d27cb4f06c1427dd96816d97d6
/org/grouplens/mooc/cbf/dao/WeightedFlag.java
ebe7925cf42c854e18fdd3d31707edf319bc038c
[ "MIT" ]
permissive
elcodedocle/recsys-p2-test
40d9863b542b8069ddcd919ef5239903e75649bf
0dfb3647558cf68a9e490ff4a02c8d3aac0668da
refs/heads/master
2020-05-30T18:34:26.182574
2013-10-15T17:48:17
2013-10-15T17:48:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
418
java
package org.grouplens.mooc.cbf.dao; import org.grouplens.lenskit.core.Parameter; import javax.inject.Qualifier; import java.lang.annotation.*; /** * Parameter annotation for user profile elaboration method selection. * @author Gael Abadin */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) @Qualifier @Parameter(Weighted.class) public @interface WeightedFlag { }
[ "gael.abadin@gmail.com" ]
gael.abadin@gmail.com
56f1bed5aa0d577d8269648cada702f6bf471ade
99d4861ade920c7181d728d99f1b3775592748fb
/src/main/java/com/giovanni/javajpa/dao/UserDAO.java
9850f53842b67ea450fce50f3543f0c898867c4f
[]
no_license
alexanderhuayama/javajpa
e118f70db11e99595f125ecca1f8f65305f0cc6d
cb43f92949ffdb59879a145e18970041903aa297
refs/heads/master
2020-08-07T09:17:04.813650
2019-10-08T16:17:44
2019-10-08T16:17:44
213,387,837
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package com.giovanni.javajpa.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.giovanni.javajpa.entity.UserEntity; @Repository public interface UserDAO extends JpaRepository<UserEntity, Integer> { }
[ "alexander.hh.cc@gmail.com" ]
alexander.hh.cc@gmail.com
0e7c52c97e67794dc99589ceac117540115c8328
de9fbfe16c807c3e2a888d308b999e49cd6c9227
/app/src/main/java/app/marks/com/ir/viewModel/SignUpViewModel.java
b08b0bd7dfc4ce00d627f43fabdfb4048089d32d
[]
no_license
vishu287/IR
a8ddc46fdb917fb7d8632c31d751ff857b0cae93
5e7de707f5c1b6eb82e2b0c2fd02c45087119434
refs/heads/master
2021-09-08T10:35:28.962614
2018-03-09T07:25:43
2018-03-09T07:25:43
115,621,282
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package app.marks.com.ir.viewModel; import app.marks.com.ir.form.SignUpForm; /** * Created by vishwanathm on 2/7/2018. */ public interface SignUpViewModel { public void register(SignUpForm form); }
[ "vishwanathm@xpanxion.co.in" ]
vishwanathm@xpanxion.co.in
29860d6438aada5d9743e61d11ddf5e1d606b3f3
9f19fdc96605c3bc29c9d24b58364cba999a7be3
/MyApp/app/src/main/java/com/example/biank/meuapp/Activity/editMetodo.java
e385724c7c675d950f7cf36611d8a0f3764fcf45
[]
no_license
biancasouza/Projeto-EduActive
caa134c68e828af4ea6d011b8f309e2c0dd36b3d
cdb9b4d664eb752e87bebe7ed586006607996ef0
refs/heads/master
2020-04-06T21:04:07.475591
2018-11-16T00:43:56
2018-11-16T00:43:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,674
java
package com.example.biank.meuapp.Activity; import android.Manifest; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.beardedhen.androidbootstrap.BootstrapButton; import com.example.biank.meuapp.Classes.Metodologia; import com.example.biank.meuapp.R; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.OnProgressListener; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import java.io.IOException; import static android.app.Activity.RESULT_OK; public class editMetodo extends AppCompatActivity { private EditText titulo; private EditText descricao; private EditText competencias; private TextView status; private EditText sequencia; private BootstrapButton btnCadastar; private BootstrapButton btnCancelar; private BootstrapButton btnUpload; private FirebaseAuth autenticacao; private FirebaseDatabase database; private Metodologia metodologias; private FirebaseStorage storage; private Uri pdfUri; private String url, user; ProgressDialog progressDialog; DatabaseReference referenciaFirebase; public static String valor; String pdfantigo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(R.style.AppTheme_Dialog); setContentView(R.layout.activity_edit_metodo); referenciaFirebase = FirebaseDatabase.getInstance().getReference(); storage = FirebaseStorage.getInstance(); database = FirebaseDatabase.getInstance(); metodologias = new Metodologia(); String email = autenticacao.getInstance().getCurrentUser().getEmail(); listaValores(getValor()); referenciaFirebase.child("usuarios").orderByChild("email").equalTo(email).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for(DataSnapshot postSnapshot : dataSnapshot.getChildren()) { String nome = postSnapshot.child("nome_completo").getValue().toString(); user = nome; } } @Override public void onCancelled(DatabaseError databaseError) { } }); status = (TextView) findViewById(R.id.txt_statusedit); titulo = (EditText) findViewById(R.id.txt_tituloedit); descricao = (EditText) findViewById(R.id.txt_descricaoedit); competencias= (EditText) findViewById(R.id.txt_competenciasedit); sequencia = (EditText) findViewById(R.id.txt_sequenciaedit); btnCadastar = (BootstrapButton) findViewById(R.id.btnCadastrometodoedit); btnCancelar = (BootstrapButton) findViewById(R.id.btnCancelametodoedit); btnUpload = (BootstrapButton) findViewById(R.id.btnUploadedit); btnCancelar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); btnCadastar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { btnCadastar.setClickable(false); if (!titulo.getText().toString().equals("") && !descricao.getText().toString().equals("") && !competencias.getText().toString().equals("") && !sequencia.getText().toString().equals("") ){ metodologias.setTitulo(titulo.getText().toString()); metodologias.setDescricao(descricao.getText().toString()); metodologias.setCompetencias(competencias.getText().toString()); metodologias.setSequencia(sequencia.getText().toString()); metodologias.setUser(user); if(pdfUri!=null) { uploadFile(pdfUri); } else{ metodologias.setArquivo(getPdfantigo()); edita(getValor()); } } else{ Toast.makeText(editMetodo.this ,"Preencha todos os campos para prosseguir!",Toast.LENGTH_LONG).show(); } } }); btnUpload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(ContextCompat.checkSelfPermission(editMetodo.this, Manifest.permission.READ_EXTERNAL_STORAGE)== PackageManager.PERMISSION_GRANTED){ selecionaArquivo(); } else{ ActivityCompat.requestPermissions(editMetodo.this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},9); } } }); } private void uploadFile(Uri pdfUri) { progressDialog = new ProgressDialog(editMetodo.this); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setTitle("Uploading file..."); progressDialog.setProgress(0); progressDialog.show(); final String fileName = System.currentTimeMillis()+""; StorageReference storageReference = storage.getReference(); storageReference.child("Uploads").child(fileName).putFile(pdfUri) .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { url = taskSnapshot.getDownloadUrl().toString(); metodologias.setArquivo(url); edita(getValor()); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Toast.makeText(editMetodo.this,"Erro ao enviar arquivo!",Toast.LENGTH_LONG).show(); } }).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() { @Override public void onProgress(UploadTask.TaskSnapshot taskSnapshot) { int currentProgress = (int) (100*taskSnapshot.getBytesTransferred()/taskSnapshot.getTotalByteCount()); progressDialog.setProgress(currentProgress); } }); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if(requestCode==9 && grantResults[0]==PackageManager.PERMISSION_GRANTED){ selecionaArquivo(); } else { Toast.makeText(editMetodo.this,"Por favor, conceda a permissão", Toast.LENGTH_SHORT).show(); } } private void selecionaArquivo() { Intent i = new Intent(); i.setType("application/pdf"); i.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(i,86); } public void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode==86 && resultCode == RESULT_OK && data!=null){ pdfUri=data.getData(); status.setText(pdfUri.getLastPathSegment()); } else { Toast.makeText(editMetodo.this,"Por favor selecione um arquivo", Toast.LENGTH_SHORT).show(); } } private void listaValores(String valor) { referenciaFirebase.child("metodologias").orderByChild("titulo").equalTo(valor).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String titulos = null,descricaos = null,sequencias = null,competencia = null, pdfs = null; for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) { titulos = postSnapshot.child("titulo").getValue().toString(); descricaos = postSnapshot.child("descricao").getValue().toString(); sequencias = postSnapshot.child("sequencia").getValue().toString(); competencia = postSnapshot.child("competencias").getValue().toString(); pdfs = postSnapshot.child("arquivo").getValue().toString(); } setPdfantigo(pdfs); titulo.setText(titulos); descricao.setText(descricaos); sequencia.setText(sequencias); competencias.setText(competencia); } @Override public void onCancelled(DatabaseError databaseError) { } }); } public void edita(String s){ referenciaFirebase.child("metodologias").orderByChild("titulo").equalTo(s).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) { postSnapshot.getRef().setValue(metodologias); } finish(); } @Override public void onCancelled(DatabaseError databaseError) { } }); } public static void setValor(String valor) { editMetodo.valor = valor; } public static String getValor() { return valor; } public String getPdfantigo() { return pdfantigo; } public void setPdfantigo(String pdfantigo) { this.pdfantigo = pdfantigo; } @Override protected void onResume() { super.onResume(); btnCadastar.setEnabled(true); } }
[ "biankasouza.012@gmail.com" ]
biankasouza.012@gmail.com
d0d6bc6aa6799675753147c40123b2416e0c9b85
28aa93fafadc58cb0967306489d8bdaa39350029
/expensetrackerapi/src/main/java/com/example/technoxtream17/expensetracker/service/impl/ExpenseServiceImpl.java
ea191e523aa7e6fd1c0ba4a9a04b2ba489cb9f7a
[]
no_license
faikturan/ExpenseTrackerAPIGateway
3b1535dd1a77f2ba85fe9420e99b184252dd17fa
6dd6949c17e432d3464f8d9bb435fb32f2038e7a
refs/heads/main
2023-03-16T02:33:39.897108
2020-11-20T16:13:54
2020-11-20T16:13:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package com.example.technoxtream17.expensetracker.service.impl; import static com.example.technoxtream17.expensetracker.constant.Paths.EXPENSENOTMATCH; import java.util.List; import java.util.Locale; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.stereotype.Service; import com.example.technoxtream17.expensetracker.error.GenericNotFoundException; import com.example.technoxtream17.expensetracker.model.Expense; import com.example.technoxtream17.expensetracker.repository.ExpenseRepo; import com.example.technoxtream17.expensetracker.service.ExpenseService; @Service public class ExpenseServiceImpl implements ExpenseService { @Autowired MessageSource messageSource; @Autowired(required = true) private ExpenseRepo expenseRepo; public List<Expense> getAllExpenses() { return expenseRepo.findAll(); } public Optional<Expense> getExpense(int id) { return expenseRepo.findById(id); } public Expense createExpense(Expense expense) { return expenseRepo.save(expense); } public Object updateExpense(Expense expense, int id) { if (expenseRepo.existsById(id) && id == expense.getId()) { expenseRepo.save(expense); } else { throw new GenericNotFoundException(messageSource.getMessage(EXPENSENOTMATCH, null, Locale.ENGLISH)); } return expense; } public void deleteExpense(int id) { expenseRepo.deleteById(id); } }
[ "nitinrai17@gmail.com" ]
nitinrai17@gmail.com
00882f5b9c6377fde838be98729431f333d907bd
c1f1c7e2807a56e743cb3043b695f5f0e0a4e44c
/src/TextStrategy.java
735a42194eac1e150cbc1b9f0c0515f5c430b8ac
[ "MIT" ]
permissive
markuslaubenthal/ba
91a02860eae9a92b1ea3eb998c09c47179404822
39f7b8c29704139055a9229647c326db0b74010c
refs/heads/master
2021-07-14T06:10:36.544695
2020-06-11T11:56:16
2020-06-11T11:56:16
157,418,127
0
0
MIT
2020-06-11T11:56:17
2018-11-13T17:17:07
Java
UTF-8
Java
false
false
177
java
import java.util.ArrayList; import javafx.scene.layout.Pane; import javafx.scene.text.*; interface TextStrategy { public void drawText(VertexPolygon poly, Pane textLayer); }
[ "mail@lennardalms.de" ]
mail@lennardalms.de
e45f1555e10d910221165fb3ed01962893ad9ce7
64166946f36e054791087e382a4eab438f65a490
/Euler/ProjectEuler/src/Problem45.java
0c87c43119c32e5168ec2f8cf4f9b16c6f7f7fe3
[]
no_license
iainswarts/git
6bf7b87925d1706ba7b8cc7caa1707f7c212e2ce
a85c44d20a3d5f65108a6b060b068932c4bdca75
refs/heads/master
2021-01-25T07:35:16.300805
2015-01-02T13:03:02
2015-01-02T13:03:02
28,713,552
0
0
null
null
null
null
UTF-8
Java
false
false
1,254
java
import java.util.ArrayList; import javax.swing.plaf.basic.BasicTreeUI.TreeIncrementAction; public class Problem45 { private static ArrayList<Long> penta = new ArrayList<Long>(); private static ArrayList<Long> triangle = new ArrayList<Long>(); private static ArrayList<Long> hexa = new ArrayList<Long>(); public static void main(String[] args) { for (long i = 1; i < 500000; i++) { System.out.println(i); hexa.add(i * (2 * i - 1)); long p = (i * (3 * i - 1) / 2); if (hexa.contains(p)) penta.add(p); //else //continue; long t = (i * i + i) / 2; if (penta.contains(t)) triangle.add(t); } System.out.println(triangle.get(0)); System.out.println(triangle.get(1)); System.out.println(triangle.get(2)); /* * System.out.println(triangle.get(9998)); int count = 0; for(int i * =0;i<triangle.get(9998);i++){ if(isPenta(i)&&isHexa(i)&&isTri(i)) * count++; System.out.println(i); * * if(count ==3) break; } */ } public static boolean isPenta(int n) { return penta.contains(n); } public static boolean isHexa(int n) { return hexa.contains(n); } public static boolean isTri(int n) { return triangle.contains(n); } }
[ "iainswarts@gmail.com" ]
iainswarts@gmail.com
bfd50869d04dbe8000f51c571655d34fa69ca918
bbb4fbe5ad3725ab6c231b4ad899f7efe26734c5
/src/com/kt/james/wmsforserver/servlet/LayoutAJustServlet.java
0b29095d9563c8a3700b121d3e5aba8bc531fd7c
[]
no_license
IaMJamesHuang/WmsForServer
45483138e1cf3e881abf5a0cd5f35e92e0b52031
a2247011bc1758507ae18657822107d83b2f0a6e
refs/heads/master
2020-04-17T07:17:34.492686
2019-05-19T07:50:02
2019-05-19T07:50:02
166,362,971
6
0
null
null
null
null
UTF-8
Java
false
false
1,700
java
package com.kt.james.wmsforserver.servlet; import com.google.gson.Gson; import com.kt.james.wmsforserver.controller.LayoutAJustController; import com.kt.james.wmsforserver.dto.GetLayoutDto; import com.kt.james.wmsforserver.dto.InsertLayoutsDto; import com.kt.james.wmsforserver.util.StringUtil; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet(name="layoutAJust",urlPatterns="/layoutAJust") public class LayoutAJustServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String company_id = req.getParameter("company_id"); GetLayoutDto dto = new LayoutAJustController().getLayoutInfo(company_id); String result = new Gson().toJson(dto); resp.setContentType("text/json; charset=utf-8"); PrintWriter pw = resp.getWriter(); pw.println(result); pw.flush(); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String jsonInfo = StringUtil.ReadAsChars(req); String company_id = req.getHeader("company_id"); InsertLayoutsDto dto = new LayoutAJustController().insertLayoutInfo(company_id, jsonInfo); String result = new Gson().toJson(dto); resp.setContentType("text/json; charset=utf-8"); PrintWriter pw = resp.getWriter(); pw.println(result); pw.flush(); } }
[ "13631413532@163.com" ]
13631413532@163.com
0d974641a00bde829a4c1709cbb58ffcd540b54e
eb8bd17cb53cb932d7f9fe24c2f205a7b6aeeaed
/graph-matching/src/auction/StandaloneAuctionVertexOutputFormat.java
8bfa95a1a95dbe6395e685049035a2e9cf3ce1a5
[ "Apache-2.0" ]
permissive
vishalbelsare/XDATA
afa39f9a9ee739aa1d4c0af51064269ff09d7ed7
4f571cea29e9f7411979b53cd298816ffdaadba5
refs/heads/master
2020-03-20T11:26:16.975599
2016-11-29T16:05:27
2016-11-29T16:05:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,084
java
/* # DARPA XDATA 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. # # Copyright 2013 Raytheon BBN Technologies Corp. All Rights Reserved. # */ package auction; import org.apache.giraph.graph.Vertex; import org.apache.giraph.io.formats.TextVertexOutputFormat; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.TaskAttemptContext; import java.io.IOException; import auction.*; import fileformats.*; public class StandaloneAuctionVertexOutputFormat extends TextVertexOutputFormat<LongWritable, AuctionVertexValue, Writable> { /** Specify the output delimiter */ public static final String LINE_TOKENIZE_VALUE = "output.delimiter"; /** Default output delimiter */ public static final String LINE_TOKENIZE_VALUE_DEFAULT = "\t"; @Override public TextVertexWriter createVertexWriter(TaskAttemptContext context) { return new AuctionValueVertexWriter(); } protected class AuctionValueVertexWriter extends TextVertexWriterToEachLine { /** Saved delimiter */ private String delimiter; @Override public void initialize(TaskAttemptContext context) throws IOException, InterruptedException { super.initialize(context); delimiter = getConf().get( LINE_TOKENIZE_VALUE, LINE_TOKENIZE_VALUE_DEFAULT); } @Override protected Text convertVertexToLine(Vertex<LongWritable, AuctionVertexValue, Writable, ?> vertex) throws IOException { Text line = new Text(vertex.getId().toString() + delimiter + vertex.getValue().getColOwned().toString()); return line; } } }
[ "ppetrov@bbn.com" ]
ppetrov@bbn.com
123e884fed70d8e47d57a8f4506537736b7e4acc
b82f7ca02d166e27e276ce280b62cf27ae0b0fb6
/src/Java6Taskas.java
a3790b355e86368aa99ecbdf2b606fcb25b0d690
[]
no_license
raimondassi/JavaKursai
a4c3795da41e49649dc0d272adc218aa521d72a1
b56068b819b9aaf22aa0517fb8c8f0fd288ebd1f
refs/heads/master
2020-12-02T06:39:19.142475
2017-09-04T10:21:39
2017-09-04T10:21:39
96,771,775
1
0
null
null
null
null
UTF-8
Java
false
false
1,650
java
import com.sun.javafx.scene.paint.GradientUtils; import java.awt.*; import java.awt.Point; import java.awt.geom.Point2D; /** * Created by Raimondas on 2017.07.13. */ public class Java6Taskas { public static void main(String[] args) { //System.out.println("Atstumas iki kito tasko : "+apskiaciuojaAtstumaIkiKitoTasko()); pasakoKokiameKetvirtyjeYraTaskas(5,10); } private static double x1=10, x2=20; private static double y1=30, y2=40; static String spalva; private Java6Taskas(){ } private Java6Taskas(double x1,double y1){ this.x1=x1; this.y1=y1; } private Java6Taskas(double x1,double y1, String spalva){ this.x1=x1; this.y1=y1; this.spalva=spalva; } private Java6Taskas(String spalva){ this.spalva=spalva; } private static double apskiaciuojaAtstumaIkiKitoTasko(){ return java.awt.Point.distance(x1,y1,x2,y2); } private static void pasakoKokiameKetvirtyjeYraTaskas(int x, int y){ if (x>0 && y>1){ System.out.println("Priklauso pirmas ketvirciui");} else if(x>0 && y<0){ System.out.println("Priklauso antram ketvirciui");} else if(x<0 && y<0){ System.out.println("Priklauso treciam ketvirciui");} else if (x<0 && y>0){ System.out.println("Priklauso ketvirtam ketvirciui");} else { System.out.println("Yra centre");} } private static void pasakoArTaskasPriklausoTamPaciamKetvirciui(int x1, int y1, int x2, int y2){ //String pirmasKetvirtis= } }
[ "raimondassiup@gmail.com" ]
raimondassiup@gmail.com
3e2f474da89bf7ff28162a945676bf5014abe3fe
ebca15c8a793107cbd75e1140ab390a9cbbac442
/fac/src/modelo/maestros/Zona.java
21ef3b8bebe10b4244e509a967919dea79d5c326
[]
no_license
dusa-repository/bizapps-fac
052acd38b68ce0d64a11783715b528313f3222c6
fc397d8268acdb5bb7b4fb37aedf6c982152f2e3
refs/heads/master
2016-08-03T18:44:30.145069
2015-08-15T19:56:16
2015-08-15T19:56:16
40,714,324
1
0
null
null
null
null
UTF-8
Java
false
false
3,563
java
package modelo.maestros; import java.io.Serializable; import java.sql.Timestamp; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import modelo.seguridad.Usuario; import modelo.transacciones.notas.Planificacion; @Entity @Table(name = "zona") public class Zona implements Serializable { private static final long serialVersionUID = -3230940093491331644L; @Id @Column(name = "id_zona", length = 50, unique = true, nullable = false) private String idZona; @Column(length = 500) private String descripcion; @Column(name="monto_original") private Double original; @Column(name="monto_consumido") private Double consumido; @Column(name="monto_saldo") private Double saldo; @Column(name = "fecha_auditoria") private Timestamp fechaAuditoria; @Column(name = "hora_auditoria", length = 10) private String horaAuditoria; @Column(name = "usuario_auditoria", length = 50) private String usuarioAuditoria; @OneToMany(mappedBy="zona") private Set<Usuario> usuarios; @OneToMany(mappedBy="zona") private Set<Aliado> aliados; @OneToMany(mappedBy="zona") private Set<Planificacion> planificaciones; public Zona() { super(); // TODO Auto-generated constructor stub } public Zona(String idZona, String descripcion, Timestamp fechaAuditoria, String horaAuditoria, String usuarioAuditoria, Double ori, Double consu, Double saldo) { super(); this.idZona = idZona; this.descripcion = descripcion; this.fechaAuditoria = fechaAuditoria; this.horaAuditoria = horaAuditoria; this.usuarioAuditoria = usuarioAuditoria; this.original = ori; this.consumido = consu; this.saldo = saldo; } public String getIdZona() { return idZona; } public void setIdZona(String idZona) { this.idZona = idZona; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public Timestamp getFechaAuditoria() { return fechaAuditoria; } public void setFechaAuditoria(Timestamp fechaAuditoria) { this.fechaAuditoria = fechaAuditoria; } public String getHoraAuditoria() { return horaAuditoria; } public void setHoraAuditoria(String horaAuditoria) { this.horaAuditoria = horaAuditoria; } public String getUsuarioAuditoria() { return usuarioAuditoria; } public void setUsuarioAuditoria(String usuarioAuditoria) { this.usuarioAuditoria = usuarioAuditoria; } public Set<Usuario> getUsuarios() { return usuarios; } public void setUsuarios(Set<Usuario> usuarios) { this.usuarios = usuarios; } public Set<Aliado> getAliados() { return aliados; } public void setAliados(Set<Aliado> aliados) { this.aliados = aliados; } public Set<Planificacion> getPlanificaciones() { return planificaciones; } public void setPlanificaciones(Set<Planificacion> planificaciones) { this.planificaciones = planificaciones; } public Double getOriginal() { return original; } public void setOriginal(Double original) { this.original = original; } public Double getConsumido() { return consumido; } public void setConsumido(Double consumido) { this.consumido = consumido; } public Double getSaldo() { return saldo; } public void setSaldo(Double saldo) { this.saldo = saldo; } }
[ "linkin9014@gmail.com" ]
linkin9014@gmail.com
c6e1ced8ff5e1c7e30c57f4b547823134dcdd3f2
4276f8d7eba853b87d04ef8b5ad165b30a76b8ae
/src/main/java/com/puzhen/heap/trial/TryHeapWithComparator.java
650c53b49087b1572a111b898cb294b39264ef31
[]
no_license
Clifnich/MyMedianMaintenance
4af7e13406c2f947fa7b509ae114e432246095ee
0fb33b43006522272c52decee44fbc1a6ad759a5
refs/heads/master
2020-06-28T09:46:22.912721
2017-07-13T07:07:14
2017-07-13T07:07:14
97,074,405
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.puzhen.heap.trial; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Queue; import com.puzhen.median.main.InvComparitor; public class TryHeapWithComparator { public static void main(String[] args) { Comparator<Integer> comparator = new InvComparitor(); Queue<Integer> heap = new PriorityQueue<Integer>(comparator); heap.add(new Integer(3)); heap.add(new Integer(9)); heap.add(new Integer(10)); System.out.println(heap.poll()); } }
[ "puqian@ebay.com" ]
puqian@ebay.com
a651a8d76541c318f464a384af537b612ed4ec31
70daf318d027f371ada3abeaaa31dd47651640d7
/src/com/javahis/system/combo/TComboINFDieinflu.java
b08d47d07e0bf9ba50c2178ffec9d72bbcde24b1
[]
no_license
wangqing123654/web
00613f6db653562e2e8edc14327649dc18b2aae6
bd447877400291d3f35715ca9c7c7b1e79653531
refs/heads/master
2023-04-07T15:23:34.705954
2020-11-02T10:10:57
2020-11-02T10:10:57
309,329,277
0
0
null
null
null
null
GB18030
Java
false
false
1,714
java
package com.javahis.system.combo; import com.dongyang.config.TConfigParse.TObject; import com.dongyang.ui.TComboBox; import com.dongyang.ui.edit.TAttributeList; /** * <p>Title: 感染对死亡的影响下拉列表</p> * * <p>Description: 感染对死亡的影响下拉列表</p> * * <p>Copyright: Copyright (c) Liu dongyang 2008</p> * * <p>Company: JavaHis</p> * * @author wangl 2009.10.26 * @version 1.0 */ public class TComboINFDieinflu extends TComboBox { /** * 新建对象的初始值 * @param object TObject */ public void createInit(TObject object) { if (object == null) return; object.setValue("Width", "81"); object.setValue("Height", "23"); object.setValue("Text", "TButton"); object.setValue("showID", "Y"); object.setValue("showName", "Y"); object.setValue("showText", "N"); object.setValue("showValue", "N"); object.setValue("showPy1", "Y"); object.setValue("showPy2", "Y"); object.setValue("Editable", "Y"); object.setValue("Tip", "感染对死亡的影响"); object.setValue("TableShowList", "id,name"); object.setValue("ModuleParmString", "GROUP_ID:INF_DIEINFLU"); object.setValue("ModuleParmTag", ""); } public String getModuleName() { return "sys\\SYSDictionaryModule.x"; } public String getModuleMethodName() { return "getGroupList"; } public String getParmMap() { return "id:ID;name:NAME;enname:ENNAME;Py1:PY1;py2:PY2"; } /** * 增加扩展属性 * @param data TAttributeList */ public void getEnlargeAttributes(TAttributeList data) { } }
[ "1638364772@qq.com" ]
1638364772@qq.com
c8f65efed6a5d91970979ad434da5a3134e1b465
9d3c2b1a422bf99f91d731bedbb0991b3ea4d7aa
/app/src/main/java/com/codepath/apps/mysimpletweets/EndlessScrollListener.java
da74713c620a9784401d165f299cbce2c4d1f908
[]
no_license
abhijitdhar/MySimpleTweets
105bbcfc5956e1b60943ff2a8b5f4127ffaf6bd1
579deebf62af0ae35930f5725d93c8dcc66c5b45
refs/heads/master
2016-09-05T14:26:57.695119
2015-02-18T23:55:24
2015-02-18T23:55:24
30,525,079
0
0
null
null
null
null
UTF-8
Java
false
false
3,003
java
package com.codepath.apps.mysimpletweets; import android.widget.AbsListView; /** * Created by abhidhar on 2/8/15. */ public abstract class EndlessScrollListener implements AbsListView.OnScrollListener { // The minimum amount of items to have below your current scroll position // before loading more. private int visibleThreshold = 5; // The current offset index of data you have loaded private int currentPage = 0; // The total number of items in the dataset after the last load private int previousTotalItemCount = 0; // True if we are still waiting for the last set of data to load. private boolean loading = true; // Sets the starting page index private int startingPageIndex = 0; public EndlessScrollListener() { } public EndlessScrollListener(int visibleThreshold) { this.visibleThreshold = visibleThreshold; } public EndlessScrollListener(int visibleThreshold, int startPage) { this.visibleThreshold = visibleThreshold; this.startingPageIndex = startPage; this.currentPage = startPage; } // This happens many times a second during a scroll, so be wary of the code you place here. // We are given a few useful parameters to help us work out if we need to load some more data, // but first we check if we are waiting for the previous load to finish. @Override public void onScroll(AbsListView view,int firstVisibleItem,int visibleItemCount,int totalItemCount) { // If the total item count is zero and the previous isn't, assume the // list is invalidated and should be reset back to initial state if (totalItemCount < previousTotalItemCount) { this.currentPage = this.startingPageIndex; this.previousTotalItemCount = totalItemCount; if (totalItemCount == 0) { this.loading = true; } } // If it’s still loading, we check to see if the dataset count has // changed, if so we conclude it has finished loading and update the current page // number and total item count. if (loading && (totalItemCount > previousTotalItemCount)) { loading = false; previousTotalItemCount = totalItemCount; currentPage++; } // If it isn’t currently loading, we check to see if we have breached // the visibleThreshold and need to reload more data. // If we do need to reload some more data, we execute onLoadMore to fetch the data. if (!loading && (totalItemCount - visibleItemCount)<=(firstVisibleItem + visibleThreshold)) { onLoadMore(currentPage + 1, totalItemCount); loading = true; } } // Defines the process for actually loading more data based on page public abstract void onLoadMore(int page, int totalItemsCount); @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // Don't take any action on changed } }
[ "abhidhar@yahoo-inc.com" ]
abhidhar@yahoo-inc.com
3f689f6b684116c22a5f7ac47ded44e040aedca0
83b58cfecff4f21e7c9c5f3ce1f1cf9788d29706
/android-scaffold/app/src/main/java/com/jeremyliao/android/scaffold/recyclerview/group/GroupDecorationAdapter.java
39c3de6682bfbcda6f199c5a24e6e4863e753707
[ "Apache-2.0" ]
permissive
JeremyLiao/android-scaffold
788341bb89cfb0ce021346afeb071a670772a233
64c38e2c62b3e584079eaf5cef28132113082264
refs/heads/master
2021-07-13T02:04:06.748009
2020-07-27T09:08:09
2020-07-27T09:08:09
182,100,978
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.jeremyliao.android.scaffold.recyclerview.group; import android.view.View; /** * Created by liaohailiang on 2020-02-07. */ public interface GroupDecorationAdapter { View onCreateGroupView(); void onBindGroupView(View groupView, int groupPosition); int getGroupCount(); int getStartPositionForGroup(int groupPosition); boolean isStickyHeader(); }
[ "liaohailiang@meituan.com" ]
liaohailiang@meituan.com
29defaa491becc104f20715bdab645be5b7367f9
8a2f7176441dc558af335c1c77c4df314715cf6d
/admin-war-demo/src/main/java/cn/starteasy/security/AuthoritiesConstants.java
f8e5ad77b0e0437b03ce2a21b0bb99af6001ba9b
[]
no_license
Wandering/se-common
06ddd4cb097a6225199fc42c6ecbc57a1e89f8bf
e0069a60b3490de030b4e8d5a56979113c119483
refs/heads/master
2021-01-23T05:29:23.748990
2016-11-22T02:05:30
2016-11-22T02:05:30
86,309,635
0
1
null
null
null
null
UTF-8
Java
false
false
342
java
package cn.starteasy.security; /** * Constants for Spring Security authorities. */ public final class AuthoritiesConstants { public static final String ADMIN = "ROLE_ADMIN"; public static final String USER = "ROLE_USER"; public static final String ANONYMOUS = "ROLE_ANONYMOUS"; private AuthoritiesConstants() { } }
[ "yq76034150@gmail.com" ]
yq76034150@gmail.com
2bfb2b9019203f3107e63f95b9a35cb9131fbec6
ded15e84ea46b8b7486548667360685321a57985
/edziennik/src/com/polsl/edziennik/desktopclient/model/comboBoxes/ComboModel.java
6a649117d6b92918dc4c34ed4a2edf29f62b3735
[]
no_license
mateuszgolab/edziennik-desktop-client
59d96c979cd1801ee1612049e402c744a9b110dc
9ae378e5046de9532d67b0faa1c7c71d710653df
refs/heads/master
2016-09-05T15:34:58.944767
2012-05-09T16:17:45
2012-05-09T16:17:45
32,699,821
0
0
null
null
null
null
UTF-8
Java
false
false
2,067
java
package com.polsl.edziennik.desktopclient.model.comboBoxes; import java.util.ArrayList; import java.util.List; import javax.swing.ComboBoxModel; import javax.swing.event.ListDataListener; public class ComboModel<Entity> implements ComboBoxModel { // extends // DefaultComboBoxModel{// protected List<Entity> data; private List<Entity> tmp; protected Entity selectedItem; public ComboModel() { data = new ArrayList<Entity>(); selectedItem = null; } public ComboModel(List<Entity> entities) { if (entities != null) { data = entities; selectedItem = entities.get(0); } else { data = new ArrayList<Entity>(); selectedItem = null; } } @Override public int getSize() { if (data == null) return 0; return data.size(); } @Override public void setSelectedItem(Object anItem) { selectedItem = (Entity) anItem; } @Override public Entity getSelectedItem() { return selectedItem; } public void add(Entity g) { if (data == null) return; data.add(g); } public void remove(Entity g) { if (data == null) return; data.remove(g); } public void setModel(List<Entity> entities) { if (entities != null && entities.size() > 0) { data = entities; selectedItem = entities.get(0); } else { data = new ArrayList<Entity>(); selectedItem = null; } // fireContentsChanged(data, 0, data.size()-1); } @Override public Entity getElementAt(int index) { if (index >= 0 && index < data.size()) return data.get(index); return null; } public void setEditable(boolean b) { if (b) { if (tmp != null) data = tmp; } else { tmp = new ArrayList<Entity>(data); data.clear(); data.add(selectedItem); } } public void removeAll() { data.clear(); } @Override public void addListDataListener(ListDataListener l) { // TODO Auto-generated method stub } @Override public void removeListDataListener(ListDataListener l) { // TODO Auto-generated method stub } }
[ "Mathgol@gmail.com@9a3c01a8-007e-c14a-894e-62519730d3a8" ]
Mathgol@gmail.com@9a3c01a8-007e-c14a-894e-62519730d3a8
d08c74129f6a8d339fd6188861b6ad55c9f8ea9d
65a3a8fc09c1f0c01c83bb869d8af18798ad3614
/app/src/main/java/com/example/josip/gameService/engine/GameEngine.java
e85746d5762a6034f347a00a7ea8f1ffc03172b6
[ "MIT" ]
permissive
Antolius/quester-playground
ed1ce14db29b3506ebe3d6740c25ae847b741f89
fa4854a3b1d140927d6d13e40ffab68171f9b31f
refs/heads/master
2021-01-10T20:40:47.816936
2014-09-22T21:06:37
2014-09-22T21:06:37
22,804,091
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.example.josip.gameService.engine; import com.example.josip.model.Checkpoint; /** * Created by Josip on 11/08/2014! */ public interface GameEngine { public void onCheckpointAreaEnter(final Checkpoint checkpoint); public void onCheckpointAreaExit(final Checkpoint checkpoint); }
[ "josipantolis@gmail.com" ]
josipantolis@gmail.com
25a1bf01fe7f54feefed9f92edf75bd2baec4fb6
4441ac0860a3b296b6df91a690bef227532b4a58
/src/test/java/MaOP/WFGTest.java
b438b7adabd3f50d9cbcacd0c999d6b359cc23cd
[]
no_license
renansantosmendes/MOEA_VRPDRT_Refactoring
1dbc879a6e86dfa1acea3fe7a440a8e0fd13c92d
f656a9736ac9e53fcf5e13f4df0beca22d48247d
refs/heads/master
2020-03-07T02:43:50.255485
2018-05-10T12:58:49
2018-05-10T12:58:49
127,215,663
0
0
null
null
null
null
UTF-8
Java
false
false
2,272
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 MaOP; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.List; import org.junit.Test; import org.moeaframework.Executor; import org.moeaframework.core.NondominatedPopulation; import org.moeaframework.core.Solution; /** * * @author renansantos */ public class WFGTest { @Test public void instancesTest() throws FileNotFoundException { String path = "AlgorithmsResults//"; String algorithm = "OnCLMOEAD"; String problem = "WFG1_10"; int reducedDimensionality = 4; // List<NondominatedPopulation> result = new Executor() // .withProblem(problem) // .withAlgorithm(algorithm) // .withMaxEvaluations(100000) // .withProperty("clusters", reducedDimensionality) // .runSeeds(10); // // boolean success = (new File(path + algorithm + "//" + problem)).mkdirs(); // if (!success) { // System.out.println("Folder already exists!"); // } // PrintStream outPutInTxt = new PrintStream(path + algorithm + "//" + problem + "//CombinedPareto.txt"); // PrintStream outPutInCsv = new PrintStream(path + algorithm + "//" + problem + "//CombinedPareto.csv"); // // NondominatedPopulation combinedPareto = new NondominatedPopulation(); // // for (NondominatedPopulation population : result) { // for (Solution solution : population) { // combinedPareto.add(solution); // } // } // // // for (Solution solution : combinedPareto) { // double[] objectives = solution.getObjectives(); // for (int i = 0; i < objectives.length; i++) { // System.out.print(objectives[i] + " "); // outPutInTxt.print(objectives[i] + " "); // outPutInCsv.print(objectives[i] + ","); // } // System.out.println(""); // outPutInTxt.print("\n"); // outPutInCsv.print("\n"); // } } }
[ "renansantosmendes@gmail.com" ]
renansantosmendes@gmail.com
ed8003d6b454c4b2977fa49de5a37af796c1fa87
e55a0fa9a1c1b9ac84e28ccd806338733c3b26a9
/backend/manual/src/main/java/com/slim/manual/domain/repository/ManualRepository.java
701b7e87dd26e1c0cdd4a0a245dd56a99b1f8950
[]
no_license
BettoFranca/API_Slim_4Semestre
b7627ffc00e42fbd7b67175efa51b840460996f8
8dae790277e3ae7c25d4334b1cab9cd4f2d501a5
refs/heads/main
2023-08-14T05:36:07.838615
2021-10-11T03:07:21
2021-10-11T03:07:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package com.slim.manual.domain.repository; import com.slim.manual.domain.model.Manual; import org.springframework.data.jpa.repository.JpaRepository; public interface ManualRepository extends JpaRepository<Manual,Integer> { }
[ "nicholas.sroque@gmail.com" ]
nicholas.sroque@gmail.com
7d0f8c571cd417a72c7f375dfdcc6a755747738d
a68dc34ebd0174b58a804f7eee9f04d45d32e9fe
/src/main/java/com/gsafety/bridgeQualityCk/IOTBridgeQualityBolt.java
7f8e10661dae9e018f08a387868fa08415c5aaaf
[]
no_license
MatlabPython/Storm
b66e62d694457fa7b4520cbdc4af38333043bdcf
81b837e54288fa4f0aaa9ce9834a216816bdb109
refs/heads/master
2020-03-09T05:05:24.199657
2018-06-04T08:27:38
2018-06-04T08:27:38
128,603,718
0
0
null
null
null
null
UTF-8
Java
false
false
23,356
java
package com.gsafety.bridgeQualityCk; import backtype.storm.task.TopologyContext; import backtype.storm.topology.BasicOutputCollector; import backtype.storm.topology.OutputFieldsDeclarer; import backtype.storm.topology.base.BaseBasicBolt; import backtype.storm.tuple.Tuple; import com.gsafety.common.BaseZookeeper; import com.gsafety.common.DBHelper; import com.gsafety.lifeline.bigdata.avro.SensorData; import com.gsafety.lifeline.bigdata.avro.SensorDataEntry; import com.gsafety.lifeline.bigdata.util.AvroUtil; import com.gsafety.storm.SystemConfig; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; public class IOTBridgeQualityBolt extends BaseBasicBolt { private Logger logger = LoggerFactory.getLogger(IOTBridgeQualityBolt.class); private Map<String, Long> preConfigMap = new HashMap<>();//公共支持设备状态用 //kafka producer private KafkaProducer<String, byte[]> producer; private String nodeData; // public static Configuration configuration; // public static Connection connection; // public static Admin admin; @Override public void prepare(Map stormConf, TopologyContext context) { //zk连接 BaseZookeeper baseZookeeper = new BaseZookeeper(); try { baseZookeeper.connectZookeeper(SystemConfig.get("ZK_LIST")); nodeData = baseZookeeper.getData(SystemConfig.get("ZK_DYNAMIC_CONFIG_QUALITCK")); //kafka连接 Properties proConf = new Properties(); proConf.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, SystemConfig.get("KAFKA_BROKER_LIST")); proConf.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); proConf.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArraySerializer"); producer = new KafkaProducer<>(proConf); //hbase的连接 // configuration = HBaseConfiguration.create(); // configuration.set("hbase.zookeeper.quorum", SystemConfig.get("ZK_LIST")); // try { // connection = ConnectionFactory.createConnection(configuration); // admin = connection.getAdmin(); // } catch (IOException e) { // e.printStackTrace(); // } } catch (Exception e) { e.printStackTrace(); } } @Override public void execute(Tuple tuple, BasicOutputCollector basicOutputCollector) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); // String sensorId = tuple.getStringByField("key"); byte[] sensorDataBytes = (byte[]) tuple.getValueByField("value"); SensorData sensorData = AvroUtil.deserialize(sensorDataBytes); // String topic = tuple.getStringByField("topic"); // long timestamp = tuple.getLongByField("timestamp"); String key = sensorData.getLocation().toString(); // String key = "HF_PHDQ_00000001#2_8"; String bridgeid = JSONArray.fromObject(JSONObject.fromObject(nodeData).get(key)).getJSONObject(0).get("bridgeid").toString(); String eqipmentname = JSONArray.fromObject(JSONObject.fromObject(nodeData).get(key)).getJSONObject(0).get("equipmentname").toString(); String monitoringcode = JSONArray.fromObject(JSONObject.fromObject(nodeData).get(key)).getJSONObject(0).get("monitoringcode").toString(); String range = JSONArray.fromObject(JSONObject.fromObject(nodeData).get(key)).getJSONObject(0).get("range").toString(); String simple_frequency = JSONArray.fromObject(JSONObject.fromObject(nodeData).get(key)).getJSONObject(0).get("frequency").toString(); List<SensorDataEntry> entries = sensorData.getEntries(); /* 数据监测表 BRIDGE_COMPLETE_INFO 完整表;BRIDGE_INTERUPT_INFO 中断表;BRIDGE_TIMELINESS_INFO 时效表;BRIDGE_NORM_INFO 规范表 */ /** * 数据的完整性 */ if (StringUtils.isNotEmpty(simple_frequency) && (1 / entries.size() != Integer.parseInt(simple_frequency) / 1000)) { logger.info("frequency------------------>" + Integer.parseInt(simple_frequency)); //理论值:1000/frequency 实际值:entries.size() 桥梁名称:bridgename 监测项目:monitoringname 设备名称: terminal:sensorData.getTerminal().toString() //sensor:sensorData.getSensor() 采集时间:sensorData.getTime().toString() System.out.println("***********###############>>>>>>>" + "桥梁名称->" + bridgeid + "监测项目->" + monitoringcode + "设备名称->" + eqipmentname + "实际条数->" + entries.size() + "理论条数->" + String.valueOf(1000 / Integer.parseInt(simple_frequency)) + "***********###############>>>>>>>"); Statement statement = null; try { statement = DBHelper.createStatement(); String CompeteSQL = "insert into BRIDGE_COMPLETE_INFO(bridgeid,monitoring_code,eqipment_name,actual_number,theory_number,time)" + "VALUES ('" + bridgeid + "','" + monitoringcode + "','" + eqipmentname + "'," + entries.size() + "," + 1000 / Integer.parseInt(simple_frequency) + ",'" + sdf.format(sensorData.getTime()) + "')"; logger.info(CompeteSQL); statement.execute(CompeteSQL); statement.close(); DBHelper.close(); } catch (Exception e) { e.printStackTrace(); } // try { //// Table table = connection.getTable(TableName.valueOf("BRIDGE_COMPLETE_INFO")); // String startrowkey = MD5Hash.getMD5AsHex(bridgeid.getBytes("utf-8")); // String rowKey = startrowkey.substring(0, 6) + ":" + key + ":" + (Long.MAX_VALUE - sensorData.getTime()); // Put put = new Put(Bytes.toBytes(rowKey)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("monitoring_code"), Bytes.toBytes(monitoringcode)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("eqipment_name"), Bytes.toBytes(eqipmentname)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("actual_number"), Bytes.toBytes(entries.size()));//实际数量 // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("theory_number"), Bytes.toBytes(String.valueOf(1000 / frequency)));//理论数量 // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("time"), Bytes.toBytes(sensorData.getTime()));//理论数量 // final BufferedMutator.ExceptionListener listener = new BufferedMutator.ExceptionListener() { // @Override // public void onException(RetriesExhaustedWithDetailsException e, BufferedMutator mutator) { // for (int i = 0; i < e.getNumExceptions(); i++) { // System.out.println("Failed to sent put " + e.getRow(i) + "."); // logger.error("Failed to sent put " + e.getRow(i) + "."); // } // } // }; // BufferedMutatorParams params = new BufferedMutatorParams(TableName.valueOf("BRIDGE_COMPLETE_INFO")).listener(listener); // params.writeBufferSize(5 * 1024 * 1024); // final BufferedMutator mutator = connection.getBufferedMutator(params); // try { // mutator.mutate(put); // mutator.flush(); // } finally { // mutator.close(); // } // } catch (IOException e) { // e.printStackTrace(); // } } /** * 数据的规范性监测 */ if (StringUtils.isNotEmpty(range)) { // String range = JSONArray.fromObject(JSONObject.fromObject(nodeData).get(key)).getJSONObject(0).get("range").toString(); Double max = Double.valueOf(range.substring(range.lastIndexOf(",") + 1, range.length()));//量程最大值 Double min = Double.valueOf(range.substring(0, range.lastIndexOf(",")));//量程最小值 int countRange = 0; for (int i = 0; i < entries.size(); i++) { SensorDataEntry sensorDataEntry = entries.get(i); List<Float> values = sensorDataEntry.getValues(); if (values.get(0) > max || values.get(0) < min) {// 超出量程范围统计 countRange++; System.out.println("***********###############>>>>>>>" + "桥梁id->" + bridgeid + "监测项目->" + monitoringcode + "设备名称->" + eqipmentname + "量程最大值->" + String.valueOf(max) + "量程最小值->" + String.valueOf(min) + "超量程值->" + values + "数据时间->" + sdf.format(entries.get(i).getTime()) + "***********###############>>>>>>>"); Statement statement = null; try { statement = DBHelper.createStatement(); String NormSQL = "insert into BRIDGE_NORM_INFO(bridgeid,monitoring_code,eqipment_name,out_range,max_range,min_range,time)" + "VALUES ('" + bridgeid + "','" + monitoringcode + "','" + eqipmentname + "','" + values.get(0) + "'," + max + "," + min + ",'" + sdf.format(entries.get(i).getTime()) + "')"; logger.info(NormSQL); statement.execute(NormSQL); statement.close(); DBHelper.close(); } catch (Exception e) { e.printStackTrace(); } // try { //// Table table = connection.getTable(TableName.valueOf("BRIDGE_NORM_INFO")); // String startrowkey = MD5Hash.getMD5AsHex(bridgeid.getBytes("utf-8")); // String rowKey = startrowkey.substring(0, 6) + ":" + key + ":" + (Long.MAX_VALUE - entries.get(i).getTime()); // Put put = new Put(Bytes.toBytes(rowKey)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("monitoring_code"), Bytes.toBytes(monitoringcode)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("eqipment_name"), Bytes.toBytes(eqipmentname)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("out_range"), Bytes.toBytes(values.get(0).toString()));//超量程 // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("max_range"), Bytes.toBytes(String.valueOf(max)));//量程最大值 // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("min_range"), Bytes.toBytes(String.valueOf(min)));//量程最小值 // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("time"), Bytes.toBytes(entries.get(i).getTime().toString())); // final BufferedMutator.ExceptionListener listener = new BufferedMutator.ExceptionListener() { // @Override // public void onException(RetriesExhaustedWithDetailsException e, BufferedMutator mutator) { // for (int i = 0; i < e.getNumExceptions(); i++) { // System.out.println("Failed to sent put " + e.getRow(i) + "."); // logger.error("Failed to sent put " + e.getRow(i) + "."); // } // } // }; // BufferedMutatorParams params = new BufferedMutatorParams(TableName.valueOf("BRIDGE_NORM_INFO")).listener(listener); // params.writeBufferSize(5 * 1024 * 1024); // final BufferedMutator mutator = connection.getBufferedMutator(params); // try { // mutator.mutate(put); // mutator.flush(); // } finally { // mutator.close(); // } //// table.put(put); //// table.close(); // } catch (IOException e) { // e.printStackTrace(); // } } /** * 数据的时效性监测(接受数据时间-数据时间) */ long sysTime = sensorData.getTime();//接受时间 long sedTime = entries.get(i).getTime();//数据时间 if (sysTime - sedTime > 10 * 1000 || sysTime - sedTime < -5 * 1000) { System.out.println("***********###############>>>>>>>" + "桥梁id->" + bridgeid + "监测项目->" + monitoringcode + "设备名称->" + eqipmentname + "数据时间->" + sdf.format(entries.get(i).getTime()) + "接受时间->" + sdf.format(sensorData.getTime()) + "值->" + values + "***********###############>>>>>>>"); Statement statement = null; try { statement = DBHelper.createStatement(); String TimeLinessSQL = "insert into BRIDGE_TIMELINESS_INFO(bridgeid,monitoring_code,eqipment_name,send_time,received_time,values)" + "VALUES ('" + bridgeid + "','" + monitoringcode + "','" + eqipmentname + "','" + sdf.format(entries.get(i).getTime()) + "','" + sdf.format(sensorData.getTime()) + "','" + values + "')"; logger.info(TimeLinessSQL); statement.execute(TimeLinessSQL); statement.close(); DBHelper.close(); } catch (Exception e) { e.printStackTrace(); } /** * HBASE的操作 */ // try { //// Table table = connection.getTable(TableName.valueOf("BRIDGE_TIMELINESS_INFO")); // String startrowkey = MD5Hash.getMD5AsHex(bridgeid.getBytes("utf-8")); // String rowKey = startrowkey.substring(0, 6) + ":" + key + ":" + (Long.MAX_VALUE - entries.get(i).getTime()); // Put put = new Put(Bytes.toBytes(rowKey)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("monitoring_code"), Bytes.toBytes(monitoringcode)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("eqipment_name"), Bytes.toBytes(eqipmentname)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("send_time"), Bytes.toBytes(entries.get(i).getTime().toString())); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("receive_time"), Bytes.toBytes(sensorData.getTime().toString())); // final BufferedMutator.ExceptionListener listener = new BufferedMutator.ExceptionListener() { // @Override // public void onException(RetriesExhaustedWithDetailsException e, BufferedMutator mutator) { // for (int i = 0; i < e.getNumExceptions(); i++) { // System.out.println("Failed to sent put " + e.getRow(i) + "."); // logger.error("Failed to sent put " + e.getRow(i) + "."); // } // } // }; // BufferedMutatorParams params = new BufferedMutatorParams(TableName.valueOf("BRIDGE_TIMELINESS_INFO")).listener(listener); // params.writeBufferSize(5 * 1024 * 1024); // final BufferedMutator mutator = connection.getBufferedMutator(params); // try { // mutator.mutate(put); // mutator.flush(); // } finally { // mutator.close(); // } //// table.put(put); //// table.close(); // } catch (IOException e) { // e.printStackTrace(); // } } /** * 数据的中断性监测 */ long prevDataTime = 0; long nextDataTime = 0; boolean flag = true; if (!preConfigMap.containsKey(key)) { preConfigMap.put(key, entries.get(entries.size() - 1).getTime());//缓存上次数据包最后一条数据时间 flag = false; } nextDataTime = entries.get(0).getTime(); if (flag && preConfigMap.containsKey(key) && nextDataTime - preConfigMap.get(key) > Integer.parseInt(simple_frequency)) { prevDataTime = preConfigMap.get(key); long inteDataTime = (nextDataTime - prevDataTime) / 1000; System.out.println("***********###############>>>>>>>" + "桥梁id->" + bridgeid + "监测项目->" + monitoringcode + "设备名称->" + eqipmentname + "前一秒时间->" + sdf.format(prevDataTime) + "下一秒时间->" + sdf.format(nextDataTime) + "中断时长->" + String.valueOf((nextDataTime - prevDataTime) / 1000) + "值->" + values + "***********###############>>>>>>>"); Statement statement = null; try { statement = DBHelper.createStatement(); String InteRuptSQL = "insert into BRIDGE_INTERUPT_INFO(bridgeid,monitoring_code,eqipment_name,prev_time,next_time,inte_time)" + "VALUES ('" + bridgeid + "','" + monitoringcode + "','" + eqipmentname + "','" + sdf.format(prevDataTime) + "','" + sdf.format(nextDataTime) + "','" + String.valueOf((nextDataTime - prevDataTime) / 1000) + "')"; logger.info(InteRuptSQL); statement.execute(InteRuptSQL); statement.close(); DBHelper.close(); } catch (Exception e) { e.printStackTrace(); } // try { //// Table table = connection.getTable(TableName.valueOf("BRIDGE_INTERUPT_INFO")); // String startrowkey = MD5Hash.getMD5AsHex(bridgeid.getBytes("utf-8")); // String rowKey = startrowkey.substring(0, 6) + ":" + key + ":" + (Long.MAX_VALUE - entries.get(i).getTime()); // Put put = new Put(Bytes.toBytes(rowKey)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("monitoring_code"), Bytes.toBytes(monitoringcode)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("eqipment_name"), Bytes.toBytes(eqipmentname)); // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("prev_time"), Bytes.toBytes(prevDataTime));//上次时间 // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("next_time"), Bytes.toBytes(nextDataTime));//下次时间 // put.addColumn(Bytes.toBytes("info"), Bytes.toBytes("inte_time"), Bytes.toBytes(inteDataTime));//中断时间 // final BufferedMutator.ExceptionListener listener = new BufferedMutator.ExceptionListener() { // @Override // public void onException(RetriesExhaustedWithDetailsException e, BufferedMutator mutator) { // for (int i = 0; i < e.getNumExceptions(); i++) { // System.out.println("Failed to sent put " + e.getRow(i) + "."); // logger.error("Failed to sent put " + e.getRow(i) + "."); // } // } // }; // BufferedMutatorParams params = new BufferedMutatorParams(TableName.valueOf("BRIDGE_INTERUPT_INFO")).listener(listener); // params.writeBufferSize(5 * 1024 * 1024); // final BufferedMutator mutator = connection.getBufferedMutator(params); // try { // mutator.mutate(put); // mutator.flush(); // } finally { // mutator.close(); // } //// table.put(put); //// table.close(); // } catch (IOException e) { // e.printStackTrace(); // } } preConfigMap.put(key, entries.get(entries.size() - 1).getTime()); //写入文件上传到hdfs上用kylin构建 } } //写入文件上传到hdfs上用kylin构建 // try { // connection.close(); // } catch (IOException e) { // e.printStackTrace(); // } } @Override public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { } public static void main(String[] args) { // int AA = Integer.parseInt(""); // System.out.println(AA); // Map<String, String> map = new ConcurrentHashMap<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); // Date date = new Date(); // String time = sdf.format(date); // String endtime = "2018-06-01 08:31:00:000"; // long stime = 0; // try { // stime = sdf.parse(endtime).getTime(); // } catch (ParseException e) { // e.printStackTrace(); // } // System.out.println(stime); long testTime = 1528072822950l; String ss = sdf.format(testTime); System.out.println(ss); } }
[ "2479296995@qq.com" ]
2479296995@qq.com
9e57c492489a63402046fc734e747d808854096f
d61cbe04b46e3480d5f2acf356f8ccdbab28dbc7
/Universidad Java De Cero a Master/05 - Servlets y JSP/19_EjemploExcelJSP_v2/src/java/util/Conversiones.java
9a3bc46b7559f3240d731023b9107c7062ab9d6b
[]
no_license
decalion/Formaciones-Platzi-Udemy
d479548c50f3413eba5bad3d01bdd6a33ba75f60
3180d5062d847cc466d4a614863a731189137e50
refs/heads/master
2022-11-30T18:59:39.796599
2021-06-08T20:11:18
2021-06-08T20:11:18
200,000,005
1
2
null
2022-11-24T09:11:48
2019-08-01T07:27:00
Java
UTF-8
Java
false
false
682
java
package util; import java.util.Date; import java.text.SimpleDateFormat; /** * * @author Ismael Caballero */ public class Conversiones { private static final String FORMATO_FECHA = "dd-MM-yyyy"; /** * Metodo que permite convertir una fecha en una cadeca con el formato especificado * @param fecha * @return */ public static String format (Date fecha){ SimpleDateFormat format = new SimpleDateFormat(FORMATO_FECHA); return format.format(fecha); } public static String format (String fecha){ SimpleDateFormat format = new SimpleDateFormat(FORMATO_FECHA); return format.format(fecha); } }
[ "icaballerohernandez@gmail.com" ]
icaballerohernandez@gmail.com
7a45b00179f0d4e6368f71cb6d7c3dd3bfd57c6d
443928d406ef51efd35020de050decd8151dae9b
/asnlab-uper/src/main/java/com/hisense/hiatmp/asn/v2x/DefPositionOffset/Longitude.java
6b30b98b75dfce9e68b44892078c48e1f9c0dcd1
[ "Apache-2.0" ]
permissive
zyjohn0822/asn1-uper-v2x-se
ad430889ca9f3d42f2c083810df2a5bc7b18ec22
85f9bf98a12a57a04260282a9154f1b988de8dec
refs/heads/master
2023-04-21T11:44:34.222501
2021-05-08T08:23:27
2021-05-08T08:23:27
365,459,042
2
1
null
null
null
null
UTF-8
Java
false
false
1,457
java
/* * Generated by ASN.1 Java Compiler (https://www.asnlab.org/) * From ASN.1 module "DefPosition" */ package com.hisense.hiatmp.asn.v2x.DefPositionOffset; import org.asnlab.asndt.runtime.conv.AsnConverter; import org.asnlab.asndt.runtime.conv.EncodingRules; import org.asnlab.asndt.runtime.conv.IntegerConverter; import org.asnlab.asndt.runtime.type.AsnType; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Longitude { public final static AsnType TYPE = DefPositionOffset.type(131085); public final static AsnConverter CONV = IntegerConverter.INSTANCE; public static void ber_encode(Integer object, OutputStream out) throws IOException { TYPE.encode(object, EncodingRules.BASIC_ENCODING_RULES, CONV, out); } public static Integer ber_decode(InputStream in) throws IOException { return (Integer) TYPE.decode(in, EncodingRules.BASIC_ENCODING_RULES, CONV); } public static void per_encode(Integer object, boolean align, OutputStream out) throws IOException { TYPE.encode(object, align ? EncodingRules.ALIGNED_PACKED_ENCODING_RULES : EncodingRules.UNALIGNED_PACKED_ENCODING_RULES, CONV, out); } public static Integer per_decode(boolean align, InputStream in) throws IOException { return (Integer) TYPE.decode(in, align ? EncodingRules.ALIGNED_PACKED_ENCODING_RULES : EncodingRules.UNALIGNED_PACKED_ENCODING_RULES, CONV); } }
[ "31430762+zyjohn0822@users.noreply.github.com" ]
31430762+zyjohn0822@users.noreply.github.com
23664fb55c90e93b682cba880730e27fc866651b
593814bbe82b454683566dfba1cf39d3e2d86792
/src/tests/unverified/TelephoneBoxKatTest.java
8f9e69b21c65225f839623ba53215db29b635b67
[]
no_license
theojulienne/acceptance
7ab534664a971257c4e2a12983d070dc46e457ae
4315558b5041b2cc7e42d59136d7634909b02908
refs/heads/master
2021-01-17T05:26:07.644623
2012-05-20T11:11:14
2012-05-20T11:11:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,758
java
package tests.unverified; import framework.Rules; import framework.Test; import framework.cards.Card; import framework.interfaces.GameState; import framework.interfaces.MoveMaker; import framework.interfaces.activators.LegionariusActivator; import framework.interfaces.activators.TelephoneBoxActivator; import java.util.ArrayList; import java.util.Collection; /** * Created with IntelliJ IDEA. * @Author : Chris FONG * Date: 19/05/12 * Time: 10:56 PM * To change this template use File | Settings | File Templates. */ public class TelephoneBoxKatTest extends Test { private final int PLAYER_1 = 0; private final int PLAYER_2 = 1; @Override public String getShortDescription() { return "Testing Kat interacting with Telephone Box"; } @Override public void run(GameState gameState, MoveMaker move) throws AssertionError, UnsupportedOperationException, IllegalArgumentException { Collection<Card> hand = new ArrayList<Card>(); hand.add(Card.KAT); gameState.setDiscard(new ArrayList<Card>()); gameState.setPlayerHand(PLAYER_2,hand); gameState.setPlayerSestertii(PLAYER_1,100); gameState.setPlayerSestertii(PLAYER_2,100); gameState.setPlayerVictoryPoints(PLAYER_1, 15); gameState.setPlayerVictoryPoints(PLAYER_2,15); Card[][] playerFields = new Card[Rules.NUM_PLAYERS][Rules.NUM_DICE_DISCS]; playerFields[PLAYER_1] = new Card[] { Card.SCAENICUS, Card.SCAENICUS, Card.LEGIONARIUS, Card.SCAENICUS, Card.SCAENICUS, Card.SCAENICUS, Card.SCAENICUS }; playerFields[PLAYER_2] = new Card[] { Card.SCAENICUS, Card.SCAENICUS, Card.MERCATOR, Card.TELEPHONEBOX, Card.SCAENICUS, Card.SCAENICUS, Card.SCAENICUS }; gameState.setPlayerCardsOnDiscs(PLAYER_1,playerFields[PLAYER_1]); gameState.setPlayerCardsOnDiscs(PLAYER_2,playerFields[PLAYER_2]); gameState.setWhoseTurn(PLAYER_1); //TURN : 1 gameState.setActionDice(new int[] {3,3,3}); LegionariusActivator legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.MERCATOR); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.MERCATOR); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.MERCATOR); move.endTurn(); //TURN : 2 gameState.setActionDice(new int[] {1,1,5}); move.endTurn(); //TURN : 3 gameState.setActionDice(new int[]{3,3,3}); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.MERCATOR); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.MERCATOR); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.MERCATOR); move.endTurn(); //TURN : 4 gameState.setActionDice(new int[] {4,3,3}); move.placeCard(Card.KAT, Rules.DICE_DISC_3); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.KAT); move.endTurn(); // TURN : 5 gameState.setActionDice(new int[]{3,3,3}); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.KAT); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.KAT); legionarius = (LegionariusActivator) move.chooseCardToActivate(Rules.DICE_DISC_3); legionarius.giveAttackDieRoll(1); legionarius.complete(); assert(gameState.getPlayerCardsOnDiscs(PLAYER_2)[2] == Card.KAT); move.endTurn(); gameState.setActionDice(new int[] {4,5,5}); TelephoneBoxActivator jerk = (TelephoneBoxActivator) move.chooseCardToActivate(Rules.DICE_DISC_4); jerk.setSecondDiceUsed(5); jerk.shouldMoveForwardInTime(false); jerk.chooseDiceDisc(Rules.DICE_DISC_3); jerk.complete(); assert(gameState.getPlayerVictoryPoints(PLAYER_2) == 14); assert(gameState.getDiscard().contains(Card.KAT)); } }
[ "mzhou.acceptanceupload@cse.unsw.edu.au" ]
mzhou.acceptanceupload@cse.unsw.edu.au
939d04e381c63f73103cc57a3dbc5fd229f345fe
b02c9acafea5d971566653558738ea3734e6ffe5
/app/src/androidTest/java/dev/sadovnikov/dagger2examples/ExampleInstrumentedTest.java
a9ed2f0f07a721a278a5dabf0238954122d07113
[]
no_license
sadovnikovrussia/Dagger2Examples
c6d6d70c6edf51d5767a2cef9bb5f6e0b002a99f
956f9be8ed7a2583df434347b440b92a5891cf28
refs/heads/master
2020-04-12T07:03:37.224780
2018-12-19T16:02:46
2018-12-19T16:02:46
162,356,131
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package dev.sadovnikov.dagger2examples; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("dev.sadovnikov.dagger2examples", appContext.getPackageName()); } }
[ "sadovnikov.russia@gmail.com" ]
sadovnikov.russia@gmail.com
cb7606ceff16693eecd6296a991351d05c6d44d2
e89dc01c95b8b45404f971517c2789fd21657749
/src/main/java/com/alipay/api/domain/KoubeiRetailWmsDeliveryorderprocessQueryModel.java
37d5f419c0ee0f88294d93925e3b40f1e7505129
[ "Apache-2.0" ]
permissive
guoweiecust/alipay-sdk-java-all
3370466eec70c5422c8916c62a99b1e8f37a3f46
bb2b0dc8208a7a0ab8521a52f8a5e1fcef61aeb9
refs/heads/master
2023-05-05T07:06:47.823723
2021-05-25T15:26:21
2021-05-25T15:26:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
647
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 物流单状态查询 * * @author auto create * @since 1.0, 2018-06-01 17:20:06 */ public class KoubeiRetailWmsDeliveryorderprocessQueryModel extends AlipayObject { private static final long serialVersionUID = 2466759627238183727L; /** * 通知单id */ @ApiField("notice_order_id") private String noticeOrderId; public String getNoticeOrderId() { return this.noticeOrderId; } public void setNoticeOrderId(String noticeOrderId) { this.noticeOrderId = noticeOrderId; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
de55eb5c36f19e4105ac8ae5a84fd862e4f242dc
899365d0910cc35022ec316ba756f911e376132c
/common/MessageType.java
86b902350a2390a7bdeed4c27f306f48fd05c7c6
[]
no_license
Zxxjgp/wxdemo
a043f524ad586378dc0b56f98010b22155be62ae
679d495f1c7c2c0d2778bfb06d3a8cc6a906cb3d
refs/heads/master
2020-03-27T02:59:53.921183
2018-10-21T12:24:29
2018-10-21T12:24:29
145,832,316
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.wx.ioc.wxdemo.common; import com.wx.ioc.wxdemo.controller.Test; /** * 接收到的消息类型 * @author HSHY-394 */ public enum MessageType { TEXT,//文本消息 IMAGE,//图片消息 VOICE,//语音消息 VIDEO,//视频消息 SHORTVIDEO,//小视频消息 LOCATION,//地理位置消息 LINK,//链接消息 EVENT,//事件消息 TEST }
[ "948102903@qq.com" ]
948102903@qq.com
a93f7cf7a28389a4f186238ab2585b64d06901c3
40f779ec3f249cc6c0d04eb05f45502ae67ebe2c
/sample/timetracker-gui/core/src/main/java/org/andromda/timetracker/domain/UserRoleDaoImpl.java
1d8baf6cde618e95ed8ac05b5b6d11b33cf2ada8
[ "BSD-3-Clause" ]
permissive
AlbanAndrieu/nabla-andromda
4a52c3bb2d1823d0f3c4fc23ba94605754fd58cf
145f7dd8321ca7512cf3cf7d7b391219b89d0306
refs/heads/master
2022-11-16T12:55:03.769743
2022-01-27T16:47:16
2022-01-27T16:47:16
32,604,523
1
1
null
2022-11-08T17:48:55
2015-03-20T20:10:05
Java
UTF-8
Java
false
false
2,282
java
// Generated by: hibernate/SpringHibernateDaoImpl.vsl in andromda-spring-cartridge. // license-header java merge-point /** * This is only generated once! It will never be overwritten. * You can (and have to!) safely modify it by hand. */ package org.andromda.timetracker.domain; import org.andromda.timetracker.vo.UserRoleVO; /** * @see UserRole */ public class UserRoleDaoImpl extends UserRoleDaoBase { /** * {@inheritDoc} */ @Override public void toUserRoleVO(final UserRole source, final UserRoleVO target) { // TODO verify behavior of toUserRoleVO super.toUserRoleVO(source, target); } /** * {@inheritDoc} */ @Override public UserRoleVO toUserRoleVO(final UserRole entity) { // TODO verify behavior of toUserRoleVO return super.toUserRoleVO(entity); } /** * Retrieves the entity object that is associated with the specified value object * from the object store. If no such entity object exists in the object store, * a new, blank entity is created */ private UserRole loadUserRoleFromUserRoleVO(final UserRoleVO userRoleVO) { // TODO implement loadUserRoleFromUserRoleVO throw new UnsupportedOperationException("org.andromda.timetracker.domain.loadUserRoleFromUserRoleVO(UserRoleVO) not yet implemented."); /* * A typical implementation looks like this: * UserRole userRole = this.load(userRoleVO.getId()); * if (userRole == null) * { * userRole = UserRole.Factory.newInstance(); * } * return userRole; */ } /** * {@inheritDoc} */ @Override public UserRole userRoleVOToEntity(final UserRoleVO userRoleVO) { // TODO verify behavior of userRoleVOToEntity final UserRole entity = this.loadUserRoleFromUserRoleVO(userRoleVO); this.userRoleVOToEntity(userRoleVO, entity, true); return entity; } /** * {@inheritDoc} */ @Override public void userRoleVOToEntity(final UserRoleVO source, final UserRole target, final boolean copyIfNull) { // TODO verify behavior of userRoleVOToEntity super.userRoleVOToEntity(source, target, copyIfNull); } }
[ "alban.andrieu@misys.com" ]
alban.andrieu@misys.com
6a6a2b21ebc6ab0d79b4fb24213146a324d83c06
4294e40b060baaba734d535c539c259f57a7b055
/section11/src/main/java/com/learn/spring/section11/repositories/UnitOfMeasureRepository.java
449b577e50a2b34cdc5f71f750cfc28a5de1f5f8
[]
no_license
songk1992/Spring-Framework-5-Beginner-to-Guru
662da72481919744bdefd778960abcd1e7711948
463aa689954420bf46b0e33b4010417c544065ff
refs/heads/main
2023-08-27T19:21:22.568975
2021-11-08T15:05:26
2021-11-08T15:05:26
409,848,680
0
0
null
2021-10-31T04:21:15
2021-09-24T05:56:29
Java
UTF-8
Java
false
false
1,134
java
package com.learn.spring.section11.repositories; import com.learn.spring.section11.domain.UnitOfMeasure; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import java.util.Optional; @Repository public interface UnitOfMeasureRepository extends CrudRepository<UnitOfMeasure, Long> { Optional<UnitOfMeasure> findByDescription(String description); @Override <S extends UnitOfMeasure> S save(S entity); @Override <S extends UnitOfMeasure> Iterable<S> saveAll(Iterable<S> entities); @Override Optional<UnitOfMeasure> findById(Long aLong); @Override boolean existsById(Long aLong); @Override Iterable<UnitOfMeasure> findAll(); @Override Iterable<UnitOfMeasure> findAllById(Iterable<Long> longs); @Override long count(); @Override void deleteById(Long aLong); @Override void delete(UnitOfMeasure entity); @Override void deleteAllById(Iterable<? extends Long> longs); @Override void deleteAll(Iterable<? extends UnitOfMeasure> entities); @Override void deleteAll(); }
[ "zuppiy@naver.com" ]
zuppiy@naver.com
382e08469c691b02e4745b7096f58e21ebc75b6a
481a2ccdbaad190d02015f2e99eebe41415b956c
/Core/SDK/org.emftext.sdk.concretesyntax.resource.cs/src-gen/org/emftext/sdk/concretesyntax/resource/cs/mopp/CsBracketPair.java
d8c65aaf9f778f959513d3383321f22933a1a8be
[]
no_license
balazsgrill/EMFText
2f3d5eb1ac9d794325b61a8bbea2e1d2c7d4b279
cbbf0f472f5a4ab7222c7d9df9cb0962dac989da
refs/heads/master
2020-12-30T18:38:38.790410
2013-04-24T10:03:32
2013-04-24T10:03:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,093
java
/******************************************************************************* * Copyright (c) 2006-2012 * Software Technology Group, Dresden University of Technology * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026 * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Software Technology Group - TU Dresden, Germany; * DevBoost GmbH - Berlin, Germany * - initial API and implementation ******************************************************************************/ package org.emftext.sdk.concretesyntax.resource.cs.mopp; /** * A single pair of brackets. */ public class CsBracketPair implements org.emftext.sdk.concretesyntax.resource.cs.ICsBracketPair { private String openingBracket; private String closingBracket; private boolean closingEnabledInside; private boolean closeAfterEnter; public String getOpeningBracket() { return openingBracket; } public String getClosingBracket() { return closingBracket; } public boolean isClosingEnabledInside() { return closingEnabledInside; } public boolean isCloseAfterEnter() { return closeAfterEnter; } public void setOpeningBracket(String openingBracket) { this.openingBracket = openingBracket; } public void setClosingBracket(String closingBracket) { this.closingBracket = closingBracket; } public void setClosingEnabledInside(boolean closingEnabledInside) { this.closingEnabledInside = closingEnabledInside; } public void setCloseAfterEnter(boolean closeAfterEnter) { this.closeAfterEnter = closeAfterEnter; } public CsBracketPair(String openingBracket, String closingBracket, boolean closingEnabledInside, boolean closeAfterEnter) { super(); this.openingBracket = openingBracket; this.closingBracket = closingBracket; this.closingEnabledInside = closingEnabledInside; this.closeAfterEnter = closeAfterEnter; } }
[ "mirko.seifert@devboost.de" ]
mirko.seifert@devboost.de
03dad43a3b5e9614b035b03f399989858ad1b83b
d1421cd4725a83f56814fc887e86089189a45d08
/src/main/java/ru/dsoccer1980/service/TestingService.java
50f7a72c5cac2057c68b5e8c7631903e8b758885
[]
no_license
dsoccer1980/otus_hw02
6eafcdd53e5df31e9914274466682cc234fe3d7c
dd60dd06e58f87bb4de32eea280f5da36270e957
refs/heads/hw02
2020-04-26T09:00:06.551725
2019-03-17T14:29:51
2019-03-17T14:29:51
173,441,097
0
0
null
2019-03-17T14:35:08
2019-03-02T11:44:21
Java
UTF-8
Java
false
false
117
java
package ru.dsoccer1980.service; public interface TestingService { void showQuestions(); int getResult(); }
[ "dsoccer1980@gmail.com" ]
dsoccer1980@gmail.com
592c84c82492afb71108c3c860a1361071921ce7
dac8845d5b99f6765ce1c86b8daee3c36321d0a5
/Forge/src/main/java/com/blamejared/crafttweaker/natives/event/interact/ExpandRightClickItemEvent.java
9927ffcd8caeb1b7cb77287213129159841e6070
[ "MIT" ]
permissive
CraftTweaker/CraftTweaker
d6f9519e790782b26bf08c703ca0068884f89152
eed8f2ca850b231e081c8d748bae1fd68c788296
refs/heads/1.20.1
2023-09-05T19:18:17.472399
2023-09-01T22:28:40
2023-09-01T22:28:40
41,600,436
248
149
MIT
2023-09-04T16:08:47
2015-08-29T16:53:44
Java
UTF-8
Java
false
false
1,431
java
package com.blamejared.crafttweaker.natives.event.interact; import com.blamejared.crafttweaker.api.annotation.ZenRegister; import com.blamejared.crafttweaker.api.event.ForgeEventCancellationCarrier; import com.blamejared.crafttweaker.api.event.ZenEvent; import com.blamejared.crafttweaker.api.event.bus.ForgeEventBusWire; import com.blamejared.crafttweaker.api.event.bus.IEventBus; import com.blamejared.crafttweaker_annotations.annotations.Document; import com.blamejared.crafttweaker_annotations.annotations.NativeTypeRegistration; import net.minecraftforge.event.entity.player.PlayerInteractEvent; /** * The rightClickItem event is fired whenever the player right clicks with an item in their hand. * It does not offer any special getters, but you can still access all members from {@link PlayerInteractEvent} * * @docEvent canceled Item#onItemRightClick will not be called */ @ZenRegister @ZenEvent @Document("forge/api/event/interact/RightClickItemEvent") @NativeTypeRegistration(value = PlayerInteractEvent.RightClickItem.class, zenCodeName = "crafttweaker.forge.api.player.interact.RightClickItemEvent") public class ExpandRightClickItemEvent { @ZenEvent.Bus public static final IEventBus<PlayerInteractEvent.RightClickItem> BUS = IEventBus.cancelable( PlayerInteractEvent.RightClickItem.class, ForgeEventBusWire.of(), ForgeEventCancellationCarrier.of() ); }
[ "jaredlll08@gmail.com" ]
jaredlll08@gmail.com
e638044ed0e72df134ab92506651187372dd737d
e3cad0271926eacfa769a88e57c349fbcda53680
/design-patterns/src/main/java/com/sda/patherns/behavioral/memento/ex2/commands/MoveCommand.java
642c23a9c21fd8354a61806be66f373886cee502
[]
no_license
DanNistor1/sda-course
72030b4cd0ce4701b3cd4caf093fdea7a0795534
3209f143c942947e06a66d3f57ca04709bc325b5
refs/heads/master
2022-12-13T23:49:36.595420
2022-12-05T07:17:47
2022-12-05T07:17:47
219,139,511
0
0
null
2022-12-04T23:31:14
2019-11-02T10:43:36
Java
UTF-8
Java
false
false
1,228
java
package com.sda.patherns.behavioral.memento.ex2.commands; import com.sda.patherns.behavioral.memento.ex2.editor.Editor; import com.sda.patherns.behavioral.memento.ex2.shapes.Shape; public class MoveCommand implements Command { private Editor editor; private int startX, startY; private int endX, endY; public MoveCommand(Editor editor) { this.editor = editor; } @Override public String getName() { return "Move by X:" + (endX - startX) + " Y:" + (endY - startY); } public void start(int x, int y) { startX = x; startY = y; for (Shape child : editor.getShapes().getSelected()) { child.drag(); } } public void move(int x, int y) { for (Shape child : editor.getShapes().getSelected()) { child.moveTo(x - startX, y - startY); } } public void stop(int x, int y) { endX = x; endY = y; for (Shape child : editor.getShapes().getSelected()) { child.drop(); } } @Override public void execute() { for (Shape child : editor.getShapes().getSelected()) { child.moveBy(endX - startX, endY - startY); } } }
[ "dan.nistor1@yahoo.ro" ]
dan.nistor1@yahoo.ro
da660eb0edd801a379e9f64edeb5eb6ddba6e03e
fbea2cf570fb3dd582cba9272e63066df76aaa6b
/RonproEditor/testbase/testcases/BlockConvetrTest/_02IfElseTest.java
cbb7b11f1600b7c2a9954bd684ee9d605c96c9b2
[]
no_license
macc704/CRiPS
3a2da4b0dfc20d6a598e0f361669706d8c7cbcea
4a2b34f041a55150aca1660c7364fb48ed95c3a1
refs/heads/master
2020-12-24T06:33:33.346484
2015-09-03T07:08:03
2015-09-03T07:08:03
13,116,338
5
3
null
null
null
null
SHIFT_JIS
Java
false
false
459
java
/** * プログラム名: * 作成者: * 作成日: Thu Nov 08 10:57:58 JST 2012 */ public class _02IfElseTest extends Turtle { //起動処理 public static void main(String[] args) { Turtle.startTurtle(new _02IfElseTest()); } //タートルを動かす処理 public void start() { int x = 0; if(x == 3){ }else if(x == 4){ fd(50); } if(x == 3){ }else { if(x == 4){ } fd(50); } } }
[ "yoshiaki.matsuzzawa@gmail.com" ]
yoshiaki.matsuzzawa@gmail.com
aca7a4fbca501d4164e3480820b2b30320084b8d
8d9030504c905250d26915827097a28bb0e4c72c
/src/main/java/com/macro/mall/tiny/mbg/model/PmsComment.java
4401f19a595604069597de79005d865bdc2232dd
[]
no_license
biqin/myMall
0bda8e6549b2b880556b6a6b1e7420ee608d7fae
b367071d8d4ec9e97584ffef19ee3c5a22efabb5
refs/heads/main
2023-02-15T07:28:58.338406
2021-01-10T08:52:15
2021-01-10T08:52:15
303,088,594
0
1
null
2020-10-12T13:37:14
2020-10-11T09:49:17
Java
UTF-8
Java
false
false
4,549
java
package com.macro.mall.tiny.mbg.model; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.Date; public class PmsComment implements Serializable { private Long id; private Long productId; private String memberNickName; private String productName; @ApiModelProperty(value = "评价星数:0->5") private Integer star; @ApiModelProperty(value = "评价的ip") private String memberIp; private Date createTime; private Integer showStatus; @ApiModelProperty(value = "购买时的商品属性") private String productAttribute; private Integer collectCouont; private Integer readCount; @ApiModelProperty(value = "上传图片地址,以逗号隔开") private String pics; @ApiModelProperty(value = "评论用户头像") private String memberIcon; private Integer replayCount; private String content; private static final long serialVersionUID = 1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getProductId() { return productId; } public void setProductId(Long productId) { this.productId = productId; } public String getMemberNickName() { return memberNickName; } public void setMemberNickName(String memberNickName) { this.memberNickName = memberNickName; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public Integer getStar() { return star; } public void setStar(Integer star) { this.star = star; } public String getMemberIp() { return memberIp; } public void setMemberIp(String memberIp) { this.memberIp = memberIp; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getShowStatus() { return showStatus; } public void setShowStatus(Integer showStatus) { this.showStatus = showStatus; } public String getProductAttribute() { return productAttribute; } public void setProductAttribute(String productAttribute) { this.productAttribute = productAttribute; } public Integer getCollectCouont() { return collectCouont; } public void setCollectCouont(Integer collectCouont) { this.collectCouont = collectCouont; } public Integer getReadCount() { return readCount; } public void setReadCount(Integer readCount) { this.readCount = readCount; } public String getPics() { return pics; } public void setPics(String pics) { this.pics = pics; } public String getMemberIcon() { return memberIcon; } public void setMemberIcon(String memberIcon) { this.memberIcon = memberIcon; } public Integer getReplayCount() { return replayCount; } public void setReplayCount(Integer replayCount) { this.replayCount = replayCount; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", productId=").append(productId); sb.append(", memberNickName=").append(memberNickName); sb.append(", productName=").append(productName); sb.append(", star=").append(star); sb.append(", memberIp=").append(memberIp); sb.append(", createTime=").append(createTime); sb.append(", showStatus=").append(showStatus); sb.append(", productAttribute=").append(productAttribute); sb.append(", collectCouont=").append(collectCouont); sb.append(", readCount=").append(readCount); sb.append(", pics=").append(pics); sb.append(", memberIcon=").append(memberIcon); sb.append(", replayCount=").append(replayCount); sb.append(", content=").append(content); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
[ "bq7327645@163.com" ]
bq7327645@163.com
7b860ea4aaafa0c8f69e15c38c648416274ecada
b1cf2425d706c5c73f8aad90fa76ef900f4bab73
/src/main/java/com/github/hypfvieh/util/StringUtil.java
a91d7fb632d2a286c4344c9cb89850f737f4b0c1
[ "MIT" ]
permissive
hypfvieh/java-utils
b254a9b79db3a854d663b8940263fed925b7431c
003ecd2ef6c10efb1e59194f87ad94e901d60cea
refs/heads/master
2023-01-21T22:00:50.313598
2023-01-12T14:51:16
2023-01-12T14:51:16
81,177,563
2
4
MIT
2022-01-04T16:59:57
2017-02-07T07:04:51
Java
UTF-8
Java
false
false
27,835
java
package com.github.hypfvieh.util; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.IntStream; /** * Utility class for String manipulation. * * @author hypfvieh * @since v1.0 - 2016-06-29 */ public final class StringUtil { /** Characters used for random strings */ private static final char[] SYMBOLS; static { StringBuilder tmp = new StringBuilder(); for (char ch = '0'; ch <= '9'; ++ch) tmp.append(ch); for (char ch = 'a'; ch <= 'z'; ++ch) tmp.append(ch); for (char ch = 'A'; ch <= 'Z'; ++ch) tmp.append(ch); SYMBOLS = tmp.toString().toCharArray(); } private StringUtil() { } /** * Abbreviates a String using ellipses. * * @param _str string to abbrivate * @param _length max length * @return abbreviated string, original string if string length is lower or equal then desired length or null if input was null */ public static String abbreviate(String _str, int _length) { if (_str == null) { return null; } if (_str.length() <= _length) { return _str; } String abbr = _str.substring(0, _length -3) + "..."; return abbr; } /** * Tries to split a string in a smart way.<br><br> * * String will be splitted by space and then recombined until each line has * the given length or less than the given length, if the next token would cause * the line to be longer than requested * * It is ensured that each line has a maximum length of _len, it could be short but never longer. * * @param _text text to split * @param _len max length per line * @return list or null if _text was null */ public static List<String> smartWordSplit(String _text, int _len) { if (_text == null) { return null; } // if the given string is already shorter or equal to wanted length, return immediately if (_text.length() <= _len) { return TypeUtil.createList(_text); } List<String> list = new ArrayList<>(); String[] result = _text.split("\\s"); for (int x=0; x<result.length; x++) { if (result[x].length() > _len) { list.addAll(splitEqually(result[x], _len)); } else if (result[x].length() < _len) { StringBuilder sb = new StringBuilder(); x = strAppender(result, sb, x, _len); list.add(sb.toString()); } else { list.add(result[x]); } } return list; } /** * Internally used by smartStringSplit to recombine the string until the expected length is reached. * * @param _text string array to process * @param _sbResult resulting line * @param _beginIdx start index of string array * @param _len line length * @return last position in string array or -1 if _text or _sbResult is null */ private static int strAppender(String[] _text, StringBuilder _sbResult, int _beginIdx, int _len) { if (_text == null || _sbResult == null) { return -1; } if (_beginIdx > _text.length) { return _text.length; } int i = _beginIdx; for (i = _beginIdx; i < _text.length; i++) { // current token length + current buffer length if (_sbResult.length() < _len) { int condition = _text[i].length() + _sbResult.length(); boolean firstOrLastToken = true; if (i <= _text.length -1 && _sbResult.length() > 0) { // add one char (for trailing space) if result is not empty and we are not on the first token condition += 1; // + 1 (for space) firstOrLastToken = false; } if (condition <= _len) { if (!firstOrLastToken) { // append a space if result is not empty and we are not on the first token _sbResult.append(" "); } _sbResult.append(_text[i]); } else { i-=1; break; } } else { if (i > _beginIdx) { i-=1; } break; } } return i; } /** * Splits a Text to equal parts. * There is no detection of words, everything will be cut to the same length. * * @param _text text to split * @param _len max length per line * @return list of string splitted to _len or null if _text was null */ public static List<String> splitEqually(String _text, int _len) { if (_text == null) { return null; } List<String> ret = new ArrayList<>((_text.length() + _len - 1) / _len); for (int start = 0; start < _text.length(); start += _len) { ret.add(_text.substring(start, Math.min(_text.length(), start + _len))); } return ret; } /** * Replace all placeholders in given string by value of the corresponding key in given Map. * * @param _searchStr search string * @param _replacements replacement * @return String or null if _searchStr was null */ public static String replaceByMap(String _searchStr, Map<String, String> _replacements) { if (_searchStr == null) { return null; } if (_replacements == null || _replacements.isEmpty()) { return _searchStr; } String str = _searchStr; for (Entry<String, String> entry : _replacements.entrySet()) { str = str.replace(entry.getKey(), entry.getValue()); } return str; } /** * Lower case the first letter of the given string. * * @param _str string * @return lowercased string */ public static String lowerCaseFirstChar(String _str) { if (_str == null) { return null; } if (_str.isEmpty()) { return _str; } return _str.substring(0, 1).toLowerCase() + _str.substring(1); } /** * Upper case the first letter of the given string. * * @param _str string * @return uppercased string */ public static String upperCaseFirstChar(String _str) { if (_str == null) { return null; } if (_str.isEmpty()) { return _str; } return _str.substring(0, 1).toUpperCase() + _str.substring(1); } /** * Simple rot13 implementation. * * @param _input input to scramble * @return scrambled input (null if input was null) */ public static String rot13(String _input) { if (_input == null) { return null; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < _input.length(); i++) { char c = _input.charAt(i); if (c >= 'a' && c <= 'm') { c += 13; } else if (c >= 'A' && c <= 'M') { c += 13; } else if (c >= 'n' && c <= 'z') { c -= 13; } else if (c >= 'N' && c <= 'Z') { c -= 13; } sb.append(c); } return sb.toString(); } /** * Checks if any of the given strings in _compare is equal to _str (case-insensitive).<br> * Will return true if both parameters are null or _str is null and _compare is empty. * * @param _str string to check * @param _compare compare strings * @return true if equal false otherwise */ public static boolean equalsIgnoreCaseAny(String _str, String... _compare) { return equalsAny(true, _str, _compare); } /** * Checks if any of the given strings in _compare is equal to _str (case-sensitive).<br> * Will return true if both parameters are null or _str is null and _compare is empty. * * @param _str string to check * @param _compare compare strings * @return true if equal false otherwise */ public static boolean equalsAny(String _str, String... _compare) { return equalsAny(false, _str, _compare); } /** * Checks if any of the given strings in _compare is equal to _str (either case-insensitive or case-sensitive).<br> * Will return true if both parameters are null or _str is null and _compare is empty. * * @param _ignoreCase ignore case * @param _str string to check * @param _compare compare strings * @return true if equal false otherwise */ public static boolean equalsAny(boolean _ignoreCase, String _str, String... _compare) { if (_str == null && _compare == null || _compare.length == 0) { return true; } else if (_str == null) { return false; } for (String cmp : _compare) { if (_ignoreCase) { if (cmp.equalsIgnoreCase(_str)) { return true; } } else { if (cmp.equals(_str)) { return true; } } } return false; } /** * Checks if the given String is either null or blank. * Blank means:<br> * <pre> * " " - true * "" - true * null - true * " xx" - false * </pre> * @param _str string to test * @return true if string is blank or null, false otherwise */ public static boolean isBlank(CharSequence _str) { if (_str == null || _str.length() == 0) { return true; } return IntStream.range(0, _str.length()).allMatch(i -> Character.isWhitespace(_str.charAt(i))); } /** * Checks if the given String is either null or empty. * Blank means:<br> * <pre> * " " - false * "" - true * null - true * " xx" - false * </pre> * @param _str string to test * @return true if string is empty or null, false otherwise */ public static boolean isEmpty(CharSequence _str) { return _str == null || _str.length() == 0; } /** * Checks if given String is blank (see {@link #isBlank(String)}.<br> * If String is blank, the given default is returned, otherwise the String is returned. * @param _str string to check * @param _default default in case of blank string * @return _str or _default */ public static String defaultIfBlank(String _str, String _default) { return isBlank(_str) ? _default : _str; } /** * Generate a simple (cryptographic insecure) random string. * @param _length length of random string * @return random string or empty string if _length &lt;= 0 */ public static String randomString(int _length) { if (_length <= 0) { return ""; } Random random = new Random(); char[] buf = new char[_length]; for (int idx = 0; idx < buf.length; ++idx) buf[idx] = SYMBOLS[random.nextInt(SYMBOLS.length)]; return new String(buf); } /** * Removes trailing and leading spaces / non-printable characters (char &lt;= 32). * * @param _str String to trim * @return trimmed string or {@code null} if null input */ public static String trim(String _str) { return _str == null ? null : _str.trim(); } /** * Combines the Strings in _string using _delimiter. * @param _delimiter delimiting string * @param _strings strings to join * @return null if _strings is null, concatenated string otherwise */ public static String join(String _delimiter, List<String> _strings) { if (_strings == null) { return null; } if (_delimiter == null) { _delimiter = ""; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < _strings.size(); i++) { sb.append(_strings.get(i)); if (i < _strings.size() - 1) { // only append delimiter if this is not the last token sb.append(_delimiter); } } return sb.toString(); } /** * Combines the Strings in _string using _delimiter. * @param _delimiter delimiting string * @param _strings string to join * @return null if _strings is null, concatenated string otherwise */ public static String join(String _delimiter, String[] _strings) { return join(_delimiter, Arrays.asList(_strings)); } /** * Converts a camel-case string to an upper-case string * where each upper-case character except the first in * the input string is preceded by an underscore in the * output string. * Empty or null strings are returned as-is. * <pre> * convertCamelToUpperCase(null) = null * convertCamelToUpperCase("") = "" * convertCamelToUpperCase(" ") = " " * convertCamelToUpperCase("Hello") = "HELLO" * convertCamelToUpperCase("HELLO") = "HELLO" * convertCamelToUpperCase("AcmeCompany") = "ACME_COMPANY" * </pre> * @param _str camel-case string * @return upper-case string */ public static String convertCamelToUpperCase(String _str) { if (isEmpty(_str) || isAllUpperCase(_str)) { return _str; } StringBuffer sb = new StringBuffer(String.valueOf(_str.charAt(0)).toUpperCase()); for (int i = 1; i < _str.length(); i++) { char c = _str.charAt(i); if (c >= 'A' && c <= 'Z') { sb.append('_'); } sb.append(c); } return sb.toString().toUpperCase(); } /** * Tries to convert upper-case string to camel-case. * The given string will be analyzed and all string parts preceded by an underline character will be * converted to upper-case, all other following characters to lower-case. * @param _str string to convert * @return converted string or original string if there was nothing to do */ public static String convertUpperToCamelCase(String _str) { if (_str == null || isBlank(_str)) { return _str; } else if (!_str.contains("_")) { return (_str.charAt(0) + "").toUpperCase() + _str.substring(1); } StringBuffer sb = new StringBuffer(String.valueOf(_str.charAt(0)).toUpperCase()); for (int i = 1; i < _str.length(); i++) { char c = _str.charAt(i); if (c == '_') { i++; // get next character and convert to upper case c = String.valueOf(_str.charAt(i)).toUpperCase().charAt(0); } else { c = String.valueOf(c).toLowerCase().charAt(0); } sb.append(c); } return sb.toString(); } /** * Checks if the given String is in all upper-case. * @param _str string to check * @return true if upper-case, false otherwise. Also false if string is null or empty. */ public static boolean isAllUpperCase(String _str) { return isEmpty(_str) || !_str.matches(".*[a-z].*"); } /** * Checks if any of the given strings in _args is contained in _str, case-insensitve. * @param _str string to check * @param _args patterns to find * @return true if any string in _args is found in _str, false if not or _str/_args is null */ public static boolean containsAnyIgnoreCase(String _str, String... _args) { return containsAny(true, _str, _args); } /** * Checks if any of the given strings in _args is contained in _str, case-sensitive. * * @param _str string to check * @param _args patterns to find * @return true if any string in _args is found in _str, false if not or _str/_args is null */ public static boolean containsAny(String _str, String... _args) { return containsAny(false, _str, _args); } /** * Checks if any of the given strings in _args is contained in _str. * @param _ignoreCase true to ignore case, false to be case sensitive * @param _str string to check * @param _args patterns to find * @return true if any string in _args is found in _str, false if not or _str/_args is null */ public static boolean containsAny(boolean _ignoreCase, String _str, String... _args) { if (_str == null || _args == null || _args.length == 0) { return false; } String heystack = _str; if (_ignoreCase) { heystack = _str.toLowerCase(); } for (String s : _args) { String needle = _ignoreCase ? s.toLowerCase() : s; if (heystack.contains(needle)) { return true; } } return false; } /** * Checks if given string in _str ends with any of the given strings in _args. * @param _ignoreCase true to ignore case, false to be case sensitive * @param _str string to check * @param _args patterns to find * @return true if given string in _str ends with any of the given strings in _args, false if not or _str/_args is null */ public static boolean endsWithAny(boolean _ignoreCase, String _str, String... _args) { if (_str == null || _args == null || _args.length == 0) { return false; } String heystack = _str; if (_ignoreCase) { heystack = _str.toLowerCase(); } for (String s : _args) { String needle = _ignoreCase ? s.toLowerCase() : s; if (heystack.endsWith(needle)) { return true; } } return false; } /** * Checks if given string in _str starts with any of the given strings in _args. * @param _ignoreCase true to ignore case, false to be case sensitive * @param _str string to check * @param _args patterns to find * @return true if given string in _str starts with any of the given strings in _args, false if not or _str/_args is null */ public static boolean startsWithAny(boolean _ignoreCase, String _str, String... _args) { if (_str == null || _args == null || _args.length == 0) { return false; } String heystack = _str; if (_ignoreCase) { heystack = _str.toLowerCase(); } for (String s : _args) { String needle = _ignoreCase ? s.toLowerCase() : s; if (heystack.startsWith(needle)) { return true; } } return false; } /** * Repeats the given string pattern for the given times. * @param _str string to repeat * @param _count number of repetitions * @return repeated string or null if pattern was null or count was &lt;= 0 */ public static String repeat(String _str, int _count) { if (_str == null || _count <= 0) { return null; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < _count; i++) { sb.append(_str); } return sb.toString(); } /** * Right-pads a string with spaces (' ').<br> * The String is padded to the size of {@code _size}. * * <pre> * StringUtil.rightPad(null, *) = null * StringUtil.rightPad("", 3) = " " * StringUtil.rightPad("bat", 3) = "bat" * StringUtil.rightPad("bat", 5) = "bat " * StringUtil.rightPad("bat", 1) = "bat" * StringUtil.rightPad("bat", -1) = "bat" * </pre> * * @param _str the String to pad out, may be null * @param _size the size to pad to * @param _padChar the padding character * @return right-padded String or original String if no padding is necessary */ public static String rightPad(String _str, int _size, String _padChar) { if (_str == null) { return null; } int pads = _size - _str.length(); if (pads <= 0) { return _str; } return _str.concat(repeat(_padChar, pads)); } /** * Split a String by the given delimiting char. * @param _str string to split * @param _separatorChar delimiting char to use * @return null if _str is null, array (maybe empty) otherwise */ public static String[] split(String _str, char _separatorChar) { return split(_str, Character.toString(_separatorChar)); } /** * Split a String by the given delimiting char. * @param _str string to split * @param _separatorStr delimiting String to use * @return null if _str is null, array (maybe empty) otherwise */ public static String[] split(String _str, String _separatorStr) { if (_str == null) { return null; } List<String> list = splitToList(_str, _separatorStr); return list.toArray(new String[list.size()]); } /** * Split string by whitespace. * @param _str string to split * @return null if _str is null, array (maybe empty) otherwise */ public static String[] split(String _str) { return split(_str, ' '); } /** * Split given String using given delimiting char. * * @param _str string to split * @param _separatorChar char to use as delimiter * @return list of String tokens, null if _str is null or empty list */ public static List<String> splitToList(String _str, char _separatorChar) { return splitToList(_str, Character.toString(_separatorChar)); } /** * Split given String using the given delimiting string. * * @param _str string to split * @param _separatorStr string to us as delimiter * @return list of String tokens, null if _str is null or empty list */ public static List<String> splitToList(String _str, String _separatorStr) { if (_str == null) { return null; } List<String> list = new ArrayList<>(); StringTokenizer st = new StringTokenizer(_str, _separatorStr); while (st.hasMoreTokens()) { list.add(st.nextToken()); } return list; } /** * Mask the given string with the given pattern starting at given start and ending on given end of string. * <br> * If _str is null or _maskStr is null or empty, null is returned.<br> * <br> * If _maskBgn is lower than 0 or _maskLength is lower than 0 * or _maskRpt minus _maskBgn is lower than 0, null is returned.<br> * <br> * If _maskBgn is bigger than the length of _str, the original String is returned.<br> * If _maskRpt is bigger than the length of _str, length of _str is used.<br> * * @param _str string to mask * @param _maskStr mask to use * @param _maskBgn offset to start at (0 based, inclusive) * @param _maskRpt repetitions of _maskStr * * @return masked String or null */ public static String mask(String _str, String _maskStr, int _maskBgn, int _maskRpt) { if (_str == null || _maskStr == null || _maskStr.isEmpty()) { return null; } if (_maskBgn < 0 || _maskRpt <= 0 || _maskRpt - _maskBgn < 0) { return _str; } if (_maskBgn > _str.length()) { return _str; } StringBuilder sb = new StringBuilder(); int maskCnt = 0; for (int i = 0; i < _str.length(); i++) { if (i < _maskBgn) { sb.append(_str.charAt(i)); continue; } if (maskCnt < _maskRpt) { sb.append(_maskStr); maskCnt++; } else { sb.append(_str.charAt(i)); } } return sb.toString(); } /** * Converts a snake-case-string to camel case string. * <br> * Eg. this_is_snake_case &rarr; thisIsSnakeCase * @param _input string * @return camel case string or input if nothing todo. Returns null if input was null. */ public static String snakeToCamelCase(String _input) { if (isBlank(_input)) { return _input; } Pattern compile = Pattern.compile("_[a-zA-Z]"); Matcher matcher = compile.matcher(_input); String result = _input; while (matcher.find()) { String match = matcher.group(); String replacement = match.replace("_", ""); replacement = replacement.toUpperCase(); result = result.replaceFirst(match, replacement); } return result; } /** * Concats all strings using the separator as delimiter. * Will exclude all null values and optionally ignore empty values. * * @param _ignoreEmpty true to ignore empty strings * @param _separator separator to add between each string * @param _parts parts to concat * * @return concatinated string, null if input is null */ public static String concatStrings(boolean _ignoreEmpty, String _separator, String... _parts) { if (_parts == null) { return null; } StringBuilder allParts = new StringBuilder(); for (int i = 0; i < _parts.length; i++) { if (_parts[i] == null) { continue; } if (_ignoreEmpty && _parts[i].isEmpty()) { continue; } allParts.append(_parts[i]); if (!_parts[i].endsWith(_separator)) { allParts.append(_separator); } } if (allParts.toString().isEmpty()) { return ""; } return allParts.toString().substring(0, allParts.lastIndexOf(_separator)); } /** * Checks that the specified string is not {@code blank}. * This method is designed primarily for doing parameter validation in methods * and constructors. * * @param _str the sequence to check for blankness * @param _message exception message if check fails * @return {@code _str} if not {@code blank} * @throws IllegalArgumentException if {@code _str} is {@code blank} */ public static <T extends CharSequence> T requireNonBlank(T _str, String _message) { if (isBlank(_str)) { throw new IllegalArgumentException(_message); } return _str; } public static <T extends CharSequence> T requireNonBlank(T _str) { return requireNonBlank(_str, "String may not be blank"); } /** * Checks that the specified string is not {@code empty}. * This method is designed primarily for doing parameter validation in methods * and constructors. * * @param _str the sequence to check for emptiness * @param _message exception message if check fails * @return {@code _str} if not {@code empty} * @throws IllegalArgumentException if {@code _str} is {@code empty} */ public static <T extends CharSequence> T requireNonEmpty(T _str, String _message) { if (isEmpty(_str)) { throw new IllegalArgumentException(_message); } return _str; } public static <T extends CharSequence> T requireNonEmpty(T _str) { return requireNonEmpty(_str, "String may not be empty"); } }
[ "maniac@case-of.org" ]
maniac@case-of.org
b95d1e1bb09c5b988fc74eb26ff6fc07e5a11677
eea72f74da07136361571dfde78a93fd93d3da41
/init/src/main/java/com/fld/framework/entity/BiDoubleEntry.java
ca165904cfac0c3ee0c149d35d5f62d263a56879
[]
no_license
bangbangbangbang/pr_init
ba730f9a2c30c9da2128cb8504068af40b98941e
a63a0ef6a4f52a23803ad545250400a0fb076f57
refs/heads/master
2020-05-04T07:57:46.477898
2019-04-02T08:56:49
2019-04-02T08:56:49
179,037,853
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.fld.framework.entity; public class BiDoubleEntry extends Entry<Double, Double> { private static final long serialVersionUID = 1L; public BiDoubleEntry() { } public BiDoubleEntry(Double code, Double msg) { this.code = code; this.msg = msg; } }
[ "15538521119@163.com" ]
15538521119@163.com
35d24c16d49da5cfa39aa4c0b0742562fca24c1a
fb5e3512dd9ed67274aeddd090982692a328ea5b
/experiencemanager-google-translate/bundle/src/main/java/com/adobe/translation/google/impl/TranslationServiceImpl.java
c400f302db69b9ae2280d521d49e5c0269656652
[ "Apache-2.0" ]
permissive
Adobe-Marketing-Cloud/experiencemanager-workflow-samples
118dce388e79206b726e005da8861444dba069b0
7d44143abadd295f2a0d5d337f2fdff95fff0155
refs/heads/master
2023-03-06T23:02:23.134711
2013-09-16T13:56:06
2013-09-16T13:56:06
12,299,824
6
11
Apache-2.0
2023-03-01T16:12:07
2013-08-22T14:59:53
Java
UTF-8
Java
false
false
4,471
java
/* * Copyright 2013 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.adobe.translation.google.impl; import java.io.IOException; import java.util.LinkedList; import java.util.List; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpConnectionManager; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Service; import org.apache.sling.commons.json.JSONArray; import org.apache.sling.commons.json.JSONException; import org.apache.sling.commons.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.adobe.translation.google.TranslationService; import com.adobe.translation.google.Translator; /** * <code>TranslatorServiceImpl</code>... */ @Component() @Service(value = TranslationService.class) public class TranslationServiceImpl implements TranslationService { /** * default logger */ private static final Logger log = LoggerFactory.getLogger(TranslationServiceImpl.class); private static final String GOOGLE_API_V2_URI = "https://www.googleapis.com/language/translate/v2"; private HttpClient httpClient; private MultiThreadedHttpConnectionManager cxMgr; // TODO: make configurable private final String key = "AIzaSyD726A86aO5bgu2W6Z8YJ603Xaf6dz5Xr8"; @Activate protected void activate() { cxMgr = new MultiThreadedHttpConnectionManager(); httpClient = new HttpClient(cxMgr); } @Deactivate protected void deactivate() { if (cxMgr != null) { cxMgr.shutdown(); cxMgr = null; } httpClient = null; } public Translator getTranslator(String srcLanguage, String dstLanguage) { return new TranslatorImpl(this, srcLanguage, dstLanguage); } public String translate(String text, String src, String dst) { GetMethod get = new GetMethod(GOOGLE_API_V2_URI); List<NameValuePair> query = new LinkedList<NameValuePair>(); query.add(new NameValuePair("key", key)); if (src != null && src.length() > 0) { query.add(new NameValuePair("source", src)); } query.add(new NameValuePair("target", dst)); query.add(new NameValuePair("q", text)); get.setQueryString(query.toArray(new NameValuePair[query.size()])); try { int code = httpClient.executeMethod(get); if (code != 200) { log.error("Unable to translate text. Server responded {}.", code); log.error("Response body: {}", get.getResponseBodyAsString()); } else { // we just concatenate the texts StringBuilder ret = new StringBuilder(); JSONObject json = new JSONObject(get.getResponseBodyAsString()); JSONObject data = json.getJSONObject("data"); JSONArray translations = data.getJSONArray("translations"); for (int i=0; i<translations.length(); i++) { JSONObject translation = translations.getJSONObject(i); ret.append(translation.getString("translatedText")); } return ret.toString(); } } catch (HttpException e) { log.error("Error while translating.", e); } catch (JSONException e) { log.error("Error while translating.", e); } catch (IOException e) { log.error("Error while translating.", e); } finally { get.releaseConnection(); } return ""; } }
[ "mboucher@adobe.com" ]
mboucher@adobe.com
1a597fd81749072e77b20bf342c2316c324ff47a
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-1111/u-11-111-1111-f9953.java
9d66c275e7b5ddcebcf79a1dbdd3dcd238a59d2f
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 2231394392000
[ "jenkins@khan.paloaltonetworks.local" ]
jenkins@khan.paloaltonetworks.local
580436d40bba6272481479b0af6bcb4652006b78
f11f33feac255ab0cb9887c06dfd0c741066631b
/StableMatching/src/Main.java
152b0741fb65c921314cbef11127e4da6ad3cefe
[]
no_license
nionanov/INF421
66c9e419327dc418f6ce959f99de9244da829318
a57d8f8f6d61997b9e4c1f3e4ed7cbba50e67728
refs/heads/master
2021-01-22T09:41:38.289132
2016-12-10T14:20:56
2016-12-10T14:20:56
76,078,507
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
public class Main { public static void main (String[] args) { // The random seed must be fixed, so that the tests are the same for everyone // and are reproducible. new StableMatchingTest ( new StableMatching (), System.out, new java.util.Random (0L) ).test(); } }
[ "nikolayionanov@yahoo.com" ]
nikolayionanov@yahoo.com
5b534008d1f836f44f97e8e0d115a8f057bf7333
0b610540510885a0ee0e983722472f13214c2ed7
/Observer/DisplayElement.java
b2ac30bb350452ae2b1b8c64fa17979f0691855c
[]
no_license
Sergey531/Patterns
c6cbaec3f5a2b34e72c9f7f61097ad5b7a5c87f3
f9eb2110fceafd28e30b1d2abaa18f7afcd42ded
refs/heads/main
2023-09-03T17:04:25.007364
2021-10-30T08:07:38
2021-10-30T08:07:38
422,821,170
0
0
null
null
null
null
UTF-8
Java
false
false
87
java
package Observer; public interface DisplayElement { public void display(); }
[ "noreply@github.com" ]
Sergey531.noreply@github.com
331d12f3bc54febe47f34997b91cc10ad44125ee
e86c66596ee477bcecb190a76ca78bf07fef377e
/src/Stringpgm.java
64bd15c29035b40decc836cb2ee0a64323d843dc
[]
no_license
tiju46/Java-Projects-Code
255eb1c9a00b026c0cad919030f6d9b68cf5716c
a2f77e081b51e923ddeccaa6dce559a5f623a6d5
refs/heads/main
2023-07-10T15:11:28.460376
2021-08-21T12:47:15
2021-08-21T12:47:15
398,555,606
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
public class Stringpgm { static String name = "tiju"; private static char index1; private static char befoeIndex; public static void stringCheck(){ index1 = name.charAt(3); befoeIndex = (char) name.codePointBefore(3); System.out.println(index1); int ctr = name.codePointCount(1, 3); System.out.println(befoeIndex); System.out.println(ctr); } public static void main(String[] args) { stringCheck(); } }
[ "addauser@Abduls-MacBook-Air-2.local" ]
addauser@Abduls-MacBook-Air-2.local
48a4b4ae91ffc4396418d7e4a33b9960b0a591ad
5cb91546166decf58413dbe68178620ad08e38de
/src/main/java/com/myszor/msscbreweryclient/web/config/BlockingRestTemplateCustomizer.java
929fb62ea16adbe814334ba3d4db577dde46aa47
[]
no_license
Maxomys/mssc-brewery-client
b6663de197ebbf9a2e751d72deaf419f840f0abe
598d5b13dfd46be9914680ec9c7755f2e3eceb55
refs/heads/master
2023-01-07T05:25:47.201469
2020-11-09T23:31:06
2020-11-09T23:31:06
310,181,756
0
0
null
null
null
null
UTF-8
Java
false
false
2,236
java
package com.myszor.msscbreweryclient.web.config; import org.apache.http.client.config.RequestConfig; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.client.RestTemplateCustomizer; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @Component public class BlockingRestTemplateCustomizer implements RestTemplateCustomizer { @Value("${sfg.brewery.maxTotalConnections}") private Integer maxTotalConnections; @Value("${sfg.brewery.maxConnectionsPerRoute}") private Integer maxConnectionsPerRoute; @Value("${sfg.brewery.connectionRequestTimeout}") private Integer connectionRequestTimeout; @Value("${sfg.brewery.socketTimeout}") private Integer socketTimeout; public ClientHttpRequestFactory clientHttpRequestFactory() { PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); connectionManager.setMaxTotal(maxTotalConnections); connectionManager.setDefaultMaxPerRoute(maxConnectionsPerRoute); RequestConfig requestConfig = RequestConfig .custom() .setConnectionRequestTimeout(connectionRequestTimeout) .setSocketTimeout(socketTimeout) .build(); CloseableHttpClient httpClient = HttpClients .custom() .setConnectionManager(connectionManager) .setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy()) .setDefaultRequestConfig(requestConfig) .build(); return new HttpComponentsClientHttpRequestFactory(httpClient); } @Override public void customize(RestTemplate restTemplate) { restTemplate.setRequestFactory(this.clientHttpRequestFactory()); } }
[ "mistrz7losos@live.com" ]
mistrz7losos@live.com
b282553239bddfa8a7048974050a2a9f6b7af7bb
fd779e2290b9bdea3230fd299101ced4885c5e09
/app/src/main/java/pexzu/unitech_test_application/utilitty/AsyncHttpClient.java
cfbfe3dd6e654fa41d8ba52d816cd0eab0e1a8b6
[]
no_license
pexzu/Unitech_test_application
691063fe3c39ed3d8e2be545722adddf46e295d0
4d972b636686053c234ea74e7504833930124d57
refs/heads/master
2021-01-23T02:19:23.532081
2017-03-24T00:27:04
2017-03-24T00:27:04
85,985,400
0
0
null
null
null
null
UTF-8
Java
false
false
2,463
java
package pexzu.unitech_test_application.utilitty; import android.content.Context; import android.os.AsyncTask; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; /** * Created by Vish on 22/3/2017. */ public class AsyncHttpClient extends AsyncTask<Void,Void,String> { public ResponseData response; private final String urlEndpoint="http://10.1.13.159:9000/"; private String request; private String data; private String type; public AsyncHttpClient(Context context, String request, String data, String type){ response = (ResponseData)context; this.request = request; this.data = data; this.type = type; } @Override protected String doInBackground(Void... params) { HttpClient getClient = new DefaultHttpClient(); HttpPost request = new HttpPost(this.urlEndpoint + this.request); StringEntity se = null; switch (this.type) { case "json": try { se = new StringEntity(data); request.setEntity(se); request.setHeader("Accept", "application/json"); request.setHeader("Content-Type","application/json"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } String json = null; HttpResponse response; try { response = getClient.execute(request); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8")); json = reader.readLine(); //Log.d("HttpTry",json); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return json; } @Override protected void onPostExecute(String s) { response.processRequest(s); super.onPostExecute(s); } }
[ "100053761" ]
100053761
c103fdcec637c3a46369ebb053ebbd270d577fd0
62e9e9cbcdde0a6ef47156e055f791bb90a63f13
/src/main/java/com/fjs/cronus/model/DocumentCategory.java
ec444512b0ab519b2213ae9f2f1fddb36520dc7e
[]
no_license
machihaoyu/cronus
02e23973678042ea67b3dea22cb56ed86f9d96a6
915d6d9ab2bcc3badcb637432a388baaad9ad5c8
refs/heads/master
2020-03-26T08:12:12.567691
2018-08-22T08:57:59
2018-08-22T08:57:59
144,691,019
0
3
null
null
null
null
UTF-8
Java
false
false
1,612
java
package com.fjs.cronus.model; import java.util.Date; public class DocumentCategory extends BaseModel { private Integer id; private Integer documentCParentId; private Boolean documentCLevel; private Boolean documentCLevelId; private String documentCNameHeader; private String documentCName; private Integer sort; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getDocumentCParentId() { return documentCParentId; } public void setDocumentCParentId(Integer documentCParentId) { this.documentCParentId = documentCParentId; } public Boolean getDocumentCLevel() { return documentCLevel; } public void setDocumentCLevel(Boolean documentCLevel) { this.documentCLevel = documentCLevel; } public Boolean getDocumentCLevelId() { return documentCLevelId; } public void setDocumentCLevelId(Boolean documentCLevelId) { this.documentCLevelId = documentCLevelId; } public String getDocumentCNameHeader() { return documentCNameHeader; } public void setDocumentCNameHeader(String documentCNameHeader) { this.documentCNameHeader = documentCNameHeader; } public String getDocumentCName() { return documentCName; } public void setDocumentCName(String documentCName) { this.documentCName = documentCName; } public Integer getSort() { return sort; } public void setSort(Integer sort) { this.sort = sort; } }
[ "zhanglei@fangjinsuo.com" ]
zhanglei@fangjinsuo.com
a0a8ea71bd195d2d2460cc0c62cfedcd103f3553
6f1b6c4d0ff4d0594ae912ed737244cd38be0b86
/src/main/java/pl/sternik/mm/kawiarnia/dekoratory/NapojDekorator.java
ee13ee6a5f52c7e728ef9a3c72dd81d430b02d39
[]
no_license
lovemuffin-git/sternik-kawiarnia
0392cbe44e10bc53c8fe29d914c59bdd32b1e331
6c79c9bd35e028ef39f8cb380e642699de2b66a6
refs/heads/master
2021-09-08T00:32:18.662332
2018-03-04T11:57:49
2018-03-04T11:57:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package pl.sternik.mm.kawiarnia.dekoratory; import pl.sternik.mm.kawiarnia.napoje.Napoj; public abstract class NapojDekorator implements Napoj { private final Napoj napoj; public NapojDekorator(Napoj napoj) { super(); this.napoj = napoj; } public Napoj getNapoj() { return napoj; } }
[ "marta.morawiec@edu.uekat.pl" ]
marta.morawiec@edu.uekat.pl
1699aa72f1cb9a3cc3b85bbdf2a3f9765240b5e6
f4d8542bf52fd0b61adc6c48af4165914b455b50
/information/src/main/java/com/example/information/InformationApplication.java
771ea5056b00279eea38a62823731f69a170bc43
[]
no_license
zjj412550708/timeoninformation
d26ed185b5ef5da05426ebe00a267d4a87adad9f
33469ddc2a204b9530d0080cbe165336bafd0f64
refs/heads/master
2022-12-17T16:18:36.849768
2019-09-02T09:59:49
2019-09-02T09:59:49
205,772,919
0
0
null
2022-12-11T04:05:17
2019-09-02T03:51:26
Java
UTF-8
Java
false
false
326
java
package com.example.information; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class InformationApplication { public static void main(String[] args) { SpringApplication.run(InformationApplication.class, args); } }
[ "15171140326@163.com" ]
15171140326@163.com
289119254927afb9ff36be3c8f258fcbc13c34ee
1d3c582a363e8b8598a7cfaf774e484905c56c04
/src/Main.java
35af114ebfdc859ab9eecc1da7ba01309b96ef58
[]
no_license
Angitae/boj1937
fd152aa8bd5718aede73de551f746e521c250a18
36fa0e904b66e19784485de1fc55fef738ae9a2a
refs/heads/master
2021-09-01T13:06:46.674703
2017-12-27T05:26:37
2017-12-27T05:26:37
115,484,623
0
0
null
null
null
null
UHC
Java
false
false
2,872
java
//import java.util.Scanner; ////import java.util.*; //import java.lang.Math; // //public class Main { // static int map[][]; // map size // static int k; // 최대로 오래 살 날 임시변수 // static int N; // static int dx[] = { 0, 1, 0, -1 }; // static int dy[] = { -1, 0, 1, 0 }; // static int x, y; // static int dix, diy; // static int day;// 생존 날짜 // // // public static void main(String[] args) { // Scanner sc = new Scanner(System.in); // N = sc.nextInt(); // map = new int[N][N]; // for (int i = 0; i < N; i++) { // for (int j = 0; j < N; j++) { // map[i][j] = sc.nextInt(); // } // } // map에 대한 구조 받기 // for (int i = 0; i < N; i++) { // map에 대해 전체 좌표 다 받아서 돌려보기 // for (int j = 0; j < N; j++) { // k = 0; // 변수 값 초기화 // solve(i, j); // 메소드 실현 // day = Math.max(day, k); // 최대값 구하기 // } // } // // solve(0, 0); // 0,0 좌표부터 받아보기 // System.out.println(day); // } // // static void solve(int x, int y) { // k++; // 일단 시작하니까 1증가시켜주고. // // System.out.println(k); // // k = Math.max(1,k); //// System.out.println(k); // for (int ii = 0; ii < 4; ii++) { // dix = x + dx[ii]; // diy = y + dy[ii]; // if (dix >= 0 && diy >= 0 && dix < N && diy < N && map[dix][diy] > map[x][y]) { // // System.out.println(map[dix][diy]); // solve(dix, diy); // } // } // } // //} import java.util.Scanner; //import java.util.*; import java.lang.Math; public class Main { static int map[][]; // map size static int visit[][]; static int k; // 최대로 오래 살 날 임시변수 static int N; static int dx[] = { 0, -1, 0, 1 }; static int dy[] = { -1, 0, 1, 0 }; static int x, y; static int dix, diy; static int day;// 생존 날짜 public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); map = new int[N][N]; visit = new int[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { map[i][j] = sc.nextInt(); } } // map에 대한 구조 받기 for (int i = 0; i < N; i++) { // map에 대해 전체 좌표 다 받아서 돌려보기 for (int j = 0; j < N; j++) { day = Math.max(day, solve(i, j)); } } // solve(0, 0); // 0,0 좌표부터 받아보기 System.out.println(day); } static int solve(int x, int y) { if (visit[x][y] > 0) { return visit[x][y]; } visit[x][y] = 1; for (int ii = 0; ii < 4; ii++) { dix = x + dx[ii]; diy = y + dy[ii]; if (dix >= 0 && diy >= 0 && dix < N && diy < N) { if (map[dix][diy] > map[x][y]) // System.out.println(map[dix][diy]); visit[x][y] = Math.max(visit[x][y], solve(dix, diy) + 1); } } return visit[x][y]; } }
[ "dksrlxo0724@naver.com" ]
dksrlxo0724@naver.com
0cf1fe07f102d1e158987ab91539dd14f5de9ae0
db77908c40c076bb713c1b00fd633457658964a3
/common/ifs-resources/src/test/java/org/innovateuk/ifs/invite/builder/NewUserStagedInviteListResourceBuilderTest.java
38499ca669da0a23b57d56deaf3728eeb0b4ccc6
[ "MIT" ]
permissive
InnovateUKGitHub/innovation-funding-service
e3807613fd3c398931918c6cc773d13874331cdc
964969b6dc9c78750738ef683076558cc897c1c8
refs/heads/development
2023-08-04T04:04:05.501037
2022-11-11T14:48:30
2022-11-11T14:48:30
87,336,871
30
20
MIT
2023-07-19T21:23:46
2017-04-05T17:20:38
Java
UTF-8
Java
false
false
2,589
java
package org.innovateuk.ifs.invite.builder; import org.innovateuk.ifs.invite.resource.NewUserStagedInviteListResource; import org.innovateuk.ifs.invite.resource.NewUserStagedInviteResource; import org.junit.Test; import java.util.List; import static org.innovateuk.ifs.invite.builder.NewUserStagedInviteListResourceBuilder.newNewUserStagedInviteListResource; import static org.innovateuk.ifs.invite.builder.NewUserStagedInviteResourceBuilder.newNewUserStagedInviteResource; import static org.junit.Assert.assertEquals; public class NewUserStagedInviteListResourceBuilderTest { @Test public void buildOne() { long expectedCompetitionId = 3L; long expectedInnovationCategoryId = 5L; List<NewUserStagedInviteResource> expectedInvites = newNewUserStagedInviteResource() .withName("Tester 1", "Tester2") .withEmail("test1@test.com", "test2@test.com") .withCompetitionId(expectedCompetitionId) .withInnovationAreaId(expectedInnovationCategoryId) .build(2); NewUserStagedInviteListResource newUserInviteList = newNewUserStagedInviteListResource() .withInvites(expectedInvites) .build(); assertEquals(2, newUserInviteList.getInvites().size()); assertEquals(expectedInvites.get(0), newUserInviteList.getInvites().get(0)); assertEquals(expectedInvites.get(1), newUserInviteList.getInvites().get(1)); } @Test public void buildMany() { List<NewUserStagedInviteResource> expectedInvites1 = newNewUserStagedInviteResource() .withName("Tester 1", "Tester2") .withEmail("test1@test.com", "test2@test.com") .withCompetitionId(7L, 11L) .withInnovationAreaId(13L, 17L) .build(2); List<NewUserStagedInviteResource> expectedInvites2 = newNewUserStagedInviteResource() .withName("Tester 3", "Tester4") .withEmail("test3@test.com", "test4@test.com") .withCompetitionId(20L, 25L) .withInnovationAreaId(10L, 11L) .build(2); List<NewUserStagedInviteListResource> newUserInviteLists = newNewUserStagedInviteListResource() .withInvites(expectedInvites1, expectedInvites2) .build(2); assertEquals(2, newUserInviteLists.size()); assertEquals(expectedInvites1, newUserInviteLists.get(0).getInvites()); assertEquals(expectedInvites2, newUserInviteLists.get(1).getInvites()); } }
[ "markd@iuk.ukri.org" ]
markd@iuk.ukri.org
552442580e2bae0f12359a9631d4bfaa338313a5
db0921e16640bebf261b188fe45ca3d3bff6631e
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/TapeMeasureLauncher.java
e15aa41290503d552b6edc5cf698870085b80da7
[]
no_license
SCHS-Robotics/LevelUp2019-2020
e8a1360d42c9dd99c49165d3d7ba4cf02de8dae1
21afb4e050f788548888512a34f28295eae8dfa4
refs/heads/master
2020-09-22T06:37:22.874993
2020-03-04T23:50:15
2020-03-04T23:50:15
225,088,761
0
0
null
null
null
null
UTF-8
Java
false
false
1,924
java
package org.firstinspires.ftc.teamcode.subsystems; import com.SCHSRobotics.HAL9001.system.source.BaseRobot.Robot; import com.SCHSRobotics.HAL9001.system.source.BaseRobot.SubSystem; import com.SCHSRobotics.HAL9001.util.annotations.TeleopConfig; import com.SCHSRobotics.HAL9001.util.misc.Button; import com.SCHSRobotics.HAL9001.util.misc.ConfigParam; import com.SCHSRobotics.HAL9001.util.misc.CustomizableGamepad; import com.qualcomm.robotcore.hardware.CRServo; import org.jetbrains.annotations.NotNull; public class TapeMeasureLauncher extends SubSystem { private CRServo crServo; private double power; private CustomizableGamepad gamepad; public TapeMeasureLauncher(@NotNull Robot robot, String LaunchServoConfig) { super(robot); crServo = robot.hardwareMap.crservo.get(LaunchServoConfig); gamepad = new CustomizableGamepad(robot); usesConfig = true; } @Override public void init() { } @Override public void init_loop() { } @Override public void start() { if (usesConfig) { gamepad = robot.pullControls(this); } } @Override public void handle() { boolean launchBool = gamepad.getBooleanInput("Launch"); boolean retractBool = gamepad.getBooleanInput("Retract"); double power = (launchBool || retractBool) ? ((launchBool) ? 0.5 : -0.5) : 0; crServo.setPower(power); } public void launch(double power) { crServo.setPower(power); } public void retract(double power) { crServo.setPower(-power); } @Override public void stop() { } @TeleopConfig public static ConfigParam[] teleopConfig() { return new ConfigParam[] { new ConfigParam("Launch", Button.BooleanInputs.dpad_right), new ConfigParam("Retract", Button.BooleanInputs.dpad_left), }; } }
[ "colesavage02@gmail.com" ]
colesavage02@gmail.com
730b60cd002922225b4362ee5d03511f54ea6c05
fd2ceb7ce1c27d68881c395fa599a1a3506b9e70
/10mybatis/src/main/java/tw/elliot/ms/mybatis/typehandler/DgtSportListHandler.java
0757fc8e5ae719a4d2ae6a7f5f5f0259efdff2ff
[]
no_license
ElliotChen/spring_boot_example
f7a5118df60608058c889c828aa1b423e9a3b5d3
ac4ad02a02c103e54f0277f204ea19975e32e7b0
refs/heads/master
2023-02-20T03:39:20.685123
2023-02-13T03:42:09
2023-02-13T03:42:09
83,627,197
1
4
null
2022-06-20T23:29:30
2017-03-02T02:55:25
JavaScript
UTF-8
Java
false
false
306
java
package tw.elliot.ms.mybatis.typehandler; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedJdbcTypes; import org.apache.ibatis.type.MappedTypes; import tw.elliot.ms.domain.dgt.Sport; import java.util.List; public class DgtSportListHandler extends DomainListHandler<Sport> { }
[ "elliot@esport-tech.com" ]
elliot@esport-tech.com
9caa96a829b580bea5b706e98e0bcf0cef29dc47
8d8a28e26d9c6d0dfc1551169e84aec9b5d9d476
/src/main/java/com/example/demo/test/AutowireTest.java
aacacc3ad7749bfd1c251b0db26c6c52b6c0edfb
[]
no_license
saifullah007/CustomEnableAnotation
f4bd74e97da5796b0b24664239c5ab7c30bf248f
f78a69362552ae71d3cf6cb2f25942d3f3c75c44
refs/heads/master
2021-09-02T16:25:18.608725
2018-01-03T16:15:12
2018-01-03T16:15:12
116,154,826
0
0
null
null
null
null
UTF-8
Java
false
false
479
java
package com.example.demo.test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; /** * @Author saifullah on 3/1/18. */ @Component public class AutowireTest { @Autowired private String aBean1; @Autowired private String aBean2; @PostConstruct private void postConstruct(){ System.out.println(">>>>>>> "+aBean1+" <<<<<<< "+aBean2); } }
[ "=" ]
=
78b19eb0f097ab2fe8f259556164c87ed8730555
60a8c046881707ff4aac5a19fb2a0cee8fcbf5ae
/LearnJava_WeekendAfternoon_Selenium_NY_Fall20201/src/LearnEscapeSequences.java
bd83bdafaf6eb1138d1f1003f79bea642f760ef5
[]
no_license
mamiar1989/EclipseWorkFlow
bbf60a6c07b3433c8438f7976ced5c4d216d7b36
3546cb77637c1bd0c512900e42202d7e06962ae6
refs/heads/main
2023-02-21T08:37:27.027539
2021-01-22T14:31:44
2021-01-22T14:31:44
331,967,708
0
0
null
null
null
null
UTF-8
Java
false
false
909
java
public class LearnEscapeSequences { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("this is an \t engeneering calss"); // insert a tab in the text at this point System.out.println("this is an \b engeneering calss"); // /b insert a backspace in the text at this point delete one caracter. not working on eclipse System.out.println("this is an \n engeneering calss"); // /n goes to next line System.out.println("this is an \r engeneering calss");// /r System.out.println("this is an \f engeneering calss");// /f System.out.println("this is an \' engeneering\' calss");// /' to print the word inside single quote System.out.println("this is an \" engeneering\" calss");// /" to print the word inside double quote quote System.out.println("this is an engeneering \\ calss");// \\ print double slash character } }
[ "mariaamiar89@gmail.com" ]
mariaamiar89@gmail.com
d35683c68423e1a69b42ac2d780535f1cc7fee47
e7838536e710397b5c10b2f1492fbf3490be38f3
/app/src/main/java/com/mmrx/gymstopwatch/ui/MainActivity.java
0487e7a5f07015323cfd86f04dcf3a51887245ca
[]
no_license
liulinru13/GymStopWatch
cf137b4277544732a36fa70b6952bfaedc6abbff
ec3132d39a5d21cabb8971247b867743ebe53100
refs/heads/master
2020-04-11T15:44:06.110996
2019-02-20T13:54:28
2019-02-20T13:54:28
161,901,183
1
2
null
null
null
null
UTF-8
Java
false
false
6,174
java
package com.mmrx.gymstopwatch.ui; import android.os.PowerManager; import android.os.SystemClock; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import com.mmrx.gymstopwatch.listener.OnDoubleClickListener; import com.mmrx.gymstopwatch.R; import com.mmrx.gymstopwatch.data.stopwatch.DataModel; import com.mmrx.gymstopwatch.data.stopwatch.Stopwatch; import com.mmrx.gymstopwatch.ui.component.StopwatchCircleView; import com.mmrx.gymstopwatch.timer.CountingTimerView; import static android.os.PowerManager.ON_AFTER_RELEASE; import static android.os.PowerManager.SCREEN_BRIGHT_WAKE_LOCK; public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); /** Displays the current stopwatch time. */ private CountingTimerView mTimeText; /** Draws the reference lap while the stopwatch is running. */ private StopwatchCircleView mTime; /** * Scheduled to update the stopwatch time and current lap time while * stopwatch is running. */ private final Runnable mTimeUpdateRunnable = new TimeUpdateRunnable(); /** * Held while the stopwatch is running and this fragment is forward to keep * the screen on. */ private PowerManager.WakeLock mWakeLock; private View mContainer; private boolean isStart = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); initValue(); initListener(); } private void initView() { mTime = findViewById(R.id.stopwatch_time); // Timer text serves as a virtual start/stop button. mTimeText = findViewById(R.id.stopwatch_time_text); mContainer = findViewById(R.id.fl_stopwatch); mContainer.setOnTouchListener(new OnDoubleClickListener(new OnDoubleClickListener.DoubleClickCallback() { @Override public void onDoubleClick() { if(isStart){ doPause(); }else{ doStart(); } isStart = !isStart; } })); } private void initValue() { DataModel.getDataModel().resetStopwatch(); mTimeText.setTime(0, true, true); mTimeText.blinkTimeStr(false); } private void initListener() { } /** * Start the stopwatch. */ public void doStart() { // Update the stopwatch state. DataModel.getDataModel().startStopwatch(); // Start UI updates. startUpdatingTime(); mTime.update(); mTimeText.blinkTimeStr(false); // Acquire the wake lock. acquireWakeLock(); } /** * Pause the stopwatch. */ public void doPause() { // Update the stopwatch state DataModel.getDataModel().pauseStopwatch(); // Redraw the paused stopwatch time. updateTime(); // Stop UI updates. stopUpdatingTime(); mTimeText.blinkTimeStr(true); } /** * Reset the stopwatch. */ public void doReset(View view) { // Update the stopwatch state. DataModel.getDataModel().resetStopwatch(); // Clear the times. mTimeText.setTime(0, true, true); // Release the wake lock. releaseWakeLock(); } /** * Post the first runnable to update times within the UI. It will reschedule * itself as needed. */ private void startUpdatingTime() { // Ensure only one copy of the runnable is ever scheduled by first // stopping updates. stopUpdatingTime(); mTime.post(mTimeUpdateRunnable); } /** * Remove the runnable that updates times within the UI. */ private void stopUpdatingTime() { mTime.removeCallbacks(mTimeUpdateRunnable); } /** * This runnable periodically updates times throughout the UI. It stops * these updates when the stopwatch is no longer running. */ private final class TimeUpdateRunnable implements Runnable { @Override public void run() { Log.d("suhuazhi", "TimeUpdateRunnable"); final long startTime = SystemClock.elapsedRealtime(); updateTime(); if (getStopwatch().isRunning()) { // The stopwatch is still running so execute this runnable again // after a delay. final boolean talkBackOn = true; // Grant longer time between redraws when talk-back is on to let // it catch up. final int period = talkBackOn ? 1 : 25; // Try to maintain a consistent period of time between redraws. final long endTime = SystemClock.elapsedRealtime(); final long delay = Math.max(0, startTime + period - endTime); mTime.postDelayed(this, delay); } } } /** * Update all time displays based on a single snapshot of the stopwatch * progress. This includes the stopwatch time drawn in the circle, the * current lap time and the total elapsed time in the list of laps. */ private void updateTime() { // Compute the total time of the stopwatch. final long totalTime = getStopwatch().getTotalTime(); // Update the total time display. mTimeText.setTime(totalTime, true, true); } private Stopwatch getStopwatch() { return DataModel.getDataModel().getStopwatch(); } private void acquireWakeLock() { if (mWakeLock == null) { final PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); mWakeLock = pm.newWakeLock(SCREEN_BRIGHT_WAKE_LOCK | ON_AFTER_RELEASE, TAG); mWakeLock.setReferenceCounted(false); } mWakeLock.acquire(); } private void releaseWakeLock() { if (mWakeLock != null && mWakeLock.isHeld()) { mWakeLock.release(); } } }
[ "liulinru13@126.com" ]
liulinru13@126.com
0989b6dac90c772e374db733116bd74201100652
612aed6e68a9adaf0a82156a1c0d563f1c78362d
/课堂笔记/java基础部分/2.08.quickHitDemo/src/com/kgc/exam/Main.java
fb820a436a5359433c56dbad23e8b4881dbf0ac7
[]
no_license
bairiyanhua/java_note
24c9a03fe42cc22018c8e540591da1bda281429e
f0e04f63f3f90abefd68adec24fc5486e48fe15e
refs/heads/master
2020-06-01T11:51:33.468532
2019-07-17T09:11:30
2019-07-17T09:11:30
190,768,835
0
0
null
null
null
null
UTF-8
Java
false
false
544
java
package com.kgc.exam; import java.util.Random; public class Main { public static void main(String[] args) { Player player = new Player(); player.play(); /*String aa = "123"; String bb = aa + "456"; System.out.println(bb); StringBuffer sb = new StringBuffer(); sb.append("123"); sb.append("456"); System.out.println(sb.toString()); Math.random(); Random random = new Random(); for (int i = 0; i < 100; i++) { System.out.println(random.nextInt(10)); } */ } }
[ "fangtao04@meituan.com" ]
fangtao04@meituan.com
298ed4897f6dbaced9c2326eb2b884934c51a5dd
df1c9e7d198c41dfb2c1d387ec358880ba1240f7
/src/main/java/by/bsu/zinkovich/generator/impl/LinearCongruentialGenerator.java
b7c786240f33aa0ee12adbdad7dda4f4df4f62f4
[]
no_license
IlyaZinkovich/ismLab2
63cd7958e854607f8b6d5a039b3b8bf2e7da0c9a
a944b09346ffc0019c81c0f0322b6476cffac11d
refs/heads/master
2021-01-10T16:29:52.328582
2016-03-25T10:48:33
2016-03-25T10:48:33
54,208,409
0
0
null
null
null
null
UTF-8
Java
false
false
834
java
package by.bsu.zinkovich.generator.impl; import org.apache.commons.math3.random.AbstractRandomGenerator; public class LinearCongruentialGenerator extends AbstractRandomGenerator { private long multiplier; private long addend; private long mask; private long oldseed; public LinearCongruentialGenerator() { this(0, 17, 3, 2097152); } public LinearCongruentialGenerator(long seed, long multiplier, long addend, long mask) { this.oldseed = seed; this.multiplier = multiplier; this.addend = addend; this.mask = mask; } @Override public void setSeed(long seed) { this.oldseed = seed; } @Override public double nextDouble() { oldseed = (multiplier * oldseed + addend) % mask; return (double)oldseed / mask; } }
[ "Ilya_Zinkovich@epam.com" ]
Ilya_Zinkovich@epam.com
27a6bc3f73dfdd2bfdb663ec41e3e4e5b8469399
200b4b20c66767981292d99b5ffdca00fb693036
/testservice/src/main/java/com/jichuangsi/school/testservice/config/Swagger2.java
9b8dfbe48f3a862aa9af1e83c5996bbc27b789c4
[]
no_license
NaiCha821/school
50182f0b2dd8d0a34fbff6d4d1d65b71c1dcf0d7
b8816b4689f5f6fc8ef82b1a9c2b6628bd7a20f2
refs/heads/p2
2022-07-15T21:24:47.277606
2019-06-06T03:13:24
2019-06-06T03:13:24
189,579,010
0
0
null
2022-06-29T17:24:48
2019-05-31T10:55:19
Java
UTF-8
Java
false
false
1,530
java
/** * */ package com.jichuangsi.school.testservice.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * @author huangjiajun * */ @Configuration @EnableSwagger2 public class Swagger2 { @Value("${com.jichuangsi.school.swagger.enable}") private boolean enableSwagger; // swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等 @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2).enable(enableSwagger).apiInfo(apiInfo()).select() // 为当前包路径 .apis(RequestHandlerSelectors.basePackage("com.jichuangsi.school.testservice.controller")) .paths(PathSelectors.any()).build(); } // 构建 api文档的详细信息函数,注意这里的注解引用的是哪个 private ApiInfo apiInfo() { return new ApiInfoBuilder() // 页面标题 .title("作业服务信息RESTful API") // 版本号 .version("1.0") // 描述 .description("API 描述").build(); } }
[ "school@jichuangsi" ]
school@jichuangsi
36b8e71b5a1108f01d289cb53695c8aa58ae2f76
e92622134baa62a06f65d6875c3d2ae48725c066
/demo3/src/main/java/com/wuyue/pojo/Request.java
09ee534b33c92b22df45ecc8b90b7eb353207985
[]
no_license
lambertss/Zero
933d3d74daf075bd65503f25d0ab98891703bcd8
39815a2ce76b9d24050c85bd0cde4af02cb4680e
refs/heads/master
2020-05-01T02:54:46.061214
2019-03-26T05:50:44
2019-03-26T05:50:44
177,231,575
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.wuyue.pojo; import lombok.Getter; import lombok.Setter; /** * 说明: 请求体包装 */ @Getter @Setter public class Request<T> { /** * 用户token; */ private String token; private Integer page=1; private Integer limit=15; /** * 请求数据; */ private T data; }
[ "774873044@qq.com" ]
774873044@qq.com
444bf20b747d1677a52fb7f8173e7a46d1a3aafb
d2ec57598c338498027c2ecbcbb8af675667596b
/src/myfaces-api-2.1.10-sources/javax/faces/convert/NumberConverter.java
ebeffb1f42564d5a7c3dfa28b0c5891d93e51fc7
[ "Apache-2.0" ]
permissive
JavaQualitasCorpus/myfaces_core-2.1.10
abf6152e3b26d905eff87f27109e9de1585073b5
10c9f2d038dd91c0b4f78ba9ad9ed44b20fb55c3
refs/heads/master
2023-08-12T09:29:23.551395
2020-06-02T18:06:36
2020-06-02T18:06:36
167,005,005
0
0
Apache-2.0
2022-07-01T21:24:07
2019-01-22T14:08:49
Java
UTF-8
Java
false
false
20,680
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 javax.faces.convert; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.ParseException; import java.util.Currency; import java.util.Locale; import javax.el.ValueExpression; import javax.faces.component.PartialStateHolder; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFConverter; import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspProperty; import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty; /** * This tag creates a number formatting converter and associates it * with the nearest parent UIComponent. * * Unless otherwise specified, all attributes accept static values or EL expressions. * * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a> * * @author Thomas Spiegl (latest modification by $Author: lu4242 $) * @version $Revision: 1237538 $ $Date: 2012-01-29 22:43:13 -0500 (Sun, 29 Jan 2012) $ */ @JSFConverter( name="f:convertNumber", bodyContent="empty", tagClass="org.apache.myfaces.taglib.core.ConvertNumberTag") @JSFJspProperty( name="binding", returnType = "javax.faces.convert.NumberConverter", longDesc = "A ValueExpression that evaluates to a NumberConverter.") public class NumberConverter implements Converter, PartialStateHolder { // API FIELDS public static final String CONVERTER_ID = "javax.faces.Number"; public static final String STRING_ID = "javax.faces.converter.STRING"; public static final String CURRENCY_ID = "javax.faces.converter.NumberConverter.CURRENCY"; public static final String NUMBER_ID = "javax.faces.converter.NumberConverter.NUMBER"; public static final String PATTERN_ID = "javax.faces.converter.NumberConverter.PATTERN"; public static final String PERCENT_ID = "javax.faces.converter.NumberConverter.PERCENT"; private static final boolean JAVA_VERSION_14; static { JAVA_VERSION_14 = checkJavaVersion14(); } private String _currencyCode; private String _currencySymbol; private Locale _locale; private int _maxFractionDigits; private int _maxIntegerDigits; private int _minFractionDigits; private int _minIntegerDigits; private String _pattern; private String _type = "number"; private boolean _groupingUsed = true; private boolean _integerOnly = false; private boolean _transient; private boolean _maxFractionDigitsSet; private boolean _maxIntegerDigitsSet; private boolean _minFractionDigitsSet; private boolean _minIntegerDigitsSet; // CONSTRUCTORS public NumberConverter() { } // METHODS public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value) { if (facesContext == null) { throw new NullPointerException("facesContext"); } if (uiComponent == null) { throw new NullPointerException("uiComponent"); } if (value != null) { value = value.trim(); if (value.length() > 0) { NumberFormat format = getNumberFormat(facesContext); format.setParseIntegerOnly(_integerOnly); DecimalFormat df = (DecimalFormat)format; // The best we can do in this case is check if there is a ValueExpression // with a BigDecimal as returning type , and if that so enable BigDecimal parsing // to prevent loss in precision, and do not break existing examples (since // in those cases it is expected to return Double). See MYFACES-1890 and TRINIDAD-1124 // for details ValueExpression valueBinding = uiComponent.getValueExpression("value"); if (valueBinding != null) { Class<?> destType = valueBinding.getType(facesContext.getELContext()); if (destType != null && BigDecimal.class.isAssignableFrom(destType)) { df.setParseBigDecimal(true); } } DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); boolean changed = false; if(dfs.getGroupingSeparator() == '\u00a0') { dfs.setGroupingSeparator(' '); df.setDecimalFormatSymbols(dfs); changed = true; } formatCurrency(format); try { return format.parse(value); } catch (ParseException e) { if(changed) { dfs.setGroupingSeparator('\u00a0'); df.setDecimalFormatSymbols(dfs); } try { return format.parse(value); } catch (ParseException pe) { if(getPattern() != null) { throw new ConverterException(_MessageUtils.getErrorMessage(facesContext, PATTERN_ID, new Object[]{value, "$###,###", _MessageUtils.getLabel(facesContext, uiComponent)})); } else if(getType().equals("number")) { throw new ConverterException(_MessageUtils.getErrorMessage(facesContext, NUMBER_ID, new Object[]{value, format.format(21), _MessageUtils.getLabel(facesContext, uiComponent)})); } else if(getType().equals("currency")) { throw new ConverterException(_MessageUtils.getErrorMessage(facesContext, CURRENCY_ID, new Object[]{value, format.format(42.25), _MessageUtils.getLabel(facesContext, uiComponent)})); } else if(getType().equals("percent")) { throw new ConverterException(_MessageUtils.getErrorMessage(facesContext, PERCENT_ID, new Object[]{value, format.format(.90), _MessageUtils.getLabel(facesContext, uiComponent)})); } } } } } return null; } public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object value) { if (facesContext == null) { throw new NullPointerException("facesContext"); } if (uiComponent == null) { throw new NullPointerException("uiComponent"); } if (value == null) { return ""; } if (value instanceof String) { return (String)value; } NumberFormat format = getNumberFormat(facesContext); format.setGroupingUsed(_groupingUsed); if (_maxFractionDigitsSet) { format.setMaximumFractionDigits(_maxFractionDigits); } if (_maxIntegerDigitsSet) { format.setMaximumIntegerDigits(_maxIntegerDigits); } if (_minFractionDigitsSet) { format.setMinimumFractionDigits(_minFractionDigits); } if (_minIntegerDigitsSet) { format.setMinimumIntegerDigits(_minIntegerDigits); } formatCurrency(format); try { return format.format(value); } catch (Exception e) { throw new ConverterException(_MessageUtils.getErrorMessage(facesContext, STRING_ID, new Object[]{value,_MessageUtils.getLabel(facesContext, uiComponent)}),e); } } private NumberFormat getNumberFormat(FacesContext facesContext) { Locale locale = _locale != null ? _locale : facesContext.getViewRoot().getLocale(); if (_pattern == null && _type == null) { throw new ConverterException("Cannot get NumberFormat, either type or pattern needed."); } // pattern if (_pattern != null) { return new DecimalFormat(_pattern, new DecimalFormatSymbols(locale)); } // type if (_type.equals("number")) { return NumberFormat.getNumberInstance(locale); } else if (_type.equals("currency")) { return NumberFormat.getCurrencyInstance(locale); } else if (_type.equals("percent")) { return NumberFormat.getPercentInstance(locale); } throw new ConverterException("Cannot get NumberFormat, illegal type " + _type); } private void formatCurrency(NumberFormat format) { if (_currencyCode == null && _currencySymbol == null) { return; } boolean useCurrencyCode; if (JAVA_VERSION_14) { useCurrencyCode = _currencyCode != null; } else { useCurrencyCode = _currencySymbol == null; } if (useCurrencyCode) { // set Currency try { format.setCurrency(Currency.getInstance(_currencyCode)); } catch (Exception e) { throw new ConverterException("Unable to get Currency instance for currencyCode " + _currencyCode); } } else if (format instanceof DecimalFormat) { DecimalFormat dFormat = (DecimalFormat)format; DecimalFormatSymbols symbols = dFormat.getDecimalFormatSymbols(); symbols.setCurrencySymbol(_currencySymbol); dFormat.setDecimalFormatSymbols(symbols); } } // STATE SAVE/RESTORE public void restoreState(FacesContext facesContext, Object state) { if (state != null) { Object values[] = (Object[])state; _currencyCode = (String)values[0]; _currencySymbol = (String)values[1]; _locale = (Locale)values[2]; Integer value = (Integer)values[3]; _maxFractionDigits = value != null ? value.intValue() : 0; value = (Integer)values[4]; _maxIntegerDigits = value != null ? value.intValue() : 0; value = (Integer)values[5]; _minFractionDigits = value != null ? value.intValue() : 0; value = (Integer)values[6]; _minIntegerDigits = value != null ? value.intValue() : 0; _pattern = (String)values[7]; _type = (String)values[8]; _groupingUsed = ((Boolean)values[9]).booleanValue(); _integerOnly = ((Boolean)values[10]).booleanValue(); _maxFractionDigitsSet = ((Boolean)values[11]).booleanValue(); _maxIntegerDigitsSet = ((Boolean)values[12]).booleanValue(); _minFractionDigitsSet = ((Boolean)values[13]).booleanValue(); _minIntegerDigitsSet = ((Boolean)values[14]).booleanValue(); } } public Object saveState(FacesContext facesContext) { if (!initialStateMarked()) { Object values[] = new Object[15]; values[0] = _currencyCode; values[1] = _currencySymbol; values[2] = _locale; values[3] = _maxFractionDigitsSet ? Integer.valueOf(_maxFractionDigits) : null; values[4] = _maxIntegerDigitsSet ? Integer.valueOf(_maxIntegerDigits) : null; values[5] = _minFractionDigitsSet ? Integer.valueOf(_minFractionDigits) : null; values[6] = _minIntegerDigitsSet ? Integer.valueOf(_minIntegerDigits) : null; values[7] = _pattern; values[8] = _type; values[9] = _groupingUsed ? Boolean.TRUE : Boolean.FALSE; values[10] = _integerOnly ? Boolean.TRUE : Boolean.FALSE; values[11] = _maxFractionDigitsSet ? Boolean.TRUE : Boolean.FALSE; values[12] = _maxIntegerDigitsSet ? Boolean.TRUE : Boolean.FALSE; values[13] = _minFractionDigitsSet ? Boolean.TRUE : Boolean.FALSE; values[14] = _minIntegerDigitsSet ? Boolean.TRUE : Boolean.FALSE; return values; } return null; } // GETTER & SETTER /** * ISO 4217 currency code * */ @JSFProperty public String getCurrencyCode() { return _currencyCode != null ? _currencyCode : getDecimalFormatSymbols().getInternationalCurrencySymbol(); } public void setCurrencyCode(String currencyCode) { _currencyCode = currencyCode; clearInitialState(); } /** * The currency symbol used to format a currency value. Defaults * to the currency symbol for locale. * */ @JSFProperty public String getCurrencySymbol() { return _currencySymbol != null ? _currencySymbol : getDecimalFormatSymbols().getCurrencySymbol(); } public void setCurrencySymbol(String currencySymbol) { _currencySymbol = currencySymbol; clearInitialState(); } /** * Specifies whether output will contain grouping separators. Default: true. * */ @JSFProperty(deferredValueType="java.lang.Boolean") public boolean isGroupingUsed() { return _groupingUsed; } public void setGroupingUsed(boolean groupingUsed) { _groupingUsed = groupingUsed; clearInitialState(); } /** * Specifies whether only the integer part of the input will be parsed. Default: false. * */ @JSFProperty(deferredValueType="java.lang.Boolean") public boolean isIntegerOnly() { return _integerOnly; } public void setIntegerOnly(boolean integerOnly) { _integerOnly = integerOnly; clearInitialState(); } /** * The name of the locale to be used, instead of the default as * specified in the faces configuration file. * */ @JSFProperty(deferredValueType="java.lang.Object") public Locale getLocale() { if (_locale != null) { return _locale; } FacesContext context = FacesContext.getCurrentInstance(); return context.getViewRoot().getLocale(); } public void setLocale(Locale locale) { _locale = locale; clearInitialState(); } /** * The maximum number of digits in the fractional portion of the number. * */ @JSFProperty(deferredValueType="java.lang.Integer") public int getMaxFractionDigits() { return _maxFractionDigits; } public void setMaxFractionDigits(int maxFractionDigits) { _maxFractionDigitsSet = true; _maxFractionDigits = maxFractionDigits; clearInitialState(); } /** * The maximum number of digits in the integer portion of the number. * */ @JSFProperty(deferredValueType="java.lang.Integer") public int getMaxIntegerDigits() { return _maxIntegerDigits; } public void setMaxIntegerDigits(int maxIntegerDigits) { _maxIntegerDigitsSet = true; _maxIntegerDigits = maxIntegerDigits; clearInitialState(); } /** * The minimum number of digits in the fractional portion of the number. * */ @JSFProperty(deferredValueType="java.lang.Integer") public int getMinFractionDigits() { return _minFractionDigits; } public void setMinFractionDigits(int minFractionDigits) { _minFractionDigitsSet = true; _minFractionDigits = minFractionDigits; clearInitialState(); } /** * The minimum number of digits in the integer portion of the number. * */ @JSFProperty(deferredValueType="java.lang.Integer") public int getMinIntegerDigits() { return _minIntegerDigits; } public void setMinIntegerDigits(int minIntegerDigits) { _minIntegerDigitsSet = true; _minIntegerDigits = minIntegerDigits; clearInitialState(); } /** * A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat. * */ @JSFProperty public String getPattern() { return _pattern; } public void setPattern(String pattern) { _pattern = pattern; clearInitialState(); } public boolean isTransient() { return _transient; } public void setTransient(boolean aTransient) { _transient = aTransient; } /** * The type of formatting/parsing to be performed. Values include: * number, currency, and percent. Default: number. * */ @JSFProperty public String getType() { return _type; } public void setType(String type) { //TODO: validate type _type = type; clearInitialState(); } private static boolean checkJavaVersion14() { String version = System.getProperty("java.version"); if (version == null) { return false; } byte java14 = 0; for (int idx = version.indexOf('.'), i = 0; idx > 0 || version != null; i++) { if (idx > 0) { byte value = Byte.parseByte(version.substring(0, 1)); version = version.substring(idx + 1, version.length()); idx = version.indexOf('.'); switch (i) { case 0: if (value == 1) { java14 = 1; break; } else if (value > 1) { java14 = 2; } // fallthru case 1: if (java14 > 0 && value >= 4) { java14 = 2; } //; // fallthru default: idx = 0; version = null; break; } } else { byte value = Byte.parseByte(version.substring(0, 1)); if (java14 > 0 && value >= 4) { java14 = 2; } break; } } return java14 == 2; } private DecimalFormatSymbols getDecimalFormatSymbols() { return new DecimalFormatSymbols(getLocale()); } private boolean _initialStateMarked = false; public void clearInitialState() { _initialStateMarked = false; } public boolean initialStateMarked() { return _initialStateMarked; } public void markInitialState() { _initialStateMarked = true; } }
[ "taibi@sonar-scheduler.rd.tut.fi" ]
taibi@sonar-scheduler.rd.tut.fi
2129edceb667f3d7c576b5074e76c5e61ed74269
e4c01c4f36bbf12abfee027a6f6bd468abe83bb4
/JavaPro/src/GenericsWildCardUooerBound.java
00d19cb8e4bbfc39bd74201a210308a71a9b9a8a
[]
no_license
kuldeep1024/Java
8287b162bda47c2804517f41edae0bf1d76f1a6e
b660b49557df2609505ac5ef04f235c12b60053f
refs/heads/master
2021-09-07T07:13:55.190711
2018-02-19T12:14:48
2018-02-19T12:14:48
115,595,955
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
import java.util.ArrayList; import java.util.List; public class GenericsWildCardUooerBound { public static void main(String[] args) { List<? extends Number> list = new ArrayList<>(); //list.add((MyCls)12); //list.add(new Double(12.9)); //list.add(new Object()); list.add(null); } } class MyCls extends Number{ @Override public int intValue() { // TODO Auto-generated method stub return 0; } @Override public long longValue() { // TODO Auto-generated method stub return 0; } @Override public float floatValue() { // TODO Auto-generated method stub return 0; } @Override public double doubleValue() { // TODO Auto-generated method stub return 0; } }
[ "noreply@github.com" ]
kuldeep1024.noreply@github.com
a1a90e97c9076ca8813a0ab844a203ab47b04f43
23611f95ae0282f2f0dd2ff33ab532369a86ac8f
/src/main/java/com/herokuapp/theinternet/TestUtilities.java
22ae86a043d4623e49dd53bbd0ae316cbc3469a3
[]
no_license
anatolikarman/SeleniumUdemy
07d042b29fb6b2aaa08a97ccdb65e07f8d8f93cb
d882d646e0feace3c6da83a7235747454480d11e
refs/heads/master
2023-01-07T02:33:50.075450
2020-11-02T20:07:56
2020-11-02T20:07:56
309,479,716
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.herokuapp.theinternet; import org.testng.annotations.DataProvider; public class TestUtilities extends Basetest { @DataProvider(name = "files") protected static Object[][] files(){ return new Object[][]{ {1, "funny_meme.jpg"}, {2, "haha.txt"} }; } }
[ "anatolikarman@gmail.com" ]
anatolikarman@gmail.com
db9d42455472d7d3b7aeb3a13e660f07b3e46611
5f0628275cce0c5d3937d90dcc45a2df988e8f46
/tp1/src/main/java/fr/miage/m1/cours/SeLit.java
8bce9cb95519a437822b3cd36915ec15b8747d9e
[]
no_license
Miage-M1-Unice/tp1-doumbe
38262e52b3008b8ea15f9dbb6604b5caa8406700
d9342d71c885a544aab9bc087bac39a6f66848f8
refs/heads/master
2020-04-22T03:46:48.035185
2019-03-05T10:53:16
2019-03-05T10:53:16
170,100,310
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package fr.miage.m1.cours; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class SeLit{ void lecture(Scanner source){ while(source.hasNextLine()){ String s = source.nextLine(); System.out.println(s); // A modifier } source.close(); } static public void main(String[] args){ SeLit sl = new SeLit(); try { File f=new File("C:\\Users\\deptinfo\\Documents\\Master_Miage_S2\\Programmation Avancée\\TP1\\tp1-doumbe\\tp1\\src\\main\\java\\fr\\miage\\m1\\cours\\SeLit.java"); Scanner sc=new Scanner(f); sl.lecture(sc); } catch (Exception e) { e.printStackTrace(); } } }
[ "doumstar90@gmail.com" ]
doumstar90@gmail.com
31bac1404f89230dcf3a8b73914c1c0cbb120065
6d74ccea8979b32f527b2195e436b033b8ae37ed
/JavaPolymorphism/src/model/ColorPrinter.java
50dcb1f39632c5c57838e1ee9ad411d6b84949f3
[]
no_license
y24er/Java_practice
bb8cf3cba2a4221047cc532ffd71fd42dd666d7f
826440b8fa80f66db7b4781260683e11f230ef51
refs/heads/master
2022-11-15T00:11:55.531670
2020-06-28T03:39:43
2020-06-28T03:39:43
275,104,667
0
0
null
null
null
null
UTF-8
Java
false
false
159
java
package model; public class ColorPrinter extends Printer{ @Override public void printing() { System.out.println("color printing..."); } }
[ "1028704486@qq.com" ]
1028704486@qq.com
0bfcef54bd7cdb06a0ba90599c9ec9d6d77ef3cf
03bb0a86e0986dd7fc926a265ea71f2e108d8dbd
/src/redes/Correccion.java
3429ba2a5ecdf01b228fe32ddf20ed4c8b852b43
[]
no_license
fazd/RedesLab1
08b3c296ddbafa879fe7b6398fb87396ee397ad4
f7f872b87fcedd640b5f38c9a911bb04d25188b4
refs/heads/master
2020-04-28T01:41:35.200113
2019-03-18T00:36:20
2019-03-18T00:36:20
174,866,955
0
0
null
null
null
null
UTF-8
Java
false
false
3,386
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 redes; import java.util.ArrayList; import java.util.BitSet; import javax.swing.JOptionPane; import static redes.Hamming.getIndexC; import static redes.Hamming.getValueOfC; /** * * @author fabio */ public class Correccion { private String mess; private ArrayList<Boolean> cValues; private String pal; private int c; public Correccion(String mess) { this.mess = mess; pal = ""; cValues = new ArrayList<>(); c = 0; } private void getC(){ int p = 1; while (p <= mess.length()) { p *= 2; c++; } } private void generatePalAndCValues(){ int length = mess.length(); getC(); System.out.println("C: " + c); int p; p = 1; int i = length - 1; while (i >= 0) { if (length - i - 1 == p - 1) { char car = mess.charAt(i); p = p * 2; if (car == '1') { cValues.add(true); } else { cValues.add(false); } } else { char car = mess.charAt(i); pal = car + pal; } i--; } System.out.println("La pal es: " + pal); System.out.println("CValues es: " + cValues.toString()); } public String verifyErrors() { generatePalAndCValues(); BitSet res = Hamming.stringToBitSet(pal); ArrayList<Boolean> obt = new ArrayList<>(); ArrayList<Boolean> errors = new ArrayList<>(); System.out.println("Pal: "+ pal); for (int i = 1; i <= c; i++) { ArrayList<Integer> cIndex = getIndexC(i, pal.length()); boolean cAux = getValueOfC(cIndex, pal); //System.out.println("Caux: "+ cAux); obt.add(cAux); errors.add(cAux^cValues.get(i-1)); } int bitErr = 0; int k =1; for(Boolean b : errors){ if(b){ bitErr+=k; } k*=2; } if(bitErr == 0){ JOptionPane.showMessageDialog(null,"El mensaje está correcto", "Correccion", JOptionPane.INFORMATION_MESSAGE); return toAscii(pal); } else{ JOptionPane.showMessageDialog(null,"Hay un error en el bit "+ bitErr, "ERROR", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null,"El error ha sido corregido", "Solucionado", JOptionPane.INFORMATION_MESSAGE); System.out.println("El bit errado es "+ bitErr); return null; } } public static String toAscii(String bin){ int charCode = Integer.parseInt(bin, 2); String str = new Character((char)charCode).toString(); return str; } public String arrToBin(ArrayList<Boolean> code) { String s = ""; for (Boolean b : code) { if (b) { s += "1"; } else { s += "0"; } } return s; } }
[ "fabioandres2907@hotmail.com" ]
fabioandres2907@hotmail.com
262c639329d9be9553bed4736a0fe6d535e97c92
a456b870118fe3034eb72f4f94bde593e5c016d0
/src/com/innowhere/jnieasy/core/impl/common/typedec/model/natobj/data/TypeNativeStringBufferUnicodeArrayWrapperImpl.java
69e4fb3e2aa60dae0a6bcc1ee0dd7d497bf59295
[ "Apache-2.0" ]
permissive
fengxiaochuang/jnieasy
0b0fed598e1d0ea2f24ab9a9e9476b58ec2fd510
e295b23ee7418c8e412b025b957e64ceaba40fac
refs/heads/master
2022-01-21T04:21:58.382039
2016-08-21T17:17:34
2016-08-21T17:17:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
/* * TypeNativeStringBufferUnicodeArrayWrapperImpl.java * * Created on 19 de enero de 2004, 20:47 */ package com.innowhere.jnieasy.core.impl.common.typedec.model.natobj.data; import com.innowhere.jnieasy.core.impl.common.classtype.model.natobj.data.ClassTypeNativeStringBufferUnicodeArrayWrapperImpl; import com.innowhere.jnieasy.core.impl.common.typedec.model.StringEncodingImpl; import com.innowhere.jnieasy.core.impl.common.typedec.model.TypeNativeStringBasedInterface; import com.innowhere.jnieasy.core.impl.common.typedec.model.mustbe.data.TypeNativeStringBufferArrayImpl; public class TypeNativeStringBufferUnicodeArrayWrapperImpl extends TypeNativeStringBufferArrayWrapperImpl { /** * Creates a new instance of TypeNativeStringBufferUnicodeArrayWrapperImpl */ public TypeNativeStringBufferUnicodeArrayWrapperImpl(ClassTypeNativeStringBufferUnicodeArrayWrapperImpl dataType) { super(dataType); TypeNativeStringBasedInterface lastCompStrTypeDec = (TypeNativeStringBasedInterface)getTypeNativeArrayInfo().getLastComponentVarType().getTypeNative(); lastCompStrTypeDec.setEncodingExpr(StringEncodingImpl.UNICODE_STR); } public TypeNativeStringBufferUnicodeArrayWrapperImpl(ClassTypeNativeStringBufferUnicodeArrayWrapperImpl dataType,TypeNativeStringBufferArrayImpl typeDecWrapped) { super(dataType,typeDecWrapped); TypeNativeStringBasedInterface lastCompStrTypeDec = (TypeNativeStringBasedInterface)getTypeNativeArrayInfo().getLastComponentVarType().getTypeNative(); lastCompStrTypeDec.setEncodingExpr(StringEncodingImpl.UNICODE_STR); } }
[ "jmarranz@innowhere.com" ]
jmarranz@innowhere.com
af57b1bcb834557148bac40c6a64e9d226baefdf
dbf5f6e79d3e499bf428de25ca3fec8033c18622
/src/main/java/com/xr/question1/Sort.java
b2e414d359e9d9281d9a767999fe9ed64cc37444
[]
no_license
13530038279/xr-answer
535f55571f276a834b09f68fa74d2d20407b70ff
26eeb0ced71fd29f9d9658e2e3e407fb147a7a9c
refs/heads/master
2023-02-15T07:03:26.145536
2021-01-06T02:07:46
2021-01-06T02:07:46
327,168,374
0
0
null
null
null
null
UTF-8
Java
false
false
1,188
java
package com.xr.question1; import java.util.Arrays; public class Sort { public static int[] merge(int a[],int b[]) { int result[]; result = new int[a.length+b.length]; //i:a数组下标 j:b数组下标 k:新数组下标 int i=0,j=0,k=0; while(i<a.length && j<b.length){ if(a[i] <= b[j]) { result[k++] = a[i++]; }else{ result[k++] = b[j++]; } } /* 后面连个while循环是用来保证两个数组比较完之后剩下的一个数组里的元素能顺利传入 * * 此时较短数组已经全部放入新数组,较长数组还有部分剩余,最后将剩下的部分元素放入新数组,大功告成*/ while(i < a.length){ result[k++] = a[i++]; } while(j < b.length){ result[k++] = b[j++]; } return result; } public static void main(String[] args) { Sort test = new Sort(); int[] num1 = {1,3,4,6}; int[] num2 = {2,5,7,8}; int result[] = test.merge(num1,num2); System.out.println(Arrays.toString(result)); } }
[ "thinkinginchwj@163.com" ]
thinkinginchwj@163.com
546d40238ce6a009706fc56957cacca8b17c4823
c429f156cd2e59cb0d0adcdef2776bc0c455f619
/src/main/java/com/example/domain/IA.java
411cf6a89becc865e59895dc7d37fdc8327fc364
[]
no_license
praveshtora/Metrics
adb5341703fc2c36359030966a37984e1cbc81e6
232bddc898970502ee804a6e654c80eabdefed44
refs/heads/master
2021-01-11T08:06:34.546806
2016-11-06T05:00:26
2016-11-06T05:00:26
72,908,551
0
0
null
null
null
null
UTF-8
Java
false
false
1,060
java
package com.example.domain; import jdk.nashorn.internal.objects.annotations.Getter; import jdk.nashorn.internal.objects.annotations.Setter; import org.springframework.boot.autoconfigure.domain.EntityScan; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; /** * Created by palsulea on 11/5/2016. */ @Entity public class IA { @Id @GeneratedValue private Long id; @Column private int headCount; @Column private int portofolios; @Column private int scoreCard; public int getHeadCount() { return headCount; } public void setHeadCount(int headCount) { this.headCount = headCount; } public int getPortofolios() { return portofolios; } public void setPortofolios(int portofolios) { this.portofolios = portofolios; } public int getScoreCard() { return scoreCard; } public void setScoreCard(int scoreCard) { this.scoreCard = scoreCard; } }
[ "abhishek.palsule@gmail.com" ]
abhishek.palsule@gmail.com
4eb10144e76cea1259539c25fbbc50d142da220b
e664c2376df92ea98fc50c840f3cb2a5df0caa9a
/src/dominio/Tabuleiro.java
dbe1c3a121dc5aa527d8a5686023c3fb3a583476
[]
no_license
GabrielBoscoli/Campo-Minado
2ea9c79c091b4e526abcb2f5f614c3c337f9206d
cc86a568cb0624234527323ce9ed92456533cada
refs/heads/master
2022-03-30T19:02:54.782345
2020-01-17T07:31:02
2020-01-17T07:31:02
228,912,600
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,890
java
package dominio; import java.util.Random; public class Tabuleiro { private int numColunas; private int numLinhas; private TipoCasa[][] matrizTabuleiro; private int[][] numBombasAoRedor; private int quantidadeDeCasasSemMina; public Tabuleiro(int numColunas, int numLinhas, int quantidadeDeCasasSemMina) { this.numColunas = numColunas; this.numLinhas = numLinhas; this.quantidadeDeCasasSemMina = quantidadeDeCasasSemMina; matrizTabuleiro = new TipoCasa[numColunas][numLinhas]; inicializaMatrizes(); for (int i = 0; i < quantidadeDeCasasSemMina; i++) { int coluna; int linha; Random colunaSemMina = new Random(); coluna = colunaSemMina.nextInt(numColunas); Random linhaSemMina = new Random(); linha = linhaSemMina.nextInt(numLinhas); if (matrizTabuleiro[coluna][linha] == TipoCasa.casaIntactaSemMina) { i--; } else { removeUmaBombaAoRedorDasCasaEmVolta(coluna, linha); } matrizTabuleiro[coluna][linha] = TipoCasa.casaIntactaSemMina; } } //esse algoritmo está preguiçoso, tem casas que são reescritas muitas vezes. private void inicializaMatrizes() { numBombasAoRedor = new int[numColunas][numLinhas]; //inicializa a matriz com a condicao das casas for (int i = 0; i < numColunas; i++) { for (int j = 0; j < numLinhas; j++) { matrizTabuleiro[i][j] = TipoCasa.casaIntactaComMina; numBombasAoRedor[i][j] = 8; } } //define a quantidade de bombas nas casas das linhas na extremidade int linha = 0; for(int j = 0; j < 2; j++) { for(int i = 0; i < numColunas; i++) { numBombasAoRedor[i][linha] = 5; } linha = numLinhas - 1; } //define a quantidade de bombas nas casas das colunas na extremidade int coluna = 0; for(int j = 0; j < 2; j++) { for(int i = 0; i < numLinhas; i++) { numBombasAoRedor[coluna][i] = 5; } coluna = numColunas - 1; } //define a quantidade de bombas das casas na quina numBombasAoRedor[0][0] = 3; numBombasAoRedor[numBombasAoRedor.length - 1][0] = 3; numBombasAoRedor[0][numBombasAoRedor.length - 1] = 3; numBombasAoRedor[numBombasAoRedor.length - 1][numBombasAoRedor.length - 1] = 3; } //algoritmo preguiçoso. muito codigo repetido private void removeUmaBombaAoRedorDasCasaEmVolta(int coluna, int linha) { int linhaAux = linha + 1; int colunaAux = coluna - 1; if(colunaAux >= 0) { numBombasAoRedor[colunaAux][linha]--; if(linhaAux < numLinhas) { numBombasAoRedor[colunaAux][linhaAux]--; } linhaAux = linha - 1; if(linhaAux >= 0) { numBombasAoRedor[colunaAux][linhaAux]--; } } linhaAux = linha + 1; colunaAux = coluna + 1; if(colunaAux < numColunas) { numBombasAoRedor[colunaAux][linha]--; if(linhaAux < numLinhas) { numBombasAoRedor[colunaAux][linhaAux]--; } linhaAux = linha - 1; if(linhaAux >= 0) { numBombasAoRedor[colunaAux][linhaAux]--; } } linhaAux = linha + 1; if(linhaAux < numLinhas) { numBombasAoRedor[coluna][linhaAux]--; } linhaAux = linha - 1; if(linhaAux >= 0) { numBombasAoRedor[coluna][linhaAux]--; } } /** * Verifica se a casa da linha e coluna especificada possui mina * * @param coluna - coluna da casa * @param linha - linha da casa * @return true, se a casa tiver mina. false, se não estiver ou se o tabuleiro * nao possui casa na coordenada recebida. */ public boolean casaNaoTemMina(int coluna, int linha) { if (linha >= numLinhas || linha < 0 || coluna >= numColunas || coluna < 0) { return false; } if (matrizTabuleiro[coluna][linha] == TipoCasa.casaIntactaSemMina) { return true; } else { return false; } } /** * Tira a mina da casa. Se a casa não tiver mina, não faz nada. * * @param coluna - coluna da casa * @param linha - linha da casa */ public void tiraMinaDaCasa(int coluna, int linha) { if (linha >= numLinhas || linha < 0 || coluna >= numColunas || coluna < 0) { return; } matrizTabuleiro[coluna][linha] = TipoCasa.casaIntactaSemMina; } public void resetaTabuleiro() { for (int i = 0; i < numColunas; i++) { for (int j = 0; j < numLinhas; j++) { tiraMinaDaCasa(i, j); } } } public int getQntBombasAoRedor(int coluna, int linha) { return numBombasAoRedor[coluna][linha]; } public int getNumColunas() { return numColunas; } public void setNumColunas(int numColunas) { this.numColunas = numColunas; } public int getNumLinhas() { return numLinhas; } public void setNumLinhas(int numLinhas) { this.numLinhas = numLinhas; } public TipoCasa[][] getMatrizTabuleiro() { return matrizTabuleiro; } public void setMatrizTabuleiro(TipoCasa[][] matrizTabuleiro) { this.matrizTabuleiro = matrizTabuleiro; } public int getQuantidadeDeCasasSemMina() { return quantidadeDeCasasSemMina; } public int getQuantidadeDeCasaTotais() { return numColunas * numLinhas; } }
[ "gabriel_boscoli@hotmail.com" ]
gabriel_boscoli@hotmail.com
68cf994272cf48de100d44b529bf34b4f2be8387
b0d5ea5da78552b83e787e9ed0d3c7325eaa67f2
/src/test/java/com/ipaly/transer/TransTest.java
8de40a5d5f4b5fad84f3937633bbae1a7897062b
[]
no_license
guyuhan777/EntityTransfer
12f3e2eefeed430975fa042bb61fe6f76c65e613
363d5ff8108ee4e23098dd487a1712ce5241836f
refs/heads/master
2021-04-26T06:30:20.047282
2018-02-26T09:15:24
2018-02-26T09:15:24
121,357,641
0
0
null
null
null
null
UTF-8
Java
false
false
928
java
package com.ipaly.transer; import java.util.ArrayList; import java.util.List; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; public class TransTest extends TestCase { public TransTest(String testName) { super(testName); } /** * @return the suite of tests being tested */ public static Test suite(){ return new TestSuite( TransTest.class ); } public void testTrans(){ Transer transer = new Transer(); From from = new From(); from.setTestAlia(12); from.setB("Hello"); List<String> strs = new ArrayList<>(); strs.add("1"); strs.add("2"); strs.add("3"); from.setC(strs); try { To to = transer.trans(from, To.class); System.out.println(to); } catch (IllegalArgumentException | TransProcessException e) { e.printStackTrace(); } } }
[ "gu_y@worksap.co.jp" ]
gu_y@worksap.co.jp
6f60680bf82ba27f1b993381a2afee10275be70f
d19940133860bbddb4b9c79a3236d7402d19152c
/src/main/java/org/xperiment/php/core/tree/impl/EchoStatementTree.java
5eb6fe40e92f6812a07a3563f755cd23e74498ae
[]
no_license
ghabxph/php-interpreter
64f8f197b84906a025fc3f5bf6803871a179837e
7700d7f92c59071ffa52cef52754a3bded53802f
refs/heads/master
2023-08-10T02:04:37.591979
2019-02-25T16:26:46
2019-02-25T16:28:07
171,160,048
0
0
null
2023-07-21T08:56:27
2019-02-17T19:01:27
Java
UTF-8
Java
false
false
1,043
java
package org.xperiment.php.core.tree.impl; import org.xperiment.php.core.tree.abs.StatementTreeImpl; import org.xperiment.php.core.tree.iface.StatementTree; import org.xperiment.php.core.tree.iface.StringLiteralTree; import java.util.ArrayList; import java.util.List; /** * (Class) EchoStatementTree * - Class responsible for ... * * @author ghabxph [me@ghabxph.info] */ public class EchoStatementTree extends StatementTreeImpl { /** * String parameters */ private final List<StringLiteralTree> args = new ArrayList<>(); /** * Adds argument to echo statement * * @param args String parameter to add */ public void args(StringLiteralTree args) { this.args.add(args); } /** * Executes the statement * * @return Returns this instance, along with the viable status */ @Override public StatementTree execute() { for (StringLiteralTree arg : args) { System.out.print(arg.stringValue()); } return null; } }
[ "me@ghabxph.info" ]
me@ghabxph.info
5266cfbc7ede31abd6a8d31326e1e6cbc7d81136
a6df3ca677cb301ae67220d1a2bec37f5045d270
/cit590Examples/Java/GUI/BoxLayoutExample.java
99b8342b821978c622f8fd48d017bbd94316182a
[]
no_license
abhusnurmath/rando
53c6fdf5ef8ecbe8440c09acb79636db7f0bbd42
84260a35399d983ed0154a5e004cadd970d2be6a
refs/heads/master
2020-05-19T11:07:09.372441
2015-02-21T01:35:25
2015-02-21T01:35:25
2,403,652
7
10
null
2015-01-25T02:02:12
2011-09-17T05:34:24
Java
UTF-8
Java
false
false
476
java
package guiprograms; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JApplet; import javax.swing.JButton; public class BoxLayoutExample extends JApplet { public void init () { Box box = new Box(BoxLayout.Y_AXIS); add(box); box.add(new JButton("One")); box.add(new JButton("Two")); box.add(new JButton("Three")); box.add(new JButton("Four")); box.add(new JButton("Five")); box.add(new JButton("Six")); } }
[ "bhusnur4@seas.upenn.edu" ]
bhusnur4@seas.upenn.edu
8d6bd4e01a72c818ac4ef7c6a42ef75b961e8e27
28b6e7c633829a5a6b2bf51b00fd36c6e07cb02e
/src/java/com/pracbiz/b2bportal/core/mapper/PoLocationDetailMapper.java
0b67db2dfb368ab64fe550320a8879e5eebe84fc
[]
no_license
OuYangLiang/pracbiz-Ntuc-B2B
db3aa7cc3cbd019b720c97342ffce966d1c4c3da
a6a36fbd0be941c19b9223aab5d0ec129b9752f1
refs/heads/master
2021-01-01T16:55:23.897814
2015-02-17T16:04:03
2015-02-17T16:04:03
30,924,377
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
package com.pracbiz.b2bportal.core.mapper; import com.pracbiz.b2bportal.base.mapper.BaseMapper; import com.pracbiz.b2bportal.base.mapper.DBActionMapper; import com.pracbiz.b2bportal.core.holder.PoLocationDetailHolder; public interface PoLocationDetailMapper extends BaseMapper<PoLocationDetailHolder>, DBActionMapper<PoLocationDetailHolder> { }
[ "ouyanggod@gmail.com" ]
ouyanggod@gmail.com
45801755fb9613c7dd18652db741ca1e27be3575
62e334192393326476756dfa89dce9f0f08570d4
/tk_code/tiku-essay-app/essay-server/src/main/java/com/huatu/tiku/essay/repository/EssayGoodsOrderRefundRepository.java
e76a378231ff8de30e781c2a0d72d0cc7374f07c
[]
no_license
JellyB/code_back
4796d5816ba6ff6f3925fded9d75254536a5ddcf
f5cecf3a9efd6851724a1315813337a0741bd89d
refs/heads/master
2022-07-16T14:19:39.770569
2019-11-22T09:22:12
2019-11-22T09:22:12
223,366,837
1
2
null
2022-06-30T20:21:38
2019-11-22T09:15:50
Java
UTF-8
Java
false
false
873
java
package com.huatu.tiku.essay.repository; import com.huatu.tiku.essay.entity.EssayGoodsOrderRefund; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import java.util.List; /** * 商品订单退款 * * @author geek-s * @date 2019-07-09 */ public interface EssayGoodsOrderRefundRepository extends JpaRepository<EssayGoodsOrderRefund, Long>, JpaSpecificationExecutor<EssayGoodsOrderRefund> { /** * 根据订单ID查询退款记录 * * @param orderId 订单ID * @return 退款记录 */ List<EssayGoodsOrderRefund> findByGoodsOrderId(Long orderId); /** * 根据订单ID查询退款记录 * * @param orderId 订单ID * @return 退款记录 */ EssayGoodsOrderRefund findTop1ByGoodsOrderIdOrderByIdDesc(Long orderId); }
[ "jelly_b@126.com" ]
jelly_b@126.com
7c2d8afaf9940ce6575c12cf0586a73671a5668b
cc3054de4cc317dd89b39d5e878e062e50837e0e
/app/src/main/java/com/mordreth/easyalertapp/app/MainActivity.java
2b8bf5f30076138086783b64a988791ae76de6fb
[]
no_license
savelascod/EasyAlertApp
8b6a71da69f44eb6ab7264e9ee673bb621390057
6987264fae7175da0ae0e7413cf3dbc65c633947
refs/heads/master
2021-01-10T04:08:52.414142
2015-11-20T04:51:52
2015-11-20T04:51:52
46,526,302
0
0
null
null
null
null
UTF-8
Java
false
false
5,274
java
package com.mordreth.easyalertapp.app; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import rest.AsyncResponse; import java.util.ArrayList; public class MainActivity extends Activity implements AsyncResponse { JSONArray jsonServices; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); jsonServices = new JSONArray(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void sendData(View view) { ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("$format", "json")); params.add(new BasicNameValuePair("$top", "30")); String filters = setFilters(); if (!filters.equals("")) { params.add(new BasicNameValuePair("$filter", filters)); } Log.v("params", params.toString()); ((EasyAlert) getApplication()).getMasterCaller().getData( "v1/superintendencia_de_vigilancia_y_seguridad_privada/directoriodeservicios", this, params); } public String setFilters() { String streamFilters = ""; ArrayList<String> filters = new ArrayList<String>(); EditText nitText = (EditText) findViewById(R.id.nit); EditText serviceTypeText = (EditText) findViewById(R.id.service_type); EditText razonSocialText = (EditText) findViewById(R.id.razon_social); EditText addressText = (EditText) findViewById(R.id.address); EditText phoneText = (EditText) findViewById(R.id.phone); EditText emailText = (EditText) findViewById(R.id.email); EditText representativeText = (EditText) findViewById(R.id.representative); if (nitText.getText().toString() != null && !nitText.getText().equals("") && nitText.getText().length() != 0) { filters.add("\"nit\"" + "=" + "\'" + nitText.getText().toString() + "\'"); } if (serviceTypeText.getText() != null && !serviceTypeText.getText().equals("") && serviceTypeText.getText().length() != 0) { filters.add("\"tiposervicio\"" + "=" + "\'" + serviceTypeText.getText().toString() + "\'"); } if (razonSocialText.getText() != null && !razonSocialText.getText().equals("") && razonSocialText.getText().length() != 0) { filters.add("\"razonsocial\"" + "=" + "\'" + razonSocialText.getText().toString() + "\'"); } if (addressText.getText() != null && !addressText.getText().equals("") && addressText.getText().length() != 0) { filters.add("\"direccion\"" + "=" + "\'" + addressText.getText().toString() + "\'"); } if (phoneText.getText() != null && !phoneText.getText().equals("") && phoneText.getText().length() != 0) { filters.add("\"telefonofijovigilado\"" + "=" + "\'" + phoneText.getText().toString() + "\'"); } if (emailText.getText() != null && !emailText.getText().equals("") && emailText.getText().length() != 0) { filters.add("\"correoelectronicovigilado\"" + "=" + "\'" + emailText.getText().toString() + "\'"); } for (int i = 0; i < filters.size() - 1; i++) { streamFilters += filters.get(i) + "and"; } if (!filters.isEmpty()) { streamFilters += filters.get(filters.size() - 1); } Log.v("filters", streamFilters); return streamFilters; } @Override public void processFinish(String result) { saveJsonObjects(result); startServicesActivity(); } private void startServicesActivity() { Intent intent = new Intent(this, ServicesActivity.class); Bundle values = new Bundle(); values.putString("services", jsonServices.toString()); intent.putExtras(values); startActivity(intent); finish(); } private void saveJsonObjects(String result) { try { JSONObject jsonObject = new JSONObject(result); if (jsonObject.length() > 0) { jsonServices = jsonObject.getJSONArray("d"); } } catch (JSONException e) { e.printStackTrace(); } } }
[ "savelascod@unal.edu.co" ]
savelascod@unal.edu.co
2df89a46197c9e91a59a950f5bab9da87d175708
3116ca829e0d014c85eb8ae7b330e822ce95a132
/c_libs/src/main/java/com/yefeng/support/base/AppInfo.java
bbdc1de523033088941eccdd41e1d20b06c6c918
[]
no_license
yefengjie/yfsms
a9a1d02da08ae69a31ecb0dcd1fd2cfce491979e
b1e82fe50f26891e7c50b8a453816689d55b3378
refs/heads/master
2020-03-12T14:46:01.779755
2019-01-21T08:41:17
2019-01-21T08:41:17
130,675,486
11
0
null
null
null
null
UTF-8
Java
false
false
1,632
java
package com.yefeng.support.base; import android.content.Context; import android.content.pm.PackageInfo; import android.os.Build; import android.util.DisplayMetrics; import com.yefeng.support.R; /** * Created by yee on 11/18/13. * app basic information * * @author yefeng */ public class AppInfo { public static String sBuildModel; public static int sBuildSdkInt; public static String sBuildRelease; public static int sAppCode; public static String sAppVersion; public static String sAppName; public static int sWidth; public static int sHeight; public static float sDensity; public static int sDensityDpi; public static void init(Context mContext) { sBuildModel = Build.MODEL; sBuildSdkInt = Build.VERSION.SDK_INT; sBuildRelease = Build.VERSION.RELEASE; PackageInfo pi = null; try { pi = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0); } catch (Exception e) { e.printStackTrace(); } if (null != pi) { sAppVersion = pi.versionName; sAppCode = pi.versionCode; } else { sAppVersion = ""; sAppCode = 0; } sAppName = mContext.getString(R.string.app_name); initDisplay(mContext); } private static void initDisplay(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); sWidth = metrics.widthPixels; sHeight = metrics.heightPixels; sDensity = metrics.density; sDensityDpi = metrics.densityDpi; } }
[ "yefeng@MacBook-Pro.local" ]
yefeng@MacBook-Pro.local
d762dc85813f3898973c4a168d44e18a15d2f054
42bfd6f4eda7a0331d7ddef1decf883ec64e98ad
/src/main/java/com/ih/service/MerchantImportServiceImpl.java
21bbdbc493ea8cc09fcd40846f089e8e1e975f1b
[]
no_license
iliyahristov/emp-test
5b7a46489a910a09b15e0763437af316d877ddf7
5627dde9ee8b5d69c3a6f1037e6ae05f493341c8
refs/heads/master
2023-03-11T13:15:34.522495
2021-02-28T19:34:50
2021-02-28T19:34:50
340,724,443
0
0
null
2021-02-28T19:34:51
2021-02-20T18:27:50
Java
UTF-8
Java
false
false
1,269
java
package com.ih.service; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import com.ih.helper.MerchantHelper; import com.ih.model.Merchant; import com.ih.repository.MerchantRepository; @Service public class MerchantImportServiceImpl { @Autowired private MerchantRepository merchantRepository; @Autowired private MerchantHelper merchantHelper; public void saveAll(MultipartFile file) { try { List<Merchant> merchantList = merchantHelper.csvToMerchantList(file.getInputStream()); List<Merchant> merchantsListToSave = new ArrayList<>(); merchantList.forEach( merchant -> { Merchant foundMerchant = merchantRepository.findByUsername(merchant.getUsername()); if (foundMerchant == null){ merchantsListToSave.add(merchant); } }); merchantRepository.saveAll(merchantsListToSave); } catch (IOException e) { throw new RuntimeException("fail to store csv data: " + e.getMessage()); } } }
[ "ihristov@intersoftpro.com" ]
ihristov@intersoftpro.com
4727fd5a493d43bcaea9afe8bf1451f92861b808
386a0f03b65ed4fdd2e61fbcba4c5c0e7af3f07c
/src/by/lyubin/task4OOP/constant/DistrictConstant.java
fb4f53a5c6ed7482ed07bb21a14bd95ebebe1c18
[]
no_license
shadow1230001/ItAcademy-Lesson5
de1697f3a81c0e69b7ebf45f11aec07ce7b8ff22
04d331c06c12b76691bf809c16bf68546d2738fa
refs/heads/master
2021-05-06T04:23:22.691764
2017-12-24T16:15:49
2017-12-24T16:15:49
114,994,904
0
0
null
null
null
null
UTF-8
Java
false
false
1,519
java
package by.lyubin.task4OOP.constant; public class DistrictConstant { public static final String DISTRICT_BRESRSKIY = "Brestskiy"; public static final String DISTRICT_VITEBSKIY = "Vitebskiy"; public static final String DISTRICT_GOMELSKIY = "Gomelskiy"; public static final String DISTRICT_GRODNENSKIY = "Grodnenskiy"; public static final String DISTRICT_MINSK = "Minsk"; public static final String DISTRICT_MINSKIY = "Minskiy"; public static final String DISTRICT_MOGILEVSKIY = "Mogilevskiy"; public static final String DISTRICT_CENTER_BREST = "Brest"; public static final String DISTRICT_CENTER_VITEBSK = "Vitebsk"; public static final String DISTRICT_CENTER_GOMEL = "Gomel"; public static final String DISTRICT_CENTER_GRODNO = "Grodno"; public static final String DISTRICT_CENTER_MINSKI = "Minsk"; public static final String DISTRICT_CENTER_MINSK = "Minsk"; public static final String DISTRICT_CENTER_MOGILEV = "Mogilev"; public static final double DISTRICT_AREA_BREST = 54.8; public static final double DISTRICT_AREA_VITEBSK = 40.0; public static final double DISTRICT_AREA_GOMEL = 40.4; public static final double DISTRICT_AREA_GRODNO = 20.1; public static final double DISTRICT_AREA_MINSKI = 0.3; public static final double DISTRICT_AREA_MINSK = 39.9; public static final double DISTRICT_AREA_MOGILEV = 29.1; public static final int DISTRICT_NUMBER_CITY = 3; public static final int DISTRICT_NUMBER_CITY_MINSK = 0; }
[ "vlyubin@list.ru" ]
vlyubin@list.ru
487d37886290ed45f7df890765fcbc383dd8a326
d2e737c077e9afb19b0d230c07e7828eb45a0691
/00_leetcode/src/com/jms/链表/_206_反转链表.java
1421fe068b4f8ce50c84c742629b58632c439f44
[]
no_license
superJamison/algorithm
5a78ac7c623cdf7a344d6494e39d2b97adb3cfb3
236c1500cf8a7d5c27327020b7505bec578e0359
refs/heads/main
2023-08-23T14:45:42.953098
2021-11-07T08:01:53
2021-11-07T08:01:53
352,030,810
1
1
null
null
null
null
UTF-8
Java
false
false
771
java
package com.jms.链表; /** * @author Jamison * @version 1.0 * @date 2021/3/21 19:30 */ public class _206_反转链表 { public ListNode reverseList(ListNode head) { if (head == null || head.next == null){ return head; } ListNode node = reverseList(head.next); head.next.next = head; head.next = null; return node; } public ListNode reverseList1(ListNode head) { if (head == null || head.next == null){ return head; } ListNode newHead = null; ListNode tmp; while (head != null){ tmp = head.next; head.next = newHead; newHead = head; head = tmp; } return newHead; } }
[ "2982935350@qq.com" ]
2982935350@qq.com
c106c9e58cc5f0d4823dc738c56129ce1afdf61c
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java
dfea3d0538114c107cfcb6c1a9bf1216fe1cb7e9
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
3,350
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.security.models; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; /** Resource collection API of ComplianceResults. */ public interface ComplianceResults { /** * Security compliance results in the subscription. * * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or * management group (/providers/Microsoft.Management/managementGroups/mgName). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of compliance results response as paginated response with {@link PagedIterable}. */ PagedIterable<ComplianceResult> list(String scope); /** * Security compliance results in the subscription. * * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or * management group (/providers/Microsoft.Management/managementGroups/mgName). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of compliance results response as paginated response with {@link PagedIterable}. */ PagedIterable<ComplianceResult> list(String scope, Context context); /** * Security Compliance Result. * * @param resourceId The identifier of the resource. * @param complianceResultName name of the desired assessment compliance result. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a compliance result along with {@link Response}. */ Response<ComplianceResult> getWithResponse(String resourceId, String complianceResultName, Context context); /** * Security Compliance Result. * * @param resourceId The identifier of the resource. * @param complianceResultName name of the desired assessment compliance result. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a compliance result. */ ComplianceResult get(String resourceId, String complianceResultName); }
[ "noreply@github.com" ]
Azure.noreply@github.com
b4959ea9544af8d18c68463408715f006986b8d9
6c28eca2c33a275fb0008a51b8e5776a82f5904d
/Code/Hierarchy_GenerationTestProject/src/net/unconventionalthinking/matrix/AppSymbols.java
76599fd59ef099453716dfa1cb67e1f00e7302e4
[]
no_license
UnconventionalThinking/hierarchy
17dc9e224595f13702b9763829e12fbce2c48cfe
de8590a29c19202c01d1a6e62ca92e91aa9fc6ab
refs/heads/master
2021-01-19T21:28:29.793371
2014-12-19T03:16:24
2014-12-19T03:16:24
13,262,291
0
1
null
null
null
null
UTF-8
Java
false
false
31,670
java
/* Copyright 2012, 2013 Unconventional Thinking * * This file is part of Hierarchy. * * Hierarchy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * * Hierarchy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Hierarchy. * If not, see <http://www.gnu.org/licenses/>. */ /* ~*~*~Matrix Meta-Compiled File~*~*~ */ package net.unconventionalthinking.matrix; import java.util.*; import net.unconventionalthinking.lang.*; import net.unconventionalthinking.matrix.symbols.*; import net.unconventionalthinking.exceptions.*; public class AppSymbols { // Single Symbols: public static Symbol ContinuationType; public static final int ContinuationType$_ID_$ = 0; public static Symbol byte$_sym_$; public static final int byte$_sym_$$_ID_$ = 1; public static Symbol short$_sym_$; public static final int short$_sym_$$_ID_$ = 2; public static Symbol int$_sym_$; public static final int int$_sym_$$_ID_$ = 3; public static Symbol long$_sym_$; public static final int long$_sym_$$_ID_$ = 4; public static Symbol float$_sym_$; public static final int float$_sym_$$_ID_$ = 5; public static Symbol double$_sym_$; public static final int double$_sym_$$_ID_$ = 6; public static Symbol char$_sym_$; public static final int char$_sym_$$_ID_$ = 7; public static Symbol boolean$_sym_$; public static final int boolean$_sym_$$_ID_$ = 8; public static Symbol String; public static final int String$_ID_$ = 9; public static Symbol Object; public static final int Object$_ID_$ = 10; public static Symbol Schema; public static final int Schema$_ID_$ = 11; public static Symbol Matrix; public static final int Matrix$_ID_$ = 12; public static Symbol Descriptor; public static final int Descriptor$_ID_$ = 13; public static Symbol FieldSet; public static final int FieldSet$_ID_$ = 14; public static Symbol Field; public static final int Field$_ID_$ = 15; public static Symbol Symbol; public static final int Symbol$_ID_$ = 16; public static Symbol DescriptorTagName; public static final int DescriptorTagName$_ID_$ = 17; public static Symbol Label; public static final int Label$_ID_$ = 18; public static Symbol DescriptorTag; public static final int DescriptorTag$_ID_$ = 19; public static Symbol MatrixName; public static final int MatrixName$_ID_$ = 20; public static Symbol SchemaName; public static final int SchemaName$_ID_$ = 21; public static Symbol DescriptorPath; public static final int DescriptorPath$_ID_$ = 22; public static Symbol SchemaPath; public static final int SchemaPath$_ID_$ = 23; public static Symbol MatrixSet; public static final int MatrixSet$_ID_$ = 24; public static Symbol MatrixSet$60$Descriptor$62$; public static final int MatrixSet$60$Descriptor$62$$_ID_$ = 25; public static Symbol MatrixSet$60$Object$62$; public static final int MatrixSet$60$Object$62$$_ID_$ = 26; public static Symbol DEFAULT; public static final int DEFAULT$_ID_$ = 27; public static Symbol IsPersistent; public static final int IsPersistent$_ID_$ = 28; public static Symbol NotPersistent; public static final int NotPersistent$_ID_$ = 29; public static Symbol BuildingMatrixElement; public static final int BuildingMatrixElement$_ID_$ = 30; public static Symbol BuildingSchemaElement; public static final int BuildingSchemaElement$_ID_$ = 31; public static Symbol BuildingMatrixElementForSchema; public static final int BuildingMatrixElementForSchema$_ID_$ = 32; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$NAMES; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$NAMES$_ID_$ = 135; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$TYPES; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$TYPES$_ID_$ = 136; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$DESC; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$DESC$_ID_$ = 137; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$DEFAULTS; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$DEFAULTS$_ID_$ = 138; public static Symbol NotRequired; public static final int NotRequired$_ID_$ = 156; public static Symbol IsRequired; public static final int IsRequired$_ID_$ = 157; public static Symbol NotSelected; public static final int NotSelected$_ID_$ = 171; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$REQUIRED; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$REQUIRED$_ID_$ = 172; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$SELECT; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$SELECT$_ID_$ = 173; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$SELECT$36$$95$S$95$$36$OPTION; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$SELECT$36$$95$S$95$$36$OPTION$_ID_$ = 174; public static Symbol MyTestType; public static final int MyTestType$_ID_$ = 200; public static Symbol net; public static final int net$_ID_$ = 201; public static Symbol unconventionalthinking; public static final int unconventionalthinking$_ID_$ = 202; public static Symbol MyTestType2; public static final int MyTestType2$_ID_$ = 203; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$TEST$36$$95$$95$$36$SCHEMA$36$$95$S$95$$36$MY$36$95$36$DESC$36$$95$$95$$36$NUM1; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$TEST$36$$95$$95$$36$SCHEMA$36$$95$S$95$$36$MY$36$95$36$DESC$36$$95$$95$$36$NUM1$_ID_$ = 207; public static Symbol FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$TEST$36$$95$$95$$36$SCHEMA$36$$95$S$95$$36$MY$36$95$36$DESC$36$$95$$95$$36$NUM2; public static final int FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$TEST$36$$95$$95$$36$SCHEMA$36$$95$S$95$$36$MY$36$95$36$DESC$36$$95$$95$$36$NUM2$_ID_$ = 208; // MultiPart Symbols: public static Symbol ContinuationType$__$byte; public static final int ContinuationType$__$byte$_ID_$ = 34; public static Symbol ContinuationType$__$short; public static final int ContinuationType$__$short$_ID_$ = 35; public static Symbol ContinuationType$__$int; public static final int ContinuationType$__$int$_ID_$ = 36; public static Symbol ContinuationType$__$long; public static final int ContinuationType$__$long$_ID_$ = 37; public static Symbol ContinuationType$__$float; public static final int ContinuationType$__$float$_ID_$ = 38; public static Symbol ContinuationType$__$double; public static final int ContinuationType$__$double$_ID_$ = 39; public static Symbol ContinuationType$__$char; public static final int ContinuationType$__$char$_ID_$ = 40; public static Symbol ContinuationType$__$boolean; public static final int ContinuationType$__$boolean$_ID_$ = 41; public static Symbol ContinuationType$__$String; public static final int ContinuationType$__$String$_ID_$ = 42; public static Symbol ContinuationType$__$Object; public static final int ContinuationType$__$Object$_ID_$ = 43; public static Symbol ContinuationType$__$Symbol; public static final int ContinuationType$__$Symbol$_ID_$ = 44; public static Symbol ContinuationType$__$DescriptorTagName; public static final int ContinuationType$__$DescriptorTagName$_ID_$ = 45; public static Symbol ContinuationType$__$Label; public static final int ContinuationType$__$Label$_ID_$ = 46; public static Symbol net$__$unconventionalthinking; public static final int net$__$unconventionalthinking$_ID_$ = 205; public static Symbol net$__$unconventionalthinking$__$MyTestType2; public static final int net$__$unconventionalthinking$__$MyTestType2$_ID_$ = 206; // Initializer for Symbols: public static boolean have_Intialized = false; static void initialize(SymbolControl symbol_Control) throws Exception_InvalidArgumentPassed_Null, Exception_InvalidArgumentPassed, Exception_SymbolCreation, Exception_MultiPartSymbolAccess, Exception_MultiPartSymbolCreation, Exception_MultiPartSymbolCreationOrAccess { initialize(symbol_Control, false); } /** * If you set have_ParentAppControl to true, then the symbolControl you pass in should be from a parent AppControl (which means this class * and all of the other app control classes for this application context are probably in a jar, being used by a parent application. <p> * * What this means is that all the ID fields for this class are INCORRECT!! The Id's for symbols will not be hard coded, but set dynamically.<br> * What this also means is that for right now, jar files can not have embedded matrix classes methods with matrix accesses that are called from * a parent application (because matrix access uses these id's). */ static void initialize(SymbolControl symbol_Control, boolean have_ParentAppControl) throws Exception_InvalidArgumentPassed_Null, Exception_InvalidArgumentPassed, Exception_SymbolCreation, Exception_MultiPartSymbolAccess, Exception_MultiPartSymbolCreation, Exception_MultiPartSymbolCreationOrAccess { SymbolControl symbolControl = symbol_Control; Symbol_Single_Factory singleSymbol_Factory = symbolControl.singleSymbol_Factory; Symbol_MultiPart_Factory multiPartSymbol_Factory = symbolControl.multiPartSymbol_Factory; // Multipart-Symbol related variables: List<Symbol_Single> newlyCreatedSymbols = new ArrayList<Symbol_Single>(); Boolean_Mutable have_Created_New_MultiPartSymbol = new Boolean_Mutable(false); int creation_StartLevel = 0; boolean creation_Has_StaticVersion = true; List<String> symbolStrings = null; // Single Symbols _________________________________________________________________________ ContinuationType = (have_ParentAppControl) ? singleSymbol_Factory.createNew("ContinuationType", true) : singleSymbol_Factory.createNew("ContinuationType", 0, true, null); byte$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("byte", true) : singleSymbol_Factory.createNew("byte", 1, true, null); short$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("short", true) : singleSymbol_Factory.createNew("short", 2, true, null); int$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("int", true) : singleSymbol_Factory.createNew("int", 3, true, null); long$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("long", true) : singleSymbol_Factory.createNew("long", 4, true, null); float$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("float", true) : singleSymbol_Factory.createNew("float", 5, true, null); double$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("double", true) : singleSymbol_Factory.createNew("double", 6, true, null); char$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("char", true) : singleSymbol_Factory.createNew("char", 7, true, null); boolean$_sym_$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("boolean", true) : singleSymbol_Factory.createNew("boolean", 8, true, null); String = (have_ParentAppControl) ? singleSymbol_Factory.createNew("String", true) : singleSymbol_Factory.createNew("String", 9, true, null); Object = (have_ParentAppControl) ? singleSymbol_Factory.createNew("Object", true) : singleSymbol_Factory.createNew("Object", 10, true, null); Schema = (have_ParentAppControl) ? singleSymbol_Factory.createNew("Schema", true) : singleSymbol_Factory.createNew("Schema", 11, true, null); Matrix = (have_ParentAppControl) ? singleSymbol_Factory.createNew("Matrix", true) : singleSymbol_Factory.createNew("Matrix", 12, true, null); Descriptor = (have_ParentAppControl) ? singleSymbol_Factory.createNew("Descriptor", true) : singleSymbol_Factory.createNew("Descriptor", 13, true, null); FieldSet = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSet", true) : singleSymbol_Factory.createNew("FieldSet", 14, true, null); Field = (have_ParentAppControl) ? singleSymbol_Factory.createNew("Field", true) : singleSymbol_Factory.createNew("Field", 15, true, null); Symbol = (have_ParentAppControl) ? singleSymbol_Factory.createNew("Symbol", true) : singleSymbol_Factory.createNew("Symbol", 16, true, null); DescriptorTagName = (have_ParentAppControl) ? singleSymbol_Factory.createNew("DescriptorTagName", true) : singleSymbol_Factory.createNew("DescriptorTagName", 17, true, null); Label = (have_ParentAppControl) ? singleSymbol_Factory.createNew("Label", true) : singleSymbol_Factory.createNew("Label", 18, true, null); DescriptorTag = (have_ParentAppControl) ? singleSymbol_Factory.createNew("DescriptorTag", true) : singleSymbol_Factory.createNew("DescriptorTag", 19, true, null); MatrixName = (have_ParentAppControl) ? singleSymbol_Factory.createNew("MatrixName", true) : singleSymbol_Factory.createNew("MatrixName", 20, true, null); SchemaName = (have_ParentAppControl) ? singleSymbol_Factory.createNew("SchemaName", true) : singleSymbol_Factory.createNew("SchemaName", 21, true, null); DescriptorPath = (have_ParentAppControl) ? singleSymbol_Factory.createNew("DescriptorPath", true) : singleSymbol_Factory.createNew("DescriptorPath", 22, true, null); SchemaPath = (have_ParentAppControl) ? singleSymbol_Factory.createNew("SchemaPath", true) : singleSymbol_Factory.createNew("SchemaPath", 23, true, null); MatrixSet = (have_ParentAppControl) ? singleSymbol_Factory.createNew("MatrixSet", true) : singleSymbol_Factory.createNew("MatrixSet", 24, true, null); MatrixSet$60$Descriptor$62$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("MatrixSet<Descriptor>", true) : singleSymbol_Factory.createNew("MatrixSet<Descriptor>", 25, true, null); MatrixSet$60$Object$62$ = (have_ParentAppControl) ? singleSymbol_Factory.createNew("MatrixSet<Object>", true) : singleSymbol_Factory.createNew("MatrixSet<Object>", 26, true, null); DEFAULT = (have_ParentAppControl) ? singleSymbol_Factory.createNew("DEFAULT", true) : singleSymbol_Factory.createNew("DEFAULT", 27, true, null); IsPersistent = (have_ParentAppControl) ? singleSymbol_Factory.createNew("IsPersistent", true) : singleSymbol_Factory.createNew("IsPersistent", 28, true, null); NotPersistent = (have_ParentAppControl) ? singleSymbol_Factory.createNew("NotPersistent", true) : singleSymbol_Factory.createNew("NotPersistent", 29, true, null); BuildingMatrixElement = (have_ParentAppControl) ? singleSymbol_Factory.createNew("BuildingMatrixElement", true) : singleSymbol_Factory.createNew("BuildingMatrixElement", 30, true, null); BuildingSchemaElement = (have_ParentAppControl) ? singleSymbol_Factory.createNew("BuildingSchemaElement", true) : singleSymbol_Factory.createNew("BuildingSchemaElement", 31, true, null); BuildingMatrixElementForSchema = (have_ParentAppControl) ? singleSymbol_Factory.createNew("BuildingMatrixElementForSchema", true) : singleSymbol_Factory.createNew("BuildingMatrixElementForSchema", 32, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$NAMES = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$NAMES", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$NAMES", 135, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$TYPES = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$TYPES", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$TYPES", 136, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$DESC = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$DESC", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$DESC", 137, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$SCHEMA$36$95$36$FOR$36$95$36$SCHEMA$36$$95$S$95$$36$DESCRIPTOR$36$$95$S$95$$36$FIELD$36$$95$$95$$36$DEFAULTS = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$DEFAULTS", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$SCHEMA$95$FOR$95$SCHEMA$_S_$DESCRIPTOR$_S_$FIELD$__$DEFAULTS", 138, true, null); NotRequired = (have_ParentAppControl) ? singleSymbol_Factory.createNew("NotRequired", true) : singleSymbol_Factory.createNew("NotRequired", 156, true, null); IsRequired = (have_ParentAppControl) ? singleSymbol_Factory.createNew("IsRequired", true) : singleSymbol_Factory.createNew("IsRequired", 157, true, null); NotSelected = (have_ParentAppControl) ? singleSymbol_Factory.createNew("NotSelected", true) : singleSymbol_Factory.createNew("NotSelected", 171, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$REQUIRED = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$WEB$__$FORM$_S_$FORM$__$REQUIRED", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$WEB$__$FORM$_S_$FORM$__$REQUIRED", 172, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$SELECT = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$WEB$__$FORM$_S_$FORM$__$SELECT", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$WEB$__$FORM$_S_$FORM$__$SELECT", 173, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$WEB$36$$95$$95$$36$FORM$36$$95$S$95$$36$FORM$36$$95$$95$$36$SELECT$36$$95$S$95$$36$OPTION = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$WEB$__$FORM$_S_$FORM$__$SELECT$_S_$OPTION", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$WEB$__$FORM$_S_$FORM$__$SELECT$_S_$OPTION", 174, true, null); MyTestType = (have_ParentAppControl) ? singleSymbol_Factory.createNew("MyTestType", true) : singleSymbol_Factory.createNew("MyTestType", 200, true, null); net = (have_ParentAppControl) ? singleSymbol_Factory.createNew("net", true) : singleSymbol_Factory.createNew("net", 201, true, null); unconventionalthinking = (have_ParentAppControl) ? singleSymbol_Factory.createNew("unconventionalthinking", true) : singleSymbol_Factory.createNew("unconventionalthinking", 202, true, null); MyTestType2 = (have_ParentAppControl) ? singleSymbol_Factory.createNew("MyTestType2", true) : singleSymbol_Factory.createNew("MyTestType2", 203, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$TEST$36$$95$$95$$36$SCHEMA$36$$95$S$95$$36$MY$36$95$36$DESC$36$$95$$95$$36$NUM1 = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$TEST$__$SCHEMA$_S_$MY$95$DESC$__$NUM1", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$TEST$__$SCHEMA$_S_$MY$95$DESC$__$NUM1", 207, true, null); FieldSetTuple$95$$95$net$36$$95$$95$$36$unconventionalthinking$36$$95$$95$$36$matrix$36$$95$CC$95$$36$TEST$36$$95$$95$$36$SCHEMA$36$$95$S$95$$36$MY$36$95$36$DESC$36$$95$$95$$36$NUM2 = (have_ParentAppControl) ? singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$TEST$__$SCHEMA$_S_$MY$95$DESC$__$NUM2", true) : singleSymbol_Factory.createNew("FieldSetTuple__net$__$unconventionalthinking$__$matrix$_CC_$TEST$__$SCHEMA$_S_$MY$95$DESC$__$NUM2", 208, true, null); // MultiPart Symbols _________________________________________________________________________ // `ContinuationType`.`byte` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("byte"); ContinuationType$__$byte = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 34, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`short` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("short"); ContinuationType$__$short = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 35, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`int` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("int"); ContinuationType$__$int = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 36, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`long` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("long"); ContinuationType$__$long = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 37, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`float` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("float"); ContinuationType$__$float = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 38, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`double` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("double"); ContinuationType$__$double = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 39, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`char` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("char"); ContinuationType$__$char = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 40, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`boolean` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("boolean"); ContinuationType$__$boolean = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 41, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`String` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("String"); ContinuationType$__$String = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 42, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`Object` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("Object"); ContinuationType$__$Object = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 43, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`Symbol` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("Symbol"); ContinuationType$__$Symbol = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 44, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`DescriptorTagName` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("DescriptorTagName"); ContinuationType$__$DescriptorTagName = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 45, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `ContinuationType`.`Label` symbolStrings = new ArrayList<String>(); symbolStrings.add("ContinuationType"); symbolStrings.add("Label"); ContinuationType$__$Label = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 46, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `net`.`unconventionalthinking` symbolStrings = new ArrayList<String>(); symbolStrings.add("net"); symbolStrings.add("unconventionalthinking"); net$__$unconventionalthinking = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 205, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); // `net`.`unconventionalthinking`.`MyTestType2` symbolStrings = new ArrayList<String>(); symbolStrings.add("net"); symbolStrings.add("unconventionalthinking"); symbolStrings.add("MyTestType2"); net$__$unconventionalthinking$__$MyTestType2 = (have_ParentAppControl) ? multiPartSymbol_Factory.createNew(symbolStrings, 206, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols) : multiPartSymbol_Factory.createNew(symbolStrings, creation_StartLevel, creation_Has_StaticVersion, have_Created_New_MultiPartSymbol, newlyCreatedSymbols); have_Intialized = true; } }
[ "github@unconventionalthinking.com" ]
github@unconventionalthinking.com
57486a3ccd561f06931371a8e8fb1a28f35255bd
613d4ac6b2e99f3ee9c84ad77822f79c2a4cc068
/iscript-core/iscript-core-match/src/test/java/com/lezo/iscript/match/algorithm/tokenizer/UnitTokenizerTest.java
a5472fc06dbf22c83f96442bca86082393397bb4
[]
no_license
juan8510/iscript
dd6b881bda5db2c4b34a45068f2dc13a64c2e9ca
352c6344b4fbed225df2ff36957ea420c2b5f4ba
refs/heads/master
2021-01-16T22:50:42.368044
2015-12-07T04:01:39
2015-12-07T04:01:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,776
java
package com.lezo.iscript.match.algorithm.tokenizer; import java.util.List; import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.lezo.iscript.match.pojo.CellToken; public class UnitTokenizerTest { UnitTokenizer tokenizer = new UnitTokenizer(); @Test public void testUnitTokenizer_en() { String origin = "肌言堂 水漾肌HA精华原液30ml/瓶"; List<CellToken> tokens = tokenizer.token(origin); System.out.println("origin:" + origin); System.out.println("size:" + tokens.size()); System.out.println("result:" + ArrayUtils.toString(tokens)); String validate = "30ml"; boolean hasCell = false; for (CellToken token : tokens) { if (validate.equals(token.getValue())) { hasCell = true; break; } } Assert.assertEquals(true, hasCell); } @Test public void testUnitTokenizer_cn() { // 单位前是字母,目前无法切出单位 // String origin = "Depend得伴 成人纸尿裤(超强吸收型)中号M10片×6包"; String origin = "Depend得伴 成人纸尿裤(超强吸收型)中号M纸尿裤 10片×6包"; List<CellToken> tokens = tokenizer.token(origin); System.out.println("origin:" + origin); System.out.println("size:" + tokens.size()); System.out.println("result:" + ArrayUtils.toString(tokens)); String validate = "10片"; boolean hasCell = false; for (CellToken token : tokens) { if (validate.equals(token.getValue())) { hasCell = true; break; } } Assert.assertEquals(true, hasCell); } }
[ "lcstore" ]
lcstore
39c77ea71c87a5ed672ec04f6a06cc88b44ada5e
9b2f53b63fe5cd2a223fdf72486ef80e41f0313b
/src/main/java/com/andy/recipe/model/UnitOfMeasure.java
c0fb1f7c14298439bbf41e5e65dd33a771cd0d06
[]
no_license
brokorenko/recipe
ae079caa5f17f8004e9a9d7d6cc498d4db5a137c
74b73523b16e05548c75e515a1a1fd67724c1aae
refs/heads/master
2020-04-03T03:17:35.085561
2018-10-31T14:01:23
2018-10-31T14:01:23
154,981,462
0
0
null
2018-10-31T14:01:25
2018-10-27T15:49:09
Java
UTF-8
Java
false
false
341
java
package com.andy.recipe.model; import javax.persistence.*; @Entity public class UnitOfMeasure { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "brokorenko@gmail.com" ]
brokorenko@gmail.com
d0721e0ebcf03def4a07f8445347f66d79d26576
40f500cd396bf84db3d130b9b6ea731378024dc8
/src/main/java/com/ms/et/initdata/InitDataLoader.java
0f172d5e0e9d7dd72ad508b76cd8ce6e2a88c939
[]
no_license
FGM-148/eqtrack
d89899fa620c84e3113bdc339bc43305994f2a82
e1f430cb39d2c08a0e4f2de641330010766bc542
refs/heads/master
2020-03-28T20:05:27.380467
2018-10-06T08:42:30
2018-10-06T08:42:30
149,037,596
0
0
null
null
null
null
UTF-8
Java
false
false
10,756
java
package com.ms.et.initdata; import com.ms.et.domain.*; import com.ms.et.repositories.*; import com.ms.et.services.CompanyService; import com.ms.et.services.ItemService; import com.ms.et.services.ProjectService; import org.kohsuke.randname.RandomNameGenerator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Lazy; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.sql.Date; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; @Component public class InitDataLoader implements ApplicationListener<ContextRefreshedEvent> { private boolean alreadySetup = false; @Autowired private UserRepository userRepository; @Autowired private RoleRepository roleRepository; @Autowired private PrivilegeRepository privilegeRepository; @Autowired private ItemRepository itemRepository; @Autowired private AddressRepository addressRepository; @Autowired private ItemService itemService; @Autowired private CompanyService companyService; @Autowired private ProjectService projectService; @Autowired @Lazy private PasswordEncoder passwordEncoder; @Override @Transactional public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadySetup) { return; } // == create initial privileges Privilege readPrivilege = createPrivilegeIfNotFound("READ_ITEM_PRIVILEGE"); Privilege writePrivilege = createPrivilegeIfNotFound("WRITE_ITEM_PRIVILEGE"); Privilege editPrivilege = createPrivilegeIfNotFound("EDIT_ITEM_PRIVILEGE"); List<String> allPrivsInStirngList = Arrays.asList( "READ_ITEM", "WRITE_ITEM", "ITEM_LIST", "READ_COMPANY", "WRITE_COMPANY", "READ_OWN_PROJECT", "WRITE_OWN_PROJECT", "READ_ROLE", "WRITE_ROLE", "READ_PRIVILEGE", "WRITE_PRIVILEGE", "READ_USER", "WRITE_USERS", "USER_LIST", "ITEM_LIST_BY_ADDRESS", "ITEM_LIST_BY_PROJECT", "ITEM_LIST_BY_COMPANY", "ITEM_LIST_BY_USER", "PROJECT_LIST_BY_OWNER", "ITEM_LIST_BY_OWNER", "ASSIGN_ITEM_TO_USER", "ASSIGN_ITEM_TO_PROJECT", "ASSIGN_ITEM_TO_STORAGE", "ASSIGN_PROJECT_AS_OWN", "ASSIGN_ITEM_TO_ME"); List<String> adminPrivsInStringList = Arrays.asList( "READ_ROLE", "WRITE_ROLE", "READ_PRIVILEGE", "WRITE_PRIVILEGE", "READ_USER", "WRITE_USERS", "USER_LIST"); List<String> ictPrivsInStirngList = Arrays.asList( "READ_ITEM", "WRITE_ITEM", "ITEM_LIST", "READ_COMPANY", "WRITE_COMPANY", "READ_USER", "ITEM_LIST_BY_ADDRESS", "ITEM_LIST_BY_PROJECT", "ITEM_LIST_BY_COMPANY", "ITEM_LIST_BY_USER", "ASSIGN_ITEM_TO_STORAGE"); List<String> managerPrivsInStringList = Arrays.asList( "READ_ITEM", "ITEM_LIST", "READ_OWN_PROJECT", "WRITE_OWN_PROJECT", "READ_USER", "ITEM_LIST_BY_USER", "PROJECT_LIST_BY_OWNER", "ITEM_LIST_BY_OWNER", "ASSIGN_ITEM_TO_PROJECT", "ASSIGN_PROJECT_AS_OWN", "ASSIGN_ITEM_TO_ME"); List<String> userPrivsInStirngList = Arrays.asList( "READ_ITEM", "ITEM_LIST", "READ_USER", "ITEM_LIST_BY_OWNER", "ASSIGN_ITEM_TO_ME"); createPriviligesIfNotFoundFromList(allPrivsInStirngList); // == create initial roles List<Privilege> adminPrivileges = Arrays.asList(readPrivilege, writePrivilege, editPrivilege); List<Privilege> rolePrivileges = Arrays.asList(readPrivilege); createRoleIfNotFound("ADMINISTRATOR", adminPrivsInStringList); createRoleIfNotFound("PROJECT MANAGER", managerPrivsInStringList); createRoleIfNotFound("USER", userPrivsInStirngList); createRoleIfNotFound("TECHNICAL SPECIALIST", ictPrivsInStirngList); Role managerRole = roleRepository.findByName("PROJECT MANAGER"); User manager = new User(); manager.setName("m"); manager.setEmail("manager@test.com"); manager.setFirstName("Jan"); manager.setLastName("Kowalski"); manager.setPassword(passwordEncoder.encode("a")); manager.setRoles(Arrays.asList(managerRole)); manager.setEnabled(true); createUserIfNotFound(manager); Role adminRole = roleRepository.findByName("ADMINISTRATOR"); User user = new User(); user.setName("a"); user.setFirstName("Adam"); user.setLastName("Nowak"); user.setEmail("admin@test.com"); user.setPassword(passwordEncoder.encode("a")); user.setRoles(Arrays.asList(adminRole)); user.setEnabled(true); createUserIfNotFound(user); Role basicRole = roleRepository.findByName("USER"); User basicUser = new User(); basicUser.setName("p"); basicUser.setFirstName("Marek"); basicUser.setLastName("Marecki"); basicUser.setEmail("user@test.com"); basicUser.setPassword(passwordEncoder.encode("a")); basicUser.setRoles(Arrays.asList(basicRole)); basicUser.setEnabled(true); createUserIfNotFound(basicUser); Role ictRole = roleRepository.findByName("TECHNICAL SPECIALIST"); User ictUser = new User(); ictUser.setName("i"); ictUser.setFirstName("Frodo"); ictUser.setLastName("Baggins"); ictUser.setEmail("ict@test.com"); ictUser.setPassword(passwordEncoder.encode("a")); ictUser.setRoles(Arrays.asList(ictRole)); ictUser.setEnabled(true); createUserIfNotFound(ictUser); User twoRoles = new User(); twoRoles.setName("dwierole"); twoRoles.setFirstName("Rafał"); twoRoles.setLastName("Nafalski"); twoRoles.setEmail("rafal@test.com"); twoRoles.setPassword(passwordEncoder.encode("a")); twoRoles.setRoles(Arrays.asList(adminRole, ictRole)); twoRoles.setEnabled(true); createUserIfNotFound(twoRoles); createCompany(); createProjects(manager); createItems(basicUser); alreadySetup = true; } @Transactional private User createUserIfNotFound(User user) { if (userRepository.findByName(user.getName()) != null) return null; userRepository.save(user); return user; } @Transactional private Privilege createPrivilegeIfNotFound(String name) { Privilege privilege = privilegeRepository.findByName(name); if (privilege == null) { privilege = new Privilege(); privilege.setName(name); privilegeRepository.save(privilege); } return privilege; } @Transactional private Role createRoleIfNotFound(String name, List<String> privilegesInStrings) { Role role = roleRepository.findByName(name); List<Privilege> privileges = new ArrayList<>(); if (role == null) { role = new Role(); role.setName(name); for (String p : privilegesInStrings) { Privilege priv = privilegeRepository.findByName(p); privileges.add(priv); } role.setPrivileges(privileges); roleRepository.save(role); } return role; } @Transactional private void createPriviligesIfNotFoundFromList(List<String> pList) { List<Privilege> privs = new ArrayList<>(); for (String pName : pList) { if (privilegeRepository.findByName(pName)==null) { Privilege p = new Privilege(); p.setName(pName); privs.add(p); } } privilegeRepository.saveAll(privs); } @Transactional private Address createAddress() { RandomNameGenerator rnd = new RandomNameGenerator(323); Address address = new Address(); address.setStreet(rnd.next()); address.setCity(rnd.next()); address.setCountry("Poland"); Random r = new Random(); address.setNumber(new Integer(r.nextInt((1000 - 1) + 1) + 1).toString()); address.setPostalCode(r.nextInt((1000 - 1) + 1) + 1); addressRepository.save(address); return address; } @Transactional private void createItems(User user) { RandomNameGenerator rnd = new RandomNameGenerator(0); for (int i = 1; i < 101; i++) { Item item = new Item(); item.setInternalNumber("F1000" + i); item.setName(rnd.next()); item.setSerialNumber("S/N 23847" + rnd.next()); Address address = createAddress(); item.setSourceOfDelivery(address); item.setDeliveryDate(new Date(30, 30, 2000)); if (i != 68 && i != 2 && i!= 50) { item.setInStorage(true); } else { item.setInStorage(false); item.setUser(user); item.setProject(projectService.getById(new Long (1))); } itemService.saveOrUpdate(item); } } @Transactional private void createCompany() { RandomNameGenerator rnd = new RandomNameGenerator(11); Company company = new Company(); company.setAddress(createAddress()); company.setName("teito"); companyService.saveOrUpdate(company); for (int i =0; i<10; i++) { Company companyr = new Company(); companyr.setAddress(createAddress()); companyr.setName(rnd.next()); companyService.saveOrUpdate(companyr); } } @Transactional private void createProjects(User user) { RandomNameGenerator rnd = new RandomNameGenerator(45); for (int i = 0; i < 5; i++) { Project project = new Project(); project.setName(rnd.next()); project.setCompany(companyService.getById(new Long(i))); project.setUser(user); projectService.saveOrUpdate(project); } } }
[ "maciej.siekierda@gmail.com" ]
maciej.siekierda@gmail.com
d5bb64e5fbeac4ca8169e2500b2c97a718929608
588944fafb1178ce48c5e50fa02291b8e23ce159
/src/com/codegym/service/CustomerService.java
3c7f716a0ebd48d7847138970952428f4b32933d
[]
no_license
KhoiPham1/java-web-mvc
c8e2a35fd49ae146da71b0f0d22a16c681c5fe43
3764a408b3344878b1e8826ecf4bf591dbfdfbbf
refs/heads/master
2020-04-09T10:59:40.221489
2018-12-04T03:28:15
2018-12-04T03:28:15
160,290,980
0
1
null
null
null
null
UTF-8
Java
false
false
294
java
package com.codegym.service; import com.codegym.model.Customer; import java.util.List; public interface CustomerService { List<Customer> findAll(); void save(Customer customer); Customer findById(int id); void update(int id, Customer customer); void remove(int id); }
[ "khoi171195@gmail.com" ]
khoi171195@gmail.com
abf88e6edc9041580d964e86ca951c0c7557d2e5
a4469318865d15dd57cc7e8248838861d47e81fe
/branch/crm-service-utils/src/main/java/com/np/tele/crm/pojos/CrmMasterPojo.java
34517947c386337a70508cb976be4a8eac2f5ec3
[]
no_license
shailendrasemilo/Timbl
f002efa9c39470302fce66492cfabd3d8a1b4379
f6a13de62694db287afa464303b0d0c7afbab6ed
refs/heads/master
2023-01-04T15:51:48.001632
2020-11-03T05:30:38
2020-11-03T05:30:38
309,582,556
0
0
null
null
null
null
UTF-8
Java
false
false
7,515
java
package com.np.tele.crm.pojos; // Generated 5 Jul, 2013 11:15:37 AM by Hibernate Tools 3.4.0.CR1 import java.util.Date; /** * CrmMaster generated by hbm2java */ public class CrmMasterPojo implements java.io.Serializable { private long categoryId; private String category; private String subCategory; private String subSubCategory; private String categoryAlias; private String categoryValue; private String createdBy; private Date createdTime; private String lastModifiedBy; private Date lastModifiedTime; private String status; private String dataType; private String displayCreatedTime; private String displayLastModifiedTime; public CrmMasterPojo() { } public CrmMasterPojo( long categoryId, String category, String subCategory, String subSubCategory, String categoryValue, String createdBy, String lastModifiedBy, Date lastModifiedTime ) { this.categoryId = categoryId; this.category = category; this.subCategory = subCategory; this.subSubCategory = subSubCategory; this.categoryValue = categoryValue; this.createdBy = createdBy; this.lastModifiedBy = lastModifiedBy; this.lastModifiedTime = lastModifiedTime; } public CrmMasterPojo( long categoryId, String category, String subCategory, String subSubCategory, String categoryAlias, String categoryValue, String createdBy, Date createdTime, String lastModifiedBy, Date lastModifiedTime, String status ) { this.categoryId = categoryId; this.category = category; this.subCategory = subCategory; this.subSubCategory = subSubCategory; this.categoryAlias = categoryAlias; this.categoryValue = categoryValue; this.createdBy = createdBy; this.createdTime = createdTime; this.lastModifiedBy = lastModifiedBy; this.lastModifiedTime = lastModifiedTime; this.status = status; } public String getDataType() { return dataType; } public void setDataType( String inDataType ) { dataType = inDataType; } public long getCategoryId() { return categoryId; } public void setCategoryId( long categoryId ) { this.categoryId = categoryId; } public String getCategory() { return this.category; } public void setCategory( String category ) { this.category = category; } public String getSubCategory() { return this.subCategory; } public void setSubCategory( String subCategory ) { this.subCategory = subCategory; } public String getSubSubCategory() { return this.subSubCategory; } public void setSubSubCategory( String subSubCategory ) { this.subSubCategory = subSubCategory; } public String getCategoryAlias() { return this.categoryAlias; } public void setCategoryAlias( String categoryAlias ) { this.categoryAlias = categoryAlias; } public String getCategoryValue() { return this.categoryValue; } public void setCategoryValue( String categoryValue ) { this.categoryValue = categoryValue; } public String getCreatedBy() { return this.createdBy; } public void setCreatedBy( String createdBy ) { this.createdBy = createdBy; } public Date getCreatedTime() { return this.createdTime; } public void setCreatedTime( Date inCreatedTime ) { createdTime = inCreatedTime; /* if ( StringUtils.isEmpty( displayCreatedTime ) && StringUtils.isValidObj( createdTime ) ) { displayCreatedTime = IDateConstants.SDF_DD_MMM_YYYY_HH_MM_SS.format( createdTime ); }*/ } public String getLastModifiedBy() { return this.lastModifiedBy; } public void setLastModifiedBy( String lastModifiedBy ) { this.lastModifiedBy = lastModifiedBy; } public Date getLastModifiedTime() { return this.lastModifiedTime; } public void setLastModifiedTime( Date inLastModifiedTime ) { lastModifiedTime = inLastModifiedTime; /*if ( StringUtils.isEmpty( displayLastModifiedTime ) && StringUtils.isValidObj( lastModifiedTime ) ) { displayLastModifiedTime = IDateConstants.SDF_DD_MMM_YYYY_HH_MM_SS.format( lastModifiedTime ); }*/ } public String getStatus() { return this.status; } public void setStatus( String status ) { this.status = status; } public String getDisplayCreatedTime() { return displayCreatedTime; } public void setDisplayCreatedTime( String inDisplayCreatedTime ) { displayCreatedTime = inDisplayCreatedTime; } public String getDisplayLastModifiedTime() { return displayLastModifiedTime; } public void setDisplayLastModifiedTime( String inDisplayLastModifiedTime ) { displayLastModifiedTime = inDisplayLastModifiedTime; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append( "CrmMasterPojo [categoryId=" ).append( categoryId ).append( ", category=" ).append( category ) .append( ", subCategory=" ).append( subCategory ).append( ", subSubCategory=" ).append( subSubCategory ) .append( ", categoryAlias=" ).append( categoryAlias ).append( ", categoryValue=" ) .append( categoryValue ).append( ", createdBy=" ).append( createdBy ).append( ", createdTime=" ) .append( createdTime ).append( ", lastModifiedBy=" ).append( lastModifiedBy ) .append( ", lastModifiedTime=" ).append( lastModifiedTime ).append( ", status=" ).append( status ) .append( "]" ); return builder.toString(); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( ( categoryAlias == null ) ? 0 : categoryAlias.hashCode() ); result = prime * result + ( ( subSubCategory == null ) ? 0 : subSubCategory.hashCode() ); return result; } @Override public boolean equals( Object obj ) { if ( this == obj ) return true; if ( obj == null ) return false; if ( getClass() != obj.getClass() ) return false; CrmMasterPojo other = (CrmMasterPojo) obj; if ( categoryAlias == null ) { if ( other.categoryAlias != null ) return false; } else if ( !categoryAlias.equals( other.categoryAlias ) ) return false; if ( subSubCategory == null ) { if ( other.subSubCategory != null ) return false; } else if ( !subSubCategory.equals( other.subSubCategory ) ) return false; return true; } }
[ "shailendrasemilo@gmail.com" ]
shailendrasemilo@gmail.com
eea9eeececddc40fee27531c80bfae9fdc0c0abe
93de0f492db1a5105c51d76d66ab78429d1d4edb
/gateway/src/main/java/io/study/gateway/interceptor/FilterLoader.java
639f3c3ba761f5815306c0f9809c7c318d0a4cec
[]
no_license
wangjingf/onlyforstudy
5a7cb0538f3277e7180f113d2bbfc0ca23b9ed07
ef19167138836957d3de72bcbee35b8b6ac15732
refs/heads/master
2022-12-21T09:55:23.673174
2022-01-15T07:40:21
2022-01-15T07:40:21
107,334,182
1
1
null
2022-12-10T06:23:12
2017-10-17T23:16:45
Java
UTF-8
Java
false
false
1,533
java
package io.study.gateway.interceptor; import com.jd.vd.common.exception.BizException; import java.util.ArrayList; import java.util.List; /** * filters数量刚才是固定的,只能有这么多,动态加的一下配置在filters里再做处理吧,可以再进行 二级封装,非线程安全 */ public class FilterLoader { ArrayList<IFilter> filters = new ArrayList<>(); public void addLast(IFilter filter){ assert filter != null; filters.add(filter); } public void addFirst(IFilter filter){ assert filter != null; filters.add(0,filter); } int findIndexByKey(String name){ for (int i = 0; i < filters.size(); i++) { if(name.equals(filters.get(i).name())){ return i; } } return -1; } public void addBefore(String name, IFilter filter){ assert name != null; assert filter != null; int index = findIndexByKey(name); if(index == -1){ throw new BizException("found invalid filter name:"+name); } filters.add(index,filter); } public void addAfter(String name, IFilter filter){ assert name != null; assert filter != null; int index = findIndexByKey(name); if(index == -1){ throw new BizException("found invalid filter name:"+name); } filters.add(index+1,filter); } public List<IFilter> getFilters(){ return filters; } }
[ "wangjingfang3@jd.com" ]
wangjingfang3@jd.com
247a86d008b511c6b6bbb37b76fbad7bf12b854f
d5a78cc4b2f456d863de50656b2986f95200f00f
/app/src/main/java/com/e/maintabactivity/PrivateTripActivity.java
63bf0e8ddf8b257c2b54e9c875f3251aa9b9541d
[]
no_license
TNaeem/TripAdvert
9b404a21d49e2e02eb1b8edabcfedb889ecd10f0
a61f3c8141164c1525957425e727cc161002b3f4
refs/heads/master
2022-10-14T20:09:03.197449
2020-06-12T21:35:10
2020-06-12T21:35:10
259,290,766
0
0
null
null
null
null
UTF-8
Java
false
false
5,985
java
package com.e.maintabactivity; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import android.Manifest; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Intent; import android.content.pm.PackageManager; import android.icu.util.DateInterval; import android.location.Address; import android.location.Location; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.DatePicker; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.android.material.button.MaterialButton; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textview.MaterialTextView; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; public class PrivateTripActivity extends AppCompatActivity { private static final String TAG = "PrivateTripActivity"; private static int ERROR_DIALOG_REQUEST = 9001; private MaterialButton mDepartureDateBtn; private MaterialButton mArrivalDateBtn; private MaterialTextView mDepartureDateTextView; private MaterialTextView mArrivalDateTextView; private TextInputEditText mDepartureLocation; private TextInputEditText mDestinationLocation; private TextInputEditText mTripTitle; private TextInputEditText mPassengersCount; private TextInputEditText mBudget; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_private_trip); bindView(); mDepartureDateBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Calendar myCalendar = Calendar.getInstance(); DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy", Locale.US); String mDateStr = sdf.format(myCalendar.getTime()); long d = new Date().getTime(); long d1 = myCalendar.getTime().getTime(); long diff = d1 - d; Log.d(TAG, "Difference " + diff); mDepartureDateTextView.setText(mDateStr); } }; new DatePickerDialog(PrivateTripActivity.this, date, myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show(); } }); mArrivalDateBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Calendar myCalendar = Calendar.getInstance(); DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy", Locale.US); String mDateStr = sdf.format(myCalendar.getTime()); Toast.makeText(PrivateTripActivity.this, "Arrival Time " + myCalendar.getTime(), Toast.LENGTH_SHORT).show(); mArrivalDateTextView.setText(mDateStr); } }; new DatePickerDialog(PrivateTripActivity.this, date, myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show(); } }); } public void bindView(){ mTripTitle = findViewById(R.id.activity_private_trip_title); mPassengersCount = findViewById(R.id.activity_private_trip_passengers_count); mBudget = findViewById(R.id.activity_private_trip_budget); mDepartureDateBtn = findViewById(R.id.activity_private_trip_departure_date_btn); mArrivalDateBtn = findViewById(R.id.activity_private_trip_arrival_date_btn); mDepartureDateTextView = findViewById(R.id.activity_private_trip_departure_date_text); mArrivalDateTextView = findViewById(R.id.activity_private_trip_arrival_date_text); mDepartureLocation = findViewById(R.id.private_trip_activity_departure_location); mDestinationLocation = findViewById(R.id.private_trip_activity_destination); } }
[ "talhanaeem395@gmail.com" ]
talhanaeem395@gmail.com
4601aad95e41d4165be79346b76b362645e5c3f3
8391818059e1ff4fef436b77a3dd62a131d1c813
/VirtualnySensor/src/main/java/com/mycompany/virtualnysensor/Sensor.java
b5fe3b023f26f1ed97fedd8081480e282099e7f2
[]
no_license
ChilyB/IoT
a6fc3579bfcaedbd3d7d1f0a9791690ed4be8bf1
c5d213a5e7927fc986e41240ba9655164503fecc
refs/heads/master
2021-01-25T08:19:29.839147
2017-06-11T11:51:37
2017-06-11T11:51:37
93,753,757
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 com.mycompany.virtualnysensor; import java.io.IOException; import java.util.Optional; import java.util.Scanner; import org.apache.http.HttpResponse; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.HttpClientBuilder; /** * Trieda obsahuje základnú metódu na odosielanie dát na server, slúži ako virtuálny senzor. Po spustení si vyžiada dáta na odoslanie na server. * Argument pri spustení je url na server, kde sa majú dáta odoslať. Defaultne je zadaná adresa http://localhost:8080/data . * @author Branislav */ public class Sensor { static CredentialsProvider provider = new BasicCredentialsProvider(); static UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("admin", "secret"); static HttpClient httpClient; static Scanner scanner = new Scanner(System.in).useDelimiter("\\s"); static boolean run = true; public static void main (String [] args){ provider.setCredentials(AuthScope.ANY, credentials); httpClient = HttpClientBuilder.create().setDefaultCredentialsProvider(provider).build(); boolean err = false; while (run){ System.out.println("int:idZariadenia string:nazov double:hodnota string:jednotka"); if(scanner.hasNext("exit")){ run = false; }else{ if(scanner.hasNextInt()){ int idZariadenia = scanner.nextInt(); if(scanner.hasNext()){ String nazov = scanner.next(); if(scanner.hasNextDouble()){ double hodnota = scanner.nextDouble(); if(scanner.hasNext()){ String jednotka = scanner.next(); System.out.println(posliData(1, idZariadenia, nazov, hodnota, jednotka,"0",args[0])); }else{err=true;} }else{err=true;} }else{err=true;} }else{err=true;} scanner.nextLine(); if(err){ if(scanner.hasNext("exit")){ run = false; } scanner.nextLine(); err = false; System.out.println("Zly zapis!"); } } } System.exit(0); } /** * Statická metóda slúžiaca na poslanie dát na server. Data odosiela vo formáte JSON funkciou POST. * @param id id odosielanych dát, nezáleží na hodnote, nie je využite a je pri prenose prepísané * @param idZariadenia id zariadenia,ku ktorému budú dáta pridelené * @param nazov názov typu dát (napr. teplota, tlak) * @param hodnota číselná hodnota * @param jednotka jednotka v ktorej, sú dáta vyjadrené * @param datum dátum vytvorenia zápisu, nezaleži na hodnote je na serveri prepísaná * @param url nepovinné zadanie adresy serveru, ak obsahuje null, bude využitá základná adresa http://localhost:8080/data * @return vracia String obsahujúci správu o vykonanej akcií */ static public String posliData(int id,int idZariadenia,String nazov,double hodnota,String jednotka, String datum, String url){ HttpResponse odpoved; try{ HttpPost postdata; if(!url.equals("")){ postdata = new HttpPost(url); }else{ postdata = new HttpPost("http://localhost:8080/data"); } StringEntity parametre = new StringEntity("{\"id\": "+id+",\"idZariadenia\": "+idZariadenia+",\"nazov\": \""+nazov+"\",\"hodnota\": "+hodnota+",\"jednotka\": \""+jednotka+"\",\"datum\": \""+datum+"\"}"); postdata.addHeader("content-type", "application/json"); postdata.setEntity(parametre); odpoved = httpClient.execute(postdata); }catch(IOException e){ return e.getLocalizedMessage(); } return odpoved.toString(); } }
[ "noreply@github.com" ]
ChilyB.noreply@github.com
fc3f73a3bd0a744639a9503dfce6b8504bd6215a
e9057a9ba387eadf55e83ce006507523be62ce77
/app/src/main/java/com/hb/mydietcoach/activity/challenge/NewChallengeActivity.java
824cd01afc9152847e4569f7405172ec362af725
[]
no_license
hungnb94/MyDietCoach
e145d48b62cd64a420ccb3511bb582e3385dacbe
3684a99f15ffb3b39a7e38890c7846ca4b5a4630
refs/heads/master
2020-03-18T23:01:43.964319
2018-07-18T09:51:47
2018-07-18T09:51:47
135,379,030
0
0
null
null
null
null
UTF-8
Java
false
false
2,839
java
package com.hb.mydietcoach.activity.challenge; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.hb.mydietcoach.R; import com.hb.mydietcoach.activity.BaseActivity; import com.hb.mydietcoach.database.MyDatabase; import com.hb.mydietcoach.model.challenge.NormalChallenge; import com.hb.mydietcoach.utils.Constants; import butterknife.ButterKnife; import butterknife.OnClick; public class NewChallengeActivity extends BaseActivity { private MyDatabase database; private EditText editText; //Funcion alert private LinearLayout llAlert; private TextView tvAlert; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_challenge); database = new MyDatabase(this); initView(); } private void initView() { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(R.string.create_challenge); getSupportActionBar().setDisplayHomeAsUpEnabled(true); editText = findViewById(R.id.editText); //Alert function llAlert = findViewById(R.id.llAlert); tvAlert = findViewById(R.id.tvAlert); tvAlert.setText(R.string.you_did_not_enter_challenge_text); ButterKnife.bind(this); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { setResult(RESULT_CANCELED); finish(); } return super.onOptionsItemSelected(item); } @OnClick(R.id.btnSave) void clickSave(View view) { String strContent = editText.getText().toString(); if (TextUtils.isEmpty(strContent)){ llAlert.setVisibility(View.VISIBLE); return; } NormalChallenge challenge = new NormalChallenge(); challenge.setTotalCount(Constants.DEFAULT_MY_CHALLENGE) .setUnit(getString(R.string.times)) .setImageId(R.drawable.challenges_general_after) .setTitle(strContent) .setStars(Constants.STARS_FOR_MY_CHALLENGE) .setType(Constants.CHALLENGE_TYPE_OF_MY); long id =database.insertChallenge(challenge); challenge.setId(id); Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putSerializable(Constants.DATA_SERIALIZABLE, challenge); intent.putExtras(bundle); setResult(RESULT_OK, intent); finish(); } }
[ "hungnb94@gmail.com" ]
hungnb94@gmail.com
b2827ade7234f390f1564a21ed8a569c6ae1d744
86505462601eae6007bef6c9f0f4eeb9fcdd1e7b
/bin/modules/web-content-management-system/cmsfacades/testsrc/de/hybris/platform/cmsfacades/workflow/populator/CMSWorkflowDataPopulatorTest.java
f1c3d1440538c4f9d23c59f82fc09007c08160a0
[]
no_license
jp-developer0/hybrisTrail
82165c5b91352332a3d471b3414faee47bdb6cee
a0208ffee7fee5b7f83dd982e372276492ae83d4
refs/heads/master
2020-12-03T19:53:58.652431
2020-01-02T18:02:34
2020-01-02T18:02:34
231,430,332
0
4
null
2020-08-05T22:46:23
2020-01-02T17:39:15
null
UTF-8
Java
false
false
2,147
java
/* * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. */ package de.hybris.platform.cmsfacades.workflow.populator; import static java.lang.Boolean.TRUE; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import de.hybris.bootstrap.annotations.UnitTest; import de.hybris.platform.cmsfacades.data.CMSWorkflowData; import de.hybris.platform.cms2.workflow.service.CMSWorkflowParticipantService; import de.hybris.platform.cronjob.enums.CronJobStatus; import de.hybris.platform.workflow.WorkflowTemplateService; import de.hybris.platform.workflow.model.WorkflowModel; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; @UnitTest @RunWith(MockitoJUnitRunner.class) public class CMSWorkflowDataPopulatorTest { private final String WORKFLOW_CODE = "some code"; private final String WORKFLOW_DESCRIPTION = "some description"; private CronJobStatus cronJobStatus; @Mock private WorkflowModel workflowModel; @Mock private CMSWorkflowData workflowData; @Mock private CMSWorkflowParticipantService cmsWorkflowParticipantService; @Mock private WorkflowTemplateService workflowTemplateService; @InjectMocks private CMSWorkflowDataPopulator cmsWorkflowDataPopulator; @Before public void setUp() { cronJobStatus = CronJobStatus.RUNNING; when(workflowModel.getCode()).thenReturn(WORKFLOW_CODE); when(workflowModel.getStatus()).thenReturn(cronJobStatus); when(workflowModel.getDescription()).thenReturn(WORKFLOW_DESCRIPTION); when(cmsWorkflowParticipantService.isWorkflowParticipant(workflowModel)).thenReturn(TRUE); } @Test public void WhenPopulateIsCalled_ThenItAddsAllTheRequiredInformation() { // WHEN cmsWorkflowDataPopulator.populate(workflowModel, workflowData); // THEN verify(workflowData).setWorkflowCode(WORKFLOW_CODE); verify(workflowData).setDescription(WORKFLOW_DESCRIPTION); verify(workflowData).setStatus(cronJobStatus.getCode()); verify(workflowData).setIsAvailableForCurrentPrincipal(TRUE); } }
[ "juan.gonzalez.working@gmail.com" ]
juan.gonzalez.working@gmail.com
eb60d251faa84d23d155e7b2669e384a8bb49379
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_31_buggy/mutated/2151/HtmlTreeBuilderState.java
5cc2962fb73280034ce23f48590ea4c10d8dd7dc
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
68,524
java
package org.jsoup.parser; import org.jsoup.helper.DescendableLinkedList; import org.jsoup.helper.StringUtil; import org.jsoup.nodes.*; import java.util.Iterator; import java.util.LinkedList; /** * The Tree Builder's current state. Each state embodies the processing for the state, and transitions to other states. */ enum HtmlTreeBuilderState { Initial { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { // todo: parse error check on expected doctypes // todo: quirk state check on doctype ids Token.Doctype d = t.asDoctype(); DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri()); tb.getDocument().appendChild(doctype); if (d.isForceQuirks()) tb.getDocument().quirksMode(Document.QuirksMode.quirks); tb.transition(BeforeHtml); } else { // todo: check not iframe srcdoc tb.transition(BeforeHtml); return tb.process(t); // re-process token } return true; } }, BeforeHtml { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); return false; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { tb.insert(t.asStartTag()); tb.transition(BeforeHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { return anythingElse(t, tb); } else if (t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.insert("html"); tb.transition(BeforeHead); return tb.process(t); } }, BeforeHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return InBody.process(t, tb); // does not transition } else if (t.isStartTag() && t.asStartTag().name().equals("head")) { Element head = tb.insert(t.asStartTag()); tb.setHeadElement(head); tb.transition(InHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { tb.process(new Token.StartTag("head")); return tb.process(t); } else if (t.isEndTag()) { tb.error(this); return false; } else { tb.process(new Token.StartTag("head")); return tb.process(t); } return true; } }, InHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return InBody.process(t, tb); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link")) { Element el = tb.insertEmpty(start); // jsoup special: update base the frist time it is seen if (name.equals("base") && el.hasAttr("href")) tb.maybeSetBaseUri(el); } else if (name.equals("meta")) { Element meta = tb.insertEmpty(start); // todo: charset switches } else if (name.equals("title")) { handleRcData(start, tb); } else if (StringUtil.in(name, "noframes", "style")) { handleRawtext(start, tb); } else if (name.equals("noscript")) { // else if noscript && scripting flag = true: rawtext (jsoup doesn't run script, to handle as noscript) tb.insert(start); tb.transition(InHeadNoscript); } else if (name.equals("script")) { // skips some script rules as won't execute them tb.tokeniser.transition(TokeniserState.ScriptData); tb.markInsertionMode(); tb.transition(Text); tb.insert(start); } else if (name.equals("head")) { tb.error(this); return false; } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("head")) { tb.pop(); tb.transition(AfterHead); } else if (StringUtil.in(name, "body", "html", "br")) { return anythingElse(t, tb); } else { tb.error(this); return false; } break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.process(new Token.EndTag("head")); return tb.process(t); } }, InHeadNoscript { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("noscript")) { tb.pop(); tb.transition(InHead); } else if (isWhitespace(t) || t.isComment() || (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "basefont", "bgsound", "link", "meta", "noframes", "style"))) { return tb.process(t, InHead); } else if (t.isEndTag() && t.asEndTag().name().equals("br")) { return anythingElse(t, tb); } else if ((t.isStartTag() && StringUtil.in(t.asStartTag().name(), "head", "noscript")) || t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); tb.process(new Token.EndTag("noscript")); return tb.process(t); } }, AfterHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { return tb.process(t, InBody); } else if (name.equals("body")) { tb.insert(startTag); tb.framesetOk(false); tb.transition(InBody); } else if (name.equals("frameset")) { tb.insert(startTag); tb.transition(InFrameset); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title")) { tb.error(this); Element head = tb.getHeadElement(); tb.push(head); tb.process(t, InHead); tb.removeFromStack(head); } else if (name.equals("head")) { tb.error(this); return false; } else { anythingElse(t, tb); } } else if (t.isEndTag()) { if (StringUtil.in(t.asEndTag().name(), "body", "html")) { anythingElse(t, tb); } else { tb.error(this); return false; } } else { anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.process(new Token.StartTag("body")); tb.framesetOk(true); return tb.process(t); } }, InBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: { Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { // todo confirm that check tb.error(this); return false; } else if (isWhitespace(c)) { tb.reconstructFormattingElements(); tb.insert(c); } else { tb.reconstructFormattingElements(); tb.insert(c); tb.framesetOk(false); } break; } case Comment: { tb.insert(t.asComment()); break; } case Doctype: { tb.error(this); return false; } case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { tb.error(this); // merge attributes onto real html Element html = tb.getStack().getFirst(); for (Attribute attribute : startTag.getAttributes()) { if (!html.hasAttr(attribute.getKey())) html.attributes().put(attribute); } } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title")) { return tb.process(t, InHead); } else if (name.equals("body")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else { tb.framesetOk(false); Element body = stack.get(1); for (Attribute attribute : startTag.getAttributes()) { if (!body.hasAttr(attribute.getKey())) body.attributes().put(attribute); } } } else if (name.equals("frameset")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else if (!tb.framesetOk()) { return false; // ignore frameset } else { Element second = stack.get(1); if (second.parent() != null) second.remove(); // pop up to html element while (stack.size() > 1) stack.removeLast(); tb.insert(startTag); tb.transition(InFrameset); } } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } if (StringUtil.in(tb.currentElement().nodeName(), "h1", "h2", "h3", "h4", "h5", "h6")) { tb.error(this); tb.pop(); } tb.insert(startTag); } else if (StringUtil.in(name, "pre", "listing")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); // todo: ignore LF if next token tb.framesetOk(false); } else if (name.equals("form")) { if (tb.getFormElement() != null) { tb.error(this); return false; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insertForm(startTag, true); } else if (name.equals("li")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (el.nodeName().equals("li")) { tb.process(new Token.EndTag("li")); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "dd", "dt")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (StringUtil.in(el.nodeName(), "dd", "dt")) { tb.process(new Token.EndTag(el.nodeName())); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (name.equals("plaintext")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.tokeniser.transition(TokeniserState.PLAINTEXT); // once in, never gets out } else if (name.equals("button")) { if (tb.inButtonScope("button")) { // close and reprocess tb.error(this); tb.process(new Token.EndTag("button")); tb.process(startTag); } else { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); } } else if (name.equals("a")) { if (tb.getActiveFormattingElement("a") != null) { tb.error(this); tb.process(new Token.EndTag("a")); // still on stack? Element remainingA = tb.getFromStack("a"); if (remainingA != null) { tb.removeFromActiveFormattingElements(remainingA); tb.removeFromStack(remainingA); } } tb.reconstructFormattingElements(); Element a = tb.insert(startTag); tb.pushActiveFormattingElements(a); } else if (StringUtil.in(name, "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u")) { tb.reconstructFormattingElements(); Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (name.equals("nobr")) { tb.reconstructFormattingElements(); if (tb.inScope("nobr")) { tb.error(this); tb.process(new Token.EndTag("nobr")); tb.reconstructFormattingElements(); } Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (StringUtil.in(name, "applet", "marquee", "object")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.insertMarkerToFormattingElements(); tb.framesetOk(false); } else if (name.equals("table")) { if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.framesetOk(false); tb.transition(InTable); } else if (StringUtil.in(name, "area", "br", "embed", "img", "keygen", "wbr")) { tb.reconstructFormattingElements(); tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("input")) { tb.reconstructFormattingElements(); Element el = tb.insertEmpty(startTag); if (!el.attr("type").equalsIgnoreCase("hidden")) tb.framesetOk(false); } else if (StringUtil.in(name, "param", "source", "track")) { tb.insertEmpty(startTag); } else if (name.equals("hr")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("image")) { // we're not supposed to ask. startTag.name("img"); return tb.process(startTag); } else if (name.equals("isindex")) { // how much do we care about the early 90s? tb.error(this); if (tb.getFormElement() != null) return false; tb.tokeniser.acknowledgeSelfClosingFlag(); tb.process(new Token.StartTag("form")); if (startTag.attributes.hasKey("action")) { Element form = tb.getFormElement(); form.attr("action", startTag.attributes.get("action")); } tb.process(new Token.StartTag("hr")); tb.process(new Token.StartTag("label")); // hope you like english. String prompt = startTag.attributes.hasKey("prompt") ? startTag.attributes.get("prompt") : "This is a searchable index. Enter search keywords: "; tb.process(new Token.Character(prompt)); // input Attributes inputAttribs = new Attributes(); for (Attribute attr : startTag.attributes) { if (!StringUtil.in(attr.getKey(), "name", "action", "prompt")) inputAttribs.put(attr); } inputAttribs.put("name", "isindex"); tb.process(new Token.StartTag("input", inputAttribs)); tb.process(new Token.EndTag("label")); tb.process(new Token.StartTag("hr")); tb.process(new Token.EndTag("form")); } else if (name.equals("textarea")) { tb.insert(startTag); // todo: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.framesetOk(false); tb.transition(Text); } else if (name.equals("xmp")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.reconstructFormattingElements(); tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("iframe")) { tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("noembed")) { // also handle noscript if script enabled handleRawtext(startTag, tb); } else if (name.equals("select")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); HtmlTreeBuilderState state = tb.state(); if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) tb.transition(InSelectInTable); else tb.transition(InSelect); } else if (StringUtil.in("optgroup", "option")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); tb.reconstructFormattingElements(); tb.insert(startTag); } else if (StringUtil.in("rp", "rt")) { if (tb.inScope("ruby")) { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("ruby")) { tb.error(this); tb.popStackToBefore("ruby"); // i.e. close up to but not include name } tb.insert(startTag); } } else if (name.equals("math")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (name.equals("svg")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "svg" (xlink, svg) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { tb.reconstructFormattingElements(); tb.insert(startTag); } break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("body")) { if (!tb.inScope("body")) { tb.error(this); return false; } else { // todo: error if stack contains something not dd, dt, li, optgroup, option, p, rp, rt, tbody, td, tfoot, th, thead, tr, body, html tb.transition(AfterBody); } } else if (name.equals("html")) { boolean notIgnored = tb.process(new Token.EndTag("body")); if (notIgnored) return tb.process(endTag); } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu", "nav", "ol", "pre", "section", "summary", "ul")) { // todo: refactor these lookups if (!tb.inScope(name)) { // nothing to close tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("form")) { Element currentForm = tb.getFormElement(); tb.setFormElement(null); if (currentForm == null || !tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); // remove currentForm from stack. will shift anything under up. tb.removeFromStack(currentForm); } } else if (name.equals("p")) { if (!tb.inButtonScope(name)) { tb.error(this); tb.process(new Token.StartTag(name)); // if no p to close, creates an empty <p></p> return tb.process(endTag); } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("li")) { if (!tb.inListItemScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "dd", "dt")) { if (!tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (!tb.inScope(new String[]{"h1", "h2", "h3", "h4", "h5", "h6"})) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose("h1", "h2", "h3", "h4", "h5", "h6"); } } else if (name.equals("sarcasm")) { // *sigh* return anyOtherEndTag(t, tb); } else if (StringUtil.in(name, "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u")) { // Adoption Agency Algorithm. OUTER: for (int i = 0; i < 8; i++) { Element formatEl = tb.getActiveFormattingElement(name); if (formatEl == null) return anyOtherEndTag(t, tb); else if (!tb.onStack(formatEl)) { tb.error(this); tb.removeFromActiveFormattingElements(formatEl); return true; } else if (!tb.inScope(formatEl.nodeName())) { tb.error(this); return false; } else if (tb.currentElement() != formatEl) if (node == formatEl) break INNER; tb.error(this); Element furthestBlock = null; Element commonAncestor = null; boolean seenFormattingElement = false; LinkedList<Element> stack = tb.getStack(); // the spec doesn't limit to < 64, but in degenerate cases (9000+ stack depth) this prevents // run-aways for (int si = 0; si < stack.size() && si < 64; si++) { Element el = stack.get(si); if (el == formatEl) { commonAncestor = stack.get(si - 1); seenFormattingElement = true; } else if (seenFormattingElement && tb.isSpecial(el)) { furthestBlock = el; break; } } if (furthestBlock == null) { tb.popStackToClose(formatEl.nodeName()); tb.removeFromActiveFormattingElements(formatEl); return true; } // todo: Let a bookmark note the position of the formatting element in the list of active formatting elements relative to the elements on either side of it in the list. // does that mean: int pos of format el in list? Element node = furthestBlock; Element lastNode = furthestBlock; INNER: for (int j = 0; j < 3; j++) { if (tb.onStack(node)) node = tb.aboveOnStack(node); if (!tb.isInActiveFormattingElements(node)) { // note no bookmark check tb.removeFromStack(node); continue INNER; } else if (node == formatEl) break INNER; Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); tb.replaceActiveFormattingElement(node, replacement); tb.replaceOnStack(node, replacement); node = replacement; if (lastNode == furthestBlock) { // todo: move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements. // not getting how this bookmark both straddles the element above, but is inbetween here... } if (lastNode.parent() != null) lastNode.remove(); node.appendChild(lastNode); lastNode = node; } if (StringUtil.in(commonAncestor.nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { if (lastNode.parent() != null) lastNode.remove(); tb.insertInFosterParent(lastNode); } else { if (lastNode.parent() != null) lastNode.remove(); commonAncestor.appendChild(lastNode); } Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri()); Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); for (Node childNode : childNodes) { adopter.appendChild(childNode); // append will reparent. thus the clone to avoid concurrent mod. } furthestBlock.appendChild(adopter); tb.removeFromActiveFormattingElements(formatEl); // todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark. tb.removeFromStack(formatEl); tb.insertOnStackAfter(furthestBlock, adopter); } } else if (StringUtil.in(name, "applet", "marquee", "object")) { if (!tb.inScope("name")) { if (!tb.inScope(name)) { tb.error(this); return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); } } else if (name.equals("br")) { tb.error(this); tb.process(new Token.StartTag("br")); return false; } else { return anyOtherEndTag(t, tb); } break; case EOF: // todo: error if stack contains something not dd, dt, li, p, tbody, td, tfoot, th, thead, tr, body, html // stop parsing break; } return true; } boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) { String name = t.asEndTag().name(); DescendableLinkedList<Element> stack = tb.getStack(); Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element node = it.next(); if (node.nodeName().equals(name)) { tb.generateImpliedEndTags(name); if (!name.equals(tb.currentElement().nodeName())) tb.error(this); tb.popStackToClose(name); break; } else { if (tb.isSpecial(node)) { tb.error(this); return false; } } } return true; } }, Text { // in script, style etc. normally treated as data tags boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.insert(t.asCharacter()); } else if (t.isEOF()) { tb.error(this); // if current node is script: already started tb.pop(); tb.transition(tb.originalState()); return tb.process(t); } else if (t.isEndTag()) { // if: An end tag whose tag name is "script" -- scripting nesting level, if evaluating scripts tb.pop(); tb.transition(tb.originalState()); } return true; } }, InTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.newPendingTableCharacters(); tb.markInsertionMode(); tb.transition(InTableText); return tb.process(t); } else if (t.isComment()) { tb.insert(t.asComment()); return true; } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("caption")) { tb.clearStackToTableContext(); tb.insertMarkerToFormattingElements(); tb.insert(startTag); tb.transition(InCaption); } else if (name.equals("colgroup")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InColumnGroup); } else if (name.equals("col")) { tb.process(new Token.StartTag("colgroup")); return tb.process(t); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InTableBody); } else if (StringUtil.in(name, "td", "th", "tr")) { tb.process(new Token.StartTag("tbody")); return tb.process(t); } else if (name.equals("table")) { tb.error(this); boolean processed = tb.process(new Token.EndTag("table")); if (processed) // only ignored if in fragment return tb.process(t); } else if (StringUtil.in(name, "style", "script")) { return tb.process(t, InHead); } else if (name.equals("input")) { if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) { return anythingElse(t, tb); } else { tb.insertEmpty(startTag); } } else if (name.equals("form")) { tb.error(this); if (tb.getFormElement() != null) return false; else { tb.insertForm(startTag, false); } } else { return anythingElse(t, tb); } return true; // todo: check if should return processed http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#parsing-main-intable } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("table")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.popStackToClose("table"); } tb.resetInsertionMode(); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; // todo: as above todo } else if (t.isEOF()) { if (tb.currentElement().nodeName().equals("html")) tb.error(this); return true; // stops parsing } return anythingElse(t, tb); } boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); boolean processed = true; if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); processed = tb.process(t, InBody); tb.setFosterInserts(false); } else { processed = tb.process(t, InBody); } return processed; } }, InTableText { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.getPendingTableCharacters().add(c); } break; default: if (tb.getPendingTableCharacters().size() > 0) { for (Token.Character character : tb.getPendingTableCharacters()) { if (!isWhitespace(character)) { // InTable anything else section: tb.error(this); if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); tb.process(character, InBody); tb.setFosterInserts(false); } else { tb.process(character, InBody); } } else tb.insert(character); } tb.newPendingTableCharacters(); } tb.transition(tb.originalState()); return tb.process(t); } return true; } }, InCaption { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag() && t.asEndTag().name().equals("caption")) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("caption")) tb.error(this); tb.popStackToClose("caption"); tb.clearFormattingElementsToLastMarker(); tb.transition(InTable); } } else if (( t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr") || t.isEndTag() && t.asEndTag().name().equals("table")) ) { tb.error(this); boolean processed = tb.process(new Token.EndTag("caption")); if (processed) return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return tb.process(t, InBody); } return true; } }, InColumnGroup { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); break; case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) return tb.process(t, InBody); else if (name.equals("col")) tb.insertEmpty(startTag); else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("colgroup")) { if (tb.currentElement().nodeName().equals("html")) { // frag case tb.error(this); return false; } else { tb.pop(); tb.transition(InTable); } } else return anythingElse(t, tb); break; case EOF: if (tb.currentElement().nodeName().equals("html")) return true; // stop parsing; frag case else return anythingElse(t, tb); default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("colgroup")); if (processed) // only ignored in frag case return tb.process(t); return true; } }, InTableBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("tr")) { tb.clearStackToTableBodyContext(); tb.insert(startTag); tb.transition(InRow); } else if (StringUtil.in(name, "th", "td")) { tb.error(this); tb.process(new Token.StartTag("tr")); return tb.process(startTag); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead")) { return exitTableBody(t, tb); } else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.clearStackToTableBodyContext(); tb.pop(); tb.transition(InTable); } } else if (name.equals("table")) { return exitTableBody(t, tb); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th", "tr")) { tb.error(this); return false; } else return anythingElse(t, tb); break; default: return anythingElse(t, tb); } return true; } private boolean exitTableBody(Token t, HtmlTreeBuilder tb) { if (!(tb.inTableScope("tbody") || tb.inTableScope("thead") || tb.inScope("tfoot"))) { // frag case tb.error(this); return false; } tb.clearStackToTableBodyContext(); tb.process(new Token.EndTag(tb.currentElement().nodeName())); // tbody, tfoot, thead return tb.process(t); } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } }, InRow { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (StringUtil.in(name, "th", "td")) { tb.clearStackToTableRowContext(); tb.insert(startTag); tb.transition(InCell); tb.insertMarkerToFormattingElements(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) { return handleMissingTr(t, tb); } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("tr")) { if (!tb.inTableScope(name)) { tb.error(this); // frag return false; } tb.clearStackToTableRowContext(); tb.pop(); // tr tb.transition(InTableBody); } else if (name.equals("table")) { return handleMissingTr(t, tb); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } tb.process(new Token.EndTag("tr")); return tb.process(t); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } private boolean handleMissingTr(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("tr")); if (processed) return tb.process(t); else return false; } }, InCell { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (StringUtil.in(name, "td", "th")) { if (!tb.inTableScope(name)) { tb.error(this); tb.transition(InRow); // might not be in scope if empty: <td /> and processing fake end tag return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); tb.transition(InRow); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html")) { tb.error(this); return false; } else if (StringUtil.in(name, "table", "tbody", "tfoot", "thead", "tr")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } } else if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr")) { if (!(tb.inTableScope("td") || tb.inTableScope("th"))) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InBody); } private void closeCell(HtmlTreeBuilder tb) { if (tb.inTableScope("td")) tb.process(new Token.EndTag("td")); else tb.process(new Token.EndTag("th")); // only here if th or td in scope } }, InSelect { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.insert(c); } break; case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) return tb.process(start, InBody); else if (name.equals("option")) { tb.process(new Token.EndTag("option")); tb.insert(start); } else if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); else if (tb.currentElement().nodeName().equals("optgroup")) tb.process(new Token.EndTag("optgroup")); tb.insert(start); } else if (name.equals("select")) { tb.error(this); return tb.process(new Token.EndTag("select")); } else if (StringUtil.in(name, "input", "keygen", "textarea")) { tb.error(this); if (!tb.inSelectScope("select")) return false; // frag tb.process(new Token.EndTag("select")); return tb.process(start); } else if (name.equals("script")) { return tb.process(t, InHead); } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option") && tb.aboveOnStack(tb.currentElement()) != null && tb.aboveOnStack(tb.currentElement()).nodeName().equals("optgroup")) tb.process(new Token.EndTag("option")); if (tb.currentElement().nodeName().equals("optgroup")) tb.pop(); else tb.error(this); } else if (name.equals("option")) { if (tb.currentElement().nodeName().equals("option")) tb.pop(); else tb.error(this); } else if (name.equals("select")) { if (!tb.inSelectScope(name)) { tb.error(this); return false; } else { tb.popStackToClose(name); tb.resetInsertionMode(); } } else return anythingElse(t, tb); break; case EOF: if (!tb.currentElement().nodeName().equals("html")) tb.error(this); break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); return false; } }, InSelectInTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); tb.process(new Token.EndTag("select")); return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); if (tb.inTableScope(t.asEndTag().name())) { tb.process(new Token.EndTag("select")); return (tb.process(t)); } else return false; } else { return tb.process(t, InSelect); } } }, AfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return tb.process(t, InBody); } else if (t.isComment()) { tb.insert(t.asComment()); // into html node } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { if (tb.isFragmentParsing()) { tb.error(this); return false; } else { tb.transition(AfterAfterBody); } } else if (t.isEOF()) { // chillax! we're done } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, InFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return tb.process(start, InBody); } else if (name.equals("frameset")) { tb.insert(start); } else if (name.equals("frame")) { tb.insertEmpty(start); } else if (name.equals("noframes")) { return tb.process(start, InHead); } else { tb.error(this); return false; } } else if (t.isEndTag() && t.asEndTag().name().equals("frameset")) { if (tb.currentElement().nodeName().equals("html")) { // frag tb.error(this); return false; } else { tb.pop(); if (!tb.isFragmentParsing() && !tb.currentElement().nodeName().equals("frameset")) { tb.transition(AfterFrameset); } } } else if (t.isEOF()) { if (!tb.currentElement().nodeName().equals("html")) { tb.error(this); return true; } } else { tb.error(this); return false; } return true; } }, AfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { tb.transition(AfterAfterFrameset); } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else if (t.isEOF()) { // cool your heels, we're complete } else { tb.error(this); return false; } return true; } }, AfterAfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, AfterAfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else { tb.error(this); return false; } return true; } }, ForeignContent { boolean process(Token t, HtmlTreeBuilder tb) { return true; // todo: implement. Also; how do we get here? } }; private static String nullString = String.valueOf('\u0000'); abstract boolean process(Token t, HtmlTreeBuilder tb); private static boolean isWhitespace(Token t) { if (t.isCharacter()) { String data = t.asCharacter().getData(); // todo: this checks more than spec - "\t", "\n", "\f", "\r", " " for (int i = 0; i < data.length(); i++) { char c = data.charAt(i); if (!StringUtil.isWhitespace(c)) return false; } return true; } return false; } private static void handleRcData(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.transition(Text); } private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rawtext); tb.markInsertionMode(); tb.transition(Text); } }
[ "justinwm@163.com" ]
justinwm@163.com