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
fd613168290e84614a169ffe481626d5db86555f
cb521ed0a44e6fe133cae3f9fb020557ba90e0a4
/studentdemoapp/src/main/java/com/studentdemo/model/Student.java
63779050989312e71627d6d438cb14c9125c155c
[]
no_license
shikhacoder/studentdemoapp
f1a596c5a5ff1afbe97c36486c0df841f6c4a31c
25b187d7b2d23c2a8b7b80370709bf84fc67de34
refs/heads/main
2023-03-04T04:55:32.576881
2021-02-13T14:29:07
2021-02-13T14:29:07
338,588,639
0
0
null
null
null
null
UTF-8
Java
false
false
2,023
java
package com.studentdemo.model; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name = "studentdemo") public class Student { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "DEPARTMENT_ID") private Department department; @Column(name = "STUDENT_FIRST_NAME") private String stuFname; @Column(name = "STUDENT_LAST_NAME") private String stuLname; @Column(name = "ADDRESS") private String address; @Column(name = "MOBILE_NO") private int mobileNo; public Student() { } public int getId() { return id; } public void setId(int id) { this.id = id; } /* * public Department getDepartment() { return department; } * * public void setDepartment(Department department) { this.department = * department; } */ public String getStuFname() { return stuFname; } public void setStuFname(String stuFname) { this.stuFname = stuFname; } public String getStuLname() { return stuLname; } public void setStuLname(String stuLname) { this.stuLname = stuLname; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public int getMobileNo() { return mobileNo; } public void setMobileNo(int mobileNo) { this.mobileNo = mobileNo; } @Override public String toString() { return "Student [id=" + id + ",stuFname=" + stuFname + ", stuLname=" + stuLname + ", address=" + address + ", mobileNo=" + mobileNo + "]"; } }
[ "Shikha Dawre@DESKTOP-R69IF6L" ]
Shikha Dawre@DESKTOP-R69IF6L
d28436395cadc94fa3049eae56257c5d4c623cef
8c5f98dc929acc7fe0c473b0259230592553b79c
/creational/prototype/src/main/java/com/aimtupsu/coffeemachine/handler/exception/HandleException.java
30c2e56020fad8476b62a3edf55511b6d1d9ced5
[]
no_license
aimtupsu/desing-patterns
8d6e676d8d569b7d5e434e029197aae315b1c97d
a35253bafb80ad087b4ee766f3c6b2995832db06
refs/heads/master
2022-02-09T07:37:36.079709
2021-12-14T20:56:26
2021-12-14T22:01:53
208,882,375
0
0
null
2022-01-04T16:47:06
2019-09-16T19:35:47
Java
UTF-8
Java
false
false
181
java
package com.aimtupsu.coffeemachine.handler.exception; public class HandleException extends Exception { public HandleException(final String msg) { super(msg); } }
[ "vladimir.shchepin@x5.ru" ]
vladimir.shchepin@x5.ru
faa87a5ca65b558522a5ee31134636c8f27a4001
0abf2b81c5805489de4dd7c65711d1047d51d95d
/MyGeo/src/it/wlp/android/widgets/ArrayListFragment.java
ea65aaa121294d250866919dfa017e71bef2bea2
[]
no_license
jerome74/myg30
23fd56870a8b58e1b0518904382f04b9f97ff0a4
ce303c67d245efd2ec1ad777c643537ac17df4ba
refs/heads/master
2021-01-19T21:48:16.317663
2014-09-14T12:51:11
2014-09-14T12:59:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,469
java
package it.wlp.android.widgets; import it.mygeo.project.R; import it.mygeo.project.constants.UTIL_GEO; import android.annotation.SuppressLint; import android.app.ListFragment; import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; public class ArrayListFragment extends ListFragment { Drawable drawable; View view; String selectedValue; String startSelectedValue; public ArrayListFragment() { // TODO Auto-generated constructor stub } @SuppressWarnings("deprecation") @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Resources r = getResources(); String[] bases = r.getStringArray(R.array.geo_obj); setListAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, bases)); startSelectedValue = super.getActivity().getIntent().getStringExtra(UTIL_GEO.VALUE_SEEK); for (int i = 0; i < bases.length; i++) { String nowValue = (String)getListAdapter().getItem(i); if(nowValue.equals(startSelectedValue)) { // TextView txView = (TextView)getListAdapter().getView(i, null, null); // String value = txView.getText().toString(); // // txView.setBackgroundColor(Color.BLUE); // txView.setTextColor(Color.BLUE); getListView().setItemChecked(i, true); } } } @SuppressLint("NewApi") @Override public void onViewCreated(View view, Bundle savedInstanceState) { // TODO Auto-generated method stub super.onViewCreated(view, savedInstanceState); } @Override public void onListItemClick(ListView l, View v, int position, long id) { selectedValue = (String) getListAdapter().getItem(position); drawable = v.getBackground(); v.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.BLUE)); if(view != null) { view.setBackgroundDrawable(drawable); } view = v; super.getActivity().finish(); } /** * * @return */ public String getSelectedValue() { return selectedValue; } }
[ "walter.longo74@gmail.com" ]
walter.longo74@gmail.com
ac2c6d3112ea46e82b0f78f04db57bf0972f1394
da6f23345f298e3203afb9d6a575a70e8b99a3e0
/src/main/java/example2/service/Validator.java
01ff4492c67768abd12d6544c3089e6463b846d2
[]
no_license
JavaSchool2020/spring-examples
55ab9d8cc4643c608f60794bf471f856bff2af3a
b56fdd1ee1f6f31db1469a6dcf1a0f9df43695fd
refs/heads/master
2023-02-28T01:35:46.069463
2021-01-25T19:02:00
2021-01-25T19:02:00
332,851,877
0
1
null
2021-02-07T15:25:50
2021-01-25T18:58:54
Java
UTF-8
Java
false
false
87
java
package example2.service; public interface Validator { void validate(long sum); }
[ "Aliara@yandex.ru" ]
Aliara@yandex.ru
73da87f98c7c7a2995dab9db723589399ffb4f89
75d49aec6f6839e1903c646b265c47cec8477728
/01-java-se/src/main/java/cn/learncoding/java/se/generic/SimpleGeneric.java
4e49b39e8bdb414ca7d2313d2de6aa5be509637f
[]
no_license
learncoding-cn/learn-coding-codes
40230440e1896fba66220424a53dd95c38682ca1
e8ae573ac1a25dcc4c1537d99d0be5589dce55bb
refs/heads/master
2022-07-26T10:14:38.133031
2019-08-02T07:30:26
2019-08-02T07:30:26
200,187,469
0
0
null
2022-06-21T01:35:24
2019-08-02T07:28:31
Java
UTF-8
Java
false
false
1,261
java
package cn.learncoding.java.se.generic; /** * @author learncoding.cn */ public class SimpleGeneric { public static class Holder<T>{ private T value; public T getValue() { return value; } public void setValue(T value) { this.value = value; } } public static void print(Holder<?> holder){ System.out.println(holder.getValue()); } public static void main(String[] args) { Holder<Long> holder = new Holder<>(); holder.setValue(new Long(100)); print(holder); Holder<String> stringHolder = new Holder<>(); stringHolder.setValue("learncoding.cn"); print(stringHolder); } public static <E> E changeType(Class<E> clazz, Object object){ if (clazz.isInstance(object)) { return (E)object; }else { throw new ClassCastException(); } } // public static void main(String[] args) { // Number number = changeType(Number.class, new Integer(10)); // System.out.println(number); // } // public static <E extends Number> double add(E... nums){ // double result = 0; // for (Number e : nums) { // result += e.doubleValue(); // } // return result; // } // // public static void main(String[] args) { // double result = add(1L, (byte)5, 10, 0.25f, new Double(5)); // System.out.println(result); // } }
[ "you@example.com" ]
you@example.com
09327d14408b95c99428606c6182026014d4ef47
c81149ccb0fcf88e3f856a2436c0e25b1732e39e
/src/main/java/lv/psoft/training/bookstore/boot/CreateRoles.java
9f05cb2590c4120944047d821fb713c1e58d8ff8
[]
no_license
OlegMiroshnikov/Bookstore
0930f2a36f4c6fc20277b631ffff4d6da5cd6424
d6d4d0e0593715e5c8f9a234a5574eb2dec9250d
refs/heads/master
2023-04-19T17:44:41.412216
2021-05-10T18:53:14
2021-05-10T18:53:14
363,446,127
0
1
null
null
null
null
UTF-8
Java
false
false
972
java
package lv.psoft.training.bookstore.boot; import lv.psoft.training.bookstore.models.Role; import lv.psoft.training.bookstore.repositories.RoleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; @Component @Order(1) @Slf4j public class CreateRoles implements CommandLineRunner { @Autowired private RoleRepository roleRepository; @Override public void run(String... args) throws Exception { if (roleRepository.count() == 0) { Role adminRole = Role.builder().name("admin").build(); Role customerRole = Role.builder().name("customer").build(); roleRepository.save(adminRole); roleRepository.save(customerRole); log.info(">>>> Created admin and customer roles..."); } } }
[ "oleg.psoft@gmail.com" ]
oleg.psoft@gmail.com
6b4ff22811ccdb039b0a59978f89493e3a3754c9
8622256ab2083415f9825b54dff88ea5dd8a70ea
/Project/src/screens/ranking/pointsScreen.java
3a1951e1dc167579a7b2c021403627f9eb21e6cb
[]
no_license
RAF3197/PROP
9216ccf557b933e49365c8fbf1f792e5ecf08485
8e3abe2257bdfa09614f3bbd3bb440ecb75f1677
refs/heads/master
2020-04-22T14:52:39.882312
2019-02-19T22:01:05
2019-02-19T22:01:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,733
java
package screens.ranking; import classes.Ranking; import classes.RankingItem; import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; import lib.Manager; import java.net.URL; import java.sql.SQLException; import java.util.ResourceBundle; public class pointsScreen implements Initializable { @FXML TableView<scoreTable> ranking = new TableView<>(); @FXML TableColumn usernames; @FXML TableColumn score; static int IdHidato; Ranking rank; @Override public void initialize(URL location, ResourceBundle resources) { try { rank = Manager.getRanking(IdHidato); usernames.setCellValueFactory(new PropertyValueFactory<scoreTable,String>("username")); usernames.setStyle("-fx-alignment: center"); score.setCellValueFactory(new PropertyValueFactory<scoreTable,String>("score")); score.setStyle("-fx-alignment: center"); final ObservableList<scoreTable> items = FXCollections.observableArrayList(); scoreTable a; for (int i=0;i<rank.getRanking().size();i++) { a = new scoreTable(rank.getRanking().get(i).getUsername(),String.valueOf(rank.getRanking().get(i).getPuntuacio())); items.add(a); } ranking.setItems(items); } catch (SQLException e) { e.printStackTrace(); } } public void main() { } }
[ "ricardabril45@gmail.com" ]
ricardabril45@gmail.com
3015f6282201a246bed6fa1c9fad72c170d95834
9512c7bc91516e88f145fbdfe06cdee9fc656a35
/restadmin-common/src/main/java/com/bdweng/common/constant/UserConstants.java
c80b7d5529ee9d2bd7f189d4517fc0abc44c68e5
[]
no_license
ToolsZhang/springboot-framework-server
a9bb430de616666f235023140f3823e0791541e2
2e14a5abc0d87f8ff2393edc3af3a1cdd13b4ae6
refs/heads/master
2023-03-12T22:39:54.517139
2021-03-02T10:07:52
2021-03-02T10:07:52
343,324,287
1
0
null
null
null
null
UTF-8
Java
false
false
1,839
java
package com.bdweng.common.constant; /** * 用户常量信息 * * @author Zq * @version 1.0 * @date 2021/1/20 11:24 上午 */ public class UserConstants { /** * 平台内系统用户的唯一标志 */ public static final String SYS_USER = "SYS_USER"; /** * 正常状态 */ public static final String NORMAL = "0"; /** * 异常状态 */ public static final String EXCEPTION = "1"; /** * 用户封禁状态 */ public static final String USER_DISABLE = "1"; /** * 角色封禁状态 */ public static final String ROLE_DISABLE = "1"; /** * 部门正常状态 */ public static final String DEPT_NORMAL = "0"; /** * 部门停用状态 */ public static final String DEPT_DISABLE = "1"; /** * 字典正常状态 */ public static final String DICT_NORMAL = "0"; /** * 是否为系统默认(是) */ public static final String YES = "Y"; /** * 是否菜单外链(是) */ public static final String YES_FRAME = "0"; /** * 是否菜单外链(否) */ public static final String NO_FRAME = "1"; /** * 菜单类型(目录) */ public static final String TYPE_DIR = "M"; /** * 菜单类型(菜单) */ public static final String TYPE_MENU = "C"; /** * 菜单类型(按钮) */ public static final String TYPE_BUTTON = "F"; /** * Layout组件标识 */ public final static String LAYOUT = "Layout"; /** * ParentView组件标识 */ public final static String PARENT_VIEW = "ParentView"; /** * 校验返回结果码 */ public final static String UNIQUE = "0"; public final static String NOT_UNIQUE = "1"; }
[ "2369185957@qq.com" ]
2369185957@qq.com
47b504e937211fbf9898c9f6fc48784a7526a4ad
b0c946d4ac79793780cd07fec2af247904d844dd
/design_pattern/src/main/java/com/feibai/designpatterns/study/observer/observer1/ObserverA.java
2c293be8a991c34a44fab300743366373e1127d0
[]
no_license
iceleeyo/feibai_study
d7309a45c7f3380584a19e7dace2b248790455d1
e2ccc0f12f03b0406ebb3d277a8068685f26be07
refs/heads/master
2023-03-29T23:23:17.578260
2021-04-05T14:49:26
2021-04-05T14:49:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
428
java
package com.feibai.designpatterns.study.observer.observer1; public class ObserverA implements Observer { private int myState; // myState需要跟目标对象的state值保持一致! @Override public void update(Subject subject) { myState = ((ConcreteSubject) subject).getState(); } public int getMyState() { return myState; } public void setMyState(int myState) { this.myState = myState; } }
[ "yuanlong.li@ximalaya.com" ]
yuanlong.li@ximalaya.com
0b1fe61125f23a685045fcb23a46e0afa8c1fad2
436b4c639df98927ad09f7a438d900fcc76f5fe1
/release/app-release_source_from_JADX/sources/androidx/core/app/NotificationCompatJellybean.java
285f45d532e4e25c67340015ce3959cde636fdbe
[]
no_license
Jaykoneko/NotInfoApp
ed6dd2a125d1f44cc65ac65b1f4a22f3d688d2e0
b0e00dd4015f8a240036d1c627120d86fc85d8e2
refs/heads/master
2022-12-05T14:26:38.998889
2020-08-29T04:18:10
2020-08-29T04:18:10
291,198,227
0
0
null
null
null
null
UTF-8
Java
false
false
13,527
java
package androidx.core.app; import android.app.Notification; import android.app.Notification.Builder; import android.app.PendingIntent; import android.os.Bundle; import android.os.Parcelable; import android.util.Log; import android.util.SparseArray; import androidx.core.app.NotificationCompat.Action; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; class NotificationCompatJellybean { static final String EXTRA_ALLOW_GENERATED_REPLIES = "android.support.allowGeneratedReplies"; static final String EXTRA_DATA_ONLY_REMOTE_INPUTS = "android.support.dataRemoteInputs"; private static final String KEY_ACTION_INTENT = "actionIntent"; private static final String KEY_ALLOWED_DATA_TYPES = "allowedDataTypes"; private static final String KEY_ALLOW_FREE_FORM_INPUT = "allowFreeFormInput"; private static final String KEY_CHOICES = "choices"; private static final String KEY_DATA_ONLY_REMOTE_INPUTS = "dataOnlyRemoteInputs"; private static final String KEY_EXTRAS = "extras"; private static final String KEY_ICON = "icon"; private static final String KEY_LABEL = "label"; private static final String KEY_REMOTE_INPUTS = "remoteInputs"; private static final String KEY_RESULT_KEY = "resultKey"; private static final String KEY_SEMANTIC_ACTION = "semanticAction"; private static final String KEY_SHOWS_USER_INTERFACE = "showsUserInterface"; private static final String KEY_TITLE = "title"; public static final String TAG = "NotificationCompat"; private static Field sActionIconField; private static Field sActionIntentField; private static Field sActionTitleField; private static boolean sActionsAccessFailed; private static Field sActionsField; private static final Object sActionsLock = new Object(); private static Field sExtrasField; private static boolean sExtrasFieldAccessFailed; private static final Object sExtrasLock = new Object(); public static SparseArray<Bundle> buildActionExtrasMap(List<Bundle> list) { int size = list.size(); SparseArray<Bundle> sparseArray = null; for (int i = 0; i < size; i++) { Bundle bundle = (Bundle) list.get(i); if (bundle != null) { if (sparseArray == null) { sparseArray = new SparseArray<>(); } sparseArray.put(i, bundle); } } return sparseArray; } public static Bundle getExtras(Notification notification) { synchronized (sExtrasLock) { if (sExtrasFieldAccessFailed) { return null; } try { if (sExtrasField == null) { Field declaredField = Notification.class.getDeclaredField(KEY_EXTRAS); if (!Bundle.class.isAssignableFrom(declaredField.getType())) { Log.e(TAG, "Notification.extras field is not of type Bundle"); sExtrasFieldAccessFailed = true; return null; } declaredField.setAccessible(true); sExtrasField = declaredField; } Bundle bundle = (Bundle) sExtrasField.get(notification); if (bundle == null) { bundle = new Bundle(); sExtrasField.set(notification, bundle); } return bundle; } catch (IllegalAccessException e) { Log.e(TAG, "Unable to access notification extras", e); sExtrasFieldAccessFailed = true; return null; } catch (NoSuchFieldException e2) { Log.e(TAG, "Unable to access notification extras", e2); sExtrasFieldAccessFailed = true; return null; } } } public static Action readAction(int i, CharSequence charSequence, PendingIntent pendingIntent, Bundle bundle) { boolean z; RemoteInput[] remoteInputArr; RemoteInput[] remoteInputArr2; if (bundle != null) { RemoteInput[] fromBundleArray = fromBundleArray(getBundleArrayFromBundle(bundle, NotificationCompatExtras.EXTRA_REMOTE_INPUTS)); remoteInputArr2 = fromBundleArray; remoteInputArr = fromBundleArray(getBundleArrayFromBundle(bundle, EXTRA_DATA_ONLY_REMOTE_INPUTS)); z = bundle.getBoolean(EXTRA_ALLOW_GENERATED_REPLIES); } else { remoteInputArr2 = null; remoteInputArr = null; z = false; } Action action = new Action(i, charSequence, pendingIntent, bundle, remoteInputArr2, remoteInputArr, z, 0, true); return action; } public static Bundle writeActionAndGetExtras(Builder builder, Action action) { builder.addAction(action.getIcon(), action.getTitle(), action.getActionIntent()); Bundle bundle = new Bundle(action.getExtras()); if (action.getRemoteInputs() != null) { bundle.putParcelableArray(NotificationCompatExtras.EXTRA_REMOTE_INPUTS, toBundleArray(action.getRemoteInputs())); } if (action.getDataOnlyRemoteInputs() != null) { bundle.putParcelableArray(EXTRA_DATA_ONLY_REMOTE_INPUTS, toBundleArray(action.getDataOnlyRemoteInputs())); } bundle.putBoolean(EXTRA_ALLOW_GENERATED_REPLIES, action.getAllowGeneratedReplies()); return bundle; } public static int getActionCount(Notification notification) { int length; synchronized (sActionsLock) { Object[] actionObjectsLocked = getActionObjectsLocked(notification); length = actionObjectsLocked != null ? actionObjectsLocked.length : 0; } return length; } public static Action getAction(Notification notification, int i) { Bundle bundle; synchronized (sActionsLock) { try { Object[] actionObjectsLocked = getActionObjectsLocked(notification); if (actionObjectsLocked != null) { Object obj = actionObjectsLocked[i]; Bundle extras = getExtras(notification); if (extras != null) { SparseArray sparseParcelableArray = extras.getSparseParcelableArray(NotificationCompatExtras.EXTRA_ACTION_EXTRAS); if (sparseParcelableArray != null) { bundle = (Bundle) sparseParcelableArray.get(i); Action readAction = readAction(sActionIconField.getInt(obj), (CharSequence) sActionTitleField.get(obj), (PendingIntent) sActionIntentField.get(obj), bundle); return readAction; } } bundle = null; Action readAction2 = readAction(sActionIconField.getInt(obj), (CharSequence) sActionTitleField.get(obj), (PendingIntent) sActionIntentField.get(obj), bundle); return readAction2; } } catch (IllegalAccessException e) { Log.e(TAG, "Unable to access notification actions", e); sActionsAccessFailed = true; } catch (Throwable th) { throw th; } } return null; } private static Object[] getActionObjectsLocked(Notification notification) { synchronized (sActionsLock) { if (!ensureActionReflectionReadyLocked()) { return null; } try { Object[] objArr = (Object[]) sActionsField.get(notification); return objArr; } catch (IllegalAccessException e) { Log.e(TAG, "Unable to access notification actions", e); sActionsAccessFailed = true; return null; } } } private static boolean ensureActionReflectionReadyLocked() { String str = "Unable to access notification actions"; String str2 = TAG; if (sActionsAccessFailed) { return false; } try { if (sActionsField == null) { Class cls = Class.forName("android.app.Notification$Action"); sActionIconField = cls.getDeclaredField(KEY_ICON); sActionTitleField = cls.getDeclaredField(KEY_TITLE); sActionIntentField = cls.getDeclaredField(KEY_ACTION_INTENT); Field declaredField = Notification.class.getDeclaredField("actions"); sActionsField = declaredField; declaredField.setAccessible(true); } } catch (ClassNotFoundException e) { Log.e(str2, str, e); sActionsAccessFailed = true; } catch (NoSuchFieldException e2) { Log.e(str2, str, e2); sActionsAccessFailed = true; } return !sActionsAccessFailed; } static Action getActionFromBundle(Bundle bundle) { String str = KEY_EXTRAS; Bundle bundle2 = bundle.getBundle(str); Action action = new Action(bundle.getInt(KEY_ICON), bundle.getCharSequence(KEY_TITLE), (PendingIntent) bundle.getParcelable(KEY_ACTION_INTENT), bundle.getBundle(str), fromBundleArray(getBundleArrayFromBundle(bundle, KEY_REMOTE_INPUTS)), fromBundleArray(getBundleArrayFromBundle(bundle, KEY_DATA_ONLY_REMOTE_INPUTS)), bundle2 != null ? bundle2.getBoolean(EXTRA_ALLOW_GENERATED_REPLIES, false) : false, bundle.getInt(KEY_SEMANTIC_ACTION), bundle.getBoolean(KEY_SHOWS_USER_INTERFACE)); return action; } static Bundle getBundleForAction(Action action) { Bundle bundle; Bundle bundle2 = new Bundle(); bundle2.putInt(KEY_ICON, action.getIcon()); bundle2.putCharSequence(KEY_TITLE, action.getTitle()); bundle2.putParcelable(KEY_ACTION_INTENT, action.getActionIntent()); if (action.getExtras() != null) { bundle = new Bundle(action.getExtras()); } else { bundle = new Bundle(); } bundle.putBoolean(EXTRA_ALLOW_GENERATED_REPLIES, action.getAllowGeneratedReplies()); bundle2.putBundle(KEY_EXTRAS, bundle); bundle2.putParcelableArray(KEY_REMOTE_INPUTS, toBundleArray(action.getRemoteInputs())); bundle2.putBoolean(KEY_SHOWS_USER_INTERFACE, action.getShowsUserInterface()); bundle2.putInt(KEY_SEMANTIC_ACTION, action.getSemanticAction()); return bundle2; } private static RemoteInput fromBundle(Bundle bundle) { ArrayList stringArrayList = bundle.getStringArrayList(KEY_ALLOWED_DATA_TYPES); HashSet hashSet = new HashSet(); if (stringArrayList != null) { Iterator it = stringArrayList.iterator(); while (it.hasNext()) { hashSet.add((String) it.next()); } } RemoteInput remoteInput = new RemoteInput(bundle.getString(KEY_RESULT_KEY), bundle.getCharSequence(KEY_LABEL), bundle.getCharSequenceArray(KEY_CHOICES), bundle.getBoolean(KEY_ALLOW_FREE_FORM_INPUT), bundle.getBundle(KEY_EXTRAS), hashSet); return remoteInput; } private static Bundle toBundle(RemoteInput remoteInput) { Bundle bundle = new Bundle(); bundle.putString(KEY_RESULT_KEY, remoteInput.getResultKey()); bundle.putCharSequence(KEY_LABEL, remoteInput.getLabel()); bundle.putCharSequenceArray(KEY_CHOICES, remoteInput.getChoices()); bundle.putBoolean(KEY_ALLOW_FREE_FORM_INPUT, remoteInput.getAllowFreeFormInput()); bundle.putBundle(KEY_EXTRAS, remoteInput.getExtras()); Set<String> allowedDataTypes = remoteInput.getAllowedDataTypes(); if (allowedDataTypes != null && !allowedDataTypes.isEmpty()) { ArrayList arrayList = new ArrayList(allowedDataTypes.size()); for (String add : allowedDataTypes) { arrayList.add(add); } bundle.putStringArrayList(KEY_ALLOWED_DATA_TYPES, arrayList); } return bundle; } private static RemoteInput[] fromBundleArray(Bundle[] bundleArr) { if (bundleArr == null) { return null; } RemoteInput[] remoteInputArr = new RemoteInput[bundleArr.length]; for (int i = 0; i < bundleArr.length; i++) { remoteInputArr[i] = fromBundle(bundleArr[i]); } return remoteInputArr; } private static Bundle[] toBundleArray(RemoteInput[] remoteInputArr) { if (remoteInputArr == null) { return null; } Bundle[] bundleArr = new Bundle[remoteInputArr.length]; for (int i = 0; i < remoteInputArr.length; i++) { bundleArr[i] = toBundle(remoteInputArr[i]); } return bundleArr; } private static Bundle[] getBundleArrayFromBundle(Bundle bundle, String str) { Parcelable[] parcelableArray = bundle.getParcelableArray(str); if ((parcelableArray instanceof Bundle[]) || parcelableArray == null) { return (Bundle[]) parcelableArray; } Bundle[] bundleArr = (Bundle[]) Arrays.copyOf(parcelableArray, parcelableArray.length, Bundle[].class); bundle.putParcelableArray(str, bundleArr); return bundleArr; } private NotificationCompatJellybean() { } }
[ "tic-260006@utnay.edu.mx" ]
tic-260006@utnay.edu.mx
5bb13e7fd52b5e3a6ea84f8c7ec7021ddf67a221
ab0f2c6a8759d2faad9de5b5cd01a81fffb8442b
/newsee-owner/newsee-owner-rest/src/main/java/com/newsee/owner/service/impl/PressureTestServiceImpl.java
706c994fdf15c838bfae4050abc87b53b09670bf
[]
no_license
un-knower/ns
2e96eaed33a8cde70dbf5914764a2c61841858c9
a4b05880b4de1587f62d7af05d1d46e9e0cd27e7
refs/heads/master
2020-04-11T11:30:31.954717
2018-08-10T09:01:32
2018-08-10T09:01:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,850
java
package com.newsee.owner.service.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.newsee.owner.dao.BillBillDetailBusinessMapper; import com.newsee.owner.dao.BillBillUsedDetailMapper; import com.newsee.owner.dao.BillBillUsedMapper; import com.newsee.owner.dao.WyglChargeChargePaymentMapper; import com.newsee.owner.dao.WyglChargeCustomerChargeDetailMapper; import com.newsee.owner.entity.BillBillDetailBusiness; import com.newsee.owner.entity.BillBillUsedDetail; import com.newsee.owner.entity.BillBillUsedWithBLOBs; import com.newsee.owner.entity.WyglChargeChargePayment; import com.newsee.owner.entity.WyglChargeCustomerChargeDetail; import com.newsee.owner.service.IPressureTestService; import com.newsee.owner.vo.WyglChargeChargePaymentVO; import com.newsee.owner.vo.WyglChargeCustomerChargeDetailVO; /** * Created by niyang on 2017/8/24. */ @Service public class PressureTestServiceImpl implements IPressureTestService { @Autowired private BillBillUsedMapper billbillUsedMapper; @Autowired private WyglChargeChargePaymentMapper wyglChargeChargePaymentMapper; @Autowired private WyglChargeCustomerChargeDetailMapper wyglChargeCustomerChargeDetailMapper; @Autowired private BillBillDetailBusinessMapper billBillDetailBusinessMapper; @Autowired private BillBillUsedDetailMapper billBillUsedDetailMapper; @Override // @ReadDataSource public PageInfo<WyglChargeCustomerChargeDetail> listPage(WyglChargeCustomerChargeDetailVO vo) { PageInfo<WyglChargeCustomerChargeDetail> pageInfo = null; if (vo != null) { PageHelper.startPage(vo.getPageIndex(), vo.getPageSize()); Map<String,Object> searchParam=new HashMap<>(); searchParam.put("CustomerID",vo.getCustomerId()); searchParam.put("IsPaid",vo.getPaid()); List<WyglChargeCustomerChargeDetail> list = wyglChargeCustomerChargeDetailMapper.loadList(searchParam); pageInfo = new PageInfo<>(list); } return pageInfo; } @Override //@WriteDataSource public Boolean payTheFees(WyglChargeChargePaymentVO vo) { List<WyglChargeCustomerChargeDetail> detailList=vo.getDetailList(); List<WyglChargeChargePayment> paymentList=new ArrayList<>(); for (WyglChargeCustomerChargeDetail detailVo:detailList) { WyglChargeChargePayment wyglChargeChargePayment=new WyglChargeChargePayment(); BeanUtils.copyProperties(detailVo,wyglChargeChargePayment); paymentList.add(wyglChargeChargePayment); } wyglChargeChargePaymentMapper.insertList(paymentList); wyglChargeCustomerChargeDetailMapper.updateByCustomerId(vo.getCustomerId()); BillBillUsedWithBLOBs billBillUsedWithBLOBs=new BillBillUsedWithBLOBs(); billBillUsedWithBLOBs.setBillcode(UUID.randomUUID().toString()); billbillUsedMapper.insertSelective(billBillUsedWithBLOBs); BillBillUsedDetail billBillUsedDetail=new BillBillUsedDetail(); billBillUsedDetail.setRemark("test"); billBillUsedDetailMapper.insertSelective(billBillUsedDetail); BillBillDetailBusiness billBillDetailBusiness=new BillBillDetailBusiness(); billBillDetailBusiness.setTablename("Wygl_Charge_ChargePayment"); billBillDetailBusiness.setBilldetailid(billBillUsedDetail.getId()); billBillDetailBusiness.setBusinessid(1L); billBillDetailBusinessMapper.insertSelective(billBillDetailBusiness); return true; } }
[ "1493562758@qq.com" ]
1493562758@qq.com
98659ca0aa6bc77eee5eb1ca9644af3b627b1783
b694015c77f79631a2148e5d51ced10190848114
/pinyougou_pojo/src/main/java/com/pinyougou/entity/Result.java
a6571a9a7f44c82db854eac86a697796977bda2c
[]
no_license
RainyMorning1995/pingyougou
2af37fc674e24e0b154eabb22a355ad0dd8fa022
76bfc5976e09b1d9acbbb313f1f6da96ffe93503
refs/heads/master
2022-07-14T16:17:43.596508
2019-06-25T03:16:10
2019-06-25T03:16:10
193,087,942
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package com.pinyougou.entity; import java.io.Serializable; public class Result implements Serializable { private Boolean success; private String message; @Override public String toString() { return "Result{" + "success=" + success + ", message='" + message + '\'' + '}'; } public Result() { } public Result(Boolean success, String message) { this.success = success; this.message = message; } public Boolean getSuccess() { return success; } public void setSuccess(Boolean success) { this.success = success; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
[ "120564719@qq.com" ]
120564719@qq.com
63ff15e4d3a8c7c02d3ae5019ef4a87908ce6bbb
56e4e0fcff3a4c0dbe1c05fdec8785161741e019
/spring-boot-data-jdbc/src/test/java/io/github/dunwu/springboot/SpringBootDataJdbcApplicationTests.java
08a2124ff3f0564482f3570cd05f66b2d5ffaf86
[ "MIT" ]
permissive
R4Jay/spring-boot-tutorial
f42e9fa099a4a4e5b067234e4fe9a3af552010c1
4abdf5d9f6359e947239f22188458dc59440fb1d
refs/heads/master
2020-09-09T21:46:01.853581
2019-11-14T02:48:56
2019-11-14T02:48:56
221,579,354
0
0
MIT
2019-11-14T00:44:05
2019-11-14T00:44:04
null
UTF-8
Java
false
false
2,224
java
package io.github.dunwu.springboot; import io.github.dunwu.springboot.data.User; import io.github.dunwu.springboot.data.UserDao; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import java.util.ArrayList; import java.util.List; @Rollback @RunWith(SpringRunner.class) @SpringBootTest(classes = { SpringBootDataJdbcApplication.class }) public class SpringBootDataJdbcApplicationTests { private static final Logger log = LoggerFactory.getLogger(SpringBootDataJdbcApplicationTests.class); @Autowired private UserDao userDAO; @Test public void batchInsert() { List<User> users = new ArrayList<>(); users.add(new User("张三", 21, "南京", "xxx@163.com")); users.add(new User("李四", 28, "上海", "xxx@163.com")); users.add(new User("王五", 24, "北京", "xxx@163.com")); users.add(new User("赵六", 31, "广州", "xxx@163.com")); userDAO.batchInsert(users); int count = userDAO.count(); Assert.assertEquals(4, count); List<User> list = userDAO.list(); Assert.assertNotNull(list); Assert.assertEquals(4, list.size()); list.forEach(user -> { log.info(user.toString()); }); } @Before public void before() { userDAO.recreateTable(); } @Test public void delete() { userDAO.insert(new User("张三", 21, "南京", "xxx@163.com")); userDAO.deleteByName("张三"); User zhangsan = userDAO.queryByName("张三"); Assert.assertNull(zhangsan); } @Test public void insert() { userDAO.insert(new User("张三", 21, "南京", "xxx@163.com")); User linda = userDAO.queryByName("张三"); Assert.assertNotNull(linda); } @Test public void update() { userDAO.insert(new User("张三", 21, "南京", "xxx@163.com")); User zhangsan = userDAO.queryByName("张三"); zhangsan.setName("张三丰"); userDAO.update(zhangsan); User jack = userDAO.queryByName("张三丰"); Assert.assertNotNull(jack); } }
[ "forbreak@163.com" ]
forbreak@163.com
bec8e7a0c694dc61cae1a318bcc68ed91bab3465
9016ae5ded894f4dce6e93c67339268902018287
/app/src/main/java/com/example/coolweather/gson/Basic.java
bf4a996473c72361131eb2f1b4c1dbdeb0839ac1
[ "Apache-2.0" ]
permissive
CY12/coolweather
5e0e9bf8babcf460a939d62228e943f5215a630f
14902d22d07c843ea13f7068c515b93b3046e376
refs/heads/master
2020-05-03T18:32:27.233885
2019-04-13T04:12:06
2019-04-13T04:12:06
178,764,999
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.example.coolweather.gson; import com.google.gson.annotations.SerializedName; public class Basic { @SerializedName ("city") public String cityName; @SerializedName ("id") public String weatherId; public Update update; public class Update{ @SerializedName ("loc") public String updateTime; } }
[ "1760602119@qq.com" ]
1760602119@qq.com
dca74dee5567af58ecc8bef15d62cf364fd28a33
a48040802df70e0bcb65a245547385f4519db283
/src/main/java/com/ztzf/dao/IMessageDao.java
984ee96e7960995c50ebb1e576d240e4b1ed633a
[]
no_license
yifan366/ssh-demo
fd91bfd293aafff00a45fe950e1b205e91702957
1fef6201f663758306bffed18fa7e9095941393b
refs/heads/master
2021-01-18T04:12:32.559739
2017-03-08T03:14:16
2017-03-08T03:14:16
84,272,410
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package com.ztzf.dao; import java.util.List; import com.ztzf.basedao.IBaseDao; import com.ztzf.model.Message; public interface IMessageDao extends IBaseDao<Message>{ public List<Message> list(); }
[ "408250214@qq.com" ]
408250214@qq.com
33428953824c319908edf05692490f09da323559
657aa3abf509b20d1c752d181bb5f944bcbaa5ae
/src/com/tomovwgti/atnd/AtndEventInfo.java
9993ed77e056396596d805796619672ad8b49d46
[]
no_license
tomovwgti/ATNDPlugIn
5c50f2bca795388bc0ab6a06f37ac4b6a3dc75e4
23273dc102aef0bd634e5ce36e7cfd9218defe78
refs/heads/master
2016-09-06T14:09:27.573555
2011-12-24T08:21:49
2011-12-24T08:21:49
1,171,302
0
1
null
null
null
null
UTF-8
Java
false
false
10,649
java
package com.tomovwgti.atnd; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.text.Html; import android.text.method.LinkMovementMethod; import android.text.method.MovementMethod; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.ScrollView; import android.widget.TextView; import com.tomovwgti.atnd.lib.Iso8601; /** * ATNDの登録イベント一覧を表示する */ public class AtndEventInfo extends Activity { private AtndEventResult event = null; private TextView eventTitle; private View viewOwner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.eventinfo); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); event = bundle.getParcelable("EVENT"); eventTitle = (TextView) findViewById(R.id.eventtitle); eventTitle.setText(event.title); eventTitle.setTextColor(Color.GREEN); eventTitle.setBackgroundColor(Color.DKGRAY); // 詳細ページへジャンプ eventTitle.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://atnd.org/events/" + event.event_id)); startActivity(intent); } }); // 参加者一覧を表示する TextView participant = (TextView) findViewById(R.id.participant); participant.setTextColor(Color.BLUE); participant.setBackgroundColor(Color.LTGRAY); participant.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // 参加者の取得 Intent intent = new Intent(AtndEventInfo.this, AtndUsers.class); intent.putExtra("EVENTID", event.event_id); intent.putExtra("EVENT", event.title); startActivity(intent); } }); ListView listView = (ListView) findViewById(R.id.eventinfo); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, eventInfolist); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { String item = event.getItem(position + 1); View view = null; switch (position) { case 0: // 概要 view = descriptionInfo(item); break; case 1: // 主催者 ownerInfo(item); view = viewOwner; break; case 2: // 場所 view = addressInfo(item); break; case 3: // 会場 view = venueInfo(item); break; case 4: // 開始時間 case 5: // 終了時間 view = daytimeInfo(item); break; case 6: // 地図 mapInfo(item); return; } new AlertDialog.Builder(AtndEventInfo.this).setView(view).show(); } }); // 主催者のみ特別に呼ばれたときに生成しておく // 主催者のTwitterアイコンを読み込んでおく final ImageDownloader imageDownloader = new ImageDownloader(); // ContextからLayoutInflaterを取得 LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); viewOwner = inflater.inflate(R.layout.listview_item, null); // アイコンにTwitter imgを設定 ImageView imageView = (ImageView) viewOwner.findViewWithTag("icon"); // 主催者イメージをダウンロード if (event.icon == null) { imageView.setImageDrawable(getResources().getDrawable(R.drawable.mogu)); } else { imageDownloader.download(event.icon, imageView); } } /** * 概要 * * @param item * @return */ private View descriptionInfo(String item) { TextView tv = new TextView(AtndEventInfo.this); tv.setText(item); tv.setTextSize(18); ScrollView sv = new ScrollView(AtndEventInfo.this); sv.addView(tv); return sv; } /** * 主催者 * * @param item * @return */ private void ownerInfo(String item) { // テキストにTwitter idを設定 TextView textView = (TextView) viewOwner.findViewWithTag("text"); textView.setText(item); if (event.IsOwner) { textView = viewId(textView); } } /** * 場所 * * @param item * @return */ private View addressInfo(String item) { TextView tv = new TextView(AtndEventInfo.this); tv.setText(item); tv.setTextSize(20); tv.setGravity(Gravity.CENTER_HORIZONTAL); ScrollView sv = new ScrollView(AtndEventInfo.this); sv.addView(tv); searchWeb(tv, item); return sv; } /** * 会場 * * @param item * @return */ private View venueInfo(String item) { TextView tv = new TextView(AtndEventInfo.this); tv.setText(item); tv.setTextSize(20); tv.setGravity(Gravity.CENTER_HORIZONTAL); ScrollView sv = new ScrollView(AtndEventInfo.this); sv.addView(tv); searchWeb(tv, item); return sv; } /** * 開始時間・終了時間 * * @param item * @return */ private View daytimeInfo(String item) { TextView tv = new TextView(AtndEventInfo.this); String daytime = Iso8601.getString(item); tv.setText(daytime); tv.setTextSize(24); tv.setGravity(Gravity.CENTER_HORIZONTAL); ScrollView sv = new ScrollView(AtndEventInfo.this); sv.addView(tv); return sv; } /** * 地図表示 * * @param item */ private void mapInfo(String item) { final String maps = item; final AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setTitle("地図を表示"); // 表示項目の配列 final CharSequence[] which = { "ピンポイント地図", "Google Maps" }; dialog.setItems(which, new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent mapIntent = null; switch (which) { case 0: // ピンポイント地図 mapIntent = new Intent(); mapIntent.setClassName("com.tomovwgti.atnd", "com.tomovwgti.atnd.PointMapView"); mapIntent.putExtra("LATLON", maps); mapIntent.putExtra("PLACE", event.getItem(4)); // 会場の名称 break; case 1: // Google Maps mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(maps + "?z=18")); break; } startActivity(mapIntent); } }); // ダイアログを表示 dialog.create().show(); } private TextView viewId(TextView tv) { // LinkMovementMethod のインスタンスを取得します MovementMethod movementmethod = LinkMovementMethod.getInstance(); // TextView に LinkMovementMethod を登録します tv.setMovementMethod(movementmethod); // <a>タグを含めたテキストを用意します String html = "<a href=\"http://twitter.com/" + tv.getText().toString() + "\">" + tv.getText().toString() + "</a>"; // URLSpan をテキストにを組み込みます CharSequence spanned = Html.fromHtml(html); tv.setText(spanned); return tv; } /** * Webでサーチする * * @param v * @param search */ private void searchWeb(View v, final String search) { v.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final AlertDialog.Builder alert = new AlertDialog.Builder(AtndEventInfo.this); alert.setMessage("Webで\"" + search + "\"を検索します"); // Positiveボタンとリスナを設定 alert.setPositiveButton("OK", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri .parse("http://www.google.co.jp/search?q=" + search)); startActivity(intent); } }); alert.setNegativeButton("CANCEL", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); } }); } private static final String eventInfolist[] = { AtndEventResult.DESC, AtndEventResult.OWNER, AtndEventResult.ADDRESS, AtndEventResult.PLACE, AtndEventResult.START, AtndEventResult.END, AtndEventResult.MAP }; }
[ "tomovwgti@gmail.com" ]
tomovwgti@gmail.com
553b220377b91453fa637c1ef397ee20a4afb7ab
2886165c51499f65748650d9cec9ef78a3988ee4
/src/main/java/com/jTranProc/Common/ThreadedTpSvc.java
7a1588988dc669078c9d1035d527a9e0300d49c5
[]
no_license
MAhsan-Raza/jTransactionProcessorPOC
9a4026543bcb71791cf797dc5f470ac1b04bf69b
a3a95476f3347953fad79fff2cdf8a602fbba4c1
refs/heads/master
2023-01-29T19:10:38.261459
2020-12-10T12:22:58
2020-12-10T12:22:58
298,562,781
0
0
null
null
null
null
UTF-8
Java
false
false
2,159
java
package com.jTranProc.Common; import com.jTranProc.Common.Enums.ServiceType; import com.jTranProc.Common.Interfaces.IMsgBroker; import com.jTranProc.Common.Interfaces.ITPSvc; import com.jTranProc.Common.UtilityClass.JLogger; import java.util.ArrayList; public abstract class ThreadedTpSvc implements ITPSvc { @Override public void Initialize(IMsgBroker imb, int nThreads) { this.NumThreads = nThreads; this.MsgBroker = imb; this.IsRunning = true; this.SvcThreadGroups = new ArrayList<>(); for(Integer i=0; i<this.NumThreads; i++){ SvcThreadGroups.add(new Thread(this::ProcThreadMethod)); } } @Override public void Start() { JLogger.Get().WriteTrace("Starting SvcThreadGroups threads"); for(Thread t : this.SvcThreadGroups) t.start(); } @Override public void Stop() { try { JLogger.Get().WriteTrace("Stopping SvcThreadGroups threads, svc type: " + this.GetServiceType().toString()); this.IsRunning = false; for (Thread t : this.SvcThreadGroups) t.join(); } catch (Exception ex){ JLogger.Get().WriteTrace( "Failed stopping SvcThreadGroups threads, svc type: " + this.GetServiceType().toString()); } } protected void ProcThreadMethod(){ while(this.IsRunning) { try { Object msg = this.MsgBroker.TryGetMessage(this.GetServiceType()); this.ProcessMessage(msg); } catch (InterruptedException ex) { JLogger.Get().WriteTrace("ProcThreadMethod thread Interrupted for service [" + this.GetServiceType().toString() + "], error: " + ex.getMessage()); return; } } } public abstract void ProcessMessage(Object msg); public abstract ServiceType GetServiceType(); protected IMsgBroker MsgBroker; private int NumThreads; protected volatile Boolean IsRunning; private ArrayList<Thread> SvcThreadGroups; }
[ "ahsan.ssuet@gmail.com" ]
ahsan.ssuet@gmail.com
5be244f73d8ea52ad396010588f8dc3e802b487a
bae06dd473b2e5ea1043741b56b671ed42c746c2
/week1-bankproject-3/src/main/java/com/revature/dao/DAO.java
7b9ce0879c7fa3b3cd54454926bd372cd65e03f2
[]
no_license
cshanor/Project-Zero----Bank-Application
247c34a954ec4fec90f9ccde096af8ece05aa8b3
71127bb81e497450c4b00dc5c9e5ec8936c091d8
refs/heads/master
2020-04-25T05:18:32.525180
2019-04-25T16:46:25
2019-04-25T16:46:25
172,538,084
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.revature.dao; import java.util.List; public interface DAO<T> { List<T> getAll(); T getById(int id); T add(T obj); T update(T updatedObj); boolean delete(int id); }
[ "noreply@github.com" ]
cshanor.noreply@github.com
6f54f07901d285002e892cfcfb54bd23b2e994a7
74c9f5cb23ecc9ca0be66cb6ce635fcb802d06a3
/TvPal/src/main/java/is/gui/shows/SingleSeasonActivity.java
fab3e4bf677e888fb8eca014eb34587dd40f8c7a
[]
no_license
arnarinn1/TVPal
209e29b1a2c7f9c5c6bb626c1d51bc84861bf302
1abee6dd1a12b6ef39e44cbcb3dd3f64cbf7b40e
refs/heads/master
2021-01-22T06:36:49.474956
2014-08-17T17:28:20
2014-08-17T17:28:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,835
java
package is.gui.shows; import android.annotation.TargetApi; import android.content.Intent; import android.database.Cursor; import android.os.Build; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import is.gui.base.BaseActivity; import is.handlers.adapters.SingleSeasonAdapter; import is.handlers.database.DbEpisodes; import is.tvpal.R; /** * Displays all episodes of a single season of some series * @author Arnar */ public class SingleSeasonActivity extends BaseActivity implements AdapterView.OnItemClickListener { public static final String EXTRA_SERIESID = "is.activites.showActivities.SERIESID"; public static final String EXTRA_SEASONNR = "is.activites.showActivities.SEASONNR"; public static final String EXTRA_EPISODENR = "is.activites.showActivities.EPISODENR"; public static final String EXTRA_SELECTED = "is.activites.showActivities.SELECTED"; private SingleSeasonAdapter mAdapter; private ListView mListView; private DbEpisodes mDB; private int _seriesId; private int _season; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_single_season); Initialize(); } @Override protected void onResume() { super.onResume(); mAdapter.swapCursor(mDB.GetCursorEpisodes(_seriesId, _season)); mAdapter.notifyDataSetChanged(); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void Initialize() { mDB = new DbEpisodes(this); Intent intent = getIntent(); _seriesId = intent.getIntExtra(SeasonFragment.EXTRA_SERIESID, 0); _season = intent.getIntExtra(SeasonFragment.EXTRA_SEASON, 0); setTitle(String.format("Season %s", _season)); mListView = (ListView) findViewById(R.id.episode_single_season); mListView.setOnItemClickListener(this); mAdapter = new SingleSeasonAdapter(this, mDB.GetCursorEpisodes(_seriesId, _season), 0, _seriesId, _season); mListView.setAdapter(mAdapter); getActionBar().setDisplayHomeAsUpEnabled(true); } @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Cursor selectedEpisode = (Cursor) mAdapter.getItem(position); Intent intent = new Intent(this, EpisodeActivity.class); intent.putExtra(EXTRA_SERIESID, selectedEpisode.getInt(1)); intent.putExtra(EXTRA_SEASONNR, selectedEpisode.getInt(2)); intent.putExtra(EXTRA_EPISODENR, selectedEpisode.getInt(3)); intent.putExtra(EXTRA_SELECTED, position); startActivity(intent); overridePendingTransition(R.anim.fade_in_activity, R.anim.fade_out_activity); } }
[ "arnarh91@gmail.com" ]
arnarh91@gmail.com
aff512483845895af4adbfe19598fef9af6091ea
adc2299fa37ce1325aadffc0f2b2a6d85a8a8f89
/ExamSystem/src/db/Testquestion.java
23885946af34e9a31dd28fe6e47a48213c0b81f7
[]
no_license
weizhang668/JavaEE
c3293db4ecd06392805f05d31c947e6bcc796efb
af3b83ecc1074f42a66718523fe7da5aec96482f
refs/heads/master
2021-07-23T23:10:39.813256
2019-11-29T07:10:13
2019-11-29T07:10:13
224,757,437
0
0
null
2020-10-13T17:50:16
2019-11-29T01:51:47
Java
UTF-8
Java
false
false
1,162
java
package db; /** * @Auther: 张伟 * @Date: 2019/11/19 * @Description: package01.model * @version: 1.0 */ public class Testquestion { private String questionText = "";//定义题目 private String standardkey = "";// 定义正确答案 private String selectKey = "";// 定义输入答案 public Testquestion(String questionText, String standardkey) { super(); this.questionText = questionText; this.standardkey = standardkey; } public String getQuestionText() { return questionText; } public void setQuestionText(String questionText) { this.questionText = questionText; } public String getStandardkey() { return standardkey; } public void setStandardkey(String standardkey) { this.standardkey = standardkey; } public String getSelectKey() { return selectKey; } public void setSelectKey(String selectKey) { this.selectKey = selectKey; } public boolean check() { if (this.selectKey.equals(this.standardkey)) { return true; } else { return false; } } }
[ "wei_zhang668@163.com" ]
wei_zhang668@163.com
2a57b8e22578ed5d36b45e324d24b044dba31664
0394232752cb9f81882692d2cc971e24604990f5
/src/dessert/controller/ajax/MemberCancelController.java
60920fdf951f90777a99d5bef9b1fd22a866b306
[]
no_license
zengchunhui/DessertHouse-own
e199d55c5e3801b3b40af321b009f6bf19084f43
a4215188873a93ee7e596898c5297583083a476d
refs/heads/master
2021-01-24T23:00:43.202472
2016-03-16T14:16:30
2016-03-16T14:16:30
53,712,003
0
0
null
null
null
null
UTF-8
Java
false
false
1,202
java
package dessert.controller.ajax; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import dessert.configure.Configure; import dessert.controller.AjaxController; import dessert.rvo.ResultVO; import dessert.service.MemberService; import dessert.util.FormValidator; @Controller("cancelMember") public class MemberCancelController extends AjaxController{ private static final long serialVersionUID = 1L; @Autowired MemberService memberService; @Override public String execute() throws Exception { return controller(response(), request()); } @Override public void validate(Map<String, String> params, FormValidator validator) { } @Override public String process(FormValidator validator) { // TODO Auto-generated method stub String id=(String)session().getAttribute(Configure.ID); ResultVO rvo=memberService.stopMembercard(id); Map<String, Object> map=new HashMap<>(); map.put(Configure.SUCCESS, rvo.getSuccess()); map.put(Configure.MESSAGE, rvo.getMessage()); setJsonResult(map); return Configure.SUCCESS; } }
[ "919169204@qq.com" ]
919169204@qq.com
de1f3f3a0a8541ce8c897f3158d6c7d316703d7e
412717679c090931c7bcc42d4da0e96610a87223
/Selenium/src/main/java/seleniumDemo/Mobile.java
fbc667cc5af0b3f1ed6ecd16e7c51e297ca22b6d
[]
no_license
taherachowdhury/selenium
1aa1cf149ece322b24fc4f5f6febe20152bc2758
b00b3d665ef32a63f8147ddb7bc8253e4a3d9d87
refs/heads/master
2023-01-29T10:13:23.670051
2020-12-07T03:53:51
2020-12-07T03:53:51
319,196,164
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
package seleniumDemo; public class Mobile { public static void main(String[] args) { // TODO Auto-generated method stub Mobile obj = new Mobile(); obj.camera(); obj.charger(); obj.video(); obj.call(); } public void camera() { System.out.println("take pictures"); } private void charger() { System.out.println("I can cahrge my phone"); } void video() { System.out.println("we cn do video call"); } protected void call() { System.out.println("we can talk"); } }
[ "Lipac@LAPTOP-FF4L5OJ9.Home" ]
Lipac@LAPTOP-FF4L5OJ9.Home
cda93c1d205ce1b66fee8937041f4f9855d9695f
2f4a058ab684068be5af77fea0bf07665b675ac0
/app/com/facebook/orca/app/MessagesModule$AnchorableToastProvider.java
076ecf1824a60e8be29ec3dd96d500ac154e94b7
[]
no_license
cengizgoren/facebook_apk_crack
ee812a57c746df3c28fb1f9263ae77190f08d8d2
a112d30542b9f0bfcf17de0b3a09c6e6cfe1273b
refs/heads/master
2021-05-26T14:44:04.092474
2013-01-16T08:39:00
2013-01-16T08:39:00
8,321,708
1
0
null
null
null
null
UTF-8
Java
false
false
743
java
package com.facebook.orca.app; import android.content.Context; import android.view.LayoutInflater; import com.facebook.orca.common.ui.widgets.AnchorableToast; import com.facebook.orca.inject.AbstractProvider; class MessagesModule$AnchorableToastProvider extends AbstractProvider<AnchorableToast> { private MessagesModule$AnchorableToastProvider(MessagesModule paramMessagesModule) { } public AnchorableToast a() { return new AnchorableToast((Context)b(Context.class), (LayoutInflater)b(LayoutInflater.class)); } } /* Location: /data1/software/jd-gui/com.facebook.katana_2.0_liqucn.com-dex2jar.jar * Qualified Name: com.facebook.orca.app.MessagesModule.AnchorableToastProvider * JD-Core Version: 0.6.0 */
[ "macluz@msn.com" ]
macluz@msn.com
65e28777a472b59f7910416427c2d9abb90d00c2
c159f53e6cf8f1b12625b61c2a5cc7d891cc9ca2
/src/main/java/de/uni/bielefeld/sc/hterhors/psink/obie/projects/scio/ontology/interfaces/IBBBSubscoreTest.java
1d3dbe0137a13b0f78a2a7c29235cfe13b7ef7a6
[ "Apache-2.0" ]
permissive
ag-sc/SpinalCordInjuryOBIE
42b778eee39a0bd57e2b75616436b4553ac1a530
7745c73b6ddc66c921fbc5de8ca55cb045e0c195
refs/heads/master
2022-10-03T21:59:54.827880
2019-03-29T11:16:38
2019-03-29T11:16:38
156,360,172
1
1
Apache-2.0
2022-09-01T22:59:29
2018-11-06T09:38:56
Java
UTF-8
Java
false
false
2,070
java
package de.uni.bielefeld.sc.hterhors.psink.obie.projects.scio.ontology.interfaces; import de.hterhors.obie.core.ontology.AbstractIndividual; import de.hterhors.obie.core.ontology.IndividualFactory; import de.hterhors.obie.core.ontology.annotations.AssignableSubClasses; import de.hterhors.obie.core.ontology.annotations.AssignableSubInterfaces; import de.hterhors.obie.core.ontology.annotations.DatatypeProperty; import de.hterhors.obie.core.ontology.annotations.DirectInterface; import de.hterhors.obie.core.ontology.annotations.DirectSiblings; import de.hterhors.obie.core.ontology.annotations.ImplementationClass; import de.hterhors.obie.core.ontology.annotations.OntologyModelContent; import de.hterhors.obie.core.ontology.annotations.RelationTypeCollection; import de.hterhors.obie.core.ontology.annotations.SuperRootClasses; import de.hterhors.obie.core.ontology.annotations.TextMention; import de.hterhors.obie.core.ontology.interfaces.IDatatype; import de.hterhors.obie.core.ontology.interfaces.IOBIEThing; import de.uni.bielefeld.sc.hterhors.psink.obie.projects.scio.ontology.classes.*; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; /** <p><b>scio:example</b> <p>We found that neither erythropoietin nor darbepoetin led to improved behavioral recovery over saline controls, with no significant differences observed in BBB scores, BBB subscores, footfall errors on horizontal ladder testing, width of hindlimb base of support, or threshold for paw withdrawal on sensory testing. <p> <p><b>rdfs:label</b> <p>bbb subscore test <p> <p><b>rdfs:description</b> <p>BBB Subscore Test is a system to rate single locomotion abilities in a 7-point scale originating from the Basso-Beattie-Bresnahan locomotor scale. <p> <p><b>scio:clinicalTerm</b> <p>false <p> <p><b>scio:exampleSource</b> <p>doi: 10.1016/j.expneurol.2007.12.013 <p> * * @author hterhors * * *Mar 19, 2019 */ @AssignableSubInterfaces(get={}) @ImplementationClass(get=BBBSubscoreTest.class) public interface IBBBSubscoreTest extends INeurologicScalesTest{ }
[ "hterhors@techfak.uni-bielefeld.de" ]
hterhors@techfak.uni-bielefeld.de
49da5653da930dc6a5944c4e54223a083d3ea0c8
e8800c7dab29ddeee6cb224ec899b0740e5d1d78
/lostIsland/src/main/java/edu/upc/eetac/dsa/exception/UserNoMoneyException.java
fd9c264359ce72f39bf95366a8673cfeea5d2106
[]
no_license
SergiVera/lost-island-server
cbe7f9e20be9f0c94e5fa0ea2871af8b636ef743
050f1b00f90271ae40b1f9bfcc5df31905820516
refs/heads/master
2020-04-11T19:20:40.369665
2019-01-21T13:18:39
2019-01-21T13:18:39
162,030,963
2
0
null
null
null
null
UTF-8
Java
false
false
94
java
package edu.upc.eetac.dsa.exception; public class UserNoMoneyException extends Exception { }
[ "sergitus1998@gmail.com" ]
sergitus1998@gmail.com
59ba3f6cb9dcb2a6c58fbe6f8e0aef22d343bfda
f2053b0798126e71ece43a7698f90d940dfe238d
/app/src/main/java/com/example/nano/myapplication/menu/TitleMenu.java
09e0ab682d2381bafb45311ed702382c2115d4d9
[]
no_license
ajaygosh102/NavigationDrawerExpandableList
19a4748c338b15915d51e05ecee1400463b7b4a4
19e7101f0f048a8ccd12d98230aedff7c1e1205b
refs/heads/master
2020-03-08T19:32:47.091371
2018-04-06T06:48:49
2018-04-06T06:48:49
128,356,475
0
0
null
null
null
null
UTF-8
Java
false
false
467
java
package com.example.nano.myapplication.menu; import com.thoughtbot.expandablerecyclerview.models.ExpandableGroup; import java.util.List; public class TitleMenu extends ExpandableGroup<SubTitle> { private int imageResource = 0; public TitleMenu(String title, List<SubTitle> items, int imageResource) { super(title, items); this.imageResource = imageResource; } public int getImageResource() { return imageResource; } }
[ "ajayghosh102@gmail.com" ]
ajayghosh102@gmail.com
c9837441991cd992f8d8f316b3e51bf3349d79b2
365cdb50bfc0173d06831556bad5a64ce3a90c94
/MADProject/app/build/generated/source/r/debug/android/support/slidingpanelayout/R.java
28443c3ce46af06524ec5993efbc22bafa4e6850
[]
no_license
AdnanMuhib/Rubricon
c8075a96809eb0f02c1806d92f03462b47edbb8c
83682c7ea733548aa1de430e9adebed5086c90d6
refs/heads/master
2020-04-11T16:32:33.127134
2019-10-08T12:00:34
2019-10-08T12:00:34
161,927,756
1
1
null
2019-10-08T12:00:36
2018-12-15T17:21:34
Java
UTF-8
Java
false
false
10,178
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.slidingpanelayout; public final class R { public static final class attr { public static final int alpha = 0x7f040027; public static final int font = 0x7f0400d7; public static final int fontProviderAuthority = 0x7f0400d9; public static final int fontProviderCerts = 0x7f0400da; public static final int fontProviderFetchStrategy = 0x7f0400db; public static final int fontProviderFetchTimeout = 0x7f0400dc; public static final int fontProviderPackage = 0x7f0400dd; public static final int fontProviderQuery = 0x7f0400de; public static final int fontStyle = 0x7f0400df; public static final int fontVariationSettings = 0x7f0400e0; public static final int fontWeight = 0x7f0400e1; public static final int ttcIndex = 0x7f040208; } public static final class color { public static final int notification_action_color_filter = 0x7f06006b; public static final int notification_icon_bg_color = 0x7f06006c; public static final int ripple_material_light = 0x7f060076; public static final int secondary_text_default_material_light = 0x7f060078; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f07004e; public static final int compat_button_inset_vertical_material = 0x7f07004f; public static final int compat_button_padding_horizontal_material = 0x7f070050; public static final int compat_button_padding_vertical_material = 0x7f070051; public static final int compat_control_corner_material = 0x7f070052; public static final int compat_notification_large_icon_max_height = 0x7f070053; public static final int compat_notification_large_icon_max_width = 0x7f070054; public static final int notification_action_icon_size = 0x7f0700c0; public static final int notification_action_text_size = 0x7f0700c1; public static final int notification_big_circle_margin = 0x7f0700c2; public static final int notification_content_margin_start = 0x7f0700c3; public static final int notification_large_icon_height = 0x7f0700c4; public static final int notification_large_icon_width = 0x7f0700c5; public static final int notification_main_column_padding_top = 0x7f0700c6; public static final int notification_media_narrow_margin = 0x7f0700c7; public static final int notification_right_icon_size = 0x7f0700c8; public static final int notification_right_side_padding_top = 0x7f0700c9; public static final int notification_small_icon_background_padding = 0x7f0700ca; public static final int notification_small_icon_size_as_large = 0x7f0700cb; public static final int notification_subtext_size = 0x7f0700cc; public static final int notification_top_pad = 0x7f0700cd; public static final int notification_top_pad_large_text = 0x7f0700ce; } public static final class drawable { public static final int notification_action_background = 0x7f080086; public static final int notification_bg = 0x7f080087; public static final int notification_bg_low = 0x7f080088; public static final int notification_bg_low_normal = 0x7f080089; public static final int notification_bg_low_pressed = 0x7f08008a; public static final int notification_bg_normal = 0x7f08008b; public static final int notification_bg_normal_pressed = 0x7f08008c; public static final int notification_icon_background = 0x7f08008d; public static final int notification_template_icon_bg = 0x7f08008e; public static final int notification_template_icon_low_bg = 0x7f08008f; public static final int notification_tile_bg = 0x7f080090; public static final int notify_panel_notification_icon_bg = 0x7f080091; } public static final class id { public static final int action_container = 0x7f0a0027; public static final int action_divider = 0x7f0a0029; public static final int action_image = 0x7f0a002a; public static final int action_text = 0x7f0a0030; public static final int actions = 0x7f0a0031; public static final int async = 0x7f0a0037; public static final int blocking = 0x7f0a003b; public static final int chronometer = 0x7f0a005a; public static final int forever = 0x7f0a0080; public static final int icon = 0x7f0a0087; public static final int icon_group = 0x7f0a0088; public static final int info = 0x7f0a00a2; public static final int italic = 0x7f0a00a4; public static final int line1 = 0x7f0a00aa; public static final int line3 = 0x7f0a00ab; public static final int normal = 0x7f0a00bb; public static final int notification_background = 0x7f0a00bc; public static final int notification_main_column = 0x7f0a00bd; public static final int notification_main_column_container = 0x7f0a00be; public static final int right_icon = 0x7f0a00da; public static final int right_side = 0x7f0a00db; public static final int tag_transition_group = 0x7f0a010a; public static final int tag_unhandled_key_event_manager = 0x7f0a010b; public static final int tag_unhandled_key_listeners = 0x7f0a010c; public static final int text = 0x7f0a010e; public static final int text2 = 0x7f0a010f; public static final int time = 0x7f0a011b; public static final int title = 0x7f0a011c; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f0b000e; } public static final class layout { public static final int notification_action = 0x7f0d003e; public static final int notification_action_tombstone = 0x7f0d003f; public static final int notification_template_custom_big = 0x7f0d0040; public static final int notification_template_icon_group = 0x7f0d0041; public static final int notification_template_part_chronometer = 0x7f0d0042; public static final int notification_template_part_time = 0x7f0d0043; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f100036; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f110115; public static final int TextAppearance_Compat_Notification_Info = 0x7f110116; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f110117; public static final int TextAppearance_Compat_Notification_Time = 0x7f110118; public static final int TextAppearance_Compat_Notification_Title = 0x7f110119; public static final int Widget_Compat_NotificationActionContainer = 0x7f1101bf; public static final int Widget_Compat_NotificationActionText = 0x7f1101c0; } public static final class styleable { public static final int[] ColorStateListItem = { 0x010101a5, 0x0101031f, 0x7f040027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0400d9, 0x7f0400da, 0x7f0400db, 0x7f0400dc, 0x7f0400dd, 0x7f0400de }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f0400d7, 0x7f0400df, 0x7f0400e0, 0x7f0400e1, 0x7f040208 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2, 0x010101a3, 0x010101a4, 0x01010201, 0x0101020b, 0x01010510, 0x01010511, 0x01010512, 0x01010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x010101a5, 0x01010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "hamza.afzaal@rndtek.co.uk" ]
hamza.afzaal@rndtek.co.uk
83a36fec3aefdb96c00636706f42b8602a603132
00969cdfb8dbbe07c7999d1c68d1a848fc1e8b9b
/src/main/java/com/springboot/cassandra/util/MyCassandraTemplate.java
d481dc1e8fca210f01737301b2a0586a1076160c
[]
no_license
jasdhali/SpringBootCassandraV2
cb444ef9b567632d4518cacaf1a77d28edee2970
18787dc60b9075d13a713ae614d11f79c34bbe67
refs/heads/master
2021-01-13T05:00:00.739948
2017-02-07T04:21:19
2017-02-07T04:21:19
81,166,257
0
0
null
null
null
null
UTF-8
Java
false
false
3,820
java
package com.springboot.cassandra.util; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.cassandra.core.CassandraOperations; import org.springframework.stereotype.Repository; /** * Utility class for handling all CRUD Operations. * @author Ranga Reddy * @version 1.0 */ @Repository public class MyCassandraTemplate { @Autowired private CassandraOperations cassandraTemplate; /** MyCassandraTemplate Default constructor*/ public MyCassandraTemplate() { System.out.println("MyCassandraTemplate()"); } /** * Creating the entity. * @param entity * @return {@link Object} */ public <T> T create(T entity) { return cassandraTemplate.insert(entity); } /** * Creating the list of entities. * @param entity */ public <T> void createList(List<T> entities) { cassandraTemplate.insert(entities); } /** * Updating the entity. * @param entity * @param claz * @return T */ public <T> T update(T entity) { return (T) cassandraTemplate.update(entity); } /** * Updating the list of entities. * @param entity * @param claz * @return T */ public <T> void updateList(List<T> entities) { cassandraTemplate.update(entities); } /** * Updating the entity. * @param entity * @param claz * @return T */ public <T> T update(T entity, Class<T> claz) { return (T) cassandraTemplate.update(entity); } /** * Get the Entity using Id. * @param id * @param claz * @return T */ public <T> T findById(Object id, Class<T> claz) { return cassandraTemplate.selectOneById(claz, id); } /** * Delete the Entity using Id. * @param id * @param claz */ public <T> void deleteById(Object id, Class<T> claz) { cassandraTemplate.deleteById(claz, id); } /** * Delete the Entity using object. * @param entity */ public void delete(Object entity) { cassandraTemplate.delete(entity); } /** * Deleting the list of entities * @param entities */ public <T> void delete(List<T> entities) { cassandraTemplate.delete(entities); } /** * Deleting the all entities. * @param claz */ public <T> void deleteAll(Class<T> claz) { cassandraTemplate.deleteAll(claz); } /** * Getting the all entities. * @param claz * @return List of entities */ public <T> List<T> findAll(Class<T> claz) { return (List<T>) cassandraTemplate.selectAll(claz); } /** * Getting the all entity values using specific id's data. * @param ids * @param claz * @return */ public <T> List<T> findAll(List<Object> ids, Class<T> claz) { return cassandraTemplate.selectBySimpleIds(claz, ids); } /** * Getting the count of records. * @param claz * @return the count value. */ public <T> void truncate(Class<T> claz) { cassandraTemplate.truncate(claz.getName()); } /** * Getting the count of records. * @param claz * @return the count value. */ public <T> long getCount(Class<T> claz) { return cassandraTemplate.count(claz); } /** * Checking the object exists or not. * @param id * @param claz * @return true if the object exists in the database otherwise it will return false. */ public <T> boolean exists(Object id, Class<T> claz) { return cassandraTemplate.exists(claz, id); } }
[ "jasdhali@gmail.com" ]
jasdhali@gmail.com
38db11eb1a346f5c5fdc6ade8dc26635e3404b1c
867edd1d086929833fd7fb146e2541e792ec1694
/smartbuy/src/main/java/com/codaglobal/service/OrderServiceImpl.java
62c34f332507054bb9d97afe8a31053f6231c8fb
[]
no_license
asifjalaludeen/smart-buy
cc0cea4e98d057f6c32f1d51272eb31902c541d7
90b0c87deb95c251f4e130d724b28ebf6a8ee3dd
refs/heads/master
2022-11-20T03:58:31.662943
2020-07-27T09:20:20
2020-07-27T09:20:20
282,650,003
0
0
null
null
null
null
UTF-8
Java
false
false
6,008
java
package com.codaglobal.service; import java.sql.Timestamp; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.stream.Collectors; import javax.transaction.Transactional; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import com.codaglobal.infrastructure.Log; import com.codaglobal.model.Order; import com.codaglobal.model.Product; import com.codaglobal.model.User; import com.codaglobal.payload.OrderForm; import com.codaglobal.payload.OrderRequest; import com.codaglobal.repository.CartRepository; import com.codaglobal.repository.OrderRepository; import com.codaglobal.repository.ProductRepository; import com.codaglobal.repository.UserRepository; import com.codaglobal.util.MessageResponse; import com.codaglobal.util.OrderStatus; import com.codaglobal.util.UserDetailsImpl; import com.codaglobal.util.UserRole; /** * @author Asif Jalaludeen * */ @Service public class OrderServiceImpl implements OrderService{ @Log Logger logger; @Autowired ProductRepository productRepository; @Autowired AuthenticationManager authenticationManager; @Autowired UserRepository userRepository; @Autowired OrderRepository orderRepository; @Autowired CartRepository cartRepository; @Override public ResponseEntity<?> getOrderByUser() { ResponseEntity<?> response; try { UserDetailsImpl userDetails = (UserDetailsImpl)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); User user = userRepository.findByUsername(userDetails.getUsername()).get(); logger.info("Gettings orders for user={}", user.getUsername()); List<Order> orders; if(UserRole.SELLER.equals(user.getRole())) { orders = orderRepository.findAll(); orders = orders.stream().filter( order -> { String[] productIds = order.getProduct().split(","); List<String> products = Arrays.asList(productIds).stream().filter(p -> { return productRepository.findById(Long.valueOf(p)).get().getUser().equals(user); }).collect(Collectors.toList()); return products.size() > 0 ? true : false; }).collect(Collectors.toList()); }else { orders = orderRepository.findByUser(user); } response = ResponseEntity.ok(modeltoForm(orders)); } catch(Exception e) { logger.error("Failed to fetch orders"); response = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage()); } return response; } @Override public ResponseEntity<?> getPendingOrders() { // TODO Auto-generated method stub return null; } @Override @Transactional public ResponseEntity<?> placeOrder(OrderRequest orderRequest) { ResponseEntity<?> response; try { List<String> products = orderRequest.getCartItems().stream().map(item -> { return String.valueOf(item.getProduct().getId()); }).collect(Collectors.toList()); orderRequest.getCartItems().stream().forEach(item -> { Product product = productRepository.findById(item.getProduct().getId()).get(); if(product.getStock() > 0) { product.setStock(product.getStock() - 1); productRepository.save(product); } cartRepository.deleteById(item.getId()); }); UserDetailsImpl userDetails = (UserDetailsImpl)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); User user = userRepository.findByUsername(userDetails.getUsername()).get(); logger.info("Placing order for user={}", user.getUsername()); Order order = new Order(); order.setUser(user); Date date = new Date(); order.setOrderDate(new Timestamp(date.getTime())); order.setStatus(OrderStatus.PLACED); order.setProduct(String.join(",", products)); orderRepository.save(order); response = ResponseEntity.ok(new MessageResponse("Order placed successfully.")); }catch(Exception e) { logger.error("Failed to place order", e.getMessage()); response = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage()); } return response; } @Override public ResponseEntity<?> dispatchOrder(Long id) { ResponseEntity<?> response; try { logger.info("Dispatching order with id={}", id); Order order = orderRepository.findById(id).get(); order.setStatus(OrderStatus.DISPATCHED); orderRepository.save(order); response = ResponseEntity.ok(new MessageResponse("Order dispatched successfully")); }catch(Exception e) { logger.error("Failed to dispatch order", e.getMessage()); response = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage()); } return response; } @Override public ResponseEntity<?> receiveOrder(Long id) { ResponseEntity<?> response; try { logger.info("Receiving order with id={}", id); Order order = orderRepository.findById(id).get(); order.setStatus(OrderStatus.DELIVERED); orderRepository.save(order); response = ResponseEntity.ok(new MessageResponse("Order received successfully")); }catch(Exception e) { logger.error("Failed to receive order", e.getMessage()); response = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage()); } return response; } private List<OrderForm> modeltoForm(List<Order> orders){ return orders.stream().map(order -> { OrderForm orderForm = new OrderForm(); orderForm.setId(order.getId()); orderForm.setStatus(order.getStatus().name()); orderForm.setOrderDate(new Date(order.getOrderDate().getTime())); List<String> productNames = Arrays.asList(order.getProduct().split(",")) .stream().map(e -> { return productRepository.findById(Long.parseLong(e)).get().getName(); }).collect(Collectors.toList()); orderForm.setProductNames(productNames); return orderForm; }).collect(Collectors.toList()); } }
[ "asif.shahjahan@blackboard.com" ]
asif.shahjahan@blackboard.com
329db5e55cb3093a51884fe2d64cc43e870794de
5d4008aa60d129ce0d00fba3bb5ee76fced32c67
/17CSL47_DESIGN_AND_ANALYSIS_OF_ALGORITHM/StackMethods.java
6c270858df3b92c8938f1ca1187aa3de2312b93a
[ "MIT" ]
permissive
prabalgupta12/vtulabs
b55c3bbaa2e92440ddc1a46403e0b5f0e5287678
31a0f9447a09e2905ed16afb40d4dbe9fe83c276
refs/heads/master
2020-09-08T17:53:17.220090
2019-11-12T13:59:20
2019-11-12T13:59:20
221,201,392
1
0
MIT
2019-11-12T11:25:37
2019-11-12T11:25:36
null
UTF-8
Java
false
false
3,707
java
/* Program 1 (b): Write a Java program to implement the Stack using arrays. Write Push(), Pop(), and display() methods to demonstrate its working. */ import java.util.Scanner; public class StackMethods { int top; int size; int[] stack ; public StackMethods(int arraySize) { size=arraySize; stack= new int[size]; top=-1; } public void push(int value) { if(top==size-1) { System.out.println("Stack is full, can't push a value"); } else { top=top+1; stack[top]=value; } } public int pop() { int t=0; if(top==-1) { System.out.println("Can't pop...stack is empty"); return -1; } else { t=top--; return stack[t]; } } public void display() { for(int i=top;i>=0;i--) { System.out.print(stack[i]+" "); } System.out.println("\n"); } public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Stack operations\n"); System.out.println("Enter Size of Stack "); int n = in.nextInt(); int choice ; /* Creating object of class arrayStack */ StackMethods stk = new StackMethods(n); /* Perform Stack Operations */ do{ System.out.println("\nStack Operations"); System.out.println("1. push"); System.out.println("2. pop"); System.out.println("3. display"); System.out.println("Enter the choice"); int ch = in.nextInt(); switch (ch) { case 1 : System.out.println("Enter element to push"); stk.push( in.nextInt() ); break; case 2 :int s=stk.pop(); if (s!=-1) System.out.println("Popped Element = " + s); break; case 3 :stk.display(); break; } System.out.println("Do you want to continue press 0/1"); choice=in.nextInt(); } while(choice==1); } } /* Output : Stack operations Enter Size of Stack 4 Stack Operations 1. push 2. pop 3. display Enter the choice 1 Enter element to push 11 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 1 Enter element to push 12 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 1 Enter element to push 13 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 1 Enter element to push 14 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 1 Enter element to push 15 Stack is full, can't push a value Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 3 14 13 12 11 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 2 Popped Element = 14 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 2 Popped Element = 13 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 2 Popped Element = 12 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 2 Popped Element = 11 Do you want to continue press 0/1 1 Stack Operations 1. push 2. pop 3. display Enter the choice 2 Can't pop...stack is empty Do you want to continue press 0/1 0 */
[ "noreply@github.com" ]
prabalgupta12.noreply@github.com
fe2ffe36b56042bd15dae86033dc2df605b01eba
65442e63968a8c943d5d21f9eafdf83516dc267e
/app/src/main/java/com/hadesky/cacw/presenter/TeamInfoPresenterImpl.java
67a42898b0758da5ed8fbcf29cb7c9bac4a4720d
[]
no_license
Hadesky/CACW-Android
01ffae06cafec1d6109abe442ffed6b94c64a981
378ee0bfa313970529e13a53db88a37af45d48fd
refs/heads/master
2021-01-17T07:32:54.573632
2020-05-28T10:13:45
2020-05-28T10:13:45
42,123,788
2
0
null
2016-09-14T04:50:55
2015-09-08T16:10:58
Java
UTF-8
Java
false
false
5,864
java
package com.hadesky.cacw.presenter; import com.hadesky.cacw.R; import com.hadesky.cacw.bean.TeamBean; import com.hadesky.cacw.bean.UserBean; import com.hadesky.cacw.config.MyApp; import com.hadesky.cacw.model.RxSubscriber; import com.hadesky.cacw.model.TeamRepertory; import com.hadesky.cacw.ui.view.TeamInfoView; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import rx.Subscription; import rx.internal.util.SubscriptionList; /** * * Created by dzysg on 2016/9/1 0001. */ public class TeamInfoPresenterImpl implements TeamInfoPresenter { private TeamInfoView mView; private TeamRepertory mTeamRepertory; private SubscriptionList mSubscriptionList = new SubscriptionList(); private TeamBean mTeam; int tid; public TeamInfoPresenterImpl(TeamInfoView view,int id) { mView = view; tid = id; mTeamRepertory = TeamRepertory.getInstance(); } @Override public void getTeamInfo() { Subscription subscription = mTeamRepertory.getTeamInfo(tid) .subscribe(new RxSubscriber<TeamBean>() { @Override public void _onError(String e) { mView.hideProgress(); mView.showMsg(e); } @Override public void _onNext(TeamBean teamBean) { mView.hideProgress(); mView.showInfo(teamBean); mTeam = teamBean; } }); mSubscriptionList.add(subscription); } @Override public void getTeamMembers() { Subscription subscription = mTeamRepertory.getTeamMember(tid,4,0,false) .subscribe(new RxSubscriber<List<UserBean>>() { @Override public void _onError(String e) { mView.hideProgress(); mView.showMsg(e); } @Override public void _onNext(List<UserBean> members) { mView.hideProgress(); mView.showMembers(members); } }); mSubscriptionList.add(subscription); } @Override public void modifySummary(final String s) { Map<String, String> info = new HashMap<>(); info.put("summary",s); Subscription subscription = mTeamRepertory.modifyTeamInfo(tid,info) .subscribe(new RxSubscriber<String>() { @Override public void _onError(String e) { mView.hideProgress(); mView.showMsg(e); } @Override public void _onNext(String teamBean) { mView.hideProgress(); mTeam.setSummary(s); mView.showInfo(mTeam); } }); mSubscriptionList.add(subscription); } @Override public void modifyNotice(final String s) { Map<String, String> info = new HashMap<>(); info.put("notice",s); mView.showProgress(); Subscription subscription = mTeamRepertory.modifyTeamInfo(tid,info) .subscribe(new RxSubscriber<String>() { @Override public void _onError(String e) { mView.hideProgress(); mView.showMsg(e); } @Override public void _onNext(String teamBean) { mView.hideProgress(); mTeam.setNotice(s); mView.showInfo(mTeam); } }); mSubscriptionList.add(subscription); } @Override public void saveTeamIcon(File file) { mView.showProgress(); Subscription s = mTeamRepertory.modifyTeamIcon(tid,file) .subscribe(new RxSubscriber<String>() { @Override public void _onError(String msg) { mView.hideProgress(); mView.showMsg(msg); } @Override public void _onNext(String s) { mView.hideProgress(); } }); mSubscriptionList.add(s); } @Override public void onDestroy() { mSubscriptionList.unsubscribe(); } @Override public void delCurrentTeam() { } @Override public void exitTeam() { if(mTeam.getAdminId()== MyApp.getCurrentUser().getId()) { mView.showMsg(MyApp.getAppContext().getString(R.string.you_are_admin_can_not_exit)); return; } mView.showProgress(); mTeamRepertory.exitTeam(mTeam.getId()) .subscribe(new RxSubscriber<String>() { @Override public void _onError(String msg) { mView.hideProgress(); mView.showMsg(msg); } @Override public void _onNext(String s) { mView.hideProgress(); mView.showMsg(MyApp.getAppContext().getString(R.string.succeed_exit_team)); mView.close(); } }); } }
[ "dzysghr@live.com" ]
dzysghr@live.com
969864955203c3ddce963cb5d774cebfacc64c6c
d28f9e558126d8369a9a369345796ade4b03b35c
/app/src/main/java/com/kasungunathilaka/showcase/ShowcaseConfig.java
f253bbbdc88035c20956a378209e454d94aab883
[]
no_license
kasun-gunathilaka/gym_partner_app
c2867a94b282a5400019751ed367954cf0b8b155
8ed622b6e66af1d9e518fd729df3b8af2dfc9f51
refs/heads/master
2020-11-26T17:40:23.308489
2019-06-07T10:03:14
2019-06-07T10:03:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,471
java
package com.kasungunathilaka.showcase; import android.graphics.Color; import com.kasungunathilaka.showcase.shape.CircleShape; import com.kasungunathilaka.showcase.shape.Shape; /** * Created by nirmal on 6/29/2016. */ public class ShowcaseConfig { public static final String DEFAULT_MASK_COLOUR = "#dd335075"; public static final long DEFAULT_FADE_TIME = 300; public static final long DEFAULT_DELAY = 0; public static final Shape DEFAULT_SHAPE = new CircleShape(); public static final int DEFAULT_SHAPE_PADDING = 10; private long mDelay = DEFAULT_DELAY; private int mMaskColour; private int mContentTextColor; private int mDismissTextColor; private long mFadeDuration = DEFAULT_FADE_TIME; private Shape mShape = DEFAULT_SHAPE; private int mShapePadding = DEFAULT_SHAPE_PADDING; private boolean renderOverNav = false; public ShowcaseConfig() { mMaskColour = Color.parseColor(ShowcaseConfig.DEFAULT_MASK_COLOUR); mContentTextColor = Color.parseColor("#ffffff"); mDismissTextColor = Color.parseColor("#ffffff"); } public long getDelay() { return mDelay; } public void setDelay(long delay) { this.mDelay = delay; } public int getMaskColor() { return mMaskColour; } public void setMaskColor(int maskColor) { mMaskColour = maskColor; } public int getContentTextColor() { return mContentTextColor; } public void setContentTextColor(int mContentTextColor) { this.mContentTextColor = mContentTextColor; } public int getDismissTextColor() { return mDismissTextColor; } public void setDismissTextColor(int dismissTextColor) { this.mDismissTextColor = dismissTextColor; } public long getFadeDuration() { return mFadeDuration; } public void setFadeDuration(long fadeDuration) { this.mFadeDuration = fadeDuration; } public Shape getShape() { return mShape; } public void setShape(Shape shape) { this.mShape = shape; } public void setShapePadding(int padding) { this.mShapePadding = padding; } public int getShapePadding() { return mShapePadding; } public boolean getRenderOverNavigationBar() { return renderOverNav; } public void setRenderOverNavigationBar(boolean renderOverNav) { this.renderOverNav = renderOverNav; } }
[ "kasungunathilaka1991@gmail.com" ]
kasungunathilaka1991@gmail.com
05b58a402891542f6b4c6bb818e8b89667669a42
b1d1275b56cff45c6b893e8eca9fdb807acdff5b
/src/test/java/com/talijan04/testiranje/apartmani/service/RezervacijaJpaServiceMockitoWithAnnotationTest.java
4032e26963508b1934ee1ed09ff4ec5d955211c5
[]
no_license
talijan04/apartmani
b5103fadee654e438e72e28057b6e42b82e9c10b
73979d1c7f5625acad3fe591c3989ffcac51fd83
refs/heads/master
2022-09-01T23:43:07.377169
2020-05-28T14:05:28
2020-05-28T14:05:28
267,609,042
0
0
null
null
null
null
UTF-8
Java
false
false
4,345
java
package com.talijan04.testiranje.apartmani.service; import com.talijan04.testiranje.apartmani.dao.IRezervacijaJpaDao; import com.talijan04.testiranje.apartmani.model.Rezervacija; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @ExtendWith(MockitoExtension.class) public class RezervacijaJpaServiceMockitoWithAnnotationTest { @Mock private IRezervacijaJpaDao iRezervacijaJpaDao; @InjectMocks private RezervacijaJpaService rezervacijaJpaService; @Test void checkOverlaps_ShouldReturn0_IfEnteredPeriodBefore() { Rezervacija rezervacija = new Rezervacija(1, 1, "Aleksandar", "Jovanović", "00254781", "talijan04@gmail.com", LocalDate.parse("05/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy")), LocalDate.parse("07/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy"))); List<Rezervacija> rezervacijas = new ArrayList(); given(iRezervacijaJpaDao.findAllOverlaps(rezervacija.getDateFrom(), rezervacija.getDateTo(), rezervacija.getApartmanId())).willReturn(rezervacijas); int expectedResult = 0; int actualResult = rezervacijaJpaService.checkOverlaps(rezervacija); Assertions.assertEquals(expectedResult, actualResult); Mockito.verify(iRezervacijaJpaDao).findAllOverlaps(rezervacija.getDateFrom(), rezervacija.getDateTo(), rezervacija.getApartmanId()); } @Test void checkOverlaps_ShouldReturn1_IfEnteredPeriodStartBeforeAndFinishInsideOfThePeriod() { Rezervacija rezervacija = new Rezervacija(1, 1, "Aleksandar", "Jovanović", "00254781", "talijan04@gmail.com", LocalDate.parse("05/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy")), LocalDate.parse("10/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy"))); List<Rezervacija> rezervacijas = new ArrayList(); rezervacijas.add(new Rezervacija(1, 1, "Aleksandar", "Jovanović", "00254781", "talijan04@gmail.com", LocalDate.parse("08/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy")), LocalDate.parse("12/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy")))); given(iRezervacijaJpaDao.findAllOverlaps(rezervacija.getDateFrom(), rezervacija.getDateTo(), rezervacija.getApartmanId())).willReturn(rezervacijas); int expectedResult = 1; int actualResult = rezervacijaJpaService.checkOverlaps(rezervacija); Assertions.assertEquals(expectedResult, actualResult); Mockito.verify(iRezervacijaJpaDao).findAllOverlaps(rezervacija.getDateFrom(), rezervacija.getDateTo(), rezervacija.getApartmanId()); } @Test void addRezervacija2_ShouldSaveRezervationSaccessfully() { final Rezervacija rezervacija = new Rezervacija(1, 1, "Aleksandar", "Jovanović", "00254781", "talijan04@gmail.com", LocalDate.parse("08/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy")), LocalDate.parse("12/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy"))); given(iRezervacijaJpaDao.save(rezervacija)).willAnswer( invocation -> invocation.getArgument(0) ); Rezervacija savedRezervacija = rezervacijaJpaService.addRezervacija2(rezervacija); assertThat(savedRezervacija).isNotNull(); Mockito.verify(iRezervacijaJpaDao).save(any(Rezervacija.class)); } @Test void findAll_ShouldReturnAllRezervations() { List<Rezervacija> rezervacijas = new ArrayList(); rezervacijas.add(new Rezervacija(1, 1, "Aleksandar", "Jovanović", "00254781", "talijan04@gmail.com", LocalDate.parse("08/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy")), LocalDate.parse("12/05/2020", DateTimeFormatter.ofPattern("dd/MM/yyyy")))); given(iRezervacijaJpaDao.findAll()).willReturn(rezervacijas); List<Rezervacija> expectedResult = rezervacijaJpaService.getAllRezervations(); Assertions.assertEquals(expectedResult, rezervacijas); Mockito.verify(iRezervacijaJpaDao).findAll(); } }
[ "talijan04@gmail.com" ]
talijan04@gmail.com
68361cbdfe3ab5b79bb4be26b0c44e7e094510c6
1ede39d3a54e5bbe066d1876565564ffc6544b48
/gwt/ulyz/src/com/netmorpher/client/controller/PopulateActionsTemplatesCommand.java
ec0f582c5cf1fda459ce620118c4254255a2a6ad
[]
no_license
davepuchyr/samples
4df3fa5ab45b80a8d27743a71d4eb4f44175253b
e22ab90a0c75ffd9aa796b831b6334f323a9cd4d
refs/heads/master
2021-06-12T08:55:22.109383
2017-03-18T14:16:15
2017-03-18T14:16:15
32,606,778
0
0
null
null
null
null
UTF-8
Java
false
false
854
java
// $Id: PopulateActionsTemplatesCommand.java 101 2010-05-14 20:33:06Z dave $ package com.netmorpher.client.controller; import org.puremvc.java.multicore.interfaces.INotification; import com.netmorpher.client.ApplicationFacade; import com.netmorpher.client.model.ActionsTemplatesProxy; import com.netmorpher.client.model.vo.TemplateVO; /** * @author dave * */ public class PopulateActionsTemplatesCommand extends DatabaseReadCommand<TemplateVO> { @Override protected String getSQL( INotification notification ) { return "SELECT template FROM templates GROUP BY template HAVING COUNT(*) > 1 ORDER BY template"; } @Override protected String getNotificationName() { return ApplicationFacade.ACTIONS_TEMPLATES_UPDATED; } @Override protected String getProxyName() { return ActionsTemplatesProxy.NAME; } }
[ "dave.puchyr@avaritia.com" ]
dave.puchyr@avaritia.com
ba44762cd9b9bd57ead7a318df378f537bcc872b
85dd7a5e5e8f3af2ad512de7c041abb24998acf7
/src/main/java/com/rush/o2o/dao/WechatAuthDao.java
575d3d4c50fb6c3ac1685e28c1f5a6d9919033b7
[]
no_license
RushZhang/o2o-campus-shops
30fd9d5b778109132db72e4fe9c67d2289f2a36b
6ff51e95524d828f94b7a528a68a1eba3c9199bd
refs/heads/master
2020-03-12T12:49:51.874767
2018-04-23T04:19:48
2018-04-23T04:19:48
130,626,787
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.rush.o2o.dao; import com.rush.o2o.entity.WechatAuth; public interface WechatAuthDao { /** * 通过openId查询对应本平台的微信帐号 * * @param openId * @return */ WechatAuth queryWechatInfoByOpenId(String openId); /** * 添加对应本平台的微信帐号 * * @param wechatAuth * @return */ int insertWechatAuth(WechatAuth wechatAuth); }
[ "rush.ruixuan@gmail.com" ]
rush.ruixuan@gmail.com
a485afbc440b0dd3f6337859c76d03fb9f20ff61
ef8a143893beaaa90f9287133880e90ea7d2aaaa
/Perestroika-Problem/src/main/java/cz/cuni/mff/perestroika/perestroika_problem_5_3_0_4_0_2_0/E_Resources.java
cf4e639528b5f5798eefac521ae2c3dca5852f2a
[ "MIT" ]
permissive
martinpilat/jPDDL
fb976ae66b248eaa021b8662f300829ef9bdb198
c5e8389cccc9707b387de41298ae51983908a3f6
refs/heads/master
2021-06-13T18:41:14.994546
2021-03-26T15:55:23
2021-03-26T15:55:23
155,592,082
0
0
MIT
2018-10-31T16:46:57
2018-10-31T16:46:57
null
UTF-8
Java
false
false
1,669
java
package cz.cuni.mff.perestroika.perestroika_problem_5_3_0_4_0_2_0; import cz.cuni.mff.perestroika.domain.types.T_Resource; import cz.cuni.mff.perestroika.problem.E_Resource; public final class E_Resources { public static final T_Resource r1 = new T_Resource("r1"); public static final T_Resource r2 = new T_Resource("r2"); public static final T_Resource r3 = new T_Resource("r3"); public static final T_Resource r4 = new T_Resource("r4"); public static final T_Resource r5 = new T_Resource("r5"); public static final T_Resource r6 = new T_Resource("r6"); public static final T_Resource r7 = new T_Resource("r7"); public static final T_Resource r8 = new T_Resource("r8"); public static final T_Resource r9 = new T_Resource("r9"); public static final T_Resource r10 = new T_Resource("r10"); public static final T_Resource r11 = new T_Resource("r11"); public static final T_Resource r12 = new T_Resource("r12"); static { E_Resource.THIS.register(T_Resource.getIndex(r1), r1); E_Resource.THIS.register(T_Resource.getIndex(r2), r2); E_Resource.THIS.register(T_Resource.getIndex(r3), r3); E_Resource.THIS.register(T_Resource.getIndex(r4), r4); E_Resource.THIS.register(T_Resource.getIndex(r5), r5); E_Resource.THIS.register(T_Resource.getIndex(r6), r6); E_Resource.THIS.register(T_Resource.getIndex(r7), r7); E_Resource.THIS.register(T_Resource.getIndex(r8), r8); E_Resource.THIS.register(T_Resource.getIndex(r9), r9); E_Resource.THIS.register(T_Resource.getIndex(r10), r10); E_Resource.THIS.register(T_Resource.getIndex(r11), r11); E_Resource.THIS.register(T_Resource.getIndex(r12), r12); } protected E_Resources() { } }
[ "martin.pilat@gmail.com" ]
martin.pilat@gmail.com
3efba2409a32afa292b3fc150663bc9c5bd1fbcc
bf0665d06791d029ded9f204b91183d67df90b29
/mynetlib/src/main/java/com/mygame/android/net/lobby/BaseGateModel.java
dda3c1c48859178d0ec32cc771bb3ee57dc362f5
[]
no_license
msgLi/MyLibContent
399b1d2f386da1491a206656660abdb932798415
980ff0e10b59405d9359864799a70753f4512bb0
refs/heads/master
2021-06-24T15:31:41.929764
2017-09-12T08:43:54
2017-09-12T08:43:54
103,245,274
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package com.mygame.android.net.lobby; import com.mygame.android.model.Model; public class BaseGateModel<T> extends Model<T> { private int code; private String msg; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } }
[ "msg@msgs-MacBook-Pro.local" ]
msg@msgs-MacBook-Pro.local
2f03d7c6a8a726e92293bcf8f5cafc76f4ebce6e
81c8e913cf3c12cb45d8bdacf32d5a6dbf707a01
/src/main/java/com/phei/netty/codec/serializable/UserInfo.java
18b1bad77105fe95d9483bc8f2884325559ed939
[]
no_license
liusw/nettyDemo
7ba3e751a8bdd955d0c05e13062f69881c98350e
b48daf63e752c2b923b056cbca5f3307ead1144a
refs/heads/master
2021-01-13T09:17:52.760018
2015-12-28T09:20:20
2015-12-28T09:20:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,249
java
/* * Copyright 2013-2018 Lilinfeng. * * 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.phei.netty.codec.serializable; import java.io.Serializable; import java.nio.ByteBuffer; /** * @author Administrator * @date 2014年2月23日 * @version 1.0 */ public class UserInfo implements Serializable { /** * 默认的序列号 */ private static final long serialVersionUID = 1L; private String userName; private int userID; public UserInfo buildUserName(String userName) { this.userName = userName; return this; } public UserInfo buildUserID(int userID) { this.userID = userID; return this; } /** * @return the userName */ public final String getUserName() { return userName; } /** * @param userName * the userName to set */ public final void setUserName(String userName) { this.userName = userName; } /** * @return the userID */ public final int getUserID() { return userID; } /** * @param userID * the userID to set */ public final void setUserID(int userID) { this.userID = userID; } public byte[] codeC() { ByteBuffer buffer = ByteBuffer.allocate(1024); byte[] value = this.userName.getBytes(); buffer.putInt(value.length); buffer.put(value); buffer.putInt(this.userID); buffer.flip(); value = null; byte[] result = new byte[buffer.remaining()]; buffer.get(result); return result; } public byte[] codeC(ByteBuffer buffer) { buffer.clear(); byte[] value = this.userName.getBytes(); buffer.putInt(value.length); buffer.put(value); buffer.putInt(this.userID); buffer.flip(); value = null; byte[] result = new byte[buffer.remaining()]; buffer.get(result); return result; } }
[ "tianmg@shishike.com" ]
tianmg@shishike.com
f84bf0631f1cf0afff7d5fe2021c881f18930e39
a4157887f09e780e9b006513e713a01543a20f11
/test/com/facebook/buck/artifact_cache/SQLiteArtifactCacheBenchmark.java
ffb39bb0a3965ea38e26b5ca5f5abdf82165a9fa
[ "Apache-2.0" ]
permissive
ereli/buck
8b6df315251ac69ad9269f77a4e560808c760cd4
b9e298a1b188fa53fbd80c40078ef62b5d732b33
refs/heads/master
2020-03-18T04:25:53.828658
2018-05-21T15:27:06
2018-05-21T15:27:06
134,286,674
0
0
Apache-2.0
2018-05-21T15:22:24
2018-05-21T15:18:28
Java
UTF-8
Java
false
false
6,229
java
/* * Copyright 2017-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package com.facebook.buck.artifact_cache; import com.facebook.buck.artifact_cache.config.CacheReadMode; import com.facebook.buck.core.build.engine.buildinfo.BuildInfo; import com.facebook.buck.core.rulekey.RuleKey; import com.facebook.buck.event.BuckEventBusForTests; import com.facebook.buck.io.file.BorrowablePath; import com.facebook.buck.io.file.LazyPath; import com.facebook.buck.io.filesystem.ProjectFilesystem; import com.facebook.buck.io.filesystem.TestProjectFilesystems; import com.facebook.buck.testutil.TemporaryPaths; import com.google.caliper.AfterExperiment; import com.google.caliper.BeforeExperiment; import com.google.caliper.Benchmark; import com.google.caliper.Param; import com.google.common.hash.HashCode; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.Random; import java.util.concurrent.Executors; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; public class SQLiteArtifactCacheBenchmark { @Rule public TemporaryPaths tmpDir = new TemporaryPaths(); @Param({"1000", "10000", "100000"}) private int opCount = 100; @Param({"5", "10"}) private int threadCount = 2; private static final Random random = new Random(12345); private static final long MAX_INLINED_BYTES = 1024; private ProjectFilesystem filesystem; private List<RuleKey> ruleKeys; private List<RuleKey> contentHashes; private List<ArtifactInfo> metadataInfo; private List<ArtifactInfo> contentInfo; private Path emptyFile; private Path inlinedFile; private Path largeFile; private Path cacheDir; private LazyPath output; private SQLiteArtifactCache artifactCache; private ListeningExecutorService executor; @Before public void setUp() throws InterruptedException, IOException, SQLException { filesystem = TestProjectFilesystems.createProjectFilesystem(tmpDir.getRoot()); emptyFile = tmpDir.newFile(".empty"); inlinedFile = tmpDir.newFile(".inlined"); largeFile = tmpDir.newFile(".large"); Files.write(inlinedFile, new byte[] {'a', 'r', 't', 'i', 'f', 'a', 'c', 't'}); for (int i = 0; i < MAX_INLINED_BYTES; i++) { Files.write(largeFile, new byte[] {'b', 'i', 'g'}); } cacheDir = tmpDir.newFolder(); output = LazyPath.ofInstance(cacheDir.resolve(".output")); setUpBenchmark(); } @BeforeExperiment private void setUpBenchmark() throws IOException, SQLException { artifactCache = cache(Optional.of(1024 * 1024 * 1024L)); byte[] randomRuleKey = new byte[16]; ruleKeys = new ArrayList<>(opCount); contentHashes = new ArrayList<>(opCount); metadataInfo = new ArrayList<>(opCount); contentInfo = new ArrayList<>(opCount); for (int i = 0; i < opCount; i++) { random.nextBytes(randomRuleKey); RuleKey ruleKey = new RuleKey(HashCode.fromBytes(randomRuleKey)); ruleKeys.add(ruleKey); metadataInfo.add( ArtifactInfo.builder() .addRuleKeys(ruleKey) .putMetadata(TwoLevelArtifactCacheDecorator.METADATA_KEY, "foo") .putMetadata(BuildInfo.MetadataKey.RULE_KEY, ruleKey.toString()) .putMetadata(BuildInfo.MetadataKey.TARGET, "bar") .build()); random.nextBytes(randomRuleKey); RuleKey contentHash = new RuleKey(HashCode.fromBytes(randomRuleKey)); contentHashes.add(contentHash); contentInfo.add(ArtifactInfo.builder().addRuleKeys(contentHash).build()); } } @After @AfterExperiment public void tearDown() { artifactCache.close(); executor.shutdown(); } private SQLiteArtifactCache cache(Optional<Long> maxCacheSizeBytes) throws IOException, SQLException { return new SQLiteArtifactCache( "sqlite", filesystem, cacheDir, BuckEventBusForTests.newInstance(), maxCacheSizeBytes, Optional.of(MAX_INLINED_BYTES), CacheReadMode.READWRITE); } @Ignore @Test public void testSingleThreaded() { executor = MoreExecutors.newDirectExecutorService(); runAllBenchmarks(); } @Ignore @Test public void testMultiThreaded() { executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(threadCount)); runAllBenchmarks(); } private void runAllBenchmarks() { benchMetadataStore(); benchMetadataFetch(); benchArtifactStore(); benchArtifactFetch(); } @Benchmark private void benchMetadataStore() { for (ArtifactInfo info : metadataInfo) { artifactCache.store(info, BorrowablePath.notBorrowablePath(emptyFile)); } } @Benchmark private void benchMetadataFetch() { for (RuleKey key : ruleKeys) { Futures.getUnchecked(artifactCache.fetchAsync(key, output)); } } @Benchmark private void benchArtifactStore() { for (int i = 0; i < contentInfo.size() / 2; i++) { artifactCache.store(contentInfo.get(i), BorrowablePath.notBorrowablePath(inlinedFile)); } for (int i = contentInfo.size() / 2; i < contentInfo.size(); i++) { artifactCache.store(contentInfo.get(i), BorrowablePath.notBorrowablePath(largeFile)); } } @Benchmark private void benchArtifactFetch() { for (RuleKey key : ruleKeys) { Futures.getUnchecked(artifactCache.fetchAsync(key, output)); } } }
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
c7a89d0f1ccbce6575edd2028bf42a2404aa526b
d9cdb940bd6481aa32a2a8df0e61eef3413b659f
/wwz/wwz.chainofresponsibilitypattern/src/chainofresponsibilitypattern/GoodGuideMan.java
d767e28bfddaea9f6179adf5a997f6bea0d5a706
[]
no_license
ccd233/software-architecture
319244f5910d5bd2565505bd2507e20cd706aad9
0ab78f6e41cea40e900fc7e67d540fca6d1e43bd
refs/heads/master
2023-01-21T01:09:20.382925
2020-11-30T06:36:29
2020-11-30T06:36:29
309,997,968
6
1
null
2020-11-17T14:07:57
2020-11-04T12:35:46
null
UTF-8
Java
false
false
1,223
java
package chainofresponsibilitypattern; import tools.PrintTool; /** * @Author Wang Wenzheng * @Description:一个可以解决任何问题的大佬志愿者类 * @Date: Created in 18:24 2020/11/5 * @Modified By: **/ public class GoodGuideMan extends GuideMan { /** * @Author: Wang Wenzheng * @Description: 构造函数 * * @Param Type * param: name * resume: 向导名 * * @Return Value * @return: * @resume: * * @Date: 18:22 2020/11/28 * @Modified By: **/ public GoodGuideMan(String name) { super(name); PrintTool.print("I am mogul "+name+",I can solve anything"); } /** * @Author: Wang Wenzheng * @Description: 大佬志愿者一定能解决问题,所以直接返回true * * @Param Type * param: question * resume: 表示问题的字符串 * * @Return Value * @return: boolean * @resume: 能解决任何问题,所以一定返回true * * @Date: 21:15 2020/11/17 * @Modified By: **/ @Override public boolean solveQuestion(String question) { PrintTool.print("I can answer \"" + question + "\""); return true; } }
[ "736005057@qq.com" ]
736005057@qq.com
c56590d74c36c5dfae4273071c849c1bb141c13c
789e4fd1b5961e1b219eb02bdbbc02ce74953a82
/src/test/java/LibraryTest.java
5e3504156df687e32ef0b0be30f209ce1518a4bd
[]
no_license
Martinporter13/LibraryTask
3b8bb4df4bd7aa2f7708b8a2ce3d0d1a18acf18b
f247485e9499c180d673fba956d605a93f4bbf46
refs/heads/master
2021-07-11T20:03:36.353453
2019-09-24T17:34:14
2019-09-24T17:34:14
210,661,547
0
0
null
2020-10-13T16:16:43
2019-09-24T17:35:11
Java
UTF-8
Java
false
false
788
java
import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; public class LibraryTest { Library library; Book book; @Before public void setUp() { library = new Library(30); book = new Book("Brendon Burchard", "High Performance Habits", "Self Improvement"); } @Test public void getBookCount() { assertEquals(0, library.bookCollectionCount()); } @Test public void addBook() { library.addBook(book); assertEquals(1, library.bookCollectionCount()); } @Test public void removeBook() { library.addBook(book); library.removeBook(); assertEquals(0, library.bookCollectionCount()); } }
[ "martinporter1312@gmail.com" ]
martinporter1312@gmail.com
59c751f0ecb5e725bd0cbddd60198a17cc73321b
924094bf9c7a056713b2471a87c6e4ab211b9032
/src/day65/LandaExpressions.java
5caeccbb915a9e186cb89b6fb91bf357564df3b0
[]
no_license
SafarEkberli/AkbarClasses
021a793735e371a1edb0caa6494cf9e181d2616c
846925812ba426d81ba389ca46164bd2fa8eace4
refs/heads/master
2022-04-25T14:00:52.062880
2020-04-22T06:53:47
2020-04-22T06:53:47
257,817,282
0
0
null
null
null
null
UTF-8
Java
false
false
588
java
package day65; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; public class LandaExpressions { public static void main(String[] args) { Predicate<Integer> remove100 = p -> p == 100; List<Integer> list1 = new ArrayList<>(Arrays.asList(100,100,100,100,100,100)); list1.removeIf(remove100); System.out.println(list1); List<Integer> list2 = new ArrayList<>(Arrays.asList(100,200,300,400,500,600)); list2.removeIf(R-> R >300); System.out.println(list2); } }
[ "safarmaharramov@gmail.com" ]
safarmaharramov@gmail.com
a161d69f6fd21b94e68ef553c8ff5cab79fc6dc9
085a775113a117db447bd8cc9075f0ae33649b62
/src/DatabaseManagement/ReadDatabase.java
7a62bd78f4afc43f53ba84b88917fa87b6d9e5a6
[]
no_license
acuas/ExchangeOffice
1cf3c313b36d1068f497cc376acbea7ce46e2390
20480902dcd9017817a28446c250accbd9186b5e
refs/heads/master
2020-05-02T07:14:51.910473
2019-05-15T21:18:14
2019-05-15T21:18:14
177,812,967
0
0
null
null
null
null
UTF-8
Java
false
false
3,422
java
package DatabaseManagement; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Modifier; import java.lang.reflect.Method; import java.sql.*; import java.util.*; public class ReadDatabase<T> { private Map<String, Field> privateFields = new LinkedHashMap<>(); private Map<String, Method> Methods = new LinkedHashMap<>(); private Class<T> genericType; private boolean initCompleted; private String username = "sys as sysdba"; private String password = "Oradoc_db1"; public ReadDatabase(final Class<T> type) { this.genericType = type; initialize(); } public List<T> readFromDatabase(String table_name) { List<T> data = new ArrayList<>(); try { // Load the oracle sql driver Class.forName("oracle.jdbc.driver.OracleDriver"); // Making a connection Connection con = DriverManager.getConnection ("jdbc:oracle:thin:@//0.0.0.0:32769/ORCLCDB.localdomain", username, password); // Creating a Statement object for our DB Connection Statement statement = con.createStatement(); ResultSet rs = statement.executeQuery("SELECT name, value FROM " + table_name); while (rs.next()) { String name = rs.getString("name"); Integer value = rs.getInt("value"); T refObject = genericType.newInstance(); callSetters(name, value, refObject); data.add(refObject); } statement.close(); con.close(); } catch (ClassNotFoundException | SQLException | InstantiationException | IllegalAccessException e) { e.printStackTrace(); } return data; } private void callSetters(String name, Integer value, T refObject) throws IllegalAccessException { List<String> listOfMethodNames = new ArrayList<String>(Methods.keySet()); for (String methodName : listOfMethodNames) { Method m = Methods.get(methodName); if (methodName.equals("setName")) { try { m.setAccessible(true); m.invoke(refObject, name); m.setAccessible(false); } catch (InvocationTargetException x) { x.printStackTrace(); } } else if (methodName.equals("setValue")) { try { m.setAccessible(true); m.invoke(refObject, value); m.setAccessible(false); } catch (InvocationTargetException x) { x.printStackTrace(); } } } } private void initialize() { if (!this.initCompleted) { Field[] allFields = genericType.getDeclaredFields(); for (Field field : allFields) { if (Modifier.isPrivate(field.getModifiers())) { privateFields.put(field.getName(), field); } } Method[] allMethods = genericType.getDeclaredMethods(); for (Method method : allMethods) { Methods.put(method.getName(), method); } this.initCompleted = true; } } }
[ "popescuauras14@gmail.com" ]
popescuauras14@gmail.com
2964aa2864b1480c1e1da68aa7aa8a7491ce38a3
feea999d2fe8ab567f3bbf99c39e3998cbc921d9
/src/state/Charmeleon.java
3592efc64bf4d0de67c96183165ac87318bab514
[]
no_license
samuelahw/Suunnittelumallitehtavat
a41f9deb787cd4ed02abb661531b7ad34eaedd40
aeca903c69d8f0aabe24a56074fc498b0e790b0f
refs/heads/master
2023-02-02T13:44:44.965425
2020-12-07T18:10:33
2020-12-07T18:10:33
307,507,273
0
0
null
2020-10-27T21:49:15
2020-10-26T21:20:07
Java
UTF-8
Java
false
false
177
java
package state; public class Charmeleon implements PokemonTila{ @Override public void kerroTila() { System.out.println("Olen nyt Charmeleon"); } }
[ "samuel.ahjoniemi@gmail.com" ]
samuel.ahjoniemi@gmail.com
6aca4adf7cb396f21446539d71130089742e001f
88d3adf0d054afabe2bc16dc27d9e73adf2e7c61
/htmlparser/src/main/java/org/vietspider/chars/chardet/bak/ISO2022CNVerifier.java
56648db5282c4e012ba8e121ba7939ea3195a010
[ "Apache-2.0" ]
permissive
nntoan/vietspider
5afc8d53653a1bb3fc2e20fb12a918ecf31fdcdc
79d563afea3abd93f7fdff5bcecb5bac2162d622
refs/heads/master
2021-01-10T06:23:20.588974
2020-05-06T09:44:32
2020-05-06T09:44:32
54,641,132
0
2
null
2020-05-06T07:52:29
2016-03-24T12:45:02
Java
UTF-8
Java
false
false
8,485
java
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public * License Version 1.1 (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.mozilla.org/NPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1998 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): */ /* * DO NOT EDIT THIS DOCUMENT MANUALLY !!! * THIS FILE IS AUTOMATICALLY GENERATED BY THE TOOLS UNDER * AutoDetect/tools/ */ package org.vietspider.chars.chardet.bak ; public class ISO2022CNVerifier extends Verifier { public ISO2022CNVerifier() { cclass = new int[256/8] ; cclass[0] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (2))) )))))) ; cclass[1] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[2] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[3] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((1) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[4] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[5] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((3) << 4) | (0))) )))))) ; cclass[6] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[7] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[8] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((4) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[9] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[10] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[11] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[12] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[13] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[14] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[15] = (((( (((( (((( 0) << 4) | (0))) ) << 8) | (((((0) << 4) | ( 0))) ))) ) << 16) | ( (((( ((((0) << 4) | (0))) ) << 8) | ( ((((0) << 4) | (0))) )))))) ; cclass[16] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[17] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[18] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[19] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[20] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[21] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[22] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[23] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[24] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[25] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[26] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[27] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[28] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[29] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[30] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; cclass[31] = (((( (((( (((( 2) << 4) | (2))) ) << 8) | (((((2) << 4) | ( 2))) ))) ) << 16) | ( (((( ((((2) << 4) | (2))) ) << 8) | ( ((((2) << 4) | (2))) )))))) ; states = new int[8] ; states[0] = (((( (((( (((( eStart) << 4) | (eStart))) ) << 8) | (((((eStart) << 4) | ( eStart))) ))) ) << 16) | ( (((( ((((eStart) << 4) | (eError))) ) << 8) | ( (((( 3) << 4) | (eStart))) )))))) ; states[1] = (((( (((( (((( eError) << 4) | (eError))) ) << 8) | (((((eError) << 4) | ( eError))) ))) ) << 16) | ( (((( ((((eError) << 4) | (eError))) ) << 8) | ( ((((eError) << 4) | (eStart))) )))))) ; states[2] = (((( (((( (((( eItsMe) << 4) | (eItsMe))) ) << 8) | (((((eItsMe) << 4) | ( eItsMe))) ))) ) << 16) | ( (((( ((((eItsMe) << 4) | (eItsMe))) ) << 8) | ( ((((eError) << 4) | (eError))) )))))) ; states[3] = (((( (((( (((( eError) << 4) | ( 4))) ) << 8) | (((((eError) << 4) | ( eError))) ))) ) << 16) | ( (((( ((((eError) << 4) | (eItsMe))) ) << 8) | ( ((((eItsMe) << 4) | (eItsMe))) )))))) ; states[4] = (((( (((( (((( eError) << 4) | (eError))) ) << 8) | (((((eError) << 4) | ( eError))) ))) ) << 16) | ( (((( ((((eItsMe) << 4) | (eError))) ) << 8) | ( ((((eError) << 4) | (eError))) )))))) ; states[5] = (((( (((( (((( eError) << 4) | (eError))) ) << 8) | (((((eError) << 4) | ( eError))) ))) ) << 16) | ( (((( ((((eError) << 4) | (eError))) ) << 8) | ( (((( 6) << 4) | ( 5))) )))))) ; states[6] = (((( (((( (((( eError) << 4) | (eError))) ) << 8) | (((((eError) << 4) | ( eError))) ))) ) << 16) | ( (((( ((((eItsMe) << 4) | (eError))) ) << 8) | ( ((((eError) << 4) | (eError))) )))))) ; states[7] = (((( (((( (((( eStart) << 4) | (eError))) ) << 8) | (((((eItsMe) << 4) | ( eError))) ))) ) << 16) | ( (((( ((((eError) << 4) | (eError))) ) << 8) | ( ((((eError) << 4) | (eError))) )))))) ; charset = "ISO-2022-CN"; stFactor = 9; } }
[ "nntoan@users.noreply.github.com" ]
nntoan@users.noreply.github.com
ce8897c11e2cae4fcf24e1cb2ec0ddfcc0176156
bbb3a0ad237e8831f6be5e422fe1bcfccd9af741
/homework/src/main/java/com/yinhx/week05/mission10/Hikari.java
e3cda331af02dad859357d39c43a91904427b511
[]
no_license
yhxct/homewark
5dade2e2469084ff3a5e996f0ea264f59bd951ee
c849ada6cf546f4c5507d116c92ec71b51c2e37c
refs/heads/main
2023-07-11T07:19:05.702089
2021-08-20T12:38:34
2021-08-20T12:38:34
398,266,046
0
1
null
null
null
null
UTF-8
Java
false
false
1,366
java
package com.yinhx.week05.mission10; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Hikari { public static void main(String[] args) { HikariConfig hikariConfig = new HikariConfig(); hikariConfig.setJdbcUrl("jdbc:mysql://localhost:3306/wozaiguomaludeDB"); hikariConfig.setDriverClassName("com.mysql.jdbc.Driver"); hikariConfig.setUsername("root"); hikariConfig.setPassword("123456"); hikariConfig.addDataSourceProperty("cachePrepStmts", "true"); hikariConfig.addDataSourceProperty("prepStmtCacheSize", "250"); hikariConfig.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); HikariDataSource ds = new HikariDataSource(hikariConfig); Connection conn = null; Statement statement = null; ResultSet rs = null; try{ conn = ds.getConnection(); statement = conn.createStatement(); rs = statement.executeQuery("select id from t_base_log"); if (rs.next()){ System.out.println(rs.getString("id")); } conn.close(); } catch (SQLException e){ e.printStackTrace(); } } }
[ "yinhx@cffex.com.cn" ]
yinhx@cffex.com.cn
c8467d459bde236012a1818274b2c5ff8066fc77
487e72e8b39016491d1c09cb5fdff3e5270f451a
/data/javaCode/_edu.nd.dronology.services.core_src_edu_nd_dronology_services_core_items_IDroneSpecification.java
695f1b3af5a9c329f814bc29802c3c6004542863
[]
no_license
jinfenglin/DronologySemantic
268ab4e7d1f25e233c480d1156e374fdbfc3f57a
867a3f611a15edac925414aec31fba8b5bdc4cb2
refs/heads/master
2020-03-21T06:19:12.639341
2018-12-21T02:54:16
2018-12-21T02:54:16
138,211,918
1
0
null
null
null
null
UTF-8
Java
false
false
239
java
package edu.nd.dronology.services.core.items; public interface IDroneSpecification extends IPersistableItem{ String getDescription(); void setType(String type); void setDescription(String description); String getType(); }
[ "jlin6@ND.EDU" ]
jlin6@ND.EDU
affa79c80c929883315aef442a7d94c6f82b1c89
ee5fbe973ade2956f9b7e553ea44ce2296ceac7f
/android/app/src/main/java/com/awesomeproject/MainApplication.java
1a61a9f9eaf14503038b772efe21f89c53bb9e0d
[]
no_license
JdavX/AwesomeProject
1a345a794e69a77518e19fa9bb8bb56516b5dd2d
f5f9878223b4a93f44da6cac5c67b116e16400cc
refs/heads/master
2023-08-03T00:54:41.796890
2021-09-28T18:57:04
2021-09-28T18:57:04
411,404,827
0
0
null
null
null
null
UTF-8
Java
false
false
2,660
java
package com.awesomeproject; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.rnfingerprint.FingerprintAuthPackage; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.awesomeproject.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
[ "jasondavid678123@gmail.com" ]
jasondavid678123@gmail.com
92148b809c31e408df9f5ee54e6a109e731a9d74
0663063a8c81def1e9f69936fb63ab5f46602b3d
/app/src/main/java/academy/learnprogramming/MainActivity.java
f63d53a252a090b428b814e1d961a7fee42ce2aa
[]
no_license
pradeep20036/IS_Project1_AppointmentReminder
34ecca8cc953ea13626d30d29ae69bc1a6eefb61
aea178417f3b2860400dc35d8bb7d02bceb9224d
refs/heads/master
2023-06-19T07:17:13.383940
2021-07-16T06:59:56
2021-07-16T06:59:56
386,542,427
0
0
null
null
null
null
UTF-8
Java
false
false
1,818
java
package academy.learnprogramming; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; public class MainActivity extends AppCompatActivity implements academy.learnprogramming.MainFragment.OnItemSelectedListener, academy.learnprogramming.AddAppointmentFragment.OnItemSelectedListener { academy.learnprogramming.MainFragment myFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FragmentManager fm = getSupportFragmentManager(); myFragment = new academy.learnprogramming.MainFragment(); // add FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.myContainer, myFragment); ft.commit(); } public void onAddAppointmentSelected(academy.learnprogramming.Appointment appt) { FragmentManager fragmentManager = getSupportFragmentManager(); myFragment.updateAppointmentList(appt); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.myContainer, myFragment); ft.commit(); } public void onCancel() { FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.myContainer, myFragment); ft.commit(); } @Override public void onButtonSelected() { FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.myContainer, new academy.learnprogramming.AddAppointmentFragment()); ft.commit(); } }
[ "pradeep20036@iiitd.ac.in" ]
pradeep20036@iiitd.ac.in
443e428ce07c0e08291c1d585a967e61d092a15a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/19/19_0bb02561c0b983fc59634364d3f30b7937a1b358/AbstractTransformer/19_0bb02561c0b983fc59634364d3f30b7937a1b358_AbstractTransformer_s.java
04e040f483468c83b5fd3b7e7bf2058a08a7b850
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
95,924
java
/* * Copyright Red Hat Inc. and/or its affiliates and other contributors * as indicated by the authors tag. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License version 2. * * This particular file is subject to the "Classpath" exception as provided in the * LICENSE file that accompanied this code. * * This program is distributed in the hope that it will be useful, but WITHOUT A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License, * along with this distribution; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ package com.redhat.ceylon.compiler.java.codegen; import static com.redhat.ceylon.compiler.java.codegen.CodegenUtil.NameFlag.QUALIFIED; import static com.sun.tools.javac.code.Flags.FINAL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Map; import java.util.Map.Entry; import org.antlr.runtime.Token; import com.redhat.ceylon.compiler.java.codegen.CodegenUtil.NameFlag; import com.redhat.ceylon.compiler.java.loader.CeylonModelLoader; import com.redhat.ceylon.compiler.java.loader.TypeFactory; import com.redhat.ceylon.compiler.java.tools.CeylonLog; import com.redhat.ceylon.compiler.java.util.Util; import com.redhat.ceylon.compiler.loader.AbstractModelLoader; import com.redhat.ceylon.compiler.loader.ModelLoader.DeclarationType; import com.redhat.ceylon.compiler.typechecker.model.Annotation; import com.redhat.ceylon.compiler.typechecker.model.BottomType; import com.redhat.ceylon.compiler.typechecker.model.Class; import com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface; import com.redhat.ceylon.compiler.typechecker.model.Declaration; import com.redhat.ceylon.compiler.typechecker.model.Functional; import com.redhat.ceylon.compiler.typechecker.model.FunctionalParameter; import com.redhat.ceylon.compiler.typechecker.model.Generic; import com.redhat.ceylon.compiler.typechecker.model.Interface; import com.redhat.ceylon.compiler.typechecker.model.IntersectionType; import com.redhat.ceylon.compiler.typechecker.model.Method; import com.redhat.ceylon.compiler.typechecker.model.Module; import com.redhat.ceylon.compiler.typechecker.model.ModuleImport; import com.redhat.ceylon.compiler.typechecker.model.Package; import com.redhat.ceylon.compiler.typechecker.model.Parameter; import com.redhat.ceylon.compiler.typechecker.model.ProducedReference; import com.redhat.ceylon.compiler.typechecker.model.ProducedType; import com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference; import com.redhat.ceylon.compiler.typechecker.model.Scope; import com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration; import com.redhat.ceylon.compiler.typechecker.model.TypeParameter; import com.redhat.ceylon.compiler.typechecker.model.TypedDeclaration; import com.redhat.ceylon.compiler.typechecker.model.UnionType; import com.redhat.ceylon.compiler.typechecker.tree.Node; import com.redhat.ceylon.compiler.typechecker.tree.Tree; import com.redhat.ceylon.compiler.typechecker.tree.Tree.Expression; import com.sun.tools.javac.code.BoundKind; import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.TypeTags; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.Factory; import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCExpression; import com.sun.tools.javac.tree.JCTree.JCFieldAccess; import com.sun.tools.javac.tree.JCTree.JCIdent; import com.sun.tools.javac.tree.JCTree.JCLiteral; import com.sun.tools.javac.tree.JCTree.JCStatement; import com.sun.tools.javac.tree.JCTree.JCTypeParameter; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.tree.JCTree.LetExpr; import com.sun.tools.javac.tree.TreeMaker; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Position; import com.sun.tools.javac.util.Position.LineMap; /** * Base class for all delegating transformers */ public abstract class AbstractTransformer implements Transformation, LocalId { /** * M1 and M2 are 0.0 since they were not tagged at the time * M3 is 1.0 as the first version with binary version information */ public static final int BINARY_MAJOR_VERSION = 1; public static final int BINARY_MINOR_VERSION = 0; private Context context; private TreeMaker make; private Names names; private Symtab syms; private AbstractModelLoader loader; private TypeFactory typeFact; protected Log log; public AbstractTransformer(Context context) { this.context = context; make = TreeMaker.instance(context); names = Names.instance(context); syms = Symtab.instance(context); loader = CeylonModelLoader.instance(context); typeFact = TypeFactory.instance(context); log = CeylonLog.instance(context); } Context getContext() { return context; } @Override public TreeMaker make() { return make; } private static JavaPositionsRetriever javaPositionsRetriever = null; public static void trackNodePositions(JavaPositionsRetriever positionsRetriever) { javaPositionsRetriever = positionsRetriever; } @Override public Factory at(Node node) { if (node == null) { make.at(Position.NOPOS); } else { Token token = node.getToken(); if (token != null) { int tokenStartPosition = getMap().getStartPosition(token.getLine()) + token.getCharPositionInLine(); make().at(tokenStartPosition); if (javaPositionsRetriever != null) { javaPositionsRetriever.addCeylonNode(tokenStartPosition, node); } } } return make(); } @Override public Symtab syms() { return syms; } @Override public Names names() { return names; } @Override public AbstractModelLoader loader() { return loader; } @Override public TypeFactory typeFact() { return typeFact; } void setMap(LineMap map) { gen().setMap(map); } LineMap getMap() { return gen().getMap(); } @Override public CeylonTransformer gen() { return CeylonTransformer.getInstance(context); } @Override public ExpressionTransformer expressionGen() { return ExpressionTransformer.getInstance(context); } @Override public StatementTransformer statementGen() { return StatementTransformer.getInstance(context); } @Override public ClassTransformer classGen() { return ClassTransformer.getInstance(context); } /** * Makes an <strong>unquoted</strong> simple identifier * @param ident The identifier * @return The ident */ JCExpression makeUnquotedIdent(String ident) { return make().Ident(names().fromString(ident)); } /** * Makes an <strong>quoted</strong> simple identifier * @param ident The identifier * @return The ident */ JCIdent makeQuotedIdent(String ident) { return make().Ident(names().fromString(Util.quoteIfJavaKeyword(ident))); } /** * Makes a <strong>quoted</strong> qualified (compound) identifier from * the given qualified name. Each part of the name will be * quoted if it is a Java keyword. * @param qualifiedName The qualified name */ JCExpression makeQuotedQualIdentFromString(String qualifiedName) { return makeQualIdent(null, Util.quoteJavaKeywords(qualifiedName.split("\\."))); } /** * Makes an <strong>unquoted</strong> qualified (compound) identifier * from the given qualified name components * @param components The components of the name. * @see #makeQuotedQualIdentFromString(String) */ JCExpression makeQualIdent(Iterable<String> components) { JCExpression type = null; for (String component : components) { if (type == null) type = makeUnquotedIdent(component); else type = makeSelect(type, component); } return type; } JCExpression makeQuotedQualIdent(Iterable<String> components) { JCExpression type = null; for (String component : components) { if (type == null) type = makeQuotedIdent(component); else type = makeSelect(type, Util.quoteIfJavaKeyword(component)); } return type; } /** * Makes an <strong>unquoted</strong> qualified (compound) identifier * from the given qualified name components * @param expr A starting expression (may be null) * @param names The components of the name (may be null) * @see #makeQuotedQualIdentFromString(String) */ JCExpression makeQualIdent(JCExpression expr, String... names) { if (names != null) { for (String component : names) { if (component != null) { if (expr == null) { expr = makeUnquotedIdent(component); } else { expr = makeSelect(expr, component); } } } } return expr; } JCExpression makeQuotedQualIdent(JCExpression expr, String... names) { if (names != null) { for (String component : names) { if (component != null) { if (expr == null) { expr = makeQuotedIdent(component); } else { expr = makeSelect(expr, Util.quoteIfJavaKeyword(component)); } } } } return expr; } JCExpression makeFQIdent(String... components) { return makeQualIdent(makeUnquotedIdent(""), components); } JCExpression makeQuotedFQIdent(String... components) { return makeQuotedQualIdent(makeUnquotedIdent(""), components); } JCExpression makeQuotedFQIdent(String qualifiedName) { return makeQuotedFQIdent(Util.quoteJavaKeywords(qualifiedName.split("\\."))); } JCExpression makeIdent(Type type) { return make().QualIdent(type.tsym); } /** * Makes a <strong>unquoted</strong> field access * @param s1 The base expression * @param s2 The field to access * @return The field access */ JCFieldAccess makeSelect(JCExpression s1, String s2) { return make().Select(s1, names().fromString(s2)); } /** * Makes a <strong>unquoted</strong> field access * @param s1 The base expression * @param s2 The field to access * @return The field access */ JCFieldAccess makeSelect(String s1, String s2) { return makeSelect(makeUnquotedIdent(s1), s2); } /** * Makes a sequence of <strong>unquoted</strong> field accesses * @param s1 The base expression * @param s2 The first field to access * @param rest The remaining fields to access * @return The field access */ JCFieldAccess makeSelect(String s1, String s2, String... rest) { return makeSelect(makeSelect(s1, s2), rest); } JCFieldAccess makeSelect(JCFieldAccess s1, String[] rest) { JCFieldAccess acc = s1; for (String s : rest) { acc = makeSelect(acc, s); } return acc; } JCLiteral makeNull() { return make().Literal(TypeTags.BOT, null); } JCExpression makeInteger(int i) { return make().Literal(Integer.valueOf(i)); } JCExpression makeLong(long i) { return make().Literal(Long.valueOf(i)); } JCExpression makeBoolean(boolean b) { JCExpression expr; if (b) { expr = make().Literal(TypeTags.BOOLEAN, Integer.valueOf(1)); } else { expr = make().Literal(TypeTags.BOOLEAN, Integer.valueOf(0)); } return expr; } // Creates a "foo foo = new foo();" JCTree.JCVariableDecl makeLocalIdentityInstance(String varName, String className, boolean isShared) { JCExpression name = makeQuotedIdent(className); JCExpression initValue = makeNewClass(className, false); List<JCAnnotation> annots = List.<JCAnnotation>nil(); int modifiers = isShared ? 0 : FINAL; JCTree.JCVariableDecl var = make().VarDef( make().Modifiers(modifiers, annots), names().fromString(varName), name, initValue); return var; } JCTree.JCVariableDecl makeLocalIdentityInstance(String varName, boolean isShared) { return makeLocalIdentityInstance(varName, varName, isShared); } // Creates a "new foo();" JCTree.JCNewClass makeNewClass(String className, boolean fullyQualified) { return makeNewClass(className, List.<JCTree.JCExpression>nil(), fullyQualified); } // Creates a "new foo(arg1, arg2, ...);" JCTree.JCNewClass makeNewClass(String className, List<JCTree.JCExpression> args, boolean fullyQualified) { JCExpression name = fullyQualified ? makeQuotedFQIdent(className) : makeQuotedQualIdentFromString(className); return makeNewClass(name, args); } // Creates a "new foo(arg1, arg2, ...);" JCTree.JCNewClass makeNewClass(JCExpression clazz, List<JCTree.JCExpression> args) { if (args == null) { args = List.<JCTree.JCExpression>nil(); } return make().NewClass(null, null, clazz, args, null); } JCVariableDecl makeVar(String varName, JCExpression typeExpr, JCExpression valueExpr) { return make().VarDef(make().Modifiers(0), names().fromString(varName), typeExpr, valueExpr); } // Creates a "( let var1=expr1,var2=expr2,...,varN=exprN in varN; )" // or a "( let var1=expr1,var2=expr2,...,varN=exprN,exprO in exprO; )" JCExpression makeLetExpr(JCExpression... args) { return makeLetExpr(tempName(), null, args); } // Creates a "( let var1=expr1,var2=expr2,...,varN=exprN in statements; varN; )" // or a "( let var1=expr1,var2=expr2,...,varN=exprN in statements; exprO; )" JCExpression makeLetExpr(String varBaseName, List<JCStatement> statements, JCExpression... args) { String varName = null; ListBuffer<JCStatement> decls = ListBuffer.lb(); int i; for (i = 0; (i + 1) < args.length; i += 2) { JCExpression typeExpr = args[i]; JCExpression valueExpr = args[i+1]; varName = varBaseName + ((args.length > 3) ? "$" + i : ""); JCVariableDecl varDecl = makeVar(varName, typeExpr, valueExpr); decls.append(varDecl); } JCExpression result; if (i == args.length) { result = makeUnquotedIdent(varName); } else { result = args[i]; } if (statements != null) { decls.appendList(statements); } return make().LetExpr(decls.toList(), result); } /* * Methods for making unique temporary and alias names */ static class UniqueId { private long id = 0; private long nextId() { return id++; } } private long nextUniqueId() { UniqueId id = context.get(UniqueId.class); if (id == null) { id = new UniqueId(); context.put(UniqueId.class, id); } return id.nextId(); } String tempName() { String result = "$ceylontmp" + nextUniqueId(); return result; } String tempName(String prefix) { String result = "$ceylontmp" + prefix + nextUniqueId(); return result; } String aliasName(String name) { String result = "$" + name + "$" + nextUniqueId(); return result; } /* * Type handling */ boolean isBooleanTrue(Declaration decl) { return decl == loader().getDeclaration("ceylon.language.$true", DeclarationType.VALUE); } boolean isBooleanFalse(Declaration decl) { return decl == loader().getDeclaration("ceylon.language.$false", DeclarationType.VALUE); } /** * Determines whether the given type is optional. */ boolean isOptional(ProducedType type) { // Note we don't use typeFact().isOptionalType(type) because // that implements a stricter test used in the type checker. return typeFact().getNullDeclaration().getType().isSubtypeOf(type); } boolean isNothing(ProducedType type) { return type.getSupertype(typeFact.getNothingDeclaration()) != null; } public boolean isVoid(ProducedType type) { return typeFact.getVoidDeclaration().getType().isExactly(type); } private boolean isObject(ProducedType type) { return typeFact.getObjectDeclaration().getType().isExactly(type); } ProducedType simplifyType(ProducedType orgType) { ProducedType type = orgType; if (isOptional(type)) { // For an optional type T?: // - The Ceylon type T? results in the Java type T type = typeFact().getDefiniteType(type); if (type.getUnderlyingType() != null) { // A definite type should not have its underlyingType set so we make a copy type = type.withoutUnderlyingType(); } } TypeDeclaration tdecl = type.getDeclaration(); if (tdecl instanceof UnionType && tdecl.getCaseTypes().size() == 1) { // Special case when the Union contains only a single CaseType // FIXME This is not correct! We might lose information about type arguments! type = tdecl.getCaseTypes().get(0); } else if (tdecl instanceof IntersectionType) { java.util.List<ProducedType> satisfiedTypes = tdecl.getSatisfiedTypes(); if (satisfiedTypes.size() == 1) { // Special case when the Intersection contains only a single SatisfiedType // FIXME This is not correct! We might lose information about type arguments! type = satisfiedTypes.get(0); } else if (satisfiedTypes.size() == 2) { // special case for T? simplified as T&Object if (isTypeParameter(satisfiedTypes.get(0)) && isObject(satisfiedTypes.get(1))) { type = satisfiedTypes.get(0); } } } return type; } TypedDeclaration nonWideningTypeDecl(TypedDeclaration decl) { TypedDeclaration refinedDeclaration = (TypedDeclaration) decl.getRefinedDeclaration(); if(decl != refinedDeclaration){ /* * We are widening if the type: * - is not object * - is erased to object * - refines a declaration that is not erased to object */ ProducedType declType = decl.getType(); ProducedType refinedDeclType = refinedDeclaration.getType(); boolean isWidening = isWidening(declType, refinedDeclType); if(!isWidening){ // make sure we get the instantiated refined decl if(refinedDeclType.getDeclaration() instanceof TypeParameter && !(declType.getDeclaration() instanceof TypeParameter)) refinedDeclType = nonWideningType(decl, refinedDeclaration); isWidening = isWideningTypeArguments(declType, refinedDeclType, true); } if(isWidening) return refinedDeclaration; } return decl; } public boolean isWidening(ProducedType declType, ProducedType refinedDeclType) { return !sameType(syms().ceylonObjectType, declType) && willEraseToObject(declType) && !willEraseToObject(refinedDeclType); } private boolean isWideningTypeArguments(ProducedType declType, ProducedType refinedDeclType, boolean allowSubtypes) { if(declType.getDeclaration() instanceof TypeParameter && refinedDeclType.getDeclaration() instanceof TypeParameter){ // consider them equivalent if they have the same bounds TypeParameter tp = (TypeParameter) declType.getDeclaration(); TypeParameter refinedTP = (TypeParameter) refinedDeclType.getDeclaration(); return !haveSameBounds(tp, refinedTP); } if(allowSubtypes){ // if we have exactly the same type don't bother finding a common ancestor if(!declType.isExactly(refinedDeclType)){ // check if we can form an informed decision if(refinedDeclType.getDeclaration() == null) return true; // find the instantiation of the refined decl type in the decl type declType = declType.getSupertype(refinedDeclType.getDeclaration()); // could not find common type, we must be widening somehow if(declType == null) return true; } } Map<TypeParameter, ProducedType> typeArguments = declType.getTypeArguments(); Map<TypeParameter, ProducedType> refinedTypeArguments = refinedDeclType.getTypeArguments(); for(Entry<TypeParameter, ProducedType> typeArgument : typeArguments.entrySet()){ ProducedType refinedTypeArgument = refinedTypeArguments.get(typeArgument.getKey()); if(refinedTypeArgument == null) return true; // something fishy here // check if the type arg is widening due to erasure if(isWidening(typeArgument.getValue(), refinedTypeArgument)) return true; // check if the type arg is a subtype, or if its type args are widening if(isWideningTypeArguments(typeArgument.getValue(), refinedTypeArgument, false)) return true; } // so far so good return false; } public boolean haveSameBounds(TypeParameter tp, TypeParameter refinedTP) { java.util.List<ProducedType> satTP = tp.getSatisfiedTypes(); java.util.List<ProducedType> satRefinedTP = new LinkedList<ProducedType>(); satRefinedTP.addAll(refinedTP.getSatisfiedTypes()); // same number of bounds if(satTP.size() != satRefinedTP.size()) return false; // make sure all the bounds are the same OUT: for(ProducedType satisfiedType : satTP){ for(ProducedType refinedSatisfiedType : satRefinedTP){ // if we found it, remove it from the second list to not match it again if(satisfiedType.isExactly(refinedSatisfiedType)){ satRefinedTP.remove(satRefinedTP); continue OUT; } } // not found return false; } // all bounds are equal return true; } ProducedType nonWideningType(TypedDeclaration declaration, TypedDeclaration refinedDeclaration){ if(declaration == refinedDeclaration) return declaration.getType(); // we must get the return type of the refined decl with any type param instantiated // Note(Stef): this magic taken from the IDE code ArrayList<ProducedType> params = new ArrayList<ProducedType>(); if (refinedDeclaration instanceof Generic) { for (TypeParameter tp: ((Generic)refinedDeclaration).getTypeParameters()) { params.add(tp.getType()); } } ProducedType outerType = declaration.getContainer().getDeclaringType(refinedDeclaration); ProducedReference producedReference = refinedDeclaration.getProducedReference(outerType, params); ProducedType refinedType = refinedDeclaration.getType(); if(producedReference != null) refinedType = refinedType.substitute(producedReference.getTypeArguments()); // if the refined type is a method TypeParam, use the original decl that will be more correct if(refinedType.getDeclaration() instanceof TypeParameter && refinedType.getDeclaration().getContainer() instanceof Method){ return declaration.getType(); } return refinedType; } private ProducedType toPType(com.sun.tools.javac.code.Type t) { return loader().getType(t.tsym.packge().getQualifiedName().toString(), t.tsym.getQualifiedName().toString(), null); } private boolean sameType(Type t1, ProducedType t2) { return toPType(t1).isExactly(t2); } // Determines if a type will be erased to java.lang.Object once converted to Java boolean willEraseToObject(ProducedType type) { type = simplifyType(type); return (sameType(syms().ceylonVoidType, type) || sameType(syms().ceylonObjectType, type) || sameType(syms().ceylonNothingType, type) || sameType(syms().ceylonIdentifiableObjectType, type) || sameType(syms().ceylonIdentifiableType, type) || type.getDeclaration() instanceof BottomType || typeFact().isUnion(type)|| typeFact().isIntersection(type)); } boolean willEraseToException(ProducedType type) { type = simplifyType(type); return (sameType(syms().ceylonExceptionType, type)); } boolean isCeylonString(ProducedType type) { return (sameType(syms().ceylonStringType, type)); } boolean isCeylonBoolean(ProducedType type) { return type.isSubtypeOf(typeFact.getBooleanDeclaration().getType()) && !(type.getDeclaration() instanceof BottomType); } boolean isCeylonInteger(ProducedType type) { return (sameType(syms().ceylonIntegerType, type)); } boolean isCeylonFloat(ProducedType type) { return (sameType(syms().ceylonFloatType, type)); } boolean isCeylonCharacter(ProducedType type) { return (sameType(syms().ceylonCharacterType, type)); } boolean isCeylonArray(ProducedType type) { return (sameType(syms().ceylonArrayType, type.getDeclaration().getType())); } boolean isCeylonBasicType(ProducedType type) { return (isCeylonString(type) || isCeylonBoolean(type) || isCeylonInteger(type) || isCeylonFloat(type) || isCeylonCharacter(type)); } boolean isCeylonCallable(ProducedType type) { return type.isCallable(); } /* * Java Type creation */ /** For use in {@code implements} clauses. */ static final int JT_SATISFIES = 1 << 0; /** For use in {@code extends} clauses. */ static final int JT_EXTENDS = 1 << 1; /** For use when generating a type argument */ static final int JT_TYPE_ARGUMENT = 1 << 2; /** For use when a primitive type won't do. */ static final int JT_NO_PRIMITIVES = 1 << 2; // Yes, same as TYPE_ARGUMENT /** For generating a type without type arguments. */ static final int JT_RAW = 1 << 3; /** For use in {@code catch} statements. */ static final int JT_CATCH = 1 << 4; /** * Generate a 'small' primitive type (if the type is primitive and has a * small variant). */ static final int JT_SMALL = 1 << 5; /** For use in {@code new} expressions. */ static final int JT_CLASS_NEW = 1 << 6; /** Generates the Java type of the companion class of the given type */ static final int JT_COMPANION = 1 << 7; static final int JT_NON_QUALIFIED = 1 << 8; /** * If the type is a type parameter, return the Java type for its upper bound. * Implies {@link #JT_RAW} */ static final int JT_RAW_TP_BOUND = JT_RAW | 1 << 9; /** * This function is used solely for method return types and parameters */ JCExpression makeJavaType(TypedDeclaration typeDecl, ProducedType type, int flags) { if (typeDecl instanceof FunctionalParameter) { FunctionalParameter p = (FunctionalParameter)typeDecl; ProducedType pt = type; for (int ii = 1; ii < p.getParameterLists().size(); ii++) { pt = typeFact().getCallableType(pt); } return makeJavaType(typeFact().getCallableType(pt), flags); } else { boolean usePrimitives = CodegenUtil.isUnBoxed(typeDecl); return makeJavaType(type, flags | (usePrimitives ? 0 : AbstractTransformer.JT_NO_PRIMITIVES)); } } JCExpression makeJavaType(ProducedType producedType) { return makeJavaType(producedType, 0); } JCExpression makeJavaType(ProducedType type, final int flags) { if(type == null) return make().Erroneous(); if ((flags & 1<<9) != 0 && type.getDeclaration() instanceof TypeParameter) { type = ((TypeParameter)type.getDeclaration()).getExtendedType(); } // ERASURE if (willEraseToObject(type)) { // For an erased type: // - Any of the Ceylon types Void, Object, Nothing, // IdentifiableObject, and Bottom result in the Java type Object // For any other union type U|V (U nor V is Optional): // - The Ceylon type U|V results in the Java type Object ProducedType iterType = typeFact().getNonemptyIterableType(typeFact().getDefiniteType(type)); if (iterType != null) { // We special case the erasure of X[] and X[]? type = iterType; } else { if ((flags & JT_SATISFIES) != 0) { return null; } else { return make().Type(syms().objectType); } } } else if (willEraseToException(type)) { if ((flags & JT_CLASS_NEW) != 0 || (flags & JT_EXTENDS) != 0) { return make().Type(syms().ceylonExceptionType); } else if ((flags & JT_CATCH) != 0) { return make().Type(syms().exceptionType); } else { return make().Type(syms().throwableType); } } else if ((flags & (JT_SATISFIES | JT_EXTENDS | JT_TYPE_ARGUMENT | JT_CLASS_NEW)) == 0 && (!isOptional(type) || isJavaString(type))) { if (isCeylonString(type) || isJavaString(type)) { return make().Type(syms().stringType); } else if (isCeylonBoolean(type)) { return make().TypeIdent(TypeTags.BOOLEAN); } else if (isCeylonInteger(type)) { if ("byte".equals(type.getUnderlyingType())) { return make().TypeIdent(TypeTags.BYTE); } else if ("short".equals(type.getUnderlyingType())) { return make().TypeIdent(TypeTags.SHORT); } else if ((flags & JT_SMALL) != 0 || "int".equals(type.getUnderlyingType())) { return make().TypeIdent(TypeTags.INT); } else { return make().TypeIdent(TypeTags.LONG); } } else if (isCeylonFloat(type)) { if ((flags & JT_SMALL) != 0 || "float".equals(type.getUnderlyingType())) { return make().TypeIdent(TypeTags.FLOAT); } else { return make().TypeIdent(TypeTags.DOUBLE); } } else if (isCeylonCharacter(type)) { if ("char".equals(type.getUnderlyingType())) { return make().TypeIdent(TypeTags.CHAR); } else { return make().TypeIdent(TypeTags.INT); } } } else if (isCeylonBoolean(type) && !isTypeParameter(type)) { //&& (flags & TYPE_ARGUMENT) == 0){ // special case to get rid of $true and $false types type = typeFact.getBooleanDeclaration().getType(); } JCExpression jt = makeErroneous(); ProducedType simpleType = simplifyType(type); java.util.List<ProducedType> qualifyingTypes = new java.util.ArrayList<ProducedType>(); ProducedType qType = simpleType; boolean hasTypeParameters = false; while (qType != null) { hasTypeParameters |= !qType.getTypeArguments().isEmpty(); qualifyingTypes.add(qType); qType = qType.getQualifyingType(); } int firstQualifyingTypeWithTypeParameters = qualifyingTypes.size() - 1; // find the first static one, from the right to the left for(ProducedType pt : qualifyingTypes){ TypeDeclaration declaration = pt.getDeclaration(); if(Decl.isStatic(declaration)){ break; } firstQualifyingTypeWithTypeParameters--; } if(firstQualifyingTypeWithTypeParameters < 0) firstQualifyingTypeWithTypeParameters = 0; // put them in outer->inner order Collections.reverse(qualifyingTypes); if (((flags & JT_RAW) == 0) && hasTypeParameters) { // special case for interfaces because we pull them into toplevel types if(Decl.isCeylon(simpleType.getDeclaration()) && qualifyingTypes.size() > 1 && simpleType.getDeclaration() instanceof Interface){ JCExpression baseType = makeErroneous(); TypeDeclaration tdecl = simpleType.getDeclaration(); // collect all the qualifying type args we'd normally have java.util.List<TypeParameter> qualifyingTypeParameters = new java.util.ArrayList<TypeParameter>(); java.util.Map<TypeParameter, ProducedType> qualifyingTypeArguments = new java.util.HashMap<TypeParameter, ProducedType>(); for (ProducedType qualifiedType : qualifyingTypes) { Map<TypeParameter, ProducedType> tas = qualifiedType.getTypeArguments(); java.util.List<TypeParameter> tps = qualifiedType.getDeclaration().getTypeParameters(); if (tps != null) { qualifyingTypeParameters.addAll(tps); qualifyingTypeArguments.putAll(tas); } } ListBuffer<JCExpression> typeArgs = makeTypeArgs(isCeylonCallable(simpleType), flags, qualifyingTypeArguments, qualifyingTypeParameters); if (isCeylonCallable(type) && (flags & JT_CLASS_NEW) != 0) { baseType = makeIdent(syms().ceylonAbstractCallableType); } else { baseType = makeDeclarationName(tdecl); } if (typeArgs != null && typeArgs.size() > 0) { jt = make().TypeApply(baseType, typeArgs.toList()); } else { jt = baseType; } }else if((flags & JT_NON_QUALIFIED) == 0){ int index = 0; for (ProducedType qualifyingType : qualifyingTypes) { jt = makeParameterisedType(qualifyingType, type, flags, jt, qualifyingTypes, firstQualifyingTypeWithTypeParameters, index); index++; } }else{ jt = makeParameterisedType(type, type, flags, jt, qualifyingTypes, 0, 0); } } else { TypeDeclaration tdecl = simpleType.getDeclaration(); // For an ordinary class or interface type T: // - The Ceylon type T results in the Java type T if(tdecl instanceof TypeParameter) jt = makeQuotedIdent(tdecl.getName()); // don't use underlying type if we want no primitives else if((flags & (JT_SATISFIES | JT_NO_PRIMITIVES)) != 0 || simpleType.getUnderlyingType() == null){ jt = makeQuotedQualIdentFromString(declName(tdecl, flags)); }else jt = makeQuotedFQIdent(simpleType.getUnderlyingType()); } return jt; } public JCExpression makeParameterisedType(ProducedType type, ProducedType generalType, final int flags, JCExpression qualifyingExpression, java.util.List<ProducedType> qualifyingTypes, int firstQualifyingTypeWithTypeParameters, int index) { JCExpression baseType; TypeDeclaration tdecl = type.getDeclaration(); ListBuffer<JCExpression> typeArgs = null; if(index >= firstQualifyingTypeWithTypeParameters) typeArgs = makeTypeArgs( type, //tdecl, flags); if (isCeylonCallable(generalType) && (flags & JT_CLASS_NEW) != 0) { baseType = makeIdent(syms().ceylonAbstractCallableType); } else if (index == 0) { String name; // in Ceylon we'd move the nested decl to a companion class // but in Java we just don't have type params to the qualifying type if the // qualified type is static if (tdecl instanceof Interface && qualifyingTypes.size() > 1 && firstQualifyingTypeWithTypeParameters == 0) { name = getCompanionClassName(tdecl); } else { name = declName(tdecl, flags); } baseType = makeQuotedQualIdentFromString(name); } else { baseType = makeSelect(qualifyingExpression, tdecl.getName()); } if (typeArgs != null && typeArgs.size() > 0) { qualifyingExpression = make().TypeApply(baseType, typeArgs.toList()); } else { qualifyingExpression = baseType; } return qualifyingExpression; } private ListBuffer<JCExpression> makeTypeArgs( ProducedType simpleType, int flags) { Map<TypeParameter, ProducedType> tas = simpleType.getTypeArguments(); java.util.List<TypeParameter> tps = simpleType.getDeclaration().getTypeParameters(); return makeTypeArgs(isCeylonCallable(simpleType), flags, tas, tps); } private ListBuffer<JCExpression> makeTypeArgs(boolean isCeylonCallable, int flags, Map<TypeParameter, ProducedType> tas, java.util.List<TypeParameter> tps) { ListBuffer<JCExpression> typeArgs = new ListBuffer<JCExpression>(); int idx = 0; for (TypeParameter tp : tps) { ProducedType ta = tas.get(tp); if (idx > 0 && isCeylonCallable) { // In the runtime Callable only has a single type param break; } if (isOptional(ta)) { // For an optional type T?: // - The Ceylon type Foo<T?> results in the Java type Foo<T>. ta = getNonNullType(ta); } if (typeFact().isUnion(ta) || typeFact().isIntersection(ta)) { // For any other union type U|V (U nor V is Optional): // - The Ceylon type Foo<U|V> results in the raw Java type Foo. // For any other intersection type U|V: // - The Ceylon type Foo<U&V> results in the raw Java type Foo. ProducedType iterType = typeFact().getNonemptyIterableType(typeFact().getDefiniteType(ta)); // don't break if the union type is erased to something better than Object if(iterType == null){ // use raw types if: // - we're calling a constructor // - we're not in a type argument (when used as type arguments raw types have more constraint than at the toplevel) if((flags & JT_CLASS_NEW) != 0 || (flags & JT_TYPE_ARGUMENT) == 0){ // A bit ugly, but we need to escape from the loop and create a raw type, no generics typeArgs = null; break; } // otherwise just go on }else ta = iterType; } if (isCeylonBoolean(ta) && !isTypeParameter(ta)) { ta = typeFact.getBooleanDeclaration().getType(); } JCExpression jta; if (sameType(syms().ceylonVoidType, ta)) { // For the root type Void: if ((flags & (JT_SATISFIES | JT_EXTENDS)) != 0) { // - The Ceylon type Foo<Void> appearing in an extends or satisfies // clause results in the Java raw type Foo<Object> jta = make().Type(syms().objectType); } else { // - The Ceylon type Foo<Void> appearing anywhere else results in the Java type // - Foo<Object> if Foo<T> is invariant in T // - Foo<?> if Foo<T> is covariant in T, or // - Foo<Object> if Foo<T> is contravariant in T if (tp.isContravariant()) { jta = make().Type(syms().objectType); } else if (tp.isCovariant()) { jta = make().Wildcard(make().TypeBoundKind(BoundKind.UNBOUND), makeJavaType(ta, flags | JT_TYPE_ARGUMENT)); } else { jta = make().Type(syms().objectType); } } } else if (ta.getDeclaration() instanceof BottomType // if we're in a type argument already, union and intersection types should use the same erasure rules // as bottom: prefer wildcards || ((flags & JT_TYPE_ARGUMENT) != 0 && (typeFact().isUnion(ta) || typeFact().isIntersection(ta)))) { // For the bottom type Bottom: if ((flags & (JT_SATISFIES | JT_EXTENDS | JT_CLASS_NEW)) != 0) { // - The Ceylon type Foo<Bottom> appearing in an extends or satisfies or instantiation // clause results in the Java raw type Foo // A bit ugly, but we need to escape from the loop and create a raw type, no generics typeArgs = null; break; } else { // - The Ceylon type Foo<Bottom> appearing anywhere else results in the Java type // - raw Foo if Foo<T> is invariant in T, // - Foo<?> if Foo<T> is covariant in T, or // - Foo<?> if Foo<T> is contravariant in T if (tp.isContravariant() || tp.isCovariant()) { jta = make().Wildcard(make().TypeBoundKind(BoundKind.UNBOUND), null); } else { // A bit ugly, but we need to escape from the loop and create a raw type, no generics typeArgs = null; break; } } } else { // For an ordinary class or interface type T: if ((flags & (JT_SATISFIES | JT_EXTENDS)) != 0) { // - The Ceylon type Foo<T> appearing in an extends or satisfies clause // results in the Java type Foo<T> jta = makeJavaType(ta, JT_TYPE_ARGUMENT); } else { // - The Ceylon type Foo<T> appearing anywhere else results in the Java type // - Foo<T> if Foo is invariant in T, // - Foo<? extends T> if Foo is covariant in T, or // - Foo<? super T> if Foo is contravariant in T if (((flags & JT_CLASS_NEW) == 0) && tp.isContravariant()) { jta = make().Wildcard(make().TypeBoundKind(BoundKind.SUPER), makeJavaType(ta, JT_TYPE_ARGUMENT)); } else if (((flags & JT_CLASS_NEW) == 0) && tp.isCovariant()) { jta = make().Wildcard(make().TypeBoundKind(BoundKind.EXTENDS), makeJavaType(ta, JT_TYPE_ARGUMENT)); } else { jta = makeJavaType(ta, JT_TYPE_ARGUMENT); } } } typeArgs.add(jta); idx++; } return typeArgs; } private ProducedType getNonNullType(ProducedType pt) { // typeFact().getDefiniteType() intersects with Object, which isn't // always right for working with the java type system. if (typeFact().getVoidDeclaration().equals(pt.getDeclaration())) { pt = typeFact().getObjectDeclaration().getType(); } else { pt = pt.minus(typeFact().getNothingDeclaration()); } return pt; } private boolean isJavaString(ProducedType type) { return "java.lang.String".equals(type.getUnderlyingType()); } private java.util.Map<Scope, Integer> locals; private java.util.Set<Interface> interfaces; private void resetLocals() { ((AbstractTransformer)gen()).locals = new java.util.HashMap<Scope, Integer>(); } private void local(Scope decl) { Map<Scope, Integer> locals = ((AbstractTransformer)gen()).locals; locals.put(decl, locals.size()); } boolean hasInterface(Interface iface) { return ((AbstractTransformer)gen()).interfaces != null && ((AbstractTransformer)gen()).interfaces.contains(iface); } void noteDecl(Declaration decl) { if (decl.isToplevel()) { resetLocals(); } else if (Decl.isLocal(decl)){ local(decl.getContainer()); } if (decl instanceof Interface) { if (((AbstractTransformer)gen()).interfaces == null) { ((AbstractTransformer)gen()).interfaces = new HashSet<Interface>(); } ((AbstractTransformer)gen()).interfaces.add((Interface)decl); } } @Override public String getLocalId(Scope decl) { Integer id = ((AbstractTransformer)gen()).locals.get(decl); if (id == null) { throw new RuntimeException(decl + " has no local id"); } return String.valueOf(id); } private ClassDefinitionBuilder ccdb; ClassDefinitionBuilder current() { return ((AbstractTransformer)gen()).ccdb; } ClassDefinitionBuilder replace(ClassDefinitionBuilder ccdb) { ClassDefinitionBuilder result = ((AbstractTransformer)gen()).ccdb; ((AbstractTransformer)gen()).ccdb = ccdb; return result; } String getFQDeclarationName(final Declaration decl) { return declName(decl, QUALIFIED); } private String declName(TypeDeclaration tdecl, int flags) { java.util.List<NameFlag> args = new LinkedList<NameFlag>(); if ((flags & JT_COMPANION) != 0) { args.add(NameFlag.COMPANION); } if ((flags & JT_NON_QUALIFIED) == 0) { args.add(NameFlag.QUALIFIED); } return declName(tdecl, args.toArray(new NameFlag[args.size()])); } String declName(final Declaration decl, CodegenUtil.NameFlag... flags) { return CodegenUtil.declName(this, decl, flags); } private JCExpression makeDeclarationName(Declaration decl) { return makeQuotedQualIdentFromString(getFQDeclarationName(decl)); } /** * Returns the name of the companion class of the given class or interface */ String getCompanionClassName(Declaration decl){ return declName(decl, QUALIFIED, NameFlag.COMPANION); } /** * Gets the first type parameter from the type model representing a * {@code ceylon.language.Callable<Result, ParameterTypes...>}. * @param typeModel A {@code ceylon.language.Callable<Result, ParameterTypes...>}. * @return The result type of the {@code Callable}. */ ProducedType getReturnTypeOfCallable(ProducedType typeModel) { if (!isCeylonCallable(typeModel)) { throw new RuntimeException("Not a Callable<>: " + typeModel); } return typeModel.getTypeArgumentList().get(0); } /** * <p>Gets the type of the given functional * (ignoring parameter types) according to * the functionals parameter lists. The result is always a * {@code Callable} of some kind (because Functionals always have * at least one parameter list).</p> * * <p>For example:</p> * <table> * <tbody> * <tr><th>functional</th><th>functionalType(functional)</th></tr> * <tr><td><code>String m()</code></td><td><code>Callable&lt;String&gt;</code></td></tr> * <tr><td><code>String m()()</code></td><td><code>Callable&lt;Callable&lt;String&gt;&gt;</code></td></tr> * </tbody> * </table> */ ProducedType functionalType(Functional model) { return typeFact().getCallableType(functionalReturnType(model)); } /** * <p>Gets the return type of the given functional (ignoring parameter * types) according to the functionals parameter lists. If the functional * has multiple parameter lists the return type will be a * {@code Callable}.</p> * * <p>For example:</p> * <table> * <tbody> * <tr><th>functional</th><th>functionalReturnType(functional)</th></tr> * <tr><td><code>String m()</code></td><td><code>String</code></td></tr> * <tr><td><code>String m()()</code></td><td><code>Callable&lt;String&gt;</code></td></tr> * </tbody> * </table> */ ProducedType functionalReturnType(Functional model) { ProducedType callableType = model.getType(); for (int ii = 1; ii < model.getParameterLists().size(); ii++) { callableType = typeFact().getCallableType(callableType); } return callableType; } /** * Return the upper bound of any type parameter, instead of the type * parameter itself */ static final int TP_TO_BOUND = 1<<0; /** * Return the type of the sequenced parameter (T[]) rather than its element type (T) */ static final int TP_SEQUENCED_TYPE = 1<<1; ProducedType getTypeForParameter(Parameter parameter, ProducedReference producedReference, int flags) { if (parameter instanceof FunctionalParameter) { return getTypeForFunctionalParameter((FunctionalParameter)parameter); } if (producedReference == null) { return parameter.getType(); } final ProducedTypedReference producedTypedReference = producedReference.getTypedParameter(parameter); final ProducedType type = producedTypedReference.getType(); final TypedDeclaration producedParameterDecl = producedTypedReference.getDeclaration(); final ProducedType declType = producedParameterDecl.getType(); final TypeDeclaration declTypeDecl = declType.getDeclaration(); if(isJavaVariadic(parameter) && (flags & TP_SEQUENCED_TYPE) == 0){ // type of param must be Iterable<T> ProducedType elementType = typeFact.getIteratedType(type); if(elementType == null){ log.error("ceylon", "Invalid type for Java variadic parameter: "+type.getProducedTypeQualifiedName()); return type; } return elementType; } if (type.getDeclaration() instanceof ClassOrInterface) { // Explicit type parameter return producedTypedReference.getType(); } else if (declTypeDecl instanceof ClassOrInterface) { return declType; } else if ((declTypeDecl instanceof TypeParameter) && (flags & TP_TO_BOUND) != 0) { if (!declTypeDecl.getSatisfiedTypes().isEmpty()) { // use upper bound return declTypeDecl.getSatisfiedTypes().get(0); } } return type; } private boolean isJavaVariadic(Parameter parameter) { return parameter.isSequenced() && parameter.getContainer() instanceof Method && isJavaMethod((Method) parameter.getContainer()); } boolean isJavaMethod(Method method) { ClassOrInterface container = Decl.getClassOrInterfaceContainer(method); return container != null && !Decl.isCeylon(container); } boolean isJavaCtor(Class cls) { return !Decl.isCeylon(cls); } private ProducedType getTypeForFunctionalParameter(FunctionalParameter fp) { java.util.List<ProducedType> typeArgs = new ArrayList<ProducedType>(fp.getTypeParameters().size()); typeArgs.add(fp.getType()); for (Parameter parameter : fp.getParameterLists().get(0).getParameters()) { typeArgs.add(parameter.getType()); } return typeFact().getCallableType(typeArgs); } /* * Annotation generation */ List<JCAnnotation> makeAtOverride() { return List.<JCAnnotation> of(make().Annotation(makeIdent(syms().overrideType), List.<JCExpression> nil())); } boolean checkCompilerAnnotations(Tree.Declaration decl){ boolean old = gen().disableModelAnnotations; if(CodegenUtil.hasCompilerAnnotation(decl, "nomodel")) gen().disableModelAnnotations = true; return old; } void resetCompilerAnnotations(boolean value){ gen().disableModelAnnotations = value; } private List<JCAnnotation> makeModelAnnotation(Type annotationType, List<JCExpression> annotationArgs) { if (gen().disableModelAnnotations) return List.nil(); return List.of(make().Annotation(makeIdent(annotationType), annotationArgs)); } private List<JCAnnotation> makeModelAnnotation(Type annotationType) { return makeModelAnnotation(annotationType, List.<JCExpression>nil()); } List<JCAnnotation> makeAtCeylon() { JCExpression majorAttribute = make().Assign(makeUnquotedIdent("major"), make().Literal(BINARY_MAJOR_VERSION)); List<JCExpression> annotationArgs; if(BINARY_MINOR_VERSION != 0){ JCExpression minorAttribute = make().Assign(makeUnquotedIdent("minor"), make().Literal(BINARY_MINOR_VERSION)); annotationArgs = List.<JCExpression>of(majorAttribute, minorAttribute); }else{ // keep the minor implicit value of 0 to reduce bytecode size annotationArgs = List.<JCExpression>of(majorAttribute); } return makeModelAnnotation(syms().ceylonAtCeylonType, annotationArgs); } List<JCAnnotation> makeAtModule(Module module) { String name = module.getNameAsString(); String version = module.getVersion(); String doc = module.getDoc(); String license = module.getLicense(); ListBuffer<JCExpression> authors = new ListBuffer<JCTree.JCExpression>(); for(String author : module.getAuthors()){ authors.add(make().Literal(author)); } ListBuffer<JCExpression> imports = new ListBuffer<JCTree.JCExpression>(); for(ModuleImport dependency : module.getImports()){ Module dependencyModule = dependency.getModule(); // do not include the implicit java module as a dependency if(dependencyModule.getNameAsString().equals(AbstractModelLoader.JDK_MODULE) // nor ceylon.language || dependencyModule.getNameAsString().equals("ceylon.language")) continue; JCExpression dependencyName = make().Assign(makeUnquotedIdent("name"), make().Literal(dependencyModule.getNameAsString())); JCExpression dependencyVersion = null; if(dependencyModule.getVersion() != null) dependencyVersion = make().Assign(makeUnquotedIdent("version"), make().Literal(dependencyModule.getVersion())); List<JCExpression> spec; if(dependencyVersion != null) spec = List.<JCExpression>of(dependencyName, dependencyVersion); else spec = List.<JCExpression>of(dependencyName); JCAnnotation atImport = make().Annotation(makeIdent(syms().ceylonAtImportType), spec); // TODO : add the export & optional annotations also ? imports.add(atImport); } JCExpression nameAttribute = make().Assign(makeUnquotedIdent("name"), make().Literal(name)); JCExpression versionAttribute = make().Assign(makeUnquotedIdent("version"), make().Literal(version)); JCExpression byAttribute = make().Assign(makeUnquotedIdent("by"), make().NewArray(null, null, authors.toList())); JCExpression importAttribute = make().Assign(makeUnquotedIdent("dependencies"), make().NewArray(null, null, imports.toList())); List<JCExpression> annotationArgs = List.<JCExpression>of(nameAttribute, versionAttribute, byAttribute, importAttribute); if( doc != null ) { JCExpression docAttribute = make().Assign(makeUnquotedIdent("doc"), make().Literal(doc)); annotationArgs = annotationArgs.append(docAttribute); } if( license != null ) { JCExpression licenseAttribute = make().Assign(makeUnquotedIdent("license"), make().Literal(license)); annotationArgs = annotationArgs.append(licenseAttribute); } return makeModelAnnotation(syms().ceylonAtModuleType, annotationArgs); } List<JCAnnotation> makeAtPackage(Package pkg) { String name = pkg.getNameAsString(); boolean shared = pkg.isShared(); JCExpression nameAttribute = make().Assign(makeUnquotedIdent("name"), make().Literal(name)); JCExpression sharedAttribute = make().Assign(makeUnquotedIdent("shared"), makeBoolean(shared)); return makeModelAnnotation(syms().ceylonAtPackageType, List.<JCExpression>of(nameAttribute, sharedAttribute)); } List<JCAnnotation> makeAtName(String name) { return makeModelAnnotation(syms().ceylonAtNameType, List.<JCExpression>of(make().Literal(name))); } List<JCAnnotation> makeAtType(String name) { return makeModelAnnotation(syms().ceylonAtTypeInfoType, List.<JCExpression>of(make().Literal(name))); } final JCAnnotation makeAtTypeParameter(String name, java.util.List<ProducedType> satisfiedTypes, boolean covariant, boolean contravariant) { JCExpression nameAttribute = make().Assign(makeUnquotedIdent("value"), make().Literal(name)); // variance String variance = "NONE"; if(covariant) variance = "OUT"; else if(contravariant) variance = "IN"; JCExpression varianceAttribute = make().Assign(makeUnquotedIdent("variance"), make().Select(makeIdent(syms().ceylonVarianceType), names().fromString(variance))); // upper bounds ListBuffer<JCExpression> upperBounds = new ListBuffer<JCTree.JCExpression>(); for(ProducedType satisfiedType : satisfiedTypes){ String type = serialiseTypeSignature(satisfiedType); upperBounds.append(make().Literal(type)); } JCExpression satisfiesAttribute = make().Assign(makeUnquotedIdent("satisfies"), make().NewArray(null, null, upperBounds.toList())); // all done return make().Annotation(makeIdent(syms().ceylonAtTypeParameter), List.<JCExpression>of(nameAttribute, varianceAttribute, satisfiesAttribute)); } List<JCAnnotation> makeAtTypeParameters(List<JCExpression> typeParameters) { JCExpression value = make().NewArray(null, null, typeParameters); return makeModelAnnotation(syms().ceylonAtTypeParameters, List.of(value)); } List<JCAnnotation> makeAtSequenced() { return makeModelAnnotation(syms().ceylonAtSequencedType); } List<JCAnnotation> makeAtDefaulted() { return makeModelAnnotation(syms().ceylonAtDefaultedType); } List<JCAnnotation> makeAtAttribute() { return makeModelAnnotation(syms().ceylonAtAttributeType); } List<JCAnnotation> makeAtMethod() { return makeModelAnnotation(syms().ceylonAtMethodType); } List<JCAnnotation> makeAtObject() { return makeModelAnnotation(syms().ceylonAtObjectType); } List<JCAnnotation> makeAtClass(ProducedType extendedType) { List<JCExpression> attributes = List.nil(); if(!extendedType.isExactly(typeFact.getIdentifiableObjectDeclaration().getType())){ JCExpression extendsAttribute = make().Assign(makeUnquotedIdent("extendsType"), make().Literal(serialiseTypeSignature(extendedType))); attributes = attributes.prepend(extendsAttribute); } return makeModelAnnotation(syms().ceylonAtClassType, attributes); } List<JCAnnotation> makeAtSatisfiedTypes(java.util.List<ProducedType> satisfiedTypes) { return makeTypesListAnnotation(syms().ceylonAtSatisfiedTypes, satisfiedTypes); } List<JCAnnotation> makeAtCaseTypes(java.util.List<ProducedType> caseTypes) { return makeTypesListAnnotation(syms().ceylonAtCaseTypes, caseTypes); } private List<JCAnnotation> makeTypesListAnnotation(Type annotationType, java.util.List<ProducedType> types) { if(types.isEmpty()) return List.nil(); ListBuffer<JCExpression> upperBounds = new ListBuffer<JCTree.JCExpression>(); for(ProducedType type : types){ String typeSig = serialiseTypeSignature(type); upperBounds.append(make().Literal(typeSig)); } JCExpression caseAttribute = make().Assign(makeUnquotedIdent("value"), make().NewArray(null, null, upperBounds.toList())); return makeModelAnnotation(annotationType, List.of(caseAttribute)); } List<JCAnnotation> makeAtCaseTypes(ProducedType ofType) { if(ofType == null) return List.nil(); String typeSig = serialiseTypeSignature(ofType); JCExpression caseAttribute = make().Assign(makeUnquotedIdent("of"), make().Literal(typeSig)); return makeModelAnnotation(syms().ceylonAtCaseTypes, List.of(caseAttribute)); } List<JCAnnotation> makeAtIgnore() { return makeModelAnnotation(syms().ceylonAtIgnore); } List<JCAnnotation> makeAtAnnotations(java.util.List<Annotation> annotations) { if(annotations == null || annotations.isEmpty()) return List.nil(); ListBuffer<JCExpression> array = new ListBuffer<JCTree.JCExpression>(); for(Annotation annotation : annotations){ array.append(makeAtAnnotation(annotation)); } JCExpression annotationsAttribute = make().Assign(makeUnquotedIdent("value"), make().NewArray(null, null, array.toList())); return makeModelAnnotation(syms().ceylonAtAnnotationsType, List.of(annotationsAttribute)); } private JCExpression makeAtAnnotation(Annotation annotation) { JCExpression valueAttribute = make().Assign(makeUnquotedIdent("value"), make().Literal(annotation.getName())); List<JCExpression> attributes; if(!annotation.getPositionalArguments().isEmpty()){ java.util.List<String> positionalArguments = annotation.getPositionalArguments(); ListBuffer<JCExpression> array = new ListBuffer<JCTree.JCExpression>(); for(String val : positionalArguments) array.add(make().Literal(val)); JCExpression argumentsAttribute = make().Assign(makeUnquotedIdent("arguments"), make().NewArray(null, null, array.toList())); attributes = List.of(valueAttribute, argumentsAttribute); }else if(!annotation.getNamedArguments().isEmpty()){ Map<String, String> namedArguments = annotation.getNamedArguments(); ListBuffer<JCExpression> array = new ListBuffer<JCTree.JCExpression>(); for(Entry<String, String> entry : namedArguments.entrySet()){ JCExpression argNameAttribute = make().Assign(makeUnquotedIdent("name"), make().Literal(entry.getKey())); JCExpression argValueAttribute = make().Assign(makeUnquotedIdent("value"), make().Literal(entry.getValue())); JCAnnotation namedArg = make().Annotation(makeIdent(syms().ceylonAtNamedArgumentType), List.of(argNameAttribute, argValueAttribute)); array.add(namedArg); } JCExpression argumentsAttribute = make().Assign(makeUnquotedIdent("namedArguments"), make().NewArray(null, null, array.toList())); attributes = List.of(valueAttribute, argumentsAttribute); }else attributes = List.of(valueAttribute); return make().Annotation(makeIdent(syms().ceylonAtAnnotationType), attributes); } boolean needsAnnotations(Declaration decl) { Declaration reqdecl = decl; if (reqdecl instanceof Parameter) { Parameter p = (Parameter)reqdecl; reqdecl = p.getDeclaration(); } return reqdecl.isToplevel() || (reqdecl.isClassOrInterfaceMember() && reqdecl.isShared() && !Decl.isAncestorLocal(reqdecl)); } List<JCTree.JCAnnotation> makeJavaTypeAnnotations(TypedDeclaration decl) { if(decl == null || decl.getType() == null) return List.nil(); ProducedType type; if (decl instanceof FunctionalParameter) { type = getTypeForFunctionalParameter((FunctionalParameter)decl); } else { type = decl.getType(); } return makeJavaTypeAnnotations(type, needsAnnotations(decl)); } private List<JCTree.JCAnnotation> makeJavaTypeAnnotations(ProducedType type, boolean required) { if (!required) return List.nil(); // Add the original type to the annotations return makeAtType(serialiseTypeSignature(type)); } private String serialiseTypeSignature(ProducedType type){ if(isTypeParameter(type)) return type.getProducedTypeName(); return type.getProducedTypeQualifiedName(); } /* * Boxing */ public enum BoxingStrategy { UNBOXED, BOXED, INDIFFERENT; } public boolean canUnbox(ProducedType type){ // all the rest is boxed return isCeylonBasicType(type) || isJavaString(type); } JCExpression boxUnboxIfNecessary(JCExpression javaExpr, Tree.Term expr, ProducedType exprType, BoxingStrategy boxingStrategy) { boolean exprBoxed = !CodegenUtil.isUnBoxed(expr); return boxUnboxIfNecessary(javaExpr, exprBoxed, exprType, boxingStrategy); } JCExpression boxUnboxIfNecessary(JCExpression javaExpr, boolean exprBoxed, ProducedType exprType, BoxingStrategy boxingStrategy) { if(boxingStrategy == BoxingStrategy.INDIFFERENT) return javaExpr; boolean targetBoxed = boxingStrategy == BoxingStrategy.BOXED; // only box if the two differ if(targetBoxed == exprBoxed) return javaExpr; if (targetBoxed) { // box javaExpr = boxType(javaExpr, exprType); } else { // unbox javaExpr = unboxType(javaExpr, exprType); } return javaExpr; } boolean isTypeParameter(ProducedType type) { if (typeFact().isOptionalType(type)) { type = type.minus(typeFact().getNothingDeclaration()); } return type.getDeclaration() instanceof TypeParameter; } JCExpression unboxType(JCExpression expr, ProducedType targetType) { if (isCeylonInteger(targetType)) { expr = unboxInteger(expr); } else if (isCeylonFloat(targetType)) { expr = unboxFloat(expr); } else if (isCeylonString(targetType)) { expr = unboxString(expr); } else if (isCeylonCharacter(targetType)) { boolean isJavaCharacter = targetType.getUnderlyingType() != null; expr = unboxCharacter(expr, isJavaCharacter); } else if (isCeylonBoolean(targetType)) { expr = unboxBoolean(expr); } else if (isCeylonArray(targetType)) { expr = unboxArray(expr); } else if (isOptional(targetType)) { targetType = typeFact().getDefiniteType(targetType); if (isCeylonString(targetType)){ expr = unboxOptionalString(expr); } } return expr; } JCExpression boxType(JCExpression expr, ProducedType exprType) { if (isCeylonInteger(exprType)) { expr = boxInteger(expr); } else if (isCeylonFloat(exprType)) { expr = boxFloat(expr); } else if (isCeylonString(exprType)) { expr = boxString(expr); } else if (isCeylonCharacter(exprType)) { expr = boxCharacter(expr); } else if (isCeylonBoolean(exprType)) { expr = boxBoolean(expr); } else if (isCeylonArray(exprType)) { expr = boxArray(expr); } else if (isVoid(exprType)) { expr = make().LetExpr(List.<JCStatement>of(make().Exec(expr)), makeNull()); } return expr; } private JCTree.JCMethodInvocation boxInteger(JCExpression value) { return makeBoxType(value, syms().ceylonIntegerType); } private JCTree.JCMethodInvocation boxFloat(JCExpression value) { return makeBoxType(value, syms().ceylonFloatType); } private JCTree.JCMethodInvocation boxString(JCExpression value) { return makeBoxType(value, syms().ceylonStringType); } private JCTree.JCMethodInvocation boxCharacter(JCExpression value) { return makeBoxType(value, syms().ceylonCharacterType); } private JCTree.JCMethodInvocation boxBoolean(JCExpression value) { return makeBoxType(value, syms().ceylonBooleanType); } private JCTree.JCMethodInvocation boxArray(JCExpression value) { return makeBoxType(value, syms().ceylonArrayType); } private JCTree.JCMethodInvocation makeBoxType(JCExpression value, Type type) { return make().Apply(null, makeSelect(makeIdent(type), "instance"), List.<JCExpression>of(value)); } private JCTree.JCMethodInvocation unboxInteger(JCExpression value) { return makeUnboxType(value, "longValue"); } private JCTree.JCMethodInvocation unboxFloat(JCExpression value) { return makeUnboxType(value, "doubleValue"); } private JCExpression unboxString(JCExpression value) { if (isStringLiteral(value)) { // If it's already a String literal, why call .toString on it? return value; } return makeUnboxType(value, "toString"); } private boolean isStringLiteral(JCExpression value) { return value instanceof JCLiteral && ((JCLiteral)value).value instanceof String; } private JCExpression unboxOptionalString(JCExpression value){ if (isStringLiteral(value)) { // If it's already a String literal, why call .toString on it? return value; } String name = tempName(); JCExpression type = makeJavaType(typeFact().getStringDeclaration().getType(), JT_NO_PRIMITIVES); JCExpression expr = make().Conditional(make().Binary(JCTree.NE, makeUnquotedIdent(name), makeNull()), unboxString(makeUnquotedIdent(name)), makeNull()); return makeLetExpr(name, null, type, value, expr); } private JCTree.JCMethodInvocation unboxCharacter(JCExpression value, boolean isJava) { return makeUnboxType(value, isJava ? "charValue" : "intValue"); } private JCTree.JCMethodInvocation unboxBoolean(JCExpression value) { return makeUnboxType(value, "booleanValue"); } private JCTree.JCMethodInvocation unboxArray(JCExpression value) { return makeUnboxType(value, "toArray"); } private JCTree.JCMethodInvocation makeUnboxType(JCExpression value, String unboxMethodName) { return make().Apply(null, makeSelect(value, unboxMethodName), List.<JCExpression>nil()); } /* * Sequences */ /** * Returns a JCExpression along the lines of * {@code new ArraySequence<seqElemType>(list...)} * @param elems The elements in the sequence * @param seqElemType The sequence type parameter * @param makeJavaTypeOpts The option flags to pass to makeJavaType(). * @return a JCExpression * @see #makeSequenceRaw(java.util.List) */ private JCExpression makeSequence(List<JCExpression> elems, ProducedType seqElemType, int makeJavaTypeOpts) { ProducedType seqType = typeFact().getDefaultSequenceType(seqElemType); JCExpression typeExpr = makeJavaType(seqType, makeJavaTypeOpts); return makeNewClass(typeExpr, elems); } /** * Returns a JCExpression along the lines of * {@code new ArraySequence<seqElemType>(list...)} * @param list The elements in the sequence * @param seqElemType The sequence type parameter * @return a JCExpression * @see #makeSequenceRaw(java.util.List) */ JCExpression makeSequence(java.util.List<Expression> list, ProducedType seqElemType) { ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>(); for (Expression expr : list) { // no need for erasure casts here elems.append(expressionGen().transformExpression(expr)); } return makeSequence(elems.toList(), seqElemType,CeylonTransformer.JT_TYPE_ARGUMENT); } /** * Returns a JCExpression along the lines of * {@code new ArraySequence(list...)} * @param list The elements in the sequence * @return a JCExpression * @see #makeSequence(java.util.List, ProducedType) */ JCExpression makeSequenceRaw(java.util.List<Expression> list) { ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>(); for (Expression expr : list) { // no need for erasure casts here elems.append(expressionGen().transformExpression(expr)); } return makeSequenceRaw(elems.toList()); } JCExpression makeSequenceRaw(List<JCExpression> elems) { return makeSequence(elems, typeFact().getObjectDeclaration().getType(), CeylonTransformer.JT_RAW); } JCExpression makeEmpty() { return make().Apply( List.<JCTree.JCExpression>nil(), makeFQIdent("ceylon", "language", "$empty", Util.getGetterName("$empty")), List.<JCTree.JCExpression>nil()); } JCExpression makeFinished() { return make().Apply( List.<JCTree.JCExpression>nil(), makeFQIdent("ceylon", "language", "exhausted", Util.getGetterName("exhausted")), List.<JCTree.JCExpression>nil()); } /** * Turns a sequence into a Java array * @param expr the sequence * @param sequenceType the sequence type * @param boxingStrategy the boxing strategy for expr * @param exprType */ JCExpression sequenceToJavaArray(JCExpression expr, ProducedType sequenceType, BoxingStrategy boxingStrategy, ProducedType exprType) { String methodName = null; // find the sequence element type ProducedType type = typeFact().getIteratedType(sequenceType); if(boxingStrategy == BoxingStrategy.UNBOXED){ if(isCeylonInteger(type)){ if("byte".equals(type.getUnderlyingType())) methodName = "toByteArray"; else if("short".equals(type.getUnderlyingType())) methodName = "toShortArray"; else if("int".equals(type.getUnderlyingType())) methodName = "toIntArray"; else methodName = "toLongArray"; }else if(isCeylonFloat(type)){ if("float".equals(type.getUnderlyingType())) methodName = "toFloatArray"; else methodName = "toDoubleArray"; } else if (isCeylonCharacter(type)) { if ("char".equals(type.getUnderlyingType())) methodName = "toCharArray"; // else it must be boxed, right? } else if (isCeylonBoolean(type)) { methodName = "toBooleanArray"; } else if (isJavaString(type)) { methodName = "toJavaStringArray"; } else if (isCeylonString(type)) { return objectVariadicToJavaArray(type, sequenceType, expr, exprType); } if(methodName == null){ log.error("ceylon", "Don't know how to convert sequences of type "+type+" to Java array (This is a compiler bug)"); return expr; } return makeUtilInvocation(methodName, List.of(expr), null); }else{ return objectVariadicToJavaArray(type, sequenceType, expr, exprType); } } private JCExpression objectVariadicToJavaArray(ProducedType type, ProducedType sequenceType, JCExpression expr, ProducedType exprType) { if(typeFact().getFixedSizedType(exprType) != null){ return objectFixedSizedToJavaArray(type, expr); } return objectIterableToJavaArray(type, typeFact().getIterableType(sequenceType), expr); } private JCExpression objectIterableToJavaArray(ProducedType type, ProducedType iterableType, JCExpression expr) { JCExpression klass = makeJavaType(type, AbstractTransformer.JT_CLASS_NEW | AbstractTransformer.JT_NO_PRIMITIVES); JCExpression klassLiteral = make().Select(klass, names.fromString("class")); return makeUtilInvocation("toArray", List.of(expr, klassLiteral), null); } private JCExpression objectFixedSizedToJavaArray(ProducedType type, JCExpression expr) { JCExpression klass1 = makeJavaType(type, AbstractTransformer.JT_CLASS_NEW | AbstractTransformer.JT_NO_PRIMITIVES); JCExpression klass2 = makeJavaType(type, AbstractTransformer.JT_CLASS_NEW | AbstractTransformer.JT_NO_PRIMITIVES); String baseName = tempName(); String seqName = baseName +"$0"; ProducedType fixedSizedType = typeFact().getFixedSizedDeclaration().getProducedType(null, Arrays.asList(type)); JCExpression seqTypeExpr1 = makeJavaType(fixedSizedType); JCExpression seqTypeExpr2 = makeJavaType(fixedSizedType); JCExpression sizeExpr = make().Apply(List.<JCExpression>nil(), make().Select(makeUnquotedIdent(seqName), names().fromString("getSize")), List.<JCExpression>nil()); sizeExpr = make().TypeCast(syms().intType, sizeExpr); JCExpression newArrayExpr = make().NewArray(klass1, List.of(sizeExpr), null); JCExpression sequenceToArrayExpr = makeUtilInvocation("toArray", List.of(makeUnquotedIdent(seqName), newArrayExpr), List.of(klass2)); // since T[] is erased to Iterable<T> we probably need a cast to FixedSized<T> JCExpression castedExpr = make().TypeCast(seqTypeExpr2, expr); return makeLetExpr(seqName, List.<JCStatement>nil(), seqTypeExpr1, castedExpr, sequenceToArrayExpr); } /* * Variable name substitution */ @SuppressWarnings("serial") protected static class VarMapper extends HashMap<String, String> { } private Map<String, String> getVarMapper() { VarMapper map = context.get(VarMapper.class); if (map == null) { map = new VarMapper(); context.put(VarMapper.class, map); } return map; } String addVariableSubst(String origVarName, String substVarName) { return getVarMapper().put(origVarName, substVarName); } void removeVariableSubst(String origVarName, String prevSubst) { if (prevSubst != null) { getVarMapper().put(origVarName, prevSubst); } else { getVarMapper().remove(origVarName); } } /* * Checks a global map of variable name substitutions and returns * either the original name if none was found or the substitute. */ String substitute(String varName) { if (getVarMapper().containsKey(varName)) { return getVarMapper().get(varName); } else { return varName; } } // Creates comparisons of expressions against types JCExpression makeTypeTest(JCExpression firstTimeExpr, String varName, ProducedType type) { JCExpression result = null; if (typeFact().isUnion(type)) { UnionType union = (UnionType)type.getDeclaration(); for (ProducedType pt : union.getCaseTypes()) { JCExpression partExpr = makeTypeTest(firstTimeExpr, varName, pt); firstTimeExpr = null; if (result == null) { result = partExpr; } else { result = make().Binary(JCTree.OR, result, partExpr); } } } else if (typeFact().isIntersection(type)) { IntersectionType union = (IntersectionType)type.getDeclaration(); for (ProducedType pt : union.getSatisfiedTypes()) { JCExpression partExpr = makeTypeTest(firstTimeExpr, varName, pt); firstTimeExpr = null; if (result == null) { result = partExpr; } else { result = make().Binary(JCTree.AND, result, partExpr); } } } else { JCExpression varExpr = firstTimeExpr != null ? firstTimeExpr : makeUnquotedIdent(varName); if (isVoid(type)){ // everything is Void, it's the root of the hierarchy return makeIgnoredEvalAndReturn(varExpr, makeBoolean(true)); } else if (type.isExactly(typeFact().getNothingDeclaration().getType())){ // is Nothing => is null return make().Binary(JCTree.EQ, varExpr, makeNull()); } else if (type.isExactly(typeFact().getObjectDeclaration().getType())){ // is Object => is not null return make().Binary(JCTree.NE, varExpr, makeNull()); } else if (type.isExactly(typeFact().getIdentifiableDeclaration().getType())){ // it's erased return makeUtilInvocation("isIdentifiable", List.of(varExpr), null); } else if (type.isExactly(typeFact().getIdentifiableObjectDeclaration().getType())){ // it's erased return makeUtilInvocation("isIdentifiableObject", List.of(varExpr), null); } else if (type.getDeclaration() instanceof BottomType){ // nothing is Bottom return makeIgnoredEvalAndReturn(varExpr, makeBoolean(false)); } else { JCExpression rawTypeExpr = makeJavaType(type, JT_NO_PRIMITIVES | JT_RAW); result = make().TypeTest(varExpr, rawTypeExpr); } } return result; } JCExpression makeNonEmptyTest(JCExpression firstTimeExpr, String varName) { Interface fixedSize = typeFact().getFixedSizedDeclaration(); JCExpression test = makeTypeTest(firstTimeExpr, varName, fixedSize.getType()); JCExpression fixedSizeType = makeJavaType(fixedSize.getType(), JT_NO_PRIMITIVES | JT_RAW); JCExpression nonEmpty = makeNonEmptyTest(make().TypeCast(fixedSizeType, makeUnquotedIdent(varName))); return make().Binary(JCTree.AND, test, nonEmpty); } JCExpression makeNonEmptyTest(JCExpression expr){ JCExpression getEmptyCall = make().Select(expr, names().fromString("getEmpty")); JCExpression empty = make().Apply(List.<JCExpression>nil(), getEmptyCall, List.<JCExpression>nil()); return make().Unary(JCTree.NOT, empty); } /** * Invokes a static method of the Util helper class * @param methodName name of the method * @param params parameters * @return the invocation AST */ public JCExpression makeUtilInvocation(String methodName, List<JCExpression> params, List<JCExpression> typeParams) { return make().Apply(typeParams, make().Select(make().QualIdent(syms().ceylonUtilType.tsym), names().fromString(methodName)), params); } private LetExpr makeIgnoredEvalAndReturn(JCExpression toEval, JCExpression toReturn){ // define a variable of type j.l.Object to hold the result of the evaluation JCVariableDecl def = makeVar(tempName(), make().Type(syms().objectType), toEval); // then ignore this result and return something else return make().LetExpr(def, toReturn); } JCExpression makeErroneous() { return makeErroneous(null); } /** * Makes an 'erroneous' AST node with no message */ JCExpression makeErroneous(Node node) { return makeErroneous(node, null, List.<JCTree>nil()); } /** * Makes an 'erroneous' AST node with a message to be logged as an error */ JCExpression makeErroneous(Node node, String message) { return makeErroneous(node, message, List.<JCTree>nil()); } /** * Makes an 'erroneous' AST node with a message to be logged as an error */ JCExpression makeErroneous(Node node, String message, List<? extends JCTree> errs) { if (node != null) { at(node); } if (message != null) { if (node != null) { log.error(getPosition(node), "ceylon", message); } else { log.error("ceylon", message); } } return make().Erroneous(errs); } private JCTypeParameter makeTypeParameter(String name, java.util.List<ProducedType> satisfiedTypes, boolean covariant, boolean contravariant) { ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>(); for (ProducedType t : satisfiedTypes) { if (!willEraseToObject(t)) { bounds.append(makeJavaType(t, AbstractTransformer.JT_NO_PRIMITIVES)); } } return make().TypeParameter(names().fromString(name), bounds.toList()); } JCTypeParameter makeTypeParameter(TypeParameter declarationModel) { TypeParameter typeParameterForBounds = declarationModel; // special case for method refinenement where Java doesn't let us refine the parameter bounds if(declarationModel.getContainer() instanceof Method){ Method method = (Method) declarationModel.getContainer(); Method refinedMethod = (Method) method.getRefinedDeclaration(); if(method != refinedMethod){ // find the param index int index = method.getTypeParameters().indexOf(declarationModel); if(index == -1){ log.error("Failed to find type parameter index: "+declarationModel.getName()); }else if(refinedMethod.getTypeParameters().size() > index){ // ignore smaller index than size since the typechecker would have found the error TypeParameter refinedTP = refinedMethod.getTypeParameters().get(index); if(!haveSameBounds(declarationModel, refinedTP)){ typeParameterForBounds = refinedTP; } } } } return makeTypeParameter(declarationModel.getName(), typeParameterForBounds.getSatisfiedTypes(), typeParameterForBounds.isCovariant(), typeParameterForBounds.isContravariant()); } JCTypeParameter makeTypeParameter(Tree.TypeParameterDeclaration param) { at(param); return makeTypeParameter(param.getDeclarationModel()); } JCAnnotation makeAtTypeParameter(TypeParameter declarationModel) { return makeAtTypeParameter(declarationModel.getName(), declarationModel.getSatisfiedTypes(), declarationModel.isCovariant(), declarationModel.isContravariant()); } JCAnnotation makeAtTypeParameter(Tree.TypeParameterDeclaration param) { at(param); return makeAtTypeParameter(param.getDeclarationModel()); } final List<JCExpression> typeArguments(Tree.AnyMethod method) { return typeArguments(method.getDeclarationModel()); } final List<JCExpression> typeArguments(Tree.AnyClass type) { return typeArguments(type); } final List<JCExpression> typeArguments(Functional method) { return typeArguments(method.getTypeParameters(), method.getType().getTypeArguments()); } final List<JCExpression> typeArguments(Tree.ClassOrInterface type) { return typeArguments(type.getDeclarationModel().getTypeParameters(), type.getDeclarationModel().getType().getTypeArguments()); } final List<JCExpression> typeArguments(java.util.List<TypeParameter> typeParameters, Map<TypeParameter, ProducedType> typeArguments) { ListBuffer<JCExpression> typeArgs = ListBuffer.<JCExpression>lb(); for (TypeParameter tp : typeParameters) { ProducedType type = typeArguments.get(tp); if (type != null) { typeArgs.append(makeJavaType(type, JT_TYPE_ARGUMENT)); } else { typeArgs.append(makeJavaType(tp.getType(), JT_TYPE_ARGUMENT)); } } return typeArgs.toList(); } /** * Returns the name of the field in classes which holds the companion * instance. */ final String getCompanionFieldName(Interface def) { return "$" + CodegenUtil.getCompanionClassName(def.getName()); } /** * Returns the name of the method in interfaces and classes used to get * the companion instance. */ final String getCompanionAccessorName(Interface def) { return getCompanionClassName(def).replace('.', '$'); } final JCExpression makeDefaultedParamMethodIdent(Method method, Parameter param) { Interface iface = (Interface)method.getRefinedDeclaration().getContainer(); return makeQuotedQualIdent(makeQuotedIdent(getCompanionFieldName(iface)), CodegenUtil.getDefaultedParamMethodName(method, param)); } private int getPosition(Node node) { int pos = getMap().getStartPosition(node.getToken().getLine()) + node.getToken().getCharPositionInLine(); log.useSource(gen().getFileObject()); return pos; } /** * Returns a copy of the given annotations, unless {@code @Ignore} is present, * in which case returns a singleton containing {@code @Ignore}. */ List<JCAnnotation> filterAnnotations( ListBuffer<JCAnnotation> annotations) { ListBuffer<JCAnnotation> lb = ListBuffer.<JCAnnotation>lb(); for (JCAnnotation anno : annotations) { JCTree type = anno.getAnnotationType(); if (type instanceof JCFieldAccess && ((JCFieldAccess)type).sym != null && ((JCFieldAccess)type).sym.type == syms().ceylonAtIgnore) { lb.clear(); lb.add(anno); break; } lb.add(anno); } return lb.toList(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8fb3d801a6f37d5a21d5b5408a10a019ccdd5690
034811df9cd663cb1457c6408a21f99ae5a5bf4e
/ODAccountBookWeb/src/main/java/org/dongchimi/odong/accountbook/web/util/NumberUtil.java
a40bfd1263cc5907b0982e79273593a7a3f56404
[]
no_license
dongchimi/odaccountbook
1a0653b7c25a4f5e4eff5c0de742290aefe75451
2638506449ebce65f8b32ddbdcd73e299d4c8f3a
refs/heads/master
2020-05-30T09:18:50.176353
2015-08-09T06:46:12
2015-08-09T06:46:12
40,129,353
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package org.dongchimi.odong.accountbook.web.util; public class NumberUtil { public static int parseInt(String obj) { int i = 0; try { i = Integer.valueOf(obj); } catch (NumberFormatException e) { } return i; } }
[ "dongchimi@gmail.com" ]
dongchimi@gmail.com
c9d2a4d87e01a622dd2184b545d1a88d516a623d
aab787acf007b1d47d4a4b2db9d2a5209f6e17c9
/src/main/java/org/personal/mason/fl/service/JWTAuthenticationToken.java
94f87083a62d9b563f2b9266fbaf5d387463d48c
[]
no_license
masonmei/food-logistics
40ff9ec7edc8a7a84071bc2f5688ee0f4c6dad38
c517b000cb902fd1b00757466efad2cbcd26c6b7
refs/heads/master
2020-04-04T19:07:16.205187
2014-08-15T13:52:19
2014-08-15T13:52:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package org.personal.mason.fl.service; import java.util.Collection; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.GrantedAuthority; public class JWTAuthenticationToken extends AbstractAuthenticationToken { /** * */ private static final long serialVersionUID = 8448535416518984499L; private final Object principal = null; private Object details; public JWTAuthenticationToken(Collection<? extends GrantedAuthority> authorities) { super(authorities); super.setAuthenticated(true); // this.principal = par; // this.set } @Override public Object getCredentials() { // TODO Auto-generated method stub return null; } @Override public Object getPrincipal() { // TODO Auto-generated method stub return null; } }
[ "dongxu.m@gmail.com" ]
dongxu.m@gmail.com
856f0e23c9100f1ca4a90df685e31906b897cc40
814a296b2e784ec5fc4b55a41ac2172e3135e738
/Neon_Number.java
7aa2c0f166c2d7a3d9c05c207cc617bb74888182
[]
no_license
100DaysJava/Week4
d888809a22fd08cbfc8557438c58978c0f6b6065
cdf15ddb632fc1d13a135eb31c77117c50d5b7d7
refs/heads/master
2022-12-24T07:57:37.746010
2020-09-25T17:28:53
2020-09-25T17:28:53
294,750,698
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
package Prgs6; import java.util.*; public class Neon_Number { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("enter number :"); int n = sc.nextInt(); // n = 9 int sq = n*n; // sq = 9*9 = 81 int sum =0; while(sq > 0 ) // 8 >0 { int rem = sq%10; // rem = 8%10 = 8 sum = sum + rem ; // sum = 1+ 8 = 9 sq = sq/10; // sq = 8/10 = 0 } if (sum == n) System.out.println("Neon Number"); else System.out.println("Not Neon Number"); } }
[ "noreply@github.com" ]
100DaysJava.noreply@github.com
9fd2aafba120ee02cde754db7a46b2e926ad12c0
bfa553efcee85ba0566a8e55ab10238c1c66a86e
/src/main/java/invoice/RideRepository.java
05d0f46a95faf1d07c96d6ddce322cdb7e7e8fc2
[]
no_license
jitendra0435/CabInvoiceGenerator
cb1782a1a09e5bb58c9d11aa8f036ed5c0dc166a
4f5a8dd8289531cdb9b552942815b377a57bb351
refs/heads/master
2020-11-24T22:18:39.758232
2019-12-17T05:40:13
2019-12-17T05:40:13
228,362,376
0
0
null
null
null
null
UTF-8
Java
false
false
530
java
package invoice; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class RideRepository { private Map<String, ArrayList<Ride>> userRides=null; public RideRepository() { this.userRides=new HashMap<>(); } public void addRides(String userId, Ride[] rides){ this.userRides.put(userId,new ArrayList<>(Arrays.asList(rides))); } public Ride[] getRide(String userId){ return this.userRides.get(userId).toArray(new Ride[0]); } }
[ "jitendrabachhav0435@gmail.com" ]
jitendrabachhav0435@gmail.com
f0cb255fc30b93871b6d04ceec1ee1806de5833c
aa3bac4d7fdc70ef9825416a2c846e178541935f
/src/zadaci_20_02_2016/Rational.java
4e3dd0d4246abdfcab2dc1e145d49e9235074ca3
[]
no_license
DejanMladjenovic/BILD-IT-Zadaci
0763b0813379a93e28211b72b6d52d0717707830
ecc4cdb6fae636d8b6fbc3c7608e71859c3c8b2a
refs/heads/master
2021-01-10T17:59:25.195449
2016-03-05T19:27:18
2016-03-05T19:27:18
49,815,399
1
0
null
null
null
null
UTF-8
Java
false
false
3,525
java
package zadaci_20_02_2016; /** * Naziv klase: Rational * * @author Dejan Mladjenovic */ public class Rational extends Number implements Comparable<Rational> { /* * Rewrite the Rational class in Listing 13.13 using a new internal representation * for the numerator and denominator. Create an array of two integers as follows: * private long[] r = new long[2]; * Use r[0] to represent the numerator and r[1] to represent the denominator. * The signatures of the methods in the Rational class are not changed, so a client * application that uses the previous Rational class can continue to use this new * Rational class without being recompiled. */ //Osobine private long[] r = new long[2]; //Konstruktor bez argumenata public Rational(){ this.r[0] = 0; this.r[1] = 1; } //Konstruktor sa odredjenim vrijednostima public Rational(long numerator, long denominator){ long gcd = gcd(numerator, denominator); this.r[0] = ((denominator > 0) ? 1 : -1) * numerator / gcd; this.r[1] = Math.abs(denominator) / gcd; } /**Vraca najveci zajednicki djelilac za dva broja*/ public static long gcd(long n, long d){ long n1 = Math.abs(n); long n2 = Math.abs(d); int gcd = 1; for (int k = 1; k <= n1 && k <= n2; k++){ if (n1 % k == 0 && n2 % k == 0) { gcd = k; } } return gcd; } /**Vraca numerator*/ public long getNumerator(){ return r[0]; } /**Vraca denominator*/ public long getDenominator(){ return r[1]; } /**Vraca zbir dva objekta*/ public Rational add(Rational secondRational){ long n = r[0] * secondRational.getDenominator() + r[1] * secondRational.getNumerator(); long d = r[1] * secondRational.getDenominator(); return new Rational(n, d); } /**Vraca razliku dva objekta*/ public Rational subtract(Rational secondRational){ long n = r[0] * secondRational.getDenominator() - r[1] * secondRational.getNumerator(); long d = r[1] * secondRational.getDenominator(); return new Rational(n, d); } /**vraca proizvod dva objekta*/ public Rational multiply(Rational secondRational){ long n = r[0] * secondRational.getNumerator(); long d = r[1] * secondRational.getDenominator(); return new Rational(n, d); } /**Vracda kolicnik dva objekta*/ public Rational divide(Rational secondRational){ long n = r[0] * secondRational.getDenominator(); long d = r[1] * secondRational.getNumerator(); return new Rational(n, d); } /**Vraca ispis objekta*/ @Override public String toString(){ if(r[1] == 1) return r[0] + ""; else return r[0] + "/" + r[1]; } /**Provjerava jednakost dva objekta*/ @Override public boolean equals(Object other){ if((this.subtract((Rational) (other))).getNumerator() == 0) return true; return false; } /**Vraca double vrijednost broja*/ @Override public double doubleValue(){ return r[0] * 1.0 / r[1]; } /**Vraca int vrijednost broja*/ @Override public int intValue(){ return (int)doubleValue(); } /**Vraca float vrijednost broja*/ @Override public float floatValue(){ return (float)doubleValue(); } /**Vraca long vrijednost broja*/ @Override public long longValue() { return (long) doubleValue(); } /**Uporedjuje dva objekta*/ @Override public int compareTo(Rational o) { if (this.subtract(o).getNumerator() > 0) return 1; else if (this.subtract(o).getNumerator() < 0) return -1; else return 0; } }
[ "dejo.muscar@gmail.com" ]
dejo.muscar@gmail.com
7e71a185f21acb67a8b6ee44923738ab014b5653
01982a94bf25d823036c3a5425d77795027c8505
/android/app/src/main/java/com/reactnativegraphview/GraphPackage.java
9fb652ae257c8b1130454848bb6f274a71c35d20
[]
no_license
zubairpaizer/react-native-graphview
555950221f64558519d99f3598e5aa82b6aa5e83
824a9ad03de1204cf7ac42591347c2c6cee67178
refs/heads/master
2020-04-08T18:56:50.466229
2018-11-29T08:17:54
2018-11-29T08:17:54
159,631,610
1
1
null
null
null
null
UTF-8
Java
false
false
721
java
package com.reactnativegraphview; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.Arrays; import java.util.List; public class GraphPackage implements ReactPackage{ @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.asList(); } @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Arrays.<ViewManager>asList( new LineGraph(), new BarGraph(), new PointsGraph() ); } }
[ "zubair.ibrahim.ibex@gmail.com" ]
zubair.ibrahim.ibex@gmail.com
fd92a4541eee9063b60a0bd5f95eb0688fd33549
f71a7ec87f7e90f8025a3079daced5dbf41aca9c
/sfcommon/src/main/java/com/shifeng/dto/mall/order/OrderExpressDTO.java
9d52701401f2cd5a00eab7fb4e2b21adb69d61d4
[]
no_license
luotianwen/yy
5ff456507e9ee3dc1a890c9bead4491d350f393d
083a05aac4271689419ee7457cd0727eb10a5847
refs/heads/master
2021-01-23T10:34:24.402548
2017-10-08T05:03:10
2017-10-08T05:03:10
102,618,007
1
3
null
null
null
null
UTF-8
Java
false
false
2,346
java
package com.shifeng.dto.mall.order; import java.io.Serializable; import java.util.Date; /** * 订单快递(o_express_order)实体类 * @author Win Zhong * @version Revision: 1.00 * Date: 2017-02-24 11:45:31 */ public class OrderExpressDTO implements Serializable { /** * */ private static final long serialVersionUID = 1L; //快递单号 private String expressNumber; //快递id private Integer expressId; //快递名称 private String expressName; //快递电话 private String expressPhone; //快递Code private String expressCode; //快递状态 private String expressStatus; /** *快递单号 * @return */ public String getExpressNumber() { return expressNumber; } /** *快递单号 * @param expressNumber */ public void setExpressNumber(String expressNumber) { this.expressNumber = expressNumber; } /** *快递id * @return */ public Integer getExpressId() { return expressId; } /** *快递id * @param expressId */ public void setExpressId(Integer expressId) { this.expressId = expressId; } /** *快递名称 * @return */ public String getExpressName() { return expressName; } /** *快递名称 * @param expressName */ public void setExpressName(String expressName) { this.expressName = expressName; } /** *快递Code * @return */ public String getExpressCode() { return expressCode; } /** *快递Code * @param expressCode */ public void setExpressCode(String expressCode) { this.expressCode = expressCode; } /** * 快递电话 * @return */ public String getExpressPhone() { return expressPhone; } /** * 快递电话 */ public void setExpressPhone(String expressPhone) { this.expressPhone = expressPhone; } /** * 快递状态 * @return */ public String getExpressStatus() { return expressStatus; } /** * 快递状态 * @param expressStatus */ public void setExpressStatus(String expressStatus) { this.expressStatus = expressStatus; } @Override public String toString() { return "OrderExpressDTO [expressNumber=" + expressNumber + ", expressId=" + expressId + ", expressName=" + expressName + ", expressPhone=" + expressPhone + ", expressCode=" + expressCode + "]"; } }
[ "tw l" ]
tw l
237660b365b12c8ddb0bff5d35dc811fa7a7e980
bc7ea32bcafbd840ef079f7e01c703d1dd521d53
/presentation/src/main/java/com/github/piasy/template/features/user/GithubUserActivity.java
ce51ca781159ac03b6e487af4527084051b198af
[ "MIT" ]
permissive
gostik/AndroidTDDBootStrap
f8ac303d8b9ce8eb796f35094513b88656c810bd
e9731ccba6241eec93828c289871d74efd95c8ff
refs/heads/master
2021-01-18T18:07:24.804953
2016-03-01T18:45:34
2016-03-01T18:45:34
52,900,749
0
0
null
2016-03-01T18:42:34
2016-03-01T18:42:34
null
UTF-8
Java
false
false
2,432
java
/* * The MIT License (MIT) * * Copyright (c) 2015 Piasy * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.github.piasy.template.features.user; import android.os.Bundle; import com.github.piasy.common.di.HasComponent; import com.github.piasy.template.app.TemplateApp; import com.github.piasy.template.base.BaseActivity; import com.github.piasy.template.features.splash.GithubSearchFragment; import com.github.piasy.template.features.user.di.GithubUserComponent; import com.github.piasy.template.features.user.di.GithubUserModule; /** * Activity for search github user feature. */ public class GithubUserActivity extends BaseActivity implements HasComponent<GithubUserComponent> { private GithubUserComponent mGithubUserComponent; @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportFragmentManager().beginTransaction() .add(android.R.id.content, new GithubSearchFragment()) .commit(); } @Override protected void initializeInjector() { mGithubUserComponent = TemplateApp.get(this) .userComponent() .plus(getActivityModule(), new GithubUserModule()); mGithubUserComponent.inject(this); } @Override public GithubUserComponent getComponent() { return mGithubUserComponent; } }
[ "xz4215@gmail.com" ]
xz4215@gmail.com
5f767cecae41bb36de258b63ca27998d34e13c1c
8e035874adbcc4af0bff58145ebc11a83c86bb36
/app/src/main/java/com/todo/servicehelper/ServiceResponse.java
9e3c9c7e8c38dc4ca930650cfb5607b230ab061b
[]
no_license
HirenVekariya9499/TODO
d6eb1598374b333dc2cc5d193d98789c4e372eee
f14e920937da72116d4a6d24e353f3fffed980fc
refs/heads/master
2020-03-19T01:15:41.463216
2018-05-31T04:57:22
2018-05-31T04:57:22
135,533,300
0
0
null
null
null
null
UTF-8
Java
false
false
1,355
java
package com.todo.servicehelper; import org.json.JSONException; import org.json.JSONObject; public class ServiceResponse { public String RawResponse; public boolean isSuccess = false; public String Message = ""; public int Tag = 0; public boolean isException = false; public int ErrorCode = 0; public int statuscode = 0; public String TAG = ""; public int getStatusCode() { return statuscode; } public boolean isSuccess() { try { JSONObject main = new JSONObject(RawResponse); boolean is_error = main.optBoolean("is_error"); return !is_error; } catch (JSONException e) { e.printStackTrace(); } return isSuccess; } public String getErrorMessage() { try { JSONObject main = new JSONObject(RawResponse); String result = main.optString("message"); return result; } catch (JSONException e) { e.printStackTrace(); } return ""; } public String GetSuccessMessage() { try { JSONObject main = new JSONObject(RawResponse); String result = main.optString("message"); return result; } catch (JSONException e) { e.printStackTrace(); } return ""; } }
[ "hirenvekariya0009@gmail.com" ]
hirenvekariya0009@gmail.com
f259a37facca6ccb9ec5caadd0c4c137cb77ba11
76126c692bbb57fb101c8c78a44e9053b3609a6b
/app/src/main/java/com/ihealth/myapplication/view/EqualizerView.java
98ce8b2a9a77e4d5f35982cead6798316f6ed868
[]
no_license
Rifypujisanto/WEE_Equalizer
6efb4f89e870a9c9397c39c2dbb64d2c3c1b3b0b
bd81d3d89ee5699dcedc1c32b271c4a3144425ea
refs/heads/master
2022-04-18T00:01:23.511351
2020-04-21T03:27:14
2020-04-21T03:27:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,662
java
package com.ihealth.myapplication.view; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PointF; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; import com.ihealth.myapplication.R; /** * Created by WEE on 2020-04-17 */ public class EqualizerView extends View { private Context mContext; private Paint mPaint; private Paint connectPaint; private int mWidth, mHeight; private PointF[] pointsArray; private final int STATE_NONE = 0; private final int STATE_TOUCH_MOVE = 2; private final int STATE_TOUCH_UP = 3; private int STATE_NOW = STATE_NONE; private int[] decibelArray; private float mRadius = 40; private float step; private updateDecibelListener listener; public interface updateDecibelListener { void updateDecibel(int[] decibels); void getDecibelWhenMoveUp(int[] decibels); } public EqualizerView(Context context) { this(context, null); } public EqualizerView( Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public EqualizerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.mContext = context; init(); } public void setUpdateDecibelListener(updateDecibelListener listener) { this.listener = listener; } public int[] getDecibelArray() { return decibelArray; } public void setDecibelArray(int[] decibelArray) { this.decibelArray = decibelArray; invalidate(); } public void init() { curvePath = new Path(); mPaint = new Paint(); mPaint.setAntiAlias(true); connectPaint = new Paint(); connectPaint.setAntiAlias(true); connectPaint.setStrokeWidth(10); connectPaint.setStyle(Paint.Style.STROKE); connectPaint.setColor(ContextCompat.getColor(mContext, R.color.equalizer_point_connect_line)); pointsArray = new PointF[6]; decibelArray = new int[4]; } private int measureView(int measureSpec, int defaultSize) { int measureSize; int mode = View.MeasureSpec.getMode(measureSpec); int size = View.MeasureSpec.getSize(measureSpec); if (mode == MeasureSpec.EXACTLY) { measureSize = size; } else { measureSize = defaultSize; if (mode == MeasureSpec.AT_MOST) { measureSize = Math.min(measureSize, defaultSize); } } return measureSize; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); setMeasuredDimension(measureView(widthMeasureSpec, 400), measureView(heightMeasureSpec, 200)); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); mWidth = getWidth(); mHeight = getHeight(); step = mHeight / 14; canvas.drawColor(ContextCompat.getColor(mContext, R.color.equalizer_background)); int stepSize = mWidth / 5; pointsArray[0] = new PointF(-50, step * 6); pointsArray[5] = new PointF(mWidth + 50, step * 6); if ((STATE_NOW == STATE_NONE)) { for (int i = 1; i <= 4; i++) { if(decibelArray[i - 1] == 6){ float cx = stepSize * i, cy = mRadius; pointsArray[i] = new PointF(cx, cy); }else if(decibelArray[i - 1] == -6){ float cx = stepSize * i, cy = mHeight - mRadius; pointsArray[i] = new PointF(cx, cy); }else{ float cx = stepSize * i, cy = step * (-decibelArray[i - 1] + 7); pointsArray[i] = new PointF(cx, cy); } } refreshView(canvas, stepSize); } else { refreshView(canvas, stepSize); } } private void refreshView(Canvas canvas, int stepSize) { //1.先画点之间的曲线 canvas.drawPath(drawCurveLine(), connectPaint); for (int i = 1; i <= 4; i++) { float cx = stepSize * i, cy = pointsArray[i].y; //mRadius = 40; Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.mipmap.point); //2.再画点 canvas.drawBitmap(bitmap1, pointsArray[i].x - bitmap1.getWidth() / 2, pointsArray[i].y - bitmap1.getHeight() / 2, connectPaint); mPaint.setColor(ContextCompat.getColor(mContext, R.color.equalizer_vertical_line)); mPaint.setStrokeWidth(6); //3.画纵线 canvas.drawLine(cx, cy + mRadius - 3, stepSize * i, mHeight, mPaint); canvas.drawLine(cx, cy - mRadius + 3, stepSize * i, 0, mPaint); } } private Path curvePath; private Path drawCurveLine() { curvePath.reset(); for (int i = 0; i < 7; i++) { if (i != 6) { switch(i) { case 0: curvePath.moveTo(pointsArray[1].x, pointsArray[1].y); break; case 1: case 2: case 3: curvePath.cubicTo((pointsArray[i].x + pointsArray[i + 1].x) / 2, pointsArray[i].y, (pointsArray[i].x + pointsArray[i + 1].x) / 2, pointsArray[i + 1].y, pointsArray[i + 1].x, pointsArray[i + 1].y); break; } } } return curvePath; } private int mLastY = 0; private int index = 0; @Override public boolean onTouchEvent(MotionEvent event) { int action = event.getAction(); int x = (int) event.getX(), y = (int) event.getY(); switch (action) { case MotionEvent.ACTION_DOWN: { index = findTheIndex(x, y); if (index != 0) { invalidate(); } break; } case MotionEvent.ACTION_MOVE: { float deltaY = y - mLastY; if (index != 0) { STATE_NOW = STATE_TOUCH_MOVE; pointsArray[index].y += deltaY; if (y <= 40) { pointsArray[index].y = 40; } if (y >= mHeight - 40) { pointsArray[index].y = mHeight - 40; } decibelArray[index - 1] = getTheDecibel(pointsArray[index].y); invalidate(); listener.updateDecibel(decibelArray); } break; } case MotionEvent.ACTION_UP: { if (index != 0) { STATE_NOW = STATE_TOUCH_UP; if (decibelArray[index - 1] == 0) { pointsArray[index].y = step * 7; } invalidate(); listener.getDecibelWhenMoveUp(decibelArray); } break; } default: break; } mLastY = y; return true; } /** * 查出当前正在操作的是哪个结点 * * @param x * @param y * * @return */ private int findTheIndex(float x, float y) { int result = 0; for (int i = 1; i < pointsArray.length; i++) { if (pointsArray[i].x - mRadius * 1.5 < x && pointsArray[i].x + mRadius * 1.5 > x && pointsArray[i].y - mRadius * 1.5 < y && pointsArray[i].y + mRadius * 1.5 > y) { result = i; break; } } return result; } /** * 将坐标转换为-6到6之间的数字 * * @param y * * @return */ private int getTheDecibel(float y) { if (y == getHeight() - 40) { return -6; } else if (y == 40f) { return 6; } else { return 7 - Math.round(y / step); } } }
[ "zhaowei@ihealthlabs.com.cn" ]
zhaowei@ihealthlabs.com.cn
27ae4845b0d1b323cb90bfdc7fb513a558ea084f
c90fa18e878094746ca6ee0582accb33e85e870d
/demos/AndroidJson/app/src/main/java/com/example/zhangdai/androidjson/uilts/ContentHandler.java
e7bce4cd5b205d1689766420ee14fdb152f675df
[]
no_license
TDCQZD/AndroidDev
f4beb684169be1c00ac121fea3867068baa16852
7a217c23547e44273e4f42b784026c257a145517
refs/heads/master
2020-04-27T23:39:17.044479
2019-03-10T06:09:33
2019-03-10T06:09:33
174,784,609
1
0
null
null
null
null
UTF-8
Java
false
false
1,881
java
package com.example.zhangdai.androidjson.uilts; import android.util.Log; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class ContentHandler extends DefaultHandler { private String nodeName; private StringBuilder id; private StringBuilder name; private StringBuilder price; @Override public void startDocument() throws SAXException { id = new StringBuilder(); name = new StringBuilder(); price = new StringBuilder(); } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // 记录当前结点名 nodeName = localName; } @Override public void characters(char[] ch, int start, int length) throws SAXException { // 根据当前的结点名判断将内容添加到哪一个StringBuilder对象中 if ("id".equals(nodeName)) { id.append(ch, start, length); } else if ("name".equals(nodeName)) { name.append(ch, start, length); } else if ("price".equals(nodeName)) { price.append(ch, start, length); } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("book".equals(localName)) { Log.e("TAG", "SAX解析的子节点数据:" + "\n" + "id :" + id.toString().trim() + "\n" + "name : " + name.toString().trim() + "\n" + "price : " + price.toString().trim()); // 最后要将StringBuilder清空掉 id.setLength(0); name.setLength(0); price.setLength(0); } } @Override public void endDocument() throws SAXException { super.endDocument(); } }
[ "ZDTDCQ@163.com" ]
ZDTDCQ@163.com
ab180669ca9c48eb389c3c783802e91950d5c637
2afaad3a49dce5da090b792f7e0ae37fa78b59eb
/src/main/java/smapi/Credentials.java
41c33e0f3607815a626dab7550914a3c74a9bb83
[]
no_license
robertdj20/YouTubeSonos
14f24a6b4427d1b367f91d1481f1ba7e08186097
4afb14aa862097819a7dd19c3f46c735e52e5d61
refs/heads/master
2021-01-02T23:45:49.174017
2018-02-19T20:27:56
2018-02-19T20:27:56
99,507,237
20
1
null
null
null
null
UTF-8
Java
false
false
5,170
java
package smapi; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="zonePlayerId" type="{http://www.sonos.com/Services/1.1}id" minOccurs="0"/> * &lt;element name="deviceId" type="{http://www.sonos.com/Services/1.1}id" minOccurs="0"/> * &lt;element name="deviceProvider" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="deviceCert" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;choice minOccurs="0"> * &lt;element ref="{http://www.sonos.com/Services/1.1}sessionId"/> * &lt;element ref="{http://www.sonos.com/Services/1.1}login"/> * &lt;element ref="{http://www.sonos.com/Services/1.1}loginToken"/> * &lt;/choice> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "zonePlayerId", "deviceId", "deviceProvider", "deviceCert", "sessionId", "login", "loginToken" }) @XmlRootElement(name = "credentials") public class Credentials { protected String zonePlayerId; protected String deviceId; protected String deviceProvider; protected String deviceCert; protected String sessionId; protected Login login; protected LoginToken loginToken; /** * Gets the value of the zonePlayerId property. * * @return * possible object is * {@link String } * */ public String getZonePlayerId() { return zonePlayerId; } /** * Sets the value of the zonePlayerId property. * * @param value * allowed object is * {@link String } * */ public void setZonePlayerId(String value) { this.zonePlayerId = value; } /** * Gets the value of the deviceId property. * * @return * possible object is * {@link String } * */ public String getDeviceId() { return deviceId; } /** * Sets the value of the deviceId property. * * @param value * allowed object is * {@link String } * */ public void setDeviceId(String value) { this.deviceId = value; } /** * Gets the value of the deviceProvider property. * * @return * possible object is * {@link String } * */ public String getDeviceProvider() { return deviceProvider; } /** * Sets the value of the deviceProvider property. * * @param value * allowed object is * {@link String } * */ public void setDeviceProvider(String value) { this.deviceProvider = value; } /** * Gets the value of the deviceCert property. * * @return * possible object is * {@link String } * */ public String getDeviceCert() { return deviceCert; } /** * Sets the value of the deviceCert property. * * @param value * allowed object is * {@link String } * */ public void setDeviceCert(String value) { this.deviceCert = value; } /** * Gets the value of the sessionId property. * * @return * possible object is * {@link String } * */ public String getSessionId() { return sessionId; } /** * Sets the value of the sessionId property. * * @param value * allowed object is * {@link String } * */ public void setSessionId(String value) { this.sessionId = value; } /** * Gets the value of the login property. * * @return * possible object is * {@link Login } * */ public Login getLogin() { return login; } /** * Sets the value of the login property. * * @param value * allowed object is * {@link Login } * */ public void setLogin(Login value) { this.login = value; } /** * Gets the value of the loginToken property. * * @return * possible object is * {@link LoginToken } * */ public LoginToken getLoginToken() { return loginToken; } /** * Sets the value of the loginToken property. * * @param value * allowed object is * {@link LoginToken } * */ public void setLoginToken(LoginToken value) { this.loginToken = value; } }
[ "robertdj20@gmail.com" ]
robertdj20@gmail.com
6160ccb93df4e24c7e8d483a6003edea661dd11f
565c1cfde1777faaa13591b6a44f5fc247aab4e2
/58_4sum/4sum.java
c79deb489174cb3db3659b82bcf423e29ef248e2
[]
no_license
AndrewLu1992/lintcodes
6bcb70287695d8464cee210eb8e46d6ed1316e7c
365a3cbca25d66525487a96dd4debd66237a568c
refs/heads/master
2020-04-10T14:57:02.266105
2016-09-14T05:27:37
2016-09-14T05:27:37
68,175,952
0
0
null
null
null
null
UTF-8
Java
false
false
2,301
java
/* @Copyright:LintCode @Author: hanqiao @Problem: http://www.lintcode.com/problem/4sum @Language: Java @Datetime: 16-07-30 13:20 */ public class Solution { /** * @param numbers : Give an array numbersbers of n integer * @param target : you need to find four elements that's sum of target * @return : Find all unique quadruplets in the array which gives the sum of * zero. */ public ArrayList<ArrayList<Integer>> fourSum(int[] numbers, int target) { /* your code */ // O(n ^ 3) time and O(n) space. ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>(); if (numbers == null || numbers.length < 4) { return res; } Arrays.sort(numbers); for (int i = 0; i < numbers.length - 3; i++) { if (i != 0 && numbers[i] == numbers[i - 1]) { continue; } for (int j = i + 1; j < numbers.length - 2; j++) { if (j != i + 1 && numbers[j] == numbers[j - 1]) { continue; } int left = j + 1; int right = numbers.length - 1; while (left < right) { int sum = numbers[i] + numbers[j] + numbers[left] + numbers[right]; if (sum == target) { ArrayList<Integer> item = new ArrayList<>(); item.add(numbers[i]); item.add(numbers[j]); item.add(numbers[left]); item.add(numbers[right]); res.add(item); left++; right--; while (numbers[left] == numbers[left - 1]) { left++; } while (numbers[right] == numbers[right + 1]) { right--; } } else if (sum < target) { left++; } else { right--; } } } } return res; } }
[ "hlu22@hawk.iit.edu" ]
hlu22@hawk.iit.edu
84aacb1eaf080cbc35d87475e86e250fb595922d
8c10592c542606045d2985864d9fcf7f1c2e45ed
/src/com/ncaa/controller/NCAAController.java
f9fda9890724ac6752d6d35c3b7b341456abb673
[]
no_license
mnsinger/NCAAPredictor
a295d770f3c58718ef426e25101a1a04f6ddeffc
736e98244d0cf3beb8546e9c22d44938ac856711
refs/heads/master
2021-01-19T06:30:10.817167
2017-04-06T20:21:45
2017-04-06T20:21:45
87,467,336
0
0
null
null
null
null
UTF-8
Java
false
false
1,317
java
package com.ncaa.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.ncaa.service.NCAAService; @Controller public class NCAAController { @Autowired NCAAService ncaaService; @RequestMapping("/ncaa") public ModelAndView welcome() { return new ModelAndView("ncaa"); } //@RequestMapping("/getMetadata") //public @ResponseBody String getMetadata() { //System.out.println("In Java Controller"); //String jsonString = ncaaService.getMetadata().toString(); //return jsonString; //} @RequestMapping("/getHistorical") public @ResponseBody String getHistorical(@RequestParam("year") String year) { String jsonArrayString = ncaaService.getHistorical(year).toString(); return jsonArrayString; } @RequestMapping("/getPredictions") public @ResponseBody String getPredictions(@RequestParam("year") String year) { String jsonArrayString = ncaaService.getPredictions(year).toString(); return jsonArrayString; } }
[ "mnsinger@gmail.com" ]
mnsinger@gmail.com
8e50fc36c50cd4ab29029058da26dc65f49c6768
18e79ff82eca3376b572e960fec9cbd48b900072
/seal/src/main/java/com/GuoGuo/JuicyChat/server/response/QiNiuTokenResponse.java
a5f0479473923695e9f238e09c09e5e4ece167d7
[ "MIT" ]
permissive
chen-android/guoliao
22aa46354f86de59e118400d765166b66dd9db70
3d0690172570677c5ab2192e6217e7c675706130
refs/heads/master
2021-01-19T18:18:26.387922
2017-12-18T05:49:55
2017-12-18T05:49:55
100,932,381
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package com.GuoGuo.JuicyChat.server.response; public class QiNiuTokenResponse { private int code; private ResultEntity data; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public ResultEntity getData() { return data; } public void setData(ResultEntity data) { this.data = data; } public static class ResultEntity { private String qiniutoken; public String getQiniutoken() { return qiniutoken; } public void setQiniutoken(String qiniutoken) { this.qiniutoken = qiniutoken; } } }
[ "1014988429@qq.com" ]
1014988429@qq.com
d5e9b9857dc0d842640b0f5c0f47a2fb3fd1f3b3
2783da2050e6ac93265f7e4b695832aa86cf03b9
/guns/src/main/java/com/example/tool/text/ASCIIStrCache.java
6a4297bfa377855645ff93c79c2d9df8ecf255f9
[]
no_license
dignjun/FooTest
f49f7bf6e4a8e36bb0df4ee8321a826d7dfce580
c4f66472ae100bb2ef2b33a44c479cbf6dc5bec4
refs/heads/master
2022-11-26T22:07:25.921259
2020-05-07T15:08:08
2020-05-07T15:08:08
172,705,687
0
0
null
2022-11-24T03:47:43
2019-02-26T12:17:21
JavaScript
UTF-8
Java
false
false
612
java
package com.example.tool.text; /** * ASCII字符对应的字符串缓存 */ public class ASCIIStrCache { private static final int ASCII_LENGTH = 128; private static final String[] CACHE = new String[ASCII_LENGTH]; static { for (char c = 0; c < ASCII_LENGTH; c++) { CACHE[c] = String.valueOf(c); } } /** * 字符转为字符串<br> * 如果为ASCII字符,使用缓存 * * @param c 字符 * @return 字符串 */ public static String toString(char c) { return c < ASCII_LENGTH ? CACHE[c] : String.valueOf(c); } }
[ "dingjun@chinatvpay.com" ]
dingjun@chinatvpay.com
6040a87db840109c4cc450f6ebf3d1608c08501d
b04ca89b4c9e6aa5aa12db6a4e6c618bf630f7d0
/Assignment 3/src/main/java/de/tuda/dmdb/sql/error/Error.java
748452770771803d558b734f7508ba30cff481e0
[]
no_license
YannickPferr/SDM
bc6761f3afe570a3e4f250a0e67d33f4c387362b
4c9edca635736c7a42d36e44daea854fe2460e44
refs/heads/main
2023-01-20T04:58:45.010239
2020-12-04T21:38:04
2020-12-04T21:38:04
318,638,108
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package de.tuda.dmdb.sql.error; public class Error { public static final Error NO_ERROR = new Error(); private ErrorType type = ErrorType.NO_ERROR; private String[] args = null; public Error(){ } public Error(ErrorType type, String[] args){ this.type = type; this.args = args; } public boolean isError(){ return this.type != ErrorType.NO_ERROR; } public String toString(){ return ErrorType.toString(type, args); } }
[ "YannickPfer@github.com" ]
YannickPfer@github.com
6c2ca8268c82219b0e260a4f4e6255b67cb8dca9
99f56814136cac0c7cf4b3e498881d6b71aa3a91
/src/proyecto/validador.java
37e69bac60f5b7ea1ffedf9b384461ab75cbaff5
[]
no_license
juniorrodelo/ProyectoAlgoritmo
c69f794500e35534bb7299c4f9ca34182608a251
41f01e20985a8d059b356f328b29adc50ae1f9de
refs/heads/master
2021-01-19T15:29:56.651259
2014-11-12T22:31:36
2014-11-12T22:31:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package proyecto; public class validador { public static boolean isNum(String a){//metodo para validar si es un numero try{ int b = Integer.parseInt(a); return true;//si se puede convertir a numero devuelve verdadero } catch(NumberFormatException e){ return false;//si no se puede convertir a numero devuelve falso } } }
[ "alfredorodelo23@hotmail.com" ]
alfredorodelo23@hotmail.com
84c6dd003feef5f195663dc1e20c4adf539b903e
1fcc7168a448309c585ae8fa5ee6cf8d2a669b82
/src/main/java/com/example/DemoApplication.java
64bcb7ed58ca3260bf54c9abccc90987a8362d76
[]
no_license
erhyd/chap07
59fdad70a216006e41cfed71e7b524302b193944
24942b6854c9948a7361cd36e058185d9d9b4c15
refs/heads/master
2021-01-14T07:55:43.024047
2017-02-14T01:44:22
2017-02-14T01:44:22
81,891,048
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema; @SpringBootApplication @ServletComponentScan public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "java" ]
java
6fc19c3d12091451b6c5fcdfd767d378cc70b17a
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/GetV2LoggingOptionsRequest.java
8f78e5076ef63160811a03734b49675954c178c1
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
2,011
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.iot.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetV2LoggingOptionsRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetV2LoggingOptionsRequest == false) return false; GetV2LoggingOptionsRequest other = (GetV2LoggingOptionsRequest) obj; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; return hashCode; } @Override public GetV2LoggingOptionsRequest clone() { return (GetV2LoggingOptionsRequest) super.clone(); } }
[ "" ]
25bafa7cff539ef07c5a18f97832e2a9fb0bafce
2816b2dd8d6bab7d6fdf3b910903ae2aa61850ca
/PopularMovies/app/src/main/java/com/example/jpdeguzman/popularmovies/moviesearch/LoadMoviesInteractorImpl.java
b92b002d3cc59471602fe754cb0126615614a848
[]
no_license
jonathan-paul-deguzman/PopularMovies
5d800f1099b115160a3177a7052eb289835bc7bd
e6c667a86861578e2d5a92ac21634d6f176116d5
refs/heads/master
2021-09-05T00:41:41.455198
2018-01-23T05:38:43
2018-01-23T05:38:43
107,152,672
0
0
null
null
null
null
UTF-8
Java
false
false
1,357
java
package com.example.jpdeguzman.popularmovies.moviesearch; import android.text.TextUtils; import com.example.jpdeguzman.popularmovies.data.constants.MovieConstants; import com.example.jpdeguzman.popularmovies.data.services.MovieClient; import com.example.jpdeguzman.popularmovies.data.models.MovieResultsModel; import com.example.jpdeguzman.popularmovies.R; import com.example.jpdeguzman.popularmovies.data.services.MovieDetailsService; import com.example.jpdeguzman.popularmovies.utils.ApplicationContext; import retrofit2.Call; /** * Responsible for interacting with {@link MovieDetailsService} to retrieve movie data based on * the movie type. */ public class LoadMoviesInteractorImpl implements LoadMoviesInteractor { @Override public Call<MovieResultsModel> loadMoviesByType(String movieType) { String userApiKey = ApplicationContext.getContext().getResources().getString(R.string.api_key); if (!TextUtils.isEmpty(movieType)) { if (movieType.equals(MovieConstants.MOVIE_TYPE_POPULAR_KEY)) { return MovieClient.getMovieDetailsService().getPopularMovies(userApiKey); } else if (movieType.equals(MovieConstants.MOVIE_TYPE_TOP_RATED_KEY)) { return MovieClient.getMovieDetailsService().getTopRatedMovies(userApiKey); } } return null; } }
[ "deguzman.jonathan.paul@gmail.com" ]
deguzman.jonathan.paul@gmail.com
3ba6198c785eebbbf09d712292eba85206a4106f
37d8b470e71ea6edff6ed108ffd2b796322b7943
/zkdemo/src/com/hxzy/common/log/service/impl/LogServiceImpl.java
4d0b4e731c197620f537f7610825225f81e4e08c
[]
no_license
haifeiforwork/myfcms
ef9575be5fc7f476a048d819e7c0c0f2210be8ca
fefce24467df59d878ec5fef2750b91a29e74781
refs/heads/master
2020-05-15T11:37:50.734759
2014-06-28T08:31:55
2014-06-28T08:31:55
null
0
0
null
null
null
null
GB18030
Java
false
false
958
java
/** * <p>项目名称:</p> * <p>版权所有 (c) </p> * <p>版本:1.0</p> * <p>日期:Mar 9, 2010</p> * <p>更新:</p> */ package com.hxzy.common.log.service.impl; import org.springframework.beans.factory.annotation.Autowired; import com.hxzy.base.service.impl.BaseServiceImpl; import com.hxzy.common.log.dao.LogDao; import com.hxzy.common.log.model.Log; import com.hxzy.common.log.service.LogService; /** * @author xiacc * * 描述: */ public class LogServiceImpl extends BaseServiceImpl<Log,LogDao> implements LogService { @Autowired private LogDao logDao; /* (non-Javadoc) * @see base.service.impl.BaseServiceImpl#getDao() */ @Override protected LogDao getDao() { return getLogDao(); } /** * 返回 logDao */ public LogDao getLogDao() { return logDao; } /** * 设置 logDao */ public void setLogDao(LogDao logDao) { this.logDao = logDao; } }
[ "yourfei@live.cn@c1c2bf6e-ae9d-b823-7fc2-ff1dc594729e" ]
yourfei@live.cn@c1c2bf6e-ae9d-b823-7fc2-ff1dc594729e
60588c7e25053b1c168225cb787d67916e7949ed
1ba27fc930ba20782e9ef703e0dc7b69391e191b
/Src/JDBCImporter/src/main/java/net/sourceforge/jdbcimporter/ColumnTranslator.java
a0ecd82ffee5078de8116dbdca070fe195f48309
[]
no_license
LO-RAN/codeQualityPortal
b0d81c76968bdcfce659959d0122e398c647b09f
a7c26209a616d74910f88ce0d60a6dc148dda272
refs/heads/master
2023-07-11T18:39:04.819034
2022-03-31T15:37:56
2022-03-31T15:37:56
37,261,337
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
package net.sourceforge.jdbcimporter; /* * JDBC Importer - database import utility/framework. * Copyright (C) 2002 Chris Nagy * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Chris Nagy * Email: cnagyxyz@hotmail.com */ /** * The ColumnTranslator interface defines the method used to * translate a column value read from a file into a column value * to be imported into the database. * * Some examples: * * <ul> * <li> Encryption : The translator encrypts a string. This can be used * when inserting passwords into the database that should have one-way * encryption * <li> File Reader : The translator identifies the string as a filename and * reads the file in as the new column value. * </ul> * * @version 0.6 * @author Chris Nagy */ public interface ColumnTranslator { /** * Returns the translated column value. * * @param column the definition of the column * @param columnValue the value of the column read from a file * @return the new value of the column */ public ColumnValue getValue( ColumnDef column, ColumnValue columnValue ); }
[ "laurent.izac@gmail.com" ]
laurent.izac@gmail.com
a632aa2eaa5a79ceda726450cc55401cf3b6257f
09e9d0de7ffeda4784705839e7628524bced9f89
/app/src/test/java/com/lagosdevelopers/lagdevs/ExampleUnitTest.java
e45bd6f65382c5fcb856960e5dc7327fc6eed848
[]
no_license
blessochampion/ALC_intermediate
608f18a8a036852f108b911f5da7e8ba8003f07d
f004fbaad0074c0fa911e8d6f1272cfbabae15bd
refs/heads/master
2021-01-21T17:22:30.804267
2017-03-16T10:44:51
2017-03-16T10:44:51
85,180,859
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package com.lagosdevelopers.lagdevs; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "blessochampion@gmail.com" ]
blessochampion@gmail.com
5a9c848e83ea15055650307b805e2661fc6b914f
c6628dfd8d98d418bd0e82ace5e807d3169ea689
/infoglue-root/milton-api/src/main/java/com/bradmcevoy/http/webdav/PropPatchHandler.java
c53a375b72aad597fb8b1ff60772de98ecc6b7fa
[ "Apache-2.0" ]
permissive
astik/infoglue-maven
64fefb10bf5759c5e5dc30c63d5c91a8fe7baa18
4ff6064e436891616d68a0f1f71e8d0bf71ef612
refs/heads/master
2021-01-19T15:05:35.744941
2011-03-07T17:35:39
2011-03-07T17:35:39
1,293,279
2
0
null
null
null
null
UTF-8
Java
false
false
6,766
java
package com.bradmcevoy.http.webdav; import com.bradmcevoy.http.*; import com.bradmcevoy.http.exceptions.BadRequestException; import com.bradmcevoy.http.exceptions.ConflictException; import com.bradmcevoy.http.exceptions.NotAuthorizedException; import com.bradmcevoy.http.webdav.PropPatchRequestParser.ParseResult; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.bradmcevoy.http.Request.Method; import com.bradmcevoy.io.ReadingException; import com.bradmcevoy.io.WritingException; /** * Example request (from ms office) * * PROPPATCH /Documents/test.docx HTTP/1.1 content-length: 371 cache-control: no-cache connection: Keep-Alive host: milton:8080 user-agent: Microsoft-WebDAV-MiniRedir/6.0.6001 pragma: no-cache translate: f if: (<opaquelocktoken:900f718e-801c-4152-ae8e-f9395fe45d71>) content-type: text/xml; charset="utf-8" <?xml version="1.0" encoding="utf-8" ?> * <D:propertyupdate xmlns:D="DAV:" xmlns:Z="urn:schemas-microsoft-com:"> * <D:set> * <D:prop> * <Z:Win32LastAccessTime>Wed, 10 Dec 2008 21:55:22 GMT</Z:Win32LastAccessTime> * <Z:Win32LastModifiedTime>Wed, 10 Dec 2008 21:55:22 GMT</Z:Win32LastModifiedTime> * <Z:Win32FileAttributes>00000020</Z:Win32FileAttributes> * </D:prop> * </D:set> * </D:propertyupdate> * * * And another example request (from spec) * * <?xml version="1.0" encoding="utf-8" ?> <D:propertyupdate xmlns:D="DAV:" xmlns:Z="http://www.w3.com/standards/z39.50/"> <D:set> <D:prop> <Z:authors> <Z:Author>Jim Whitehead</Z:Author> <Z:Author>Roy Fielding</Z:Author> </Z:authors> </D:prop> </D:set> <D:remove> <D:prop><Z:Copyright-Owner/></D:prop> </D:remove> </D:propertyupdate> * * * Here is an example response (from the spec) * * HTTP/1.1 207 Multi-Status Content-Type: text/xml; charset="utf-8" Content-Length: xxxx <?xml version="1.0" encoding="utf-8" ?> <D:multistatus xmlns:D="DAV:" xmlns:Z="http://www.w3.com/standards/z39.50"> <D:response> <D:href>http://www.foo.com/bar.html</D:href> <D:propstat> <D:prop><Z:Authors/></D:prop> <D:status>HTTP/1.1 424 Failed Dependency</D:status> </D:propstat> <D:propstat> <D:prop><Z:Copyright-Owner/></D:prop> <D:status>HTTP/1.1 409 Conflict</D:status> </D:propstat> <D:responsedescription> Copyright Owner can not be deleted or altered.</D:responsedescription> </D:response> </D:multistatus> * * * @author brad */ public class PropPatchHandler implements ExistingEntityHandler { private final static Logger log = LoggerFactory.getLogger( PropPatchHandler.class ); private final ResourceHandlerHelper resourceHandlerHelper; private final PropPatchRequestParser requestParser; private final PropPatchSetter patchSetter; private final WebDavResponseHandler responseHandler; public PropPatchHandler( ResourceHandlerHelper resourceHandlerHelper, WebDavResponseHandler responseHandler, PropPatchSetter propPatchSetter ) { this.resourceHandlerHelper = resourceHandlerHelper; this.requestParser = new DefaultPropPatchParser(); patchSetter = propPatchSetter; this.responseHandler = responseHandler; } public PropPatchHandler( ResourceHandlerHelper resourceHandlerHelper, PropPatchRequestParser requestParser, PropPatchSetter patchSetter, WebDavResponseHandler responseHandler ) { this.resourceHandlerHelper = resourceHandlerHelper; this.requestParser = requestParser; this.patchSetter = patchSetter; this.responseHandler = responseHandler; } public String[] getMethods() { return new String[]{Method.PROPPATCH.code}; } public boolean isCompatible( Resource r ) { return patchSetter.supports( r ); } public void process( HttpManager httpManager, Request request, Response response ) throws ConflictException, NotAuthorizedException, BadRequestException { resourceHandlerHelper.process( httpManager, request, response, this ); } public void processResource( HttpManager manager, Request request, Response response, Resource r ) throws NotAuthorizedException, ConflictException, BadRequestException { resourceHandlerHelper.processResource( manager, request, response, r, this ); } public void processExistingResource( HttpManager manager, Request request, Response response, Resource resource ) throws NotAuthorizedException, BadRequestException, ConflictException { // todo: check if token header try { InputStream in = request.getInputStream(); ParseResult parseResult = requestParser.getRequestedFields( in ); String href = request.getAbsoluteUrl(); List<PropFindResponse> responses = new ArrayList<PropFindResponse>(); PropFindResponse resp = patchSetter.setProperties( href, parseResult, resource ); responses.add(resp); responseHandler.respondPropFind( responses, response, request, resource); } catch( WritingException ex ) { throw new RuntimeException( ex ); } catch( ReadingException ex ) { throw new RuntimeException( ex ); } catch( IOException ex ) { throw new RuntimeException( ex ); } } public static class Field { public final String name; String namespaceUri; public Field( String name ) { this.name = name; } public void setNamespaceUri( String namespaceUri ) { this.namespaceUri = namespaceUri; } public String getNamespaceUri() { return namespaceUri; } } public static class SetField extends Field { public final String value; public SetField( String name, String value ) { super( name ); this.value = value; } } public static class Fields implements Iterable<Field> { /** * fields to remove */ public final List<Field> removeFields = new ArrayList<Field>(); /** * fields to set to a value */ public final List<SetField> setFields = new ArrayList<PropPatchHandler.SetField>(); private int size() { return removeFields.size() + setFields.size(); } public Iterator<Field> iterator() { List<Field> list = new ArrayList<Field>( removeFields ); list.addAll( setFields ); return list.iterator(); } } }
[ "romain.gonord.opensource@neteyes.org" ]
romain.gonord.opensource@neteyes.org
f68653c80b4528dc5258f35920bf516932aabf1d
33d8c4ea7d5429ccd8431d94cccacb16878df1b0
/registration/registration-api/src/main/java/com/liferay/training/registration/validator/UserValidator.java
4644e2e56c9e5c5d07afa2f255bd84268900fc44
[]
no_license
ces-luannguyen/modules
a262f826fec3dd1c7527bfcc70fe8ff735b12d5d
46bc112e5c42f832c77c26e0b877d060fabd6da7
refs/heads/master
2023-05-06T22:46:11.794796
2021-05-18T01:50:53
2021-05-18T01:50:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package com.liferay.training.registration.validator; import com.liferay.training.registration.exception.UserValidationException; import java.util.Date; public interface UserValidator { public void validate( String userName, String firstName, String lastName, String emailAddress, Date birthDay, String password, String confirmPassword, String homePhone, String mobilePhone, String address1, String address2, String city, String state, String zipCode, String securityQuestion, String answer, boolean termsOfUse) throws UserValidationException; }
[ "luan.nguyen@codeenginestudio.com" ]
luan.nguyen@codeenginestudio.com
4001b022cfcfbd0773c6b94fd30a2454282631f3
0fb0dba9dbefa4d078775ae2a84cb8e8eee07a32
/app/src/main/java/com/dant2/popularmovies/Movie.java
ef66dcfd9afafc403df88815da495f77f971d04f
[]
no_license
AppSecAI-TEST/PopularMovies
5d80a378cafa380337d80c2ab066113c023e3e5f
6b687ef971d391d07ace03098e00d06bf394c0f5
refs/heads/master
2021-01-16T11:39:41.341130
2017-08-11T06:30:28
2017-08-11T06:30:28
100,000,874
0
0
null
2017-08-11T06:50:51
2017-08-11T06:50:51
null
UTF-8
Java
false
false
1,224
java
package com.dant2.popularmovies; /** * Model for movie objects */ public class Movie { public String getName() { return name; } public void setName(String name) { this.name = name; } public String getReleaseDate() { return releaseDate; } public void setReleaseDate(String releaseDate) { this.releaseDate = releaseDate; } public String getPlotSummary() { return plotSummary; } public void setPlotSummary(String plotSummary) { this.plotSummary = plotSummary; } public int getRating() { return rating; } public void setRating(int rating) { this.rating = rating; } String name; public Movie(String name, String releaseDate, String plotSummary, int rating, String poster) { this.name = name; this.releaseDate = releaseDate; this.plotSummary = plotSummary; this.rating = rating; this.poster = poster; } String releaseDate; String plotSummary; int rating; public String getPoster() { return poster; } public void setPoster(String poster) { this.poster = poster; } String poster; }
[ "jorlee92@gmail.com" ]
jorlee92@gmail.com
a36cb07a8c45fec6218c45e7c87d28db1de1d557
c770c49e2a91260abad58fd451d9524b790d7b20
/sentinel-agent/sentinel-agent-core/src/main/java/com/google/inject/internal/SingleMethodInjector.java
92699424a1232e5dfff4f32be59774a7c7f804b9
[ "Apache-2.0" ]
permissive
ddreaml/Sentinel-ali
d45e941e537d26628151f9c87dccdca16ef329a7
33721158794f9a713057abccbb4f4b89dfaaa644
refs/heads/master
2023-04-24T13:20:07.505656
2019-10-21T11:24:43
2019-10-21T11:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,052
java
package com.google.inject.internal; import com.google.inject.spi.InjectionPoint; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; final class SingleMethodInjector implements SingleMemberInjector { private final InjectorImpl.MethodInvoker methodInvoker; private final SingleParameterInjector<?>[] parameterInjectors; private final InjectionPoint injectionPoint; SingleMethodInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; Method method = (Method)injectionPoint.getMember(); this.methodInvoker = this.createMethodInvoker(method); this.parameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); } private InjectorImpl.MethodInvoker createMethodInvoker(final Method method) { int modifiers = method.getModifiers(); if (!Modifier.isPublic(modifiers) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) { method.setAccessible(true); } return new InjectorImpl.MethodInvoker() { public Object invoke(Object target, Object... parameters) throws IllegalAccessException, InvocationTargetException { return method.invoke(target, parameters); } }; } public InjectionPoint getInjectionPoint() { return this.injectionPoint; } public void inject(InternalContext context, Object o) throws InternalProvisionException { Object[] parameters = SingleParameterInjector.getAll(context, this.parameterInjectors); try { this.methodInvoker.invoke(o, parameters); } catch (IllegalAccessException var6) { throw new AssertionError(var6); } catch (InvocationTargetException var7) { Throwable cause = var7.getCause() != null ? var7.getCause() : var7; throw InternalProvisionException.errorInjectingMethod((Throwable)cause).addSource(this.injectionPoint); } } }
[ "418294249@qq.com" ]
418294249@qq.com
a26d606a1a41f8d3cdf21d21aec1711342d7ad2e
6160ab48ebf1a77e49bdca57a7c87aa7e91b6a82
/app/src/main/java/www/scientistx/saftafood/App.java
a588bd7064436d991cb19314ed7127ae8a80dd04
[]
no_license
sazzad9911/safta_android
5bde8f4a16df30a8e64b4648e54f98671d16009f
031f178f48df4dec118bac3ede859efdf76a5652
refs/heads/main
2023-05-11T21:58:10.843325
2021-06-05T17:08:57
2021-06-05T17:08:57
374,169,326
0
0
null
null
null
null
UTF-8
Java
false
false
1,607
java
package www.scientistx.saftafood; import android.app.Application; import android.app.NotificationChannel; import android.app.NotificationManager; import android.os.Build; public class App extends Application { public static final String CHANNEL_1_ID="meal"; public static final String CHANNEL_2_ID="home"; public static final String CHANNEL_3_ID="message"; @Override public void onCreate() { super.onCreate(); createNotification(); } public void createNotification(){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ NotificationChannel channel=new NotificationChannel( CHANNEL_1_ID, "meal", NotificationManager.IMPORTANCE_HIGH ); channel.setDescription("Meal Account"); NotificationChannel channell=new NotificationChannel( CHANNEL_2_ID, "home", NotificationManager.IMPORTANCE_HIGH ); channel.setDescription("Home Account"); NotificationChannel channel2=new NotificationChannel( CHANNEL_3_ID, "Message", NotificationManager.IMPORTANCE_HIGH ); channel2.setDescription("User's Messages"); NotificationManager manager= getSystemService(NotificationManager.class); manager.createNotificationChannel(channel); manager.createNotificationChannel(channell); manager.createNotificationChannel(channel2); } } }
[ "sazzad15-2521@diu.edu.bd" ]
sazzad15-2521@diu.edu.bd
440c443862df1821340ee7900d9d0611915966c2
858761a5810934c51cb0987903f3f97f161bc4a6
/tags/kernel-1.0.20/api/src/main/java/org/sakaiproject/content/api/ContentTypeImageService.java
a2dc90cb91d6a03822ceb581c392990bf5aff181
[]
no_license
svn2github/sakai-kernel
f10821d51e39651788c97e1d2739f762c25e79de
2b97c9b7ad53becc8de57a5233c7d35873edd10d
refs/heads/master
2020-04-14T21:44:05.973159
2014-12-23T21:38:01
2014-12-23T21:38:01
10,166,725
1
0
null
null
null
null
UTF-8
Java
false
false
3,050
java
/********************************************************************************** * $URL$ * $Id$ *********************************************************************************** * * Copyright (c) 2003, 2004, 2005, 2006, 2008 Sakai Foundation * * Licensed under the Educational Community 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.osedu.org/licenses/ECL-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.sakaiproject.content.api; import java.util.List; /** * <p>ContentTypeImageService is the Interface for looking up proper image based on the content type. It also * associates a display name and a set of file extensions to known types.</p> * * @version $Revision$ */ public interface ContentTypeImageService { /** This string can be used to find the service in the service manager. */ public static final String SERVICE_NAME = ContentTypeImageService.class.getName(); /** * Get the image file name based on the content type. * @param contentType The content type string. * @return The image file name based on the content type. */ public String getContentTypeImage(String contentType); /** * Get the display name of the content type. * @param contentType The content type string. * @return The display name of the content type. */ public String getContentTypeDisplayName(String contentType); /** * Get the file extension value of the content type. * @param contentType The content type string. * @return The file extension value of the content type. */ public String getContentTypeExtension(String contentType); /** * Get the content type string that is used for this file extension. * @param extension The file extension (to the right of the dot, not including the dot). * @return The content type string that is used for this file extension. */ public String getContentType(String extension); /** * Is the type one of the known types used when the file type is unknown? * @param contentType The content type string to test. * @return true if the type is a type used for unknown file types, false if not. */ public boolean isUnknownType(String contentType); /** * Access an ordered list of all mimetype categories. * @return The list of mimetype categories in alphabetic order. */ public List getMimeCategories(); /** * Access an ordered list of all mimetype subtypes for a particular category. * @param category The category. * @return The list of mimetype subtypes in alphabetic order. */ public List getMimeSubtypes(String category); } // ContentTypeImageService
[ "arwhyte@umich.edu@66ffb92e-73f9-0310-93c1-f5514f145a0a" ]
arwhyte@umich.edu@66ffb92e-73f9-0310-93c1-f5514f145a0a
7fb61ce9a9304417e464e796f61c8218bcd140ed
d71e879b3517cf4fccde29f7bf82cff69856cfcd
/ExtractedJars/Shopkick_com.shopkick.app/javafiles/com/google/android/exoplayer/DefaultLoadControl.java
27cf9ac7727ece7efd7f7d9160e809e333e6883d
[ "MIT" ]
permissive
Andreas237/AndroidPolicyAutomation
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
refs/heads/master
2020-04-10T02:14:08.789751
2019-05-16T19:29:11
2019-05-16T19:29:11
160,739,088
5
1
null
null
null
null
UTF-8
Java
false
false
25,932
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.google.android.exoplayer; import android.os.Handler; import com.google.android.exoplayer.upstream.Allocator; import com.google.android.exoplayer.upstream.NetworkLock; import java.util.*; // Referenced classes of package com.google.android.exoplayer: // LoadControl public final class DefaultLoadControl implements LoadControl { public static interface EventListener { public abstract void onLoadingChanged(boolean flag); } private static class LoaderState { public final int bufferSizeContribution; public int bufferState; public boolean loading; public long nextLoadPositionUs; public LoaderState(int i) { // 0 0:aload_0 // 1 1:invokespecial #19 <Method void Object()> bufferSizeContribution = i; // 2 4:aload_0 // 3 5:iload_1 // 4 6:putfield #21 <Field int bufferSizeContribution> bufferState = 0; // 5 9:aload_0 // 6 10:iconst_0 // 7 11:putfield #23 <Field int bufferState> loading = false; // 8 14:aload_0 // 9 15:iconst_0 // 10 16:putfield #25 <Field boolean loading> nextLoadPositionUs = -1L; // 11 19:aload_0 // 12 20:ldc2w #26 <Long -1L> // 13 23:putfield #29 <Field long nextLoadPositionUs> // 14 26:return } } public DefaultLoadControl(Allocator allocator1) { this(allocator1, ((Handler) (null)), ((EventListener) (null))); // 0 0:aload_0 // 1 1:aload_1 // 2 2:aconst_null // 3 3:aconst_null // 4 4:invokespecial #58 <Method void DefaultLoadControl(Allocator, Handler, DefaultLoadControl$EventListener)> // 5 7:return } public DefaultLoadControl(Allocator allocator1, Handler handler, EventListener eventlistener) { this(allocator1, handler, eventlistener, 15000, 30000, 0.2F, 0.8F); // 0 0:aload_0 // 1 1:aload_1 // 2 2:aload_2 // 3 3:aload_3 // 4 4:sipush 15000 // 5 7:sipush 30000 // 6 10:ldc1 #28 <Float 0.2F> // 7 12:ldc1 #24 <Float 0.8F> // 8 14:invokespecial #62 <Method void DefaultLoadControl(Allocator, Handler, DefaultLoadControl$EventListener, int, int, float, float)> // 9 17:return } public DefaultLoadControl(Allocator allocator1, Handler handler, EventListener eventlistener, int i, int j, float f, float f1) { // 0 0:aload_0 // 1 1:invokespecial #65 <Method void Object()> allocator = allocator1; // 2 4:aload_0 // 3 5:aload_1 // 4 6:putfield #67 <Field Allocator allocator> eventHandler = handler; // 5 9:aload_0 // 6 10:aload_2 // 7 11:putfield #69 <Field Handler eventHandler> eventListener = eventlistener; // 8 14:aload_0 // 9 15:aload_3 // 10 16:putfield #71 <Field DefaultLoadControl$EventListener eventListener> loaders = ((List) (new ArrayList())); // 11 19:aload_0 // 12 20:new #73 <Class ArrayList> // 13 23:dup // 14 24:invokespecial #74 <Method void ArrayList()> // 15 27:putfield #76 <Field List loaders> loaderStates = new HashMap(); // 16 30:aload_0 // 17 31:new #78 <Class HashMap> // 18 34:dup // 19 35:invokespecial #79 <Method void HashMap()> // 20 38:putfield #81 <Field HashMap loaderStates> lowWatermarkUs = (long)i * 1000L; // 21 41:aload_0 // 22 42:iload 4 // 23 44:i2l // 24 45:ldc2w #82 <Long 1000L> // 25 48:lmul // 26 49:putfield #85 <Field long lowWatermarkUs> highWatermarkUs = (long)j * 1000L; // 27 52:aload_0 // 28 53:iload 5 // 29 55:i2l // 30 56:ldc2w #82 <Long 1000L> // 31 59:lmul // 32 60:putfield #87 <Field long highWatermarkUs> lowBufferLoad = f; // 33 63:aload_0 // 34 64:fload 6 // 35 66:putfield #89 <Field float lowBufferLoad> highBufferLoad = f1; // 36 69:aload_0 // 37 70:fload 7 // 38 72:putfield #91 <Field float highBufferLoad> // 39 75:return } private int getBufferState(int i) { float f = (float)i / (float)targetBufferSize; // 0 0:iload_1 // 1 1:i2f // 2 2:aload_0 // 3 3:getfield #97 <Field int targetBufferSize> // 4 6:i2f // 5 7:fdiv // 6 8:fstore_2 if(f > highBufferLoad) //* 7 9:fload_2 //* 8 10:aload_0 //* 9 11:getfield #91 <Field float highBufferLoad> //* 10 14:fcmpl //* 11 15:ifle 20 return 0; // 12 18:iconst_0 // 13 19:ireturn return f >= lowBufferLoad ? 1 : 2; // 14 20:fload_2 // 15 21:aload_0 // 16 22:getfield #89 <Field float lowBufferLoad> // 17 25:fcmpg // 18 26:ifge 31 // 19 29:iconst_2 // 20 30:ireturn // 21 31:iconst_1 // 22 32:ireturn } private int getLoaderBufferState(long l, long l1) { if(l1 == -1L) //* 0 0:lload_3 //* 1 1:ldc2w #100 <Long -1L> //* 2 4:lcmp //* 3 5:ifne 10 return 0; // 4 8:iconst_0 // 5 9:ireturn l = l1 - l; // 6 10:lload_3 // 7 11:lload_1 // 8 12:lsub // 9 13:lstore_1 if(l > highWatermarkUs) //* 10 14:lload_1 //* 11 15:aload_0 //* 12 16:getfield #87 <Field long highWatermarkUs> //* 13 19:lcmp //* 14 20:ifle 25 return 0; // 15 23:iconst_0 // 16 24:ireturn return l >= lowWatermarkUs ? 1 : 2; // 17 25:lload_1 // 18 26:aload_0 // 19 27:getfield #85 <Field long lowWatermarkUs> // 20 30:lcmp // 21 31:ifge 36 // 22 34:iconst_2 // 23 35:ireturn // 24 36:iconst_1 // 25 37:ireturn } private void notifyLoadingChanged(final boolean loading) { Handler handler = eventHandler; // 0 0:aload_0 // 1 1:getfield #69 <Field Handler eventHandler> // 2 4:astore_2 if(handler != null && eventListener != null) //* 3 5:aload_2 //* 4 6:ifnull 30 //* 5 9:aload_0 //* 6 10:getfield #71 <Field DefaultLoadControl$EventListener eventListener> //* 7 13:ifnull 30 handler.post(new Runnable() { public void run() { eventListener.onLoadingChanged(loading); // 0 0:aload_0 // 1 1:getfield #19 <Field DefaultLoadControl this$0> // 2 4:invokestatic #30 <Method DefaultLoadControl$EventListener DefaultLoadControl.access$000(DefaultLoadControl)> // 3 7:aload_0 // 4 8:getfield #21 <Field boolean val$loading> // 5 11:invokeinterface #35 <Method void DefaultLoadControl$EventListener.onLoadingChanged(boolean)> // 6 16:return } final DefaultLoadControl this$0; final boolean val$loading; { this$0 = DefaultLoadControl.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #19 <Field DefaultLoadControl this$0> loading = flag; // 3 5:aload_0 // 4 6:iload_2 // 5 7:putfield #21 <Field boolean val$loading> super(); // 6 10:aload_0 // 7 11:invokespecial #24 <Method void Object()> // 8 14:return } } ); // 8 16:aload_2 // 9 17:new #8 <Class DefaultLoadControl$1> // 10 20:dup // 11 21:aload_0 // 12 22:iload_1 // 13 23:invokespecial #106 <Method void DefaultLoadControl$1(DefaultLoadControl, boolean)> // 14 26:invokevirtual #112 <Method boolean Handler.post(Runnable)> // 15 29:pop // 16 30:return } private void updateControlState() { int k = bufferState; // 0 0:aload_0 // 1 1:getfield #115 <Field int bufferState> // 2 4:istore_2 boolean flag3 = false; // 3 5:iconst_0 // 4 6:istore 6 boolean flag2 = false; // 5 8:iconst_0 // 6 9:istore 5 int i = ((int) (flag2)); // 7 11:iload 5 // 8 13:istore_1 boolean flag = ((boolean) (i)); // 9 14:iload_1 // 10 15:istore_3 boolean flag1 = ((boolean) (i)); // 11 16:iload_1 // 12 17:istore 4 i = ((int) (flag2)); // 13 19:iload 5 // 14 21:istore_1 do { int l = loaders.size(); // 15 22:aload_0 // 16 23:getfield #76 <Field List loaders> // 17 26:invokeinterface #121 <Method int List.size()> // 18 31:istore 5 boolean flag4 = true; // 19 33:iconst_1 // 20 34:istore 7 if(i >= l) break; // 21 36:iload_1 // 22 37:iload 5 // 23 39:icmpge 122 LoaderState loaderstate = (LoaderState)loaderStates.get(loaders.get(i)); // 24 42:aload_0 // 25 43:getfield #81 <Field HashMap loaderStates> // 26 46:aload_0 // 27 47:getfield #76 <Field List loaders> // 28 50:iload_1 // 29 51:invokeinterface #125 <Method Object List.get(int)> // 30 56:invokevirtual #128 <Method Object HashMap.get(Object)> // 31 59:checkcast #13 <Class DefaultLoadControl$LoaderState> // 32 62:astore 13 l = ((int) (flag1 | loaderstate.loading)); // 33 64:iload 4 // 34 66:aload 13 // 35 68:getfield #131 <Field boolean DefaultLoadControl$LoaderState.loading> // 36 71:ior // 37 72:istore 5 if(loaderstate.nextLoadPositionUs != -1L) //* 38 74:aload 13 //* 39 76:getfield #134 <Field long DefaultLoadControl$LoaderState.nextLoadPositionUs> //* 40 79:ldc2w #100 <Long -1L> //* 41 82:lcmp //* 42 83:ifeq 93 flag1 = flag4; // 43 86:iload 7 // 44 88:istore 4 else //* 45 90:goto 96 flag1 = false; // 46 93:iconst_0 // 47 94:istore 4 flag |= flag1; // 48 96:iload_3 // 49 97:iload 4 // 50 99:ior // 51 100:istore_3 k = Math.max(k, loaderstate.bufferState); // 52 101:iload_2 // 53 102:aload 13 // 54 104:getfield #135 <Field int DefaultLoadControl$LoaderState.bufferState> // 55 107:invokestatic #141 <Method int Math.max(int, int)> // 56 110:istore_2 i++; // 57 111:iload_1 // 58 112:iconst_1 // 59 113:iadd // 60 114:istore_1 flag1 = ((boolean) (l)); // 61 115:iload 5 // 62 117:istore 4 } while(true); // 63 119:goto 22 boolean flag5; if(!loaders.isEmpty() && (flag1 || flag) && (k == 2 || k == 1 && fillingBuffers)) //* 64 122:aload_0 //* 65 123:getfield #76 <Field List loaders> //* 66 126:invokeinterface #145 <Method boolean List.isEmpty()> //* 67 131:ifne 166 //* 68 134:iload 4 //* 69 136:ifne 143 //* 70 139:iload_3 //* 71 140:ifeq 166 //* 72 143:iload_2 //* 73 144:iconst_2 //* 74 145:icmpeq 160 //* 75 148:iload_2 //* 76 149:iconst_1 //* 77 150:icmpne 166 //* 78 153:aload_0 //* 79 154:getfield #147 <Field boolean fillingBuffers> //* 80 157:ifeq 166 flag5 = true; // 81 160:iconst_1 // 82 161:istore 8 else //* 83 163:goto 169 flag5 = false; // 84 166:iconst_0 // 85 167:istore 8 fillingBuffers = flag5; // 86 169:aload_0 // 87 170:iload 8 // 88 172:putfield #147 <Field boolean fillingBuffers> if(fillingBuffers && !streamingPrioritySet) //* 89 175:aload_0 //* 90 176:getfield #147 <Field boolean fillingBuffers> //* 91 179:ifeq 209 //* 92 182:aload_0 //* 93 183:getfield #149 <Field boolean streamingPrioritySet> //* 94 186:ifne 209 { NetworkLock.instance.add(0); // 95 189:getstatic #155 <Field NetworkLock NetworkLock.instance> // 96 192:iconst_0 // 97 193:invokevirtual #159 <Method void NetworkLock.add(int)> streamingPrioritySet = true; // 98 196:aload_0 // 99 197:iconst_1 // 100 198:putfield #149 <Field boolean streamingPrioritySet> notifyLoadingChanged(true); // 101 201:aload_0 // 102 202:iconst_1 // 103 203:invokespecial #161 <Method void notifyLoadingChanged(boolean)> } else //* 104 206:goto 245 if(!fillingBuffers && streamingPrioritySet && !flag1) //* 105 209:aload_0 //* 106 210:getfield #147 <Field boolean fillingBuffers> //* 107 213:ifne 245 //* 108 216:aload_0 //* 109 217:getfield #149 <Field boolean streamingPrioritySet> //* 110 220:ifeq 245 //* 111 223:iload 4 //* 112 225:ifne 245 { NetworkLock.instance.remove(0); // 113 228:getstatic #155 <Field NetworkLock NetworkLock.instance> // 114 231:iconst_0 // 115 232:invokevirtual #164 <Method void NetworkLock.remove(int)> streamingPrioritySet = false; // 116 235:aload_0 // 117 236:iconst_0 // 118 237:putfield #149 <Field boolean streamingPrioritySet> notifyLoadingChanged(false); // 119 240:aload_0 // 120 241:iconst_0 // 121 242:invokespecial #161 <Method void notifyLoadingChanged(boolean)> } maxLoadStartPositionUs = -1L; // 122 245:aload_0 // 123 246:ldc2w #100 <Long -1L> // 124 249:putfield #166 <Field long maxLoadStartPositionUs> if(fillingBuffers) //* 125 252:aload_0 //* 126 253:getfield #147 <Field boolean fillingBuffers> //* 127 256:ifeq 349 { for(int j = ((int) (flag3)); j < loaders.size(); j++) //* 128 259:iload 6 //* 129 261:istore_1 //* 130 262:iload_1 //* 131 263:aload_0 //* 132 264:getfield #76 <Field List loaders> //* 133 267:invokeinterface #121 <Method int List.size()> //* 134 272:icmpge 349 { Object obj = loaders.get(j); // 135 275:aload_0 // 136 276:getfield #76 <Field List loaders> // 137 279:iload_1 // 138 280:invokeinterface #125 <Method Object List.get(int)> // 139 285:astore 13 long l1 = ((LoaderState)loaderStates.get(obj)).nextLoadPositionUs; // 140 287:aload_0 // 141 288:getfield #81 <Field HashMap loaderStates> // 142 291:aload 13 // 143 293:invokevirtual #128 <Method Object HashMap.get(Object)> // 144 296:checkcast #13 <Class DefaultLoadControl$LoaderState> // 145 299:getfield #134 <Field long DefaultLoadControl$LoaderState.nextLoadPositionUs> // 146 302:lstore 9 if(l1 == -1L) continue; // 147 304:lload 9 // 148 306:ldc2w #100 <Long -1L> // 149 309:lcmp // 150 310:ifeq 342 long l2 = maxLoadStartPositionUs; // 151 313:aload_0 // 152 314:getfield #166 <Field long maxLoadStartPositionUs> // 153 317:lstore 11 if(l2 == -1L || l1 < l2) //* 154 319:lload 11 //* 155 321:ldc2w #100 <Long -1L> //* 156 324:lcmp //* 157 325:ifeq 336 //* 158 328:lload 9 //* 159 330:lload 11 //* 160 332:lcmp //* 161 333:ifge 342 maxLoadStartPositionUs = l1; // 162 336:aload_0 // 163 337:lload 9 // 164 339:putfield #166 <Field long maxLoadStartPositionUs> } // 165 342:iload_1 // 166 343:iconst_1 // 167 344:iadd // 168 345:istore_1 } //* 169 346:goto 262 // 170 349:return } public Allocator getAllocator() { return allocator; // 0 0:aload_0 // 1 1:getfield #67 <Field Allocator allocator> // 2 4:areturn } public void register(Object obj, int i) { loaders.add(obj); // 0 0:aload_0 // 1 1:getfield #76 <Field List loaders> // 2 4:aload_1 // 3 5:invokeinterface #173 <Method boolean List.add(Object)> // 4 10:pop loaderStates.put(obj, ((Object) (new LoaderState(i)))); // 5 11:aload_0 // 6 12:getfield #81 <Field HashMap loaderStates> // 7 15:aload_1 // 8 16:new #13 <Class DefaultLoadControl$LoaderState> // 9 19:dup // 10 20:iload_2 // 11 21:invokespecial #175 <Method void DefaultLoadControl$LoaderState(int)> // 12 24:invokevirtual #179 <Method Object HashMap.put(Object, Object)> // 13 27:pop targetBufferSize = targetBufferSize + i; // 14 28:aload_0 // 15 29:aload_0 // 16 30:getfield #97 <Field int targetBufferSize> // 17 33:iload_2 // 18 34:iadd // 19 35:putfield #97 <Field int targetBufferSize> // 20 38:return } public void trimAllocator() { allocator.trim(targetBufferSize); // 0 0:aload_0 // 1 1:getfield #67 <Field Allocator allocator> // 2 4:aload_0 // 3 5:getfield #97 <Field int targetBufferSize> // 4 8:invokeinterface #185 <Method void Allocator.trim(int)> // 5 13:return } public void unregister(Object obj) { loaders.remove(obj); // 0 0:aload_0 // 1 1:getfield #76 <Field List loaders> // 2 4:aload_1 // 3 5:invokeinterface #189 <Method boolean List.remove(Object)> // 4 10:pop obj = ((Object) ((LoaderState)loaderStates.remove(obj))); // 5 11:aload_0 // 6 12:getfield #81 <Field HashMap loaderStates> // 7 15:aload_1 // 8 16:invokevirtual #191 <Method Object HashMap.remove(Object)> // 9 19:checkcast #13 <Class DefaultLoadControl$LoaderState> // 10 22:astore_1 targetBufferSize = targetBufferSize - ((LoaderState) (obj)).bufferSizeContribution; // 11 23:aload_0 // 12 24:aload_0 // 13 25:getfield #97 <Field int targetBufferSize> // 14 28:aload_1 // 15 29:getfield #194 <Field int DefaultLoadControl$LoaderState.bufferSizeContribution> // 16 32:isub // 17 33:putfield #97 <Field int targetBufferSize> updateControlState(); // 18 36:aload_0 // 19 37:invokespecial #196 <Method void updateControlState()> // 20 40:return } public boolean update(Object obj, long l, long l1, boolean flag) { int j = getLoaderBufferState(l, l1); // 0 0:aload_0 // 1 1:lload_2 // 2 2:lload 4 // 3 4:invokespecial #200 <Method int getLoaderBufferState(long, long)> // 4 7:istore 8 obj = ((Object) ((LoaderState)loaderStates.get(obj))); // 5 9:aload_0 // 6 10:getfield #81 <Field HashMap loaderStates> // 7 13:aload_1 // 8 14:invokevirtual #128 <Method Object HashMap.get(Object)> // 9 17:checkcast #13 <Class DefaultLoadControl$LoaderState> // 10 20:astore_1 int i = ((LoaderState) (obj)).bufferState; // 11 21:aload_1 // 12 22:getfield #135 <Field int DefaultLoadControl$LoaderState.bufferState> // 13 25:istore 7 boolean flag3 = false; // 14 27:iconst_0 // 15 28:istore 10 boolean flag1; if(i == j && ((LoaderState) (obj)).nextLoadPositionUs == l1 && ((LoaderState) (obj)).loading == flag) //* 16 30:iload 7 //* 17 32:iload 8 //* 18 34:icmpne 65 //* 19 37:aload_1 //* 20 38:getfield #134 <Field long DefaultLoadControl$LoaderState.nextLoadPositionUs> //* 21 41:lload 4 //* 22 43:lcmp //* 23 44:ifne 65 //* 24 47:aload_1 //* 25 48:getfield #131 <Field boolean DefaultLoadControl$LoaderState.loading> //* 26 51:iload 6 //* 27 53:icmpeq 59 //* 28 56:goto 65 flag1 = false; // 29 59:iconst_0 // 30 60:istore 7 else //* 31 62:goto 68 flag1 = true; // 32 65:iconst_1 // 33 66:istore 7 if(flag1) //* 34 68:iload 7 //* 35 70:ifeq 91 { obj.bufferState = j; // 36 73:aload_1 // 37 74:iload 8 // 38 76:putfield #135 <Field int DefaultLoadControl$LoaderState.bufferState> obj.nextLoadPositionUs = l1; // 39 79:aload_1 // 40 80:lload 4 // 41 82:putfield #134 <Field long DefaultLoadControl$LoaderState.nextLoadPositionUs> obj.loading = flag; // 42 85:aload_1 // 43 86:iload 6 // 44 88:putfield #131 <Field boolean DefaultLoadControl$LoaderState.loading> } int k = getBufferState(allocator.getTotalBytesAllocated()); // 45 91:aload_0 // 46 92:aload_0 // 47 93:getfield #67 <Field Allocator allocator> // 48 96:invokeinterface #203 <Method int Allocator.getTotalBytesAllocated()> // 49 101:invokespecial #205 <Method int getBufferState(int)> // 50 104:istore 9 boolean flag2; if(bufferState != k) //* 51 106:aload_0 //* 52 107:getfield #115 <Field int bufferState> //* 53 110:iload 9 //* 54 112:icmpeq 121 flag2 = true; // 55 115:iconst_1 // 56 116:istore 8 else //* 57 118:goto 124 flag2 = false; // 58 121:iconst_0 // 59 122:istore 8 if(flag2) //* 60 124:iload 8 //* 61 126:ifeq 135 bufferState = k; // 62 129:aload_0 // 63 130:iload 9 // 64 132:putfield #115 <Field int bufferState> if(flag1 || flag2) //* 65 135:iload 7 //* 66 137:ifne 145 //* 67 140:iload 8 //* 68 142:ifeq 149 updateControlState(); // 69 145:aload_0 // 70 146:invokespecial #196 <Method void updateControlState()> flag = flag3; // 71 149:iload 10 // 72 151:istore 6 if(l1 != -1L) //* 73 153:lload 4 //* 74 155:ldc2w #100 <Long -1L> //* 75 158:lcmp //* 76 159:ifeq 179 { flag = flag3; // 77 162:iload 10 // 78 164:istore 6 if(l1 <= maxLoadStartPositionUs) //* 79 166:lload 4 //* 80 168:aload_0 //* 81 169:getfield #166 <Field long maxLoadStartPositionUs> //* 82 172:lcmp //* 83 173:ifgt 179 flag = true; // 84 176:iconst_1 // 85 177:istore 6 } return flag; // 86 179:iload 6 // 87 181:ireturn } private static final int ABOVE_HIGH_WATERMARK = 0; private static final int BELOW_LOW_WATERMARK = 2; private static final int BETWEEN_WATERMARKS = 1; public static final float DEFAULT_HIGH_BUFFER_LOAD = 0.8F; public static final int DEFAULT_HIGH_WATERMARK_MS = 30000; public static final float DEFAULT_LOW_BUFFER_LOAD = 0.2F; public static final int DEFAULT_LOW_WATERMARK_MS = 15000; private final Allocator allocator; private int bufferState; private final Handler eventHandler; private final EventListener eventListener; private boolean fillingBuffers; private final float highBufferLoad; private final long highWatermarkUs; private final HashMap loaderStates; private final List loaders; private final float lowBufferLoad; private final long lowWatermarkUs; private long maxLoadStartPositionUs; private boolean streamingPrioritySet; private int targetBufferSize; /* static EventListener access$000(DefaultLoadControl defaultloadcontrol) { return defaultloadcontrol.eventListener; // 0 0:aload_0 // 1 1:getfield #71 <Field DefaultLoadControl$EventListener eventListener> // 2 4:areturn } */ }
[ "silenta237@gmail.com" ]
silenta237@gmail.com
fe72984ad07ce6a3652c47953bc8405e8ad0995e
f7a6b16a7e16186ff94a9a64e1057dbd55bd2291
/src/test/java/com/Rakesh/AnuragAppCartApplicationTests.java
4499d8b88de3ef9ce451610ad54308e54d93a0e2
[]
no_license
RakeshRoshan19/ISDesignCart
a58d5f052cc45369f7f218b37a13ec1d5742016f
37f7b7f90e737d38e3478f0877c3c43b5a2d378d
refs/heads/master
2022-04-25T07:58:52.084567
2020-04-28T02:53:05
2020-04-28T02:53:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package com.Rakesh; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class AnuragAppCartApplicationTests { @Test void contextLoads() { } }
[ "rakeshroshan19@gmail.com" ]
rakeshroshan19@gmail.com
53fef312c3d63837ce2598de2c8a8f0be435f86d
1e500def85e8e2a51cd5c13ceee7a534167e19d1
/data-acces/UD4/EjercicioHibernate/ad.04.hibernate.jose/src/hql/Ejercicio4.java
1a45b7fec25fcc81df2f5175ff45f490e26a70e6
[]
no_license
sharco-code/2DAM
27dd65563b160138a979ee5fc4d6035c455cb0ab
49e28125445d55072ff0703a34b8ee9bb9ea5169
refs/heads/master
2023-01-12T22:43:43.539217
2020-03-02T10:31:14
2020-03-02T10:31:14
215,472,459
0
1
null
2023-01-07T13:35:33
2019-10-16T06:22:57
Java
UTF-8
Java
false
false
934
java
package hql; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.query.Query; import hibernate.UtilesHibernate; import pojos.Ciclista; public class Ejercicio4 { public static void main(String[] args) { SessionFactory factory = UtilesHibernate.getSessionfactory(); Session session = factory.getCurrentSession(); session.beginTransaction(); System.out.println("4. Todos los ciclistas del equipo \"TVM\". \n"); Query q = session.createQuery("SELECT e FROM Ciclista e WHERE e.equipo.nomeq LIKE 'TVM'"); List<Ciclista> lst = (List<Ciclista>) q.list(); if(lst == null || lst.isEmpty()) { System.out.println("No hay ciclistas de TVM"); return; } lst.forEach(e -> { System.out.println("Dorsal: "+e.getDorsal()); System.out.println("Nombre: "+e.getNombre()); System.out.println("Nacimiento: "+e.getNacimiento()+"\n"); }); } }
[ "38721575+sharco-code@users.noreply.github.com" ]
38721575+sharco-code@users.noreply.github.com
ab793730085b934c68bf20f640c889e7fd8f3955
a863997277da3464488718637c4b387e0bf3e669
/src/main/java/com/lbi/client/GreetingService.java
90020a254fb6152c94db543af80945198bf4c121
[]
no_license
jpasski/GWT
8022e4a70468e03a4733430b152c56c59e89a011
af8fecb66567e45ce34ff0baae86389fded97471
refs/heads/master
2022-11-27T04:55:58.839570
2013-01-28T21:21:12
2013-01-28T21:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.lbi.client; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; /** * The client side stub for the RPC service. */ @RemoteServiceRelativePath("greet") public interface GreetingService extends RemoteService { String greetServer(String name) throws IllegalArgumentException; }
[ "uttrasey@gmail.com" ]
uttrasey@gmail.com
77726de6f20e0dab20b725fd47bf46a6c4c8608d
9c42651c20d4caf04e0b580e7cf6539213c2dab0
/vap-consumer/src/main/java/com/vrv/vap/consumer/swagger/SwaggerProperties.java
042959980e9afbb148abbee568f6acee52dfc6f7
[]
no_license
ljh205sy/vap-redis-test
9342a2ccfd3d7d5d03d5061877207791d7f428ca
f373d4ffa7779d0516a573d83ccd849c080ff64c
refs/heads/master
2022-07-22T13:36:43.636552
2020-01-08T08:29:28
2020-01-08T08:29:28
232,495,253
0
0
null
2022-07-07T23:01:03
2020-01-08T06:33:27
Java
UTF-8
Java
false
false
830
java
package com.vrv.vap.consumer.swagger; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; /** * @author wh1107066 */ @Configuration @ConfigurationProperties(prefix = "springfox") public class SwaggerProperties { private String name; private String title; private String description; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "liujinhui@vrvmail.com.cn" ]
liujinhui@vrvmail.com.cn
422e79b341909fef3d74d3daf112868041fe44e8
36f4b7ff76bd4dfa7278cddb71f365e658f698a2
/sixun-test/shirodemo/src/main/java/hhz/shirodemo/shiro/ShiroConfiguration.java
d1e370ff950052d975487221b5af6d1b96a2e01d
[]
no_license
huanghezhen/study_code
7afcdab37c3ff748dfefe79e1780038d54051f9b
ff4bbe3171d8286560a4d11ccb6aae58fc04569d
refs/heads/master
2022-12-25T08:54:57.677048
2020-01-10T08:06:42
2020-01-10T08:06:42
206,271,176
1
0
null
2022-12-14T20:44:04
2019-09-04T08:33:49
JavaScript
UTF-8
Java
false
false
1,245
java
package hhz.shirodemo.shiro; import org.apache.shiro.spring.web.ShiroFilterFactoryBean; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.LinkedHashMap; import java.util.Map; @Configuration public class ShiroConfiguration { @Bean public ShiroFilterFactoryBean shiroFilterFactoryBean(DefaultWebSecurityManager defaultWebSecurityManager) { ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); shiroFilter.setSecurityManager(defaultWebSecurityManager); // 添加内置过滤器 Map<String, String> filterMap = new LinkedHashMap<>(); filterMap.put("/**", "authc"); shiroFilter.setFilterChainDefinitionMap(filterMap); return shiroFilter; } @Bean public DefaultWebSecurityManager defaultWebSecurityManager(ShiroRealm shiroRealm) { DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager(); defaultWebSecurityManager.setRealm(shiroRealm); return defaultWebSecurityManager; } @Bean public ShiroRealm userRealm() { return new ShiroRealm(); } }
[ "827283849@qq.com" ]
827283849@qq.com
d5bf7ee785cce6e7b03ec163743bcc2606cc0976
44b8cc05b3d39754177174b71df32e3edcaa5397
/pinot-common/src/main/java/com/linkedin/pinot/common/utils/ServiceStatus.java
ae59812113df7e6002915983bbd25f0e31202c33
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
BillTheBest/pinot
f32a5bf03cff84bac7ab1e77992127d21f2f5d3e
63962422e7697436686cb4c79a30b0726afba4c2
refs/heads/master
2021-01-11T16:37:55.192191
2017-01-26T02:02:53
2017-01-26T02:02:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,376
java
/** * Copyright (C) 2014-2016 LinkedIn Corp. (pinot-core@linkedin.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.linkedin.pinot.common.utils; import java.util.ArrayList; import java.util.List; import org.apache.helix.HelixAdmin; import org.apache.helix.model.ExternalView; import org.apache.helix.model.IdealState; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Utility class to obtain the status of the Pinot instance running in this JVM. */ public class ServiceStatus { private static final Logger LOGGER = LoggerFactory.getLogger(ServiceStatus.class); public enum Status { STARTING, GOOD, BAD } /** * Callback that returns the status of the service. */ public interface ServiceStatusCallback { Status getServiceStatus(); } private static ServiceStatusCallback serviceStatusCallback = null; public static void setServiceStatusCallback(ServiceStatusCallback serviceStatusCallback) { ServiceStatus.serviceStatusCallback = serviceStatusCallback; } public static Status getServiceStatus() { if (serviceStatusCallback == null) { return Status.STARTING; } else { try { return serviceStatusCallback.getServiceStatus(); } catch (Exception e) { LOGGER.warn("Caught exception while reading the service status", e); return Status.BAD; } } } /** * Service status callback that reports starting until all resources relevant to this instance have a matching * external view and ideal state. This callback considers the ERROR state in the external view to be equivalent to the * ideal state value. */ public static class IdealStateAndExternalViewMatchServiceStatusCallback implements ServiceStatusCallback { private HelixAdmin _helixAdmin; private String _clusterName; private String _instanceName; private List<String> _resourcesToMonitor; private boolean _finishedStartingUp = false; public IdealStateAndExternalViewMatchServiceStatusCallback(HelixAdmin helixAdmin, String clusterName, String instanceName) { _helixAdmin = helixAdmin; _clusterName = clusterName; _instanceName = instanceName; // Make a list of the resources to monitor _resourcesToMonitor = new ArrayList<>(); for (String resource : _helixAdmin.getResourcesInCluster(_clusterName)) { final IdealState idealState = _helixAdmin.getResourceIdealState(_clusterName, resource); for (String partitionInResource : idealState.getPartitionSet()) { if (idealState.getInstanceSet(partitionInResource).contains(_instanceName)) { _resourcesToMonitor.add(resource); break; } } } LOGGER.info("Monitoring resources {} for start up of instance {}", _resourcesToMonitor, _instanceName); } public IdealStateAndExternalViewMatchServiceStatusCallback(HelixAdmin helixAdmin, String clusterName, String instanceName, List<String> resourcesToMonitor) { _helixAdmin = helixAdmin; _clusterName = clusterName; _instanceName = instanceName; _resourcesToMonitor = resourcesToMonitor; LOGGER.info("Monitoring resources {} for start up of instance {}", _resourcesToMonitor, _instanceName); } @Override public Status getServiceStatus() { if(_finishedStartingUp) { return Status.GOOD; } for (String resourceToMonitor : _resourcesToMonitor) { IdealState idealState = _helixAdmin.getResourceIdealState(_clusterName, resourceToMonitor); ExternalView externalView = _helixAdmin.getResourceExternalView(_clusterName, resourceToMonitor); if (idealState == null || externalView == null) { return Status.STARTING; } for (String partition : idealState.getPartitionSet()) { String idealStateStatus = idealState.getInstanceStateMap(partition).get(_instanceName); String externalViewStatus = externalView.getStateMap(partition).get(_instanceName); // Skip this partition if it is not assigned to this instance if (idealStateStatus == null) { continue; } // If this instance state is not in the external view, then it hasn't finished starting up if (externalViewStatus == null) { return Status.STARTING; } // If the instance state is not ERROR and is not the same as what's expected from the ideal state, then it // hasn't finished starting up if (!externalViewStatus.equals("ERROR") && !externalViewStatus.equals(idealStateStatus)) { return Status.STARTING; } } } LOGGER.info("Instance {} has finished starting up", _instanceName); _finishedStartingUp = true; return Status.GOOD; } } }
[ "jeanfrancois.im@gmail.com" ]
jeanfrancois.im@gmail.com
6c6b2648cbde41b40995829379c25135f645ea8a
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/MOCKITO-7b-4-22-FEMO-WeightedSum:TestLen:CallDiversity/org/mockito/internal/stubbing/defaultanswers/ReturnsDeepStubs_ESTest_scaffolding.java
89d67b0246b45b2e00681b9b3b59b8d13b83fe84
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
465
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Apr 04 10:58:23 UTC 2020 */ package org.mockito.internal.stubbing.defaultanswers; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class ReturnsDeepStubs_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
26ffcc63cb90ce1aa25e2186763be657f639172b
eed4f4979ce340e341250ae09a8067ea92697543
/src/ao/protocol/packets/bi/PrivateChannelInvitePacket.java
fa8c7a0ffa2d2d7bb1e8c3b8fb91c0ee49441b3c
[]
no_license
bitnykk/anarchytalk
06d0b4195d04ba9adb4a2a73a897393e0215e751
96d2b925236e2ba353e6cb330f87d37fda916ce6
refs/heads/master
2023-04-13T20:13:34.263852
2021-04-19T13:49:56
2021-04-19T13:49:56
259,027,723
0
1
null
2020-04-26T12:42:37
2020-04-26T12:42:36
null
UTF-8
Java
false
false
2,745
java
/* * PrivateChannelInvitePacket.java * * Created on July 11, 2010, 10:30 PM ************************************************************************* * Copyright 2010 Kevin Kendall * * 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 ao.protocol.packets.bi; import ao.protocol.packets.*; import ao.protocol.packets.utils.PacketParser; import ao.protocol.packets.utils.PacketSerializer; import java.io.IOException; public class PrivateChannelInvitePacket extends Packet { public static final short TYPE = 50; private final byte[] m_data; private final int m_id; private final Direction m_direction; public PrivateChannelInvitePacket(int id) { m_direction = Direction.OUT; m_id = id; // Serialize the packet PacketSerializer serializer = new PacketSerializer( 4 + 4 ); serializer.write(m_id); m_data = serializer.getResult(); serializer.close(); } // end PrivateChannelInvitePacket() public PrivateChannelInvitePacket(byte[] data, Direction d) throws MalformedPacketException { if (data == null) { throw new NullPointerException("No binary data was passed."); } try { m_data = data; m_direction = d; PacketParser parser = new PacketParser(data); m_id = parser.parseInt(); parser.close(); } catch (IOException e) { throw new MalformedPacketException( "The packet could not be parsed.", e, new UnparsablePacket(TYPE, data, d) ); } // end catch } // end PrivateChannelInvitePacket() public int getGroupID(){ return m_id; } /** Always returns {@value #TYPE} */ public short getType() { return TYPE; } public byte[] getData() { return m_data; } /** Returns whether this message was recieved or sent by the client */ public Direction getDirection() { return m_direction; } @Override public String toString() { String result = "["+TYPE+"]PrivateChannelInvitePacket: "; result += Integer.toHexString( m_id ); return result; } // end toString() } // end class PrivateChannelInvitePacket
[ "christofer.engel@gmail.com@00ac6120-5df9-160a-9ebf-fd4304b4a24b" ]
christofer.engel@gmail.com@00ac6120-5df9-160a-9ebf-fd4304b4a24b
cce55d1b51c1493baa50357021a228e081b818d4
b74bf7b76069884e6caadba46dded8dee2bd1627
/src/main/java/note/spring/dao/UserDao.java
b25b6320a693b2394022a7fd57ef8fc3763f7dcb
[]
no_license
jiaopenglin/spring
d428ef1aca5bf52c3713b3a3487bd4af267326ac
51eda5c79bc5adb8cf80ab402a76318ea0c7c735
refs/heads/master
2023-03-02T04:04:12.359240
2021-02-09T03:36:20
2021-02-09T03:36:20
327,811,291
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package note.spring.dao; import note.spring.model.User; import java.util.List; public interface UserDao { public User getUserById(int id); public List<User> getUsers(); public int updateUser(User user); public int addUser(User user); public int addUsers(List<User> user); public Long count(); public int delete(int id); }
[ "591259813@qq.com" ]
591259813@qq.com
272e9408eebb4031998040ba4168cc54c007bd19
aa3c26010a990efd818a973428358f69eb890cfb
/vitamio/src/io/vov/vitamio/Vitamio.java
a9c9221bafffa9f313943f676dd4ea40bcdb25f5
[]
no_license
SkyCoders007/KryKeyApp
d84c81c8c67bf02c80a47e07a865db5c30d88f08
1a0f1692266f0d76e9ab20962715537a2bcff696
refs/heads/master
2020-03-16T19:01:30.054953
2018-05-10T12:31:53
2018-05-10T12:31:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,459
java
/* * Copyright (C) 2013 YIXIA.COM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.vov.vitamio; import android.content.Context; import io.vov.vitamio.utils.ContextUtils; /** * Inspect this class before using any other Vitamio classes. * <p/> * Don't modify this class, or the full Vitamio library may be broken. */ public class Vitamio { private static String vitamioPackage; private static String vitamioLibraryPath; /** * Check if Vitamio is initialized at this device * * @param ctx Android Context * @return true if the Vitamio has been initialized. */ public static boolean isInitialized(Context ctx) { vitamioPackage = ctx.getPackageName(); vitamioLibraryPath = ContextUtils.getDataDir(ctx) + "lib/"; return true; } public static String getVitamioPackage() { return vitamioPackage; } public static final String getLibraryPath() { return vitamioLibraryPath; } }
[ "soniakash94@gmail.com" ]
soniakash94@gmail.com
37ebe237b259efa31a9b8844dfb228bb558164f7
a2fef413f65434f9084bd602be7a4086f0e894c1
/airLinex/src/net/JavaNet.java
2c07b733c8fbcc87bbead0b07019d5e4e8253c7f
[]
no_license
ewrfedf/Android_public
073925a8eaab0c3a257e7a27c7d749bf0e71c467
0fa78690848b1f596aeef3fa67cef1826509954c
refs/heads/master
2020-09-20T05:48:47.495787
2019-09-12T00:33:30
2019-09-12T00:33:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,752
java
package net; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketAddress; import java.net.UnknownHostException; public class JavaNet { //1:客户端程序 /** * 使用Sender类来代表客户端程序, * * @author ccna_zhang * */ public class Sender { public void main(String[] args) { String msg = "Hello, World"; byte[] buf = msg.getBytes(); try { InetAddress address = InetAddress.getByName("192.168.1.80"); //服务器地址 int port = 8080; //服务器的端口号 //创建发送方的数据报信息 DatagramPacket dataGramPacket = new DatagramPacket(buf, buf.length, address, port); DatagramSocket socket = new DatagramSocket(); //创建套接字 socket.send(dataGramPacket); //通过套接字发送数据 //接收服务器反馈数据 byte[] backbuf = new byte[1024]; DatagramPacket backPacket = new DatagramPacket(backbuf, backbuf.length); socket.receive(backPacket); //接收返回数据 String backMsg = new String(backbuf, 0, backPacket.getLength()); System.out.println("服务器返回的数据为:" + backMsg); socket.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } //2:服务器端程序 /** * 服务器端程序 * * @author ccna_zhang * */ public class Receiver { public void main(String[] args) { try { InetAddress address = InetAddress.getLocalHost(); int port = 8080; //创建DatagramSocket对象 DatagramSocket socket = new DatagramSocket(port, address); byte[] buf = new byte[1024]; //定义byte数组 DatagramPacket packet = new DatagramPacket(buf, buf.length); //创建DatagramPacket对象 socket.receive(packet); //通过套接字接收数据 String getMsg = new String(buf, 0, packet.getLength()); System.out.println("客户端发送的数据为:" + getMsg); //从服务器返回给客户端数据 InetAddress clientAddress = packet.getAddress(); //获得客户端的IP地址 int clientPort = packet.getPort(); //获得客户端的端口号 SocketAddress sendAddress = packet.getSocketAddress(); String feedback = "Received"; byte[] backbuf = feedback.getBytes(); DatagramPacket sendPacket = new DatagramPacket(backbuf, backbuf.length, sendAddress); //封装返回给客户端的数据 socket.send(sendPacket); //通过套接字反馈服务器数据 socket.close(); //关闭套接字 } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "wetnt@sina.com" ]
wetnt@sina.com
621d5573551a6a5442167ed558e6aa5ca28ff193
9dfbb51bdca7b9bf5b17affa4ea48a2af7955b3d
/inventory-service/src/main/java/com/yikejian/inventory/api/v1/dto/ResponseInventory.java
dd32b700a935deb7969a162fb62aff3d6b25ee7c
[]
no_license
hedgehog-zowie/yikejian-parent
a9e2a0373b72be025a3af5f3bc6060f69fcd7130
cd6f710f70f94312de09ce7c0eef35c877c221c6
refs/heads/master
2021-09-06T21:02:10.303978
2018-02-11T10:19:42
2018-02-11T10:19:42
114,800,578
1
2
null
null
null
null
UTF-8
Java
false
false
954
java
package com.yikejian.inventory.api.v1.dto; import com.yikejian.inventory.domain.inventory.Inventory; import java.util.List; /** * <code>ResponseRole</code>. * ${DESCRIPTION} * * @author zweig * @version: 1.0-SNAPSHOT * date: 2018/1/15 11:28 */ public class ResponseInventory { private List<Inventory> list; private Pagination pagination; public ResponseInventory() { } public ResponseInventory(List<Inventory> list) { this.list = list; } public ResponseInventory(List<Inventory> list, Pagination pagination) { this.list = list; this.pagination = pagination; } public List<Inventory> getList() { return list; } public void setList(List<Inventory> list) { this.list = list; } public Pagination getPagination() { return pagination; } public void setPagination(Pagination pagination) { this.pagination = pagination; } }
[ "hedgehog.zowie@gmail.com" ]
hedgehog.zowie@gmail.com
0743841411be0d8972d841d5c8fef8e026d69ca2
8c3c8c59f3120a2fdb0c1837fef43600d22863b7
/goviza2/goviza2-ejb/src/java/be/EstadoLetrasPagoCanje.java
62df6f50bedd6b662b25dabc67f93ce9af98b9ca
[]
no_license
ponicito2015/govizamix
5925e69f0e5534180e64621bbcd5e15773f733fa
4a01fa989faadc2c292415ac07b4cc691b76ecc4
refs/heads/master
2016-09-08T05:09:42.282398
2015-03-05T16:33:47
2015-03-05T16:33:47
31,720,891
1
0
null
null
null
null
UTF-8
Java
false
false
3,699
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package be; import java.io.Serializable; import java.util.List; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; /** * * @author argos */ @Entity @Table(name = "estado_letras_pago_canje") @NamedQueries({ @NamedQuery(name = "EstadoLetrasPagoCanje.findAll", query = "SELECT e FROM EstadoLetrasPagoCanje e"), @NamedQuery(name = "EstadoLetrasPagoCanje.findByIdEstadoLetrasPagoCanje", query = "SELECT e FROM EstadoLetrasPagoCanje e WHERE e.idEstadoLetrasPagoCanje = :idEstadoLetrasPagoCanje"), @NamedQuery(name = "EstadoLetrasPagoCanje.findByNombre", query = "SELECT e FROM EstadoLetrasPagoCanje e WHERE e.nombre = :nombre"), @NamedQuery(name = "EstadoLetrasPagoCanje.findByDescripcion", query = "SELECT e FROM EstadoLetrasPagoCanje e WHERE e.descripcion = :descripcion")}) public class EstadoLetrasPagoCanje implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "ID_ESTADO_LETRAS_PAGO_CANJE") private Integer idEstadoLetrasPagoCanje; @Column(name = "NOMBRE") private String nombre; @Column(name = "DESCRIPCION") private String descripcion; @OneToMany(mappedBy = "estadoLetrasPagoCanje", fetch = FetchType.EAGER) private List<LetrasPagoCanje> letrasPagoCanjeList; public EstadoLetrasPagoCanje() { } public EstadoLetrasPagoCanje(Integer idEstadoLetrasPagoCanje) { this.idEstadoLetrasPagoCanje = idEstadoLetrasPagoCanje; } public Integer getIdEstadoLetrasPagoCanje() { return idEstadoLetrasPagoCanje; } public void setIdEstadoLetrasPagoCanje(Integer idEstadoLetrasPagoCanje) { this.idEstadoLetrasPagoCanje = idEstadoLetrasPagoCanje; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public List<LetrasPagoCanje> getLetrasPagoCanjeList() { return letrasPagoCanjeList; } public void setLetrasPagoCanjeList(List<LetrasPagoCanje> letrasPagoCanjeList) { this.letrasPagoCanjeList = letrasPagoCanjeList; } @Override public int hashCode() { int hash = 0; hash += (idEstadoLetrasPagoCanje != null ? idEstadoLetrasPagoCanje.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof EstadoLetrasPagoCanje)) { return false; } EstadoLetrasPagoCanje other = (EstadoLetrasPagoCanje) object; if ((this.idEstadoLetrasPagoCanje == null && other.idEstadoLetrasPagoCanje != null) || (this.idEstadoLetrasPagoCanje != null && !this.idEstadoLetrasPagoCanje.equals(other.idEstadoLetrasPagoCanje))) { return false; } return true; } @Override public String toString() { return "be.EstadoLetrasPagoCanje[idEstadoLetrasPagoCanje=" + idEstadoLetrasPagoCanje + "]"; } }
[ "Anthony@Anthonyrm" ]
Anthony@Anthonyrm
965d013c4fab5632eb4c58246c1caeabcfdcd310
2622649b90a760e27a6ede91737f853a15cfe4a2
/src/main/java/com/megagao/production/ssm/controller/scheduling/CustomController.java
3b04f263e577cfafcbeadf395856b37f73b3be1e
[]
no_license
xiaokeai-coder/production_ssm-1
13377764083f682c03421e4843bff9d27e37f313
62e007f734c43a906fd7049f10f8f9430e6febde
refs/heads/master
2022-07-19T13:23:57.963438
2020-05-27T03:20:46
2020-05-27T03:20:46
267,212,357
1
0
null
2020-05-27T03:34:24
2020-05-27T03:34:23
null
UTF-8
Java
false
false
4,693
java
package com.megagao.production.ssm.controller.scheduling; import java.util.List; import javax.validation.Valid; import com.megagao.production.ssm.domain.Custom; import com.megagao.production.ssm.domain.customize.CustomResult; import com.megagao.production.ssm.domain.customize.EUDataGridResult; import com.megagao.production.ssm.service.CustomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/custom") public class CustomController { @Autowired private CustomService customService; @RequestMapping("/get/{customId}") @ResponseBody public Custom getItemById(@PathVariable String customId) throws Exception{ Custom custom = customService.get(customId); return custom; } @RequestMapping("/find") public String find() throws Exception{ return "custom_list"; } @RequestMapping("/add") public String add() { return "custom_add"; } @RequestMapping("/edit") public String edit() throws Exception{ return "custom_edit"; } @RequestMapping("/get_data") @ResponseBody public List<Custom> getData() throws Exception{ List<Custom> list = customService.find(); return list; } @RequestMapping("/list") @ResponseBody public EUDataGridResult getItemList(Integer page, Integer rows, Custom custom) throws Exception{ EUDataGridResult result = customService.getList(page, rows, custom); return result; } @RequestMapping(value="/insert", method=RequestMethod.POST) @ResponseBody private CustomResult insert(@Valid Custom custom, BindingResult bindingResult) throws Exception { CustomResult result; if(bindingResult.hasErrors()){ FieldError fieldError = bindingResult.getFieldError(); return CustomResult.build(100, fieldError.getDefaultMessage()); } if(customService.get(custom.getCustomId()) != null){ result = new CustomResult(0, "该客户编号已经存在,请更换客户编号!", null); }else{ result = customService.insert(custom); } return result; } @RequestMapping(value="/update") @ResponseBody private CustomResult update(@Valid Custom custom, BindingResult bindingResult) throws Exception { if(bindingResult.hasErrors()){ FieldError fieldError = bindingResult.getFieldError(); return CustomResult.build(100, fieldError.getDefaultMessage()); } return customService.update(custom); } @RequestMapping(value="/update_all") @ResponseBody private CustomResult updateAll(@Valid Custom custom, BindingResult bindingResult) throws Exception { if(bindingResult.hasErrors()){ FieldError fieldError = bindingResult.getFieldError(); return CustomResult.build(100, fieldError.getDefaultMessage()); } return customService.updateAll(custom); } @RequestMapping(value="/update_note") @ResponseBody private CustomResult updateNote(@Valid Custom custom, BindingResult bindingResult) throws Exception { if(bindingResult.hasErrors()){ FieldError fieldError = bindingResult.getFieldError(); return CustomResult.build(100, fieldError.getDefaultMessage()); } return customService.updateNote(custom); } @RequestMapping(value="/delete") @ResponseBody private CustomResult delete(String id) throws Exception { CustomResult result = customService.delete(id); return result; } @RequestMapping(value="/delete_batch") @ResponseBody private CustomResult deleteBatch(String[] ids) throws Exception { CustomResult result = customService.deleteBatch(ids); return result; } @RequestMapping(value="/change_status") @ResponseBody public CustomResult changeStatus(String[] ids) throws Exception{ CustomResult result = customService.changeStatus(ids); return result; } //根据客户id查找 @RequestMapping("/search_custom_by_customId") @ResponseBody public EUDataGridResult searchCustomByCustomId(Integer page, Integer rows, String searchValue) throws Exception{ EUDataGridResult result = customService.searchCustomByCustomId(page, rows, searchValue); return result; } //根据客户名查找 @RequestMapping("/search_custom_by_customName") @ResponseBody public EUDataGridResult searchCustomByCustomName(Integer page, Integer rows, String searchValue) throws Exception{ EUDataGridResult result = customService.searchCustomByCustomName(page, rows, searchValue); return result; } }
[ "1210503603@qq.com" ]
1210503603@qq.com
9297fca95083864ca27cb9eb95f0ac2fc9c9a232
4e504aeb8c649fca077459c590dbc13b3bacc55f
/api/src/main/java/org/openmrs/module/xforms/DanielLuhnIdentifierValidator.java
f4ffffbe9a5b24dc68a56b998dc03b65a1e5839a
[]
no_license
zestyping/openmrs-module-xforms
de53f5a93ee6b5670c7176cc04b8a757a245301e
ac20ef45fc75368fd01df9412dab90fb61b5995b
refs/heads/master
2020-12-11T08:00:55.177274
2015-03-24T23:04:29
2015-03-24T23:04:29
33,567,282
0
0
null
2015-04-07T20:44:45
2015-04-07T20:44:45
null
UTF-8
Java
false
false
318
java
package org.openmrs.module.xforms; import org.openmrs.patient.impl.LuhnIdentifierValidator; public class DanielLuhnIdentifierValidator extends LuhnIdentifierValidator { /** * @see org.openmrs.patient.IdentifierValidator#getName() */ @Override public String getName() { return "Testing Kayiwa Daniel"; } }
[ "dkayiwa@openmrs.org" ]
dkayiwa@openmrs.org
a8026ba98ea263ddc63ea710a731e7c565a16a48
72f2875544e499dc0f66d886bcf97eedbd134b2f
/src/main/java/minn/minnbot/manager/CommandManager.java
97f43016cad197de459886420c6a9366d35bcba6
[]
no_license
connor44566/minnbot-test
1eb2b0c0c6b559d08daadc91d37afa1219f35b4f
5f939f2ed5b74e662802a4a392a88a528d0fe59b
refs/heads/master
2021-01-20T18:27:35.349105
2016-07-03T15:22:15
2016-07-03T15:22:15
62,502,358
0
0
null
null
null
null
UTF-8
Java
false
false
9,809
java
package minn.minnbot.manager; import minn.minnbot.entities.Command; import minn.minnbot.entities.Logger; import minn.minnbot.entities.throwable.Info; import minn.minnbot.util.IgnoreUtil; import net.dv8tion.jda.JDA; import net.dv8tion.jda.entities.Guild; import net.dv8tion.jda.events.ShutdownEvent; import net.dv8tion.jda.events.message.MessageReceivedEvent; import net.dv8tion.jda.hooks.ListenerAdapter; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import javax.activation.UnsupportedDataTypeException; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class CommandManager extends ListenerAdapter { private List<Command> commands = new LinkedList<>(); private List<CmdManager> managers = new LinkedList<>(); @SuppressWarnings("unused") private JDA api; private String owner; private Logger logger; private ThreadPoolExecutor executor; private static Map<String, List<String>> prefixMap; private static PrefixWriter writer; private static boolean reading = true; public static List<String> getPrefixList(String id) { if (prefixMap.containsKey(id)) return prefixMap.get(id); else { List<String> prefixList = new LinkedList<>(); prefixMap.put(id, prefixList); return prefixList; } } public static boolean addPrefix(Guild guild, String fix) { String id = guild.getId(); List<String> prefixList = getPrefixList(id); if (prefixList.contains(fix)) return false; prefixList.add(fix); return true; } public static boolean removePrefix(Guild guild, String fix) { String id = guild.getId(); List<String> prefixList = getPrefixList(id); if (!prefixList.contains(fix)) return false; prefixList.remove(fix); if (prefixList.isEmpty()) prefixMap.remove(id); return true; } private void readMap() { prefixMap = new HashMap<>(); File f = new File("prefix.json"); if (!f.exists()) { logger.logThrowable(new Info("prefix.json does not exist.")); } try { JSONArray arr = new JSONArray(new String(Files.readAllBytes(Paths.get("prefix.json")))); for (Object anArr : arr) try { JSONObject jObj = (JSONObject) anArr; String id = jObj.keys().next(); JSONArray list = jObj.getJSONArray(id); List<String> prefixList = new LinkedList<>(); for (Object aFix : list) prefixList.add(aFix.toString()); prefixMap.put(id, prefixList); } catch (Exception ex) { logger.logThrowable(ex); } } catch (IOException e) { logger.logThrowable(new Info("prefix.json does not exist.")); } catch (JSONException e) { logger.logThrowable(new Info("prefix array is malformed!")); } reading = false; } public CommandManager(Logger logger, String owner) { this.logger = logger; this.owner = owner; this.executor = new ThreadPoolExecutor(50, 60, 5L, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), r -> { final Thread thread = new Thread(r, "CommandExecution-Thread"); thread.setPriority(Thread.MAX_PRIORITY); thread.setDaemon(true); return thread; }); executor.submit(this::readMap); writer = new PrefixWriter(); } public void setApi(JDA api) { this.api = api; if(!api.getRegisteredListeners().contains(this)) api.addEventListener(this); } public List<Command> getCommands() { return Collections.unmodifiableList(commands); } public List<CmdManager> getManagers() { return Collections.unmodifiableList(managers); } public List<Command> getAllCommands() { Thread.currentThread().setUncaughtExceptionHandler((Thread.UncaughtExceptionHandler) logger); List<Command> cmds = new LinkedList<>(); cmds.addAll(commands); managers.parallelStream().filter(manager -> manager != null && manager.getCommands() != null).forEachOrdered(manager -> cmds.addAll(manager.getCommands())); return Collections.unmodifiableList(cmds); } public void onShutdown(ShutdownEvent event) { savePrefixMap(); } public void onMessageReceived(MessageReceivedEvent event) { if (event.getAuthor().isBot() || IgnoreUtil.isIgnored(event.getAuthor(), event.getGuild(), event.getTextChannel())) return; executor.submit(() -> { Thread.currentThread().setUncaughtExceptionHandler((Thread.UncaughtExceptionHandler) logger); for (Command c : commands) { if (c.requiresOwner()) { if (event.getAuthor().getId().equals(owner)) c.onMessageReceived(event); continue; } c.onMessageReceived(event); } managers.parallelStream().forEachOrdered(manager -> { if (manager.requiresOwner() && !event.getAuthor().getId().equals(owner)) return; manager.call(event); }); //noinspection deprecation Thread.currentThread().stop(); }); } public void registerManager(CmdManager manager) throws UnsupportedDataTypeException { if (manager == null) throw new UnsupportedDataTypeException("Manager is null!"); managers.add(manager); } @Deprecated public String registerCommand(Command com) { try { commands.add(com); } catch (Exception e) { return com.getClass().getSimpleName() + ": " + e; } return ""; } @SuppressWarnings("unused") public boolean removeCommand(Command com) { for (Command c : commands) { if (com.getAlias().equals(c.getAlias())) { commands.remove(c); return true; } } return false; } private JSONObject jsonfy(Command command) { String alias = command.getAlias(); String usage = command.usage(); boolean ownerOnly = command.requiresOwner(); JSONObject obj = new JSONObject(); obj.put("aliase", alias); obj.put("usage", usage); obj.put("owner", ownerOnly); return obj; } public JSONArray getAsJsonArray() { JSONArray array = new JSONArray(); for (Command c : commands) { JSONObject obj = new JSONObject(); obj.put("name", c.getClass().getSimpleName()); obj.put("data", jsonfy(c)); array.put(obj); } return array; } public File generateJson(String path) { JSONArray array = getAsJsonArray(); File f = new File(path); try { Files.write(Paths.get(path), array.toString(4).getBytes()); logger.logThrowable(new Info("Generated Commands as Json: " + path)); } catch (JSONException | IOException e) { logger.logThrowable(e); } return f; } public void saveTags() { TagManager.saveTags(); } public void savePrefixMap() { if (reading) { logger.logThrowable(new Info("Tried to save prefix map before it finished reading!")); return; } try { save(); } catch (IOException e) { logger.logThrowable(e); return; } logger.logThrowable(new Info("Saved Prefix Map: prefix.json")); } public static void save() throws IOException { if (reading) { new Info("Tried to save prefix map before it finished reading!").printStackTrace(); return; } JSONArray arr = new JSONArray(); prefixMap.forEach((id, list) -> { if (list.isEmpty()) return; JSONObject obj = new JSONObject(); JSONArray a = new JSONArray(); list.parallelStream().forEachOrdered(a::put); obj.put(id, a); arr.put(obj); }); writer.write(arr.toString(4)); } private class PrefixWriter { private File f; private BufferedOutputStream stream; PrefixWriter() { f = new File("prefix.json"); try { if (!f.exists()) f.createNewFile(); stream = new BufferedOutputStream(new FileOutputStream(f)); } catch (IOException e) { logger.logThrowable(e); } } void writeln(String input) { if(reading) return; try { stream.write((input + "\n").getBytes()); } catch (IOException e) { logger.logThrowable(e); } } void write(String input) { if(reading) return; try { stream.write(input.getBytes()); } catch (IOException e) { logger.logThrowable(e); } } void close() { try { stream.close(); } catch (IOException e) { logger.logThrowable(e); } } } }
[ "connor68989@gmail.com" ]
connor68989@gmail.com
3f4fbc01b9a7a2648ec3141b2942f10f69685185
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/106/org/apache/commons/math/analysis/PolynomialFunctionLagrangeForm_computeCoefficients_218.java
ff5908d1f1f3728a2dd92ff3304f4fcfdaa1315f
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,083
java
org apach common math analysi implement represent real polynomi function href http mathworld wolfram lagrang interpol polynomi lagrangeinterpolatingpolynomi html lagrang form refer introduct numer analysi isbn 038795452x chapter approxim function smooth lagrang polynomi work spline version revis date polynomi function lagrang form polynomialfunctionlagrangeform univari real function univariaterealfunct calcul coeffici lagrang polynomi interpol data take time note comput ill condit caution arithmet except arithmeticexcept abscissa coincid comput coeffici computecoeffici arithmet except arithmeticexcept degre coeffici coeffici coeffici abscissa ident arithmet except arithmeticexcept ident abscissa divis lagrang polynomi sum term polynomi degre coeffici numer coeffici coeffici coeffici comput coefficientscomput
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
ffd3dc293e2ca7f9ace041b1fcf2ede94ee97aae
627919765482c52c78a93b1a67a521a00e2a500c
/app/src/main/java/app/com/example/android/popularmovies/network/FetchTrailerTask.java
04cc986d2fde6e47fea36eeadc782ea497c90313
[]
no_license
Shuna90/Udacity-PopularMovie-app
921c64b84a3feee7deb5f9fa0312c6968b4803ae
ec22f800ac9a170f7701d971849d6ce45f8da753
refs/heads/master
2020-05-29T08:48:01.502680
2017-01-31T21:58:10
2017-01-31T21:58:10
70,196,571
0
0
null
null
null
null
UTF-8
Java
false
false
5,276
java
package app.com.example.android.popularmovies.network; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import app.com.example.android.popularmovies.BuildConfig; public class FetchTrailerTask extends AsyncTask<String, Void, ArrayList<Trailer> > { private final String LOG_TAG = FetchTrailerTask.class.getSimpleName(); private OnTrailerTaskCompleted listener; public FetchTrailerTask(OnTrailerTaskCompleted listener) { this.listener = listener; } public interface OnTrailerTaskCompleted{ void trailerTaskCompleted(ArrayList<Trailer> list); } @Override protected ArrayList<Trailer> doInBackground(String... params) { if (params.length == 0) { return null; } ArrayList<Trailer> trailerList; String movieId = params[0]; HttpURLConnection urlConnection = null; BufferedReader reader = null; String forecastJsonStr; try { final String BASE_URL = "http://api.themoviedb.org/3/movie/"; final String KEYID_PARAM = "api_key"; Uri builtUri = Uri.parse(BASE_URL + movieId + "/" + "videos" + "?").buildUpon() .appendQueryParameter(KEYID_PARAM, BuildConfig.THE_MOVIE_DATABASE_API_KEY) .build(); Log.d(LOG_TAG, builtUri.toString()); URL url = new URL(builtUri.toString()); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.connect(); InputStream inputStream = urlConnection.getInputStream(); StringBuilder buffer = new StringBuilder(); if (inputStream == null) { // Nothing to do. return null; } reader = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((line = reader.readLine()) != null) { // Since it's JSON, adding a newline isn't necessary (it won't affect parsing) // But it does make debugging a *lot* easier if you print out the completed // buffer for debugging. buffer.append(line).append("\n"); } if (buffer.length() == 0) { // Stream was empty. No point in parsing. return null; } forecastJsonStr = buffer.toString(); Log.d(LOG_TAG, forecastJsonStr); trailerList = getMovieDataFromJson(forecastJsonStr); return trailerList; }catch (IOException e) { Log.e(LOG_TAG, "Error ", e); // If the code didn't successfully get the weather data, there's no point in attemping // to parse it. //return null; }catch (JSONException e){ Log.e(LOG_TAG, e.getMessage(), e); e.printStackTrace(); } finally { if (urlConnection != null) { urlConnection.disconnect(); } if (reader != null) { try { reader.close(); } catch (final IOException e) { Log.e(LOG_TAG, "Error closing stream", e); } } } return null; } private ArrayList<Trailer> getMovieDataFromJson(String forecastJsonStr) throws JSONException{ final String TRAILER_ID = Trailer.TRAILER_ID; final String TRAILER_KEY = Trailer.TRAILER_KEY; final String TRAILER_NAME = Trailer.TRAILER_NAME; final String TRAILER_SITE = Trailer.TRAILER_SITE; final String TRAILER_SIZE = Trailer.TRAILER_SIZE; try{ JSONObject forecastJson = new JSONObject(forecastJsonStr); JSONArray movieArray = forecastJson.getJSONArray("results"); ArrayList<Trailer> list = new ArrayList<>(); for (int i = 0; i < movieArray.length(); i++){ String id; String key; String name; String site; String size; JSONObject movieJson = movieArray.getJSONObject(i); id = movieJson.getString(TRAILER_ID); key = movieJson.getString(TRAILER_KEY); name = movieJson.getString(TRAILER_NAME); site = movieJson.getString(TRAILER_SITE); size = movieJson.getString(TRAILER_SIZE); Trailer newTrailer = new Trailer(id, key, name, site, size); list.add(newTrailer); } Log.d("listsize", list.size() + ""); return list; }catch (JSONException e) { Log.e(LOG_TAG, e.getMessage(), e); e.printStackTrace(); } return null; } @Override protected void onPostExecute(ArrayList<Trailer> trailers) { listener.trailerTaskCompleted(trailers); } }
[ "hushuna1990@gmail.com" ]
hushuna1990@gmail.com
847a92a65423df0ef44403a7e4e05db6bca39dd4
bd3f60be177d0b393ed7d42b598d9f3d8e833a61
/Dolicci/src/model/entidade/Donos.java
723525579e6667c0cace6097c5f65c3f7e5702f6
[]
no_license
rodrigoestevezz/Dolicci-2
ce2365abfc61be8519c5c4c161d7f8c679a8349d
256fef30a2fc53859e3aab9b21a2ed681cdd058f
refs/heads/main
2023-06-16T05:09:37.096724
2021-07-13T19:19:52
2021-07-13T19:19:52
385,711,421
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package model.entidade; import javax.persistence.Entity; import javax.persistence.Table; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import org.hibernate.annotations.SelectBeforeUpdate; @Entity @Table @DynamicUpdate(value = true) @SelectBeforeUpdate(value = true) @DynamicInsert(value = true) public class Donos extends Pessoas { public Donos() { } public Donos(long id, String nome, String cpf, String senha, String telefone, String email, String tipo) { super(id, nome, cpf, senha, telefone, email, tipo); } }
[ "noreply@github.com" ]
rodrigoestevezz.noreply@github.com