blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c86dcb125e24b1509e6acaad2ea2cddc97487349 | 7d63a578cc9526b885da487b163853a595054d9c | /src/main/java/com/epam/rd/fp/servlets/SortMeetingsByRegisteredCountServlet.java | 3d3dad4645edb3ff7b486e1324f0a36b0dc13407 | [] | no_license | LolkeeN/finalProject | a34599fc562667c9c84649663bf0fcb174742253 | e076e51cd15a6aa458d90c972447b333fb113261 | refs/heads/master | 2023-06-28T07:02:44.496676 | 2021-07-27T06:52:32 | 2021-07-27T06:52:32 | 370,661,330 | 1 | 0 | null | 2021-06-17T11:11:30 | 2021-05-25T10:59:58 | Java | UTF-8 | Java | false | false | 2,430 | java | package com.epam.rd.fp.servlets;
import com.epam.rd.fp.factory.ServiceFactory;
import com.epam.rd.fp.factory.impl.ServiceFactoryImpl;
import com.epam.rd.fp.model.Meeting;
import com.epam.rd.fp.service.MeetingService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Comparator;
import java.util.List;
@WebServlet(name = "SortMeetingsByRegisteredCountServlet", value = "/sortMeetingsByRegisteredCount")
public class SortMeetingsByRegisteredCountServlet extends HttpServlet {
private final ServiceFactory serviceFactory = new ServiceFactoryImpl();
private final MeetingService meetingService = serviceFactory.getMeetingService();
private static final Logger log = LogManager.getLogger(SortMeetingsByRegisteredCountServlet.class);
private static final String CONNECTION_URL = "jdbc:mysql://localhost:3306/meetings?createDatabaseIfNotExist=true&user=root&password=myrootpass";
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
List<Meeting> meetings;
try {
meetings = meetingService.getAllMeetings();
request.setAttribute("meetings", meetings);
for (Meeting meeting : meetings) {
meeting.setParticipantsCount(meetingService.countMeetingParticipants(meeting.getId()));
meeting.setRegisteredUsers(meetingService.countMeetingRegisteredUsers(meeting.getId()));
}
meetings.sort(new MeetingRegisteredUsersComparator());
} catch (IllegalArgumentException e) {
log.error(e.getMessage(), e);
request.getSession().setAttribute("errorMessage", e.getMessage());
response.sendRedirect(request.getContextPath() + "/errorPage.jsp");
return;
}
request.getRequestDispatcher("allMeetingsPage.jsp").forward(request, response);
}
static class MeetingRegisteredUsersComparator implements Comparator<Meeting> {
public int compare(Meeting a, Meeting b) {
return Integer.compare(a.getRegisteredUsers(), b.getRegisteredUsers());
}
}
}
| [
"bazelik777@gmail.com"
] | bazelik777@gmail.com |
f25f650646b6f20b763c326f862c31dcc402624e | 01001927e6b42eeddac7d242983130d319cb3a1c | /ScientificOp/src/Stack.java | 2a972e90474ec73d2a3719b2c150efb27b01bc89 | [] | no_license | fruitbraker/Algorithms | fd59da50ab3f21d0d597fedd22551e4574147105 | 0b2e039e688ff96a703f433f33b25aec6060e4c5 | refs/heads/master | 2020-12-24T07:59:47.159365 | 2016-09-20T02:32:43 | 2016-09-20T02:32:43 | 59,802,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,977 | java |
public class Stack<Item> {
/*
* I know I could have used a linked-list type of implementation. I just wanted to use an Array implementation.
*/
private int topOfStack;
private Item[] theStack;
@SuppressWarnings("unchecked")
public Stack() {
topOfStack = 0;
theStack = (Item[]) new Object[5];
}
public void push(Item token) {
if(topOfStack == theStack.length)
resizeArray(theStack.length*2);
theStack[topOfStack++] = token;
}
public Item pop() {
if(topOfStack >= 0) {
Item obj = theStack[--topOfStack];
theStack[topOfStack] = null;
if(topOfStack > 0 && topOfStack == theStack.length/4)
resizeArray(theStack.length/2);
return obj;
}
else
return null;
}
public Item peek() {
if(topOfStack >= 0)
return theStack[topOfStack];
else
return null;
}
public int getStackLength() {
return theStack.length;
}
public int getTopOfStackPos() {
return topOfStack;
}
public boolean isEmpty() {
return topOfStack == 0;
}
public Item peekAt(int position) {
if(position < 0 || position >= getTopOfStackPos())
return null;
return theStack[position];
}
public Item popAt(int position) {
if(position > this.topOfStack || position < 0) {
System.err.println("Index out of bounds");
return null;
}
Item item = theStack[position];
shiftDown(position);
return item;
}
public void pushAt(Item obj, int position) {
if(this.topOfStack == theStack.length)
resizeArray(theStack.length*2);
for(int i=getTopOfStackPos(); i>=position; i--) {
theStack[i+1] = theStack[i];
}
theStack[position] = obj;
this.topOfStack++;
}
private void shiftDown(int pos) {
for(int i=pos; i<getTopOfStackPos()-1; i++) {
theStack[i] = theStack[i+1];
}
topOfStack--;
}
@SuppressWarnings("unchecked")
private void resizeArray(int cap) {
Item[] temp = (Item[])new Object[cap];
for(int i=0; i<topOfStack; i++) {
temp[i] = theStack[i];
}
theStack = temp;
}
}
| [
"congpeng89@gmail.com"
] | congpeng89@gmail.com |
797d54c717761b6c8a7b8e2d05c5e904f237b99e | 9969567c8906988c43a69a8a1957f5a4084bedcc | /framework/src/main/java/com/aaron/android/framework/base/widget/viewpager/TabFragmentPagerAdapter.java | 5f5d8373de5014eeb0a3b33432d51ac8a189988e | [] | no_license | AaronHuangGit/SoybeanFramework | de662edd5682c7ed5da93446a92c2381378ebb18 | 8461aa0850dba88c22ea4a11c998c356fb6ed2d4 | refs/heads/master | 2021-07-11T04:13:21.732124 | 2017-10-09T06:45:29 | 2017-10-09T06:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,687 | java | package com.aaron.android.framework.base.widget.viewpager;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* @author ran.huang
* @version 7.0.0
*/
public class TabFragmentPagerAdapter extends FragmentPagerAdapter {
private static final String TAG = "SlidingTabFragmentPagerAdapter";
private List<FragmentBinder> mFragmentBinders;
private Context mContext;
/**
* 构造函数
*
* @param context context
* @param fragmentManager fragmentManager
* @param fragmentBinders FragmentBinder 列表
*/
public TabFragmentPagerAdapter(Context context, FragmentManager fragmentManager, List<FragmentBinder> fragmentBinders) {
super(fragmentManager);
mContext = context;
mFragmentBinders = fragmentBinders;
if (mFragmentBinders == null) {
throw new IllegalArgumentException("FragmentBinders must not be null!");
}
}
@Override
public Fragment getItem(int position) {
return mFragmentBinders.get(position).getFragment();
}
/**
* clear
*/
public void clear() {
mContext = null;
}
@Override
public int getCount() {
return mFragmentBinders.size();
}
@Override
public CharSequence getPageTitle(int position) {
final CharSequence title = mFragmentBinders.get(position).getCharSequenceTitle();
return title == null ? super.getPageTitle(position) : title.toString();
}
@Override
public long getItemId(int position) {
return mFragmentBinders.get(position).getId();
}
@Override
public int getItemPosition(Object object) {
for (FragmentBinder binder : mFragmentBinders) {
if (null != binder && object.equals(binder.getFragment())) {
return super.getItemPosition(object);
}
}
return POSITION_NONE;
}
/**
* 添加FragmentBinder
* @param fragmentBinder fragmentBinder
*/
public void addFragmentBinder(FragmentBinder fragmentBinder) {
if (mFragmentBinders == null) {
mFragmentBinders = new ArrayList<FragmentBinder>();
}
mFragmentBinders.add(fragmentBinder);
notifyDataSetChanged();
}
/**
* fragmentBinder是否存在
* @param id id
* @return true false
*/
public boolean isFragmentBinderExisted(long id) {
if (mFragmentBinders != null) {
for (FragmentBinder fragmentBinder : mFragmentBinders) {
if (fragmentBinder.getId() == id) {
return true;
}
}
}
return false;
}
/**
* 删除指定FragmentBinder
* @param id 删除的FragmentBinder 的 ID
*/
public void removeFragmentBinder(long id) {
if (mFragmentBinders != null) {
for (FragmentBinder fragmentBinder : mFragmentBinders) {
if (fragmentBinder.getId() == id) {
mFragmentBinders.remove(fragmentBinder);
notifyDataSetChanged();
break;
}
}
}
}
/**
* FragmentBinder
*/
public static class FragmentBinder {
private long mId;
private int mTabTitleResId;
private CharSequence mCharSequenceTitle;
private int mTabIconResId;
private Fragment mFragment;
/**
* @param id id
* @param tabTitleResId 标题资源id
* @param tabIconResId 标题Icon资源id
* @param fragment Fragment
*/
public FragmentBinder(long id, int tabTitleResId, int tabIconResId, Fragment fragment) {
mId = id;
mTabTitleResId = tabTitleResId;
mTabIconResId = tabIconResId;
mFragment = fragment;
}
/**
* @param id id
* @param charSequenceTitle charSequenceTitle
* @param tabIconResId 标题Icon资源id
* @param fragment Fragment
*/
public FragmentBinder(long id, CharSequence charSequenceTitle, int tabIconResId, Fragment fragment) {
mId = id;
mCharSequenceTitle = charSequenceTitle;
mTabIconResId = tabIconResId;
mFragment = fragment;
}
/**
*
* @return 文字title
*/
public CharSequence getCharSequenceTitle() {
return mCharSequenceTitle;
}
/**
* 设置标签文字
* @param title 文字
*/
public void setCharSequenceTitle(CharSequence title) {
mCharSequenceTitle = title;
}
/**
* 获取Fragment对于的Tab项标题资源Id
*
* @return Fragment对于的Tab项标题资源Id
*/
public int getTabTitleResId() {
return mTabTitleResId;
}
/**
* 获取Fragment对于的Tab项图标资源Id
*
* @return Fragment对于的Tab项图标资源Id
*/
public int getTabIconResId() {
return mTabIconResId;
}
/**
* 获取唯一标识
*
* @return Id
*/
public long getId() {
return mId;
}
/**
* 获取Fragment
*
* @return fragment
*/
public Fragment getFragment() {
return mFragment;
}
}
}
| [
"huangran@chushi007.com"
] | huangran@chushi007.com |
3266b58f51e38677e432fe83400b0ed340827b63 | 445c3cf84dd4bbcbbccf787b2d3c9eb8ed805602 | /aliyun-java-sdk-config/src/main/java/com/aliyuncs/config/model/v20190108/ActiveConfigRulesRequest.java | 1cb1feb5629e74a89d0f579494f187f453979970 | [
"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 | 1,665 | 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.config.model.v20190108;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.config.Endpoint;
/**
* @author auto create
* @version
*/
public class ActiveConfigRulesRequest extends RpcAcsRequest<ActiveConfigRulesResponse> {
private String configRuleIds;
public ActiveConfigRulesRequest() {
super("Config", "2019-01-08", "ActiveConfigRules", "Config");
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 getConfigRuleIds() {
return this.configRuleIds;
}
public void setConfigRuleIds(String configRuleIds) {
this.configRuleIds = configRuleIds;
if(configRuleIds != null){
putQueryParameter("ConfigRuleIds", configRuleIds);
}
}
@Override
public Class<ActiveConfigRulesResponse> getResponseClass() {
return ActiveConfigRulesResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
b18497f76ed0b56f76e9ef54b8978eb5a71a9cc1 | cd33222b4891436845b0c7583aabd5881d0adcb6 | /arms/src/main/java/com/jess/arms/http/RequestIntercept.java | 4b785c4f141f823282464b417dae1cf0595db289 | [
"Apache-2.0"
] | permissive | qgreat/Pretty_MVP | 9fe5980aad99301561fd48c5075d853561d05920 | 03da0d68fa4b0894c42a0bf70cdf099f7d442077 | refs/heads/master | 2021-01-19T23:32:52.642616 | 2019-08-20T07:33:14 | 2019-08-20T07:33:14 | 88,991,836 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,066 | java | package com.jess.arms.http;
import android.support.annotation.NonNull;
import com.jess.arms.utils.ZipHelper;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import javax.inject.Inject;
import javax.inject.Singleton;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSource;
import timber.log.Timber;
import static com.jess.arms.utils.CharactorHandler.jsonFormat;
/**
* Created by jess on 7/1/16.
*/
@Singleton
public class RequestIntercept implements Interceptor {
private GlobeHttpHandler mHandler;
@Inject
public RequestIntercept(GlobeHttpHandler handler) {
this.mHandler = handler;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
if (mHandler != null)//在请求服务器之前可以拿到request,做一些操作比如给request添加header,如果不做操作则返回参数中的request
request = mHandler.onHttpRequestBefore(chain, request);
Buffer requestbuffer = new Buffer();
if (request.body() != null) {
request.body().writeTo(requestbuffer);
} else {
Timber.tag("Request").w("request.body() == null");
}
//打印url信息
Timber.tag("Request").w("Sending Request %s on %n Params ---> %s%n Connection ---> %s%n Headers ---> %s", request.url()
, request.body() != null ? parseParams(request.body(), requestbuffer) : "null"
, chain.connection()
, request.headers());
long t1 = System.nanoTime();
Response originalResponse = chain.proceed(request);
long t2 = System.nanoTime();
//打印响应时间
Timber.tag("Response").w("Received response in %.1fms%n%s", (t2 - t1) / 1e6d, originalResponse.headers());
//读取服务器返回的结果
ResponseBody responseBody = originalResponse.body();
BufferedSource source = responseBody.source();
source.request(Long.MAX_VALUE); // Buffer the entire body.
Buffer buffer = source.buffer();
//获取content的压缩类型
String encoding = originalResponse
.headers()
.get("Content-Encoding");
Buffer clone = buffer.clone();
String bodyString;
//解析response content
if (encoding != null && encoding.equalsIgnoreCase("gzip")) {//content使用gzip压缩
bodyString = ZipHelper.decompressForGzip(clone.readByteArray());//解压
} else if (encoding != null && encoding.equalsIgnoreCase("zlib")) {//content使用zlib压缩
bodyString = ZipHelper.decompressToStringForZlib(clone.readByteArray());//解压
} else {//content没有被压缩
Charset charset = Charset.forName("UTF-8");
MediaType contentType = responseBody.contentType();
if (contentType != null) {
charset = contentType.charset(charset);
}
bodyString = clone.readString(charset);
}
Timber.tag("Result").w(jsonFormat(bodyString));
if (mHandler != null)//这里可以比客户端提前一步拿到服务器返回的结果,可以做一些操作,比如token超时,重新获取
return mHandler.onHttpResultResponse(bodyString, chain, originalResponse);
return originalResponse;
}
@NonNull
public static String parseParams(RequestBody body, Buffer requestbuffer) throws UnsupportedEncodingException {
if (body.contentType() != null && !body.contentType().toString().contains("multipart")) {
return URLDecoder.decode(requestbuffer.readUtf8(), "UTF-8");
}
return "null";
}
}
| [
"yachao_qi@126.com"
] | yachao_qi@126.com |
1effea9cf62871a8d2d2d26fa8299074b10e7482 | 65b6650fb2c96dde5df85c7bb7ecc54a9d0721a7 | /src/main/java/net/thedragonteam/pec/PEC.java | 83ce79b1a6d592754ec9ed3e36f6803440899738 | [] | no_license | TheDragonTeam/PEC | a2ab1dc539bfb734605e7fadbcc635e8b0414c56 | 9cc4a3c032814fa1d60d28748085617d77afe705 | refs/heads/master | 2021-01-01T06:01:05.402594 | 2018-02-05T23:14:26 | 2018-02-05T23:14:26 | 97,328,276 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package net.thedragonteam.pec;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import static net.thedragonteam.pec.Reference.MODID;
@Mod(modid = MODID,
name = Reference.MODNAME,
version = Reference.VERSION,
dependencies = Reference.DEPEND,
updateJSON = Reference.UPDATE_JSON,
guiFactory = Reference.GUI_FACTORY
)
public class PEC {
@Instance(MODID)
public static PEC instance;
public static SimpleNetworkWrapper network;
} | [
"sokratis12GR@gmail.com"
] | sokratis12GR@gmail.com |
d795bd1e76b91f94d192d7299f8ced81ffe14a85 | 91bea11b887792754fb9056a33c4411dd1aafde7 | /src/main/java/dev/kir/sync/config/SyncConfig.java | 5e9e31af300513c959f43de85b226c93d17902b1 | [
"LGPL-3.0-only",
"MIT"
] | permissive | Kir-Antipov/sync-fabric | 767eeccafc6a0a89605dc94333b2ea84201e82c8 | e821350f37576909751053ec39fba3f15b852689 | refs/heads/1.19.x/stable | 2023-08-21T04:02:50.854839 | 2022-08-06T19:29:17 | 2022-08-06T19:29:17 | 396,081,373 | 16 | 11 | MIT | 2023-03-30T23:22:02 | 2021-08-14T17:36:01 | Java | UTF-8 | Java | false | false | 3,890 | java | package dev.kir.sync.config;
import dev.kir.sync.api.shell.ShellPriority;
import dev.kir.sync.compat.cloth.SyncClothConfig;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.EntityType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import java.util.List;
import java.util.UUID;
public interface SyncConfig {
List<EnergyMapEntry> DEFAULT_ENERGY_MAP = List.of(
EnergyMapEntry.of(EntityType.CHICKEN, 2),
EnergyMapEntry.of(EntityType.PIG, 16),
EnergyMapEntry.of(EntityType.PLAYER, 20),
EnergyMapEntry.of(EntityType.WOLF, 24),
EnergyMapEntry.of(EntityType.CREEPER, 80),
EnergyMapEntry.of(EntityType.ENDERMAN, 160)
);
List<ShellPriorityEntry> DEFAULT_SYNC_PRIORITY = List.of(new ShellPriorityEntry() { });
static SyncConfig resolve() {
return FabricLoader.getInstance().isModLoaded("cloth-config") ? SyncClothConfig.getInstance() : new SyncConfig() { };
}
default boolean enableInstantShellConstruction() {
return false;
}
default boolean warnPlayerInsteadOfKilling() {
return false;
}
default float fingerstickDamage() {
return 20F;
}
default float hardcoreFingerstickDamage() {
return 40F;
}
default long shellConstructorCapacity() {
return 256000;
}
default long shellStorageCapacity() {
return 320;
}
default long shellStorageConsumption() {
return 16;
}
default boolean shellStorageAcceptsRedstone() {
return true;
}
default int shellStorageMaxUnpoweredLifespan() {
return 20;
}
default List<EnergyMapEntry> energyMap() {
return DEFAULT_ENERGY_MAP;
}
default List<ShellPriorityEntry> syncPriority() {
return DEFAULT_SYNC_PRIORITY;
}
default String wrench() {
return "minecraft:stick";
}
default boolean updateTranslationsAutomatically() {
return false;
}
default boolean preserveOrigins() {
return false;
}
default boolean enableTechnobladeEasterEgg() {
return true;
}
default boolean renderTechnobladeCape() {
// Techno hasn't worn a cape lately
return false;
}
default boolean allowTechnobladeAnnouncements() {
return true;
}
default boolean allowTechnobladeQuotes() {
return true;
}
default int TechnobladeQuoteDelay() {
return 1800;
}
default boolean isTechnoblade(UUID uuid) {
return false;
}
default void addTechnoblade(UUID uuid) {
}
default void removeTechnoblade(UUID uuid) {
}
default void clearTechnobladeCache() {
}
interface EnergyMapEntry {
default String entityId() {
return "minecraft:pig";
}
default long outputEnergyQuantity() {
return 16;
}
default EntityType<?> getEntityType() {
Identifier id = Identifier.tryParse(this.entityId());
return id == null ? EntityType.PIG : Registry.ENTITY_TYPE.get(id);
}
static EnergyMapEntry of(EntityType<?> entityType, long outputEnergyQuantity) {
return of(Registry.ENTITY_TYPE.getId(entityType).toString(), outputEnergyQuantity);
}
static EnergyMapEntry of(String id, long outputEnergyQuantity) {
return new EnergyMapEntry() {
@Override
public String entityId() {
return id;
}
@Override
public long outputEnergyQuantity() {
return outputEnergyQuantity;
}
};
}
}
interface ShellPriorityEntry {
default ShellPriority priority() {
return ShellPriority.NATURAL;
}
}
}
| [
"kp.antipov@gmail.com"
] | kp.antipov@gmail.com |
1db6c6fa6699319004bfd05fac6f72aad058a752 | 441bada7555720d883563998e2ffcaae094a95ed | /contest-back/src/main/java/com/ruoyi/project/system/service/ISysOssRecordService.java | 05f1c4d32d95787c7be0c2513909e22f98fdef5b | [
"MIT"
] | permissive | iesap/contest-weapp | 7f615ce1a0f93c145d69896fcf6438fd0d22800d | 4be1ab0dd9bff0c0a3c7f70dd5edcc8200a95118 | refs/heads/master | 2023-04-12T13:07:33.165136 | 2020-08-16T07:04:24 | 2020-08-16T07:04:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,685 | java | package com.ruoyi.project.system.service;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import com.ruoyi.project.system.domain.SysOssRecord;
import org.springframework.web.multipart.MultipartFile;
/**
* OSS上传Service接口
*
* @author sun
* @date 2020-04-27
*/
public interface ISysOssRecordService {
/**
* 上传文件
* @param file
* @param filePath
* @param businessType
* @return
* @throws IOException
*/
String uploadFile(MultipartFile file, String filePath, String businessType) throws IOException;
/**
* 上传用户头像
* @param file 头像
* @return url地址
*/
String uploadAvatar(MultipartFile file) throws IOException;
/**
* 上传竞赛封面
* @param file 封面
* @return url地址
*/
String uploadCpCover(MultipartFile file) throws IOException;
/**
* 上传队伍的头像
* @param file
* @return
* @throws IOException
*/
String uploadTeamAvatar(MultipartFile file) throws IOException;
/**
* 上传首页Swiper的图片
* @param file
* @return
*/
String uploadRecoSwiper(MultipartFile file) throws IOException;
/**
* 上传首页竞赛推荐的图片
* @param file
* @return
*/
String uploadRecoComp(MultipartFile file) throws IOException;
/**
* 上传帖子封面
* @param file
* @return
*/
String uploadPostCover(MultipartFile file) throws IOException;
/**
* 查询OSS上传
*
* @param id OSS上传ID
* @return OSS上传
*/
SysOssRecord selectSysOssRecordById(String id);
/**
* 查询OSS上传列表
*
* @param sysOssRecord OSS上传
* @return OSS上传集合
*/
List<SysOssRecord> selectSysOssRecordList(SysOssRecord sysOssRecord);
/**
* 查询OSS上传选项
*
* @return Map 集合
*/
List<Map<String, Object>> selectSysOssRecordOptions(SysOssRecord sysOssRecord);
/**
* 新增OSS上传
*
* @param sysOssRecord OSS上传
* @return 结果
*/
int insertSysOssRecord(SysOssRecord sysOssRecord);
/**
* 修改OSS上传
*
* @param sysOssRecord OSS上传
* @return 结果
*/
int updateSysOssRecord(SysOssRecord sysOssRecord);
/**
* 批量删除OSS上传
*
* @param ids 需要删除的OSS上传ID
* @return 结果
*/
int deleteSysOssRecordByIds(String[] ids);
/**
* 删除OSS上传信息
*
* @param id OSS上传ID
* @return 结果
*/
int deleteSysOssRecordById(String id);
}
| [
"sunss1903@163.com"
] | sunss1903@163.com |
4f093e87c58f1d4270d0251b877391ca0687cdbb | cf79b4d5552da0ae0cf73de51ed29e72a3d845f0 | /logger-service/src/main/java/com/sophos/logger/LoggerApplication.java | df10d2f80175520bb756e70f4610979e8ada022c | [] | no_license | rjrb/DemoWebflux | 9e0b812fe45f5aafdd43d91099af434bf0e7dc7e | 37e2daa21cb3071cce0fd1377692c6fe9c36c7f8 | refs/heads/master | 2023-01-21T11:30:39.707591 | 2020-11-27T16:35:30 | 2020-11-27T16:35:30 | 308,090,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package com.sophos.logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class LoggerApplication {
public static void main(String[] args) {
SpringApplication.run(LoggerApplication.class, args);
}
}
| [
"ricardo.ramirez@sophossolutions.com"
] | ricardo.ramirez@sophossolutions.com |
6736ed6c6b3a063e74a0fe80690fe50619adb78e | 4d956d377eb465098c9de697fea9847d985a69d3 | /src/main/java/io/jboot/db/model/Columns.java | f62be1a1f035dc56675b51f7fab2ab074e4064c7 | [
"Apache-2.0"
] | permissive | chenyongze/jboot | 587be9d852a0aee1ce1a45a7a7d9e5bf05946a85 | d35ea46f2ec666bdfaeca0c87da6f5e06d63871d | refs/heads/master | 2020-04-05T17:38:05.679639 | 2018-11-01T08:49:04 | 2018-11-01T08:49:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,832 | java | /**
* Copyright (c) 2015-2018, Michael Yang 杨福海 (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.jboot.db.model;
import io.jboot.utils.StrUtils;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
/**
* Column 的工具类,用于方便组装sql
*/
public class Columns implements Serializable {
private List<Column> cols;
public static Columns create() {
return new Columns();
}
public static Columns create(Column column) {
Columns that = new Columns();
that.add(column);
return that;
}
public static Columns create(List<Column> columns) {
Columns that = new Columns();
that.cols = columns;
return that;
}
public static Columns create(String name, Object value) {
return create().eq(name, value);
}
/**
* add new column in Columns
*
* @param column
*/
public void add(Column column) {
//do not add null value column
if (column.isMustNeedValue() && column.getValue() == null) {
return;
}
if (this.cols == null) {
this.cols = new LinkedList<>();
}
this.cols.add(column);
}
public Columns add(String name, Object value) {
return eq(name, value);
}
/**
* equals
*
* @param name
* @param value
* @return
*/
public Columns eq(String name, Object value) {
this.add(Column.create(name, value));
return this;
}
/**
* not equals !=
*
* @param name
* @param value
* @return
*/
public Columns ne(String name, Object value) {
this.add(Column.create(name, value, Column.LOGIC_NOT_EQUALS));
return this;
}
/**
* like
*
* @param name
* @param value
* @return
*/
public Columns like(String name, Object value) {
this.add(Column.create(name, value, Column.LOGIC_LIKE));
return this;
}
/**
* 自动添加两边 % 的like
*
* @param name
* @param value
* @return
*/
public Columns likeAppendPercent(String name, Object value) {
if (value == null || StrUtils.isBlank(value.toString())) {
//do nothing
return this;
}
this.add(Column.create(name, "%" + value + "%", Column.LOGIC_LIKE));
return this;
}
/**
* 大于 great than
*
* @param name
* @param value
* @return
*/
public Columns gt(String name, Object value) {
this.add(Column.create(name, value, Column.LOGIC_GT));
return this;
}
/**
* 大于等于 great or equal
*
* @param name
* @param value
* @return
*/
public Columns ge(String name, Object value) {
this.add(Column.create(name, value, Column.LOGIC_GE));
return this;
}
/**
* 小于 less than
*
* @param name
* @param value
* @return
*/
public Columns lt(String name, Object value) {
this.add(Column.create(name, value, Column.LOGIC_LT));
return this;
}
/**
* 小于等于 less or equal
*
* @param name
* @param value
* @return
*/
public Columns le(String name, Object value) {
this.add(Column.create(name, value, Column.LOGIC_LE));
return this;
}
public Columns is_null(String name) {
this.add(Column.create(name, null, Column.LOGIC_IS_NULL));
return this;
}
public Columns is_not_null(String name) {
this.add(Column.create(name, null, Column.LOGIC_IS_NOT_NULL));
return this;
}
public boolean isEmpty() {
return cols == null || cols.isEmpty();
}
static final Object[] NULL_PARA_ARRAY = new Object[0];
public Object[] getValueArray() {
if (isEmpty()) {
return null;
}
List<Object> values = new LinkedList<>();
for (Column column : cols) {
if (column.getValue() != null) values.add(column.getValue());
}
return values.isEmpty() ? NULL_PARA_ARRAY : values.toArray();
}
public List<Column> getList() {
return cols;
}
}
| [
"fuhai999@gmail.com"
] | fuhai999@gmail.com |
7cadd9468d4be2bbbf8e14f9c90603349d6e0ca2 | 7ebc513fe01c6dfdb85b2dafbc6a2b1ec48bc20b | /src/java/c/b/b/a/f/b/q5.java | 2aac2eda4565c5420ab098819b6568457113e52b | [] | no_license | arnoldnekemiah/chessapp | b6c9b7a5aceb8912d699abf654f9ebc08a61f8d2 | f3f0b141742f55c84c7ab98966256897c6bb07f4 | refs/heads/main | 2023-04-05T00:25:54.395071 | 2021-04-13T06:12:39 | 2021-04-13T06:12:39 | 357,438,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | /*
* Decompiled with CFR 0.0.
*
* Could not load the following classes:
* java.lang.Object
* java.lang.Runnable
* java.lang.String
*/
package c.b.b.a.f.b;
import c.b.b.a.f.b.j6;
public final class q5
implements Runnable {
public final /* synthetic */ String a;
public final /* synthetic */ String b;
public final /* synthetic */ Object c;
public final /* synthetic */ long d;
public final /* synthetic */ j6 e;
public q5(j6 j62, String string, String string2, Object object, long l2) {
this.e = j62;
this.a = string;
this.b = string2;
this.c = object;
this.d = l2;
}
public final void run() {
this.e.a(this.a, this.b, this.c, this.d);
}
}
| [
"42886828+arnoldnekemiah@users.noreply.github.com"
] | 42886828+arnoldnekemiah@users.noreply.github.com |
586066a8e1b26d9329f08bc3d668283b835486cd | 503f7f92ad2576758b0559d987a70b7097a788c2 | /src/main/java/com/knowns/rss/generator/utils/result/PageResult.java | b8d74c5066388ed91a18e3fd9b1710320531a73d | [] | no_license | Tainger/stackOverFlow-cn | 939eb864f198e1a396c370e19ef88890dec36800 | ea626c896bddb95c3c1f2672febed89efbc5f106 | refs/heads/master | 2023-08-08T03:38:09.105177 | 2023-07-30T05:49:54 | 2023-07-30T05:49:54 | 302,631,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java | package com.knowns.rss.generator.utils.result;
import java.util.List;
/**
* 返回给客户端执行结果的消息类,带批量数据
*
* @author liying22923
* @since 2020/6/24
*/
public class PageResult<T> extends BaseResult {
private static final long serialVersionUID = -6673395649748854452L;
/**
* 当前返回的数据列表,其数目可以等于count,也可以小于count(分页时)
*/
private List<T> data;
/**
* 在分页查询时,totalCount表示数据库数据总数
*/
private int totalCount;
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
}
| [
"1131819936@qq.com"
] | 1131819936@qq.com |
05b5b587e4677d7d429d2e0dd29d42fe1fc304fc | d948bbe9c5977f4686759bab28fe6228cdb7348a | /src/test/resources/testClasses/counter/CounterTest.java | 7716c06384008122709c3386e565bc9b5992b4e0 | [] | no_license | Project-Phoenix/SubmissionPipeline | b74323ff1f01b02b908e7f9aa87833be5fd46021 | 097654565d5f8fd7774ae5ddad5e2c77880560fa | refs/heads/master | 2020-12-24T13:45:05.222651 | 2014-06-03T18:25:19 | 2014-06-03T18:25:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | import static org.junit.Assert.*;
import org.junit.Test;
public class CounterTest {
@Test(timeout = 500)
public void test() {
Counter counter = new Counter();
assertEquals("Counter: 0", counter.toString());
counter.count();
counter.count();
assertEquals("Counter: 2", counter.toString());
}
}
| [
"Bhaals@gmx.de"
] | Bhaals@gmx.de |
94beb3f9c9c863769e23f11a0c7fa8895f37b84e | 76debede57b3ea1517da09a7d94788b7da00045a | /PersonGeneratorApp/src/main/java/com/persongeneratorapp/model/Person.java | f20a6eec8cbe8669ca1fcece70303591e59e43d0 | [] | no_license | ppletes/SpringBoot | 0e8eccb30a17ec07a1c75e7cc4f2463d0f20b065 | 5ab19d60d917dada661c5234de84e448569bf7b9 | refs/heads/main | 2023-06-13T04:11:38.801416 | 2021-06-16T08:25:14 | 2021-06-16T08:25:14 | 377,415,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,625 | java | package com.persongeneratorapp.model;
import com.persongeneratorapp.designpatterns.observer.Observer;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class Person implements Serializable {
private final List<Observer> observers = new ArrayList<Observer>();
private String givenName;
private String familyName;
private String age;
private String ageType;
public Person() {
}
public Person(String givenName, String familyName, String age) {
this.givenName = givenName;
this.familyName = familyName;
this.age = age;
}
public String getGivenName() {
return givenName;
}
public void setGivenName(String givenName) {
this.givenName = givenName;
}
public String getFamilyName() {
return familyName;
}
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getAgeType() {
notifyAllObservers();
return ageType;
}
public void setAgeType(String ageType) {
//notifyAllObservers();
this.ageType = ageType;
}
@Override
public String toString() {
return givenName + " " + familyName + " " + age + " " + ageType;
}
public void attach(Observer observer) {
observers.add(observer);
}
public void notifyAllObservers() {
for (Observer observer : observers) {
observer.update();
}
}
}
| [
"ppletes@gmail.com"
] | ppletes@gmail.com |
b27bfb77e469442af877562c42c39bd5fd249577 | 0e06e096a9f95ab094b8078ea2cd310759af008b | /classes91-dex2jar/com/tapjoy/internal/fz.java | 2dcf023b7629c2c6826612bd70249e8a7755f795 | [] | no_license | Manifold0/adcom_decompile | 4bc2907a057c73703cf141dc0749ed4c014ebe55 | fce3d59b59480abe91f90ba05b0df4eaadd849f7 | refs/heads/master | 2020-05-21T02:01:59.787840 | 2019-05-10T00:36:27 | 2019-05-10T00:36:27 | 185,856,424 | 1 | 2 | null | 2019-05-10T00:36:28 | 2019-05-09T19:04:28 | Java | UTF-8 | Java | false | false | 1,440 | java | //
// Decompiled by Procyon v0.5.34
//
package com.tapjoy.internal;
import android.os.Looper;
public final class fz
{
public static boolean a;
public static void a(final String s) {
if (fz.a) {
ac.a(4, "Tapjoy", s, null);
}
}
public static void a(final String s, final String s2, final String s3) {
if (fz.a) {
ac.a("Tapjoy", "{}: {} {}", s, s2, s3);
}
}
public static void a(final String s, final Object... array) {
if (fz.a) {
ac.a(4, "Tapjoy", s, array);
}
}
public static boolean a(final Object o, final String s) {
if (o == null) {
if (fz.a) {
b(s);
}
return false;
}
return true;
}
public static boolean a(final boolean b, final String s) {
if (fz.a && !b) {
b(s);
throw new IllegalStateException(s);
}
return b;
}
public static void b(final String s) {
if (fz.a) {
ac.a(6, "Tapjoy", s, null);
}
}
public static void b(final String s, final Object... array) {
if (fz.a) {
ac.a("Tapjoy", s, array);
}
}
public static boolean c(final String s) {
return a(Looper.myLooper() == Looper.getMainLooper(), s + ": Must be called on the main/ui thread");
}
}
| [
"querky1231@gmail.com"
] | querky1231@gmail.com |
f1fb4d04daea3b8f071e9220a4810dd0e4b384fd | 8c7f4196bd80da045138212840049c75fbb22d74 | /components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/dto/EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO.java | 40af4c658be917fc3c59fbbdc69d6538f9eee3c3 | [] | no_license | shilmyhasan/carbon-apimgt | d28656006823a76f1a8c164369fe65b62cca49df | 8f78a046d431d0e5df85275999c0acbf44117806 | refs/heads/master | 2023-08-17T08:13:14.765030 | 2019-06-17T00:07:47 | 2019-06-17T00:07:47 | 149,287,803 | 0 | 0 | null | 2018-09-18T12:52:32 | 2018-09-18T12:52:31 | null | UTF-8 | Java | false | false | 3,781 | java | package org.wso2.carbon.apimgt.rest.api.publisher.dto;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
/**
* EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO
*/
public class EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO {
@SerializedName("timeWindow")
private Integer timeWindow = null;
@SerializedName("bucketSize")
private Integer bucketSize = null;
@SerializedName("requestVolumeThreshold")
private Integer requestVolumeThreshold = null;
public EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO timeWindow(Integer timeWindow) {
this.timeWindow = timeWindow;
return this;
}
/**
* time window in milliseconds
* @return timeWindow
**/
@ApiModelProperty(example = "1000", value = "time window in milliseconds")
public Integer getTimeWindow() {
return timeWindow;
}
public void setTimeWindow(Integer timeWindow) {
this.timeWindow = timeWindow;
}
public EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO bucketSize(Integer bucketSize) {
this.bucketSize = bucketSize;
return this;
}
/**
* bucket size in milliseconds
* @return bucketSize
**/
@ApiModelProperty(example = "1000", value = "bucket size in milliseconds ")
public Integer getBucketSize() {
return bucketSize;
}
public void setBucketSize(Integer bucketSize) {
this.bucketSize = bucketSize;
}
public EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO requestVolumeThreshold(Integer requestVolumeThreshold) {
this.requestVolumeThreshold = requestVolumeThreshold;
return this;
}
/**
* Minimum number of requests in a rolling window that will trip the circuit.
* @return requestVolumeThreshold
**/
@ApiModelProperty(example = "2", value = "Minimum number of requests in a rolling window that will trip the circuit. ")
public Integer getRequestVolumeThreshold() {
return requestVolumeThreshold;
}
public void setRequestVolumeThreshold(Integer requestVolumeThreshold) {
this.requestVolumeThreshold = requestVolumeThreshold;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO endPointEndpointConfigCircuitBreakerRollingWindow = (EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO) o;
return Objects.equals(this.timeWindow, endPointEndpointConfigCircuitBreakerRollingWindow.timeWindow) &&
Objects.equals(this.bucketSize, endPointEndpointConfigCircuitBreakerRollingWindow.bucketSize) &&
Objects.equals(this.requestVolumeThreshold, endPointEndpointConfigCircuitBreakerRollingWindow.requestVolumeThreshold);
}
@Override
public int hashCode() {
return Objects.hash(timeWindow, bucketSize, requestVolumeThreshold);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EndPoint_endpointConfig_circuitBreaker_rollingWindowDTO {\n");
sb.append(" timeWindow: ").append(toIndentedString(timeWindow)).append("\n");
sb.append(" bucketSize: ").append(toIndentedString(bucketSize)).append("\n");
sb.append(" requestVolumeThreshold: ").append(toIndentedString(requestVolumeThreshold)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"rajithroshan90@gmail.com"
] | rajithroshan90@gmail.com |
be341f588c7631990e349b3a242ab0872b202aac | 15bf603ddf7d9f0819919587a778abc229bbd792 | /Sentinel/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/param/ParamFlowRule.java | 5b2747fc38567a7fc68f828ce1d95b280ffd021e | [
"Apache-2.0"
] | permissive | Luciexxm/Spring-Cloud-Alibaba | a900538e3435a5355d41c3c4054cddbef8f3138e | 9106f7125cbd6915f04b97e07c0468b670793f4e | refs/heads/master | 2022-12-23T06:48:33.454795 | 2020-07-09T06:42:09 | 2020-07-09T06:42:09 | 168,626,503 | 2 | 2 | Apache-2.0 | 2022-12-15T23:24:10 | 2019-02-01T01:55:26 | Java | UTF-8 | Java | false | false | 5,666 | java | /*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.csp.sentinel.slots.block.flow.param;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.csp.sentinel.context.Context;
import com.alibaba.csp.sentinel.node.DefaultNode;
import com.alibaba.csp.sentinel.slots.block.AbstractRule;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
/**
* Rules for "hot-spot" frequent parameter flow control.
*
* @author jialiang.linjl
* @author Eric Zhao
* @since 0.2.0
*/
public class ParamFlowRule extends AbstractRule {
public ParamFlowRule() {}
public ParamFlowRule(String resourceName) {
setResource(resourceName);
}
/**
* The threshold type of flow control (0: thread count, 1: QPS).
*/
private int grade = RuleConstant.FLOW_GRADE_QPS;
/**
* Parameter index.
*/
private Integer paramIdx;
/**
* The threshold count.
*/
private double count;
/**
* Original exclusion items of parameters.
*/
private List<ParamFlowItem> paramFlowItemList = new ArrayList<ParamFlowItem>();
/**
* Parsed exclusion items of parameters. Only for internal use.
*/
private Map<Object, Integer> hotItems = new HashMap<Object, Integer>();
/**
* Indicating whether the rule is for cluster mode.
*/
private boolean clusterMode = false;
/**
* Cluster mode specific config for parameter flow rule.
*/
private ParamFlowClusterConfig clusterConfig;
public int getGrade() {
return grade;
}
public ParamFlowRule setGrade(int grade) {
this.grade = grade;
return this;
}
public Integer getParamIdx() {
return paramIdx;
}
public ParamFlowRule setParamIdx(Integer paramIdx) {
this.paramIdx = paramIdx;
return this;
}
public double getCount() {
return count;
}
public ParamFlowRule setCount(double count) {
this.count = count;
return this;
}
public List<ParamFlowItem> getParamFlowItemList() {
return paramFlowItemList;
}
public ParamFlowRule setParamFlowItemList(List<ParamFlowItem> paramFlowItemList) {
this.paramFlowItemList = paramFlowItemList;
return this;
}
public Integer retrieveExclusiveItemCount(Object value) {
if (value == null || hotItems == null) {
return null;
}
return hotItems.get(value);
}
Map<Object, Integer> getParsedHotItems() {
return hotItems;
}
ParamFlowRule setParsedHotItems(Map<Object, Integer> hotItems) {
this.hotItems = hotItems;
return this;
}
public boolean isClusterMode() {
return clusterMode;
}
public ParamFlowRule setClusterMode(boolean clusterMode) {
this.clusterMode = clusterMode;
return this;
}
public ParamFlowClusterConfig getClusterConfig() {
return clusterConfig;
}
public ParamFlowRule setClusterConfig(ParamFlowClusterConfig clusterConfig) {
this.clusterConfig = clusterConfig;
return this;
}
@Override
@Deprecated
public boolean passCheck(Context context, DefaultNode node, int count, Object... args) {
return true;
}
@Override
public boolean equals(Object o) {
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
if (!super.equals(o)) { return false; }
ParamFlowRule rule = (ParamFlowRule)o;
if (grade != rule.grade) { return false; }
if (Double.compare(rule.count, count) != 0) { return false; }
if (clusterMode != rule.clusterMode) { return false; }
if (paramIdx != null ? !paramIdx.equals(rule.paramIdx) : rule.paramIdx != null) { return false; }
if (paramFlowItemList != null ? !paramFlowItemList.equals(rule.paramFlowItemList)
: rule.paramFlowItemList != null) { return false; }
return clusterConfig != null ? clusterConfig.equals(rule.clusterConfig) : rule.clusterConfig == null;
}
@Override
public int hashCode() {
int result = super.hashCode();
long temp;
result = 31 * result + grade;
result = 31 * result + (paramIdx != null ? paramIdx.hashCode() : 0);
temp = Double.doubleToLongBits(count);
result = 31 * result + (int)(temp ^ (temp >>> 32));
result = 31 * result + (paramFlowItemList != null ? paramFlowItemList.hashCode() : 0);
result = 31 * result + (clusterMode ? 1 : 0);
result = 31 * result + (clusterConfig != null ? clusterConfig.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "ParamFlowRule{" +
"grade=" + grade +
", paramIdx=" + paramIdx +
", count=" + count +
", paramFlowItemList=" + paramFlowItemList +
", clusterMode=" + clusterMode +
", clusterConfig=" + clusterConfig +
'}';
}
}
| [
"xxm@163.com"
] | xxm@163.com |
04c1611d7d63fba934fca5b2dd0a273f46a891ee | 5d3f8de6925cb388bab706741e0d3e74a5bda79e | /src/java_swing_study/ch09/layout/silsup07/InputPanel.java | f240acf7970ba58a1936978f3bc5dc9184df4dc3 | [] | no_license | jsonhyun/java_swing_study | 19ccb5c4d5331c27830799ab0355aa6ca7cd6bc1 | 5216b97a8b7f33fd17e82841cbb94b5288637aec | refs/heads/master | 2020-12-05T08:36:44.631694 | 2020-02-05T09:08:30 | 2020-02-05T09:08:30 | 232,059,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package java_swing_study.ch09.layout.silsup07;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
@SuppressWarnings("serial")
public class InputPanel extends JPanel {
private JLabel lblInput;
private JTextField tfInput;
/**
* Create the panel.
*/
public InputPanel() {
initialize();
}
private void initialize() {
setBackground(Color.GRAY);
lblInput = new JLabel("수식입력");
lblInput.setFont(new Font("굴림", Font.PLAIN, 14));
add(lblInput);
tfInput = new JTextField();
add(tfInput);
tfInput.setColumns(20);
}
}
| [
"airplant@naver.com"
] | airplant@naver.com |
301bb249ddc08813529a0bc6090d8bc6f87f1181 | 3d0cbc81cfa7e484cf14662b003508f52f1d2b08 | /translator-web-meta/translator-web-app/src/main/java/com/github/bogdanovmn/translator/web/app/admin/upload/UploadBookController.java | faa1b02b46ff5c8da692acb4586a36a56ba765b2 | [
"BSD-2-Clause"
] | permissive | bogdanovmn/translator | 94a578aef866ee2ec48235dfb5c359296c0ff6ce | e9af02bd5768fcf51cf69e07ed11c1e5529f24c7 | refs/heads/master | 2022-10-06T04:51:13.376678 | 2022-10-03T23:11:14 | 2022-10-03T23:11:14 | 103,356,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,328 | java | package com.github.bogdanovmn.translator.web.app.admin.upload;
import com.github.bogdanovmn.common.spring.menu.MenuItem;
import com.github.bogdanovmn.common.spring.mvc.ViewTemplate;
import com.github.bogdanovmn.translator.web.app.infrastructure.AbstractVisualAdminController;
import com.github.bogdanovmn.translator.web.app.infrastructure.menu.MainMenuItem;
import com.github.bogdanovmn.translator.web.orm.entity.Source;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.io.IOException;
@Slf4j
@Controller
class UploadBookController extends AbstractVisualAdminController {
private final UploadBookService uploadBookService;
@Autowired
UploadBookController(UploadBookService uploadBookService) {
this.uploadBookService = uploadBookService;
}
@Override
protected MenuItem currentMenuItem() {
return MainMenuItem.UPLOAD_BOOK;
}
@PostMapping("/upload-book")
String upload(
@RequestParam("file") MultipartFile file,
RedirectAttributes redirectAttributes
) {
try {
Source source = uploadBookService.upload(file);
redirectAttributes.addFlashAttribute("msg", "OK!");
redirectAttributes.addFlashAttribute("source", source);
}
catch (IOException e) {
LOG.error("Upload book error", e);
redirectAttributes.addFlashAttribute(
"customError",
String.format(
"Что-то пошло не так при загрузке файла (%s)",
e.getMessage()
)
);
}
catch (UploadDuplicateException e) {
redirectAttributes.addFlashAttribute("customError", e.getMessage());
}
return "redirect:/admin/upload-book";
}
@GetMapping("/upload-book")
ModelAndView form(
@RequestHeader(name = "referer", required = false) String referer)
{
return new ViewTemplate("upload_book")
.with("referer" , referer)
.modelAndView();
}
}
| [
"bogdanovmn@gmail.com"
] | bogdanovmn@gmail.com |
18aeff6a5c9ef559a66a801d0c31f0fb0045a710 | 3ea8067937000a18dc94ed8b6f1de6d5e2d0bfdd | /app/src/main/java/com/techgigandroidhackathon/ui/SplashScreen.java | 185e29f008d191c8abbc30d8ab0f00461e418a55 | [
"Apache-2.0"
] | permissive | AmolGangadhare/TG-hackathon | 3488fcc0687a3b5b2979fc46219ab146ba7abf84 | 84841a57f053fd76089d6af60a948c3b0f1f3054 | refs/heads/master | 2023-02-02T10:16:01.427658 | 2020-12-22T16:38:12 | 2020-12-22T16:38:12 | 113,480,883 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | package com.techgigandroidhackathon.Activity;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.techgigandroidhackathon.MainActivity;
import com.techgigandroidhackathon.R;
public class SplashScreen extends AppCompatActivity {
private Intent intent;
private Handler mHandler;
private long delayTime = 3 * 1000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
initialize();
}
/**
* Initialize variables
*/
private void initialize() {
intent = new Intent(this, MainActivity.class);
mHandler = new Handler();
mHandler.postDelayed(delayRunnable, delayTime);
}
private Runnable delayRunnable = new Runnable() {
@Override
public void run() {
startActivity(intent);
finish();
}
};
}
| [
"amol.gangadhare@gmail.com"
] | amol.gangadhare@gmail.com |
f87bcc02dc384c56ad8012b5e7ca9a925acdf804 | 8e0f83362fdb0391af7321f61b506ffd64db0111 | /src/main/java/org/linagora/linshare/uploadproposition/enums/MatchType.java | 2cbfd59e6bb120aacfed570a75a5b8055f5f1c5a | [] | no_license | rasata/linshare-upload-proposition | b9ed0397a422f60fd842f623f3ed1a33818456cb | d7e5e6bfb2462d40075d21bf3b48760eae071638 | refs/heads/master | 2021-09-11T20:28:49.947748 | 2018-04-11T09:31:21 | 2018-04-11T09:31:21 | 198,106,606 | 1 | 0 | null | 2019-07-21T21:22:45 | 2019-07-21T21:22:45 | null | UTF-8 | Java | false | false | 196 | java | package org.linagora.linshare.uploadproposition.enums;
public enum MatchType {
ALL, ANY, TRUE;
public static MatchType fromString(String s) {
return MatchType.valueOf(s.toUpperCase());
}
}
| [
"fmartin@linagora.com"
] | fmartin@linagora.com |
2fe928a068f305595d490bce97d48a17a94e4ecd | 1fbc7b819ded0824d28f4e24465b023e30c1f421 | /core/src/main/java/org/mini2Dx/core/input/GamePadConnectionListener.java | 57ae85e09bbbf481bb6c0e85a339ffa5c23c995a | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | mini2Dx/mini2Dx | 959bfce4690f54cce68c9e8bb68328d2d48eaeaa | 93a5c6cb59ff186926ca7005604aad5e707a7656 | refs/heads/master | 2023-09-03T14:37:58.044965 | 2023-08-19T18:47:09 | 2023-08-19T18:47:09 | 8,236,056 | 543 | 76 | Apache-2.0 | 2022-12-05T21:53:34 | 2013-02-16T13:27:08 | Java | UTF-8 | Java | false | false | 929 | java | /*******************************************************************************
* Copyright 2020 Viridian Software Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.mini2Dx.core.input;
public interface GamePadConnectionListener {
public void onConnect(GamePad gamePad);
public void onDisconnect(GamePad gamePad);
}
| [
"thomascashman404@gmail.com"
] | thomascashman404@gmail.com |
f0fb87924d2d33ae9ff96549a62342c650f6fc9a | a22017d5e0bc78268e862350b3b53dfb9b4b15d6 | /mainframe/src/main/java/com/taoxue/umeng/model/BasePageModel.java | 4a56fa7b53650c6c4d65d177fe07bb40b8b4c1cc | [] | no_license | hanks7/HjjAndroidFrame | 1a0d8d43961b3f1d48ba09341391747f0f2dcf7a | 928f649f67c699b50481b8dcb4ff652bd5a2ce3f | refs/heads/master | 2021-05-12T18:57:14.857376 | 2018-03-23T04:32:17 | 2018-03-23T04:32:17 | 117,078,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.taoxue.umeng.model;
import com.taoxue.umeng.base.BaseModel;
import java.io.Serializable;
/**
* Created by CC on 2016/12/11.
*/
public class BasePageModel<Data extends Serializable> extends BaseModel {
private PageModel<Data> page;
public PageModel<Data> getPage() {
return page;
}
public void setPage(PageModel<Data> page) {
this.page = page;
}
}
| [
"474664736@qq.com"
] | 474664736@qq.com |
77e413f5e5d9d2b010eb7ff3c0dca272464ebb1a | d6ea7df6c966b4c87d1fad4a2e4ad47141f8a16a | /src/Lesson4/Exersices.java | 59e41f80acf77be9574256cb1b59e860cc9f42d9 | [] | no_license | DenisMelaRossa/TryAtHome | a19ae62cba35620d1842821af85c3b83fb74e0a2 | f271dfacc389f4fcf2ab58e1cea8fd017ea3cdc7 | refs/heads/master | 2023-04-03T18:50:28.833415 | 2021-04-16T11:46:51 | 2021-04-16T11:46:51 | 330,184,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | package Lesson4;
import java.util.Scanner;
public class Exersices {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the number: ");
int a = scanner.nextInt();
int sum = 0;
for (int i = 0; i < a; i++) {
sum += i;
}
System.out.println(sum);
for (int i = 1; i <= 3; i++) {
System.out.println("3 * " + i + " = " + 3 * i);
}
for (int i = 0; i <20 ; i++) {
if (7*i<100) {
System.out.print(7 * i + " ");
}
}
int i=1;
while (7*i<100){
System.out.print(7*i+" ");
i++;
}
System.out.println();
int j=1;
while (j<=512){
System.out.print(j+" ");
j*=2;
}
int pelmen=0;
while (pelmen<=10){
if (pelmen==5){
System.out.println("lucky one");
break;
}
System.out.println(pelmen);
pelmen++;
}
}
}
| [
"denis1803@tut.by"
] | denis1803@tut.by |
064555c0c01f42b031492e3fb60496788fd838b3 | 7edc06c93808988665196e9eb5d2ab2c99b3788e | /app/src/main/java/com/example/mypc/cloudstorage/asyctask/ContactTask.java | bd514513e3b5bd57e2204c1a14df1c4a42b7ced7 | [] | no_license | JohnChin/Clouding | 06445305e465dc75c568e079d987065ad273964e | e727d17cad24814b097ed9d557d437860d7b3bb2 | refs/heads/master | 2020-03-08T08:06:52.502453 | 2018-04-23T08:39:56 | 2018-04-23T08:39:56 | 128,012,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,340 | java | package com.example.mypc.cloudstorage.asyctask;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.ContactsContract;
import android.provider.ContactsContract.PhoneLookup;
import android.util.Log;
import android.widget.Toast;
import com.example.mypc.cloudstorage.activities.ContactBackupActivity;
import com.example.mypc.cloudstorage.methods.XMLWriter;
public class ContactTask extends AsyncTask<Void, Void, String>{
private Context context;
public ProgressDialog pContactDialog;
private ContentResolver resolver;
private int sumCount = 0;
private int proNum = 0;
private Uri uri = ContactsContract.Contacts.CONTENT_URI;
// 定义联系人ID和联系人名称两个字段
private String[] columns = new String[]{ContactsContract.Contacts._ID, PhoneLookup.DISPLAY_NAME};
private XMLWriter writer;
private Cursor dataCursor;
private static final String CONTACTS = "contacts";
private static final String CONTACT = "contact";
//private static final String ID = "id";
private static final String NAME = "name";
private static final String PHONE = "phone";
public ContactTask(Context context, File file) throws FileNotFoundException {
pContactDialog = new ProgressDialog(context);
pContactDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pContactDialog.setMessage("联系人备份中...");
pContactDialog.setCancelable(false);
resolver = context.getContentResolver();
writer = new XMLWriter(file);
this.context = context;
}
@Override
protected void onPreExecute() {
pContactDialog.show();
}
@Override
protected String doInBackground(Void... params) {
Cursor cursor = resolver.query(uri, columns,
// 限定返回只返回有号码的联系人
PhoneLookup.HAS_PHONE_NUMBER + "=1", null, null);
sumCount = cursor.getCount(); //获取一共有多少条记录
if (sumCount > 0) {
writer.writeDocument();
writer.writeStartTAG(CONTACTS);
try {
while(cursor.moveToNext()){
// 写联系人信息
writeContactById(cursor.getLong(0), cursor.getString(1));
// 通知界面更新
proNum ++;
publishProgress();
}
writer.writeEndTAG(CONTACTS);
return "success";
} catch (IOException e) {
e.printStackTrace();
Log.w("ContactTask", e.toString());
} finally {
cursor.close();
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return null;
}
private void writeContactById(long id, String name) throws IOException {
// 根据联系人ID,查找联系人所有的电话号码
dataCursor = resolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER},
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + id, null, null);
writer.writeStartTAG(CONTACT);
// 判断是否包含xml文件中不支持的特殊符号
if (name.contains("&") || name.contains("<")) {
writer.writeTextData(name, NAME);
} else {
writer.writeText(name, NAME);
}
while (dataCursor.moveToNext()) {
// 循环把联系人的电话号码一一写入到xml文件中
writer.writeText(dataCursor.getString(0), PHONE);
}
writer.writeEndTAG(CONTACT);
writer.flush();
// 一定要记得关闭该游标,不然就资源泄露。会报cursor finalized without prior close的警告
dataCursor.close();
}
@Override
protected void onPostExecute(String result) {
pContactDialog.dismiss();
if (result != null) {
// 将上下文转换为MainActivity,并调用loadData方法刷新数据
ContactBackupActivity contactBackupActivity=(ContactBackupActivity)context;
contactBackupActivity.RefreshList();
Toast.makeText(context, "成功备份"+sumCount+"个联系人", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(context, "联系人备份失败", Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onProgressUpdate(Void... values) {
pContactDialog.setProgress((int)(proNum * (100.0/sumCount)));
pContactDialog.setProgressNumberFormat(proNum + "/" + sumCount);
}
}
| [
"617756545@qq.com"
] | 617756545@qq.com |
41b24d683bd9f30df719793adde6a790fa52d7d9 | 779283d00b8a43f6eb0a20730eb97b6e0187b164 | /app/src/main/java/com/eslam/restapi_facebook_simpleapp/Post.java | efa91a28d39575b4a654fc7056867e9be917cc4b | [] | no_license | mreslamgeek/RestApi-facebook-simpleApp | 393f39835c34f1255143b6f842a7a3d47df56bda | 7a5ee4a7022ef80aabbb136785c85670ac6590ae | refs/heads/master | 2023-02-07T21:28:40.504362 | 2020-12-19T18:30:34 | 2020-12-19T18:30:34 | 322,901,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 819 | java | package com.eslam.restapi_facebook_simpleapp;
class Post {
private int userId;
private int id;
private String title;
private String body;
public Post(int userId, String title, String body) {
this.userId = userId;
this.title = title;
this.body = body;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
| [
"42094349+mreslamgeek@users.noreply.github.com"
] | 42094349+mreslamgeek@users.noreply.github.com |
c1f5831de9c5314328abaf2bff3368a0fd783fa1 | 27a4f901e1d511d4f180af735faf9d9e3eb01f74 | /Canzoni Saneremo Esame/CanzoniSanremo/src/java/it/unisa/CanzoneEJBRemote.java | 84b1107a02836e09dfb8417081c2aaa1c06401fd | [] | no_license | dahSayril/PDistribuita | 918392b20d6bcf333bf43b736826d437ee6981e4 | c62956e368105fbda626aad425cf65269260de00 | refs/heads/main | 2023-02-15T21:03:50.281868 | 2021-01-11T20:52:11 | 2021-01-11T20:52:11 | 305,811,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package it.unisa;
import java.util.List;
import javax.ejb.Remote;
@Remote
public interface CanzoneEJBRemote {
void creaCanzone(CanzoneEntity c);
CanzoneEntity aggiornaCanzone(CanzoneEntity c);
void rimuoviCanzone(CanzoneEntity c);
CanzoneEntity ottieniDaId(int id);
List <CanzoneEntity> ottieniTutti();
List <CanzoneEntity> ottieniDaCategoria(String categoria);
List <CanzoneEntity> ottieniDaVotoMinimo(int voto);
CanzoneEntity aggiornaVoti(int id, int voti);
}
| [
"sig.cirillo@gmail.com"
] | sig.cirillo@gmail.com |
8ed28464ee84f7b1e82bc62bfe0f670b8ccef0c0 | 923e1b95ecdff04759018308dc643dbbc15f40f2 | /app/src/main/java/com/hackreactive/cognivic/ui/home/HomeViewModelFactory.java | 5deebc53536ac1a5364b8ad33124e9ba1c65156e | [] | no_license | brijeshshah13/cognivic-android | 5ccb115ec150bc96b3703fbf5c51c69d682b0222 | 44bbd6ab15c618d2676190829a4204478e325805 | refs/heads/master | 2020-04-17T11:13:22.705910 | 2019-01-20T09:57:06 | 2019-01-20T09:57:06 | 166,532,458 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package com.hackreactive.cognivic.ui.home;
import android.arch.lifecycle.ViewModel;
import android.arch.lifecycle.ViewModelProvider;
import android.support.annotation.NonNull;
import com.hackreactive.cognivic.data.network.NetworkDataSource;
public class HomeViewModelFactory extends ViewModelProvider.NewInstanceFactory {
private final NetworkDataSource mNetworkDataSource;
public HomeViewModelFactory(NetworkDataSource networkDataSource) {
mNetworkDataSource = networkDataSource;
}
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
// No inspection unchecked
return (T) new HomeViewModel(mNetworkDataSource);
}
}
| [
"antarikshc@gmail.com"
] | antarikshc@gmail.com |
d4af7732bbf760dff3295ada880708100fbdb0d2 | 2731b2cd91df760fd394eed270f4e74ddcabaf4e | /src/main/java/com/example/myspringapp/resourse/FileResourse.java | 6328aeae3a036ce28adf6af8a40ede080ca2ae05 | [] | no_license | Jaiv24/myspringapp | 61b125304c7df02b5c413bb63d3c020e461960ff | 0b3fd9e5436e39f97d3a3dae6831a961319f8caa | refs/heads/main | 2023-08-19T06:36:52.855983 | 2021-10-03T17:04:47 | 2021-10-03T17:04:47 | 395,051,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,900 | java | package com.example.myspringapp.resourse;
import com.amazonaws.services.s3.Headers;
import com.amazonaws.services.s3.model.S3Object;
import com.example.myspringapp.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@RestController
@RequestMapping("/api/files")
public class FileResourse {
@Autowired
private FileService fileService;
@PostMapping
public boolean upload(@RequestParam(name = "file") MultipartFile file){
return fileService.upload(file);
}
@GetMapping("/view")
public void view(@RequestParam(name = "key") String key, HttpServletResponse response) throws IOException {
S3Object s3Object = fileService.getFile(key);
response.setContentType(s3Object.getObjectMetadata().getContentType());
response.getOutputStream().write(s3Object.getObjectContent().readAllBytes());
}
@GetMapping("/download")
public ResponseEntity<Resource> download(@RequestParam(name = "key") String key) throws IOException {
S3Object s3Object = fileService.getFile(key);
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType(s3Object.getObjectMetadata().getContentType()))
.header(Headers.CONTENT_DISPOSITION, "attachment; filename=\"" + key + "\"")
.body(new ByteArrayResource(s3Object.getObjectContent().readAllBytes()));
}
@DeleteMapping
public void delete(@RequestParam(name = "key") String key){
fileService.deleteFile(key);
}
}
| [
"jaiv.maurya@gmail.com"
] | jaiv.maurya@gmail.com |
72af7c9fae9ad847afe57a43d8614f52459f0045 | daf2f7ef7cdd6cfead3bbe7fd1b321254e15240d | /src/main/java/tech/flapweb/apps/rest/extensions/RequestValidator.java | e86dc6da65deebf0defd063f18d35319b638f25b | [] | no_license | lszita/flapweb-rest-services | ef2e7bbc8d6d20adea54e96b4bd9d0075374fd3f | 58377ddebdb1b02dd3949f24a9ed3426106476d5 | refs/heads/master | 2020-03-23T08:15:32.008857 | 2018-10-16T13:02:17 | 2018-10-16T13:02:17 | 141,316,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package tech.flapweb.apps.rest.extensions;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import javax.validation.ConstraintViolationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
@Provider
public class RequestValidator implements ExceptionMapper<ConstraintViolationException> {
@Override
public Response toResponse(final ConstraintViolationException exception) {
return Response.status(Response.Status.BAD_REQUEST)
.entity(prepareMessage(exception))
.type("application/json")
.build();
}
private JsonObject prepareMessage(ConstraintViolationException exception) {
JsonObjectBuilder responseObjectBuilder = Json.createObjectBuilder();
JsonArrayBuilder errors = Json.createArrayBuilder();
exception.getConstraintViolations().forEach(v -> errors.add(v.getMessage()));
responseObjectBuilder
.add("status", "error")
.add("errors", errors.build());
return responseObjectBuilder.build();
}
}
| [
"lajos.szita@oracle.com"
] | lajos.szita@oracle.com |
439fc35d2966325ef1d213be6ab3c749f8698ed3 | b85376d5c76246b2866a743d70a723e17f99b08e | /Algorithm_213_House Robber II.java | 8bf17e6cbbe4afcf97780035ae203c134dae3c04 | [] | no_license | zclyne/LeetCode-Problems | db56a21ea6620ccb7506e24622490560c039225e | 3f59e4c2ac7dc95e4b9e70e705616f5ee4915967 | refs/heads/master | 2022-08-27T12:00:49.477906 | 2022-08-22T20:23:10 | 2022-08-22T20:23:10 | 123,556,538 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | java | // 思路:首尾相连表明nums[0]和nums[nums.length - 1]中最多只能有一个被选中
// 因此可以看作2次Algorithm_198,没有环的情况
// 第一次为nums[0 : nums.length - 1],第二次为nums[1 : nums.length]
class Solution {
public int rob(int[] nums) {
if (nums == null || nums.length == 0) {
return 0;
} else if (nums.length == 1) {
return nums[0];
}
int lastRob = 0, lastNotRob = 0, result = 0;
for (int i = 0; i < nums.length - 1; i++) {
int curRob = lastNotRob + nums[i];
int curNotRob = Math.max(lastRob, lastNotRob);
lastRob = curRob;
lastNotRob = curNotRob;
}
result = Math.max(lastRob, lastNotRob);
lastRob = 0;
lastNotRob = 0;
for (int i = 1; i < nums.length; i++) {
int curRob = lastNotRob + nums[i];
int curNotRob = Math.max(lastRob, lastNotRob);
lastRob = curRob;
lastNotRob = curNotRob;
}
result = Math.max(result, Math.max(lastRob, lastNotRob));
return result;
}
} | [
"zyfinori@gmail.com"
] | zyfinori@gmail.com |
2adfef0b9ce3b333f769d45a5b1bd34ea0e63d76 | 28b27d45e9f31077961d32f1494966980608d469 | /Problem_1.java | e43875ba2d03b686626652e4ada6c51838472374 | [] | no_license | poojakittur/Binary-Search-2 | 4241e28b198b4d6dcafc80b4437e2cbe3b0ebcfb | 1163d72b4889870965a64473d327f3877550da8a | refs/heads/master | 2020-11-30T04:29:35.889225 | 2019-12-27T11:37:26 | 2019-12-27T11:37:26 | 230,301,829 | 0 | 0 | null | 2019-12-26T17:23:36 | 2019-12-26T17:23:36 | null | UTF-8 | Java | false | false | 1,656 | java | class Solution {
public int[] searchRange(int[] nums, int target) {
if(nums.length == 0 || nums == null){
return new int[]{-1, -1};
}
int left = binarySearchLeft(nums, target);
int right = binarySearchRight(nums, target);
return new int[]{left, right};
}
private int binarySearchLeft(int[] nums, int target){
int low = 0;
int high = nums.length - 1;
while(low <= high){
int mid = low + (high - low)/2;
if(nums[mid] == target){
if(mid == 0 || nums[mid-1] < nums[mid]){
return mid;
}else{
high = mid - 1;
}
}else if(nums[mid] < target){
low = mid + 1;
}else{
high = mid - 1;
}
}
return -1;
}
private int binarySearchRight(int[] nums, int target){
int low = 0;
int high = nums.length - 1;
while(low <= high){
int mid = low + (high - low)/2;
if(nums[mid] == target){
if(mid == nums.length-1 || nums[mid] < nums[mid+1]){
return mid;
}else{
low = mid + 1;
}
}else if(nums[mid] < target){
low = mid + 1;
}else{
high = mid - 1;
}
}
return -1;
}
} | [
"gitpoojakittur@gmail.com"
] | gitpoojakittur@gmail.com |
2b11e10d345928513c2492fee21f1a0f236f5482 | 709f4223787e848abd979b2c730bd4b0d501d50a | /oedu-base/src/main/java/net/oedu/backend/base/endpoints/EndpointParameterType.java | 9c0de5c8007177edc5cf0f59f362d809a8dbd9d9 | [] | no_license | o-edu/backend | 12413e496ec98281b3d35b062b836c0ee60b0d99 | 430dc19dfc51c4bb95b2d68b55f14db4a8a99595 | refs/heads/master | 2023-01-30T05:23:35.710743 | 2020-12-11T15:35:35 | 2020-12-11T15:35:35 | 294,079,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package net.oedu.backend.base.endpoints;
public enum EndpointParameterType {
NORMAL,
REPOSITORY,
USER,
SESSION
}
| [
"frederik04.fj@gmail.com"
] | frederik04.fj@gmail.com |
0b6f1cd746b9036deb259a1cfa49fbf057b90b3c | 1287c570eca9c7b0405f8b18a9647ab318a75c22 | /src/main/java/burke/personal/sfgdi/services/SetterGreeting.java | b9bd436c5412540538203201b415ca08a97090cd | [] | no_license | TesterAccount243/sfg-di | 810dbd72b6731169de1e9cdc4153ca72a6db0f03 | 113ed672c281c5845c005ae1839d1b33d326c050 | refs/heads/master | 2023-01-09T14:40:23.357747 | 2020-11-02T16:00:38 | 2020-11-02T16:00:38 | 303,957,628 | 0 | 0 | null | 2020-10-15T15:03:11 | 2020-10-14T08:55:10 | null | UTF-8 | Java | false | false | 256 | java | package burke.personal.sfgdi.services;
import org.springframework.stereotype.Service;
@Service
public class SetterGreeting implements GreetingService {
@Override
public String sayGreeting() {
return "Hello there from the Setter";
}
}
| [
"rig@pop-os.localdomain"
] | rig@pop-os.localdomain |
bb0736d8a1b069fd5d3b6f2519162529e7e8ee28 | ed8e9c7c2fbe8ee587a2c06b4dc043f7aef3de8a | /app/src/main/java/com/zm/liaopei/tencent/model/TRTCCalling.java | ed3ab7a5df0570c99838b1f3e120fec1de9c11c1 | [] | no_license | FanLiangl/liaopei_andorid | f1ea1fb425a8ff314cc1243fa9251dbbae766647 | 04d883de56cc83d6ab4bbae6ff354d6535db2fab | refs/heads/master | 2023-04-19T07:57:23.978389 | 2021-05-06T09:35:08 | 2021-05-06T09:35:08 | 364,857,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,480 | java | package com.zm.liaopei.tencent.model;
import android.content.Context;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.zm.liaopei.tencent.model.impl.TRTCCallingImpl;
import java.util.List;
/**
* TRTC 语音/视频通话接口
* 本功能使用腾讯云实时音视频 / 腾讯云即时通信IM 组合实现
* 使用方式如下
* 1. 初始化
* TRTCCalling sCall = TRTCCallingImpl.sharedInstance(context);
* sCall.init();
* <p>
* 2. 监听回调
* sCall.addDelegate(new TRTCCallingDelegate());
* <p>
* 3. 登录到IM系统中
* sCall.login(A, password, callback);
* <p>
* 4. 给B拨打电话
* sCall.call(B, TYPE_VIDEO_CALL);
* <p>
* 5. 打开自己的摄像头
* sCall.openCamera(true, txCloudVideoView);
* <p>
* 6. 接听/拒绝电话
* 此时B如果也登录了IM系统,会收到TRTCVideoCallListener的onInvited(A, null, false, TYPE_VIDEO_CALL)回调
* B 可以调用 sCall.accept 接受 / sCall.reject 拒绝
* <p>
* 7. 观看对方的画面
* 由于A打开了摄像头,B接受通话后会收到 onUserVideoAvailable(A, true) 回调
* B 可以调用 startRemoteView(A, txCloudVideoView) 就可以看到A的画面了
* <p>
* 8. 结束通话
* 需要结束通话时,A、B 任意一方可以调用 sCall.hangup 挂断电话
* <p>
* 9. 销毁实例
* sCall.destroy();
* TRTCCallingImpl.destroySharedInstance();
*/
public abstract class TRTCCalling {
public static final int TYPE_UNKNOWN = 0;
public static final int TYPE_AUDIO_CALL = 1;
public static final int TYPE_VIDEO_CALL = 2;
private static TRTCCalling sTRTCCalling;
public interface ActionCallBack {
void onError(int code, String msg);
void onSuccess();
}
/**
* 用于获取单例
*
* @param context
* @return 单例
*/
public static TRTCCalling sharedInstance(Context context) {
synchronized (TRTCCallingImpl.class) {
if (sTRTCCalling == null) {
sTRTCCalling = new TRTCCallingImpl(context);
}
return sTRTCCalling;
}
}
/**
* 销毁单例
*/
public static void destroySharedInstance() {
synchronized (TRTCCallingImpl.class) {
if (sTRTCCalling != null) {
sTRTCCalling.destroy();
sTRTCCalling = null;
}
}
}
/**
* 销毁函数,如果不需要再运行该实例,请调用该接口
*/
public abstract void destroy();
/**
* 增加回调接口
*
* @param delegate 上层可以通过回调监听事件
*/
public abstract void addDelegate(TRTCCallingDelegate delegate);
/**
* 移除回调接口
*
* @param delegate 需要移除的监听器
*/
public abstract void removeDelegate(TRTCCallingDelegate delegate);
/**
* 登录IM接口,所有功能需要先进行登录后才能使用
*
* @param sdkAppId
* @param userId
* @param userSig
* @param callback
*/
public abstract void login(int sdkAppId, final String userId, String userSig, final ActionCallBack callback);
/**
* 登出接口,登出后无法再进行拨打操作
*/
public abstract void logout(final ActionCallBack callBack);
/**
* C2C邀请通话,被邀请方会收到 {@link TRTCCallingDelegate#onInvited } 的回调
* 如果当前处于通话中,可以调用该函数以邀请第三方进入通话
*
* @param userId 被邀请方
* @param type 1-语音通话,2-视频通话
*/
public abstract void call(String userId, int type);
/**
* IM群组邀请通话,被邀请方会收到 {@link TRTCCallingDelegate#onInvited } 的回调
* 如果当前处于通话中,可以继续调用该函数继续邀请他人进入通话,同时正在通话的用户会收到 {@link TRTCCallingDelegate#onGroupCallInviteeListUpdate(List)} 的回调
*
* @param userIdList 邀请列表
* @param type 1-语音通话,2-视频通话
* @param groupId IM群组ID
*/
public abstract void groupCall(List<String> userIdList, int type, String groupId);
/**
* 当您作为被邀请方收到 {@link TRTCCallingDelegate#onInvited } 的回调时,可以调用该函数接听来电
*/
public abstract void accept();
/**
* 当您作为被邀请方收到 {@link TRTCCallingDelegate#onInvited } 的回调时,可以调用该函数拒绝来电
*/
public abstract void reject();
/**
* 当您处于通话中,可以调用该函数结束通话
*/
public abstract void hangup();
/**
* 当您收到 onUserVideoAvailable 回调时,可以调用该函数将远端用户的摄像头数据渲染到指定的TXCloudVideoView中
*
* @param userId 远端用户id
* @param txCloudVideoView 远端用户数据将渲染到该view中
*/
public abstract void startRemoteView(String userId, TXCloudVideoView txCloudVideoView);
/**
* 当您收到 onUserVideoAvailable 回调为false时,可以停止渲染数据
*
* @param userId 远端用户id
*/
public abstract void stopRemoteView(String userId);
/**
* 您可以调用该函数开启摄像头,并渲染在指定的TXCloudVideoView中
* 处于通话中的用户会收到 {@link TRTCCallingDelegate#onUserVideoAvailable(String, boolean)} 回调
*
* @param isFrontCamera 是否开启前置摄像头
* @param txCloudVideoView 摄像头的数据将渲染到该view中
*/
public abstract void openCamera(boolean isFrontCamera, TXCloudVideoView txCloudVideoView);
/**
* 您可以调用该函数关闭摄像头
* 处于通话中的用户会收到 {@link TRTCCallingDelegate#onUserVideoAvailable(String, boolean)} 回调
*/
public abstract void closeCamera();
/**
* 您可以调用该函数切换前后摄像头
*
* @param isFrontCamera true:切换前置摄像头 false:切换后置摄像头
*/
public abstract void switchCamera(boolean isFrontCamera);
/**
* 是否静音mic
*
* @param isMute true:麦克风关闭 false:麦克风打开
*/
public abstract void setMicMute(boolean isMute);
/**
* 是否开启免提
*
* @param isHandsFree true:开启免提 false:关闭免提
*/
public abstract void setHandsFree(boolean isHandsFree);
}
| [
"fanjialiang1314@qq.com"
] | fanjialiang1314@qq.com |
22319c685f7010d84205d75a4810a23dff44d9cf | 034557b4abfa44a507a5f6433e1cea52568996a2 | /src/jcifs2/util/MD4.java | ff097c23950f470fd649b8561711dcce7ead7037 | [
"Apache-2.0"
] | permissive | archos-sa/aos-FileCoreLibrary | 23788ab2793cdbbbed625cf0708cd10898a31334 | c8457c6bd5add0d0db3439721617422c6631dedd | refs/heads/master | 2021-01-21T19:51:12.136066 | 2018-04-04T08:04:05 | 2018-04-04T08:05:19 | 98,518,053 | 8 | 11 | Apache-2.0 | 2018-10-20T13:51:33 | 2017-07-27T09:23:25 | Java | UTF-8 | Java | false | false | 9,514 | java | // This file is currently unlocked (change this line if you lock the file)
//
// $Log: MD4.java,v $
// Revision 1.2 1998/01/05 03:41:19 iang
// Added references only.
//
// Revision 1.1.1.1 1997/11/03 22:36:56 hopwood
// + Imported to CVS (tagged as 'start').
//
// Revision 0.1.0.0 1997/07/14 R. Naffah
// + original version
//
// $Endlog$
/*
* Copyright (c) 1997 Systemics Ltd
* on behalf of the Cryptix Development Team. All rights reserved.
*/
package jcifs2.util;
import java.security.MessageDigest;
/**
* Implements the MD4 message digest algorithm in Java.
* <p>
* <b>References:</b>
* <ol>
* <li> Ronald L. Rivest,
* "<a href="http://www.roxen.com/rfc/rfc1320.html">
* The MD4 Message-Digest Algorithm</a>",
* IETF RFC-1320 (informational).
* </ol>
*
* <p><b>$Revision: 1.2 $</b>
* @author Raif S. Naffah
*/
public class MD4 extends MessageDigest implements Cloneable
{
// MD4 specific object variables
//...........................................................................
/**
* The size in bytes of the input block to the tranformation algorithm.
*/
private static final int BLOCK_LENGTH = 64; // = 512 / 8;
/**
* 4 32-bit words (interim result)
*/
private int[] context = new int[4];
/**
* Number of bytes processed so far mod. 2 power of 64.
*/
private long count;
/**
* 512 bits input buffer = 16 x 32-bit words holds until reaches 512 bits.
*/
private byte[] buffer = new byte[BLOCK_LENGTH];
/**
* 512 bits work buffer = 16 x 32-bit words
*/
private int[] X = new int[16];
// Constructors
//...........................................................................
public MD4 () {
super("MD4");
engineReset();
}
/**
* This constructor is here to implement cloneability of this class.
*/
private MD4 (MD4 md) {
this();
context = (int[])md.context.clone();
buffer = (byte[])md.buffer.clone();
count = md.count;
}
// Cloneable method implementation
//...........................................................................
/**
* Returns a copy of this MD object.
*/
public Object clone() { return new MD4(this); }
// JCE methods
//...........................................................................
/**
* Resets this object disregarding any temporary data present at the
* time of the invocation of this call.
*/
public void engineReset () {
// initial values of MD4 i.e. A, B, C, D
// as per rfc-1320; they are low-order byte first
context[0] = 0x67452301;
context[1] = 0xEFCDAB89;
context[2] = 0x98BADCFE;
context[3] = 0x10325476;
count = 0L;
for (int i = 0; i < BLOCK_LENGTH; i++)
buffer[i] = 0;
}
/**
* Continues an MD4 message digest using the input byte.
*/
public void engineUpdate (byte b) {
// compute number of bytes still unhashed; ie. present in buffer
int i = (int)(count % BLOCK_LENGTH);
count++; // update number of bytes
buffer[i] = b;
if (i == BLOCK_LENGTH - 1)
transform(buffer, 0);
}
/**
* MD4 block update operation.
* <p>
* Continues an MD4 message digest operation, by filling the buffer,
* transform(ing) data in 512-bit message block(s), updating the variables
* context and count, and leaving (buffering) the remaining bytes in buffer
* for the next update or finish.
*
* @param input input block
* @param offset start of meaningful bytes in input
* @param len count of bytes in input block to consider
*/
public void engineUpdate (byte[] input, int offset, int len) {
// make sure we don't exceed input's allocated size/length
if (offset < 0 || len < 0 || (long)offset + len > input.length)
throw new ArrayIndexOutOfBoundsException();
// compute number of bytes still unhashed; ie. present in buffer
int bufferNdx = (int)(count % BLOCK_LENGTH);
count += len; // update number of bytes
int partLen = BLOCK_LENGTH - bufferNdx;
int i = 0;
if (len >= partLen) {
System.arraycopy(input, offset, buffer, bufferNdx, partLen);
transform(buffer, 0);
for (i = partLen; i + BLOCK_LENGTH - 1 < len; i+= BLOCK_LENGTH)
transform(input, offset + i);
bufferNdx = 0;
}
// buffer remaining input
if (i < len)
System.arraycopy(input, offset + i, buffer, bufferNdx, len - i);
}
/**
* Completes the hash computation by performing final operations such
* as padding. At the return of this engineDigest, the MD engine is
* reset.
*
* @return the array of bytes for the resulting hash value.
*/
public byte[] engineDigest () {
// pad output to 56 mod 64; as RFC1320 puts it: congruent to 448 mod 512
int bufferNdx = (int)(count % BLOCK_LENGTH);
int padLen = (bufferNdx < 56) ? (56 - bufferNdx) : (120 - bufferNdx);
// padding is alwas binary 1 followed by binary 0s
byte[] tail = new byte[padLen + 8];
tail[0] = (byte)0x80;
// append length before final transform:
// save number of bits, casting the long to an array of 8 bytes
// save low-order byte first.
for (int i = 0; i < 8; i++)
tail[padLen + i] = (byte)((count * 8) >>> (8 * i));
engineUpdate(tail, 0, tail.length);
byte[] result = new byte[16];
// cast this MD4's context (array of 4 ints) into an array of 16 bytes.
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
result[i * 4 + j] = (byte)(context[i] >>> (8 * j));
// reset the engine
engineReset();
return result;
}
// own methods
//...........................................................................
/**
* MD4 basic transformation.
* <p>
* Transforms context based on 512 bits from input block starting
* from the offset'th byte.
*
* @param block input sub-array.
* @param offset starting position of sub-array.
*/
private void transform (byte[] block, int offset) {
// encodes 64 bytes from input block into an array of 16 32-bit
// entities. Use A as a temp var.
for (int i = 0; i < 16; i++)
X[i] = (block[offset++] & 0xFF) |
(block[offset++] & 0xFF) << 8 |
(block[offset++] & 0xFF) << 16 |
(block[offset++] & 0xFF) << 24;
int A = context[0];
int B = context[1];
int C = context[2];
int D = context[3];
A = FF(A, B, C, D, X[ 0], 3);
D = FF(D, A, B, C, X[ 1], 7);
C = FF(C, D, A, B, X[ 2], 11);
B = FF(B, C, D, A, X[ 3], 19);
A = FF(A, B, C, D, X[ 4], 3);
D = FF(D, A, B, C, X[ 5], 7);
C = FF(C, D, A, B, X[ 6], 11);
B = FF(B, C, D, A, X[ 7], 19);
A = FF(A, B, C, D, X[ 8], 3);
D = FF(D, A, B, C, X[ 9], 7);
C = FF(C, D, A, B, X[10], 11);
B = FF(B, C, D, A, X[11], 19);
A = FF(A, B, C, D, X[12], 3);
D = FF(D, A, B, C, X[13], 7);
C = FF(C, D, A, B, X[14], 11);
B = FF(B, C, D, A, X[15], 19);
A = GG(A, B, C, D, X[ 0], 3);
D = GG(D, A, B, C, X[ 4], 5);
C = GG(C, D, A, B, X[ 8], 9);
B = GG(B, C, D, A, X[12], 13);
A = GG(A, B, C, D, X[ 1], 3);
D = GG(D, A, B, C, X[ 5], 5);
C = GG(C, D, A, B, X[ 9], 9);
B = GG(B, C, D, A, X[13], 13);
A = GG(A, B, C, D, X[ 2], 3);
D = GG(D, A, B, C, X[ 6], 5);
C = GG(C, D, A, B, X[10], 9);
B = GG(B, C, D, A, X[14], 13);
A = GG(A, B, C, D, X[ 3], 3);
D = GG(D, A, B, C, X[ 7], 5);
C = GG(C, D, A, B, X[11], 9);
B = GG(B, C, D, A, X[15], 13);
A = HH(A, B, C, D, X[ 0], 3);
D = HH(D, A, B, C, X[ 8], 9);
C = HH(C, D, A, B, X[ 4], 11);
B = HH(B, C, D, A, X[12], 15);
A = HH(A, B, C, D, X[ 2], 3);
D = HH(D, A, B, C, X[10], 9);
C = HH(C, D, A, B, X[ 6], 11);
B = HH(B, C, D, A, X[14], 15);
A = HH(A, B, C, D, X[ 1], 3);
D = HH(D, A, B, C, X[ 9], 9);
C = HH(C, D, A, B, X[ 5], 11);
B = HH(B, C, D, A, X[13], 15);
A = HH(A, B, C, D, X[ 3], 3);
D = HH(D, A, B, C, X[11], 9);
C = HH(C, D, A, B, X[ 7], 11);
B = HH(B, C, D, A, X[15], 15);
context[0] += A;
context[1] += B;
context[2] += C;
context[3] += D;
}
// The basic MD4 atomic functions.
private int FF (int a, int b, int c, int d, int x, int s) {
int t = a + ((b & c) | (~b & d)) + x;
return t << s | t >>> (32 - s);
}
private int GG (int a, int b, int c, int d, int x, int s) {
int t = a + ((b & (c | d)) | (c & d)) + x + 0x5A827999;
return t << s | t >>> (32 - s);
}
private int HH (int a, int b, int c, int d, int x, int s) {
int t = a + (b ^ c ^ d) + x + 0x6ED9EBA1;
return t << s | t >>> (32 - s);
}
}
| [
"noury@archos.com"
] | noury@archos.com |
7a8d74901ce682ae36a8bef040ec5670f9e9930b | fdea1f2754132d82b49d7171664addbda655cd54 | /app/src/main/java/org/projects/shopassist/SplashScreen.java | 9de892978e27573f7aeaab1cb1808dae4be10a61 | [] | no_license | roxanajula/ShopAssist | ad1fb896c50fe3f3ea68ed04b45d1ac0e39f5f48 | 77b7127f40fbb06b4713ba3bdf7636c67a6a6b63 | refs/heads/master | 2021-01-01T04:40:27.430622 | 2016-05-09T23:55:11 | 2016-05-09T23:55:11 | 58,328,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | package org.projects.shopassist;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
/**
* Created by roxanajula on 5/9/16.
*/
public class SplashScreen extends Activity {
// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(SplashScreen.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
} | [
"roxana.jula@gmail.com"
] | roxana.jula@gmail.com |
678d4e5ac1929072646580e940456448d3361287 | 0ff9f9701c479eddd488dd3c97a80263e9eb3f9f | /src/ch04/d.java | 504e517abd4aae02f10005404e8ffaae2a3e2603 | [] | no_license | NandaJannata00/Alpro_21_02 | 2ca254b8961f6918ce85c4110a1ffd9ed8a07d8d | b3993a1378e6dc844544da5cc223c49d11fc36e1 | refs/heads/master | 2022-08-12T03:38:49.516744 | 2020-05-18T05:54:38 | 2020-05-18T05:54:38 | 264,845,185 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package ch04;
public class d {
public static void main(String[] args) {
int [] array1 = {82,12,41,38,19,26,9,48,20,5,8,32,3};
for(int i = 0; i < array1.length; i++){
if (array1[i] % 3 == 0){
System.out.print(array1[i] + " ");
}
}
}
}
| [
"abdullahjannata1@gmail.com"
] | abdullahjannata1@gmail.com |
d05eacb59b48252074d9612b956146dc423f36d1 | a13efb450d9056f5ccf8dc16227c919392fc6671 | /app/src/main/java/com/litao/ttweather/weathertrendgraph/DensityUtils.java | 1ce638ac932b2ff76850bed6ec522e7a5dff714b | [] | no_license | 365318663/wuleWheather | 2767debf20dd57ccfe95e2f6a2edd744c0e1e541 | 87ad37461014ddc969c2f92f0aa5693930de8d91 | refs/heads/master | 2022-12-13T02:45:24.284284 | 2020-09-10T02:17:28 | 2020-09-10T02:17:28 | 293,062,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | package com.litao.ttweather.weathertrendgraph;
import android.content.Context;
/**
* Created by OO on 2017/3/26.
*/
public class DensityUtils {
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dp2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
*/
public static int px2dp(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
public static int sp2px(Context context, float spValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (spValue * fontScale + 0.5f);
}
}
| [
"365318663@qq.com"
] | 365318663@qq.com |
286e23dea301223d75ec09fd35a8698721ede1d4 | fb7bb2ae813ca657932331602f39241e40a71de8 | /febs-common/src/main/java/com/mxys/febs/common/exception/FebsAuthException.java | 20a9aca038f26838c8a52e476ab37ef24758440b | [] | no_license | xpf0321/FEBS-BASE | ebaec6f813a8aa39da17682c99c001fac95409c3 | ab34ae2beae84ff012052e55a9553931bab4bb1f | refs/heads/master | 2022-06-26T22:19:11.344700 | 2019-11-08T10:35:16 | 2019-11-08T10:35:16 | 219,704,838 | 0 | 0 | null | 2022-06-17T02:39:16 | 2019-11-05T09:20:26 | Java | UTF-8 | Java | false | false | 243 | java | package com.mxys.febs.common.exception;
public class FebsAuthException extends Exception{
private static final long serialVersionUID = -6916154462432027437L;
public FebsAuthException(String message){
super(message);
}
} | [
"18813004399@163.com"
] | 18813004399@163.com |
e9ae0fa281fbf06bafc2d5cff1985b904767b7fd | ea8013860ed0b905c64f449c8bce9e0c34a23f7b | /SystemUIGoogle/sources/com/android/systemui/biometrics/AuthBiometricUdfpsView.java | b2891cb41ee11e02e36f16deb64307aaea231cca | [] | no_license | TheScarastic/redfin_b5 | 5efe0dc0d40b09a1a102dfb98bcde09bac4956db | 6d85efe92477576c4901cce62e1202e31c30cbd2 | refs/heads/master | 2023-08-13T22:05:30.321241 | 2021-09-28T12:33:20 | 2021-09-28T12:33:20 | 411,210,644 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,627 | java | package com.android.systemui.biometrics;
import android.content.Context;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.util.AttributeSet;
import com.android.systemui.biometrics.AuthDialog;
/* loaded from: classes.dex */
public class AuthBiometricUdfpsView extends AuthBiometricFingerprintView {
private UdfpsDialogMeasureAdapter mMeasureAdapter;
public AuthBiometricUdfpsView(Context context) {
this(context, null);
}
public AuthBiometricUdfpsView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
/* access modifiers changed from: package-private */
public void setSensorProps(FingerprintSensorPropertiesInternal fingerprintSensorPropertiesInternal) {
UdfpsDialogMeasureAdapter udfpsDialogMeasureAdapter = this.mMeasureAdapter;
if (udfpsDialogMeasureAdapter == null || udfpsDialogMeasureAdapter.getSensorProps() != fingerprintSensorPropertiesInternal) {
this.mMeasureAdapter = new UdfpsDialogMeasureAdapter(this, fingerprintSensorPropertiesInternal);
}
}
/* access modifiers changed from: package-private */
@Override // com.android.systemui.biometrics.AuthBiometricView
public AuthDialog.LayoutParams onMeasureInternal(int i, int i2) {
AuthDialog.LayoutParams onMeasureInternal = super.onMeasureInternal(i, i2);
UdfpsDialogMeasureAdapter udfpsDialogMeasureAdapter = this.mMeasureAdapter;
return udfpsDialogMeasureAdapter != null ? udfpsDialogMeasureAdapter.onMeasureInternal(i, i2, onMeasureInternal) : onMeasureInternal;
}
}
| [
"warabhishek@gmail.com"
] | warabhishek@gmail.com |
3b424726df89bb6fa471efdbeeb1fd48ae316e69 | 3d3cebc53f740c634663da8349779617f2d89347 | /src/me/sablednah/MobHealth/NewWidgitActions.java | e595a1daf808df5b6dee7153f7a8dfa3051a96b0 | [] | no_license | Paril/MobHealth | 0d5a951e28df207c90682563a11f8ff42605b134 | c44a585cec425f51aba28082c16fe9210b748dce | refs/heads/master | 2021-01-16T19:52:28.412560 | 2013-06-06T19:08:42 | 2013-06-06T19:08:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package me.sablednah.MobHealth;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer;
public class NewWidgitActions implements Runnable {
public MobHealth plugin;
private Player player;
private Widget widget;
private int action;
public NewWidgitActions(Player p, MobHealth plugin, int action, Widget widget) {
this.player = p;
this.plugin = plugin;
this.action = action;
this.widget = widget;
}
@Override
public void run() {
SpoutPlayer splayer = SpoutManager.getPlayer(player);
MobHealth.killWidget(player, action);
splayer.getMainScreen().removeWidget(widget);
}
}
| [
"darren.douglas@gmail.com"
] | darren.douglas@gmail.com |
d2eeeb3111a297659f2e04ce2bfdacd1e47cb8c6 | 073357dd64537a2fc150e4d5e265ea633e06d9ec | /src/com/techlearning/practice/randomprogram/StringPrograms.java | 35d7242643f7ebc17e5d21ceab12a784957d85ee | [] | no_license | amit-code-receipe/javaprogram | 603b36cebaedc52f7efe799787ddad7a65ba9b84 | c2c65534ba3681ffdcc2a1b647962ae4723ab27d | refs/heads/main | 2023-06-14T14:46:41.636018 | 2021-06-19T09:21:32 | 2021-06-19T09:21:32 | 312,606,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,436 | java | package src.com.techlearning.practice.randomprogram;
public class StringPrograms {
//reverse string
public static String reversedString(String input){
String reversed="";
int i=input.length()-1;
while(i>=0){
reversed=reversed+input.charAt(i);
i--;
}
return reversed;
}
//palindrome check
public static boolean isPalindrome(String input,String word){
return (orderStringInAsc(input).equals(orderStringInAsc(word)));
}
public static String orderStringInAsc(String in){
char[] ch= in.toCharArray();
for(int i=0;i<ch.length;i++){
for(int j=i+1;j<ch.length;j++){
if(ch[i]>ch[j]){
char tmp=ch[i];
ch[i]=ch[j];
ch[j]=tmp;
}
}
}
return new String(ch);
}
// all substring
//find a given string in another string
public static void main(String args[]){
System.out.println("Reverse of Time is "+reversedString("Time"));
System.out.println("Reverse of Amit is "+reversedString("Amit"));
System.out.println("Amit is palindrome of imAt "+isPalindrome("Amit","imAt"));
System.out.println("abcde is palindrome of cdeba "+isPalindrome("abcde","cdeba"));
System.out.println("abcde is palindrome of cdaeba "+isPalindrome("abcde","cdeaba"));
}
}
| [
"ami.singh.1989@gmail.com"
] | ami.singh.1989@gmail.com |
e7e6b03948bdd797fddd17fa6cc6288366e083c7 | b914e5c377d209c5da4a32a8fa80433b550f1928 | /src/main/java/org/jboss/com/sun/corba/se/spi/ior/IdentifiableBase.java | 03967a6ba41997af54c7156832f1660e8622c5a9 | [] | no_license | jboss/jboss-rmi-api_spec | fba98c8b561235b38e072b58ba4cb7f3931767cd | 826d7a6fd167fb8341a2854faa073822407bd9ee | refs/heads/master | 2023-08-26T06:31:00.782358 | 2018-01-23T14:51:37 | 2018-01-23T14:51:37 | 2,223,478 | 0 | 3 | null | 2016-06-22T18:32:15 | 2011-08-17T18:27:50 | Java | UTF-8 | Java | false | false | 2,068 | java | /*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.jboss.com.sun.corba.se.spi.ior;
import org.jboss.com.sun.corba.se.impl.ior.EncapsulationUtility;
import org.omg.CORBA_2_3.portable.OutputStream;
/**
* Provide support for properly reading and writing Identifiable objects that are also encapsulations (tagged profiles
* and components).
*/
public abstract class IdentifiableBase implements Identifiable, WriteContents
{
/**
* Write the data for this object as a CDR encapsulation. This is used for writing tagged components and profiles.
* These data types must be written out as encapsulations, which means that we need to first write the data out to
* an encapsulation stream, then extract the data and write it to os as an array of octets.
*/
final public void write(OutputStream os)
{
EncapsulationUtility.writeEncapsulation(this, os);
}
}
| [
"sguilhen@redhat.com"
] | sguilhen@redhat.com |
e461ac8e148afb700b9ef75bcfc55de1f71cab04 | e37dab05ee887907df6ce3366e152bcaaec15965 | /app/src/androidTest/java/com/atilano/datawriting/ExampleInstrumentedTest.java | 5811772c493e1e8b5c7787ebbb845dac82c64f47 | [] | no_license | jeaninaa/Atilano_DataWriting | f6ccb0872f95d2c30916f7311528a9a9f801b69f | fbfb43cbecf5ebe217bacbfe5bbdcfb9afbdfd25 | refs/heads/master | 2021-08-09T03:13:17.077009 | 2017-11-12T04:21:57 | 2017-11-12T04:21:57 | 110,119,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package com.atilano.datawriting;
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.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.atilano.datawriting", appContext.getPackageName());
}
}
| [
"2014072568@ust-ics.mygbiz.com"
] | 2014072568@ust-ics.mygbiz.com |
fee9b2e3a799eb2ea47f6a4ed0b007e3e755a3c5 | eb5f5353f49ee558e497e5caded1f60f32f536b5 | /com/sun/jmx/snmp/agent/SnmpRequestTree.java | 194c0affff0badf99ac44a6fef347615d28c2b82 | [] | no_license | mohitrajvardhan17/java1.8.0_151 | 6fc53e15354d88b53bd248c260c954807d612118 | 6eeab0c0fd20be34db653f4778f8828068c50c92 | refs/heads/master | 2020-03-18T09:44:14.769133 | 2018-05-23T14:28:24 | 2018-05-23T14:28:24 | 134,578,186 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 18,808 | java | package com.sun.jmx.snmp.agent;
import com.sun.jmx.defaults.JmxProperties;
import com.sun.jmx.snmp.SnmpEngine;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpPdu;
import com.sun.jmx.snmp.SnmpStatusException;
import com.sun.jmx.snmp.SnmpVarBind;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
final class SnmpRequestTree
{
private Hashtable<Object, Handler> hashtable = null;
private SnmpMibRequest request = null;
private int version = 0;
private boolean creationflag = false;
private boolean getnextflag = false;
private int type = 0;
private boolean setreqflag = false;
SnmpRequestTree(SnmpMibRequest paramSnmpMibRequest, boolean paramBoolean, int paramInt)
{
request = paramSnmpMibRequest;
version = paramSnmpMibRequest.getVersion();
creationflag = paramBoolean;
hashtable = new Hashtable();
setPduType(paramInt);
}
public static int mapSetException(int paramInt1, int paramInt2)
throws SnmpStatusException
{
int i = paramInt1;
if (paramInt2 == 0) {
return i;
}
int j = i;
if (i == 225) {
j = 17;
} else if (i == 224) {
j = 17;
}
return j;
}
public static int mapGetException(int paramInt1, int paramInt2)
throws SnmpStatusException
{
int i = paramInt1;
if (paramInt2 == 0) {
return i;
}
int j = i;
if (i == 225) {
j = i;
} else if (i == 224) {
j = i;
} else if (i == 6) {
j = 224;
} else if (i == 18) {
j = 224;
} else if ((i >= 7) && (i <= 12)) {
j = 224;
} else if (i == 4) {
j = 224;
} else if ((i != 16) && (i != 5)) {
j = 225;
}
return j;
}
public Object getUserData()
{
return request.getUserData();
}
public boolean isCreationAllowed()
{
return creationflag;
}
public boolean isSetRequest()
{
return setreqflag;
}
public int getVersion()
{
return version;
}
public int getRequestPduVersion()
{
return request.getRequestPduVersion();
}
public SnmpMibNode getMetaNode(Handler paramHandler)
{
return meta;
}
public int getOidDepth(Handler paramHandler)
{
return depth;
}
public Enumeration<SnmpMibSubRequest> getSubRequests(Handler paramHandler)
{
return new Enum(this, paramHandler);
}
public Enumeration<Handler> getHandlers()
{
return hashtable.elements();
}
public void add(SnmpMibNode paramSnmpMibNode, int paramInt, SnmpVarBind paramSnmpVarBind)
throws SnmpStatusException
{
registerNode(paramSnmpMibNode, paramInt, null, paramSnmpVarBind, false, null);
}
public void add(SnmpMibNode paramSnmpMibNode, int paramInt, SnmpOid paramSnmpOid, SnmpVarBind paramSnmpVarBind, boolean paramBoolean)
throws SnmpStatusException
{
registerNode(paramSnmpMibNode, paramInt, paramSnmpOid, paramSnmpVarBind, paramBoolean, null);
}
public void add(SnmpMibNode paramSnmpMibNode, int paramInt, SnmpOid paramSnmpOid, SnmpVarBind paramSnmpVarBind1, boolean paramBoolean, SnmpVarBind paramSnmpVarBind2)
throws SnmpStatusException
{
registerNode(paramSnmpMibNode, paramInt, paramSnmpOid, paramSnmpVarBind1, paramBoolean, paramSnmpVarBind2);
}
void setPduType(int paramInt)
{
type = paramInt;
setreqflag = ((paramInt == 253) || (paramInt == 163));
}
void setGetNextFlag()
{
getnextflag = true;
}
void switchCreationFlag(boolean paramBoolean)
{
creationflag = paramBoolean;
}
SnmpMibSubRequest getSubRequest(Handler paramHandler)
{
if (paramHandler == null) {
return null;
}
return new SnmpMibSubRequestImpl(request, paramHandler.getSubList(), null, false, getnextflag, null);
}
SnmpMibSubRequest getSubRequest(Handler paramHandler, SnmpOid paramSnmpOid)
{
if (paramHandler == null) {
return null;
}
int i = paramHandler.getEntryPos(paramSnmpOid);
if (i == -1) {
return null;
}
return new SnmpMibSubRequestImpl(request, paramHandler.getEntrySubList(i), paramHandler.getEntryOid(i), paramHandler.isNewEntry(i), getnextflag, paramHandler.getRowStatusVarBind(i));
}
SnmpMibSubRequest getSubRequest(Handler paramHandler, int paramInt)
{
if (paramHandler == null) {
return null;
}
return new SnmpMibSubRequestImpl(request, paramHandler.getEntrySubList(paramInt), paramHandler.getEntryOid(paramInt), paramHandler.isNewEntry(paramInt), getnextflag, paramHandler.getRowStatusVarBind(paramInt));
}
private void put(Object paramObject, Handler paramHandler)
{
if (paramHandler == null) {
return;
}
if (paramObject == null) {
return;
}
if (hashtable == null) {
hashtable = new Hashtable();
}
hashtable.put(paramObject, paramHandler);
}
private Handler get(Object paramObject)
{
if (paramObject == null) {
return null;
}
if (hashtable == null) {
return null;
}
return (Handler)hashtable.get(paramObject);
}
private static int findOid(SnmpOid[] paramArrayOfSnmpOid, int paramInt, SnmpOid paramSnmpOid)
{
int i = paramInt;
int j = 0;
int k = i - 1;
for (int m = j + (k - j) / 2; j <= k; m = j + (k - j) / 2)
{
SnmpOid localSnmpOid = paramArrayOfSnmpOid[m];
int n = paramSnmpOid.compareTo(localSnmpOid);
if (n == 0) {
return m;
}
if (paramSnmpOid.equals(localSnmpOid)) {
return m;
}
if (n > 0) {
j = m + 1;
} else {
k = m - 1;
}
}
return -1;
}
private static int getInsertionPoint(SnmpOid[] paramArrayOfSnmpOid, int paramInt, SnmpOid paramSnmpOid)
{
SnmpOid[] arrayOfSnmpOid = paramArrayOfSnmpOid;
int i = paramInt;
int j = 0;
int k = i - 1;
for (int m = j + (k - j) / 2; j <= k; m = j + (k - j) / 2)
{
SnmpOid localSnmpOid = arrayOfSnmpOid[m];
int n = paramSnmpOid.compareTo(localSnmpOid);
if (n == 0) {
return m;
}
if (n > 0) {
j = m + 1;
} else {
k = m - 1;
}
}
return m;
}
private void registerNode(SnmpMibNode paramSnmpMibNode, int paramInt, SnmpOid paramSnmpOid, SnmpVarBind paramSnmpVarBind1, boolean paramBoolean, SnmpVarBind paramSnmpVarBind2)
throws SnmpStatusException
{
if (paramSnmpMibNode == null)
{
JmxProperties.SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpRequestTree.class.getName(), "registerNode", "meta-node is null!");
return;
}
if (paramSnmpVarBind1 == null)
{
JmxProperties.SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpRequestTree.class.getName(), "registerNode", "varbind is null!");
return;
}
SnmpMibNode localSnmpMibNode = paramSnmpMibNode;
Handler localHandler = get(localSnmpMibNode);
if (localHandler == null)
{
localHandler = new Handler(type);
meta = paramSnmpMibNode;
depth = paramInt;
put(localSnmpMibNode, localHandler);
}
if (paramSnmpOid == null) {
localHandler.addVarbind(paramSnmpVarBind1);
} else {
localHandler.addVarbind(paramSnmpVarBind1, paramSnmpOid, paramBoolean, paramSnmpVarBind2);
}
}
static final class Enum
implements Enumeration<SnmpMibSubRequest>
{
private final SnmpRequestTree.Handler handler;
private final SnmpRequestTree hlist;
private int entry = 0;
private int iter = 0;
private int size = 0;
Enum(SnmpRequestTree paramSnmpRequestTree, SnmpRequestTree.Handler paramHandler)
{
handler = paramHandler;
hlist = paramSnmpRequestTree;
size = paramHandler.getSubReqCount();
}
public boolean hasMoreElements()
{
return iter < size;
}
public SnmpMibSubRequest nextElement()
throws NoSuchElementException
{
if ((iter == 0) && (handler.sublist != null))
{
iter += 1;
return hlist.getSubRequest(handler);
}
iter += 1;
if (iter > size) {
throw new NoSuchElementException();
}
SnmpMibSubRequest localSnmpMibSubRequest = hlist.getSubRequest(handler, entry);
entry += 1;
return localSnmpMibSubRequest;
}
}
static final class Handler
{
SnmpMibNode meta;
int depth;
Vector<SnmpVarBind> sublist;
SnmpOid[] entryoids = null;
Vector<SnmpVarBind>[] entrylists = null;
boolean[] isentrynew = null;
SnmpVarBind[] rowstatus = null;
int entrycount = 0;
int entrysize = 0;
final int type;
private static final int Delta = 10;
public Handler(int paramInt)
{
type = paramInt;
}
public void addVarbind(SnmpVarBind paramSnmpVarBind)
{
if (sublist == null) {
sublist = new Vector();
}
sublist.addElement(paramSnmpVarBind);
}
void add(int paramInt, SnmpOid paramSnmpOid, Vector<SnmpVarBind> paramVector, boolean paramBoolean, SnmpVarBind paramSnmpVarBind)
{
if (entryoids == null)
{
entryoids = new SnmpOid[10];
entrylists = ((Vector[])new Vector[10]);
isentrynew = new boolean[10];
rowstatus = new SnmpVarBind[10];
entrysize = 10;
paramInt = 0;
}
else if ((paramInt >= entrysize) || (entrycount == entrysize))
{
SnmpOid[] arrayOfSnmpOid = entryoids;
Vector[] arrayOfVector = entrylists;
boolean[] arrayOfBoolean = isentrynew;
SnmpVarBind[] arrayOfSnmpVarBind = rowstatus;
entrysize += 10;
entryoids = new SnmpOid[entrysize];
entrylists = ((Vector[])new Vector[entrysize]);
isentrynew = new boolean[entrysize];
rowstatus = new SnmpVarBind[entrysize];
if (paramInt > entrycount) {
paramInt = entrycount;
}
if (paramInt < 0) {
paramInt = 0;
}
int k = paramInt;
int m = entrycount - paramInt;
if (k > 0)
{
System.arraycopy(arrayOfSnmpOid, 0, entryoids, 0, k);
System.arraycopy(arrayOfVector, 0, entrylists, 0, k);
System.arraycopy(arrayOfBoolean, 0, isentrynew, 0, k);
System.arraycopy(arrayOfSnmpVarBind, 0, rowstatus, 0, k);
}
if (m > 0)
{
int n = k + 1;
System.arraycopy(arrayOfSnmpOid, k, entryoids, n, m);
System.arraycopy(arrayOfVector, k, entrylists, n, m);
System.arraycopy(arrayOfBoolean, k, isentrynew, n, m);
System.arraycopy(arrayOfSnmpVarBind, k, rowstatus, n, m);
}
}
else if (paramInt < entrycount)
{
int i = paramInt + 1;
int j = entrycount - paramInt;
System.arraycopy(entryoids, paramInt, entryoids, i, j);
System.arraycopy(entrylists, paramInt, entrylists, i, j);
System.arraycopy(isentrynew, paramInt, isentrynew, i, j);
System.arraycopy(rowstatus, paramInt, rowstatus, i, j);
}
entryoids[paramInt] = paramSnmpOid;
entrylists[paramInt] = paramVector;
isentrynew[paramInt] = paramBoolean;
rowstatus[paramInt] = paramSnmpVarBind;
entrycount += 1;
}
public void addVarbind(SnmpVarBind paramSnmpVarBind1, SnmpOid paramSnmpOid, boolean paramBoolean, SnmpVarBind paramSnmpVarBind2)
throws SnmpStatusException
{
Vector localVector = null;
SnmpVarBind localSnmpVarBind = paramSnmpVarBind2;
if (entryoids == null)
{
localVector = new Vector();
add(0, paramSnmpOid, localVector, paramBoolean, localSnmpVarBind);
}
else
{
int i = SnmpRequestTree.getInsertionPoint(entryoids, entrycount, paramSnmpOid);
if ((i > -1) && (i < entrycount) && (paramSnmpOid.compareTo(entryoids[i]) == 0))
{
localVector = entrylists[i];
localSnmpVarBind = rowstatus[i];
}
else
{
localVector = new Vector();
add(i, paramSnmpOid, localVector, paramBoolean, localSnmpVarBind);
}
if (paramSnmpVarBind2 != null)
{
if ((localSnmpVarBind != null) && (localSnmpVarBind != paramSnmpVarBind2) && ((type == 253) || (type == 163))) {
throw new SnmpStatusException(12);
}
rowstatus[i] = paramSnmpVarBind2;
}
}
if (paramSnmpVarBind2 != paramSnmpVarBind1) {
localVector.addElement(paramSnmpVarBind1);
}
}
public int getSubReqCount()
{
int i = 0;
if (sublist != null) {
i++;
}
if (entryoids != null) {
i += entrycount;
}
return i;
}
public Vector<SnmpVarBind> getSubList()
{
return sublist;
}
public int getEntryPos(SnmpOid paramSnmpOid)
{
return SnmpRequestTree.findOid(entryoids, entrycount, paramSnmpOid);
}
public SnmpOid getEntryOid(int paramInt)
{
if (entryoids == null) {
return null;
}
if ((paramInt == -1) || (paramInt >= entrycount)) {
return null;
}
return entryoids[paramInt];
}
public boolean isNewEntry(int paramInt)
{
if (entryoids == null) {
return false;
}
if ((paramInt == -1) || (paramInt >= entrycount)) {
return false;
}
return isentrynew[paramInt];
}
public SnmpVarBind getRowStatusVarBind(int paramInt)
{
if (entryoids == null) {
return null;
}
if ((paramInt == -1) || (paramInt >= entrycount)) {
return null;
}
return rowstatus[paramInt];
}
public Vector<SnmpVarBind> getEntrySubList(int paramInt)
{
if (entrylists == null) {
return null;
}
if ((paramInt == -1) || (paramInt >= entrycount)) {
return null;
}
return entrylists[paramInt];
}
public Iterator<SnmpOid> getEntryOids()
{
if (entryoids == null) {
return null;
}
return Arrays.asList(entryoids).iterator();
}
public int getEntryCount()
{
if (entryoids == null) {
return 0;
}
return entrycount;
}
}
static final class SnmpMibSubRequestImpl
implements SnmpMibSubRequest
{
private final Vector<SnmpVarBind> varbinds;
private final SnmpMibRequest global;
private final int version;
private final boolean isnew;
private final SnmpOid entryoid;
private final boolean getnextflag;
private final SnmpVarBind statusvb;
SnmpMibSubRequestImpl(SnmpMibRequest paramSnmpMibRequest, Vector<SnmpVarBind> paramVector, SnmpOid paramSnmpOid, boolean paramBoolean1, boolean paramBoolean2, SnmpVarBind paramSnmpVarBind)
{
global = paramSnmpMibRequest;
varbinds = paramVector;
version = paramSnmpMibRequest.getVersion();
entryoid = paramSnmpOid;
isnew = paramBoolean1;
getnextflag = paramBoolean2;
statusvb = paramSnmpVarBind;
}
public Enumeration<SnmpVarBind> getElements()
{
return varbinds.elements();
}
public Vector<SnmpVarBind> getSubList()
{
return varbinds;
}
public final int getSize()
{
if (varbinds == null) {
return 0;
}
return varbinds.size();
}
public void addVarBind(SnmpVarBind paramSnmpVarBind)
{
varbinds.addElement(paramSnmpVarBind);
global.addVarBind(paramSnmpVarBind);
}
public boolean isNewEntry()
{
return isnew;
}
public SnmpOid getEntryOid()
{
return entryoid;
}
public int getVarIndex(SnmpVarBind paramSnmpVarBind)
{
if (paramSnmpVarBind == null) {
return 0;
}
return global.getVarIndex(paramSnmpVarBind);
}
public Object getUserData()
{
return global.getUserData();
}
public void registerGetException(SnmpVarBind paramSnmpVarBind, SnmpStatusException paramSnmpStatusException)
throws SnmpStatusException
{
if (version == 0) {
throw new SnmpStatusException(paramSnmpStatusException, getVarIndex(paramSnmpVarBind) + 1);
}
if (paramSnmpVarBind == null) {
throw paramSnmpStatusException;
}
if (getnextflag)
{
value = SnmpVarBind.endOfMibView;
return;
}
int i = SnmpRequestTree.mapGetException(paramSnmpStatusException.getStatus(), version);
if (i == 225) {
value = SnmpVarBind.noSuchObject;
} else if (i == 224) {
value = SnmpVarBind.noSuchInstance;
} else {
throw new SnmpStatusException(i, getVarIndex(paramSnmpVarBind) + 1);
}
}
public void registerSetException(SnmpVarBind paramSnmpVarBind, SnmpStatusException paramSnmpStatusException)
throws SnmpStatusException
{
if (version == 0) {
throw new SnmpStatusException(paramSnmpStatusException, getVarIndex(paramSnmpVarBind) + 1);
}
throw new SnmpStatusException(15, getVarIndex(paramSnmpVarBind) + 1);
}
public void registerCheckException(SnmpVarBind paramSnmpVarBind, SnmpStatusException paramSnmpStatusException)
throws SnmpStatusException
{
int i = paramSnmpStatusException.getStatus();
int j = SnmpRequestTree.mapSetException(i, version);
if (i != j) {
throw new SnmpStatusException(j, getVarIndex(paramSnmpVarBind) + 1);
}
throw new SnmpStatusException(paramSnmpStatusException, getVarIndex(paramSnmpVarBind) + 1);
}
public int getVersion()
{
return version;
}
public SnmpVarBind getRowStatusVarBind()
{
return statusvb;
}
public SnmpPdu getPdu()
{
return global.getPdu();
}
public int getRequestPduVersion()
{
return global.getRequestPduVersion();
}
public SnmpEngine getEngine()
{
return global.getEngine();
}
public String getPrincipal()
{
return global.getPrincipal();
}
public int getSecurityLevel()
{
return global.getSecurityLevel();
}
public int getSecurityModel()
{
return global.getSecurityModel();
}
public byte[] getContextName()
{
return global.getContextName();
}
public byte[] getAccessContextName()
{
return global.getAccessContextName();
}
}
}
/* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\com\sun\jmx\snmp\agent\SnmpRequestTree.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"mohit.rajvardhan@ericsson.com"
] | mohit.rajvardhan@ericsson.com |
686898096bd4d9684d4e45343aaaa9fee59deccf | 7e39c9d5c2054d23477b21281fab8270c7a3a683 | /src/main/java/demo/pluto/maven/Bean.java | 47c9474085359a907d65733a90660767b109fefd | [] | no_license | Feiyizhan/pluto.maven | b507018a05a326433e333bf01850a7157a84703f | dd3c6601a91576e7ba52efee17d94e08ec660687 | refs/heads/master | 2021-01-11T08:21:05.817219 | 2017-08-16T01:39:52 | 2017-08-16T01:39:52 | 76,417,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package demo.pluto.maven;
public class Bean {
public Bean(String id, String name) {
super();
this.id = id;
this.name = name;
}
private String id;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"pxu3@mmm.com"
] | pxu3@mmm.com |
efb580e02f415c6e5d643b3a085186c38fef0547 | 7a739dfc0c1c987fff5c06c652f1a98426176762 | /assigments/Unit 2/HW 11 - Recursion/src/hw/recursion/HWRecursion.java | 01c6bfb8bb6252cca56f50369afccdf9e1012ecc | [] | no_license | TaniaQuishpe02/ESPE202011_FP_GEO_3285 | 076be573399df06c6c9dbf8ea0ed2250708b44c2 | a0f204b4f4810a5a4fa1e04f5aee75bc21463f2f | refs/heads/main | 2023-04-08T10:59:34.067799 | 2021-03-31T23:44:49 | 2021-03-31T23:44:49 | 326,759,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java |
package hw.recursion;
/**
*
* @author Tania Lizeth
*/
public class HWRecursion {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int n = 18 ;
int SumRecursive;
int result = SumRecursive (n);
System.out.println( " The Sum Recursive the " + n + "is" + result);
}
public static int SumRecursive (int n) {
int result;
if (n==1) {
return 3 ;
} else {
return result = (n + SumRecursive( n - 1));
}
}
}
| [
"tanializeth@gmail.com"
] | tanializeth@gmail.com |
2342b8132ba1e6d58585ff5ad21c96a9cdc2fb91 | b7d7e13a46a973ac8a0f445305359b5c10fc61f0 | /app/src/main/java/com/example/peterlanier/wgu/AppDatabase.java | 7e0bce8d67a4d203893c1d7e4d249164192bd09b | [] | no_license | peterlanier/android-schedule-planner-wgu | 163776c7ef284db7bcd0a8da48d7fb9ea6bb47f3 | 2b89c0a4efee270c35e2f5c0a3ff6733c20250c4 | refs/heads/master | 2021-09-14T21:41:10.909356 | 2018-05-20T03:23:44 | 2018-05-20T03:23:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package com.example.peterlanier.wgu;
import android.arch.persistence.room.Database;
import android.arch.persistence.room.Room;
import android.arch.persistence.room.RoomDatabase;
import android.content.Context;
/**
* Created by peterlanier on 3/10/18.
*/
@Database(entities = {Term.class, Course.class, Assessment.class
}, version = 21, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
private static AppDatabase INSTANCE;
public abstract TermDao termDao();
public abstract CourseDao courseDao();
public abstract AssessmentDao assessmentDao();
public static AppDatabase getDatabase(Context context) {
if (INSTANCE == null) {
INSTANCE =
Room.databaseBuilder(context, AppDatabase.class, "termdatabase")
//Room.inMemoryDatabaseBuilder(context.getApplicationContext(), AppDatabase.class)
// To simplify the exercise, allow queries on the main thread.
// Don't do this on a real app!
.allowMainThreadQueries()
// recreate the database if necessary
.fallbackToDestructiveMigration()
.build();
}
return INSTANCE;
}
public static void destroyInstance() {
INSTANCE = null;
}
} | [
"peterlanier@me.com"
] | peterlanier@me.com |
822499182acf15e23bce82c557e0a5019f86805d | b37c892a57ef16a33fc037cb4f1baef5a6347ca6 | /LPS/src/main/java/com/pucminas/icoleta/repository/package-info.java | 163594165068039f7d15b042d2a882468bb21e7d | [] | no_license | brunduartt/icoleta | 75f5d6b9b5cf927f0e6c08037a483391c1993cb4 | 9dd0c60223dd44d84282315c9b4c4963d689859e | refs/heads/master | 2023-05-04T06:03:07.542865 | 2021-05-26T03:48:53 | 2021-05-26T03:48:53 | 369,894,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | /**
* Spring Data JPA repositories.
*/
package com.pucminas.icoleta.repository;
| [
"brunduartt@gmail.com"
] | brunduartt@gmail.com |
5f4921375ed08a2ba874c4cde3aec504a4cd5bd8 | bd8a57ef41ee157ad68a082c6f7a3f5a3abfc553 | /redisson/src/main/java/org/redisson/client/protocol/decoder/StreamInfoMapDecoder.java | 1d3d449b3f05ca890dca5ba4242cc029e9f31c5a | [
"Apache-2.0"
] | permissive | songshansitulv/redisson | f2bd48c7149abd9ade33ba8bed94c931836b8958 | 55cc12870d95452ceaa0e531d3520fd1eddbe6a5 | refs/heads/master | 2020-07-08T17:37:52.290324 | 2019-08-22T08:18:31 | 2019-08-22T08:18:31 | 203,734,152 | 0 | 0 | Apache-2.0 | 2019-08-22T07:02:50 | 2019-08-22T07:02:49 | null | UTF-8 | Java | false | false | 1,688 | java | /**
* Copyright (c) 2013-2019 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.client.protocol.decoder;
import java.util.List;
import org.redisson.client.codec.Codec;
import org.redisson.client.handler.State;
import org.redisson.client.protocol.Decoder;
/**
*
* @author Nikita Koksharov
*
*/
public class StreamInfoMapDecoder implements MultiDecoder<Object> {
boolean hasNonZeroLevel = false;
final StreamInfoDecoder streamInfo = new StreamInfoDecoder();
final ObjectMapDecoder decoder;
public StreamInfoMapDecoder(Codec codec) {
decoder = new ObjectMapDecoder(codec);
}
@Override
public Decoder<Object> getDecoder(int paramNum, State state) {
if (state.getLevel() > 0) {
hasNonZeroLevel = true;
}
if (state.getLevel() == 2) {
return decoder.getDecoder(paramNum, state);
}
return null;
}
@Override
public Object decode(List<Object> parts, State state) {
if (hasNonZeroLevel) {
return decoder.decode(parts, state);
}
return streamInfo.decode(parts, state);
}
}
| [
"nkoksharov@redisson.pro"
] | nkoksharov@redisson.pro |
d9058c4988c1a0952536c56f3ba2d35da1c21a02 | 29f78bfb928fb6f191b08624ac81b54878b80ded | /generated_SPs_SCs/test/large2/src/main/java/large2/input/InputDataClassName_4_2.java | d67d981dc401efba7bb8696691580dc886a03825 | [] | no_license | MSPL4SOA/MSPL4SOA-tool | 8a78e73b4ac7123cf1815796a70f26784866f272 | 9f3419e416c600cba13968390ee89110446d80fb | refs/heads/master | 2020-04-17T17:30:27.410359 | 2018-07-27T14:18:55 | 2018-07-27T14:18:55 | 66,304,158 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,023 | java | package large2.input;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "InputDataClassName_4_2")
@XmlType(name = "inputDataClassName_4_2", propOrder = { "InputName_4_2_3",
"InputName_4_2_4", "InputName_4_2_5", "InputName_4_2_6",
"InputName_4_2_1", "InputName_4_2_2" })
public class InputDataClassName_4_2 implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name = "InputName_4_2_3")
protected String InputName_4_2_3;
@XmlElement(name = "InputName_4_2_4")
protected Float InputName_4_2_4;
@XmlElement(name = "InputName_4_2_5")
protected String InputName_4_2_5;
@XmlElement(name = "InputName_4_2_6")
protected Float InputName_4_2_6;
@XmlElement(name = "InputName_4_2_1")
protected Integer InputName_4_2_1;
@XmlElement(name = "InputName_4_2_2")
protected Integer InputName_4_2_2;
public String getInputName_4_2_3() {
return InputName_4_2_3;
}
public Float getInputName_4_2_4() {
return InputName_4_2_4;
}
public String getInputName_4_2_5() {
return InputName_4_2_5;
}
public Float getInputName_4_2_6() {
return InputName_4_2_6;
}
public Integer getInputName_4_2_1() {
return InputName_4_2_1;
}
public Integer getInputName_4_2_2() {
return InputName_4_2_2;
}
public void setInputName_4_2_3(String value) {
this.InputName_4_2_3 = value;
}
public void setInputName_4_2_4(Float value) {
this.InputName_4_2_4 = value;
}
public void setInputName_4_2_5(String value) {
this.InputName_4_2_5 = value;
}
public void setInputName_4_2_6(Float value) {
this.InputName_4_2_6 = value;
}
public void setInputName_4_2_1(Integer value) {
this.InputName_4_2_1 = value;
}
public void setInputName_4_2_2(Integer value) {
this.InputName_4_2_2 = value;
}
}
| [
"akram.kamoun@gmail.com"
] | akram.kamoun@gmail.com |
33847fdbcff9957a2829bdc6ecb7a879ba5b124f | 38abc15b541032792303c1b445a40003170178c9 | /MyProject/src/main/java/com/example/model/exceptions/PaymentException.java | eb6d033fd7127a00acbea23c22d6c0f490d4452c | [] | no_license | vasilvasilev50/Finance-tracker | 9ca35c0704e875cc69be2de25ce2323ec84d489e | 8c4a3798f6a1340b4eee5f3b4e39c022053e1287 | refs/heads/master | 2021-01-12T13:56:37.795236 | 2016-10-25T07:55:49 | 2016-10-25T07:55:49 | 68,927,131 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package com.example.model.exceptions;
public class PaymentException extends Exception {
private static final long serialVersionUID = -5027401775046671742L;
public PaymentException() {
super();
}
public PaymentException(String arg0, Throwable arg1, boolean arg2, boolean arg3) {
super(arg0, arg1, arg2, arg3);
}
public PaymentException(String arg0, Throwable arg1) {
super(arg0, arg1);
}
public PaymentException(String arg0) {
super(arg0);
}
public PaymentException(Throwable arg0) {
super(arg0);
}
}
| [
"Katerina Simeonova"
] | Katerina Simeonova |
c9b3a266eeddf896c1d51c577265c7c934557b93 | 1e4db09bc3fcd22fdacff955f81fe9f4cba0d2c5 | /grade/src/main/java/com/jch/java/api/ScoreController.java | dbdfe4d24b4363221824ee8c01ca13375188f142 | [] | no_license | dreammings/project | 69257c6d3e62e09c868638124164154b72b86bb3 | c7fe0d387cbaeead4e126f47e94732d31a9fe2e3 | refs/heads/master | 2021-04-09T11:01:21.894053 | 2018-03-16T08:58:28 | 2018-03-16T08:58:28 | 125,484,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,518 | java | package com.jch.java.api;
import com.jch.java.common.score.service.ScoreService;
import com.jch.java.util.Constant;
import com.jch.java.util.Response;
import com.jch.java.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/")
public class ScoreController {
@Autowired
private ScoreService scoreService;
//成绩添加
@RequestMapping("insert")
public String addScore(@RequestParam("type") int type, @RequestParam("time") String time,
@RequestParam("chinese") int chinese, @RequestParam("maths") int maths,
@RequestParam("english") int english, @RequestParam("politics") int politics,
@RequestParam("history") int history, @RequestParam("geography") int geography) {
if(StringUtil.isNull(time)){
return Response.info().setCode(Constant.ADD_SCORE_CODE).setMsg(Constant.ADD_SCORE_TIME_MSG).setData(Constant.FAIL_DATA).toJSON();
}
try {
int id = scoreService.addScore(type, time, chinese, maths, english, politics, history, geography);
switch (id){
case -1:
return Response.info().setCode(Constant.ADD_SCORE_CODE).setMsg(Constant.ADD_SCORE_EXIST_MSG).setData(Constant.FAIL_DATA).toJSON();
default:
return Response.info().setCode(Constant.SUCCESS_CODE).setMsg(Constant.ADD_SCORE_SUCCESS_MSG).setData(id).toJSON();
}
}catch (Exception e) {
e.printStackTrace();
return Response.info().setCode(Constant.ADD_SCORE_CODE).setMsg(Constant.ADD_SCORE_FAIL_MSG).setData(Constant.FAIL_DATA).toJSON();
}
}
//成绩列表
@RequestMapping("show")
public String getScoreList(@RequestParam(defaultValue = "0") int type, String sort,
String start_time,String end_time,@RequestParam(defaultValue = "2") int sequence,
@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int per_page) {
try{
String scoreList = scoreService.getScoreList(type, sort, start_time, end_time, sequence, page, per_page);
return Response.info().setCode(Constant.SUCCESS_CODE).setMsg(Constant.QUERY_SCORE_LIST_SUCCESS_MSG).setData(scoreList).toJSON();
}catch (Exception e){
e.printStackTrace();
return Response.info().setCode(Constant.QUERY_SCORE_LIST_CODE).setMsg(Constant.QUERY_SCORE_LIST_FAIL_MSG).setData(Constant.FAIL_DATA).toJSON();
}
}
//成绩走势
@RequestMapping("statistics")
public String getScoreReport(@RequestParam(defaultValue = "0") int type, @RequestParam("subject") String subject,String start_time,String end_time){
try{
String statistic = scoreService.getScoreReport(type, subject, start_time, end_time);
return Response.info().setCode(Constant.SUCCESS_CODE).setMsg(Constant.QUERY_STATISTICS_SUCCESS_MSG).setData(statistic).toJSON();
}catch (Exception e){
e.printStackTrace();
return Response.info().setCode(Constant.QUERY_STATISTICS_CODE).setMsg(Constant.QUERY_STATISTICS_FAIL_MSG).setData(Constant.FAIL_DATA).toJSON();
}
}
}
| [
"jch920324@sina.com"
] | jch920324@sina.com |
aa15b7c2c63c34f06a509000c494c7e4785bb4de | e1885b2bad7f2e4c5cd67ee2ae80b001495a72aa | /app/src/main/java/com/chicsol/alfalah/activities/UserProfileActivity.java | 8cd40016a7a88265d48fd4cad79d4f1eac41145b | [] | no_license | zeeshanchicsol/alfalah | 77dd0acec27abd67dac1855fa917b83b54a7a259 | 9680aa0367109f8ea7d6302437ea4bac77639f0f | refs/heads/master | 2023-01-05T20:28:16.736208 | 2019-06-25T14:16:24 | 2019-06-25T14:16:24 | 307,623,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64,010 | java | package com.chicsol.alfalah.activities;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.chicsol.alfalah.R;
import com.chicsol.alfalah.adapters.ImageSliderPagerAdapter;
import com.chicsol.alfalah.dialogs.dialogBlock;
import com.chicsol.alfalah.dialogs.dialogDeclineInterest;
import com.chicsol.alfalah.dialogs.dialogMatchAid;
import com.chicsol.alfalah.dialogs.dialogMatchAidUnderProcess;
import com.chicsol.alfalah.dialogs.dialogProfileCompletion;
import com.chicsol.alfalah.dialogs.dialogReplyOnAcceptInterest;
import com.chicsol.alfalah.dialogs.dialogReportConcern;
import com.chicsol.alfalah.dialogs.dialogRequestPhone;
import com.chicsol.alfalah.dialogs.dialogShowInterest;
import com.chicsol.alfalah.dialogs.dialogWithdrawInterest;
import com.chicsol.alfalah.fragments.userprofilefragments.BasicInfoFragment;
import com.chicsol.alfalah.fragments.userprofilefragments.PicturesFragment;
import com.chicsol.alfalah.modal.Members;
import com.chicsol.alfalah.other.MarryMax;
import com.chicsol.alfalah.preferences.SharedPreferenceManager;
import com.chicsol.alfalah.urls.Urls;
import com.chicsol.alfalah.utils.Constants;
import com.chicsol.alfalah.utils.MySingleton;
import com.chicsol.alfalah.utils.functions;
import com.chicsol.alfalah.utils.userProfileConstants;
import com.chicsol.alfalah.widgets.faTextView;
import com.chicsol.alfalah.widgets.mTextView;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.process.BitmapProcessor;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by Android on 11/14/2016.
*/
public class UserProfileActivity extends AppCompatActivity {
}/*
public class UserProfileActivity extends AppCompatActivity implements PicturesFragment.onCompleteListener, dialogShowInterest.onCompleteListener, dialogDeclineInterest.onCompleteListener, dialogReplyOnAcceptInterest.onCompleteListener, dialogReportConcern.onCompleteListener, dialogWithdrawInterest.onCompleteListener, dialogBlock.onBlockCompleteListener, dialogMatchAid.onCompleteListener, dialogRequestPhone.onCompleteListener, dialogProfileCompletion.onCompleteListener {
public ImageLoader imageLoader;
//slider
MarryMax marryMax;
private int lastSelectedPage = 0;
Members member;
private ImageView ivZodiacSign, ivCountrySign, ivPhoneVerified;
private PopupMenu popupUp;
//slider
private ViewPager viewPagerSlider;
private List<String> sliderImagesDataList;
private ImageSliderPagerAdapter myCustomPagerAdapter;
private ImageButton ibSwipeRight, ibSwipeLeft;
private faTextView faUserDropdown, faAddToFavourites, faInterestIcon;
// private Toolbar toolbar;
private TabLayout tabLayout1;
private ViewPager viewPager1;
private mTextView tvShowInterestButtonText, tvMatchAid, tvImagesCount, tvInterest, tvAlias, tvAge, tvLocation, tvProfileFor, tvReligion, tvEducation, tvOccupation, tvMaritalStatus, tvLastLoginDate;
private DisplayImageOptions options;
private LayoutInflater inflater;
private LinearLayout llshowInterest, llBottomshowInterest, llBottomSendMessage, llUPSendMessage, llImagesCount, LineaLayoutUserProfileInterestMessage, LineaLayoutUserProfileTopBar;
private JSONArray responsArray;
private String userpath;
private ProgressDialog pDialog;
//
ViewPagerAdapter1 adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_profile);
userpath = getIntent().getExtras().getString("userpath");
*//* dialogGeoInfo newFragment = dialogGeoInfo.newInstance(response.toString());
newFragment.show(getSupportFragmentManager(), "dialog");
*//*
initialize();
setListenders();
JSONObject params = new JSONObject();
try {
params.put("userpath", userpath);
params.put("member_status", SharedPreferenceManager.getUserObject(getApplicationContext()).getMember_status());
params.put("gender", SharedPreferenceManager.getUserObject(getApplicationContext()).getGender());
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
// Test Images Account
*//* params.put("userpath", "su8Gt~DnAz3r4UZAiw5DDQ==");
params.put("member_status", "4");
params.put("gender", "F");
params.put("path", "O70ETBVSOFu4qO9tn^YMeA==");*//*
} catch (JSONException e) {
e.printStackTrace();
}
Log.d("Params", params.toString() + "");
getLifestyle(params);
}
private void setInterestButtonText() {
Members sessionObj = SharedPreferenceManager.getUserObject(getApplicationContext());
Log.e(functions.checkProfileCompleteStatus(member) + "" + member.getMember_status(), "checcccccccccccccccccccc");
if (functions.checkProfileCompleteStatus(sessionObj)) {
*//* if (sessionObj.getMember_status() < 3) {
tvInterest.setText("Show Interest");
llshowInterest.setBackgroundColor(R.color.colorUserProfileTextGreen);
}*//*
Log.e("interested id", member.getInterested_id() + "");
Log.e("interested receieved", member.getInterest_received() + "");
if (member.getInterested_id() == 0) {
tvInterest.setText("Show Interest");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorUserProfileTextGreen));
} else if (member.getInterested_id() != 0) {
if (member.getInterest_received() == 0) {
tvInterest.setText("Withdraw Interest");
tvShowInterestButtonText.setText("Withdraw Interest");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorGrey));
} else if (member.getInterest_received() == 1) {
tvInterest.setText("Reply On Interest");
tvShowInterestButtonText.setText("Reply On Interest");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorDefaultGreen));
} else if (member.getInterest_received() == 3) {
tvInterest.setText("Interest Accepted");
tvShowInterestButtonText.setText("Interest Accepted");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorUserProfileTextGreen));
}
}
*//*else if (member.getInterested_id() == 0 && member.getInterest_received() == 0) {
tvInterest.setText("Withdraw Interest");
llshowInterest.setBackgroundColor(R.color.colorGrey);
} else if (member.getInterested_id() == 0 && member.getInterest_received() == 3) {
tvInterest.setText("Interest Accepted");
llshowInterest.setBackgroundColor(R.color.colorUserProfileTextGreen);
}*//*
} else {
Toast.makeText(this, "copmp profile", Toast.LENGTH_SHORT).show();
//comp profile when click on this
}
}
private int getItem(int i) {
return viewPagerSlider.getCurrentItem() + i;
}
private void loadSlider(String mainPath) {
sliderImagesDataList = new ArrayList<>();
sliderImagesDataList.add(mainPath);
if (responsArray.length() == 5) {
// llPicsNotAvailable.setVisibility(View.GONE);
Gson gson;
GsonBuilder gsonBuilder = new GsonBuilder();
gson = gsonBuilder.create();
Type member = new TypeToken<List<Members>>() {
}.getType();
try {
JSONArray objectsArray = responsArray.getJSONArray(4);
List<Members> membersDataList = (List<Members>) gson.fromJson(objectsArray.toString(), member);
Log.e("Length 56", membersDataList.size() + " ");
for (int i = 0; i < membersDataList.size(); i++) {
sliderImagesDataList.add(membersDataList.get(i).getPhoto_path());
}
myCustomPagerAdapter = new ImageSliderPagerAdapter(UserProfileActivity.this, sliderImagesDataList);
viewPagerSlider.setAdapter(myCustomPagerAdapter);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
private void initialize() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar1);
toolbar.setVisibility(View.GONE);
ProgressBar pBar = (ProgressBar) findViewById(R.id.ProgressBarUserprofile);
pBar.setVisibility(View.GONE);
tabLayout1 = (TabLayout) findViewById(R.id.tabs1);
tabLayout1.setupWithViewPager(viewPager1);
viewPager1 = (ViewPager) findViewById(R.id.viewpager1);
viewPagerSlider = (ViewPager) findViewById(R.id.viewPagerUserProfileSlider);
marryMax = new MarryMax(UserProfileActivity.this);
pDialog = new ProgressDialog(this);
pDialog.setMessage("Loading...");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
faUserDropdown = (faTextView) findViewById(R.id.faTextViewUserDetailDropdown);
faAddToFavourites = (faTextView) findViewById(R.id.faTextViewAddToFavouriteMember);
faInterestIcon = (faTextView) findViewById(R.id.faTextViewUserProfileInterestIcon);
tvImagesCount = (mTextView) findViewById(R.id.TextViewImagesCount);
// iv_profile = (ImageView) findViewById(R.id.ImageViewUPImage);
tvAlias = (mTextView) findViewById(R.id.TextViewUPAlias);
tvAge = (mTextView) findViewById(R.id.TextViewUPAge);
tvLocation = (mTextView) findViewById(R.id.TextViewUPLocation);
tvProfileFor = (mTextView) findViewById(R.id.TextViewUPProfileFor);
tvReligion = (mTextView) findViewById(R.id.TextViewUPReligion);
tvEducation = (mTextView) findViewById(R.id.TextViewUPEducation);
tvOccupation = (mTextView) findViewById(R.id.TextViewUPOccupation);
tvMaritalStatus = (mTextView) findViewById(R.id.TextViewUPMaritalStatus);
tvLastLoginDate = (mTextView) findViewById(R.id.TextViewUPLastLoginDate);
tvMatchAid = (mTextView) findViewById(R.id.TextViewMatchAid);
llshowInterest = (LinearLayout) findViewById(R.id.LinearLayoutShowInterest);
tvShowInterestButtonText = (mTextView) findViewById(R.id.mTextViewLinearLayoutUserProfileShowInterestText);
llBottomSendMessage = (LinearLayout) findViewById(R.id.LinearLayoutUserProfileSendMessage);
llBottomshowInterest = (LinearLayout) findViewById(R.id.LinearLayoutUserProfileShowInterest);
llUPSendMessage = (LinearLayout) findViewById(R.id.LinearLayoutUPSendMessage);
llImagesCount = (LinearLayout) findViewById(R.id.LinearLayoutImagesCount);
tvInterest = (mTextView) findViewById(R.id.TextViewInterestId);
ibSwipeRight = (ImageButton) findViewById(R.id.imageButtonUPArrowRight);
ibSwipeLeft = (ImageButton) findViewById(R.id.imageButtonUPArrowLeft);
ivZodiacSign = (ImageView) findViewById(R.id.ImageViewUPZodiacSign);
ivCountrySign = (ImageView) findViewById(R.id.ImageViewUPCountrySign);
ivPhoneVerified = (ImageView) findViewById(R.id.ImageViewUPPhoneVerified);
imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(getApplicationContext()));
inflater = LayoutInflater.from(getApplicationContext());
options = new DisplayImageOptions.Builder()
// .showImageOnLoading(resize(R.drawable.loading_sm))
// .showImageOnLoading(resize(R.drawable.loading))
// .showImageForEmptyUri(resize(R.drawable.oops_sm))
// .showImageForEmptyUri(resize(R.drawable.no_image))
//.showImageOnFail(resize(R.drawable.oops_sm))
.cacheOnDisk(true)
.considerExifParams(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.postProcessor(new BitmapProcessor() {
@Override
public Bitmap process(Bitmap bmp) {
Bitmap bmp_sticker;
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
int widthScreen = metrics.widthPixels;
int heightScreen = metrics.heightPixels;
if (widthScreen > heightScreen) {
int h = (int) (heightScreen * 0.046);//it set the height of image 10% of your screen
// iv.getLayoutParams().width = (int) (widthScreen * 0.10);
Log.e("wid " + widthScreen + " " + heightScreen, "");
bmp_sticker = resizeImage(bmp, h);
} else {
int h = (int) (heightScreen * 0.027);//it set the height of image 10% of your screen
// iv.getLayoutParams().width = (int) (widthScreen * 0.15);
bmp_sticker = resizeImage(bmp, h);
Log.e("wid " + widthScreen + " " + heightScreen, "");
}
return bmp_sticker;
}
}).build();
userpath = getIntent().getExtras().getString("userpath");
popupUp = new PopupMenu(UserProfileActivity.this, faUserDropdown);
popupUp.getMenuInflater()
.inflate(R.menu.menu_user_profile, popupUp.getMenu());
adapter = new ViewPagerAdapter1(getSupportFragmentManager());
}
private void settHeader() {
// tvAlias,tvDesc,tvLocation,tvProfileFor,tvReligion,tvEducation,tvOccupation,tvMaritalStatus;
tvAlias.setText(member.getAlias());
tvAge.setText("( " + member.getAge() + " Years )");
String location = "";
if (!(member.getCity_name().equals(""))) {
location = member.getCity_name() + ", ";
}
if (!member.getState_name().equals("")) {
location = location + member.getState_name() + ", ";
}
tvLocation.setText(location + member.getCountry_name() + ", (" + member.getVisa_status_types() + ")");
// Log.e("Location", member.getCity_name());
tvProfileFor.setText(member.getProfile_owner());
tvReligion.setText(member.getReligious_sec_type());
tvEducation.setText(member.getEducation_types());
tvOccupation.setText(member.getOccupation_types());
tvMaritalStatus.setText(member.getMarital_status_types());
tvLastLoginDate.setText(member.getLast_login_date());
if (member.getImage_count() > 0) {
llImagesCount.setVisibility(View.VISIBLE);
ibSwipeLeft.setVisibility(View.VISIBLE);
ibSwipeRight.setVisibility(View.VISIBLE);
} else {
llImagesCount.setVisibility(View.GONE);
ibSwipeLeft.setVisibility(View.GONE);
ibSwipeRight.setVisibility(View.GONE);
}
tvImagesCount.setText(Long.toString(member.getImage_count()));
// Log.e("zodaic", "" + member.getSign_name());
// Log.e("country flag", "" + member.getCountry_flag());
imageLoader.displayImage(Urls.baseUrl + "/images/zodiac/" + member.getSign_name() + ".png", ivZodiacSign, options);
imageLoader.displayImage(Urls.baseUrl + "/images/flags/" + member.getCountry_flag() + ".gif", ivCountrySign, options);
if (member.getPhone_verified() == 2) {
if (member.getHide_phone() == 0 || member.getAllow_phone_view() > 0) {
ivPhoneVerified.setImageDrawable(getResources().getDrawable(R.drawable.ic_num_verified_icon_60));
//greeen
} else {
ivPhoneVerified.setImageDrawable(getResources().getDrawable(R.drawable.num_not_verified_icon_60));
// orange
}
} else {
ivPhoneVerified.setImageDrawable(getResources().getDrawable(R.drawable.no_number_icon_60));
//default
}
*//*imageLoader.displayImage(Urls.baseUrl + "/" + member.getDefault_image(),
ivZodiacSign, options,
new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
// holder.progressBar.setVisibility(View.VISIBLE);
// holder.RLprogress1.setVisibility(View.VISIBLE);
}
@Override
public void onLoadingFailed(String imageUri, View view,
FailReason failReason) {
// holder.RLprogress1.setVisibility(View.GONE);
// holder.progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String imageUri,
View view, Bitmap loadedImage) {
// holder.progressBar.setVisibility(View.GONE);
// holder.RLprogress1.setVisibility(View.GONE);
// holder.progressBar.setVisibility(View.GONE);
}
}, new ImageLoadingProgressListener() {
@Override
public void onProgressUpdate(String imageUri,
View view, int current, int total) {
// holder.RLprogress1.setProgress(Math.round(100.0f
// * current / total));
}
});
*//*
if (member.getRemoved_member() == 1) {
MenuItem menuItem = popupUp.getMenu().findItem(R.id.menu_up_remove);
menuItem.setTitle("Unremove");
} else {
MenuItem menuItem = popupUp.getMenu().findItem(R.id.menu_up_remove);
menuItem.setTitle("Remove");
}
*//* if (member.get_is == 1) {
MenuItem menuItem = popupUp.getMenu().findItem(R.id.menu_up_remove);
menuItem.setTitle("Unremove");
} else {
MenuItem menuItem = popupUp.getMenu().findItem(R.id.menu_up_remove);
menuItem.setTitle("Remove");
}*//*
Log.e("Saved Member", member.getSaved_member() + " ");
if (member.getSaved_member() == 1) {
faAddToFavourites.setPressed(true);
}
//MenuItem menuItem1 = popupUp.getMenu().findItem(R.id.menu_up_request);
*//* Log.e("Vall Member", member.getHide_profile() + " " + member.getHide_photo());
if (member.getHide_profile() == 1) {
menuItem1.setTitle("Request Profile View");
}
if (member.getHide_photo() == 1) {
menuItem1.setTitle("Request Photo View");
}*//*
postSetListener();
}
private void postSetListener() {
ivPhoneVerified.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
marryMax.statusBaseChecks(member, getApplicationContext(), 5, getSupportFragmentManager(), null, v, null, null);
*//*if (member.getPhone_request_id() == 0) {
if (member.getPhone_verified() == 2) {
if (member.getHide_phone() == 0 || member.getAllow_phone_view() > 0) {
//greeen
JSONObject params = new JSONObject();
try {
params.put("userpath", member.getUserpath());
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
} catch (JSONException e) {
e.printStackTrace();
}
getMobileInfo(params);
} else {
/// if value available
// member.req
// member.phone_request_id
//if 0 request else withdraw id and call withdraw request
// orange
JSONObject params = new JSONObject();
try {
params.put("checkedTextView", member.getAlias());
params.put("type", "5");
params.put("userpath", member.getUserpath());
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
} catch (JSONException e) {
e.printStackTrace();
}
String desc = "Request <b> <font color=#216917>" + member.getAlias() + "</font></b>" + " for Contact Details";
dialogRequestPhone newFragment = dialogRequestPhone.newInstance(params.toString(), "Request Contact Details", desc);
newFragment.show(getSupportFragmentManager(), "dialog");
}
} else {
//default
String desc = "Contact details of <b> <font color=#216917>" + member.getAlias() + "</font></b>" + " are not available to public.";
dialogRequestPhone newFragment = dialogRequestPhone.newInstance(null, "Notification", desc);
newFragment.show(getSupportFragmentManager(), "dialog");
}
} else {
JSONObject params = new JSONObject();
try {
params.put("userpath", userpath);
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
params.put("interested_id", member.getPhone_request_id());
} catch (JSONException e) {
e.printStackTrace();
}
String desc = "Are you sure to withdraw your request for <b> <font color=#216917>" + member.getAlias() + "</font></b>";
withdrawInterest(params, "Withdraw Contact Details", desc);
}
*//*
}
});
}
private void setListenders() {
llBottomSendMessage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMessage(v);
}
});
llBottomshowInterest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showInterest(v);
}
});
viewPager1.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
lastSelectedPage = position;
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
tvMatchAid.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean bcheck3 = marryMax.statusBaseChecks(member, getApplicationContext(), 7, getSupportFragmentManager(), null, v, null, null);
if (bcheck3) {
matchAid();
}
}
});
faAddToFavourites.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Toast.makeText(UserProfileActivity.this, "Clicked", Toast.LENGTH_SHORT).show();
// Log.e("Saved Member", member.getSaved_member() + " ");
boolean bcheck3 = marryMax.statusBaseChecks(member, getApplicationContext(), 7, getSupportFragmentManager(), null, v, null, null);
if (bcheck3) {
if (member.getSaved_member() == 1) {
JSONObject params = new JSONObject();
try {
params.put("id", "1");
params.put("userpath", userpath);
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
} catch (JSONException e) {
e.printStackTrace();
}
addToFavourites(params);
} else {
JSONObject params = new JSONObject();
try {
params.put("id", "0");
params.put("userpath", userpath);
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
} catch (JSONException e) {
e.printStackTrace();
}
addToFavourites(params);
}
}
}
});
llUPSendMessage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMessage(v);
}
});
llshowInterest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showInterest(v);
}
});
ibSwipeRight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
viewPagerSlider.setCurrentItem(getItem(+1), true);
}
});
ibSwipeLeft.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
viewPagerSlider.setCurrentItem(getItem(-1), true);
}
});
faUserDropdown.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
// addRemoveBlockMenu=popup;
//Inflating the Popup using xml file
//registering popup with OnMenuItemClickListener
popupUp.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
*//* case R.id.menu_up_request:
break;*//*
case R.id.menu_up_block:
boolean bcheck = marryMax.statusBaseChecks(member, getApplicationContext(), 7, getSupportFragmentManager(), null, v, null, null);
if (bcheck) {
blockUser();
}
break;
case R.id.menu_up_remove:
boolean checkStatus = marryMax.statusBaseChecks(member, getApplicationContext(), 3, getSupportFragmentManager(), null, v, null, null);
if (checkStatus) {
JSONObject params = new JSONObject();
try {
params.put("id", member.getRemoved_member());
params.put("userpath", userpath);
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
} catch (JSONException e) {
e.printStackTrace();
}
removeMember(params, item);
}
break;
case R.id.menu_up_report_concern:
boolean bcheck3 = marryMax.statusBaseChecks(member, getApplicationContext(), 7, getSupportFragmentManager(), null, v, null, null);
if (bcheck3) {
reportConcern();
}
break;
}
return true;
}
});
popupUp.show(); //showing popup menu
}
});
}
private void sendMessage(View v) {
marryMax.statusBaseChecks(member, getApplicationContext(), 6, getSupportFragmentManager(), null, v, null, null);
}
private void showInterest(View v) {
JSONObject params = new JSONObject();
try {
params.put("userpath", userpath);
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
*//* params.put("userpath", "jX0GywjuTMhXATJ3f56FIg==");
params.put("path", "G2vOHlGTQOrBjneguNPQuA==");*//*
} catch (JSONException e) {
e.printStackTrace();
}
Members sessionObj = SharedPreferenceManager.getUserObject(getApplicationContext());
Log.e(functions.checkProfileCompleteStatus(member) + "" + member.getMember_status(), "checcccccccccccccccccccc");
boolean checkStatus = marryMax.statusBaseChecks(member, getApplicationContext(), 2, getSupportFragmentManager(), null, v, null, null);
if (checkStatus) {
if (functions.checkProfileCompleteStatus(sessionObj)) {
if (member.getInterested_id() == 0) {
showInterest(params, false);
*//* tvInterest.setText("Show Interest");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorUserProfileTextGreen));*//*
} else if (member.getInterested_id() != 0) {
if (member.getInterest_received() == 0) {
*//* tvInterest.setText("Withdraw Interest");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorGrey));*//*
try {
params.put("interested_id", member.getInterested_id());
} catch (JSONException e) {
e.printStackTrace();
}
String desc = "Are you sure to withdraw your interest for <font color=#216917>" + member.getAlias() + "</font>";
withdrawInterest(params, "Withdraw Interest", desc);
} else if (member.getInterest_received() == 1) {
replyOnInterest(v);
*//*
tvInterest.setText("Reply On Interest");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorDefaultGreen));*//*
} else if (member.getInterest_received() == 3) {
*//* tvInterest.setText("Interest Accepted");
llshowInterest.setBackgroundColor(getResources().getColor(R.color.colorUserProfileTextGreen));*//*
}
}
} else {
Toast.makeText(UserProfileActivity.this, "Please Complete Your Profile", Toast.LENGTH_SHORT).show();
//comp profile when click on this
}
}
}
private void setupViewPager(ViewPager viewPager, String jsonArryaResponse1) {
Log.e("setup viewpager", "setup viewpager" + jsonArryaResponse1);
Bundle args = new Bundle();
args.putString("json", jsonArryaResponse1);
BasicInfoFragment basicInfoFragment = new BasicInfoFragment();
// basicInfoFragment.setTargetFragment(this, 0);
//MessageHistoryFragment messageHistoryFragment = new MessageHistoryFragment();
PicturesFragment picturesFragment = new PicturesFragment();
// picturesFragment.jsonData = jsonArryaResponse1;
userProfileConstants.jsonArryaResponse = jsonArryaResponse1;
basicInfoFragment.setArguments(args);
// messageHistoryFragment.setArguments(args);
// picturesFragment.setArguments(args);
// picturesFragment.jsonData = jsonArryaResponse;
adapter.clearFragments();
adapter.addFragment(basicInfoFragment, "Basic");
///adapter.addFragment(messageHistoryFragment, "Message History");
Bundle picfrg = new Bundle();
picfrg.putBoolean("myprofilecheck", false);
picfrg.putString("json", jsonArryaResponse1);
picturesFragment.setArguments(picfrg);
// picturesFragment.setTargetFragment(this, 0);
adapter.addFragment(picturesFragment, "Pictures");
// viewPager.setAdapter(null);
viewPager.setAdapter(adapter);
tabLayout1.setupWithViewPager(viewPager1);
adapter.notifyDataSetChanged();
for (int i = tabLayout1.getTabCount() - 1; i >= 0; i--) {
TabLayout.Tab tab = tabLayout1.getTabAt(i);
LinearLayout relativeLayout = (LinearLayout)
LayoutInflater.from(UserProfileActivity.this).inflate(R.layout.custom_user_tab_item, tabLayout1, false);
TextView tabTextView = (TextView) relativeLayout.findViewById(R.id.tab_title1);
tabTextView.setText(tab.getText());
if (i == tabLayout1.getTabCount() - 1) {
View view1 = (View) relativeLayout.findViewById(R.id.tab_view_separator1);
view1.setVisibility(View.INVISIBLE);
}
tab.setCustomView(relativeLayout);
tab.select();
}
{
TabLayout.Tab tabs = tabLayout1.getTabAt(lastSelectedPage);
tabs.select();
}
// picturesFragment.loadData(jsonArryaResponse);
}
*//* private void setupViewPager(ViewPager viewPager, String jsonArryaResponse1) {
Bundle args = new Bundle();
args.putString("json", jsonArryaResponse1);
BasicInfoFragment basicInfoFragment = new BasicInfoFragment();
//MessageHistoryFragment messageHistoryFragment = new MessageHistoryFragment();
PicturesFragment picturesFragment = new PicturesFragment();
picturesFragment.jsonData = jsonArryaResponse1;
userProfileConstants.jsonArryaResponse = jsonArryaResponse1;
basicInfoFragment.setArguments(args);
// messageHistoryFragment.setArguments(args);
// picturesFragment.setArguments(args);
// picturesFragment.jsonData = jsonArryaResponse;
adapter.clearFragments();
adapter.addFragment(basicInfoFragment, "Basic");
///adapter.addFragment(messageHistoryFragment, "Message History");
adapter.addFragment(picturesFragment, "Pictures");
Bundle picfrg = new Bundle();
picfrg.putBoolean("myprofilecheck", false);
picturesFragment.setArguments(picfrg);
// viewPager.setAdapter(null);
viewPager.setAdapter(adapter);
tabLayout1.setupWithViewPager(viewPager1);
adapter.notifyDataSetChanged();
for (int i = tabLayout1.getTabCount() - 1; i >= 0; i--) {
TabLayout.Tab tab = tabLayout1.getTabAt(i);
LinearLayout relativeLayout = (LinearLayout)
LayoutInflater.from(this).inflate(R.layout.custom_user_tab_item, tabLayout1, false);
TextView tabTextView = (TextView) relativeLayout.findViewById(R.id.tab_title1);
tabTextView.setText(tab.getText());
if (i == tabLayout1.getTabCount() - 1) {
View view1 = (View) relativeLayout.findViewById(R.id.tab_view_separator1);
view1.setVisibility(View.INVISIBLE);
}
tab.setCustomView(relativeLayout);
tab.select();
}
{
TabLayout.Tab tabs = tabLayout1.getTabAt(lastSelectedPage);
tabs.select();
}
// picturesFragment.loadData(jsonArryaResponse);
}*//*
private void replyOnInterest(View v) {
PopupMenu popup = new PopupMenu(UserProfileActivity.this, v);
//Inflating the Popup using xml file
popup.getMenuInflater()
.inflate(R.menu.menu_yes_no, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_up_yes:
JSONObject params = new JSONObject();
try {
params.put("userpath", userpath);
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
*//* params.put("userpath", "jX0GywjuTMhXATJ3f56FIg==");
params.put("path", "G2vOHlGTQOrBjneguNPQuA==");*//*
} catch (JSONException e) {
e.printStackTrace();
}
replyOnAcceptInterest(params, true);
break;
case R.id.menu_up_no:
dialogDeclineInterest newFragment = dialogDeclineInterest.newInstance(member, userpath);
newFragment.show(getSupportFragmentManager(), "dialog");
break;
}
return true;
}
});
popup.show(); //showing popup menu
}
private void blockUser() {
pDialog.show();
JsonArrayRequest req = new JsonArrayRequest(Urls.getBlockReasonData,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d("Response", response.toString());
try {
JSONArray responseJSONArray = response.getJSONArray(0);
dialogBlock newFragment = dialogBlock.newInstance(responseJSONArray, userpath, member);
newFragment.show(getSupportFragmentManager(), "dialog");
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d("Err", "Error: " + error.getMessage());
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
MySingleton.getInstance(this).addToRequestQueue(req);
}
private void reportConcern() {
pDialog.show();
JsonArrayRequest req = new JsonArrayRequest(Urls.getReportConcernData,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d("Response", response.toString() + " == " + Urls.getReportConcernData);
try {
JSONArray responseJSONArray = response.getJSONArray(0);
dialogReportConcern newFragment = dialogReportConcern.newInstance(responseJSONArray, userpath, member);
newFragment.show(getSupportFragmentManager(), "dialog");
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d("Err", "Error: " + error.getMessage());
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
MySingleton.getInstance(this).addToRequestQueue(req);
}
private void matchAid() {
pDialog.show();
Log.e("url", Urls.getAssistance + SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
JsonArrayRequest req = new JsonArrayRequest(Urls.getAssistance + SharedPreferenceManager.getUserObject(getApplicationContext()).getPath(),
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.e("Response", response.toString() + " == ");
try {
int res = response.getJSONArray(1).getJSONObject(0).getInt("id");
Log.e("ressss", "" + res + "");
if (res == 0) {
dialogMatchAid newFragment = dialogMatchAid.newInstance(response, userpath, SharedPreferenceManager.getUserObject(getApplicationContext()).getMember_status());
newFragment.show(getSupportFragmentManager(), "dialog");
} else {
dialogMatchAidUnderProcess newFragment = dialogMatchAidUnderProcess.newInstance(response, userpath);
newFragment.show(getSupportFragmentManager(), "dialog");
}
} catch (JSONException e) {
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d("Err", "Error: " + error.getMessage());
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
MySingleton.getInstance(this).addToRequestQueue(req);
}
private void withdrawInterest(JSONObject params, String title, String desc) {
dialogWithdrawInterest newFragment = dialogWithdrawInterest.newInstance(params, title, desc);
newFragment.show(getSupportFragmentManager(), "dialog");
}
private void replyOnAcceptInterest(JSONObject params, final boolean replyCheck) {
pDialog.show();
Log.e("params", params.toString());
Log.e("profile path", Urls.interestProvisions);
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.PUT,
Urls.interestProvisions, params,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("Res interest ", response + "");
try {
JSONObject responseObject = response.getJSONArray("data").getJSONArray(0).getJSONObject(0);
Gson gson;
GsonBuilder gsonBuilder = new GsonBuilder();
gson = gsonBuilder.create();
Type type = new TypeToken<Members>() {
}.getType();
Members member2 = (Members) gson.fromJson(responseObject.toString(), type);
Log.e("interested id", "" + member.getAlias() + "====================");
dialogReplyOnAcceptInterest newFragment = dialogReplyOnAcceptInterest.newInstance(member, userpath, replyCheck, member2);
newFragment.show(getSupportFragmentManager(), "dialog");
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("res err", "Error: " + error);
// Toast.makeText(RegistrationActivity.this, "Incorrect Email or Password !", Toast.LENGTH_SHORT).show();
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
// Adding request to request queue
/// rq.add(jsonObjReq);
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MySingleton.getInstance(this).addToRequestQueue(jsonObjReq);
}
private void showInterest(JSONObject params, final boolean replyCheck) {
pDialog.show();
Log.e("params", params.toString());
Log.e("profile path", Urls.interestProvisions);
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.PUT,
Urls.interestProvisions, params,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("Res interest ", response + "");
try {
JSONObject responseObject = response.getJSONArray("data").getJSONArray(0).getJSONObject(0);
Gson gson;
GsonBuilder gsonBuilder = new GsonBuilder();
gson = gsonBuilder.create();
Type type = new TypeToken<Members>() {
}.getType();
Members member2 = (Members) gson.fromJson(responseObject.toString(), type);
Log.e("interested id", "" + member.getAlias() + "====================");
dialogShowInterest newFragment = dialogShowInterest.newInstance(member, userpath, replyCheck, member2);
newFragment.show(getSupportFragmentManager(), "dialog");
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("res err", "Error: " + error);
// Toast.makeText(RegistrationActivity.this, "Incorrect Email or Password !", Toast.LENGTH_SHORT).show();
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
// Adding request to request queue
/// rq.add(jsonObjReq);
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MySingleton.getInstance(this).addToRequestQueue(jsonObjReq);
}
private void removeMember(JSONObject params, final MenuItem menuItem) {
pDialog.show();
Log.e("params", params.toString());
// Log.e("profile path", Urls.interestProvisions);
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.PUT,
Urls.removeMember, params,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("Res ", response + "");
try {
int responseid = response.getInt("id");
if (responseid == 1) {
member.setRemoved_member(responseid);
Toast.makeText(UserProfileActivity.this, "User has been Removed successfully ", Toast.LENGTH_SHORT).show();
*//* MenuItem menuItem = addRemoveBlockMenu.getMenu().findItem(R.id.menu_up_remove);
*//*
menuItem.setTitle("Unremove");
} else {
member.setRemoved_member(responseid);
Toast.makeText(UserProfileActivity.this, "User has been unremoved successfully ", Toast.LENGTH_SHORT).show();
*//* MenuItem menuItem = addRemoveBlockMenu.getMenu().findItem(R.id.menu_up_remove);
*//*
menuItem.setTitle("Remove");
}
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("res err", "Error: " + error);
// Toast.makeText(RegistrationActivity.this, "Incorrect Email or Password !", Toast.LENGTH_SHORT).show();
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
// Adding request to request queue
/// rq.add(jsonObjReq);
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MySingleton.getInstance(this).addToRequestQueue(jsonObjReq);
}
private void addToFavourites(JSONObject params) {
pDialog.show();
Log.e("params", params.toString());
// Log.e("profile path", Urls.interestProvisions);
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.PUT,
Urls.addRemoveFavorites, params,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("Res ", response + "");
try {
int responseid = response.getInt("id");
if (responseid == 1) {
faAddToFavourites.setPressed(true);
Toast.makeText(UserProfileActivity.this, "Favourite Updated successfully ", Toast.LENGTH_SHORT).show();
} else {
faAddToFavourites.setPressed(false);
}
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("res err", "Error: " + error);
// Toast.makeText(RegistrationActivity.this, "Incorrect Email or Password !", Toast.LENGTH_SHORT).show();
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
// Adding request to request queue
/// rq.add(jsonObjReq);
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MySingleton.getInstance(this).addToRequestQueue(jsonObjReq);
}
private void getLifestyle(JSONObject params) {
pDialog.show();
Log.e("params", params.toString());
Log.e("profile path", Urls.getProfileDetail);
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.PUT,
Urls.getProfileDetail, params,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("re update lifestyle", response + "");
try {
responsArray = response.getJSONArray("jdata");
JSONObject firstJsonObj = responsArray.getJSONArray(0).getJSONObject(0);
Gson gson;
GsonBuilder gsonBuilder = new GsonBuilder();
gson = gsonBuilder.create();
Type type = new TypeToken<Members>() {
}.getType();
member = (Members) gson.fromJson(firstJsonObj.toString(), type);
getSupportActionBar().setTitle(member.getAlias());
if (SharedPreferenceManager.getUserObject(getApplicationContext()).getPath() != null && member.getPath() != null) {
Log.e("=========path ========", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath() + "======" + member.getUserpath());
if (SharedPreferenceManager.getUserObject(getApplicationContext()).getPath().equals((member.getUserpath()))) {
LineaLayoutUserProfileInterestMessage = (LinearLayout) findViewById(R.id.LineaLayoutUserProfileInterestMessage);
LineaLayoutUserProfileTopBar = (LinearLayout) findViewById(R.id.LineaLayoutUserProfileTopBar);
LineaLayoutUserProfileInterestMessage.setVisibility(View.GONE);
LineaLayoutUserProfileTopBar.setVisibility(View.GONE);
}
}
setInterestButtonText();
settHeader();
loadSlider(member.getDefault_image());
setupViewPager(viewPager1, responsArray.toString());
// Log.e("Member checkedTextView", "" + member.getAlias());
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("res err", "Error: " + error);
// Toast.makeText(RegistrationActivity.this, "Incorrect Email or Password !", Toast.LENGTH_SHORT).show();
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
// Adding request to request queue
/// rq.add(jsonObjReq);
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MySingleton.getInstance(this).addToRequestQueue(jsonObjReq);
}
@Override
public void onComplete(String s) {
JSONObject params = new JSONObject();
try {
params.put("userpath", userpath);
params.put("member_status", SharedPreferenceManager.getUserObject(getApplicationContext()).getMember_notes_id());
params.put("gender", SharedPreferenceManager.getUserObject(getApplicationContext()).getGender());
params.put("path", SharedPreferenceManager.getUserObject(getApplicationContext()).getPath());
} catch (JSONException e) {
e.printStackTrace();
}
Log.d("Params", params.toString() + "");
getLifestyle(params);
}
*//* private void getMobileInfo(JSONObject params) {
pDialog.show();
Log.e("params mobile", params.toString());
Log.e("mobile U RL ", Urls.mobileInfo);
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.PUT,
Urls.mobileInfo, params,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("Res ", response + "");
try {
JSONObject responseObject = response.getJSONArray("data").getJSONArray(0).getJSONObject(0);
///Log.e("interested id", "" + member.getAlias() + "====================");
dialogContactDetails newFragment = dialogContactDetails.newInstance(responseObject.toString(), member.getAlias());
newFragment.show(getSupportFragmentManager(), "dialog");
} catch (JSONException e) {
pDialog.dismiss();
e.printStackTrace();
}
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("res err", "Error: " + error);
// Toast.makeText(RegistrationActivity.this, "Incorrect Email or Password !", Toast.LENGTH_SHORT).show();
pDialog.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return Constants.getHashMap();
}
};
// Adding request to request queue
/// rq.add(jsonObjReq);
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MySingleton.getInstance(this).addToRequestQueue(jsonObjReq);
}*//*
private Bitmap resizeImage(final Bitmap image, int maxHeight) {
Bitmap resizedImage = null;
if (image != null) {
// int maxHeight = 80; //actual image height coming from internet
int maxWidth = 300; //actual image width coming from internet
int imageHeight = image.getHeight();
if (imageHeight > maxHeight)
imageHeight = maxHeight;
int imageWidth = (imageHeight * image.getWidth()) / image.getHeight();
if (imageWidth > maxWidth) {
imageWidth = maxWidth;
imageHeight = (imageWidth * image.getHeight()) / image.getWidth();
}
resizedImage = Bitmap.createScaledBitmap(image, imageWidth, imageHeight, true);
}
return resizedImage;
}
@Override
public void onDestroy() {
super.onDestroy();
if (pDialog != null && pDialog.isShowing()) {
pDialog.cancel();
}
}
@Override
protected void onPause() {
super.onPause();
if (pDialog != null && pDialog.isShowing()) {
pDialog.cancel();
}
}
@Override
public void onComplete(int s) {
}
@Override
public void onCompleteReportConcern(String s) {
finish();
}
@Override
public void onBlockComplete(String s) {
finish();
}
class ViewPagerAdapter1 extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public ViewPagerAdapter1(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
public void clearFragments() {
mFragmentList.clear();
mFragmentTitleList.clear();
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
}
*/ | [
"zeeshan.ahmad@chicsol.com"
] | zeeshan.ahmad@chicsol.com |
60f4f94652130c3ccf499f16b6de2cb470cfb770 | d3172b7d20722394e1416084a5b8aa047d756b12 | /designPatterns/src/templateMethod/duck/DuckSortTestDrive.java | 5b75caf7a2a79d4ff0e3775b5a4b20cfa6b63d07 | [] | no_license | exit5710/application | 5dda55793445ab851a49569aecda4af95d0da1a1 | 34cc5d030f85d2ee5cc8946a7b43613da3c14658 | refs/heads/master | 2023-08-16T14:29:32.605057 | 2023-07-21T18:10:58 | 2023-07-21T18:10:58 | 300,112,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package templateMethod.duck;
import java.util.Arrays;
public class DuckSortTestDrive {
public static void main(String[] args) {
Duck[] ducks = {new Duck("Daffy", 8), new Duck("Dewey", 2), new Duck("Howard", 7),
new Duck("Louie", 2), new Duck("Donald", 10), new Duck("Huey", 2)};
System.out.println("Before sorting : ");
display(ducks);
Arrays.sort(ducks);
System.out.println("\nAfter sorting : ");
display(ducks);
}
private static void display(Duck[] ducks) {
for (Duck duck : ducks) {
System.out.println(duck);
}
}
} | [
"exit5710@gmail.com"
] | exit5710@gmail.com |
cd4906fc0a2488ca942e0969f48b3feb79b8fc6f | 148100c6a5ac58980e43aeb0ef41b00d76dfb5b3 | /sources/com/google/android/gms/internal/ads/zzasr.java | d9d107aa702365c4da703f082c01e8580da51dae | [] | no_license | niravrathod/car_details | f979de0b857f93efe079cd8d7567f2134755802d | 398897c050436f13b7160050f375ec1f4e05cdf8 | refs/heads/master | 2020-04-13T16:36:29.854057 | 2018-12-27T19:03:46 | 2018-12-27T19:03:46 | 163,325,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,683 | java | package com.google.android.gms.internal.ads;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Build.VERSION;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.TextView;
import com.google.android.gms.ads.impl.C2397R;
import com.google.android.gms.ads.internal.gmsg.zzu;
import com.google.android.gms.ads.internal.overlay.zzc;
import com.google.android.gms.ads.internal.overlay.zzd;
import com.google.android.gms.ads.internal.zzbv;
import com.google.android.gms.ads.internal.zzv;
import com.google.android.gms.common.util.Predicate;
import com.google.android.gms.dynamic.IObjectWrapper;
import java.util.Map;
import org.json.JSONObject;
@zzaer
public final class zzasr extends FrameLayout implements zzasg {
/* renamed from: a */
private final zzasg f21360a;
/* renamed from: b */
private final zzaqx f21361b;
public zzasr(zzasg zzasg) {
super(zzasg.getContext());
this.f21360a = zzasg;
this.f21361b = new zzaqx(zzasg.mo4774p(), this, this);
addView(this.f21360a.getView());
}
public final View getView() {
return this;
}
/* renamed from: a */
public final zzaqx mo4731a() {
return this.f21361b;
}
public final void onPause() {
this.f21361b.m10062b();
this.f21360a.onPause();
}
/* renamed from: B */
public final void mo4722B() {
this.f21361b.m10063c();
this.f21360a.mo4722B();
}
/* renamed from: I */
public final void mo4729I() {
setBackgroundColor(0);
this.f21360a.setBackgroundColor(0);
}
/* renamed from: j */
public final int mo4763j() {
return getMeasuredHeight();
}
/* renamed from: k */
public final int mo4764k() {
return getMeasuredWidth();
}
/* renamed from: l */
public final void mo4765l() {
this.f21360a.mo4765l();
}
public final WebView getWebView() {
return this.f21360a.getWebView();
}
/* renamed from: a */
public final void mo4743a(String str, Map<String, ?> map) {
this.f21360a.mo4743a(str, (Map) map);
}
/* renamed from: a */
public final void mo2748a(String str, JSONObject jSONObject) {
this.f21360a.mo2748a(str, jSONObject);
}
/* renamed from: a */
public final void mo4740a(String str, zzu<? super zzasg> zzu) {
this.f21360a.mo4740a(str, (zzu) zzu);
}
/* renamed from: b */
public final void mo4749b(String str, zzu<? super zzasg> zzu) {
this.f21360a.mo4749b(str, zzu);
}
/* renamed from: a */
public final void mo4741a(String str, Predicate<zzu<? super zzasg>> predicate) {
this.f21360a.mo4741a(str, (Predicate) predicate);
}
/* renamed from: m */
public final void mo4769m() {
this.f21360a.mo4769m();
}
/* renamed from: a */
public final void mo4732a(int i) {
this.f21360a.mo4732a(i);
}
/* renamed from: n */
public final void mo4770n() {
this.f21360a.mo4770n();
}
/* renamed from: o */
public final void mo4771o() {
this.f21360a.mo4771o();
}
/* renamed from: b */
public final void mo2749b(String str) {
this.f21360a.mo2749b(str);
}
/* renamed from: b */
public final void mo4750b(String str, JSONObject jSONObject) {
this.f21360a.mo4750b(str, jSONObject);
}
/* renamed from: d */
public final Activity mo4199d() {
return this.f21360a.mo4199d();
}
/* renamed from: p */
public final Context mo4774p() {
return this.f21360a.mo4774p();
}
/* renamed from: e */
public final zzv mo4200e() {
return this.f21360a.mo4200e();
}
/* renamed from: q */
public final zzd mo4775q() {
return this.f21360a.mo4775q();
}
/* renamed from: y */
public final IObjectWrapper mo4785y() {
return this.f21360a.mo4785y();
}
/* renamed from: r */
public final zzd mo4776r() {
return this.f21360a.mo4776r();
}
/* renamed from: s */
public final zzatt mo4205s() {
return this.f21360a.mo4205s();
}
/* renamed from: t */
public final String mo4781t() {
return this.f21360a.mo4781t();
}
/* renamed from: u */
public final zzatn mo4782u() {
return this.f21360a.mo4782u();
}
/* renamed from: v */
public final WebViewClient mo4783v() {
return this.f21360a.mo4783v();
}
/* renamed from: w */
public final boolean mo4784w() {
return this.f21360a.mo4784w();
}
/* renamed from: x */
public final zzck mo4207x() {
return this.f21360a.mo4207x();
}
/* renamed from: i */
public final zzaop mo4204i() {
return this.f21360a.mo4204i();
}
/* renamed from: z */
public final boolean mo4208z() {
return this.f21360a.mo4208z();
}
public final int getRequestedOrientation() {
return this.f21360a.getRequestedOrientation();
}
/* renamed from: A */
public final boolean mo4721A() {
return this.f21360a.mo4721A();
}
/* renamed from: C */
public final boolean mo4723C() {
return this.f21360a.mo4723C();
}
/* renamed from: D */
public final boolean mo4724D() {
return this.f21360a.mo4724D();
}
public final void zzcl() {
this.f21360a.zzcl();
}
public final void zzck() {
this.f21360a.zzck();
}
/* renamed from: g */
public final String mo4759g() {
return this.f21360a.mo4759g();
}
/* renamed from: c */
public final zzoh mo4752c() {
return this.f21360a.mo4752c();
}
/* renamed from: h */
public final zzoi mo4203h() {
return this.f21360a.mo4203h();
}
/* renamed from: b */
public final zzasw mo4198b() {
return this.f21360a.mo4198b();
}
/* renamed from: a */
public final void mo4735a(zzd zzd) {
this.f21360a.mo4735a(zzd);
}
/* renamed from: a */
public final void mo4736a(IObjectWrapper iObjectWrapper) {
this.f21360a.mo4736a(iObjectWrapper);
}
/* renamed from: a */
public final void mo4737a(zzatt zzatt) {
this.f21360a.mo4737a(zzatt);
}
/* renamed from: b */
public final void mo4751b(boolean z) {
this.f21360a.mo4751b(z);
}
/* renamed from: F */
public final void mo4726F() {
this.f21360a.mo4726F();
}
/* renamed from: a */
public final void mo4733a(Context context) {
this.f21360a.mo4733a(context);
}
/* renamed from: c */
public final void mo4753c(boolean z) {
this.f21360a.mo4753c(z);
}
public final void setRequestedOrientation(int i) {
this.f21360a.setRequestedOrientation(i);
}
/* renamed from: b */
public final void mo4748b(zzd zzd) {
this.f21360a.mo4748b(zzd);
}
/* renamed from: d */
public final void mo4754d(boolean z) {
this.f21360a.mo4754d(z);
}
/* renamed from: a */
public final void mo4739a(String str) {
this.f21360a.mo4739a(str);
}
/* renamed from: G */
public final void mo4727G() {
this.f21360a.mo4727G();
}
public final void destroy() {
IObjectWrapper y = mo4785y();
if (y != null) {
zzbv.zzfb().m9456b(y);
zzalo.f8872a.postDelayed(new gv(this), (long) ((Integer) zzkd.m10713e().m10897a(zznw.cz)).intValue());
return;
}
this.f21360a.destroy();
}
public final void loadData(String str, String str2, String str3) {
this.f21360a.loadData(str, str2, str3);
}
public final void loadDataWithBaseURL(String str, String str2, String str3, String str4, String str5) {
this.f21360a.loadDataWithBaseURL(str, str2, str3, str4, str5);
}
public final void loadUrl(String str) {
this.f21360a.loadUrl(str);
}
/* renamed from: a */
public final void mo4742a(String str, String str2, String str3) {
this.f21360a.mo4742a(str, str2, str3);
}
public final void setOnClickListener(OnClickListener onClickListener) {
this.f21360a.setOnClickListener(onClickListener);
}
public final void setOnTouchListener(OnTouchListener onTouchListener) {
this.f21360a.setOnTouchListener(onTouchListener);
}
public final void setWebChromeClient(WebChromeClient webChromeClient) {
this.f21360a.setWebChromeClient(webChromeClient);
}
public final void setWebViewClient(WebViewClient webViewClient) {
this.f21360a.setWebViewClient(webViewClient);
}
public final void stopLoading() {
this.f21360a.stopLoading();
}
public final void onResume() {
this.f21360a.onResume();
}
/* renamed from: J */
public final void mo4730J() {
View textView = new TextView(getContext());
Resources g = zzbv.zzeo().m9722g();
textView.setText(g != null ? g.getString(C2397R.string.s7) : "Test Ad");
textView.setTextSize(15.0f);
textView.setTextColor(-1);
textView.setPadding(5, 0, 5, 0);
Drawable gradientDrawable = new GradientDrawable();
gradientDrawable.setShape(0);
gradientDrawable.setColor(-12303292);
gradientDrawable.setCornerRadius(8.0f);
if (VERSION.SDK_INT >= 16) {
textView.setBackground(gradientDrawable);
} else {
textView.setBackgroundDrawable(gradientDrawable);
}
addView(textView, new LayoutParams(-2, -2, 49));
bringChildToFront(textView);
}
/* renamed from: f */
public final void mo4758f(boolean z) {
this.f21360a.mo4758f(z);
}
/* renamed from: a */
public final void mo2329a(zzfv zzfv) {
this.f21360a.mo2329a(zzfv);
}
public final OnClickListener getOnClickListener() {
return this.f21360a.getOnClickListener();
}
/* renamed from: a */
public final void mo4738a(zzpk zzpk) {
this.f21360a.mo4738a(zzpk);
}
/* renamed from: H */
public final zzpk mo4728H() {
return this.f21360a.mo4728H();
}
/* renamed from: a */
public final void mo4197a(zzasw zzasw) {
this.f21360a.mo4197a(zzasw);
}
/* renamed from: E */
public final boolean mo4725E() {
return this.f21360a.mo4725E();
}
/* renamed from: e */
public final void mo4756e(boolean z) {
this.f21360a.mo4756e(z);
}
/* renamed from: a */
public final void mo4744a(boolean z) {
this.f21360a.mo4744a(z);
}
/* renamed from: f */
public final void mo4757f() {
this.f21360a.mo4757f();
}
/* renamed from: a */
public final void mo4734a(zzc zzc) {
this.f21360a.mo4734a(zzc);
}
/* renamed from: a */
public final void mo4745a(boolean z, int i) {
this.f21360a.mo4745a(z, i);
}
/* renamed from: a */
public final void mo4746a(boolean z, int i, String str) {
this.f21360a.mo4746a(z, i, str);
}
/* renamed from: a */
public final void mo4747a(boolean z, int i, String str, String str2) {
this.f21360a.mo4747a(z, i, str, str2);
}
}
| [
"niravrathod473@gmail.com"
] | niravrathod473@gmail.com |
19c29213edd4b08f96f90f969a5bef9e404c7198 | 20ff198ed4d31f96bc72c471b5fd45418c82beac | /src/main/java/logic/usercode/tasks/IfTask.java | 8fd932f8eff4d0a13ce0d0d3db231d429cf1fd05 | [] | no_license | Exprescode/Farmio | 887075292928f738624bbbf36c189c47b5962f25 | b6e5e7823b8866465b65f146bbfaa677cdd8dad4 | refs/heads/master | 2020-09-25T15:05:03.263826 | 2019-12-05T06:35:42 | 2019-12-05T06:35:42 | 226,030,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package logic.usercode.tasks;
import farmio.exceptions.FarmioFatalException;
import farmio.Farmio;
import farmio.exceptions.FarmioException;
import logic.usercode.actions.Action;
import logic.usercode.conditions.Condition;
public class IfTask extends Task {
/**
* Creates a task of type if.
* @param condition The condition to be considered.
* @param action The action to be executed if the condition is true.
*/
public IfTask(Condition condition, Action action) {
super(Tasktype.IF, condition, action);
}
@Override
public void execute(Farmio farmio) throws FarmioException, FarmioFatalException {
{
if (condition.check(farmio)) {
action.execute(farmio.getFrontend(), farmio.getStorage(), farmio.getFarmer());
} else {
farmio.getFrontend().simulate();
farmio.getFrontend().show("Condition not fulfilled, not executing task!");
farmio.getFrontend().sleep(1000);
}
}
}
@Override
public String toString() {
return "if " + super.toString();
}
} | [
"jinghui.yew@gmail.com"
] | jinghui.yew@gmail.com |
c9afb913dad17c0739dd6262ace16657f64e8444 | b48c1c2b60399e2df7b2cc5af9891104273e5dbe | /jdkProxy/src/jkdProxy/proxy/ProxyImpl.java | 40622ea01c38754981954a01bdf28805dac040e7 | [] | no_license | kaiwen546/ioc-jdkProxy | 8e145d4f349366a9563f128a16c478e6861756f9 | 4a804a62df0a90499649003ea497bcfdf166e659 | refs/heads/master | 2020-04-19T08:30:32.267016 | 2019-01-29T07:49:52 | 2019-01-29T07:49:52 | 167,132,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package jkdProxy.proxy;
import jkdProxy.dao.CommonDao;
/**
* Created by Kevin on 2019/1/22
* 聚合
*/
public class ProxyImpl implements CommonDao {
public CommonDao target;
public ProxyImpl(CommonDao target) {
this.target = target;
}
public void query() {
System.out.println("---------log--------");
target.query();
}
@Override
public void query(String string) {
System.out.println("---------log--------");
target.query(string);
}
}
| [
"xiaofei.ma@ucarinc.com"
] | xiaofei.ma@ucarinc.com |
f6525980a66263c1d6150ae7151d110cb8e83c94 | 4e440348e434be7d47f9ce4f872681aa93b38d6b | /src/test/java/com/vytrack/utilities/Driver.java | 852fa54c04f4e95df693c20ce7e716ff13eb4bfa | [] | no_license | HCRPC/CucumberSelenium | 9f288cd6417fe9f9721af5da94ef079fed8d5ba7 | be7d9f9013d81e03d9ac6d50976b5bd08cbf1d34 | refs/heads/master | 2023-07-26T17:57:38.544368 | 2021-08-25T05:56:13 | 2021-08-25T05:56:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,908 | java | package com.vytrack.utilities;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.safari.SafariDriver;
public class Driver {
private Driver() {
}
private static WebDriver driver;
public static WebDriver get() {
// Test
if (driver == null) {
// this line will tell which browser should open based on the value from properties file
String browser = ConfigurationReader.get("browser");
switch (browser) {
case "chrome":
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
break;
case "chrome-headless":
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver(new ChromeOptions().setHeadless(true));
break;
case "firefox":
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
break;
case "firefox-headless":
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver(new FirefoxOptions().setHeadless(true));
break;
case "ie":
if (!System.getProperty("os.name").toLowerCase().contains("windows"))
throw new WebDriverException("Your OS doesn't support Internet Explorer");
WebDriverManager.iedriver().setup();
driver = new InternetExplorerDriver();
break;
case "edge":
if (!System.getProperty("os.name").toLowerCase().contains("windows"))
throw new WebDriverException("Your OS doesn't support Edge");
WebDriverManager.edgedriver().setup();
driver = new EdgeDriver();
break;
case "safari":
if (!System.getProperty("os.name").toLowerCase().contains("mac"))
throw new WebDriverException("Your OS doesn't support Safari");
WebDriverManager.getInstance(SafariDriver.class).setup();
driver = new SafariDriver();
break;
}
}
return driver;
}
public static void closeDriver() {
if (driver != null) {
driver.quit();
driver = null;
}
}
}
| [
"haciarpaci12@gmail.com"
] | haciarpaci12@gmail.com |
3c9058d41bacd5d81aeeaec9b6cd6362fa837c40 | 6b8e554436a8c7a765c6e73df3a4f7dcc7d0741d | /KIV-UPG/UPG - SP/src/upg/Projectiles.java | c103bfa7685c98c040b3c2397e3618c7a1a2651b | [] | no_license | Hartrik/ZCU-FAV | 543fc617c9015969a7af171853514a2485a83113 | 4f234c334fff66d77ebac4f6acc18afc94666277 | refs/heads/master | 2022-04-28T18:18:30.836076 | 2022-04-17T17:51:16 | 2022-04-17T17:51:16 | 63,448,700 | 1 | 0 | null | 2021-02-26T22:11:54 | 2016-07-15T20:18:23 | PHP | UTF-8 | Java | false | false | 842 | java | package upg;
/**
* Definuje nějaké projektily.
*
* @version 2016-05-04
* @author Patrik Harag
*/
public final class Projectiles {
private Projectiles() { }
public static final Projectile NORMAL = new Projectile(3, new int[][] {
{ 0, 0, 0, -1, 0, 0, 0},
{ 0, 0, -1, -4, -1, 0, 0},
{ 0, -1, -4, -8, -4, -1, 0},
{ -1, -4, -8, -10, -8, -4, -1},
{ 0, -1, -4, -8, -4, -1, 0},
{ 0, 0, -1, -4, -1, 0, 0},
{ 0, 0, 0, -1, 0, 0, 0},
});
public static final Projectile SMALL = new Projectile(2, new int[][] {
{ 0, 0, -1, 0, 0},
{ 0, -1, -3, -1, 0},
{ -1, -3, -8, -3, -1},
{ 0, -1, -3, -1, 0},
{ 0, 0, -1, 0, 0},
});
} | [
"patrikharag@gmail.com"
] | patrikharag@gmail.com |
1be6dad6c4e70bf9ac1988aa0b8b05aa27db96c9 | 7984a52b60859e1e93cc07b41d1457e20bbed6b3 | /Naib_ReedExhibitions_Back_CRM/src/main/java/com/naib/sinapsist/api/app/models/service/IEmailContactoService.java | 783bc553c8953195bef35ad1567775278b9a1fb4 | [] | no_license | CarlitosLeon/NaibBackInterno | e37654fbca9f9b0f5c59ec8d73478ae00c9b2812 | 971d1af811c4c29e750b53a09310d9ee78dddd89 | refs/heads/master | 2023-05-30T09:55:27.770113 | 2021-06-10T22:41:52 | 2021-06-10T22:41:52 | 375,846,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package com.naib.sinapsist.api.app.models.service;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import com.naib.sinapsist.api.app.models.entity.ArchivoContacto;
import com.naib.sinapsist.api.app.models.entity.EmailContacto;
import com.naib.sinapsist.api.app.models.entity.FirmaEmail;
public interface IEmailContactoService {
public List<EmailContacto> findAll();
public List<EmailContacto> getemailContacto(int ideCon);
public List<ArchivoContacto> getFiles(int idEC);
public List<EmailContacto> getfirmaFile(int idE);
public EmailContacto save(EmailContacto emailContacto);
public EmailContacto findById(int idEc);
public void deleteById(int idE);
}
| [
"2517360000clinaresl@gmail.com"
] | 2517360000clinaresl@gmail.com |
627a021333ff5d14b3ca0e7397ae27c80860ef54 | a2592ec59d6f54f4ebd64033dee96daa46c9acc6 | /Abstracts/src/Bird.java | a90c2bd942547206c55501dc3a7a5bc0d7cbbb41 | [] | no_license | rahulsahay19/Java-Fundamentals | b988a51f46b3e30f1408c398f8d3ff7d8ac2c278 | 8764086e1974e0e8f8d5819e75548955b108ddd3 | refs/heads/master | 2023-07-01T01:42:44.691819 | 2021-08-02T18:09:22 | 2021-08-02T18:09:22 | 382,923,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | public abstract class Bird extends Animal implements ICanFly{
public Bird(String name) {
super(name);
}
@Override
public void eat() {
System.out.println(getName() + " is pecking");
}
@Override
public void breathe() {
System.out.println(getName() + " is breathing");
}
@Override
public void fly() {
System.out.println(getName() + " is flapping");
}
}
| [
"rahulsahay19@hotmail.com"
] | rahulsahay19@hotmail.com |
ef58fc67aab1bfc112ab021cb4d0fb7451df6ef3 | 21c2fa219f9abd5a3f94aa416d8639c16d8aff95 | /coteafs-appium-master/src/main/java/com/github/wasiqb/coteafs/appium/android/system/AlertActivity.java | 573f40c3f8046f4c8c14206f9874bd7cb8ddebeb | [
"Apache-2.0"
] | permissive | ranjithsanda/AppiumProject | 9ee3613b9e762c9d7e2d5ccc45d315d990141772 | 97f27584f1f2871fff26411ed3987757cad6b9b3 | refs/heads/master | 2020-04-07T19:09:37.577100 | 2018-11-22T03:46:44 | 2018-11-22T03:46:44 | 158,638,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,730 | java | /**
* Copyright (c) 2017, Wasiq Bhamla.
*
* 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.github.wasiqb.coteafs.appium.android.system;
import org.openqa.selenium.By;
import com.github.wasiqb.coteafs.appium.android.AndroidActivity;
import com.github.wasiqb.coteafs.appium.android.AndroidDevice;
import com.github.wasiqb.coteafs.appium.device.DeviceElement;
/**
* @author wasiq.bhamla
* @since Feb 8, 2018 3:44:36 PM
*/
public class AlertActivity extends AndroidActivity {
/**
* @author wasiq.bhamla
* @since Feb 8, 2018 3:44:36 PM
* @param device
*/
public AlertActivity (final AndroidDevice device) {
super (device);
}
/*
* (non-Javadoc)
* @see com.github.wasiqb.coteafs.appium.device.DeviceActivity#prepare()
*/
@Override
protected DeviceElement prepare () {
final DeviceElement alert = DeviceElement.create ("Alert")
.using (By.id ("android:id/parentPanel"));
DeviceElement.create ("Title")
.parent (alert)
.using (By.id ("android:id/alertTitle"));
DeviceElement.create ("Message")
.parent (alert)
.using (By.id ("android:id/message"));
DeviceElement.create ("OK")
.parent (alert)
.using (By.id ("android:id/button1"));
return alert;
}
} | [
"ranjit.sanda@happiestminds.com"
] | ranjit.sanda@happiestminds.com |
56863814d9d68e3cb135d35ddadafaf07da88dbe | fd1f0d95c082cf86dc845b8b3e39b063a3c7df77 | /azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/gradle/functions/bindings/QueueBinding.java | bdc2cdfee57e0c9d4be29b2ebabb698b0c2416a7 | [
"MIT"
] | permissive | rvanderwerf/azure-gradle-plugins | da06a26a1abb281df4163305ac83fb476dcef933 | 960ae838b898cef24a5166f9858338834ea68c8f | refs/heads/master | 2020-04-08T00:37:38.361021 | 2018-10-02T19:48:37 | 2018-10-02T19:48:37 | 158,859,372 | 0 | 0 | MIT | 2018-11-23T17:07:11 | 2018-11-23T17:07:10 | null | UTF-8 | Java | false | false | 1,279 | java | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.gradle.functions.bindings;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.microsoft.azure.functions.annotation.QueueOutput;
import com.microsoft.azure.functions.annotation.QueueTrigger;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class QueueBinding extends StorageBaseBinding {
public static final String QUEUE_TRIGGER = "queueTrigger";
public static final String QUEUE = "queue";
private String queueName = "";
public QueueBinding(final QueueTrigger queueTrigger) {
super(queueTrigger.name(), QUEUE_TRIGGER, Direction.IN, queueTrigger.dataType());
queueName = queueTrigger.queueName();
setConnection(queueTrigger.connection());
}
public QueueBinding(final QueueOutput queueOutput) {
super(queueOutput.name(), QUEUE, Direction.OUT, queueOutput.dataType());
queueName = queueOutput.queueName();
setConnection(queueOutput.connection());
}
@JsonGetter
public String getQueueName() {
return queueName;
}
}
| [
"lena.lakhno@gmail.com"
] | lena.lakhno@gmail.com |
097db1177c47062cdd6196be181bbe9e4e880eba | 979dd68ec5f0fab4042bd49c4a6301e02d4976b6 | /src/c/spik3/asdf/Asdf.java | 20b2392a3fa40204d65508dab426764cd8e2ea14 | [] | no_license | aquamarine602/my_repository | a724142f9b0208f0d9def6e651af504a91d087db | 8685790a92e9518e7fb50fb87e1b27b7218f32dd | refs/heads/master | 2020-04-02T08:10:26.167444 | 2018-10-23T01:28:21 | 2018-10-23T01:28:21 | 154,232,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package c.spik3.asdf;
import static java.lang.System.out;
import java.util.Scanner;
public class Asdf {
public static void main(String[] args) {
out.println((int)(Math.random()));
out.println(Math.pow(2,3));
out.println(34 % 7);
out.println(3 + 4 * 2 > 2 * 9);
int number = 4;
out.println(3 * number);
out.println(4 * number);
int x = 943;
out.println(x/100);
out.println(x % 100);
out.println(x + "is" + ((x % 2 == 0) ? "even" : "odd"));
int y = -1;
y++;
out.println(y);
}
}
| [
"Chloe@10.0.0.153"
] | Chloe@10.0.0.153 |
18e688d420b0b7dd6099915eba005b1b7da9d917 | ed8f2bb5d6c0af0c68e60b161ce1c4822346b534 | /app/src/main/java/com/magossi/simb/activity/TarefaActivity.java | 8d9567ce9f72e4cf4ac3b52705602e5d2306450c | [] | no_license | rafaelmagossi/simb-app | 2268d8a97c58eb5a165ad33b0c5e1128b8bf8a48 | 876066922491b6afacbc3303655495e46ff8b71a | refs/heads/master | 2020-03-21T17:03:21.023880 | 2017-08-29T02:23:41 | 2017-08-29T02:23:41 | 138,810,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,192 | java | package com.magossi.simb.activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.magossi.simb.MainActivity;
import com.magossi.simb.R;
import com.magossi.simb.domain.bovino.Bovino;
import com.magossi.simb.domain.tarefas.Tarefa;
import com.magossi.simb.fragment.TarefaFragment;
/**
* Created by RafaelMq on 17/11/2016.
*/
public class TarefaActivity extends AppCompatActivity{
private Toolbar toolbarPadrao;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tarefa);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
TarefaFragment tf = (TarefaFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_tarefa);
Tarefa t = (Tarefa) getIntent().getSerializableExtra("tarefa");
tf.setTarefa(t);
toolbarPadrao = (Toolbar)findViewById(R.id.toolbar_tarefa);
toolbarPadrao.setLogo(R.drawable.ic_toolbar_cadastro);
toolbarPadrao.setTitle(t.getTipoTarefa().toString());
setSupportActionBar(toolbarPadrao);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
toolbarPadrao.setNavigationIcon(R.drawable.ic_toolbar_voltar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_toobar_busca, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.menu_home:
//Toast.makeText(CadastroActivity.this, "Menu Config", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
break;
}
return super.onOptionsItemSelected(item);
}
}
| [
"rafael_mq2@hotmail.com"
] | rafael_mq2@hotmail.com |
5bb8722badb9733d4baf7ad31d008e48352188e3 | 6e5b4b2300c1b5766adbe5c70872cdc9a454e136 | /ThreadTest/src/kr/or/ddit/basic/T08_ThreadPriorityTest.java | 0f89766591bf3b20814dc77031774ae081d51b64 | [] | no_license | sulgy0928/HighJava | 4b9f16d1f1b312fd36e4fe7aa68e22f4ea110396 | bd5feff65b7e9b4d1d813de6a1c3dc628c7f2875 | refs/heads/master | 2020-09-20T02:28:21.974871 | 2019-12-02T10:06:14 | 2019-12-02T10:06:14 | 224,357,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | java | package kr.or.ddit.basic;
public class T08_ThreadPriorityTest {
public static void main(String[] args) {
ThreadTest1 th1 = new ThreadTest1();
ThreadTest2 th2 = new ThreadTest2();
//우선순위는 start()메서드를 호출하기 전에 설정해야한다.
th1.setPriority(10);
th2.setPriority(1);
System.out.println("th1의 우선순위 : " + th1.getPriority());
System.out.println("th2의 우선순위 : " + th2.getPriority());
th1.start();
th2.start();
try {
th1.join();
th2.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("최대 우선순위 : " + Thread.MAX_PRIORITY);
System.out.println("최소 우선순위 : " + Thread.MIN_PRIORITY);
System.out.println("보통 우선순위 : " + Thread.NORM_PRIORITY);
}
}
//대문자를 출력하는 쓰레드 클래스
class ThreadTest1 extends Thread{
@Override
public void run() {
for(char ch = 'A'; ch <= 'Z'; ch++) {
System.out.print(ch);
//아무것도 하지 않는 반복문(시간때우기용)
for(long i = 1; i <=1000000000L; i++) {}
}
}
}
//소문자를 출력하는 쓰레드 클래스
class ThreadTest2 extends Thread{
@Override
public void run() {
for(char ch = 'a'; ch <= 'z'; ch++) {
System.out.print(ch);
//아무것도 하지 않는 반복문(시간때우기용)
for(long i = 1; i <=1000000000L; i++) {}
}
}
}
| [
"sulgy0928@gmail.com"
] | sulgy0928@gmail.com |
78b952e03818fba7a41fb1d063d38fa5bfd93a20 | 56dcb88d839051b4459b99122d487d5be485506c | /src/main/java/com/t_systems_mms/additional/Main.java | f220bfe0a28bcf6be3f86305d8801b7c28a0e74c | [] | no_license | Kohukene/JavaKurs-Grundlagen | 919c765669f3098912245c45ff79038281d832a2 | 653549d96a3d26fd2c18bfcca93a9747c0c8ba4b | refs/heads/master | 2021-06-22T13:07:50.651995 | 2017-07-29T17:55:48 | 2017-07-29T17:55:48 | 98,748,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.t_systems_mms.additional;
public class Main{
public static void main(String[] args){
SimpleIntegerAdder simpleAdder=new SimpleIntegerAdder();
AddingComponent addComp=new AddingComponent(simpleAdder);
SimpleSummandProvider simSumProv = new SimpleSummandProvider(1,2);
addComp.addNumbers(simSumProv);
System.out.println(addComp.addNumbers(simSumProv));
}
} | [
"Verena.schiffler@gmx.de"
] | Verena.schiffler@gmx.de |
b5460fbf7a7c27f8ae492bb7e12a40871f75f3ac | 9a633ae2aa51b4656428fa454c63caa5fb369ad5 | /src/test/java/com/example/demo/EntrepriseApiApplicationTests.java | 0c092a6a412f10a90681851a4fbf288e217d9ee7 | [] | no_license | lanaflon-cda2/SpringApi | f360c8cfa809e3c603ee9aa02736a6c59336b7ff | e6bcd2491ce6d4c2e235d500b3347a0d58651de8 | refs/heads/master | 2022-04-14T11:41:00.452835 | 2020-04-18T09:58:14 | 2020-04-18T09:58:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.example.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class EntrepriseApiApplicationTests {
@Test
void contextLoads() {
}
}
| [
"ylesueur@jehann.fr"
] | ylesueur@jehann.fr |
4336f5408d41027af376b17cfcfc52dc3fe4c10a | f29373ed0538011a8697fdb7730b1f21926ebcfa | /app/src/main/java/com/syu/ipc/data/FinalTv.java | 77a0ce45c7e0ae7085dfaeda084a93e487f93f07 | [] | no_license | MobeedoM-opensource/android-auto | bd1763bb340b7fcc6b7efaf99c81daa4c9a504c1 | 0428f8b84cd8361d80a5501203f7a4cd4de947e2 | refs/heads/master | 2020-06-10T20:22:39.169458 | 2019-06-30T19:30:04 | 2019-06-30T19:30:04 | 193,735,614 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,178 | java | package com.syu.ipc.data;
public class FinalTv {
public static final int AREA_DEFAULT = 0;
public static final int AREA_INDONESIA = 1;
public static final int C_AREA = 9;
public static final int C_FORMAT = 6;
public static final int C_FREQ_DOWN = 3;
public static final int C_FREQ_UP = 2;
public static final int C_KEY = 8;
public static final int C_NEXT_CHANNEL = 1;
public static final int C_PREV_CHANNEL = 0;
public static final int C_SEARCH = 5;
public static final int C_TOUCH = 7;
public static final int C_TV_TYPE = 4;
public static final int FORMAT_NTSC_MN = 5;
public static final int FORMAT_PAL_BG = 2;
public static final int FORMAT_PAL_DK = 1;
public static final int FORMAT_PAL_I = 0;
public static final int FORMAT_PAL_M = 3;
public static final int FORMAT_PAL_N = 4;
public static final int FORMAT_SEACAML_BG = 7;
public static final int FORMAT_SEACAM_DK = 6;
public static final int G_CHANNEL_FREQ = 0;
public static final int G_TV_TYPE = 1;
public static final int KEY_CONFIRM = 4;
public static final int KEY_DOWN = 3;
public static final int KEY_EXIT = 6;
public static final int KEY_LEFT = 0;
public static final int KEY_MENU = 5;
public static final int KEY_RIGHT = 2;
public static final int KEY_UP = 1;
public static final int MODULE_TV_BY_MCU = 1;
public static final int MODULE_TV_NULL = 0;
public static final int SEARCH_STATE_AUTO = 1;
public static final int SEARCH_STATE_DOWN = 3;
public static final int SEARCH_STATE_NULL = 0;
public static final int SEARCH_STATE_UP = 2;
public static final int TV_TYPE_ANALOG = 1;
public static final int TV_TYPE_CMMB = 3;
public static final int TV_TYPE_DVBT = 2;
public static final int TV_TYPE_NULL = 0;
public static final int U_AREA = 6;
public static final int U_CHANNEL = 2;
public static final int U_CHANNEL_CNT = 4;
public static final int U_CNT_MAX = 30;
public static final int U_FORMAT = 3;
public static final int U_FREQ = 1;
public static final int U_SEARCH_STATE = 5;
public static final int U_TV_TYPE = 0;
}
| [
"mloturco@gmail.com"
] | mloturco@gmail.com |
a4d1442dabdfe7bea5c0055893d223021ee86797 | cf81656232ac3bf3c17de0170a36272df8e0d21b | /ftpGate/apache-sshd-2.2.0/sshd-common/src/main/java/org/apache/sshd/common/util/MapEntryUtils.java | 617bb2e95fdfe74d517883421b890c351b3e0b7f | [
"Apache-2.0"
] | permissive | delphiasp/sftpGate | 35fe1b02f88ce2b0aeee87bacb7ebfbaaaafc2cd | a558127cff468d2b9cc939b2da1582d5b84a93fe | refs/heads/master | 2022-08-06T11:27:30.630957 | 2019-12-28T13:51:38 | 2019-12-28T13:51:38 | 221,374,661 | 1 | 0 | null | 2022-05-25T06:46:23 | 2019-11-13T04:47:26 | Java | UTF-8 | Java | false | false | 6,717 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.sshd.common.util;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NavigableMap;
import java.util.Objects;
import java.util.TreeMap;
import java.util.function.Supplier;
/**
* Represents an un-modifiable pair of values
*
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
public final class MapEntryUtils {
@SuppressWarnings({"rawtypes", "unchecked"})
private static final Comparator<Map.Entry<Comparable, ?>> BY_KEY_COMPARATOR = (o1, o2) -> {
Comparable k1 = o1.getKey();
Comparable k2 = o2.getKey();
return k1.compareTo(k2);
};
private MapEntryUtils() {
throw new UnsupportedOperationException("No instance");
}
/**
* @param <K> The {@link Comparable} key type
* @param <V> The associated entry value
* @return A {@link Comparator} for {@link java.util.Map.Entry}-ies that
* compares the key values
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <K extends Comparable<K>, V> Comparator<Map.Entry<K, V>> byKeyEntryComparator() {
return (Comparator) BY_KEY_COMPARATOR;
}
public static class GenericMapPopulator<K, V, M extends Map<K, V>> implements Supplier<M> {
private final M map;
public GenericMapPopulator(M map) {
this.map = Objects.requireNonNull(map, "No map provided");
}
public GenericMapPopulator<K, V, M> put(K k, V v) {
map.put(k, v);
return this;
}
public GenericMapPopulator<K, V, M> remove(K k) {
map.remove(k);
return this;
}
public GenericMapPopulator<K, V, M> putAll(Map<? extends K, ? extends V> other) {
map.putAll(other);
return this;
}
public GenericMapPopulator<K, V, M> clear() {
map.clear();
return this;
}
@Override
public M get() {
return map;
}
}
public static class MapBuilder<K, V> extends GenericMapPopulator<K, V, Map<K, V>> {
public MapBuilder() {
super(new LinkedHashMap<>());
}
@Override
public MapBuilder<K, V> put(K k, V v) {
super.put(k, v);
return this;
}
@Override
public MapBuilder<K, V> remove(K k) {
super.remove(k);
return this;
}
@Override
public MapBuilder<K, V> putAll(Map<? extends K, ? extends V> other) {
super.putAll(other);
return this;
}
@Override
public MapBuilder<K, V> clear() {
super.clear();
return this;
}
public Map<K, V> build() {
return get();
}
public Map<K, V> immutable() {
return Collections.unmodifiableMap(build());
}
public static <K, V> MapBuilder<K, V> builder() {
return new MapBuilder<>();
}
}
public static class NavigableMapBuilder<K, V> extends GenericMapPopulator<K, V, NavigableMap<K, V>> {
public NavigableMapBuilder(Comparator<? super K> comparator) {
super(new TreeMap<>(Objects.requireNonNull(comparator, "No comparator provided")));
}
@Override
public NavigableMapBuilder<K, V> put(K k, V v) {
super.put(k, v);
return this;
}
@Override
public NavigableMapBuilder<K, V> remove(K k) {
super.remove(k);
return this;
}
@Override
public NavigableMapBuilder<K, V> putAll(Map<? extends K, ? extends V> other) {
super.putAll(other);
return this;
}
@Override
public NavigableMapBuilder<K, V> clear() {
super.clear();
return this;
}
public NavigableMap<K, V> build() {
return get();
}
public NavigableMap<K, V> immutable() {
return Collections.unmodifiableNavigableMap(build());
}
public static <K extends Comparable<? super K>, V> NavigableMapBuilder<K, V> builder() {
return builder(Comparator.naturalOrder());
}
public static <K, V> NavigableMapBuilder<K, V> builder(Comparator<? super K> comparator) {
return new NavigableMapBuilder<>(comparator);
}
}
public static class EnumMapBuilder<K extends Enum<K>, V> extends GenericMapPopulator<K, V, Map<K, V>> {
public EnumMapBuilder(Class<K> keyType) {
super(new EnumMap<>(Objects.requireNonNull(keyType, "No enum class specified")));
}
@Override
public EnumMapBuilder<K, V> put(K k, V v) {
super.put(k, v);
return this;
}
@Override
public EnumMapBuilder<K, V> remove(K k) {
super.remove(k);
return this;
}
@Override
public EnumMapBuilder<K, V> putAll(Map<? extends K, ? extends V> other) {
super.putAll(other);
return this;
}
@Override
public EnumMapBuilder<K, V> clear() {
super.clear();
return this;
}
public Map<K, V> build() {
return get();
}
public Map<K, V> immutable() {
return Collections.unmodifiableMap(build());
}
public static <K extends Enum<K>, V> EnumMapBuilder<K, V> builder(Class<K> keyType) {
return new EnumMapBuilder<>(keyType);
}
}
} | [
"wanghong@windows10.microdone.cn"
] | wanghong@windows10.microdone.cn |
e8a5161e0eb890dea6cd5e293a48734718477c32 | d297bbca468865ed0239a7cab01e187e7b277165 | /src/main/java/com/example/demo/util/OptionalBean.java | cd35e1b0ee3887ee5c1f8a382cfedf6f2ddc9503 | [] | no_license | duanxiaoduan/demo | 6957d5201690b6a151d67435b040833001b1372f | 340783ed5584bbee7f12c45cd1aa7a5492f82764 | refs/heads/master | 2022-07-04T01:56:42.852335 | 2020-11-12T02:10:23 | 2020-11-12T02:10:23 | 132,895,073 | 0 | 0 | null | 2022-06-29T18:24:45 | 2018-05-10T12:08:08 | Java | UTF-8 | Java | false | false | 1,077 | java | package com.example.demo.util;
import java.util.Objects;
import java.util.function.Function;
/**
* @author duanxiaoduan
* @version 2020/10/12
*/
public final class OptionalBean<T> {
private static final OptionalBean<?> EMPTY = new OptionalBean<>();
private final T value;
private OptionalBean() {
this.value = null;
}
private OptionalBean(T value) {
this.value = value;
}
public static<T> OptionalBean<T> empty() {
@SuppressWarnings("unchecked")
OptionalBean<T> t = (OptionalBean<T>) EMPTY;
return t;
}
public static <T> OptionalBean<T> ofNullable(T value) {
return value == null ? empty() : of(value);
}
public static <T> OptionalBean<T> of(T value) {
return new OptionalBean<>(value);
}
public T get() {
return Objects.isNull(value) ? null : value;
}
public <R> OptionalBean<R> getBean(Function<? super T, ? extends R> fn) {
return Objects.isNull(value) ? OptionalBean.empty() : OptionalBean.ofNullable(fn.apply(value));
}
}
| [
"aihua0721@gmail.com"
] | aihua0721@gmail.com |
a9a18099a6954af49fb2642b4974c3cd4db60fbc | daff9a020bb5065e7552983d1a728dcc15f9706a | /src/osc/OSCPort.java | 8656fe992de7c44032e507e83d4f8a34ef70476b | [] | no_license | rmdPurdue/BaMDancer | fe6fe7a44a469b4c068dd22ddaa332cbc41fb245 | ff510a04a965d8da44ca835de6ad0dd96fc5a2fd | refs/heads/master | 2020-07-24T08:17:42.206200 | 2019-09-11T16:52:54 | 2019-09-11T16:52:54 | 207,862,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,765 | java | /*
* Copyright (C) 2003-2014, C. Ramakrishnan / Illposed Software.
* All rights reserved.
*
* This code is licensed under the BSD 3-Clause license.
* See file LICENSE (or LICENSE.html) for more information.
*/
package osc;
import java.net.DatagramSocket;
/**
* OSCPort is an abstract superclass, to send OSC messages,
* use {@link OSCPortOut}.
* To listen for OSC messages, use {@link OSCPortIn}.
*
* @author Chandrasekhar Ramakrishnan
*/
public class OSCPort {
private final DatagramSocket socket;
private final int port;
public static final int DEFAULT_SC_OSC_PORT = 57110;
public static final int DEFAULT_SC_LANG_OSC_PORT = 57120;
protected OSCPort(final DatagramSocket socket, final int port) {
this.socket = socket;
this.port = port;
}
/**
* The port that the SuperCollider <b>synth</b> engine
* usually listens to.
* @return default SuperCollider <b>synth</b> UDP port
* @see #DEFAULT_SC_OSC_PORT
*/
public static int defaultSCOSCPort() {
return DEFAULT_SC_OSC_PORT;
}
/**
* The port that the SuperCollider <b>language</b> engine
* usually listens to.
* @return default SuperCollider <b>language</b> UDP port
* @see #DEFAULT_SC_LANG_OSC_PORT
*/
public static int defaultSCLangOSCPort() {
return DEFAULT_SC_LANG_OSC_PORT;
}
/**
* Returns the socket associated with this port.
* @return this ports socket
*/
protected DatagramSocket getSocket() {
return socket;
}
/**
* Returns the port number associated with this port.
* @return this ports number
*/
protected int getPort() {
return port;
}
/**
* Close the socket and free-up resources.
* It is recommended that clients call this when they are done with the
* port.
*/
public void close() {
socket.close();
}
}
| [
"rdionne@purdue.edu"
] | rdionne@purdue.edu |
48aeadf9751dc9abdd40a4f4282dd47c794c972a | 721ba6454ad65397a7d16e88072f6d2e7944381b | /src/com/iscreate/op/pojo/rno/.svn/text-base/FreqInterIndex.java.svn-base | 3a84c6432bef0cdd21bcf7dafb560d4c3d02d831 | [] | no_license | tianxiao666/rno-4g | dc8314d13d6835efb5ad554c9be8561a5b0d87c0 | 4cb02b6ef30d0bd42beed5ff80bde3b2475b7c4d | refs/heads/master | 2021-04-03T02:59:56.154677 | 2018-03-12T09:30:49 | 2018-03-12T09:30:49 | 124,864,568 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | package com.iscreate.op.pojo.rno;
import java.util.List;
public class FreqInterIndex {
private String label;
private String cellTch;
private List<AdjFreqInterDetailed> adjFreqInterDetaList;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getCellTch() {
return cellTch;
}
public void setCellTch(String cellTch) {
this.cellTch = cellTch;
}
public List<AdjFreqInterDetailed> getAdjFreqInterDetaList() {
return adjFreqInterDetaList;
}
public void setAdjFreqInterDetaList(
List<AdjFreqInterDetailed> adjFreqInterDetaList) {
this.adjFreqInterDetaList = adjFreqInterDetaList;
}
}
| [
"chao.xj@hgicreate.com"
] | chao.xj@hgicreate.com | |
5dd262b032a08a1a73b9f35053551166e84bd192 | 197800c473213100ced370ddb9925f86f612dd16 | /app/src/main/java/com/lyk/busgrade/ThreadPoolManagerFactory.java | 68501f8a148e6a0bb92dbaf2edbe734498d046fe | [] | no_license | nian0114/BusGrade | 4bff0221391d053deb82c0c7c63d2de35909c618 | 78ba217af45eeffa0b69865ae9057ce9f19215fc | refs/heads/master | 2021-10-26T18:56:44.228808 | 2017-10-09T14:53:59 | 2017-10-09T14:53:59 | 107,343,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.lyk.busgrade;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class ThreadPoolManagerFactory {
private static int corePoolSize = 3;
private static int maxPoolSize = 10;
private static int keepAliveTime = 300;
private static ThreadPoolExecutor threadPoolManager;
static {
threadPoolManager = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new ThreadPoolExecutor.DiscardPolicy());
}
public static ThreadPoolExecutor getInstance() {
return threadPoolManager;
}
}
| [
"268078545@qq.com"
] | 268078545@qq.com |
57907c2975bb9de9ed344c7010c80edcf00a1ec2 | 0632f2d4d3c011dd96e9e377e301a72e05243ac1 | /src/main/java/com/disease/demo/controller/HeadquarterController.java | f01b0a6452cd54c4df3b13d59d4e929339d6a785 | [] | no_license | superIRON33/FightDisease | 24bbe1f240f59b5e90e03eb1960f0df6f83760ff | 6e7cb6f79c9dcbbca75d8a3bbebb50b018036dae | refs/heads/master | 2022-04-05T09:41:17.260180 | 2020-02-23T04:00:07 | 2020-02-23T04:00:07 | 237,792,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package com.disease.demo.controller;
import com.disease.demo.model.dto.ResultDTO;
import com.disease.demo.service.HeadquarterService;
import com.disease.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author: wjy
* @date: 2020/2/3 21:32
* @description: 问答表控制层
*/
@RestController
@RequestMapping("/")
public class HeadquarterController {
@Autowired
private UserService userService;
@Autowired
private HeadquarterService headquarterService;
@PostMapping(value = "/headQuarter")
public ResultDTO updateStatus(@RequestParam Integer id) {
return userService.updateStatus(id);
}
@GetMapping(value = "/headQuarter")
public ResultDTO getHeadQuarter(@RequestParam Integer id) {
return headquarterService.getHeadQuarter(id);
}
}
| [
"wjymessi@163.com"
] | wjymessi@163.com |
bcfa6b51e30bca77099ea48641e87f9754250c1a | 87aa4d7096bf8ddaabd861a79fa5a18e194e1d72 | /src/main/java/Aula02/Caneta.java | fa7411f06cfa6104db7c53d22eb66ca6d31888b7 | [] | no_license | sergiofilho-dev/POO-JAVA-BASIC | 32b4926a2834cdc3097f5246d209faf0261d2297 | a84b5c95069415dd861a97540eeccd9d9aa92273 | refs/heads/master | 2023-04-01T18:22:10.397687 | 2021-04-06T03:09:49 | 2021-04-06T03:09:49 | 355,040,340 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 771 | java | package Aula02;
public class Caneta {
String modelo;
String cor;
float ponta;
int carga;
boolean tampada;
public void status (){
System.out.println("Modelo: " + this.modelo);
System.out.println("Uma caneta " + this.cor);
System.out.println("Ponta: " + this.ponta);
System.out.println("Está tampada ? " + this.tampada);
System.out.println("Carga: " + this.carga);
}
void rabiscar (){
if (this.tampada == true){
System.out.println("ERRO! Não posso rabiscar");
}else{
System.out.println("Estou rabiscando!");
}
}
void tampar (){
this.tampada = true;
}
void destampar (){
this.tampada = false;
}
}
| [
"sergi@SérgioFilho"
] | sergi@SérgioFilho |
13990a46f868fa2dc9fce0ce8fd1edebf0a51d04 | b8e9e52f0910bde7d90e884d53a3ee1c889313ab | /src/main/java/org/unsw/eva/threads/LongProcessInstanceResponeTests.java | 72e84394d19a04c0e03484049bffaa026dd92c09 | [] | no_license | 1zha0/cloud-platforms-evaluation | 4a1ca327671378e56aa55805614b60f57ae39575 | 281e96586597fb7a96c9b74437becc7b4bf6fa93 | refs/heads/master | 2021-01-15T07:55:00.721856 | 2015-04-23T13:35:29 | 2015-04-23T13:35:29 | 34,458,407 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package org.unsw.eva.threads;
import org.cloudcomputingevaluation.Result;
import org.unsw.eva.SOAPVersion;
import org.unsw.eva.ServerType;
import org.unsw.eva.strategy.AbstractStrageyTest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author shrimpy
*/
public class LongProcessInstanceResponeTests<T extends AbstractStrageyTest> extends EvaluationThread {
private static final Logger log = LoggerFactory.getLogger(LongProcessInstanceResponeTests.class);
public LongProcessInstanceResponeTests() {
}
public LongProcessInstanceResponeTests(String name, T strageyTest, ServerType serverType, int repeatNumberOfTime) {
super(name, strageyTest, SOAPVersion.SOAP_11, serverType, repeatNumberOfTime);
}
@Override
public Result doSOAP11Call() throws Exception {
return getServiceEndpoint().longProcessInstanceResponse(50000, "a");
}
@Override
public Result doSOAP12Call() throws Exception {
return null;
}
@Override
public Boolean hasError() {
return (getResult().getTimer() != null);
}
}
| [
"imxmwu@gmail.com"
] | imxmwu@gmail.com |
810572f34d5ba1381462f02bcbfc30016ed2a2e6 | 101e87f6350e4f9fbbf755dd76063694466358dc | /localVPN/src/main/java/com/vm/shadowsocks/tcpip/UDPHeader.java | 4920ffa776d37ec6b24d0ece1231d9f0121a7d00 | [] | no_license | androidKy/MockDevice | ad509ce75dff34430a59e7db37a6784c0b4a5243 | 286d2b0e4f2ccde9644ad903c5192c47de19da27 | refs/heads/master | 2021-08-19T23:01:22.123523 | 2020-11-25T15:09:44 | 2020-11-25T15:09:44 | 227,784,083 | 0 | 1 | null | 2020-11-25T15:09:46 | 2019-12-13T07:42:01 | C | UTF-8 | Java | false | false | 1,714 | java | package com.vm.shadowsocks.tcpip;
import android.annotation.SuppressLint;
public class UDPHeader {
static final short offset_src_port = 0; // Source port
static final short offset_dest_port = 2; // Destination port
static final short offset_tlen = 4; // Datagram length
static final short offset_crc = 6; // Checksum
public byte[] m_Data;
public int m_Offset;
public UDPHeader(byte[] data, int offset) {
this.m_Data = data;
this.m_Offset = offset;
}
public short getSourcePort() {
return CommonMethods.readShort(m_Data, m_Offset + offset_src_port);
}
public void setSourcePort(short value) {
CommonMethods.writeShort(m_Data, m_Offset + offset_src_port, value);
}
public short getDestinationPort() {
return CommonMethods.readShort(m_Data, m_Offset + offset_dest_port);
}
public void setDestinationPort(short value) {
CommonMethods.writeShort(m_Data, m_Offset + offset_dest_port, value);
}
public int getTotalLength() {
return CommonMethods.readShort(m_Data, m_Offset + offset_tlen) & 0xFFFF;
}
public void setTotalLength(int value) {
CommonMethods.writeShort(m_Data, m_Offset + offset_tlen, (short) value);
}
public short getCrc() {
return CommonMethods.readShort(m_Data, m_Offset + offset_crc);
}
public void setCrc(short value) {
CommonMethods.writeShort(m_Data, m_Offset + offset_crc, value);
}
@SuppressLint("DefaultLocale")
@Override
public String toString() {
// TODO Auto-generated method stub
return String.format("%d->%d", getSourcePort() & 0xFFFF, getDestinationPort() & 0xFFFF);
}
}
| [
"13286810620@163.com"
] | 13286810620@163.com |
3b8a4f90678b5013c8792982d5716af09597bed1 | a5d6b5c302c6c16f4b9f6ad218f6267ee0eeec5e | /test-sharding-jdbc/src/main/java/com/meng/entity/User.java | 7fb003ba119412e56dd01a6121ba6a16e815bd31 | [] | no_license | xlm1999/mydemo-springboot | c2f23ddf92b9c9c71aeee396df5dd932a949999b | 4fc4f8e60346a2fc4ba4e0261fb209bd6c40e837 | refs/heads/master | 2023-07-04T17:02:57.021675 | 2021-08-03T12:07:03 | 2021-08-03T12:07:03 | 392,302,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.meng.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import groovy.transform.EqualsAndHashCode;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @Classname User
* @Description 用户实体类
* @Author 章国文 13120739083@163.com
* @Date 2019-06-28 17:24
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("user")
public class User extends Model<User> {
/**
* 主键Id
*/
private int id;
/**
* 名称
*/
private String name;
/**
* 年龄
*/
private int age;
String s = "SELECT\n" +
" T . NAME,\n" +
" t2. NAME,\n" +
" T3. NAME,\n" +
" t4. NAME,\n" +
" T1.fld_u_00004,\n" +
" T1.fld_d_00005,\n" +
" T .ObjStatusID,\n" +
" T .OWNERIDS,\n" +
" T .CREATORID,\n" +
" T .CREATEDTIME\n" +
"FROM\n" +
" T_WF22_WF22 T\n" +
"LEFT JOIN T_WF22_EXT t1 ON t1.OBJECTID = T . ID\n" +
"LEFT JOIN T_PSM_PJT t2 ON t2. ID = T .projectid\n" +
"LEFT JOIN T_OBJ_BASEITEM t3 ON t3. ID = T1.fld_s_00002\n" +
"LEFT JOIN T_OBJ_BASEITEM t4 ON t4. ID = T1.fld_s_00003\n" +
"ORDER BY\n" +
" T .MODIFYTIME DESC;\n" +
"\n";
} | [
"xlm_1999@163.com"
] | xlm_1999@163.com |
b4de06272f8531b39341e2b30c900039bb24d837 | 648aa202e77a9f452a14faee22824d08270a9938 | /src/main/java/Library.java | 8256f9cfab6e2b3c8a87e965321ea70f2f561551 | [] | no_license | kanaryayi/TageBuch | 32c89ce16dc812c1a3ddf1ded61c1f0f5433959c | 2fcb2c8f2d1a03d69da954f3e34c2a12582042c1 | refs/heads/master | 2021-05-03T10:17:18.814942 | 2018-02-06T19:42:56 | 2018-02-06T19:42:56 | 120,532,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | /*
* This Java source file was auto generated by running 'gradle buildInit --type java-library'
* by 'HTC' at '07.07.2017 16:21' with Gradle 2.9
*
* @author HTC, @date 07.07.2017 16:21
*/
public class Library {
public boolean someLibraryMethod() {
return true;
}
}
| [
"yigit.burdurlu@hacettepe.edu.tr"
] | yigit.burdurlu@hacettepe.edu.tr |
650a7b8d0660973ef16cf1758ab99eca3dda08e6 | cd495300285f9e1224380250c2ffabd742eb9804 | /src/src/com/sid/hashmapAndHeap/heap/SortKsortedArray.java | a876ba5d7398a17660e771ca393ec3884233a11f | [] | no_license | siddharthnawani/data-structures-and-algorithms | 78147f793323213e0b1af3df8def71a086de81cb | c51aa1c1d9b02a4804bc636227f2ca1cf7d8938b | refs/heads/master | 2023-06-08T20:30:00.791671 | 2023-05-28T17:18:17 | 2023-05-28T17:18:17 | 282,298,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | java | package src.com.sid.hashmapAndHeap.heap;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.PriorityQueue;
/**
* Question
* 1. You are given a number n, representing the size of array a.
* 2. You are given n numbers, representing elements of array a.
* 3. The array is nearly sorted. Every element is at-max displaced k spots left or right to it's position in the sorted array. Hence it is being called k-sorted array.
* 4. You are required to sort and print the sorted array.
* <p>
* Sample Input
* 9
* 3
* 2
* 4
* 1
* 6
* 5
* 7
* 9
* 8
* 3
* Sample Output
* 1
* 2
* 3
* 4
* 5
* 6
* 7
* 8
* 9
**/
public class SortKsortedArray {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = Integer.parseInt(br.readLine());
}
int k = Integer.parseInt(br.readLine());
PriorityQueue<Integer> pq = new PriorityQueue<>();
for (int i = 0; i <= k; i++) {
pq.add(arr[i]);
}
for (int i = k + 1; i < arr.length; i++) {
System.out.println(pq.remove());
pq.add(arr[i]);
}
while (pq.size() > 0) {
System.out.println(pq.remove());
}
}
}
| [
"siddharth.nawani@gmail.com"
] | siddharth.nawani@gmail.com |
1dc9a053bb4a7cd68e78b9885c69fcf482eb0fad | f304c30fd16f56e55d738eeb61a42cc7a983f527 | /level21/lesson08/task03/Solution.java | 868fd9db2b5cc62ecb975c25ecbe38a248ca2228 | [] | no_license | bitho/JavaRush | 79d0d9d925c09099fca01f4a50cbc3e20869021f | 7c1b25073c930e42afa492500ca9665b9982cd11 | refs/heads/master | 2021-01-10T14:13:53.467362 | 2015-10-22T17:57:04 | 2015-10-22T17:57:04 | 43,957,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.javarush.test.level21.lesson08.task03;
/* Запретить клонирование
Разрешите клонировать класс А
Запретите клонировать класс B
Разрешите клонировать класс C
*/
public class Solution {
public static class A implements Cloneable {
private int i;
private int j;
public A(int i, int j) {
this.i = i;
this.j = j;
}
@Override
protected A clone() throws CloneNotSupportedException
{
return new A(getI(), getJ());
}
public int getI() {
return i;
}
public int getJ() {
return j;
}
}
public static class B extends A {
private String name;
public B(int i, int j, String name) {
super(i, j);
this.name = name;
}
public String getName() {
return name;
}
protected B clone() throws CloneNotSupportedException
{
throw new CloneNotSupportedException("You can't do that!");
}
}
public static class C extends B {
public C(int i, int j, String name) {
super(i, j, name);
}
@Override
protected C clone() throws CloneNotSupportedException
{
return new C(getI(), getJ(), getName());
}
}
} | [
"sasha.starichkov@mail.ru"
] | sasha.starichkov@mail.ru |
a2cfcfacd4b4c927a20694f628a3d8771fe19686 | 96ca08c92af5e03c3f0886d1b8126faf813b0ab0 | /src/main/java/com/recruit/paythem/controller/EmployeeController.java | 23783a514a0a1b1bb1940ab0e69ebe515a973d3f | [] | no_license | walakulu/Pay-Them | 2cca71261f565412d4d3f3cce37854174c2c7c4e | 9d9c3e7bff95d87bd1b98e2b0f20ad9b1bbd7f1a | refs/heads/master | 2020-04-07T05:50:57.895860 | 2018-11-18T18:20:13 | 2018-11-18T18:20:13 | 158,112,945 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,306 | java | package com.recruit.paythem.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.recruit.paythem.dto.ResponseDto;
import com.recruit.paythem.enums.ResponseMessage;
import com.recruit.paythem.service.EmployeeService;
@RestController
@CrossOrigin
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
/**
* <p>
* This controller method gives all the recruited employee details for given
* recruitment id.
* </p>
*
* @param recruitmentId
* @return {@code ResponseEntity}
* @throws Exception
*/
@GetMapping(value = "employees/{recruitment-id}")
public ResponseEntity<?> getEmployeesByRecruitmentId(@PathVariable("recruitment-id") int recruitmentId)
throws Exception {
ResponseDto responseDto = employeeService.getEmployeeList(recruitmentId);
responseDto.setMessageCode(ResponseMessage.SUCCESS.getCode());
responseDto.setMessage(ResponseMessage.SUCCESS.getMessage());
return ResponseEntity.ok(responseDto);
}
}
| [
"hasitha.arachchige@auxenta.com"
] | hasitha.arachchige@auxenta.com |
a820f11772c0ec154e8fff38b1429b7e6ddb0fae | f19e80191d6cbd07d24d9a9d52cd34f6877fdbb9 | /lib-https/src/main/java/com/github/douruanliang/lib_https/model/IDataList.java | 7090e276cec48b61e9607a0c3d6b1a6ecff13134 | [] | no_license | douruanliang/component-base-demo | eea9abf4a9eea83a965f20e6ad61f997b254aee5 | df95b83aba6184adcb52616ed5e44676ded377df | refs/heads/master | 2021-06-27T00:37:03.610429 | 2021-06-10T02:30:25 | 2021-06-10T02:30:25 | 234,732,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 191 | java | package com.github.douruanliang.lib_https.model;
import java.util.List;
public interface IDataList<T> extends BaseObject {
public List<T> getList();
public String getNext();
}
| [
"douruanliang@zhidaoauto.com"
] | douruanliang@zhidaoauto.com |
14dce8be11ef2ec41b0328ecdad9b6b514f952ff | 72960a3e2bdbb01b16245a1ad4cccbdfa0553b93 | /src/SS-GENERIDAO-TO-JPA2/src/main/java/com/sofis/sofisform/to/LabelTO.java | 8d60e44f890412b84b0813fd715fdee49592d352 | [] | no_license | AGESIC-UY/siges | 0629afbc42f35add7db4dc10a7189cac79073ce5 | d809ced53759dd82314a3a481a79b731a3e15bc4 | refs/heads/master | 2023-08-04T04:00:56.709793 | 2023-07-20T18:21:51 | 2023-07-20T18:21:51 | 224,908,836 | 2 | 4 | null | 2020-07-02T01:27:26 | 2019-11-29T19:05:15 | Java | UTF-8 | Java | false | false | 1,027 | java | /*
* Clase desarrollada por Sofis Solutions
*
*/
package com.sofis.sofisform.to;
import java.io.Serializable;
import org.jdom.Element;
/**
* Clase desarrollada por Sofis Solutions
* <label key =""
* entityvar=""
* property=""
* propertyClass=""
* text=""
* />
*
* @author Sofis Solutions
*/
public class LabelTO extends BindingComponentTO implements Serializable{
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public Element toXML() {
Element toReturn = new Element("label");
toReturn = super.toXMLMetadata(toReturn);
toReturn.setAttribute("text", this.getText() +"");
return toReturn;
}
}
| [
"carlos.facal@agesic.gub.uy"
] | carlos.facal@agesic.gub.uy |
c6dea9cd6dfd079c26afd71a8a43520521654a10 | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/select/SelectDialogPresenterKt.java | da2f42c4532d140cdd07b8acd4a9b0d52766470d | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,594 | java | package com.avito.android.select;
import com.avito.android.remote.auth.AuthSource;
import com.avito.android.remote.model.ParcelableEntity;
import java.util.Comparator;
import kotlin.Metadata;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0018\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\"\u0016\u0010\u0003\u001a\u00020\u00008\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b\u0001\u0010\u0002\"2\u0010\t\u001a\u001e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00000\u00050\u0004j\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00000\u0005`\u00068\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b\u0007\u0010\b¨\u0006\n"}, d2 = {"", AuthSource.SEND_ABUSE, "Ljava/lang/String;", "CLEAR_VARIANT_ID", "Ljava/util/Comparator;", "Lcom/avito/android/remote/model/ParcelableEntity;", "Lkotlin/Comparator;", AuthSource.BOOKING_ORDER, "Ljava/util/Comparator;", "COMPARATOR", "select_release"}, k = 2, mv = {1, 4, 2})
public final class SelectDialogPresenterKt {
public static final String a = a2.b.a.a.a.E2(SelectDialogPresenterImpl.class, new StringBuilder(), "_clear_variant_id");
public static final Comparator<ParcelableEntity<String>> b = a.a;
public static final class a<T> implements Comparator<ParcelableEntity<String>> {
public static final a a = new a();
@Override // java.util.Comparator
public int compare(ParcelableEntity<String> parcelableEntity, ParcelableEntity<String> parcelableEntity2) {
return parcelableEntity.getId().compareTo(parcelableEntity2.getId());
}
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
66271a7a1d62ea439b2930f58de58dea76f0ab25 | b96b1c40c9d8cb3f25ae225661d2e217b3ebf8a5 | /Refactoring/SourceCode/Day2/src/BankAccount.java | f5ebb76f6d4bb0e2e804e31febe583b18ad51286 | [] | no_license | leekoko/BookLearned | b2bc0380ca7d43315ef996d51c055551768f0f9b | bd89e61c9339031e249c0cb6ca24e6b3d86f3433 | refs/heads/master | 2021-06-02T20:44:53.885430 | 2019-12-25T01:47:00 | 2019-12-25T01:47:00 | 135,463,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | java | public class BankAccount{
public BankAccount(int accountAge, int creditScore, AccountInterest accountInterest){
AccountAge = accountAge;
CreditScore = creditScore;
AccountInterest = accountInterest;
}
public int AccountAge;
public int CreditScore;
public AccountInterest AccountInterest;
public int getAccountAge() {
return AccountAge;
}
public void setAccountAge(int accountAge) {
AccountAge = accountAge;
}
public int getCreditScore() {
return CreditScore;
}
public void setCreditScore(int creditScore) {
CreditScore = creditScore;
}
public AccountInterest getAccountInterest() {
return AccountInterest;
}
public void setAccountInterest(AccountInterest accountInterest) {
AccountInterest = accountInterest;
}
}
class AccountInterest{
private BankAccount Account;
public double InterestRate(){
return CalculateInterestRate();
}
public boolean IntroductoryRate(){
return CalculateInterestRate() < 0.05;
}
public double CalculateInterestRate()
{
if (Account.CreditScore > 800)
return 0.02;
if (Account.AccountAge > 10)
return 0.03;
return 0.05;
}
public BankAccount getAccount() {
return Account;
}
public void setAccount(BankAccount account) {
Account = account;
}
public AccountInterest(BankAccount account)
{
Account = account;
}
} | [
"908230189@qq.com"
] | 908230189@qq.com |
e3750ec7ab6515b647f3829a87994cc208684129 | e76e3e1000f44bc18b56c2891d21562ef51a651c | /app/src/main/java/models/DressedModel.java | b5de593008d7c8d7d195e9a22c1d47bdcf7a54c9 | [] | no_license | JaneSmyth/Sencerity | ef884be43f27af59559bbe79b354ad43d9d12fe1 | 5e1dedce1df4f46ab46e9d79b192a16bc6d06300 | refs/heads/master | 2021-07-17T05:08:45.187812 | 2020-06-15T12:26:24 | 2020-06-15T12:26:24 | 180,355,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | package models;
import java.time.format.DateTimeFormatter;
public class DressedModel {
private String patientId;
private Long dateLong;
public DressedModel(String patientId, Long dateLong) {
this.patientId = patientId;
this.dateLong = dateLong;
}
//getters and setters
public String getPatientId() {
return patientId;
}
public void setPatientId(String patientId) {
this.patientId = patientId;
}
public Long getDateLong() {
return dateLong;
}
public void setDateLong(Long dateLong) {
this.dateLong = dateLong;
}
}
| [
"Janesmyth246@gmail.com"
] | Janesmyth246@gmail.com |
792869a4ba81e1d737686075f0800f4f1c638bb1 | 2445528f9528aea110ca6d606cbcdd78050f294c | /src/main/java/dao/AbstractDao.java | 1c4964513c955332e00e6233e3131c941eaae6bf | [] | no_license | yoppyi/rest | 228bc3271ae6e40539168e313e5b9657a2d69c2b | 5ae66f8ea97de83e75c0de5b92f2e97243575535 | refs/heads/master | 2021-01-20T20:31:58.597322 | 2016-06-29T03:23:15 | 2016-06-29T03:23:15 | 62,192,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 700 | java | package dao;
import java.io.Closeable;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractDao implements Closeable {
static final Logger logger = LoggerFactory.getLogger(AbstractDao.class);
Connection con;
public AbstractDao() throws SQLException {
this.con = DriverManager.getConnection("jdbc:mysql://localhost:3306/reservation", "root", "passw0rd");
con.setAutoCommit(false);
}
@Override
public void close() throws IOException {
try {
con.close();
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
}
}
| [
"yoppyi@gmail.com"
] | yoppyi@gmail.com |
4d4f1e1858fd9147d34d0eae16fc301eb48e8974 | ee96e7f2d32f4350529fabbb1039aa2374d9327d | /app/src/main/java/com/example/user/worldmeal/ContentProvider.java | 4d50e0dd2dbd0dd5b4870acd97bbbecb0ae4ca4a | [] | no_license | DCG12/PokeCards | 9195463afa5da7b397e1f971e982d44121027ec0 | a9f275a651307e505ad4df730ebd874d9d025391 | refs/heads/master | 2021-01-23T12:38:33.528233 | 2017-06-04T22:34:52 | 2017-06-04T22:34:52 | 93,185,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package com.example.user.worldmeal;
import nl.littlerobots.cupboard.tools.provider.CupboardContentProvider;
import static nl.qbusict.cupboard.CupboardFactory.cupboard;
public class ContentProvider extends CupboardContentProvider {
public static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".provider";
static {
cupboard().register(Meals.class);
}
public ContentProvider() {
super(AUTHORITY, 1);
}
}
| [
"46406163y@iespoblenou.org"
] | 46406163y@iespoblenou.org |
4f74e8e05bdc18770677f3cac4e37aace5120ac8 | 2d0812336dd029b1e6bbc3a3b9d7f29d6ef0f2b3 | /olmatechFit/src/main/java/com/olmatech/fitness/ui/MaxrepActivity.java | e2215abe58876da2849cbd3d84628af7e704232d | [] | no_license | olgab99/CommandoFit | 605c77a86279698d9359d5f41a9e90585bfb9505 | 746241e015a5c986968ec0190849f788cc938ee5 | refs/heads/master | 2020-04-27T23:25:59.030789 | 2019-07-24T15:35:44 | 2019-07-24T15:35:44 | 174,775,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,919 | java | package com.olmatech.fitness.ui;
import java.text.DecimalFormat;
import kankan.wheel.widget.WheelView;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.olmatech.fitness.R;
import com.olmatech.fitness.adapters.ValueNumericAdapter;
import com.olmatech.fitness.adapters.WeightLbAdapter;
import com.olmatech.fitness.main.Common;
//dialog activity
public class MaxrepActivity extends BaseFragmentActivity{
//private final static String TAG="MaxrepActivity";
//private String dlgMsg="Error reading data.";
//private boolean finishOnErr = false;
TextView[] tvTableLbs; //array of views in teh table with values from 100 to 35 % in order
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_calculator);
//set adapters
WheelView wheelWeight = (WheelView)this.findViewById(R.id.maxrep_wheel_weight);
wheelWeight.setViewAdapter(new WeightLbAdapter(this, 1, 300, 0, false));
WheelView wheelReps = (WheelView)this.findViewById(R.id.maxrep_wheel_reps);
wheelReps.setViewAdapter(new ValueNumericAdapter(this, 1, 50, 7));
if(savedInstanceState != null)
{
if(savedInstanceState.containsKey("wheight_ind"))
{
int ind = savedInstanceState.getInt("wheight_ind");
wheelWeight.setCurrentItem(ind);
}
if(savedInstanceState.containsKey("reps_ind"))
{
int ind = savedInstanceState.getInt("reps_ind");
wheelReps.setCurrentItem(ind);
}
this.initTextViewArray();
//draw table
}
else
{
new InitTask().execute();
}
}
public void onButtonClick(View view)
{
switch(view.getId())
{
case R.id.maxrep_but_calculate:
doCalculate();
break;
case R.id.maxrep_but_close:
doClose();
break;
default:
super.onButtonClick(view);
break;
}
}
private void doClose()
{
this.setResult(Common.RESULT_OK);
finish();
}
private void doCalculate()
{
new SaveTask().execute();
}
private boolean calculate()
{
//get data
WheelView wheelWeight = (WheelView)this.findViewById(R.id.maxrep_wheel_weight);
WheelView wheelReps = (WheelView)this.findViewById(R.id.maxrep_wheel_reps);
int weight = WeightLbAdapter.getItemValueFromIndex(wheelWeight.getCurrentItem());
int repVal = wheelReps.getCurrentItem() +1;
//final double wt =weight;
//final double reps = repVal;
///////////////// REMOVE
//calculate
// double epley = wt*reps / 30f + wt;
// double brzycki = wt *(36f /(37f -reps));
//
// double lander = (100f*wt) /(101.3 - 2.67123*reps);
//
// double lombardi = Math.pow(reps, 0.1) * wt;
//
// double mayhew = (100.0 * wt) / (52.2 + Math.pow(2.71828, -0.055*reps)*41.9);
//
// double oconner = wt*(1+0.025*reps);
//
// double wathan = (100.0* wt) /(48.8 + Math.pow(2.71828, -0.075*reps));
//
// DecimalFormat df = new DecimalFormat("#.##");
// String testStr = "epley=" + df.format(epley) + " -- brzycki= " + df.format(brzycki) +
// " --lander=" + df.format(lander) + " -- lombardi=" + df.format(lombardi) +
// " - mayhew=" + df.format(mayhew) + " -- oconner=" + df.format(oconner) +
// " -- wathan=" + df.format(wathan);
//
// showTest(testStr);
///////////// REMOVE END /////////////////
final double maxRep = Common.calculateMaxRep(weight, repVal);
//save to db
// DBAdapter dbAdapter = DBAdapter.getAdapter(this.getApplicationContext());
// User user = User.getUser();
// CurProgram progr = CurProgram.getProgram();
// final boolean ok = dbAdapter.saveOneMaxRep(user.getId(), progr.getCurExId(user.getGender()), maxRep, wt, reps);
// if(ok)
// {
// this.drawRepsTable(maxRep);
// }
this.drawRepsTable(maxRep);
return true;
}
// private void showTest(final String s)
// {
// this.runOnUiThread(new Runnable(){
//
// @Override
// public void run() {
// showTestStr(s);
//
// }
//
// });
// }
//
// private void showTestStr(final String s)
// {
// TextView tv = (TextView)this.findViewById(R.id.maxrep_msg);
// tv.setText(s);
//
// }
private void processSaveDone(final boolean res)
{
this.showRepsTable(res);
if(!res)
{
showErrorDlg(R.string.err_save_data, Common.REASON_NOT_IMPORTANT);
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
WheelView wheelWeight = (WheelView)this.findViewById(R.id.maxrep_wheel_weight);
outState.putInt("wheight_ind", wheelWeight.getCurrentItem());
WheelView wheelReps = (WheelView)this.findViewById(R.id.maxrep_wheel_reps);
outState.putInt("reps_ind", wheelReps.getCurrentItem());
super.onSaveInstanceState(outState);
}
private void initTextViewArray()
{
//init arary
tvTableLbs = new TextView[15];
tvTableLbs[0] =(TextView)this.findViewById(R.id.maxrep_100);
tvTableLbs[1] =(TextView)this.findViewById(R.id.maxrep_95);
tvTableLbs[2] =(TextView)this.findViewById(R.id.maxrep_90);
tvTableLbs[3] =(TextView)this.findViewById(R.id.maxrep_85);
tvTableLbs[4] =(TextView)this.findViewById(R.id.maxrep_80);
tvTableLbs[5] =(TextView)this.findViewById(R.id.maxrep_75);
tvTableLbs[6] =(TextView)this.findViewById(R.id.maxrep_70);
tvTableLbs[7] =(TextView)this.findViewById(R.id.maxrep_65);
tvTableLbs[8] =(TextView)this.findViewById(R.id.maxrep_60);
tvTableLbs[9] =(TextView)this.findViewById(R.id.maxrep_55);
tvTableLbs[10] =(TextView)this.findViewById(R.id.maxrep_50);
tvTableLbs[11] =(TextView)this.findViewById(R.id.maxrep_45);
tvTableLbs[12] =(TextView)this.findViewById(R.id.maxrep_40);
tvTableLbs[13] =(TextView)this.findViewById(R.id.maxrep_35);
tvTableLbs[14] =(TextView)this.findViewById(R.id.maxrep_30);
}
//ret One max rep or -1
private void initData()
{
initTextViewArray();
// DBAdapter dbAdapter = DBAdapter.getAdapter(this.getApplicationContext());
//
// User user = User.getUser();
//
// int[] data = dbAdapter.getOneMaxRep(exId, user.getId());
//
//
// if(data == null)
// {
// setWheelsVals(20, 7);
// return -1;
// }
//set adapters
setWheelsVals(0,0);
//return data[0];
}
private void setWheelsVals(final int wt, final int reps)
{
this.runOnUiThread(new Runnable(){
@Override
public void run() {
setWheelsValsUI(wt, reps);
}
});
}
private void setWheelsValsUI(final int wt, final int reps)
{
WheelView wheelWeight = (WheelView)this.findViewById(R.id.maxrep_wheel_weight);
WheelView wheelReps = (WheelView)this.findViewById(R.id.maxrep_wheel_reps);
if(wt >0)
{
final int ind = WeightLbAdapter.getItemIndexFromValue(wt);
wheelWeight.setCurrentItem(ind);
}
else
{
wheelWeight.setCurrentItem(10);
}
if(reps > 0) wheelReps.setCurrentItem(reps-1);
}
private void drawRepsTable(final double maxRep)
{
this.runOnUiThread(new Runnable(){
@Override
public void run() {
drawTable(maxRep);
}
});
}
private void showRepsTable(final boolean show)
{
this.runOnUiThread(new Runnable(){
@Override
public void run() {
showTable(show);
}
});
}
private void showTable(final boolean show)
{
View tb = this.findViewById(R.id.maxrep_table);
if(show) tb.setVisibility(View.VISIBLE);
else tb.setVisibility(View.GONE);
}
private void drawTable(final double maxRepVal)
{
DecimalFormat df = new DecimalFormat("#.00");
TextView tv = (TextView)this.findViewById(R.id.maxrep_number);
tv.setText(df.format(maxRepVal));
if(tvTableLbs == null) return;
final int cnt = tvTableLbs.length;
double coeff = 1.0;
final double diff = 0.05;
for(int i=0; i < cnt; i++)
{
tvTableLbs[i].setText(df.format(coeff*maxRepVal));
coeff -=diff;
}
}
//TODO - define
private void processInitDone(final boolean res)
{
if(!res)
{
//no max rep in db - will calculate
// dlgMsg = "Error accessing database.";
// this.showDialog(Common.DLG_ERROR);
}
}
/////////////////////// TASKS
private class SaveTask extends AsyncTask<String, Void, long[]>
{
private ProgressDialog dialog = new ProgressDialog(MaxrepActivity.this);
// can use UI thread here
protected void onPreExecute() {
this.dialog.setMessage(getString(R.string.processing));
this.dialog.show();
}
@Override
protected long[] doInBackground(String... params) {
final boolean ok = calculate();
return (ok)? new long[]{1L} : new long[]{0L};
}
protected void onPostExecute(final long[] result) {
try
{
if(dialog != null)
{
dialog.dismiss();
dialog = null;
}
}
catch(Exception e)
{
//nothing
}
if(result != null && result.length >0)
{
MaxrepActivity.this.processSaveDone((result[0] == 1)? true : false);
}
}
}
private class InitTask extends AsyncTask<String, Void, long[]>
{
private ProgressDialog dialog = new ProgressDialog(MaxrepActivity.this);
// can use UI thread here
protected void onPreExecute() {
this.dialog.setMessage(getString(R.string.processing));
this.dialog.show();
}
@Override
protected long[] doInBackground(String... arg0) {
long[] res = new long[1];
// int maxRep = initData();
// if(maxRep >0)
// {
// res[0]=1;
// drawRepsTable(maxRep);
// showRepsTable(true);
// }
// else
// {
// res[0]=0;
// showRepsTable(false);
// }
initData();
showRepsTable(false);
return res;
}
protected void onPostExecute(final long[] result) {
try
{
if(dialog != null)
{
dialog.dismiss();
dialog = null;
}
}
catch(Exception e)
{
//nothing
}
if(result != null && result.length >0)
{
MaxrepActivity.this.processInitDone((result[0] == 1)? true : false);
}
}
}
@Override
public int getId() {
return Common.ACT_MaxrepActivity;
}
}
/*
TableLayout tb = (TableLayout)this.findViewById(R.id.maxrep_table);
tb.removeAllViews();
TableRow row;
TextView tv;
LinearLayout cell;
TableLayout.LayoutParams tableRowParams;
LinearLayout.LayoutParams tvParams;
tableRowParams = new TableLayout.LayoutParams (TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
tableRowParams.setMargins(1,1,1,1);
row = new TableRow (this);
row.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
row.setBackgroundResource(R.color.txt_light);
cell = new LinearLayout(this);
cell.setLayoutParams(tableRowParams);
cell.setBackgroundResource(R.color.txt_light);
tvParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
tvParams.setMargins(1, 1, 1, 1);
tv = new TextView(this);
tv.setLayoutParams(tvParams);
tv.setBackgroundResource(R.color.bgcolor);
tv.setSingleLine(true);
tv.setMaxLines(1);
tv.setPadding(6, 6, 6, 6);
tv.setText("95% 1 Max");
cell.addView(tv);
tv = new TextView(this);
tv.setLayoutParams(tvParams);
tv.setBackgroundResource(R.color.bgcolor);
tv.setSingleLine(true);
tv.setMaxLines(1);
tv.setPadding(6, 6, 6, 6);
tv.setText("500");
cell.addView(tv);
row.addView(cell);
tb.addView(row);
*/ | [
"Olga.Borissova@kantar.com"
] | Olga.Borissova@kantar.com |
4663d9c8ac4701208fd88b149b3f41519bf4c7db | a6d709feba31a38755c71a54995c83c86251cced | /app/src/main/java/com/rappsantiago/weighttracker/progress/StatisticsFragment.java | 1523c048e2e817802861ab1ebdc0b407f4f74e17 | [
"Apache-2.0"
] | permissive | rappsantiago28/weight-tracker | d998b5e76cae8dba7a4c5ac6591eefc887b4e8e3 | 7b7cd3b2f9d6dda5c6bc325623ebaa2d03cece94 | refs/heads/master | 2021-01-21T04:50:44.700064 | 2016-07-23T09:43:36 | 2016-07-23T09:43:36 | 53,789,590 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,915 | java | /**
* Copyright 2016 Ralph Kristofelle A. Santiago
*
* 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.rappsantiago.weighttracker.progress;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.rappsantiago.weighttracker.R;
import com.rappsantiago.weighttracker.provider.DbConstants;
import com.rappsantiago.weighttracker.provider.WeightTrackerContract;
import com.rappsantiago.weighttracker.util.DisplayUtil;
import com.rappsantiago.weighttracker.util.PreferenceUtil;
import com.rappsantiago.weighttracker.util.Util;
import java.util.ArrayList;
/**
* Created by rappsantiago28 on 3/26/16.
*/
public class StatisticsFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
private LineChart mLineChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_statistics, container, false);
mLineChart = (LineChart) view.findViewById(R.id.line_chart);
mLineChart.setNoDataTextDescription(getString(R.string.no_data_to_show));
mLineChart.setDescription("");
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getLoaderManager().initLoader(0, null, this);
}
@Override
public void onResume() {
super.onResume();
getLoaderManager().restartLoader(0, null, this);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new CursorLoader(getContext(), WeightTrackerContract.Progress.CONTENT_URI,
DbConstants.COLUMNS_PROGRESS, null, null, WeightTrackerContract.Progress.COL_TIMESTAMP + " ASC");
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (null != data && 0 < data.getCount()) {
ArrayList<Entry> entries = new ArrayList<>();
ArrayList<String> labels = new ArrayList<>();
int dataIdx = 0;
String weightUnit = PreferenceUtil.getWeightUnit(getActivity());
while (data.moveToNext()) {
float weight = data.getFloat(DbConstants.IDX_PROGRESS_WEIGHT);
long dateInMillis = data.getLong(DbConstants.IDX_PROGRESS_TIMESTAMP);
switch (weightUnit) {
case WeightTrackerContract.Profile.WEIGHT_UNIT_KILOGRAMS:
entries.add(new Entry(weight, dataIdx++));
break;
case WeightTrackerContract.Profile.WEIGHT_UNIT_POUNDS:
entries.add(new Entry((float) Util.kilogramsToPounds(weight), dataIdx++));
break;
default:
throw new IllegalArgumentException();
}
labels.add(DisplayUtil.getReadableDate(dateInMillis));
}
String legend = "";
switch (weightUnit) {
case WeightTrackerContract.Profile.WEIGHT_UNIT_KILOGRAMS:
legend = getString(R.string.weight_in_kilograms);
break;
case WeightTrackerContract.Profile.WEIGHT_UNIT_POUNDS:
legend = getString(R.string.weight_in_pounds);
break;
default:
throw new IllegalArgumentException();
}
LineDataSet weightDataSet = new LineDataSet(entries, legend);
weightDataSet.setDrawCubic(true);
LineData lineData = new LineData(labels, weightDataSet);
mLineChart.setData(lineData);
mLineChart.invalidate();
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
mLineChart.setData(null);
mLineChart.invalidate();
}
}
| [
"rappsantiago28@gmail.com"
] | rappsantiago28@gmail.com |
58c56e0d0a3f1051bfaaa540816d99d9c6884019 | 0068236c12bf7b6b2916cab55c2ef94da3c9c185 | /java/cmpsd/farmingutils/renderer/Render_Kakashi.java | cc1a60b189f25b4a1a2826c1241fd9e1e0c2a1c9 | [] | no_license | ChumoriPoseidon/FarmingUtils | b14efafb6d6e62a31ede11581054beeed7963553 | 7bc8e82265746e7ffba1a8899a4ccc9ce0f56741 | refs/heads/master | 2020-06-13T09:16:38.563913 | 2019-08-16T15:16:49 | 2019-08-16T15:16:49 | 194,611,333 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,222 | java | package cmpsd.farmingutils.renderer;
import cmpsd.farmingutils.Reference;
import cmpsd.farmingutils.entity.Entity_Kakashi;
import cmpsd.farmingutils.renderer.model.Model_Kakashi;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class Render_Kakashi implements IRenderFactory<Entity_Kakashi> {
public Render<? super Entity_Kakashi> createRenderFor(RenderManager manager){
return new CustomRender(manager);
}
private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.MODID, "textures/entities/mob/kakashi_64x32.png");
private class CustomRender<T extends EntityLiving> extends RenderLiving<T> {
public CustomRender(RenderManager managerIn) {
super(managerIn, new Model_Kakashi(), 0.5F);
}
@Override
protected ResourceLocation getEntityTexture(T entity) {
return TEXTURE;
}
}
}
| [
"poseidon7525@gmail.com"
] | poseidon7525@gmail.com |
4b11896b0240e9028a51873efea3afdaca6b531b | 223e836ecc7c1186bf73f2515bea766804911cfb | /app/src/main/java/com/room/mokeys/maps/ui/maps/MapsFragment.java | 0f81e64b4cda395408a31c16d70c19f9ee563f24 | [
"MIT"
] | permissive | yhh5158/mokeys | f0966d96154227ee1c8acfae5db0976516eecf41 | fa1f3289333f1fb2b3eedfff943bf656720fea65 | refs/heads/master | 2020-03-21T00:06:53.466701 | 2018-06-19T10:59:45 | 2018-06-19T10:59:45 | 137,878,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 67,222 | java | package com.room.mokeys.maps.ui.maps;
import android.Manifest;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps2d.AMap;
import com.amap.api.maps2d.CameraUpdateFactory;
import com.amap.api.maps2d.LocationSource;
import com.amap.api.maps2d.MapView;
import com.amap.api.maps2d.model.BitmapDescriptor;
import com.amap.api.maps2d.model.BitmapDescriptorFactory;
import com.amap.api.maps2d.model.CameraPosition;
import com.amap.api.maps2d.model.LatLng;
import com.amap.api.maps2d.model.Marker;
import com.amap.api.maps2d.model.MarkerOptions;
import com.amap.api.maps2d.model.MyLocationStyle;
import com.amap.api.maps2d.overlay.PoiOverlay;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeQuery;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.amap.api.services.help.Inputtips;
import com.amap.api.services.help.InputtipsQuery;
import com.amap.api.services.help.Tip;
import com.room.mokeys.App;
import com.room.mokeys.R;
import com.room.mokeys.kit.Constants;
import com.room.mokeys.maps.beans.BJCamera;
import com.room.mokeys.maps.beans.PoiSearchTip;
import com.room.mokeys.maps.presenters.SearchMapsPresenter;
import com.room.mokeys.maps.presenters.iviews.ISearchMapsView;
import com.room.mokeys.maps.ui.anim.AnimEndListener;
import com.room.mokeys.maps.ui.anim.ViewAnimUtils;
import com.room.mokeys.maps.ui.poi.PoiSearchAdapter;
import com.room.mokeys.maps.utils.ToastUtil;
import com.room.mokeys.maps.zxing.ScanDoorActivity;
import com.room.mokeys.model.LoginAccessTokenInfo;
import com.room.mokeys.model.MokeysContractInfo;
import com.room.mokeys.model.MokeysEstateInfo;
import com.room.mokeys.model.MokeysListModel;
import com.room.mokeys.model.MokeysReservesInfo;
import com.room.mokeys.model.MokeysUserInfo;
import com.room.mokeys.net.Api;
import com.room.mokeys.pay.PayMainActivity;
import com.room.mokeys.ui.ActivityAuthenticaition;
import com.room.mokeys.ui.ActivityRoomResult;
import com.room.mokeys.ui.MClearEditText;
import com.room.mokeys.ui.PhoneLoginActivity;
import com.room.mokeys.ui.UserCenterActivity;
import com.room.mokeys.ui.contractroom.ContractRoomAcitivity;
import com.room.mokeys.ui.neighbourhoodroom.NeighbourhoodRoomAcitivity;
import com.room.mokeys.ui.reserveroom.ReserverRoomAcitivity;
import com.room.mokeys.widget.BitmapUtils;
import com.uuch.adlibrary.AdConstant;
import com.uuch.adlibrary.AdManager;
import com.uuch.adlibrary.AnimDialogUtils;
import com.uuch.adlibrary.bean.AdInfo;
import com.uuch.adlibrary.transformer.DepthPageTransformer;
import com.uuzuche.lib_zxing.activity.CodeUtils;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import cn.droidlover.xdroidmvp.kit.SPUtil;
import cn.droidlover.xdroidmvp.mvp.XFragment;
import cn.droidlover.xdroidmvp.net.ApiSubscriber;
import cn.droidlover.xdroidmvp.net.NetError;
import cn.droidlover.xdroidmvp.net.XApi;
import io.reactivex.functions.Consumer;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link MapsFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link MapsFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MapsFragment extends XFragment implements ISearchMapsView, OnKeyListener,Inputtips.InputtipsListener
,LocationSource,
AMapLocationListener,AMap.OnMapTouchListener,AMap.OnMapClickListener
,GeocodeSearch.OnGeocodeSearchListener
,AMap.OnCameraChangeListener
,AMap.OnMarkerClickListener{
private static final boolean DEBUG = false;
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private static final int REQUEST_SCAN = 1000;
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private boolean mLandscape = false;
private float mOri = 0;
private AMap aMap;
@BindView(R.id.map)
MapView mapView;
private SensorManager mSensorManager;
private MySensorEventListener mEventListener = new MySensorEventListener();
private float mDevicesDirection = 0f;
@BindView((R.id.ori_compass))
ImageButton mCompass;
@BindView(R.id.my_location_btn)
ImageButton mMyLocation;
@BindView(R.id.map_custom)
ImageButton mMapCustom;
@BindView(R.id.poi_search_in_maps)
MClearEditText mSearchEditText;
@BindView(R.id.tip_notlogin)
TextView mTipNotlogin;
@BindView(R.id.tip_reserves)
TextView mTipReserves;
@BindView(R.id.tip_contract)
TextView mTipContract;
private SearchMapsPresenter mSearchMapsPresenter;
private OnFragmentInteractionListener mListener1;
@BindView(R.id.search_result_list_view)
ListView mListView;
private PoiSearchAdapter mPoiSearchAdapter;
private SearchViewHelper mSearchViewHelper;
// float window
@BindView(R.id.search_float_rl)
RelativeLayout mSearchFloatWindow;
@BindView(R.id.search_result_title)
TextView mSearchPoiTitle;
@BindView(R.id.search_poi_summary)
TextView mSearchPoiSummary;
@BindView(R.id.search_poi_tel)
TextView mSearchPoiTel;
@BindView(R.id.maps_drive_line_btn)
ImageButton mLineBtn;
@BindView(R.id.title_text)
TextView tv_title;
@BindView(R.id.scan_lin)
LinearLayout lin_scan;
@BindView(R.id.left_drawer_switch)
ImageButton mDrawerSwitch ;
@BindView(R.id.cancel_search)
ImageButton mSearchBtn ;
// progress dialog
private ProgressDialog mSearchProgressDialog;
private GeocodeSearch mGeocodeSearch ;
private PoiItem mPoiItem;
private ArrayList<MokeysReservesInfo> mReservesList = new ArrayList<>();
private ArrayList<MokeysContractInfo> mContractsList = new ArrayList<>();
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment MapsFragment.
*/
// TODO: Rename and change types and number of parameters
@Override
public void onGetInputtips(List<Tip> tipList, int rCode) {
if (rCode == 1000 && tipList != null) {// 正确返回
List<PoiSearchTip> tips = new ArrayList<>();
// MapsApplication.getDaoSession().getPoiSearchTipDao().deleteAll();
for (Tip tip : tipList) {
PoiSearchTip mtip = new PoiSearchTip(tip.getName(), tip.getDistrict(), tip.getAdcode());
// MapsApplication.getDaoSession().getPoiSearchTipDao().insert(mtip);
tips.add(mtip);
}
List<String> listString = new ArrayList<>();
for (int i = 0; i < tipList.size(); i++) {
listString.add(tipList.get(i).getName());
}
mPoiSearchAdapter.addResultTips(tips);
if (mListView.getVisibility() == View.GONE){
mListView.setVisibility(View.VISIBLE);
}
}
}
public AMap getGaoDeMap() {
return aMap;
}
public ImageButton getMyLocationBtn() {
return mMyLocation;
}
public float getDevicesDirection() {
return mDevicesDirection;
}
private ScanOnclickListener mScanLinstener;
public interface ScanOnclickListener{
public void goScan();
public void goLogin();
}
public void setScanLinsterner(ScanOnclickListener listener){
mScanLinstener = listener;
}
/**
* 初始化
*/
private void init() {
if (aMap == null) {
aMap = mapView.getMap();
}
setMaps();
}
@Override
public void onResume() {
super.onResume();
mapView.onResume();
Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
Sensor mPSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(mEventListener, mSensor, SensorManager.SENSOR_DELAY_UI);
mSensorManager.registerListener(mEventListener,mPSensor, SensorManager.SENSOR_DELAY_UI);
getUserInfo((String)SPUtil.get(context,Constants.MOKEYS_A,""));
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mapView.onSaveInstanceState(outState);
}
@Override
public void onDestroy() {
super.onDestroy();
// mMapsModule.onDestroy();
mapView.onDestroy();
}
@Override
public void onPause() {
super.onPause();
mapView.onPause();
deactivate();
mSensorManager.unregisterListener(mEventListener);
// mMapsModule.deactivate();
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener1 != null) {
mListener1.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener1 = (OnFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener1 = null;
}
// public void onLeftDrawerViewClick(int id){
// if (id == R.id.left_drawer_satellite){
// int currentStyle = SettingUtils.readCurrentMapsStyle();
//
// int newStyle = AMap.MAP_TYPE_NORMAL;
//
// if (currentStyle == AMap.MAP_TYPE_NORMAL){
// newStyle = AMap.MAP_TYPE_SATELLITE;
// } else{
// newStyle = AMap.MAP_TYPE_NORMAL;
// }
//
// SettingUtils.writeCurrentMapsStyle(newStyle);
//
// mMapsModule.changeMapStyle(newStyle);
//
// } else if (id == R.id.left_drawer_camera){
// int cameraSwitch = SettingUtils.readCurrentCameraState();
// if (cameraSwitch == SettingUtils.SWITCH_ON){
// SettingUtils.writeCurrentCameraState(SettingUtils.SWITCH_OFF);
// mMapsModule.removeCameras();
// } else {
// SettingUtils.writeCurrentCameraState(SettingUtils.SWITCH_ON);
// mMapsModule.loadCameras();
// }
// }
// }
private static boolean loginStatus = false;
@OnClick({
R.id.left_drawer_switch,R.id.cancel_search,R.id.poi_search_in_maps,
R.id.my_location_btn,R.id.scan_lin,R.id.my_location_refresh,
R.id.tip_notlogin,R.id.tip_reserves,R.id.tip_contract,
R.id.map_custom})
public void onClick(View view){
switch (view.getId()) {
case R.id.left_drawer_switch:
if (mSearchViewHelper.isInSearch()) {
mSearchMapsPresenter.exitSearch();
} else {
{
Intent i = new Intent(context, UserCenterActivity.class);
startActivity(i);
}
// mSearchMapsPresenter.openDrawer();
}
break;
case R.id.cancel_search:
// if (mSearchFloatWindow.getVisibility() == View.VISIBLE){
if (currentSearchedFinished){
mSearchMapsPresenter.exitSearch();
} else{
mSearchEditText.setVisibility(View.VISIBLE);
lin_scan.setVisibility(View.GONE);
mTipReserves.setVisibility(View.GONE);
mTipContract.setVisibility(View.GONE);
mTipNotlogin.setVisibility(View.GONE);
mMapCustom.setVisibility(View.GONE);
tv_title.setVisibility(View.GONE);
if (mSearchViewHelper.isInSearch()) {
String mSearchText = mSearchEditText.getText().toString();
if (TextUtils.isEmpty(mSearchText)){
Toast.makeText(getActivity().getApplicationContext(),R.string.search_no_text, Toast.LENGTH_SHORT).show();
return;
}
mSearchMapsPresenter.searchPoi(getActivity().getApplicationContext(),mSearchText , "");
} else {
mSearchMapsPresenter.enterSearch();
}
}
break;
case R.id.poi_search_in_maps:
// if (mSearchFloatWindow.getVisibility() == View.VISIBLE){
if (currentSearchedFinished){
mSearchMapsPresenter.enterSearch();
} else{
if (!mSearchViewHelper.isInSearch) {
mSearchMapsPresenter.enterSearch();
}
}
break;
case R.id.my_location_btn:
// mMapsPresenter.changeMyLocationMode();
if(mLocation != null) {
CameraPosition newCP = new CameraPosition(new LatLng(mLocation.getLatitude(), mLocation.getLongitude()), 18, 0, 0);
aMap.animateCamera(CameraUpdateFactory.newCameraPosition(newCP), null);
// aMap.moveCamera(CameraUpdateFactory.zoomTo(18));
getMyLocationBtn().setImageResource(R.mipmap.ic_qu_direction_mylocation);
mIsEnableMyLocation = true;
}
break;
case R.id.scan_lin:
if(!Constants.isLogin(context)){
showloginAd(true);
}else
{
if(!(boolean)SPUtil.get(context,Constants.MOKEYS_LOGIN_TIP,false)){
AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.MyAlertDialogStyle);
builder.setTitle("收费提示");
// builder.setMessage(getString(R.string.permission_text));
LinearLayout linearLayout=(LinearLayout)getActivity().getLayoutInflater().inflate(R.layout.alertdialog_content, null);
TextView text = (TextView) linearLayout.findViewById(R.id.alert_message);
text.setText(getString(R.string.alert_dialog_text));
CheckBox mCheckBox = (CheckBox)linearLayout.findViewById(R.id.alert_nomore);
mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
SPUtil.put(context,Constants.MOKEYS_LOGIN_TIP,b);
}
});
builder.setView(linearLayout);
builder.setNegativeButton("取消",null);
builder.setPositiveButton("好", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
// Uri uri = Uri.fromParts("package", context.getPackageName(), null);
// intent.setData(uri);
// startActivityForResult(intent, 300);
Intent i2 = new Intent(context, ScanDoorActivity.class);
startActivityForResult(i2, REQUEST_SCAN);
dialogInterface.dismiss();
}
});
builder.show();
}else {
Intent i = new Intent(context, ScanDoorActivity.class);
startActivityForResult(i, REQUEST_SCAN);
}
}
break;
case R.id.my_location_refresh:
getvDelegate().toastShort("刷新房子");
if(mLocation!=null) {
getEstateList((String) SPUtil.get(context, Constants.MOKEYS_A, ""), mLocation.getLongitude(), mLocation.getLatitude());
refreshRoom();
}else{
getvDelegate().toastShort("定位失败");
}
break;
case R.id.map_custom:
getvDelegate().toastShort("点击客服");
break;
case R.id.tip_notlogin:
String mStatus = (String)SPUtil.get(context,Constants.MOKEYS_USER_STATUS,"");
if("login".equals(mStatus)){
Intent mIntent = new Intent();
mIntent.setClass(context, PayMainActivity.class);
mIntent.putExtra("title","充值押金");
mIntent.putExtra("money","500");
startActivity(mIntent);
}else if("authentication".equals(mStatus)){
Intent mIntent = new Intent(context,ActivityAuthenticaition.class);
mIntent.putExtra(Constants.MOKEYS_CHECK_ALIAUTH,true);
startActivity(mIntent);
}else{
Intent mIntent = new Intent(context,PhoneLoginActivity.class);
startActivity(mIntent);
}
break;
case R.id.tip_reserves:
Intent intent = new Intent(context, ReserverRoomAcitivity.class);
startActivity(intent);
break;
case R.id.tip_contract:
Intent intent1 = new Intent(context, ContractRoomAcitivity.class);
startActivity(intent1);
break;
default:
break;
}
}
private void getEstateList(String token,double x,double y){
Api.getMokeysEstateListService().getData(token,x,y)
.compose(XApi.<MokeysListModel<MokeysEstateInfo>>getApiTransformer())
.compose(XApi.<MokeysListModel<MokeysEstateInfo>>getScheduler())
.compose(this.<MokeysListModel<MokeysEstateInfo>>bindToLifecycle())
.subscribe(new ApiSubscriber<MokeysListModel<MokeysEstateInfo>>() {
@Override
protected void onFail(NetError error) {
Log.d("yuhh","onFail!!!" + error);
}
@Override
public void onNext(MokeysListModel<MokeysEstateInfo> gankResults) {
Log.d("yuhh","getUserInfo code = " +gankResults.getCode());
if(gankResults.getCode()==0 && gankResults.getMsg().equals("success")) {
new addMarkersTask().execute(gankResults.getData());
}else{
// getvDelegate().toastShort(gankResults.getMsg());
Constants.handErrorCode(gankResults.getCode(),context);
}
}
});
}
// public void getAccesstokenInfo(String r) {
// Api.getMokeysAccessTokenInfoService().getData(r)
// .compose(XApi.<MokeysListModel<LoginAccessTokenInfo>>getApiTransformer())
// .compose(XApi.<MokeysListModel<LoginAccessTokenInfo>>getScheduler())
// .compose(this.<MokeysListModel<LoginAccessTokenInfo>>bindToLifecycle())
// .subscribe(new ApiSubscriber<MokeysListModel<LoginAccessTokenInfo>>() {
// @Override
// protected void onFail(NetError error) {
//
// Log.d("yuhh","onFail!!!" + error);
// }
// @Override
// public void onNext(MokeysListModel<LoginAccessTokenInfo> gankResults) {
// Log.d("yuhh","getUserInfo code = " +gankResults.getCode());
// if(gankResults.getCode()==0 && gankResults.getMsg().equals("success")) {
//// SPUtil.put(context, Constants.MOKEYS_R,gankResults.getData().getR());
// SPUtil.put(context, Constants.MOKEYS_A,gankResults.getData().get(0).getA());
// getvDelegate().toastShort("获取accesstoken成功");
// }else{
// getvDelegate().toastShort(gankResults.getMsg());
// }
// }
// });
// }
private void refreshRoom(){
Animation animation = AnimationUtils.loadAnimation(context, R.anim.rotate);
mSearchViewHelper.myRefreshView.startAnimation(animation);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mSearchViewHelper.myRefreshView.setVisibility(View.GONE);
startToRecordTime();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
public int num = 0;
private void startToRecordTime(){
new Thread() {
@Override
public void run() {
num = 5;
while (num > 0) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
num--;
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
mSearchViewHelper.myRefreshView.setVisibility(View.VISIBLE);
}
});
}
}.start();
}
public boolean isInSearch(){
return mSearchViewHelper.isInSearch();
}
// DrawerLayout state
// @Override
// public void onDrawerSlide(View drawerView, float slideOffset) {
//
// }
//
// @Override
// public void onDrawerOpened(View drawerView) {
//
// }
//
// @Override
// public void onDrawerClosed(View drawerView) {
//
// }
//
// @Override
// public void onDrawerStateChanged(int newState) {
//
// }
//
// @Override
// public void openDrawer() {
// ((MapsMainActivity) getActivity()).openLeftDrawer();
// }
//
// @Override
// public void closeDrawer() {
// ((MapsMainActivity) getActivity()).closeLeftDrawer();
// }
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER) {
hideKeyboard(mSearchEditText);
mSearchMapsPresenter.searchPoi(getActivity().getApplicationContext(), mSearchEditText.getText().toString(), "");
return true;
}
return false;
}
@Override
public void onMapClick(LatLng latLng) {
if(isInSearch()) {
LatLonPoint mLatLonPoint = new LatLonPoint(latLng.latitude, latLng.longitude);
RegeocodeQuery query = new RegeocodeQuery(mLatLonPoint, 200, GeocodeSearch.AMAP);
mGeocodeSearch.getFromLocationAsyn(query);
}
}
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int rCode) {
String formatAddress = regeocodeResult.getRegeocodeAddress().getFormatAddress();
Log.e("yhh", "formatAddress:" + formatAddress);
Log.e("yhh", "rCode:" + rCode);
String msg = "是否将"+formatAddress+"加入到可教学区域?";
// DialogUtil.showAlertOkCancel(getActivity(), formatAddress, new MyCallback() {
// @Override
// public void onCallback(Object data) {
//
// }
// });
}
@Override
public void onGeocodeSearched(GeocodeResult geocodeResult, int rCode) {
String name = geocodeResult.getGeocodeQuery().getLocationName();
// Log.d("yhh","address name = " +name);
}
@Override
public void onCameraChange(CameraPosition cameraPosition) {
// Log.d("yhh","onCameraChange.latitude= " + cameraPosition.target.latitude+ " mLatLng.longitude = "+cameraPosition.target.longitude);
}
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
getEstateList((String) SPUtil.get(context, Constants.MOKEYS_A, ""), cameraPosition.target.longitude, cameraPosition.target.latitude);
Log.d("yhh","onCameraChangeFinish = " + cameraPosition.target.latitude+ " mLatLng.longitude = "+cameraPosition.target.longitude);
RegeocodeQuery query = new RegeocodeQuery(new LatLonPoint(cameraPosition.target.latitude,cameraPosition.target.longitude), 200, GeocodeSearch.AMAP);
mGeocodeSearch.getFromLocationAsyn(query);
}
@Override
public boolean onMarkerClick(Marker marker) {
Log.d("yhh","onMarkerClick!!!");
if(Constants.isLogin(context)) {
double longitude = marker.getPosition().longitude;
double latitude = marker.getPosition().latitude;
Intent mIntent = new Intent(getActivity(), NeighbourhoodRoomAcitivity.class);
mIntent.putExtra("x", longitude);
mIntent.putExtra("y", latitude);
startActivity(mIntent);
}else{
getvDelegate().toastShort(getString(R.string.notlogin_toast));
}
return true;
}
@Override
public void initData(Bundle savedInstanceState) {
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
mLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
mSensorManager = (SensorManager) getActivity().getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
mSearchMapsPresenter = new SearchMapsPresenter(MapsFragment.this);
mPoiSearchAdapter = new PoiSearchAdapter(getActivity().getApplicationContext());
mapView.onCreate(savedInstanceState);// 此方法必须重写
init();
mSearchViewHelper = new SearchViewHelper(getRootView());
mSearchEditText.setOnKeyListener(this);
mSearchEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
String newText = charSequence.toString().trim();
InputtipsQuery inputquery = new InputtipsQuery(newText,"");
Inputtips inputTips = new Inputtips(getActivity().getApplicationContext(), inputquery);
inputTips.setInputtipsListener(MapsFragment.this);
inputTips.requestInputtipsAsyn();
// Inputtips inputTips = new Inputtips(getActivity().getApplicationContext(),
// new Inputtips.InputtipsListener() {
//
// @Override
// public void onGetInputtips(List<Tip> tipList, int rCode) {
//
// if (rCode == 0 && tipList != null) {// 正确返回
// List<PoiSearchTip> tips = new ArrayList<>();
//
//// MapsApplication.getDaoSession().getPoiSearchTipDao().deleteAll();
//
//
// for (Tip tip : tipList) {
//
// PoiSearchTip mtip = new PoiSearchTip(tip.getName(), tip.getDistrict(), tip.getAdcode());
//
//// MapsApplication.getDaoSession().getPoiSearchTipDao().insert(mtip);
// tips.add(mtip);
// }
//
// List<String> listString = new ArrayList<>();
//
// for (int i = 0; i < tipList.size(); i++) {
// listString.add(tipList.get(i).getName());
// }
//
// mPoiSearchAdapter.addResultTips(tips);
//
// if (mListView.getVisibility() == View.GONE){
// mListView.setVisibility(View.VISIBLE);
// }
// }
// }
// });
// try {
// inputTips.requestInputtips(newText, "");// 第一个参数表示提示关键字,第二个参数默认代表全国,也可以为城市区号
//
// } catch (AMapException e) {
// e.printStackTrace();
// }
}
@Override
public void afterTextChanged(Editable editable) {
}
});
// mListView = (ListView) view.findViewById(R.id.search_result_list_view);
mListView.setAdapter(mPoiSearchAdapter);
mListView.requestFocus();
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
hideKeyboard(mSearchEditText);
// stop follow mode
// mMapsModule.disableAutoLocation();
PoiSearchAdapter adapter = (PoiSearchAdapter) parent.getAdapter();
PoiSearchTip tip = (PoiSearchTip) adapter.getItem(position);
mSearchEditText.setText(tip.getName());
mSearchEditText.setSelection(mSearchEditText.getText().toString().length());
Log.d("Search_OnItemClick ", "" + tip.toString());
mSearchMapsPresenter.searchPoi(getActivity(), tip.getName(), tip.getAdcode());
}
});
// mSearchFloatWindow = (RelativeLayout) view.findViewById(R.id.search_float_rl);
// mSearchPoiTitle = (TextView) view.findViewById(R.id.search_result_title);
// mSearchPoiSummary = (TextView) view.findViewById(R.id.search_poi_summary);
// mLineBtn = (ImageButton) view.findViewById(R.id.maps_drive_line_btn);
// mSearchPoiTel = (TextView) view.findViewById(R.id.search_poi_tel);
initAdData();
getRxPermissions()
.request(Manifest.permission.CAMERA,Manifest.permission.ACCESS_COARSE_LOCATION)
.subscribe(new Consumer<Boolean>() {
@Override
public void accept(Boolean granted) throws Exception {
Log.d("yhh","granted = " +granted);
if (granted) {
//TODO 许可
} else {
//TODO 未许可
AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.MyAlertDialogStyle);
builder.setTitle("权限申请失败");
builder.setMessage(getString(R.string.permission_text));
builder.setNegativeButton("取消",null);
builder.setPositiveButton("好,去设置", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
intent.setData(uri);
startActivityForResult(intent, 300);
dialogInterface.dismiss();
}
});
builder.show();
return;
}
}
});
}
@Override
public int getLayoutId() {
return R.layout.fragment_maps;
}
@Override
public Object newP() {
return null;
}
// GeocodeSearch geocoderSearch = new GeocodeSearch(getActivity());
// geocoderSearch.setOnGeocodeSearchListener(new OnGeocodeSearchListener(){
//
// @Override
// public void onGeocodeSearched(GeocodeResult result, int rCode) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public void onRegeocodeSearched(RegeocodeResult result, int rCode) {
//
// String formatAddress = result.getRegeocodeAddress().getFormatAddress();
// Log.e("formatAddress", "formatAddress:"+formatAddress);
// Log.e("formatAddress", "rCode:"+rCode);
//
// }});
class SearchViewHelper {
View compassView;
View myLocationView;
View myRefreshView;
View searchMaskView;
ImageButton drawerSwitch;
EditText searchEditText;
ListView listView;
private View floatWindow;
private boolean isInSearch = false;
public boolean isInSearch() {
return isInSearch;
}
public SearchViewHelper(View rootView) {
compassView = rootView.findViewById(R.id.ori_compass);
myLocationView = rootView.findViewById(R.id.my_location_btn);
myRefreshView = rootView.findViewById(R.id.my_location_refresh);
searchMaskView = rootView.findViewById(R.id.search_mask);
drawerSwitch = (ImageButton) rootView.findViewById(R.id.left_drawer_switch);
searchEditText = (EditText) rootView.findViewById(R.id.poi_search_in_maps);
listView = (ListView) rootView.findViewById(R.id.search_result_list_view);
floatWindow = rootView.findViewById(R.id.search_float_rl);
}
public void enterSearch() {
isInSearch = true;
// floatWindow.setVisibility(View.GONE);
currentSearchedFinished = false;
compassView.setVisibility(View.GONE);
myLocationView.setVisibility(View.GONE);
myRefreshView.setVisibility(View.GONE);
if (listView.getAdapter().getCount() == 0){
// List<PoiSearchTip> tips = MapsApplication.getDaoSession().getPoiSearchTipDao().loadAll();
// if (tips.isEmpty()){
// listView.setVisibility(View.GONE);
// } else{
// mPoiSearchAdapter.addResultTips(tips);
// }
listView.setVisibility(View.GONE);
}
ViewAnimUtils.popupinWithInterpolator(searchMaskView, new AnimEndListener() {
@Override
public void onAnimEnd() {
searchMaskView.setVisibility(View.VISIBLE);
}
});
if (listView.getAdapter().getCount() > 0){
ViewAnimUtils.popupinWithInterpolator(listView, new AnimEndListener() {
@Override
public void onAnimEnd() {
listView.setVisibility(View.VISIBLE);
}
});
}
drawerSwitch.setImageResource(R.mipmap.ic_qu_appbar_back);
searchEditText.setCursorVisible(true);
showKeyboard(searchEditText);
}
public void exitSearch() {
isInSearch = false;
// floatWindow.setVisibility(View.GONE);
currentSearchedFinished = false;
if (searchMaskView.getVisibility() == View.VISIBLE){
ViewAnimUtils.popupoutWithInterpolator(searchMaskView, new AnimEndListener() {
@Override
public void onAnimEnd() {
searchMaskView.setVisibility(View.GONE);
}
});
}
if (listView.getVisibility() == View.VISIBLE){
ViewAnimUtils.popupoutWithInterpolator(listView, new AnimEndListener() {
@Override
public void onAnimEnd() {
listView.setVisibility(View.GONE);
//取消掉
compassView.setVisibility(View.GONE);
myLocationView.setVisibility(View.VISIBLE);
myRefreshView.setVisibility(View.VISIBLE);
}
});
} else{
//取消掉
compassView.setVisibility(View.GONE);
myLocationView.setVisibility(View.VISIBLE);
myRefreshView.setVisibility(View.VISIBLE);
}
drawerSwitch.setImageResource(R.mipmap.ic_qu_menu_grabber);
searchEditText.setText("");
searchEditText.setCursorVisible(true);
mSearchEditText.setVisibility(View.GONE);
tv_title.setVisibility(View.VISIBLE);
hideKeyboard(searchEditText);
}
public void showSuggestTips() {
isInSearch = true;
listView.clearAnimation();
// floatWindow.setVisibility(View.GONE);
currentSearchedFinished = false;
Log.d("yhh","listView.getVisibility() =" +listView.getVisibility());
listView.setVisibility(View.GONE);
Log.d("yhh","listView.getVisibility() =" +listView.getVisibility());
compassView.setVisibility(View.GONE);
myLocationView.setVisibility(View.GONE);
myRefreshView.setVisibility(View.GONE);
searchEditText.setCursorVisible(true);
searchMaskView.setVisibility(View.GONE);
drawerSwitch.setImageResource(R.mipmap.ic_qu_appbar_back);
}
}
private void hideKeyboard(View view) {
InputMethodManager manager = (InputMethodManager) getActivity().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
manager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
private void showKeyboard(View view) {
InputMethodManager manager = (InputMethodManager) getActivity().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
manager.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
@Override
public void enterSearch() {
mSearchViewHelper.enterSearch();
lin_scan.setVisibility(View.GONE);
mTipReserves.setVisibility(View.GONE);
mTipContract.setVisibility(View.GONE);
mTipNotlogin.setVisibility(View.GONE);
mMapCustom.setVisibility(View.GONE);
}
@Override
public void exitSearch() {
if (mPoiOverlay != null) {
mPoiOverlay.removeFromMap();
mPoiOverlay = null;
}
mSearchViewHelper.exitSearch();
lin_scan.setVisibility(View.VISIBLE);
// mTipReserves.setVisibility(View.VISIBLE);
// mTipContract.setVisibility(View.VISIBLE);
// mTipNotlogin.setVisibility(View.VISIBLE);
setContractReserverTip();
initLoginStatus();
mMapCustom.setVisibility(View.VISIBLE);
}
private PoiOverlay mPoiOverlay;
@Override
public void showSearchResult(List<PoiItem> poiItems) {
Log.d("yhh","showSearchResult");
if (poiItems == null || poiItems.isEmpty()){
ToastUtil.show(getActivity().getApplicationContext(), R.string.no_poi_search);
} else {
mSearchViewHelper.showSuggestTips();
if (mPoiOverlay != null) {
mPoiOverlay.removeFromMap();
mPoiOverlay = null;
}
PoiOverlay poiOverlay = new PoiOverlay(aMap, poiItems);
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
mPoiOverlay = poiOverlay;
mSearchMapsPresenter.showPoiFloatWindow(poiItems.get(0));
mPoiItem = poiItems.get(0);
// MarkerOptions markerOption = new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_camera_location))
// .position(new LatLng(mPoiItem.getLatLonPoint().getLatitude(),mPoiItem.getLatLonPoint().getLongitude()))
// .draggable(true);
// aMap.addMarker(markerOption);
aMap.moveCamera(
CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(mPoiItem.getLatLonPoint().getLatitude(),mPoiItem.getLatLonPoint().getLongitude()), 18, 30, 30)));
// aMap.clear();
// aMap.addMarker(new MarkerOptions().position(new LatLng(39.983456, 116.3154950))
// .icon(BitmapDescriptorFactory
// .defaultMarker(BitmapDescriptorFactory.HUE_RED)));
}
}
@Override
public void showSearchProgress() {
if (mSearchProgressDialog == null){
mSearchProgressDialog = new ProgressDialog(getActivity());
mSearchProgressDialog.setMessage(getResources().getString(R.string.search_message));
}
mSearchProgressDialog.show();
}
@Override
public void hideSearchProgress() {
mSearchProgressDialog.hide();
}
private boolean currentSearchedFinished = false;
@Override
public void showPoiFloatWindow(PoiItem poiItem) {
currentSearchedFinished = true;
// mSearchFloatWindow.setVisibility(View.VISIBLE);
//
// PoiItem item = poiItem;
//
//// if (DEBUG){
//// Log.d("showPoiFloatWindow adCode -" , poiItem.getAdCode());
//// Log.d("showPoiFloatWindow adName -" , poiItem.getAdName());
//// Log.d("showPoiFloatWindow CityCOde -" , poiItem.getCityCode());
//// Log.d("showPoiFloatWindow cityName -" , poiItem.getCityName());
//// Log.d("showPoiFloatWindow direction -" , poiItem.getDirection());
//// Log.d("showPoiFloatWindow email -" , poiItem.getEmail());
//// Log.d("showPoiFloatWindow poid -" , poiItem.getPoiId());
//// Log.d("showPoiFloatWindow postCode -" , poiItem.getPostcode());
//// Log.d("showPoiFloatWindow provinceCode -" , poiItem.getProvinceCode());
//// Log.d("showPoiFloatWindow provincename -" , poiItem.getProvinceName());
//// Log.d("showPoiFloatWindow snippet -" , poiItem.getSnippet());
//// Log.d("showPoiFloatWindow tel -" , poiItem.getTel());
//// Log.d("showPoiFloatWindow title -" , poiItem.getTitle());
//// Log.d("showPoiFloatWindow typedes -" , poiItem.getTypeDes());
//// Log.d("showPoiFloatWindow website -" , poiItem.getWebsite());
//// Log.d("showPoiFloatWindow distance -" , poiItem.getDistance() + "");
//// }
//
//
//
// mSearchPoiTitle.setText(poiItem.getTitle());
// String sum = "";
// if (!TextUtils.isEmpty(poiItem.getProvinceName())){
// sum += poiItem.getProvinceName();
// }
//
// if (!TextUtils.isEmpty(poiItem.getCityName())){
// sum += "-" + poiItem.getCityName();
// }
//
// if (!TextUtils.isEmpty(poiItem.getAdName())){
// sum += "-" + poiItem.getAdName();
// }
//
// if (!TextUtils.isEmpty(poiItem.getSnippet())){
// sum += "-" + poiItem.getSnippet();
// }
//
// mSearchPoiSummary.setText(sum);
// mSearchPoiTel.setText(poiItem.getTel());
// mLineBtn.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//// AMapNavi aMapNavi = AMapNavi.getInstance(getActivity().getApplicationContext());
//// ArrayList<NaviLatLng> start = new ArrayList<>();
//// start.add(new NaviLatLng(mMapsModule.getMyLocation().getLatitude(), mMapsModule.getMyLocation().getLongitude()));
////
//// ArrayList<NaviLatLng> end = new ArrayList<>();
//// end.add(new NaviLatLng(mPoiItem.getLatLonPoint().getLatitude(), mPoiItem.getLatLonPoint().getLongitude()));
////
//// aMapNavi.calculateDriveRoute(end, null, AMapNavi.DrivingDefault);
//
//// Intent intent = new Intent(getActivity(), NaviRouteActivity.class);
//// intent.putParcelableArrayListExtra(NaviRouteActivity.NAVI_ENDS, end);
//// intent.putParcelableArrayListExtra(NaviRouteActivity.NAVI_START, start);
//// getActivity().startActivity(intent);
// }
// });
//// mNaviBtn.setOnClickListener(new View.OnClickListener() {
//// @Override
//// public void onClick(View v) {
//// Intent intent = new Intent(getActivity(), NaviEmulatorActivity.class);
//// getActivity().startActivity(intent);
//// }
//// });
}
// DrawerLayout state
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
public void onFragmentInteraction(Uri uri);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mLandscape = (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
}
class MySensorEventListener implements SensorEventListener {
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
if (sensorEvent.sensor.getType() == Sensor.TYPE_ORIENTATION) {
float x = sensorEvent.values[SensorManager.DATA_X];
float fixedX = x;
if (mLandscape ){
if (mOri < 0) {
fixedX -= 90;
Log.d("onSensorChanged","Right" + x + " fixedX :" + fixedX);
} else {
fixedX += 90;
Log.d("onSensorChanged","Left " + x + " fixedX :" + fixedX);
}
}
if (Math.abs(fixedX - mDevicesDirection) > 2) {
// if (SettingUtils.readCurrentMyLocationMode() == 3){
if (false){
mCompass.setRotation(-fixedX);
} else{
mCompass.setRotation(0);
}
mDevicesDirection = fixedX;
// mMapsModule.onOrientationChanged(mDevicesDirection);
}
} else if (sensorEvent.sensor.getType() == Sensor.TYPE_ACCELEROMETER){
float x = sensorEvent.values[SensorManager.DATA_X];
float y = sensorEvent.values[SensorManager.DATA_Y];
float z = sensorEvent.values[SensorManager.DATA_Z];
mOri = x;
// Log.d("PSensor-onSensorChanged","" + x + " Ori :" + x);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
}
private OnLocationChangedListener mListener;
private AMapLocationClient mlocationClient;
private AMapLocationClientOption mLocationOption;
private AMapLocation mLocation;
private BitmapDescriptor mMyLocationIcon = BitmapDescriptorFactory.fromResource(R.mipmap.ic_mylocation);
private Marker marker;
private boolean mIsEnableMyLocation = true;
private boolean mIsChanged = false;
public void setMaps(){
mGeocodeSearch = new GeocodeSearch(getActivity());
mGeocodeSearch.setOnGeocodeSearchListener(this);
aMap.setOnMapTouchListener(this);
aMap.setOnMapClickListener(this);
aMap.setLocationSource(this);// 设置定位监听
aMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
aMap.getUiSettings().setZoomControlsEnabled(false);//设置缩放控件是否显示
aMap.setOnCameraChangeListener(this);
aMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
setupLocationStyle();//自定义蓝点
aMap.setOnMarkerClickListener(this);
aMap.moveCamera(CameraUpdateFactory.zoomTo(18));
// new addMarkersTask().execute();
}
private void setupLocationStyle(){
int STROKE_COLOR = Color.argb(180, 3, 145, 255);
int FILL_COLOR = Color.argb(10, 0, 0, 180);
// 自定义系统定位蓝点
MyLocationStyle myLocationStyle = new MyLocationStyle();
// 自定义定位蓝点图标
myLocationStyle.myLocationIcon(BitmapDescriptorFactory.
fromResource(R.mipmap.ic_mylocation));
// 自定义精度范围的圆形边框颜色
myLocationStyle.strokeColor(STROKE_COLOR);
//自定义精度范围的圆形边框宽度
myLocationStyle.strokeWidth(5);
// 设置圆形的填充颜色
myLocationStyle.radiusFillColor(FILL_COLOR);
// 将自定义的 myLocationStyle 对象添加到地图上
aMap.setMyLocationStyle(myLocationStyle);
}
// private void initPoint(){
// MyLocationStyle myLocationStyle;
// myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类
// myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。
// myLocationStyle.interval(2000); //设置连续定位模式下的定位间隔,只在连续定位模式下生效,单次定位模式下不会生效。单位为毫秒。
// aMap.setMyLocationStyle(myLocationStyle);//设置定位蓝点的Style
// }
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
// if (mListener != null && aMapLocation != null) {
//// if ((mLocation == null || (mLocation.getLatitude() != aMapLocation.getLatitude() || mLocation.getLongitude() != aMapLocation.getLongitude()))) {
// if(mLocation == null){
// Log.e("yhh", "onLocationChanged");
// mLocation = aMapLocation;
// if (mIsEnableMyLocation) {
// Log.e("yhh", "mIsEnableMyLocation =====" );
// LatLng latLng = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
// aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
//
// if (marker == null) {
// aMap.clear();
// MarkerOptions mMyLocationMarker = new MarkerOptions().anchor(0.5f, 0.5f).position(latLng).icon(mMyLocationIcon);
// marker = aMap.addMarker(mMyLocationMarker);
// } else {
// marker.setPosition(latLng);
// }
//// aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18));
// }
//
// }
// }
if (mListener != null && aMapLocation != null) {
Log.d("yhh","onLocationChanged aMapLocation.getLongitude() = " + aMapLocation.getLongitude() + " amapLocation.getLatitude()" + aMapLocation.getLatitude() + " aMapLocation.getErrorCode() = " +aMapLocation.getErrorCode());
if (aMapLocation != null
&& aMapLocation.getErrorCode() == 0) {
mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点
// CameraPosition newCP= new CameraPosition(new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude()),18, 0, 0);
// aMap.animateCamera(CameraUpdateFactory.newCameraPosition(newCP), null);
// aMap.moveCamera(CameraUpdateFactory.zoomTo(18));
mLocation = aMapLocation;
} else {
String errText = "定位失败," + aMapLocation.getErrorCode()+ ": " + aMapLocation.getErrorInfo();
Toast.makeText(getActivity(),errText,Toast.LENGTH_SHORT);
Log.e("yhh",errText);
// mLocationErrText.setVisibility(View.VISIBLE);
// mLocationErrText.setText(errText);
}
}
}
@Override
public void onTouch(MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_MOVE){
if (!mIsChanged){
mIsEnableMyLocation = false;
// mMapsPresenter.stopFollowMode();
getMyLocationBtn().setImageResource(R.mipmap.ic_qu_direction_mylocation_lost);
mIsChanged = true;
}
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP){
mIsChanged = false;
// LatLng mLatLng = aMap.getProjection().fromScreenLocation(new Point(mapView.getWidth()/2,mapView.getHeight()/2));
// Log.d("yhh","mLatLng.latitude= " + mLatLng.latitude+ " mLatLng.longitude = "+mLatLng.longitude);
}
}
/**
* 激活定位
*/
@Override
public void activate(OnLocationChangedListener listener) {
mListener = listener;
if (mlocationClient == null) {
mlocationClient = new AMapLocationClient(App.getContext());
mLocationOption = new AMapLocationClientOption();
//设置定位监听
mlocationClient.setLocationListener(this);
//设置为高精度定位模式
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//设置定位参数
mlocationClient.setLocationOption(mLocationOption);
// 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗,
// 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求
// 在定位结束后,在合适的生命周期调用onDestroy()方法
// 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
mlocationClient.startLocation();
}
}
/**
* 停止定位
*/
@Override
public void deactivate() {
mListener = null;
if (mlocationClient != null) {
mlocationClient.stopLocation();
mlocationClient.onDestroy();
}
mlocationClient = null;
}
// private void addMarkers(){
// ArrayList<MarkerOptions> markerOptionses = createMarkerOptions();
// for(int i = 0;i<markerOptionses.size() ;i++){
// aMap.addMarker(markerOptionses.get(i));
// }
// }
private ArrayList<MarkerOptions> createMarkerOptions(ArrayList<MokeysEstateInfo> list){
BitmapDescriptor mMarkerDesc ;
ArrayList<MarkerOptions> markerOptions = new ArrayList<>();
for(int i =0;i<list.size();i++){
if(list.get(i).getCount() > 99){
mMarkerDesc = BitmapDescriptorFactory.fromBitmap(BitmapUtils.getNumberBitmap(60,"99+"));
// mMarkerDesc = BitmapDescriptorFactory.fromBitmap(BitmapUtils.getCounterResources(context,"99+",60));
}else{
// mMarkerDesc = BitmapDescriptorFactory.fromBitmap(BitmapUtils.getNumberBitmap(60,list.get(i).getCount()+""));
mMarkerDesc = BitmapDescriptorFactory.fromBitmap(BitmapUtils.getCounterResources(context,list.get(i).getCount()+"",60));
}
LatLng latLng = new LatLng(list.get(i).getY(),list.get(i).getX());
MarkerOptions mo = new MarkerOptions().position(latLng).draggable(true).icon(mMarkerDesc);
markerOptions.add(mo);
}
// for (BJCamera cameraBean : cameraBeans) {
// LatLng latLng = new LatLng(cameraBean.getLatitude(), cameraBean.getLongtitude());
// MarkerOptions mo = new MarkerOptions().position(latLng).draggable(true).icon(mMarkerDesc);
// markerOptions.add(mo);
// }
return markerOptions;
}
private List<BJCamera> readCameras(){
List<BJCamera> mCameras = new ArrayList<BJCamera>();
try {
mCameras = App.getDaoSession().getBJCameraDao().queryBuilder().build().list();
return mCameras;
} catch (Exception e) {
e.printStackTrace();
}
return mCameras;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
Log.d("yhh","requestCode = " +requestCode);
switch (requestCode) {
case REQUEST_SCAN: //
if (resultCode == getActivity().RESULT_OK) {
if (null != data) {
Bundle bundle = data.getExtras();
if (bundle == null) {
return;
}
if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_SUCCESS) {
String result = bundle.getString(CodeUtils.RESULT_STRING);
Toast.makeText(context, "解析结果:" + result, Toast.LENGTH_LONG).show();
Intent mIntent = new Intent(context, ActivityRoomResult.class);
startActivity(mIntent);
} else if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_FAILED) {
Toast.makeText(context, "解析二维码失败", Toast.LENGTH_LONG).show();
}
}
}
break;
}
}
public class addMarkersTask extends
AsyncTask<ArrayList<MokeysEstateInfo>, Integer, List<MarkerOptions>> {
@Override
protected List<MarkerOptions> doInBackground(ArrayList<MokeysEstateInfo>... list) {
ArrayList<MarkerOptions> markerOptionses = createMarkerOptions(list[0]);
return markerOptionses;
}
@Override
protected void onPostExecute(List<MarkerOptions> result) {
for(int i = 0;i<result.size() ;i++){
aMap.addMarker(result.get(i));
}
}
}
/**
* 初始化数据
*/
private List<AdInfo> advList = null;
private List<AdInfo> advListLogin = null;
private void initAdData() {
advList = new ArrayList<>();
AdInfo adInfo = new AdInfo();
adInfo.setActivityImg("http://pay.mobilecinema.cn/upload/imgs/2017-05-24/csm_Rattle-Abschied_MR_b7dd4a730d.jpg");
advList.add(adInfo);
adInfo = new AdInfo();
adInfo.setActivityImg("http://pay.mobilecinema.cn/upload/imgs/2017-05-24/csm_Rattle-Abschied_MR_b7dd4a730d.jpg");
advList.add(adInfo);
advListLogin = new ArrayList<>();
advListLogin.add(adInfo);
}
private AdManager adManager;
private void showAd(){
adManager = new AdManager(getActivity(), advList);
adManager.setOverScreen(true)
.setPageTransformer(new DepthPageTransformer());
adManager.setOnLoginClickLinstener(new AnimDialogUtils.OnLoginClickListenner() {
@Override
public void goLogin() {
getvDelegate().toastShort("go to login");
}
});
adManager.setOnImageClickListener(new AdManager.OnImageClickListener() {
@Override
public void onImageClick(View view, AdInfo advInfo) {
getvDelegate().toastShort(advInfo.getActivityImg());
}
})
.setPadding(60)
.setWidthPerHeight(0.5f)
.showAdDialog(AdConstant.ANIM_UP_TO_DOWN);
}
private void showloginAd(boolean login){
adManager = new AdManager(getActivity(), advListLogin);
adManager.setOverScreen(true)
.setPageTransformer(new DepthPageTransformer());
adManager.setOnLoginClickLinstener(new AnimDialogUtils.OnLoginClickListenner() {
@Override
public void goLogin() {
getvDelegate().toastShort("go to login");
Intent mIntent = new Intent(context,PhoneLoginActivity.class);
startActivity(mIntent);
adManager.dismissAdDialog();
}
});
adManager.setOnImageClickListener(new AdManager.OnImageClickListener() {
@Override
public void onImageClick(View view, AdInfo advInfo) {
getvDelegate().toastShort(advInfo.getActivityImg());
}
})
.setPadding(60)
.setWidthPerHeight(0.5f)
.showAdDialog(AdConstant.ANIM_UP_TO_DOWN,login);
}
public AdManager getAdManager() {
return adManager;
}
public void setAdManager(AdManager adManager) {
this.adManager = adManager;
}
public void getUserInfo(String token) {
Api.getMokeysUserInfoService().getData(token)
.compose(XApi.<MokeysListModel<MokeysUserInfo>>getApiTransformer())
.compose(XApi.<MokeysListModel<MokeysUserInfo>>getScheduler())
.subscribe(new ApiSubscriber<MokeysListModel<MokeysUserInfo>>() {
@Override
protected void onFail(NetError error) {
Log.d("yuhh","onFail!!!" + error);
}
@Override
public void onNext(MokeysListModel<MokeysUserInfo> gankResults) {
Log.d("yuhh","getUserInfo code = " +gankResults.getCode());
if(gankResults.getCode()==0 && gankResults.getMsg().equals("success")) {
String mStatus = gankResults.getData().get(0).getStatus();
// String mStatus = "100";
if("100".equals(mStatus)){
SPUtil.put(context, Constants.MOKEYS_USER_STATUS,"login");
}else if("101".equals(mStatus)){
SPUtil.put(context, Constants.MOKEYS_USER_STATUS,"authentication");
}else if("111".equals(mStatus)){
SPUtil.put(context, Constants.MOKEYS_USER_STATUS,"finish");
}
mReservesList = gankResults.getData().get(0).getReserves();
mContractsList = gankResults.getData().get(0).getContracts();
}else{
// Toast.makeText(context,gankResults.getMsg(),Toast.LENGTH_SHORT).show();
Constants.handErrorCode(gankResults.getCode(),context);
}
initLoginStatus();
setContractReserverTip();
}
});
}
private void setContractReserverTip(){
if(mReservesList.size() != 0){
mTipReserves.setVisibility(View.VISIBLE);
}else{
mTipReserves.setVisibility(View.GONE);
}
if(mContractsList.size() != 0){
mTipContract.setVisibility(View.VISIBLE);
}else{
mTipContract.setVisibility(View.GONE);
}
}
private void initLoginStatus(){
if(Constants.isLogin(context)){
String mStatus = (String)SPUtil.get(context,Constants.MOKEYS_USER_STATUS,"");
if("login".equals(mStatus)){
mTipNotlogin.setVisibility(View.VISIBLE);
mTipNotlogin.setText(getString(R.string.notpay_tip));
}else if("authentication".equals(mStatus)){
mTipNotlogin.setVisibility(View.VISIBLE);
mTipNotlogin.setText(getString(R.string.notauthentication_tip));
}else if("finish".equals(mStatus)){
mTipNotlogin.setVisibility(View.GONE);
}else{
mTipNotlogin.setVisibility(View.GONE);
}
}else{
mTipNotlogin.setVisibility(View.VISIBLE);
mTipNotlogin.setText(getString(R.string.notlogin_tip));
}
}
}
| [
"yuhaihang@tianshenyule.com"
] | yuhaihang@tianshenyule.com |
c8d1a6f4bd9595913b2fa497790a7c4f3b0f6031 | d93ce8a57be61625c4259b41f860c596726bd2af | /src/main/java/soot/dava/MethodCallFinder.java | 5da5b981755d6cbaf0e9464694694aa5f7fc9dcc | [
"Apache-2.0"
] | permissive | izgzhen/markii | 81b67049ce817582736c8d630ec0e2cd12caa214 | 237a054a72f01121ce0fefac7532c1a39444e852 | refs/heads/master | 2023-05-06T00:24:48.026714 | 2021-04-14T17:41:27 | 2021-04-16T06:29:12 | 275,070,321 | 5 | 0 | Apache-2.0 | 2021-04-16T06:29:13 | 2020-06-26T04:06:53 | Java | UTF-8 | Java | false | false | 16,075 | java | package soot.dava;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 2005 Nomair A. Naeem
* %%
* 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 2.1 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 General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import soot.RefType;
import soot.Scene;
import soot.SootClass;
import soot.SootMethod;
import soot.SootMethodRef;
import soot.dava.internal.AST.ASTDoWhileNode;
import soot.dava.internal.AST.ASTForLoopNode;
import soot.dava.internal.AST.ASTIfElseNode;
import soot.dava.internal.AST.ASTIfNode;
import soot.dava.internal.AST.ASTLabeledBlockNode;
import soot.dava.internal.AST.ASTMethodNode;
import soot.dava.internal.AST.ASTNode;
import soot.dava.internal.AST.ASTStatementSequenceNode;
import soot.dava.internal.AST.ASTSwitchNode;
import soot.dava.internal.AST.ASTSynchronizedBlockNode;
import soot.dava.internal.AST.ASTTryNode;
import soot.dava.internal.AST.ASTUnconditionalLoopNode;
import soot.dava.internal.AST.ASTWhileNode;
import soot.dava.internal.asg.AugmentedStmt;
import soot.dava.toolkits.base.AST.analysis.DepthFirstAdapter;
import soot.dava.toolkits.base.AST.traversals.ASTParentNodeFinder;
import soot.grimp.internal.GNewInvokeExpr;
import soot.grimp.internal.GThrowStmt;
import soot.jimple.InvokeExpr;
import soot.jimple.InvokeStmt;
import soot.jimple.Stmt;
import soot.jimple.StringConstant;
public class MethodCallFinder extends DepthFirstAdapter {
ASTMethodNode underAnalysis;
DavaStaticBlockCleaner cleaner;
public MethodCallFinder(DavaStaticBlockCleaner cleaner) {
this.cleaner = cleaner;
underAnalysis = null;
}
public MethodCallFinder(boolean verbose, DavaStaticBlockCleaner cleaner) {
super(verbose);
this.cleaner = cleaner;
underAnalysis = null;
}
public void inASTMethodNode(ASTMethodNode node) {
underAnalysis = node;
}
/*
* some ASTConstuct{ ASTConstruct{ Some bodies Some Bodies Statement SequenceNode New Stmt seq node with some stmts some
* stmts ----------> Body of method to inline the invoke stmt New Stmt seq node with other stmts some other stmts Some
* other bodies Some other bodies End ASTConstruct End ASTConstruct
*/
/*
* Notice that since this class is only invoked for clinit methods this invoke statement is some invocation that occured
* within the clinit method
*/
public void inInvokeStmt(InvokeStmt s) {
InvokeExpr invokeExpr = s.getInvokeExpr();
SootMethod maybeInline = invokeExpr.getMethod();
// check whether we want to inline
ASTMethodNode toInlineASTMethod = cleaner.inline(maybeInline);
if (toInlineASTMethod == null) {
// not to inline
return;
} else {
// yes we want to inline
// we know that the method to be inlined has no declarations.
List<Object> subBodies = toInlineASTMethod.get_SubBodies();
if (subBodies.size() != 1) {
throw new RuntimeException("Found ASTMEthod node with more than one subBodies");
}
List body = (List) subBodies.get(0);
ASTParentNodeFinder finder = new ASTParentNodeFinder();
underAnalysis.apply(finder);
List<ASTStatementSequenceNode> newChangedBodyPart = createChangedBodyPart(s, body, finder);
boolean replaced = replaceSubBody(s, newChangedBodyPart, finder);
if (replaced) {
// so the invoke stmt has been replaced with the body of the
// method invoked
/*
* if the inlined method contained an assignment to a static field we want to replace that with a throw stmt
*/
StaticDefinitionFinder defFinder = new StaticDefinitionFinder(maybeInline);
toInlineASTMethod.apply(defFinder);
if (defFinder.anyFinalFieldDefined()) {
// create throw stmt to be added to inlined method
// create a SootMethodRef
SootClass runtime = Scene.v().loadClassAndSupport("java.lang.RuntimeException");
if (runtime.declaresMethod("void <init>(java.lang.String)")) {
SootMethod sootMethod = runtime.getMethod("void <init>(java.lang.String)");
SootMethodRef methodRef = sootMethod.makeRef();
RefType myRefType = RefType.v(runtime);
StringConstant tempString = StringConstant.v("This method used to have a definition of a final variable. "
+ "Dava inlined the definition into the static initializer");
List list = new ArrayList();
list.add(tempString);
GNewInvokeExpr newInvokeExpr = new GNewInvokeExpr(myRefType, methodRef, list);
GThrowStmt throwStmt = new GThrowStmt(newInvokeExpr);
AugmentedStmt augStmt = new AugmentedStmt(throwStmt);
List<AugmentedStmt> sequence = new ArrayList<AugmentedStmt>();
sequence.add(augStmt);
ASTStatementSequenceNode seqNode = new ASTStatementSequenceNode(sequence);
List<Object> subBody = new ArrayList<Object>();
subBody.add(seqNode);
toInlineASTMethod.replaceBody(subBody);
}
}
}
}
}
public List<Object> getSubBodyFromSingleSubBodyNode(ASTNode node) {
List<Object> subBodies = node.get_SubBodies();
if (subBodies.size() != 1) {
throw new RuntimeException("Found a single subBody node with more than 1 subBodies");
}
return (List<Object>) subBodies.get(0);
}
public List<Object> createNewSubBody(List<Object> orignalBody, List<ASTStatementSequenceNode> partNewBody,
Object stmtSeqNode) {
List<Object> newBody = new ArrayList<Object>();
Iterator<Object> it = orignalBody.iterator();
while (it.hasNext()) {
Object temp = it.next();
if (temp != stmtSeqNode) {
newBody.add(temp);
} else {
// breaks out of the loop as soon as stmtSeqNode is reached
break;
}
}
// dont add this stmt sequence node instead add the modified stmt seq
// nodes and the to be inline method
newBody.addAll(partNewBody);
// add remaining stuff drom the orignalBody
while (it.hasNext()) {
newBody.add(it.next());
}
return newBody;
}
public boolean replaceSubBody(InvokeStmt s, List<ASTStatementSequenceNode> newChangedBodyPart,
ASTParentNodeFinder finder) {
// get the stmt seq node of invoke stmt
Object stmtSeqNode = finder.getParentOf(s);
// find the parent node of the stmt seq node
Object ParentOfStmtSeq = finder.getParentOf(stmtSeqNode);
if (ParentOfStmtSeq == null) {
throw new RuntimeException("MethodCall FInder: parent of stmt seq node not found");
}
ASTNode node = (ASTNode) ParentOfStmtSeq;
// the decision what to replace and how to replace depends on the type
// of ASTNode
if (node instanceof ASTMethodNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTMethodNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTSynchronizedBlockNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTSynchronizedBlockNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTLabeledBlockNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTLabeledBlockNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTUnconditionalLoopNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTUnconditionalLoopNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTIfNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTIfNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTWhileNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTWhileNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTDoWhileNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTDoWhileNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTForLoopNode) {
// get the subBody to replace
List<Object> subBodyToReplace = getSubBodyFromSingleSubBodyNode(node);
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
((ASTForLoopNode) node).replaceBody(newBody);
return true;
} else if (node instanceof ASTIfElseNode) {
List<Object> subBodies = node.get_SubBodies();
if (subBodies.size() != 2) {
throw new RuntimeException("Found an ifelse ASTNode which does not have two bodies");
}
List<Object> ifBody = (List<Object>) subBodies.get(0);
List<Object> elseBody = (List<Object>) subBodies.get(1);
// find out which of these bodies has the stmt seq node with the
// invoke stmt
int subBodyNumber = -1;
Iterator<Object> it = ifBody.iterator();
while (it.hasNext()) {
Object temp = it.next();
if (temp == stmtSeqNode) {
subBodyNumber = 0;
break;
}
}
if (subBodyNumber != 0) {
it = elseBody.iterator();
while (it.hasNext()) {
Object temp = it.next();
if (temp == stmtSeqNode) {
subBodyNumber = 1;
break;
}
}
}
List<Object> subBodyToReplace = null;
if (subBodyNumber == 0) {
subBodyToReplace = ifBody;
} else if (subBodyNumber == 1) {
subBodyToReplace = elseBody;
} else {
throw new RuntimeException("Could not find the related ASTNode in the method");
}
List<Object> newBody = createNewSubBody(subBodyToReplace, newChangedBodyPart, stmtSeqNode);
if (subBodyNumber == 0) {
((ASTIfElseNode) node).replaceBody(newBody, elseBody);
return true;
} else if (subBodyNumber == 1) {
((ASTIfElseNode) node).replaceBody(ifBody, newBody);
return true;
}
} else if (node instanceof ASTTryNode) {
// NOTE THAT method INLINING Is currently only done in the tryBody
// and not the catchBody
// THe only reason for this being that mostly method calls are made
// in the try and not the catch
// get try body
List<Object> tryBody = ((ASTTryNode) node).get_TryBody();
Iterator<Object> it = tryBody.iterator();
// find whether stmtSeqNode is in the tryBody
boolean inTryBody = false;
while (it.hasNext()) {
ASTNode temp = (ASTNode) it.next();
if (temp == stmtSeqNode) {
inTryBody = true;
break;
}
}
if (!inTryBody) {
// return without making any changes
return false;
}
List<Object> newBody = createNewSubBody(tryBody, newChangedBodyPart, stmtSeqNode);
((ASTTryNode) node).replaceTryBody(newBody);
return true;
} else if (node instanceof ASTSwitchNode) {
List<Object> indexList = ((ASTSwitchNode) node).getIndexList();
Map<Object, List<Object>> index2BodyList = ((ASTSwitchNode) node).getIndex2BodyList();
Iterator<Object> it = indexList.iterator();
while (it.hasNext()) {
// going through all the cases of the switch
// statement
Object currentIndex = it.next();
List<Object> body = index2BodyList.get(currentIndex);
if (body != null) {
// this body is a list of ASTNodes
// see if it contains stmtSeqNode
boolean found = false;
Iterator<Object> itBody = body.iterator();
while (itBody.hasNext()) {
ASTNode temp = (ASTNode) itBody.next();
if (temp == stmtSeqNode) {
found = true;
break;
}
}
if (found) {
// this is the body which has the stmt seq node
List<Object> newBody = createNewSubBody(body, newChangedBodyPart, stmtSeqNode);
// put this body in the Map
index2BodyList.put(currentIndex, newBody);
// replace in actual switchNode
((ASTSwitchNode) node).replaceIndex2BodyList(index2BodyList);
return true;
}
} // if body not null
} // going through all cases
}
return false;
}
/*
* Given an invoke stmt this method finds the parent of this stmt which should always be a StatementSequenceNode Then the
* sequence is broken into three parts. The first part contains stmts till above the invoke stmt. The second part contains
* the body argument which is the body of the inlined method and the third part are the stmts below the invoke stmt
*/
public List<ASTStatementSequenceNode> createChangedBodyPart(InvokeStmt s, List body, ASTParentNodeFinder finder) {
// get parent node of invoke stmt
Object parent = finder.getParentOf(s);
if (parent == null) {
throw new RuntimeException("MethodCall FInder: parent of invoke stmt not found");
}
ASTNode parentNode = (ASTNode) parent;
if (!(parentNode instanceof ASTStatementSequenceNode)) {
throw new RuntimeException("MethodCall FInder: parent node not a stmt seq node");
}
ASTStatementSequenceNode orignal = (ASTStatementSequenceNode) parentNode;
// copying the stmts till above the inoke stmt into one stmt sequence
// node
List<AugmentedStmt> newInitialNode = new ArrayList<AugmentedStmt>();
Iterator<AugmentedStmt> it = orignal.getStatements().iterator();
while (it.hasNext()) {
AugmentedStmt as = it.next();
Stmt tempStmt = as.get_Stmt();
if (tempStmt != s) {
newInitialNode.add(as);
} else {
// the first time we get to a stmt which points to the invoke
// stmt we break
break;
}
}
// copy remaining stmts into the AFTER stmt sequence node
List<AugmentedStmt> newSecondNode = new ArrayList<AugmentedStmt>();
while (it.hasNext()) {
newSecondNode.add(it.next());
}
List<ASTStatementSequenceNode> toReturn = new ArrayList<ASTStatementSequenceNode>();
if (newInitialNode.size() != 0) {
toReturn.add(new ASTStatementSequenceNode(newInitialNode));
}
// add inline methods body
toReturn.addAll(body);
if (newSecondNode.size() != 0) {
toReturn.add(new ASTStatementSequenceNode(newSecondNode));
}
return toReturn;
}
}
| [
"7168454+izgzhen@users.noreply.github.com"
] | 7168454+izgzhen@users.noreply.github.com |
116a0554ad51c7af3e98f77f6e8a0224c41caaa8 | 3ac12ca60576fef4bab967944b24a6aeed0f36b9 | /model/src/main/java/com/lc/yygh/model/cmn/Dict.java | a5c4a08637b2f59d1e4e8f94056a054aa91021e0 | [] | no_license | wujiawei55/yygh-parent | 1faff1852c75b9ff1427b9fe983b8791bff137ca | f806fba0318ec8bcaeed236dfeb832c32b9a1f36 | refs/heads/master | 2023-05-13T18:46:45.940198 | 2021-06-07T02:02:12 | 2021-06-07T02:02:12 | 374,515,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,726 | java | package com.lc.yygh.model.cmn;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* Dict
* </p>
*
* Create by lujun
*/
@Data
@ApiModel(description = "数据字典")
@TableName("dict")
public class Dict {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = "逻辑删除(1:已删除,0:未删除)")
@TableLogic
@TableField("is_deleted")
private Integer isDeleted;
@ApiModelProperty(value = "其他参数")
@TableField(exist = false)
private Map<String,Object> param = new HashMap<>();
@ApiModelProperty(value = "上级id")
@TableField("parent_id")
private Long parentId;
@ApiModelProperty(value = "名称")
@TableField("name")
private String name;
@ApiModelProperty(value = "值")
@TableField("value")
private String value;
@ApiModelProperty(value = "编码")
@TableField("dict_code")
private String dictCode;
@ApiModelProperty(value = "是否包含子节点")
@TableField(exist = false)
private boolean hasChildren;
} | [
"592014178@qq.com"
] | 592014178@qq.com |
5fc8e221210d4fdf5ee6742c2a97d8746e14cd15 | 801c39e8bbeee2e25ed1ba2b74aa039f8b3d62ae | /fizteh-java-2014/src/ru/fizteh/fivt/students/LevkovMiron/FileMap/StreamFileMap.java | 87c405b2d5e77375acc41f83ede90450fc113018 | [] | no_license | grapefroot/mipt | 2f6572b3120e28a0e63e28f2542782520384828f | 51d13fa07b37bdbdda943bd47d7e356a3a126177 | refs/heads/master | 2020-12-24T21:12:03.706690 | 2016-11-08T07:40:20 | 2016-11-08T07:40:20 | 56,529,254 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package ru.fizteh.fivt.students.LevkovMiron.FileMap;
import java.util.Scanner;
/**
* Created by Мирон on 22.09.2014 ru.fizteh.fivt.students.LevkovMiron.shell.
*/
class StreamFileMap extends FileMap {
StreamFileMap() {
super(System.out);
}
public void readCommands() {
System.out.println("$");
Scanner scanner = new Scanner(System.in);
if (scanner.hasNextLine()) {
String input = scanner.nextLine();
String[] commands = input.split(";");
for (String cmd : commands) {
runCommand(cmd, System.out);
}
readCommands();
} else {
System.exit(1);
}
}
}
| [
"salnikov.dmitri@gmail.com"
] | salnikov.dmitri@gmail.com |
d0bda70fa64472821a15136f738e1f9e45283a6b | 3792a3f4c92c21533fd6aca3fa709de089c6f06a | /java/CloudHandsJAPI/src/main/java/com/antell/cloudhands/api/packet/PacketSourceReader.java | edbc64dce3d10581ee9148bd5e652ead1b0d249e | [] | no_license | barbiegirl2014/CloudHands | 8edd14cb99bc30856c1014f23c7fe8083e431b1f | c1a2a9d3ce7c197ba468c2cd060b4d17adb4ae0f | refs/heads/master | 2020-03-21T17:12:20.525682 | 2018-06-26T09:35:54 | 2018-06-26T09:35:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package com.antell.cloudhands.api.packet;
import com.antell.cloudhands.api.source.AbstractSourceReader;
import com.antell.cloudhands.api.source.Filter;
import com.antell.cloudhands.api.source.Source;
/**
* Created by dell on 2018/6/19.
*/
public class PacketSourceReader extends AbstractSourceReader {
private PacketRecordReader packetRecordReader;
protected PacketSourceReader(Source source, Filter filter,String mmapFileName) {
super(source,new PacketSourceEntryParser(), filter);
this.packetRecordReader = new PacketRecordReader(mmapFileName,null,0,4096);
}
@Override
public int open() {
return packetRecordReader.open();
}
@Override
public PacketRecord read() {
return packetRecordReader.read();
}
@Override
public void readEnd(PacketRecord packetRecord) {
packetRecord.reset();
}
@Override
public void close() {
packetRecordReader.close();
}
}
| [
"csp001314@gmail.com"
] | csp001314@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.