blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
ec4935df82ae4ae783177d91fd0e8bd63351251a
83d6f8d1ea6e78e59ae30e979dd26ccbbdf11215
/app/src/main/java/com/juxin/predestinate/module/local/msgview/chatview/input/ChatBaseSmilePanel.java
07b3735fc68cb914a8e05c3153f11fd3565360ff
[]
no_license
muyouwoshi/JFHHGL
b6c232e4fc781184019501d3add2f3c353ebbfd3
c1a5aa19772ccb698f20982aed08c41a0a7f2ec9
refs/heads/master
2021-05-11T22:54:27.083425
2018-01-15T05:42:45
2018-01-15T05:42:45
117,501,517
1
0
null
null
null
null
UTF-8
Java
false
false
974
java
package com.juxin.predestinate.module.local.msgview.chatview.input; import android.content.Context; import android.support.v4.view.ViewPager; import com.juxin.predestinate.R; import com.juxin.predestinate.module.local.msgview.ChatAdapter; import com.juxin.predestinate.module.local.msgview.chatview.base.ChatViewPanel; import com.juxin.predestinate.module.logic.baseui.custom.PointsView; /** * Created by Kind on 2017/3/30. */ public class ChatBaseSmilePanel extends ChatViewPanel { private PointsView pointsView = null; public ChatBaseSmilePanel(Context context, ChatAdapter.ChatInstance chatInstance) { super(context, chatInstance); } public void initPointsView(ViewPager vp, int totalNum, boolean firstShow) { pointsView = (PointsView) findViewById(R.id.chat_points); pointsView.setTotalPoints(totalNum, firstShow); vp.setCurrentItem(pointsView.selectIndex); vp.setOnPageChangeListener(pointsView); } }
598783bfeea10be9de45ebe073d338b3c98ef385
1a512c1c818823c44b8efb19009e14bf950dde05
/project/psychologicalprj/WebContent/src/com/entity/User.java
a8403affd97e8cc187b5e18e0d4002e0469515aa
[]
no_license
bao9777/Software
0af426f09a5ba7e42c2cff86f69ff55996f0c6a2
b7d12e3074667aab02b6327e8feefe2b2d343e50
refs/heads/master
2020-04-01T04:13:44.778795
2019-01-04T12:35:45
2019-01-04T12:44:56
152,854,885
0
3
null
null
null
null
UTF-8
Java
false
false
4,874
java
package com.entity; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; /** * *@desc:用户�? * 字段:用户ID,头像路径,昵称,性别,真实姓名,身份证号,个�?�签�?,手机号(作为账号�?,密码,注册时间, 身份�?1.客户2.咨询�?3.倾听�?,城市,邮箱 映射关系:双向一对多 用户标签和咨询记�? *@author 段智�? *@date:2018�?11�?20日下�?3:32:27 */ @Entity @Table(name="user") public class User { public static final int IDENTITY_USER = 1; public static final int IDENTITY_CONSULTER = 2; private String userProvince; private String alipayUserId; private String weiboUid; private Integer userId; private String userHeadPath; private String userNickName; private String userSex; private int userAge; private String userRealName; private String userIdNumber; private String userAutograph; private String userPhone; private String userPassword; private Date userRegistTime; private Integer userIdentity; private String userCity; private String userEmail; private Set<UserLabel> userLabels= new HashSet<UserLabel>(); private Set<ConsultationRecord> consultationRecords = new HashSet<ConsultationRecord>(); @Id @GeneratedValue(strategy=GenerationType.IDENTITY) public Integer getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getUserHeadPath() { return userHeadPath; } public void setUserHeadPath(String userHeadPath) { this.userHeadPath = userHeadPath; } public String getUserNickName() { return userNickName; } public void setUserNickName(String userNickName) { this.userNickName = userNickName; } public String getUserSex() { return userSex; } public void setUserSex(String userSex) { this.userSex = userSex; } public String getUserRealName() { return userRealName; } public void setUserRealName(String userRealName) { this.userRealName = userRealName; } public String getUserIdNumber() { return userIdNumber; } public void setUserIdNumber(String userIdNumber) { this.userIdNumber = userIdNumber; } public String getUserAutograph() { return userAutograph; } public void setUserAutograph(String userAutograph) { this.userAutograph = userAutograph; } public String getUserPhone() { return userPhone; } public void setUserPhone(String userPhone) { this.userPhone = userPhone; } public String getUserPassword() { return userPassword; } public void setUserPassword(String userPassword) { this.userPassword = userPassword; } public Date getUserRegistTime() { return userRegistTime; } public void setUserRegistTime(Date userRegistTime) { this.userRegistTime = userRegistTime; } public Integer getUserIdentity() { return userIdentity; } public void setUserIdentity(int userIdentity) { this.userIdentity = userIdentity; } public String getUserCity() { return userCity; } public void setUserCity(String userCity) { this.userCity = userCity; } public String getUserEmail() { return userEmail; } public void setUserEmail(String userEmail) { this.userEmail = userEmail; } @OneToMany(mappedBy="user",targetEntity=UserLabel.class,cascade=CascadeType.ALL) public Set<UserLabel> getUserLabels() { return userLabels; } public void setUserLabels(Set<UserLabel> userLabels) { this.userLabels = userLabels; } @OneToMany(mappedBy="user",targetEntity=ConsultationRecord.class,cascade=CascadeType.ALL) public Set<ConsultationRecord> getConsultationRecords() { return consultationRecords; } public void setConsultationRecords(Set<ConsultationRecord> consultationRecords) { this.consultationRecords = consultationRecords; } public String getUserProvince() { return userProvince; } public void setUserProvince(String userProvince) { this.userProvince = userProvince; } public String getAlipayUserId() { return alipayUserId; } public void setAlipayUserId(String alipayUserId) { this.alipayUserId = alipayUserId; } public String getWeiboUid() { return weiboUid; } public void setWeiboUid(String weiboUid) { this.weiboUid = weiboUid; } public static int getIdentityUser() { return IDENTITY_USER; } public static int getIdentityConsulter() { return IDENTITY_CONSULTER; } public void setUserId(Integer userId) { this.userId = userId; } public void setUserIdentity(Integer userIdentity) { this.userIdentity = userIdentity; } public String toString() { return "uaserName is"+userRealName; } public int getUserAge() { return userAge; } public void setUserAge(int userAge) { this.userAge = userAge; } }
6b48c7d4e47a89844f2bf1d1b6cdb5b414d55901
8dd7a302e6ee53d20a09296787102ebfdca1eca6
/easeui/src/com/hyphenate/easeui/ui/EaseChatFragment.java
29d599ebb94e39890ca8bba73a0c13575ef89241
[ "Apache-2.0" ]
permissive
fox28/wechat201705
06ee658926d938ac0db682ebd1d28de022acf096
e16c6ef61e96255031b8fac2b2d7c5e91f1b4c2f
refs/heads/master
2021-01-21T18:43:41.110663
2017-06-06T15:17:13
2017-06-06T15:17:13
92,037,913
0
0
null
null
null
null
UTF-8
Java
false
false
42,537
java
package com.hyphenate.easeui.ui; import android.app.Activity; import android.app.ProgressDialog; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.provider.MediaStore; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.ListView; import android.widget.Toast; import com.hyphenate.EMMessageListener; import com.hyphenate.EMValueCallBack; import com.hyphenate.chat.EMChatRoom; import com.hyphenate.chat.EMClient; import com.hyphenate.chat.EMConversation; import com.hyphenate.chat.EMGroup; import com.hyphenate.chat.EMImageMessageBody; import com.hyphenate.chat.EMMessage; import com.hyphenate.chat.EMMessage.ChatType; import com.hyphenate.chat.EMTextMessageBody; import com.hyphenate.easeui.EaseConstant; import com.hyphenate.easeui.R; import com.hyphenate.easeui.controller.EaseUI; import com.hyphenate.easeui.domain.EaseEmojicon; import com.hyphenate.easeui.domain.EaseUser; import com.hyphenate.easeui.domain.User; import com.hyphenate.easeui.model.EaseAtMessageHelper; import com.hyphenate.easeui.utils.EaseCommonUtils; import com.hyphenate.easeui.utils.EaseUserUtils; import com.hyphenate.easeui.widget.EaseAlertDialog; import com.hyphenate.easeui.widget.EaseAlertDialog.AlertDialogUser; import com.hyphenate.easeui.widget.EaseChatExtendMenu; import com.hyphenate.easeui.widget.EaseChatInputMenu; import com.hyphenate.easeui.widget.EaseChatInputMenu.ChatInputMenuListener; import com.hyphenate.easeui.widget.EaseChatMessageList; import com.hyphenate.easeui.widget.EaseVoiceRecorderView; import com.hyphenate.easeui.widget.EaseVoiceRecorderView.EaseVoiceRecorderCallback; import com.hyphenate.easeui.widget.chatrow.EaseCustomChatRowProvider; import com.hyphenate.util.EMLog; import com.hyphenate.util.PathUtil; import java.io.File; import java.util.List; /** * you can new an EaseChatFragment to use or you can inherit it to expand. * You need call setArguments to pass chatType and userId * <br/> * <br/> * you can see ChatActivity in demo for your reference * */ public class EaseChatFragment extends EaseBaseFragment implements EMMessageListener { protected static final String TAG = "EaseChatFragment"; protected static final int REQUEST_CODE_MAP = 1; protected static final int REQUEST_CODE_CAMERA = 2; protected static final int REQUEST_CODE_LOCAL = 3; /** * params to fragment */ protected Bundle fragmentArgs; protected int chatType; protected String toChatUsername; protected EaseChatMessageList messageList; protected EaseChatInputMenu inputMenu; protected EMConversation conversation; protected InputMethodManager inputManager; protected ClipboardManager clipboard; protected Handler handler = new Handler(); protected File cameraFile; protected EaseVoiceRecorderView voiceRecorderView; protected SwipeRefreshLayout swipeRefreshLayout; protected ListView listView; protected boolean isloading; protected boolean haveMoreData = true; protected int pagesize = 20; protected GroupListener groupListener; protected ChatRoomListener chatRoomListener; protected EMMessage contextMenuMessage; static final int ITEM_TAKE_PICTURE = 1; static final int ITEM_PICTURE = 2; static final int ITEM_LOCATION = 3; protected int[] itemStrings = { R.string.attach_take_pic, R.string.attach_picture, R.string.attach_location }; protected int[] itemdrawables = { R.drawable.ease_chat_takepic_selector, R.drawable.ease_chat_image_selector, R.drawable.ease_chat_location_selector }; protected int[] itemIds = { ITEM_TAKE_PICTURE, ITEM_PICTURE, ITEM_LOCATION }; private boolean isMessageListInited; protected MyItemClickListener extendMenuItemClickListener; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.ease_fragment_chat, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { fragmentArgs = getArguments(); // check if single chat or group chat chatType = fragmentArgs.getInt(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_SINGLE); // userId you are chat with or group id toChatUsername = fragmentArgs.getString(EaseConstant.EXTRA_USER_ID); super.onActivityCreated(savedInstanceState); } /** * init view */ protected void initView() { // hold to record voice //noinspection ConstantConditions voiceRecorderView = (EaseVoiceRecorderView) getView().findViewById(R.id.voice_recorder); // message list layout messageList = (EaseChatMessageList) getView().findViewById(R.id.message_list); if(chatType != EaseConstant.CHATTYPE_SINGLE) messageList.setShowUserNick(true); listView = messageList.getListView(); extendMenuItemClickListener = new MyItemClickListener(); inputMenu = (EaseChatInputMenu) getView().findViewById(R.id.input_menu); registerExtendMenuItem(); // init input menu inputMenu.init(null); inputMenu.setChatInputMenuListener(new ChatInputMenuListener() { @Override public void onSendMessage(String content) { sendTextMessage(content); } @Override public boolean onPressToSpeakBtnTouch(View v, MotionEvent event) { return voiceRecorderView.onPressToSpeakBtnTouch(v, event, new EaseVoiceRecorderCallback() { @Override public void onVoiceRecordComplete(String voiceFilePath, int voiceTimeLength) { sendVoiceMessage(voiceFilePath, voiceTimeLength); } }); } @Override public void onBigExpressionClicked(EaseEmojicon emojicon) { sendBigExpressionMessage(emojicon.getName(), emojicon.getIdentityCode()); } }); swipeRefreshLayout = messageList.getSwipeRefreshLayout(); swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light, R.color.holo_orange_light, R.color.holo_red_light); inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } protected void setUpView() { titleBar.setTitle(toChatUsername); if (chatType == EaseConstant.CHATTYPE_SINGLE) { // set title User user = EaseUserUtils.getAppUserInfo(toChatUsername); if(user != null){ if (user.getMUserNick() != null) { titleBar.setTitle(user.getMUserNick()); } else { titleBar.setTitle(user.getMUserName()); } }else { titleBar.setTitle(user.getMUserName()); } titleBar.setRightImageResource(R.drawable.ease_mm_title_remove); } else { titleBar.setRightImageResource(R.drawable.ease_to_group_details_normal); if (chatType == EaseConstant.CHATTYPE_GROUP) { //group chat EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername); if (group != null) titleBar.setTitle(group.getGroupName()); // listen the event that user moved out group or group is dismissed groupListener = new GroupListener(); EMClient.getInstance().groupManager().addGroupChangeListener(groupListener); } else { chatRoomListener = new ChatRoomListener(); EMClient.getInstance().chatroomManager().addChatRoomChangeListener(chatRoomListener); onChatRoomViewCreation(); } } if (chatType != EaseConstant.CHATTYPE_CHATROOM) { onConversationInit(); onMessageListInit(); } titleBar.setLeftLayoutClickListener(new OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); titleBar.setRightLayoutClickListener(new OnClickListener() { @Override public void onClick(View v) { if (chatType == EaseConstant.CHATTYPE_SINGLE) { emptyHistory(); } else { toGroupDetails(); } } }); setRefreshLayoutListener(); // show forward message if the message is not null String forward_msg_id = getArguments().getString("forward_msg_id"); if (forward_msg_id != null) { forwardMessage(forward_msg_id); } } /** * register extend menu, item id need > 3 if you override this method and keep exist item */ protected void registerExtendMenuItem(){ for(int i = 0; i < itemStrings.length; i++){ inputMenu.registerExtendMenuItem(itemStrings[i], itemdrawables[i], itemIds[i], extendMenuItemClickListener); } } protected void onConversationInit(){ conversation = EMClient.getInstance().chatManager().getConversation(toChatUsername, EaseCommonUtils.getConversationType(chatType), true); conversation.markAllMessagesAsRead(); // the number of messages loaded into conversation is getChatOptions().getNumberOfMessagesLoaded // you can change this number final List<EMMessage> msgs = conversation.getAllMessages(); int msgCount = msgs != null ? msgs.size() : 0; if (msgCount < conversation.getAllMsgCount() && msgCount < pagesize) { String msgId = null; if (msgs != null && msgs.size() > 0) { msgId = msgs.get(0).getMsgId(); } conversation.loadMoreMsgFromDB(msgId, pagesize - msgCount); } } protected void onMessageListInit(){ messageList.init(toChatUsername, chatType, chatFragmentHelper != null ? chatFragmentHelper.onSetCustomChatRowProvider() : null); setListItemClickListener(); messageList.getListView().setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { hideKeyboard(); inputMenu.hideExtendMenuContainer(); return false; } }); isMessageListInited = true; } protected void setListItemClickListener() { messageList.setItemClickListener(new EaseChatMessageList.MessageListItemClickListener() { @Override public void onUserAvatarClick(String username) { if(chatFragmentHelper != null){ chatFragmentHelper.onAvatarClick(username); } } @Override public void onUserAvatarLongClick(String username) { if(chatFragmentHelper != null){ chatFragmentHelper.onAvatarLongClick(username); } } @Override public void onResendClick(final EMMessage message) { new EaseAlertDialog(getActivity(), R.string.resend, R.string.confirm_resend, null, new AlertDialogUser() { @Override public void onResult(boolean confirmed, Bundle bundle) { if (!confirmed) { return; } resendMessage(message); } }, true).show(); } @Override public void onBubbleLongClick(EMMessage message) { contextMenuMessage = message; if(chatFragmentHelper != null){ chatFragmentHelper.onMessageBubbleLongClick(message); } } @Override public boolean onBubbleClick(EMMessage message) { if(chatFragmentHelper == null){ return false; } return chatFragmentHelper.onMessageBubbleClick(message); } }); } protected void setRefreshLayoutListener() { swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { if (listView.getFirstVisiblePosition() == 0 && !isloading && haveMoreData) { List<EMMessage> messages; try { if (chatType == EaseConstant.CHATTYPE_SINGLE) { messages = conversation.loadMoreMsgFromDB(messageList.getItem(0).getMsgId(), pagesize); } else { messages = conversation.loadMoreMsgFromDB(messageList.getItem(0).getMsgId(), pagesize); } } catch (Exception e1) { swipeRefreshLayout.setRefreshing(false); return; } if (messages.size() > 0) { messageList.refreshSeekTo(messages.size() - 1); if (messages.size() != pagesize) { haveMoreData = false; } } else { haveMoreData = false; } isloading = false; } else { Toast.makeText(getActivity(), getResources().getString(R.string.no_more_messages), Toast.LENGTH_SHORT).show(); } swipeRefreshLayout.setRefreshing(false); } }, 600); } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { if (requestCode == REQUEST_CODE_CAMERA) { // capture new image if (cameraFile != null && cameraFile.exists()) sendImageMessage(cameraFile.getAbsolutePath()); } else if (requestCode == REQUEST_CODE_LOCAL) { // send local image if (data != null) { Uri selectedImage = data.getData(); if (selectedImage != null) { sendPicByUri(selectedImage); } } } else if (requestCode == REQUEST_CODE_MAP) { // location double latitude = data.getDoubleExtra("latitude", 0); double longitude = data.getDoubleExtra("longitude", 0); String locationAddress = data.getStringExtra("address"); if (locationAddress != null && !locationAddress.equals("")) { sendLocationMessage(latitude, longitude, locationAddress); } else { Toast.makeText(getActivity(), R.string.unable_to_get_loaction, Toast.LENGTH_SHORT).show(); } } } } @Override public void onResume() { super.onResume(); if(isMessageListInited) messageList.refresh(); EaseUI.getInstance().pushActivity(getActivity()); // register the event listener when enter the foreground EMClient.getInstance().chatManager().addMessageListener(this); if(chatType == EaseConstant.CHATTYPE_GROUP){ EaseAtMessageHelper.get().removeAtMeGroup(toChatUsername); } } @Override public void onStop() { super.onStop(); // unregister this event listener when this activity enters the // background EMClient.getInstance().chatManager().removeMessageListener(this); // remove activity from foreground activity list EaseUI.getInstance().popActivity(getActivity()); } @Override public void onDestroy() { super.onDestroy(); if (groupListener != null) { EMClient.getInstance().groupManager().removeGroupChangeListener(groupListener); } if (chatRoomListener != null) { EMClient.getInstance().chatroomManager().removeChatRoomListener(chatRoomListener); } if(chatType == EaseConstant.CHATTYPE_CHATROOM){ EMClient.getInstance().chatroomManager().leaveChatRoom(toChatUsername); } } public void onBackPressed() { // Log.e(TAG, "onBackPressed, --001"); if (inputMenu.onBackPressed()) { // Log.e(TAG, "onBackPressed, --002"); getActivity().finish(); if(chatType == EaseConstant.CHATTYPE_GROUP){ EaseAtMessageHelper.get().removeAtMeGroup(toChatUsername); EaseAtMessageHelper.get().cleanToAtUserList(); } if (chatType == EaseConstant.CHATTYPE_CHATROOM) { EMClient.getInstance().chatroomManager().leaveChatRoom(toChatUsername); } } // Log.e(TAG, "onBackPressed, --003"); } protected void onChatRoomViewCreation() { final ProgressDialog pd = ProgressDialog.show(getActivity(), "", "Joining......"); EMClient.getInstance().chatroomManager().joinChatRoom(toChatUsername, new EMValueCallBack<EMChatRoom>() { @Override public void onSuccess(final EMChatRoom value) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { if(getActivity().isFinishing() || !toChatUsername.equals(value.getId())) return; pd.dismiss(); EMChatRoom room = EMClient.getInstance().chatroomManager().getChatRoom(toChatUsername); if (room != null) { titleBar.setTitle(room.getName()); EMLog.d(TAG, "join room success : " + room.getName()); } else { titleBar.setTitle(toChatUsername); } addChatRoomChangeListenr(); onConversationInit(); onMessageListInit(); } }); } @Override public void onError(final int error, String errorMsg) { // TODO Auto-generated method stub EMLog.d(TAG, "join room failure : " + error); getActivity().runOnUiThread(new Runnable() { @Override public void run() { pd.dismiss(); } }); getActivity().finish(); } }); } protected void addChatRoomChangeListenr() { /* chatRoomChangeListener = new EMChatRoomChangeListener() { @Override public void onChatRoomDestroyed(String roomId, String roomName) { if (roomId.equals(toChatUsername)) { showChatroomToast(" room : " + roomId + " with room name : " + roomName + " was destroyed"); getActivity().finish(); } } @Override public void onMemberJoined(String roomId, String participant) { showChatroomToast("member : " + participant + " join the room : " + roomId); } @Override public void onMemberExited(String roomId, String roomName, String participant) { showChatroomToast("member : " + participant + " leave the room : " + roomId + " room name : " + roomName); } @Override public void onRemovedFromChatRoom(String roomId, String roomName, String participant) { if (roomId.equals(toChatUsername)) { String curUser = EMClient.getInstance().getCurrentUser(); if (curUser.equals(participant)) { EMClient.getInstance().chatroomManager().leaveChatRoom(toChatUsername); getActivity().finish(); }else{ showChatroomToast("member : " + participant + " was kicked from the room : " + roomId + " room name : " + roomName); } } } // ============================= group_reform new add api begin @Override public void onMuteListAdded(String chatRoomId, Map<String, Long> mutes) {} @Override public void onMuteListRemoved(String chatRoomId, List<String> mutes) {} @Override public void onAdminAdded(String chatRoomId, String admin) {} @Override public void onAdminRemoved(String chatRoomId, String admin) {} @Override public void onOwnerChanged(String chatRoomId, String newOwner, String oldOwner) {} // ============================= group_reform new add api end }; EMClient.getInstance().chatroomManager().addChatRoomChangeListener(chatRoomChangeListener); */ } protected void showChatroomToast(final String toastContent){ getActivity().runOnUiThread(new Runnable() { public void run() { Toast.makeText(getActivity(), toastContent, Toast.LENGTH_SHORT).show(); } }); } // implement methods in EMMessageListener @Override public void onMessageReceived(List<EMMessage> messages) { for (EMMessage message : messages) { String username = null; // group message if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) { username = message.getTo(); } else { // single chat message username = message.getFrom(); } // if the message is for current conversation if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername)) { messageList.refreshSelectLast(); EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message); conversation.markMessageAsRead(message.getMsgId()); } else { EaseUI.getInstance().getNotifier().onNewMsg(message); } } } @Override public void onCmdMessageReceived(List<EMMessage> messages) { } @Override public void onMessageRead(List<EMMessage> messages) { if(isMessageListInited) { messageList.refresh(); } } @Override public void onMessageDelivered(List<EMMessage> messages) { if(isMessageListInited) { messageList.refresh(); } } @Override public void onMessageChanged(EMMessage emMessage, Object change) { if(isMessageListInited) { messageList.refresh(); } } /** * handle the click event for extend menu * */ class MyItemClickListener implements EaseChatExtendMenu.EaseChatExtendMenuItemClickListener{ @Override public void onClick(int itemId, View view) { if(chatFragmentHelper != null){ if(chatFragmentHelper.onExtendMenuItemClick(itemId, view)){ return; } } switch (itemId) { case ITEM_TAKE_PICTURE: selectPicFromCamera(); break; case ITEM_PICTURE: selectPicFromLocal(); break; case ITEM_LOCATION: startActivityForResult(new Intent(getActivity(), EaseBaiduMapActivity.class), REQUEST_CODE_MAP); break; default: break; } } } /** * input @ * @param username */ protected void inputAtUsername(String username, boolean autoAddAtSymbol){ if(EMClient.getInstance().getCurrentUser().equals(username) || chatType != EaseConstant.CHATTYPE_GROUP){ return; } EaseAtMessageHelper.get().addAtUser(username); EaseUser user = EaseUserUtils.getUserInfo(username); if (user != null){ username = user.getNick(); } if(autoAddAtSymbol) inputMenu.insertText("@" + username + " "); else inputMenu.insertText(username + " "); } /** * input @ * @param username */ protected void inputAtUsername(String username){ inputAtUsername(username, true); } //send message protected void sendTextMessage(String content) { if(EaseAtMessageHelper.get().containsAtUsername(content)){ sendAtMessage(content); }else{ EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername); sendMessage(message); } } /** * send @ message, only support group chat message * @param content */ @SuppressWarnings("ConstantConditions") private void sendAtMessage(String content){ if(chatType != EaseConstant.CHATTYPE_GROUP){ EMLog.e(TAG, "only support group chat message"); return; } EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername); EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername); if(EMClient.getInstance().getCurrentUser().equals(group.getOwner()) && EaseAtMessageHelper.get().containsAtAll(content)){ message.setAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL); }else { message.setAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, EaseAtMessageHelper.get().atListToJsonArray(EaseAtMessageHelper.get().getAtMessageUsernames(content))); } sendMessage(message); } protected void sendBigExpressionMessage(String name, String identityCode){ EMMessage message = EaseCommonUtils.createExpressionMessage(toChatUsername, name, identityCode); sendMessage(message); } protected void sendVoiceMessage(String filePath, int length) { EMMessage message = EMMessage.createVoiceSendMessage(filePath, length, toChatUsername); sendMessage(message); } protected void sendImageMessage(String imagePath) { EMMessage message = EMMessage.createImageSendMessage(imagePath, false, toChatUsername); sendMessage(message); } protected void sendLocationMessage(double latitude, double longitude, String locationAddress) { EMMessage message = EMMessage.createLocationSendMessage(latitude, longitude, locationAddress, toChatUsername); sendMessage(message); } protected void sendVideoMessage(String videoPath, String thumbPath, int videoLength) { EMMessage message = EMMessage.createVideoSendMessage(videoPath, thumbPath, videoLength, toChatUsername); sendMessage(message); } protected void sendFileMessage(String filePath) { EMMessage message = EMMessage.createFileSendMessage(filePath, toChatUsername); sendMessage(message); } protected void sendMessage(EMMessage message){ if (message == null) { return; } if(chatFragmentHelper != null){ //set extension chatFragmentHelper.onSetMessageAttributes(message); } if (chatType == EaseConstant.CHATTYPE_GROUP){ message.setChatType(ChatType.GroupChat); }else if(chatType == EaseConstant.CHATTYPE_CHATROOM){ message.setChatType(ChatType.ChatRoom); } //send message EMClient.getInstance().chatManager().sendMessage(message); //refresh ui if(isMessageListInited) { messageList.refreshSelectLast(); } } public void resendMessage(EMMessage message){ message.setStatus(EMMessage.Status.CREATE); EMClient.getInstance().chatManager().sendMessage(message); messageList.refresh(); } //=================================================================================== /** * send image * * @param selectedImage */ protected void sendPicByUri(Uri selectedImage) { String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getActivity().getContentResolver().query(selectedImage, filePathColumn, null, null, null); if (cursor != null) { cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); cursor = null; if (picturePath == null || picturePath.equals("null")) { Toast toast = Toast.makeText(getActivity(), R.string.cant_find_pictures, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); return; } sendImageMessage(picturePath); } else { File file = new File(selectedImage.getPath()); if (!file.exists()) { Toast toast = Toast.makeText(getActivity(), R.string.cant_find_pictures, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); return; } sendImageMessage(file.getAbsolutePath()); } } /** * send file * @param uri */ protected void sendFileByUri(Uri uri){ String filePath = null; if ("content".equalsIgnoreCase(uri.getScheme())) { String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = null; try { cursor = getActivity().getContentResolver().query(uri, filePathColumn, null, null, null); int column_index = cursor.getColumnIndexOrThrow("_data"); if (cursor.moveToFirst()) { filePath = cursor.getString(column_index); } } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) { cursor.close(); } } } else if ("file".equalsIgnoreCase(uri.getScheme())) { filePath = uri.getPath(); } if (filePath == null) { return; } File file = new File(filePath); if (!file.exists()) { Toast.makeText(getActivity(), R.string.File_does_not_exist, Toast.LENGTH_SHORT).show(); return; } //limit the size < 10M if (file.length() > 10 * 1024 * 1024) { Toast.makeText(getActivity(), R.string.The_file_is_not_greater_than_10_m, Toast.LENGTH_SHORT).show(); return; } sendFileMessage(filePath); } /** * capture new image */ protected void selectPicFromCamera() { if (!EaseCommonUtils.isSdcardExist()) { Toast.makeText(getActivity(), R.string.sd_card_does_not_exist, Toast.LENGTH_SHORT).show(); return; } cameraFile = new File(PathUtil.getInstance().getImagePath(), EMClient.getInstance().getCurrentUser() + System.currentTimeMillis() + ".jpg"); //noinspection ResultOfMethodCallIgnored cameraFile.getParentFile().mkdirs(); startActivityForResult( new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA); } /** * select local image */ protected void selectPicFromLocal() { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); } else { intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } startActivityForResult(intent, REQUEST_CODE_LOCAL); } /** * clear the conversation history * */ protected void emptyHistory() { String msg = getResources().getString(R.string.Whether_to_empty_all_chats); new EaseAlertDialog(getActivity(),null, msg, null,new AlertDialogUser() { @Override public void onResult(boolean confirmed, Bundle bundle) { if(confirmed){ if (conversation != null) { conversation.clearAllMessages(); } messageList.refresh(); } } }, true).show(); } /** * open group detail * */ protected void toGroupDetails() { if (chatType == EaseConstant.CHATTYPE_GROUP) { EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername); if (group == null) { Toast.makeText(getActivity(), R.string.gorup_not_found, Toast.LENGTH_SHORT).show(); return; } if(chatFragmentHelper != null){ chatFragmentHelper.onEnterToChatDetails(); } }else if(chatType == EaseConstant.CHATTYPE_CHATROOM){ if(chatFragmentHelper != null){ chatFragmentHelper.onEnterToChatDetails(); } } } /** * hide */ protected void hideKeyboard() { if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getActivity().getCurrentFocus() != null) inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } } /** * forward message * * @param forward_msg_id */ protected void forwardMessage(String forward_msg_id) { final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id); EMMessage.Type type = forward_msg.getType(); switch (type) { case TXT: if(forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){ sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(), forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null)); }else{ // get the content and send it String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage(); sendTextMessage(content); } break; case IMAGE: // send image String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl(); if (filePath != null) { File file = new File(filePath); if (!file.exists()) { // send thumb nail if original image does not exist filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath(); } sendImageMessage(filePath); } break; default: break; } if(forward_msg.getChatType() == EMMessage.ChatType.ChatRoom){ EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo()); } } /** * listen the group event * */ class GroupListener extends EaseGroupListener { @Override public void onUserRemoved(final String groupId, String groupName) { getActivity().runOnUiThread(new Runnable() { public void run() { if (toChatUsername.equals(groupId)) { Toast.makeText(getActivity(), R.string.you_are_group, Toast.LENGTH_LONG).show(); Activity activity = getActivity(); if (activity != null && !activity.isFinishing()) { activity.finish(); } } } }); } @Override public void onGroupDestroyed(final String groupId, String groupName) { // prompt group is dismissed and finish this activity getActivity().runOnUiThread(new Runnable() { public void run() { if (toChatUsername.equals(groupId)) { Toast.makeText(getActivity(), R.string.the_current_group_destroyed, Toast.LENGTH_LONG).show(); Activity activity = getActivity(); if (activity != null && !activity.isFinishing()) { activity.finish(); } } } }); } } /** * listen chat room event */ class ChatRoomListener extends EaseChatRoomListener { @Override public void onChatRoomDestroyed(final String roomId, final String roomName) { getActivity().runOnUiThread(new Runnable() { public void run() { if (roomId.equals(toChatUsername)) { Toast.makeText(getActivity(), R.string.the_current_chat_room_destroyed, Toast.LENGTH_LONG).show(); Activity activity = getActivity(); if (activity != null && !activity.isFinishing()) { activity.finish(); } } } }); } @Override public void onRemovedFromChatRoom(final String roomId, final String roomName, final String participant) { getActivity().runOnUiThread(new Runnable() { public void run() { if (roomId.equals(toChatUsername)) { Toast.makeText(getActivity(), R.string.quiting_the_chat_room, Toast.LENGTH_LONG).show(); Activity activity = getActivity(); if (activity != null && !activity.isFinishing()) { activity.finish(); } } } }); } @Override public void onMemberJoined(final String roomId, final String participant) { if (roomId.equals(toChatUsername)) { getActivity().runOnUiThread(new Runnable() { public void run() { Toast.makeText(getActivity(), "member join:" + participant, Toast.LENGTH_LONG).show(); } }); } } @Override public void onMemberExited(final String roomId, final String roomName, final String participant) { if (roomId.equals(toChatUsername)) { getActivity().runOnUiThread(new Runnable() { public void run() { Toast.makeText(getActivity(), "member exit:" + participant, Toast.LENGTH_LONG).show(); } }); } } } protected EaseChatFragmentHelper chatFragmentHelper; public void setChatFragmentListener(EaseChatFragmentHelper chatFragmentHelper){ this.chatFragmentHelper = chatFragmentHelper; } public interface EaseChatFragmentHelper{ /** * set message attribute */ void onSetMessageAttributes(EMMessage message); /** * enter to chat detail */ void onEnterToChatDetails(); /** * on avatar clicked * @param username */ void onAvatarClick(String username); /** * on avatar long pressed * @param username */ void onAvatarLongClick(String username); /** * on message bubble clicked */ boolean onMessageBubbleClick(EMMessage message); /** * on message bubble long pressed */ void onMessageBubbleLongClick(EMMessage message); /** * on extend menu item clicked, return true if you want to override * @param view * @param itemId * @return */ boolean onExtendMenuItemClick(int itemId, View view); /** * on set custom chat row provider * @return */ EaseCustomChatRowProvider onSetCustomChatRowProvider(); } }
23d2a3ab19fc97d6934affd8d7f402a31a933528
a5fac726ef20827c5fd9ed26d29c86641c37e6cd
/test/hotciv/EpsilonCiv/TestEpsilonCivWinnerCalculation.java
25aa49fb5f75ff507829e807b3ee228a91cd1b87
[]
no_license
STOREtun/hotciv
233566584811d4e919105033fa0627b4222f3a53
821f5a49a6c21d685585fb7f4768f2fc5c00fd68
refs/heads/master
2020-02-26T14:59:06.215862
2015-12-16T07:19:28
2015-12-16T07:19:28
45,177,520
0
0
null
null
null
null
UTF-8
Java
false
false
2,425
java
package hotciv.EpsilonCiv; import hotciv.framework.GameConstants; import hotciv.framework.Player; import hotciv.framework.Position; import hotciv.standard.GameImpl; import hotciv.standard.UnitImpl; import hotciv.variants.EpsilonCiv.EpsilonFactory; import hotciv.TestStubs.FakeDie; import org.junit.Before; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; /** * Created by asger on 25/11/15. */ public class TestEpsilonCivWinnerCalculation { UnitImpl redArcher; UnitImpl blueSettler_01; UnitImpl blueSettler_02; UnitImpl blueSettler_03; GameImpl game; @Before public void setup(){ game = new GameImpl(new EpsilonFactory(new FakeDie())); redArcher = new UnitImpl(Player.RED, GameConstants.ARCHER); blueSettler_01 = new UnitImpl(Player.BLUE, GameConstants.SETTLER); blueSettler_02 = new UnitImpl(Player.BLUE, GameConstants.SETTLER); blueSettler_03 = new UnitImpl(Player.BLUE, GameConstants.SETTLER); game.positionUnitMap.put(new Position(10,10), redArcher); game.positionUnitMap.put(new Position(11,10), blueSettler_01); game.positionUnitMap.put(new Position(10,11), blueSettler_02); game.positionUnitMap.put(new Position(10,12), blueSettler_03); } @Test public void shouldCalculateWinnerAccordingToWonAttacks() { assertNull(game.getWinner()); // first attack results in redArcher taking over settler_01's tile assertTrue(game.moveUnit(new Position(10,10), new Position(11, 10))); assertThat("This unit is a red archer", game.getUnitAt(new Position(11, 10)).getOwner(), is(Player.RED)); // second attack removes another settler assertTrue(game.moveUnit(new Position(11,10), new Position(10, 11))); assertThat("This unit is a red archer", game.getUnitAt(new Position(10, 11)).getOwner(), is(Player.RED)); // third, and final attack removes the last settler and let red win the game assertTrue(game.moveUnit(new Position(10,11), new Position(10, 12))); assertThat("This unit is a red archer", game.getUnitAt(new Position(10, 12)).getOwner(), is(Player.RED)); assertThat("Red has won the game after three successful attacks", game.getWinner(), is(Player.RED)); } }
1bc983e3dd305b734300fcd296ac21f1f2b54f2b
0d1835c1fbfe08dad1d59cd1f6261e706146e609
/CardioMRI/src/com/pixelmed/dicom/AttributeTree.java
7fb246139d6832f0657e9a7f8dda319c3de11a94
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
inevitably2484848/MRI
c57dc4313b06f47796e7ac6b200485b20af04d66
2185d5a9dcbe4cca09dcce49d43b77df35677f84
refs/heads/master
2021-01-14T08:25:25.978877
2016-04-27T19:31:10
2016-04-27T19:31:10
29,896,364
2
2
null
2015-11-30T23:39:51
2015-01-27T03:53:59
Java
UTF-8
Java
false
false
6,498
java
/* Copyright (c) 2001-2003, David A. Clunie DBA Pixelmed Publishing. All rights reserved. */ package com.pixelmed.dicom; import javax.swing.tree.*; import javax.swing.event.*; import java.util.*; import java.io.File; /** * <p>The {@link com.pixelmed.dicom.AttributeTree AttributeTree} class implements a * {@link javax.swing.tree.TreeModel TreeModel} to abstract the contents of a list of attributes as * a tree in order to provide support for a {@link com.pixelmed.dicom.AttributeTreeBrowser AttributeTreeBrowser}.</p> * * <p>For details of some of the methods implemented here see {@link javax.swing.tree.TreeModel javax.swing.tree.TreeModel}.</p> * * @see com.pixelmed.dicom.AttributeTreeBrowser * @see com.pixelmed.dicom.AttributeTreeRecord * * @author dclunie */ public class AttributeTree implements TreeModel { /***/ private static final String identString = "@(#) $Header: /userland/cvs/pixelmed/imgbook/com/pixelmed/dicom/AttributeTree.java,v 1.6 2005/06/10 13:25:55 dclunie Exp $"; // Our nodes are all instances of AttributeTreeRecord ... /***/ private AttributeTreeRecord root; // Stuff to support listener vector /***/ private Vector listeners; // Methods for TreeModel /** * @param node * @param index */ public Object getChild(Object node,int index) { return ((AttributeTreeRecord)node).getChildAt(index); } /** * @param parent * @param child */ public int getIndexOfChild(Object parent, Object child) { return ((AttributeTreeRecord)parent).getIndex((AttributeTreeRecord)child); } /***/ public Object getRoot() { return root; } /** * @param parent */ public int getChildCount(Object parent) { return ((AttributeTreeRecord)parent).getChildCount(); } /** * @param node */ public boolean isLeaf(Object node) { return ((AttributeTreeRecord)node).getChildCount() == 0; } /** * @param path * @param newValue */ public void valueForPathChanged(TreePath path, Object newValue) { } /** * @param tml */ public void addTreeModelListener(TreeModelListener tml) { if (listeners == null) listeners = new Vector(); listeners.addElement(tml); } /** * @param tml */ public void removeTreeModelListener(TreeModelListener tml) { if (listeners == null) listeners.removeElement(tml); } // Methods specific to AttributeTree /** * <p>Add all attributes of a list as sibling nodes of a tree.</p> * * <p>Attributes are added in the natural order of the {@link com.pixelmed.dicom.AttributeList AttributeList}.</p> * * <p>Calls itself recursively to add attribute lists in items of any sequence attributes encountered.</p> * * @param parent the parent to which the new nodes are added as children * @param list the list whose attributes to add * @param dictionary the dictionary in which to look up the attribute names * @return the first node at this level of the tree added (if any) * @exception DicomException */ private AttributeTreeRecord processAttributeList(AttributeTreeRecord parent,AttributeList list,DicomDictionary dictionary) throws DicomException { AttributeTreeRecord first = null; Iterator i = list.values().iterator(); while (i.hasNext()) { Attribute a = (Attribute)i.next(); AttributeTreeRecord node = new AttributeTreeRecord(parent,a,dictionary); if (first == null) { first=node; if (parent != null) parent.addChild(node); } else { node.addSibling(node); } if (ValueRepresentation.isSequenceVR(a.getVR())) { SequenceAttribute sa = (SequenceAttribute)a; int itemCount = 0; Iterator items = sa.iterator(); while (items.hasNext()) { SequenceItem item = (SequenceItem)items.next(); AttributeTreeRecord itemnode = new AttributeTreeRecord(node,++itemCount); node.addChild(itemnode); processAttributeList(itemnode,item.getAttributeList(),dictionary); } } } return first; } /** * <p>Construct an entire tree of attributes from an attribute list.</p> * * @param list the list whose attributes to add * @exception DicomException */ public AttributeTree(AttributeList list) throws DicomException { if (list != null) { DicomDictionary dictionary = list.getDictionary(); root = new AttributeTreeRecord(null,null,dictionary); // we create our own (empty) root on top processAttributeList(root,list,dictionary); } } /** * <p>Walk the sub-tree starting at the specified node and dump as a string.</p> * * @param node the node that roots the sub-tree * @return the attributes in the tree as a string */ private String walkTree(AttributeTreeRecord node) { StringBuffer buffer = new StringBuffer(); buffer.append(node.toString()); buffer.append("\n"); int n = getChildCount(node); for (int i=0; i<n; ++i) buffer.append(walkTree((AttributeTreeRecord)getChild(node,i))); return buffer.toString(); } /** * <p>Walk the entire tree and dump as a string.</p> * * @return the attributes in the tree as a string */ public String toString() { return walkTree(root); } /** * <p>Walk the sub-tree starting at the specified node and set the sort order.</p> * * @param node the node that roots the sub-tree * @return the attributes in the tree as a string */ private void walkTreeAndSetSortOrder(AttributeTreeRecord node,boolean sortByName) { node.setSortByName(sortByName); Vector copy = new Vector(); int n = node.getChildCount(); for (int i=0; i<n; ++i) { AttributeTreeRecord child = (AttributeTreeRecord)node.getChildAt(i); walkTreeAndSetSortOrder(child,sortByName); copy.add(child); } node.removeAllChildren(); Enumeration e = copy.elements(); while (e.hasMoreElements()) { AttributeTreeRecord child = (AttributeTreeRecord)e.nextElement(); node.addChild(child); } } /** * <p>Set the sort order to be alphabetical by attribute name, or numerical by group and element tag.</p> * * @param sortByName true if sort alphabetically by attribute name */ public void setSortByName(boolean sortByName) { walkTreeAndSetSortOrder(root,sortByName); if (listeners != null) { for (int i=0; i<listeners.size(); ++i) { ((TreeModelListener)(listeners.get(i))).treeStructureChanged(new TreeModelEvent(this,new TreePath(root))); } } } }
f03eefef07bcf9b0ea467fa600dede0381d58ede
a61d03928d91a8ab6287912afa7ecfe4a3b8bbd9
/src/main/java/services/imp/html/HTMLDownloader.java
113fb21daf320e6d175619b8846847b87e5275ef
[]
no_license
Artem100101/Test
3ff3cc3a1b0a0dc393a8920e411f2aac8eddb3ab
757ee8733db1edee48561760e46bab435934fb79
refs/heads/main
2023-04-28T18:49:19.989754
2021-05-08T17:05:48
2021-05-08T17:05:48
360,955,566
0
0
null
null
null
null
UTF-8
Java
false
false
1,280
java
package services.imp.html; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; public class HTMLDownloader { private static final String URL_PATTERN = "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"; public void save(String url, String fileName) throws IOException, IllegalArgumentException { validateUrl(url); InputStream ist = new URL(url).openStream(); FileOutputStream fileOutputStream = new FileOutputStream(fileName); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream); final byte[] bytes = new byte[64]; try { while (ist.read(bytes) != -1) { bufferedOutputStream.write(bytes); bufferedOutputStream.flush(); fileOutputStream.flush(); } } finally { ist.close(); fileOutputStream.close(); bufferedOutputStream.close(); } } private void validateUrl(String url) throws IllegalArgumentException { if (!url.matches(URL_PATTERN)) { throw new IllegalArgumentException("Can not validate url: " + url); } } }
8f73f249487fa7b199a327da964898269e1e8855
86b0de37a090b5d0a9fd737cc5ae5c0119a5f2ce
/MUGA_13_09/src/problem/bitString/Deceptive/F3S.java
08f558e4767c6b7344f098ea4f7d4a56f910c370
[]
no_license
manso/EvolutionaryComputation
0e5779339aa44d4a4a953cdb235a61f0e1c76c5a
cf67cab17f42ea238ac0b10cc00bda1610eb303e
refs/heads/master
2021-01-22T08:59:13.234128
2013-09-26T16:52:11
2013-09-26T16:52:11
null
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
4,253
java
///****************************************************************************/ ///****************************************************************************/ ///**** Copyright (C) 2012 ****/ ///**** Antonio Manuel Rodrigues Manso ****/ ///**** e-mail: [email protected] ****/ ///**** url : http://orion.ipt.pt/~manso ****/ ///**** Instituto Politecnico de Tomar ****/ ///**** Escola Superior de Tecnologia de Tomar ****/ ///****************************************************************************/ ///****************************************************************************/ ///**** This software was built with the purpose of investigating ****/ ///**** and learning. Its use is free and is not provided any ****/ ///**** guarantee or support. ****/ ///**** If you met bugs, please, report them to the author ****/ ///**** ****/ ///****************************************************************************/ ///****************************************************************************/ package problem.bitString.Deceptive; import genetic.gene.GeneNumberBits; import java.util.StringTokenizer; import problem.Individual; import utils.BitField; /** * from paper: *Whitley L.D., “Fundamental Principles of Deception in Genetic Search,” Foundations of *Genetic Algorithms, Volume 1, Rowlins G.J.E. (ed). Morgan Kaufmann, ISBN 1-55860-170- * 8. 1991, pp 221-241. * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.18.6847&rep=rep1&type=pdf * * * * The Island Model Genetic Algorithm: On Separability, Population Size and Convergence (1998) * by Darrell Whitley , Soraya Rana , Robert B. Heckendorn * Journal of Computing and Information Technology * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.36.7225&rep=rep1&type=pdf * * * @author ZULU */ public class F3S extends F3 { public static int NUMBER_OF_BLOCKS = 10; public F3S() { super(); } @Override protected double fitness() { double fit = 0; BitField bits = getBits(); for (int i = 0; i < getGenome().getNumGenes(); i++) { int g = getGeneValue(bits, i); fit += values[g]; } return fit; } @Override protected BitField getGeneBits(BitField bits, int gene) { BitField value = new BitField(GENE_SIZE); int step = bits.getNumberOfBits() / GENE_SIZE; int index; for (int j = 0; j < GENE_SIZE; j++) { index = (gene + j*step); value.setBit(j, bits.getBit(index)); } return value; } @Override public String getGenomeInformation() { StringBuilder buf = new StringBuilder(); buf.append("Fully Separated Deceptive Problem <").append(NUMBER_OF_BLOCKS).append(">"); buf.append("\n\n 4-bit fully deceptive problem SEPARATED"); buf.append("\nf(1111) = 30 f(0000) = 28 f(0111) = 0 f(1011) = 2"); buf.append("\nf(1101) = 4 f(1110) = 6 f(1100) = 8 f(1010) = 10"); buf.append("\nf(1001) = 12 f(0110) = 14 f(0101) = 16 f(0011) = 18"); buf.append("\nf(1000) = 20 f(0100) = 22 f(0010) = 24 f(0001) = 26"); buf.append("\nSEPARATION: Bits of function are separated in the "); buf.append("\nBlocks"); buf.append("\n\nParameters <BLOCKS>"); buf.append("\n <#BLOCKS> number of deceptive block "); buf.append("\n\nL. D. Whitley Whitley"); buf.append("\nFundamental Principles of Deception in Genetic Search"); buf.append("\nFoundations of Genetic Algorithms, 1991"); return buf.toString(); } public static void main(String[] args) { F3.NUMBER_OF_BLOCKS = 4; F3S f = new F3S(); System.out.println(f.toStringGenotype()); System.out.println(f.toStringPhenotype()); } }
a67249c63f3859a59798d7c538a0a193a42f67ea
8fafe51543540695097b0153486316c83c8b866c
/ToolQ-Core/src/main/java/com/toolq/qq/protocol/jce/group/TroopMemberInfo.java
e697981d5ed6a00c230a58273ebbdf7c008a8721
[]
no_license
Arryboom/ToolQ
94f767dc22ab6e8c1baf9228dcbca68767e17cb9
1c7cdfbf4dd340c58788a186e04b86205ba5e537
refs/heads/main
2023-07-03T06:21:56.876580
2021-08-05T15:14:36
2021-08-05T15:14:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,428
java
package com.toolq.qq.protocol.jce.group; import com.qq.taf.Jce; import com.qq.taf.jce.JceInputStream; public class TroopMemberInfo extends Jce<TroopMemberInfo> { static QzoneUserInfo cache_qzusrinfo = new QzoneUserInfo(); static byte[] cache_vecGroupHonor = new byte[1]; public byte Age; public short FaceId; public byte Gender; public long MemberUin; public String Nick = ""; public byte Status = 20; public String job = ""; public byte cApolloFlag; public byte cConcerned; public byte cGender; public byte cRichCardNameVer; public byte cShielded; public long dwApolloTimestamp; public long dwBigClubFlag; public long dwBigClubLevel; public long dwCreditLevel; public long dwFlag; public long dwFlagExt; public long dwGlobalGroupLevel; public long dwGlobalGroupPoint; public long dwJoinTime; public long dwLastSpeakTime; public long dwMemberLevel; public long dwNameplate; public long dwPoint; public long dwShutupTimestap = 0; public long dwSpecialTitleExpireTime; public long dwTitleId; public long dwVipLevel; public long dwVipType; public QzoneUserInfo qzusrinfo; public String sEmail = ""; public String sMemo = ""; public String sName = ""; public String sPhone = ""; public String sShowName = ""; public String sSpecialTitle = ""; public String strAutoRemark = ""; public byte[] vecGroupHonor; @Override public void readFrom(JceInputStream jceInputStream) { this.MemberUin = jceInputStream.read(this.MemberUin, 0, true); this.FaceId = jceInputStream.read(this.FaceId, 1, true); this.Age = jceInputStream.read(this.Age, 2, true); this.Gender = jceInputStream.read(this.Gender, 3, true); this.Nick = jceInputStream.readString(4, true); this.Status = jceInputStream.read(this.Status, 5, true); this.sShowName = jceInputStream.readString(6, false); this.sName = jceInputStream.readString(8, false); this.cGender = jceInputStream.read(this.cGender, 9, false); this.sPhone = jceInputStream.readString(10, false); this.sEmail = jceInputStream.readString(11, false); this.sMemo = jceInputStream.readString(12, false); this.strAutoRemark = jceInputStream.readString(13, false); this.dwMemberLevel = jceInputStream.read(this.dwMemberLevel, 14, false); this.dwJoinTime = jceInputStream.read(this.dwJoinTime, 15, false); this.dwLastSpeakTime = jceInputStream.read(this.dwLastSpeakTime, 16, false); this.dwCreditLevel = jceInputStream.read(this.dwCreditLevel, 17, false); this.dwFlag = jceInputStream.read(this.dwFlag, 18, false); this.dwFlagExt = jceInputStream.read(this.dwFlagExt, 19, false); this.dwPoint = jceInputStream.read(this.dwPoint, 20, false); this.cConcerned = jceInputStream.read(this.cConcerned, 21, false); this.cShielded = jceInputStream.read(this.cShielded, 22, false); this.sSpecialTitle = jceInputStream.readString(23, false); this.dwSpecialTitleExpireTime = jceInputStream.read(this.dwSpecialTitleExpireTime, 24, false); this.job = jceInputStream.readString(25, false); this.cApolloFlag = jceInputStream.read(this.cApolloFlag, 26, false); this.dwApolloTimestamp = jceInputStream.read(this.dwApolloTimestamp, 27, false); this.dwGlobalGroupLevel = jceInputStream.read(this.dwGlobalGroupLevel, 28, false); this.dwTitleId = jceInputStream.read(this.dwTitleId, 29, false); this.dwShutupTimestap = jceInputStream.read(this.dwShutupTimestap, 30, false); this.dwGlobalGroupPoint = jceInputStream.read(this.dwGlobalGroupPoint, 31, false); this.qzusrinfo = (QzoneUserInfo) jceInputStream.readV2(cache_qzusrinfo, 32, false); this.cRichCardNameVer = jceInputStream.read(this.cRichCardNameVer, 33, false); this.dwVipType = jceInputStream.read(this.dwVipType, 34, false); this.dwVipLevel = jceInputStream.read(this.dwVipLevel, 35, false); this.dwBigClubLevel = jceInputStream.read(this.dwBigClubLevel, 36, false); this.dwBigClubFlag = jceInputStream.read(this.dwBigClubFlag, 37, false); this.dwNameplate = jceInputStream.read(this.dwNameplate, 38, false); this.vecGroupHonor = jceInputStream.read(cache_vecGroupHonor, 39, false); } }
2477ce60ce95484ec06162874b5ad52b6f91b60b
cb1c9017ee50a51fb4356566438843d1a6f88ef5
/app/src/main/java/com/lll/posserviceaidl/bean/PrinterParams.java
f8a4c9ff6c9a0a7d8ac977937b609b71261e22a7
[]
no_license
HahalongGit/PosClient
fedd2f4120c3f7dedd5ff0c141deb3707cb711ad
2916220f2785137e167938471cbe839656142f78
refs/heads/master
2020-09-20T22:42:15.479657
2019-12-20T07:59:30
2019-12-20T07:59:30
224,608,865
0
0
null
null
null
null
UTF-8
Java
false
false
5,966
java
package com.lll.posserviceaidl.bean; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; /** * 打印参数 * * @author runningDigua * @date 2019/11/27 */ public class PrinterParams implements Parcelable { // 对齐方式 enum ALIGN { LEFT, CENTER, RIGHT } enum DATATYPE { //文本 TEXT, // 走纸 FEED_LINE, // 一维码 BARCODE, // 二维码 QRCODE, //图片 IMAGE } /** * 待打数据布局 * */ ALIGN align = ALIGN.LEFT; /*** * 待打数据类型 */ DATATYPE dataType = DATATYPE.TEXT; /*** * 待打印文字、条码内容 */ String text = "";//最大 2K // /*** 打印文本字体大小 */ int textSize = 24;//矢量字体 // /*** 打印文本是否斜体 */ boolean isItalic = false; /*** 打印文本是否有中划线 */ boolean isStrikeThruText = false; /*** 打印文本行间隔 */ int lineSpace = 0; /*** 打印文本是否加粗 */ boolean bold = false; /*** 打印文本是否有下划线 */ boolean underLine = false; /** * 打印一维码宽 */ int barcodeWidth = 200;//200~600 /*** 打印一维码高 */ int barcodeHeight = 50;//50~600 /*** 打印二维码宽度 */ int qrcodeWidth = 250; /*** 打印图片的 biamap */ Bitmap bitmap; /*** 待打印图片宽度 */ int imgWidth;//0~384 /*** 待打印图片高度 */ int imgHeigth; /*** 走纸行数,0~255 */ int feedlineNum; public String getText() { return text; } public void setText(String text) { this.text = text; } public int getTextSize() { return textSize; } public void setTextSize(int textSize) { this.textSize = textSize; } public boolean isItalic() { return isItalic; } public void setItalic(boolean italic) { isItalic = italic; } public boolean isStrikeThruText() { return isStrikeThruText; } public void setStrikeThruText(boolean strikeThruText) { isStrikeThruText = strikeThruText; } public int getLineSpace() { return lineSpace; } public void setLineSpace(int lineSpace) { this.lineSpace = lineSpace; } public boolean isBold() { return bold; } public void setBold(boolean bold) { this.bold = bold; } public boolean isUnderLine() { return underLine; } public void setUnderLine(boolean underLine) { this.underLine = underLine; } public int getBarcodeWidth() { return barcodeWidth; } public void setBarcodeWidth(int barcodeWidth) { this.barcodeWidth = barcodeWidth; } public int getBarcodeHeight() { return barcodeHeight; } public void setBarcodeHeight(int barcodeHeight) { this.barcodeHeight = barcodeHeight; } public int getQrcodeWidth() { return qrcodeWidth; } public void setQrcodeWidth(int qrcodeWidth) { this.qrcodeWidth = qrcodeWidth; } public Bitmap getBitmap() { return bitmap; } public void setBitmap(Bitmap bitmap) { this.bitmap = bitmap; } public int getImgWidth() { return imgWidth; } public void setImgWidth(int imgWidth) { this.imgWidth = imgWidth; } public int getImgHeigth() { return imgHeigth; } public void setImgHeigth(int imgHeigth) { this.imgHeigth = imgHeigth; } public int getFeedlineNum() { return feedlineNum; } public void setFeedlineNum(int feedlineNum) { this.feedlineNum = feedlineNum; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.align == null ? -1 : this.align.ordinal()); dest.writeInt(this.dataType == null ? -1 : this.dataType.ordinal()); dest.writeString(this.text); dest.writeInt(this.textSize); dest.writeByte(this.isItalic ? (byte) 1 : (byte) 0); dest.writeByte(this.isStrikeThruText ? (byte) 1 : (byte) 0); dest.writeInt(this.lineSpace); dest.writeByte(this.bold ? (byte) 1 : (byte) 0); dest.writeByte(this.underLine ? (byte) 1 : (byte) 0); dest.writeInt(this.barcodeWidth); dest.writeInt(this.barcodeHeight); dest.writeInt(this.qrcodeWidth); dest.writeParcelable(this.bitmap, flags); dest.writeInt(this.imgWidth); dest.writeInt(this.imgHeigth); dest.writeInt(this.feedlineNum); } public PrinterParams() {} protected PrinterParams(Parcel in) { int tmpAlign = in.readInt(); this.align = tmpAlign == -1 ? null : ALIGN.values()[tmpAlign]; int tmpDataType = in.readInt(); this.dataType = tmpDataType == -1 ? null : DATATYPE.values()[tmpDataType]; this.text = in.readString(); this.textSize = in.readInt(); this.isItalic = in.readByte() != 0; this.isStrikeThruText = in.readByte() != 0; this.lineSpace = in.readInt(); this.bold = in.readByte() != 0; this.underLine = in.readByte() != 0; this.barcodeWidth = in.readInt(); this.barcodeHeight = in.readInt(); this.qrcodeWidth = in.readInt(); this.bitmap = in.readParcelable(Bitmap.class.getClassLoader()); this.imgWidth = in.readInt(); this.imgHeigth = in.readInt(); this.feedlineNum = in.readInt(); } public static final Creator<PrinterParams> CREATOR = new Creator<PrinterParams>() { @Override public PrinterParams createFromParcel(Parcel source) {return new PrinterParams(source);} @Override public PrinterParams[] newArray(int size) {return new PrinterParams[size];} }; }
423dbb9c06e964f5d160ff2dbfbb298b40d06e34
fdee75d9cc74007849d8b60a1e01d3267f5edbd5
/totrigger.java
813beca24c4cc146ccdd088d942f9692ed96aefe
[]
no_license
GudaBhanu/Java1
03dcbf095e09040066762c2887a0e0bc45213cd5
5581eb01d9cbdac53572a41adc06be636ee21f19
refs/heads/master
2020-09-24T23:36:14.442438
2019-12-08T05:08:39
2019-12-08T05:08:39
225,870,404
0
0
null
null
null
null
UTF-8
Java
false
false
174
java
public class totrigger{ public static void main(String[] args) { for (int i=1; i<=10;i++) { System.out.println(" editing on totriggerfile with name bhanu" +i); } } }
b6cf343c61593dada3d514e82a75510020fcd8e2
fb2b633987735ae91a90771ad1103bd211f54912
/lab 04/zad2/src/smartHouse/client/Client.java
a9283790d92609f7380ca5a9c48e2c4c0e86de25
[]
no_license
mimagiera/rozprochy
905ace1a42c3d5086354abf3daa2d1bb4cd13aae
0013f43d38635358be0dfe611210fb50cf385a88
refs/heads/master
2022-09-17T19:50:43.252308
2020-05-31T12:51:18
2020-05-31T12:51:18
259,137,733
3
0
null
null
null
null
UTF-8
Java
false
false
3,404
java
package src.sr.ice.client; import SmartHouseModule.FridgePrx; import SmartHouseModule.SmartTvPrx; import SmartHouseModule.ThermometerPrx; import com.zeroc.Ice.Communicator; import com.zeroc.Ice.LocalException; import com.zeroc.Ice.ObjectPrx; import com.zeroc.Ice.Util; import java.util.Map; public class Client { private static Map<String, String> deviceToIdentity = Map.of("veryGoodTv", "smartTv/veryGoodTv", "veryBadTv", "smartTv/veryBadTv", "basicFridge", "smartTv/basicFridge", "basicThermometer", "smartTv/basicThermometer"); static String getDeviceProxy(String device) { return deviceToIdentity.get(device) + ":tcp -h localhost -p 10000"; } private static ObjectPrx getObjProxy(Communicator communicator, String deviceName) { return communicator.stringToProxy(getDeviceProxy(deviceName)); } public static void main(String[] args) { int status = 0; Communicator communicator = null; try { communicator = Util.initialize(args); SmartTvPrx veryGoodTv = SmartTvPrx.checkedCast(getObjProxy(communicator, "veryGoodTv")); SmartTvPrx veryBadTv = SmartTvPrx.checkedCast(getObjProxy(communicator, "veryBadTv")); FridgePrx basicFridge = FridgePrx.checkedCast(getObjProxy(communicator, "basicFridge")); ThermometerPrx basicThermometer = ThermometerPrx.checkedCast(getObjProxy(communicator, "basicThermometer")); if (veryGoodTv == null) throw new Error("Invalid proxy"); String line = null; java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); do { try { System.out.print("==> "); System.out.flush(); line = in.readLine(); if (line == null) { break; } else if (line.equals("goodTv")) { String goodTvName = veryGoodTv.getName(); System.out.println(goodTvName); } else if (line.equals("badTv")) { String veryBadTvName = veryBadTv.getName(); System.out.println(veryBadTvName); } else if (line.equals("therm")) { String basicThermometerName = basicThermometer.getName(); System.out.println(basicThermometerName); } else if (line.equals("fridge")) { String basicFridgeName = basicFridge.getName(); System.out.println(basicFridgeName); } } catch (java.io.IOException ex) { ex.printStackTrace(); } } while (!line.equals("x")); } catch (LocalException e) { e.printStackTrace(); status = 1; } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } if (communicator != null) { // Clean up // try { communicator.destroy(); } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } } System.exit(status); } }
2a02e306ea1ac62565665281e4d6fcfb024fd9ee
8a9ea8da46495e8aa60d73373ac7b423cb5adac7
/app/src/main/java/com/example/vladka/mymetaphory/utilities/NetworkUtils.java
bc9c17804fdb2caf7493ab58ec32860f8d552dd2
[]
no_license
Vladi-ca/MyMetaphory
e826fbfa8bc638a7508cfd294a4fff744fd9c32e
994cfdc6d7e72019e554759076ca2c3d67f0aa61
refs/heads/master
2021-05-03T10:24:37.191573
2018-02-06T22:58:00
2018-02-06T22:58:00
118,055,008
0
0
null
null
null
null
UTF-8
Java
false
false
3,959
java
package com.example.vladka.mymetaphory.utilities; import android.net.Uri; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.Scanner; /** * Created by Vladka on 22/01/2018. */ public class NetworkUtils { final static String GITHUB_BASE_URL = "https://api.github.com/search/repositories"; private static final String STATIC_JSON_URL = "https://andfun-weather.udacity.com/staticweather"; final static String PARAM_QUERY = "q"; final static String PARAM_SORT = "sort"; final static String sortBy = "stars"; public static URL buildUrl(String githubSearchQuery) { // builds Github query // buldUpon = to obtain a builder representing an existing URI, constructs a new builder, copying the attributes from this Uri Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { // printStackTrace() = tells me where and what happened in the code when Exception is diagnosed, a method of the class Throwable of java.lang package e.printStackTrace(); } return url; } public static String getResponseFromHttpUrl (URL url) throws IOException { // openConnection() = manipulate parameters that affect the connection to the remote resource // and connection object is created by invoking the method on a URL // it does not talk to network yet, it just creates the http URL connection object HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try { // getInputStream = returns an input stream that reads from this open connection InputStream in = urlConnection.getInputStream(); /* sets the delimiter of this Scanner object its helpfull if I would use Scanner to split String into multiple tokens The scanner class is used to split the String and output the tokens in the console e.g. "Vladi/Female/30" gives output if useDelimeter("/") then gives: Vladi Female 30 */ // Scanner tokenised stream Scanner scanner = new Scanner(in); /* we force the scanner to read entire contents of the stream into the next token stream it buffers the data!!! = pulls the data from the network in small chunks, but because http is not required to give us a content size thus! our code needs to handle buffer of different sizes. It allocates and deallocates the buffers as needed. Also handles character encoding for us. It translates from UTF-8 (default encoding for JSON and JS to UTF-16 (format used by Android) */ scanner.useDelimiter("\\A"); // prints the tokenised Strings /* The next() and hasNext() methods and their primitive-type companion methods (such as nextInt() and hasNextInt()) first skip any input that matches the delimiter pattern, and then attempt to return the next token. Both hasNext and next methods may block waiting for further input. Whether a hasNext method blocks has no connection to whether or not its associated next method will block. */ boolean hasInput = scanner.hasNext(); if (hasInput) { return scanner.next(); } else { return null; } } finally { urlConnection.disconnect(); } } }
a995e1929f07868ef36df1227fbf54722b5d4480
bcc236d7cff08efdcaf560290cbd45caed7f6508
/SecondNoteBook/src/main/java/my/webchat/service/impl/WebChatIndexServiceImpl.java
47a6d842ddcd021319c4753ab9d5a29a24afafcb
[]
no_license
becauseOfLazy/myFirstProject
40905a36e298aef0610ad6101937e03bdcd735ed
31265b12b74335fb3f2f7e15d0426caaab17e7e4
refs/heads/master
2020-03-25T06:33:26.722868
2018-09-12T06:50:16
2018-09-12T06:50:16
143,509,237
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package my.webchat.service.impl; import javax.annotation.Resource; import javax.sql.rowset.serial.SerialException; import org.springframework.stereotype.Service; import my.common.entity.User; import my.fore_end.dao.UserDao; import my.fore_end.exception.ServiceException; import my.webchat.service.WebChatIndexService; @Service public class WebChatIndexServiceImpl implements WebChatIndexService{ @Resource private UserDao udao; public User getUserByUserName(String username) { User user = udao.getByUserName (username); if(user==null){ throw new ServiceException ("用户不存在!"); } return user; } }
9ebc486aa0a50d3c8c995a02443cb2f6bf2e3d03
152d168b988854fb7d600ea5ef54ca1ea5f4405f
/app/src/main/java/com/yifan/dapaointerview/helper/PermissionHelper.java
17437d7169a32c341035583da863147c960179b7
[]
no_license
SamuelSun1995/daPaoInterview
01b8408623cec3da31bec6d995b0fb2862b8c51e
6346f3b023914c26758d8899137290ed4856974e
refs/heads/main
2023-04-25T21:44:35.584693
2021-05-25T06:45:47
2021-05-25T06:45:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,450
java
package com.yifan.dapaointerview.helper; import android.content.Context; import com.yanzhenjie.permission.Action; import com.yanzhenjie.permission.AndPermission; import com.yanzhenjie.permission.Rationale; /** * 权限封装类 */ public class PermissionHelper { public static void requestMultiPermission(Context context, Action grantedAction, Action deniedAction, String... permissions) { requestMultiPermission(context, grantedAction, deniedAction, null, permissions); } /** * 请求权限组. * * @param context Context * @param grantedAction 权限允许监听 * @param deniedAction 权限拒绝监听 * @param rationale 请求失败的回调,用户拒绝一次权限,再次申请时先征求用户同意,再打开授权对话框 * @param permissions 权限组 */ private static void requestMultiPermission(Context context, Action grantedAction, Action deniedAction, Rationale rationale, String... permissions) { AndPermission.with(context) .runtime() .permission(permissions) .onGranted(grantedAction) .onDenied(deniedAction) .rationale(rationale) .start(); } public static void requestSinglePermission(Context context, Action grantedAction, Action deniedAction, String permission) { requestSinglePermission(context, grantedAction, deniedAction, null, permission); } /** * 请求单个权限. * * @param context Context * @param grantedAction 权限允许监听 * @param deniedAction 权限拒绝监听 * @param rationale 请求失败的回调,用户拒绝一次权限,再次申请时先征求用户同意,再打开授权对话框 * @param permission 权限组 */ private static void requestSinglePermission(Context context, Action grantedAction, Action deniedAction, Rationale rationale, String permission) { AndPermission.with(context) .runtime() .permission(permission) .onGranted(grantedAction) .onDenied(deniedAction) .rationale(rationale) .start(); } }
05434b6762ec7624e7fdc90b68d4b9457cb5efde
257f5d9f3e3d6fadecd785a41b5504fe72a90fd7
/src/day54_abstraction/student/Student.java
e0b147e7c3e034214d0ac81bd84d3e8df068891a
[]
no_license
Dilnoz9140/StaticBlockDemo.java
c36fde2a3a47d080575fb83f67be4db028c244fb
42f634d97b406d925ee04201e75a77c41779d011
refs/heads/master
2023-06-20T14:44:58.699643
2021-07-17T21:16:07
2021-07-17T21:16:07
385,745,238
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package day54_abstraction.student; /** * -> we add abstract keyword to a class to make it an abstract class. * -> We cannot create object of Student class - meaning: * Student student = new Student(); will show ERROR * -> what can we do with this Student class? We can extend this class by sub classes * -> Student class will Parent class for all other types of student related classes */ public abstract class Student { public void code(String language) { System.out.println("Student is coding using " + language); } /** * we can add abstract methods into abstract class. * abstract method -> is created using abstract keyword * and does not have the implementation/method body * * So abstract class only shows WHAT it can do, but not HOW by using abstract methods. */ public abstract void attendClass(); }
ac7e42d306e41239e2b7aa5d8ef312a2edf57d8e
bffca60adff25c82b8bb0d08e6a2188c71b2c331
/ep-common/src/main/java/com/weida/epcommon/chart/pie/PieOption.java
e588b18aaf46e7fd618519c3c0baa8ab2b2576e0
[]
no_license
ahweida/ahweida
7489311793c9b78457bce298f310e3e4cb7cdd50
a53aa784f305dee347171876afcbbfd54f67a032
refs/heads/main
2023-03-31T03:31:51.885653
2021-03-24T05:59:05
2021-03-24T05:59:05
350,717,592
0
0
null
null
null
null
UTF-8
Java
false
false
1,666
java
package com.weida.epcommon.chart.pie; import com.weida.epcommon.chart.common.Legend; import com.weida.epcommon.chart.common.Title; import com.weida.epcommon.chart.common.Tooltip; import lombok.Data; import java.util.List; @Data public class PieOption { private Title title; private Legend legend; private List<PieSerie> series; private List<String> color; private Tooltip tooltip; public PieOption(){ } public PieOption(List<PieSerie> series){ this.series = series; } // option = { // title: { // text: '某站点用户访问来源', // subtext: '纯属虚构', // left: 'center' // }, // tooltip: { // trigger: 'item', // formatter: '{a} <br/>{b} : {c} ({d}%)' // }, // legend: { // orient: 'vertical', // left: 'left', // data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'] // }, // series: [ // { // name: '访问来源', // type: 'pie', // radius: '55%', // center: ['50%', '60%'], // data: [ // {value: 335, name: '直接访问'}, // {value: 310, name: '邮件营销'}, // {value: 234, name: '联盟广告'}, // {value: 135, name: '视频广告'}, // {value: 1548, name: '搜索引擎'} // ], // emphasis: { // itemStyle: { // shadowBlur: 10, // shadowOffsetX: 0, // shadowColor: 'rgba(0, 0, 0, 0.5)' // } // } // } // ] //}; }
4931673d763fe7730b4f9dc0a87850c743f4e4bc
63b007ebfac164be647e211df4b776aa465a8bb5
/src/main/java/net/ilexiconn/jurassicraft/client/model/entity/ModelMeganeuraEgg.java
e1cb82bfdc433689c52c3b90fe62ca3013629856
[ "LicenseRef-scancode-public-domain" ]
permissive
iLexiconn/JurassiCraft
2eee4317d9eed041f61faefc2be99c69230a2449
f5bfd4b068b96e7abc573cdf758718c76fd0c6b0
refs/heads/master
2021-01-21T21:39:59.851144
2016-07-11T08:37:11
2016-07-11T08:37:11
20,406,475
6
6
null
2015-03-31T20:24:05
2014-06-02T14:18:25
Java
UTF-8
Java
false
false
1,233
java
package net.ilexiconn.jurassicraft.client.model.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelMeganeuraEgg extends ModelBase { // fields ModelRenderer Shape1; public ModelMeganeuraEgg() { textureWidth = 32; textureHeight = 32; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 1, 1, 2); Shape1.setRotationPoint(0F, 23F, 0F); Shape1.setTextureSize(32, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Shape1.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } }
47b691a70b1d2694092132611b6edd2c1080a7f7
33d97b8daad7e3dea9f0edb495f3b186aefc77af
/intro_java/Animal Extra Credit/src/Eagle1.java
698eab2768c96715909635ab5c8f90078d6e2c50
[]
no_license
BroderickHigby/java_projects
51c19d45f2b71cb41b8641c3b7824691d74a00d9
d425253d24a6cd6cb89bc8b015a952b494101f42
refs/heads/master
2020-03-22T05:59:14.588722
2018-07-04T10:04:46
2018-07-04T10:04:46
139,604,479
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
/*Programmer: Broderick Higby * Program: Eagle1 * Date: 7 May 2015 * Description: This eagle class gives specific info for the AnimalMenu and Animal1Program classes to use working w/ AnimalBase */ public class Eagle1 extends AnimalBase { //This is the awesome Eagle class that extends the AnimalBase and is called by AnimalMenu and Animal1Program public Eagle1(String name, int legs, String Environment) { super(name, legs, Environment); } //getHello returns the animal sound, this is the only real specific thing that can't be identified within the base class public String getHello() { return "Eaaaaaaaaaaaahhhhh"; //Returns the Eagles sound; which is the sound of American freedom ringing } }
0a2e0f032c69cb57d715f34ee60761a7397874f4
4db0a9cf822c2b6e99eee0960a81aecba8572892
/BACK/logging/src/main/java/com/company/logging/auxiliary/StudentSubjectMarksRepository.java
c4f6b06baa4646fce9d6dbb9be884b3f50a28c26
[]
no_license
DShcherbak/Course-work
c42988fd285e425c649ff393ebcbfccfcb7ce2e9
e83e3649e63477051a67aa815318cf2eb5c9162a
refs/heads/main
2023-05-08T00:36:11.649976
2021-05-31T02:41:42
2021-05-31T02:41:42
370,002,704
0
0
null
null
null
null
UTF-8
Java
false
false
1,069
java
package com.company.logging.auxiliary; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.util.Pair; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; import java.util.List; @Repository public interface StudentSubjectMarksRepository extends JpaRepository<StudentSubjectMarks, Long> { @Query("SELECT ssm FROM StudentSubjectMarks ssm WHERE ssm.subjectId = ?1") List<StudentSubjectMarks> selectBySubjectId(Long subjectId); @Transactional @Modifying @Query("DELETE FROM StudentSubjectMarks ssm where ssm.subjectId = ?1") void deleteAllBySubjectId(Long id); @Query("SELECT ssm.studentId FROM StudentSubjectMarks ssm where ssm.subjectId = ?1") List<Long> getStudentBySubjectId(Long subjectId); @Query("SELECT ssm FROM StudentSubjectMarks ssm WHERE ssm.subjectId = ?1") List<StudentSubjectMarks> getMarksBySubject(Long subjectId); }
5d08b04bc72d7cfa9d5b0208616ba54a56bfe69c
705ced9d8ad12f86aea8a0b39e2f898b95bd6d10
/core/src/main/java/org/mestor/reflection/Valuable.java
4c889e98df11b14ff6ba2f50dfb19608e57004f1
[ "Apache-2.0" ]
permissive
alexradzin/Mestor
0aabaaf00afadca7616c6346e5b73c94c07943df
6d4371a9f9f388657cc757c19517280dc6f744dc
refs/heads/master
2016-09-10T09:52:21.223654
2014-02-24T21:05:21
2014-02-24T21:05:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package org.mestor.reflection; import java.lang.reflect.AccessibleObject; public abstract class Valuable<T extends AccessibleObject, V> { protected final T accessible; protected Valuable(T accessible) { this.accessible = accessible; } @SuppressWarnings("unchecked") public V value(Object ... args) { try { return (V)valueImpl(args); } catch (ReflectiveOperationException e) { throw new IllegalArgumentException(e); } } protected abstract Object valueImpl(Object ... args) throws ReflectiveOperationException; }
bec0cc568e071580f2bd34e81b76d1d8394d3e29
aa3cde82a7b1cab0182c8ce5a5d09796d6772f1e
/AppsterAndroid/Appster/app/src/main/java/com/appster/customview/SubPlayerStatusView.java
5c6f22089e37befe4193ff1da500122cd45c06c8
[]
no_license
zaizaixinhtrai/belive
fc474fc588bb3065f04e2e30239ca2790eb6c957
db38db29f040e40865d1f5bfa3e35e36fd797ccf
refs/heads/master
2020-09-10T00:39:40.313547
2019-11-14T03:54:06
2019-11-14T03:54:06
221,606,172
0
1
null
null
null
null
UTF-8
Java
false
false
14,327
java
package com.appster.customview; import android.content.Context; import android.os.Handler; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import androidx.annotation.Nullable; import com.appster.R; import com.appster.features.stream.CountDownAnimation; import com.appster.features.stream.Role; import com.appster.features.stream.State; import com.appster.utility.AppsterUtility; import com.appster.utility.ImageLoaderUtil; import com.appster.utility.glide.BlurTransformation; import com.apster.common.Utils; import java.lang.ref.WeakReference; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import timber.log.Timber; /** * Created by thanhbc on 9/6/17. */ public class SubPlayerStatusView extends FrameLayout { @Bind(R.id.rippleBackground) RippleBackground rippleBackground; @Bind(R.id.tvUserName) CustomFontTextView tvUserName; @Bind(R.id.tvCallStatus) AnimateTextView tvCallStatus; @Bind(R.id.ibEndCall) ImageButton ibEndCall; @Bind(R.id.civAvatar) CircleImageView civAvatar; @Bind(R.id.flPlayerStatus) FrameLayout llPlayerStatus; @Bind(R.id.ivHostAvatar) ImageView ivGuestAvatar; @Bind(R.id.vGuestAvatarOverlay) View mVGuestAvatarOverlay; @Bind(R.id.ibProfile) ImageButton ibProfile; @Bind(R.id.tvCountDown) CustomFontTextView tvCountDown; @Bind(R.id.flUserInfoContainer) FrameLayout flUserInfoContainer; @Bind(R.id.tvDisplayName) CustomFontTextView mTvDisplayName; @Role int mRole = Role.VIEWER; final int width = Utils.dpToPx(120); final int height = Utils.dpToPx(160); @State int mCurrentState = State.CONNECTING; OnClickListener mListener; private String mGuestAvatarLink = ""; private String mGuestDisplayName = ""; private String mGuesUserName = ""; private final Handler mHandler = new Handler(); private final WeakRunnable dismissOptionRunable = new WeakRunnable(this); public void setListener(OnClickListener listener) { mListener = listener; } public SubPlayerStatusView(Context context) { super(context); init(context); } public SubPlayerStatusView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(context); } //== event listeners =========================================================================== @OnClick(R.id.ibEndCall) public void onIbEndCallClicked() { if (mListener != null) mListener.onEndCallClicked(); } // @OnClick(R.id.flUserInfoContainer) // public void onDisplayNameClicked(View view) { // AppsterUtility.temporaryLockView(view); // if (mListener != null) mListener.onShowProfileClicked(mGuesUserName, mGuestAvatarLink); // } @OnClick(R.id.ibProfile) public void showUserProfile(View view) { AppsterUtility.temporaryLockView(view); if (mListener != null) mListener.onShowProfileClicked(mGuesUserName, mGuestAvatarLink); } //== inner methods ============================================================================= private void init(Context context) { LayoutInflater.from(context).inflate(R.layout.sub_player_state, this, true); ButterKnife.bind(this); resetState(); } private void loadGuestImage(String avatarUrl) { if (avatarUrl.isEmpty()) { loadDefaultGuestImage(); } else { ImageLoaderUtil.displayUserImage(getContext(), avatarUrl, ivGuestAvatar, width, height, new BlurTransformation(getContext().getApplicationContext())); } } public void setRole(@Role int role) { mRole = role; resetState(); } public void updateState(@State int status) { Timber.e("updateState %d", status); if (mCurrentState == status) { Timber.e("updateState same status returned %d", status); return; } if (mCurrentState == State.DISCONNECTED && status == State.DISCONNECTING) { Timber.e("mCurrentState is disconnected but received disconnecting"); return; } switch (status) { case State.ACCEPT: onAccept(); break; case State.AWAY: onAway(); break; case State.REJECT: onReject(); break; case State.NO_ANSWER: onNoAnswer(); break; case State.AUDIO_ONLY: onAudioOnly(); break; case State.VIDEO_AND_AUDIO: case State.CONNECTED: onConnected(); break; case State.DISCONNECTING: onDisconnecting(); break; case State.CONNECTING: case State.DISCONNECTED: onConnecting(); break; case State.RECONNECTED: onReconnecting(); break; default: break; } postInvalidate(); mCurrentState = status; Timber.e("status ***** %d", status); } private void onReconnecting() { initstate(); if (ibEndCall.getVisibility() != GONE) ibEndCall.setVisibility(GONE); if (mRole == Role.HOST) ibProfile.setVisibility(GONE); if (tvCallStatus.getVisibility() != VISIBLE) tvCallStatus.setVisibility(VISIBLE); tvCallStatus.setIndexBegin("Reconnecting...".indexOf(".") + 1); tvCallStatus.animateText("Reconnecting..."); mHandler.removeCallbacks(dismissOptionRunable); mHandler.postDelayed(dismissOptionRunable, 2000); } private void onAccept() { if (rippleBackground.isRippleAnimationRunning()) rippleBackground.stopRippleAnimation(); if (ibEndCall.getVisibility() == VISIBLE) ibEndCall.setVisibility(GONE); if (tvCallStatus.getVisibility() == VISIBLE) tvCallStatus.setVisibility(GONE); if (rippleBackground.getVisibility() == VISIBLE) rippleBackground.setVisibility(GONE); if (civAvatar.getVisibility() == VISIBLE) civAvatar.setVisibility(GONE); if (tvUserName.getVisibility() == VISIBLE) tvUserName.setVisibility(GONE); if (mVGuestAvatarOverlay.getVisibility() == VISIBLE) mVGuestAvatarOverlay.setVisibility(VISIBLE); startCountDown(); } private void onAway() { commonNotifyState("Away"); if (ibEndCall.getVisibility() != VISIBLE && mRole == Role.HOST) ibEndCall.setVisibility(VISIBLE); } private void onReject() { commonNotifyState("Rejected"); } private void onNoAnswer() { commonNotifyState("No Answer"); } private void commonNotifyState(String state) { initstate(); if (rippleBackground.isRippleAnimationRunning()) rippleBackground.stopRippleAnimation(); if (tvCallStatus.getVisibility() != VISIBLE) tvCallStatus.setVisibility(VISIBLE); tvCallStatus.setTextAndStopAnimation(state); if (ibEndCall.getVisibility() == VISIBLE) ibEndCall.setVisibility(INVISIBLE); } private void onAudioOnly() { rippleBackground.setVisibility(VISIBLE); if (tvUserName.getVisibility() != VISIBLE) tvUserName.setVisibility(VISIBLE); if (!rippleBackground.isRippleAnimationRunning()) rippleBackground.startRippleAnimation(); ivGuestAvatar.setVisibility(VISIBLE); civAvatar.setVisibility(VISIBLE); if (tvCallStatus.getVisibility() == VISIBLE) tvCallStatus.setVisibility(INVISIBLE); if (tvCallStatus.getVisibility() != VISIBLE) mVGuestAvatarOverlay.setVisibility(VISIBLE); } void onConnected() { if (mCurrentState == State.DISCONNECTING || mCurrentState == State.DISCONNECTED) { Timber.e("disconnecting state but call onConnected"); return; } if (rippleBackground.isRippleAnimationRunning()) rippleBackground.stopRippleAnimation(); ibEndCall.setVisibility(GONE); ibProfile.setVisibility(GONE); tvCallStatus.setTextAndStopAnimation("Connected"); tvCallStatus.setVisibility(GONE); rippleBackground.setVisibility(GONE); civAvatar.setVisibility(GONE); ivGuestAvatar.setVisibility(GONE); tvCountDown.setVisibility(GONE); tvUserName.setVisibility(GONE); flUserInfoContainer.setVisibility(VISIBLE); mVGuestAvatarOverlay.setVisibility(GONE); mCurrentState = State.CONNECTED; } private void onDisconnecting() { initstate(); if (ibEndCall.getVisibility() != GONE) ibEndCall.setVisibility(GONE); if (tvCallStatus.getVisibility() != VISIBLE) tvCallStatus.setVisibility(VISIBLE); tvCallStatus.setIndexBegin("Disconnecting...".indexOf(".") + 1); tvCallStatus.animateText("Disconnecting..."); } private void onConnecting() { if (mCurrentState == State.ACCEPT) return; initstate(); if (tvCallStatus.getVisibility() != VISIBLE) tvCallStatus.setVisibility(VISIBLE); tvCallStatus.setIndexBegin("Connecting...".indexOf(".") + 1); tvCallStatus.animateText("Connecting..."); ibEndCall.setVisibility(mRole == Role.HOST ? VISIBLE : INVISIBLE); } private void initstate() { if (!rippleBackground.isRippleAnimationRunning()) rippleBackground.startRippleAnimation(); if (rippleBackground.getVisibility() != VISIBLE) rippleBackground.setVisibility(VISIBLE); if (civAvatar.getVisibility() != VISIBLE) civAvatar.setVisibility(VISIBLE); if (ivGuestAvatar.getVisibility() != VISIBLE) ivGuestAvatar.setVisibility(VISIBLE); if (tvCountDown.getVisibility() != GONE) tvCountDown.setVisibility(GONE); if (tvUserName.getVisibility() != VISIBLE) tvUserName.setVisibility(VISIBLE); if (tvCallStatus.getVisibility() != VISIBLE) tvCallStatus.setVisibility(VISIBLE); if (mVGuestAvatarOverlay.getVisibility() != VISIBLE) mVGuestAvatarOverlay.setVisibility(VISIBLE); if (flUserInfoContainer.getVisibility() == VISIBLE) flUserInfoContainer.setVisibility(GONE); if (ibProfile.getVisibility() != GONE) ibProfile.setVisibility(GONE); } private void startCountDown() { if (tvCountDown.getVisibility() != VISIBLE) tvCountDown.setVisibility(VISIBLE); if (ivGuestAvatar.getVisibility() != VISIBLE) ivGuestAvatar.setVisibility(VISIBLE); // mCurrentState = State.CONNECTED; new CountDownAnimation(5000, 1000, tvCountDown, () -> { if (mListener != null) mListener.onCountDownCompleted(); }).start(); } public void showScreenOptions() { if (mRole == Role.HOST) { if (flUserInfoContainer.getVisibility() == VISIBLE) flUserInfoContainer.setVisibility(GONE); if (ibEndCall.getVisibility() != VISIBLE) ibEndCall.setVisibility(VISIBLE); if (mCurrentState == State.CONNECTED) { ibProfile.setVisibility(VISIBLE); } else { ibProfile.setVisibility(GONE); } if (mVGuestAvatarOverlay.getVisibility() != VISIBLE) mVGuestAvatarOverlay.setVisibility(VISIBLE); mHandler.removeCallbacks(dismissOptionRunable); mHandler.postDelayed(dismissOptionRunable, 2000); } else { if (mListener != null) mListener.onShowProfileClicked(mGuesUserName, mGuestAvatarLink); } } public void resetState() { mCurrentState = State.CONNECTING; rippleBackground.startRippleAnimation(); // ivGuestAvatar.post(this::loadDefaultGuestImage); mGuestAvatarLink = ""; ibEndCall.setVisibility(mRole == Role.HOST ? VISIBLE : INVISIBLE); if (mRole == Role.HOST) ibProfile.setVisibility(GONE); if (!rippleBackground.isRippleAnimationRunning()) rippleBackground.startRippleAnimation(); rippleBackground.setVisibility(VISIBLE); civAvatar.setVisibility(VISIBLE); ivGuestAvatar.setVisibility(VISIBLE); mVGuestAvatarOverlay.setVisibility(VISIBLE); tvCountDown.setVisibility(INVISIBLE); tvUserName.setVisibility(VISIBLE); tvCallStatus.setIndexBegin("Connecting...".indexOf(".") + 1); tvCallStatus.animateText("Connecting..."); tvCallStatus.setVisibility(VISIBLE); flUserInfoContainer.setVisibility(GONE); } private void loadDefaultGuestImage() { ImageLoaderUtil.displayUserImage(getContext(), R.drawable.user_image_default, ivGuestAvatar, width, height, new BlurTransformation(getContext().getApplicationContext())); } public void setGuesUserName(String guesUserName) { mGuesUserName = guesUserName; } public void setGuestName(String displayName) { mGuestDisplayName = displayName; tvUserName.setText(mGuestDisplayName); mTvDisplayName.setText(mGuestDisplayName); } public void setGuestAvatar(String avatarUrl) { mGuestAvatarLink = avatarUrl; loadGuestImage(avatarUrl); ImageLoaderUtil.displayUserImage(getContext(), mGuestAvatarLink, civAvatar); } private final static class WeakRunnable implements Runnable { private final WeakReference<SubPlayerStatusView> mSubPlayerStatusViewWeakReference; WeakRunnable(SubPlayerStatusView view) { mSubPlayerStatusViewWeakReference = new WeakReference<SubPlayerStatusView>(view); } @Override public void run() { final SubPlayerStatusView view = mSubPlayerStatusViewWeakReference.get(); if (view != null) { if (view.mCurrentState != State.AWAY) { view.onConnected(); } view.ibProfile.setVisibility(GONE); } } } public interface OnClickListener { void onEndCallClicked(); void onCountDownCompleted(); void onShowProfileClicked(String userName, String profilePic); } }
5dc194f65ee22eb36556eb674e0ddcac158e3d88
03de99362fddb54e7158455f14148d6b5dfea4ab
/code/changed/CSVParser.java
17705a2615e9908abc99a09b4f3f3d85b1bf305e
[]
no_license
CPHI-TVHS/curl_toan
27e819502da0e878ae162b8bcb6d16e21c2c58bd
ce161cabb263f14d261303c08d1f96f0d960faa2
refs/heads/master
2021-01-20T01:22:36.777805
2020-02-27T21:35:18
2020-02-27T21:35:18
89,260,329
0
0
null
2017-04-24T16:01:02
2017-04-24T16:01:02
null
UTF-8
Java
false
false
11,444
java
/** Copyright 2005 Bytecode Pty Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import java.io.*; import java.util.*; /** * A very simple CSV parser released under a commercial-friendly license. * This just implements splitting a single line into fields. * * @author Glen Smith * @author Rainer Pruy * */ public class CSVParser { private Scanner in; private char separator; private File csvFile = null;; private final char quotechar; private final char escape; private final boolean strictQuotes; private String pending; private boolean inField = false; private final boolean ignoreLeadingWhiteSpace; /** The default separator to use if none is supplied to the constructor. */ public static final char DEFAULT_SEPARATOR = ','; public static final int INITIAL_READ_SIZE = 128; /** * The default quote character to use if none is supplied to the * constructor. */ public static final char DEFAULT_QUOTE_CHARACTER = '"'; /** * The default escape character to use if none is supplied to the * constructor. */ public static final char DEFAULT_ESCAPE_CHARACTER = '\\'; /** * The default strict quote behavior to use if none is supplied to the * constructor */ public static final boolean DEFAULT_STRICT_QUOTES = false; /** * The default leading whitespace behavior to use if none is supplied to the * constructor */ public static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE = true; /** * Constructs CSVParser using a comma for the separator. */ public CSVParser() { this(DEFAULT_SEPARATOR, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER); } /** * Constructs CSVParser with supplied separator. * @param separator * the delimiter to use for separating entries. */ public CSVParser(char separator) { this(separator, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER); } /** * Constructs CSVParser with supplied separator and quote char. * @param separator * the delimiter to use for separating entries * @param quotechar * the character to use for quoted elements */ public CSVParser(char separator, char quotechar) { this(separator, quotechar, DEFAULT_ESCAPE_CHARACTER); } /** * Constructs CSVReader with supplied separator and quote char. * @param separator * the delimiter to use for separating entries * @param quotechar * the character to use for quoted elements * @param escape * the character to use for escaping a separator or quote */ public CSVParser(char separator, char quotechar, char escape) { this(separator, quotechar, escape, DEFAULT_STRICT_QUOTES); } /** * Constructs CSVReader with supplied separator and quote char. * Allows setting the "strict quotes" flag * @param separator * the delimiter to use for separating entries * @param quotechar * the character to use for quoted elements * @param escape * the character to use for escaping a separator or quote * @param strictQuotes * if true, characters outside the quotes are ignored */ public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes) { this(separator, quotechar, escape, strictQuotes, DEFAULT_IGNORE_LEADING_WHITESPACE); } /** * Constructs CSVReader with supplied separator and quote char. * Allows setting the "strict quotes" and "ignore leading whitespace" flags * @param separator * the delimiter to use for separating entries * @param quotechar * the character to use for quoted elements * @param escape * the character to use for escaping a separator or quote * @param strictQuotes * if true, characters outside the quotes are ignored * @param ignoreLeadingWhiteSpace * if true, white space in front of a quote in a field is ignored */ public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) { this.separator = separator; this.quotechar = quotechar; this.escape = escape; this.strictQuotes = strictQuotes; this.ignoreLeadingWhiteSpace = ignoreLeadingWhiteSpace; } public void setFile(String filePath) throws Exception{ csvFile = new File(filePath); in = new Scanner(csvFile); } public void setFile(File file) throws Exception{ csvFile = file; in = new Scanner(csvFile); } /** * * @return true if something was left over from last call(s) */ public boolean isPending() { return pending != null; } public ArrayList<Patient> parseFile() throws Exception{ ArrayList<Patient> patientList = new ArrayList<Patient>(); ArrayList<String> patientInput; Patient p; Organizer o = new Organizer(); patientInput = o.toArrayList(parseLine(in.nextLine())); o.setActualOrder(patientInput); while(in.hasNextLine()){ p = new Patient(); patientInput = o.toArrayList(parseLine(in.nextLine())); patientInput = o.organize(patientInput); for(int i = 0; i < patientInput.size(); i++) p.setInstance(i, patientInput.get(i)); patientList.add(p); } System.out.println(); return patientList; } public String[] parseLineMulti(String nextLine) throws IOException { return parseLine(nextLine, true); } public String[] parseLine(String nextLine) throws IOException { return parseLine(nextLine, false); } /** * Parses an incoming String and returns an array of elements. * * @param nextLine * the string to parse * @param multi * @return the comma-tokenized list of elements, or null if nextLine is null * @throws IOException if bad things happen during the read */ private String[] parseLine(String nextLine, boolean multi) throws IOException { if (!multi && pending != null) { pending = null; } if (nextLine == null) { if (pending != null) { String s = pending; pending = null; return new String[] {s}; } else { return null; } } List<String>tokensOnThisLine = new ArrayList<String>(); StringBuilder sb = new StringBuilder(INITIAL_READ_SIZE); boolean inQuotes = false; if (pending != null) { sb.append(pending); pending = null; inQuotes = true; } for (int i = 0; i < nextLine.length(); i++) { char c = nextLine.charAt(i); if (c == this.escape) { if( isNextCharacterEscapable(nextLine, inQuotes || inField, i) ){ sb.append(nextLine.charAt(i+1)); i++; } } else if (c == quotechar) { if( isNextCharacterEscapedQuote(nextLine, inQuotes || inField, i) ){ sb.append(nextLine.charAt(i+1)); i++; }else{ inQuotes = !inQuotes; // the tricky case of an embedded quote in the middle: a,bc"d"ef,g if (!strictQuotes) { if(i>2 //not on the beginning of the line && nextLine.charAt(i-1) != this.separator //not at the beginning of an escape sequence && nextLine.length()>(i+1) && nextLine.charAt(i+1) != this.separator //not at the end of an escape sequence ){ if (ignoreLeadingWhiteSpace && sb.length() > 0 && isAllWhiteSpace(sb)) { sb = new StringBuilder(INITIAL_READ_SIZE); //discard white space leading up to quote } else { sb.append(c); } } } } inField = !inField; } else if (c == separator && !inQuotes) { tokensOnThisLine.add(sb.toString()); sb = new StringBuilder(INITIAL_READ_SIZE); // start work on next token inField = false; } else { if (!strictQuotes || inQuotes){ sb.append(c); inField = true; } } } // line is done - check status if (inQuotes) { if (multi) { // continuing a quoted section, re-append newline sb.append("\n"); pending = sb.toString(); sb = null; // this partial content is not to be added to field list yet } else { throw new IOException("Un-terminated quoted field at end of CSV line"); } } if (sb != null) { tokensOnThisLine.add(sb.toString()); } return tokensOnThisLine.toArray(new String[tokensOnThisLine.size()]); } public void setSeperator(char delimiter){ separator = delimiter; } /** * precondition: the current character is a quote or an escape * @param nextLine the current line * @param inQuotes true if the current context is quoted * @param i current index in line * @return true if the following character is a quote */ private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped quotes in here. && nextLine.length() > (i+1) // there is indeed another character to check. && nextLine.charAt(i+1) == quotechar; } /** * precondition: the current character is an escape * @param nextLine the current line * @param inQuotes true if the current context is quoted * @param i current index in line * @return true if the following character is a quote */ protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped quotes in here. && nextLine.length() > (i+1) // there is indeed another character to check. && ( nextLine.charAt(i+1) == quotechar || nextLine.charAt(i+1) == this.escape); } /** * precondition: sb.length() > 0 * @param sb A sequence of characters to examine * @return true if every character in the sequence is whitespace */ protected boolean isAllWhiteSpace(CharSequence sb) { boolean result = true; for (int i = 0; i < sb.length(); i++) { char c = sb.charAt(i); if ( !Character.isWhitespace(c) ) { return false; } } return result; } }
a30cd1568e52ca5dbf64f17fd33408635b1b72b4
46ca3cf0b4230f80ae3aba4b9096af961af0a51c
/src/com/cn/leedane/mapper/OperateLogMapper.java
fdc9c1808375addc063a220353bb897c21f7194b
[]
no_license
LeeDane/leedaneMVC
e6421388de71896c590f1b83e0c1dc72c877c3fe
ec24fe85eda4902f415505f4fc7bf221a456f64d
refs/heads/master
2021-01-19T01:07:37.263537
2017-03-14T04:40:41
2017-03-14T04:40:41
63,657,404
0
0
null
null
null
null
UTF-8
Java
false
false
727
java
package com.cn.leedane.mapper; import java.util.List; import java.util.Map; import com.cn.leedane.model.OperateLogBean; /** * 操作日志的mapper接口类 * @author LeeDane * 2016年7月12日 上午11:13:51 * Version 1.0 */ public interface OperateLogMapper extends BaseMapper<OperateLogBean>{ /** * 分页获取单表的全部字段的数据 * 注意:1、这个只获取单表 * 2、获取的是该表的全部字段 * @param tableName 表名 * @param where where语句,参数需直接填写在字符串中 * @param pageSize 每页条数 * @param pageNo 第几页 * @return */ public List<Map<String, Object>> getlimits(String tableName, String where, int pageSize, int pageNo); }
033d5982e4b5ee849b25039825c81a53a730138f
02ae52c6beb89ca00bc3028bd085ca3d438fef9b
/Java/Spring/spring02_21/src/kr/or/kosta/mvc/controller/WebjsoupController.java
aa0f6c16390dd925610570eb414fe41597205535
[]
no_license
terryaa/JAVA_SpringMVC_OracleDMBS_JavaScript_Servlet-jsp
50d23e7a27c3d5c161bb1e914c6c333787bd68c0
0efc28b9ed55adabdbc0bc43d2703b8c32851f82
refs/heads/master
2020-04-15T18:13:20.656331
2019-05-08T02:48:06
2019-05-08T02:48:06
164,905,680
0
0
null
null
null
null
UHC
Java
false
false
1,895
java
package kr.or.kosta.mvc.controller; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @Controller public class WebjsoupController { @GetMapping("/jsoup") public String jsoup(Model m) { String URL = "https://weather.naver.com/rgn/cityWetrMain.nhn"; Document doc; try { doc=Jsoup.connect(URL).get(); Elements elem = doc.select("#content>table>tbody>tr:nth-child(1)"); //데이터만 추출할 경우 String[] str = elem.text().split(" "); for(String e: str) { System.out.println(e); } //element를 추출할 경우 - tr까지 다 적용 table <tr> System.out.println("elem :"+elem); System.out.println("str :"+str); m.addAttribute("elem",elem); //이미지만 추출할 경우 Elements elem2 = doc.select("#content>table>tbody>tr:nth-child(1) img"); System.out.println("elem2 :"+elem2); m.addAttribute("elem2",elem2); } catch (IOException e) { e.printStackTrace(); } return "jsoup1"; } @GetMapping("/jsoup2") public String webtoon(String url,String selector,Model m) { Document document; try { document = Jsoup.connect(url).get(); Elements elements = document.select(selector); List<String> list = new ArrayList<String>(); // String[] str = elements.text().split(" "); for(Element e: elements) { System.out.println(e); list.add(e.text()); } m.addAttribute("list",list); } catch (IOException e) { e.printStackTrace(); } return "jsoup2"; } @GetMapping("/jsoup3") public String inputweb() { return "jsoup3"; } }
15c4e99d2146df57347f569e30bfd68e336ec030
c89cf58fe1499e49f558b8218d4c1f0e8f70ae1f
/Spring_Hibernate/Spring_Boot/03-actuator-demo/src/main/java/com/luv2code/springboot/demo/mycoolapp/rest/FunRestController.java
d1a10322976cc48dca45b4526433610834f7c4ba
[]
no_license
AsteRons/Java
19f5efe80f87568a75aa775929c97ec553c70d62
63f4352aebd2cd8afa4b33795048f9a408c8d354
refs/heads/master
2022-03-01T15:59:32.469412
2020-05-25T14:47:10
2020-05-25T14:47:10
120,139,641
1
0
null
2022-02-09T23:46:24
2018-02-03T23:40:26
Java
UTF-8
Java
false
false
705
java
package com.luv2code.springboot.demo.mycoolapp.rest; import java.time.LocalDateTime; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class FunRestController { // expose "/" the return "Hello World" @GetMapping("/") public String sayHello() { return "Hello World! Time on server is : " + LocalDateTime.now(); } // expose new endpoint for "workout" @GetMapping("/workout") public String getDailyWorkout() { return "Run a hard 5k"; } // expose a new endpoint for "fortune" @GetMapping("/fortune") public String getDailyFortune() { return "Today is your lucky day"; } }
0f9034ea37de149f13628ebe349dc155bd8ed5e8
4b3d7fd54abe3b4c35536d1751f8bc31c51f92e1
/src/test/java/seedu/address/logic/parser/SortCommandParserTest.java
48fd3a90120991def458704be4c95baefa26afc0
[ "MIT" ]
permissive
AY2021S1-CS2103-T16-1/tp
dbb0edd02f4b05703a5949417219f2f65b1aee24
19052b7854fb0e75bc62d3032ef9bace348b52c6
refs/heads/master
2023-01-22T12:18:29.279955
2020-11-09T12:28:05
2020-11-09T12:28:05
297,009,080
3
6
NOASSERTION
2020-11-09T12:28:06
2020-09-20T05:32:30
Java
UTF-8
Java
false
false
2,120
java
package seedu.address.logic.parser; import static seedu.address.commons.core.Messages.MESSAGE_INSUFFICIENT_ARGUMENTS; import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.commons.core.Messages.MESSAGE_TOO_MANY_ARGUMENTS; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess; import org.junit.jupiter.api.Test; import seedu.address.logic.commands.SortCommand; public class SortCommandParserTest { private SortCommandParser parser = new SortCommandParser(); @Test public void parse_allFieldsSpecified_success() { assertParseSuccess(parser, "n a", new SortCommand("n", "a")); assertParseSuccess(parser, "n d", new SortCommand("n", "d")); assertParseSuccess(parser, "p a", new SortCommand("p", "a")); assertParseSuccess(parser, "p d", new SortCommand("p", "d")); } @Test public void parse_optionalFieldMissing_success() { assertParseSuccess(parser, "n", new SortCommand("n", "t")); assertParseSuccess(parser, "p", new SortCommand("p", "t")); } @Test public void parse_invalidValues_failure() { // empty String assertParseFailure(parser, "", String.format(MESSAGE_INVALID_COMMAND_FORMAT, String.format(MESSAGE_INSUFFICIENT_ARGUMENTS, SortCommand.COMMAND_WORD, 1, SortCommand.MESSAGE_USAGE))); // More than 2 arguments assertParseFailure(parser, "1 2 3", String.format(MESSAGE_INVALID_COMMAND_FORMAT, String.format(MESSAGE_TOO_MANY_ARGUMENTS, SortCommand.COMMAND_WORD, 2, SortCommand.MESSAGE_USAGE))); // Invalid String assertParseFailure(parser, "a", SortCommand.MESSAGE_USAGE); assertParseFailure(parser, "j", SortCommand.MESSAGE_USAGE); assertParseFailure(parser, "p 1", SortCommand.MESSAGE_USAGE); assertParseFailure(parser, "p n", SortCommand.MESSAGE_USAGE); assertParseFailure(parser, "n i", SortCommand.MESSAGE_USAGE); } }
4dd9bd3990a864affd7fa4c1424693a0fb489c2c
0c624dcd97a446ebff9f109372b533019efd29d3
/src/SumExecutor.java
390a4884c7ec2ae1087ecefd01644a37615bc680
[]
no_license
redperov/AdvancedJava_EX5_1
38a21d2aa0085383ca1562129d9d4eaadf01bd36
3e1d148008e4bfb7753c3e324a04df41eb058f3f
refs/heads/master
2022-09-11T08:01:35.513964
2020-05-29T11:07:50
2020-05-29T11:07:50
267,837,439
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
/** * Sums values that are pulled from a storage. */ public class SumExecutor implements Runnable { /** * The storage from which values to sum are pulled. */ private Storage storage; /** * Constructor. * @param storage storage to pull values from */ public SumExecutor(Storage storage) { this.storage = storage; } @Override public void run() { int[] valuesToSum; while ((valuesToSum = storage.getTwoValues()) != null) { storage.insertSum(valuesToSum[0] + valuesToSum[1]); } } }
171d604c323cf6acc963424b5a6923ac5e3d294b
88aa758723d9a2c0064b6014761612c4f1f612bf
/src/main/java/com/brasaca/cursomc/domain/Produto.java
d3059d7185d8fcf5c09e0150ede65292ad4abcb5
[]
no_license
aj-brasaca/cursomc
1dc9aefddd10726a1d4f7c5ac47bf80ed8b37b6f
386eaa0fb025cb9a67190aa7cbc627ad6858790d
refs/heads/master
2020-03-18T00:41:24.530232
2018-05-27T02:35:16
2018-05-27T02:35:16
134,107,695
0
0
null
null
null
null
UTF-8
Java
false
false
2,511
java
package com.brasaca.cursomc.domain; import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import net.minidev.json.annotate.JsonIgnore; @Entity public class Produto implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String nome; private Double preco; @JsonIgnore @ManyToMany @JoinTable(name = "PRODUTO_CATEGORIA", joinColumns = @JoinColumn(name = "produto_id"), inverseJoinColumns = @JoinColumn(name = "categoria_id") ) private List<Categoria> categorias = new ArrayList<>(); @JsonIgnore @OneToMany(mappedBy="id.produto") private Set<ItemPedido> itens = new HashSet<>(); public Produto() { } public Produto(Integer id, String nome, Double preco) { super(); this.id = id; this.nome = nome; this.preco = preco; } @JsonIgnore public List<Pedido> getPedidos() { List<Pedido> lista = new ArrayList<>(); for(ItemPedido x : itens) { lista.add(x.getPedido()); } return lista; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public Double getPreco() { return preco; } public void setPreco(Double preco) { this.preco = preco; } public List<Categoria> getCategorias() { return categorias; } public void setCategorias(List<Categoria> categorias) { this.categorias = categorias; } public Set<ItemPedido> getItens() { return itens; } public void setItens(Set<ItemPedido> itens) { this.itens = itens; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Produto other = (Produto) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
15110ffe6077f6371d02f6fbe542099bbc59b1c3
0069f9b5fe1abb7c20b2202d435d98c6dd5ab2fc
/lab7_WebServices/src/main/java/wsClient/GetCandidate.java
51c780a6e53e96f161be70c56252fdf3ee818d21
[]
no_license
bogdanKaftanatiy/StudyJavaEE
678222ff7d88f792a2a303619da85cd1bf11c80e
4b5593f37bec93f1612242ac01fa46760d4ec80c
refs/heads/master
2021-01-24T08:06:19.349629
2016-12-17T20:24:54
2016-12-17T20:24:54
70,192,596
1
0
null
null
null
null
UTF-8
Java
false
false
1,304
java
package wsClient; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for getCandidate complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="getCandidate"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "getCandidate", propOrder = { "arg0" }) public class GetCandidate { protected Integer arg0; /** * Gets the value of the arg0 property. * * @return * possible object is * {@link Integer } * */ public Integer getArg0() { return arg0; } /** * Sets the value of the arg0 property. * * @param value * allowed object is * {@link Integer } * */ public void setArg0(Integer value) { this.arg0 = value; } }
226fefc369778b0c1ea8863d13b8eff94c545de1
bc11851dac5486e8fc2ec828de150e563bad855f
/DESWEBMOB/LifeCycleCC3ANBUA/app/src/test/java/br/com/siqueira/lifecyclecc3anbua/ExampleUnitTest.java
2d7739c820243f7b80090cfffc209d9e859a3ce4
[]
no_license
lspessanha/USJT-CCOBN
4458b04daefc013ad71b83b75432380297ac02d1
1ecaa8330c09e98cb10b3ff71fcd78e06d06aeef
refs/heads/master
2020-03-27T00:09:36.581606
2018-10-31T01:20:50
2018-10-31T01:21:14
145,599,564
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package br.com.siqueira.lifecyclecc3anbua; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
689cb46a29e3b8a9192380941836ca6334698a8a
dffe44be18ff1207136875bb4301c613193a5dfa
/src/main/java/de/abbaddie/wot/fleet/data/ovent/FleetOventService.java
70a106d0674be839d1c420e17b1f4097933c3c88
[]
no_license
Biggerskimo/wots2-fleet
0264dc69ab3c12d853708222c88389f97b8ff60a
e5a0fb9b237383ef2f8c82424ffcacf5a03873d0
refs/heads/master
2021-01-02T09:08:41.549627
2012-05-06T17:02:58
2012-05-06T17:02:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package de.abbaddie.wot.fleet.data.ovent; import de.abbaddie.wot.fleet.data.fleet.Fleet; public interface FleetOventService { public void createAll(Fleet fleet); }
d02c036300801a2074ec03f38024a068e946e78e
9d9c5b6621db0b20bf61b65eca8de1e8d76b9eb1
/src/be/intecbrussel/FundaPractice/Practice1/CardDeck/Card.java
0f60b5bc52655283d702c2e58ccad39d86af4d12
[]
no_license
Sirisha130289/javaFundamentals
3394f35c15e5ff008c70451396825044333e79d9
c4030dee72974173282d067f5e240fe9bd999364
refs/heads/master
2020-09-03T15:52:05.000086
2020-02-25T12:19:25
2020-02-25T12:19:25
219,502,671
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
package be.intecbrussel.FundaPractice.Practice1.CardDeck; public class Card { private SuitType suitType; private Value number; public SuitType getSuitType() { return suitType; } public void setSuitType(SuitType suitType) { this.suitType = suitType; } public Value getNumber() { return number; } public void setNumber(Value number) { this.number = number; } public Card(SuitType suitType, Value number) { this.suitType = suitType; this.number = number; } @Override public String toString() { return "Card{" + "suitType=" + suitType + ", number=" + number + '}'; } }
bf97c8305dc205d5368faaa7d436529e46d41e20
ae4548243ea060ffeb201feaabd4a6cf17fada61
/kz-wutiegang/servlet的所有作业/servlet的第七次课/Wtg7/src/com/wtg/Test2.java
a0021825251a07afdd0ea6188f3f77999119a95a
[]
no_license
kaizhou-College/apri-homework
ef1654a3de62fe483cb9e815e3a09c34fb96c917
b8092d03461ba37b1e30a886b5ae0dac007b370a
refs/heads/master
2021-01-23T00:01:42.341789
2017-12-24T23:59:53
2017-12-24T23:59:53
102,425,806
3
1
null
2017-09-25T08:39:35
2017-09-05T02:46:01
PLSQL
GB18030
Java
false
false
1,456
java
package com.wtg; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameClassPair; import javax.naming.NamingEnumeration; import javax.naming.NamingException; public class Test2 { public static void main(String[] args) { try { //准备一张白纸 Properties ps=new Properties(); //将纸包装处理好 ps.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.FSContextFactory"); Context context = new InitialContext(ps); //获取当前类的根目录下的文件或文件夹 NamingEnumeration<NameClassPair> list = context.list(""); while (list.hasMoreElements()) { NameClassPair nextElement = list.nextElement(); System.out.println("nextElement=="+nextElement); } File file =(File) context.lookup("a.txt"); //读文件 FileReader fr=new FileReader(file); char[] ch=new char[1024]; int read = fr.read(ch); while(read!=-1){ System.out.println(new String(ch)); read = fr.read(ch); } fr.close(); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
d2818e95e1552e69ded741211f0355e323a18a61
7810ee083e1e73211535c49ce995a7d73a943a52
/insurance-dal/src/main/java/com/born/insurance/dal/dataobject/RelatedUserDO.java
ff0a4f4d035ad4bdda46abceaa4cf40970339df5
[]
no_license
robben766/insuranceSystem
702013b8ad83a596404c7718bff8097ac8a255fa
852acf72136b560a4a3cdf890eae02a55d4e2995
refs/heads/master
2023-03-15T08:15:26.434405
2018-01-31T08:03:35
2018-01-31T08:03:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,816
java
/** * www.yiji.com Inc. * Copyright (c) 2011 All Rights Reserved. */ package com.born.insurance.dal.dataobject; import java.io.Serializable; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; // auto generated imports import java.util.Date; /** * A data object class directly models database table <tt>related_user</tt>. * * This file is generated by <tt>specialmer-dalgen</tt>, a DAL (Data Access Layer) * code generation utility specially developed for <tt>paygw</tt> project. * * PLEASE DO NOT MODIFY THIS FILE MANUALLY, or else your modification may * be OVERWRITTEN by someone else. To modify the file, you should go to * directory <tt>(project-home)/biz/dal/src/conf/dalgen</tt>, and * find the corresponding configuration file (<tt>tables/related_user.xml</tt>). * Modify the configuration file according to your needs, then run <tt>specialmer-dalgen</tt> * to generate this file. * * @author peigen */ public class RelatedUserDO implements Serializable{ /** Comment for <code>serialVersionUID</code> */ private static final long serialVersionUID = -4282603875229233564L; //========== properties ========== private long relatedId; private long formId; private String formCode; private long taskId; private String exeStatus; private String projectCode; private String userType; private long userId; private String userAccount; private String userName; private String userMobile; private String userEmail; private long deptId; private String deptCode; private String deptName; private Date transferTime; private String remark; private String isCurrent; private String isDel; private Date rawAddTime; private Date rawUpdateTime; //========== getters and setters ========== public long getRelatedId() { return relatedId; } public void setRelatedId(long relatedId) { this.relatedId = relatedId; } public long getFormId() { return formId; } public void setFormId(long formId) { this.formId = formId; } public String getFormCode() { return formCode; } public void setFormCode(String formCode) { this.formCode = formCode; } public long getTaskId() { return taskId; } public void setTaskId(long taskId) { this.taskId = taskId; } public String getExeStatus() { return exeStatus; } public void setExeStatus(String exeStatus) { this.exeStatus = exeStatus; } public String getProjectCode() { return projectCode; } public void setProjectCode(String projectCode) { this.projectCode = projectCode; } public String getUserType() { return userType; } public void setUserType(String userType) { this.userType = userType; } public long getUserId() { return userId; } public void setUserId(long userId) { this.userId = userId; } public String getUserAccount() { return userAccount; } public void setUserAccount(String userAccount) { this.userAccount = userAccount; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserMobile() { return userMobile; } public void setUserMobile(String userMobile) { this.userMobile = userMobile; } public String getUserEmail() { return userEmail; } public void setUserEmail(String userEmail) { this.userEmail = userEmail; } public long getDeptId() { return deptId; } public void setDeptId(long deptId) { this.deptId = deptId; } public String getDeptCode() { return deptCode; } public void setDeptCode(String deptCode) { this.deptCode = deptCode; } public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } public Date getTransferTime() { return transferTime; } public void setTransferTime(Date transferTime) { this.transferTime = transferTime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getIsCurrent() { return isCurrent; } public void setIsCurrent(String isCurrent) { this.isCurrent = isCurrent; } public String getIsDel() { return isDel; } public void setIsDel(String isDel) { this.isDel = isDel; } public Date getRawAddTime() { return rawAddTime; } public void setRawAddTime(Date rawAddTime) { this.rawAddTime = rawAddTime; } public Date getRawUpdateTime() { return rawUpdateTime; } public void setRawUpdateTime(Date rawUpdateTime) { this.rawUpdateTime = rawUpdateTime; } /** * @return * * @see java.lang.Object#toString() */ @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } }
3575d4a8ef68c6f103854dcdfbbceb2a377ae471
1172666ab3a9b72557a7e20cb1ac00bf98366486
/src/SystemTime.java
ca03a19c03e61276bc9686d3e996a83a9e3210ed
[]
no_license
hoainam190100/Java
e351b21d95a8e2535eebdfd801f56804a9a559e2
b9ea4b413901cdc89f7d62da37b85d977be69b0d
refs/heads/master
2020-11-28T04:49:39.729970
2019-12-23T09:37:04
2019-12-23T09:37:04
229,707,553
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
import java.util.Date; public class SystemTime { public static void main(String[] args){ Date now =new Date(); System.out.println("Date now:"+ now ); } }
654597a1be99ef3ffbd7989847aaa315489222f1
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project312/src/test/java/org/gradle/test/performance/largejavamultiproject/project312/p1564/Test31296.java
66aebb1a39a6e7618f7ca209c8d6bee49cff3dcb
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,182
java
package org.gradle.test.performance.largejavamultiproject.project312.p1564; import org.junit.Test; import static org.junit.Assert.*; public class Test31296 { Production31296 objectUnderTest = new Production31296(); @Test public void testProperty0() { Production31293 value = new Production31293(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production31294 value = new Production31294(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production31295 value = new Production31295(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
b6f043e3cb7f35651dd55a90d4031e2165c9a394
492a3fd62f00d267c8913cb98717acedd142659f
/src/main/java/cc/yyf/procesor/Processor.java
919f3831d96bc96eda852911763730406c619ccc
[]
no_license
xzwb/plugin-demo
09b74e6740fcb5d098f79e86fc343a30f88ecc5e
def15f4d16771fd1e4ad77f7130a867b70b6021c
refs/heads/main
2022-12-26T08:30:48.557815
2020-10-11T07:34:36
2020-10-11T07:34:36
302,588,583
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package cc.yyf.procesor; import freemarker.template.TemplateException; import java.io.IOException; public interface Processor { public void process(SourceNoteData sourceNoteData) throws IOException, TemplateException; }
605cf291118cb717cec6a59c0243bc3776949087
fad5fa04b860b6997615d6bb8ef23a8c04b093fb
/src/comparableInterfaceExample1/src/comparableInterfaceExample1/SortMovies.java
2a93fcbd23f402178bd2c722834009a031179d29
[]
no_license
shruthiklk15/Java-practice
64ab68fd21021d1e5f08f7a2f23a644a62cdce72
c193956383e0bce33e98739083e0894ba6f4e8ee
refs/heads/main
2023-03-07T13:41:35.596815
2021-02-23T15:19:06
2021-02-23T15:19:06
308,560,175
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package comparableInterfaceExample1; import java.util.TreeSet; public class SortMovies { public static void main(String[] args) { Movies m1 = new Movies(250,"KGF1"); Movies m2 = new Movies(270,"KGF2"); Movies m3 = new Movies(150,"KGu3"); TreeSet<Movies> t = new TreeSet<Movies>(); t.add(m1); t.add(m2); t.add(m3); for(Movies m : t) { System.out.println(m); } } }
e64fbf0357a1c7d4f5aba68ac63a6e8b8d5e5096
d08cbee1d7f50c1825261cca044c37fede50f533
/src/org/iolani/frc/commands/auto/AutoLowBarAndShoot.java
7433281bca0c3894fe9edd925e729879ff481aac
[]
no_license
Iobotics/FRC-2016-Stronghold
ab646d1a51d7b1e9d848814575e9629e59e14442
421d8a8ce8cdee73021624121860f74098f852e8
refs/heads/master
2021-01-10T17:55:53.937177
2016-05-01T13:24:49
2016-05-01T13:24:49
51,663,935
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
package org.iolani.frc.commands.auto; import org.iolani.frc.commands.SeekGimbalElevation; import org.iolani.frc.commands.SeekGimbalToPosition; import org.iolani.frc.commands.SeekGimbalToPosition.GimbalPosition; import org.iolani.frc.commands.SetCameraPosition; import org.iolani.frc.commands.SetCameraPosition.CameraPosition; import org.iolani.frc.commands.SetShooterKicker; import org.iolani.frc.commands.SetShooterWheelPower; import org.iolani.frc.commands.SetShooterWheelSpeed; import edu.wpi.first.wpilibj.command.CommandGroup; import edu.wpi.first.wpilibj.command.WaitCommand; public class AutoLowBarAndShoot extends CommandGroup { public AutoLowBarAndShoot(boolean vision) { this.addSequential(new AutoDriveStraight(228)); this.addParallel(new SeekGimbalElevation(45.0)); this.addParallel(new SetCameraPosition(CameraPosition.ShotOptimal)); this.addSequential(new AutoTurn(55.0)); if(vision) { this.addSequential(new AutoVisionAzimuth(5)); } else { this.addSequential(new WaitCommand(3)); } this.addSequential(new SetShooterWheelSpeed(5500, true)); this.addSequential(new WaitCommand(1)); this.addSequential(new SetShooterKicker(true, true)); this.addSequential(new WaitCommand(0.25)); this.addParallel(new SetShooterKicker(false, true)); this.addParallel(new SetShooterWheelPower(0, true)); this.addParallel(new SeekGimbalToPosition(GimbalPosition.Home)); } }
0dde0843dfa86774123684a51db731643714f8c9
58a9ecda0597862108da0aece8bc14b236b9b836
/core/src/main/java/org/htsjdk/core/utils/IOUtils.java
5055830570e34c02bbdb373151ffd373002d1020
[ "BSD-3-Clause" ]
permissive
devopstoday11/htsjdk-next-beta
a5d1492bbf8a673ddba6094f6f7027284be9d298
45571dc1b4e4286870728ab26b680c2ce0e7c632
refs/heads/master
2022-02-24T15:11:30.705337
2019-02-14T15:53:37
2019-02-14T15:53:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package org.htsjdk.core.utils; import java.io.File; import java.io.IOException; import java.nio.file.Path; public class IOUtils { /** * Create a temporary file using a given name prefix and name suffix and return a {@link java.nio.file.Path}. * @param prefix * @param suffix * @return temp File that will be deleted on exit * @throws IOException */ public static Path createTempPath(final String prefix, final String suffix) throws IOException { final File tempFile = File.createTempFile(prefix, suffix); tempFile.deleteOnExit(); return tempFile.toPath(); } }
800ed1a31b8c594cd223d4f073bf72be1622428e
e8ed2b7b9da2f4bc67798487c471216515424dc4
/app/src/main/java/tydic/cn/com/helloworld/MySocketActivity.java
006f1ddfe3ca8e5dd00c8148f1dec4b0905ca4ef
[]
no_license
FireToYe/HelloWorld
d2618b7f38c792330bde1d45aff625c01f25b0f7
28118116f606c2bdc1fc9be8b4ad07aff0047e00
refs/heads/master
2021-01-12T07:09:05.929928
2017-01-19T06:34:21
2017-01-19T06:34:21
76,918,695
0
0
null
null
null
null
UTF-8
Java
false
false
1,642
java
package tydic.cn.com.helloworld; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.ServerSocket; import java.net.Socket; import tydic.cn.com.Thread.ClientThread; public class MySocketActivity extends AppCompatActivity { private TextView tvShow; private EditText etSend; public Handler handler; Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_socket); tvShow = (TextView) findViewById(R.id.tv_show); etSend = (EditText) findViewById(R.id.et_send); btn = (Button)findViewById(R.id.btn_send); btn.setOnClickListener(v -> { String content = etSend.getText().toString(); etSend.setText(""); handler.obtainMessage(0x456,content); }); handler = new Handler(){ @Override public void handleMessage(Message msg) { if(msg.what==0x123){ tvShow.append("\n"+msg.obj.toString()); } super.handleMessage(msg); } }; } }
8a0cc6417adb8756ea41a44269d68c15df4f81e2
4d16d88c79f541efd89223a5b67eba381e1f3bbc
/src/org/traccar/protocol/Tk102Protocol.java
4e1d067f942b531af529eda8cac292792e01643f
[ "Apache-2.0" ]
permissive
demianalonso/traccar
c310d77e3eab1212513c199b36feacbc484def3f
412702aeb4baab45e9432ec3ded30426b1ecc58f
refs/heads/master
2021-01-15T09:01:48.180605
2016-03-17T19:11:34
2016-03-17T19:11:34
37,136,858
3
2
null
2015-06-09T14:26:19
2015-06-09T14:26:19
null
UTF-8
Java
false
false
1,761
java
/* * Copyright 2015 Anton Tananaev ([email protected]) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; import java.util.List; public class Tk102Protocol extends BaseProtocol { public Tk102Protocol() { super("tk102"); } @Override public void initTrackerServers(List<TrackerServer> serverList) { serverList.add(new TrackerServer(new ServerBootstrap(), this.getName()) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, ']')); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Tk102ProtocolDecoder(Tk102Protocol.this)); } }); } }
a0d077c2c9386a61df8e8098ee5a7b74ecff0b12
12b14b30fcaf3da3f6e9dc3cb3e717346a35870a
/examples/commons-math3/mutations/mutants-LaguerreSolver/240/org/apache/commons/math3/analysis/solvers/LaguerreSolver.java
600ac1eb0eab0a4e86c0756914f334a1d84e8ccd
[ "BSD-3-Clause", "Minpack", "Apache-2.0" ]
permissive
SmartTests/smartTest
b1de326998857e715dcd5075ee322482e4b34fb6
b30e8ec7d571e83e9f38cd003476a6842c06ef39
refs/heads/main
2023-01-03T01:27:05.262904
2020-10-27T20:24:48
2020-10-27T20:24:48
305,502,060
0
0
null
null
null
null
UTF-8
Java
false
false
15,944
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.math3.analysis.solvers; import org.apache.commons.math3.complex.Complex; import org.apache.commons.math3.complex.ComplexUtils; import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; import org.apache.commons.math3.exception.NoBracketingException; import org.apache.commons.math3.exception.NullArgumentException; import org.apache.commons.math3.exception.NoDataException; import org.apache.commons.math3.exception.TooManyEvaluationsException; import org.apache.commons.math3.exception.NumberIsTooLargeException; import org.apache.commons.math3.exception.util.LocalizedFormats; import org.apache.commons.math3.util.FastMath; /** * Implements the <a href="http://mathworld.wolfram.com/LaguerresMethod.html"> * Laguerre's Method</a> for root finding of real coefficient polynomials. * For reference, see * <quote> * <b>A First Course in Numerical Analysis</b> * ISBN 048641454X, chapter 8. * </quote> * Laguerre's method is global in the sense that it can start with any initial * approximation and be able to solve all roots from that point. * The algorithm requires a bracketing condition. * * @version $Id$ * @since 1.2 */ public class LaguerreSolver extends AbstractPolynomialSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; /** Complex solver. */ private final ComplexSolver complexSolver = new ComplexSolver(); /** * Construct a solver with default accuracy (1e-6). */ public LaguerreSolver() { this(DEFAULT_ABSOLUTE_ACCURACY); } /** * Construct a solver. * * @param absoluteAccuracy Absolute accuracy. */ public LaguerreSolver(double absoluteAccuracy) { super(absoluteAccuracy); } /** * Construct a solver. * * @param relativeAccuracy Relative accuracy. * @param absoluteAccuracy Absolute accuracy. */ public LaguerreSolver(double relativeAccuracy, double absoluteAccuracy) { super(relativeAccuracy, absoluteAccuracy); } /** * Construct a solver. * * @param relativeAccuracy Relative accuracy. * @param absoluteAccuracy Absolute accuracy. * @param functionValueAccuracy Function value accuracy. */ public LaguerreSolver(double relativeAccuracy, double absoluteAccuracy, double functionValueAccuracy) { super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy); } /** * {@inheritDoc} */ @Override public double doSolve() throws TooManyEvaluationsException, NumberIsTooLargeException, NoBracketingException { final double min = getMin(); final double max = getMax(); final double initial = getStartValue(); final double functionValueAccuracy = getFunctionValueAccuracy(); verifySequence(min, initial, max); // Return the initial guess if it is good enough. final double yInitial = computeObjectiveValue(initial); if (FastMath.abs(yInitial) <= functionValueAccuracy) { return initial; } // Return the first endpoint if it is good enough. final double yMin = computeObjectiveValue(min); if (FastMath.abs(yMin) <= functionValueAccuracy) { return min; } // Reduce interval if min and initial bracket the root. if (yInitial * yMin < 0) { return laguerre(min, initial, yMin, yInitial); } // Return the second endpoint if it is good enough. final double yMax = computeObjectiveValue(max); if (FastMath.abs(yMax) <= functionValueAccuracy) { return max; } // Reduce interval if initial and max bracket the root. if (yInitial * yMax < 0) { return laguerre(initial, max, yInitial, yMax); } throw new NoBracketingException(min, max, yMin, yMax); } /** * Find a real root in the given interval. * * Despite the bracketing condition, the root returned by * {@link LaguerreSolver.ComplexSolver#solve(Complex[],Complex)} may * not be a real zero inside {@code [min, max]}. * For example, <code>p(x) = x<sup>3</sup> + 1,</code> * with {@code min = -2}, {@code max = 2}, {@code initial = 0}. * When it occurs, this code calls * {@link LaguerreSolver.ComplexSolver#solveAll(Complex[],Complex)} * in order to obtain all roots and picks up one real root. * * @param lo Lower bound of the search interval. * @param hi Higher bound of the search interval. * @param fLo Function value at the lower bound of the search interval. * @param fHi Function value at the higher bound of the search interval. * @return the point at which the function value is zero. * @deprecated This method should not be part of the public API: It will * be made private in version 4.0. */ @Deprecated public double laguerre(double lo, double hi, double fLo, double fHi) { final Complex c[] = ComplexUtils.convertToComplex(getCoefficients()); final Complex initial = new Complex(0.5 * (lo + hi), 0); final Complex z = complexSolver.solve(c, initial); if (complexSolver.isRoot(lo, hi, z)) { return z.getReal(); } else { double r = Double.NaN; // Solve all roots and select the one we are seeking. Complex[] root = complexSolver.solveAll(c, initial); for (int i = 0; i < root.length; i++) { if (complexSolver.isRoot(lo, hi, root[i])) { r = root[i].getReal(); break; } } return r; } } /** * Find all complex roots for the polynomial with the given * coefficients, starting from the given initial value. * <br/> * Note: This method is not part of the API of {@link BaseUnivariateSolver}. * * @param coefficients Polynomial coefficients. * @param initial Start value. * @return the point at which the function value is zero. * @throws org.apache.commons.math3.exception.TooManyEvaluationsException * if the maximum number of evaluations is exceeded. * @throws NullArgumentException if the {@code coefficients} is * {@code null}. * @throws NoDataException if the {@code coefficients} array is empty. * @since 3.1 */ public Complex[] solveAllComplex(double[] coefficients, double initial) throws NullArgumentException, NoDataException, TooManyEvaluationsException { setup(Integer.MAX_VALUE, new PolynomialFunction(coefficients), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, initial); return complexSolver.solveAll(ComplexUtils.convertToComplex(coefficients), new Complex(initial, 0d)); } /** * Find a complex root for the polynomial with the given coefficients, * starting from the given initial value. * <br/> * Note: This method is not part of the API of {@link BaseUnivariateSolver}. * * @param coefficients Polynomial coefficients. * @param initial Start value. * @return the point at which the function value is zero. * @throws org.apache.commons.math3.exception.TooManyEvaluationsException * if the maximum number of evaluations is exceeded. * @throws NullArgumentException if the {@code coefficients} is * {@code null}. * @throws NoDataException if the {@code coefficients} array is empty. * @since 3.1 */ public Complex solveComplex(double[] coefficients, double initial) throws NullArgumentException, NoDataException, TooManyEvaluationsException { setup(Integer.MAX_VALUE, new PolynomialFunction(coefficients), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, initial); return complexSolver.solve(ComplexUtils.convertToComplex(coefficients), new Complex(initial, 0d)); } /** * Class for searching all (complex) roots. */ private class ComplexSolver { /** * Check whether the given complex root is actually a real zero * in the given interval, within the solver tolerance level. * * @param min Lower bound for the interval. * @param max Upper bound for the interval. * @param z Complex root. * @return {@code true} if z is a real zero. */ public boolean isRoot(double min, double max, Complex z) { if (isSequence(min, z.getReal(), max)) { double tolerance = FastMath.max(getRelativeAccuracy() * z.abs(), getAbsoluteAccuracy()); return (FastMath.abs(z.getImaginary()) <= tolerance) || (z.abs() <= getFunctionValueAccuracy()); } return false; } /** * Find all complex roots for the polynomial with the given * coefficients, starting from the given initial value. * * @param coefficients Polynomial coefficients. * @param initial Start value. * @return the point at which the function value is zero. * @throws org.apache.commons.math3.exception.TooManyEvaluationsException * if the maximum number of evaluations is exceeded. * @throws NullArgumentException if the {@code coefficients} is * {@code null}. * @throws NoDataException if the {@code coefficients} array is empty. */ public Complex[] solveAll(Complex coefficients[], Complex initial) throws NullArgumentException, NoDataException, TooManyEvaluationsException { if (coefficients == null) { throw new NullArgumentException(); } final int n = coefficients.length - 1; if (n == 0) { throw new NoDataException(LocalizedFormats.POLYNOMIAL); } // Coefficients for deflated polynomial. final Complex c[] = new Complex[n + 1]; for (int i = 0; i <= n; i++) { c[i] = coefficients[i]; } // Solve individual roots successively. final Complex root[] = new Complex[n]; for (int i = 0; i < n; i++) { final Complex subarray[] = new Complex[n - i + 1]; System.arraycopy(c, 0, subarray, 0, subarray.length); root[i] = solve(subarray, initial); // Polynomial deflation using synthetic division. Complex newc = c[n - i]; Complex oldc = null; for (int j = n - i - 1; j >= 0; j--) { oldc = c[j]; c[j] = newc; newc = oldc.add(newc.multiply(root[i])); } } return root; } /** * Find a complex root for the polynomial with the given coefficients, * starting from the given initial value. * * @param coefficients Polynomial coefficients. * @param initial Start value. * @return the point at which the function value is zero. * @throws org.apache.commons.math3.exception.TooManyEvaluationsException * if the maximum number of evaluations is exceeded. * @throws NullArgumentException if the {@code coefficients} is * {@code null}. * @throws NoDataException if the {@code coefficients} array is empty. */ public Complex solve(Complex coefficients[], Complex initial) throws NullArgumentException, NoDataException, TooManyEvaluationsException { if (coefficients == null) { throw new NullArgumentException(); } final int n = coefficients.length - 1; if (n == 0) { throw new NoDataException(LocalizedFormats.POLYNOMIAL); } final double absoluteAccuracy = getAbsoluteAccuracy(); final double relativeAccuracy = getRelativeAccuracy(); final double functionValueAccuracy = getFunctionValueAccuracy(); final Complex nC = new Complex(n, 0); final Complex n1C = new Complex(n - 1, 0); Complex z = initial; Complex oldz = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); while (true) { // Compute pv (polynomial value), dv (derivative value), and // d2v (second derivative value) simultaneously. Complex pv = coefficients[n]; Complex dv = Complex.ZERO; Complex d2v = Complex.ZERO; for (int j = n-1; j >= 0; j--) { d2v = dv.add(z.multiply(d2v)); dv = pv.add(z.multiply(dv)); pv = coefficients[j].add(z.multiply(pv)); } d2v = d2v.multiply(new Complex(2.0, 0.0)); // Check for convergence. final double tolerance = FastMath.max(relativeAccuracy * z.abs(), absoluteAccuracy); if ((z.subtract(oldz)).abs() <= tolerance) { return z; } if (pv.abs() <= functionValueAccuracy) { return z; } // Now pv != 0, calculate the new approximation. final Complex G = dv.divide(pv); final Complex G2 = G.multiply(G); final Complex H = G2.subtract(d2v.divide(pv)); final Complex delta = n1C.multiply((nC.multiply(H)).subtract(G2)); // Choose a denominator larger in magnitude. final Complex deltaSqrt = delta.sqrt(); final Complex dplus = G.add(deltaSqrt); final Complex dminus = G.subtract(deltaSqrt); final Complex denominator = dplus.abs() > dminus.abs() ? dplus : dminus; // Perturb z if denominator is zero, for instance, // p(x) = x^3 + 1, z = 0. if (true) { z = z.add(new Complex(absoluteAccuracy, absoluteAccuracy)); oldz = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); } else { oldz = z; z = z.subtract(nC.divide(denominator)); } incrementEvaluationCount(); } } } }
94da66f783d29202cdf2c1bf0145c73ca4506571
6eecf296c14f716c01f8cbbfc1b5d9b6219f3f2e
/Esercitazione/src/com/java/prodotti/Zucchero.java
476e3a317e20e4bce601518e237b8b36f4f87939
[]
no_license
ValentinaRebiscini/rep_corso
fd090cc32c8b988f4ac39c2d8cee60afd2d9884b
f3c1bb319ffe7370978e4f53d2c65a9a8554c253
refs/heads/master
2023-06-29T18:30:23.837100
2021-07-28T10:06:51
2021-07-28T10:06:51
390,267,583
0
0
null
null
null
null
UTF-8
Java
false
false
2,831
java
package com.java.prodotti; import com.java.prodotti.categorie.*; import com.java.prodotti.prodottiprezzati.*; public class Zucchero extends Prodotto implements ProdottoPrezzato { private String iDProdotto; private final String sigla; private double prezzoAlKg; private double peso; private String tipo; public Zucchero(CategoriaProdotti categoria, String descrizione, String sigla, double prezzoAlKg, double peso, String tipo) { super(categoria, descrizione); this.sigla = sigla; this.prezzoAlKg = prezzoAlKg; this.peso = peso; this.tipo = tipo; this.iDProdotto = generaIDProdotto(sigla); } public String getIDProdotto() { return iDProdotto; } public String getSigla() { return sigla; } public double getPrezzoAlKg() { return prezzoAlKg; } public double getPeso() { return peso; } public double getPrezzo() { return prezzoAlKg * peso; } public String getTipo() { return tipo; } public void setPrezzoAlKg(double prezzoAlKg) { this.prezzoAlKg = prezzoAlKg; } public void setPeso(double peso) { this.peso = peso; } public void setTipo(String tipo) { this.tipo = tipo; } private String generaIDProdotto(String sigla) { return sigla + Math.round(Math.random()*Math.pow(10, 6)); } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((iDProdotto == null) ? 0 : iDProdotto.hashCode()); long temp; temp = Double.doubleToLongBits(peso); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(prezzoAlKg); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + ((sigla == null) ? 0 : sigla.hashCode()); result = prime * result + ((tipo == null) ? 0 : tipo.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; Zucchero other = (Zucchero) obj; if (iDProdotto == null) { if (other.iDProdotto != null) return false; } else if (!iDProdotto.equals(other.iDProdotto)) return false; if (Double.doubleToLongBits(peso) != Double.doubleToLongBits(other.peso)) return false; if (Double.doubleToLongBits(prezzoAlKg) != Double.doubleToLongBits(other.prezzoAlKg)) return false; if (sigla == null) { if (other.sigla != null) return false; } else if (!sigla.equals(other.sigla)) return false; if (tipo == null) { if (other.tipo != null) return false; } else if (!tipo.equals(other.tipo)) return false; return true; } @Override public String toString() { return "Zucchero [iDProdotto=" + iDProdotto + ", sigla=" + sigla + ", prezzoAlKg=" + prezzoAlKg + ", peso=" + peso + ", tipo=" + tipo + "]"; } }
68965d62a073c4c2c76be6a342734b26fe06ff87
cc0820d97b8df14ef171fb594b8d302752b5745c
/app/src/main/java/com/assignment/binlix26/case_study_bmc/admin/EditVisitorActivity.java
6bdd3486b5808aa795895feae025e6e7c975cc9d
[]
no_license
Binlix26/Case_Study_BMC
8ae64600a258269fe8c1ef1783b104d9542f3620
a7a4ffbac46cd6b183faa2ee456f3008bc44185b
refs/heads/master
2020-09-17T00:01:07.597226
2017-06-22T06:46:15
2017-06-22T06:46:15
94,489,994
0
3
null
null
null
null
UTF-8
Java
false
false
2,647
java
package com.assignment.binlix26.case_study_bmc.admin; import android.content.ContentValues; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.assignment.binlix26.case_study_bmc.AdminActivity; import com.assignment.binlix26.case_study_bmc.R; import com.assignment.binlix26.case_study_bmc.data.BMCContract.VisitorEntry; public class EditVisitorActivity extends AppCompatActivity { private EditText etName; private EditText etBusiness; private EditText etPhone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_visitor); etName = (EditText) findViewById(R.id.edit_visitor_name); etBusiness = (EditText) findViewById(R.id.edit_visitor_business); etPhone = (EditText) findViewById(R.id.edit_visitor_phone); Button btAddVisitor = (Button) findViewById(R.id.edit_visitor_bt_add); btAddVisitor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (checkInput()) { insertVisitor(); } } }); } private void insertVisitor() { String name = etName.getText().toString(); String business = etBusiness.getText().toString(); String phone = etPhone.getText().toString(); ContentValues values = new ContentValues(); values.put(VisitorEntry.COLUMN_NAME, name); values.put(VisitorEntry.COLUMN_BUSINESS_NAME, business); values.put(VisitorEntry.COLUMN_PHONE, phone); getContentResolver().insert(VisitorEntry.CONTENT_URI, values); Intent admin = new Intent(this, AdminActivity.class); startActivity(admin); } private boolean checkInput() { String name = etName.getText().toString(); String title = etBusiness.getText().toString(); String phone = etPhone.getText().toString(); if (name.equals("") || title.equals("") || phone.equals("")) { new AlertDialog.Builder(this) .setTitle("Field Required") .setMessage("Please enter each field!") .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, null) .show(); return false; } return true; } }
1544b56f03c5a2e60ea450215b500674b5a023c7
0a61bcd89a0d1c49f21e66b50bb5cd305ad35117
/Projects/Luggage/developpement/ProjectColis/backend/colis/src/main/java/colis/com/entities/colisReceptionner/ColisReceptionnerContext.java
01306cc3e4ccdd03efcf2720c507febde132082e
[]
no_license
tchatchouang/babyProject
28e571a9a8e1fdfc8b707e35eba5619de811289f
cf5e9c10a63deab18a16c36e89874c94a3b5d40a
refs/heads/master
2020-03-26T01:43:38.015004
2018-08-15T13:12:19
2018-08-15T13:12:19
144,379,864
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
package colis.com.entities.colisReceptionner; import colis.com.entities.colis.Colis; import colis.com.entities.personnes.Personnes; public class ColisReceptionnerContext { private Personnes personnes; private Colis colis; public Personnes getPersonnes() { return personnes; } public void setPersonnes(Personnes personnes) { this.personnes = personnes; } public Colis getColis() { return colis; } public void setColis(Colis colis) { this.colis = colis; } }
04a66eddba578f4bd6639507453a6012bc82f91b
840a8c15cea0da3f2e8d8f6dfcc2dd4e0c02c96a
/service/src/it/polito/dp2/RNS/sol3/service/model/GateType.java
8063a1c08fa3cdad0a667b1d0194d338c93de261
[ "MIT" ]
permissive
marcomicera/rns
8b9651a331f1be22424deaac215138fdd68c924e
ec8588b968649a9eb52310438957822d4865ddf3
refs/heads/master
2020-05-17T00:40:06.177503
2020-04-11T13:40:14
2020-04-11T13:40:14
183,401,765
0
0
null
null
null
null
UTF-8
Java
false
false
795
java
package it.polito.dp2.RNS.sol3.service.model; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for GateType. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="GateType"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}token"> * &lt;enumeration value="IN"/> * &lt;enumeration value="OUT"/> * &lt;enumeration value="INOUT"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "GateType") @XmlEnum public enum GateType { IN, OUT, INOUT; public String value() { return name(); } public static GateType fromValue(String v) { return valueOf(v); } }
04606be5057382e329ad0742b2bab1a436d892db
280ca7e9bc0643e7aec53c2729fb0c65a4e77aef
/src/p03/textbook/InputDataCheckNaNExample2.java
b55e19275d44c6568401d2fc8decc300a5efc3da
[]
no_license
ParkSangPil/java20210325
0620701c603a847dd1a71f5272c7406d3fb6a439
2e0e42a1f4324fe8df7d7eed2e7a1532db8ca12d
refs/heads/master
2023-07-11T22:46:59.876381
2021-08-25T03:17:53
2021-08-25T03:17:53
351,269,453
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package p03.textbook; public class InputDataCheckNaNExample2 { public static void main(String[] args) { String userInput = "NaN"; double val = Double.valueOf(userInput); double currentBalance = 10000.0; if(Double.isNaN(val)) { System.out.println("NaN이 입력되어 처리할 수 없음"); val = 0.0; } currentBalance += val; System.out.println(currentBalance); } }
ee2ff9ae06c70f8872b1d482b9b4ac316b6ff3b5
5b20675279b8c3559512397563b7dacc690e8785
/gameserver/branches/maven/l2jfrozen-server/src/game/main/java/com/l2jfrozen/gameserver/handler/skillhandlers/Charge.java
6303ba7a3130278b999afa53d35fc64399e187e3
[]
no_license
Bokoa/l2jfrozen
0226a1d30eaf4bfa0078fedb46ac4f650cbca805
624d29604b1626f379929f0100c6a3a431a7f89b
refs/heads/master
2023-02-11T01:39:49.699822
2020-05-10T12:50:46
2020-05-10T12:50:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,482
java
/* * L2jFrozen Project - www.l2jfrozen.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package com.l2jfrozen.gameserver.handler.skillhandlers; import org.apache.log4j.Logger; import com.l2jfrozen.gameserver.handler.ISkillHandler; import com.l2jfrozen.gameserver.model.L2Character; import com.l2jfrozen.gameserver.model.L2Effect; import com.l2jfrozen.gameserver.model.L2Object; import com.l2jfrozen.gameserver.model.L2Skill; import com.l2jfrozen.gameserver.model.SkillType; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; /** * This class ... * @version $Revision: 1.1.2.2.2.9 $ $Date: 2005/04/04 19:08:01 $ */ public class Charge implements ISkillHandler { static Logger LOGGER = Logger.getLogger(Charge.class); /* * (non-Javadoc) * @see com.l2jfrozen.gameserver.handler.IItemHandler#useItem(com.l2jfrozen.gameserver.model.L2PcInstance, com.l2jfrozen.gameserver.model.L2ItemInstance) */ private static final SkillType[] SKILL_IDS = { /* SkillType.CHARGE */ }; @Override public void useSkill(final L2Character activeChar, final L2Skill skill, final L2Object[] targets) { for (final L2Object target1 : targets) { if (!(target1 instanceof L2PcInstance)) continue; L2PcInstance target = (L2PcInstance) target1; skill.getEffects(activeChar, target, false, false, false); target = null; } // self Effect :] L2Effect effect = activeChar.getFirstEffect(skill.getId()); if (effect != null && effect.isSelfEffect()) { // Replace old effect with new one. effect.exit(false); } skill.getEffectsSelf(activeChar); effect = null; } @Override public SkillType[] getSkillIds() { return SKILL_IDS; } }
855d66465da98308bd690ce528ad265130aaf7a4
6d0dc6a2601d8587d76656b51e007c93f093ffad
/src/android/support/v4/view/ViewCompatBase.java
ce558a3f0bd8dfba99da5edc7f61a88c56486a89
[]
no_license
DheepthaB/Sing-Along
b9b5e6f8e6a8d94948f7ed26f86b01acc83761b2
99eccf3431975ba0583c87367de7ccad99ff585b
refs/heads/master
2021-08-19T08:47:01.505751
2017-11-25T15:42:35
2017-11-25T15:42:35
111,056,421
0
0
null
null
null
null
UTF-8
Java
false
false
1,491
java
package android.support.v4.view; import android.content.res.ColorStateList; import android.graphics.PorterDuff.Mode; import android.view.View; class ViewCompatBase { static ColorStateList getBackgroundTintList(View paramView) { if ((paramView instanceof TintableBackgroundView)) { return ((TintableBackgroundView)paramView).getSupportBackgroundTintList(); } return null; } static PorterDuff.Mode getBackgroundTintMode(View paramView) { if ((paramView instanceof TintableBackgroundView)) { return ((TintableBackgroundView)paramView).getSupportBackgroundTintMode(); } return null; } static boolean isLaidOut(View paramView) { return (paramView.getWidth() > 0) && (paramView.getHeight() > 0); } static void setBackgroundTintList(View paramView, ColorStateList paramColorStateList) { if ((paramView instanceof TintableBackgroundView)) { ((TintableBackgroundView)paramView).setSupportBackgroundTintList(paramColorStateList); } } static void setBackgroundTintMode(View paramView, PorterDuff.Mode paramMode) { if ((paramView instanceof TintableBackgroundView)) { ((TintableBackgroundView)paramView).setSupportBackgroundTintMode(paramMode); } } } /* Location: C:\Softwares\dex2jar-0.0.9.15\dex2jar-0.0.9.15\classes_dex2jar.jar * Qualified Name: android.support.v4.view.ViewCompatBase * JD-Core Version: 0.7.0.1 */
d454058eefbb23a27b7accaf93363449e05ad3fe
f27cb821dd601554bc8f9c112d9a55f32421b71b
/entity-view/api/src/main/java/com/blazebit/persistence/view/spi/EntityViewConstructorMapping.java
11c142582046be32fc9dec014f009e795e6b0fec
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Blazebit/blaze-persistence
94f7e75154e80ce777a61eb3d436135ad6d7a497
a9b1b6efdd7ae388e7624adc601a47d97609fdaa
refs/heads/main
2023-08-31T22:41:17.134370
2023-07-14T15:31:39
2023-07-17T14:52:26
21,765,334
1,475
92
Apache-2.0
2023-08-07T18:10:38
2014-07-12T11:08:47
Java
UTF-8
Java
false
false
1,617
java
/* * Copyright 2014 - 2023 Blazebit. * * 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.blazebit.persistence.view.spi; import java.lang.reflect.Constructor; import java.util.List; /** * Mapping of an entity view constructor. * * @author Christian Beikov * @since 1.2.0 */ public interface EntityViewConstructorMapping { /** * Returns the mapping of the view declaring this constructor. * * @return The declaring view mapping */ public EntityViewMapping getDeclaringView(); /** * Returns the name of the view constructor. * * @return The view constructor name */ public String getName(); /** * Returns the constructor object of the declaring view java type represented by this mapping. * * @return The constructor represented by this mapping */ public Constructor<?> getConstructor(); /** * Returns the parameter mappings of this constructor mapping. * * @return The parameter mappings of this constructor mapping */ List<EntityViewParameterMapping> getParameters(); }
58cbf7572d1a5842be94032b68c2ba4d7862d423
bb4ad83c2bc6c0718e029af44a89dc56305fc6a3
/src/main/java/com/wisely/ch8_6_2/domain/PersonDao.java
91c67a60ad5cfff3708cd16ad70272d44027b47a
[]
no_license
Ma5k/SpringStudy_8_6_2
e74d77221fec0acbe70278fa3d466970d6bcaa27
1261f8ca05a39a9b03c0f316ec2d8c0b14bf4468
refs/heads/master
2020-04-08T04:10:04.940257
2018-11-26T14:44:03
2018-11-26T14:44:03
159,005,676
0
0
null
null
null
null
GB18030
Java
false
false
1,608
java
package com.wisely.ch8_6_2.domain; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Repository; import com.wisely.ch8_6_2.dao.Person; @Repository public class PersonDao { @Autowired StringRedisTemplate stringRedisTemplate; //1、SpringBoot已为我们配置StringRedisTemplate,在此处可以直接注入 @Autowired RedisTemplate<Object, Object> redisTemplate; //2、SpringBoot已为我们配置RedisTemplate,在此处可以直接注入 @Resource(name="stringRedisTemplate") ValueOperations<String, String> valOpsStr; //3、可以使用@Resource注解指定stringRedisTemplate,可注入基于字符串的简单属性操作方法。 @Resource(name="redisTemplate") ValueOperations<Object, Object> valOps; //4、可以使用@Resource注解指定redisTemplate,可注入基于对象的简单属性操作方法 public void stringRedisTemplateDemo() { //5、通过set方法,存储字符串类型。 valOpsStr.set("xx", "yy"); } public void save(Person person) { valOps.set(person.getId(), person); //6、通过set方法,存储对象类型。 } public String getString() { return valOpsStr.get("xx"); //7、通过get方法,获得字符串。 } public Person getPerson() { return (Person) valOps.get("1"); //8、通过get方法,获得对象。 } }
1121399f07be565090f55772cbaa57da3b754a4e
da06d16a0170307f0be724b2fd15fdc9adfd71e3
/src/main/java/com/qinjiance/tourist/model/po/User.java
184197f122dabb088dfd594f1ba0cd160d5effb7
[]
no_license
qinjiance/entour
a5b6938aa2e40bfb75dd27931f65dadcbd95723e
d1394fb8733500ea9d6c88ec7cdc9719098ad202
refs/heads/master
2021-01-21T13:29:53.903069
2016-05-10T07:58:21
2016-05-10T07:58:21
48,699,604
2
0
null
null
null
null
UTF-8
Java
false
false
3,277
java
package com.qinjiance.tourist.model.po; import java.util.Date; import module.laohu.commons.model.BaseObject; import org.apache.ibatis.type.Alias; import org.codehaus.jackson.annotate.JsonIgnore; /** * @author "Jiance Qin" * * @date 2014年7月16日 * * @time 下午5:04:33 * * @desc * */ @Alias("user") public class User extends BaseObject { /** * */ private static final long serialVersionUID = -8572870599755706702L; private Long id; private String email; private String mobile; private String nickname; @JsonIgnore private String salt; @JsonIgnore private String password; private Integer level; private String registerIp; private Date registerTime; private Date updateTime; /** * @return the id */ public Long getId() { return id; } /** * @param id * the id to set */ public void setId(Long id) { this.id = id; } /** * @return the email */ public String getEmail() { return email; } /** * @param email * the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the mobile */ public String getMobile() { return mobile; } /** * @param mobile * the mobile to set */ public void setMobile(String mobile) { this.mobile = mobile; } /** * @return the nickname */ public String getNickname() { return nickname; } /** * @param nickname * the nickname to set */ public void setNickname(String nickname) { this.nickname = nickname; } /** * @return the salt */ public String getSalt() { return salt; } /** * @param salt * the salt to set */ public void setSalt(String salt) { this.salt = salt; } /** * @return the password */ public String getPassword() { return password; } /** * @param password * the password to set */ public void setPassword(String password) { this.password = password; } /** * @return the level */ public Integer getLevel() { return level; } /** * @param level * the level to set */ public void setLevel(Integer level) { this.level = level; } /** * @return the registerIp */ public String getRegisterIp() { return registerIp; } /** * @param registerIp * the registerIp to set */ public void setRegisterIp(String registerIp) { this.registerIp = registerIp; } /** * @return the registerTime */ public Date getRegisterTime() { return registerTime; } /** * @param registerTime * the registerTime to set */ public void setRegisterTime(Date registerTime) { this.registerTime = registerTime; } /** * @return the updateTime */ public Date getUpdateTime() { return updateTime; } /** * @param updateTime * the updateTime to set */ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } /** * @return the serialversionuid */ public static long getSerialversionuid() { return serialVersionUID; } }
c481260070a80c2ab8525b64ed6af7a0626f4c12
a1b0fdce04d00f209130919240b27a6b7958aad1
/PRAKTIKUM2/src/test/java/latihan/praktikum2/autotesting/AppTest.java
21dd2d0359344637c7cfee00ca9e5cb9734b5660
[]
no_license
Viorra22/PEMROGRAMAN2-PRAKTIKUM
b3d473a308009fb248fbf5621df977f52a84432a
cb7a29736f350b3cfd2f8f48f715d5e3a3c07758
refs/heads/master
2020-06-03T13:54:55.197872
2014-07-09T11:07:03
2014-07-09T11:07:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
658
java
package latihan.praktikum2.autotesting; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
2c9c265db48e4b8aec833e7cc1ea060d7d2639d9
d38a0ef76ccd80bed9ecfb40c3fc9a215f485d58
/app/src/main/java/com/fillingapps/twittnearby/TwittnearbyApp.java
1915a3952d5e0eba236214db400f20b3c219a11b
[]
no_license
jalzueta/keepCodingMaster-AndroidAvanzado
67cb928748a25405bf9f04b2e6c260385eb07aa2
f43b836f0e7504f6cec50195413e3516ac48b222
refs/heads/master
2021-01-10T10:29:48.658883
2015-10-26T12:07:10
2015-10-26T12:07:10
44,942,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,235
java
package com.fillingapps.twittnearby; import android.app.Application; import android.content.Context; import android.util.Log; import java.lang.ref.WeakReference; public class TwittnearbyApp extends Application { // Lo guardaos como referencia débil para evitar ciclos "strong" private static WeakReference<Context> context; public static Context getAppContext() { return context.get(); } @Override public void onCreate() { super.onCreate(); // El contexto de una aplicacion es unico. Lo vamos a meter en una variable de la clase Application // para que podamos acceder a el en las clases que no lo tengas a mano (p.e. los Fragments) // "final" porque no va a variar (como los let de swift) final Context c = getApplicationContext(); context = new WeakReference<Context>(c); Log.d(TwittnearbyApp.class.getCanonicalName(), getString(R.string.log_twittnearby_starting)); } @Override public void onLowMemory() { super.onLowMemory(); // Envío una notificación a las clases que puedan estar activas Log.d(TwittnearbyApp.class.getCanonicalName(), getString(R.string.log_twittnearby_low_memory)); } }
85debb6c1d77540d0aea8471eceabba7e26b3a50
2c24b070c0f3816ff77cd6629affa970ec188e32
/newbiest-common-idgenerator/src/main/java/com/newbiest/common/idgenerator/service/GeneratorService.java
f9053fe27c07495852e81e14390e10de299dfb8c
[]
no_license
changanforgithub/resource
663d9d382265397e97cd433c3ab453f5cfc1f303
86fbf2fc4d597deff9111efc9ad552db424767a6
refs/heads/master
2020-03-26T05:27:28.989988
2018-08-13T07:26:26
2018-08-13T07:26:26
144,558,298
0
0
null
null
null
null
UTF-8
Java
false
false
1,293
java
package com.newbiest.common.idgenerator.service; import com.newbiest.base.exception.ClientException; import com.newbiest.base.utils.SessionContext; import com.newbiest.common.idgenerator.model.GeneratorRule; import com.newbiest.common.idgenerator.utils.GeneratorContext; import javax.validation.constraints.NotNull; import java.util.List; /** * Created by guoxunbo on 2018/8/6. */ public interface GeneratorService { void deleteGeneratorRule(Long ruleRrn, SessionContext sc) throws ClientException; String generatorId(long orgRrn, GeneratorContext context) throws ClientException; List<String> generatorId(long orgRrn, @NotNull GeneratorRule rule, GeneratorContext context) throws ClientException; List<String> generatorId(long orgRrn, @NotNull GeneratorRule rule, boolean isParameterList, GeneratorContext context) throws ClientException; List<Integer> getNextSequenceValue(long orgRrn, long generateRrn, String sequenceName, int count) throws ClientException;; List<Integer> getNextSequenceValue(long orgRrn, long generateRrn, String sequenceName, int count, int minValue) throws ClientException; List<Integer> getNextSequenceValue(long orgRrn, long generateRrn, String sequenceName, int count, int minValue, boolean newTrans) throws ClientException; }
215b8c0b037494981f03ff90c72dff1baaa2b400
a0dc6d239311f16455f0ed738bb3b7d63bf90ccb
/se-workspace/11day-static-abstract-interface/src/step2/TestStatic1.java
8be3b84254284caf61fb6a6c6e00e1dc81ef40cc
[]
no_license
8story8/java
e433ed74d251859baa30038b2ad8f57f424f9db5
2f59794f50cee6241fed182cedcf2a3d49c8d125
refs/heads/master
2021-04-03T09:22:28.516512
2018-07-09T08:21:47
2018-07-09T08:21:47
null
0
0
null
null
null
null
UHC
Java
false
false
512
java
package step2; class Person { int age = 1; static int sAge = 1; public static void test() { System.out.println("static test 실행" + sAge); } } public class TestStatic1 { public static void main(String[] args) { Person p = new Person(); System.out.println(p.age); // 객체 생성없이 클래스명.static 변수로 사용 가능 System.out.println(Person.sAge); // static 메서드이므로 객체 생성없이 클래스명으로 호출 Person.test(); } }
d838e270bf6dde4c8efd7d8e5989c5d185778342
04ef5337b55ffc2d8b54c0257e964f84bdaf3226
/src/com/tercen/model/base/BooleanPropertyBase.java
9510d105f87b210c96c1c9dfb2e601c5e0bf9aab
[]
no_license
ginberg/tercen_java_client
24a1047a3103f8d631f52fe38fcfbeacd168ec03
e75075847d18d88bac86efb77f727e341f3c51f6
refs/heads/main
2023-07-11T21:01:48.367143
2021-08-24T14:04:33
2021-08-24T14:04:33
391,846,180
0
0
null
2021-08-02T07:01:19
2021-08-02T07:01:19
null
UTF-8
Java
false
false
1,479
java
package com.tercen.model.base; import com.tercen.base.*; import com.tercen.model.impl.*; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Collection; public class BooleanPropertyBase extends Property { public boolean defaultValue; public BooleanPropertyBase() { super(); this.defaultValue = true; } public BooleanPropertyBase(LinkedHashMap m) { super(m); this.subKind = m.get(Vocabulary.SUBKIND) != null ? (String) m.get(Vocabulary.SUBKIND) : (String) (m.get(Vocabulary.KIND) != Vocabulary.BooleanProperty_CLASS ? m.get(Vocabulary.KIND) : null); this.defaultValue = (boolean) m.get(Vocabulary.defaultValue_DP); } public static BooleanProperty createFromJson(LinkedHashMap m) { return BooleanPropertyBase.fromJson(m); } public static BooleanProperty fromJson(LinkedHashMap m) { String kind = (String) m.get(Vocabulary.KIND); switch (kind) { case Vocabulary.BooleanProperty_CLASS: return new BooleanProperty(m); default: throw new IllegalArgumentException( "bad kind : " + kind + " for class BooleanProperty in fromJson constructor"); } } public LinkedHashMap toJson() { LinkedHashMap m = super.toJson(); m.put(Vocabulary.KIND, Vocabulary.BooleanProperty_CLASS); if (this.subKind != null && this.subKind != Vocabulary.BooleanProperty_CLASS) m.put(Vocabulary.SUBKIND, this.subKind); else m.remove(Vocabulary.SUBKIND); m.put(Vocabulary.defaultValue_DP, defaultValue); return m; } }
63affd4c2f9932a7f7a5f0f65d733845edbc0a61
1f3ff9e3525e225ebe9c3e6b2c45030d87ca80df
/app/src/test/java/com/ihandy/a2014011423/ExampleUnitTest.java
8cbde73ae57d21ae7ed77f60de1a165e6c8ae380
[]
no_license
cyz14/NewsApp
7f613ec05011af94748ecfe987b0c0dfb253a969
a2745e2e81cbcc8c8c39f54f5c0acd638f5e911a
refs/heads/master
2020-12-05T09:26:51.475213
2016-09-09T22:07:23
2016-09-09T22:07:23
67,834,794
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package com.ihandy.a2014011423; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
abe9eaf9000a7be86f44f4798c79b530ea41abbf
aba42afc4fdbdfb1900a0e09ef5696abf6078480
/app/src/main/java/com/example/firebasemi/Track.java
04b0ba50dbf80f7a4e0207867b60d9e2df66d557
[]
no_license
rashifmalikilyasa/FireBase
20a43847be8f2ebf3e979fd4b2d0b21476ad993c
3483b55a77c92a4e2854c97ea0423d8f40510e5b
refs/heads/master
2020-09-30T17:31:22.484809
2019-12-11T10:18:08
2019-12-11T10:18:08
227,336,358
0
0
null
null
null
null
UTF-8
Java
false
false
558
java
package com.example.firebasemi; public class Track { private String trackId; private String trackName; private int trackRating; public Track(){ } public Track(String trackId, String trackName, int trackRating) { this.trackId = trackId; this.trackName = trackName; this.trackRating = trackRating; } public String getTrackId() { return trackId; } public String getTrackName() { return trackName; } public int getTrackRating() { return trackRating; } }
6a50463c96a325a7a81d5460caa23879b931ecd0
ee25483939a6235e7976b4a9e463a3da28a17e29
/src/main/java/com/springboot/base/exceptions/ParamException.java
d17311153b209a69bf3ba84e59ca4e46b4864ce8
[]
no_license
taoyou1230/springboot-base
732910c9c0b2d71b88b36a1065e2c334a7541afe
52831e506936a54f6e71207292eb594cf0fc4d49
refs/heads/master
2020-05-02T03:12:54.885872
2019-03-29T09:09:16
2019-03-29T09:09:16
177,723,017
1
0
null
null
null
null
UTF-8
Java
false
false
587
java
package com.springboot.base.exceptions; /** * Author: Damon.CF * Company: UBIOT.CN * Date: $date$ * Description: $desc$ */ public class ParamException extends RuntimeException { private int code; private String msg; public ParamException(int code, String msg) { this.code = code; this.msg = 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; } }
18665801c06061698552db897c46ebb024c0520a
a1534d495f9a38f150eeba3cf5e4a49772502daa
/src/main/java/com/rick/amqp/AmqpApplication.java
3bfb1ee019f8d4a92143313d8eeebc50a216230b
[]
no_license
ricardo8504/amqp
5bb4833122deaa901ef35d66f9cee81e0bad63aa
d394809a13fc52041ea07eefdcda9a9a634759c1
refs/heads/master
2020-03-27T09:28:30.477488
2018-08-27T19:33:38
2018-08-27T19:33:38
146,344,567
0
0
null
null
null
null
UTF-8
Java
false
false
1,189
java
package com.rick.amqp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @EnableScheduling public class AmqpApplication { @Profile("usage_message") @Bean public CommandLineRunner usage() { return new CommandLineRunner() { @Override public void run(String... arg0) throws Exception { System.out.println("This app uses Spring Profiles to control its behavior.\n"); System.out.println("Sample usage: java -jar rabbit-tutorials.jar --spring.profiles.active=hello-world,sender"); } }; } @Profile("!usage_message") @Bean public CommandLineRunner tutorial() { return new RabbitAmqpTutorialsRunner(); } public static void main(String[] args) throws Exception { SpringApplication.run(AmqpApplication.class, args); } }
b3f4f1c0efc0b589864594166c85418b6eaaef2f
268589f690883f8fe21548e12b3c792f60afd6ec
/src/pong/game.java
e36471e63f0e05ca73bf0531636824c0975d1c59
[]
no_license
blueboxers/pongrepo
e69a3fa552cd84ce06f66c6b516cb6663876d1c2
693b3ae2f328993bc60059365777f63d81d2229e
refs/heads/master
2021-06-15T03:27:43.128381
2017-03-30T12:05:45
2017-03-30T12:06:10
86,107,083
0
0
null
null
null
null
UTF-8
Java
false
false
872
java
/* This is where the big functions are located and the "core" of the game essentially */ package pong; import java.awt.Graphics2D; public class game { boolean running = true; pongFrame mainFrame; pongBall mainBall; public game(){ mainFrame = new pongFrame(); mainBall = new pongBall(mainFrame.getSize().width, mainFrame.getSize().height); while(running){ getInput(); process(); draw(); } } public void getInput(){ } public void process(){ //mainBall.move(); } public void draw(){ mainBall.paintComponent(); } ///////////////////////////////////////////////////////////////////////// public static void main(String[] args) { game mainGame = new game(); } }
2c4f466d28751c3349c2074056071839feaa9de8
66892f1d3575d6af6fbf7632c60d95e7e810dab7
/SisTelecom/src/br/com/sistelecom/entity/Produto.java
1749be4ec3563442dddcadbdad42503785119b6e
[]
no_license
Letractively/projeto-sistelecom
058f36bc5ec6cf27f29d21efb42549a01c7a925a
db25b5f2cc30bfe347970713503eb8426fabb620
refs/heads/master
2021-01-10T16:55:05.995685
2012-11-07T14:04:12
2012-11-07T14:04:12
46,106,011
0
0
null
null
null
null
UTF-8
Java
false
false
1,529
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.com.sistelecom.entity; import java.util.Date; /** * * @author Danilo Alves */ public class Produto { private int idProduto; private String nomeProduto; private String tipo; private float valorReceita; private Date criacao; public Produto() { } public Produto(int idProduto, String nomeProduto, String tipo, float valorReceita, Date criacao) { this.idProduto = idProduto; this.nomeProduto = nomeProduto; this.tipo = tipo; this.valorReceita = valorReceita; this.criacao = criacao; } public int getIdProduto() { return idProduto; } public void setIdProduto(int idProduto) { this.idProduto = idProduto; } public String getNomeProduto() { return nomeProduto; } public void setNomeProduto(String nomeProduto) { this.nomeProduto = nomeProduto; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public float getValorReceita() { return valorReceita; } public void setValorReceita(float valorReceita) { this.valorReceita = valorReceita; } public Date getCriacao() { return criacao; } public void setCriacao(Date criacao) { this.criacao = criacao; } }
fb3e6800a759478afcc5d41d09d70cb0a641c544
ddbd8eda48c5ad7f0c784d1a313204d0831517a3
/core/tags/1.1/src/com/captiveimagination/jgn/register/Server.java
3aef2aa9f68ccdfaff773d9b0589949390000307
[]
no_license
chinastyle/jgn
5c487323ad6b03139a8ddcdadbbad4db3265f3f6
bad8e4327090ae976144ea6328ac354a66fdc091
refs/heads/master
2020-08-05T01:48:48.093053
2010-02-14T12:48:53
2010-02-14T12:48:53
33,904,633
0
0
null
null
null
null
UTF-8
Java
false
false
3,867
java
/* * Copyright (c) 2005-2006 JavaGameNetworking * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'JavaGameNetworking' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.captiveimagination.jgn.register; /** * @author Matthew D. Hicks */ public class Server { private String serverName; private String host; private byte[] address; private int portUDP; private int portTCP; private String game; private String map; private String info; private int players; private int maxPlayers; public Server() { } public Server(String serverName, String host, byte[] address, int portUDP, int portTCP, String game, String map, String info, int players, int maxPlayers) { this.serverName = serverName; this.host = host; this.address = address; this.portUDP = portUDP; this.portTCP = portTCP; this.game = game; this.map = map; this.info = info; this.players = players; this.maxPlayers = maxPlayers; } public byte[] getAddress() { return address; } public void setAddress(byte[] address) { this.address = address; } public String getGame() { return game; } public void setGame(String game) { this.game = game; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public String getInfo() { return info; } public void setInfo(String info) { this.info = info; } public String getMap() { return map; } public void setMap(String map) { this.map = map; } public int getPortUDP() { return portUDP; } public void setPortUDP(int portUDP) { this.portUDP = portUDP; } public int getPortTCP() { return portTCP; } public void setPortTCP(int portTCP) { this.portTCP = portTCP; } public String getServerName() { return serverName; } public void setServerName(String serverName) { this.serverName = serverName; } public int getPlayers() { return players; } public void setPlayers(int players) { this.players = players; } public int getMaxPlayers() { return maxPlayers; } public void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers; } }
[ "mhicks@a42d04ac-5654-0410-88ef-dd6235ab3d57" ]
mhicks@a42d04ac-5654-0410-88ef-dd6235ab3d57
ed52a9e0a6a9456b19629750e17247d554db2458
1247a279dd4824e1084e380e9995ae4a3e711993
/PR027-SQLiteDAO/app/src/main/java/es/iessaladillo/pedrojoya/pr027/actividades/MainActivity.java
d660533a1c6190f8bb4bbc9999c179d3622ba1ed
[]
no_license
lmontano7904/studio
82a8beee5b462a06b4aa596d97d40b24474212b2
abfeea20a41787463e581cc9a5c759ed3c76b398
refs/heads/master
2021-01-12T22:07:55.291445
2016-04-25T06:16:16
2016-04-25T06:16:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,193
java
package es.iessaladillo.pedrojoya.pr027.actividades; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.DialogFragment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import es.iessaladillo.pedrojoya.pr027.R; import es.iessaladillo.pedrojoya.pr027.fragmentos.ListaAlumnosFragment; import es.iessaladillo.pedrojoya.pr027.fragmentos.ListaAlumnosFragment.OnListaAlumnosFragmentListener; import es.iessaladillo.pedrojoya.pr027.fragmentos.SiNoDialogFragment; import es.iessaladillo.pedrojoya.pr027.fragmentos.SiNoDialogFragment.SiNoDialogListener; public class MainActivity extends AppCompatActivity implements OnListaAlumnosFragmentListener, SiNoDialogListener { private static final String TAG_LISTA_FRAGMENT = "tag_lista_fragment"; private static final String TAG_FRG_DIALOGO = "tag_frg_dialogo"; private static final int RC_AGREGAR = 1; private static final int RC_EDITAR = 2; private FloatingActionButton btnAgregar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setupToolbar(); initVistas(); cargarFragmento(); } // Configura la toolbar. private void setupToolbar() { setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); } // Obtiene e inicializa las vistas. private void initVistas() { findViewById(R.id.btnAgregar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onAgregarAlumno(); } }); btnAgregar = (FloatingActionButton) findViewById(R.id.btnAgregar); } // Carga el fragmento de la lista. private void cargarFragmento() { if (getSupportFragmentManager().findFragmentByTag(TAG_LISTA_FRAGMENT) == null) { getSupportFragmentManager() .beginTransaction() .replace(R.id.flContenido, new ListaAlumnosFragment(), TAG_LISTA_FRAGMENT) .commit(); } } // Muestra la actividad de alumno para agregar. @Override public void onAgregarAlumno() { AlumnoActivity.startForResult(this, RC_AGREGAR); } // Muestra la actividad de alumno para editar. Recibe el id del alumno. @Override public void onEditarAlumno(long id) { AlumnoActivity.startForResult(this, id, RC_EDITAR); } // Muestra el fragmento de diálogo de confirmación de eliminación. @Override public void onConfirmarEliminarAlumnos() { SiNoDialogFragment frgDialogo = new SiNoDialogFragment(); frgDialogo.show(getSupportFragmentManager(), TAG_FRG_DIALOGO); } // Se confirma la eliminación de los alumnos seleccionados. @Override public void onPositiveButtonClick(DialogFragment dialog) { // Se llama al método del fragmento para eliminar los alumnos // seleccionados. ListaAlumnosFragment frg = (ListaAlumnosFragment) getSupportFragmentManager() .findFragmentByTag(TAG_LISTA_FRAGMENT); if (frg != null) { frg.eliminarAlumnosSeleccionados(); } } // No se confirma la eliminación de los alumnos seleccionados. @Override public void onNegativeButtonClick(DialogFragment dialog) { // Método requerido por la interfaz SiNoDialogListener. } @Override public void onShowFAB() { btnAgregar.show(); } @Override public void onHideFAB() { btnAgregar.hide(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { ListaAlumnosFragment frg = (ListaAlumnosFragment) getSupportFragmentManager() .findFragmentByTag(TAG_LISTA_FRAGMENT); if (frg != null) { frg.cargarAlumnos(); } } super.onActivityResult(requestCode, resultCode, data); } }
74a9ae53b80315c4319a3b4d5e45cf1cd331e74c
b7d8aeb6cb2da6af9a30abf2d4fee5ee47ef6e83
/java8/src/com/dev/java/java8/streams/HashMaptoQuery.java
cdd6cd0c8ba7781160f69c5fe3ca531e0810f89a
[]
no_license
devanandgv/Java
caddceacc4aae9ced60d95e84d437d8512b841f2
27b3c982c30353a6d11f28e4403b77d91c4f44ea
refs/heads/master
2021-01-19T14:46:14.608142
2018-10-05T10:21:43
2018-10-05T10:21:43
100,921,640
0
0
null
null
null
null
UTF-8
Java
false
false
661
java
package com.dev.java.java8.streams; import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; public class HashMaptoQuery { public static void main(String args[]) { /* * Use Case : Convert the content of Map into name and value pair concatenate with '&' symbol * Ex : key : name :: value :: Dev * key : age :: value :: 28 * * Output = name=Dev&age=28 * * */ Map<String, String> map = new HashMap<>(); map.put("name", "Dev"); map.put("MobileNo", "1234567890"); String query = map.entrySet().stream().map(s->s.getKey()+"="+s.getValue()).collect(Collectors.joining("&")); System.out.println(query); } }
fd5b28366b342992b8485ef0fcd4a17a0d219da4
4e377ecae7db4bf6f2c8590287d692b8dc022599
/src/main/java/net/chinahrd/core/job/JobQuartz.java
32ac2c1fe38e3f4ba97e19023b603e250f887165
[]
no_license
a559927z/project-framework
952ba56c0e01bbeaa0ba194e03dfaeb9f1358aa8
0ee566e09abcb79babc90d109706c841ff1b9a31
refs/heads/master
2022-12-22T02:23:29.639808
2018-09-04T10:54:29
2018-09-04T10:54:29
111,410,675
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
/** *net.chinahrd.core.job */ package net.chinahrd.core.job; /** * 定时任务接口 * @author htpeng *2016年11月9日下午4:09:40 */ public class JobQuartz { }
824a67a0f98eb72bd378f2e044d3ba5a6cf1e06f
9c9f29dc7d288531d2bbb4f0dbc62416b883b928
/ChatDemoUI3.0/src/cn/ucai/superwechat/ui/RecorderVideoActivity.java
ca69d05ce28f7631d6c1f61728c2c1548458a22a
[ "Apache-2.0" ]
permissive
HoleWithoutBottom/SuperWeChat
f61f528b635f05f127793c379d025587eaef6009
bded10d53c356c3b8cb812f65d1daf5c12ee6553
refs/heads/master
2021-01-11T00:04:20.926297
2016-12-12T09:03:08
2016-12-12T09:03:29
70,762,672
1
0
null
null
null
null
UTF-8
Java
false
false
16,370
java
/************************************************************ * * EaseMob CONFIDENTIAL * __________________ * Copyright (C) 2016 Hyphenate Inc. All rights reserved. * * NOTICE: All information contained herein is, and remains * the property of EaseMob Technologies. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from EaseMob Technologies. */ package cn.ucai.superwechat.ui; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Collections; import java.util.List; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.graphics.Bitmap; import android.graphics.PixelFormat; import android.hardware.Camera; import android.hardware.Camera.CameraInfo; import android.hardware.Camera.Parameters; import android.hardware.Camera.Size; import android.media.MediaRecorder; import android.media.MediaRecorder.OnErrorListener; import android.media.MediaRecorder.OnInfoListener; import android.media.MediaScannerConnection; import android.media.MediaScannerConnection.MediaScannerConnectionClient; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.PowerManager; import android.os.SystemClock; import android.text.TextUtils; import android.view.SurfaceHolder; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.Chronometer; import android.widget.ImageView; import android.widget.Toast; import android.widget.VideoView; import cn.ucai.superwechat.R; import cn.ucai.superwechat.video.util.Utils; import com.hyphenate.easeui.utils.EaseCommonUtils; import com.hyphenate.util.EMLog; import com.hyphenate.util.PathUtil; public class RecorderVideoActivity extends BaseActivity implements OnClickListener, SurfaceHolder.Callback, OnErrorListener, OnInfoListener { private static final String TAG = "RecorderVideoActivity"; private final static String CLASS_LABEL = "RecordActivity"; private PowerManager.WakeLock mWakeLock; private ImageView btnStart; private ImageView btnStop; private MediaRecorder mediaRecorder; private VideoView mVideoView;// to display video String localPath = "";// path to save recorded video private Camera mCamera; private int previewWidth = 480; private int previewHeight = 480; private Chronometer chronometer; private int frontCamera = 0; // 0 is back camera,1 is front camera private Button btn_switch; Parameters cameraParameters = null; private SurfaceHolder mSurfaceHolder; int defaultVideoFrameRate = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE);// no title getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);// full screen // translucency mode,used in surface view getWindow().setFormat(PixelFormat.TRANSLUCENT); setContentView(R.layout.em_recorder_activity); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, CLASS_LABEL); mWakeLock.acquire(); initViews(); } private void initViews() { btn_switch = (Button) findViewById(R.id.switch_btn); btn_switch.setOnClickListener(this); btn_switch.setVisibility(View.VISIBLE); mVideoView = (VideoView) findViewById(R.id.mVideoView); btnStart = (ImageView) findViewById(R.id.recorder_start); btnStop = (ImageView) findViewById(R.id.recorder_stop); btnStart.setOnClickListener(this); btnStop.setOnClickListener(this); mSurfaceHolder = mVideoView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); chronometer = (Chronometer) findViewById(R.id.chronometer); } public void back(View view) { releaseRecorder(); releaseCamera(); finish(); } @Override protected void onResume() { super.onResume(); if (mWakeLock == null) { // keep screen on PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, CLASS_LABEL); mWakeLock.acquire(); } } @SuppressLint("NewApi") private boolean initCamera() { try { if (frontCamera == 0) { mCamera = Camera.open(CameraInfo.CAMERA_FACING_BACK); } else { mCamera = Camera.open(CameraInfo.CAMERA_FACING_FRONT); } Camera.Parameters camParams = mCamera.getParameters(); mCamera.lock(); mSurfaceHolder = mVideoView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mCamera.setDisplayOrientation(90); } catch (RuntimeException ex) { EMLog.e("video", "init Camera fail " + ex.getMessage()); return false; } return true; } private void handleSurfaceChanged() { if (mCamera == null) { finish(); return; } boolean hasSupportRate = false; List<Integer> supportedPreviewFrameRates = mCamera.getParameters() .getSupportedPreviewFrameRates(); if (supportedPreviewFrameRates != null && supportedPreviewFrameRates.size() > 0) { Collections.sort(supportedPreviewFrameRates); for (int i = 0; i < supportedPreviewFrameRates.size(); i++) { int supportRate = supportedPreviewFrameRates.get(i); if (supportRate == 15) { hasSupportRate = true; } } if (hasSupportRate) { defaultVideoFrameRate = 15; } else { defaultVideoFrameRate = supportedPreviewFrameRates.get(0); } } // get all resolutions which camera provide List<Camera.Size> resolutionList = Utils.getResolutionList(mCamera); if (resolutionList != null && resolutionList.size() > 0) { Collections.sort(resolutionList, new Utils.ResolutionComparator()); Camera.Size previewSize = null; boolean hasSize = false; // use 60*480 if camera support for (int i = 0; i < resolutionList.size(); i++) { Size size = resolutionList.get(i); if (size != null && size.width == 640 && size.height == 480) { previewSize = size; previewWidth = previewSize.width; previewHeight = previewSize.height; hasSize = true; break; } } // use medium resolution if camera don't support the above resolution if (!hasSize) { int mediumResolution = resolutionList.size() / 2; if (mediumResolution >= resolutionList.size()) mediumResolution = resolutionList.size() - 1; previewSize = resolutionList.get(mediumResolution); previewWidth = previewSize.width; previewHeight = previewSize.height; } } } @Override protected void onPause() { super.onPause(); if (mWakeLock != null) { mWakeLock.release(); mWakeLock = null; } } @Override public void onClick(View view) { switch (view.getId()) { case R.id.switch_btn: switchCamera(); break; case R.id.recorder_start: // start recording if(!startRecording()) return; Toast.makeText(this, R.string.The_video_to_start, Toast.LENGTH_SHORT).show(); btn_switch.setVisibility(View.INVISIBLE); btnStart.setVisibility(View.INVISIBLE); btnStart.setEnabled(false); btnStop.setVisibility(View.VISIBLE); chronometer.setBase(SystemClock.elapsedRealtime()); chronometer.start(); break; case R.id.recorder_stop: btnStop.setEnabled(false); stopRecording(); btn_switch.setVisibility(View.VISIBLE); chronometer.stop(); btnStart.setVisibility(View.VISIBLE); btnStop.setVisibility(View.INVISIBLE); new AlertDialog.Builder(this) .setMessage(R.string.Whether_to_send) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); sendVideo(null); } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(localPath != null){ File file = new File(localPath); if(file.exists()) file.delete(); } finish(); } }).setCancelable(false).show(); break; default: break; } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { mSurfaceHolder = holder; } @Override public void surfaceCreated(SurfaceHolder holder) { if (mCamera == null){ if(!initCamera()){ showFailDialog(); return; } } try { mCamera.setPreviewDisplay(mSurfaceHolder); mCamera.startPreview(); handleSurfaceChanged(); } catch (Exception e1) { EMLog.e("video", "start preview fail " + e1.getMessage()); showFailDialog(); } } @Override public void surfaceDestroyed(SurfaceHolder arg0) { EMLog.v("video", "surfaceDestroyed"); } public boolean startRecording(){ if (mediaRecorder == null){ if(!initRecorder()) return false; } mediaRecorder.setOnInfoListener(this); mediaRecorder.setOnErrorListener(this); mediaRecorder.start(); return true; } @SuppressLint("NewApi") private boolean initRecorder(){ if(!EaseCommonUtils.isSdcardExist()){ showNoSDCardDialog(); return false; } if (mCamera == null) { if(!initCamera()){ showFailDialog(); return false; } } mVideoView.setVisibility(View.VISIBLE); mCamera.stopPreview(); mediaRecorder = new MediaRecorder(); mCamera.unlock(); mediaRecorder.setCamera(mCamera); mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); if (frontCamera == 1) { mediaRecorder.setOrientationHint(270); } else { mediaRecorder.setOrientationHint(90); } mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); // set resolution, should be set after the format and encoder was set mediaRecorder.setVideoSize(previewWidth, previewHeight); mediaRecorder.setVideoEncodingBitRate(384 * 1024); // set frame rate, should be set after the format and encoder was set if (defaultVideoFrameRate != -1) { mediaRecorder.setVideoFrameRate(defaultVideoFrameRate); } // set the path for video file localPath = PathUtil.getInstance().getVideoPath() + "/" + System.currentTimeMillis() + ".mp4"; mediaRecorder.setOutputFile(localPath); mediaRecorder.setMaxDuration(30000); mediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface()); try { mediaRecorder.prepare(); } catch (IllegalStateException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } return true; } public void stopRecording() { if (mediaRecorder != null) { mediaRecorder.setOnErrorListener(null); mediaRecorder.setOnInfoListener(null); try { mediaRecorder.stop(); } catch (Exception e) { EMLog.e("video", "stopRecording error:" + e.getMessage()); } } releaseRecorder(); if (mCamera != null) { mCamera.stopPreview(); releaseCamera(); } } private void releaseRecorder() { if (mediaRecorder != null) { mediaRecorder.release(); mediaRecorder = null; } } protected void releaseCamera() { try { if (mCamera != null) { mCamera.stopPreview(); mCamera.release(); mCamera = null; } } catch (Exception e) { } } @SuppressLint("NewApi") public void switchCamera() { if (mCamera == null) { return; } if (Camera.getNumberOfCameras() >= 2) { btn_switch.setEnabled(false); if (mCamera != null) { mCamera.stopPreview(); mCamera.release(); mCamera = null; } switch (frontCamera) { case 0: mCamera = Camera.open(CameraInfo.CAMERA_FACING_FRONT); frontCamera = 1; break; case 1: mCamera = Camera.open(CameraInfo.CAMERA_FACING_BACK); frontCamera = 0; break; } try { mCamera.lock(); mCamera.setDisplayOrientation(90); mCamera.setPreviewDisplay(mVideoView.getHolder()); mCamera.startPreview(); } catch (IOException e) { mCamera.release(); mCamera = null; } btn_switch.setEnabled(true); } } MediaScannerConnection msc = null; ProgressDialog progressDialog = null; public void sendVideo(View view) { if (TextUtils.isEmpty(localPath)) { EMLog.e("Recorder", "recorder fail please try again!"); return; } if(msc == null) msc = new MediaScannerConnection(this, new MediaScannerConnectionClient() { @Override public void onScanCompleted(String path, Uri uri) { EMLog.d(TAG, "scanner completed"); msc.disconnect(); progressDialog.dismiss(); setResult(RESULT_OK, getIntent().putExtra("uri", uri)); finish(); } @Override public void onMediaScannerConnected() { msc.scanFile(localPath, "video/*"); } }); if(progressDialog == null){ progressDialog = new ProgressDialog(this); progressDialog.setMessage("processing..."); progressDialog.setCancelable(false); } progressDialog.show(); msc.connect(); } @Override public void onInfo(MediaRecorder mr, int what, int extra) { EMLog.v("video", "onInfo"); if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) { EMLog.v("video", "max duration reached"); stopRecording(); btn_switch.setVisibility(View.VISIBLE); chronometer.stop(); btnStart.setVisibility(View.VISIBLE); btnStop.setVisibility(View.INVISIBLE); chronometer.stop(); if (localPath == null) { return; } String st3 = getResources().getString(R.string.Whether_to_send); new AlertDialog.Builder(this) .setMessage(st3) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { arg0.dismiss(); sendVideo(null); } }).setNegativeButton(R.string.cancel, null) .setCancelable(false).show(); } } @Override public void onError(MediaRecorder mr, int what, int extra) { EMLog.e("video", "recording onError:"); stopRecording(); Toast.makeText(this, "Recording error has occurred. Stopping the recording", Toast.LENGTH_SHORT).show(); } public void saveBitmapFile(Bitmap bitmap) { File file = new File(Environment.getExternalStorageDirectory(), "a.jpg"); try { BufferedOutputStream bos = new BufferedOutputStream( new FileOutputStream(file)); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos); bos.flush(); bos.close(); } catch (IOException e) { e.printStackTrace(); } } @Override protected void onDestroy() { super.onDestroy(); releaseCamera(); if (mWakeLock != null) { mWakeLock.release(); mWakeLock = null; } } @Override public void onBackPressed() { back(null); } private void showFailDialog() { new AlertDialog.Builder(this) .setTitle(R.string.prompt) .setMessage(R.string.Open_the_equipment_failure) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }).setCancelable(false).show(); } private void showNoSDCardDialog() { new AlertDialog.Builder(this) .setTitle(R.string.prompt) .setMessage("No sd card!") .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }).setCancelable(false).show(); } }
af3a468dd4546a8a849f0f5a0cf011168b90e91b
da11d39355a6f9e50062201c095b5e099f0e7ead
/app/src/test/java/com/example/servicedemo/ExampleUnitTest.java
1f3dcaadb2dbb5eb8e7f4b8d5525bf457b5be4c8
[]
no_license
GODVS/AndroidAIDL
2a7b32e188d36d1a5b4ac845a53495c75db40a22
1f1dd8948f5425007a4dad04ba4133a05b0e8500
refs/heads/main
2023-08-15T03:26:22.083668
2021-09-23T15:53:19
2021-09-23T15:53:19
409,651,786
0
0
null
null
null
null
UTF-8
Java
false
false
400
java
package com.example.servicedemo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
7cf19cf3d3e07dbd54a28b825e87101d4d2906ea
059c65203627203bc713186c533cf9754512a832
/src/main/java/br/com/campanhas/app/services/AssociadoService.java
fc04f8b5a7ce8f1fcc54ba4fa8efe7bb6e88005a
[]
no_license
jhowjocker/desafio_campanhas_refatorado
6f62b8f71832c01de81d8db67e81792427c3d9a0
eca96c8dd4b4ac9e7339fa45523c4c1b747f88e2
refs/heads/master
2023-02-19T06:38:33.860153
2021-01-21T12:14:18
2021-01-21T12:14:18
330,658,623
0
0
null
null
null
null
UTF-8
Java
false
false
4,729
java
package br.com.campanhas.app.services; import br.com.campanhas.app.dto.request.AssociadoRequest; import br.com.campanhas.app.dto.response.AssociadoResponse; import br.com.campanhas.app.entities.Associado; import br.com.campanhas.app.entities.Campanha; import br.com.campanhas.app.entities.Clube; import br.com.campanhas.app.exceptions.AssociadoDuplicadoException; import br.com.campanhas.app.exceptions.NomeTimeNotExistException; import br.com.campanhas.app.mappers.MapperAssociadoToAssociadoResponse; import br.com.campanhas.app.repositories.AssociadoRepository; import br.com.campanhas.app.repositories.ClubeRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Objects; @Service @RequiredArgsConstructor public class AssociadoService { private final AssociadoRepository associadoRepository; private final ClubeRepository clubeRepository; private final MapperAssociadoToAssociadoResponse mapperAssociadoToAssociadoResponse; public AssociadoResponse inserir(AssociadoRequest associadoRequest) { String message = ""; Associado associado = new Associado(); Campanha campanha = new Campanha(); verificaNomeAssociado(associadoRequest.getNomeCompleto()); if (verificaEmailAssociado(associadoRequest)) { throw new AssociadoDuplicadoException("Email já cadastrado! Tente novamente."); } Clube clube = clubeRepository.findByNomeIgnoreCase(associadoRequest.getTime()); if (Objects.isNull(clube)) { throw new NomeTimeNotExistException("Nome do time não existe!"); } associado.setNomeCompleto(associadoRequest.getNomeCompleto().toUpperCase()); associado.setEmail(associadoRequest.getEmail()); associado.setDataDeNascimento(associadoRequest.getDataNascimento()); associado.setClube(clube); associadoRepository.save(associado); message += "Associado inserido com sucesso!"; AssociadoResponse associadoResponse = mapperAssociadoToAssociadoResponse.toDto(associado); associadoResponse.setMessage(message); return associadoResponse; } public void verificaNomeAssociado(String nomeAssociado) { Associado associado = associadoRepository.findByNomeCompletoIgnoreCase(nomeAssociado); if (Objects.nonNull(associado)) { throw new AssociadoDuplicadoException("Cadastro existente!"); } } public boolean verificaEmailAssociado(AssociadoRequest associadoRequest) { List<Associado> listaDeEmailsBancoDeDados = associadoRepository.findAll(); for (Associado seleciona : listaDeEmailsBancoDeDados) { if (seleciona.getEmail().equals(associadoRequest.getEmail())) { return true; } } return false; } public List<AssociadoResponse> listar() { List<AssociadoResponse> listaAssociadoResponse = new ArrayList<>(); List<Associado> ListaAssociadoBancoDeDados = associadoRepository.findAll(); for (Associado associado : ListaAssociadoBancoDeDados) { Associado associadoSave = associadoRepository.save(associado); AssociadoResponse associadoResponse = mapperAssociadoToAssociadoResponse.toDto(associado); listaAssociadoResponse.add(associadoResponse); } return listaAssociadoResponse; } public AssociadoResponse obter(Long id) { Associado associado = associadoRepository.getOne(id); AssociadoResponse associadoResponse = mapperAssociadoToAssociadoResponse.toDto(associado); return associadoResponse; } public AssociadoResponse atualizar(Long id, AssociadoRequest associadoRequest) { Associado associado = associadoRepository.getOne(id); Clube clube = clubeRepository.findByNomeIgnoreCase(associadoRequest.getTime()); if (Objects.isNull(clube)) { throw new NomeTimeNotExistException("Nome do time não existe!"); } associado.setId(id); associado.setNomeCompleto(associadoRequest.getNomeCompleto().toUpperCase()); associado.setDataDeNascimento(associadoRequest.getDataNascimento()); associado.setEmail(associadoRequest.getEmail()); associado.setClube(clube); associadoRepository.save(associado); AssociadoResponse associadoResponse = mapperAssociadoToAssociadoResponse.toDto(associado); associadoResponse.setMessage("Associado atualizada com sucesso!"); return associadoResponse; } public void deletar(Long id) { associadoRepository.deleteById(id); } }
8b570174bcd8aad46913edf55265e12c6aee2517
08f1c2551f685f9d992d293195a3cf6ec112ee06
/src/main/java/ivorius/reccomplex/gui/editinventorygen/GuiEditInventoryGen.java
e1a1ba7f35299d3e7242550aa33096adf9769f61
[]
no_license
BeardStroker/RecurrentComplex
1a7d29e351c98edeaa4720b81ebc0dcb92be1b3f
1e641f8ef07a2d34d23b6eff816d1ffaf56b3b10
refs/heads/master
2020-12-25T08:59:57.337776
2016-05-06T06:39:48
2016-05-06T06:39:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,670
java
/* * Copyright (c) 2014, Lukas Tenbrink. * * http://lukas.axxim.net */ package ivorius.reccomplex.gui.editinventorygen; import ivorius.ivtoolkit.gui.*; import ivorius.ivtoolkit.network.PacketGuiAction; import ivorius.reccomplex.RecurrentComplex; import ivorius.reccomplex.gui.GuiValidityStateIndicator; import ivorius.reccomplex.gui.InventoryWatcher; import ivorius.reccomplex.gui.TableDataSourceExpression; import ivorius.reccomplex.gui.table.Bounds; import ivorius.reccomplex.gui.table.TableDataSource; import ivorius.reccomplex.network.PacketEditInventoryGenerator; import ivorius.reccomplex.utils.IvTranslations; import ivorius.reccomplex.utils.RangeHelper; import ivorius.reccomplex.worldgen.inventory.GenericItemCollection; import ivorius.reccomplex.worldgen.inventory.GenericItemCollection.Component; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Created by lukas on 26.05.14. */ public class GuiEditInventoryGen extends GuiContainer implements InventoryWatcher, GuiControlListener { public static ResourceLocation textureBackground = new ResourceLocation(RecurrentComplex.MODID, RecurrentComplex.filePathTextures + "guiEditInventoryGen.png"); public String key; private Component inventoryGenerator; private GuiTextField nameTextField; private GuiTextField inventoryGenIDTextField; private GuiButton saveBtn; private GuiButton cancelBtn; private GuiButton nextPageBtn; private GuiButton prevPageBtn; private GuiTextField dependencyTextField; private GuiValidityStateIndicator dependencyStateIndicator; private List<GuiSlider> weightSliders = new ArrayList<>(); private List<GuiSliderRange> minMaxSliders = new ArrayList<>(); private int currentColShift; public GuiEditInventoryGen(EntityPlayer player, Component generator, String key) { super(new ContainerEditInventoryGen(player, generator)); this.inventoryGenerator = generator; this.key = key; this.xSize = ContainerEditInventoryGen.SEGMENT_WIDTH * ContainerEditInventoryGen.ITEM_COLUMNS + 20; this.ySize = 219; ((ContainerEditInventoryGen) inventorySlots).inventory.addWatcher(this); } @Override public void initGui() { super.initGui(); Keyboard.enableRepeatEvents(true); this.buttonList.clear(); weightSliders.clear(); minMaxSliders.clear(); int shiftRight = width / 2 - xSize / 2; int shiftTop = height / 2 - ySize / 2; int shiftRightPage = shiftRight + ContainerEditInventoryGen.ITEM_COLUMNS * ContainerEditInventoryGen.SEGMENT_WIDTH; this.nameTextField = new GuiTextField(this.fontRendererObj, this.width / 2 - 150, this.height / 2 - 110, 142, 20); this.nameTextField.setMaxStringLength(32767); this.nameTextField.setFocused(true); this.nameTextField.setText(key); this.buttonList.add(this.saveBtn = new GuiButton(0, this.width / 2, this.height / 2 - 110, 70, 20, I18n.format("guiGenericInventory.save"))); this.buttonList.add(this.cancelBtn = new GuiButton(1, this.width / 2 + 75, this.height / 2 - 110, 70, 20, I18n.format("gui.cancel"))); inventoryGenIDTextField = new GuiTextField(this.fontRendererObj, this.width / 2 - 150, this.height / 2 - 85, 142, 20); inventoryGenIDTextField.setMaxStringLength(32767); inventoryGenIDTextField.setText(inventoryGenerator.inventoryGeneratorID); dependencyTextField = new GuiTextField(fontRendererObj, this.width / 2, this.height / 2 - 85, 130, 20); dependencyTextField.setText(inventoryGenerator.dependencies.getExpression()); dependencyStateIndicator = new GuiValidityStateIndicator(this.width / 2 + 135, this.height / 2 - 80, TableDataSourceExpression.getValidityState(inventoryGenerator.dependencies)); this.buttonList.add(this.nextPageBtn = new GuiButton(2, shiftRightPage, this.height / 2 - 50, 20, 20, ">")); this.buttonList.add(this.prevPageBtn = new GuiButton(3, shiftRightPage, this.height / 2 - 20, 20, 20, "<")); for (int col = 0; col < ContainerEditInventoryGen.ITEM_COLUMNS; ++col) { for (int row = 0; row < ContainerEditInventoryGen.ITEM_ROWS; ++row) { int availableSize = ContainerEditInventoryGen.SEGMENT_WIDTH - 22 - 4; int baseX = shiftRight + 20 + col * ContainerEditInventoryGen.SEGMENT_WIDTH; int onePart = availableSize / 5; GuiSliderRange minMaxSlider = new GuiSliderRange(100, baseX, shiftTop + 48 + row * 18, onePart * 2 - 2, 18, ""); minMaxSlider.addListener(this); minMaxSlider.setMinValue(1); this.buttonList.add(minMaxSlider); minMaxSliders.add(minMaxSlider); GuiSlider weightSlider = new GuiSlider(200, baseX + onePart * 2, shiftTop + 48 + row * 18, onePart * 3, 18, IvTranslations.get("structures.gui.random.weight")); weightSlider.addListener(this); weightSlider.setMinValue(0); weightSlider.setMaxValue(10); this.buttonList.add(weightSlider); weightSliders.add(weightSlider); } } updateSaveButtonEnabled(); this.scrollTo(currentColShift); } public void scrollTo(int colShift) { currentColShift = colShift; ((ContainerEditInventoryGen) inventorySlots).scrollTo(colShift); updateAllItemSliders(); updatePageButtons(); } private void updateAllItemSliders() { List<GenericItemCollection.RandomizedItemStack> chestContents = inventoryGenerator.items; for (int i = 0; i < weightSliders.size(); i++) { GuiSlider weightSlider = weightSliders.get(i); GuiSliderRange minMaxSlider = minMaxSliders.get(i); int index = i + currentColShift * ContainerEditInventoryGen.ITEM_ROWS; weightSlider.id = index + 100; minMaxSlider.id = index + 200; if (index < chestContents.size()) { GenericItemCollection.RandomizedItemStack chestContent = chestContents.get(index); minMaxSlider.setRange(new FloatRange(chestContent.min, chestContent.max)); minMaxSlider.setMaxValue(chestContent.itemStack.getMaxStackSize()); minMaxSlider.enabled = true; minMaxSlider.displayString = I18n.format("guiGenericInventory.minMax", chestContent.min, chestContent.max); weightSlider.setValue((float) chestContent.weight); weightSlider.enabled = true; weightSlider.displayString = I18n.format("guiGenericInventory.weightNumber", String.format("%.2f", weightSlider.getValue())); } else { minMaxSlider.setRange(new FloatRange(1, 1)); minMaxSlider.setMaxValue(64); minMaxSlider.enabled = false; minMaxSlider.displayString = "Min - Max"; weightSlider.setValue(weightSlider.getMinValue()); weightSlider.enabled = false; weightSlider.displayString = I18n.format("structures.gui.random.weight"); } } } private void updatePageButtons() { List<GenericItemCollection.RandomizedItemStack> chestContents = inventoryGenerator.items; int neededCols = chestContents.size() / ContainerEditInventoryGen.ITEM_ROWS + 1; nextPageBtn.enabled = (currentColShift + ContainerEditInventoryGen.ITEM_COLUMNS) < neededCols; prevPageBtn.enabled = currentColShift > 0; } @Override public void updateScreen() { super.updateScreen(); nameTextField.updateCursorCounter(); inventoryGenIDTextField.updateCursorCounter(); dependencyTextField.updateCursorCounter(); } @Override protected void actionPerformed(GuiButton button) { if (button.enabled) { if (button.id == 1) { this.mc.thePlayer.closeScreen(); } else if (button.id == 0) { RecurrentComplex.network.sendToServer(new PacketEditInventoryGenerator(key, inventoryGenerator)); this.mc.thePlayer.closeScreen(); } else if (button.id == 2) { scrollTo(currentColShift + 1); RecurrentComplex.network.sendToServer(PacketGuiAction.packetGuiAction("igSelectCol", currentColShift)); } else if (button.id == 3) { scrollTo(currentColShift - 1); RecurrentComplex.network.sendToServer(PacketGuiAction.packetGuiAction("igSelectCol", currentColShift)); } } } @Override protected void keyTyped(char par1, int par2) { if (!(par2 == Keyboard.KEY_ESCAPE || par2 == this.mc.gameSettings.keyBindInventory.getKeyCode())) // Escape! { super.keyTyped(par1, par2); } if (nameTextField.textboxKeyTyped(par1, par2)) { key = nameTextField.getText(); } else if (inventoryGenIDTextField.textboxKeyTyped(par1, par2)) { inventoryGenerator.inventoryGeneratorID = inventoryGenIDTextField.getText(); } else if (dependencyTextField.textboxKeyTyped(par1, par2)) { inventoryGenerator.dependencies.setExpression(dependencyTextField.getText()); dependencyStateIndicator.setState(TableDataSourceExpression.getValidityState(inventoryGenerator.dependencies)); } else { if (par2 == Keyboard.KEY_LEFT && prevPageBtn.enabled) { actionPerformed(prevPageBtn); } else if (par2 == Keyboard.KEY_RIGHT && nextPageBtn.enabled) { actionPerformed(nextPageBtn); } } updateSaveButtonEnabled(); // if (par2 != 28 && par2 != 156) // { // if (par2 == 1) // { // this.actionPerformed(this.cancelBtn); // } // } // else // { // this.actionPerformed(this.saveBtn); // } } @Override protected void mouseClicked(int par1, int par2, int par3) { super.mouseClicked(par1, par2, par3); this.nameTextField.mouseClicked(par1, par2, par3); this.inventoryGenIDTextField.mouseClicked(par1, par2, par3); dependencyTextField.mouseClicked(par1, par2, par3); } @Override public void onGuiClosed() { super.onGuiClosed(); Keyboard.enableRepeatEvents(false); } @Override protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) { nameTextField.drawTextBox(); drawPlaceholderString(nameTextField, "Component ID"); inventoryGenIDTextField.drawTextBox(); drawPlaceholderString(inventoryGenIDTextField, "Group ID"); dependencyTextField.drawTextBox(); drawPlaceholderString(dependencyTextField, "Dependency Expression"); dependencyStateIndicator.draw(); mc.getTextureManager().bindTexture(textureBackground); GL11.glColor3f(1.0f, 1.0f, 1.0f); drawTexturedModalRect(width / 2 - 176 / 2 - 20 / 2 - 1, MathHelper.ceiling_float_int(height * 0.5f) + 17, 0, 0, 176, 90); for (int i = 0; i < ContainerEditInventoryGen.ITEM_ROWS; i++) { drawTexturedModalRect(width / 2 - ContainerEditInventoryGen.SEGMENT_WIDTH / 2 - 11, height / 2 - 61 + i * 18, 7, 7, 18, 18); } // for (int i = 0; i < ContainerEditInventoryGen.ITEM_COLUMNS; i++) // { // int baseX = width / 2 + i * ContainerEditInventoryGen.SEGMENT_WIDTH; // drawCenteredString(fontRendererObj, I18n.format("guiGenericInventory.min"), baseX + 20, this.height / 2 - 75, 0xffffffff); // drawCenteredString(fontRendererObj, I18n.format("guiGenericInventory.max"), baseX + 40, this.height / 2 - 75, 0xffffffff); // drawCenteredString(fontRendererObj, I18n.format("guiGenericInventory.weight"), baseX + 60, this.height / 2 - 75, 0xffffffff); // } if (Bounds.fromSize(dependencyStateIndicator.xPosition, dependencyStateIndicator.getWidth(), dependencyStateIndicator.yPosition, dependencyStateIndicator.getHeight()).contains(mouseX, mouseY)) drawHoveringText(Collections.singletonList(TableDataSourceExpression.parsedString(inventoryGenerator.dependencies)), mouseX, mouseY, fontRendererObj); } private void drawPlaceholderString(GuiTextField textField, String string) { if (StringUtils.isNullOrEmpty(textField.getText())) drawString(fontRendererObj, string, textField.xPosition + 5, textField.yPosition + 7, 0xff888888); } @Override public void inventoryChanged(IInventory inventory) { updateAllItemSliders(); updatePageButtons(); } @Override public void valueChanged(Gui gui) { List<GenericItemCollection.RandomizedItemStack> chestContents = inventoryGenerator.items; if (gui instanceof GuiSlider) { GuiSlider slider = (GuiSlider) gui; if (slider.id < 200 && slider.id >= 100) { int stackIndex = slider.id - 100; if (stackIndex < chestContents.size()) { chestContents.get(stackIndex).weight = slider.getValue(); updateAllItemSliders(); } } } else if (gui instanceof GuiSliderRange) { GuiSliderRange slider = (GuiSliderRange) gui; if (slider.id < 300) { int stackIndex = slider.id - 200; if (stackIndex < chestContents.size()) { GenericItemCollection.RandomizedItemStack chestContent = chestContents.get(stackIndex); IntegerRange intRange = RangeHelper.roundedIntRange(slider.getRange()); chestContent.min = intRange.getMin(); chestContent.max = intRange.getMax(); slider.setRange(new FloatRange(chestContent.min, chestContent.max)); updateAllItemSliders(); } } } } @Override protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_) { super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); if (p_146286_3_ == 0) { for (Object object : buttonList) { GuiButton button = (GuiButton) object; button.mouseReleased(p_146286_1_, p_146286_2_); } } } public void updateSaveButtonEnabled() { saveBtn.enabled = key.trim().length() > 0 && inventoryGenerator.inventoryGeneratorID.trim().length() > 0; } }
9f55d450c98dbfca38e3eb008db5c8d2b74e87e5
c1a353f4a5d7d929295ed7d9f0c3c640270f47f7
/DesarrolloApurata/apurata_android/app/src/main/java/com/apurata/prestamos/creditos/Service/NetworkChangeReceiver.java
cadc882f95fc7143ae1cf8cfcc158f27b2787634
[]
no_license
JCFlores93/AndroidAvanzado
05d6b06ddfae5fb919fb7b8ce664e9637ec81f75
7d1156afa89016289b4d20ecb4ba78590bf05752
refs/heads/master
2021-09-02T08:22:27.906025
2017-12-31T21:57:25
2017-12-31T21:57:25
105,342,233
0
0
null
null
null
null
UTF-8
Java
false
false
1,502
java
package com.apurata.prestamos.creditos.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; /** * Created by apurata on 10/23/17. */ public class NetworkChangeReceiver extends BroadcastReceiver { public interface ProviderConnectionListener{ public void providerNetworkIsEnable(); public void networkIsJustDisconnected(); } private ProviderConnectionListener provListener = null; public void registerListener(ProviderConnectionListener provider){ Log.d("GPS_TRACKER", "is registering a new listener"); provListener = provider; } @Override public void onReceive( Context context, Intent intent ) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE ); NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo(); if (provListener != null) { if (activeNetInfo != null) { provListener.providerNetworkIsEnable(); Log.i("GPS_TRACKER", "ACTIVE NETWORK"); Log.i("GPS_TRACKER", "Active Network Type : " + activeNetInfo.getTypeName()); } else { Log.i("GPS_TRACKER", "NETWORK IS JUST DISCONNECTED"); provListener.networkIsJustDisconnected(); } } } }
5a271b515ff34b96695e215d1667cac6509c7834
cbe9d280d1df42280996b77f2b74b67db70fba26
/common/src/main/java/com/codename1/rad/attributes/package-info.java
e8812f6af2e45725957f10336f4b032c32b05f9a
[]
no_license
shannah/CodeRAD
0cdaeaeb8c65d599a86eef16c502ebbaba8dba77
57b5566b411cd9c32855cc7e48a4d985e256e64c
refs/heads/master
2023-01-24T00:11:32.663772
2023-01-15T15:07:16
2023-01-15T15:07:16
240,612,918
27
10
null
2023-01-15T14:27:00
2020-02-14T22:58:04
Java
UTF-8
Java
false
false
128
java
/** * This package contains {@link Attribute} classes for use in UI descriptors. * */ package com.codename1.rad.attributes;
a78fb4c0dccf32999b4d9599dc37a7338449fd8e
55b09acbda62732b1fc5e27bef25dafb9250251f
/src/main/java/com/robindrew/trading/cityindex/InstrumentCategory.java
20fc9aac890eff270986f340593d87532208c32e
[]
no_license
robindrew/robindrew-trading-cityindex
5b4e8777a27c34afa2c8eef972d65f84f4bfb555
c5175963ed41a5a2a75a8a04965eb5a0c237e725
refs/heads/master
2021-06-06T01:34:10.569919
2020-04-06T22:34:34
2020-04-06T22:34:34
131,757,303
0
0
null
null
null
null
UTF-8
Java
false
false
89
java
package com.robindrew.trading.cityindex; public enum InstrumentCategory { CFD, DFT; }
18e5a0fd746682db71e1ca307fcc73281fac0c30
3b827e21d1e0c73f4b19f9154c0cad428f78b676
/practicas/p1/src/e6/Rectangulo.java
26c4f786171a6fe0c9ed9906b80e741928576f0b
[]
no_license
onofricamila/LaboratorioDeSoftware
6a20520cf7efc4f7751f68d97d5dce55ff5a0470
351fc7c9347711cb7f9ecbd56b4565fa3a609ccd
refs/heads/master
2020-03-27T13:56:28.851526
2018-11-14T15:29:25
2018-11-14T15:29:25
146,635,619
0
1
null
null
null
null
UTF-8
Java
false
false
749
java
package e6; public class Rectangulo extends FiguraGeometrica{ private int ancho; private int alto; public Rectangulo(String color, int ancho, int alto) { super(color); this.ancho = ancho; this.alto = alto; } @Override public void dibujar() { System.out.println("Se dibuja un circulo de ancho " + ancho + " alto " + alto + " y color " + this.getColor()); } @Override public int area() { return ancho * alto; } @Override public String toString() { return "Rectangulo{" + "color=" + this.getColor() + ", ancho=" + ancho + ", alto=" + alto + '}'; } }
42aa93f715d9212195fa8ab72d0d3c35bdcb71b5
84f7c7b625f9e8a9a8893a078423aa970bb5d34e
/com/abiram26/blockguard/events/PlayerHealthListeners.java
af574b3909ebe2ed9c212e041edcac727d4b0f95
[]
no_license
Abiram26/BlockGuardPlugin
3b34e25cfe3d2ed1235b512d393fcf679c4cf316
7699adde23f1fb551c26e97fc0e17b5b82891512
refs/heads/master
2020-04-27T21:21:47.096511
2014-11-04T16:23:59
2014-11-04T16:23:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,724
java
package com.abiram26.blockguard.events; import com.abiram26.blockguard.BlockGuardPlugin; import com.abiram26.blockguard.storage.RegionFlags; import com.abiram26.blockguard.storage.RegionMembers; import com.abiram26.blockguard.storage.Regions; import com.mbserver.api.events.EntityDamageEvent; import com.mbserver.api.events.EntityDeathEvent; import com.mbserver.api.events.EntityHealEvent; import com.mbserver.api.events.EventHandler; import com.mbserver.api.events.Listener; import com.mbserver.api.events.PlayerPvpEvent; import com.mbserver.api.game.Location; import com.mbserver.api.game.Player; public class PlayerHealthListeners implements Listener { private final Regions cfg1; private final RegionMembers cfg2; private final RegionFlags cfg3; public PlayerHealthListeners(final Regions regions, final RegionMembers members, final RegionFlags flags) { this.cfg1 = regions; this.cfg2 = members; this.cfg3 = flags; } @EventHandler public void pvpEvent1(final PlayerPvpEvent e) { final Location loc1 = e.getVictim().getLocation(); final int blockX = loc1.getBlockX(); final int blockY = loc1.getBlockY(); final int blockZ = loc1.getBlockZ(); final String w1 = loc1.getWorld().getWorldName(); if (!(e.getAttacker().hasPermission("abiram26.blockguard.*"))) { for (int x = 0; x < cfg1.getRegions().size(); x++) { if (cfg1.getRegions().get(x).contains(blockX, blockY, blockZ, w1)) { if (cfg2.getMembers().get(x) .hasMember(e.getAttacker().getName()) == -1&& !cfg3.getFlags().get(x).isCan_player_attack_player()) { e.getAttacker().sendMessage( BlockGuardPlugin.stamp + "You are not allowed to PvP in region: " + cfg1.getRegions().get(x) .getRegionName() + "!"); e.setCancelled(true); return; } } } } } @EventHandler public void deathEvent (EntityDeathEvent e){ if(!(e.getEntity() instanceof Player)){ return; } final Player p1 = (Player) e.getEntity(); final Location loc1 = p1.getLocation(); final int blockX = loc1.getBlockX(); final int blockY = loc1.getBlockY(); final int blockZ = loc1.getBlockZ(); final String w1 = loc1.getWorld().getWorldName(); if (!(p1.hasPermission("abiram26.blockguard.*"))) { for (int x = 0; x < cfg1.getRegions().size(); x++) { if (cfg1.getRegions().get(x).contains(blockX, blockY, blockZ, w1)) { if (cfg2.getMembers().get(x) .hasMember(p1.getName()) == -1&& !cfg3.getFlags().get(x).isCan_player_die()) { p1.sendMessage( BlockGuardPlugin.stamp + "You are not allowed to die in region: " + cfg1.getRegions().get(x) .getRegionName() + "!"); e.setCancelled(true); return; } } } } } @EventHandler public void healEvent (EntityHealEvent e){ if(!(e.getEntity() instanceof Player)){ return; } final Player p1 = (Player) e.getEntity(); final Location loc1 = p1.getLocation(); final int blockX = loc1.getBlockX(); final int blockY = loc1.getBlockY(); final int blockZ = loc1.getBlockZ(); final String w1 = loc1.getWorld().getWorldName(); if (!(p1.hasPermission("abiram26.blockguard.*"))) { for (int x = 0; x < cfg1.getRegions().size(); x++) { if (cfg1.getRegions().get(x).contains(blockX, blockY, blockZ, w1)) { if (cfg2.getMembers().get(x) .hasMember(p1.getName()) == -1&& !cfg3.getFlags().get(x).isCan_player_heal()) { p1.sendMessage( BlockGuardPlugin.stamp + "You are not allowed to heal in region: " + cfg1.getRegions().get(x) .getRegionName() + "!"); e.setCancelled(true); return; } } } } } @EventHandler public void damageEvent (EntityDamageEvent e){ if(!(e.getEntity() instanceof Player)){ return; } final Player p1 = (Player) e.getEntity(); final Location loc1 = p1.getLocation(); final int blockX = loc1.getBlockX(); final int blockY = loc1.getBlockY(); final int blockZ = loc1.getBlockZ(); final String w1 = loc1.getWorld().getWorldName(); if (!(p1.hasPermission("abiram26.blockguard.*"))) { for (int x = 0; x < cfg1.getRegions().size(); x++) { if (cfg1.getRegions().get(x).contains(blockX, blockY, blockZ, w1)) { if (cfg2.getMembers().get(x) .hasMember(p1.getName()) == -1&& !cfg3.getFlags().get(x).isCan_player_receive_damage()) { p1.sendMessage( BlockGuardPlugin.stamp + "You are not allowed to receive damage in region: " + cfg1.getRegions().get(x) .getRegionName() + "!"); e.setCancelled(true); return; } } } } } }
f0bf5f91a0be11770aee099644c0186d32a69780
54f4873984d40b6d18bebf7a877c5dd99c499e6a
/third version/MailForm.java
c1120e0021917ebf9114e63d4d4e0d584ec08373
[]
no_license
three-star-programmer/Mail-sendind-form
b2950abef4c5a4b50ca165a9b5a6a5e1193fbf4f
da8e8dca237363b6c937ff482d98f65ef908e925
refs/heads/master
2020-05-09T22:26:24.450662
2019-04-20T11:35:35
2019-04-20T11:35:35
181,471,715
0
1
null
null
null
null
UTF-8
Java
false
false
23,264
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package mailapp; import java.awt.Image; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Properties; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.swing.DefaultListModel; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.ListSelectionModel; import javax.swing.filechooser.FileNameExtensionFilter; /** * * @author Aizaz */ public class MailForm extends javax.swing.JFrame { /** Creates new form MailForm */ public MailForm() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane2 = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jPanel5 = new javax.swing.JPanel(); sendBtn = new javax.swing.JButton(); ClearBtn = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); messageText = new javax.swing.JTextArea(); browserBtn = new javax.swing.JButton(); deleteAttachments = new javax.swing.JButton(); path = new javax.swing.JTextField(); jPanel8 = new javax.swing.JPanel(); sendToLabel = new javax.swing.JLabel(); sendToText = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); subjectText = new javax.swing.JTextField(); jMenuBar1 = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); newMenuItem = new javax.swing.JMenuItem(); closeMenuItem = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); removeAllMenu = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jScrollPane2.setPreferredSize(new java.awt.Dimension(574, 508)); jPanel1.setBackground(new java.awt.Color(62, 96, 111)); jPanel1.setLayout(null); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Mail Form"); jPanel1.add(jLabel3); jLabel3.setBounds(280, 20, 66, 17); jPanel5.setBackground(new java.awt.Color(62, 96, 111)); sendBtn.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N sendBtn.setText("Send"); sendBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sendBtnActionPerformed(evt); } }); ClearBtn.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N ClearBtn.setText("Clear"); ClearBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ClearBtnActionPerformed(evt); } }); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addContainerGap(31, Short.MAX_VALUE) .addComponent(sendBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ClearBtn) .addContainerGap()) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() .addContainerGap(16, Short.MAX_VALUE) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(sendBtn) .addComponent(ClearBtn)) .addContainerGap()) ); jPanel1.add(jPanel5); jPanel5.setBounds(430, 550, 180, 50); jPanel4.setBackground(new java.awt.Color(145, 170, 180)); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel2.setText("Message:"); messageText.setColumns(20); messageText.setRows(5); jScrollPane1.setViewportView(messageText); browserBtn.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N browserBtn.setText("Browse"); browserBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browserBtnActionPerformed(evt); } }); deleteAttachments.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N deleteAttachments.setText("Delete Attachment"); deleteAttachments.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteAttachmentsActionPerformed(evt); } }); path.setEditable(false); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 29, Short.MAX_VALUE) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addComponent(browserBtn) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(path, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(25, 25, 25)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(deleteAttachments) .addGap(182, 182, 182)) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)) .addGroup(jPanel4Layout.createSequentialGroup() .addGap(96, 96, 96) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(browserBtn) .addComponent(path, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(30, 30, 30) .addComponent(deleteAttachments) .addGap(38, 38, 38)) ); jPanel1.add(jPanel4); jPanel4.setBounds(10, 200, 540, 320); jPanel8.setBackground(new java.awt.Color(145, 170, 180)); sendToLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N sendToLabel.setText("Recipient(s):"); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel1.setText("Subject:"); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel8Layout.createSequentialGroup() .addComponent(sendToLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(sendToText, javax.swing.GroupLayout.PREFERRED_SIZE, 408, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel8Layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(subjectText, javax.swing.GroupLayout.PREFERRED_SIZE, 408, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 41, Short.MAX_VALUE)) ); jPanel8Layout.setVerticalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addGap(36, 36, 36) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(sendToLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sendToText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(subjectText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(36, 36, 36)) ); jPanel1.add(jPanel8); jPanel8.setBounds(10, 43, 540, 140); jScrollPane2.setViewportView(jPanel1); fileMenu.setText("File"); newMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); newMenuItem.setIcon(new javax.swing.ImageIcon("C:\\Users\\Aizaz\\Desktop\\github project\\images\\basic2-081_new_badge-512.png")); // NOI18N newMenuItem.setText("New"); newMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newMenuItemActionPerformed(evt); } }); fileMenu.add(newMenuItem); closeMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK)); closeMenuItem.setIcon(new javax.swing.ImageIcon("C:\\Users\\Aizaz\\Desktop\\github project\\images\\close.jpg")); // NOI18N closeMenuItem.setText("Close"); closeMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { closeMenuItemActionPerformed(evt); } }); fileMenu.add(closeMenuItem); jMenuBar1.add(fileMenu); jMenu2.setText("Remove"); removeAllMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DELETE, java.awt.event.InputEvent.CTRL_MASK)); removeAllMenu.setIcon(new javax.swing.ImageIcon("C:\\Users\\Aizaz\\Desktop\\github project\\images\\remove.png")); // NOI18N removeAllMenu.setText("Delete Attachment"); removeAllMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeAllMenuActionPerformed(evt); } }); jMenu2.add(removeAllMenu); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 639, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 619, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void sendBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendBtnActionPerformed String sendToStr; sendToStr = this.sendToText.getText().toString(); if(sendToStr.length()<=0){ JOptionPane.showMessageDialog(null, "Please enter recepients email id "); } String pathstr = path.getText().toString(); if(pathstr.length()<=0){ String from = "[email protected]"; String password = "sarfrazalishah100"; String to = sendToText.getText(); String subject = subjectText.getText(); String message = messageText.getText(); sendWithoutAttachments.send(from,password,to,subject,message); } else{ String from = "[email protected]"; String password = "sarfrazalishah100"; String to = sendToText.getText(); String subject = subjectText.getText(); String message = messageText.getText(); // sendMail.send(from,password,to,subject,message,attachment_path1,attachment_path2,a1,a2); sendMail.send(from,password,to,subject,message,attachment_path1,attachment_path2); path.setText(""); } }//GEN-LAST:event_sendBtnActionPerformed private void ClearBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearBtnActionPerformed sendToText.setText(""); subjectText.setText(""); messageText.setText(""); }//GEN-LAST:event_ClearBtnActionPerformed private void browserBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browserBtnActionPerformed try{ JFileChooser file = new JFileChooser(); // file.setMultiSelectionEnabled(true); // file.setCurrentDirectory(new File(System.getProperty("user.home"))); // file.setSelectedFile(selectedFile); // file.setCurrentDirectory(defaultDir); FileNameExtensionFilter filter = new FileNameExtensionFilter("*.images", "jpg","png"); FileNameExtensionFilter filter1 = new FileNameExtensionFilter("*.text","txt","doc"); FileNameExtensionFilter filter2 = new FileNameExtensionFilter("*.pdf", "pdf"); FileNameExtensionFilter filter3 = new FileNameExtensionFilter("*.zip", "zip"); file.addChoosableFileFilter(filter); file.addChoosableFileFilter(filter1); file.addChoosableFileFilter(filter2); file.addChoosableFileFilter(filter3); // int result = file.showSaveDialog(null); int result = file.showOpenDialog(null); if(result == JFileChooser.APPROVE_OPTION) { File selectedFile = file.getSelectedFile(); attachment_path1 = selectedFile.getAbsolutePath(); attachment_path2 = selectedFile.getName(); // // JOptionPane.showMessageDialog(null, "Attached"); path.setText(attachment_path1); // } else{ System.out.println("No file selected"); } } catch(Exception exc){ } }//GEN-LAST:event_browserBtnActionPerformed private void deleteAttachmentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteAttachmentsActionPerformed // path.setText(""); String pathstr = path.getText(); if(pathstr.length()<=0){ JOptionPane.showMessageDialog(null, "There is no attachment"); } else{ path.setText(""); } }//GEN-LAST:event_deleteAttachmentsActionPerformed private void newMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newMenuItemActionPerformed dispose(); MailForm f1 = new MailForm(); f1.setVisible(true); }//GEN-LAST:event_newMenuItemActionPerformed private void closeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeMenuItemActionPerformed dispose(); }//GEN-LAST:event_closeMenuItemActionPerformed private void removeAllMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeAllMenuActionPerformed path.setText(""); }//GEN-LAST:event_removeAllMenuActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MailForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton ClearBtn; private javax.swing.JButton browserBtn; private javax.swing.JMenuItem closeMenuItem; private javax.swing.JButton deleteAttachments; private javax.swing.JMenu fileMenu; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel8; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextArea messageText; private javax.swing.JMenuItem newMenuItem; private javax.swing.JTextField path; private javax.swing.JMenuItem removeAllMenu; private javax.swing.JButton sendBtn; private javax.swing.JLabel sendToLabel; private javax.swing.JTextField sendToText; private javax.swing.JTextField subjectText; // End of variables declaration//GEN-END:variables // String attachment_path; String attachment_path1 = null; String attachment_path2 = null; List a1 = new ArrayList(); List a2 = new ArrayList(); // File selectedFile; }
8ab487cc744dfad38a7a65c1fbff4039c1d2b9e6
e5f991d01a6d8da55347919aaaa0f281a1d8b2f0
/src/subarray/Candy_135.java
21f62bbe86859baf72bba1e8cd9c8ae4d3734a67
[]
no_license
xz565/Rio
3875e942c8fbcd699c07dc8a97a290e670bad5ff
223ef6c757af4b99041fb28b474873ba8c87012f
refs/heads/master
2020-03-30T11:24:20.875754
2018-10-12T05:49:21
2018-10-12T05:49:21
151,171,806
0
0
null
null
null
null
UTF-8
Java
false
false
1,001
java
package subarray; /** * Created by xiaodz on 5/29/17. */ public class Candy_135 { public static int candy(int[] ratings) { // scan from left -> right // scan from right -> left // [1,2,3,4,5,3,2,1] // 1,2,3,4,5,1,1,1 // 1 2 3 4 5 3 2 1 int[] candy = new int[ratings.length]; candy[0] = 1; for (int i = 1; i < ratings.length; i++) { if (ratings[i] > ratings[i-1]) { candy[i] = candy[i-1] + 1; } else { candy[i] = 1; } } int sum = candy[ratings.length-1]; for (int i = ratings.length - 2; i >= 0; i--) { if (ratings[i] > ratings[i+1] && candy[i] <= candy[i+1]) { candy[i] = candy[i+1] + 1; } sum += candy[i]; } return sum; } public static void main(String[] args) { int[] rating = {1,2,3,4,5,3,2,1}; System.out.println(candy(rating)); } }
271cc526a7af281223757203d57ca7cd86dd4546
79b59996fb4cde427cdd75e5e7a8a1c3a6c20f9a
/java-demo/src/main/java/org/thor/javademo/network/GreetClient.java
b06298ae387ac9cba0e670f54980b112b2c10ebf
[]
no_license
a364514921/thor-study
1389a2439857d77ef2fb0ff93c05dc324af3793b
f78985ea9bec20b7d299d355e1be589e86cb07eb
refs/heads/master
2022-06-30T03:26:34.992652
2021-11-19T01:00:52
2021-11-19T01:00:52
239,874,296
1
0
null
2022-06-21T02:47:35
2020-02-11T22:05:32
Java
UTF-8
Java
false
false
1,225
java
package org.thor.javademo.network; import java.io.*; import java.net.Socket; /** * 模块名称:StudyJava com.wyq.studyjava.网络编程 * 功能说明:<br> * 开发人员:wangyiqiang * 创建时间: 2017-08-23 下午7:23 * 系统版本:1.0.0 **/ public class GreetClient { public static void main(String [] args) { String serverName = args[0]; int port = Integer.parseInt(args[1]); try { System.out.println("连接到主机:" + serverName + " ,端口号:" + port); Socket client = new Socket(serverName, port); System.out.println("远程主机地址:" + client.getRemoteSocketAddress()); OutputStream outToServer = client.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); out.writeUTF("Hello from " + client.getLocalSocketAddress()); InputStream inFromServer = client.getInputStream(); DataInputStream in = new DataInputStream(inFromServer); System.out.println("服务器响应: " + in.readUTF()); client.close(); }catch(IOException e) { e.printStackTrace(); } } }
18b453180a65d0eec66ce91ecd3137aba13d7b01
065e6c67cc5fedeaab880d3707fb7f173bbd7c42
/app/src/main/java/com/example/android/recipes/utilities/OnStepClickListener.java
42eabef6d72c687dfa56012ba135a9c8aa470985
[]
no_license
BrunoCode7/Recipes
2dd42b18b44a66f9ba599029a44f6148a4ea8337
f130d956e198c88f29961cd945304c6ba75d9b2a
refs/heads/master
2020-03-21T16:18:04.470969
2018-07-28T19:09:19
2018-07-28T19:09:19
138,761,339
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package com.example.android.recipes.utilities; /** * Created by Baraa Hesham on 6/18/2018. */ public interface OnStepClickListener { void OnStepSelected(int position); }
d61fb1542f9b78f0de189fd2148e7e7b8162ace5
5fb2dfd88cea9455d82f14aea01f7db695968ad9
/Poster/app/src/main/java/com/wanzhuan/poster/TestManager/TestClass.java
139268582f1834c0087903a0a767b15a5a74f66b
[]
no_license
bladesaber/Android-Tv-App-development
41a69fa6a1fc42e903ab6fe76026d86e2ea35b23
8ed3548a348da9f41e0b5b1c43c14d793d4a8acb
refs/heads/master
2022-06-14T20:56:01.152774
2020-05-05T08:33:05
2020-05-05T08:33:05
261,398,454
0
0
null
null
null
null
UTF-8
Java
false
false
1,639
java
package com.wanzhuan.poster.TestManager; import android.content.Context; import android.os.Message; import com.wanzhuan.poster.AppManager.AppManager; import com.wanzhuan.poster.Global.GlobalSignManager; import com.wanzhuan.poster.HttpClient.GetThread; import com.wanzhuan.poster.HttpClient.PostThread; import org.json.JSONException; import org.json.JSONObject; /** * Created by bladesaber on 2018/6/29. */ public class TestClass { private static TestClass testClass = null; public static TestClass getInstance(){ if (testClass==null){ testClass = new TestClass(); } return testClass; } public void TestGet(Context context){ GetThread getThread = new GetThread(context,"https://www.baidu.com"){ @Override public void Handle_Response(String Result) { super.Handle_Response(Result); System.out.println("network test is: "+Result); } }; getThread.start(); } public void TestPost(Context context){ JSONObject jsonObject = new JSONObject(); try { jsonObject.put("wtf", "wtf"); } catch (JSONException e) { e.printStackTrace(); } PostThread postThread = new PostThread(context,"http://192.168.31.123/OwnTest/public/api/wtf",jsonObject){ public void Handle_Response(String Result){ System.out.println("network test is: "+Result); } }; postThread.start(); } private void test_non_params(int... param){ int[] var = new int[param.length+1]; } }
0b6fb7b9a221e4026e1d1dc6119aac2b91dbdb50
815e09ee205376542f1903613d3aea6b52a44b31
/src/docView/service/boardListService.java
0465ee7fd3d2fa57315048e97440036fcb41f882
[]
no_license
leejoy980/DMS
8959c6226e37aaee8f4f0d3c7002d898d8338214
e26b96852714d36ecefd267462cd4ee4b4b021be
refs/heads/master
2022-04-04T14:39:14.526061
2020-02-19T08:03:51
2020-02-19T08:03:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,680
java
package docView.service; import java.sql.Connection; import java.sql.SQLException; import java.util.List; import Dao.boardDao; import VO.boardListVo; import jdbc.connection.ConnectionProvider; public class boardListService { private boardDao boardDao = new boardDao(); private int size = 15; public boardListPageService getBoardListPage(int pageNum,String boardType){ try(Connection conn = ConnectionProvider.getConnection()){ int total = boardDao.totalDoc(conn, boardType); List<boardListVo> content = boardDao.selectByBoardList(conn, boardType, (pageNum-1)*size,size); return new boardListPageService(total,pageNum,size,content); }catch(SQLException e){ throw new RuntimeException(e); } } public boardListPageService getDoc_idSearchPage(int pageNum,String boardType,int searchDoc_id){ try(Connection conn = ConnectionProvider.getConnection()){ int total = 1; List<boardListVo> content = boardDao.selectByDoc_id(conn, boardType, (pageNum-1)*size,size,searchDoc_id); return new boardListPageService(total,pageNum,size,content); }catch(SQLException e){ throw new RuntimeException(e); } } public boardListPageService getTitleSearchPage(int pageNum,String boardType,String searchTitle){ try(Connection conn = ConnectionProvider.getConnection()){ searchTitle = "%"+searchTitle +"%"; int total = boardDao.totalSearchTitle(conn,boardType,searchTitle); List<boardListVo> content = boardDao.selectByTitle(conn, boardType, (pageNum-1)*size,size,searchTitle); return new boardListPageService(total,pageNum,size,content); }catch(SQLException e){ throw new RuntimeException(e); } } }
03cb8720aaa5bd53d1f2d2d69fb112e5f672a51e
b21956ea72a6fd6615d67709b2c82e121d8c1668
/qmx-app-admin/src/main/java/com/qmx/admin/filter/CsrfFilter.java
ee00ae57317db349239671f718179db6152b2b82
[]
no_license
qq296326738/NewSB
71bacbb83883b01c2f2413c1671564a54493ad49
bd8d00a8da7719dd5a21675678774da995f26dad
refs/heads/master
2020-03-27T23:03:01.608764
2018-09-04T04:06:58
2018-09-04T04:06:58
147,284,843
0
1
null
null
null
null
UTF-8
Java
false
false
3,154
java
package com.qmx.admin.filter; import com.qmx.base.core.utils.WebUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class CsrfFilter implements Filter { private static final Logger logger = LoggerFactory.getLogger(CsrfFilter.class); // 白名单 private List<String> whiteUrls; private int _size = 0; public void init(FilterConfig filterConfig) { // 读取文件 String path = CsrfFilter.class.getResource("/").getFile(); whiteUrls = readFile(path + "csrfWhite.txt"); _size = null == whiteUrls ? 0 : whiteUrls.size(); } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; // 获取请求url地址 String url = req.getRequestURL().toString(); String referurl = req.getHeader("Referer"); logger.info("referurl----->" + referurl); if (isWhiteReq(referurl)) { chain.doFilter(request, response); } else { req.getRequestDispatcher("/").forward(req, res); // 记录跨站请求日志 String log = ""; String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); String clientIp = WebUtil.getHost(req); log = clientIp + "||" + date + "||" + referurl + "||" + url; logger.warn(log); return; } } catch (Exception e) { logger.error("doFilter", e); } } /* * 判断是否是白名单 */ private boolean isWhiteReq(String referUrl) { if (referUrl == null || "".equals(referUrl) || _size == 0) { return true; } else { String refHost = ""; referUrl = referUrl.toLowerCase(); if (referUrl.startsWith("http://")) { refHost = referUrl.substring(7); } else if (referUrl.startsWith("https://")) { refHost = referUrl.substring(8); } for (String urlTemp : whiteUrls) { if (refHost.indexOf(urlTemp.toLowerCase()) > -1) { return true; } } } return false; } public void destroy() { } private List<String> readFile(String fileName) { List<String> list = new ArrayList<String>(); BufferedReader reader = null; FileInputStream fis = null; try { File f = new File(fileName); if (f.isFile() && f.exists()) { fis = new FileInputStream(f); reader = new BufferedReader(new InputStreamReader(fis, "UTF-8")); String line; while ((line = reader.readLine()) != null) { if (!"".equals(line)) { list.add(line); } } } } catch (Exception e) { logger.error("readFile", e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { logger.error("InputStream关闭异常", e); } try { if (fis != null) { fis.close(); } } catch (IOException e) { logger.error("FileInputStream关闭异常", e); } } return list; } }
16a2cee1fc75045b6193618f1299df909fa91127
f2fa1a9299f580efbccb4ef200789569c005dbaa
/Abhigaya_java/src/abhigaya/EqualToOperator.java
cbf97a020097dce9c064d6f60f35e85edf715666
[]
no_license
smmmanagerhere/Java_code
bf835d4ac732848014ac995dc22ee5cdeb691aea
b81f8dfc8269d7c3296c44e6ead1cf3c5c95bc69
refs/heads/master
2023-07-02T21:13:22.378191
2021-07-23T01:36:45
2021-07-23T01:36:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
590
java
package abhigaya; public class EqualToOperator { public static void main(String[] args) { // TODO Auto-generated method stub double i = 20.0; int j = 20; System.out.println(i == j);//false String s1 = "java"; // obj created String s2 = "java"; //s2 will be pointing to obj which is appointed by s1 String s3 = new String("java"); // heap <-s3 System.out.println(s1==s2);//true System.out.println(s1==s3); //false because both are pointing to diff obj int var1=10; int var2=20; System.out.println(var1!=var2); System.out.println(s1!=s2); } }
dd6c1ed15e7f3df96ddc8248d40ab1c7e521988b
ba28cd243922c835e4242c8dace4c6a3c5a6372a
/app/src/main/java/com/example/fwqi/dudu/activity/MoreProductActivity.java
c052ccd598df5c58361314ead7cddebfa2ed8ee9
[]
no_license
leehong2005/dudumall
234b86b65cbab9e7d4fde3db5b2aed166cc2e96f
55b65e77cbdb5a89a8f409f4f8dbe65e8a42747b
refs/heads/master
2021-01-10T08:37:10.928712
2015-12-17T14:56:34
2015-12-17T14:56:34
48,179,843
0
0
null
null
null
null
UTF-8
Java
false
false
3,272
java
package com.example.fwqi.dudu.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import com.example.fwqi.dudu.common.AppConstants; import com.example.fwqi.dudu.data.RecommendItemData; import com.example.fwqi.dudu.data.Product; import com.example.fwqi.dudu.data.ServiceData; import com.example.fwqi.dudu.utils.HttpUtils; import com.example.fwqi.dudu.widget.RecommendItemView; import java.util.List; /** * Created by leehong on 2015/10/11. */ public class MoreProductActivity extends ActionBarActivity{ private MoreProductUIHandler handler = new MoreProductUIHandler(); private ServiceData moreProductData = null; private String cateId = null; private RecommendItemView moreProductView = null; /** * Start the activity. * @param from * @param cateName * @param cateId */ public static void startActivity(Context from, CharSequence cateName, String cateId) { Activity fromActivity = (Activity) from; Intent intent = new Intent(); intent.putExtra("cateName", cateName); intent.putExtra("cateId", cateId); intent.setClass(fromActivity, MoreProductActivity.class); fromActivity.startActivity(intent); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); String titleName = intent.getStringExtra("cateName"); cateId = intent.getStringExtra("cateId"); // Create the grid view to show more product.The grid view has no data now. moreProductView = new RecommendItemView(this); moreProductView.setTitleVisibility(false); moreProductView.setColumn(3); setContentView(moreProductView); this.setTitleName(titleName); // Start the worker thread to request data from server. MoreProductRequestThread thread = new MoreProductRequestThread(handler); thread.start(); this.showLoadingView(); } class MoreProductUIHandler extends Handler { @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (moreProductData != null && moreProductData.getErrNo() == AppConstants.ERROR_CODE_SUCCESS) { List<Product> productList = (List<Product>) moreProductData.getData("list"); RecommendItemData data = new RecommendItemData(); data.setItemData(productList); moreProductView.setData(data); MoreProductActivity.this.hideLoadingView(); } } } class MoreProductRequestThread extends Thread { private Handler uiHandler = null; public MoreProductRequestThread(Handler uiHandler) { this.uiHandler = uiHandler; } @Override public void run() { moreProductData = HttpUtils.getMoreProductData(cateId, 0, 30); if (uiHandler != null) { uiHandler.obtainMessage().sendToTarget(); } } } }
0933da1acd05f33eb504fa22cc17e8bf1a32c959
0d685ed31a24acc1abef8b69a785d2a6c45e2253
/Lab3_b/app/src/main/java/com/example/lab3_b/entity/Animal.java
909ee71bb37e254962077fb2694ef6955bd87291
[]
no_license
Keilymin/mobile_programming_labs
19bdc300fa3a284ad7b8c3469cfc42c61db0b22d
0d943a8a1cf937919fef9b6160072611c3a52ace
refs/heads/master
2021-03-04T08:58:23.331711
2020-04-05T22:38:47
2020-04-05T22:38:47
246,021,776
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package com.example.lab3_b.entity; import java.io.Serializable; //Класс животных public class Animal implements Serializable { //картинка животного private int image; //имя private String name; //класс private String species; //описание private int description; public Animal(int image, String name, String species, int description) { this.image = image; this.name = name; this.species = species; this.description = description; } public int getImage() { return image; } public void setImage(int image) { this.image = image; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSpecies() { return species; } public void setSpecies(String species) { this.species = species; } public int getDescription() { return description; } public void setDescription(int description) { this.description = description; } }
ef0a2e1bcb8297147421b5bcd69a398f33cea304
bb431b4a03a2e4d45c242d9e6b7920618d5ecb32
/YourFirstCup/dev-app-parent/db-fixtures-jar/src/main/java/firstcup/sql/util/DbFixtures.java
bcffefa0da618653c067536803a326dc07d7106e
[]
no_license
harishkannarao/Java_EE_Tutorial
2b9bbbbfcccd020b1a2f84dd2980211da38c4375
4899fb00f206e74db1f47066bac8b29785f4d5a9
refs/heads/master
2020-04-26T10:10:06.369578
2015-06-28T17:57:39
2015-06-28T17:57:39
28,489,154
2
0
null
null
null
null
UTF-8
Java
false
false
1,960
java
package firstcup.sql.util; import javax.inject.Inject; import javax.sql.DataSource; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.sql.Connection; public class DbFixtures { private static final String DELETE_SQL_FILE = "db_scripts/delete.sql"; private static final String DROP_SQL_FILE = "db_scripts/drop.sql"; private static final String CREATE_SQL_FILE = "db_scripts/create.sql"; private static final String INSERT_SQL_FILE = "db_scripts/insert.sql"; private final ScriptRunner scriptRunner = new ScriptRunner(false, true); @Inject @DbFixturesDataSource private DataSource dataSource; public void createDbFixtures() throws Exception { createDbObjects(); insertDbFixtures(); } public void resetDbFixtures() throws Exception { clearDbFixtures(); insertDbFixtures(); } public void resetDatabase() throws Exception { clearDbFixtures(); clearDbObjects(); createDbObjects(); insertDbFixtures(); } public void clearDbFixtures() throws Exception { runSqlScript(DELETE_SQL_FILE); } public void clearDbObjects() throws Exception { runSqlScript(DELETE_SQL_FILE); runSqlScript(DROP_SQL_FILE); } public void createDbObjects() throws Exception { runSqlScript(CREATE_SQL_FILE); } public void insertDbFixtures() throws Exception { runSqlScript(INSERT_SQL_FILE); } private void runSqlScript(String sqlFile) throws Exception { InputStream inputStream = getClass().getClassLoader().getResourceAsStream(sqlFile); Reader reader = new BufferedReader(new InputStreamReader(inputStream)); try(Connection connection = dataSource.getConnection()) { scriptRunner.runScript(connection, reader); } } }
50f513b5b5d0506beda8f889c962c12223ee7ab1
5e112ce16b41f40a000ed2470087db40402d2312
/src/br/com/pcsocial/cliente/visao/manter/AdicionarDemandaUI.java
d8d61f496b75f3ed4279197248aa901fc8981812
[]
no_license
marcooos/PCSocialRMIClient
7c578138b3eadf9b1a2d8c668e03b1d6ea6e1960
c62c482cede500f9fb85b04f3ffd9b9d968c144d
refs/heads/master
2020-09-24T11:26:48.157920
2013-08-12T20:06:41
2013-08-12T20:06:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,523
java
package br.com.pcsocial.cliente.visao.manter; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.WindowConstants; import br.com.pcsocial.cliente.DemandaCliente; import br.com.pcsocial.servidor.modelo.Demanda; public class AdicionarDemandaUI extends JDialog { private static final long serialVersionUID = 1L; private JDialog adicionarDemanda; private Dimension dmsTela; private JButton btnConfirmar, btnCancelar; private JPanel panel, panelInfBotoes, panelCentral; private BorderLayout layout; private FlowLayout layoutInfBotoes; private FlowLayout layoutCentral; private JLabel lbDescricao, lbCodEmpresaPMS; private JTextField tfDescricao, tfCodEmpresaPMS; private Dimension dmsEdit, dmsLabel, dmsEditDois, dmsLabelDois; private Demanda demanda; private byte janelaAtiva; public AdicionarDemandaUI() { } public void createAndShowUI(String t, Demanda dm) { // Propriedades dos componentes da janela dmsEdit = new Dimension(620, 27); dmsEditDois = new Dimension(100, 27); dmsLabel = new Dimension(140, 27); dmsLabelDois = new Dimension(90, 27); // Instanciar Janela dmsTela = new Dimension(800, 600); adicionarDemanda = new JDialog(); // Tãtulo da Janela adicionarDemanda.setTitle(t); // Textos lbDescricao = new JLabel("Descrição", SwingConstants.RIGHT); lbDescricao.setPreferredSize(dmsLabel); lbCodEmpresaPMS = new JLabel("Cod. PMS", SwingConstants.RIGHT); lbCodEmpresaPMS.setPreferredSize(dmsLabel); // Editores tfDescricao = new JTextField(); tfDescricao.setPreferredSize(dmsEdit); tfCodEmpresaPMS = new JTextField(); tfCodEmpresaPMS.setPreferredSize(dmsEditDois); // Atribuir campos ao Apartamento tfDescricao.setText(demanda.getDescricao()); tfCodEmpresaPMS.setText(demanda.getCodPmsStr()); // Botoes btnConfirmar = new JButton("Confirmar"); btnCancelar = new JButton("Cancelar"); // Paineis panel = new JPanel(); panelInfBotoes = new JPanel(); panelCentral = new JPanel(); layout = new BorderLayout(); layoutInfBotoes = new FlowLayout(FlowLayout.LEFT); layoutCentral = new FlowLayout(FlowLayout.LEFT); // Propriedades dos componentes panelInfBotoes.setBorder(new javax.swing.border.LineBorder( new java.awt.Color(160, 160, 160), 1, true)); panelCentral.setBorder(javax.swing.BorderFactory .createTitledBorder("Dados gerais")); // Acoes btnConfirmar.setIcon(new ImageIcon( getClass().getResource("/gui/icones/acoes/confirmar.png"))); btnConfirmar.addActionListener(al); btnCancelar.setIcon(new ImageIcon( getClass().getResource("/gui/icones/acoes/cancelar.png"))); btnCancelar.addActionListener(al); // Propriedades dos paineis panel.setLayout(layout); panelInfBotoes.setLayout(layoutInfBotoes); panelCentral.setLayout(layoutCentral); panel.add(panelCentral, BorderLayout.CENTER); panel.add(panelInfBotoes, BorderLayout.SOUTH); // Adicionar componentes ao painel central panelCentral.add(lbDescricao); panelCentral.add(tfDescricao); panelCentral.add(lbCodEmpresaPMS); panelCentral.add(tfCodEmpresaPMS); // Adicionar componentes ao painel inferior panelInfBotoes.add(btnConfirmar); panelInfBotoes.add(btnCancelar); // Propriedades da Janela adicionarDemanda.setPreferredSize(dmsTela); adicionarDemanda.setSize(dmsTela); adicionarDemanda.setMaximumSize(dmsTela); adicionarDemanda.setMinimumSize(dmsTela); adicionarDemanda.add(panel); adicionarDemanda.setLocationRelativeTo(null); adicionarDemanda.setModal(true); adicionarDemanda.setVisible(true); adicionarDemanda.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } public void adicionarDemanda() { // Instanciar Demanda demanda = new Demanda(); // Criar interface createAndShowUI("Adicionar demandas", demanda); janelaAtiva = 0; } public void alterarDemanda(Long id) { // Instanciar Demanda demanda = new Demanda(); // Intanciar Demanda Cliente DemandaCliente dc = new DemandaCliente(); demanda = dc.buscarDemandaId(id); // Criar interface janelaAtiva = 1; createAndShowUI("Alterar demanda", demanda); } public void excluirDemanda(Long id) { demanda = new Demanda(); // Intanciar Demanda Cliente DemandaCliente dc = new DemandaCliente(); demanda = dc.buscarDemandaId(id); dc.excluirDemanda(id); } public void setDmsEditDois(Dimension dmsEditDois) { this.dmsEditDois = dmsEditDois; } public Dimension getDmsEditDois() { return dmsEditDois; } public void setDmsLabelDois(Dimension dmsLabelDois) { this.dmsLabelDois = dmsLabelDois; } public Dimension getDmsLabelDois() { return dmsLabelDois; } // ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(btnConfirmar)) { DemandaCliente dm = new DemandaCliente(); demanda.setDescricao(tfDescricao.getText()); demanda.setCodPms(Long.parseLong(tfCodEmpresaPMS.getText())); if (janelaAtiva == 0) { if (dm.adicionarDemanda(demanda)) { javax.swing.JOptionPane .showMessageDialog( null, "Cadastro realizado com sucesso", "Informação", 0, new ImageIcon( getClass().getResource("/gui/icones/acoes/informacao.png"))); tfDescricao.setText(null); tfCodEmpresaPMS.setText(null); tfDescricao.setFocusable(true); } } if (janelaAtiva == 1) { if (dm.alterarDemanda(demanda)) { javax.swing.JOptionPane .showMessageDialog( null, "Cadastro alterado com sucesso", "Informação", 0, new ImageIcon( getClass().getResource("/gui/icones/acoes/informacao.png"))); } } } if (e.getSource().equals(btnCancelar)) { if (javax.swing.JOptionPane .showConfirmDialog( null, "Deseja cancelar a operação? \n" + " Todas as informaçães não salvas serão perdidas", "Confirme sua operação ", javax.swing.JOptionPane.YES_NO_OPTION, 0, new ImageIcon( getClass().getResource("/gui/icones/acoes/alerta.png"))) == 0) { adicionarDemanda.dispose(); } } } }; }
fdd25eafcc635377c0e6b1dd5e416a9bfa56dcac
2636b9ce828a7862d93ca19521bfec89e8530a2c
/turms-server-common/src/test/java/unit/im/turms/server/common/infra/plugin/JavaPluginManagerTests.java
1fe167ba7e1bc501f2a346cf3a4b6282017c077c
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0", "AGPL-3.0-or-later", "LicenseRef-scancode-unknown-license-reference", "SSPL-1.0" ]
permissive
turms-im/turms
f1ccbc78175a176b3f5edf34b2b2badc901dcece
33bef70a5737c23adea72c6ba150b851bee6bfb6
refs/heads/develop
2023-09-01T17:02:03.053493
2023-08-23T13:53:21
2023-08-23T14:04:20
191,290,973
1,506
217
Apache-2.0
2023-04-25T02:38:02
2019-06-11T04:01:39
Java
UTF-8
Java
false
false
5,907
java
/* * Copyright (C) 2019 The Turms Project * https://github.com/turms-im/turms * * 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 unit.im.turms.server.common.infra.plugin; import java.nio.file.Path; import java.util.Collections; import java.util.List; import lombok.SneakyThrows; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.boot.SpringApplication; import org.springframework.context.ApplicationContext; import util.JarUtil; import im.turms.plugin.MyExtensionPoint; import im.turms.server.common.infra.cluster.node.NodeType; import im.turms.server.common.infra.cluster.service.rpc.RpcService; import im.turms.server.common.infra.context.TurmsApplicationContext; import im.turms.server.common.infra.plugin.PluginClassLoader; import im.turms.server.common.infra.plugin.PluginManager; import im.turms.server.common.infra.plugin.TurmsExtension; import im.turms.server.common.infra.property.TurmsProperties; import im.turms.server.common.infra.property.TurmsPropertiesManager; import im.turms.server.common.infra.property.env.common.plugin.PluginProperties; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author James Chen */ class JavaPluginManagerTests { private static final String JAR_NAME = "MyPluginForTest.jar"; private static final Path JAR_FILE; static { JAR_FILE = JarUtil.createJarFile(JAR_NAME, List.of(SpringApplication.class, MyExtension.class, MyExtensionPoint.class, MyPlugin.class), List.of("plugin.yaml")); } @Disabled("legacy test and should be rewritten later") @Test void shouldLoadPluginWithPluginLoader() { MyExtensionPoint myExtensionPoint = getMyExtensionPoint(); assertThat(myExtensionPoint.getClass()).isNotEqualTo(MyExtension.class); assertThat(myExtensionPoint.getClass() .getName()).isEqualTo(MyExtension.class.getName()); assertThat(myExtensionPoint.getClass() .getClassLoader()).isInstanceOf(PluginClassLoader.class); } @SneakyThrows @Test void shouldLoadTurmsClassInPluginWithSystemLoader() { MyExtensionPoint myExtensionPoint = getMyExtensionPoint(); // We don't declare "MyExtension" here because // "MyExtension" will be loaded by the system class loader // while "MyExtension" in the plugin will use "PluginClassLoader" // so they cannot cast to each other TurmsExtension myExtension = (TurmsExtension) myExtensionPoint; Class<?> rpcServiceClass = (Class<?>) myExtension.getClass() .getDeclaredField("rpcServiceClass") .get(myExtension); assertThat(rpcServiceClass).isEqualTo(RpcService.class); assertThat(rpcServiceClass.getClassLoader()).isEqualTo(ClassLoader.getSystemClassLoader()); } @Disabled("legacy test and should be rewritten later") @SneakyThrows @Test void shouldPreferClassesInPlugin() { MyExtensionPoint myExtensionPoint = getMyExtensionPoint(); TurmsExtension myExtension = (TurmsExtension) myExtensionPoint; Object application = myExtension.getClass() .getDeclaredField("application") .get(myExtension); assertThat(application.getClass()).isNotEqualTo(SpringApplication.class); assertThat(application.getClass() .getName()).isEqualTo(SpringApplication.class.getName()); assertThat(application.getClass() .getClassLoader()).isInstanceOf(PluginClassLoader.class); boolean testMethodRetVal = (boolean) application.getClass() .getDeclaredMethod("test") .invoke(application); assertThat(testMethodRetVal).isTrue(); } @SneakyThrows @Test void shouldRunMethodInPluginSuccessfully() { MyExtensionPoint myExtensionPoint = getMyExtensionPoint(); TurmsExtension myExtension = (TurmsExtension) myExtensionPoint; boolean testMethodRetVal = (boolean) myExtension.getClass() .getDeclaredMethod("testBool") .invoke(myExtension); assertThat(testMethodRetVal).isTrue(); } private MyExtensionPoint getMyExtensionPoint() { ApplicationContext context = mock(ApplicationContext.class); TurmsApplicationContext applicationContext = mock(TurmsApplicationContext.class); when(applicationContext.getHome()).thenReturn(JAR_FILE.getParent() .toAbsolutePath()); TurmsPropertiesManager propertiesManager = mock(TurmsPropertiesManager.class); when(propertiesManager.getLocalProperties()).thenReturn(new TurmsProperties().toBuilder() .plugin(new PluginProperties().toBuilder() .enabled(true) .dir(".") .build()) .build()); PluginManager manager = new PluginManager( NodeType.GATEWAY, context, applicationContext, propertiesManager, Collections.emptySet()); return manager.getExtensionPoints(MyExtensionPoint.class) .get(0); } }
7e1c415ff273478e4d115b77ebbdb3c3b4edbf40
982f6c3a3c006d2b03f4f53c695461455bee64e9
/src/main/java/com/alipay/api/domain/UserLoginStatusDetail.java
33794d4a9ce17fd51809344ddad1532fec4ee313
[ "Apache-2.0" ]
permissive
zhaomain/Alipay-Sdk
80ffc0505fe81cc7dd8869d2bf9a894b823db150
552f68a2e7c10f9ffb33cd8e0036b0643c7c2bb3
refs/heads/master
2022-11-15T03:31:47.418847
2020-07-09T12:18:59
2020-07-09T12:18:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,941
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 口碑云登录子账号状态的详细信息 * * @author auto create * @since 1.0, 2018-11-16 21:41:17 */ public class UserLoginStatusDetail extends AlipayObject { private static final long serialVersionUID = 8536667912718484616L; /** * 口碑云子账号联系人邮箱 */ @ApiField("contact_email") private String contactEmail; /** * 口碑云子账号联系人名称 */ @ApiField("contact_name") private String contactName; /** * 口碑云子账号联系人联系方式 */ @ApiField("contact_phone") private String contactPhone; /** * 口碑云子账号id */ @ApiField("user_id") private String userId; /** * 口碑云子账号名称 */ @ApiField("user_name") private String userName; /** * 口碑云子账户显示名 */ @ApiField("user_show_name") private String userShowName; public String getContactEmail() { return this.contactEmail; } public void setContactEmail(String contactEmail) { this.contactEmail = contactEmail; } public String getContactName() { return this.contactName; } public void setContactName(String contactName) { this.contactName = contactName; } public String getContactPhone() { return this.contactPhone; } public void setContactPhone(String contactPhone) { this.contactPhone = contactPhone; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserShowName() { return this.userShowName; } public void setUserShowName(String userShowName) { this.userShowName = userShowName; } }
490749f5b60851895eb621bc50619eb3c7f731d7
3c6a4cfdf26b0a450570bef8e7560994ce9f8df4
/app/src/main/java/com/quick/common/mvp/project/ProjectArticlePresenter.java
c5e14507985a3b20c2086da5011e995354a702d6
[]
no_license
zhaolongd/Common
3f02770f32fb44fa76084bf578e7a715b1e2f955
67d412fc28a87d7e88ce204efbabe4c7be514df2
refs/heads/master
2020-11-29T20:39:01.616106
2020-04-17T06:43:50
2020-04-17T06:43:50
230,211,761
2
0
null
null
null
null
UTF-8
Java
false
false
1,167
java
package com.quick.common.mvp.project; import android.app.Activity; import androidx.lifecycle.LifecycleOwner; import com.quick.common.bean.main.ArticleListBean; import com.quick.common.config.HttpConfig; import com.quick.common.mvp.base.BasePresenter; import com.quick.core.rxhttp.OnError; import com.rxjava.rxlife.RxLife; import rxhttp.wrapper.param.RxHttp; /** * Created by zhaolong. * Description: * Date: 2019/12/24 0024 15:05 */ public class ProjectArticlePresenter extends BasePresenter<ProjectArticleView> { public ProjectArticlePresenter(LifecycleOwner owner, ProjectArticleView mvpView, Activity activity) { super(owner, mvpView, activity); } public void getProjectArticleList(int id, int page) { RxHttp.get(String.format(HttpConfig.PROJECT_ARTICLE_LIST, page)) .add("cid", id) .asResponse(ArticleListBean.class) .as(RxLife.asOnMain(this)) .subscribe(s -> { //成功回调 mvpView.getProjectArticleListSuccess(s); }, (OnError) error -> { //失败回调 }); } }
dcf386d8e636e1269180bce79fc4aa4ad13afbbf
f4fa8c471e352d37fe81e381b49fffe04c7db0db
/Spring/src/main/java/learning/programs/P01_SpringAsFactoryDemo.java
64a2785cf1e0d5bd251ec97b4ffb2d9260075a0c
[]
no_license
shubhambalyan/hibernate-with-spring
2878c14ca5778a85fccd273c499b2e526a7fa7f5
9d25f4d9082d09a6135df4da8d072f8515e63e21
refs/heads/master
2022-12-21T12:09:06.252915
2021-01-26T11:51:53
2021-01-26T11:51:53
195,571,569
0
0
null
2022-12-16T13:56:28
2019-07-06T18:32:22
Java
UTF-8
Java
false
false
833
java
package learning.programs; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import learning.cfg.AppConfig6; import learning.dao.DaoException; import learning.dao.ProductDao; /** * */ public class P01_SpringAsFactoryDemo { /** * @param args * @throws DaoException */ public static void main(final String[] args) throws DaoException { //spring container final AnnotationConfigApplicationContext ctx; //object representing spring container based on AppConfig1 ctx = new AnnotationConfigApplicationContext(AppConfig6.class); final ProductDao dao1 = ctx.getBean("htDao", ProductDao.class); final int pc = dao1.count(); System.out.println(pc); //close the container ctx.close(); } }
d3e5b31d82568ab36a595edab30485ebf156a8f8
b74d9186fc9fe77623cbec41bc6c4daef2141ef7
/src/main/java/lv/javaguru/novopol/logic/api/producer/AddProducerResponse.java
7aff406013baeab22a230f8c3ab4df80330cb83c
[]
no_license
YuryPetukhou/Novopol
86b2c55a9dc197577c756c55da63fc191ce38f33
9968b0051ea40407157c89b4f1944e9cc70c48cc
refs/heads/master
2021-09-03T02:07:18.612219
2018-01-04T19:23:51
2018-01-04T19:23:51
105,168,313
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package lv.javaguru.novopol.logic.api.producer; import lv.javaguru.novopol.domain.Producer; public class AddProducerResponse { private final Producer producer; public AddProducerResponse (Producer producer) { super(); this.producer = producer; } public Producer getProducer() { return producer; } }
[ "Yury@Lacis" ]
Yury@Lacis
31baf3c9ae1d0669086a847232a6afcca00c2999
16cd938f36df6a7fd5cd755b6e6071b7b4c255a3
/src/calcolo/paralello/Buffer.java
bfeef2c8f671a2a838a9387da4e9c77ffe8e5b65
[]
no_license
DELROCCAGIORGIO/CalcoloParallelo
4e5ea636fd26799e103633ce13c145c41331621d
3673cd0084bbbae6cd60cd905886f7000e79ae4d
refs/heads/master
2023-03-25T20:59:19.846986
2021-03-23T07:30:57
2021-03-23T07:30:57
350,616,197
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package calcolo.paralello; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Giorgio Del Rocca */ public class Buffer { public double x=0, y=0, z=0, t=0, k=0, a, b, c; public Buffer(double a, double b, double c) { this.a = a; this.b = b; this.c = c; System.out.println("i parametri valgono a: "+a +" b: "+b+" c: "+c); } }
6b7599a1ed0804d7f0d5d78b6996d4ad6dd8c7d0
f562b9546f93024e90da0ff68e0f8f8da5ddd27a
/app/src/main/java/com/example/proximityserviceapp/ServiceDetails.java
34a1d4c19cd97fb7e9c77a6c67462e25f2a67c4f
[]
no_license
parth-v/ProximityServiceApp
b2db75182ae15aa062ee5d03ee4f3bdd0b615c3f
a70252ed1d557906916358cc63628135f67107e5
refs/heads/master
2023-02-04T17:43:03.453980
2020-12-31T17:04:35
2020-12-31T17:04:35
323,072,183
0
0
null
null
null
null
UTF-8
Java
false
false
3,174
java
package com.example.proximityserviceapp; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.app.DatePickerDialog; import android.app.TimePickerDialog; import android.text.format.DateFormat; import android.widget.Button; import android.widget.DatePicker; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.TimePicker; import java.util.Calendar; import androidx.appcompat.app.AppCompatActivity; public class ServiceDetails extends AppCompatActivity implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener { TextView textView; Button button; int day, month, year, hour, minute; int myday, myMonth, myYear, myHour, myMinute; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_service_details); textView = findViewById(R.id.textView); button = findViewById(R.id.btnPick); button.setOnClickListener(v -> { //Make calendar dialog picker for booking service Calendar calendar = Calendar.getInstance(); year = calendar.get(Calendar.YEAR); month = calendar.get(Calendar.MONTH); day = calendar.get(Calendar.DAY_OF_MONTH); DatePickerDialog datePickerDialog = new DatePickerDialog(ServiceDetails.this, ServiceDetails.this,year, month,day); datePickerDialog.show(); }); } public void openBookSuccessActivity (View view) { //Open book success activity once user is done with data entry passing the service time selected Intent intent = new Intent(this, BookSuccessActivity.class); TextView text = (TextView) findViewById(R.id.textView); String time = String.valueOf(text.getText()); intent.putExtra("Time", time); startActivity(intent); } @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { //Setting the time picker dialog myYear = year; myday = day; myMonth = month; Calendar c = Calendar.getInstance(); hour = c.get(Calendar.HOUR); minute = c.get(Calendar.MINUTE); TimePickerDialog timePickerDialog = new TimePickerDialog(ServiceDetails.this, ServiceDetails.this, hour, minute, DateFormat.is24HourFormat(this)); timePickerDialog.show(); } @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { //Setting and displaying date and time to the user along with other service form inputs myHour = hourOfDay; myMinute = minute; RadioGroup radioGroup = (RadioGroup) findViewById(R.id.groupradio); int selectedId = radioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(selectedId); textView.setText("\n\nSelected Technician: "+ radioButton.getText() + "\nScheduled Time:\nDate- " + myday + "/" + myMonth + "/" + myYear + "\nTime- " + myHour + ":" + myMinute); } }
ca7b1d16411051b6c5a77fc9db012e32f54ea087
88c02d49d669c7637bbca9fd1f570cc7292f484f
/AndroidJniGenerate/GetJniCode/xwebruntime_javacode/org/xwalk/core/internal/XWalkContentLifecycleNotifier.java
59f96c9cab94eed079c063384e7744fce3efa72b
[]
no_license
ghost461/AndroidMisc
1af360cf36ae212a81814f9a4057884290dbe12e
dfa4c9115c0198755c9ff6c5e5c9ea3b56c9daff
refs/heads/master
2020-09-07T19:17:00.028887
2019-11-11T02:55:33
2019-11-11T02:55:33
220,887,476
0
0
null
null
null
null
UTF-8
Java
false
false
2,012
java
package org.xwalk.core.internal; import java.util.Iterator; import org.chromium.base.ObserverList; import org.chromium.base.ThreadUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; @JNINamespace(value="xwalk") public class XWalkContentLifecycleNotifier { public interface Observer { void onFirstXWalkViewCreated(); void onLastXWalkViewDestroyed(); } private static final ObserverList sLifecycleObservers; private static int sNumXWalkViews; static { XWalkContentLifecycleNotifier.sLifecycleObservers = new ObserverList(); } private XWalkContentLifecycleNotifier() { super(); } public static void addObserver(Observer arg1) { XWalkContentLifecycleNotifier.sLifecycleObservers.addObserver(arg1); } public static boolean hasXWalkViewInstances() { boolean v0 = XWalkContentLifecycleNotifier.sNumXWalkViews > 0 ? true : false; return v0; } @CalledByNative private static void onXWalkViewCreated() { ThreadUtils.assertOnUiThread(); ++XWalkContentLifecycleNotifier.sNumXWalkViews; if(XWalkContentLifecycleNotifier.sNumXWalkViews == 1) { Iterator v0 = XWalkContentLifecycleNotifier.sLifecycleObservers.iterator(); while(v0.hasNext()) { v0.next().onFirstXWalkViewCreated(); } } } @CalledByNative private static void onXWalkViewDestroyed() { ThreadUtils.assertOnUiThread(); --XWalkContentLifecycleNotifier.sNumXWalkViews; if(XWalkContentLifecycleNotifier.sNumXWalkViews == 0) { Iterator v0 = XWalkContentLifecycleNotifier.sLifecycleObservers.iterator(); while(v0.hasNext()) { v0.next().onLastXWalkViewDestroyed(); } } } public static void removeObserver(Observer arg1) { XWalkContentLifecycleNotifier.sLifecycleObservers.removeObserver(arg1); } }
aa2d5bdadb1a39298ed64c530435f0231bd99cb7
e315e2340f3cd7fd27004b7008fe0735e3182173
/NESO/src/search/QueryRetrievalModel.java
55aca1d77ba43160d346635897bccdf99e6033f6
[]
no_license
HuiZhang0312/Infromation-retrieval
f9888d2dac3a6bf24ea6a324d3fe53ca965b9a26
2a77c9d0ea2bc413ecbe09cb513553dc4df864f7
refs/heads/master
2021-01-18T18:31:15.820259
2017-03-08T20:24:15
2017-03-08T20:24:15
84,362,175
0
0
null
null
null
null
UTF-8
Java
false
false
3,940
java
package search; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import classes.Document; import classes.Path; import indexingLucene.MyIndexReader; public class QueryRetrievalModel{ protected MyIndexReader indexReader; // Accoring to slides, most common value is 2000 public double u = 2000; public long collectionLength; public QueryRetrievalModel(MyIndexReader ixreader) throws Exception { this.collectionLength = new GetLength().countTerm(Path.Result); indexReader = ixreader; } @SuppressWarnings("rawtypes") public List<Document> retrieveQuery( String aQuery, int TopN ) throws IOException { // NT: you will find our IndexingLucene.Myindexreader provides method: docLength() // implement your retrieval model here, and for each input query, return the topN retrieved documents // sort the docs based on their relevance score, from high to low // Implement of comparator class // According to TA assignment session 2 Comparator<Document> comparator = new Comparator<Document>(){ public int compare(Document d1,Document d2){ if(d1.score()!=d2.score()){ return d1.score()<d2.score()?1:-1; }else{ return 1; } } }; //System.out.println("aQuery:"+aQuery); //System.out.println("TopKTopN:"+TopN); // Get query content String[] tokens = aQuery.split(" "); System.out.println("tokens"+tokens.length); // Output List<Document> output = new ArrayList<Document>(); // Token info HashMap<String,HashMap> tokenInfo = new HashMap<String,HashMap>(); // Relevant docs HashSet<Integer> docs=new HashSet<Integer>(); for(String token:tokens){ HashMap<Integer,Integer> info=new HashMap<Integer,Integer>(); // Get posting list int[][] post = indexReader.getPostingList(token); // Has posting list if(post!=null){ // And list has content if(post.length!=0){ for(int i=0;i<post.length;i++){ int docid=post[i][0]; int freq=post[i][1]; // Put docid and frequency into map info.put(docid, freq); // Put token and its info into tokenInfo tokenInfo.put(token,info); // Add docid into relevant docs docs.add(docid); } } } } System.out.println("finish relevant doc"); System.out.println("doc size:"+docs.size()); // Calculate scores for each relevant doc Iterator it=docs.iterator(); while(it.hasNext()){ // Get docid int docid = Integer.parseInt(it.next().toString()); // Get docno String docno =indexReader.getDocno(docid); // Get doc length int docLength = indexReader.docLength(docid); // Initial score each time double score = 1; for(String token : tokens){ if(tokenInfo.containsKey(token)){ // Get collection frequency long cf = indexReader.CollectionFreq(token); // Get info of that token HashMap info = tokenInfo.get(token); // Get frequency of that token // Need to judge whether map has that docid before computing, cause it may be null if(info.get(docid)!=null){ int freq=Integer.parseInt(info.get(docid).toString()); // Calculate probability and score according to formula double p = (freq+u*cf/collectionLength)/(docLength+u); score *= p; } } } // score = 1/(1/score+1/vote); // Only record scores larger than 0, which is meaningful if(score>0){ output.add(new Document(Integer.toString(docid),docno,score)); } } System.out.println("finish calculate score"); // Sort the output Collections.sort(output,comparator); // Return top n relevant documents list System.out.println("sublist size:"+output.subList(0, TopN).size()); return output.subList(0, TopN); } }
b598feb202ec48bfd9dc35a0b7c92f0f8a5cb497
f0e9084593b53e4e6686128dc7a1cd2e598f41df
/src/main/java/com/reto/interactions/SwitchToTagPage.java
bbfb88012f72d72392360fbb7f275ff7ccab79e4
[]
no_license
CarlosEGB/RetoBanistmo
602c530a4aa0c80917daa5d637cbcc2747fdff05
8c89b2f25a70590a8e23443d9f17b21f35de4c08
refs/heads/master
2022-12-04T00:47:25.238921
2020-08-20T16:18:21
2020-08-20T16:18:21
289,027,122
1
0
null
null
null
null
UTF-8
Java
false
false
872
java
package com.reto.interactions; import net.serenitybdd.core.Serenity; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.Interaction; import net.serenitybdd.screenplay.Performable; import net.serenitybdd.screenplay.Tasks; import org.openqa.selenium.WebDriver; import java.util.ArrayList; public class SwitchToTagPage implements Interaction { private int tag; public SwitchToTagPage(int tag) { this.tag = tag; } public static Performable switchTag(int tag) { return Tasks.instrumented(SwitchToTagPage.class, tag); } @Override public <T extends Actor> void performAs(T actor) { WebDriver driver = Serenity.getWebdriverManager().getCurrentDriver(); ArrayList<String> newTab = new ArrayList<String>(driver.getWindowHandles()); driver.switchTo().window(newTab.get(tag)); } }
f02fd67f63219a944fb3dd4420e3d48aa436715a
d72eb5c010e6fd293ef8af1a646c39af6b4849b4
/app/src/main/java/com/bwie/myitem/model/listener/OnGetDataOther.java
c0298101cf0c3c7050a7f42e93e350497e24b1a7
[]
no_license
aydwh/MyItem
f7c3a586907149f0aef02b071e9b757b3055fa6a
280a0ccb3335b609b3192840864e198f8f0dc295
refs/heads/master
2021-06-10T15:39:07.287036
2017-01-17T02:25:13
2017-01-17T02:25:13
79,179,619
0
0
null
null
null
null
UTF-8
Java
false
false
262
java
package com.bwie.myitem.model.listener; import com.bwie.myitem.bean.tvbean.OtherBean; /** * 1.类的用途 * 2.@author:weihuanhuan * 3.@ 2017/1/9. */ public interface OnGetDataOther { void OnSuccess(OtherBean otherBean); void OnFial(String str); }