blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fba2a0f6d39cb498b8696fab5882e33eeb957d67 | 6599d3a421772ab8455ab7cd41324af6c3c535e4 | /September/Day15.java | e69b3577da768d1bb7ac1556d46dee8d070bcbce | [] | no_license | Vishalks/LeetCode-Daily-Challenges | 3c3b8075b2df9ed7c8bb41b4b0c6147d53753be7 | c30cd8f9c73d3272d876f11fba467ce8666291f4 | refs/heads/main | 2023-02-04T10:16:31.940866 | 2020-12-25T04:02:06 | 2020-12-25T04:02:06 | 301,443,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | //TC: O(n)
//SC: O(n)
class Solution {
public int lengthOfLastWord(String s) {
if(s == null || s.length() == 0)
return 0;
String[] split = s.split("\\s");
if(split.length == 0)
return 0;
return split[split.length - 1].length();
}
} | [
"noreply@github.com"
] | Vishalks.noreply@github.com |
47b44e7a369c19931aae0fd032031a28b93e2fcf | edc15241edb72d670c793527bc5cd327f7c50544 | /app/src/main/java/com/yuntongxun/as/storage/GroupMemberSqlManager.java | 4c3205bb828db8bac1a98d70f9b7067702f25fa1 | [] | no_license | qq5889/YTX | 21a6f3ae6b1468aa16bfe494d1f1cd6915cb85e5 | 25c70bc5ec7807cdac7c350392613b57a063acc6 | refs/heads/master | 2020-09-23T04:24:57.840475 | 2016-09-09T09:01:13 | 2016-09-09T09:01:13 | 67,783,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,258 | java | /*
* Copyright (c) 2013 The CCP project authors. All Rights Reserved.
*
* Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
* that can be found in the LICENSE file in the root of the web site.
*
* http://www.yuntongxun.com
*
* An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package com.yuntongxun.as.storage;
import android.content.ContentValues;
import android.database.Cursor;
import android.text.TextUtils;
import com.yuntongxun.as.common.CCPAppManager;
import com.yuntongxun.as.ui.contact.ECContacts;
import com.yuntongxun.ecsdk.im.ECGroupMember;
import java.util.ArrayList;
import java.util.List;
/**
* 群组数据库接口
* @author Jorstin Chan@容联•云通讯
* @date 2014-12-29
* @version 4.0
*/
public class GroupMemberSqlManager extends AbstractSQLManager {
private static final String TAG = "ECDemo.GroupMemberSqlManager";
Object mLock = new Object();
private static GroupMemberSqlManager sInstance;
private static GroupMemberSqlManager getInstance() {
if(sInstance == null) {
sInstance = new GroupMemberSqlManager();
}
return sInstance;
}
private GroupMemberSqlManager() {
}
public static Cursor getGroupMembersByCursorExceptSelf(String groupId) {
String selfVoip=CCPAppManager.getUserId();
String sql = "select voipaccount ,contacts.username ,contacts.remark ,role ,isban from group_members ,contacts where group_members.voipaccount != '" + selfVoip + "' and group_id ='" + groupId + "' and contacts.contact_id = group_members.voipaccount order by role" ;
return getInstance().sqliteDB().rawQuery(sql , null);
}
/**
* 查询群组成员账号
* @param groupId
* @return
*/
public static ArrayList<String> getGroupMemberID(String groupId) {
String sql = "select voipaccount from group_members where group_id ='" + groupId + "'";
ArrayList<String> list = null;
try {
Cursor cursor = getInstance().sqliteDB().rawQuery(sql, null);
if(cursor != null && cursor.getCount() > 0) {
list = new ArrayList<String>();
while (cursor.moveToNext()) {
list.add(cursor.getString(cursor.getColumnIndex(GroupMembersColumn.VOIPACCOUNT)));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
/**
* 查询群组成员用于列表显示
* @param groupId
* @return
*/
public static ArrayList<ECGroupMember> getGroupMemberWithName(String groupId) {
String sql = "select voipaccount ,contacts.username ,contacts.remark ,role ,isban from group_members ,contacts where group_id ='" + groupId + "' and contacts.contact_id = group_members.voipaccount order by role" ;
//String sql = "select voipaccount ,remark,role , isban from group_members where group_id ='" + groupId + "'" ;
ArrayList<ECGroupMember> list = null;
try {
Cursor cursor = getInstance().sqliteDB().rawQuery(sql, null);
if(cursor != null && cursor.getCount() > 0) {
list = new ArrayList<ECGroupMember>();
while (cursor.moveToNext()) {
ECGroupMember groupMember = new ECGroupMember();
groupMember.setBelong(groupId);
groupMember.setVoipAccount(cursor.getString(0));
groupMember.setDisplayName(cursor.getString(1));
groupMember.setRemark(cursor.getString(2));
int roleValue = cursor.getInt(3);
if(roleValue <= 0 || roleValue >=3 ) roleValue = 3;
groupMember.setRole(ECGroupMember.Role.values()[roleValue - 1]);
groupMember.setBan(cursor.getInt(4) == 2);
list.add(groupMember);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public static int getSelfRoleWithGroupId(String groupId,String voipaccount) {
String sql = "select role from group_members where group_id ='" + groupId + "' and voipaccount ='"+voipaccount+"'";
int role = 3;
ArrayList<ECGroupMember> list = null;
try {
Cursor cursor = getInstance().sqliteDB().rawQuery(sql, null);
if(cursor != null && cursor.getCount() > 0) {
list = new ArrayList<ECGroupMember>();
while (cursor.moveToNext()) {
role = cursor.getInt(0);
}
}
} catch (Exception e) {
e.printStackTrace();
return 3;
}
if(role <=0 || role >= 3) {
role = 3;
}
return role;
}
public static int updateSelfRoleWithGroupId(String groupId,int role) {
ContentValues values = new ContentValues();
values.put(GroupMembersColumn.ROLE,role+"");
getInstance().sqliteDB().update(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS, values, "group_id = ?", new String[]{groupId});
return role;
}
public static int updateSelfRoleWithGroupId(String groupId,String voip,int role) {
try{
ContentValues values = new ContentValues();
values.put(GroupMembersColumn.ROLE,role+"");
getInstance().sqliteDB().update(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS, values, "group_id = ? and voipaccount = ?", new String[]{groupId,voip});
}catch (Exception e){
e.printStackTrace();
}
return role;
}
public static boolean isGroupHasManager(String groupId) {
int count = 0;
ArrayList<ECGroupMember> list = getGroupMemberWithName(groupId);
if (list == null || list.size() == 0) {
return false;
}
for (ECGroupMember item : list) {
if (item != null) {
if (item.getMemberRole() == ECGroupMember.Role.OWNER || item.getMemberRole() == ECGroupMember.Role.MANAGER) {
count++;
if (count == 2) {
break;
}
}
}
}
return count >1;
}
/**
* 查询所有群组成员帐号
* @param groupId
* @return
*/
public static ArrayList<String> getGroupMemberAccounts(String groupId) {
String sql = "select * from group_members where group_id ='" + groupId + "'";
ArrayList<String> list = null;
try {
Cursor cursor = getInstance().sqliteDB().rawQuery(sql, null);
if(cursor != null && cursor.getCount() > 0) {
list = new ArrayList<String>();
while (cursor.moveToNext()) {
list.add(cursor.getString(cursor.getColumnIndex(GroupMembersColumn.VOIPACCOUNT)));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
/**
* 更新群组成员
* @param members
* @return
*/
public static ArrayList<Long> insertGroupMembers(List<ECGroupMember> members) {
ArrayList<Long> rows = new ArrayList<Long>();
if (members == null) {
return rows;
}
try {
synchronized (getInstance().mLock) {
// Set the start transaction
getInstance().sqliteDB().beginTransaction();
// Batch processing operation
for (ECGroupMember member : members) {
try {
long row = insertGroupMember(member);
if(row != -1) {
rows.add(row);
}
} catch (Exception e) {
e.printStackTrace();
}
}
// Set transaction successful, do not set automatically
// rolls back not submitted.
getInstance().sqliteDB().setTransactionSuccessful();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
getInstance().sqliteDB().endTransaction();
}
return rows;
}
/**
* 更新群组到数据库
* @param member
* @return
*/
public static long insertGroupMember(ECGroupMember member) {
if(member == null || TextUtils.isEmpty(member.getBelong())
|| TextUtils.isEmpty(member.getVoipAccount())) {
return -1L;
}
ContentValues values = null;
try {
updateContact(member);
values = new ContentValues();
values.put(GroupMembersColumn.OWN_GROUP_ID, member.getBelong());
values.put(GroupMembersColumn.VOIPACCOUNT, member.getVoipAccount());
values.put(GroupMembersColumn.TEL, member.getTel());
values.put(GroupMembersColumn.MAIL, member.getEmail());
values.put(GroupMembersColumn.REMARK, member.getDisplayName());
values.put(GroupMembersColumn.ISBAN, member.isBan() ? 2 : 1);
values.put(GroupMembersColumn.ROLE, member.getMemberRole().ordinal() + 1);
values.put(GroupMembersColumn.SEX, member.getSex());
if(!isExitGroupMember(member.getBelong(), member.getVoipAccount())) {
return getInstance().sqliteDB().insert(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS, null, values);
} else {
return getInstance().sqliteDB().update(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS ,values , "group_id ='" + member.getBelong() + "'" + " and voipaccount='" + member.getVoipAccount() + "'",null);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (values != null) {
values.clear();
}
}
return -1L;
}
private static void updateContact(ECGroupMember member) {
ECContacts contacts = new ECContacts(member.getVoipAccount());
contacts.setNickname(member.getDisplayName());
contacts.setRemark(member.getRemark());
ContactSqlManager.insertContact(contacts);
}
/**
* 判断性格是否改变
*
* @param belong
* @param userid
* @param sex
* @return
*/
public static boolean needUpdateSexPhoto(String belong, String userid, int sex) {
String sql = "select voipaccount ,sex from group_members where sex !=" + sex + " and voipaccount = '" + userid + "' and group_id='" + belong + "'";
Cursor cursor = getInstance().sqliteDB().rawQuery(sql, null);
if(cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
int anInt = cursor.getInt(1);
String string = cursor.getString(0);
cursor.close();;
return true;
}
return false;
}
/**
* 是否存在该联系人
* @param groupId
* @param member
* @return
*/
public static boolean isExitGroupMember(String groupId , String member) {
String sql = "select voipaccount from group_members where group_id ='" + groupId + "'" + " and voipaccount='" + member + "'";
try {
Cursor cursor = getInstance().sqliteDB().rawQuery(sql, null);
if(cursor != null && cursor.getCount() > 0) {
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* 更新群组成员
* @param groupId
* @param members
*/
public static void insertGroupMembers(String groupId , String[] members) {
if(TextUtils.isEmpty(groupId) || members == null || members.length <= 0 ) {
return ;
}
for(String member :members) {
ECGroupMember groupMember = new ECGroupMember();
groupMember.setBelong(groupId);
groupMember.setVoipAccount(member);
if(CCPAppManager.getClientUser() != null && CCPAppManager.getUserId().equals(member)) {
groupMember.setRole(ECGroupMember.Role.OWNER);
} else {
groupMember.setRole(ECGroupMember.Role.MEMBER);
}
groupMember.setTel(member);
insertGroupMember(groupMember);
}
}
/**
* 删除群组所有成员
* @param groupId
*/
public static void delAllMember(String groupId) {
String sqlWhere = "group_id ='" + groupId + "'";
try {
getInstance().sqliteDB().delete(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS, sqlWhere, null);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 删除群组成员
* @param groupId 群组ID
* @param member 群组成员
* @return
*/
public static void delMember(String groupId , String member) {
String sqlWhere = "group_id ='" + groupId + "'" + " and voipaccount='" + member + "'";
try {
getInstance().sqliteDB().delete(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS, sqlWhere, null);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 删除群组成员
* @param groupId
* @param members
*/
public static void delMember(String groupId , String[] members) {
StringBuilder builder = new StringBuilder("in(");
for(String member : members) {
builder.append("'").append(member).append("'").append(",");
}
if(builder.toString().endsWith(",")) {
builder.replace(builder.length() - 1, builder.length(), "");
builder.append(")");
} else {
builder.replace(0, builder.length(), "");
}
String sqlWhere = " group_id ='" + groupId + "'" + " and voipaccount " + builder.toString();
try {
getInstance().sqliteDB().delete(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS, sqlWhere, null);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 更新成员禁言状态
* @param groupid
* @param member
* @param enabled
* @return
*/
public static long updateMemberSpeakState(String groupid , String member ,boolean enabled) {
try {
String where = GroupMembersColumn.VOIPACCOUNT + "='" + member + "' and " + GroupMembersColumn.OWN_GROUP_ID + "='" + groupid + "'";
ContentValues values = new ContentValues();
values.put(GroupMembersColumn.ISBAN , enabled?2:1);
return getInstance().sqliteDB().update(DatabaseHelper.TABLES_NAME_GROUP_MEMBERS , values , where , null);
}catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static void reset() {
getInstance().release();
}
@Override
protected void release() {
super.release();
sInstance = null;
}
}
| [
"jqyang@fiberhome.com"
] | jqyang@fiberhome.com |
0517e3d5e86f63744a9d7bf4eea02032cee13a3e | 9f7ae2f3a2fe129420560cbf639f93131bdc3003 | /servlet/src/main/java/io/undertow/servlet/core/ManagedListener.java | 77ffb555e1db982b06a1ea1a0ca2b01b9007ff92 | [
"Apache-2.0"
] | permissive | kirmerzlikin/undertow | e04db81ca38ac8fde012186ed35a385ad848a528 | d30a979647e8ae1b8ad6f2ca12c061fb800fa991 | refs/heads/master | 2020-12-02T22:12:28.199343 | 2017-07-03T10:36:36 | 2017-07-03T10:36:36 | 96,097,063 | 0 | 0 | null | 2017-07-03T09:59:10 | 2017-07-03T09:59:10 | null | UTF-8 | Java | false | false | 2,402 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.undertow.servlet.core;
import java.util.EventListener;
import javax.servlet.ServletException;
import io.undertow.servlet.UndertowServletMessages;
import io.undertow.servlet.api.InstanceHandle;
import io.undertow.servlet.api.ListenerInfo;
/**
* @author Stuart Douglas
*/
public class ManagedListener implements Lifecycle {
private final ListenerInfo listenerInfo;
private final boolean programatic;
private volatile boolean started = false;
private volatile InstanceHandle<? extends EventListener> handle;
public ManagedListener(final ListenerInfo listenerInfo, final boolean programatic) {
this.listenerInfo = listenerInfo;
this.programatic = programatic;
}
public synchronized void start() throws ServletException {
if (!started) {
try {
handle = listenerInfo.getInstanceFactory().createInstance();
} catch (Exception e) {
throw UndertowServletMessages.MESSAGES.couldNotInstantiateComponent(listenerInfo.getListenerClass().getName(), e);
}
started = true;
}
}
public synchronized void stop() {
started = false;
if (handle != null) {
handle.release();
}
}
public ListenerInfo getListenerInfo() {
return listenerInfo;
}
@Override
public boolean isStarted() {
return started;
}
public EventListener instance() {
if (!started) {
throw UndertowServletMessages.MESSAGES.listenerIsNotStarted();
}
return handle.getInstance();
}
public boolean isProgramatic() {
return programatic;
}
}
| [
"stuart.w.douglas@gmail.com"
] | stuart.w.douglas@gmail.com |
afafe2844eb9636bfe29195cf23d54da6b9291a7 | 51ec1f375049c58283312c23adb3b1f850670c44 | /src/test/java/com/github/javarushcommunity/jrtb/javarushclient/JavaRushGroupClientTest.java | c73d77101037d136dd436a68b9816b2f1af0a7c3 | [
"Apache-2.0"
] | permissive | MADHAM19/javarush-telegrambot | 1e5209fe6a03978b0476b9e9679672b4d49e690d | 95455109de65a83531866bd4b2194de06fbb60d9 | refs/heads/main | 2023-08-14T12:35:11.485176 | 2021-10-04T11:18:50 | 2021-10-04T11:18:50 | 385,920,014 | 0 | 0 | Apache-2.0 | 2021-10-04T11:18:51 | 2021-07-14T11:44:12 | Java | UTF-8 | Java | false | false | 3,558 | java | package com.github.javarushcommunity.jrtb.javarushclient;
import com.github.javarushcommunity.jrtb.javarushclient.dto.GroupDiscussionInfo;
import com.github.javarushcommunity.jrtb.javarushclient.dto.GroupInfo;
import com.github.javarushcommunity.jrtb.javarushclient.dto.GroupRequestArgs;
import com.github.javarushcommunity.jrtb.javarushclient.dto.GroupsCountRequestArgs;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.util.List;
import static com.github.javarushcommunity.jrtb.javarushclient.dto.GroupInfoType.TECH;
@DisplayName("Integration-level testing for JavaRushGroupClientImplTest")
class JavaRushGroupClientTest {
private final JavaRushGroupClient groupClient = new JavaRushGroupClientImpl("https://javarush.ru/api/1.0/rest");
@Test
public void shouldProperlyGetGroupsWithEmptyArgs() {
//given
GroupRequestArgs args = GroupRequestArgs.builder().build();
//when
List<GroupInfo> groupList = groupClient.getGroupList(args);
//then
Assertions.assertNotNull(groupList);
Assertions.assertFalse(groupList.isEmpty());
}
@Test
public void shouldProperlyGetWithOffSetAndLimit() {
//given
GroupRequestArgs args = GroupRequestArgs.builder()
.offset(1)
.limit(3)
.build();
//when
List<GroupInfo> groupList = groupClient.getGroupList(args);
//then
Assertions.assertNotNull(groupList);
Assertions.assertEquals(3, groupList.size());
}
@Test
public void shouldProperlyGetGroupsDiscWithEmptyArgs() {
//given
GroupRequestArgs args = GroupRequestArgs.builder().build();
//when
List<GroupDiscussionInfo> groupList = groupClient.getGroupDiscussionList(args);
//then
Assertions.assertNotNull(groupList);
Assertions.assertFalse(groupList.isEmpty());
}
@Test
public void shouldProperlyGetGroupDiscWithOffSetAndLimit() {
//given
GroupRequestArgs args = GroupRequestArgs.builder()
.offset(1)
.limit(3)
.build();
//when
List<GroupDiscussionInfo> groupList = groupClient.getGroupDiscussionList(args);
//then
Assertions.assertNotNull(groupList);
Assertions.assertEquals(3, groupList.size());
}
@Test
public void shouldProperlyGetGroupCount() {
//given
GroupsCountRequestArgs args = GroupsCountRequestArgs.builder().build();
//when
Integer groupCount = groupClient.getGroupCount(args);
//then
Assertions.assertEquals(31, groupCount);
}
@Test
public void shouldProperlyGetGroupTECHCount() {
//given
GroupsCountRequestArgs args = GroupsCountRequestArgs.builder()
.type(TECH)
.build();
//when
Integer groupCount = groupClient.getGroupCount(args);
//then
Assertions.assertEquals(7, groupCount);
}
@Test
public void shouldProperlyGetGroupById() {
//given
Integer androidGroupId = 16;
//when
GroupDiscussionInfo groupById = groupClient.getGroupById(androidGroupId);
//then
Assertions.assertNotNull(groupById);
Assertions.assertEquals(16, groupById.getId());
Assertions.assertEquals(TECH, groupById.getType());
Assertions.assertEquals("android", groupById.getKey());
}
} | [
"noreply@github.com"
] | MADHAM19.noreply@github.com |
6155ec988a0f5c1905b75ae76e506f188269fe3d | b9aedb0391319466195dd6f46cb389f97b42ab3c | /src/com/ik/ggnote/constants/Global.java | e68bfb8d33bf1aa72de1fee769fd9df9a8761d65 | [] | no_license | benchakalaka/challangeme | 8eb088f92c94b67a91768e4b7b30ed8e1d6d00bf | 7649ddd25f70fe82f8f98e5eb2eb2c0c15e52461 | refs/heads/master | 2021-01-10T22:10:45.687749 | 2014-09-10T16:04:07 | 2014-09-10T16:04:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.ik.ggnote.constants;
import java.io.File;
import android.os.Environment;
public class Global {
public static final String TAG = "Jenote";
public static final String UNKNOWN_STRING = "";
public static final double EMPTY_INT_VALUE = -1;
public static final float EMPTY_FLOAT_VALUE = -1;
public static final String APP_PHOTO_DIRECTORY = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + "note_photo" + File.separator;
public static final int CAPTURE_CAMERA_PHOTO = 100;
public interface NOTES {
public static final String SIMPLE_STR = "Simple";
public static final String EVENT_STR = "Event";
public static final String URGENT_STR = "Urgent";
public static final String REMINDER_STR = "Reminder";
public static final String WORK_STR = "Work";
public static final int SIMPLE_INT = 0;
public static final int EVENT_INT = 1;
public static final int URGENT_INT = 2;
public static final int REMINDER_INT = 3;
public static final int WORK_INT = 4;
}
}
| [
"benchakalaka@gmail.com"
] | benchakalaka@gmail.com |
eb1dd74f38563bc6e6dd4659048ab3ce68adec46 | 52855e5811111a46e49820408b8f17be92d12807 | /app/src/main/java/com/chengsi/weightcalc/activity/DoctorAdviceActivity.java | 600acb6af83bbf7589708359835daa6a298feb18 | [] | no_license | czdfn/weight | 1e41db74a5bd97bd8ba5a542c67c4f6e795db482 | 64407b69911fd483d6bef1d86994658a24d90794 | refs/heads/master | 2020-05-21T12:21:12.573444 | 2016-12-22T05:12:55 | 2016-12-22T05:12:55 | 50,978,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,359 | java | package com.chengsi.weightcalc.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.View;
import android.widget.AdapterView;
import com.alibaba.fastjson.TypeReference;
import com.chengsi.weightcalc.R;
import com.chengsi.weightcalc.adapter.SocialStreamAdapter;
import com.chengsi.weightcalc.bean.AdviceBean;
import com.chengsi.weightcalc.bean.BaseBean;
import com.chengsi.weightcalc.http.JDHttpClient;
import com.chengsi.weightcalc.http.JDHttpResponseHandler;
import com.chengsi.weightcalc.utils.UIUtils;
import com.chengsi.weightcalc.widget.FanrRefreshListView;
import com.chengsi.weightcalc.widget.JDLoadingView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.ButterKnife;
import butterknife.InjectView;
import cn.jiadao.corelibs.utils.ListUtils;
public class DoctorAdviceActivity extends BaseActivity {
@InjectView(R.id.listview)
FanrRefreshListView listView;
private List<AdviceBean> adviceBeanList = new ArrayList<>();
private SocialStreamAdapter mAdapter = null;
private List<Map<String, Object>> dataSource = new ArrayList<>();
private static final int[] RESOUCE = {R.layout.item_advice_list};
private String[] from = {"date", "doctor"};
private int[] to = {R.id.tv_advice_date, R.id.tv_advice_doctor};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_doctor_advice);
ButterKnife.inject(this);
initViews();
}
private void initViews() {
HashMap<Integer, String[]> fromMap = new HashMap<Integer, String[]>();
fromMap.put(RESOUCE[0], from);
HashMap<Integer, int[]> toMap = new HashMap<Integer, int[]>();
toMap.put(RESOUCE[0], to);
mAdapter = new SocialStreamAdapter(this, dataSource, RESOUCE, fromMap, toMap, 0, UIUtils.convertDpToPixel(3, this));
listView.setAdapter(mAdapter);
listView.setOnPullRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
adviceBeanList.clear();
dataSource.clear();
mAdapter.notifyDataSetChanged();
initDataSource();
}
});
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(DoctorAdviceActivity.this, AdviceDetailActivity.class);
intent.putExtra(AdviceDetailActivity.KEY_ADVICE_BEAN, adviceBeanList.get(position));
startActivity(intent);
}
});
listView.setCanLoadMore(false);
listView.setPullRefreshing(true);
initDataSource();
}
protected void initDataSource() {
listView.setPullRefreshing(true);
JDHttpClient.getInstance().reqAdviceList(this, new JDHttpResponseHandler<List<AdviceBean>>(new TypeReference<BaseBean<List<AdviceBean>>>() {
}) {
@Override
public void onRequestCallback(BaseBean<List<AdviceBean>> result) {
super.onRequestCallback(result);
listView.setPullRefreshing(false);
dismissLoadingView();
if (result.isSuccess()) {
adviceBeanList = result.getData();
if (ListUtils.isEmpty(result.getData())) {
setLoadingViewState(JDLoadingView.STATE_EMPTY);
}
parseData();
} else {
setLoadingViewState(JDLoadingView.STATE_FAILED);
showToast(result.getMessage());
}
}
});
}
private void parseData() {
if (!ListUtils.isEmpty(adviceBeanList)) {
for (final AdviceBean bean : adviceBeanList) {
Map<String, Object> map = new HashMap<>();
map.put(from[0], bean.getBillingDate());
map.put(from[1], bean.getDoctorName());
dataSource.add(map);
}
}
mAdapter.notifyDataSetChanged();
}
}
| [
"czdfn.github@gmail.com"
] | czdfn.github@gmail.com |
e039ab9ff2ed95db5135143a6636bf05fb32a539 | 075ff4d7f4985b551f94b7f1b91e2452328573a9 | /CucumberPOMSeries/src/main/java/com/qa/util/ExcelReader.java | 4048f66e2c82c6d72876b75c9ffa9121879345a7 | [] | no_license | mldcmt/ProjMVNTest | 719675023025234edab7877ab0658e801f880c31 | 393f1fecf6dd93c455bf54ba4c91a2592f42a6c7 | refs/heads/master | 2023-04-19T13:36:16.212871 | 2021-05-16T09:49:22 | 2021-05-16T09:49:22 | 367,816,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,339 | java | package com.qa.util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.NumberToTextConverter;
public class ExcelReader {
public List<Map<String, String>> getData(String excelFilePath, String sheetName)
throws InvalidFormatException, IOException {
Sheet sheet = getSheetByName(excelFilePath, sheetName);
return readSheet(sheet);
}
public List<Map<String, String>> getData(String excelFilePath, int sheetNumber)
throws InvalidFormatException, IOException {
Sheet sheet = getSheetByIndex(excelFilePath, sheetNumber);
return readSheet(sheet);
}
private Sheet getSheetByName(String excelFilePath, String sheetName) throws IOException, InvalidFormatException {
Sheet sheet = getWorkBook(excelFilePath).getSheet(sheetName);
return sheet;
}
private Sheet getSheetByIndex(String excelFilePath, int sheetNumber) throws IOException, InvalidFormatException {
Sheet sheet = getWorkBook(excelFilePath).getSheetAt(sheetNumber);
return sheet;
}
private Workbook getWorkBook(String excelFilePath) throws IOException, InvalidFormatException {
return WorkbookFactory.create(new File(excelFilePath));
}
private List<Map<String, String>> readSheet(Sheet sheet) {
Row row;
int totalRow = sheet.getPhysicalNumberOfRows();
List<Map<String, String>> excelRows = new ArrayList<Map<String, String>>();
int headerRowNumber = getHeaderRowNumber(sheet);
if (headerRowNumber != -1) {
int totalColumn = sheet.getRow(headerRowNumber).getLastCellNum();
int setCurrentRow = 1;
for (int currentRow = setCurrentRow; currentRow <= totalRow; currentRow++) {
row = getRow(sheet, sheet.getFirstRowNum() + currentRow);
LinkedHashMap<String, String> columnMapdata = new LinkedHashMap<String, String>();
for (int currentColumn = 0; currentColumn < totalColumn; currentColumn++) {
columnMapdata.putAll(getCellValue(sheet, row, currentColumn));
}
excelRows.add(columnMapdata);
}
}
return excelRows;
}
private int getHeaderRowNumber(Sheet sheet) {
Row row;
int totalRow = sheet.getLastRowNum();
for (int currentRow = 0; currentRow <= totalRow + 1; currentRow++) {
row = getRow(sheet, currentRow);
if (row != null) {
int totalColumn = row.getLastCellNum();
for (int currentColumn = 0; currentColumn < totalColumn; currentColumn++) {
Cell cell;
cell = row.getCell(currentColumn, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
if (cell.getCellType() == CellType.STRING) {
return row.getRowNum();
} else if (cell.getCellType() == CellType.NUMERIC) {
return row.getRowNum();
} else if (cell.getCellType() == CellType.BOOLEAN) {
return row.getRowNum();
} else if (cell.getCellType() == CellType.ERROR) {
return row.getRowNum();
}
}
}
}
return (-1);
}
private Row getRow(Sheet sheet, int rowNumber) {
return sheet.getRow(rowNumber);
}
private LinkedHashMap<String, String> getCellValue(Sheet sheet, Row row, int currentColumn) {
LinkedHashMap<String, String> columnMapdata = new LinkedHashMap<String, String>();
Cell cell;
if (row == null) {
if (sheet.getRow(sheet.getFirstRowNum()).getCell(currentColumn, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)
.getCellType() != CellType.BLANK) {
String columnHeaderName = sheet.getRow(sheet.getFirstRowNum()).getCell(currentColumn)
.getStringCellValue();
columnMapdata.put(columnHeaderName, "");
}
} else {
cell = row.getCell(currentColumn, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
if (cell.getCellType() == CellType.STRING) {
if (sheet.getRow(sheet.getFirstRowNum())
.getCell(cell.getColumnIndex(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)
.getCellType() != CellType.BLANK) {
String columnHeaderName = sheet.getRow(sheet.getFirstRowNum()).getCell(cell.getColumnIndex())
.getStringCellValue();
columnMapdata.put(columnHeaderName, cell.getStringCellValue());
}
} else if (cell.getCellType() == CellType.NUMERIC) {
if (sheet.getRow(sheet.getFirstRowNum())
.getCell(cell.getColumnIndex(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)
.getCellType() != CellType.BLANK) {
String columnHeaderName = sheet.getRow(sheet.getFirstRowNum()).getCell(cell.getColumnIndex())
.getStringCellValue();
columnMapdata.put(columnHeaderName, NumberToTextConverter.toText(cell.getNumericCellValue()));
}
} else if (cell.getCellType() == CellType.BLANK) {
if (sheet.getRow(sheet.getFirstRowNum())
.getCell(cell.getColumnIndex(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)
.getCellType() != CellType.BLANK) {
String columnHeaderName = sheet.getRow(sheet.getFirstRowNum()).getCell(cell.getColumnIndex())
.getStringCellValue();
columnMapdata.put(columnHeaderName, "");
}
} else if (cell.getCellType() == CellType.BOOLEAN) {
if (sheet.getRow(sheet.getFirstRowNum())
.getCell(cell.getColumnIndex(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)
.getCellType() != CellType.BLANK) {
String columnHeaderName = sheet.getRow(sheet.getFirstRowNum()).getCell(cell.getColumnIndex())
.getStringCellValue();
columnMapdata.put(columnHeaderName, Boolean.toString(cell.getBooleanCellValue()));
}
} else if (cell.getCellType() == CellType.ERROR) {
if (sheet.getRow(sheet.getFirstRowNum())
.getCell(cell.getColumnIndex(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)
.getCellType() != CellType.BLANK) {
String columnHeaderName = sheet.getRow(sheet.getFirstRowNum()).getCell(cell.getColumnIndex())
.getStringCellValue();
columnMapdata.put(columnHeaderName, Byte.toString(cell.getErrorCellValue()));
}
}
}
return columnMapdata;
}
}
| [
"84261961+mldcmt@users.noreply.github.com"
] | 84261961+mldcmt@users.noreply.github.com |
3f990270b842be1be3e1a2aba1243da21aca2689 | 1374237fa0c18f6896c81fb331bcc96a558c37f4 | /java/com/winnertel/ems/epon/iad/bbs4000/mib/r311/UtsDot3Onu2AlarmSettingTable.java | a4c6f884f82f8dcd9bd2d01d9b1ff09ddd45c301 | [] | no_license | fangniude/lct | 0ae5bc550820676f05d03f19f7570dc2f442313e | adb490fb8d0c379a8b991c1a22684e910b950796 | refs/heads/master | 2020-12-02T16:37:32.690589 | 2017-12-25T01:56:32 | 2017-12-25T01:56:32 | 96,560,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,847 | java | package com.winnertel.ems.epon.iad.bbs4000.mib.r311;
import com.winnertel.em.framework.model.MibBeanException;
import com.winnertel.em.framework.model.snmp.ISnmpConstant;
import com.winnertel.em.framework.model.snmp.ISnmpProxy;
import com.winnertel.em.framework.model.snmp.SnmpMibBean;
import com.winnertel.em.framework.model.snmp.SnmpMibBeanProperty;
import java.util.Vector;
/**
* The utsDot3Onu2AlarmSettingTabl class. Created by QuickDVM
*/
public class UtsDot3Onu2AlarmSettingTable extends SnmpMibBean {
public static final String utsDot3Onu2AlarmSettingModuleId = "utsDot3Onu2AlarmSettingModuleId";
public static final String utsDot3Onu2AlarmSettingDeviceId = "utsDot3Onu2AlarmSettingDeviceId";
public static final String utsDot3Onu2AlarmSettingPortId = "utsDot3Onu2AlarmSettingPortId";
public static final String utsDot3Onu2AlarmSettingLogicalPortId = "utsDot3Onu2AlarmSettingLogicalPortId";
public static final String utsDot3Onu2AlarmSettingProfileId = "utsDot3Onu2AlarmSettingProfileId";
public UtsDot3Onu2AlarmSettingTable(ISnmpProxy aSnmpProxy) {
super(aSnmpProxy);
init();
}
protected void init() {
initProperty(utsDot3Onu2AlarmSettingModuleId, new SnmpMibBeanProperty(
utsDot3Onu2AlarmSettingModuleId,
".1.3.6.1.4.1.45121.1800.2.3.1.2.1.45.1.1",
ISnmpConstant.INTEGER));
initProperty(utsDot3Onu2AlarmSettingDeviceId, new SnmpMibBeanProperty(
utsDot3Onu2AlarmSettingDeviceId,
".1.3.6.1.4.1.45121.1800.2.3.1.2.1.45.1.2",
ISnmpConstant.INTEGER));
initProperty(utsDot3Onu2AlarmSettingPortId, new SnmpMibBeanProperty(
utsDot3Onu2AlarmSettingPortId,
".1.3.6.1.4.1.45121.1800.2.3.1.2.1.45.1.3",
ISnmpConstant.INTEGER));
initProperty(utsDot3Onu2AlarmSettingLogicalPortId,
new SnmpMibBeanProperty(utsDot3Onu2AlarmSettingLogicalPortId,
".1.3.6.1.4.1.45121.1800.2.3.1.2.1.45.1.4",
ISnmpConstant.INTEGER));
initProperty(utsDot3Onu2AlarmSettingProfileId, new SnmpMibBeanProperty(
utsDot3Onu2AlarmSettingProfileId,
".1.3.6.1.4.1.45121.1800.2.3.1.2.1.45.1.5",
ISnmpConstant.INTEGER));
}
public Integer getUtsDot3Onu2AlarmSettingModuleId() {
return (Integer) getIndex(0);
}
public void setUtsDot3Onu2AlarmSettingModuleId(
Integer aUtsDot3Onu2AlarmSettingModuleId) {
setIndex(0, aUtsDot3Onu2AlarmSettingModuleId);
}
public Integer getUtsDot3Onu2AlarmSettingDeviceId() {
return (Integer) getIndex(1);
}
public void setUtsDot3Onu2AlarmSettingDeviceId(
Integer aUtsDot3Onu2AlarmSettingDeviceId) {
setIndex(1, aUtsDot3Onu2AlarmSettingDeviceId);
}
public Integer getUtsDot3Onu2AlarmSettingPortId() {
return (Integer) getIndex(2);
}
public void setUtsDot3Onu2AlarmSettingPortId(
Integer aUtsDot3Onu2AlarmSettingPortId) {
setIndex(2, aUtsDot3Onu2AlarmSettingPortId);
}
public Integer getUtsDot3Onu2AlarmSettingLogicalPortId() {
return (Integer) getIndex(3);
}
public void setUtsDot3Onu2AlarmSettingLogicalPortId(
Integer aUtsDot3Onu2AlarmSettingLogicalPortId) {
setIndex(3, aUtsDot3Onu2AlarmSettingLogicalPortId);
}
public Integer getUtsDot3Onu2AlarmSettingProfileId() {
return (Integer) getProperty(utsDot3Onu2AlarmSettingProfileId)
.getValue();
}
public void setUtsDot3Onu2AlarmSettingProfileId(
Integer aUtsDot3Onu2AlarmSettingProfileId) {
getProperty(utsDot3Onu2AlarmSettingProfileId).setValue(
aUtsDot3Onu2AlarmSettingProfileId);
}
public boolean retrieve() throws MibBeanException {
prepareRead(super.getProperty(utsDot3Onu2AlarmSettingProfileId));
return load();
}
public Vector retrieveAll() throws MibBeanException {
prepareRead(super.getProperty(utsDot3Onu2AlarmSettingProfileId));
return loadAll(new int[] { 1, 1, 1, 1 });
}
public boolean modify() throws MibBeanException {
prepareSave(getProperty(utsDot3Onu2AlarmSettingProfileId));
return save();
}
}
| [
"fangniude@gmail.com"
] | fangniude@gmail.com |
a8b1e9c3e87a3e45e051498b796d22c7ab234d26 | 57438fc7e36f85d2385e8f08d5fc543360e9e64c | /src/test/java/br/com/elo7/rover/test/service/MarsServiceTest.java | 6acf9192762181d56efca8fd4775fdf2c241fba8 | [] | no_license | danielvicente/rover | 91bd8d3ef8bfe0fc6a2e84d1a660dca2be4d2f7a | 2d3922467fce6510a9d798fcf1bda9e23a9a0857 | refs/heads/master | 2020-04-15T12:57:23.017488 | 2019-01-12T13:51:04 | 2019-01-12T13:51:04 | 164,694,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 942 | java | package br.com.elo7.rover.test.service;
import br.com.elo7.rover.domain.model.Direction;
import br.com.elo7.rover.domain.model.Mars;
import br.com.elo7.rover.domain.model.Movement;
import br.com.elo7.rover.domain.model.Rover;
import br.com.elo7.rover.domain.service.MarsService;
import org.junit.Assert;
import org.junit.Test;
import java.util.Collections;
/**
* Unit testes for mars services.
*
* @author Daniel Vicente
* @since 1.0
*/
public class MarsServiceTest {
@Test
public void moveOneForwardFromLeftBottom() {
final Rover initialRover = Rover.of(0, 0, Direction.NORTH);
final MarsService service = new MarsService();
service.loadMars(Mars.of(0, 5, 0, 5));
service.loadRover(initialRover);
Rover finalRover = service.move(0, Collections.singletonList(
Movement.MOVE
));
Assert.assertEquals(Rover.of(0, 1, Direction.NORTH), finalRover);
}
}
| [
"piditom@gmail.com"
] | piditom@gmail.com |
1ea3cb49cbd22b21289537cadbeb17a62c40d3ef | e977c424543422f49a25695665eb85bfc0700784 | /benchmark/icse15/1242497/buggy-version/lucene/dev/trunk/modules/analysis/common/src/java/org/apache/lucene/analysis/ro/RomanianAnalyzer.java | 1d3c40d6dbea365ec95cb6c7320a3a62c3e2ed7b | [] | no_license | amir9979/pattern-detector-experiment | 17fcb8934cef379fb96002450d11fac62e002dd3 | db67691e536e1550245e76d7d1c8dced181df496 | refs/heads/master | 2022-02-18T10:24:32.235975 | 2019-09-13T15:42:55 | 2019-09-13T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,117 | java | package org.apache.lucene.analysis.ro;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.IOException;
import java.io.Reader;
import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.analysis.core.StopFilter;
import org.apache.lucene.analysis.miscellaneous.KeywordMarkerFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.snowball.SnowballFilter;
import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.analysis.util.CharArraySet;
import org.apache.lucene.analysis.util.StopwordAnalyzerBase;
import org.apache.lucene.util.Version;
import org.tartarus.snowball.ext.RomanianStemmer;
/**
* {@link Analyzer} for Romanian.
*/
public final class RomanianAnalyzer extends StopwordAnalyzerBase {
private final Set<?> stemExclusionSet;
/** File containing default Romanian stopwords. */
public final static String DEFAULT_STOPWORD_FILE = "stopwords.txt";
/**
* The comment character in the stopwords file.
* All lines prefixed with this will be ignored.
*/
private static final String STOPWORDS_COMMENT = "#";
/**
* Returns an unmodifiable instance of the default stop words set.
* @return default stop words set.
*/
public static Set<?> getDefaultStopSet(){
return DefaultSetHolder.DEFAULT_STOP_SET;
}
/**
* Atomically loads the DEFAULT_STOP_SET in a lazy fashion once the outer class
* accesses the static final set the first time.;
*/
private static class DefaultSetHolder {
static final Set<?> DEFAULT_STOP_SET;
static {
try {
DEFAULT_STOP_SET = loadStopwordSet(false, RomanianAnalyzer.class,
DEFAULT_STOPWORD_FILE, STOPWORDS_COMMENT);
} catch (IOException ex) {
// default set should always be present as it is part of the
// distribution (JAR)
throw new RuntimeException("Unable to load default stopword set");
}
}
}
/**
* Builds an analyzer with the default stop words: {@link #DEFAULT_STOPWORD_FILE}.
*/
public RomanianAnalyzer(Version matchVersion) {
this(matchVersion, DefaultSetHolder.DEFAULT_STOP_SET);
}
/**
* Builds an analyzer with the given stop words.
*
* @param matchVersion lucene compatibility version
* @param stopwords a stopword set
*/
public RomanianAnalyzer(Version matchVersion, Set<?> stopwords) {
this(matchVersion, stopwords, CharArraySet.EMPTY_SET);
}
/**
* Builds an analyzer with the given stop words. If a non-empty stem exclusion set is
* provided this analyzer will add a {@link KeywordMarkerFilter} before
* stemming.
*
* @param matchVersion lucene compatibility version
* @param stopwords a stopword set
* @param stemExclusionSet a set of terms not to be stemmed
*/
public RomanianAnalyzer(Version matchVersion, Set<?> stopwords, Set<?> stemExclusionSet) {
super(matchVersion, stopwords);
this.stemExclusionSet = CharArraySet.unmodifiableSet(CharArraySet.copy(
matchVersion, stemExclusionSet));
}
/**
* Creates a
* {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
* which tokenizes all the text in the provided {@link Reader}.
*
* @return A
* {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
* built from an {@link StandardTokenizer} filtered with
* {@link StandardFilter}, {@link LowerCaseFilter}, {@link StopFilter}
* , {@link KeywordMarkerFilter} if a stem exclusion set is
* provided and {@link SnowballFilter}.
*/
@Override
protected TokenStreamComponents createComponents(String fieldName,
Reader reader) {
final Tokenizer source = new StandardTokenizer(matchVersion, reader);
TokenStream result = new StandardFilter(matchVersion, source);
result = new LowerCaseFilter(matchVersion, result);
result = new StopFilter(matchVersion, result, stopwords);
if(!stemExclusionSet.isEmpty())
result = new KeywordMarkerFilter(result, stemExclusionSet);
result = new SnowballFilter(result, new RomanianStemmer());
return new TokenStreamComponents(source, result);
}
}
| [
"durieuxthomas@hotmail.com"
] | durieuxthomas@hotmail.com |
ec7ac4cd4a20e4a3de4946bb947b2077c18adea9 | 5e263da895bfd21e16d3326ff267e5746d4791b9 | /core/src/main/java/com/github/zwg/core/manager/JemMethod.java | 86ca89bdd3f3a6ce996d85065aa4ca3ea8d3446b | [
"Apache-2.0"
] | permissive | zhawengan/jvm-enhance-monitor | f793837624caa1db8eb2548e56272fd0d0fbf8f3 | 4dfe690ec13486ea7a76d6eb341696b7cca703e9 | refs/heads/master | 2023-08-11T01:09:41.279647 | 2021-09-28T12:05:32 | 2021-09-28T12:05:32 | 401,278,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package com.github.zwg.core.manager;
/**
* @author zwg
* @version 1.0
* @date 2021/9/5
*/
public class JemMethod {
private final String name;
private final String desc;
public JemMethod(String name, String desc) {
this.name = name;
this.desc = desc;
}
public String getName() {
return name;
}
public String getDesc() {
return desc;
}
@Override
public String toString() {
return "JemMethod{" +
"name='" + name + '\'' +
", desc='" + desc + '\'' +
'}';
}
}
| [
"zhawengan@rcplatformhk.com"
] | zhawengan@rcplatformhk.com |
6f2156e44d031fe55704c528cf122d7541e8b7aa | 4d46ec3b1bf9a12c74cbbc384f0a04f47de4ca49 | /cash-back/src/main/java/com/info/back/service/ISysUserBankCardService.java | 90ce82da0e1d8ee73fe959473a55db1a0c0354e6 | [] | no_license | lovelimanyi/liquan_cuishou_back | 80e4438c7de6e96b3236ed0c4605607e8de85f62 | 7edf0312e974b84afd7c339548fbbf34e757257f | refs/heads/master | 2022-12-23T16:45:36.449496 | 2020-03-19T09:42:39 | 2020-03-19T09:44:48 | 190,881,567 | 0 | 1 | null | 2022-12-16T05:46:04 | 2019-06-08T11:46:07 | JavaScript | UTF-8 | Java | false | false | 389 | java | package com.info.back.service;
import com.info.web.pojo.SysUserBankCard;
public interface ISysUserBankCardService {
/**
* 添加银行卡信息
* @param sysUserBankCard
* @return
*/
public int saveNotNull(SysUserBankCard sysUserBankCard);
/**
* 根据用户ID查询银行卡信息
* @param userId
* @return
*/
public SysUserBankCard findUserId(String userId);
}
| [
"hxj@xianjinxia.com"
] | hxj@xianjinxia.com |
164b39c18a46a5a3bef4e419afaf7dbd54b9401d | 39dc5ac37da1cf32acbc3c01378977163be7e08b | /teacher_lim/learnjava/src/step04/_05_WhileLoopDemo.java | 05b158d68cdfef2616ca472a09dd2d3fd4d9222c | [] | no_license | mdj44518/human_example | 6247de1499e0e854aa529566b648ce28c199114e | f6ad5b86cc48a71a5978057f3839a537ff7bf49e | refs/heads/master | 2020-12-23T00:15:35.448563 | 2020-01-29T12:03:11 | 2020-01-29T12:03:11 | 236,971,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | package step04;
import java.util.Scanner;
public class _05_WhileLoopDemo {
public static void main(String[] args) {
// 사용자가 0 를 입력할 때까지
// 입력된 숫자를 더하는 프로그램
Scanner scanner = new Scanner(System.in);
int sum = 0;
// int number = 1;
// while (number != 0) {
// System.out.print("숫자입력: ");
// number = scanner.nextInt();
// sum += number; // sum = sum + num;
// }
for (int number = 1; number != 0; ) {
System.out.print("숫자입력: ");
number = scanner.nextInt();
sum += number;
}
System.out.println("총합: " + sum);
}
}
| [
"dongju.moon@mackerly.com"
] | dongju.moon@mackerly.com |
05d66fdedd291fcfe07916278b05a5f4de454707 | cc24c7e1dc2adb50a2d0ee4bacc5743bf25f5441 | /LeetCode/__141_LinkedListCycle.java | 5ed18e4fcfb3e937f49e537e81181eb1fd07ab6b | [] | no_license | TimCoder/OJ | a1e7c9d7180e4028c5b6e42f8d7953c74ce9c885 | 3b820057188020d246afc4a837a3e759f106be9a | refs/heads/master | 2021-01-12T15:59:44.268965 | 2017-05-28T14:14:08 | 2017-05-28T14:14:08 | 69,329,047 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package tim.leetcode;
public class __141_LinkedListCycle {
class ListNode {
int val;
ListNode next;
ListNode (int x) {
val = x;
}
}
/*
* Test Case:
* 1. l: null
* 2. l: 1
* 3. l: 1,2
* 4. l: 1,1
* 5. l: 1,2,3
* 6. l: 1,2,1
* 7. l: 1,2,2
* 8. l: 1,2,3,1
* 9. l: 1,2,3,2
* 10. l: 1,2,3,4
*/
public boolean hasCycle(ListNode head) {
ListNode dummy = new ListNode(0);
dummy.next = head;
ListNode fast = dummy, slow = dummy;
while (fast != null && fast.next != null) {
fast = fast.next.next;
slow = slow.next;
if (fast == slow) {
return true;
}
}
return false;
}
}
| [
"tim@szjlxu.com"
] | tim@szjlxu.com |
e5e290bb6b7626e63155caec4b9403c58a5c50f6 | d5671bb07b351545d2e2fc8b9c9207405dc62680 | /src/main/java/br/com/setebit/sgr/dto/UsuarioAreaDTO.java | b986a9453b51fc4c74a3f313414245292295b36d | [] | no_license | claudemirferreira/ieadam-service-api | e31573c97f57e2e5e2094a13a452f90a3345b607 | 8a6e7f2c5f9317e3fdddf74688e4a1203ee95474 | refs/heads/master | 2023-02-08T09:36:34.493654 | 2020-12-30T14:23:58 | 2020-12-30T14:23:58 | 267,177,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,320 | java | package br.com.setebit.sgr.dto;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import br.com.setebit.sgr.security.entity.Usuario;
import br.com.setebit.sgr.security.entity.UsuarioArea;
import br.com.setebit.sgr.security.entity.Area;
public class UsuarioAreaDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer idUsuarioArea;
private Integer idArea;
private Integer idUsuario;
private String nome;
private boolean usuarioArea;
public UsuarioAreaDTO() {
}
public UsuarioAreaDTO(Integer idUsuarioArea, Integer idArea, Integer idUsuario, String nome, boolean usuarioArea) {
this.idUsuarioArea = idUsuarioArea;
this.idArea = idArea;
this.idUsuario = idUsuario;
this.nome = nome;
this.usuarioArea = usuarioArea;
}
public UsuarioAreaDTO( Integer idArea, String nome) {
this.idArea = idArea;
this.nome = nome;
this.usuarioArea = false;
}
public Integer getIdUsuarioArea() {
return idUsuarioArea;
}
public void setIdUsuarioArea(Integer idUsuarioArea) {
this.idUsuarioArea = idUsuarioArea;
}
public Integer getIdArea() {
return idArea;
}
public void setIdArea(Integer idArea) {
this.idArea = idArea;
}
public Integer getIdUsuario() {
return idUsuario;
}
public void setIdUsuario(Integer idUsuario) {
this.idUsuario = idUsuario;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public boolean isUsuarioArea() {
return usuarioArea;
}
public void setUsuarioArea(boolean usuarioArea) {
this.usuarioArea = usuarioArea;
}
public static UsuarioArea toEntity(UsuarioAreaDTO dto) {
UsuarioArea u = new UsuarioArea();
if(null != dto.getIdUsuarioArea())
u.setIdUsuarioArea(dto.getIdUsuarioArea());
u.setUsuario(new Usuario(dto.getIdUsuario()));
u.setArea(new Area(dto.getIdArea()));
return u;
}
public static UsuarioAreaDTO toDTO(Area entity) {
return new UsuarioAreaDTO(entity.getIdArea(), entity.getNome());
}
public static List<UsuarioAreaDTO> toDTO(List<Area> list) {
List<UsuarioAreaDTO> dtos = new ArrayList<UsuarioAreaDTO>();
list.forEach(item -> dtos.add(toDTO(item)));
return dtos;
}
} | [
"claudemirramosferreira@gmail.com"
] | claudemirramosferreira@gmail.com |
09dc839013ca3cc63e4fa373371eba8a77a2350c | e1e42f25bc0c79dc7f275ade0912e38e25ba8c2b | /DIADIA/test/it/uniroma3/diadia/LabirintoTest.java | 99551658972728855412b74f10bb2b79ab521746 | [] | no_license | antonio-ianniello/DiaDia-2.0 | d349fad857610a2dadfd0daeb0bb206840fd32b8 | f031fa7602d28e4de6f4dca15023b883382f13cd | refs/heads/master | 2021-03-01T12:41:00.283625 | 2020-03-20T14:18:14 | 2020-03-20T14:18:14 | 245,786,885 | 0 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 1,155 | java | package it.uniroma3.diadia;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import it.uniroma3.diadia.ambienti.Labirinto;
import it.uniroma3.diadia.ambienti.Stanza;
public class LabirintoTest {
private Labirinto universit√;
private Stanza stanzaTest;
@Before
public void setUp() throws Exception {
universit√= new Labirinto("Labirinto.txt");
stanzaTest= new Stanza("StanzaTest");
}
@Test
public void testGetStanzaCorrenteDefault() {
assertEquals("atrio", universit√.getStanzaCorrente().getNome());
}
@Test
public void testGetStanzaCorrente() {
universit√.setStanzaCorrente(stanzaTest);
assertEquals("StanzaTest", universit√.getStanzaCorrente().getNome());
}
@Test
public void testSetStanzaCorrenteDefault() {
assertEquals("atrio", universit√.getStanzaCorrente().getNome());
}
@Test
public void testSetStanzaCorrente() {
universit√.setStanzaCorrente(stanzaTest);
assertEquals("StanzaTest", universit√.getStanzaCorrente().getNome());
}
@Test
public void testGetStanzaVincente() {
assertEquals("biblioteca", universit√.getStanzaVincente().getNome());
}
}
| [
"anton@192.168.1.59"
] | anton@192.168.1.59 |
d900e84d6945c5cb12e73d6719421b4386cad192 | 971398ce01cc8e2ace414a98dad3dc8d7a37a48b | /src/main/java/org/yiwan/webcore/zaproxy/PenetrationTest.java | f6572de99857613eda005741593fa48fa21b5f57 | [] | no_license | KentGu/testing | cda61b0097dd9fca9fb0f15214b530b0196e344c | 39970ccf13a8de59dc713e92cfca11ee42c99e3a | refs/heads/master | 2022-07-09T09:39:19.630659 | 2020-06-17T07:00:17 | 2020-06-17T07:00:17 | 117,648,810 | 0 | 0 | null | 2021-06-07T17:55:19 | 2018-01-16T07:28:22 | Java | UTF-8 | Java | false | false | 15,387 | java | package org.yiwan.webcore.zaproxy;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yiwan.webcore.test.TestCaseManager;
import org.yiwan.webcore.test.pojo.ApplicationServer;
import org.yiwan.webcore.test.pojo.TestEnvironment;
import org.yiwan.webcore.util.PropHelper;
import org.yiwan.webcore.zaproxy.model.ScanInfo;
import org.yiwan.webcore.zaproxy.model.ScanResponse;
import org.zaproxy.clientapi.core.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class PenetrationTest {
private static final Logger logger = LoggerFactory.getLogger(PenetrationTest.class);
private static final String API_KEY = PropHelper.ZAP_API_KEY;
private static final String MEDIUM = "MEDIUM";
private static final String HIGH = "HIGH";
private static final String[] policyNames = {"directory-browsing", "cross-site-scripting", "sql-injection", "path-traversal", "remote-file-inclusion", "server-side-include", "script-active-scan-rules", "server-side-code-injection", "external-redirect", "crlf-injection"};
private static ClientApi clientApi;
static {
if (PropHelper.ENABLE_PENETRATION_TEST) {
try {
doPreActions();
// add shutdown hook for crawling, scanning and get penetration test report in the end
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
doPostActions();
}
});
} catch (ClientApiException e) {
logger.error("skip penetration testing due to following error", e);
}
}
}
static void doPreActions() throws ClientApiException {
clientApi = new ClientApi(PropHelper.ZAP_SERVER_HOST, PropHelper.ZAP_SERVER_PORT);
ActiveScanner.config();
Core.config();
Spider.config();
}
static void doPostActions() {
try {
crawl();
scan();
generateReport();
Core.shutdown();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
static void crawl() {
for (TestEnvironment testEnvironment : TestCaseManager.getTestEnvironments()) {
for (ApplicationServer applicationServer : testEnvironment.getApplicationServers()) {
try {
String url = applicationServer.getUrl();
Spider.scan(url);
Spider.waitScanningDone(Spider.getLastScannerId());
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
}
static void scan() {
for (TestEnvironment testEnvironment : TestCaseManager.getTestEnvironments()) {
for (ApplicationServer applicationServer : testEnvironment.getApplicationServers()) {
try {
String url = applicationServer.getUrl();
ActiveScanner.scan(url);
ActiveScanner.waitScanningDone(ActiveScanner.getLastScannerId());
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
}
static void generateReport() throws ClientApiException, IOException {
byte[] bytes = Core.getHtmlReport();
File file = new File(PropHelper.PENETRATION_TEST_HTML_REPORT_FILE);
FileUtils.writeByteArrayToFile(file, bytes);
}
static class Core {
static void config() throws ClientApiException {
//may set unique release name into second parameter
newSession("", "");
}
static ApiResponse newSession(String name, String overwrite) throws ClientApiException {
return clientApi.core.newSession(API_KEY, name, overwrite);
}
static ApiResponse deleteAllAlerts() throws ClientApiException {
return clientApi.core.deleteAllAlerts(API_KEY);
}
static byte[] getXmlReport() throws ClientApiException {
return clientApi.core.xmlreport(API_KEY);
}
static byte[] getHtmlReport() throws ClientApiException {
return clientApi.core.htmlreport(API_KEY);
}
static void shutdown() throws ClientApiException {
clientApi.core.shutdown(API_KEY);
}
}
static class ActiveScanner {
static void config() throws ClientApiException {
removeAllScans();
setAlertAndAttackStrength();
PassiveScanner.setEnabled(true);
}
static int getLastScannerId() throws ClientApiException {
ApiResponseList apiResponseList = (ApiResponseList) scans();
return (new ScanResponse(apiResponseList)).getLastScan().getId();
}
static int getScanningProgress(int id) throws ClientApiException {
ApiResponseList apiResponseList = (ApiResponseList) scans();
return (new ScanResponse(apiResponseList)).getScanById(id).getProgress();
}
static ScanInfo.State getScanningState(int id) throws ClientApiException {
ApiResponseList apiResponseList = (ApiResponseList) scans();
return (new ScanResponse(apiResponseList)).getScanById(id).getState();
}
static List<String> getScanningResults(int id) throws ClientApiException {
List<String> results = new ArrayList<>();
ApiResponseList responseList = (ApiResponseList) clientApi.spider.results(String.valueOf(id));
for (ApiResponse response : responseList.getItems()) {
results.add(((ApiResponseElement) response).getValue());
}
return results;
}
static void waitScanningDone(int id) throws ClientApiException, InterruptedException {
logger.info("active scanning...");
int progress = 0;
while (progress < 100) {
progress = getScanningProgress(id);
logger.info(String.format("scanner id=%d scanning progress=%d", id, progress));
Thread.sleep(1000);
}
logger.info("active scanning done");
}
static ApiResponse removeAllScans() throws ClientApiException {
return clientApi.ascan.removeAllScans(API_KEY);
}
static ApiResponse setAttackStrength(String scannerId, String strength) throws ClientApiException {
return setAttackStrength(scannerId, strength, null);
}
static ApiResponse setAttackStrength(String scannerId, String strength, String scanPolicyName) throws ClientApiException {
return clientApi.ascan.setScannerAttackStrength(API_KEY, scannerId, strength, scanPolicyName);
}
static ApiResponse setScannerAlertThreshold(String scannerId, String threshold) throws ClientApiException {
return clientApi.ascan.setScannerAlertThreshold(API_KEY, scannerId, threshold, null);
}
static ApiResponse enableScanners(String ids) throws ClientApiException {
return clientApi.ascan.enableScanners(API_KEY, ids);
}
static ApiResponse disableScanners(String ids) throws ClientApiException {
return clientApi.ascan.disableScanners(API_KEY, ids);
}
static ApiResponse disableAllScanners(String scanPolicyName) throws ClientApiException {
return clientApi.ascan.disableAllScanners(API_KEY, scanPolicyName);
}
static ApiResponse enableAllScanners(String scanPolicyName) throws ClientApiException {
return clientApi.ascan.enableAllScanners(API_KEY, scanPolicyName);
}
static ApiResponse scan(String url) throws ClientApiException {
return scan(url, "true", "false", null, null, null);
}
static ApiResponse scan(String url, String recurse, String inScopeOnly, String scanPolicyName, String method, String postData) throws ClientApiException {
return clientApi.ascan.scan(API_KEY, url, recurse, inScopeOnly, scanPolicyName, method, postData);
}
static ApiResponse scans() throws ClientApiException {
return clientApi.ascan.scans();
}
static void excludeFromScanner(String regex) throws ClientApiException {
clientApi.ascan.excludeFromScan(API_KEY, regex);
}
}
static class PassiveScanner {
static void setEnabled(boolean enabled) throws ClientApiException {
clientApi.pscan.setEnabled(API_KEY, Boolean.toString(enabled));
}
}
static class Spider {
static void config() throws ClientApiException {
// Spider.excludeFromScan(myApp.LOGOUT_URL);
Spider.setOptionThreadCount(5);
Spider.setOptionMaxDepth(5);
Spider.setOptionPostForm(false);
}
static int getLastScannerId() throws ClientApiException {
ApiResponseList apiResponseList = (ApiResponseList) scans();
return (new ScanResponse(apiResponseList)).getLastScan().getId();
}
static int getScanningProgress(int id) throws ClientApiException {
ApiResponseList apiResponseList = (ApiResponseList) scans();
return (new ScanResponse(apiResponseList)).getScanById(id).getProgress();
}
static ScanInfo.State getScanningState(int id) throws ClientApiException {
ApiResponseList apiResponseList = (ApiResponseList) scans();
return (new ScanResponse(apiResponseList)).getScanById(id).getState();
}
static List<String> getScanningResults(int id) throws ClientApiException {
List<String> results = new ArrayList<>();
ApiResponseList responseList = (ApiResponseList) clientApi.spider.results(String.valueOf(id));
for (ApiResponse response : responseList.getItems()) {
results.add(((ApiResponseElement) response).getValue());
}
return results;
}
static void waitScanningDone(int id) throws ClientApiException, InterruptedException {
logger.info("spider scanning...");
int progress = 0;
while (progress < 100) {
progress = getScanningProgress(id);
logger.info(String.format("scanner id=%d scanning progress=%d", id, progress));
Thread.sleep(1000);
}
logger.info("spider scanning done");
}
static ApiResponse scans() throws ClientApiException {
return clientApi.spider.scans();
}
static ApiResponse excludeFromScan(String regex) throws ClientApiException {
return clientApi.spider.excludeFromScan(API_KEY, regex);
}
static ApiResponse setOptionMaxDepth(int depth) throws ClientApiException {
return clientApi.spider.setOptionMaxDepth(API_KEY, depth);
}
static ApiResponse setOptionPostForm(boolean post) throws ClientApiException {
return clientApi.spider.setOptionPostForm(API_KEY, post);
}
static ApiResponse setOptionThreadCount(int threads) throws ClientApiException {
return clientApi.spider.setOptionThreadCount(API_KEY, threads);
}
static ApiResponse scan(String url) throws ClientApiException {
return scan(url, null, true, null);
}
static ApiResponse scan(String url, Integer maxChildren, boolean recurse, String contextName) throws ClientApiException {
String contextNameString = contextName == null ? "Default Context" : contextName; //Something must be specified else zap throws an exception
String maxChildrenString = maxChildren == null ? null : String.valueOf(maxChildren);
return clientApi.spider.scan(API_KEY, url, maxChildrenString, String.valueOf(recurse), contextNameString);
}
}
static List<Alert> getAlerts() throws ClientApiException {
return getAlerts(-1, -1);
}
static List<Alert> getAlerts(int start, int count) throws ClientApiException {
return getAlerts("", start, count);
}
static List<Alert> getAlerts(String baseurl, int start, int count) throws ClientApiException {
return clientApi.getAlerts(baseurl, start, count);
}
static void setAlertAndAttackStrength() throws ClientApiException {
for (String policyName : policyNames) {
String ids = enableScanners(policyName);
for (String id : ids.split(",")) {
ActiveScanner.setScannerAlertThreshold(id, MEDIUM);
ActiveScanner.setAttackStrength(id, HIGH);
}
}
}
static String enableScanners(String policyName) throws ClientApiException {
String scannerIds = null;
switch (policyName.toLowerCase()) {
case "directory-browsing":
scannerIds = "0";
break;
case "cross-site-scripting":
scannerIds = "40012,40014,40016,40017";
break;
case "sql-injection":
scannerIds = "40018";
break;
case "path-traversal":
scannerIds = "6";
break;
case "remote-file-inclusion":
scannerIds = "7";
break;
case "server-side-include":
scannerIds = "40009";
break;
case "script-active-scan-rules":
scannerIds = "50000";
break;
case "server-side-code-injection":
scannerIds = "90019";
break;
case "remote-os-command-injection":
scannerIds = "90020";
break;
case "external-redirect":
scannerIds = "20019";
break;
case "crlf-injection":
scannerIds = "40003";
break;
case "source-code-disclosure":
scannerIds = "42,10045,20017";
break;
case "shell-shock":
scannerIds = "10048";
break;
case "remote-code-execution":
scannerIds = "20018";
break;
case "ldap-injection":
scannerIds = "40015";
break;
case "xpath-injection":
scannerIds = "90021";
break;
case "xml-external-entity":
scannerIds = "90023";
break;
case "padding-oracle":
scannerIds = "90024";
break;
case "el-injection":
scannerIds = "90025";
break;
case "insecure-http-methods":
scannerIds = "90028";
break;
case "parameter-pollution":
scannerIds = "20014";
break;
default:
throw new RuntimeException(String.format("%s was not a valid policy name", policyName));
}
ActiveScanner.enableScanners(scannerIds);
return scannerIds;
}
}
| [
"kent.gu@lombardrisk.com"
] | kent.gu@lombardrisk.com |
856318b3c7fc1f453e464db2c41bd7cdfe916c10 | 43ca534032faa722e206f4585f3075e8dd43de6c | /src/com/facebook/ah.java | 81fc2baca190b0d08962cc83f66976c7d66ea1a1 | [] | no_license | dnoise/IG-6.9.1-decompiled | 3e87ba382a60ba995e582fc50278a31505109684 | 316612d5e1bfd4a74cee47da9063a38e9d50af68 | refs/heads/master | 2021-01-15T12:42:37.833988 | 2014-10-29T13:17:01 | 2014-10-29T13:17:01 | 26,952,948 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.facebook;
import android.os.Handler;
import android.os.Message;
// Referenced classes of package com.facebook:
// ag
final class ah extends Handler
{
final ag a;
ah(ag ag1)
{
a = ag1;
super();
}
public final void handleMessage(Message message)
{
ag.a(a, message);
}
}
| [
"leo.sjoberg@gmail.com"
] | leo.sjoberg@gmail.com |
985a9287c6258fd9415d6562ceb56f818d659d45 | 5623ba61c467e2e8dff0a98786028a61c33270d6 | /src/com/pranay/GeeksForGeeks/MinimumSwaps2.java | 437b02838a332a4ba493e3a880276ea5bb15fdc4 | [] | no_license | pranayhere/JavaCore | 009e5178e3a1d6e8ba8aabde467c8e7e159d7f46 | 48e9c9a6f5d42d27b95b6d508000901b9b09793a | refs/heads/master | 2023-03-03T07:57:35.361724 | 2023-02-26T11:29:02 | 2023-02-26T11:29:02 | 65,987,339 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package com.pranay.GeeksForGeeks;
public class MinimumSwaps2 {
public static void main(String[] args) {
int[] arr = {7, 1, 3, 2, 4, 5, 6};
int minSwaps = minimumSwaps(arr);
System.out.println(minSwaps);
}
private static int minimumSwaps(int[] arr) {
int count = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] == i+1) {
continue;
}
swap(i, arr[i]-1, arr);
i = 0;
count ++;
if (i == arr.length-1)
break;
}
return count;
}
private static void swap(int idx_i, int idx_j, int[] arr) {
int temp = arr[idx_i];
arr[idx_i] = arr[idx_j];
arr[idx_j] = temp;
}
}
| [
"pranay.sankpal@pharmeasy.in"
] | pranay.sankpal@pharmeasy.in |
e5c8a802afcee13219dedfdc024874e66a930165 | 445c3cf84dd4bbcbbccf787b2d3c9eb8ed805602 | /aliyun-java-sdk-dts/src/main/java/com/aliyuncs/dts/model/v20200101/DescribeCenVpcRequest.java | 525b7c7ea729faac0389eb8a75fdcb76b0bc4104 | [
"Apache-2.0"
] | permissive | caojiele/aliyun-openapi-java-sdk | b6367cc95469ac32249c3d9c119474bf76fe6db2 | ecc1c949681276b3eed2500ec230637b039771b8 | refs/heads/master | 2023-06-02T02:30:02.232397 | 2021-06-18T04:08:36 | 2021-06-18T04:08:36 | 172,076,930 | 0 | 0 | NOASSERTION | 2019-02-22T14:08:29 | 2019-02-22T14:08:29 | null | UTF-8 | Java | false | false | 3,650 | java | /*
* 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.aliyuncs.dts.model.v20200101;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.dts.Endpoint;
/**
* @author auto create
* @version
*/
public class DescribeCenVpcRequest extends RpcAcsRequest<DescribeCenVpcResponse> {
private String type;
private String pageNumber;
private String engine;
private String pageSize;
private String roleName;
private String ip;
private String aliyunId;
private String instanceId;
private String port;
private String region;
public DescribeCenVpcRequest() {
super("Dts", "2020-01-01", "DescribeCenVpc", "dts");
setMethod(MethodType.POST);
try {
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
if(type != null){
putQueryParameter("Type", type);
}
}
public String getPageNumber() {
return this.pageNumber;
}
public void setPageNumber(String pageNumber) {
this.pageNumber = pageNumber;
if(pageNumber != null){
putQueryParameter("PageNumber", pageNumber);
}
}
public String getEngine() {
return this.engine;
}
public void setEngine(String engine) {
this.engine = engine;
if(engine != null){
putQueryParameter("Engine", engine);
}
}
public String getPageSize() {
return this.pageSize;
}
public void setPageSize(String pageSize) {
this.pageSize = pageSize;
if(pageSize != null){
putQueryParameter("PageSize", pageSize);
}
}
public String getRoleName() {
return this.roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
if(roleName != null){
putQueryParameter("RoleName", roleName);
}
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
if(ip != null){
putQueryParameter("Ip", ip);
}
}
public String getAliyunId() {
return this.aliyunId;
}
public void setAliyunId(String aliyunId) {
this.aliyunId = aliyunId;
if(aliyunId != null){
putQueryParameter("AliyunId", aliyunId);
}
}
public String getInstanceId() {
return this.instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
if(instanceId != null){
putQueryParameter("InstanceId", instanceId);
}
}
public String getPort() {
return this.port;
}
public void setPort(String port) {
this.port = port;
if(port != null){
putQueryParameter("Port", port);
}
}
public String getRegion() {
return this.region;
}
public void setRegion(String region) {
this.region = region;
if(region != null){
putQueryParameter("Region", region);
}
}
@Override
public Class<DescribeCenVpcResponse> getResponseClass() {
return DescribeCenVpcResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
b337a859fca0d7debf3d0644a705bbb5051d0a5e | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Jetty/Jetty4826.java | 0374807c4c4c304e24d5049ccb9b63cfbec00dff | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | public static boolean isPrefix(ByteBuffer prefix, ByteBuffer buffer)
{
if (prefix.remaining() > buffer.remaining())
return false;
int bi = buffer.position();
for (int i = prefix.position(); i < prefix.limit(); i++)
if (prefix.get(i) != buffer.get(bi++))
return false;
return true;
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
5a6a2412036a6c65a141ceb0372a268f90559ceb | 7fb7e45083e9f78010a0112da80889202195fa51 | /sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/GalleryApplicationsClient.java | f12bd56876a4195c39307aeebf6dec50229d6943 | [
"LicenseRef-scancode-generic-cla",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | abouquet/azure-sdk-for-java | 1f79d75636ef5c354d1229531583f67d97b104cd | 05bcf7062f5bc1bca09eeec36b2ca8fa2c4e3655 | refs/heads/master | 2023-01-06T04:17:28.305062 | 2020-09-24T18:47:53 | 2020-09-24T18:47:53 | 298,386,196 | 0 | 0 | MIT | 2020-09-24T20:19:37 | 2020-09-24T20:19:36 | null | UTF-8 | Java | false | false | 82,255 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.fluent;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.compute.fluent.inner.GalleryApplicationInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
import com.azure.resourcemanager.compute.models.GalleryApplicationList;
import com.azure.resourcemanager.compute.models.GalleryApplicationUpdate;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in GalleryApplications. */
public final class GalleryApplicationsClient {
private final ClientLogger logger = new ClientLogger(GalleryApplicationsClient.class);
/** The proxy service used to perform REST calls. */
private final GalleryApplicationsService service;
/** The service client containing this operation class. */
private final ComputeManagementClient client;
/**
* Initializes an instance of GalleryApplicationsClient.
*
* @param client the instance of the service client containing this operation class.
*/
GalleryApplicationsClient(ComputeManagementClient client) {
this.service =
RestProxy.create(GalleryApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientGalleryApplications to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
private interface GalleryApplicationsService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries"
+ "/{galleryName}/applications/{galleryApplicationName}")
@ExpectedResponses({200, 201, 202})
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("galleryName") String galleryName,
@PathParam("galleryApplicationName") String galleryApplicationName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") GalleryApplicationInner galleryApplication,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries"
+ "/{galleryName}/applications/{galleryApplicationName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono<Response<Flux<ByteBuffer>>> update(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("galleryName") String galleryName,
@PathParam("galleryApplicationName") String galleryApplicationName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") GalleryApplicationUpdate galleryApplication,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries"
+ "/{galleryName}/applications/{galleryApplicationName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono<Response<GalleryApplicationInner>> get(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("galleryName") String galleryName,
@PathParam("galleryApplicationName") String galleryApplicationName,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries"
+ "/{galleryName}/applications/{galleryApplicationName}")
@ExpectedResponses({200, 202, 204})
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono<Response<Flux<ByteBuffer>>> delete(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("galleryName") String galleryName,
@PathParam("galleryApplicationName") String galleryApplicationName,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries"
+ "/{galleryName}/applications")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono<Response<GalleryApplicationList>> listByGallery(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("galleryName") String galleryName,
@QueryParam("api-version") String apiVersion,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono<Response<GalleryApplicationList>> listByGalleryNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
if (galleryApplication == null) {
return Mono
.error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null."));
} else {
galleryApplication.validate();
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
galleryApplication,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
if (galleryApplication == null) {
return Mono
.error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null."));
} else {
galleryApplication.validate();
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
galleryApplication,
context);
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication) {
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication);
return this
.client
.<GalleryApplicationInner, GalleryApplicationInner>getLroResult(
mono,
this.client.getHttpPipeline(),
GalleryApplicationInner.class,
GalleryApplicationInner.class,
Context.NONE);
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(
resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context);
return this
.client
.<GalleryApplicationInner, GalleryApplicationInner>getLroResult(
mono,
this.client.getHttpPipeline(),
GalleryApplicationInner.class,
GalleryApplicationInner.class,
context);
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginCreateOrUpdate(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication) {
return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication)
.getSyncPoller();
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginCreateOrUpdate(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication,
Context context) {
return beginCreateOrUpdateAsync(
resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context)
.getSyncPoller();
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<GalleryApplicationInner> createOrUpdateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication) {
return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<GalleryApplicationInner> createOrUpdateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication,
Context context) {
return beginCreateOrUpdateAsync(
resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GalleryApplicationInner createOrUpdate(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication) {
return createOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).block();
}
/**
* Create or update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* created.
* @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The
* allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The
* maximum length is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to create
* or update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GalleryApplicationInner createOrUpdate(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationInner galleryApplication,
Context context) {
return createOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context)
.block();
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
if (galleryApplication == null) {
return Mono
.error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null."));
} else {
galleryApplication.validate();
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
galleryApplication,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
if (galleryApplication == null) {
return Mono
.error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null."));
} else {
galleryApplication.validate();
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.update(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
galleryApplication,
context);
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginUpdateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication) {
Mono<Response<Flux<ByteBuffer>>> mono =
updateWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication);
return this
.client
.<GalleryApplicationInner, GalleryApplicationInner>getLroResult(
mono,
this.client.getHttpPipeline(),
GalleryApplicationInner.class,
GalleryApplicationInner.class,
Context.NONE);
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginUpdateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
updateWithResponseAsync(
resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context);
return this
.client
.<GalleryApplicationInner, GalleryApplicationInner>getLroResult(
mono,
this.client.getHttpPipeline(),
GalleryApplicationInner.class,
GalleryApplicationInner.class,
context);
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginUpdate(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication) {
return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication)
.getSyncPoller();
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<GalleryApplicationInner>, GalleryApplicationInner> beginUpdate(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication,
Context context) {
return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context)
.getSyncPoller();
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<GalleryApplicationInner> updateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication) {
return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<GalleryApplicationInner> updateAsync(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication,
Context context) {
return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GalleryApplicationInner update(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication) {
return updateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).block();
}
/**
* Update a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* updated.
* @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed
* characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length
* is 80 characters.
* @param galleryApplication Specifies information about the gallery Application Definition that you want to update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GalleryApplicationInner update(
String resourceGroupName,
String galleryName,
String galleryApplicationName,
GalleryApplicationUpdate galleryApplication,
Context context) {
return updateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context).block();
}
/**
* Retrieves information about a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be
* retrieved.
* @param galleryApplicationName The name of the gallery Application Definition to be retrieved.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<GalleryApplicationInner>> getWithResponseAsync(
String resourceGroupName, String galleryName, String galleryApplicationName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Retrieves information about a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be
* retrieved.
* @param galleryApplicationName The name of the gallery Application Definition to be retrieved.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<GalleryApplicationInner>> getWithResponseAsync(
String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
context);
}
/**
* Retrieves information about a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be
* retrieved.
* @param galleryApplicationName The name of the gallery Application Definition to be retrieved.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<GalleryApplicationInner> getAsync(
String resourceGroupName, String galleryName, String galleryApplicationName) {
return getWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName)
.flatMap(
(Response<GalleryApplicationInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves information about a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be
* retrieved.
* @param galleryApplicationName The name of the gallery Application Definition to be retrieved.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<GalleryApplicationInner> getAsync(
String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
return getWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, context)
.flatMap(
(Response<GalleryApplicationInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves information about a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be
* retrieved.
* @param galleryApplicationName The name of the gallery Application Definition to be retrieved.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GalleryApplicationInner get(String resourceGroupName, String galleryName, String galleryApplicationName) {
return getAsync(resourceGroupName, galleryName, galleryApplicationName).block();
}
/**
* Retrieves information about a gallery Application Definition.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be
* retrieved.
* @param galleryApplicationName The name of the gallery Application Definition to be retrieved.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the gallery Application Definition that you want to create or update.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GalleryApplicationInner get(
String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
return getAsync(resourceGroupName, galleryName, galleryApplicationName, context).block();
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String galleryName, String galleryApplicationName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
if (galleryApplicationName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null."));
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
galleryApplicationName,
apiVersion,
context);
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String galleryName, String galleryApplicationName) {
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String galleryName, String galleryApplicationName) {
return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName).getSyncPoller();
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, context).getSyncPoller();
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(String resourceGroupName, String galleryName, String galleryApplicationName) {
return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(
String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String galleryName, String galleryApplicationName) {
deleteAsync(resourceGroupName, galleryName, galleryApplicationName).block();
}
/**
* Delete a gallery Application.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be
* deleted.
* @param galleryApplicationName The name of the gallery Application Definition to be deleted.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String galleryName, String galleryApplicationName, Context context) {
deleteAsync(resourceGroupName, galleryName, galleryApplicationName, context).block();
}
/**
* List gallery Application Definitions in a gallery.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be
* listed.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<GalleryApplicationInner>> listByGallerySinglePageAsync(
String resourceGroupName, String galleryName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.listByGallery(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
apiVersion,
context))
.<PagedResponse<GalleryApplicationInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* List gallery Application Definitions in a gallery.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be
* listed.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<GalleryApplicationInner>> listByGallerySinglePageAsync(
String resourceGroupName, String galleryName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (galleryName == null) {
return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null."));
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.listByGallery(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
galleryName,
apiVersion,
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* List gallery Application Definitions in a gallery.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be
* listed.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<GalleryApplicationInner> listByGalleryAsync(String resourceGroupName, String galleryName) {
return new PagedFlux<>(
() -> listByGallerySinglePageAsync(resourceGroupName, galleryName),
nextLink -> listByGalleryNextSinglePageAsync(nextLink));
}
/**
* List gallery Application Definitions in a gallery.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be
* listed.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<GalleryApplicationInner> listByGalleryAsync(
String resourceGroupName, String galleryName, Context context) {
return new PagedFlux<>(
() -> listByGallerySinglePageAsync(resourceGroupName, galleryName, context),
nextLink -> listByGalleryNextSinglePageAsync(nextLink, context));
}
/**
* List gallery Application Definitions in a gallery.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be
* listed.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<GalleryApplicationInner> listByGallery(String resourceGroupName, String galleryName) {
return new PagedIterable<>(listByGalleryAsync(resourceGroupName, galleryName));
}
/**
* List gallery Application Definitions in a gallery.
*
* @param resourceGroupName The name of the resource group.
* @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be
* listed.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<GalleryApplicationInner> listByGallery(
String resourceGroupName, String galleryName, Context context) {
return new PagedIterable<>(listByGalleryAsync(resourceGroupName, galleryName, context));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<GalleryApplicationInner>> listByGalleryNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listByGalleryNext(nextLink, context))
.<PagedResponse<GalleryApplicationInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Gallery Applications operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<GalleryApplicationInner>> listByGalleryNextSinglePageAsync(
String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listByGalleryNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
}
| [
"noreply@github.com"
] | abouquet.noreply@github.com |
70d2df2bf787a12550361bac964f183064e1a541 | 239d84297dd6a35ce6d69eba7455d2c6c8651ea9 | /witty-core/src/test/java/com/wittyhome/core/EntityControlerTest.java | 7d0c1e3b8c920875b8e77ebfea89c82ea86ba753 | [] | no_license | RomanNosachev/WittyServer | 0864c1201739a4be560cc19a8fc2f11854b8cd01 | e3affabab3c4ecf071353fe78702162d4f11f6bd | refs/heads/master | 2020-09-21T00:54:11.959246 | 2020-06-09T22:30:31 | 2020-06-09T22:30:31 | 224,633,289 | 5 | 0 | null | 2020-06-09T22:30:33 | 2019-11-28T10:57:42 | Java | UTF-8 | Java | false | false | 596 | java | package com.wittyhome.core;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.wittyhome.core.generator.ScenarioController;
@RunWith(SpringRunner.class)
@SpringBootTest()
public class EntityControlerTest
{
@Autowired
private ScenarioController controller;
@Test
public void scenarioControllerTest()
{
assertNotNull(controller);
}
}
| [
"walther.landmine@gmail.com"
] | walther.landmine@gmail.com |
b784b4aea1a499e1951d77f5b291e9a321dcd6e4 | 10b16ec1ef60e6bae1a3751575a244e4f4e4c9df | /app/src/main/java/com/khoa/lunarcalendar/calendar/view/fragment/CalendarFragment.java | d35db75329f2ee8796df1a2d8a3c5f8a9697f811 | [] | no_license | KhoaMoya/VietNamLunarCalendar | 50220efac80d2bd1e4ff9c27f5422faaf8ea418b | 46daf2e3234155365c92f537b9e8ca6c7e6d4875 | refs/heads/master | 2021-01-06T15:19:22.810962 | 2020-02-18T14:06:55 | 2020-02-18T14:06:55 | 241,377,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,950 | java | package com.khoa.lunarcalendar.calendar.view.fragment;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.ViewPagerBottomSheetBehavior;
import com.khoa.lunarcalendar.R;
import com.khoa.lunarcalendar.calendar.model.MessageEvent;
import com.khoa.lunarcalendar.calendar.model.MyDate;
import com.khoa.lunarcalendar.calendar.model.MyEvent;
import com.khoa.lunarcalendar.calendar.model.SpecialEvent;
import com.khoa.lunarcalendar.calendar.reponsitory.dao.DatabaseAccess;
import com.khoa.lunarcalendar.calendar.ultis.ZoomOutPageTransformer;
import com.khoa.lunarcalendar.calendar.view.adapter.MonthViewPagerAdapter;
import com.khoa.lunarcalendar.calendar.viewmodel.CalendarViewModel;
import com.khoa.lunarcalendar.databinding.CalendarFragmentBinding;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
public class CalendarFragment extends Fragment {
private CalendarFragmentBinding mBinding;
private CalendarViewModel mViewModel;
public static CalendarFragment newInstance() {
return new CalendarFragment();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mBinding = DataBindingUtil.inflate(inflater, R.layout.calendar_fragment, container, false);
mViewModel = ViewModelProviders.of(this).get(CalendarViewModel.class);
if (savedInstanceState == null) mViewModel.init(getContext(), getChildFragmentManager());
mBinding.setViewmodel(mViewModel);
return mBinding.getRoot();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setupBinding();
setUpViewPagerCalendar();
setupViewPagerBottomSheet();
mViewModel.setCurrentMonth(MonthViewPagerAdapter.firstPosition);
}
private void setupBinding() {
mBinding.fabBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mBinding.viewpagerCalendar.setCurrentItem(MonthViewPagerAdapter.firstPosition, true);
}
});
mBinding.bottomSheetEvent.txtEventMonth.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mBinding.bottomSheetEvent.viewpagerEvent.setCurrentItem(1);
}
});
mBinding.bottomSheetEvent.txtEventDay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mBinding.bottomSheetEvent.viewpagerEvent.setCurrentItem(0);
}
});
}
private void setupViewPagerBottomSheet() {
// set peek height bottom sheet && height bottom sheet
final ViewPagerBottomSheetBehavior<View> layoutBehavior = ViewPagerBottomSheetBehavior.from((View) mBinding.bottomSheetEvent.bottomsheetLayout);
mBinding.fabBack.post(new Runnable() {
@Override
public void run() {
// set peek height bottom sheet
int bottomRoot = mBinding.rootLayout.getBottom();
int bottomFabBack = mBinding.fabBack.getBottom();
int peekHeight = bottomRoot - bottomFabBack - 15;
layoutBehavior.setPeekHeight(peekHeight, true);
layoutBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
// set height bottom sheet
int topCalendar = mBinding.viewpagerCalendar.getTop();
int heightSheet = bottomRoot - topCalendar;
ViewGroup.LayoutParams params = mBinding.bottomSheetEvent.bottomsheetLayout.getLayoutParams();
params.height = heightSheet;
mBinding.bottomSheetEvent.bottomsheetLayout.setLayoutParams(params);
}
});
// set adapter for view pager event
mBinding.bottomSheetEvent.viewpagerEvent.setAdapter(mViewModel.adapterViewPagerEvent);
// set scrolling child for viewpager
mBinding.bottomSheetEvent.viewpagerEvent.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mBinding.bottomSheetEvent.viewpagerEvent.post(new Runnable() {
@Override
public void run() {
layoutBehavior.updateScrollingChild();
}
});
if (position == 0) {
mBinding.bottomSheetEvent.txtEventDay.setTextColor(getResources().getColor(R.color.colorBlack));
mBinding.bottomSheetEvent.txtEventMonth.setTextColor(getResources().getColor(R.color.colorBlack20));
} else if (position == 1) {
mBinding.bottomSheetEvent.txtEventDay.setTextColor(getResources().getColor(R.color.colorBlack20));
mBinding.bottomSheetEvent.txtEventMonth.setTextColor(getResources().getColor(R.color.colorBlack));
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
// viewpager calendar
private void setUpViewPagerCalendar() {
// mBinding.viewpagerCalendar.setClipToPadding(false);
// mBinding.viewpagerCalendar.setPadding(10,0,10,0);
// mBinding.viewpagerCalendar.setPageMargin(10);
mBinding.viewpagerCalendar.setOffscreenPageLimit(2);
mBinding.viewpagerCalendar.setAdapter(mViewModel.adapterViewPagerCalendar);
mBinding.viewpagerCalendar.setCurrentItem(MonthViewPagerAdapter.firstPosition, false);
// page transformer
mBinding.viewpagerCalendar.setPageTransformer(true, new ZoomOutPageTransformer());
mBinding.viewpagerCalendar.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mViewModel.setCurrentMonth(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
mBinding.fabAddEvent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickFabAddEvent();
}
});
}
public boolean isExpandedBottomSheet() {
final ViewPagerBottomSheetBehavior<View> layoutBehavior = ViewPagerBottomSheetBehavior.from((View) mBinding.bottomSheetEvent.bottomsheetLayout);
return layoutBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED;
}
public void closeBottomSheet() {
final ViewPagerBottomSheetBehavior<View> layoutBehavior = ViewPagerBottomSheetBehavior.from((View) mBinding.bottomSheetEvent.bottomsheetLayout);
layoutBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
@Subscribe
public void onListenerMessageEvent(MessageEvent messageEvent) {
switch (messageEvent.action) {
// day click listener
case DAY_CLICK:
MyDate clickedDate = (MyDate) messageEvent.data;
mViewModel.setCurrentDay(clickedDate);
if (mBinding.bottomSheetEvent.viewpagerEvent.getCurrentItem() == 1) {
mBinding.bottomSheetEvent.viewpagerEvent.setCurrentItem(0);
}
break;
// recycler view event scroll listenser
case SCROLL_EVENT_LIST:
int visibly = (int) messageEvent.data;
if (visibly == View.VISIBLE) {
mBinding.fabAddEvent.show();
} else {
mBinding.fabAddEvent.hide();
}
break;
case UPDATE_TEXT_EVENT_LIST_DAY_SIZE:
mBinding.bottomSheetEvent.txtEventDay.setText("Ngày (" + messageEvent.data + ")");
break;
case UPDATE_TEXT_EVENT_LIST_MONTH_SIZE:
mBinding.bottomSheetEvent.txtEventMonth.setText("Tháng (" + messageEvent.data + ")");
break;
default:
break;
}
}
private void clickFabAddEvent() {
fadeOutFabAddEvent();
mBinding.reveal.setVisibility(VISIBLE);
int cx = mBinding.reveal.getWidth();
int cy = mBinding.reveal.getHeight();
int x = (int) (getFabWidth() / 2 + mBinding.fabAddEvent.getX());
int y = (int) (getFabWidth() / 2 + mBinding.fabAddEvent.getY());
float finalRadius = Math.max(cx, cy) * 1.3f;
Animator reveal = ViewAnimationUtils
.createCircularReveal(mBinding.reveal, x, y, getFabWidth(), finalRadius);
reveal.setDuration(400);
reveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
reset(animation);
// finish();
}
private void reset(Animator animation) {
super.onAnimationEnd(animation);
mBinding.reveal.setVisibility(INVISIBLE);
mBinding.fabAddEvent.setAlpha(1f);
mBinding.calendarLayout.setVisibility(VISIBLE);
mBinding.bottomSheetEvent.bottomsheetLayout.setVisibility(VISIBLE);
}
});
reveal.start();
delayedStartNextActivity();
}
private int getFabWidth() {
return (int) getResources().getDimension(R.dimen.fab_size);
}
private void fadeOutFabAddEvent() {
mBinding.fabAddEvent.animate().alpha(0f).setDuration(100).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mBinding.calendarLayout.setVisibility(INVISIBLE);
mBinding.bottomSheetEvent.bottomsheetLayout.setVisibility(INVISIBLE);
}
}).start();
}
private void delayedStartNextActivity() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
EventBus.getDefault().post(new MessageEvent(MessageEvent.Action.SHOW_ADD_EVENT_ACTIVITY, ""));
}
}, 100);
}
@Override
public void onResume() {
super.onResume();
EventBus.getDefault().register(this);
}
@Override
public void onPause() {
super.onPause();
EventBus.getDefault().unregister(this);
}
private void testDatabase() {
try {
DatabaseAccess databaseAccess = DatabaseAccess.getInstance(getActivity());
ArrayList<MyEvent> eventList = databaseAccess.getAllEvent();
ArrayList<SpecialEvent> specialEventList = databaseAccess.getAllSpecialEvent();
// for(MyEvent event : eventList) Log.e("Loi", event.toString());
Log.e("Loi", specialEventList.size() + "");
// for(int i=0; i<eventList.size(); i++){
// for (int j=0; j<specialEventList.size(); j++){
// String str1 = specialEventList.get(j).titile.toLowerCase();
// String str2 = eventList.get(i).titile.toLowerCase();
// if(str1.equalsIgnoreCase(str2) || str1.contains(str2) || str2.contains(str1)){
// Log.e("Loi", eventList.get(i).titile);
// databaseAccess.deleteSpecialEvent(specialEventList.get(j).id);
// }
// }
// }
// 14, 19, 26,38
// databaseAccess.deleteSpecialEvent(14);
// databaseAccess.deleteSpecialEvent(19);
// databaseAccess.deleteSpecialEvent(26);
// databaseAccess.deleteSpecialEvent(38);
Log.e("Loi", eventList.size() + "");
for (int i = 0; i < specialEventList.size(); i++) {
SpecialEvent event = specialEventList.get(i);
String newDate = event.date;
String[] splits = newDate.split("/");
newDate = "1970-" + splits[1] + "-" + splits[0] + " 00:00:00";
// Log.e("Loi", newDate + " , " + specialEventList.get(i).toString());
//int id, String calendar, String title, String imageURL, String startDate, String endDate, String content, String createdAt, String updateAt
MyEvent myEvent = new MyEvent(event.id, event.calendar, event.title, event.imageURL, newDate, newDate, event.content, event.createdAt, event.updateAt);
databaseAccess.insertEventAnnual(myEvent);
}
eventList = databaseAccess.getAllEvent();
Log.e("Loi", eventList.size() + "");
} catch (Exception e) {
e.printStackTrace();
}
}
} | [
"42571291+KhoaMoya@users.noreply.github.com"
] | 42571291+KhoaMoya@users.noreply.github.com |
58f48e9a3ab9af42a0034fbdc0b9c4cacb91f8b4 | fb30cacd7826c7dbae81b3ad8aacf97099bc364f | /app/src/main/java/com/clarifai/demo/app/Login.java | 85de2b0cfaf3082c306f458dc5bba6773e3712d1 | [] | no_license | ManeeshDanthala/ClarifaiAPI_ImplementationApp | 392a5bf3b09460a30d7549c6f60d451e7e5d535b | 29c52309089bef7c2de7c34a55729a72626dfb83 | refs/heads/master | 2021-05-05T16:05:37.698641 | 2018-01-13T10:45:54 | 2018-01-13T10:45:54 | 117,334,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,266 | java | package com.clarifai.demo.app;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
public class Login extends AppCompatActivity {
private static final String TAG = "GoogleActivity";
private static final int RC_SIGN_IN = 9001;
private FirebaseAuth mAuth;
private GoogleSignInClient mGoogleSignInClient;
private ImageView loginButton;
private ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
if (isOnline()) {
// Configure Google Sign In
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
mAuth = FirebaseAuth.getInstance();
loginButton = (ImageView) findViewById(R.id.loginButton);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
progressDialog = new ProgressDialog(Login.this);
progressDialog.setMessage("Hang on...");
progressDialog.setCancelable(false);
progressDialog.show();
signIn();
}
});
}
else{
Toast.makeText(Login.this,"No Internet Access",Toast.LENGTH_LONG).show();
}
}
private void updateUI(FirebaseUser firebaseUser, int temp) {
if (firebaseUser != null) {
Intent i = new Intent(Login.this, MainActivity.class);
startActivity(i);
} else if (firebaseUser == null && temp == 1) {
Toast.makeText(Login.this, "Authentication failed", Toast.LENGTH_LONG).show();
} else {
}
}
@Override
public void onStart() {
super.onStart();
// Check if user is signed in (non-null) and update UI accordingly.
FirebaseUser currentUser = mAuth.getCurrentUser();
updateUI(currentUser, 0);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// Google Sign In was successful
GoogleSignInAccount account = task.getResult(ApiException.class);
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
Log.w(TAG, "Google sign in failed", e);
updateUI(null, 1);
}
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
progressDialog.setMessage("Hang on...");
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = mAuth.getCurrentUser();
updateUI(user, 1);
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
updateUI(null, 1);
}
progressDialog.dismiss();
}
});
}
private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
protected boolean isOnline() {
boolean haveConnectedWifi = false;
boolean haveConnectedMobile = false;
ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork != null) { // connected to the internet
if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) {
if (activeNetwork.isConnected())
haveConnectedWifi = true;
} else if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) {
if (activeNetwork.isConnected())
haveConnectedMobile = true;
}
}
return haveConnectedWifi || haveConnectedMobile;
}
}
| [
"maneeshdanthala@gmail.com"
] | maneeshdanthala@gmail.com |
24c06be3c9633dec1d289312d6fea47feda4082a | 46d0904e16fc68c1702388db8a3d90ece9f724fa | /TestSpringApp2/src/main/java/com/example/demo/controller/adminController.java | bfd40e793c78368a01761c836d70b91273c02862 | [] | no_license | HasnainNasif/Hibernate-and-Springboot | 7e724f12f1bd660b3b59a9c1f9b346f6063a89d4 | f6f2e7b95e8f721a21690e33ef4f90dd77b34e07 | refs/heads/master | 2021-09-03T23:27:00.464470 | 2018-01-12T19:44:30 | 2018-01-12T19:44:30 | 117,271,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package com.example.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class adminController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index(Model model) {
System.out.println("-----------index-------------");
model.addAttribute("myMessage","We run it ......");
return "index";
}
}
| [
"nasif.it@yahoo.com"
] | nasif.it@yahoo.com |
5c35309c87e71919c416c10c817ae6edefb2c47f | bf8a42dccc24a25b81f4500ed9f3f23106e58003 | /http/org.wso2.carbon.transport.http.netty/src/main/java/org/wso2/carbon/transport/http/netty/listener/http2/HTTP2ResponseCallback.java | 17c05369ec08be416a6d2820fb023305bdfb9250 | [
"Apache-2.0"
] | permissive | warunalakshitha/carbon-transports | b0a13d3e0c2644f8782c46d8163424f853bc467c | 67efb5de1b8fd44e834cb91736af361b22de7aad | refs/heads/master | 2021-04-30T23:47:36.822399 | 2017-02-24T06:32:39 | 2017-02-24T06:32:39 | 79,798,748 | 0 | 0 | null | 2017-02-09T15:36:34 | 2017-01-23T11:34:22 | Java | UTF-8 | Java | false | false | 9,192 | java | /*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.wso2.carbon.transport.http.netty.listener.http2;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.HttpContent;
import io.netty.handler.codec.http.LastHttpContent;
import io.netty.handler.codec.http2.DefaultHttp2Headers;
import io.netty.handler.codec.http2.Http2Exception;
import io.netty.handler.codec.http2.Http2Headers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.messaging.CarbonCallback;
import org.wso2.carbon.messaging.CarbonMessage;
import org.wso2.carbon.messaging.DefaultCarbonMessage;
import org.wso2.carbon.messaging.MessageDataSource;
import org.wso2.carbon.transport.http.netty.common.Constants;
import org.wso2.carbon.transport.http.netty.common.Util;
import org.wso2.carbon.transport.http.netty.internal.HTTPTransportContextHolder;
import org.wso2.carbon.transport.http.netty.message.HTTPCarbonMessage;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
/**
* {@code HTTP2ResponseCallback} is the class implements {@link CarbonCallback} interface to process http2 message
* responses coming from message processor
*/
public class HTTP2ResponseCallback implements CarbonCallback {
private ChannelHandlerContext ctx;
// Stream id of the channel of initial request
private int streamId;
private static final Logger logger = LoggerFactory.getLogger(HTTP2ResponseCallback.class);
private static final String DEFAULT_HTTP_METHOD_POST = "POST";
/**
* Construct a new {@link HTTP2ResponseCallback} to process HTTP2 responses
*
* @param channelHandlerContext Channel context
* @param streamId Stream Id
*/
public HTTP2ResponseCallback(ChannelHandlerContext channelHandlerContext, int streamId) {
this.ctx = channelHandlerContext;
this.streamId = streamId;
}
public void done(CarbonMessage cMsg) {
handleResponsesWithoutContentLength(cMsg);
if (HTTPTransportContextHolder.getInstance().getHandlerExecutor() != null) {
HTTPTransportContextHolder.getInstance().getHandlerExecutor().executeAtSourceResponseReceiving(cMsg);
}
Http2Headers http2Headers = createHttp2Headers(cMsg);
if (ctx.handler() instanceof HTTP2SourceHandler) {
HTTP2SourceHandler http2SourceHandler = (HTTP2SourceHandler) ctx.handler();
final ChannelPromise channelPromise = ctx.newPromise();
http2SourceHandler.encoder().frameWriter().writeHeaders(ctx, streamId, http2Headers, 0, false,
channelPromise);
try {
if (cMsg instanceof HTTPCarbonMessage) {
HTTPCarbonMessage nettyCMsg = (HTTPCarbonMessage) cMsg;
while (true) {
if (nettyCMsg.isEndOfMsgAdded() && nettyCMsg.isEmpty()) {
http2SourceHandler.encoder().frameWriter().writeData(ctx, streamId, Unpooled
.EMPTY_BUFFER, 0, true, channelPromise);
http2SourceHandler.flush(ctx);
break;
}
HttpContent httpContent = nettyCMsg.getHttpContent();
if (httpContent instanceof LastHttpContent) {
http2SourceHandler.encoder().frameWriter().writeData(ctx, streamId, httpContent.content()
, 0, true, channelPromise);
http2SourceHandler.flush(ctx);
if (HTTPTransportContextHolder.getInstance().getHandlerExecutor() != null) {
HTTPTransportContextHolder.getInstance().getHandlerExecutor().
executeAtSourceResponseSending(cMsg);
}
break;
}
http2SourceHandler.encoder().frameWriter().writeData(ctx, streamId, httpContent.content(), 0,
false, channelPromise);
}
} else if (cMsg instanceof DefaultCarbonMessage) {
DefaultCarbonMessage defaultCMsg = (DefaultCarbonMessage) cMsg;
if (defaultCMsg.isEndOfMsgAdded() && defaultCMsg.isEmpty()) {
http2SourceHandler.encoder().frameWriter().writeData(ctx, streamId, Unpooled.EMPTY_BUFFER, 0,
true, channelPromise);
http2SourceHandler.flush(ctx);
return;
}
while (true) {
ByteBuffer byteBuffer = defaultCMsg.getMessageBody();
ByteBuf bbuf = Unpooled.wrappedBuffer(byteBuffer);
http2SourceHandler.encoder().frameWriter().writeData(ctx, streamId, bbuf, 0, false,
channelPromise);
if (defaultCMsg.isEndOfMsgAdded() && defaultCMsg.isEmpty()) {
ChannelFuture future = http2SourceHandler.encoder().frameWriter().writeData(ctx,
streamId, Unpooled.EMPTY_BUFFER, 0, true, channelPromise);
http2SourceHandler.flush(ctx);
if (HTTPTransportContextHolder.getInstance().getHandlerExecutor() != null) {
HTTPTransportContextHolder.getInstance().getHandlerExecutor().
executeAtSourceResponseSending(cMsg);
}
String connection = cMsg.getHeader(Constants.HTTP_CONNECTION);
if (connection != null && Constants.HTTP_CONNECTION_CLOSE.equalsIgnoreCase(connection)) {
future.addListener(ChannelFutureListener.CLOSE);
}
break;
}
}
} else {
}
} catch (Http2Exception e) {
logger.error("Error occurred while sending response to client", e);
}
}
}
/**
* Handles the response without content length and set or remove headers based on carbon message
*
* @param cMsg Carbon Message
*/
private void handleResponsesWithoutContentLength(CarbonMessage cMsg) {
if (cMsg.isAlreadyRead()) {
MessageDataSource messageDataSource = cMsg.getMessageDataSource();
if (messageDataSource != null) {
messageDataSource.serializeData();
cMsg.setEndOfMsgAdded(true);
cMsg.getHeaders().remove(Constants.HTTP_CONTENT_LENGTH);
} else {
logger.error("Message is already built but cannot find the MessageDataSource");
}
}
if (cMsg.getHeader(Constants.HTTP_TRANSFER_ENCODING) == null
&& cMsg.getHeader(Constants.HTTP_CONTENT_LENGTH) == null) {
cMsg.setHeader(Constants.HTTP_CONTENT_LENGTH, String.valueOf(cMsg.getFullMessageLength()));
}
}
/**
* Create HTTP/2 Headers for response
*
* @param msg Carbon Message
* @return HTTP/2 Headers
*/
private Http2Headers createHttp2Headers(CarbonMessage msg) {
Http2Headers http2Headers = new DefaultHttp2Headers()
.status(String.valueOf(Util.getIntValue(msg, Constants.HTTP_STATUS_CODE, 200)))
.method(Util.getStringValue(msg, Constants.HTTP_METHOD, DEFAULT_HTTP_METHOD_POST))
.path(msg.getProperty(Constants.TO) != null ? msg.getProperty(Constants.TO).toString() : "/")
.scheme(msg.getProperty(Constants.SCHEME) != null ? msg.getProperty(Constants.SCHEME).toString()
: Constants.PROTOCOL_NAME);
//set Authority Header
if (msg.getProperty(Constants.AUTHORITY) != null) {
http2Headers.authority(Constants.AUTHORITY);
} else {
http2Headers.authority(((InetSocketAddress) ctx.channel().remoteAddress()).getHostName());
}
msg.getHeaders().getAll().forEach(k -> http2Headers.add(k.getName().toLowerCase(), k.getValue()));
return http2Headers;
}
}
| [
"warudanu@gmail.com"
] | warudanu@gmail.com |
dbd7ea5f50042fcaba46a0989c12db83a651b1c3 | 7296c1027301290f22b9c60c3cb97cea1bd043ee | /app/src/main/java/com/shubhammobiles/shubhammobiles/util/Constants.java | 74e7cacb0c940b54e6cc2fa7bac978e5f3ea8932 | [] | no_license | Akshayagrawal27/Shubham-Mobiles | 343aca1f46be750693356ea94795e314f721dcdb | fb0ec8c89c91259e16ea2e4bdf775edb7ac01d71 | refs/heads/master | 2020-03-19T20:18:50.689714 | 2018-06-11T08:58:55 | 2018-06-11T08:58:55 | 136,895,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,232 | java | package com.shubhammobiles.shubhammobiles.util;
/**
* Created by Akshay on 26-02-2018.
*/
public class Constants {
/**
* Constants related to locations in Firebase, such as the name of the node
* where user lists are stored (ie "userLists")
*/
public static final String FIREBASE_LOCATION_USERS = "users";
public static final String FIREBASE_LOCATION_BRAND_LIST = "BrandList";
public static final String FIREBASE_LOCATION_BRAND_MODEL_LIST = "BrandModelList";
public static final String FIREBASE_LOCATION_MODEL_VARIANT_LIST = "ModelVariant";
public static final String FIREBASE_LOCATION_ORDER_LIST = "OrderList";
public static final String FIREBASE_LOCATION_ACCOUNT_LIST = "AccountList";
public static final String FIREBASE_LOCATION_NOTE_LIST = "NoteList";
public static final String FIREBASE_LOCATION_PRICE_LIST = "PriceList";
/**
* Constants for Firebase object properties
*/
public static final String FIREBASE_PROPERTY_TIMESTAMP_LAST_CHANGED = "timestampLastChanged";
public static final String FIREBASE_PROPERTY_TIMESTAMP = "timestamp";
public static final String FIREBASE_PROPERTY_BRAND_QTY = "brandQuantity";
public static final String FIREBASE_PROPERTY_BOOKING_DATE = "bookingDate";
public static final String FIREBASE_PROPERTY_ORDER_STATUS = "status";
public static final String FIREBASE_PROPERTY_NOTE_DATE = "noteDate";
public static final String FIREBASE_PROPERTY_VARIANT_BEST_PRICE = "variantBestPrice";
/**
* Constants for bundles, extras and shared preferences keys
*/
public static final String KEY_DIALOG_ADD_BRAND = "ADD_BRAND_NAME";
public static final String KEY_DIALOG_ADD_BRAND_MODEL = "ADD_BRAND_MODEL";
public static final String KEY_DIALOG_ADD_MODEL_VARIANT = "ADD_MODEL_VARIANT";
public static final String KEY_DIALOG_ADD_ACCOUNT = "ADD_ACCOUNT";
public static final String KEY_DIALOG_ADD_PRICE = "ADD_PRICE";
public static final String KEY_DIALOG_EDIT_PRICE = "EDIT_PRICE";
public static final String KEY_BRAND_NAME = "BRAND_NAME";
public static final String KEY_BRAND_KEY = "BRAND_KEY";
public static final String KEY_BRAND_MODEL_NAME = "BRAND_MODEL_NAME";
public static final String KEY_BRAND_MODEL_KEY = "BRAND_MODEL_KEY";
public static final String KEY_ORDER = "ORDER_KEY";
public static final String KEY_ACCOUNT_NAME = "ACCOUNT_NAME";
public static final String KEY_ACCOUNT_KEY = "ACCOUNT_KEY";
public static final String KEY_NOTE_KEY = "NOTE_KEY";
public static final String KEY_VARIANT_KEY = "VARIANT_KEY";
public static final String KEY_VARIANT_NAME = "VARIANT_NAME";
public static final String KEY_PRICE_KEY = "PRICE_NAME";
public static final String COUNTRY_TIMEZONE= "india";
public static final String DATE_FORMAT= "dd-MM-yyyy HH:mm:ss";
public static final String ADD_NEW_ORDER = "ADD_NEW_ORDER";
public static final String EDIT_ORDER = "EDIT_ORDER";
public static final String ADD_NEW_NOTE = "ADD_NEW_NOTE";
public static final String EDIT_NOTE = "EDIT_NOTE";
/*
* Constants for Order Status
* */
public static final String ORDER_STATUS_PENDING = "pending";
public static final String ORDER_STATUS_COMPLETED = "completed";
public static final String KEY_DIALOG_SHARE_BRAND = "shareBrand";
public static final String FIREBASE_PROPERTY_OWNER_NAME = "ownerName";
public static final String FIREBASE_PROPERTY_SHOP_NAME = "shopName";
public static final String FIREBASE_LOCATION_SHARED_BRAND_WITH = "sharedBrandWith";
public static final String KEY_BRAND = "brandValue";
public static final String KEY_AM_I_OWNER = "amIOwner";
public static final String FIREBASE_PROPERTY_PHONE_NUMBER = "phoneNumber";
public static final String KEY_BRAND_SHARED = "brandShared";
public static final String SHARE_STOCK = "shareStock";
public static final String SHARE_ACCOUNTS = "shareAccounts";
public static final String FIREBASE_LOCATION_SHARED_ACCOUNT_WITH = "shareAccountWith";
public static final String KEY_ACCOUNT_SHARED = "accountShared";
/*
* Constants for Data Removal
* */
public static int REMOVAL_TAG = 1;
}
| [
"aks_agrawal275@yahoo.com"
] | aks_agrawal275@yahoo.com |
8a06e526059701a6f050624518e8a7f21b0c5f47 | bc275d3d0a932b0308b44241956065d364688d1e | /app/src/main/java/hiram/liverpool/model/Response.java | 1d84e5cab07c47a99563f7f48f604561c64005b6 | [] | no_license | hiramcastrod/liverpool | 6563d87ae47bf8cd69c51cf3cdf82dee140b9ee7 | 7e3bdefa34538722b51c588e2da502e934ccaada | refs/heads/master | 2020-09-06T19:59:25.194093 | 2019-11-08T19:52:03 | 2019-11-08T19:52:03 | 220,534,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package hiram.liverpool.model;
public class Response {
public Response() {
}
public PlpResults plpResults;
public PlpResults getPlpResults() {
return plpResults;
}
public void setPlpResults(PlpResults plpResults) {
this.plpResults = plpResults;
}
}
| [
"hiramc@live.com.mx"
] | hiramc@live.com.mx |
0e3e4b6a8ce2391ffd828185f1c27d987f7ca6cd | c9c97391809573b09abe30c7097abbd50a0fda71 | /app/src/main/java/chkksjpt/colomind/chkksjpt/utils/DialogHelper.java | a7f028e9a68bd164191552c08661ea605966d2e3 | [] | no_license | ColoMind/Chkksjpt | 32299e3645fb172584bddbea0da8bcb23ad86d30 | 59b2da34ebfa29fedf229996171abbdbc20a5ef3 | refs/heads/master | 2021-05-05T19:45:19.279724 | 2018-01-17T08:10:04 | 2018-01-17T08:10:04 | 117,798,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,485 | java | package chkksjpt.colomind.chkksjpt.utils;
import android.app.Activity;
import android.app.AlertDialog;
import android.view.View;
import android.view.ViewGroup;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;
import me.drakeet.materialdialog.MaterialDialog;
/**
* Created by Administrator on 2017/11/29.
*/
public class DialogHelper {
private ViewGroup mViewRoot;
private Activity mActivity;
private AlertDialog.Builder builder;
private View dialogView;
private TextView titleText;
private MultiAutoCompleteTextView showText;
private View.OnClickListener mNegativeListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
materialDialog.dismiss();
}
};
private MaterialDialog materialDialog;
public DialogHelper(Activity activity) {
mActivity = activity;
/*dialogView = LayoutInflater.from(mActivity).inflate(R.layout.simple_button_dialog, null);
titleText = dialogView.findViewById(R.id.dialog_title);
showText = dialogView.findViewById(R.id.dialog_message);
builder = new AlertDialog.Builder(mActivity);*/
}
/*public AlertDialog buildAlertDialog(CharSequence title, CharSequence message, DialogInterface.OnClickListener positiveListener, boolean cancelable, boolean selectable) {
titleText.setText(title);
if (message != null) {
showText.setText(message);
showText.setTextIsSelectable(selectable);
} else {
showText.setVisibility(View.GONE);
}
builder.setView(dialogView)
.setCancelable(cancelable);
if (positiveListener != null) {
builder.setPositiveButton("确定", positiveListener);
}
return builder.create();
}*/
public MaterialDialog buildMaterialDialog(CharSequence title, CharSequence message, boolean cancelable, View.OnClickListener positiveListener, View.OnClickListener negativeListener) {
materialDialog = new MaterialDialog(mActivity)
.setTitle(title)
.setMessage(message)
.setCanceledOnTouchOutside(cancelable);
if (negativeListener == null) {
materialDialog.setNegativeButton("取消", mNegativeListener);
} else {
materialDialog.setNegativeButton("取消", negativeListener);
}
if (positiveListener == null) {
materialDialog.setPositiveButton("确定", mNegativeListener);
} else {
materialDialog.setPositiveButton("确定", positiveListener);
}
materialDialog.show();
return materialDialog;
}
/*public MaterialDialog setButton() {
}*/
/*titleText.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (android.os.Build.VERSION.SDK_INT > 11) {
try {
ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText("Label", ((TextView) view).getText());
manager.setPrimaryClip(clipData);
} catch (NullPointerException e) {
e.printStackTrace();
}
}
return true;
}
});*/
}
| [
"colomindartist@163.com"
] | colomindartist@163.com |
8edff76daa444db84015ab53b77b3724787db94f | 20cd26d380fc7060c438cad2f86971c66ea5d707 | /src/com/codeshane/representing/providers/Rep.java | 397a114b7e60ff4157682383b66a4e51b3521f49 | [] | no_license | CodeShane/project-72 | f8c04c577aa76de7584f63915a2096afedf66bec | 6df01176238d01f76b8784031c41d3d74dce829d | refs/heads/master | 2020-03-30T11:14:40.934593 | 2013-09-05T22:20:05 | 2013-09-05T22:20:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,998 | java | /* RepItem is part of a CodeShane™ solution.
* Copyright © 2013 Shane Ian Robinson. All Rights Reserved.
* See LICENSE file or visit codeshane.com for more information. */
package com.codeshane.representing.providers;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.ContentValues;
import android.database.Cursor;
/** Data holder representing a Representative instance. Data can be populated
* manually, or by a cursor or JSONObject.
*
* @author Shane Ian Robinson <shane@codeshane.com>
* @since Aug 22, 2013
* @version 1 */
public class Rep {
public static final String TAG = Rep.class.getSimpleName();
public static final String[] PROJECTION = {"id", "name", "party", "district", "state", "office", "phone", "link"};
public long id;
public String name;
public String party;
public String district;
public String state;
public String office;
public String phone;
public String link;
public long updated;
public Rep ( long id, String name, String party, String district, String state, String office, String phone, String link, long updated ) {
this.id = -1;
this.name = name;
this.party = party;
this.district = district;
this.state = state;
this.office = office;
this.phone = phone;
this.link = link;
this.updated = updated;
}
/** Populates an existing (or new if param is null) RepItem instance with
* data from a {@code Cursor}.
*
* @return repItem (chainable)
* @see Cursor */
public static Rep update ( Rep repItem, Cursor c ) {
if (null == repItem) { return new Rep(
-1, c.getString(0), c.getString(1), c.getString(2),
c.getString(3), c.getString(4), c.getString(5), c.getString(6), c.getLong(7)); }
repItem.id = -1;
repItem.name = c.getString(0);
repItem.party = c.getString(1);
repItem.district = c.getString(2);
repItem.state = c.getString(3);
repItem.office = c.getString(4);
repItem.phone = c.getString(5);
repItem.link = c.getString(6);
repItem.updated = c.getLong(7);
return repItem;
}
/** Populates an existing (or new if param is null) RepItem instance with
* data from a Json array.
*
* @return repItem (chainable) */ // JSONObject can use .getString(name)
public static Rep update ( Rep repItem, JSONObject object ) {
if (null == repItem) { return new Rep(-1,
object.optString("name"), object.optString("party"), object.optString("district"),
object.optString("state"), object.optString("office"),
object.optString("phone"), object.optString("link"), object.optLong("updated"));
}
repItem.name = object.optString("name", "");
repItem.party = object.optString("party", "");
repItem.district = object.optString("district", "");
repItem.state = object.optString("state", "");
repItem.office = object.optString("office", "");
repItem.phone = object.optString("phone", "");
repItem.link = object.optString("link", "");
repItem.updated = object.optLong("updated", System.currentTimeMillis());
return repItem;
}
@Override public String toString () {
return "RepItem [id=" + id + ", name=" + name + ", district=" + district + ", state=" + state + ", office=" + office + ", party=" + party + ", phone="
+ phone + ", link=" + link + ", updated=" + updated + "]";
}
public JSONObject toJson() {
try {
return new JSONObject().put("id", id).put("name", name).put("party", party).put("district", district).put("state", state).put("office", office).put("phone", phone).put("link", link).put("updated", updated);
} catch (JSONException ex) {
throw new RuntimeException(ex);
}
}
public ContentValues toContentValues () {
ContentValues contentValues = new ContentValues();
contentValues.put("name", name);
contentValues.put("party", party);
contentValues.put("district", district);
contentValues.put("state", state);
contentValues.put("office", office);
contentValues.put("phone", phone);
contentValues.put("link", link);
contentValues.put("updated", updated);
return contentValues;
}
}
| [
"shane@codeshane.com"
] | shane@codeshane.com |
0af627f72fe31b6f9cd44e93c0faaaa79558a1d0 | 4e5cf7a8f599637b146746e098b2996ec81a12ba | /app/src/main/java/com/xtec/timeline/widget/NumberProgressBar.java | 7a1ee732649130504128340edb02362f694b3479 | [] | no_license | reyzarc/FastDevelopFrame | 7a9699a69fa91837fab647465f35cf72ecdb6011 | 8d367338d0d903f7d5143aaad2e44c003b2e77ce | refs/heads/master | 2021-01-18T19:35:33.576833 | 2018-11-05T07:02:48 | 2018-11-05T07:02:48 | 72,067,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,676 | java | package com.xtec.timeline.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class NumberProgressBar extends View {
/**
* 背景画笔
*/
private Paint mBgPaint;
/**
* 进度画笔
*/
private Paint mProgressPaint;
/**
* 文本画笔
*/
private Paint mTextPaint;
private int mTextSize = 22;
/**
* 进度条高度
*/
private int mProgressBarHeight = 10;
/**
* 背景颜色
*/
private int mBgColor = Color.rgb(204, 204, 204);
/**
* 进度条的颜色
*/
private int mProgressColor = Color.rgb(66, 145, 241);
/**
* 文本颜色
*/
private int mTextColor = Color.rgb(255, 0, 0);
/**
* 进度条进度
*/
private int mProgress = 40;
/**
* 最大进度,默认100
*/
private int mProgressMax = 100;
private int mRadius = 20;
private RectF mBgRect = new RectF(0, 0, 0, 0);
private RectF mProgressRect = new RectF(0, 0, 0, 0);
/**
* 背景是否已经绘制(确保背景只用绘制一次)
*/
private boolean isBgDrawn;
public NumberProgressBar(Context context) {
super(context);
init();
}
public NumberProgressBar(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
public NumberProgressBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBgPaint.setColor(mBgColor);
mTextPaint.setColor(mTextColor);
mProgressPaint.setColor(mProgressColor);
mTextPaint.setTextSize(mTextSize);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Log.e("reyzarc", 100 * 1.0f / 2 + "======?" + 100 / 2 * 1.0f);
drawProgress(canvas);
drawBackground(canvas);
drawProgressText(canvas);
}
/**
* 绘制进度文本
*
* @param canvas
*/
private void drawProgressText(final Canvas canvas) {
//文本的宽度
float textWidth = mTextPaint.measureText(mProgress + "%");
float maxX = Math.min(mProgressRect.right + 2.0f, mBgRect.right - textWidth);
float maxY = getHeight() / 2.0f - ((mTextPaint.ascent() + mTextPaint.descent()) / 2.0f);
if(mProgressRect.right+textWidth>=getWidth()-getPaddingRight()){
maxY -= 16;
}
canvas.drawText(mProgress + "%", maxX, maxY, mTextPaint);
}
/**
* 绘制进度背景
*
* @param canvas
*/
private void drawBackground(Canvas canvas) {
//文本的宽度
float textWidth = mTextPaint.measureText(mProgress + "%");
mBgRect.left = mProgressRect.right + textWidth;
//view设置的高度减去进度条的高度就是要画的矩形的top值
mBgRect.top = getHeight() / 2.0f - mProgressBarHeight / 2.0f;
mBgRect.right = getWidth() - getPaddingRight();
mBgRect.bottom = mBgRect.top + mProgressBarHeight;
if (mRadius == 0) {
canvas.drawRect(mBgRect, mBgPaint);
} else {
canvas.drawRoundRect(mBgRect, mRadius, mRadius, mBgPaint);
}
}
/**
* 绘制进度
*/
private void drawProgress(final Canvas canvas) {
mProgressRect.left = getPaddingLeft();
mProgressRect.top = getHeight() / 2.0f - mProgressBarHeight / 2.0f;
mProgressRect.right = (getWidth() - getPaddingRight()) * (mProgress * 1.0f / mProgressMax);
mProgressRect.bottom = mBgRect.top + mProgressBarHeight;
if (mRadius == 0) {
canvas.drawRect(mProgressRect, mProgressPaint);
} else {
canvas.drawRoundRect(mProgressRect, mRadius, mRadius, mProgressPaint);
}
}
public void setProgress(int progress) {
if (progress > mProgressMax) {
return;
}
mProgress = progress;
invalidate();
}
public void setProgressMax(int progressMax) {
mProgressMax = progressMax;
invalidate();
}
public void setRadius(int radius) {
mRadius = radius;
invalidate();
}
}
| [
"reyzarc@163.com"
] | reyzarc@163.com |
04a2c97c800ac18bc430cd80a7cc382fa0c9f670 | 0d01d622cf7f52fb955b28805bed90b45dfc4903 | /app/src/main/java/com/example/shaina/thesisproject/PermissionUtils.java | 01255142faad9abfc767f6ff2db4f5d0df3120e7 | [] | no_license | Meg3956/ThesisProject | 36319c58df6d47fca9786c6ebacc1dcdc988e96d | 332da17357f50e83b0bf9ee38c7a716c5704ae65 | refs/heads/master | 2020-12-30T14:00:15.122558 | 2017-06-05T02:12:55 | 2017-06-05T02:12:55 | 91,271,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,489 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* 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.example.shaina.thesisproject;
import android.Manifest;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;
/**
* Utility class for access to runtime permissions.
*/
public abstract class PermissionUtils {
/**
* Requests the fine location permission. If a rationale with an additional explanation should
* be shown to the user, displays a dialog that triggers the request.
*/
public static void requestPermission(FragmentActivity activity, int requestId,
String permission, boolean finishActivity) {
if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
// Display a dialog with rationale.
PermissionUtils.RationaleDialog.newInstance(requestId, finishActivity)
.show(activity.getSupportFragmentManager(), "dialog");
} else {
// Location permission has not been granted yet, request it.
ActivityCompat.requestPermissions(activity, new String[]{permission}, requestId);
}
}
/**
* Checks if the result contains a {@link PackageManager#PERMISSION_GRANTED} result for a
* permission from a runtime permissions request.
*
* @see android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback
*/
public static boolean isPermissionGranted(String[] grantPermissions, int[] grantResults,
String permission) {
for (int i = 0; i < grantPermissions.length; i++) {
if (permission.equals(grantPermissions[i])) {
return grantResults[i] == PackageManager.PERMISSION_GRANTED;
}
}
return false;
}
/**
* A dialog that displays a permission denied message.
*/
public static class PermissionDeniedDialog extends DialogFragment {
private static final String ARGUMENT_FINISH_ACTIVITY = "finish";
private boolean mFinishActivity = false;
/**
* Creates a new instance of this dialog and optionally finishes the calling Activity
* when the 'Ok' button is clicked.
*/
public static PermissionDeniedDialog newInstance(boolean finishActivity) {
Bundle arguments = new Bundle();
arguments.putBoolean(ARGUMENT_FINISH_ACTIVITY, finishActivity);
PermissionDeniedDialog dialog = new PermissionDeniedDialog();
dialog.setArguments(arguments);
return dialog;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mFinishActivity = getArguments().getBoolean(ARGUMENT_FINISH_ACTIVITY);
return new AlertDialog.Builder(getActivity())
.setMessage(R.string.location_permission_denied)
.setPositiveButton(android.R.string.ok, null)
.create();
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
if (mFinishActivity) {
Toast.makeText(getActivity(), R.string.permission_required_toast,
Toast.LENGTH_SHORT).show();
getActivity().finish();
}
}
}
/**
* A dialog that explains the use of the location permission and requests the necessary
* permission.
* <p>
* The activity should implement
* {@link android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback}
* to handle permit or denial of this permission request.
*/
public static class RationaleDialog extends DialogFragment {
private static final String ARGUMENT_PERMISSION_REQUEST_CODE = "requestCode";
private static final String ARGUMENT_FINISH_ACTIVITY = "finish";
private boolean mFinishActivity = false;
/**
* Creates a new instance of a dialog displaying the rationale for the use of the location
* permission.
* <p>
* The permission is requested after clicking 'ok'.
*
* @param requestCode Id of the request that is used to request the permission. It is
* returned to the
* {@link android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback}.
* @param finishActivity Whether the calling Activity should be finished if the dialog is
* cancelled.
*/
public static RationaleDialog newInstance(int requestCode, boolean finishActivity) {
Bundle arguments = new Bundle();
arguments.putInt(ARGUMENT_PERMISSION_REQUEST_CODE, requestCode);
arguments.putBoolean(ARGUMENT_FINISH_ACTIVITY, finishActivity);
RationaleDialog dialog = new RationaleDialog();
dialog.setArguments(arguments);
return dialog;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle arguments = getArguments();
final int requestCode = arguments.getInt(ARGUMENT_PERMISSION_REQUEST_CODE);
mFinishActivity = arguments.getBoolean(ARGUMENT_FINISH_ACTIVITY);
return new AlertDialog.Builder(getActivity())
.setMessage(R.string.permission_rationale_location)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// After click on Ok, request the permission.
ActivityCompat.requestPermissions(getActivity(),
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
requestCode);
// Do not finish the Activity while requesting permission.
mFinishActivity = false;
}
})
.setNegativeButton(android.R.string.cancel, null)
.create();
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
if (mFinishActivity) {
Toast.makeText(getActivity(),
R.string.permission_required_toast,
Toast.LENGTH_SHORT)
.show();
getActivity().finish();
}
}
}
} | [
"shaina.hirschman@gmail.com"
] | shaina.hirschman@gmail.com |
1674721bbb8c158d9db524012013c7d0053b27d5 | f321db1ace514d08219cc9ba5089ebcfff13c87a | /generated-tests/dynamosa/tests/s1003/27_math/evosuite-tests/org/apache/commons/math3/ode/MultistepIntegrator_ESTest.java | 03cb48731a3bcc4658670000d27c4f6ede7ccf9b | [] | no_license | sealuzh/dynamic-performance-replication | 01bd512bde9d591ea9afa326968b35123aec6d78 | f89b4dd1143de282cd590311f0315f59c9c7143a | refs/heads/master | 2021-07-12T06:09:46.990436 | 2020-06-05T09:44:56 | 2020-06-05T09:44:56 | 146,285,168 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 13,040 | java | /*
* This file was automatically generated by EvoSuite
* Wed Jul 03 00:52:17 GMT 2019
*/
package org.apache.commons.math3.ode;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.math3.ode.ExpandableStatefulODE;
import org.apache.commons.math3.ode.FirstOrderConverter;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
import org.apache.commons.math3.ode.ODEIntegrator;
import org.apache.commons.math3.ode.SecondOrderDifferentialEquations;
import org.apache.commons.math3.ode.SecondaryEquations;
import org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator;
import org.apache.commons.math3.ode.nonstiff.AdamsMoultonIntegrator;
import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
import org.apache.commons.math3.ode.nonstiff.ThreeEighthesIntegrator;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class MultistepIntegrator_ESTest extends MultistepIntegrator_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
SecondOrderDifferentialEquations secondOrderDifferentialEquations0 = mock(SecondOrderDifferentialEquations.class, new ViolatedAssumptionAnswer());
doReturn(0).when(secondOrderDifferentialEquations0).getDimension();
FirstOrderConverter firstOrderConverter0 = new FirstOrderConverter(secondOrderDifferentialEquations0);
ExpandableStatefulODE expandableStatefulODE0 = new ExpandableStatefulODE(firstOrderConverter0);
expandableStatefulODE0.setTime(0.0);
// Undeclared exception!
try {
adamsBashforthIntegrator0.integrate(expandableStatefulODE0, 5.237807655758373E-100);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator", e);
}
}
@Test(timeout = 4000)
public void test01() throws Throwable {
double[] doubleArray0 = new double[1];
AdamsMoultonIntegrator adamsMoultonIntegrator0 = new AdamsMoultonIntegrator(1, 0.0, 358.41683239, doubleArray0, doubleArray0);
DormandPrince853Integrator dormandPrince853Integrator0 = (DormandPrince853Integrator)adamsMoultonIntegrator0.getStarterIntegrator();
assertEquals(0.2, adamsMoultonIntegrator0.getMinReduction(), 0.01);
assertEquals(1.4142135623730951, adamsMoultonIntegrator0.getMaxGrowth(), 0.01);
assertEquals(0.0, dormandPrince853Integrator0.getMinStep(), 0.01);
assertEquals(358.41683239, dormandPrince853Integrator0.getMaxStep(), 0.01);
assertEquals(0.9, adamsMoultonIntegrator0.getSafety(), 0.01);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(5, (-1.0), (-1.0), 1.0686607360839844, 1511.25581);
adamsBashforthIntegrator0.setMaxGrowth((-1016.86562));
double double0 = adamsBashforthIntegrator0.getMaxGrowth();
assertEquals((-1016.86562), double0, 0.01);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
adamsBashforthIntegrator0.setStarterIntegrator((FirstOrderIntegrator) null);
adamsBashforthIntegrator0.getStarterIntegrator();
assertEquals(0.9, adamsBashforthIntegrator0.getSafety(), 0.01);
assertEquals(1.1040895136738123, adamsBashforthIntegrator0.getMaxGrowth(), 0.01);
assertEquals(0.2, adamsBashforthIntegrator0.getMinReduction(), 0.01);
}
@Test(timeout = 4000)
public void test04() throws Throwable {
double[] doubleArray0 = new double[5];
AdamsMoultonIntegrator adamsMoultonIntegrator0 = new AdamsMoultonIntegrator(1, 2.053884626293416E-85, (-2357.6194), doubleArray0, doubleArray0);
DormandPrince853Integrator dormandPrince853Integrator0 = new DormandPrince853Integrator(0.9, 0.0, doubleArray0, doubleArray0);
adamsMoultonIntegrator0.setStarterIntegrator(dormandPrince853Integrator0);
assertEquals(0.2, adamsMoultonIntegrator0.getMinReduction(), 0.01);
assertEquals(0.9, adamsMoultonIntegrator0.getSafety(), 0.01);
assertEquals(1.4142135623730951, adamsMoultonIntegrator0.getMaxGrowth(), 0.01);
}
@Test(timeout = 4000)
public void test05() throws Throwable {
double[] doubleArray0 = new double[1];
AdamsMoultonIntegrator adamsMoultonIntegrator0 = new AdamsMoultonIntegrator(1, 0.0, 358.41683239, doubleArray0, doubleArray0);
assertEquals(0.9, adamsMoultonIntegrator0.getSafety(), 0.01);
adamsMoultonIntegrator0.setSafety(0.0);
double double0 = adamsMoultonIntegrator0.getSafety();
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test06() throws Throwable {
double[] doubleArray0 = new double[2];
AdamsMoultonIntegrator adamsMoultonIntegrator0 = new AdamsMoultonIntegrator(1, (-1852), 0.0, doubleArray0, doubleArray0);
adamsMoultonIntegrator0.setMinReduction(1630.348671192);
assertEquals(1630.348671192, adamsMoultonIntegrator0.getMinReduction(), 0.01);
}
@Test(timeout = 4000)
public void test07() throws Throwable {
AdamsMoultonIntegrator adamsMoultonIntegrator0 = new AdamsMoultonIntegrator(3, 3, 3, 3, 3);
adamsMoultonIntegrator0.setMinReduction((-582.827));
double double0 = adamsMoultonIntegrator0.getMinReduction();
assertEquals((-582.827), double0, 0.01);
}
@Test(timeout = 4000)
public void test08() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
assertEquals(1.1040895136738123, adamsBashforthIntegrator0.getMaxGrowth(), 0.01);
adamsBashforthIntegrator0.setMaxGrowth(0.0);
double double0 = adamsBashforthIntegrator0.getMaxGrowth();
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test09() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
adamsBashforthIntegrator0.setMaxGrowth(663.330273);
assertEquals(663.330273, adamsBashforthIntegrator0.getMaxGrowth(), 0.01);
}
@Test(timeout = 4000)
public void test10() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(2, (-6.508966857277253E-9), 0.0, (-1.0), 0.0);
adamsBashforthIntegrator0.setSafety(2);
assertEquals(2.0, adamsBashforthIntegrator0.getSafety(), 0.01);
}
@Test(timeout = 4000)
public void test11() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
assertEquals(0.2, adamsBashforthIntegrator0.getMinReduction(), 0.01);
adamsBashforthIntegrator0.setMinReduction(0.0);
double double0 = adamsBashforthIntegrator0.getMinReduction();
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test12() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
SecondOrderDifferentialEquations secondOrderDifferentialEquations0 = mock(SecondOrderDifferentialEquations.class, new ViolatedAssumptionAnswer());
doReturn(0).when(secondOrderDifferentialEquations0).getDimension();
FirstOrderConverter firstOrderConverter0 = new FirstOrderConverter(secondOrderDifferentialEquations0);
ExpandableStatefulODE expandableStatefulODE0 = new ExpandableStatefulODE(firstOrderConverter0);
SecondaryEquations secondaryEquations0 = mock(SecondaryEquations.class, new ViolatedAssumptionAnswer());
doReturn(0).when(secondaryEquations0).getDimension();
expandableStatefulODE0.addSecondaryEquations(secondaryEquations0);
// Undeclared exception!
try {
adamsBashforthIntegrator0.integrate(expandableStatefulODE0, (double) 7);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// matrix must have at least one column
//
verifyException("org.apache.commons.math3.linear.Array2DRowRealMatrix", e);
}
}
@Test(timeout = 4000)
public void test13() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = null;
try {
adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(1, 1, 1, 1, 1);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// multistep method needs at least 1 previous steps, got 2
//
verifyException("org.apache.commons.math3.ode.MultistepIntegrator", e);
}
}
@Test(timeout = 4000)
public void test14() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
ThreeEighthesIntegrator threeEighthesIntegrator0 = new ThreeEighthesIntegrator(7);
adamsBashforthIntegrator0.setStarterIntegrator(threeEighthesIntegrator0);
assertEquals(0.9, adamsBashforthIntegrator0.getSafety(), 0.01);
assertEquals(0.2, adamsBashforthIntegrator0.getMinReduction(), 0.01);
assertEquals(1.1040895136738123, adamsBashforthIntegrator0.getMaxGrowth(), 0.01);
}
@Test(timeout = 4000)
public void test15() throws Throwable {
double[] doubleArray0 = new double[4];
AdamsMoultonIntegrator adamsMoultonIntegrator0 = new AdamsMoultonIntegrator(1, 0.9, 2.0, doubleArray0, doubleArray0);
assertEquals(0.9, adamsMoultonIntegrator0.getSafety(), 0.01);
adamsMoultonIntegrator0.setSafety((-1.0));
double double0 = adamsMoultonIntegrator0.getSafety();
assertEquals((-1.0), double0, 0.01);
}
@Test(timeout = 4000)
public void test16() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
double double0 = adamsBashforthIntegrator0.getSafety();
assertEquals(0.9, double0, 0.01);
assertEquals(0.2, adamsBashforthIntegrator0.getMinReduction(), 0.01);
assertEquals(1.1040895136738123, adamsBashforthIntegrator0.getMaxGrowth(), 0.01);
}
@Test(timeout = 4000)
public void test17() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(4, 4, 4, 4, 4);
double double0 = adamsBashforthIntegrator0.getMinReduction();
assertEquals(0.2, double0, 0.01);
assertEquals(0.9, adamsBashforthIntegrator0.getSafety(), 0.01);
assertEquals(1.189207115002721, adamsBashforthIntegrator0.getMaxGrowth(), 0.01);
}
@Test(timeout = 4000)
public void test18() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
double double0 = adamsBashforthIntegrator0.getMaxGrowth();
assertEquals(1.1040895136738123, double0, 0.01);
assertEquals(0.2, adamsBashforthIntegrator0.getMinReduction(), 0.01);
assertEquals(0.9, adamsBashforthIntegrator0.getSafety(), 0.01);
}
@Test(timeout = 4000)
public void test19() throws Throwable {
AdamsBashforthIntegrator adamsBashforthIntegrator0 = new AdamsBashforthIntegrator(7, 7, 7, 7, 7);
SecondOrderDifferentialEquations secondOrderDifferentialEquations0 = mock(SecondOrderDifferentialEquations.class, new ViolatedAssumptionAnswer());
doReturn(7).when(secondOrderDifferentialEquations0).getDimension();
FirstOrderConverter firstOrderConverter0 = new FirstOrderConverter(secondOrderDifferentialEquations0);
ExpandableStatefulODE expandableStatefulODE0 = new ExpandableStatefulODE(firstOrderConverter0);
// Undeclared exception!
adamsBashforthIntegrator0.integrate(expandableStatefulODE0, (double) 7);
}
@Test(timeout = 4000)
public void test20() throws Throwable {
AdamsMoultonIntegrator adamsMoultonIntegrator0 = new AdamsMoultonIntegrator(2, 2, 2, 2, 2);
ODEIntegrator oDEIntegrator0 = adamsMoultonIntegrator0.getStarterIntegrator();
assertEquals(1.2599210498948732, adamsMoultonIntegrator0.getMaxGrowth(), 0.01);
assertEquals(0.2, adamsMoultonIntegrator0.getMinReduction(), 0.01);
assertEquals(0.9, adamsMoultonIntegrator0.getSafety(), 0.01);
assertEquals(2.0, oDEIntegrator0.getCurrentSignedStepsize(), 0.01);
}
}
| [
"granogiovanni90@gmail.com"
] | granogiovanni90@gmail.com |
5ffd3582c671391535d23bff0b4bed6fbeb37e0b | 748e42a9db349b583257f1351f12d80d4fbb104e | /streams/src/eu/rtakacs/stream/oo/observer/Guardian.java | 7f45aad600adfb67c83497e877b7f30dfb93b4e1 | [
"Apache-2.0"
] | permissive | rtkcs/java-8 | fb083ebe4791fd09110e31e84226ecfcde4fca3b | bb82242486f7d0d7a8128f6ec65343d0e2b510c7 | refs/heads/master | 2018-10-19T18:35:49.221816 | 2018-09-18T08:32:26 | 2018-09-18T08:32:26 | 118,050,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package eu.rtakacs.stream.oo.observer;
public class Guardian implements Observer {
@Override
public void notify(String tweet) {
if(tweet!=null && tweet.contains("queen")) {
System.out.println("Yet another news in London: " + tweet);
}
}
}
| [
"robino13@gmail.com"
] | robino13@gmail.com |
b1af9a983691ccff11a5a2ee571349262a822f09 | bb67511bec8421fd2ecf0d281ef4113923c8873b | /src/main/java/com/flurry/sdk/hi.java | 0e2a27e83ffab28990a0cd49f58865369ff061c6 | [] | no_license | TaintBench/hummingbad_android_samp | 5b5183737d92948fb2def5b70af8f008bf94e364 | b7ce27e2a9f2977c11ba57144c639fa5c55dbcb5 | refs/heads/master | 2021-07-21T19:35:45.570627 | 2021-07-16T11:38:49 | 2021-07-16T11:38:49 | 234,354,957 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,898 | java | package com.flurry.sdk;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class hi {
private static final String c = hi.class.getSimpleName();
private static hi d;
public final Map a = new HashMap();
public hx b;
private final Set e;
private hm f = hm.NONE;
private String g;
private byte[] h;
private hi() {
HashSet hashSet = new HashSet();
hashSet.add("null");
hashSet.add("9774d56d682e549c");
hashSet.add("dead00beef");
this.e = Collections.unmodifiableSet(hashSet);
hz.a.b(new hj(this));
}
public static synchronized hi a() {
hi hiVar;
synchronized (hi.class) {
if (d == null) {
d = new hi();
}
hiVar = d;
}
return hiVar;
}
/* JADX WARNING: Removed duplicated region for block: B:34:0x00c5 A:{Catch:{ Exception -> 0x0054 }} */
/* JADX WARNING: Removed duplicated region for block: B:29:0x00b8 A:{Catch:{ Exception -> 0x0054 }} */
/* JADX WARNING: Removed duplicated region for block: B:35:0x00d5 A:{Catch:{ Exception -> 0x0054 }} */
static /* synthetic */ void a(com.flurry.sdk.hi r8) {
/*
r6 = 37;
L_0x0002:
r0 = com.flurry.sdk.hm.FINISHED;
r1 = r8.f;
r0 = r0.equals(r1);
if (r0 != 0) goto L_0x0198;
L_0x000c:
r0 = com.flurry.sdk.hl.a;
r1 = r8.f;
r1 = r1.ordinal();
r0 = r0[r1];
switch(r0) {
case 1: goto L_0x0077;
case 2: goto L_0x007c;
case 3: goto L_0x0081;
case 4: goto L_0x0086;
case 5: goto L_0x008b;
default: goto L_0x0019;
};
L_0x0019:
r0 = com.flurry.sdk.hl.a; Catch:{ Exception -> 0x0054 }
r1 = r8.f; Catch:{ Exception -> 0x0054 }
r1 = r1.ordinal(); Catch:{ Exception -> 0x0054 }
r0 = r0[r1]; Catch:{ Exception -> 0x0054 }
switch(r0) {
case 2: goto L_0x0027;
case 3: goto L_0x0090;
case 4: goto L_0x0134;
case 5: goto L_0x0193;
default: goto L_0x0026;
}; Catch:{ Exception -> 0x0054 }
L_0x0026:
goto L_0x0002;
L_0x0027:
com.flurry.sdk.lt.b(); Catch:{ Exception -> 0x0054 }
r0 = com.flurry.sdk.hz.a; Catch:{ Exception -> 0x0054 }
r0 = r0.b; Catch:{ Exception -> 0x0054 }
r0 = com.flurry.sdk.lu.a(r0); Catch:{ Exception -> 0x0054 }
if (r0 == 0) goto L_0x0002;
L_0x0034:
r0 = com.flurry.sdk.hz.a; Catch:{ Exception -> 0x0054 }
r0 = r0.b; Catch:{ Exception -> 0x0054 }
r0 = com.flurry.sdk.lu.b(r0); Catch:{ Exception -> 0x0054 }
r8.b = r0; Catch:{ Exception -> 0x0054 }
r0 = r8.b(); Catch:{ Exception -> 0x0054 }
if (r0 == 0) goto L_0x0002;
L_0x0044:
r8.e(); Catch:{ Exception -> 0x0054 }
r0 = new com.flurry.sdk.ho; Catch:{ Exception -> 0x0054 }
r0.m3436init(); Catch:{ Exception -> 0x0054 }
r1 = com.flurry.sdk.il.a(); Catch:{ Exception -> 0x0054 }
r1.a(r0); Catch:{ Exception -> 0x0054 }
goto L_0x0002;
L_0x0054:
r0 = move-exception;
r1 = 4;
r2 = c;
r3 = new java.lang.StringBuilder;
r4 = "Exception during id fetch:";
r3.<init>(r4);
r4 = r8.f;
r3 = r3.append(r4);
r4 = ", ";
r3 = r3.append(r4);
r0 = r3.append(r0);
r0 = r0.toString();
com.flurry.sdk.iw.a(r1, r2, r0);
goto L_0x0002;
L_0x0077:
r0 = com.flurry.sdk.hm.ADVERTISING;
r8.f = r0;
goto L_0x0019;
L_0x007c:
r0 = com.flurry.sdk.hm.DEVICE;
r8.f = r0;
goto L_0x0019;
L_0x0081:
r0 = com.flurry.sdk.hm.HASHED_IMEI;
r8.f = r0;
goto L_0x0019;
L_0x0086:
r0 = com.flurry.sdk.hm.REPORTED_IDS;
r8.f = r0;
goto L_0x0019;
L_0x008b:
r0 = com.flurry.sdk.hm.FINISHED;
r8.f = r0;
goto L_0x0019;
L_0x0090:
com.flurry.sdk.lt.b(); Catch:{ Exception -> 0x0054 }
r0 = com.flurry.sdk.hz.a; Catch:{ Exception -> 0x0054 }
r0 = r0.b; Catch:{ Exception -> 0x0054 }
r0 = r0.getContentResolver(); Catch:{ Exception -> 0x0054 }
r1 = "android_id";
r1 = android.provider.Settings.Secure.getString(r0, r1); Catch:{ Exception -> 0x0054 }
r0 = android.text.TextUtils.isEmpty(r1); Catch:{ Exception -> 0x0054 }
if (r0 != 0) goto L_0x00c3;
L_0x00a7:
r0 = java.util.Locale.US; Catch:{ Exception -> 0x0054 }
r0 = r1.toLowerCase(r0); Catch:{ Exception -> 0x0054 }
r2 = r8.e; Catch:{ Exception -> 0x0054 }
r0 = r2.contains(r0); Catch:{ Exception -> 0x0054 }
if (r0 != 0) goto L_0x00c3;
L_0x00b5:
r0 = 1;
L_0x00b6:
if (r0 != 0) goto L_0x00c5;
L_0x00b8:
r0 = 0;
L_0x00b9:
r1 = android.text.TextUtils.isEmpty(r0); Catch:{ Exception -> 0x0054 }
if (r1 != 0) goto L_0x00d5;
L_0x00bf:
r8.g = r0; Catch:{ Exception -> 0x0054 }
goto L_0x0002;
L_0x00c3:
r0 = 0;
goto L_0x00b6;
L_0x00c5:
r0 = new java.lang.StringBuilder; Catch:{ Exception -> 0x0054 }
r2 = "AND";
r0.<init>(r2); Catch:{ Exception -> 0x0054 }
r0 = r0.append(r1); Catch:{ Exception -> 0x0054 }
r0 = r0.toString(); Catch:{ Exception -> 0x0054 }
goto L_0x00b9;
L_0x00d5:
r0 = c(); Catch:{ Exception -> 0x0054 }
r1 = android.text.TextUtils.isEmpty(r0); Catch:{ Exception -> 0x0054 }
if (r1 == 0) goto L_0x00bf;
L_0x00df:
r0 = r8.d(); Catch:{ Exception -> 0x0054 }
r1 = android.text.TextUtils.isEmpty(r0); Catch:{ Exception -> 0x0054 }
if (r1 == 0) goto L_0x011a;
L_0x00e9:
r0 = java.lang.Math.random(); Catch:{ Exception -> 0x0054 }
r0 = java.lang.Double.doubleToLongBits(r0); Catch:{ Exception -> 0x0054 }
r2 = java.lang.System.nanoTime(); Catch:{ Exception -> 0x0054 }
r4 = com.flurry.sdk.hz.a; Catch:{ Exception -> 0x0054 }
r4 = r4.b; Catch:{ Exception -> 0x0054 }
r4 = com.flurry.sdk.lq.a(r4); Catch:{ Exception -> 0x0054 }
r4 = com.flurry.sdk.lt.f(r4); Catch:{ Exception -> 0x0054 }
r4 = r4 * r6;
r2 = r2 + r4;
r2 = r2 * r6;
r0 = r0 + r2;
r2 = new java.lang.StringBuilder; Catch:{ Exception -> 0x0054 }
r3 = "ID";
r2.<init>(r3); Catch:{ Exception -> 0x0054 }
r3 = 16;
r0 = java.lang.Long.toString(r0, r3); Catch:{ Exception -> 0x0054 }
r0 = r2.append(r0); Catch:{ Exception -> 0x0054 }
r0 = r0.toString(); Catch:{ Exception -> 0x0054 }
L_0x011a:
r1 = android.text.TextUtils.isEmpty(r0); Catch:{ Exception -> 0x0054 }
if (r1 != 0) goto L_0x00bf;
L_0x0120:
r1 = com.flurry.sdk.hz.a; Catch:{ Exception -> 0x0054 }
r1 = r1.b; Catch:{ Exception -> 0x0054 }
r2 = ".flurryb.";
r1 = r1.getFileStreamPath(r2); Catch:{ Exception -> 0x0054 }
r2 = com.flurry.sdk.ls.a(r1); Catch:{ Exception -> 0x0054 }
if (r2 == 0) goto L_0x00bf;
L_0x0130:
a(r0, r1); Catch:{ Exception -> 0x0054 }
goto L_0x00bf;
L_0x0134:
r0 = com.flurry.sdk.hz.a; Catch:{ Exception -> 0x0054 }
r0 = r0.b; Catch:{ Exception -> 0x0054 }
r1 = "android.permission.READ_PHONE_STATE";
r0 = r0.checkCallingOrSelfPermission(r1); Catch:{ Exception -> 0x0054 }
if (r0 != 0) goto L_0x0002;
L_0x0140:
r0 = com.flurry.sdk.hz.a; Catch:{ Exception -> 0x0054 }
r0 = r0.b; Catch:{ Exception -> 0x0054 }
r1 = "phone";
r0 = r0.getSystemService(r1); Catch:{ Exception -> 0x0054 }
r0 = (android.telephony.TelephonyManager) r0; Catch:{ Exception -> 0x0054 }
if (r0 == 0) goto L_0x0002;
L_0x014e:
r0 = r0.getDeviceId(); Catch:{ Exception -> 0x0054 }
if (r0 == 0) goto L_0x0002;
L_0x0154:
r1 = r0.trim(); Catch:{ Exception -> 0x0054 }
r1 = r1.length(); Catch:{ Exception -> 0x0054 }
if (r1 <= 0) goto L_0x0002;
L_0x015e:
r0 = com.flurry.sdk.lt.d(r0); Catch:{ Exception -> 0x016d }
if (r0 == 0) goto L_0x0178;
L_0x0164:
r1 = r0.length; Catch:{ Exception -> 0x016d }
r2 = 20;
if (r1 != r2) goto L_0x0178;
L_0x0169:
r8.h = r0; Catch:{ Exception -> 0x016d }
goto L_0x0002;
L_0x016d:
r0 = move-exception;
r0 = 6;
r1 = c; Catch:{ Exception -> 0x0054 }
r2 = "Exception in generateHashedImei()";
com.flurry.sdk.iw.a(r0, r1, r2); Catch:{ Exception -> 0x0054 }
goto L_0x0002;
L_0x0178:
r1 = 6;
r2 = c; Catch:{ Exception -> 0x016d }
r3 = new java.lang.StringBuilder; Catch:{ Exception -> 0x016d }
r4 = "sha1 is not 20 bytes long: ";
r3.<init>(r4); Catch:{ Exception -> 0x016d }
r0 = java.util.Arrays.toString(r0); Catch:{ Exception -> 0x016d }
r0 = r3.append(r0); Catch:{ Exception -> 0x016d }
r0 = r0.toString(); Catch:{ Exception -> 0x016d }
com.flurry.sdk.iw.a(r1, r2, r0); Catch:{ Exception -> 0x016d }
goto L_0x0002;
L_0x0193:
r8.e(); Catch:{ Exception -> 0x0054 }
goto L_0x0002;
L_0x0198:
r0 = new com.flurry.sdk.hn;
r0.m3435init();
r1 = com.flurry.sdk.il.a();
r1.a(r0);
return;
*/
throw new UnsupportedOperationException("Method not decompiled: com.flurry.sdk.hi.a(com.flurry.sdk.hi):void");
}
private static void a(String str, File file) {
Throwable th;
Closeable dataOutputStream;
try {
dataOutputStream = new DataOutputStream(new FileOutputStream(file));
try {
dataOutputStream.writeInt(1);
dataOutputStream.writeUTF(str);
lt.a(dataOutputStream);
} catch (Throwable th2) {
th = th2;
try {
iw.a(6, c, "Error when saving deviceId", th);
lt.a(dataOutputStream);
} catch (Throwable th3) {
th = th3;
lt.a(dataOutputStream);
throw th;
}
}
} catch (Throwable th4) {
th = th4;
dataOutputStream = null;
lt.a(dataOutputStream);
throw th;
}
}
private static String c() {
Throwable th;
Throwable th2;
String str = null;
File fileStreamPath = hz.a.b.getFileStreamPath(".flurryb.");
if (fileStreamPath != null && fileStreamPath.exists()) {
Closeable dataInputStream;
try {
dataInputStream = new DataInputStream(new FileInputStream(fileStreamPath));
try {
if (1 == dataInputStream.readInt()) {
str = dataInputStream.readUTF();
}
lt.a(dataInputStream);
} catch (Throwable th3) {
th = th3;
}
} catch (Throwable th4) {
dataInputStream = str;
th2 = th4;
lt.a(dataInputStream);
throw th2;
}
}
return str;
}
private String d() {
Throwable th;
Throwable th2;
String str = null;
File filesDir = hz.a.b.getFilesDir();
if (filesDir != null) {
String[] list = filesDir.list(new hk(this));
if (!(list == null || list.length == 0)) {
filesDir = hz.a.b.getFileStreamPath(list[0]);
if (filesDir != null && filesDir.exists()) {
Closeable dataInputStream;
try {
dataInputStream = new DataInputStream(new FileInputStream(filesDir));
try {
if (46586 == dataInputStream.readUnsignedShort()) {
if (2 == dataInputStream.readUnsignedShort()) {
dataInputStream.readUTF();
str = dataInputStream.readUTF();
}
}
lt.a(dataInputStream);
} catch (Throwable th3) {
th = th3;
}
} catch (Throwable th4) {
dataInputStream = null;
th2 = th4;
lt.a(dataInputStream);
throw th2;
}
}
}
}
return str;
}
private void e() {
String str = this.b == null ? null : this.b.a;
if (str != null) {
iw.a(3, c, "Fetched advertising id");
this.a.put(hv.AndroidAdvertisingId, lt.c(str));
}
str = this.g;
if (str != null) {
iw.a(3, c, "Fetched device id");
this.a.put(hv.DeviceId, lt.c(str));
}
byte[] bArr = this.h;
if (bArr != null) {
iw.a(3, c, "Fetched hashed IMEI");
this.a.put(hv.Sha1Imei, bArr);
}
}
public final boolean b() {
return hm.FINISHED.equals(this.f);
}
}
| [
"malwareanalyst1@gmail.com"
] | malwareanalyst1@gmail.com |
29bcbba946d07067492d329a9e415276cb66e94d | eeabebb1700f8a2b9e8a1d34eb25e8dc9209d115 | /Buoi5/src/com/t3h/mangdong/MangDong.java | 411d6964341c351c59e72a6c484d7ebb2962c98a | [] | no_license | bacnv1/landt1902e | 1adc183eda9db1dd21c4be9f81568bde5177dfd8 | 51245e86afc30e54b213006fbd4c2397d52634e7 | refs/heads/master | 2020-04-28T00:20:44.626682 | 2019-09-27T13:30:51 | 2019-09-27T13:30:51 | 174,812,414 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | package com.t3h.mangdong;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class MangDong {
private ArrayList<Integer> arr = new ArrayList<>();
public void inMang() {
for (int i = 0; i < arr.size(); i++) {
System.out.print(arr.get(i) + "\t");
}
System.out.println();
}
public void add(Integer value){
arr.add(value);
}
public void add(int index, Integer value){
arr.add(index, value);
}
public void addAll(ArrayList<Integer> arr){
this.arr.addAll(arr);
}
public void addAll(int index, ArrayList<Integer> arr){
this.arr.addAll(index, arr);
}
public void set(int index, Integer value){
arr.set(index, value);
}
public void remove(int index){
arr.remove(index);
}
public void clear(){
arr.clear();
}
public boolean contains(Integer value){
return arr.contains(value);
}
public boolean containsAll(ArrayList<Integer> arr){
return this.arr.containsAll(arr);
}
public void sort(){
arr.sort(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (o1 < o2){
return -1;
}
return 0;
}
});
}
public void shuffle(){
Collections.shuffle(arr);
}
}
| [
"dathalongbay@gmail.com"
] | dathalongbay@gmail.com |
5fd23a79c4cbadb170036e8a866046b675f0e70a | 142eef86056d6a62dde1d27733ff34e0ecdf6e8f | /InventoryManager_RPC_Gilead_M_1.01/src/com/aeryinnovations/shared/coredomain/EquipmentRegister.java | 362815a9513513800de6d230db4772c2e9620707 | [] | no_license | olamideokunola/inventory-gwt | b7bd7971cd2b40ca11836e0a7e513808e8426c8e | ec158848dca31558e8d8af12b0064bac1ad86857 | refs/heads/master | 2020-03-09T16:32:54.088275 | 2018-04-10T06:47:33 | 2018-04-10T06:47:33 | 128,887,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,772 | java | package com.aeryinnovations.shared.coredomain;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import com.aeryinnovations.shared.JPAUtil;
public class EquipmentRegister
{
//fields
private EquipmentSpecification equipmentSpecification;
private List<EquipmentSpecification> equipmentSpecifications;
//private EntityManager em = JPAUtil.getEntityManagerFactory().createEntityManager();
//constructor
public EquipmentRegister(){
this.equipmentSpecification=null;
this.equipmentSpecifications = new ArrayList<EquipmentSpecification>();
loadEquipmentSpecifications();
this.equipmentSpecification = new EquipmentSpecification();
}
//methods
public void loadEquipmentSpecifications(){
EquipmentSpecification equipSpec;
equipSpec = new EquipmentSpecification("eq01", "Equipment 01", "EquipmentType 01", "manufacturer01", "pn001", "10");
this.equipmentSpecifications.add(equipSpec);
equipSpec = new EquipmentSpecification("eq02", "Equipment 02", "EquipmentType 01", "manufacturer01", "pn002", "20");
this.equipmentSpecifications.add(equipSpec);
}
public EquipmentSpecification findEquipmentSpecification(String equipmentSpecificationId){
EquipmentSpecification equipmentSpec = new EquipmentSpecification();
for (EquipmentSpecification eqSpec : equipmentSpecifications) {
if (equipmentSpecificationId.equals(eqSpec.getEquipmentSpecificationId())) {
equipmentSpec = eqSpec;
}
}
return equipmentSpec;
}
//getter methods
public EquipmentSpecification getEquipmentSpecification() {
return equipmentSpecification;
}
public List<EquipmentSpecification> getEquipmentSpecifications(){
return equipmentSpecifications;
}
}
| [
"olamide.okunola@yahoo.com"
] | olamide.okunola@yahoo.com |
2b9149264343dc15b25bd2b0b2477315fba47efb | e58ef389d935e356b53113c9ae2373e667c10949 | /server/GameState/Meeple.java | 3d066dad881ef644ac803c3bf00e69beb9b539af | [] | no_license | rickydtran/TigerZone | 81bcff8001aa65bf84057960e4c64df34033e421 | 52aa11747165ba2e8bcaf741bb41d1635434a07d | refs/heads/master | 2021-05-01T19:45:04.579519 | 2016-12-02T21:29:28 | 2016-12-02T21:29:28 | 73,145,718 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 194 | java | package GameState;
public class Meeple {
private final Player owner;
public Meeple(Player owner) {
this.owner = owner;
}
public Player getOwner() {
return this.owner;
}
} | [
"rickydtran@ufl.edu"
] | rickydtran@ufl.edu |
60aa84dfdc3359ce6022e6d73734b84771803a72 | 80279fe831770c2ce2251b44830e82f8122e60e4 | /src/command/CommandPatternDemo.java | 8e2a9de028c32325317488619424e2e06749b4a1 | [] | no_license | ssskming/pattern | 1f9af3bd269a8485bf258d9c376198031e7c7b32 | bac73ff89f24158114adbf515244ef805417aae2 | refs/heads/master | 2020-04-22T11:17:02.176445 | 2019-02-28T14:24:50 | 2019-02-28T14:24:50 | 170,334,158 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 418 | java | package command;
//使用 Broker 类来接受并执行命令。
public class CommandPatternDemo {
public static void main(String[] args) {
Stock abcStock = new Stock();
BuyStock buyStockOrder = new BuyStock(abcStock);
SellStock sellStockOrder = new SellStock(abcStock);
Broker broker = new Broker();
broker.takeOrder(buyStockOrder);
broker.takeOrder(sellStockOrder);
broker.placeOrder();
}
}
| [
"ssskming@126.com"
] | ssskming@126.com |
f6d1962f3be59d8a68f43833038a7bb3c2ca1ec8 | 158fb18219dc9044882ee8817daf918d834f370d | /src/test/java/com/qait/automation/MacmillanLaunchpad/TestSuites/LearningCurveTest.java | 56a0ddc0a3154686398fc168747e16b130aa9992 | [] | no_license | praveenchinthala/Macmillan-Launchpad | ad61468738b2d5a04ebade6c576d15cdd3267f68 | fc5e5475fd0cfb0f7efe289ac902299673dc311a | refs/heads/master | 2020-12-27T09:40:53.891087 | 2013-12-23T14:36:18 | 2013-12-23T14:36:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,840 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.qait.automation.MacmillanLaunchpad.TestSuites;
import com.qait.automation.MacmillanLaunchpad.CentralLibrary.DataCentralLibrary;
import com.qait.automation.MacmillanLaunchpad.Utils.Utilities;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
public class LearningCurveTest{
DataCentralLibrary dsl = new DataCentralLibrary();
////////////////////////////////////////////////////////////////////////////////////////////////////////
@Test(priority=1)
public void instructorCreatesCourse(){
dsl.setUp();
Assert.assertTrue(dsl.clickOnCreateCourseLink());
Assert.assertTrue(dsl.clickOnNextButton());
dsl.userCreatesNewbaselinedCourse(dsl.courseName);
dsl.clickOnActivateCourseLink();
Assert.assertTrue(dsl.validateActivateCoursePopUpIsDisplayedWithHeading("Activate this course?"));
dsl.clickActivateButton();
Assert.assertTrue(dsl.validateCourseSuccessfullyUpdatedPopUpIsDisplayedWithHeading("Course Activated!"));
dsl.clickDoneButton();
}
@Test(dependsOnMethods="instructorCreatesCourse")
public void enterInCourseCreatedByInstructor(){
dsl.enterIntoCourseByCourseName(dsl.courseName);
Assert.assertTrue(dsl.clickEnterCourse());
}
@Test(dependsOnMethods="enterInCourseCreatedByInstructor")
public void createLearningCurveActivityTc002195() {
Assert.assertTrue(dsl.clickOnTheAddLinkAppearingAtTheTop());
Assert.assertTrue(dsl.selectTheCreateNewOption());
Assert.assertTrue(dsl.selectLearningCurveActivity());
Assert.assertTrue(dsl.provideATitleAndClickOnSave());
Assert.assertTrue(dsl.clickOnQuestionsTab());
Assert.assertTrue(dsl.clickOnAnyChapterAndThenTestBank());
dsl.selectQuestionsAndThenClickOnAddToNewPoolFromTheAddToPoolDropDown();
dsl.enterTitleAndClickSaveButton();
Assert.assertTrue(dsl.clickDoneEditingButtonLearnicgCurveVrification());
}
@Test(dependsOnMethods="createLearningCurveActivityTc002195")
public void userChangeTheTargetScoreForLearningCurveActivityTc002168() {
Assert.assertTrue(dsl.clickOnTheLearningCurveActivity());
dsl.hoverOverTheEditButtonAndClickOnSettingsOption();
dsl.uncheckAutoCalculateCheckboxAndEnterTheTargetScore("150");
Assert.assertTrue(dsl.clickSaveButton());
dsl.clickDoneEditingButtonAndVerifyEnteredScore("150");
}
//@Test(priority=4)
public void deleteSampleCOurseOne() {
dsl.setUp();
dsl.deleteSampleCourses("TestAutomationCourseCreation");
}
@AfterClass(alwaysRun = true)
public void browserClose(){
dsl.exitBrowser();
}
}
| [
"hiteshsharma@qainfotech.net"
] | hiteshsharma@qainfotech.net |
0502f4e231c085bcea6d04d89c29ed02675f8f74 | 9d82d0828c0522ef08c96ff107217295bd8b04da | /src/main/java/io/github/grc/practice/application/service/mapper/package-info.java | 6db6c9e0060dba84fd2f3dd3496e42a708507d90 | [] | no_license | jmoore2081/grcpractice | 6b275df6c959a995c2c728e2415e3b8ef915944f | edd51a7c0e7e3a66b4a88c2f10d2659483d824b5 | refs/heads/master | 2021-06-20T12:00:29.460351 | 2018-02-28T11:23:35 | 2018-02-28T11:23:35 | 123,275,111 | 0 | 1 | null | 2020-09-18T08:57:46 | 2018-02-28T11:23:30 | Java | UTF-8 | Java | false | false | 142 | java | /**
* MapStruct mappers for mapping domain objects and Data Transfer Objects.
*/
package io.github.grc.practice.application.service.mapper;
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
71327ea6bcf55fc7d64fa9c611bc2c97bbaebdb8 | 5ade3d2e723708bb74614d921e155de72771b968 | /angularjs-bank/src/main/java/com/clouway/adapter/persistence/PersistentSessionRepository.java | 51bc3b50f08c5aa2ad31e800e2e973af49824f3a | [] | no_license | kristiyanpetkov/AngularJS-Bank | a02be495ee521fae4acd77be43452affccd18989 | 0a1e4ddf1bfc3827e3c2fd774bb0ff1a5c4d55f0 | refs/heads/master | 2020-05-27T11:28:16.274103 | 2016-09-15T06:27:57 | 2016-09-17T14:36:52 | 82,546,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,145 | java | package com.clouway.adapter.persistence;
import com.clouway.core.ConnectionProvider;
import com.clouway.core.Session;
import com.clouway.core.SessionRepository;
import com.google.inject.Inject;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by Kristiyan Petkov <kristiqn.l.petkov@gmail.com> on 02.06.16.
*/
public class PersistentSessionRepository implements SessionRepository {
private ConnectionProvider connectionProvider;
@Inject
public PersistentSessionRepository(ConnectionProvider connectionProvider) {
this.connectionProvider = connectionProvider;
}
public void create(Session session) {
Connection connection = connectionProvider.get();
PreparedStatement statement = null;
try {
statement = connection.prepareStatement("INSERT INTO session (email,sessionID,expirationTime) VALUES (?,?,?)");
statement.setString(1, session.email);
statement.setString(2, session.sessionId);
statement.setLong(3, System.currentTimeMillis()+5*60*1000);
statement.execute();
} catch (SQLException sqlExc) {
sqlExc.printStackTrace();
} finally {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public Session get(String sessionID) {
Session session = null;
Connection connection = connectionProvider.get();
PreparedStatement statement = null;
try {
statement = connection.prepareStatement("SELECT * FROM session WHERE sessionID=?");
statement.setString(1, sessionID);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
session = new Session(resultSet.getString("email"), resultSet.getString("sessionID"));
}
resultSet.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return session;
}
public void delete(String sessionID) {
Connection connection = connectionProvider.get();
PreparedStatement statement = null;
try {
statement = connection.prepareStatement("DELETE FROM session WHERE sessionID=?");
statement.setString(1, sessionID);
statement.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public void deleteAll() {
Connection connection = connectionProvider.get();
PreparedStatement statement = null;
try {
statement = connection.prepareStatement("DELETE FROM session");
statement.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public void cleanExpired() {
Connection connection = connectionProvider.get();
PreparedStatement statement = null;
try {
statement = connection.prepareStatement("DELETE FROM session WHERE expirationTime < " + System.currentTimeMillis());
statement.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public void refreshSessionTime(Session session) {
Connection connection = connectionProvider.get();
PreparedStatement statement = null;
try {
statement = connection.prepareStatement("UPDATE session SET expirationTime=? WHERE email=? AND sessionID=?");
statement.setLong(1, System.currentTimeMillis() + 5 * 60 * 1000 );
statement.setString(2, session.email);
statement.setString(3, session.sessionId);
statement.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public Integer getActiveSessions() {
Connection connection = connectionProvider.get();
ResultSet resultSet = null;
PreparedStatement statement;
Integer counter = null;
try {
statement = connection.prepareStatement("SELECT COUNT(*) FROM session");
resultSet = statement.executeQuery();
while (resultSet.next()) {
counter = resultSet.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}
return counter;
}
public String getCurrentUserEmail(String sessionId) {
Connection connection = connectionProvider.get();
PreparedStatement statement = null;
String email = null;
try {
statement = connection.prepareStatement("SELECT email FROM session WHERE sessionID=?");
statement.setString(1, sessionId);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
email = resultSet.getString("email");
}
} catch (SQLException e) {
e.printStackTrace();
}
return email;
}
}
| [
"panayot.kulchev@clouway.com"
] | panayot.kulchev@clouway.com |
33abce96e3af2949bb157c9eb41bae6c49772b5d | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/XWIKI-14556-8-10-Single_Objective_GGA-IntegrationSingleObjective-/com/xpn/xwiki/store/hibernate/query/HqlQueryExecutor$1_ESTest_scaffolding.java | dc3cbdef9ee2681fc28b5c1eb94c6334f3a04064 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sun May 17 12:19:03 UTC 2020
*/
package com.xpn.xwiki.store.hibernate.query;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class HqlQueryExecutor$1_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
c6684d70733a142549a56c7cb04f343c0dd575f4 | 49f35e6067a845351fe47ab99cb37c4dc457c5c2 | /php-frontend/src/main/java/org/sonar/php/ini/PhpIniCheck.java | 895b260a34b27434a039310f74b2c33e8ae125c4 | [] | no_license | WhiteSymmetry/sonar-php | 680b2f9ba52235f56f4b9ede5701e8833517752c | 49f1cfe2ec317f2b51f48d419002a4398ade3f6a | refs/heads/master | 2020-07-21T22:35:43.890033 | 2016-11-02T09:49:13 | 2016-11-02T09:49:13 | 73,839,973 | 1 | 0 | null | 2016-11-15T17:49:44 | 2016-11-15T17:49:44 | null | UTF-8 | Java | false | false | 1,038 | java | /*
* SonarQube PHP Plugin
* Copyright (C) 2010-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.php.ini;
import java.util.List;
import org.sonar.php.ini.tree.PhpIniFile;
public interface PhpIniCheck {
List<PhpIniIssue> analyze(PhpIniFile phpIniFile);
}
| [
"pierre-yves.nicolas@sonarsource.com"
] | pierre-yves.nicolas@sonarsource.com |
2711a616fd81152d8e14bea7c891469f1402fdc7 | 8144109825c42ea7d1aac99e059e2e3cd4831faf | /Advjava/CollectionInterface/src/IOPackage/Lab876.java | e487c0e3335ee674f1b2f885b130476d7b7430ad | [] | no_license | binodjava/JavaPractice | bf39eba39390dff0fc2aa4b427f65d4c889a50eb | 3c0a774749eed6804d8e85298d2053b191e9c9b2 | refs/heads/master | 2021-05-10T21:20:48.779486 | 2018-01-25T06:37:41 | 2018-01-25T06:37:41 | 118,221,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | /*package IOPackage;
import java.io.PrintWriter;
public class Lab876 {
public static void main(String[] args) throws Exception {
PrintWriter pw=PrintWriter("welcome.txt");
pw.println(97);
pw.write(97);
pw.println(10.0);
pw.println(true);
pw.println("JLC");
pw.close();
}
}
*/ | [
"binodk.java@gmail.com"
] | binodk.java@gmail.com |
98217741db60da55c469f2a9a66f52232583c213 | 54ddd773653c6021afb830ecffddb7ad55913a02 | /src/main/java/com/gmh/cjcx/service/IMemberService.java | fff7a84119bf2b453fd1608f173a418c8f09cabb | [] | no_license | easonstudy/springboot_demo | 38541b27884cc43c87fd226daeea654803592f89 | ea8c5d52ca6d15893e360ba4e3d0636cc2b6481b | refs/heads/master | 2021-01-25T06:44:43.856233 | 2017-09-30T05:05:36 | 2017-09-30T05:05:36 | 93,599,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.gmh.cjcx.service;
import com.gmh.cjcx.dto.MemberDto;
import com.gmh.cjcx.entity.Member;
import com.gmh.framework.service.IBaseService;
/**
* <p>
* 服务类
* </p>
*
* @author Guominghua
* @since 2017-08-15
*/
public interface IMemberService extends IBaseService<MemberDto, Integer> {
}
| [
"11"
] | 11 |
bcaf99603b59611807d143a9803e741fd223c15a | b5bcd6f3e286d04b998c9ec8d4d15bd52ca9739b | /src/PopUpScreens/ControllerModifyTicket.java | 7bdbffa136d3a5f06dea9081c243a3f916b39534 | [] | no_license | SandrinePatin/backoffice_linkservice | 297aa98bf82d9e8a5355deb6ee232bf83fe1b6ec | 09c749c8c59b960284e742edc6dd205553d44f20 | refs/heads/master | 2022-11-28T21:01:02.057689 | 2020-07-22T06:09:42 | 2020-07-22T06:09:42 | 263,458,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,852 | java | package PopUpScreens;
import Classes.Ticket;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.stage.Stage;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ResourceBundle;
public class ControllerModifyTicket {
Ticket actualTicket;
int idUserCreator;
@FXML
private TextArea tfDescriptionModifySection;
@FXML
private ComboBox<String> cbStatutTicket;
@FXML
private TextField tfUserModifyTicket;
@FXML
private Button btnModifyTicketData;
@FXML
private Button btnCreateTicketData;
public void initialize(URL location, ResourceBundle resources) {
}
public void loadSection(Ticket ticket) {
actualTicket = ticket;
tfDescriptionModifySection.setPromptText(ticket.getDescription());
tfUserModifyTicket.setPromptText(ticket.getId_user_assigned());
cbStatutTicket.getSelectionModel().select(ticket.getStatut());
setStatusAvailable();
btnCreateTicketData.setVisible(false);
btnModifyTicketData.setVisible(true);
}
public void loadCreateWindow(int idUser) {
idUserCreator = idUser;
setStatusAvailable();
btnCreateTicketData.setVisible(true);
btnModifyTicketData.setVisible(false);
}
public void handleClicks(ActionEvent actionEvent) throws IOException, InterruptedException {
if (actionEvent.getSource() == btnModifyTicketData) {
updateTicket();
Stage primaryStage = (Stage) btnModifyTicketData.getScene().getWindow();
primaryStage.close();
}
if (actionEvent.getSource() == btnCreateTicketData) {
createTicket();
}
}
private void updateTicket() throws IOException, InterruptedException {
String newDescription = tfDescriptionModifySection.getText();
String newUserAssigned = tfUserModifyTicket.getText();
String newStatus = cbStatutTicket.getValue();
if (newDescription.equals("")) {
newDescription = actualTicket.getDescription();
}
if (newUserAssigned.equals("")){
newUserAssigned = actualTicket.getId_user_assigned();
}
if(newStatus.contains("0")){
newStatus = "0";
} else if (newStatus.contains("1")){
newStatus = "1";
}
actualTicket.updateTicket(newDescription, newUserAssigned, newStatus);
}
private void createTicket() throws IOException, InterruptedException {
boolean error = false;
String newDescription = tfDescriptionModifySection.getText();
String newUserAssigned = tfUserModifyTicket.getText();
String todayDate;
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime now = LocalDateTime.now();
todayDate = dtf.format(now);
actualTicket = new Ticket(0, todayDate, newDescription, idUserCreator, newUserAssigned, 0);
if (newDescription.equals("")) {
tfDescriptionModifySection.setStyle("-fx-border-color: red");
error = true;
}
if (error != true) {
actualTicket.createTicket();
Stage primaryStage = (Stage) btnCreateTicketData.getScene().getWindow();
primaryStage.close();
}
}
private boolean checkValue(String value, TextField origin){
if(value.equals("")){
origin.setStyle("-fx-border-color: red");
return true;
}
return false;
}
private void setStatusAvailable(){
cbStatutTicket.getItems().addAll(
"0 - A résoudre",
"1 - Résolu"
);
}
private void setUserAvailable(){
}
}
| [
"yunie@MacBook-Pro-de-Sandrine.local"
] | yunie@MacBook-Pro-de-Sandrine.local |
bfe2e39e7a26d7e979de8bdd76c19fd4bac2108d | f3e95d0d6b87e7330f3ddc20b00df0673bcbc08b | /evio-5.1/java/org/jlab/coda/jevio/test/ReaderTest.java | 83ab076cdd47a88ca6f2cae47275fadf87664404 | [] | no_license | JeffersonLab/EvioTool | 88525821760d91da12827ea2214d107ffd4d1424 | 942cb3dfc7454bb3ff6435aca01a13f9c725829c | refs/heads/master | 2022-09-26T10:16:17.013108 | 2022-09-15T20:09:44 | 2022-09-15T20:09:44 | 164,700,955 | 2 | 1 | null | 2022-04-24T20:56:55 | 2019-01-08T17:34:44 | Java | UTF-8 | Java | false | false | 5,335 | java | package org.jlab.coda.jevio.test;
import org.jlab.coda.jevio.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
/**
* Test program made to work with 2 file produced by the SwapTest (one of the mainN() methods).
* This test the readers both regular and compact to see if they parse this single event
* properly.
*
* @author timmer
* Date: Dec 3, 2015
*/
public class ReaderTest {
// These files were written by SwapTest.java or by hand
static String compositeFile = "/home/timmer/evioTestFiles/xmlTests/composite.evio";
static String regularXmlFile = "/home/timmer/evioTestFiles/xmlTests/regularEvent.xml";
static String regularFile = "/home/timmer/evioTestFiles/xmlTests/regularEvent.evio";
static String regularFile2 = "/home/timmer/evioTestFiles/xmlTests/regularEvent2.evio";
static String smallXmlFile = "/home/timmer/evioTestFiles/xmlTests/regularEventSmall.xml";
static String swappedFile = "/home/timmer/evioTestFiles/xmlTests/swappedEvent.evio";
/** Reading files to get EvioNode objects & print out XML representation. */
public static void main4(String args[]) {
try {
String xml = new String(Files.readAllBytes(Paths.get(regularXmlFile)));
System.out.println("\nXML:\n" + xml);
System.out.println("Convert XML to EvioEvent:");
List<EvioEvent> evList = Utilities.toEvents(xml);
for (EvioEvent ev : evList) {
System.out.println("\n\nEvioEvent ---> XML:\n" + ev.toXML());
}
}
catch (Exception e) {
e.printStackTrace();
}
}
/** Reading files to get EvioNode objects & print out XML representation. */
public static void main3(String args[]) {
EvioNode node;
boolean hex = false;
try {
EvioCompactReader fileReader = new EvioCompactReader(compositeFile);
int evNum = 1;
while ( (node = fileReader.getScannedEvent(evNum++)) != null) {
String xml = Utilities.toXML(node, hex);
System.out.println("\nXML:\n" + xml);
System.out.println("Convert XML to EvioEvent:");
List<EvioEvent> evList = Utilities.toEvents(xml);
System.out.println("\n\nev to XML:\n" + evList.get(0).toXML());
System.out.println("\n\n");
}
}
catch (Exception e) {
e.printStackTrace();
}
}
/** Reading files to get EvioNode objects & print out XML representation. */
public static void main(String args[]) {
EvioNode node;
boolean hex=false, compact=true;
try {
if (!compact) {
EvioReader reader = new EvioReader(regularFile);
EvioEvent event = reader.parseEvent(1);
System.out.println("\nXML:\n" + event.toXML(hex));
}
else {
EvioCompactReader fileReader = new EvioCompactReader(regularFile);
node = fileReader.getScannedEvent(1);
String xml = Utilities.toXML(node, hex);
System.out.println("\nXML:\n" + xml);
}
// System.out.println("----------------------------------------------------------");
// System.out.println("----------------------SWAPPED-----------------------------");
//
// fileReader = new EvioCompactReader(swappedFile);
//
// node = fileReader.getScannedEvent(1);
// xml = node.toXML();
// System.out.println("\nXML:\n" + xml);
}
catch (Exception e) {
e.printStackTrace();
}
}
/** Reading files to get EvioEvent objects & print out XML representation. */
public static void main1(String args[]) {
EvioEvent event;
try {
EvioReader fileReader = new EvioReader(regularFile);
System.out.println("TRY EvioReader.parseEvent(1)");
event = fileReader.parseEvent(1);
System.out.println("\nXML:\n" + event.toXML());
System.out.println("Rewind ...");
fileReader.rewind();
System.out.println("TRY EvioReader.parseNextEvent()");
event = fileReader.parseNextEvent();
System.out.println("\nXML:\n" + event.toXML());
fileReader.rewind();
System.out.println("----------------------------------------------------------");
System.out.println("----------------------SWAPPED-----------------------------");
fileReader = new EvioReader(swappedFile);
System.out.println("TRY EvioReader.parseEvent(1)");
event = fileReader.parseEvent(1);
System.out.println("\nXML:\n" + event.toXML());
System.out.println("Rewind ...");
fileReader.rewind();
System.out.println("TRY EvioReader.parseNextEvent()");
event = fileReader.parseNextEvent();
System.out.println("\nXML:\n" + event.toXML());
fileReader.rewind();
}
catch (IOException e) {
e.printStackTrace();
}
catch (EvioException e) {
e.printStackTrace();
}
}
}
| [
"maurik@physics.unh.edu"
] | maurik@physics.unh.edu |
ade7020d5d6d249fc99440cd9a72381eb5a88c57 | aa30ff743df0dbaed4ec6766239f5efcf9e40bcb | /PratnerApps/app/src/main/java/com/gaadi/pratnerapps/fragments/buy_car/BuyCarBodyTypeFragment.java | 3891121810327f7df6843d1388989702173bb11c | [] | no_license | musharib499/partner | 38725eb6e50f51893a5ac50590029ec5e4924fc1 | 86794bf366c1c53beed870f1aa1973c11ddba180 | refs/heads/master | 2021-05-02T04:21:20.695356 | 2016-12-14T12:31:27 | 2016-12-14T12:31:27 | 76,444,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,113 | java | package com.gaadi.pratnerapps.fragments.buy_car;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.gaadi.pratnerapps.R;
import com.gaadi.pratnerapps.adapter.BodyAdapter;
import com.gaadi.pratnerapps.models.BuyCarFilterModel;
import com.gaadi.pratnerapps.models.ParameterApiModel;
import com.gaadi.pratnerapps.utils.BodyUtils;
import com.gaadi.pratnerapps.utils.CommonUtils;
import com.gaadi.pratnerapps.utils.ObjectTableUtil;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
* Use the {@link BuyCarBodyTypeFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class BuyCarBodyTypeFragment extends Fragment {
private ArrayList<ParameterApiModel.KeyValueModel> bodyList = new ArrayList<>();
private RecyclerView recyclerView;
private BuyCarFilterModel buyCarFilterModel;
public static BuyCarBodyTypeFragment newInstance(BuyCarFilterModel buyCarFilterModel) {
BuyCarBodyTypeFragment fragment = new BuyCarBodyTypeFragment();
fragment.buyCarFilterModel = buyCarFilterModel;
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_body_type_blank, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recycle_list);
recyclerView = CommonUtils.recyclerView(recyclerView, getActivity(), true);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),2);
recyclerView.setLayoutManager(gridLayoutManager);
bodyList = ObjectTableUtil.getCarBodyTypes(getContext());
BodyAdapter bodyAdapter=new BodyAdapter(getActivity(),bodyList,buyCarFilterModel);
recyclerView.setAdapter(bodyAdapter);
return view;
}
public static int getIcon(String key) {
switch (key)
{
case BodyUtils.COUPE:
return R.drawable.coupe;
case BodyUtils.CONVERTIBLES:
return R.drawable.convertible;
case BodyUtils.HATCHBACK:
return R.drawable.hatchback;
case BodyUtils.MUV:
return R.drawable.muv;
case BodyUtils.MINIVAN:
return R.drawable.minivans;
case BodyUtils.SEDAN:
return R.drawable.sedan;
case BodyUtils.SUV:
return R.drawable.suv;
default:
return R.drawable.hybrids;
}
}
/* @Override
public void onBind(final BuyCarBodyTypeViewHolder holder, final int position) {
holder.tv_view.setText(bodyList.get(position).getValue());
holder.im_view.setImageResource(getIcon(bodyList.get(position).getValue()));
holder.view_check.setImageResource(getIcon(bodyList.get(position).getValue()));
Utils.setTint(holder.view_check,getActivity(),"primary_color");
if (buyCarFilterModel.getBodyTypes().contains(bodyList.get(position).getKey())) {
holder.view_check.setVisibility(View.VISIBLE);
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (buyCarFilterModel.getBodyTypes().contains(bodyList.get(position).getKey())) {
buyCarFilterModel.getBodyTypes().remove(bodyList.get(position).getKey());
holder.view_check.setVisibility(View.GONE);
} else {
buyCarFilterModel.getBodyTypes().add(bodyList.get(position).getKey());
holder.view_check.setVisibility(View.VISIBLE);
}
}
});
}*/
}
| [
"mushareb.ali@gaadi.com"
] | mushareb.ali@gaadi.com |
81a36f393dbc5d2651cec1079db78f9d2689a6e7 | 9907672fcd81ab73ac63b2a83422a82bf31eadde | /aizu/tyama_aizu0522.java | 3e9f535a063f2d81d56d02c7d3b196d2986d25e2 | [
"0BSD"
] | permissive | cielavenir/procon | bbe1974b9bddb51b76d58722a0686a5b477c4456 | 746e1a91f574f20647e8aaaac0d9e6173f741176 | refs/heads/master | 2023-06-21T23:11:24.562546 | 2023-06-11T13:15:15 | 2023-06-11T13:15:15 | 7,557,464 | 137 | 136 | null | 2020-10-20T09:35:52 | 2013-01-11T09:40:26 | C++ | UTF-8 | Java | false | false | 338 | java | import java.util.*;
class Main{
public static void main(String[]z){
int t=0,u=0,i=0,j=0;
Scanner x=new Scanner(System.in);
for(;x.hasNext();t=u=i=j=0){
String s=x.nextLine();
for(;(t=s.indexOf("IOI",t))!=-1;t+=2)i++;
for(;(u=s.indexOf("JOI",u))!=-1;u+=3)j++;
System.out.println(j+"\n"+i);
}
}
} | [
"cielartisan@gmail.com"
] | cielartisan@gmail.com |
955baaec32dd9438ae044c8b19c9133c88f14180 | 3f7963a853a035abf83a830f5f6defb4f0325711 | /src/java/servico/CategoriaDBService.java | d4cc2c336e95d947c70fc009ca0e30f5d797a724 | [] | no_license | Zontae/171178POOII | 1b23d06abb626db4dc8b112a55a8c36a79c42c3b | e52c6fc84c3c4062f83f6deb0d507de59e047c44 | refs/heads/master | 2020-04-25T06:50:27.615027 | 2019-06-10T23:02:48 | 2019-06-10T23:02:48 | 172,594,143 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,324 | java |
package servico;
import modelo.Categoria;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class CategoriaDBService {
private EntityManagerFactory emf;
public CategoriaDBService() {
emf = emf = Persistence.createEntityManagerFactory("POOIIDB");
}
public void salvarAtualizar(Categoria cat) {
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
em.merge(cat);
em.getTransaction().commit();
em.close();
}
public List<Categoria> getCategorias()
{
EntityManager em = emf.createEntityManager();
List <Categoria> categorias = em.createQuery("Select c From Categoria c").getResultList();
em.close();
System.out.println(categorias.toString());
return categorias;
}
public Categoria getCategoriaByCodigo(int codigo)
{
EntityManager em = emf.createEntityManager();
Categoria cat = em.find(Categoria.class, codigo);
em.close();
System.out.println("servico.CategoriaDBService.getCategoriaByCodigo()" + cat.getCodigo());
return cat;
}
}
| [
"gabrielguga2013@hotmail.com"
] | gabrielguga2013@hotmail.com |
bfac1bdcd52359726a909b5343e977e5ca69fd45 | 92ec94a86a1bcf68ecc0378a036e23922788d462 | /src/main/java/com/master/salmonapp/model/MasterMobilModel.java | f776ecd73674a56da214febc7ee18c006deb10d5 | [] | no_license | MDimas27/Salmon-app | a65a3130fb8a9432c57abcc4fd1f222bb0b19cb4 | 1e6f5cbb622883c71edd850595a7675b1fc07d5b | refs/heads/master | 2023-01-23T05:43:48.100932 | 2020-11-30T10:14:06 | 2020-11-30T10:14:06 | 304,401,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 509 | java | package com.master.salmonapp.model;
import java.math.BigInteger;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@JsonIgnoreProperties(ignoreUnknown = true)
public class MasterMobilModel extends PersistenceModel {
private String namaMobil;
private String type;
private String tahunProduksi;
private BigInteger hargaOtr;
private Date createDate;
private Integer active;
}
| [
"mdimas.umb@gmail.com"
] | mdimas.umb@gmail.com |
839dde7d2e678bad5b3b878514009125e040c549 | 68d1bb585f30d2ade7a8b91269631adfb1e4429b | /src/main/java/org/george/hybridcolumnar/util/RowAnalyzer.java | de0d697ce78a07569be077a872f3d3b2d8ea276c | [] | no_license | gkirion/hybridcolumnar | 100e480119151e8482be2c78ec82c1c12326e30b | 9829888d9fda22c616426a548004c2c881d278b5 | refs/heads/master | 2023-02-16T06:33:51.308812 | 2021-01-16T21:27:21 | 2021-01-16T21:27:21 | 327,288,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | package org.george.hybridcolumnar.util;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.george.hybridcolumnar.domain.Row;
import org.george.hybridcolumnar.domain.Tuple2;
public class RowAnalyzer {
public static List<String> getColumnsOrderedByCardinality(List<Row> rows) {
HashMap<String, HashMap<Comparable<?>, Boolean>> uniqueElements = new HashMap<>();
for (Row row : rows) {
for (String key : row) {
if (uniqueElements.get(key) == null) {
uniqueElements.put(key, new HashMap<>());
}
uniqueElements.get(key).put(row.get(key), true);
}
}
ArrayList<Tuple2<String, Integer>> cardinalities = new ArrayList<>();
for (String key : uniqueElements.keySet()) {
cardinalities.add(new Tuple2<String, Integer>(key, uniqueElements.get(key).size()));
}
cardinalities.sort(new Comparator<Tuple2<String, Integer>>() {
@Override
public int compare(Tuple2<String, Integer> o1, Tuple2<String, Integer> o2) {
return o1.getSecond().compareTo(o2.getSecond());
}
});
List<String> orderList = new ArrayList<>();
for (Tuple2<String, Integer> tuple : cardinalities) {
orderList.add(tuple.getFirst());
}
return orderList;
}
}
| [
"gkirion@gmail.com"
] | gkirion@gmail.com |
299f439278981c76fc6e5472c7fd60710702fb85 | e0fef5526507fa614d2e72e4862ea5266a546420 | /src/icehs/science/chapter09/Account.java | 478af75c9880472a8a25a354eb960fef6dd9dac2 | [] | no_license | jhu0924/MY_JAVA_PROJECT | a6b62c950053235c383ee18cffac4adbd0857afa | cee991b157d4dc805782d836e6cf752a3024e795 | refs/heads/master | 2023-02-15T18:30:38.272542 | 2021-01-09T06:13:28 | 2021-01-09T06:13:28 | 325,242,218 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 850 | java | package icehs.science.chapter09;
public class Account {
private String number;
private String name;
private int balance;
public Account(String number, String name, int balance) {
super();
this.number = number;
this.name = name;
this.balance = balance;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
void openAccount() {
System.out.println("계좌 번호 : " + this.number);
System.out.println("예금주 : " + this.name);
System.out.println("잔액 : " + this.balance + "원");
}
}
| [
"User@DESKTOP-73TAQI5"
] | User@DESKTOP-73TAQI5 |
4af0f99215ef19c25750d1678a65e158642782be | 34e9d4d37da85234b76ec6523f8c595d9d5c0351 | /src/main/java/com/svetanis/algorithms/dp/lis/variations/LongestBitonicSubArrLen.java | 5b809ee56c2e566c3615531940e91f00577be774 | [] | no_license | svetanis/algorithms | 1985abab0951147e2d89b76e23f579a029721c4b | 88d4cce2f5ab55847e1b06cc9ecf3b8cccc6c9b1 | refs/heads/master | 2020-05-05T09:28:53.551123 | 2019-09-01T19:18:23 | 2019-09-01T19:18:23 | 179,906,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,523 | java | package com.svetanis.algorithms.dp.lis.variations;
import static java.lang.Math.max;
public final class LongestBitonicSubArrLen {
public static int lbs(int[] a) {
// Time complexity: O(n)
// Auxiliary space: O(n)
int[] inc = incr(a);
int[] dec = decr(a);
return getMaxLen(inc, dec);
}
private static int getMaxLen(int[] inc, int[] dec) {
int n = inc.length;
// 3. find the length of max length bitonic sequence
int max = inc[0] + dec[0] - 1;
for (int i = 1; i < n; ++i) {
max = max(max, inc[i] + dec[i] - 1);
}
return max;
}
private static int[] incr(int[] a) {
int n = a.length;
int[] inc = new int[n];
// length of increasing sequence
// ending at first index is 1
inc[0] = 1;
// 1. construct increasing sequence array
for (int i = 1; i < n; ++i) {
if (a[i] > a[i - 1]) {
inc[i] = inc[i - 1] + 1;
} else {
inc[i] = 1;
}
}
return inc;
}
private static int[] decr(int[] a) {
int n = a.length;
int[] dec = new int[n];
// length of decreasing sequence
// starting at last index is 1
dec[n - 1] = 1;
// 2. construct decreasing sequence array
for (int i = n - 2; i >= 0; --i) {
if (a[i] > a[i + 1]) {
dec[i] = dec[i + 1] + 1;
} else {
dec[i] = 1;
}
}
return dec;
}
public static void main(String[] args) {
int arr[] = { 12, 4, 78, 90, 45, 23 };
System.out.println("Max length size: " + lbs(arr));
}
}
| [
"svet125@gmail.com"
] | svet125@gmail.com |
4cc698175c781ae5ca22c8229567d9af92288eef | 30e2a97fa46389f502ed6533842de0630c7c90cd | /app/src/main/java/com/colintheshots/rxretrofitmashup/MainActivity.java | b8f028e82555824d76433ac4d606a775839fed20 | [
"Apache-2.0"
] | permissive | evrimulgen/RxRetrofitMashup | 4df75ddae580ecfa576826feb6e793c94a93145f | 3fc32eb437f8c14fe38ed652fcde2b6ebbae9e43 | refs/heads/master | 2020-12-30T12:44:12.733741 | 2015-03-21T15:47:58 | 2015-03-21T15:47:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,659 | java | package com.colintheshots.rxretrofitmashup;
import android.app.ActionBar;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.Toast;
import com.colintheshots.rxretrofitmashup.adapters.GistFilesAdapter;
import com.colintheshots.rxretrofitmashup.models.GistDetail;
import com.colintheshots.rxretrofitmashup.network.GitHubNetworkService;
import java.util.List;
import butterknife.ButterKnife;
import butterknife.InjectView;
public class MainActivity extends Activity
implements GitHubNetworkService.GitHubCallback, ServiceConnection {
@InjectView(R.id.listView)
ListView mListView;
private GitHubNetworkService mService;
private boolean mBound;
private String mGistVisible = "none";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.inject(this);
}
@Override
protected void onDestroy() {
getApplicationContext().unbindService(this);
super.onDestroy();
}
@Override
protected void onStart() {
super.onStart();
// Bind to LocalService
Intent intent = new Intent(this, GitHubNetworkService.class);
getApplicationContext().bindService(intent, this, Context.BIND_AUTO_CREATE);
}
@Override
protected void onStop() {
super.onStop();
// Unbind from the service
if (mBound) {
unbindService(this);
mBound = false;
}
}
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
GitHubNetworkService.GitHubBinder binder = (GitHubNetworkService.GitHubBinder) iBinder;
mService = binder.getService();
if (GitHubNetworkService.GITHUB_PERSONAL_ACCESS_TOKEN.equals("XXX")) {
Toast.makeText(getApplicationContext(), "GitHub Personal Access Token is Unset!", Toast.LENGTH_LONG).show();
}
mService.setCallback(this);
mService.getGists();
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
mService.unsetCallback();
mService = null;
}
@Override
public void displayFiles(List<GistDetail> gistDetailList) {
if (mListView!=null) {
mListView.setAdapter(new GistFilesAdapter(MainActivity.this, gistDetailList));
}
}
} | [
"colin.lee@mentormate.com"
] | colin.lee@mentormate.com |
00eb89a4d18b0aa3a2dead503c0887cf4a5548e1 | bd3d3724626158f0c930b881048a4e37ad650431 | /components/src/net/mostlyoriginal/game/component/action/ActionPickup.java | 3e364bd6e79ed3bb39e47eae43586be37f5292be | [
"MIT"
] | permissive | DaanVanYperen/odb-bob | 56c8dfe7c7a2dc8f10e03115bca09706c3d7291d | 589c70e2dbd35825b4a685112f914aaec175c4a6 | refs/heads/master | 2020-08-06T13:07:59.095241 | 2019-10-08T10:05:35 | 2019-10-08T10:05:35 | 212,986,696 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 242 | java | package net.mostlyoriginal.game.component.action;
import com.artemis.Component;
import com.artemis.annotations.EntityId;
/**
* @author Daan van Yperen
*/
public class ActionPickup extends Component {
@EntityId public int target=-1;
}
| [
"daan@mostlyoriginal.net"
] | daan@mostlyoriginal.net |
f247316b3217e09baaacd0f3e428e394dcf588fc | 3a2db6c9aec73cc952327dae4fb09d816caf84df | /app/src/main/java/com/anton111111/vr/raypicking/RayPicking.java | 528de4915f372dd714569a677a9a4971476d6888 | [] | no_license | Anton111111/GVRVideoPlayer | 5a589ea9d9718583569850aba236db4775d34f5a | 535d0e2a6bdf98655580a68cd5b355937c9bf63b | refs/heads/master | 2020-03-23T14:40:02.721078 | 2018-07-20T09:28:25 | 2018-07-20T09:28:25 | 141,691,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,166 | java | package com.anton111111.vr.raypicking;
import android.opengl.GLU;
import java.util.ArrayList;
public class RayPicking {
/**
* Do ray picking and return coords of hit
*
* @param viewWidth
* @param viewHeight
* @param rx
* @param ry
* @param modelViewMatrix
* @param projMatrix
* @param objectCoords
* @param objectIndexes
* @return return coord of intersection hit area or null if no intersection
*/
public static float[] rayPicking(int viewWidth, int viewHeight, float rx, float ry,
float[] modelViewMatrix, float[] projMatrix,
final float[] objectCoords, final short[] objectIndexes) {
int[] viewport = {0, 0, viewWidth, viewHeight};
float[] temp = new float[4];
GLU.gluUnProject(rx, ry, 0, modelViewMatrix, 0, projMatrix, 0, viewport, 0, temp, 0);
float[] near_xyz = new float[]{
temp[0] / temp[3],
temp[1] / temp[3],
temp[2] / temp[3]
};
GLU.gluUnProject(rx, ry, 1, modelViewMatrix, 0, projMatrix, 0, viewport, 0, temp, 0);
float[] far_xyz = new float[]{
temp[0] / temp[3],
temp[1] / temp[3],
temp[2] / temp[3]
};
int coordCount = objectCoords.length;
float[] convertedSquare = new float[coordCount];
for (int i = 0; i < coordCount; i = i + 3) {
convertedSquare[i] = objectCoords[i];
convertedSquare[i + 1] = objectCoords[i + 1];
convertedSquare[i + 2] = objectCoords[i + 2];
}
ArrayList<Triangle> triangles = new ArrayList<>();
for (int i = 0; i < objectIndexes.length; i = i + 3) {
int i1 = objectIndexes[i] * 3;
int i2 = objectIndexes[i + 1] * 3;
int i3 = objectIndexes[i + 2] * 3;
triangles.add(
new Triangle(
new float[]{
convertedSquare[i1],
convertedSquare[i1 + 1],
convertedSquare[i1 + 2]
},
new float[]{
convertedSquare[i2],
convertedSquare[i2 + 1],
convertedSquare[i2 + 2]
},
new float[]{
convertedSquare[i3],
convertedSquare[i3 + 1],
convertedSquare[i3 + 2]
}
)
);
}
for (Triangle t : triangles) {
float[] point = new float[3];
int intersects = Triangle.intersectRayAndTriangle(near_xyz, far_xyz, t, point);
if (intersects == 1 || intersects == 2) {
return new float[]{
point[0], point[1], point[2]
};
}
}
return null;
}
}
| [
"anton.potekhin@orbitscripts.com"
] | anton.potekhin@orbitscripts.com |
324ec6ee61625854884daacb2a9ee439c1694b95 | 69c982e7ff81a6afa63d9cbc028d1d5eaf20917e | /src/main/java/matrix/room/MatrixRoomMessageChunk.java | 7264967b324cd3ddff9c6b5bf6245929b0a60f99 | [] | no_license | helllynx/matrix_stress_test | 945047545a9ad5eec9984d82649becf14db9bbed | 29f66fd9d42b85adda5cf5e55f5bf4dece70d6a7 | refs/heads/master | 2022-12-29T10:12:36.653805 | 2020-10-06T15:03:56 | 2020-10-06T15:03:56 | 300,376,673 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,542 | java | /*
* matrix-java-sdk - Matrix Client SDK for Java
* Copyright (C) 2018 Kamax Sarl
*
* https://www.kamax.io/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package matrix.room;
import matrix.event._MatrixPersistentEvent;
import java.util.List;
public class MatrixRoomMessageChunk implements _MatrixRoomMessageChunk {
private String startToken;
private String endToken;
private List<_MatrixPersistentEvent> events;
public MatrixRoomMessageChunk(String startToken, String endToken, List<_MatrixPersistentEvent> events) {
this.startToken = startToken;
this.endToken = endToken;
this.events = events;
}
@Override
public String getStartToken() {
return startToken;
}
@Override
public String getEndToken() {
return endToken;
}
@Override
public List<_MatrixPersistentEvent> getEvents() {
return events;
}
}
| [
"white.night.447@gmail.com"
] | white.night.447@gmail.com |
1e6184b4e9cbb031a33dc1f1356b9c44ed483d51 | 263473f26eba52882f87eb6f30119edfde0dc131 | /app/src/main/java/com/example/user/barcodedetect/MainActivity.java | 3f97235f368b2ae7e36fe79edd0ad9cbf62ac09e | [] | no_license | hyejinhyun/BarcodeDetect | c87cb18236f55d70e16633d1f385c3381e768b32 | ac62c75f0d0cefdd9e59a330f4421bacb690f534 | refs/heads/master | 2020-03-31T02:18:42.375133 | 2018-10-06T07:45:19 | 2018-10-06T07:45:19 | 151,817,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,060 | java | package com.example.user.barcodedetect;
import android.app.Activity;
import android.app.AlertDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.SparseArray;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.google.android.gms.vision.Frame;
import com.google.android.gms.vision.face.Face;
import com.google.android.gms.vision.face.FaceDetector;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ImageView myImageView = (ImageView) findViewById(R.id.imgview);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inMutable=true;
Bitmap myBitmap = BitmapFactory.decodeResource(
getApplicationContext().getResources(),
R.drawable.test1,
options);
Paint myRectPaint = new Paint();
myRectPaint.setStrokeWidth(5);
myRectPaint.setColor(Color.RED);
myRectPaint.setStyle(Paint.Style.STROKE);
Bitmap tempBitmap = Bitmap.createBitmap(myBitmap.getWidth(), myBitmap.getHeight(), Bitmap.Config.RGB_565);
Canvas tempCanvas = new Canvas(tempBitmap);
tempCanvas.drawBitmap(myBitmap, 0, 0, null);
FaceDetector faceDetector = new
FaceDetector.Builder(getApplicationContext()).setTrackingEnabled(false)
.build();
if(!faceDetector.isOperational()){
new AlertDialog.Builder(v.getContext()).setMessage("Could not set up the face detector!").show();
return;
}
Frame frame = new Frame.Builder().setBitmap(myBitmap).build();
SparseArray<Face> faces = faceDetector.detect(frame);
for(int i=0; i<faces.size(); i++) {
Face thisFace = faces.valueAt(i);
float x1 = thisFace.getPosition().x;
float y1 = thisFace.getPosition().y;
float x2 = x1 + thisFace.getWidth();
float y2 = y1 + thisFace.getHeight();
tempCanvas.drawRoundRect(new RectF(x1, y1, x2, y2), 2, 2, myRectPaint);
}
myImageView.setImageDrawable(new BitmapDrawable(getResources(),tempBitmap));
}
});
}
}
| [
"bwj05117@naver.com"
] | bwj05117@naver.com |
5ca878f5ce80e341b759affac85f96991f443e7b | 9796bb797634ef8a43d6147183d3a25ff198ed40 | /src/main/java/org/conquernos/cinnamon/utils/process/Process.java | cbd4fdece90edd0048dac613994c8482ffe15f55 | [] | no_license | conquernos/cinnamon | c5fe1b5c50b2498105737bc0686443515d900b37 | bb0aa09151c169efabb85c495ca589e9467caef9 | refs/heads/master | 2020-05-03T18:11:25.157054 | 2019-04-01T00:36:41 | 2019-04-01T00:36:41 | 178,757,928 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java | package org.conquernos.cinnamon.utils.process;
import java.io.*;
import java.lang.management.ManagementFactory;
public class Process {
public static int getProcessId() {
String jvmName = ManagementFactory.getRuntimeMXBean().getName();
int idx;
String pid = null;
if ((idx = jvmName.indexOf("@")) > 0) {
pid = jvmName.substring(0, idx);
}
if (pid != null) {
try {
return Integer.parseInt(pid);
} catch (NumberFormatException e) {
return -1;
}
}
return -1;
}
public static boolean saveProcessId(String fileName) {
PrintWriter pidWriter = null;
try {
pidWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8"));
pidWriter.print(getProcessId());
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
if (pidWriter != null) {
pidWriter.close();
}
}
}
}
| [
"conquernos@gmail.com"
] | conquernos@gmail.com |
a497dd404decaf5f592554bbf1f279cf1c710c5e | 59a19bb8c3e2c59a7f7a354f5cafc106e0116e59 | /modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ChunkLST_Type.java | aa72aa231d80089e3288d88f93c47c17c2976f5a | [
"Apache-2.0"
] | permissive | KnowledgeGarden/bluima | ffd5d54d69e42078598a780bdf6e67a6325d695a | 793ea3f46761dce72094e057a56cddfa677156ae | refs/heads/master | 2021-01-01T06:21:54.919609 | 2016-01-25T22:37:43 | 2016-01-25T22:37:43 | 97,415,950 | 1 | 0 | null | 2017-07-16T22:53:46 | 2017-07-16T22:53:46 | null | UTF-8 | Java | false | false | 1,850 | java |
/* First created by JCasGen Sat Mar 07 22:05:57 CET 2015 */
package de.julielab.jules.types;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
/**
* Updated by JCasGen Sat Mar 07 22:05:57 CET 2015
* @generated */
public class ChunkLST_Type extends Chunk_Type {
/** @generated
* @return the generator for this type
*/
@Override
protected FSGenerator getFSGenerator() {return fsGenerator;}
/** @generated */
private final FSGenerator fsGenerator =
new FSGenerator() {
public FeatureStructure createFS(int addr, CASImpl cas) {
if (ChunkLST_Type.this.useExistingInstance) {
// Return eq fs instance if already created
FeatureStructure fs = ChunkLST_Type.this.jcas.getJfsFromCaddr(addr);
if (null == fs) {
fs = new ChunkLST(addr, ChunkLST_Type.this);
ChunkLST_Type.this.jcas.putJfsFromCaddr(addr, fs);
return fs;
}
return fs;
} else return new ChunkLST(addr, ChunkLST_Type.this);
}
};
/** @generated */
@SuppressWarnings ("hiding")
public final static int typeIndexID = ChunkLST.typeIndexID;
/** @generated
@modifiable */
@SuppressWarnings ("hiding")
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("de.julielab.jules.types.ChunkLST");
/** initialize variables to correspond with Cas Type and Features
* @generated
* @param jcas JCas
* @param casType Type
*/
public ChunkLST_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
}
}
| [
"renaud@apache.org"
] | renaud@apache.org |
adf915d7607de653b619f39836e58c6e3be85043 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project50/src/main/java/org/gradle/test/performance50_2/Production50_179.java | 13ca6239684b09b28dbb940f036eeb7523d8574a | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance50_2;
public class Production50_179 extends org.gradle.test.performance14_2.Production14_179 {
private final String property;
public Production50_179() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
bfece62305591a933079b6e40d80272832cd79a7 | 8d1d62db80a3742fab1307a5ceda658fce886184 | /src/com/vikky/lecture21/GymMembership.java | 707ba5f33985b56f7fe203c30907486efbcc285a | [] | no_license | victoriajeniluc/OOP | 4049e46ddd7fedd01bf84867114e2e63b6b41247 | d877e0065221e07600af9cacba3e4a8c489e1cb6 | refs/heads/master | 2020-03-27T08:06:34.150066 | 2018-09-03T19:34:26 | 2018-09-03T19:34:26 | 146,221,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,251 | java | package com.vikky.lecture21;
/**
* Gym membership class. Simply calculates the total cost by
* multiplying duration by monthlyFee.
*
* Check DiscountedGymMembership1 and DiscountedGymMembership2 classes as well.
*
* @author Udayan Khattry
*/
// DO NOT MAKE DISCOUNT CHANGES IN THIS BECAUSE IT CAN CAUSE AN ERROR IF WE ADDED IT AS A PROPERTY OF THE GYMMEMBERSHIP
public class GymMembership {
private String memberName;
private double duration;
private double monthlyFee;
/**
* Parameterized Constructor.
*
* @param name the name of the member
* @param duration the membership duration
* @param monthlyFee per month fee
*/
// initializating all the instance variables
public GymMembership(String name, double duration, double monthlyFee) {
this.memberName = name;
this.duration = duration;
this.monthlyFee = monthlyFee;
}
/**
* Returns the total cost of gym membership.
*
* @return total cost of gym membership
*/
public double getTotalCost() {
return duration * monthlyFee;
}
@Override
public String toString() {
String det = memberName + ", " + duration + ", " + monthlyFee;
return det;
}
} | [
"victoriajeniluc@gmail.com"
] | victoriajeniluc@gmail.com |
dc15a103b5da883194306bed4ea701cf80ef284e | 05b9336ac649eca835bbabc184f3ca21984e5157 | /src/java/com/util/Email.java | fbb3384476538b5f2d6f1f084bf7305caaf0a783 | [] | no_license | lawale4me/BulkSMS | 283c952ceda275ef0b1e2d9a41d69f915f2baf95 | ce352560bf049e683e8f770ebac8510fa559fdf0 | refs/heads/master | 2016-08-10T00:14:22.368286 | 2015-11-07T08:09:39 | 2015-11-07T08:09:39 | 45,107,051 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,784 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.util;
/**
*
* @author Ahmed
*/
public class Email {
private int emailid;
private String emailAddress;
private String subject;
private String message;
private int fetchStatus;
private int status;
/**
* @return the emailid
*/
public int getEmailid() {
return emailid;
}
/**
* @param emailid the emailid to set
*/
public void setEmailid(int emailid) {
this.emailid = emailid;
}
/**
* @return the emailAddress
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* @param emailAddress the emailAddress to set
*/
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
/**
* @return the subject
*/
public String getSubject() {
return subject;
}
/**
* @param subject the subject to set
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* @return the fetchStatus
*/
public int getFetchStatus() {
return fetchStatus;
}
/**
* @param fetchStatus the fetchStatus to set
*/
public void setFetchStatus(int fetchStatus) {
this.fetchStatus = fetchStatus;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
/**
* @return the status
*/
public int getStatus() {
return status;
}
/**
* @param status the status to set
*/
public void setStatus(int status) {
this.status = status;
}
}
| [
"ahmed.oladele@vanso.com"
] | ahmed.oladele@vanso.com |
c50b24191fd6af282bb71205285c4751e0f6a6f1 | 3c681b3ec0f1dee5d671bf131dce91a89ba279e1 | /app/src/main/java/com/amits/gomules/AboutUsFragment.java | 0d5776fe21015c93c82324c8e922d5618d1c20ab | [] | no_license | amitsbaghel/AndroidGoMules | ef84f1a2cfddf41c21a70223ff2f03c8b23e7fee | 3fb85b91ee87287c5cfd31ecfd954a51740a68a4 | refs/heads/master | 2020-03-12T02:33:36.781406 | 2018-04-26T00:42:56 | 2018-04-26T00:42:56 | 130,405,355 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,642 | java | package com.amits.gomules;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.amits.gomules.Utils.YouTubeConfig;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerSupportFragment;
public class AboutUsFragment extends Fragment {
Button btnPlay;
YouTubePlayerSupportFragment youTubePlayerFragment;
private static final String YoutubeAPI_KEY = YouTubeConfig.getApiKey();
// Go to https://console.developers.google.com/ and Use your Google acc tounto lo gin
// Use package name and SHA1 of your app to create Youtube API key
//add the key here
public AboutUsFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_about_us, container, false);
youTubePlayerFragment = YouTubePlayerSupportFragment.newInstance();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.add(R.id.youtubeplayer, youTubePlayerFragment).commit();
btnPlay = (Button) view.findViewById(R.id.btnPlay);
btnPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Setting initializer for loading and playing the video.
youTubePlayerFragment.initialize(YoutubeAPI_KEY, new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
if (!wasRestored) {
player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
player.loadVideo("MOJRWYzevLg");
player.play();
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult error) {
// YouTube error
// String errorMessage = error.toString();
}
});
}
});
return view;
}
} | [
"amitsb3747@gmail.com"
] | amitsb3747@gmail.com |
10d6bef940ae897df46ec9764f6ad07e2aa61329 | 5f6378f99694159e06979391c5265f0fca26f141 | /src/OOP/Constructor/define_class/CarDealer.java | 8b3d1d2c46f287da20f08e3b862703d53faa8586 | [] | no_license | NarTene/JavaTutorial | 62be40352fd1eee4ad16ced7561ea2f6157c42f3 | 9fc63ec704e1e885ef0e5ea5dc5cea51900f1f47 | refs/heads/master | 2020-06-01T03:58:22.378634 | 2019-06-06T18:29:34 | 2019-06-06T18:29:34 | 190,625,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package OOP.Constructor.define_class;
public class CarDealer {
public static void main(String[] args) {
Car carOne = new Car(4, "Red", "V8", "MODEL3");
System.out.println(carOne);
Car carTwo = new Car(4, "Silver", "V6", "MODEL 7");
System.out.println(carTwo);
}
}
| [
"narherve@yahoo.com"
] | narherve@yahoo.com |
83acba93890ddb31ea1912ad4d4ce32832899f9e | 3c0a799ccd177bb4cec3060262f2fc699a94dc18 | /src/基础知识/设计模式/原型模式/my/ConcretePrototype1.java | 2260fc15a1e8c599328e800c13ed91d38622bb8f | [] | no_license | gaohanghang/technology | 6c855a0b17c85940affdd67df807dd2106f5087c | f7de7153e1b9805a0cae5fea894bd9ba54627b97 | refs/heads/master | 2022-10-04T10:13:11.942340 | 2022-09-27T17:45:01 | 2022-09-27T17:45:01 | 125,711,791 | 1 | 2 | null | 2022-05-22T15:08:41 | 2018-03-18T09:58:35 | Java | UTF-8 | Java | false | false | 655 | java | package 基础知识.设计模式.原型模式.my;
/**
* @Description
* @Author Gao Hang Hang
* @Date 2019-07-06 13:11
**/
public class ConcretePrototype1 implements Prototype {
private String name;
@Override
public String getName() {
return this.name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public Prototype clone() {
Prototype prototype = new ConcretePrototype1();
prototype.setName(this.name);
return prototype;
}
@Override
public String toString() {
return "ConcretePrototype1 [name=" + name + "]";
}
}
| [
"1341947277@qq.com"
] | 1341947277@qq.com |
a84cc902a2feced32c1888cfd360dd01ec715e65 | edad005d6d5a79f894264a3750b41bf05cc7a65e | /src/main/java/com/myjhipster/web/rest/UserJWTController.java | d78f6d3fea9661fe461e8e0d888ecb92d84eda92 | [] | no_license | eduardomendes-git/jhipster-sample-application | 4041d874672dde229bba2d69e6ea4caeee0a6940 | 01996032d94a1c8a674e7b12fc6d809cda05b608 | refs/heads/main | 2023-04-30T19:40:02.717320 | 2021-05-19T05:27:58 | 2021-05-19T05:27:58 | 368,753,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,481 | java | package com.myjhipster.web.rest;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.myjhipster.security.jwt.JWTFilter;
import com.myjhipster.security.jwt.TokenProvider;
import com.myjhipster.web.rest.vm.LoginVM;
import javax.validation.Valid;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
/**
* Controller to authenticate users.
*/
@RestController
@RequestMapping("/api")
public class UserJWTController {
private final TokenProvider tokenProvider;
private final AuthenticationManagerBuilder authenticationManagerBuilder;
public UserJWTController(TokenProvider tokenProvider, AuthenticationManagerBuilder authenticationManagerBuilder) {
this.tokenProvider = tokenProvider;
this.authenticationManagerBuilder = authenticationManagerBuilder;
}
@PostMapping("/authenticate")
public ResponseEntity<JWTToken> authorize(@Valid @RequestBody LoginVM loginVM) {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(
loginVM.getUsername(),
loginVM.getPassword()
);
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
SecurityContextHolder.getContext().setAuthentication(authentication);
String jwt = tokenProvider.createToken(authentication, loginVM.isRememberMe());
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt);
return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK);
}
/**
* Object to return as body in JWT Authentication.
*/
static class JWTToken {
private String idToken;
JWTToken(String idToken) {
this.idToken = idToken;
}
@JsonProperty("id_token")
String getIdToken() {
return idToken;
}
void setIdToken(String idToken) {
this.idToken = idToken;
}
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
388597ec6e25441fe193e3057f3aa40c7719b1f0 | cbd239f20ee8a8e70e8d9eb31a48169201afa904 | /ServerV0000/src/org/reldb/rel/v0/engine/Rel.java | 61d40db8c0ac91bb99898c0d1aca3359ae5d79ea | [
"Apache-2.0"
] | permissive | pebsconsulting/Rel | 7ffa2f0c484d46de5b7fc65765850c223370b48e | 6894edf492cbae103e82a5b22d47982357053d2f | refs/heads/master | 2021-01-19T21:47:18.577495 | 2017-04-14T07:44:01 | 2017-04-14T07:44:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,934 | java | package org.reldb.rel.v0.engine;
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.PrintStream;
import org.reldb.rel.exceptions.DatabaseFormatVersionException;
import org.reldb.rel.exceptions.ExceptionFatal;
import org.reldb.rel.exceptions.ExceptionSemantic;
import org.reldb.rel.v0.interpreter.ClassPathHack;
import org.reldb.rel.v0.interpreter.Instance;
import org.reldb.rel.v0.interpreter.Interpreter;
import org.reldb.rel.v0.interpreter.ParseExceptionPrinter;
import org.reldb.rel.v0.languages.tutoriald.parser.ParseException;
import org.reldb.rel.v0.languages.tutoriald.parser.TokenMgrError;
import org.reldb.rel.v0.version.Version;
/** Convenient access point for running an embedded or stand-alone interpreter. */
public class Rel {
private Interpreter interpreter;
private Instance instance;
private PipedInputStream input;
private PrintStream output;
private static void buildClasspath() throws IOException {
ClassPathHack.addFile("lib/" + Version.getBerkeleyDbJarFilename());
ClassPathHack.addFile("lib/relshared.jar");
ClassPathHack.addFile("lib/ecj-4.6.1.jar");
}
/** Convenient runner for a stand-alone Rel interpreter.
* @throws IOException */
public static void main(String[] args) throws IOException {
buildClasspath();
org.reldb.rel.v0.interpreter.Instance.main(args);
}
/** Open this database and back it up to the named file. */
public static void backup(String databaseDir, String backupFileName) throws IOException, ParseException, DatabaseFormatVersionException {
buildClasspath();
PrintStream output = new PrintStream(backupFileName);
Instance instance = new Instance(databaseDir, false, output);
Interpreter interpreter = new Interpreter(instance.getDatabase(), output);
interpreter.interpret("BACKUP;");
output.close();
instance.dbclose();
}
/** Convert this database to the latest format, if necessary. Throw exception if not necessary. Normally only needed if invoking
* the constructor throws DatabaseFormatVersionException. */
public static void convertToLatestFormat(String databaseDir, PrintStream conversionOutput, String[] additionalJars) throws DatabaseFormatVersionException, IOException {
buildClasspath();
Instance.convertToLatestFormat(databaseDir, conversionOutput, additionalJars);
}
/** Establish a connection with this server. */
public Rel(String databaseDir, boolean createDbAllowed, String[] additionalJars) throws IOException, DatabaseFormatVersionException {
buildClasspath();
input = new PipedInputStream();
PipedOutputStream pipeOutput = new PipedOutputStream(input);
output = new PrintStream(pipeOutput, true);
instance = new Instance(databaseDir, createDbAllowed, output, additionalJars);
interpreter = new Interpreter(instance.getDatabase(), output);
instance.announceActive(output);
output.println("<EOT>");
}
public InputStream getServerResponseInputStream() throws IOException {
return input;
}
private static abstract class Action {
public abstract void execute() throws ParseException;
}
private boolean resetting = false;
private void send(Action action) throws Throwable {
try {
try {
action.execute();
} catch (Throwable tt) {
if (!resetting)
throw tt;
}
resetting = false;
} catch (ParseException pe) {
interpreter.reset();
output.println("ERROR: " + ParseExceptionPrinter.getParseExceptionMessage(pe));
} catch (TokenMgrError tme) {
interpreter.reset();
output.println("ERROR: " + tme.getMessage());
} catch (ExceptionSemantic es) {
interpreter.reset();
output.println("ERROR: " + es.getMessage());
} catch (ExceptionFatal et) {
interpreter.reset();
output.println("ERROR: " + et.getMessage());
et.printStackTrace(output);
et.printStackTrace();
throw et;
} catch (java.lang.Error jle) {
interpreter.reset();
output.println("ERROR: " + jle.getMessage());
} catch (Throwable t) {
interpreter.reset();
output.println("ERROR: " + t);
t.printStackTrace(output);
t.printStackTrace();
throw t;
}
output.println("<EOT>");
}
public void sendEvaluate(final String source) throws Throwable {
send(new Action() {
public void execute() throws ParseException {
interpreter.evaluate(source).toStream(output);
output.println();
}
});
}
public void sendExecute(final String source) throws Throwable {
send(new Action() {
public void execute() throws ParseException {
interpreter.interpret(source);
output.println("\nOk.");
}
});
}
public void reset() {
resetting = true;
interpreter.reset();
output.println();
output.println("Cancel.");
}
public void close() {
output.close();
}
}
| [
"dave@armchair.mb.ca"
] | dave@armchair.mb.ca |
881c583231efb6fc203e5e6eeda20d6ef0b796ff | f284f5c5d91e96c775ae8718337ede5246d1da3b | /app/src/androidTest/java/com/sample/sanketshah/ExampleInstrumentedTest.java | dd2a444334cd1dad0ed4afb8e30b9a843c3b0ac5 | [] | no_license | sanketshah92/MVVMPaging | 54193c4556b47073fd1e06737270c244b8f0b88f | 64881cfb20bf79bf5d12bac5aed08d4639d8eaa7 | refs/heads/master | 2020-04-07T10:22:37.992324 | 2018-11-19T20:14:38 | 2018-11-19T20:14:38 | 158,284,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package com.sample.sanketshah;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.sample.sanketshah", appContext.getPackageName());
}
}
| [
"sanket.shah@brainvire.com"
] | sanket.shah@brainvire.com |
1c113460d3ad102f708904a3a050a101c1afb45f | 0bee13d0e1287e2b83e75b9bfa3130a7fe8b4875 | /src/main/java/net/danbeach/gaming/constants/item/MagicBonusEnum.java | e978084102238be4d492ec899c9f1fe1a81d9b3c | [] | no_license | debeach/GamingAPI | d39f81f6557078bca43712f5237c774d9ba56bad | e00b71a071d3ca44d6bf7e7f4c58d9c2d501d8d5 | refs/heads/master | 2021-01-09T20:33:32.420035 | 2018-08-26T17:38:58 | 2018-08-26T17:38:58 | 63,827,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | 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 net.danbeach.gaming.constants.item;
/**
*
* @author deb
*/
public enum MagicBonusEnum {
MINUS_ONE(-1),
MINUS_TWO(-2),
PLUS_ONE(1),
PLUS_TWO(2),
PLUS_THREE(3),
PLUS_FOUR(4),
PLUS_FIVE(5);
private int bonus;
private MagicBonusEnum(int bonus){
this.bonus = bonus;
}
public int getBonus() {
return bonus;
}
public void setBonus(int bonus) {
this.bonus = bonus;
}
}
| [
"ddbeach87@gmail.com"
] | ddbeach87@gmail.com |
ccd7a72bee3d98a7e6c8b721016f5d7ec853b195 | 78f284cd59ae5795f0717173f50e0ebe96228e96 | /factura-negocio/src/cl/stotomas/factura/negocio/init_14/copy/copy/TestingVulnerabilities.java | b5e8eea127c343ad5d5359bb047c213f1674baf0 | [] | no_license | Pattricio/Factura | ebb394e525dfebc97ee2225ffc5fca10962ff477 | eae66593ac653f85d05071b6ccb97fb1e058502d | refs/heads/master | 2020-03-16T03:08:45.822070 | 2018-05-07T15:29:25 | 2018-05-07T15:29:25 | 132,481,305 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,279 | java | package cl.stotomas.factura.negocio.init_14.copy.copy;
import java.applet.Applet;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
//import cl.stomas.factura.negocio.testing.TestingModel.Echo;
public class TestingVulnerabilities {
public static String decryptMessage(final byte[] message, byte[] secretKey)
{
try {
// CÓDIGO VULNERABLE
final SecretKeySpec KeySpec = new SecretKeySpec(secretKey, "DES");
final Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, KeySpec);
// RECOMENDACIÓN VERACODE
// final Cipher cipher = Cipher.getInstance("DES...");
// cipher.init(Cipher.DECRYPT_MODE, KeySpec);
return new String(cipher.doFinal(message));
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
// Inclusión de funcionalidades de esfera de control que no es de confianza
// Un atacante puede insertar funcionalidades maliciosas dentro de este programa.
// Las Applet comprometen la seguridad. ya que sus funcionalidades se pueden adaptar a la Web
// Ademas la entrega de acceso de credenciales es engorrosa para el cliente.
public final class WidgetData extends Applet {
private static final long serialVersionUID = 1L;
public float price;
public WidgetData()
{
this.price = LookupPrice("MyWidgetType");
}
private float LookupPrice(String string) {
return 0;
}
}
class Echo {
// Control de Proceso
// Posible reemplazo de librería por una maliciosa
// Donde además s enos muestra el nombre explícito de esta.
public native void runEcho();
{
System.loadLibrary("echo"); // Se carga librería
}
public void main(String[] args)
{
new Echo().runEcho();
}
}
class EchoSecond {
// Control de Proceso
// Posible reemplazo de librería por una maliciosa
// Donde además s enos muestra el nombre explícito de esta.
public native void runEcho();
{
System.loadLibrary("echo"); // Se carga librería
}
public void main(String[] args)
{
new Echo().runEcho();
}
}
}
| [
"Adriana Molano@DESKTOP-GQ96FK8"
] | Adriana Molano@DESKTOP-GQ96FK8 |
bf684afbf10e724a1a23b78ae99570cdf52dbed5 | 951f563503af2d6f7e6dd6b4f0494735d7979d6f | /Pilas/src/pilas/Nodo.java | 34b6b154ebeaa2460e17d2344049d52fc821f58e | [] | no_license | santiagowac/Aprendiendo-Java | a94d247912a5a58838fc334548f5b5b0506ddf81 | 7bc59ba7fc6fdc70dcff16254ef05917ecdb7c2c | refs/heads/master | 2020-12-14T05:05:21.036660 | 2020-01-17T23:48:33 | 2020-01-17T23:48:33 | 234,650,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | 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 pilas;
/**
* curso: Estructura de datos
* codigo: 1016113251
* @author Welver Santiago Amado Camargo
* Proyecto : Manejo de Pilas
*
*/
public class Nodo {
private int dato;
private Nodo siguiente;
public void Nodo() {
this.dato = 0;
this.siguiente = null;
}
public int getDato() {
return dato;
}
public void setDato(int dato) {
this.dato = dato;
}
public Nodo getSiguiente() {
return siguiente;
}
public void setSiguiente(Nodo siguiente) {
this.siguiente = siguiente;
}
}
| [
"santiagoamadolml@hotmail.com"
] | santiagoamadolml@hotmail.com |
1153560dbb63fc31fa8e821bc316f6bcffc78c68 | ce389e669dba9125fb457d12a95d3771c076316f | /app/src/main/java/com/zxiaofan/yunyi/update/CheckVersionTask.java | 3c57735344a5ac86f1a7ea4ffd427f618598426d | [] | no_license | zxiaofan/YunYiAPP | ba01f86bc95be6044b0b79c3a7e6a70d34136388 | 57a0b2367c9468241f916bda4254a05c052d21de | refs/heads/master | 2020-09-27T07:24:22.442989 | 2016-09-12T16:06:45 | 2016-09-12T16:06:45 | 67,935,497 | 28 | 7 | null | null | null | null | UTF-8 | Java | false | false | 3,242 | java | package com.zxiaofan.yunyi.update;
import java.util.HashMap;
import java.util.Map;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.AsyncTask;
import util.JsonUtils;
/**
* Describe: 检查更新异步任务
* User: xiaofan
* Date: 2016/4/12 10:21
*/
@SuppressLint("NewApi")
public class CheckVersionTask extends AsyncTask<Void, Integer, Boolean> {
private int newVerCode = -1;
private String newVerName = "";
private Context currentContext;
private int curVerCode;
private int type; //
public static String UPDATE_SERVER;//更新的服务器地址
public static String UPDATE_VERJSON;//更新的版本号
public static String SERVER_APP_NAME;//更新的app名称
public static String UPDATE_SAVENAME;
private TaskInf inf;
Map<String, Object> object = null;
Map<String, Object> backObj = null;
public CheckVersionTask(Context context) {
this.currentContext = context;
this.UPDATE_SERVER =Config.UPDATE_SERVER;
this.SERVER_APP_NAME = Config.SERVER_APP_NAME;
this.curVerCode = Config.getVerCode(context);//当前应用版本号
}
public void setListener(TaskInf inf) {
this.inf = inf;
}
private Integer getServerVerCode() {
try {
// String verjson = NetworkTool.getContent(UPDATE_SERVER
// + UPDATE_VERJSON);
String verjson = "{'success':'1','msg':'成功','data':{'version':'5720','versionName':'1.1(build:2016-06-02)','content':'修复bug'}}";
object = JsonUtils.getMapObj(verjson);
if (object.get("success").toString().equals("0")) {
return 0;
} else if(object.get("success").toString().equals("1")) {
object = JsonUtils.getMapObj(object.get("data").toString());
return 1;
}else{
return 2;
}
} catch (Exception e) {
return 2;
}
}
@Override
protected void onPreExecute() {
inf.onPreExecute();
super.onPreExecute();
}
@Override
protected Boolean doInBackground(Void... params) {
if (getServerVerCode()==1) {
newVerCode=Integer.parseInt(object.get("version").toString());//获取服务器存储的版本号
if (newVerCode > curVerCode) {
return true;
}
}
return false;
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
backObj=new HashMap<>();
if (result) {
backObj.put("version",object.get("version").toString());//更新版本号
backObj.put("curVerName",Config.getVerName(currentContext));//当前版本名称1.0.2
backObj.put("newVerName",object.get("versionName").toString());//更新版本名称1.0.3
backObj.put("content",object.get("content").toString());//更新内容
backObj.put("checkTime", String.valueOf(System.currentTimeMillis()));//更新时间
backObj.put("isUpdate",true);//是否更新
} else {
backObj.put("isUpdate",false);
}
inf.isSuccess(backObj);
}
}
| [
"zeng-dream@live.com"
] | zeng-dream@live.com |
53a34e04844500739de93acb50f102570383fbfb | c2de1ef0aabde3de5b9e0da843e752829cea80ff | /src/graphics/PerspectiveFigure.java | 9337a88130bdb77175a3a29d6d3015662f850e33 | [
"Unlicense"
] | permissive | kamac/SoftwareRenderer | 7c91a9fdc226b0005a7045b2a9eefff2674b060d | d52ab30b0b1b92335fb7b9f9589c94a4a072ecc7 | refs/heads/master | 2021-05-14T01:11:08.158426 | 2018-01-07T12:15:18 | 2018-01-07T12:15:18 | 116,559,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,643 | java | package graphics;
import org.joml.Matrix4f;
import org.joml.Vector3f;
import org.joml.Vector4f;
import java.util.ArrayList;
import java.util.Arrays;
public class PerspectiveFigure extends Figure {
public PerspectiveFigure(Matrix4f m) {
float fov = m.perspectiveFov();
float near = m.perspectiveNear();
float far = m.perspectiveFar();
float depth = far - near;
float nearSize = 2.0f * near * (float)Math.tan(fov / 2);
float farSize = 2.0f * far * (float)Math.tan(fov / 2);
ArrayList<Triangle> triangles = new ArrayList<>();
// front
triangles.addAll(Arrays.asList(QuadFigure.build(
new Vertex(new Vector4f(-nearSize/2, -nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(nearSize/2, -nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(nearSize/2, nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(-nearSize/2, nearSize/2, depth/2, 1.0f)),
new Vector3f(0.0f, 0.0f, -1.0f)
)));
// back
triangles.addAll(Arrays.asList(QuadFigure.build(
new Vertex(new Vector4f(-farSize/2, farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(-farSize/2, -farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(farSize/2, -farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(farSize/2, farSize/2, -depth/2, 1.0f)),
new Vector3f(0.0f, 0.0f, 1.0f)
)));
// top
triangles.addAll(Arrays.asList(QuadFigure.build(
new Vertex(new Vector4f(nearSize/2, nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(-nearSize/2, nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(-farSize/2, farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(farSize/2, farSize/2, -depth/2, 1.0f)),
new Vector3f(0.0f, 1.0f, 0.0f)
)));
// bottom
triangles.addAll(Arrays.asList(QuadFigure.build(
new Vertex(new Vector4f(farSize/2, -farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(nearSize/2, -nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(-nearSize/2, -nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(-farSize/2, -farSize/2, -depth/2, 1.0f)),
new Vector3f(0.0f, -1.0f, 0.0f)
)));
// left
triangles.addAll(Arrays.asList(QuadFigure.build(
new Vertex(new Vector4f(-farSize/2, -farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(-farSize/2, farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(-nearSize/2, nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(-nearSize/2, -nearSize/2, depth/2, 1.0f)),
new Vector3f(-1.0f, 0.0f, 0.0f)
)));
// right
triangles.addAll(Arrays.asList(QuadFigure.build(
new Vertex(new Vector4f(nearSize/2, -nearSize/2, depth/2, 1.0f)),
new Vertex(new Vector4f(farSize/2, -farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(farSize/2, farSize/2, -depth/2, 1.0f)),
new Vertex(new Vector4f(nearSize/2, nearSize/2, depth/2, 1.0f)),
new Vector3f(1.0f, 0.0f, 0.0f)
)));
_triangles = triangles.toArray(new Triangle[triangles.size()]);
for(int i = 0; i < _triangles.length; i++)
for(int j = 0; j < _triangles[i].vertices.length; j++)
_triangles[i].vertices[j].position.add(0.0f, 0.0f, -depth/2 - near, 0.0f);
}
}
| [
"kamac2495@gmail.com"
] | kamac2495@gmail.com |
44f4648d869fef0f34022dba4414d6cd062cb4f8 | 46c057f865c298abf1213d59eb6083a06395b398 | /app/src/main/java/org/smalldatalab/northwell/impulse/ImpulsivityNotificationDAO.java | 7235dc859b572d8cdd130d51ae6443cdbb3543be | [
"LicenseRef-scancode-bsd-3-clause-no-trademark",
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | smalldatalab/northwell-impulse-android | 876f4f701590dd38429008dab7e3ed2e65b6b174 | 9b9d1acff9c28440f3a37550c9ab53d50061cc3b | refs/heads/master | 2021-01-24T03:25:10.663879 | 2017-07-09T05:41:18 | 2017-07-09T05:41:18 | 66,388,294 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,018 | java | package org.smalldatalab.northwell.impulse;
import android.content.Context;
import android.support.annotation.Nullable;
import org.sagebionetworks.bridge.android.manager.dao.SharedPreferencesJsonDAO;
import java.util.Date;
/**
* Created by jameskizer on 5/24/17.
*/
public class ImpulsivityNotificationDAO extends SharedPreferencesJsonDAO {
private static final String PREFERENCES_FILE = "notifications";
private static final String KEY_MORNING_NOTIFICATION_TIME = "MorningNotification.NOTIFICATION";
private static final String KEY_MORNING_NOTIFICATION_TIME_2ND = "MorningNotification.NOTIFICATION_2ND";
private static final String KEY_EVENING_NOTIFICATION_TIME = "EveningNotification.NOTIFICATION";
private static final String KEY_EVENING_NOTIFICATION_TIME_2ND = "EveningNotification.NOTIFICATION_2ND";
private static final String KEY_21_DAY_NOTIFICATION_TIME = "21DayNotification.NOTIFICATION";
private static final String KEY_21_DAY_NOTIFICATION_TIME_2ND = "21DayNotification.NOTIFICATION_2ND";
public ImpulsivityNotificationDAO(Context applicationContext) {
super(applicationContext, PREFERENCES_FILE);
}
@Nullable
public Date getMorningNotificationTime() {
return this.getValue(KEY_MORNING_NOTIFICATION_TIME, Date.class);
}
@Nullable
public Date getMorningNotificationTime2nd() {
return this.getValue(KEY_MORNING_NOTIFICATION_TIME_2ND, Date.class);
}
public void setMorningNotificationTime(Date firstNotification) {
this.setValue(KEY_MORNING_NOTIFICATION_TIME, firstNotification, Date.class);
}
public void setMorningNotificationTime2nd(Date secondNotification) {
this.setValue(KEY_MORNING_NOTIFICATION_TIME_2ND, secondNotification, Date.class);
}
@Nullable
public Date getEveningNotificationTime() {
return this.getValue(KEY_EVENING_NOTIFICATION_TIME, Date.class);
}
@Nullable
public Date getEveningNotificationTime2nd() {
return this.getValue(KEY_EVENING_NOTIFICATION_TIME_2ND, Date.class);
}
public void setEveningNotificationTime(Date firstNotification) {
this.setValue(KEY_EVENING_NOTIFICATION_TIME, firstNotification, Date.class);
}
public void setEveningNotificationTime2nd(Date secondNotification) {
this.setValue(KEY_EVENING_NOTIFICATION_TIME_2ND, secondNotification, Date.class);
}
@Nullable
public Date get21DayNotificationTime() {
return this.getValue(KEY_21_DAY_NOTIFICATION_TIME, Date.class);
}
@Nullable
public Date get21DayNotificationTime2nd() {
return this.getValue(KEY_21_DAY_NOTIFICATION_TIME_2ND, Date.class);
}
public void set21DayNotificationTime(Date firstNotification) {
this.setValue(KEY_21_DAY_NOTIFICATION_TIME, firstNotification, Date.class);
}
public void set21DayNotificationTime2nd(Date secondNotification) {
this.setValue(KEY_21_DAY_NOTIFICATION_TIME_2ND, secondNotification, Date.class);
}
}
| [
"james.kizer@gmail.com"
] | james.kizer@gmail.com |
788d2cf4174b8c01eb686acdd3baecdb03b3a9ac | 7e576135097dbff6aee166ea6f3a3492d4266043 | /OriStone/src/com/cyw/oristone/ast/BinaryExpr.java | f4050e1aa2a2b9df491964ead0a58e16fed4335e | [] | no_license | cyw3/OriStone | ffecbea20b25539567cf02a0eeff75bf1095927e | a783822b11d065d57ff3d823e045a32d37eb4be4 | refs/heads/master | 2016-08-11T14:15:50.392120 | 2016-01-25T10:00:11 | 2016-01-25T10:00:11 | 49,820,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.cyw.oristone.ast;
import java.util.List;
public class BinaryExpr extends ASTList {
public BinaryExpr(List<ASTree> list) {
super(list);
}
public ASTree left(){
return child(0);
}
public String operator(){
return ((ASTLeaf)child(1)).token.getText();
}
public ASTree right(){ return child(2); }
}
| [
"2927096163@qq.com"
] | 2927096163@qq.com |
61a733df66c100f9f2eafb4bca18ce9883d12123 | 51e9c0614a8f13317edc0b2800d0694e3420cff1 | /src/main/java/ConversationHandler/Time.java | d9f48e81ff15dca8a5eb134f1e7c44a8e100525e | [] | no_license | paprice/aria | a04969abdad363f0775b80c2cfd921e892d958a8 | ce316ea1ba7a7fda2d36054034e47c50a01061c9 | refs/heads/master | 2021-08-30T02:36:37.735078 | 2017-12-15T18:51:35 | 2017-12-15T18:51:35 | 103,711,473 | 0 | 0 | null | 2017-11-22T01:26:42 | 2017-09-16T00:10:41 | Java | UTF-8 | Java | false | false | 315 | 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 ConversationHandler;
/**
*
* @author gildo
*/
public enum Time {
PASSE,
PRESENT,
FUTUR;
}
| [
"gildo@LAPTOP-0LLN8UB8"
] | gildo@LAPTOP-0LLN8UB8 |
42ba3e7297e6e8cd831c03c2e0e9cdf728cb47e9 | dafd7764fb85812d3fa0990cd55761c3ae2eaa27 | /spring-boot-web/src/test/java/com/dany/HelloControllerTest.java | 59791cbcaed678abd912b3984dcc2dc36eff4209 | [] | no_license | dany2fiona/spring-boot-demos | 345a7f5b96eff4b715964ad351a3cce20ff5fd9a | 538b6321981d593ea746acd43b8b68e3f5e11978 | refs/heads/master | 2021-08-04T09:08:50.911938 | 2019-01-17T09:22:24 | 2019-01-17T09:22:24 | 153,735,592 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,766 | java | package com.dany;
import com.dany.controller.HelloController;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@SpringBootTest
public class HelloControllerTest {
private MockMvc mvc;
//初始化执行
@Before
public void setUp() throws Exception{
mvc = MockMvcBuilders.standaloneSetup(new HelloController()).build();
}
//验证controller是否正常响应并打印返回结果
@Test
public void getHello() throws Exception{
mvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
}
//验证controller是否正常响应并判断返回结果是否正确
@Test
public void testHello() throws Exception{
mvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(equalTo("hello world")));
}
}
| [
"yangdan90@126.com"
] | yangdan90@126.com |
4a546549e46e9223f6b979d1492c6f0f91928aa9 | ff4fef75cdf2f45340bbf1a31cbc6f5f56911cb9 | /src/main/java/io/vertx/stomp/StompClient.java | 5a41183faec78ccdf579a7405c543db5612353b2 | [
"Apache-2.0"
] | permissive | purplefox/mod-stomp-server | 3edefa29e18d0b87179132efd2a41a5fb9d6ee0e | 7c5174687a886e8108ab2895aee5d4022b94283c | refs/heads/master | 2020-12-24T15:31:13.575545 | 2013-12-09T14:15:42 | 2013-12-09T14:15:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,468 | java | package io.vertx.stomp;
import org.vertx.java.core.AsyncResult;
import org.vertx.java.core.Handler;
import org.vertx.java.core.impl.DefaultFutureResult;
import org.vertx.java.core.net.NetClient;
import org.vertx.java.core.net.NetSocket;
public class StompClient {
private NetClient netClient;
public StompClient(NetClient netClient) {
this.netClient = netClient;
}
public void connect(int port, Handler<AsyncResult<StompConnection>> connectHandler) {
connect(port, "localhost", null, null, connectHandler);
}
public void connect(int port, String host, Handler<AsyncResult<StompConnection>> connectHandler) {
connect(port, host, null, null, connectHandler);
}
public void connect(int port, String host, final String username, final String password,
final Handler<AsyncResult<StompConnection>> connectHandler) {
netClient.connect(port, host, new Handler<AsyncResult<NetSocket>>() {
public void handle(AsyncResult<NetSocket> res) {
if (res.succeeded()) {
final StompConnection conn = new StompConnection(res.result());
conn.connect(username, password, new Handler<AsyncResult<StompConnection>>() {
public void handle(AsyncResult<StompConnection> res2) {
connectHandler.handle(res2);
}
});
} else {
connectHandler.handle(new DefaultFutureResult<StompConnection>(res.cause()));
}
}
});
}
}
| [
"timvolpe@gmail.com"
] | timvolpe@gmail.com |
9dd4c6c237f5775fcc786847a472bcda6d40bab4 | 31e02f1ea274133ef9fa6f02f9629cd80fd94cc5 | /CrossingPlay/src/Play.java | 43fb896f632b6637da3fde314b72562429f22d95 | [] | no_license | ChristopherSaunders/Projects | e7fbccce47575c6e47c6621847b5481f9889498a | 2155e71ea1df116a516a6cad12794c1b402aef71 | refs/heads/master | 2020-06-10T20:45:43.216495 | 2016-12-07T22:03:11 | 2016-12-07T22:03:11 | 75,875,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,175 | java |
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.TargetDataLine;
import javax.swing.Timer;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
/**
*
* @author chris
*/
public class Play extends javax.swing.JFrame {
Properties p = new Properties();
/**
* Creates new form Play
*/
public Play() {
initComponents();
p.setBackground(p.currBackground);
p.setStroke(p.currStoke);
}
/**
* 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() {
jInternalFrame1 = new javax.swing.JInternalFrame();
Main = new javax.swing.JPanel();
jMenuBar1 = new javax.swing.JMenuBar();
PlayItem = new javax.swing.JMenu();
PlayFiles = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jInternalFrame1.setVisible(true);
Main.setBackground(new java.awt.Color(255, 255, 255));
javax.swing.GroupLayout MainLayout = new javax.swing.GroupLayout(Main);
Main.setLayout(MainLayout);
MainLayout.setHorizontalGroup(
MainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1464, Short.MAX_VALUE)
);
MainLayout.setVerticalGroup(
MainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 631, Short.MAX_VALUE)
);
PlayItem.setText("Play");
PlayFiles.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
PlayFiles.setText("Read Files");
PlayFiles.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
PlayFilesActionPerformed(evt);
}
});
PlayItem.add(PlayFiles);
jMenuBar1.add(PlayItem);
jInternalFrame1.setJMenuBar(jMenuBar1);
javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Main, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Main, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jInternalFrame1)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jInternalFrame1)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void PlayFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PlayFilesActionPerformed
try {
String gongFile ="RecordAudio.wav";
InputStream in = new FileInputStream(gongFile);
// create an audiostream from the inputstream
AudioStream audioStream = new AudioStream(in);
// play the audio clip with the audioplayer class
AudioPlayer.player.start(audioStream);
p.text.check(1);
} catch (IOException ex) {
Logger.getLogger(Play.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_PlayFilesActionPerformed
/**
* @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(Play.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Play.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Play.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Play.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 Play().setVisible(true);
}
});
}
class Properties {
private Date time = new Date();
private long currTime = setCurrTime(new Date());
private long startTime = currTime;
private long timeDiff;
private Timings Ptimings= new Timings();
private boolean isMoving = false;
private boolean isClicked = false;
private boolean canRecord = false;
private Color currStoke = Color.BLACK;
private Color currBackground = Color.WHITE;
private boolean canDraw = true;
private int segCounter =0;
private int strokeCounter = 0;
private int pages = 1;
private int backgroundCounter = 0;
private VoiceRecording vr;
private int timeBreakCounter = 0;
private Text text = new Text();
private ArrayList<Long> Times = new ArrayList<>();
private ArrayList<Long> timeBreaks = new ArrayList<>();
private ArrayList<Point> seg = new ArrayList<>();
private ArrayList<ArrayList<Point>> segments = new ArrayList<>();
private boolean isVoiceRecording = false;
private Properties TempProperties;
private boolean playing = false;
private String [] data;
public void setMoving(boolean move){
System.out.println("Moving");
this.isMoving = move;
}
public void setClicked(boolean clicked){
System.out.println("Clicked");
this.isMoving = clicked;
}
public void setStroke(Color c){
this.currStoke = c;
}
public void setBackground(Color c){
Main.setBackground(c);
this.currBackground = c;
}
public long setCurrTime(Date d){
return currTime = d.getTime();
}
public void setTimeBreak(Long time){
this.timeBreaks.add(time);
// for(int i = 0; i < timeBreaks.size(); i++)
// System.out.println("Timesbreaks("+i+"): " + this.timeBreaks.get(i));
}
public void setTimeDiff(){
Date d = new Date();
timeDiff = d.getTime() - getCurrTime();
setTimes(timeDiff);
setCurrTime(new Date());
}
public void setTimes(Long time){
this.Times.add(time);
}
public boolean getDraw(){
return canDraw;
}
public long getCurrTime(){
return currTime;
}
public long getTimeDiff(){
return timeDiff;
}
public boolean getVoiceRecording(){
return isVoiceRecording;
}
public boolean getPlaying(){
return playing;
}
public void draw(Graphics g){
if(canDraw == true){
g.setColor(currStoke);
System.out.println(this.isClicked);
System.out.println(this.isMoving);
System.out.println("Drawing");
System.out.println("draw Seg Counter: " + segCounter);
g.drawLine(segments.get(segCounter).get(seg.size()-2).x,
segments.get(segCounter).get(seg.size()-2).y,
segments.get(segCounter).get(seg.size()-1).x,
segments.get(segCounter).get(seg.size()-1).y);
}
}
public void drawDot(Graphics g, Point point){
g.setColor(currStoke);
g.fillRect(point.x, point.y, 1, 1);
}
public void createSegment(int index){
ArrayList<Point> a = new ArrayList();
seg = a;
System.out.println("Size " + seg.size());
segments.add(index, seg);
}
public void clearAll(){
this.timeDiff= 0;
this.seg.clear();
this.segments.clear();
this.segCounter=0;
this.currStoke = Color.BLACK;
this.setBackground(Color.WHITE);
this.setCurrTime(new Date());
this.Times.clear();
this.timeBreakCounter = 0;
this.timeBreaks.clear();
this.clearScreen(Main.getGraphics());
}
public void record(){
this.clearAll();
this.canRecord = true;
}
public void InitVoiceRecord(){
vr = new VoiceRecording();
}
public void newPage() throws IOException{
text = new Text(pages);
clearAll();
}
public void stopRecording(){
isVoiceRecording = false;
vr.finish();
}
public void recording(){
// creates a new thread that waits for a specified
Thread recorder = new Thread(new Runnable() {
public void run(){
vr.start();
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
});
recorder.start();
}
public void clearScreen(Graphics g){
g.setColor(this.currBackground);
g.fillRect(0,0, Main.getWidth(), Main.getHeight());
}
public void readData(String [] data, int page){
int index = 0;
int TempSegmentsIndex = -1;
int TempSegIndex = -1;
ArrayList<Long> TempTimes = new ArrayList<>();
ArrayList<Long> TempTimeBreaks = new ArrayList<>();
ArrayList<Point> TempSeg;
ArrayList<ArrayList<Point>> TempSegments = new ArrayList<>();
Color TempBackGround = Color.WHITE;
Color TempStroke = Color.BLACK;
String segmentDone = "-segmentDone-";
String SegmentsDone = "-SegmentsDone-";
String Segments = "-Segments-";
String segs = "-segs-";
String segsDone = "-segsDone-";
String Times = "-Times-";
String nextTime = "-nextTime-";
String TimesDone = "-TimesDone-";
String TimeDiff = "-TimeDiff-";
String nextTimeDiff = "-nextTimeDiff-";
String TimeDiffDone = "-TimeDiffDone-";
String BackGround = "-BackGround-";
String Stoke = "-Stoke-";
String Finished = "-Finished-";
while(index < data.length){
System.out.println(data[index].trim());
while(!data[index].trim().equals(SegmentsDone)){
System.out.println(data[index].trim());
if(data[index].trim().equals(Segments)){
index++;
TempSegmentsIndex++;
TempSeg = new ArrayList<>();
System.out.println(data[index].trim());
while(data[index].trim().equals(segs)){
index++;
TempSegIndex++;
String [] XY = data[index].trim().split(",");
Point point = new Point(Integer.parseInt(XY[0].trim()), Integer.parseInt(XY[1].trim()));
TempSeg.add(point);
index++;
System.out.println(data[index].trim());
if(data[index].trim().equals(segsDone)){
index++;
TempSegments.add(TempSeg);
TempSegIndex = 0;
if(data[index].trim().equals(segmentDone)){
TempSegmentsIndex++;
index++;
}
}
}
}
}
index++;
//Where you left off reading times from file
//System.out.println(data[index].trim());
if(data[index].trim().equals(Times)){
System.out.println("Comparar: " + data[index].trim());
index++;
while(!data[index].trim().equals("-TimesDone-")){
System.out.println(data[index].trim());
System.out.println("Time: " + data[index].trim());
TempTimes.add(Long.parseLong(data[index].trim()));
index++;
System.out.println("nextTime "+ data[index].trim());
if(data[index].trim().equals(nextTime))
index++;
}
}
if(data[index].trim().equals(TimesDone)){
index++;
if(data[index].trim().equals(TimeDiff)){
while(!data[index].trim().equals("-TimeDiffDone-")){
System.out.println("timediff "+data[index].trim());
index++;
System.out.println("Int: "+data[index].trim());
TempTimeBreaks.add(Long.parseLong(data[index].trim()));
index++;
System.out.println("nextTime" + data[index].trim());
if(data[index].trim().equals(nextTimeDiff)){
if(data[index+1].trim().equals(TimeDiffDone)){
System.out.println("done");
index++;
}
}
if(data[index].trim().equals(TimeDiffDone)){
System.out.println("Stay");
}
}
}
if(data[index].trim().equals(TimeDiffDone))
index++;
}
if(data[index].trim().equals(BackGround)){
index++;
String [] color = data[index].trim().split(",");
float [] c = Color.RGBtoHSB(Integer.parseInt(color[0]), Integer.parseInt(color[1]), Integer.parseInt(color[2]),null);
TempBackGround = Color.getHSBColor(c[0], c[1], c[2]);
index++;
}
if(data[index].trim().equals(Stoke)){
index++;
String [] color = data[index].trim().split(",");
float [] c = Color.RGBtoHSB(Integer.parseInt(color[0]), Integer.parseInt(color[1]), Integer.parseInt(color[2]),null);
TempStroke = Color.getHSBColor(c[0], c[1], c[2]);
index++;
}
if(data[index].trim().equals(Finished)){
index++;
}
}
System.out.println("Reading Complete....");
TempProperties = new Properties();
TempProperties.currStoke = TempStroke;
TempProperties.currBackground = TempBackGround;
TempProperties.segments = TempSegments;
System.out.println(TempSegments.get(0).get(0).x + "," +TempSegments.get(0).get(0).y);
TempProperties.Times = TempTimes;
System.out.println("Temp times: "+TempTimes.get(0));
TempProperties.timeBreaks = TempTimeBreaks;
System.out.println("Temp: " + TempProperties.currBackground);
TempProperties.play(page);
}
public void play(){
clearScreen(Main.getGraphics());
System.out.println("Playing....");
Timers timer = new Timers();
timer.drawTimer.start();
p.clearScreen(Main.getGraphics());
}
public void play(int pages){
clearScreen(Main.getGraphics());
System.out.println("Playing....");
Timers timer = new Timers();
timer.currpage = pages;
timer.drawTimer.start();
p.clearScreen(Main.getGraphics());
}
class Timers{
Replay replay= new Replay(this,Ptimings);
Timer drawTimer = new Timer(1,replay);
Timer strokeTimer = new Timer(1,null);
Timer backgroundTimer = new Timer(1,null);
long drawCounter = 0;
long strokeCounter = 0;
long backgroundCounter = 0;
int currpage = -1;
long getDrawCounter(){
System.out.println("Drawcounter: " + drawCounter);
return drawCounter;
}
long getStrokeCounter(){
return strokeCounter;
}
long getBackgroundCounter(){
return backgroundCounter;
}
}
class Timings{
private long startTime = 0;
private long backgroundCT = 0;
private long strokeCT = 0;
private ArrayList<Long> strokeTimes = new ArrayList<>();
private ArrayList<Long> backgroundTimes= new ArrayList<>();
public void setStartTime(long s){
this.startTime = s;
}
public long setCurrTime(Date d){
return d.getTime();
}
public void setTimeDiff(long currtime, ArrayList<Long> list){
Date d = new Date();
long ct = d.getTime();
long timediff = d.getTime() - currTime;
list.add(timediff);
currtime = ct;
}
}
public class VoiceRecording{// record duration, in milliseconds
static final long RECORD_TIME = 6000; // 1 minute
// path of the wav file
File wavFile = new File("RecordAudio.wav");
// format of audio file
AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;
// the line from which audio data is captured
TargetDataLine line;
AudioFormat getAudioFormat() {
float sampleRate = 8000;
int sampleSizeInBits = 16;
int channels = 2;
boolean signed = true;
boolean bigEndian = true;
AudioFormat format = new AudioFormat(sampleRate, sampleSizeInBits,channels, signed, bigEndian);
return format;
}
/**
* Captures the sound and record into a WAV file
*/
void start() {
try {
AudioFormat format = getAudioFormat();
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
// checks if system supports the data line
if (!AudioSystem.isLineSupported(info)) {
System.out.println("Line not supported");
System.exit(0);
}
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format);
line.start(); // start capturingSystem.out.println("Start capturing...");
AudioInputStream ais = new AudioInputStream(line);
System.out.println("Start recording...");
// start recording
AudioSystem.write(ais, fileType, wavFile);
} catch (LineUnavailableException ex) {
ex.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
/**
* Closes the target data line to finish capturing and recording
*/
void finish() {
line.stop();
line.close();
System.out.println("Finished");
}
}
class Replay implements ActionListener{
long t = 0;
int Bseg = 0;
int Sseg = 0 ;
int times = 0;
int tbreaks = 0;
int sc = 1;
int bc = 1;
int currpage = -1;
String file = "";
Graphics g = Main.getGraphics();
Timers timers;
Timings replayTimings;
Replay(Timers t, Timings tm){
timers= t;
if(t == null)
System.out.println("t is null");
replayTimings = tm;
}
public String getFile(){
return file;
}
@Override
public void actionPerformed(ActionEvent ae) {
Main.setBackground(currBackground);
System.out.print("Color: " + currBackground);
g.setColor(currStoke);
if(Bseg < segments.size()){
System.out.println("Bseg: " + Bseg +" size: " + segments.get(Bseg).size());
if(Sseg+1 < (segments.get(Bseg).size())){
System.out.println("P times " + Times.get(this.times));
if(timers.getDrawCounter() == Times.get(this.times)){
System.out.println("P times " + Times.get(this.times));
g.drawLine(segments.get(Bseg).get(Sseg).x,
segments.get(Bseg).get(Sseg).y,
segments.get(Bseg).get(Sseg+1).x,
segments.get(Bseg).get(Sseg+1).y);
timers.drawTimer.restart();
timers.drawCounter=0;
Sseg+=1;
this.times++;
}
}
else{
Bseg+=1;
Sseg = 0;
timers.drawCounter=0;
}
}
if(Bseg == segments.size()){
this.Bseg = 0;
this.Sseg = 0;
this.t = 0;
this.timers.drawTimer.stop();
playing = false;
if(timers.currpage != -1){
try {
text.check(timers.currpage+1);
} catch (IOException ex) {
Logger.getLogger(Play.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
this.timers.drawCounter++;
// this.bc++;
// this.sc++;
}
}
public class Text {
DataOutputStream dos;
String [] file;
Reading reading;
boolean canPlay = true;
public void check (int fileName) throws FileNotFoundException, IOException{
if(new File(Integer.toString(fileName)).exists()){
System.out.println("File exist");
reading = new Reading(new FileInputStream(Integer.toString(fileName)));
System.out.println("Reading...........................");
reading.read();
file = reading.getText().split(" ");
System.out.println(file[0]);
reading.close();
readData(file, fileName);
}
else{
System.out.println("File Doesn't exist");
}
}
public Text(){
}
public Text(int num) throws FileNotFoundException, IOException{
dos = new DataOutputStream(new FileOutputStream(Integer.toString(pages)));
int segTempCount =0;
int segmentsTempCount =0;
while(segmentsTempCount < segments.size()){
dos.writeUTF("-Segments- ");
System.out.println("Segments");
while(segTempCount < segments.get(segmentsTempCount).size()){
dos.writeUTF("-segs- ");
System.out.println("segs");
String points = segments.get(segmentsTempCount).get(segTempCount).x + ","+segments.get(segmentsTempCount).get(segTempCount).y + " ";
dos.writeUTF(points);
System.out.println(points);
segTempCount++;
}
System.out.println("segsDone");
dos.writeUTF("-segsDone- ");
segTempCount = 0;
segmentsTempCount++;
dos.writeUTF("-segmentDone- ");
}
dos.writeUTF("-SegmentsDone- ");
dos.writeUTF("-Times- ");
int timesIndex = 0;
while(timesIndex <Times.size()){
dos.writeUTF(Long.toString(Times.get(timesIndex))+ " ");
dos.writeUTF("-nextTime- ");
timesIndex++;
}
dos.writeUTF("-TimesDone- ");
timesIndex = 0;
dos.writeUTF("-TimeDiff- ");
while(timesIndex < timeBreaks.size()){
dos.writeUTF(Long.toString(timeBreaks.get(timesIndex))+ " ");
dos.writeUTF("-nextTimeDiff- ");
timesIndex++;
}
dos.writeUTF("-TimeDiffDone- ");
dos.writeUTF("-BackGround- ");
dos.writeUTF(currBackground.getRed()+ ","+currBackground.getGreen()+","+currBackground.getBlue()+ " ");
dos.writeUTF("-Stoke- ");
dos.writeUTF(currStoke.getRed()+ ","+currStoke.getGreen()+","+currStoke.getBlue()+ " ");
dos.writeUTF("-Finished- ");
dos.flush();
dos.close();
Reading reading = new Reading(new FileInputStream(Integer.toString(pages)));
pages+=1;
}
public class Reading extends FilterInputStream {
private String message = "";
public Reading(InputStream in) throws IOException{
super(in);
}
@Override
public int read() throws IOException{
String temp = "";
int value;
String FirstLetter = "";
int counter = 0;
while(((value = in.read()) != -1)){
if(counter == 0)
in.skip(1);
message += (char)value;
counter++;
}
temp += message;
message = temp;
return 0;
}
public String getText(){
return message;
}
}
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel Main;
private javax.swing.JMenuItem PlayFiles;
private javax.swing.JMenu PlayItem;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JMenuBar jMenuBar1;
// End of variables declaration//GEN-END:variables
}
| [
"noreply@github.com"
] | ChristopherSaunders.noreply@github.com |
7ee7204e66dfd0add0778539d88b58906cb71468 | b816b1e57c0e0ecfc71b5c590abaf791a622c186 | /src/main/java/com/Data/CommodityPP.java | 3ac8ff7a4b4357d8e5da9551a8b8cb73e2cc7e1f | [] | no_license | TheCty/millet | 9b8e4d38e55e567ecd3e2511dc839c689cb683d5 | 09ef23c2d976b699b9dec1319c10bd35dd9e82ab | refs/heads/main | 2022-12-30T23:47:02.448533 | 2020-10-26T15:10:51 | 2020-10-26T15:10:51 | 307,254,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,348 | java | package com.Data;
import com.millet.dao.impl.CommodityDaoImpl;
import com.millet.pojo.Classify;
import com.millet.pojo.Commodity;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.select.Elements;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.net.URL;
public class CommodityPP {
public static void main(String[] args) throws Exception {
//获取请求 https://search.jd.com/Search?keyword=java
//前提要联网
/**
* https://list.jd.com/list.html?cat=9987%2C653%2C655&ev=exbrand_%E5%B0%8F%E7%B1%B3%EF%BC%88MI%EF%BC%89%5E&cid3=655 小米
* https://list.jd.com/list.html?cat=9987%2C653%2C655&ev=exbrand_%E5%B0%8F%E7%B1%B3%EF%BC%88MI%EF%BC%89%5E&page=3&s=61&click=0 类别2
* https://list.jd.com/list.html?cat=670%2C671%2C672&ev=exbrand_%E5%B0%8F%E7%B1%B3%EF%BC%88MI%EF%BC%89%5E&cid3=672 电脑
* https://search.jd.com/search?keyword=%E8%B7%AF%E7%94%B1%E5%99%A8&suggest=1.def.0.0&wq=%E8%B7%AF%E7%94%B1%E5%99%A8&ev=exbrand_%E5%B0%8F%E7%B1%B3%EF%BC%88MI%EF%BC%89%5E 路由器
*
*
*
*/
String url="https://search.jd.com/search?keyword=%E8%B7%AF%E7%94%B1%E5%99%A8&suggest=1.def.0.0&wq=%E8%B7%AF%E7%94%B1%E5%99%A8&ev=exbrand_%E5%B0%8F%E7%B1%B3%EF%BC%88MI%EF%BC%89%5E";
//解析网页
Document document = Jsoup.parse(new URL(url),30000);
Element element = document.getElementById("J_goodsList");
Elements elements = element.getElementsByTag("li");
// System.out.println(elements);
for (Element el : elements) {
String img = el.getElementsByTag("img").attr("src");
String price=el.getElementsByTag("strong").text();
String title=el.getElementsByTag("em").text();
System.out.println("=========================================");
if (img != null && !img.equals("")) {
price=price.substring(price.indexOf("¥")+1).trim();
title=title.substring(title.indexOf("¥")+1).trim();
img=img.substring(img.lastIndexOf("/")+1);
if (substringtitles(title).equals("") || substringtitles(title) ==null) {
continue;
}
System.out.println(substringtitles(title));
System.out.println(img);
System.out.println(price);
System.out.println(title.substring(substringtitles(title).length()+1));
CommodityDaoImpl cmd=new CommodityDaoImpl();
Commodity comm=new Commodity();
//注意类别
comm.setClassifyId(new Classify(9,null,0));
comm.setImg(img);
//注意方法
comm.setName(substringtitles(title));
comm.setPrice(Double.parseDouble(price));
//注意方法
comm.setContext(title.substring(substringtitles(title).length()+1));
System.out.println(cmd.insert(comm));
}else {
continue;
}
}
}
//去除【京东商城】
private static String substringtitles(String title) {
String trim="";
if (title.indexOf('市')!=-1) {
trim = title.substring(title.indexOf('市') + 1).trim();
}
if (!trim.equals("") && trim!=null) {
trim=trim.substring(0,trim.indexOf(' '));
}
return trim;
}
//获得商品名称
private static String substringtitle(String title) {
String substring = title.substring(0, title.indexOf(' '));
String substring3 =title.substring(title.indexOf(" ")+1);
String substring2=substring3.substring(0,substring3.indexOf(' '));
if (substring.indexOf(' ')!=-1) {
substring2 = substring.substring(0, substring.indexOf(' '));
}
String name=substring+" "+substring2;
int start=-1;
if ((start=name.indexOf("【"))>=0) {
String substring1 = name.substring(name.indexOf('】')+1);
return substring1;
}
return name;
}
}
| [
"we32020662@foxmail"
] | we32020662@foxmail |
a2b6fd8bca6b474565ae34050983a635a3613d43 | d030f0cba6cf93a5375e0976e01d5291a137ef81 | /TravelApp/src/productorderservlet/IspayUpdateServlet.java | a6d9c2c37a5c182857fdb4d93f215b694dcc4089 | [] | no_license | AngelYHY/Travel | a65cc766c6f15d2e2ab284f20fbdc30741fcf124 | ed180b1751276f9c9fb9d7617abfd230b7ba0ad1 | refs/heads/master | 2020-06-14T09:42:02.678682 | 2017-01-17T09:15:39 | 2017-01-17T09:15:39 | 75,203,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | package productorderservlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import productorderdao.IsplayUpdatedao;
public class IspayUpdateServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public IspayUpdateServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//PrintWriter printWriter = response.getWriter();
String result = "";
result=request.getParameter("order_id");
String ispay_time=request.getParameter("ispay_time");
int order_id=Integer.parseInt(result);
IsplayUpdatedao isplayUpdatedao=new IsplayUpdatedao();
isplayUpdatedao.isplayupdate(order_id,ispay_time);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
| [
"1064389584@qq.com"
] | 1064389584@qq.com |
f7d0814e367cd95a8065238b1135369cad1068b6 | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/Lang/lang45/3/AstorMain-lang45/src/variant-175/org/apache/commons/lang/WordUtils.java | 5877718c1137acc88555ca6211f53732029331e0 | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,026 | java | package org.apache.commons.lang;
public class WordUtils {
public WordUtils() {
super();
}
public static java.lang.String wrap(java.lang.String str, int wrapLength) {
return org.apache.commons.lang.WordUtils.wrap(str, wrapLength, null, false);
}
public static java.lang.String wrap(java.lang.String str, int wrapLength, java.lang.String newLineStr, boolean wrapLongWords) {
if (str == null) {
return null;
}
if (newLineStr == null) {
newLineStr = org.apache.commons.lang.SystemUtils.LINE_SEPARATOR;
}
if (wrapLength < 1) {
wrapLength = 1;
}
int inputLineLength = str.length();
int offset = 0;
java.lang.StringBuffer wrappedLine = new java.lang.StringBuffer((inputLineLength + 32));
while ((inputLineLength - offset) > wrapLength) {
if ((str.charAt(offset)) == ' ') {
offset++;
continue;
}
int spaceToWrapAt = str.lastIndexOf(' ', (wrapLength + offset));
if (spaceToWrapAt >= offset) {
wrappedLine.append(str.substring(offset, spaceToWrapAt));
wrappedLine.append(newLineStr);
offset = spaceToWrapAt + 1;
} else {
if (wrapLongWords) {
wrappedLine.append(str.substring(offset, (wrapLength + offset)));
wrappedLine.append(newLineStr);
offset += wrapLength;
} else {
spaceToWrapAt = str.indexOf(' ', (wrapLength + offset));
if (spaceToWrapAt >= 0) {
wrappedLine.append(str.substring(offset, spaceToWrapAt));
wrappedLine.append(newLineStr);
offset = spaceToWrapAt + 1;
} else {
wrappedLine.append(str.substring(offset));
offset = inputLineLength;
}
}
}
}
wrappedLine.append(str.substring(offset));
return wrappedLine.toString();
}
public static java.lang.String capitalize(java.lang.String str) {
return org.apache.commons.lang.WordUtils.capitalize(str, null);
}
public static java.lang.String capitalize(java.lang.String str, char[] delimiters) {
int delimLen = delimiters == null ? -1 : delimiters.length;
if (((str == null) || ((str.length()) == 0)) || (delimLen == 0)) {
return str;
}
int strLen = str.length();
java.lang.StringBuffer buffer = new java.lang.StringBuffer(strLen);
boolean capitalizeNext = true;
for (int i = 0 ; i < strLen ; i++) {
char ch = str.charAt(i);
if (org.apache.commons.lang.WordUtils.isDelimiter(ch, delimiters)) {
buffer.append(ch);
capitalizeNext = true;
} else {
if (capitalizeNext) {
buffer.append(java.lang.Character.toTitleCase(ch));
capitalizeNext = false;
} else {
buffer.append(ch);
}
}
}
return buffer.toString();
}
public static java.lang.String capitalizeFully(java.lang.String str) {
return org.apache.commons.lang.WordUtils.capitalizeFully(str, null);
}
public static java.lang.String capitalizeFully(java.lang.String str, char[] delimiters) {
int delimLen = delimiters == null ? -1 : delimiters.length;
if (((str == null) || ((str.length()) == 0)) || (delimLen == 0)) {
return str;
}
str = str.toLowerCase();
return org.apache.commons.lang.WordUtils.capitalize(str, delimiters);
}
public static java.lang.String uncapitalize(java.lang.String str) {
return org.apache.commons.lang.WordUtils.uncapitalize(str, null);
}
public static java.lang.String uncapitalize(java.lang.String str, char[] delimiters) {
int delimLen = delimiters == null ? -1 : delimiters.length;
if (((str == null) || ((str.length()) == 0)) || (delimLen == 0)) {
return str;
}
int strLen = str.length();
java.lang.StringBuffer buffer = new java.lang.StringBuffer(strLen);
boolean uncapitalizeNext = true;
for (int i = 0 ; i < strLen ; i++) {
char ch = str.charAt(i);
if (org.apache.commons.lang.WordUtils.isDelimiter(ch, delimiters)) {
buffer.append(ch);
uncapitalizeNext = true;
} else {
if (uncapitalizeNext) {
buffer.append(java.lang.Character.toLowerCase(ch));
uncapitalizeNext = false;
} else {
buffer.append(ch);
}
}
}
return buffer.toString();
}
public static java.lang.String swapCase(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
java.lang.StringBuffer buffer = new java.lang.StringBuffer(strLen);
boolean whitespace = true;
char ch = 0;
char tmp = 0;
for (int i = 0 ; i < strLen ; i++) {
ch = str.charAt(i);
if (java.lang.Character.isUpperCase(ch)) {
tmp = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isTitleCase(ch)) {
tmp = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isLowerCase(ch)) {
if (whitespace) {
tmp = java.lang.Character.toTitleCase(ch);
} else {
tmp = java.lang.Character.toUpperCase(ch);
}
} else {
tmp = ch;
}
}
}
buffer.append(tmp);
whitespace = java.lang.Character.isWhitespace(ch);
}
return buffer.toString();
}
public static java.lang.String initials(java.lang.String str) {
return org.apache.commons.lang.WordUtils.initials(str, null);
}
public static java.lang.String initials(java.lang.String str, char[] delimiters) {
if ((str == null) || ((str.length()) == 0)) {
return str;
}
if ((delimiters != null) && ((delimiters.length) == 0)) {
return "";
}
int strLen = str.length();
char[] buf = new char[(strLen / 2) + 1];
int count = 0;
boolean lastWasGap = true;
for (int i = 0 ; i < strLen ; i++) {
char ch = str.charAt(i);
if (org.apache.commons.lang.WordUtils.isDelimiter(ch, delimiters)) {
lastWasGap = true;
} else {
if (lastWasGap) {
buf[(count++)] = ch;
lastWasGap = false;
} else {
}
}
}
return new java.lang.String(buf , 0 , count);
}
private static boolean isDelimiter(char ch, char[] delimiters) {
if (delimiters == null) {
return java.lang.Character.isWhitespace(ch);
}
for (int i = 0, isize = delimiters.length ; i < isize ; i++) {
if (ch == (delimiters[i])) {
return true;
}
}
return false;
}
public static java.lang.String abbreviate(java.lang.String str, int lower, int upper, java.lang.String appendToEnd) {
if (str == null) {
return null;
}
if ((str.length()) == 0) {
return org.apache.commons.lang.StringUtils.EMPTY;
}
if ((upper == (-1)) || (upper > (str.length()))) {
upper = str.length();
}
if (upper < lower) {
upper = lower;
}
java.lang.StringBuffer result = new java.lang.StringBuffer();
int index = org.apache.commons.lang.StringUtils.indexOf(str, " ", lower);
if (index == (-1)) {
result.append(str.substring(0, upper));
if (upper != (str.length())) {
if (upper < lower) {
upper = lower;
}
result.append(org.apache.commons.lang.StringUtils.defaultString(appendToEnd));
}
} else {
if (index > upper) {
result.append(str.substring(0, upper));
result.append(org.apache.commons.lang.StringUtils.defaultString(appendToEnd));
} else {
result.append(str.substring(0, index));
result.append(org.apache.commons.lang.StringUtils.defaultString(appendToEnd));
}
}
return result.toString();
}
}
| [
"sajjad.syed@ucalgary.ca"
] | sajjad.syed@ucalgary.ca |
d6e39b7998ae0ba774809a6160c43e27311df545 | a6c3a4fc9d2684a9db4743f5877f75ec03b14c0a | /src/test/java/cn/news/sample/service/SampleServiceTest.java | 67884c27b6980fb2868bef476d934faa5c5771a7 | [] | no_license | conanca/spring-cloud-consul-sample-consumer | 969bf38ea3efcda3fd6ec76e5cb7799d4427cd47 | bf7d9668f8a0301035c4915667e359efb4f79f7a | refs/heads/master | 2021-01-20T09:03:16.060493 | 2017-05-04T06:01:48 | 2017-05-04T06:01:48 | 90,216,268 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | package com.dolplay.sample.service;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Created by conanca on 17-2-15.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class SampleServiceTest {
@Autowired
private SampleService sampleService;
@Test
public void testGreeting(){
sampleService.greeting("test");
}
}
| [
"gongchengdong@news.cn"
] | gongchengdong@news.cn |
f0a16d5e4192fbd01ac3ae1ad3ed0efdb3caa606 | 44ebb583b62839c1279f5f45f16237e265e6f624 | /office-service/src/main/java/tw/com/ktv/utils/excel/HSSFFontFunc.java | 9ad1e03c579917285e9696e1e6278bb18089160c | [] | no_license | ChrisRyo/office | c7476735520afddd0e5218595bcb993ba9996706 | d1894e496bf843b5e4d40ce54dd89cb25dc50c69 | refs/heads/master | 2021-01-10T18:16:23.860875 | 2016-04-24T17:06:40 | 2016-04-24T17:06:40 | 54,324,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,668 | java | package tw.com.ktv.utils.excel;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
/**
* HSSF 自定義方法
*
* @author chrisryo
* @since 2015-03-28
*/
public class HSSFFontFunc {
private List<HSSFFontFunc.dto> tmpList = new ArrayList<HSSFFontFunc.dto>(); // 紀錄使用過得style
/**
*
* @param workbook
* @param styleDto
* @param fontDto
* @return
*/
public HSSFCellStyle getCellStyle(HSSFWorkbook workbook, HSSFCellStyleDto styleDto, HSSFFontDto fontDto) {
if (!tmpList.isEmpty()) {
for (HSSFFontFunc.dto dto : tmpList) {
if (this.equals(dto.getStyle(), styleDto) && this.equals(dto.getFont(), fontDto)) {
return dto.getStyle();
}
}
}
HSSFFont font = workbook.createFont();
fontDto.editHSSFFont(font);
HSSFCellStyle style = workbook.createCellStyle();
styleDto.editHSSFCellStyle(style, font);
HSSFFontFunc.dto dto = new HSSFFontFunc.dto();
dto.setFont(font);
dto.setStyle(style);
tmpList.add(dto);
return style;
}
private boolean equals(Object hssf, Object dto) {
Field[] Fields = dto.getClass().getDeclaredFields();
for (Field Field : Fields) {
try {
if ("font".equals(Field.getName())) {
continue;
}
Object val1 = BeanUtils.getProperty(dto, Field.getName());
Object val2 = BeanUtils.getProperty(hssf, Field.getName());
if (val1 instanceof Short) {
short a = (short) val1;
short b = (short) val2;
if (a != b) {
return false;
}
} else if (val1 instanceof String) {
String a = (String) val1;
String b = (String) val2;
if (!a.equals(b)) {
return false;
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}
@Data
private class dto {
private HSSFFont font;
private HSSFCellStyle style;
}
} | [
"chrisryo0301@gmail.com"
] | chrisryo0301@gmail.com |
bc468add509ae34770d44ba9b4aef7b80c525b30 | c038ec0619e0f216a203d92f1c37d653102d0eba | /SOAProject/src/localhost/soaproject/services/repairtransportationservice/GetTransportationDistanceResponse.java | bd0f5f5116217fa404669fb98563890f5365601c | [] | no_license | jhuijts14/SOA-Project | cf323823c179d7ee9f536653ab6f6bd2bea805e8 | 61bbe1401b62376216896347b58dda22583035a5 | refs/heads/master | 2021-01-22T04:34:14.088170 | 2017-03-29T17:17:30 | 2017-03-29T17:17:30 | 81,555,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,217 | java |
/**
* GetTransportationDistanceResponse.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.4 Built on : Dec 28, 2015 (10:04:10 GMT)
*/
package localhost.soaproject.services.repairtransportationservice;
/**
* GetTransportationDistanceResponse bean class
*/
@SuppressWarnings({"unchecked","unused"})
public class GetTransportationDistanceResponse
implements org.apache.axis2.databinding.ADBBean{
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://localhost:8080/SOAProject/services/RepairTransportationService/",
"GetTransportationDistanceResponse",
"ns8");
/**
* field for GetTransportationDistanceResponse
*/
protected localhost.soaproject.services.repairtransportationservice.DistanceResponseType localGetTransportationDistanceResponse ;
/**
* Auto generated getter method
* @return localhost.soaproject.services.repairtransportationservice.DistanceResponseType
*/
public localhost.soaproject.services.repairtransportationservice.DistanceResponseType getGetTransportationDistanceResponse(){
return localGetTransportationDistanceResponse;
}
/**
* Auto generated setter method
* @param param GetTransportationDistanceResponse
*/
public void setGetTransportationDistanceResponse(localhost.soaproject.services.repairtransportationservice.DistanceResponseType param){
this.localGetTransportationDistanceResponse=param;
}
/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{
org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME);
}
public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
}
public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
java.lang.String prefix = null;
java.lang.String namespace = null;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);
if (serializeType){
java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://localhost:8080/SOAProject/services/RepairTransportationService/");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":GetTransportationDistanceResponse",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"GetTransportationDistanceResponse",
xmlWriter);
}
}
if (localGetTransportationDistanceResponse==null){
writeStartElement(null, "", "GetTransportationDistanceResponse", xmlWriter);
// write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement();
}else{
localGetTransportationDistanceResponse.serialize(new javax.xml.namespace.QName("","GetTransportationDistanceResponse"),
xmlWriter);
}
xmlWriter.writeEndElement();
}
private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://localhost:8080/SOAProject/services/RepairTransportationService/")){
return "ns8";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{
java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();
elementList.add(new javax.xml.namespace.QName("",
"GetTransportationDistanceResponse"));
elementList.add(localGetTransportationDistanceResponse==null?null:
localGetTransportationDistanceResponse);
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
}
/**
* Factory class that keeps the parse method
*/
public static class Factory{
/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static GetTransportationDistanceResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
GetTransportationDistanceResponse object =
new GetTransportationDistanceResponse();
int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try {
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix;
java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);
if (!"GetTransportationDistanceResponse".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (GetTransportationDistanceResponse)localhost.soaproject.services.repairtransportationservice.ExtensionMapper.getTypeObject(
nsUri,type,reader);
}
}
}
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();
reader.next();
while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
if (reader.isStartElement() && new javax.xml.namespace.QName("","GetTransportationDistanceResponse").equals(reader.getName())){
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
object.setGetTransportationDistanceResponse(null);
reader.next();
reader.next();
}else{
object.setGetTransportationDistanceResponse(localhost.soaproject.services.repairtransportationservice.DistanceResponseType.Factory.parse(reader));
reader.next();
}
} // End of if for expected property start element
else{
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
}
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}//end of factory class
}
| [
"joephuijts14@gmail.com"
] | joephuijts14@gmail.com |
d5162822e04ce455bf0ea20008cbf7463b8fecb4 | d325e12ba9521a66026718dc3153ae92a47559c6 | /chlitina/.svn/pristine/b0/b0ab07db4b661a8824106525e21110b41255da68.svn-base | f12cdaa837169c3116ab97879cf22b55961088a6 | [] | no_license | niarehtni/nccode | ee69ab00a3f522832d8e4f25abe1083dfc39fdfe | b85f86e71b392a3e5883a77e921949e2249c736d | refs/heads/master | 2023-01-03T21:07:34.865967 | 2020-10-31T06:49:33 | 2020-10-31T06:49:33 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 16,955 | package nc.ui.ta.leaveoff.pf.view;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.hr.utils.PubEnv;
import nc.itf.hr.frame.IHrBillCode;
import nc.itf.ta.ILeaveOffManageMaintain;
import nc.pubitf.para.SysInitQuery;
import nc.ui.pub.beans.UIRefPane;
import nc.ui.pub.beans.textfield.formatter.DefaultTextFiledFormatterFactory;
import nc.ui.pub.bill.BillCardBeforeEditListener;
import nc.ui.pub.bill.BillEditEvent;
import nc.ui.pub.bill.BillItem;
import nc.ui.pub.bill.BillItemEvent;
import nc.ui.ta.leaveoff.pf.model.LeaveoffAppModel;
import nc.ui.ta.wf.pub.TBMPubBillCardForm;
import nc.vo.logging.Debug;
import nc.vo.pub.BusinessException;
import nc.vo.pub.BusinessRuntimeException;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDateTime;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pub.pf.IPfRetCheckInfo;
import nc.vo.ta.leave.LeaveConst;
import nc.vo.ta.leave.LeaveRegVO;
import nc.vo.ta.leaveoff.AggLeaveoffVO;
import nc.vo.ta.leaveoff.LeaveoffVO;
import nc.vo.ta.pub.AllParams;
import nc.vo.ta.pub.TALoginContext;
import nc.vo.ta.timeitem.TimeItemCopyVO;
import nc.vo.ta.timerule.TimeRuleVO;
import org.apache.commons.lang.StringUtils;
@SuppressWarnings("serial")
public class LeaveoffCardForm extends TBMPubBillCardForm implements BillCardBeforeEditListener {
private LeaveRegVO regvo = null;
private boolean islactation = false;
@Override
public void initUI() {
super.initUI();
getBillCardPanel().addEditListener(this);
getBillCardPanel().setBillBeforeEditListenerHeadTail(this);// BillItemEvent事件监听
UIRefPane diffPanel = (UIRefPane) getBillCardPanel().getHeadItem(LeaveoffVO.DIFFERENCEHOUR).getComponent();
diffPanel.getUITextField().setTextFiledFormatterFactory(
new DefaultTextFiledFormatterFactory(new LeaveoffDiffNumFormatter(diffPanel.getUITextField())));
}
@Override
protected void setDefaultValue() {
super.setDefaultValue();
getBillCardPanel().getHeadItem(LeaveoffVO.PK_LEAVEREG).setValue(regvo.getPk_leavereg());
getBillCardPanel().getHeadItem(LeaveoffVO.PK_PSNJOB).setValue(regvo.getPk_psnjob());
getBillCardPanel().getHeadItem(LeaveoffVO.PK_PSNDOC).setValue(regvo.getPk_psndoc());
getBillCardPanel().getHeadItem(LeaveoffVO.PK_PSNORG).setValue(regvo.getPk_psnorg());
getBeginTimeListener().setPk_psndoc(regvo.getPk_psndoc());// 选择日期时间的监听,根据班次设置开始结束时间
getEndTimeListener().setPk_psndoc(regvo.getPk_psndoc());
// 开始结束时间,以及休假时长要用一个新的字段备份,要不然在销假审批结束后回写完休假登记表信息 ,休假登记原有的这几个字段会跟着变动
getBillCardPanel().getHeadItem(LeaveoffVO.REGBEGINTIMECOPY).setValue(regvo.getLeavebegintime());
getBillCardPanel().getHeadItem(LeaveoffVO.REGENDTIMECOPY).setValue(regvo.getLeaveendtime());
getBillCardPanel().getHeadItem(LeaveoffVO.REGBEGINDATECOPY).setValue(regvo.getLeavebegindate());
getBillCardPanel().getHeadItem(LeaveoffVO.REGENDDATECOPY).setValue(regvo.getLeaveenddate());
getBillCardPanel().getHeadItem(LeaveoffVO.REGLEAVEHOURCOPY).setValue(regvo.getLeavehour());
getBillCardPanel().getHeadItem(LeaveoffVO.BILLMAKER).setValue(PubEnv.getPk_user());
getBillCardPanel().getHeadItem(LeaveoffVO.APPLY_DATE).setValue(PubEnv.getServerDate());
getBillCardPanel().getHeadItem(LeaveoffVO.PK_GROUP).setValue(getModel().getContext().getPk_group());
getBillCardPanel().getHeadItem(LeaveoffVO.PK_ORG).setValue(getModel().getContext().getPk_org());
getBillCardPanel().getHeadItem(LeaveoffVO.PK_BILLTYPE).setValue(LeaveConst.BillTYPE_LEAVEOFF);
getBillCardPanel().getHeadItem(LeaveoffVO.APPROVE_STATE).setValue(IPfRetCheckInfo.NOSTATE);
getBillCardPanel().getHeadItem(LeaveoffVO.PK_LEAVETYPE).setValue(regvo.getPk_leavetype());
getBillCardPanel().getHeadItem(LeaveoffVO.PK_LEAVETYPECOPY).setValue(regvo.getPk_leavetypecopy());
getBillCardPanel().getHeadItem(LeaveoffVO.ISLACTATION).setValue(regvo.getIslactation());
// 和自助保持一致,默认时间为登记时间
// 台湾本地化 销假申请 针对加班转调休的单据 只允许全部销假 不允许部分销假 2018-5-8 10:50:41 但强 start
UFBoolean twEnabled = UFBoolean.FALSE;
String pk_leavetypecopy = "";
try {
twEnabled = SysInitQuery.getParaBoolean(regvo.getPk_org(), "TWHR01");// 啟用臺灣本地化
if (twEnabled != null && twEnabled.booleanValue()) {
pk_leavetypecopy = SysInitQuery.getParaString(regvo.getPk_org(), "TWHRT08");// 加班轉調休休假類別
}
} catch (BusinessException e) {
Logger.error(e);
}
if (regvo.getPk_leavetype().equals(pk_leavetypecopy)) {
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEBEGINDATE).setValue(regvo.getLeavebegindate());
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEBEGINTIME).setValue(regvo.getLeavebegintime());
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEENDDATE).setValue(regvo.getLeavebegindate());
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEENDTIME).setValue(regvo.getLeavebegintime());
getBillCardPanel().getHeadItem(LeaveoffVO.REALLYLEAVEHOUR).setValue(0);
UFDouble zero = UFDouble.ZERO_DBL;
getBillCardPanel().getHeadItem(LeaveoffVO.DIFFERENCEHOUR).setValue(zero.sub(regvo.getLeavehour()));
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEBEGINTIME).setEdit(false);
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEENDTIME).setEdit(false);
} else {
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEBEGINDATE).setValue(regvo.getLeavebegindate());
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEBEGINTIME).setValue(regvo.getLeavebegintime());
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEENDDATE).setValue(regvo.getLeaveenddate());
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEENDTIME).setValue(regvo.getLeaveendtime());
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEBEGINTIME).setEdit(true);
getBillCardPanel().getHeadItem(LeaveoffVO.LEAVEENDTIME).setEdit(true);
}
// 台湾本地化 销假申请 针对加班转调休的单据 只允许全部销假 不允许部分销假 2018-5-8 10:50:41 但强 start
getBillCardPanel().getHeadItem(LeaveoffVO.BILL_CODE).setValue(((LeaveoffAppModel) getModel()).getBillcode());
}
public void rollBackCode(String autoGeneratedCode) {
if (StringUtils.isNotEmpty(autoGeneratedCode)) {
IHrBillCode hrBillCode = NCLocator.getInstance().lookup(IHrBillCode.class);
try {
hrBillCode.rollbackPreBillCode(LeaveConst.BillTYPE_LEAVEOFF, getModel().getContext().getPk_group(),
getModel().getContext().getPk_org(), autoGeneratedCode);
} catch (BusinessException e) {
Debug.error(e.getMessage(), e);
throw new BusinessRuntimeException(e.getMessage(), e);
}
}
}
@Override
protected AutoCalTimeInfoVO getAutoCalTimeInfoVO() {
return null;
}
@Override
protected ChangeLabelVO getChangeLabelVO() {
if (changeLabelVO == null) {
changeLabelVO = new ChangeLabelVO();
changeLabelVO.setKqTypeKey(LeaveoffVO.PK_LEAVETYPE);
changeLabelVO.setChangeLabelKeys(new String[] { "regleavehourcopy", "pk_leavereg.resteddayorhour",
"pk_leavereg.realdayorhour", "pk_leavereg.restdayorhour", "pk_leavereg.freezedayorhour",
"pk_leavereg.usefuldayorhour", "pk_leavereg.lactationhour" });
}
return changeLabelVO;
}
@Override
protected String[] getFloatItems() {
return new String[] { "pk_leavereg.leavehour", "pk_leavereg.resteddayorhour", "pk_leavereg.realdayorhour",
"pk_leavereg.restdayorhour", "pk_leavereg.freezedayorhour", "pk_leavereg.usefuldayorhour",
"pk_leavereg.lactationhour", LeaveoffVO.REALLYLEAVEHOUR, LeaveoffVO.DIFFERENCEHOUR,
LeaveoffVO.REGLEAVEHOURCOPY };
}
@Override
public boolean beforeEdit(BillItemEvent e) {
// 编辑前修改参照数据范围
if (LeaveoffVO.TRANSTYPEID.equals(e.getItem().getKey())) {
try {
// 如果是直批,则流程类型不可编辑
if (((nc.ui.hr.pf.model.PFAppModel) getModel()).isDirectApprove())
return true;
} catch (BusinessException ex) {
Logger.error(ex.getMessage(), ex);
}
// 审批流
((UIRefPane) e.getItem().getComponent()).getRefModel().addWherePart(
" and (( parentbilltype = '" + LeaveConst.BillTYPE_LEAVEOFF + "' and pk_group = '"
+ getModel().getContext().getPk_group() + "') or pk_billtypecode = '"
+ LeaveConst.BillTYPE_LEAVEOFF + "' )");
((UIRefPane) e.getItem().getComponent()).getRefModel().reloadData();
}
return true;
}
@Override
public void afterEdit(BillEditEvent e) {
super.afterEdit(e);
if (LeaveoffVO.TRANSTYPEID.equals(e.getKey())) {
UIRefPane refPane = (UIRefPane) getBillCardPanel().getHeadItem(LeaveoffVO.TRANSTYPEID).getComponent();
getBillCardPanel().setHeadItem(LeaveoffVO.TRANSTYPE, refPane.getRefCode());
} else if (LeaveoffVO.LEAVEBEGINTIME.equals(e.getKey()) || LeaveoffVO.LEAVEENDTIME.equals(e.getKey())) {
// 同时记录相应修改字段的日期
LeaveoffVO leaveoffvo = (LeaveoffVO) getBillCardPanel().getBillData().getHeaderValueVO(
LeaveoffVO.class.getName());
if (leaveoffvo == null)
return;
if (LeaveoffVO.LEAVEBEGINTIME.equals(e.getKey())) {
// getBillCardPanel().setHeadItem(LeaveoffVO.LEAVEOFFBEGINDATE,leaveoffvo.getLeaveoffbegintime()==null?null:leaveoffvo.getLeaveoffbegintime());
getBillCardPanel().setHeadItem(LeaveoffVO.LEAVEBEGINDATE,
leaveoffvo.getLeavebegintime() == null ? null : leaveoffvo.getLeavebegintime());
} else {
// getBillCardPanel().setHeadItem(LeaveoffVO.LEAVEOFFENDDATE,leaveoffvo.getLeaveoffendtime()==null?null:leaveoffvo.getLeaveoffendtime());
getBillCardPanel().setHeadItem(LeaveoffVO.LEAVEENDDATE,
leaveoffvo.getLeaveendtime() == null ? null : leaveoffvo.getLeaveendtime());
}
// if(leaveoffvo.getLeaveoffbegintime()!=null &&
// leaveoffvo.getLeaveoffendtime()!=null){
if (leaveoffvo.getLeavebegintime() != null && leaveoffvo.getLeaveendtime() != null) {
AggLeaveoffVO aggvo = new AggLeaveoffVO();
aggvo.setParentVO(leaveoffvo);
setOtherItem(aggvo);
}
} else if (LeaveoffVO.LEAVEBEGINDATE.equals(e.getKey()) || LeaveoffVO.LEAVEENDDATE.equals(e.getKey())) {
// 同时记录相应修改字段的日期时间
LeaveoffVO leaveoffvo = (LeaveoffVO) getBillCardPanel().getBillData().getHeaderValueVO(
LeaveoffVO.class.getName());
if (leaveoffvo == null)
return;
if (LeaveoffVO.LEAVEBEGINDATE.equals(e.getKey())) {
// getBillCardPanel().setHeadItem(StringUtils.replace(e.getKey(),
// "date",
// "time"),leaveoffvo.getLeaveoffbegindate()==null?null:(new
// UFDateTime(leaveoffvo.getLeaveoffbegindate().toDate().getTime())));
getBillCardPanel().setHeadItem(
StringUtils.replace(e.getKey(), "date", "time"),
leaveoffvo.getLeavebegindate() == null ? null : (new UFDateTime(leaveoffvo.getLeavebegindate()
.toDate().getTime())));
} else {
// getBillCardPanel().setHeadItem(StringUtils.replace(e.getKey(),
// "date",
// "time"),leaveoffvo.getLeaveoffenddate()==null?null:(new
// UFDateTime(leaveoffvo.getLeaveoffenddate().toDate().getTime())));
getBillCardPanel().setHeadItem(
StringUtils.replace(e.getKey(), "date", "time"),
leaveoffvo.getLeaveenddate() == null ? null : (new UFDateTime(leaveoffvo.getLeaveenddate()
.toDate().getTime())));
}
// if(leaveoffvo.getLeaveoffbegindate()!=null &&
// leaveoffvo.getLeaveoffenddate()!=null){
if (leaveoffvo.getLeavebegindate() != null && leaveoffvo.getLeaveenddate() != null) {
AggLeaveoffVO aggvo = new AggLeaveoffVO();
aggvo.setParentVO(leaveoffvo);
setOtherItem(aggvo);
}
}
}
public void setOtherItem(AggLeaveoffVO aggvo) {
AggLeaveoffVO aggleaveoffvo = getCalculate(aggvo);
if (null == aggleaveoffvo)
return;
TimeRuleVO timerule = getTimeRule();
if (null == timerule)
return;
getBillCardPanel().setHeadItem(LeaveoffVO.REALLYLEAVEHOUR, aggleaveoffvo.getLeaveoffVO().getReallyleavehour());
getBillCardPanel().setHeadItem(LeaveoffVO.DIFFERENCEHOUR, aggleaveoffvo.getLeaveoffVO().getDifferencehour());
getBillCardPanel().getHeadItem(LeaveoffVO.REALLYLEAVEHOUR).setDecimalDigits(timerule.getTimedecimal());
getBillCardPanel().getHeadItem(LeaveoffVO.DIFFERENCEHOUR).setDecimalDigits(timerule.getTimedecimal());
}
public TimeRuleVO getTimeRule() {
AllParams params = ((TALoginContext) getModel().getContext()).getAllParams();
if (params == null)
return null;
TimeRuleVO timeRuleVO = params.getTimeRuleVO();
if (timeRuleVO == null)
return null;
return timeRuleVO;
}
AggLeaveoffVO getCalculate(AggLeaveoffVO aggvo) {
AggLeaveoffVO aggleaveoffvo = null;
try {
aggleaveoffvo = NCLocator.getInstance().lookup(ILeaveOffManageMaintain.class).calculate(aggvo);
} catch (BusinessException e) {
Logger.error(e.getMessage(), e);
}
return aggleaveoffvo;
}
@Override
public void setValue(Object object) {
super.setValue(object);
Object obj = getBillCardPanel().getHeadItem("pk_leavereg.pk_leavetype").getValueObject();
if (null == obj)
return;
if (obj.equals(TimeItemCopyVO.LEAVETYPE_LACTATION))
islactation = true;
else
islactation = false;
changeTemplate();
}
public LeaveRegVO getRegvo() {
return regvo;
}
public void setRegvo(LeaveRegVO regvo) {
this.regvo = regvo;
}
@Override
protected void onAdd() {
super.onAdd();
AggLeaveoffVO aggvo = (AggLeaveoffVO) getValue();
islactation = regvo.getIslactation().booleanValue();
changeTemplate();
aggvo = getCalculate(aggvo);
setValue(aggvo);
}
@Override
protected void onEdit() {
super.onEdit();
Object obj = getBillCardPanel().getHeadItem("pk_leavereg.pk_leavetype").getValueObject();
if (obj.equals(TimeItemCopyVO.LEAVETYPE_LACTATION))
islactation = true;
else
islactation = false;
changeTemplate();
String pk_psndoc = (String) ((UIRefPane) getBillCardPanel().getHeadItem(LeaveoffVO.PK_PSNDOC).getComponent())
.getRefPK();
getBeginTimeListener().setPk_psndoc(pk_psndoc);// 选择日期时间的监听,根据班次设置开始结束时间
getEndTimeListener().setPk_psndoc(pk_psndoc);
}
/**
* 切换模板页面,动态隐藏列
*/
private void changeTemplate() {
boolean isNotLactation = !islactation;
billCardPanel.getHeadItem(LeaveoffVO.LEAVEBEGINTIME).setShow(isNotLactation);
billCardPanel.getHeadItem(LeaveoffVO.LEAVEENDTIME).setShow(isNotLactation);
billCardPanel.getHeadItem(LeaveoffVO.REALLYLEAVEHOUR).setShow(isNotLactation);
billCardPanel.getHeadItem(LeaveoffVO.DIFFERENCEHOUR).setShow(isNotLactation);
billCardPanel.getHeadItem("pk_leavereg.leaveyear").setShow(isNotLactation);
billCardPanel.getHeadItem("pk_leavereg.leavemonth").setShow(isNotLactation);
// billCardPanel.getHeadItem("pk_leavereg.leavebegintime").setShow(isNotLactation);
// billCardPanel.getHeadItem("pk_leavereg.leaveendtime").setShow(isNotLactation);
// billCardPanel.getHeadItem("pk_leavereg.leavehour").setShow(isNotLactation);
billCardPanel.getHeadItem("regbegintimecopy").setShow(isNotLactation);
billCardPanel.getHeadItem("regendtimecopy").setShow(isNotLactation);
billCardPanel.getHeadItem("regleavehourcopy").setShow(isNotLactation);
billCardPanel.getHeadItem("pk_leavereg.relatetel").setShow(isNotLactation);
billCardPanel.getHeadItem("pk_leavereg.resteddayorhour").setShow(isNotLactation);// 已休时长
billCardPanel.getHeadItem("pk_leavereg.realdayorhour").setShow(isNotLactation);// 享有时长
billCardPanel.getHeadItem("pk_leavereg.restdayorhour").setShow(isNotLactation);// 结余时长
billCardPanel.getHeadItem("pk_leavereg.freezedayorhour").setShow(isNotLactation);// 冻结时长
billCardPanel.getHeadItem("pk_leavereg.usefuldayorhour").setShow(isNotLactation);// 可用时长
billCardPanel.getHeadItem(LeaveoffVO.LEAVEBEGINDATE).setShow(islactation);
billCardPanel.getHeadItem(LeaveoffVO.LEAVEENDDATE).setShow(islactation);
// billCardPanel.getHeadItem("pk_leavereg.leavebegindate").setShow(islactation);
// billCardPanel.getHeadItem("pk_leavereg.leaveenddate").setShow(islactation);
billCardPanel.getHeadItem("regbegindatecopy").setShow(islactation);
billCardPanel.getHeadItem("regenddatecopy").setShow(islactation);
billCardPanel.getHeadItem("pk_leavereg.lactationholidaytype").setShow(islactation);// 哺乳时段
billCardPanel.getHeadItem("pk_leavereg.lactationhour").setShow(islactation);// 单日哺乳时长
billCardPanel.setBillData(billCardPanel.getBillData());
}
@Override
protected void setTimeRefListener() {
BillItem beginTimeItem = billCardPanel.getHeadItem(LeaveoffVO.LEAVEBEGINTIME);
((UIRefPane) beginTimeItem.getComponent()).addCalendarValueChangeListener(getBeginTimeListener());
BillItem endTimeItem = billCardPanel.getHeadItem(LeaveoffVO.LEAVEENDTIME);
((UIRefPane) endTimeItem.getComponent()).addCalendarValueChangeListener(getEndTimeListener());
}
}
| [
"sunsx@sina.com"
] | sunsx@sina.com | |
7246a9c793aa9e84ec9f56d222a905f4a57f6d79 | 98fa3fff1905eb6c308b4ba78afdc5fcf7cf29d8 | /testlibrary/src/androidTest/java/com/example/lorin/testlibrary/ApplicationTest.java | 19f835cc095a3cd298d2b97d3db0c4304ba298e6 | [] | no_license | daileidecaifu/CoreTest | 6ad9296cf7e919cad2c439b6e721dc828cdff4af | cb88fa0a1ad75a1bdda7ac1f27b5a8a4415ede91 | refs/heads/master | 2020-05-29T15:11:19.814457 | 2019-04-10T11:13:39 | 2019-04-10T11:13:39 | 63,401,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package com.example.lorin.testlibrary;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"daileidecaifu@hotmail.com"
] | daileidecaifu@hotmail.com |
e86f8ada99a986c6a7e5a61be2e0d1efda625613 | 27da02f60c1cfd9c37dde88c4ec82792d7cd5ee0 | /src/main/java/com/example/chatroom/ChatroomApplication.java | d5e51f3074bfffe9a1c989980de94d6fc74b1490 | [] | no_license | rkmsh/Spring-Boot-Chat-Application | 3b2bdf3a4ef466f3769a94da07cf1bfdf0bb5068 | 24cc734c71e7d5e7d34eec9e32de7434a2f67acf | refs/heads/master | 2021-01-01T12:22:37.886236 | 2020-02-11T11:04:23 | 2020-02-11T11:04:23 | 239,277,988 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.example.chatroom;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ChatroomApplication {
public static void main(String[] args) {
SpringApplication.run(ChatroomApplication.class, args);
}
}
| [
"rohitshmahato@gmail.com"
] | rohitshmahato@gmail.com |
ec9c28b19d825485d2b205d4d2bbbebcede45d91 | 2d21f53c096a878b57f12d9d35f887c9e7c28904 | /Lab5_EliasGiron/src/lab5_eliasgiron/Especial.java | 9d5077e7b8459bf6033c07d23319410e8bbda587 | [
"MIT"
] | permissive | eliasgz97/Lab-5_EliasGiron | 504e4be3dbcb4e3ec30446f36bbb50fadd3b16dc | 729217fb45fbdf2105c1024e1cf940cdf8ccf811 | refs/heads/master | 2020-04-24T16:47:07.523311 | 2019-02-23T00:31:58 | 2019-02-23T00:31:58 | 172,121,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package lab5_eliasgiron;
public class Especial extends Carta{
public Especial(String nombre, int dano, int puntos, String objetivo, String velocidad, int costelixir, String tipo) {
super(nombre, dano, puntos, objetivo, velocidad, costelixir, tipo);
}
}
| [
"noreply@github.com"
] | eliasgz97.noreply@github.com |
af55eca526f49d8465a16c788472327d65f41998 | fc3ac9d2bc1887423ab89ac0c65e806b4749ce77 | /src/de/fhdw/ml/transactionFramework/transactions/TransactionAdministration.java | 960169c0779684697127c16759a9a76453b92dd4 | [] | no_license | Cryzas/FHDW_TEO | a54d7664c3f8cd21267625ec0a1f574a28873b17 | e286a5461cb9f759c828acced873ef62ae903553 | refs/heads/master | 2021-07-11T22:45:36.861924 | 2017-10-11T07:07:10 | 2017-10-11T07:07:10 | 106,514,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,685 | java | package de.fhdw.ml.transactionFramework.transactions;
import java.util.HashMap;
import java.util.Map;
import de.fhdw.ml.transactionFramework.transactions.Buffer.StopException;
public class TransactionAdministration extends ActiveTransactionObject implements TransactionManager {
private static final int NumberOfExecuters = 5;
private static ActiveTransactionObject theTransactionAdministration = null;
public static ActiveTransactionObject getTheTransactionAdministration() {
if( theTransactionAdministration == null ){
theTransactionAdministration = new TransactionAdministration();
}
return theTransactionAdministration;
}
private Buffer<TransactionExecuter> executerPool = null;
private Map< TEOTransactionWithException<?, ?>, TransactionExecuter > taskMap = new HashMap<TEOTransactionWithException<?, ?>, TransactionExecuter>();
private TransactionAdministration(){
this.initExecuterPool();
this.thread = new Thread( this, "Transaction Administration" );
this.thread.setPriority(Thread.MAX_PRIORITY);
this.thread.start();
}
private void initExecuterPool() {
this.executerPool = new Buffer<TransactionExecuter>();
for( int i = 0; i < NumberOfExecuters; i++ ){
this.executerPool.put(new TransactionExecuter( this ));
}
}
@Override
public void handle(TEOTransactionWithException<?, ?> task) {
if (! (task.state == InitialState.theInitialState)) throw new Error("Transactions shall not be handled twice!");
task.state = ReadyState.theReadyState;
super.handle(task);
}
@Override
public void run() {
while(true){
TEOTransactionWithException< ?, ?> task = null;
try {
task = this.inputBuffer.get();
} catch (StopException e) {
stopThreadExecuters();
return;
}
try{
startExecution(task);
} catch (StopException e) {
throw new Error(e);
}
}
}
private void stopThreadExecuters() {
for( int i = 0; i < NumberOfExecuters; i++ ){
TransactionExecuter executer;
try {
executer = this.executerPool.get();
} catch (StopException e) {
throw new Error(e);
}
executer.stop();
}
}
private void startExecution(TEOTransactionWithException<?, ?> task) throws StopException {
// Manager waits for idle executor. Executor gets at most one task into its input queue.
TransactionExecuter executer = this.executerPool.get();
synchronized( this ){
this.taskMap.put(task, executer);
}
executer.handle(task);
}
@Override
public void acknowlegdeExecution(TEOTransactionWithException<?, ?> task) {
TransactionExecuter executer = null;
synchronized( this ){
executer = this.taskMap.remove(task);
}
this.executerPool.put(executer);
}
}
| [
"jensburczyk96@gmail.com"
] | jensburczyk96@gmail.com |
246648815b798d0ee7ff62f0cc78bb127cca13b1 | 85d1ce4b131a8197502ee7c8ba99adfad9e78d0e | /app/src/main/java/com/example/ktoma/bmi/bmiMainActivity.java | 7ae7153e0c12fe2acf860c5b6d063b8e113a7b3f | [] | no_license | ktomaszewska97/BMI-Android-app | 4d9fbceada3d995aa13349e2bbcb002bd07587eb | 751c4dea6fe6aa3c4ee851ef673d6101998fe157 | refs/heads/master | 2023-03-13T17:25:56.642766 | 2021-03-08T17:10:01 | 2021-03-08T17:10:01 | 345,523,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,178 | java | package com.example.ktoma.bmi;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;
public class bmiMainActivity extends AppCompatActivity {
EditText mass, height;
Button go;
Context context;
Switch change;
TextView ifEmpty;
Toolbar myToolbar;
SharedPreferences preferences;
double massNum, heightNum;
double resultNum;
String savedText1, savedText2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bmi);
context = getApplicationContext();
preferences = getPreferences(Context.MODE_PRIVATE);
myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
change = (Switch) findViewById(R.id.change_for_feets);
mass = (EditText) findViewById(R.id.mass_field);
height = (EditText) findViewById(R.id.height_field);
ifEmpty = (TextView) findViewById(R.id.true_false);
go = (Button) findViewById(R.id.count_button);
go.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!isEmpty()) {
massNum = Double.parseDouble(mass.getText().toString());
heightNum = Double.parseDouble(height.getText().toString());
if (change.isChecked()) {
bmiForKg bfk = new bmiForKg(massNum, heightNum);
if (massNum < 30 || massNum > 200 || heightNum < 0.4 || heightNum > 2.5) {
mass.getText().clear();
height.getText().clear();
ifEmpty.setText("Hey, wrong data!");
}
else {
resultNum = bfk.count();
Intent result_intent = new Intent(context, resultActivity.class);
result_intent.putExtra("result_message", resultNum);
startActivity(result_intent);
}
} else {
bmiForFeetsAndPounds bffap = new bmiForFeetsAndPounds(massNum, heightNum);
if(massNum < 66 || massNum > 440 || heightNum < 16 || heightNum > 98.5) {
mass.getText().clear();
height.getText().clear();
ifEmpty.setText("Hey, wrong data!");
}
else {
resultNum = bffap.count();
Intent result_intent = new Intent(context, resultActivity.class);
result_intent.putExtra("result_message", resultNum);
startActivity(result_intent);
}
}
}
else {
ifEmpty.setText("Please, write your weight and height.");
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_about_me) {
Intent about_me_intent = new Intent(context, aboutMeActivity.class);
startActivity(about_me_intent);
return true;
}
if (id == R.id.action_save) {
saveData();
}
if (id == R.id.action_restore) {
restoreData();
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onPause() {
super.onPause();
saveData();
}
@Override
protected void onResume() {
super.onResume();
restoreData();
}
private void saveData() {
SharedPreferences.Editor preferencesEditor = preferences.edit();
savedText1 = mass.getText().toString();
preferencesEditor.putString("text_1", savedText1);
savedText2 = height.getText().toString();
preferencesEditor.putString("text_2", savedText2);
preferencesEditor.commit();
}
private void restoreData() {
String text1 = preferences.getString("text_1", "");
mass.setText(text1);
String text2 = preferences.getString("text_2", "");
height.setText(text2);
}
public boolean isEmpty() {
if(mass.getText().toString()==null || mass.getText().toString().trim().equals("") || height.getText().toString()==null || height.getText().toString().trim().equals("")) return true;
return false;
}
}
| [
"k.tomaszewska.97@gmail.com"
] | k.tomaszewska.97@gmail.com |
241bae1e307f285d1b51eb9a58a23cdfba1bea5d | fed1a499ca68d22c383fa18033ea1a5bc8f8d301 | /app/src/main/java/com/example/digital_agent_background/LessonActivity.java | 718ba201c62eb64286cc0617fb589b0539bf5895 | [] | no_license | rango3526/digital_agent_background | 9005bd64fed39f80685c4a28a3670e83b2589484 | 3241bd130d83c9706ca54b030d8996985a676720 | refs/heads/master | 2023-06-14T00:18:26.134900 | 2021-07-11T04:45:08 | 2021-07-11T04:45:08 | 382,248,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,088 | java | package com.example.digital_agent_background;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.digital_agent_background.databinding.ActivityLessonBinding;
import com.example.digital_agent_background.databinding.ActivityMainBinding;
import com.squareup.picasso.Picasso;
public class LessonActivity extends AppCompatActivity {
ActivityLessonBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityLessonBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
Context context = this;
Intent prevIntent = getIntent();
String objectFound = prevIntent.getStringExtra("objectFound");
Uri imageUri = Uri.parse(prevIntent.getStringExtra("imageUri"));
Long myImageID = prevIntent.getLongExtra("myImageID", -1);
MyImage mi = LessonListActivity.getMyImageByID(context, myImageID);
TextView textView = binding.avatarBeginLessonDialogue;
// ImageView image = binding.objectImage;
// if (!imageUri.equals(Uri.parse("")) && imageUri != null) // aka if there's an actual URI in there
// Picasso.get().load(imageUri).into(image);
textView.setText("Let's learn about that " + objectFound + "!");
Log.w("Stuff", "STARTED LESSON LEARN ACTIVITY");
binding.bookmarkToggle.setChecked(mi.bookmarked);
binding.backToMainButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, MainActivity.class);
startActivity(intent);
}
});
binding.learnMoreButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ObjectLesson ol = FirebaseManager.getFirestoreObjectData(objectFound);
if (ol == null) {
Toast.makeText(context, "Check your internet connection and try again (restart app)", Toast.LENGTH_SHORT).show();
return;
}
Intent intent = new Intent(context, LearnMoreActivity.class);
intent.putExtra("objectLessonHashmap", ol.getHashmapRepresentation());
intent.putExtra("myImageID", myImageID);
startActivity(intent);
}
});
binding.bookmarkToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
LessonListActivity.setImageBookmark(context, myImageID, isChecked);
}
});
}
} | [
"r2chenore@gmail.com"
] | r2chenore@gmail.com |
f1dd84dc9dfc2e10f3498878512079d78c51afa6 | bb3b741c9934ba28411af887aebd399634b7cd07 | /app/src/main/java/com/laushkina/anastasia/orm/repositories/db/DbHelper.java | b8c770dc67085c1cbd29bbf40d5ec6881413a89c | [] | no_license | StacyLaushkina/ORM | c6f3bc2405644c4a6e863811a3b3bbcd0aec4640 | 543b5eb78d02cfe232b7ce4d214e5251d2530235 | refs/heads/master | 2021-05-14T06:49:32.236122 | 2018-01-04T14:08:22 | 2018-01-04T14:08:22 | 116,250,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,378 | java | package com.laushkina.anastasia.orm.repositories.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.laushkina.anastasia.orm.R;
import java.io.IOException;
import java.io.InputStream;
public class DbHelper extends SQLiteOpenHelper {
// If you change the database schema, you must increment the database version.
public static final int DATABASE_VERSION = 1;
public static final String DATABASE_NAME = "KanjiDB.db";
private Context context;
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
this.context = context;
}
public void onCreate(SQLiteDatabase db) {
try {
InputStream migrationFile = context.getResources().openRawResource(R.raw.db_migration_1);
byte[] migrationBytes = new byte[migrationFile.available()];
migrationFile.read(migrationBytes);
db.execSQL("CREATE TABLE Kanjis( id TEXT PRIMARY KEY,\n" +
" description TEXT,\n" +
" popularity INT NOT NULL);");
db.execSQL("CREATE TABLE Meanings( id TEXT PRIMARY KEY,\n" +
" description TEXT NOT NULL,\n" +
" kanjiId INT NOT NULL,\n" +
" FOREIGN KEY (kanjiId) REFERENCES Kanjis(id) ON DELETE CASCADE);");
db.execSQL("CREATE TABLE Readings( id TEXT PRIMARY KEY,\n" +
" hiraganaReading TEXT NOT NULL,\n" +
" romanjiReading INT NOT NULL,\n" +
" readingType INT NOT NULL,\n" +
" kanjiId INT NOT NULL,\n" +
" FOREIGN KEY (kanjiId) REFERENCES Kanjis(id) ON DELETE CASCADE);");
} catch (IOException ignored) {
Log.e("DbHelper", ignored.getMessage());
}
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onUpgrade(db, oldVersion, newVersion);
}
}
| [
"Stacy.laushkina@gmail.com"
] | Stacy.laushkina@gmail.com |
11716e8034c9505fc333f8ded6705710015c4f8e | b6ac66c7aba506f646818df4bdaa9c61a34e4799 | /Information Asset Registry/src/model/Action.java | 12b0cb82021fc60b61ce1dca67a03a3f44a08296 | [] | no_license | inpaner/information-asset-registry | 68880d9bef619969657b5b627cfaa048a414c533 | 29f57f008d9f6da4900c2c0245b3f95a972fe754 | refs/heads/master | 2021-01-10T19:10:01.776940 | 2013-08-01T22:39:30 | 2013-08-01T22:39:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package model;
public enum Action {
LOGIN("Login"),
LOGOUT("Logout");
private String text;
Action(String text) {
this.text = text;
}
@Override
public String toString() {
return text;
}
}
| [
"ivan.paner@gmail.com"
] | ivan.paner@gmail.com |
060f0eacc96ae2bef1f93429de619d20bb2033fd | 169f635a8863c84f90fd469665eff9b424ac7326 | /app/src/main/java/de/fischerprofil/fp/ui/fragments/GalleryListFragment.java | a19b2c14b3b2d793618ef7982f5e89e58cbc06b5 | [] | no_license | chheld/fp | 8dcff6e0a2cfdd43048dc200df83050d175946f3 | 0670f39640ec4b16d74029dc03431afbe3791ccf | refs/heads/master | 2021-01-17T10:35:06.968133 | 2016-05-02T14:29:33 | 2016-05-02T14:29:33 | 42,661,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,733 | java | package de.fischerprofil.fp.ui.fragments;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.squareup.picasso.Picasso;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import de.fischerprofil.fp.AppController;
import de.fischerprofil.fp.R;
import de.fischerprofil.fp.adapter.GalleryListAdapter;
import de.fischerprofil.fp.listener.EndlessRecyclerViewScrollListener;
import de.fischerprofil.fp.model.reference.GalleryImage;
import de.fischerprofil.fp.rest.HttpsJsonObjectRequest;
import de.fischerprofil.fp.rest.HttpsJsonTrustManager;
import de.fischerprofil.fp.rest.PicassoUtils;
import de.fischerprofil.fp.rest.RestUtils;
import de.fischerprofil.fp.ui.UIUtils;
@SuppressLint("ValidFragment")
public class GalleryListFragment extends Fragment {
private AppController mAppController;
private Context mContext;
private GalleryListAdapter mAdapter;
private int mSearchRequestCounter = 0; // Zähler fuer die http-Anfragen
private String mSearchString;
private RecyclerView mRecyclerView;
private SwipeRefreshLayout mSwipeRefreshLayout;
private final String VOLLEY_TAG = "VOLLEY_TAG_ReferenceListFragment";
private final String URL = RestUtils.getApiURL();
private Picasso mPicasso;
private ArrayList<GalleryImage> mDataset = new ArrayList<>();
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
//TODO: Restore the fragment's state here
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
//TODO: Save the fragment's state here
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mContext = getActivity();
mAppController = AppController.getInstance();
mPicasso = PicassoUtils.buildPicasso(mContext);
View view = inflater.inflate(R.layout.fragment_recycleview_gallerylist, container, false);
Integer rows = getArguments().getInt("rows");
mSearchString = getArguments().getString("search", null); // evtl. übergebene SUCH-Parameter ermitteln
if (rows==0) rows=3; // default Spalten für Anzeige setzen
int numColumns = 3;
//Setup layout manager
//v1
GridLayoutManager layoutManager = new GridLayoutManager(mContext, rows);
//v2
// PreCachingGridLayoutManager layoutManager = new PreCachingGridLayoutManager(mContext, rows);
// layoutManager.setExtraLayoutSpace(UIUtils.getScreenHeight(mContext)*2);
//Setup Recyclerview
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(layoutManager);
//mRecyclerView.getRecycledViewPool().setMaxRecycledViews(0, 2 * numColumns); //TODO: löschen ??
mRecyclerView.setHasFixedSize(true);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int scrollState) {
super.onScrollStateChanged(recyclerView, scrollState);
//final Picasso picasso = PicassoUtils.buildPicasso(mContext);
if (scrollState == 1 || scrollState == 0) {
mPicasso.resumeTag(mContext);
} else {
mPicasso.pauseTag(mContext);
}
}
});
mRecyclerView.addOnScrollListener(new EndlessRecyclerViewScrollListener(layoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount) {
// Triggered only when new mDataset needs to be appended to the list
// Add whatever code is needed to append new items to the bottom of the list
customLoadMoreDataFromApi(page);
}
});
//Setup Swipe Layput
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_conctactlist_container);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
doSearch(mSearchString);
}
});
if (mSearchString != null) doSearch(mSearchString);
return view;
}
@Override
public void onStop() {
super.onStop();
// This will tell to Volley to cancel all the pending requests
mAppController.cancelPendingRequests(VOLLEY_TAG);
// Picasso.with(mContext).cancelTag(mContext);
mPicasso.cancelTag(mContext);
}
// Append more data into the adapter
// This method probably sends out a network request and appends new data items to your adapter.
public void customLoadMoreDataFromApi(int offset) {
// TODO: loading per page
/// / Send an API request to retrieve appropriate data using the offset value as a parameter.
// Deserialize API response and then construct new objects to append to the adapter
// Add the new objects to the data source for the adapter
//items.addAll(moreItems);
// For efficiency purposes, notify the adapter of only the elements that got changed
// curSize will equal to the index of the first element inserted because the list is 0-indexed
//int curSize = adapter.getItemCount();
//adapter.notifyItemRangeInserted(curSize, items.size() - 1);
Toast.makeText(mContext, "TODO: Seite nachladen", Toast.LENGTH_SHORT).show();
// Toast.makeText(mContext, "Seite " + offset + " nachladen", Toast.LENGTH_SHORT).show();
}
private void doSearch(String search) {
if (search.length() < 1) {
Toast.makeText(mContext, "Mindestens 2 Zeichen eingeben", Toast.LENGTH_SHORT).show();
} else {
UIUtils.makeToast(mContext, "Suche '" + search + "'");
showProgressCircle(mSwipeRefreshLayout, true);
//alte Liste löschen
mDataset.clear();
callAPIImageListByDir(URL + "/pics"); // TODO Parameter übergeben
// callAPIImageListByDir(URL + "/pics"); // TODO Parameter übergeben
// callAPIImageListByDir(URL + "/pics?qry="+ picURL + "&mask=*__*&sub=true");
}
}
private void callAPIImageListByDir(String search) {
// Increase counter for pending search requests
mSearchRequestCounter++;
HttpsJsonTrustManager.allowAllSSL(); // SSL-Fehlermeldungen ignorieren
HttpsJsonObjectRequest req = new HttpsJsonObjectRequest(search, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray images = response.getJSONArray("images");
Log.v("JSON", images.length() + " Elemente gefunden");
// Daten in Array laden
for (int i = 0; i < images.length(); i++) {
GalleryImage image = new GalleryImage();
image.setName("Image_" + i);
image.setUrl(URL + "/" + images.get(i));
mDataset.add(image);
}
//Adapter zuweisen
mAdapter = new GalleryListAdapter(mContext, mDataset);
mRecyclerView.setAdapter(mAdapter);
mSearchRequestCounter--;
if (mSearchRequestCounter < 1) {
showProgressCircle(mSwipeRefreshLayout, false);
Toast.makeText(mContext, images.length() + " Einträge gefunden", Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(mContext, e.toString(), Toast.LENGTH_SHORT).show();
showProgressCircle(mSwipeRefreshLayout, false);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Error: ", error.getMessage());
Toast.makeText(mContext, error.toString(), Toast.LENGTH_SHORT).show();
mSearchRequestCounter--;
if (mSearchRequestCounter < 1) showProgressCircle(mSwipeRefreshLayout, false); // Fortschritt ausblenden
}
});
req.setRetryPolicy(new DefaultRetryPolicy(3000, 3, 2));
AppController.getInstance().addToRequestQueue(req,VOLLEY_TAG);
}
private void showProgressCircle(final SwipeRefreshLayout s, final Boolean v) {
s.setColorSchemeResources(R.color.settings_color);
s.post(new Runnable() {
@Override public void run() {
s.setRefreshing(v);
}
});
}
}
| [
"christoph.held@fischerprofil.de"
] | christoph.held@fischerprofil.de |
1dab8f6a2e2037adfec6f2ae2c18c9e950c2a32c | 9f30fbae8035c2fc1cb681855db1bc32964ffbd4 | /Java/lichunyu/task1/src/main/java/mapper/UserDAO.java | e95f8625ddad3f70b6810c8385e92856859ae323 | [] | no_license | IT-xzy/Task | f2d309cbea962bec628df7be967ac335fd358b15 | 4f72d55b8c9247064b7c15db172fd68415492c48 | refs/heads/master | 2022-12-23T04:53:59.410971 | 2019-06-20T21:14:15 | 2019-06-20T21:14:15 | 126,955,174 | 18 | 395 | null | 2022-12-16T12:17:21 | 2018-03-27T08:34:32 | null | UTF-8 | Java | false | false | 356 | java | package mapper;
import org.springframework.web.bind.annotation.ModelAttribute;
import pojo.User;
import java.util.List;
/**
* mybatis CRUD (DAO层)
*/
public interface UserDAO {
void insert(User user);
int delete(int id);
User select(int id);
List<User> selectByName(String name);
int update(User user);
}
| [
"noreply@github.com"
] | IT-xzy.noreply@github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.