blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
df76ade6b6bc9e8bcada9d076aa9b60afa46b3ab | e054c1e6903e4b5eb166d107802c0c2cadd2eb03 | /modules/datex-serializer/src/generated/java/eu/datex2/schema/_2/_2_0/MaintenanceVehicleActionsEnum.java | 2f3dadcb2d6e914af5daf54fb770f867b9516bea | [
"MIT"
] | permissive | svvsaga/gradle-modules-public | 02dc90ad2feb58aef7629943af3e0d3a9f61d5cf | e4ef4e2ed5d1a194ff426411ccb3f81d34ff4f01 | refs/heads/main | 2023-05-27T08:25:36.578399 | 2023-05-12T14:15:47 | 2023-05-12T14:33:14 | 411,986,217 | 2 | 1 | MIT | 2023-05-12T14:33:15 | 2021-09-30T08:36:11 | Java | UTF-8 | Java | false | false | 1,903 | java |
package eu.datex2.schema._2._2_0;
import jakarta.xml.bind.annotation.XmlEnum;
import jakarta.xml.bind.annotation.XmlEnumValue;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for MaintenanceVehicleActionsEnum.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <pre>
* <simpleType name="MaintenanceVehicleActionsEnum">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="maintenanceVehiclesMergingIntoTrafficFlow"/>
* <enumeration value="saltAndGritSpreading"/>
* <enumeration value="slowMoving"/>
* <enumeration value="snowClearing"/>
* <enumeration value="stoppingToServiceEquipments"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "MaintenanceVehicleActionsEnum")
@XmlEnum
public enum MaintenanceVehicleActionsEnum {
@XmlEnumValue("maintenanceVehiclesMergingIntoTrafficFlow")
MAINTENANCE_VEHICLES_MERGING_INTO_TRAFFIC_FLOW("maintenanceVehiclesMergingIntoTrafficFlow"),
@XmlEnumValue("saltAndGritSpreading")
SALT_AND_GRIT_SPREADING("saltAndGritSpreading"),
@XmlEnumValue("slowMoving")
SLOW_MOVING("slowMoving"),
@XmlEnumValue("snowClearing")
SNOW_CLEARING("snowClearing"),
@XmlEnumValue("stoppingToServiceEquipments")
STOPPING_TO_SERVICE_EQUIPMENTS("stoppingToServiceEquipments");
private final String value;
MaintenanceVehicleActionsEnum(String v) {
value = v;
}
public String value() {
return value;
}
public static MaintenanceVehicleActionsEnum fromValue(String v) {
for (MaintenanceVehicleActionsEnum c: MaintenanceVehicleActionsEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"[email protected]"
] | |
9d8edc7b416016f730ff475d334d4b1a49864665 | 206ba5a4cba3d94e14a68070aa9a4ebb8e8b5b55 | /AppContact/src/main/java/com/dao/impl/ChefResponsableDaoImpl.java | 00d4cf883f5b4214070b75c69794f9cceb9b4038 | [] | no_license | BilelSahlii/AppContact | 02bae7772b9923b22547c8192d04a2490cb7bf1b | 73354508ef1d0b76b2685debe6be1828b6ca8332 | refs/heads/master | 2021-01-11T07:08:15.272828 | 2016-10-12T23:39:14 | 2016-10-12T23:39:14 | 69,383,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,011 | java | package com.dao.impl;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.idao.AgentDeviseDao;
import com.idao.ChefResponsableDao;
@Service("ChefResponsableDao")
@Transactional
public class ChefResponsableDaoImpl extends GenericDaoImpl implements ChefResponsableDao {
public void saveFile(InputStream inputstream,File file)
{
OutputStream output = null;
try {
output = new FileOutputStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
IOUtils.copyLarge(inputstream, output);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
30740eb87e94f00ad1a8069496b0af4d18c8c385 | b259d8aa34e7a979ac234231c940ea427fe2bfa2 | /financial-planning-development/src/main/java/ua/uhk/mois/financialplanning/FinancialPlanningApplication.java | 86234f72c9752b2a5096f83588b1eff5ccada5e2 | [] | no_license | hmarochos/KVN | 59b4bb7eb5ad53481906d3a4d105641ac2907eda | 58285b1bd0ca57d3140dc4285651658f5c92c1e7 | refs/heads/master | 2023-06-04T07:35:47.182374 | 2021-06-18T16:16:18 | 2021-06-18T16:16:18 | 378,195,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package ua.uhk.mois.financialplanning;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
//@EnableEurekaClient
public class FinancialPlanningApplication {
public static void main(String[] args) {
SpringApplication.run(FinancialPlanningApplication.class, args);
}
}
| [
"[email protected]"
] | |
783b5e07177b678b7babb657cc5bdcb65a06e6a5 | aded9c5e99d627b6ff7090c13b55bb91f31fb26e | /app/src/main/java/com/haoche51/sales/hctransfer/TransferTaskFragment.java | d05728e161da3779cc598d4ec9ba90a61cd6f4a1 | [] | no_license | pengxinaglin/maiche | f47964884393bcd7823550b8392ee4621c78fa5e | 4b36e2ef5f45df9879843e2ce98acdacc4f7eb33 | refs/heads/master | 2021-01-21T10:12:33.595132 | 2017-02-28T05:08:54 | 2017-02-28T05:08:54 | 83,391,921 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 8,135 | java | package com.haoche51.sales.hctransfer;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import com.haoche51.sales.GlobalData;
import com.haoche51.sales.R;
import com.haoche51.sales.constants.HCConst;
import com.haoche51.sales.constants.TaskConstants;
import com.haoche51.sales.custom.HCPullToRefresh;
import com.haoche51.sales.hcbasefragment.CommonBaseFragment;
import com.haoche51.sales.net.AppHttpServer;
import com.haoche51.sales.net.HCHttpRequestParam;
import com.haoche51.sales.net.HCHttpResponse;
import com.haoche51.sales.net.HCJsonParse;
import com.haoche51.sales.net.HttpConstants;
import com.haoche51.sales.util.DisplayUtils;
import com.haoche51.sales.util.ToastUtil;
import java.util.ArrayList;
import java.util.List;
/**
* 待过户列表
* Created by yangming on 2016/1/19.
*/
public class TransferTaskFragment extends CommonBaseFragment implements AdapterView.OnItemClickListener, View.OnClickListener, HCPullToRefresh.OnRefreshCallback {
/**
* 记录当前上拉刷新页码 *
*/
private int mCurrentPage = 0;
/**
* 监听过户状态广播
*/
private BroadcastReceiver mReceiver;
private HCPullToRefresh mPullToRefresh;
private ListView mListView;
private TransferAdapter mAdater;
private List<TransferSimpleEntity> mTransferData = new ArrayList<TransferSimpleEntity>();
@Override
protected int getContentView() {
return R.layout.fragment_transfer_list;
}
@Override
protected void initView(View view) {
super.initView(view);
mPullToRefresh = (HCPullToRefresh) view.findViewById(R.id.pull_to_refresh);
mPullToRefresh.setCanPull(true);
mPullToRefresh.setOnRefreshCallback(this);
mListView = mPullToRefresh.getListView();
mListView.setDivider(getResources().getDrawable(R.color.hc_self_gray_bg));
mListView.setDividerHeight(DisplayUtils.dip2px(getActivity(), 10));
mListView.setOnItemClickListener(this);
doRegistTransferStatusChanged();
}
@Override
protected void initData(Bundle savedInstanceState) {
super.initData(savedInstanceState);
mAdater = new TransferAdapter(mTransferData);
mListView.setAdapter(mAdater);
//自动刷新
mPullToRefresh.setFirstAutoRefresh();
}
@Override
public void onDetach() {
super.onDetach();
doUnRegistTransferStatusChanged();
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
@Override
public void onClick(View v) {
//当空数据列表时会回调此方法
if (mPullToRefresh != null) {
onPullDownRefresh();//刷新重新拉取数据
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position - 1 < mAdater.getCount()) {
TransferSimpleEntity clickedEntity = (TransferSimpleEntity) mAdater.getItem(position);
Intent intent = new Intent(GlobalData.mContext, TransferDetailActivity.class);
intent.putExtra(TransferDetailActivity.KEY_INTENT_EXTRA_ID, clickedEntity.getTransaction_id());
startActivity(intent);
}
}
@Override
public void onPullDownRefresh() {
mCurrentPage = 0;
requestFilterTransferData(HCConst.Transfer.HTTP_POST_TAB_TRANFER, ""
, mCurrentPage, HttpConstants.REQUEST_PAGESIZE, HttpConstants.GET_LIST_REFRESH);
}
@Override
public void onLoadMoreRefresh() {
requestFilterTransferData(HCConst.Transfer.HTTP_POST_TAB_TRANFER, ""
, ++mCurrentPage, HttpConstants.REQUEST_PAGESIZE, HttpConstants.GET_LIST_LOADMORE);
}
private void doUnRegistTransferStatusChanged() {
if (getActivity() != null) {
if (mReceiver != null) {
getActivity().unregisterReceiver(mReceiver);
}
}
}
private void doRegistTransferStatusChanged() {
if (getActivity() != null && !getActivity().isFinishing()) {
if (mReceiver == null) {
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null) {// 刷新列表
requestFilterTransferData(HCConst.Transfer.HTTP_POST_TAB_TRANFER, ""
, 0, HttpConstants.REQUEST_PAGESIZE * (mCurrentPage + 1), HttpConstants.GET_LIST_REFRESH);
mCurrentPage = 0;
}
}
};
}
IntentFilter filter = new IntentFilter(HCConst.ACTION_TRANSFER_CHANGED);
getActivity().registerReceiver(mReceiver, filter);
}
}
private void requestFilterTransferData(int tab, String keyword, int page, int limit, int requestId) {
AppHttpServer.getInstance().post(HCHttpRequestParam.transferList(tab, keyword, page, limit), this, requestId);
}
@Override
public void onHttpComplete(String action, int requestId, HCHttpResponse response, Throwable error) {
if (getActivity() != null && getActivity().isFinishing()) {
return;
}
if (action.equals(HttpConstants.ACTION_TRANSFERAPI_GET_LIST)) {
onListHttpResponse(response, requestId);
}
}
/**
* 列表页刷新返回解析
*
* @param response
* @param requestId
*/
private void onListHttpResponse(HCHttpResponse response, int requestId) {
try {
switch (response.getErrno()) {
case 0:
List<TransferSimpleEntity> resultData = HCJsonParse.parseTransferListData(response.getData());
//刷新
if (requestId == HttpConstants.GET_LIST_REFRESH && mTransferData != null) {
mTransferData.clear();
}
//把后来加载的添加进来
if (resultData != null) {
mTransferData.addAll(resultData);
}
//是否还有更多
boolean isNoMoreData = false;
if (resultData == null || resultData.size() < TaskConstants.DEFAULT_SHOWTASK_COUNT) {
isNoMoreData = true;
}
mPullToRefresh.setFooterStatus(isNoMoreData);
//重置数据
mAdater.notifyDataSetChanged();
//当没有数据时显示默认空白页
if (mTransferData.size() == 0) {
mPullToRefresh.hideFooter();
showNoDataView(false, GlobalData.resourceHelper.getString(R.string.hc_common_result_nodata), this);
} else {
dismissResultView(true);//有数据,显示出来数据列表页面
}
break;
default:
mPullToRefresh.setFooterStatus(false);
ToastUtil.showInfo(response.getErrmsg());
//无网络视图
if (mTransferData.size() == 0) {
showErrorView(false, this);
}
break;
}
//停止刷新
mPullToRefresh.finishRefresh();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void doingFilter(Bundle where) {
super.doingFilter(where);
String key = where.getString("search_field");
mCurrentPage = 0;
requestFilterTransferData(HCConst.Transfer.HTTP_POST_TAB_TRANFER, key
, mCurrentPage, HttpConstants.REQUEST_PAGESIZE, HttpConstants.GET_LIST_REFRESH);
}
}
| [
"[email protected]"
] | |
273887a63598899c8a6ae8f7731f0a522bffca67 | 7b12f67da8c10785efaebe313547a15543a39c77 | /jjg-online/src/main/java/com/xdl/jjg/entity/EsGroupBuyGoods.java | f84e64c756df336b27a2b607cd6fbe6424a81e97 | [] | no_license | liujinguo1994/xdl-jjg | 071eaa5a8fb566db6b47dbe046daf85dd2b9bcd8 | 051da0a0dba18e6e5021ecb4ef3debca16b01a93 | refs/heads/master | 2023-01-06T09:11:30.487559 | 2020-11-06T14:42:45 | 2020-11-06T14:42:45 | 299,525,315 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,576 | java | package com.xdl.jjg.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author libw [email protected]
* @since 2019-05-31
*/
@Data
@Accessors(chain = true)
@TableName("es_group_buy_goods")
public class EsGroupBuyGoods extends Model<EsGroupBuyGoods> {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@TableId(value="id", type= IdType.AUTO)
private Double id;
/**
* SKUId
*/
@TableField("sku_id")
private Long skuId;
/**
* 活动Id
*/
@TableField("act_id")
private Long actId;
/**
* 团购分类
*/
@TableField("cat_id")
private Long catId;
/**
* 地区Id
*/
@TableField("area_id")
private Long areaId;
/**
* 团购名称
*/
@TableField("gb_name")
private String gbName;
/**
* 副标题
*/
@TableField("gb_title")
private String gbTitle;
/**
* 商品名称
*/
@TableField("goods_name")
private String goodsName;
/**
* 商品Id
*/
@TableField("goods_id")
private Long goodsId;
/**
* 原始价格
*/
@TableField("original_price")
private Double originalPrice;
/**
* 团购价格
*/
@TableField("price")
private Double price;
/**
* 图片地址
*/
@TableField("img_url")
private String imgUrl;
/**
* 商品总数
*/
@TableField("goods_num")
private Integer goodsNum;
/**
* 虚拟数量
*/
@TableField("visual_num")
private Integer visualNum;
/**
* 限购数量
*/
@TableField("limit_num")
private Integer limitNum;
/**
* 已团购数量
*/
@TableField("buy_num")
private Integer buyNum;
/**
* 浏览数量
*/
@TableField("view_num")
private Integer viewNum;
/**
* 介绍
*/
@TableField("remark")
private String remark;
/**
* 状态
*/
@TableField("gb_status")
private Integer gbStatus;
/**
* 添加时间
*/
@TableField("add_time")
private Long addTime;
/**
* wap缩略图
*/
@TableField("wap_thumbnail")
private String wapThumbnail;
/**
* pc缩略图
*/
@TableField("thumbnail")
private String thumbnail;
/**
* 商家ID
*/
@TableField("seller_id")
private Long sellerId;
/**
* 店铺名称
*/
@TableField("seller_name")
private String sellerName;
@Override
protected Serializable pkVal() {
return this.id;
}
}
| [
"[email protected]"
] | |
36c56abcdfab7eda379febc6746e4436d4092f6b | 3501fc9a26f1102a72da0802c5006b6007446a36 | /bridge-impl/src/main/java/com/liferay/faces/bridge/context/ExternalContextImpl.java | 16242eaf064de787a3b31364889b88f0a4963c5d | [] | no_license | matethurzo/liferay-faces | 651e15e9ec269df0dd5d935be5b284d03ed5d32a | e3c0148918d1bef176d77021c193f1e7039f263a | refs/heads/master | 2020-12-24T19:17:51.127887 | 2014-02-01T20:24:09 | 2014-02-01T20:24:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,305 | java | /**
* Copyright (c) 2000-2014 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.faces.bridge.context;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.Principal;
import java.util.Collections;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.faces.context.ExternalContext;
import javax.portlet.ClientDataRequest;
import javax.portlet.MimeResponse;
import javax.portlet.PortletContext;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.PortletSession;
import javax.portlet.ResourceResponse;
import javax.portlet.StateAwareResponse;
import javax.portlet.faces.BridgeWriteBehindResponse;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import com.liferay.faces.bridge.BridgeFactoryFinder;
import com.liferay.faces.bridge.application.view.BridgeAfterViewContentRequest;
import com.liferay.faces.bridge.application.view.BridgeAfterViewContentResponse;
import com.liferay.faces.bridge.application.view.BridgeWriteBehindSupportFactory;
import com.liferay.faces.bridge.bean.BeanManager;
import com.liferay.faces.bridge.bean.BeanManagerFactory;
import com.liferay.faces.bridge.config.BridgeConfigConstants;
import com.liferay.faces.bridge.context.map.ApplicationMap;
import com.liferay.faces.bridge.context.map.InitParameterMap;
import com.liferay.faces.bridge.context.map.RequestAttributeMap;
import com.liferay.faces.bridge.context.map.RequestCookieMap;
import com.liferay.faces.bridge.context.map.SessionMap;
import com.liferay.faces.bridge.util.LocaleIterator;
import com.liferay.faces.util.helper.BooleanHelper;
import com.liferay.faces.util.logging.Logger;
import com.liferay.faces.util.logging.LoggerFactory;
import com.liferay.faces.util.product.ProductConstants;
import com.liferay.faces.util.product.ProductMap;
/**
* @author Neil Griffin
*/
public class ExternalContextImpl extends ExternalContextCompat_2_2_Impl {
// Logger
private static final Logger logger = LoggerFactory.getLogger(ExternalContextImpl.class);
// Private Constants
private static final boolean LIFERAY_PORTAL_DETECTED = ProductMap.getInstance().get(ProductConstants.LIFERAY_PORTAL)
.isDetected();
private static final boolean RICHFACES_DETECTED = ProductMap.getInstance().get(ProductConstants.RICHFACES)
.isDetected();
private static final String ORG_RICHFACES_EXTENSION = "org.richfaces.extension";
// Pre-initialized Data Members
private ApplicationMap applicationMap;
private BeanManager beanManager;
private Map<String, Object> requestAttributeMap;
private Iterator<Locale> requestLocales;
private Map<String, Object> sessionMap;
// Lazily-Initialized Data Members
private String authType;
private BridgeAfterViewContentRequest bridgeAfterViewContentRequest;
private BridgeAfterViewContentResponse bridgeAfterViewContentResponse;
private Map<String, String> initParameterMap;
private String remoteUser;
private Map<String, Object> requestCookieMap;
private Locale requestLocale;
private Principal userPrincipal;
public ExternalContextImpl(PortletContext portletContext, PortletRequest portletRequest,
PortletResponse portletResponse) {
super(portletContext, portletRequest, portletResponse);
BeanManagerFactory beanManagerFactory = (BeanManagerFactory) BridgeFactoryFinder.getFactory(
BeanManagerFactory.class);
this.beanManager = beanManagerFactory.getBeanManager();
try {
boolean requestChanged = false;
boolean responseChanged = false;
preInitializeObjects(requestChanged, responseChanged);
}
catch (Exception e) {
logger.error(e);
}
}
@Override
public void dispatch(String path) throws IOException {
// Indicate that JSP AFTER_VIEW_CONTENT processing has been de-activated. This will make it possible for the
// Mojarra JspViewHandlingStrategy#executePageToBuildView(FacesContext, UIViewRoot) method to successfully call
// {@link ExternalContextImpl#setResponse(Object)} in order to undo the ViewHandlerResponseWrapper and restore
// the original PortletResponse.
bridgeContext.setProcessingAfterViewContent(false);
logger.debug("De-activated JSP AFTER_VIEW_CONTENT");
bridgeContext.dispatch(path);
}
/**
* @see ExternalContext#encodeNamespace(String)
*/
@Override
public String encodeNamespace(String name) {
if (name == null) {
return bridgeContext.getResponseNamespace();
}
else if (RICHFACES_DETECTED && (name.equals(ORG_RICHFACES_EXTENSION))) {
// http://issues.liferay.com/browse/FACES-1416
return name;
}
else {
return bridgeContext.getResponseNamespace() + name;
}
}
/**
* @see ExternalContext#encodeResourceURL(String)
*/
@Override
public String encodeResourceURL(String url) {
return bridgeContext.encodeResourceURL(url).toString();
}
@Override
public void log(String message) {
portletContext.log(message);
}
@Override
public void log(String message, Throwable exception) {
portletContext.log(message, exception);
}
@Override
public void redirect(String url) throws IOException {
bridgeContext.redirect(url);
}
/**
* In order to increase runtime performance, this method caches values of objects that are typically called more
* than once during the JSF lifecycle. Other values will be cached lazily, or might not be cached since their getter
* methods may never get called.
*
* @param requestChanged Flag indicating that this method is being called because {@link #setRequest(Object)} was
* called.
* @param responseChanged Flag indicating that this method is being called because {@link #setResponse(Object)}
* was called.
*/
protected void preInitializeObjects(boolean requestChanged, boolean responseChanged) {
if (requestChanged) {
bridgeContext.setPortletRequest(portletRequest);
}
if (responseChanged) {
bridgeContext.setPortletResponse(portletResponse);
}
// Retrieve the portlet lifecycle phase.
portletPhase = bridgeContext.getPortletRequestPhase();
// Determines whether or not methods annotated with the @PreDestroy annotation are preferably invoked
// over the @BridgePreDestroy annotation.
String preferPreDestroyInitParam = getInitParameter(BridgeConfigConstants.PARAM_PREFER_PRE_DESTROY1);
if (preferPreDestroyInitParam == null) {
// Backward compatibility
preferPreDestroyInitParam = getInitParameter(BridgeConfigConstants.PARAM_PREFER_PRE_DESTROY2);
}
boolean preferPreDestroy = BooleanHelper.toBoolean(preferPreDestroyInitParam, true);
// Initialize the application map.
applicationMap = new ApplicationMap(portletContext, beanManager, preferPreDestroy);
// Determines whether or not JSF @ManagedBean classes annotated with @RequestScoped should be distinct for
// each portlet when running under Liferay Portal.
boolean distinctRequestScopedManagedBeans = false;
if (LIFERAY_PORTAL_DETECTED) {
distinctRequestScopedManagedBeans = BooleanHelper.toBoolean(getInitParameter(
BridgeConfigConstants.PARAM_DISTINCT_REQUEST_SCOPED_MANAGED_BEANS), false);
}
// Initialize the request attribute map.
requestAttributeMap = new RequestAttributeMap(portletRequest, beanManager,
bridgeContext.getPortletContainer().getResponseNamespace(), preferPreDestroy,
distinctRequestScopedManagedBeans);
// Initialize the session map.
sessionMap = new SessionMap(portletRequest.getPortletSession(), beanManager, PortletSession.PORTLET_SCOPE,
preferPreDestroy);
// Initialize the init parameter map.
initParameterMap = Collections.unmodifiableMap(new InitParameterMap(portletContext));
// Initialize the request context path.
requestContextPath = portletRequest.getContextPath();
// Initialize the request locales.
requestLocales = new LocaleIterator(portletRequest.getLocales());
}
@Override
public Map<String, Object> getApplicationMap() {
return applicationMap;
}
@Override
public String getAuthType() {
if (authType == null) {
authType = portletRequest.getAuthType();
}
return authType;
}
@Override
public Object getContext() {
return portletContext;
}
@Override
public boolean isUserInRole(String role) {
return portletRequest.isUserInRole(role);
}
@Override
public String getInitParameter(String name) {
return bridgeContext.getInitParameter(name);
}
@Override
public Map<String, String> getInitParameterMap() {
return initParameterMap;
}
@Override
public String getRemoteUser() {
if (remoteUser == null) {
remoteUser = portletRequest.getRemoteUser();
}
return remoteUser;
}
@Override
public Object getRequest() {
// If JSP AFTER_VIEW_CONTENT processing has been activated by the
// JspViewDeclarationLanguage#buildView(FacesContext, UIViewRoot) method, then return a ServletRequest that
// wraps/decorates the current PortletRequest. This is necessary because the MyFaces
// JspViewDeclarationLanguage#buildView(FacesContext, UIViewRoot) method has a Servlet API dependency due to
// explicit casts to HttpServletRequest.
if (bridgeContext.isProcessingAfterViewContent()) {
if ((bridgeAfterViewContentRequest == null) ||
(bridgeAfterViewContentRequest.getWrapped() != portletRequest)) {
BridgeWriteBehindSupportFactory bridgeWriteBehindSupportFactory = (BridgeWriteBehindSupportFactory)
BridgeFactoryFinder.getFactory(BridgeWriteBehindSupportFactory.class);
bridgeAfterViewContentRequest = bridgeWriteBehindSupportFactory.getBridgeAfterViewContentRequest(
portletRequest);
}
return bridgeAfterViewContentRequest;
}
else {
return portletRequest;
}
}
@Override
public void setRequest(Object request) {
this.portletRequest = (PortletRequest) request;
try {
boolean requestChanged = true;
boolean responseChanged = false;
preInitializeObjects(requestChanged, responseChanged);
}
catch (Exception e) {
logger.error(e);
}
}
@Override
public String getRequestCharacterEncoding() {
if (portletRequest instanceof ClientDataRequest) {
ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;
String requestCharacterEncoding = clientDataRequest.getCharacterEncoding();
if (manageIncongruities) {
try {
incongruityContext.setRequestCharacterEncoding(requestCharacterEncoding);
}
catch (Exception e) {
logger.error(e);
}
}
return requestCharacterEncoding;
}
else {
if (manageIncongruities) {
return incongruityContext.getRequestCharacterEncoding();
}
else {
// The Mojarra 2.x {@link MultiViewHandler#initView(FacesContext)} method expects a null value to be
// returned, so throwing an IllegalStateException is not an option.
return null;
}
}
}
@Override
public void setRequestCharacterEncoding(String encoding) throws UnsupportedEncodingException,
IllegalStateException {
// Although the JSF API's ViewHandler.initView(FacesContext) method will call this method during the portlet
// RENDER_PHASE, the RenderRequest does not implement the ClientDataRequest interface, which means it does not
// have a setCharacterEncoding(String) method, therefore this should only be done in the case of a
// ClientDataRequest.
if (portletRequest instanceof ClientDataRequest) {
ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;
try {
clientDataRequest.setCharacterEncoding(encoding);
}
catch (IllegalStateException e) {
// TestPage141: setRequestCharacterEncodingActionTest -- exception is to be ignored
}
}
else {
if (manageIncongruities) {
incongruityContext.setRequestCharacterEncoding(encoding);
}
else {
// TestPage140: setRequestCharacterEncodingRenderTest expects this to be a no-op so throwing an
// IllegalStateException is not an option.
}
}
}
@Override
public String getRequestContentType() {
if (portletRequest instanceof ClientDataRequest) {
ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;
// If using ICEfaces 3.0.x/2.0.x then need to return the legacy value.
// http://issues.liferay.com/browse/FACES-1228
String requestContentType = null;
if (isICEfacesLegacyMode(clientDataRequest)) {
requestContentType = clientDataRequest.getResponseContentType();
}
else {
requestContentType = clientDataRequest.getContentType();
}
if (manageIncongruities) {
incongruityContext.setRequestContentType(requestContentType);
}
return requestContentType;
}
else {
if (manageIncongruities) {
return incongruityContext.getRequestContentType();
}
else {
// TestPage166: getRequestContentTypeEventTest expects this condition to return null so throwing an
// IllegalStateException is not an option.
return null;
}
}
}
@Override
public String getRequestContextPath() {
return requestContextPath;
}
@Override
public Map<String, Object> getRequestCookieMap() {
if (requestCookieMap == null) {
requestCookieMap = new RequestCookieMap(portletRequest.getCookies());
}
return requestCookieMap;
}
@Override
public Map<String, String> getRequestHeaderMap() {
return bridgeContext.getRequestHeaderMap();
}
@Override
public Map<String, String[]> getRequestHeaderValuesMap() {
return bridgeContext.getRequestHeaderValuesMap();
}
@Override
public Locale getRequestLocale() {
if (requestLocale == null) {
requestLocale = portletRequest.getLocale();
}
return requestLocale;
}
@Override
public Iterator<Locale> getRequestLocales() {
return requestLocales;
}
@Override
public Map<String, Object> getRequestMap() {
return requestAttributeMap;
}
@Override
public Map<String, String> getRequestParameterMap() {
return bridgeContext.getRequestParameterMap();
}
@Override
public Iterator<String> getRequestParameterNames() {
return getRequestParameterMap().keySet().iterator();
}
@Override
public Map<String, String[]> getRequestParameterValuesMap() {
return bridgeContext.getRequestParameterValuesMap();
}
/**
* This method returns the relative path to the viewId that is to be rendered.
*
* @see javax.faces.context.ExternalContext#getRequestPathInfo()
*/
@Override
public String getRequestPathInfo() {
return bridgeContext.getRequestPathInfo();
}
/**
* Section 6.1.3.1 of the JSR 329 spec describes the logic for this method.
*/
@Override
public String getRequestServletPath() {
return bridgeContext.getRequestServletPath();
}
@Override
public URL getResource(String path) throws MalformedURLException {
return portletContext.getResource(path);
}
@Override
public InputStream getResourceAsStream(String path) {
return portletContext.getResourceAsStream(path);
}
@Override
public Set<String> getResourcePaths(String path) {
return portletContext.getResourcePaths(path);
}
@Override
public Object getResponse() {
// If JSP AFTER_VIEW_CONTENT processing has been activated by the
// JspViewDeclarationLanguage#buildView(FacesContext, UIViewRoot) method, then return a ServletResponse that is
// able to handle the AFTER_VIEW_CONTENT feature. This is necessary because the Mojarra
// JspViewHandlingStrategy#getWrapper(ExternalContext) method has a Servlet API dependency due to explicit casts
// to HttpServletResponse. Additionally, the MyFaces JspViewDeclarationLanguage#buildView(FacesContext,
// UIViewRoot) method has an explicit cast to HttpServletResponse.
if (bridgeContext.isProcessingAfterViewContent()) {
if (facesImplementationServletResponse == null) {
if ((bridgeAfterViewContentResponse == null) ||
(bridgeAfterViewContentResponse.getWrapped() != portletResponse)) {
BridgeWriteBehindSupportFactory bridgeWriteBehindSupportFactory = (BridgeWriteBehindSupportFactory)
BridgeFactoryFinder.getFactory(BridgeWriteBehindSupportFactory.class);
bridgeAfterViewContentResponse = bridgeWriteBehindSupportFactory.getBridgeAfterViewContentResponse(
portletResponse, getRequestLocale());
}
return bridgeAfterViewContentResponse;
}
else {
return facesImplementationServletResponse;
}
}
else {
if (isBridgeFlashServletResponseRequired()) {
return createFlashHttpServletResponse();
}
else {
return portletResponse;
}
}
}
@Override
public void setResponse(Object response) {
// Assume that the JSP_AFTER_VIEW_CONTENT feature is deactivated.
facesImplementationServletResponse = null;
// If JSP AFTER_VIEW_CONTENT processing has been activated by the bridge's
// ViewDeclarationLanguageJspImpl#buildView(FacesContext, UIViewRoot) method, then wrap the specified response
// object with a ServletResponse that is able to handle the AFTER_VIEW_CONTENT feature. This is necessary
// because the Mojarra JspViewHandlingStrategy#getWrapper(ExternalContext) method has a Servlet API dependency
// due to explicit casts to HttpServletResponse.
if (bridgeContext.isProcessingAfterViewContent()) {
// If the specified response is of type HttpServletResponseWrapper, then it is almost certain that Mojarra's
// JspViewHandlingStrategy#executePageToBuildView(FacesContext, UIViewRoot) method is attempting to wrap the
// bridge's response object (that it originally got by calling the ExternalContext#getResponse() method)
// with it's ViewHandlerResponseWrapper, which extends HttpServletResponseWrapper.
if (response instanceof HttpServletResponseWrapper) {
this.facesImplementationServletResponse = (ServletResponse) response;
HttpServletResponseWrapper httpServletResponseWrapper = (HttpServletResponseWrapper) response;
ServletResponse wrappedServletResponse = httpServletResponseWrapper.getResponse();
if (wrappedServletResponse instanceof BridgeAfterViewContentResponse) {
BridgeAfterViewContentResponse bridgeAfterViewContentPreResponse = (BridgeAfterViewContentResponse)
wrappedServletResponse;
PortletResponse wrappedPortletResponse = bridgeAfterViewContentPreResponse.getWrapped();
BridgeWriteBehindSupportFactory bridgeWriteBehindSupportFactory = (BridgeWriteBehindSupportFactory)
BridgeFactoryFinder.getFactory(BridgeWriteBehindSupportFactory.class);
BridgeWriteBehindResponse bridgeWriteBehindResponse =
bridgeWriteBehindSupportFactory.getBridgeWriteBehindResponse((MimeResponse)
wrappedPortletResponse, facesImplementationServletResponse);
// Note: See comments in BridgeContextImpl#dispatch(String) regarding Liferay's inability to
// accept a wrapped response. This is indeed supported in Pluto.
this.portletResponse = (PortletResponse) bridgeWriteBehindResponse;
}
else {
// Since we're unable to determine the wrapped PortletResponse, the following line will throw an
// intentional ClassCastException. Note that this case should never happen.
this.portletResponse = (PortletResponse) response;
}
}
// Otherwise, the specified response is of type BridgeAfterViewContentResponse, then Mojarra's
// JspViewHandlingStrategy#executePageToBuildView(FacesContext, UIViewRoot) method is trying to restore the
// bridge's response object that it originally got from calling the ExternalContext#getResponse() method
// prior to wrapping with it's ViewHandlerResponseWrapper.
else if (response instanceof BridgeAfterViewContentResponse) {
BridgeAfterViewContentResponse bridgeAfterViewContentResponse = (BridgeAfterViewContentResponse)
response;
this.portletResponse = bridgeAfterViewContentResponse.getWrapped();
}
// Otherwise, assume that the specified response is a PortletResponse.
else {
this.portletResponse = (PortletResponse) response;
}
}
// Otherwise, since the JSF AFTER_VIEW_CONTENT feature is not activated, assume that the specified response is
// a PortletResponse.
else {
this.portletResponse = (PortletResponse) response;
}
try {
boolean requestChanged = false;
boolean responseChanged = true;
preInitializeObjects(requestChanged, responseChanged);
}
catch (Exception e) {
logger.error(e);
}
}
@Override
public String getResponseCharacterEncoding() {
if (portletResponse instanceof MimeResponse) {
MimeResponse mimeResponse = (MimeResponse) portletResponse;
String characterEncoding = mimeResponse.getCharacterEncoding();
if (manageIncongruities) {
incongruityContext.setResponseCharacterEncoding(characterEncoding);
}
return characterEncoding;
}
else {
if (manageIncongruities) {
return incongruityContext.getResponseCharacterEncoding();
}
else {
if (portletResponse instanceof StateAwareResponse) {
// TCK TestPage169: getResponseCharacterEncodingActionTest
// TCK TestPage180: getResponseCharacterEncodingEventTest
throw new IllegalStateException();
}
else {
return null;
}
}
}
}
/**
* @see ExternalContext#setResponseCharacterEncoding(String)
*/
@Override
public void setResponseCharacterEncoding(String encoding) {
if (encoding != null) {
if (portletResponse instanceof ResourceResponse) {
ResourceResponse resourceResponse = (ResourceResponse) portletResponse;
resourceResponse.setCharacterEncoding(encoding);
}
else {
if (manageIncongruities) {
incongruityContext.setResponseCharacterEncoding(encoding);
}
else {
// TestPage196: setResponseCharacterEncodingTest expects this to be a no-op so throwing
// IllegalStateException is not an option.
}
}
}
}
/**
* @see {@link ExternalContext#getResponseContentType()}
*/
@Override
public String getResponseContentType() {
if (portletResponse instanceof MimeResponse) {
MimeResponse mimeResponse = (MimeResponse) portletResponse;
String responseContentType = mimeResponse.getContentType();
if (responseContentType == null) {
responseContentType = portletRequest.getResponseContentType();
}
return responseContentType;
}
else {
// TCK TestPage173: getResponseContentTypeActionTest
// TCK TestPage174: getResponseContentTypeEventTest
throw new IllegalStateException();
}
}
/**
* @see {@link ExternalContext#getSession(boolean)}
*/
@Override
public Object getSession(boolean create) {
return portletRequest.getPortletSession(create);
}
@Override
public Map<String, Object> getSessionMap() {
return sessionMap;
}
@Override
public Principal getUserPrincipal() {
if (userPrincipal == null) {
userPrincipal = portletRequest.getUserPrincipal();
}
return userPrincipal;
}
}
| [
"[email protected]"
] | |
ece51b482a2d9f3ae22001eed9803760736a4bfe | e08d9d8c054f378765d9646fcdba8171e7ef4b18 | /src/test/java/login/LoginTest.java | fbad9cab188736ed54a10cc848312551a832a1a0 | [] | no_license | nasirqa2020/seleniumHomeWork | f5b7d0717bd3864b9cb31e061b2cf335958d2e32 | 2423e1ce8ecf45a39c724241a948df5c81953c58 | refs/heads/master | 2023-06-26T20:19:08.739705 | 2021-07-17T13:59:53 | 2021-07-17T13:59:53 | 345,376,035 | 0 | 0 | null | 2021-07-17T13:59:53 | 2021-03-07T15:04:21 | Java | UTF-8 | Java | false | false | 719 | java | package login;
import base.ScriptBase;
import controller.LoginPage;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class LoginTest extends ScriptBase {
LoginPage loginPage;
@Test
public void verifyInvalidLogin() {
loginPage = new LoginPage(driver);
loginPage.inValidSigning("[email protected]", "12345");
}
@Test
public void verifyInvalidLogin2() {
loginPage = new LoginPage(driver);
loginPage.inValidSigning("[email protected]", "12345");
// @AfterTest
// public void closeBrowser(){
// driver.close();
// driver.quit();
// }
//
//
}
}
| [
"Khatun3030"
] | Khatun3030 |
3984f05460331dc00c97b3d23b5c97cfb20b222f | e9b3eb65fbff5ba3a73276c9068be793a9448bd2 | /219. Contains Duplicate II/src/solution/Solution2.java | 753ca225677688f512d7a1ed95b4c1ab41b13b67 | [] | no_license | ykes60513/Leetcode | 4bdd332404b4477a57df68a5c74aad63ede39778 | 71e507491dd7c215584c0708dea389280de18508 | refs/heads/master | 2021-11-18T15:01:36.205007 | 2021-10-21T07:37:04 | 2021-10-21T07:37:04 | 189,901,572 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package solution;
import java.util.*;
public class Solution2 {
public boolean containsNearbyDuplicate(int[] nums, int k) {
Set<Integer> set = new HashSet<>();
for (int i = 0; i < nums.length; i++) {
if (i > k)
set.remove(nums[i - k - 1]);
if (set.contains(nums[i]))
return true;
set.add(nums[i]);
}
return false;
}
}
| [
"[email protected]"
] | |
06b02f0172f016f3c13cc0ff1f1c99f72e2c87af | 0c6f69358e957a5f655459ed5482fa827d16084d | /firstsite/src/org/apachechina/fscore/dao/UserDao.java | 595cd55670edd288be6764465b66850a44fc6560 | [] | no_license | whhxp/firstfastsite | 277b00517444f894970f67d4368f84fb6adccb35 | f8f6c86fe90e867713debd5deab234f5b69b5da5 | refs/heads/master | 2021-01-01T19:24:28.679115 | 2010-01-14T09:07:23 | 2010-01-14T09:07:23 | 32,619,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | //@charset "UTF-8"
package org.apachechina.fscore.dao;
import org.apachechina.fscore.domain.User;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class UserDao extends HibernateDaoSupport{
//单例
private static UserDao instance = null;
public static synchronized UserDao getInstance() {
if (instance == null)
instance = new UserDao();
return instance;
}
public User getUserByCookieid(String userCookieid) {
return null;
}
public User getUserByName(String name) {
return null;
}
public void updateCookieid(String name, String userCookieid) {
// TODO Auto-generated method stub
}
}
| [
"nisen.cn@512cd92e-e866-11de-a5fe-b7516cc0fd57"
] | nisen.cn@512cd92e-e866-11de-a5fe-b7516cc0fd57 |
47c1ee4c9cdbe7f67cdce473d937ff063ef5c27d | 745783c5de94c738e41e3c75347962255fee8d66 | /src/firstpartialexercises/Circle1.java | 9c4bb5a76bb3d82edbaed703139f6a695af7c166 | [] | no_license | JorgeC98/FirstPartialExercisesPOO | 74168a3cc456b625e1fea3189b0e68fb799ecbdc | a942017d86bca70c7271c9724197856645979a56 | refs/heads/master | 2021-01-22T02:14:38.336565 | 2017-02-06T04:24:44 | 2017-02-06T04:24:44 | 81,038,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,660 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package firstpartialexercises;
/**
*
* @author JorgeRicardo
*/
public class Circle1 {
private double radius;
private String color;
//CONSTRUCTOR
public Circle1() {
radius = 1.0;
color = "red";
//this(1.0, "red");
}
public Circle1 (double radius) {
this.radius = radius;
color = "red";
//this(radius,"red");
}
public Circle1 (String color) {
this.radius = 1.0 ;
this.color = color;
//this(1.0,color);
}
public Circle1 (double radius, String color) {
this.radius = radius;
this.color = color;
//this(radius,color);
}
//GET & SET
public double getRadius() {
return this.radius;
}
public String getColor() {
return this.color;
}
public void SetRadius(double radius) {
this.radius = radius;
}
public void SetColor(String color) {
this.color = color;
}
@Override
public String toString() {
/*String temp;
temp = "Circle(radius=" + this.radius + ", color=" + this.color + ")";
return temp;*/
return "Circle(radius=" + this.radius + ", color=" + this.color + ")";
}
//SACAR EL AREA
public double getArea(){
return this.radius*this.radius*Math.PI;
}
} | [
"[email protected]"
] | |
9dd65725917c4fb73accc26f55d93cbaca4a0296 | abba07c400c93c7034c87384d26ffa75fc4d5747 | /src/main/java/com/producter/intern/InternApplication.java | e18dd2dfa24f1ed1acd0d0ad0c528ae92d310279 | [] | no_license | oguzdursun06/GraphQL-Spring | f4c5ad7a28c69c395688c2874bd1b25286df34ad | ab5d900ea7673ca3e95d1635da4e017f6d7dc0cb | refs/heads/main | 2023-04-06T11:42:11.875681 | 2021-04-18T20:06:13 | 2021-04-18T20:06:13 | 359,241,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.producter.intern;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class InternApplication {
public static void main(String[] args) {
SpringApplication.run(InternApplication.class, args);
}
}
| [
"[email protected]"
] | |
a13d7209b44881c10af106b7c8a3795f2dd73725 | d046a41a41f4181b8f538cdfd6c5bf22c95c185c | /vtracer-server/src/main/java/none/nintha/vtracer/util/PagerWrapper.java | ac51572c71eea87005873b7d60195ed85cd3ff16 | [] | no_license | Justice-Eternal/vtracer | b06629ca2da45dfe3053691a9ea5c0518c8165c2 | f13bc41a49651dfd860908ae1e8b5d0adefff7ff | refs/heads/master | 2020-03-23T10:34:33.238488 | 2018-07-18T13:59:19 | 2018-07-18T13:59:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,204 | java | package none.nintha.vtracer.util;
import com.google.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
public class PagerWrapper {
private static final Logger logger = LoggerFactory.getLogger(PagerWrapper.class);
private final static ExecutorService executors = Executors.newFixedThreadPool(8);
private final static int PAGE_SIZE = 500;
public static <R> List<R> list(long total, BiFunction<Long, Integer, List<R>> func) {
return shrink(total, 1, func);
}
/**
* 间隔取值,每interval个元素取一个值
*/
public static <R> List<R> shrink(long total, int interval, BiFunction<Long, Integer, List<R>> func) {
if (total == 0) return Collections.emptyList();
List<List<R>> wrapList = Lists.newArrayList();
long pageTotal = total / PAGE_SIZE + (total % PAGE_SIZE == 0 ? 0 : 1);
// logger.info("一共 " + pageTotal);
final CountDownLatch latch = new CountDownLatch((int) pageTotal);
for (long skip = 0; skip < total; skip += PAGE_SIZE) {
final long skipTemp = skip;
final List<R> sublist = Lists.newArrayList();
wrapList.add(sublist);
executors.execute(() -> {
List<R> tlist = func.apply(skipTemp, PAGE_SIZE);
int[] index = {0};
tlist = tlist.stream().filter(v -> index[0]++ % interval == 0).collect(Collectors.toList());
sublist.addAll(tlist);
latch.countDown();
// logger.info("剩下 " + latch.getCount());
});
}
try {
latch.await();
} catch (InterruptedException e) {
logger.error("PagerWrapper 异常", e);
return Collections.emptyList();
}
return wrapList.stream().flatMap(List::stream).collect(Collectors.toList());
}
}
| [
"[email protected]"
] | |
4f5ebba2954d339ac61eb0e5a6bf33ee6915ee7c | 4814027946324458ba9014dd27cd7765bae6b8f6 | /app/src/main/java/cn/org/bjca/cipherproxy/utils/Obj2Json.java | 72c7ad5cdd284d42436685023e348466c57523e1 | [] | no_license | wutengfei/CipherProxy | b055c03431fa1e2bdd3d5890e2630b4f698034f8 | 4bd8bec24a5cb5b2dd8159a74fa801ca1771f39b | refs/heads/master | 2020-05-17T08:52:07.398586 | 2019-04-29T10:48:20 | 2019-04-29T10:48:20 | 183,618,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,014 | java | package cn.org.bjca.cipherproxy.utils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by YeLiang on 2017/7/3.
*/
public class Obj2Json {
/**
* 此方法会将一个对象转换成json字符串
*
* @param object 将要被转成json字符串的对象
* @return json字符串
*/
public static String toJson(Object object) {
//JSON载体
StringBuffer jsonBuffer = new StringBuffer();
//判断是否是集合类型
if (object instanceof List<?>) {
jsonBuffer.append("[");
List<?> list = (List<?>) object;
//循环读取集合类型
for (int i = 0; i < list.size(); i++) {
addObjectToJson(jsonBuffer, list.get(i));
//jsonArray添加 逗号分隔
if (i < list.size() - 1) {
jsonBuffer.append(",");
}
}
jsonBuffer.append("]");
} else {
addObjectToJson(jsonBuffer, object);
}
return jsonBuffer.toString();
}
/**
* 解析单独的JSONobject类型
* 递归
*
* @param jsonBuffer
* @param object
*/
private static void addObjectToJson(StringBuffer jsonBuffer, Object object) {
jsonBuffer.append("{"); //{
List<Field> fields = new ArrayList<>();
getAllFields(object.getClass(), fields);
for (int i = 0; i < fields.size(); i++) {
Method method = null;
//1 获取field
Field field = fields.get(i);
Object fieldVlaue = null;
String fieldName = field.getName();
String methodName = "get" + ((char) (fieldName.charAt(0) - 32) + fieldName.substring(1));
try {
//2 获取到Method对象
method = object.getClass().getMethod(methodName);
} catch (NoSuchMethodException e1) {
if (!fieldName.startsWith("is")) {
methodName = "is" + ((char) (fieldName.charAt(0) - 32) + fieldName.substring(1));
}
try {
method = object.getClass().getMethod(methodName);
} catch (NoSuchMethodException e2) {
replaceChar(i, fields, jsonBuffer);
continue;
}
}
if (method != null) {
try {
//3 通过get方法获取成员变量的值
fieldVlaue = method.invoke(object);
} catch (Exception e) {
replaceChar(i, fields, jsonBuffer);
continue;
}
}
if (fieldVlaue != null) {
jsonBuffer.append("\""); //{"
jsonBuffer.append(fieldName); //{"name
jsonBuffer.append("\":"); //{"name":
if (fieldVlaue instanceof Integer || fieldVlaue instanceof Double ||
fieldVlaue instanceof Long || fieldVlaue instanceof Boolean) {
jsonBuffer.append(fieldVlaue.toString());// {"name":1
} else if (fieldVlaue instanceof String) {
jsonBuffer.append("\"");
jsonBuffer.append(fieldVlaue.toString());// {"name":"张三"
jsonBuffer.append("\"");
} else if (fieldVlaue instanceof List<?>) {
addListToBuffer(jsonBuffer, fieldVlaue);
} else if (fieldVlaue instanceof Map) {
//TODO
} else {
addObjectToJson(jsonBuffer, fieldVlaue);
}
jsonBuffer.append(","); // {"name":"张三",
}
if (i == fields.size() - 1 && jsonBuffer.charAt(jsonBuffer.length() - 1) == ',') {
jsonBuffer.deleteCharAt(jsonBuffer.length() - 1);
}
}
jsonBuffer.append("}"); //{"name":"张三",}
}
/**
* 如果最后一个字符是 , 就删除此字符
*
* @param i
* @param fields
* @param jsonBuffer
*/
public static void replaceChar(int i, List<Field> fields, StringBuffer jsonBuffer) {
if (i == fields.size() - 1 && jsonBuffer.charAt(jsonBuffer.length() - 1) == ',') {
//删除最后一个字符
jsonBuffer.deleteCharAt(jsonBuffer.length() - 1);
}
}
/**
* 获取当前类中的所有的成员变量
*
* @param aClass 成员变量所在的类
* @param fields aClass中所有的成员变量
*/
private static void getAllFields(Class<?> aClass, List<Field> fields) {
if (fields == null) {
fields = new ArrayList<>();
}
//排除Object类型
if (aClass.getSuperclass() != null) {
//获取到当前class的所有成员变量的Field
Field[] fieldSelf = aClass.getDeclaredFields();
for (Field field : fieldSelf) {
//排除当前Class的所有成员变量的Field
if (!Modifier.isFinal(field.getModifiers())) {
fields.add(field);
}
}
//获取到父类的所有成员变量
getAllFields(aClass.getSuperclass(), fields);
}
}
/**
* 当Json字符串中包含集合时
*
* @param jsonBuffer
* @param fieldValue
*/
private static void addListToBuffer(StringBuffer jsonBuffer, Object fieldValue) {
List<?> list = (List<?>) fieldValue;
jsonBuffer.append("[");
for (int i = 0; i < list.size(); i++) {
addObjectToJson(jsonBuffer, list.get(i));
if (i < list.size() - 1) {
jsonBuffer.append(",");
}
}
jsonBuffer.append("]");
}
}
| [
"[email protected]"
] | |
887cc801687e42a1bafb6d57cab5b1a35e2a16a8 | af79916025156e3d0cf4986b126fbe7f059753e2 | /web/dx/houqin/src/main/java/com/houqin/controller/food/FoodTypeController.java | 339a8aaafc773bcfc1af2ffd14bb115f6216fa33 | [] | no_license | Letmebeawinner/yywt | 5380680fadb7fc0d4c86fb92234f7c69cb216010 | 254fa0f54c09300d4bdcdf8617d97d75003536bd | refs/heads/master | 2022-12-26T06:17:11.755486 | 2020-02-14T10:04:29 | 2020-02-14T10:04:29 | 240,468,510 | 0 | 0 | null | 2022-12-16T11:36:21 | 2020-02-14T09:08:31 | Roff | UTF-8 | Java | false | false | 5,000 | java | package com.houqin.controller.food;
import com.a_268.base.constants.ErrorCode;
import com.a_268.base.controller.BaseController;
import com.a_268.base.core.Pagination;
import com.houqin.biz.equipment.EquipmentBiz;
import com.houqin.biz.food.FoodTypeBiz;
import com.houqin.controller.equipment.EquipmentController;
import com.houqin.entity.food.FoodType;
import com.houqin.utils.GenerateSqlUtil;
import org.apache.tools.ant.taskdefs.condition.Http;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.security.Key;
import java.util.List;
import java.util.Map;
/**
* 食材分类
*
* @author wanghailong
* @create 2017-07-25-上午 10:18
*/
@Controller
@RequestMapping("/admin/houqin")
public class FoodTypeController extends BaseController {
private static Logger logger = LoggerFactory.getLogger(FoodTypeController.class);
//添加食材分类
private static final String toAddFoodType = "/food/add-foodType";
//更新食材分类
private static final String toUpdateFoodType = "/food/update-foodType";
//食材分类列表
private static final String foodTypeList = "/food/foodType_list";
@Autowired
private FoodTypeBiz foodTypeBiz;
@InitBinder("foodType")
public void initFoodType(WebDataBinder binder) {
binder.setFieldDefaultPrefix("foodType.");
}
/**
* 跳转添加页面
*
* @param request
* @return
*/
@RequestMapping("/toAddFoodType")
public String toAddFoodType(HttpServletRequest request) {
return toAddFoodType;
}
/**
* 添加方法
*
* @param request
* @param foodType
* @return
*/
@RequestMapping("/addFoodType")
@ResponseBody
public Map<String, Object> addFoodType(HttpServletRequest request, @ModelAttribute("foodType") FoodType foodType) {
try {
foodTypeBiz.save(foodType);
} catch (Exception e) {
logger.info("FoodTypeController--addFoodType", e);
return this.resultJson(ErrorCode.ERROR_DATA, ErrorCode.SYS_ERROR_MSG, null);
}
return this.resultJson(ErrorCode.SUCCESS, ErrorCode.SUCCESS_MSG, null);
}
/**
* 去查询
*
* @param request
* @param foodType
* @param pagination
* @return
*/
@RequestMapping("/selectAllFoodType")
public String selectAllFoodType(HttpServletRequest request, @ModelAttribute("foodType") FoodType foodType, @ModelAttribute("pagination") Pagination pagination) {
try {
String whereSql = GenerateSqlUtil.getSql(foodType);
pagination.setRequest(request);
List<FoodType> foodTypeList = foodTypeBiz.find(pagination, whereSql);
request.setAttribute("foodTypeList", foodTypeList);
request.setAttribute("foodType", foodType);
} catch (Exception e) {
e.printStackTrace();
logger.info("FoodTypeController--selectAllFoodType", e);
}
return foodTypeList;
}
/**
* 去更新
*
* @param request
* @param id
* @return
*/
@RequestMapping("/toUpdateFoodType")
public String toUpdateFoodType(HttpServletRequest request, @RequestParam("id") Long id) {
try {
FoodType foodType = foodTypeBiz.findById(id);
request.setAttribute("foodType", foodType);
} catch (Exception e) {
e.printStackTrace();
logger.info("FoodTypeController--toUpdateFoodType", e);
}
return toUpdateFoodType;
}
/**
* 更新
*
* @param request
* @param foodType
* @return
*/
@RequestMapping("/updateFoodType")
@ResponseBody
public Map<String, Object> updateFoodType(HttpServletRequest request, @ModelAttribute("foodType") FoodType foodType) {
try {
foodTypeBiz.update(foodType);
} catch (Exception e) {
logger.info("FoodTypeController--updateFoodType", e);
return this.resultJson(ErrorCode.ERROR_DATA, ErrorCode.SYS_ERROR_MSG, null);
}
return this.resultJson(ErrorCode.SUCCESS, ErrorCode.SUCCESS_MSG, null);
}
/**
* 删除
* @param request
* @param id
* @return
*/
@RequestMapping("/delFoodType")
@ResponseBody
public Map<String, Object> delFoodType(HttpServletRequest request, @RequestParam("id")Long id) {
try {
foodTypeBiz.deleteById(id);
} catch (Exception e) {
logger.info("FoodTypeController--delFoodType", e);
return this.resultJson(ErrorCode.ERROR_DATA, ErrorCode.SYS_ERROR_MSG, null);
}
return this.resultJson(ErrorCode.SUCCESS, ErrorCode.SUCCESS_MSG, null);
}
}
| [
"[email protected]"
] | |
4281f40d0fc6edcc8fd239802e00b5581a8cf3ba | dd3aa8ef4f470cc2ccf708389c8dc9c98c687cf2 | /app/src/main/java/com/foora/perevozkadev/ui/add_order/route/RouteFragment.java | 6a3eed9f5a48be70053817ab7ced70e73b7c6e5b | [] | no_license | matvapps/Trucker | e986b45347bf38d86e319d376d6179cf6effd73c | a4f32ffad8fae90b10c2dd40dd32eecbebf86179 | refs/heads/master | 2020-04-12T18:54:43.519584 | 2019-06-19T09:57:12 | 2019-06-19T09:57:12 | 162,693,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,027 | java | package com.foora.perevozkadev.ui.add_order.route;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.foora.foora.perevozkadev.R;
import com.foora.perevozkadev.ui.add_order.model.Place;
import com.foora.perevozkadev.ui.add_order.route.model.RouteItem;
import com.foora.perevozkadev.ui.base.BaseFragment;
import com.foora.perevozkadev.utils.ViewUtils;
import com.foora.perevozkadev.utils.custom.places.PlaceAutoCompleteTextView;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by Alexandr.
*/
public class RouteFragment extends BaseFragment {
public static final String TAG = RouteFragment.class.getSimpleName();
@BindView(R.id.btn_main)
Button btnMain;
@BindView(R.id.routes_list)
LinearLayout loadList;
@BindView(R.id.routes_list_2)
LinearLayout unloadList;
private Callback listener;
private List<Place> loadingPlaces;
private List<Place> unloadingPlaces;
public static RouteFragment newInstance() {
Bundle args = new Bundle();
RouteFragment fragment = new RouteFragment();
fragment.setArguments(args);
return fragment;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_route, container, false);
setUnBinder(ButterKnife.bind(this, rootView));
return rootView;
}
@OnClick(R.id.btn_main)
void onClick() {
if (listener != null) {
for (int i = 0; i < loadList.getChildCount(); i++) {
PlaceAutoCompleteTextView placeAutoCompleteTextView = (PlaceAutoCompleteTextView) loadList.getChildAt(i);
String name = placeAutoCompleteTextView.getText();
if (!name.isEmpty())
loadingPlaces.add(new Place(i, name));
}
for (int i = 0; i < unloadList.getChildCount(); i++) {
PlaceAutoCompleteTextView placeAutoCompleteTextView = (PlaceAutoCompleteTextView) unloadList.getChildAt(i);
String name = placeAutoCompleteTextView.getText();
if (!name.isEmpty())
unloadingPlaces.add(new Place(i, name));
}
if (loadingPlaces.size() == 0) {
onError("Заполните место погрузки");
return;
}
if (unloadingPlaces.size() == 0) {
onError("Заполните место выгрузки");
return;
}
listener.onReceiveRoutes(loadingPlaces, unloadingPlaces);
}
}
@OnClick(R.id.add_route)
void onAddLoadRoute() {
loadList.addView(getPlaceAutoCompleteTxtv(RouteItem.Type.LOADING_PLACE));
}
@OnClick(R.id.add_route_2)
void onAddUnLoadRoute() {
unloadList.addView(getPlaceAutoCompleteTxtv(RouteItem.Type.UNLOADING_PLACE));
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
listener = (Callback) context;
}
public Callback getListener() {
return listener;
}
public void setListener(Callback listener) {
this.listener = listener;
}
@Override
protected void setUp(View view) {
loadingPlaces = new ArrayList<>();
unloadingPlaces = new ArrayList<>();
loadList.addView(getPlaceAutoCompleteTxtv(RouteItem.Type.LOADING_PLACE));
unloadList.addView(getPlaceAutoCompleteTxtv(RouteItem.Type.UNLOADING_PLACE));
}
private PlaceAutoCompleteTextView getPlaceAutoCompleteTxtv(RouteItem.Type type) {
PlaceAutoCompleteTextView placeAutoCompleteTextView = new PlaceAutoCompleteTextView(getContext());
switch (type) {
case LOADING_PLACE:
break;
case UNLOADING_PLACE:
break;
}
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, ViewUtils.dpToPx(8), 0, 0);
placeAutoCompleteTextView.setLayoutParams(layoutParams);
return placeAutoCompleteTextView;
}
private boolean containsItemWithId(List<Place> items, int id) {
for (Place item : items) {
if (item.getId() == id)
return true;
}
return false;
}
public interface Callback {
void onReceiveRoutes(List<Place> loadingPlaces, List<Place> unloadingPlaces);
}
}
| [
"[email protected]"
] | |
30f99d408e310353ca31aeaf34f9a6b8c62faabb | 4256d89036633adeb31cf6787cd0bfd675fbeed4 | /src/com/javaKnowledge/Setter.java | 80c8e14f08a7953a26190ca69410a27ac4cd5e3a | [] | no_license | MubashirAhmmedJamy/Learning-Spring_5_Core | b83f1b4f617911d146582c14e99c3722d2da8027 | def87bb37d8f6434c45b09536ec5399238b9cfd9 | refs/heads/master | 2022-12-17T06:32:29.710043 | 2020-09-24T03:12:28 | 2020-09-24T03:12:28 | 257,270,544 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.javaKnowledge;
import java.util.List;
/**
*
* @author Jamy
*/
public class Setter {
String s;
List <Address> get;
public String getS() {
return s;
}
public void setS(String s) {
this.s = s;
}
public List<Address> getGet() {
return get;
}
public void setGet(List<Address> get) {
this.get = get;
}
public void show(){
System.out.println("Setter class working");
System.out.println(s);
System.out.println(get);
}
}
| [
"[email protected]"
] | |
d89de1e985b1c78c27747852e4fbe53741633705 | 60777333efa695e0dfc33168be33965fd4f5c4eb | /src/Transport/AirTransport/PassengerPlane.java | 90d4ce1d4b02ad29599330004d26f16417cee8aa | [] | no_license | Mason15011988/Company | 774550d3cf2df224c96d64ffb795626489edc117 | 6ca3a9062e5d478fa93b0dabcbe01624d3a79ade | refs/heads/master | 2020-04-02T12:46:37.690901 | 2018-10-24T06:36:29 | 2018-10-24T06:36:29 | 154,451,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package Transport.AirTransport;
public class PassengerPlane extends AirTransport {
public PassengerPlane(String name, int numberPassengers, double weight,int speed, int price) {
super(name, numberPassengers, weight,speed, price);
}
public PassengerPlane() {
}
public void show(){
System.out.println("PassengerPlane: name = "+getName() +" , NumberPassengers = "+ getNumberPassengers()+" , Weight = "+ getWeight()
+" ,Speed = "+ getSpeed()+ " , Price = " + getPrice());
}
}
| [
"[email protected]"
] | |
8a18f641ada5be7a83867bc7500abb3049b37537 | 05e5eb6fe488df32ec37e8b1793c7542df27d028 | /src/main/java/io/gof/peyek/ApplicationWebXml.java | d3e40503f5784468a2247b0ce65bccfe0a6dee6a | [] | no_license | BulkSecurityGeneratorProject/peyek2 | 04e2a65f3d9daa889e0608fedbb72fa305543b2c | 56313db728825ee6d99971d523edcd8c65ce196a | refs/heads/master | 2022-12-10T06:47:41.004300 | 2015-12-02T06:12:12 | 2015-12-02T06:12:12 | 296,567,524 | 0 | 0 | null | 2020-09-18T08:53:59 | 2020-09-18T08:53:59 | null | UTF-8 | Java | false | false | 1,250 | java | package io.gof.peyek;
import io.gof.peyek.config.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
* This is a helper Java class that provides an alternative to creating a web.xml.
*/
public class ApplicationWebXml extends SpringBootServletInitializer {
private final Logger log = LoggerFactory.getLogger(ApplicationWebXml.class);
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.profiles(addDefaultProfile())
.sources(Application.class);
}
/**
* Set a default profile if it has not been set.
* <p>
* Please use -Dspring.profiles.active=dev
* </p>
*/
private String addDefaultProfile() {
String profile = System.getProperty("spring.profiles.active");
if (profile != null) {
log.info("Running with Spring profile(s) : {}", profile);
return profile;
}
log.warn("No Spring profile configured, running with default configuration");
return Constants.SPRING_PROFILE_DEVELOPMENT;
}
}
| [
"[email protected]"
] | |
f9d8ca070529aaa6789e0b1c26c00906f880eaed | fc48ef8f5c5419d50ca26d8d1a2111af77a99535 | /tlogTool/src/com/zxhd/tlogTool/entity/FieldObject.java | 4b1446106b7d3763fa9d03ce2939fdaecd90db37 | [] | no_license | virackt/tlogSqlVSCodeProducer | 741ff0925e3113e62c98654db6e9bdb075fdb7c6 | 6f45e615d28194d51ca9b5f055bad85bac12ab4c | refs/heads/master | 2020-04-06T04:30:23.973552 | 2014-08-30T14:15:43 | 2014-08-30T14:15:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,702 | java | package com.zxhd.tlogTool.entity;
public class FieldObject {
// SQL类型
public String sqlType;
// java类型
private String javaType;
// 属性名
public String name;
// set方法
public String setMethod;
// get方法
public String getMethod;
// comment
public String comment;
public String getSqlType() {
return sqlType;
}
public void setSqlType(String sqlType) {
this.sqlType = sqlType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSetMethod() {
return setMethod;
}
public void setSetMethod(String setMethod) {
this.setMethod = setMethod;
}
public String getGetMethod() {
return getMethod;
}
public void setGetMethod(String getMethod) {
this.getMethod = getMethod;
}
public void setJavaType(String javaType) {
this.javaType = javaType;
}
public String getJavaType(){
return this.javaType;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public FieldObject(String type, String name, String comment) {
super();
this.sqlType = type;
changeToJavaType();
this.name = name;
this.comment = comment;
this.setMethod = "public void set" + name.substring(0,1).toUpperCase() + name.substring(1) + "(" + javaType + " " + name + "){";
this.getMethod = "public " + javaType + " get" + name.substring(0, 1).toUpperCase() + name.substring(1) + "(){";
}
private void changeToJavaType(){
if(sqlType.contains("int")){
this.javaType = "int";
} else if(sqlType.contains("varchar")){
this.javaType = "String";
} else if (sqlType.contains("time")){
this.javaType = "String";
}
}
}
| [
"[email protected]"
] | |
f3f26a791f6830b55a8b3bdfcb0bb8cf7b1329de | b9eb9fef0205a1aa1a3509d9e7f6fe1cc3300327 | /theoldone822/NetherrocksFusion/Items/ItemExtendedAxe.java | 4b62b45c80aee0aa56818aed2c72f9849d62aaff | [] | no_license | Skrallexxx/TheOldOne822Minecraftmods | fd537a237164c35bbb11eacc1073e06beec3f124 | d7451435ac556a1b969f7f022338fda841e9abec | refs/heads/master | 2021-05-27T21:41:09.757104 | 2014-01-19T06:48:46 | 2014-01-19T06:48:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,634 | java | package theoldone822.NetherrocksFusion.Items;
import static theoldone822.NetherrocksFusion.NetherrocksFusion.extendedValues.increaseToolAttackDamage;
import static theoldone822.NetherrocksFusion.NetherrocksFusion.extendedValues.increaseToolDurability;
import static theoldone822.NetherrocksFusion.NetherrocksFusion.extendedValues.increaseToolPower;
import java.util.ArrayList;
import java.util.Random;
import theoldone822.NetherrocksFusion.Content;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class ItemExtendedAxe extends ItemAxe
{
public ItemExtendedAxe(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1, par2EnumToolMaterial);
setMaxDamage((int)(getMaxDamage() * increaseToolDurability));
this.damageVsEntity *= increaseToolAttackDamage;
}
@Override
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return super.getStrVsBlock(par1ItemStack, par2Block) * increaseToolPower;
}
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) {
if (this.itemID == Content.extendeddragonbezoarAxe.itemID) {
par1ItemStack.damageItem(1, par3EntityLivingBase);
par2EntityLivingBase.setFire(100);
par3EntityLivingBase.addPotionEffect(new PotionEffect(Potion.nightVision.id, 3600));
par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.blindness.id, 60));
if (!(par2EntityLivingBase instanceof EntityPlayer)) {
par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 3));
}
}
if (this.itemID == Content.extendedpyralisAxe.itemID) {
par1ItemStack.damageItem(1, par3EntityLivingBase);
par2EntityLivingBase.setFire(50);
par3EntityLivingBase.addPotionEffect(new PotionEffect(Potion.nightVision.id, 1200));
par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.blindness.id, 20));
if (!(par2EntityLivingBase instanceof EntityPlayer)) {
par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
}
}
par1ItemStack.damageItem(1, par3EntityLivingBase);
return true;
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
if (this.itemID == Content.extendeddragonbezoarAxe.itemID || this.itemID == Content.extendedpyralisAxe.itemID) {
if (par7 == 0) {
par5--;
}
if (par7 == 1) {
par5++;
}
if (par7 == 2) {
par6--;
}
if (par7 == 3) {
par6++;
}
if (par7 == 4) {
par4--;
}
if (par7 == 5) {
par4++;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
return false;
}
int var11 = par3World.getBlockId(par4, par5, par6);
if (var11 == 0) {
par3World.playSoundEffect(par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, Item.itemRand.nextFloat() * 0.4F + 0.8F);
par3World.setBlock(par4, par5, par6, Block.fire.blockID);
}
return true;
}
return true;
}public boolean onBlockStartBreak(ItemStack itemstack, int i, int j, int k, EntityPlayer player) {
Random random = new Random();
if (itemID == Content.extendeddragonbezoarAxe.itemID && !player.capabilities.isCreativeMode) {
Boolean flag = false;
World world = player.worldObj;
int blockID = world.getBlockId(i, j, k);
int meta = world.getBlockMetadata(i, j, k);
NBTTagList ench = itemstack.getEnchantmentTagList();
short level = 0;
if (ench != null) {
for (int x = 0; x < ench.tagCount(); x++) {
NBTTagCompound nbt = (NBTTagCompound) ench.tagAt(x);
short id = nbt.getShort("id");
if (id == Enchantment.fortune.effectId) {
level = nbt.getShort("lvl");
}
}
}
ArrayList<ItemStack> items = Block.blocksList[blockID].getBlockDropped(world, i, j, k, meta, level);
if (items == null || items.size() == 0) {
return false;
}
if (Block.blocksList[blockID] != null && getStrVsBlock(itemstack, Block.blocksList[blockID], meta) > 1.0F) {
for (ItemStack item : items) {
if (FurnaceRecipes.smelting().getSmeltingResult(item) == null) {
return false;
}
int var3 = random.nextInt(level + 2) - 1;
if (var3 < 0) {
var3 = 0;
}
int quantity = Block.blocksList[blockID].quantityDropped(random) * (var3 + 1);
ItemStack drop = new ItemStack(FurnaceRecipes.smelting().getSmeltingResult(item).copy().itemID, quantity, meta);
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F, Block.blocksList[blockID].stepSound.getBreakSound(),
(Block.blocksList[blockID].stepSound.getVolume() + 1.0F) / 2.0F, Block.blocksList[blockID].stepSound.getPitch() * 0.8F);
world.setBlock(i, j, k, 0);
if (!world.isRemote) {
EntityItem entityitem = new EntityItem(world, i + 0.5, j + 0.5, k + 0.5, drop);
world.spawnEntityInWorld(entityitem);
}
itemstack.damageItem(1, player);
flag = true;
}
}
return flag;
} else
return false;
}
}
| [
"[email protected]"
] | |
394498f8352b872abfe59ddcd1258ebb34150b40 | 2dc4ede39d3f6633ebfe9ebbb0fa8fdb15468277 | /src/main/java/com/igitras/auth/common/audit/AbstractAuditable.java | 509a1f969412efa43e9de41ed645b0d1df0d3fbc | [
"Apache-2.0"
] | permissive | igitras-blog/auth-server | b782d456e93fac85277aac0467898f69dd94d703 | 7bb3c1214bcabab480d289604f4201397f9b3c2c | refs/heads/master | 2021-01-10T10:18:53.975072 | 2016-03-17T17:14:50 | 2016-03-17T17:14:50 | 52,770,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,020 | java | package com.igitras.auth.common.audit;
import com.igitras.auth.common.Auditable;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.AbstractPersistable;
import java.io.Serializable;
import java.time.ZonedDateTime;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
/**
* Abstract base class for auditable entities. Stores the audition values in persistent fields.
*
* @param <PK> the type of the auditing type's idenifier
* @author mason
*/
@MappedSuperclass
public abstract class AbstractAuditable<PK extends Serializable> extends AbstractPersistable<PK>
implements Auditable<String, PK> {
private static final long serialVersionUID = 8771767911665503172L;
@CreatedBy
private String createdBy;
@CreatedDate
private ZonedDateTime createdDate;
@LastModifiedBy
private String lastModifiedBy;
@LastModifiedDate
private ZonedDateTime lastModifiedDate;
@Override
public String getCreatedBy() {
return createdBy;
}
@Override
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
@Override
public ZonedDateTime getCreatedDate() {
return createdDate;
}
@Override
public void setCreatedDate(ZonedDateTime createdDate) {
this.createdDate = createdDate;
}
@Override
public String getLastModifiedBy() {
return lastModifiedBy;
}
@Override
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
@Override
public ZonedDateTime getLastModifiedDate() {
return lastModifiedDate;
}
@Override
public void setLastModifiedDate(ZonedDateTime lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
}
| [
"[email protected]"
] | |
a92dfd4417dac26bda7254022b31c3eddee27a2c | ba5e1165d1aeb367d6f4877e221595573acdcf97 | /src/main/java/org/chromium/network/mojom/CspHashSource.java | e84907abe7dc1e3499cb30124239c8b757db45d8 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Guang1234567/chromium-aw | 2105269c8f13147f71fa7bf1c346a132ba257f6f | 8d4b9ec65c3bd31f774962e0c177d9c92aa6a7e7 | refs/heads/master | 2023-03-31T07:43:30.009428 | 2021-03-21T16:34:12 | 2021-03-21T16:34:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,178 | java | // CspHashSource.java is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is autogenerated by:
// mojo/public/tools/bindings/mojom_bindings_generator.py
// For:
// services/network/public/mojom/content_security_policy.mojom
//
package org.chromium.network.mojom;
public final class CspHashSource extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int algorithm;
public byte[] value;
private CspHashSource(int version) {
super(STRUCT_SIZE, version);
}
public CspHashSource() {
this(0);
}
public static CspHashSource deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static CspHashSource deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static CspHashSource decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
CspHashSource result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new CspHashSource(elementsOrVersion);
{
result.algorithm = decoder0.readInt(8);
CspHashAlgorithm.validate(result.algorithm);
}
{
result.value = decoder0.readBytes(16, org.chromium.mojo.bindings.BindingsHelper.NOTHING_NULLABLE, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.algorithm, 8);
encoder0.encode(this.value, 16, org.chromium.mojo.bindings.BindingsHelper.NOTHING_NULLABLE, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
}
} | [
"[email protected]"
] | |
8ea512456cb4ea3c6d3db8f7accc7e16f80d5cae | 6dd34eac55295242cf9b30f862aa54cfc642f204 | /app/src/main/java/com/londonappbrewery/destini/StoryNode.java | 294b22af3228ee8ddd999d2641f079ef14363ebe | [] | no_license | londonappbrewery/destini-android-danielhorwitz | 8a97b3a4c74204b40ce7902fe5f9590513c00c66 | 8c842d16bd7dd95430715dd67213de9be6d6f2c7 | refs/heads/master | 2023-01-28T23:01:21.188430 | 2020-12-10T15:34:59 | 2020-12-10T15:34:59 | 320,276,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,826 | java | package com.londonappbrewery.destini;
public class StoryNode {
private int mNodeKey;
private int mStoryStringId;
private int mAnswerOneStringId;
private StoryNode mAnswerOneNextNode;
private int mAnswerTwoStringId;
private StoryNode mAnswerTwoNextNode;
private StoryNode mNextNode;
static public StoryNode getRootNode() {
return buildNodeTree();
}
static public StoryNode getSpecifiedNode(int nodeKey) {
int myKey = Math.max(nodeKey, 1);
for (StoryNode curNode = buildNodeTree(); curNode != null; curNode = curNode.mNextNode) {
if (curNode.mNodeKey == myKey) {
return curNode;
}
}
return null;
}
public int getStoryStringId() {
return mStoryStringId;
}
public int getAnswerOneStringId() {
return mAnswerOneStringId;
}
public int getAnswerTwoStringId() {
return mAnswerTwoStringId;
}
public int getNodeKey() {
return mNodeKey;
}
// Get the next node for the answer.
// Param -
// followAnswerOne - True if following answer one, false if following answer two.
// Returns -
// The appropriate node for the answer. Returns null if a leaf node.
public StoryNode nextNodeForAnswer(boolean followAnswerOne) {
return followAnswerOne ? mAnswerOneNextNode : mAnswerTwoNextNode;
}
// Is this a leaf node?
// Returns -
// True if a leaf node, false if there are answers to follow.
public boolean isLeafNode() {
return (mAnswerOneNextNode == null);
}
private StoryNode(int nodeKey,
int storyStringId,
int answerOneStringId,
StoryNode answerOneNextNode,
int answerTwoStringId,
StoryNode answerTwoNextNode,
StoryNode nextNode) {
mNodeKey = nodeKey;
mStoryStringId = storyStringId;
mAnswerOneStringId = answerOneStringId;
mAnswerOneNextNode = answerOneNextNode;
mAnswerTwoStringId = answerTwoStringId;
mAnswerTwoNextNode = answerTwoNextNode;
mNextNode = nextNode;
}
static private StoryNode buildNodeTree() {
StoryNode t6 = new StoryNode(6, R.string.T6_End, 0, null, 0, null, null);
StoryNode t5 = new StoryNode(5, R.string.T5_End, 0, null, 0, null, t6);
StoryNode t4 = new StoryNode(4, R.string.T4_End, 0, null, 0, null, t5);
StoryNode t3 = new StoryNode(3, R.string.T3_Story, R.string.T3_Ans1, t6, R.string.T3_Ans2, t5, t4);
StoryNode t2 = new StoryNode(2, R.string.T2_Story, R.string.T2_Ans1, t3, R.string.T2_Ans2, t4, t3);
return new StoryNode(1, R.string.T1_Story, R.string.T1_Ans1, t3, R.string.T1_Ans2, t2, t2);
}
}
| [
"[email protected]"
] | |
b35aeb9d2aa682141b4ee67adb43acbeabdebe3a | 4f4e3d5d1404cf94396e0064326fffd51e86f266 | /switchbreak.java | cee60bcee86c0408104b12d7a295f961363d53ad | [] | no_license | AkhilaThirumalareddy/java | de6f7f93f0b58f92b9b1cb4bb72998bba14a308d | b0a7db7e63190aeb76503badaa6fe64a8e3c6792 | refs/heads/master | 2022-12-07T01:38:06.404740 | 2020-09-09T13:41:10 | 2020-09-09T13:41:10 | 280,202,218 | 0 | 0 | null | 2020-08-10T03:30:15 | 2020-07-16T16:23:30 | Java | UTF-8 | Java | false | false | 441 | java | import java.util.Scanner;
class switchbreak{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Enter Model's number:");
int modelnumber;
modelnumber=sc.nextInt();
switch(modelnumber){
case 1:
System.out.println("Runway");
break;
case 2:
System.out.println("Commercial ");
break;
case 3:
System.out.println("Magazine or Print");
break;
default :
System.out.println("Invalid Modelnumber");
}
}
}
| [
"[email protected]"
] | |
5179e0572a22722aa5095dd9fbf90a19dd59cd80 | 68dd09dc257bb8e755bbe11ee76d6918270d24ef | /app/src/main/java/com/narmware/samista/adapter/MyAdapter.java | 0db9c2207f3a3eae4087e95b8caf1daf9eb6eb35 | [] | no_license | narmware/sasmitavendor | 000682ea9c9374abb20dd91d69cd86db28159c68 | 3116144705e5864b42bdfbb54971a8c34ed0f2cb | refs/heads/master | 2020-03-30T15:36:00.345345 | 2018-10-05T12:27:44 | 2018-10-05T12:27:44 | 151,370,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,168 | java | package com.narmware.samista.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.narmware.samista.R;
import com.narmware.samista.activity.CommentActivity;
import com.narmware.samista.pojo.Comments;
import com.narmware.samista.support.Endpoints;
import java.util.ArrayList;
public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
Context mContext;
private ArrayList<Comments> mData;
public MyAdapter(Context mContext, ArrayList<Comments> mData) {
this.mContext = mContext;
this.mData = mData;
}
class ViewHolder0 extends RecyclerView.ViewHolder {
TextView mTxtComment,mTxtDate,mTxtName,mTxtDesignation;
public ViewHolder0(View itemView) {
super(itemView);
mTxtComment=itemView.findViewById(R.id.txt_comment);
mTxtName=itemView.findViewById(R.id.txt_name);
mTxtDate=itemView.findViewById(R.id.txt_date);
mTxtDesignation=itemView.findViewById(R.id.txt_designation);
}
}
class ViewHolder2 extends RecyclerView.ViewHolder {
TextView mTxtComment,mTxtDate,mTxtName,mTxtDesignation;
public ViewHolder2(View itemView) {
super(itemView);
mTxtComment=itemView.findViewById(R.id.txt_comment);
mTxtName=itemView.findViewById(R.id.txt_name);
mTxtDate=itemView.findViewById(R.id.txt_date);
mTxtDesignation=itemView.findViewById(R.id.txt_designation);
}
}
@Override
public int getItemViewType(int position) {
// Just as an example, return 0 or 2 depending on position
// Note that unlike in ListView adapters, types don't have to be contiguous
Log.e("Adapter size",mData.size()+"");
if(mData.get(position).getFlag().equals(Endpoints.GENERATOR))
{
return 0;
}
if(mData.get(position).getFlag().equals(Endpoints.CONVERTOR))
{
return 2;
}
return 0;
//return position % 2 * 2;
}
@Override
public int getItemCount() {
if(mData.size()==0)
{
//Toast.makeText(mContext,"No data",Toast.LENGTH_SHORT).show();
CommentActivity.mEmptyLinear.setVisibility(View.VISIBLE);
}
else {
CommentActivity.mEmptyLinear.setVisibility(View.GONE);
}
return mData.size();
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch (viewType) {
case 0:
return new ViewHolder0(LayoutInflater.from(mContext).inflate(R.layout.item_comment, parent, false));
case 2:
return new ViewHolder2(LayoutInflater.from(mContext).inflate(R.layout.item_comment_righ, parent, false));
}
return null;
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
switch (holder.getItemViewType()) {
case 0:
ViewHolder0 viewHolder0 = (ViewHolder0)holder;
viewHolder0.mTxtComment.setText(mData.get(position).getComment());
viewHolder0.mTxtName.setText(mData.get(position).getName());
viewHolder0.mTxtDate.setText(mData.get(position).getDate_time());
viewHolder0.mTxtDesignation.setText(" ("+mData.get(position).getFlag().toLowerCase()+")");
break;
case 2:
ViewHolder2 viewHolder2 = (ViewHolder2)holder;
viewHolder2.mTxtComment.setText(mData.get(position).getComment());
viewHolder2.mTxtName.setText(mData.get(position).getName());
viewHolder2.mTxtDate.setText(mData.get(position).getDate_time());
viewHolder2.mTxtDesignation.setText(" ("+mData.get(position).getFlag().toLowerCase()+")");
break;
}
}
} | [
"[email protected]"
] | |
efb25def4a967583ee56ba865cfb227120378611 | b77f15189647ae9ae4abfaf45e0de079334057a2 | /src/main/java/com/emusicstore/model/Product.java | 9116e05fbe06ce73f7f4b0fc12c5090f3813e2c5 | [] | no_license | nzarko/emusicstore | e15469b4d7a5615c8c2e2e687ddda20c063652a3 | 24931b703a09362577a2f40d43dac9a27cdb0eb0 | refs/heads/master | 2020-03-30T00:46:25.842980 | 2018-02-09T10:23:32 | 2018-02-09T10:23:32 | 150,543,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,948 | java | package com.emusicstore.model;
import org.springframework.web.multipart.MultipartFile;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.beans.Transient;
@Entity
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private String productId;
@NotEmpty (message = "The product name must not be empty.")
private String productName;
private String productCategory;
private String productDescription;
@Min(value = 0, message = "The product price must not be less than zero.")
private double productPrice;
private String productCondition;
private String productStatus;
@Min(value = 0, message = "The product unit in stock must not be less than zero.")
private int unitInStock;
private String productManufacturer;
@javax.persistence.Transient
private MultipartFile productImage;
public MultipartFile getProductImage() {
return productImage;
}
public void setProductImage(MultipartFile productImage) {
this.productImage = productImage;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getProductCategory() {
return productCategory;
}
public void setProductCategory(String productCategory) {
this.productCategory = productCategory;
}
public String getProductDescription() {
return productDescription;
}
public void setProductDescription(String productDescription) {
this.productDescription = productDescription;
}
public double getProductPrice() {
return productPrice;
}
public void setProductPrice(double productPrice) {
this.productPrice = productPrice;
}
public String getProductCondition() {
return productCondition;
}
public void setProductCondition(String productCondition) {
this.productCondition = productCondition;
}
public String getProductStatus() {
return productStatus;
}
public void setProductStatus(String productStatus) {
this.productStatus = productStatus;
}
public int getUnitInStock() {
return unitInStock;
}
public void setUnitInStock(int unitInStock) {
this.unitInStock = unitInStock;
}
public String getProductManufacturer() {
return productManufacturer;
}
public void setProductManufacturer(String productManufacturer) {
this.productManufacturer = productManufacturer;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
}
| [
"[email protected]"
] | |
7d50fe5d571e663f713cdbfa47e9ba82861bc365 | a28a8ef8027dcbe7f7eaa168347c6c2d0c1b2d79 | /war/datasetbf/t_211903/left_MemberFilePersister_1.4.java | b47e868b3df507ea0d7cc451ceae635494eb24b9 | [] | no_license | martinezmatias/commitsurvey | f36f9e6a32c2dd43cc976eb2224ffae06067c609 | a1791d57b879c722d30ee174e1af81737ef04f34 | refs/heads/master | 2021-01-23T05:29:56.498364 | 2017-03-27T08:58:08 | 2017-03-27T08:58:08 | 86,312,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,387 | java | // $Id: MemberFilePersister.java,v 1.4 2005-01-09 21:10:37 linus Exp $
// Copyright (c) 1996-2005 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
// and this paragraph appear in all copies. This software program and
// documentation are copyrighted by The Regents of the University of
// California. The software program and documentation are supplied "AS
// IS", without any accompanying services from The Regents. The Regents
// does not warrant that the operation of the program will be
// uninterrupted or error-free. The end-user understands that the program
// was developed for research purposes and is advised not to rely
// exclusively on the program for any reason. IN NO EVENT SHALL THE
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
package org.argouml.persistence;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.Writer;
import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectMember;
/**
* A base class file persister for project members.
* @author Bob Tarling
*/
public abstract class MemberFilePersister {
/**
* Load the member based on instance variables
* which should have been setup in the constructor.
*
* @param project the project to persist
* @param inputStream the inputStream to parse to load the member.
* @throws OpenException on any parsing errors.
*/
public abstract void load(Project project, InputStream inputStream)
throws OpenException;
/**
* Gets the tag name which is the root tag for this member.
* @return tag name.
*/
public abstract String getMainTag();
/**
* Save the projectmember as XML to the given writer.
*
* @param member The project member to save.
* @param writer The Writer to which appen the save.
* @param indent The offset to which to indent the XML
* @throws SaveException if the save fails
*/
public abstract void save(
ProjectMember member,
Writer writer,
Integer indent) throws SaveException;
/**
* Send an existing file of XML to the PrintWriter.
* @param writer the PrintWriter.
* @param file the File
* @param indent How far to indent in the writer.
* @throws SaveException on any errors.
*/
protected void addXmlFileToWriter(PrintWriter writer, File file, int indent)
throws SaveException {
try {
String padding =
" "
.substring(0, indent);
BufferedReader reader =
new BufferedReader(new FileReader(file));
// Skip the <?xml... first line
String line = reader.readLine();
while (line != null && (line.startsWith("<?xml ")
|| line.startsWith("<!DOCTYPE "))) {
line = reader.readLine();
}
while (line != null) {
(writer).print(padding);
(writer).println(line);
line = reader.readLine();
}
reader.close();
} catch (FileNotFoundException e) {
throw new SaveException(e);
} catch (IOException e) {
throw new SaveException(e);
}
}
}
| [
"[email protected]"
] | |
142be98a6bb94562e723bf119a718d77d191589a | 2350d084ae54a68de9047ba22dfb43d4e926e2a9 | /src/com/test/java/program/_4_MinimumDistanceBetweenTwoWords.java | d24ff9c4bf0b75842ef098b8d759d6390330e792 | [] | no_license | osimahemmed/code | 244fa32c85e499be559984e50d63e5dbd9c24b35 | 1a43be3bbf8cc0ff6c83ee1193b3ff52bdd01f94 | refs/heads/master | 2020-04-14T10:46:35.366092 | 2019-01-25T05:57:55 | 2019-01-25T05:57:55 | 163,795,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,313 | java | package com.test.java.program;
public class _4_MinimumDistanceBetweenTwoWords {
public static void main(String[] args) {
String str1 = "ABC is a d XYZ and ABC dffd XYZ are two distinct words";
String str2 = "ABC";
String str3 = "XYZ";
int distance = getDistance(str1, str2, str3);
System.out.println(distance);
}
public static int getDistance(String p, String str1, String str2) {
String[] arr = p.split(" ");
int i = 0;
int min_dist = Integer.MAX_VALUE;
int currentLength = 0;
int prevIndex = 0;
for (i = 0; i < arr.length; i++) {
if (arr[i].equals(str1) || arr[i].equals(str2)) {
prevIndex = i;
i++;
break;
}
}
//"ABC is a d XYZ and ABC dffd XYZ are two distinct words";
for (; i < arr.length; i++) {
if (arr[i].equals(str1) || arr[i].equals(str2)) {
if (arr[prevIndex].equals(arr[i])) {
prevIndex = i;
currentLength = 0;
} else {
if (currentLength < min_dist) {
min_dist = currentLength + 1;
currentLength = 0;
}
prevIndex = i;
}
} else {
currentLength = currentLength + arr[i].length() + 1;
}
}
System.out.println("min_dist = " + min_dist);
min_dist = min_dist + (str1.length() + 1) / 2 + (str2.length() + 1) / 2;
return min_dist;
}
}
| [
"[email protected]"
] | |
7ffbd868e646a4cc345ac95fc14500df25bcb5e5 | 8fc353fcca109517b84f890df1f9e1f8a90adc78 | /src/main/java/com/surekam/modules/api/dto/resp/MaterialAnimalHealthProductsResp.java | 165f9d231001cdd9da4afa42ee9c4f8299d00f59 | [] | no_license | yycGitHub/production-process | 6ecd5ac15087288763cd8d7abe83d706f8f8e6f5 | 58a8628ef2f53164571b42f2629d23fb4b881e12 | refs/heads/master | 2022-12-08T16:55:34.955036 | 2020-08-31T09:03:34 | 2020-08-31T09:03:36 | 291,583,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,299 | java | package com.surekam.modules.api.dto.resp;
import java.io.Serializable;
import java.util.List;
public class MaterialAnimalHealthProductsResp implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主鍵
*/
private String id;
/**
* 公司id
*/
private String officeId;
/**
* 农药名称
*/
private String pesticideName;
/**
* 登记号
*/
private String registrationNumber;
/**
* 规格
*/
private String specifications;
/**
* 制造商
*/
private String manufacturer;
/**
* 有效期
*/
private String valid;
/**
* 成分和含量
*/
private String compositionAndContent;
/**
* 用法用量
*/
private String usageAndDosage;
/**
* 储存
*/
private String storage;
/**
* 不良反应
*/
private String sideEffects;
/**
* 休药期
*/
private String withdrawalPeriod;
/**
* 作用
*/
private String effect;
/**
* 备注信息
*/
private String remarks;
/**
* 种类表信息
*/
private List<ProductLibraryTreeListResp> pltResp;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOfficeId() {
return officeId;
}
public void setOfficeId(String officeId) {
this.officeId = officeId;
}
public String getPesticideName() {
return pesticideName;
}
public void setPesticideName(String pesticideName) {
this.pesticideName = pesticideName;
}
public String getRegistrationNumber() {
return registrationNumber;
}
public void setRegistrationNumber(String registrationNumber) {
this.registrationNumber = registrationNumber;
}
public String getSpecifications() {
return specifications;
}
public void setSpecifications(String specifications) {
this.specifications = specifications;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getValid() {
return valid;
}
public void setValid(String valid) {
this.valid = valid;
}
public String getCompositionAndContent() {
return compositionAndContent;
}
public void setCompositionAndContent(String compositionAndContent) {
this.compositionAndContent = compositionAndContent;
}
public String getUsageAndDosage() {
return usageAndDosage;
}
public void setUsageAndDosage(String usageAndDosage) {
this.usageAndDosage = usageAndDosage;
}
public String getStorage() {
return storage;
}
public void setStorage(String storage) {
this.storage = storage;
}
public String getSideEffects() {
return sideEffects;
}
public void setSideEffects(String sideEffects) {
this.sideEffects = sideEffects;
}
public String getWithdrawalPeriod() {
return withdrawalPeriod;
}
public void setWithdrawalPeriod(String withdrawalPeriod) {
this.withdrawalPeriod = withdrawalPeriod;
}
public String getEffect() {
return effect;
}
public void setEffect(String effect) {
this.effect = effect;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public List<ProductLibraryTreeListResp> getPltResp() {
return pltResp;
}
public void setPltResp(List<ProductLibraryTreeListResp> pltResp) {
this.pltResp = pltResp;
}
}
| [
"[email protected]"
] | |
017317a5be8fc92bea9de9d4f8777c55466a791e | 311f1237e7498e7d1d195af5f4bcd49165afa63a | /sourcedata/jedit40source/jEdit/org/gjt/sp/jedit/browser/BrowserIORequest.java | fdfeb1b2b61dbdddb1d1a6c226b4d4cf800d554c | [
"Apache-2.0"
] | permissive | DXYyang/SDP | 86ee0e9fb7032a0638b8bd825bcf7585bccc8021 | 6ad0daf242d4062888ceca6d4a1bd4c41fd99b63 | refs/heads/master | 2023-01-11T02:29:36.328694 | 2019-11-02T09:38:34 | 2019-11-02T09:38:34 | 219,128,146 | 10 | 1 | Apache-2.0 | 2023-01-02T21:53:42 | 2019-11-02T08:54:26 | Java | UTF-8 | Java | false | false | 6,814 | java | /*
* BrowserIORequest.java - VFS browser I/O request
* :tabSize=8:indentSize=8:noTabs=false:
* :folding=explicit:collapseFolds=1:
*
* Copyright (C) 2000 Slava Pestov
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.gjt.sp.jedit.browser;
//{{{ Imports
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.*;
import org.gjt.sp.jedit.io.*;
import org.gjt.sp.jedit.jEdit;
import org.gjt.sp.jedit.MiscUtilities;
import org.gjt.sp.util.WorkRequest;
import org.gjt.sp.util.WorkThread;
//}}}
/**
* A browser I/O request.
* @author Slava Pestov
* @version $Id: BrowserIORequest.java,v 1.8 2002/01/28 04:20:54 spestov Exp $
*/
public class BrowserIORequest extends WorkRequest
{
//{{{ Request types
/**
* Directory listing I/O request.
*/
public static final int LIST_DIRECTORY = 0;
/**
* Delete file I/O request.
*/
public static final int DELETE = 1;
/**
* Rename file I/O request.
*/
public static final int RENAME = 2;
/**
* Make directory I/O request.
*/
public static final int MKDIR = 3;
//}}}
//{{{ BrowserIORequest constructor
/**
* Creates a new browser I/O request.
* @param type The request type
* @param browser The VFS browser instance
* @param path1 The first path name to operate on
* @param path2 The second path name to operate on
* @param node Only used for type == LIST_DIRECTORY
*/
public BrowserIORequest(int type, VFSBrowser browser,
Object session, VFS vfs, String path1, String path2,
DefaultMutableTreeNode node)
{
this.type = type;
this.browser = browser;
this.session = session;
this.vfs = vfs;
this.path1 = path1;
this.path2 = path2;
this.node = node;
} //}}}
//{{{ run() method
public void run()
{
switch(type)
{
case LIST_DIRECTORY:
listDirectory();
break;
case DELETE:
delete();
break;
case RENAME:
rename();
break;
case MKDIR:
mkdir();
break;
}
if(type != LIST_DIRECTORY)
browser.endRequest();
} //}}}
//{{{ toString() method
public String toString()
{
String typeString;
switch(type)
{
case LIST_DIRECTORY:
typeString = "LIST_DIRECTORY";
break;
case DELETE:
typeString = "DELETE";
break;
case RENAME:
typeString = "RENAME";
break;
case MKDIR:
typeString = "MKDIR";
break;
default:
typeString = "UNKNOWN!!!";
break;
}
return getClass().getName() + "[type=" + typeString
+ ",vfs=" + vfs + ",path1=" + path1
+ ",path2=" + path2 + "]";
} //}}}
//{{{ Private members
//{{{ Instance variables
private int type;
private VFSBrowser browser;
private Object session;
private VFS vfs;
private String path1;
private String path2;
private DefaultMutableTreeNode node;
//}}}
//{{{ listDirectory() method
private void listDirectory()
{
VFS.DirectoryEntry[] directory = null;
String[] args = { path1 };
setStatus(jEdit.getProperty("vfs.status.listing-directory",args));
String canonPath = null;
try
{
setAbortable(true);
canonPath = vfs._canonPath(session,path1,browser);
directory = vfs._listDirectory(session,canonPath,browser);
}
catch(IOException io)
{
setAbortable(false);
String[] pp = { io.toString() };
VFSManager.error(browser,path1,"ioerror.directory-error",pp);
}
catch(WorkThread.Abort a)
{
}
finally
{
try
{
vfs._endVFSSession(session,browser);
}
catch(IOException io)
{
setAbortable(false);
String[] pp = { io.toString() };
VFSManager.error(browser,path1,"ioerror.directory-error",pp);
}
}
setAbortable(false);
browser.directoryLoaded(node,canonPath,directory);
} //}}}
//{{{ delete() method
private void delete()
{
try
{
setAbortable(true);
String[] args = { path1 };
setStatus(jEdit.getProperty("vfs.status.deleting",args));
try
{
path1 = vfs._canonPath(session,path1,browser);
if(!vfs._delete(session,path1,browser))
VFSManager.error(browser,path1,"ioerror.delete-error",null);
}
catch(IOException io)
{
String[] pp = { io.toString() };
VFSManager.error(browser,path1,"ioerror.directory-error",pp);
}
}
catch(WorkThread.Abort a)
{
}
finally
{
try
{
vfs._endVFSSession(session,browser);
}
catch(IOException io)
{
String[] pp = { io.toString() };
VFSManager.error(browser,path1,"ioerror.directory-error",pp);
}
}
} //}}}
//{{{ rename() method
private void rename()
{
try
{
setAbortable(true);
String[] args = { path1, path2 };
setStatus(jEdit.getProperty("vfs.status.renaming",args));
try
{
path1 = vfs._canonPath(session,path1,browser);
path2 = vfs._canonPath(session,path2,browser);
VFS.DirectoryEntry file = vfs._getDirectoryEntry(
session,path2,browser);
if(file != null)
VFSManager.error(browser,path1,"ioerror.rename-exists",
new String[] { path2 });
else
{
if(!vfs._rename(session,path1,path2,browser))
VFSManager.error(browser,path1,"ioerror.rename-error",
new String[] { path2 });
}
}
catch(IOException io)
{
String[] pp = { io.toString() };
VFSManager.error(browser,path1,"ioerror.directory-error",pp);
}
}
catch(WorkThread.Abort a)
{
}
finally
{
try
{
vfs._endVFSSession(session,browser);
}
catch(IOException io)
{
String[] pp = { io.toString() };
VFSManager.error(browser,path1,"ioerror.directory-error",pp);
}
}
} //}}}
//{{{ mkdir() method
private void mkdir()
{
try
{
setAbortable(true);
String[] args = { path1 };
setStatus(jEdit.getProperty("vfs.status.mkdir",args));
try
{
path1 = vfs._canonPath(session,path1,browser);
if(!vfs._mkdir(session,path1,browser))
VFSManager.error(browser,path1,"ioerror.mkdir-error",null);
}
catch(IOException io)
{
args[0] = io.toString();
VFSManager.error(browser,path1,"ioerror",args);
}
}
catch(WorkThread.Abort a)
{
}
finally
{
try
{
vfs._endVFSSession(session,browser);
}
catch(IOException io)
{
String[] args = { io.toString() };
VFSManager.error(browser,path1,"ioerror",args);
}
}
} //}}}
//}}}
}
| [
"[email protected]"
] | |
0bd86d5ffa2280b8e6e79fb1118f6ef7a6284748 | 8d118326379f673fd0dbd83e20f282ce8f06421d | /sampletest/src/main/java/learning/ValidateParenthesis.java | b0d60f76d7abd1b9893b074f5e1aa0c26d742805 | [] | no_license | chpsrinu/learning | c12545525216d68305c9c4391c8cdd7eda997682 | 718f0f30dbe87c284b377fad6a0ea8e7ee242722 | refs/heads/master | 2021-06-18T02:40:35.529924 | 2021-01-22T20:39:55 | 2021-01-22T20:39:55 | 150,308,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package learning;
import java.util.Stack;
public class ValidateParenthesis {
//https://leetcode.com/problems/valid-parenthesis-string/
public static boolean checkValidString(String s) {
int n = s.length();
if (n==0) return true;
boolean[][] dp = new boolean[n][n];
for(int i =0;i<n;i++) {
if(s.charAt(i) == '*') dp[i][i] = true;
if (i<n-1 && (s.charAt(i) == '(' || s.charAt(i) == '*') &&
(s.charAt(i+1) == ')' || s.charAt(i+1) == '*')) {
dp[i][i+1] = true;
}
}
for(int size = 2; size<n;size++) {
for (int i=0;i+size<n;i++) {
if(s.charAt(i) == '*' && dp[i+1][i+size] == true) {
dp[i][i+size] = true;
} else if(s.charAt(i) == '(' || s.charAt(i) == '*') {
for(int k = i+1;k<=i+size;k++) {
if((s.charAt(k) == ')' || s.charAt(k) == '*') &&
(k == i+1 || dp[i+1][k-1]) &&
(k == i+size || dp[k+1][i+size])) {
dp[i][i+size] = true;
}
}
}
}
}
return dp[0][n-1];
}
public static void main(String[] args) {
System.out.println(checkValidString("(())((())()()(*)(*()(())())())()()((()())((()))(*"));
}
}
| [
"[email protected]"
] | |
ccdc87c43c94239d49252189a2ccf5117ad91fc6 | 4e653824bd41de6abf5d6e698dfee6e8548c4c96 | /SOAP-Web-Services/src/main/java/com/soap/ws/endpoint/SoapControllerEndPoint.java | 81c218c74c5d7f4cc28e325c5a9da74eb5b4265e | [] | no_license | prasannaanubhav/Java-Web-Services-Part-1 | 68803a09b78a6ccc8d0ce00502308d8e865796dc | 8d198320fab8de8894fe7aea28946cd016c39d6a | refs/heads/master | 2022-12-21T22:07:51.827648 | 2020-09-29T05:37:08 | 2020-09-29T05:37:08 | 299,513,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package com.soap.ws.endpoint;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class SoapControllerEndPoint {
@WebMethod
public String HelloSoap() {
return "Hello Soap";
}
}
| [
"[email protected]"
] | |
1b73042f79822a3140866691a5c8da33402d0a47 | 63ee3a7fe843e4ef69b9efff5e4ee37ed69e8a08 | /src/main/java/act/apidoc/javadoc/Javadoc.java | ad468fd3551fd29f4c0097c229920866c13dd3f5 | [
"ISC",
"Apache-2.0",
"MIT"
] | permissive | Diffblue-benchmarks/actframework | a145e9ff7a04491e779ca565046730d05eb55954 | b5398b3f5a7003e18c47c485901fdc04e0864204 | refs/heads/master | 2020-04-22T05:10:47.859514 | 2019-02-11T15:21:03 | 2019-02-12T10:55:49 | 170,150,546 | 0 | 0 | Apache-2.0 | 2019-02-11T15:16:45 | 2019-02-11T15:16:44 | null | UTF-8 | Java | false | false | 4,546 | java | package act.apidoc.javadoc;
/*-
* #%L
* ACT Framework
* %%
* Copyright (C) 2014 - 2018 ActFramework
* %%
* 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.
* #L%
*/
import com.github.javaparser.ast.comments.JavadocComment;
import org.osgl.util.OS;
import java.util.LinkedList;
import java.util.List;
public class Javadoc {
private static String EOL = OS.get().lineSeparator();
private JavadocDescription description;
private List<JavadocBlockTag> blockTags;
public Javadoc(JavadocDescription description) {
this.description = description;
this.blockTags = new LinkedList<>();
}
public Javadoc addBlockTag(JavadocBlockTag blockTag) {
this.blockTags.add(blockTag);
return this;
}
/**
* For tags like "@return good things" where
* tagName is "return",
* and the rest is content.
*/
public Javadoc addBlockTag(String tagName, String content) {
return addBlockTag(new JavadocBlockTag(tagName, content));
}
/**
* For tags like "@param abc this is a parameter" where
* tagName is "param",
* parameter is "abc"
* and the rest is content.
*/
public Javadoc addBlockTag(String tagName, String parameter, String content) {
return addBlockTag(tagName, parameter + " " + content);
}
public Javadoc addBlockTag(String tagName) {
return addBlockTag(tagName, "");
}
/**
* Return the text content of the document. It does not containing trailing spaces and asterisks
* at the start of the line.
*/
public String toText() {
StringBuilder sb = new StringBuilder();
if (!description.isEmpty()) {
sb.append(description.toText());
sb.append(EOL);
}
if (!blockTags.isEmpty()) {
sb.append(EOL);
}
for (JavadocBlockTag tag : blockTags) {
sb.append(tag.toText()).append(EOL);
}
return sb.toString();
}
/**
* Create a JavadocComment, by formatting the text of the Javadoc using no indentation (expecting the pretty printer to do the formatting.)
*/
public JavadocComment toComment() {
return toComment("");
}
/**
* Create a JavadocComment, by formatting the text of the Javadoc using the given indentation.
*/
public JavadocComment toComment(String indentation) {
for (char c : indentation.toCharArray()) {
if (!Character.isWhitespace(c)) {
throw new IllegalArgumentException("The indentation string should be composed only by whitespace characters");
}
}
StringBuilder sb = new StringBuilder();
sb.append(EOL);
final String text = toText();
if (!text.isEmpty()) {
for (String line : text.split(EOL)) {
sb.append(indentation);
sb.append(" * ");
sb.append(line);
sb.append(EOL);
}
}
sb.append(indentation);
sb.append(" ");
return new JavadocComment(sb.toString());
}
public JavadocDescription getDescription() {
return description;
}
/**
* @return the current List of associated JavadocBlockTags
*/
public List<JavadocBlockTag> getBlockTags() {
return this.blockTags;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Javadoc document = (Javadoc) o;
return description.equals(document.description) && blockTags.equals(document.blockTags);
}
@Override
public int hashCode() {
int result = description.hashCode();
result = 31 * result + blockTags.hashCode();
return result;
}
@Override
public String toString() {
return "Javadoc{" +
"description=" + description +
", blockTags=" + blockTags +
'}';
}
}
| [
"[email protected]"
] | |
e979a8864ce5e086e385131463e2819ab728c825 | ac87d83ba002cb6109aed689ebca9f3385e8c0ca | /home/vet-clinic-web/src/main/java/ua/lesson/servlets/ClinicUserViewServlet.java | 5ca7d942e197f777c866943b590b22cc0eb10b0e | [] | no_license | ArtemVolkov/java-learn | 43676aea302b28d604c68ce53a3e0e8b3fcc921f | 15f802fc401904b4bb01ee6963c614ef0dbef833 | refs/heads/master | 2021-09-14T22:25:58.256803 | 2018-05-21T08:43:42 | 2018-05-21T08:43:42 | 103,434,305 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,285 | java | package ua.lesson.servlets;
import ua.lesson.lessons.*;
import ua.lesson.models.VetClinicHolder;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ClinicUserViewServlet extends HttpServlet{
private VetClinic vetClinic= VetClinicHolder.getInstance();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
int index=Integer.valueOf(req.getParameter("id"));
try{
Client client=vetClinic.getClients().get(index);
req.setAttribute("user", client);
//give pets list to view
req.setAttribute("pets", client.getPets());
}catch (IndexOutOfBoundsException e){ //go to error page
req.setAttribute("error", "User with this id does not exist!");
RequestDispatcher errorDisp=req.getRequestDispatcher("/views/clinic/ErrorPage.jsp");
errorDisp.forward(req, resp);
}
RequestDispatcher disp=req.getRequestDispatcher("/views/clinic/ClinicUserView.jsp");
disp.forward(req, resp);
}
}
| [
"[email protected]"
] | |
e73dd59ebd5f524e7f9c7af2d42378221f550fe2 | d528fe4f3aa3a7eca7c5ba4e0aee43421e60857f | /src/xgxt/xszz/portallet/action/XszzAction.java | f7d4510820e850c2c3604141e97adf7208d10ef3 | [] | no_license | gxlioper/xajd | 81bd19a7c4b9f2d1a41a23295497b6de0dae4169 | b7d4237acf7d6ffeca1c4a5a6717594ca55f1673 | refs/heads/master | 2022-03-06T15:49:34.004924 | 2019-11-19T07:43:25 | 2019-11-19T07:43:25 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 5,855 | java | package xgxt.xszz.portallet.action;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import xgxt.DAO.DAO;
import xgxt.action.Base;
import xgxt.action.BaseAction;
public class XszzAction extends BaseAction {
private boolean isNull(String str) {
return ((str == null) || str.equalsIgnoreCase("") || str
.equalsIgnoreCase("all"));
}
/**
* @describe 困难生列表
* @author zhoumi
* @return
* @throws Exception
*/
public ActionForward porKnsList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
DAO dao = DAO.getInstance();
HttpSession session = request.getSession();
List<Object> rs = new ArrayList<Object>();
HashMap<String, String> map = new HashMap<String, String>();
String[] colList = null;
String[] colListCN = null;
String sql = "";// sql语句
StringBuffer querry = new StringBuffer(" where 1=1 ");// sql条件
String rsNum = "0";// 返回的记录数
String pk = "";// 数据源表主键(格式为“字段名||字段名||字段名”)
String userDep = session.getAttribute("userDep").toString();
String userType = dao.getUserType(userDep);
String xy = Base.chgNull(request.getParameter("xydm"), "", 1);
String tips = "";
String xh = Base.chgNull(request.getParameter("xh"), "", 1);
if (userType.equalsIgnoreCase("xy")
&& (xy == null || xy.trim().equals(""))) {
xy = userDep;
}
String zy = Base.chgNull(request.getParameter("zydm"), "", 1);
String bj = Base.chgNull(request.getParameter("bjdm"), "", 1);
String nj = Base.chgNull(request.getParameter("nj"), "", 1);
String xn = Base.chgNull(request.getParameter("xn"), "", 1);
pk = "xn||xh";
if (!isNull(nj)) {
querry.append(" and nj='");
querry.append(nj);
querry.append("' ");
}
if (!isNull(xn)) {
querry.append(" and xn='");
querry.append(xn);
querry.append("' ");
}
if (!isNull(xy)) {
querry.append(" and xydm='");
querry.append(xy);
querry.append("' ");
}
if (!isNull(zy)) {
querry.append(" and zydm='");
querry.append(zy);
querry.append("' ");
}
if (!isNull(bj)) {
querry.append(" and bjdm='");
querry.append(bj);
querry.append("' ");
}
if (!isNull(xh)) {
querry.append(" and xh='");
querry.append(xh);
querry.append("' ");
}
tips = "当前所在位置:测试 - 资助 - 困难生";
colList = new String[] { "主键", "xn", "xh", "xm", "xymc", "zymc",
"bjmc", "nj" };
sql = "select " + pk + " 主键,xn,xh,xm,xymc,zymc,bjmc,nj from "
+ " view_knsxx " + querry.toString();
colListCN = dao.getColumnNameCN(colList, "view_knsxx");
List topTr = dao.arrayToList(colList, colListCN);
if ((request.getParameter("go") != null)
&& request.getParameter("go").equalsIgnoreCase("go")) {
rs.addAll(dao.rsToVator(sql, new String[] {}, colList));
if (rs == null) {
rsNum = "0";
} else {
rsNum = String.valueOf(rs.size());
}
}
map.put("xydm", xy);
map.put("zydm", zy);
map.put("bjdm", bj);
map.put("xn", xn);
map.put("nj", nj);
map.put("xh", xh);
xy = xy == null ? "" : xy;
zy = zy == null ? "" : zy;
nj = nj == null ? "" : nj;
String bjKey = xy + "!!" + zy + "!!" + nj;
request.setAttribute("tips", tips);
request.setAttribute("rs1", map);
request.setAttribute("userType", userType);
request.setAttribute("pk", pk);// 发送数据源表主键
request.setAttribute("njList", Base.getNjList());// 发送年级列表
request.setAttribute("xnList", Base.getXnndList());// 发送学年列表
request.setAttribute("xyList", Base.getXyList());// 发送学院列表
request.setAttribute("zyList", Base.getZyMap().get(xy));// 发送专业列表
request.setAttribute("bjList", Base.getBjMap().get(bjKey));// 发送班级列表
request.setAttribute("rs", rs);// 发送数据集
request.setAttribute("topTr", topTr);// 发送表头
request.setAttribute("rsNum", rsNum);// 发送记录数
return mapping.findForward("porKnsList");
}
/**
* @describe 困难生详细信息
* @author zhoumi
* @return
* @throws Exception
*/
public ActionForward porKnsXx(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
DAO dao = DAO.getInstance();
HashMap<String, String> map = new HashMap<String, String>();
String[] outValue = null;
String userType = dao.getUserType(request.getSession().getAttribute(
"userDep").toString());
String pkVal = Base.chgNull(request.getParameter("pkVal"), "", 0);
String sql = "select xh,xm,xb,nj,xymc,zymc,bjmc,nd,xn,xq,sqyy,sqsj,bz,lxdh from view_knsxx where xn||xh=?";
String[] outString = new String[] { "xh", "xm", "xb", "nj", "xymc",
"zymc", "bjmc", "nd", "xn", "xq", "sqyy", "sqsj", "bz", "lxdh" };
outValue = dao.getOneRs(sql, new String[] { pkVal }, outString);
int len1 = outString.length;
int len2 = 0;
if (outValue != null) {
len2 = outValue.length;
}
int max = 0;
if (len1 >= len2) {
max = len2;
} else {
max = len1;
}
for (int i = 0; i < max; i++) {
if (null != outValue[i]) {
map.put(outString[i], outValue[i]);
} else {
map.put(outString[i], "");
}
}
request.setAttribute("rs", map);
request.setAttribute("userType", userType);
request.setAttribute("pkVal", pkVal);
return mapping.findForward("porKnsXx");
}
}
| [
"[email protected]"
] | |
fa70967db886e437a2f9340c5494d496a40a3adc | 87997829c196d82f101bea8ba40e93b626ff6a34 | /app/src/main/java/bsl/co/ke/kephis/ui/Views/Activities/ExportActivities/Export_Consignment_Inspection_Step5.java | 9923b72bb0e49d0265d486cf18d599857e2b72a4 | [] | no_license | koskcom/koskei2 | 4a5cabb9a325b66689543337b949d2e3279690e9 | 6debb63171c089eda9c2f86a1a864a2583e01abd | refs/heads/master | 2022-12-17T00:39:37.028455 | 2020-09-14T06:25:42 | 2020-09-14T06:25:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,582 | java | package bsl.co.ke.kephis.ui.Views.Activities.ExportActivities;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.stepstone.stepper.BlockingStep;
import com.stepstone.stepper.StepperLayout;
import com.stepstone.stepper.VerificationError;
import java.util.Objects;
import bsl.co.ke.kephis.Data.Bus.ConsignmentIspectionBus;
import bsl.co.ke.kephis.KEPHIS;
import bsl.co.ke.kephis.R;
import bsl.co.ke.kephis.db.DataBaseAdapter;
import bsl.co.ke.kephis.util.GPSTracker;
import butterknife.BindView;
import butterknife.ButterKnife;
public class Export_Consignment_Inspection_Step5 extends Fragment implements AdapterView.OnItemSelectedListener, BlockingStep {
@BindView(R.id.etDamageCaused)
EditText etDamageCaused;
@BindView(R.id.etPlantPart)
EditText etPlantPart;
@BindView(R.id.etSampleSizeInspected)
EditText etSampleSizeInspected;
@BindView(R.id.etTypeofDisease)
EditText etTypeofDisease;
@BindView(R.id.etPathogenIdentified)
EditText etPathogenIdentified;
@BindView(R.id.etHealthClean)
EditText etHealthClean;
@BindView(R.id.etTreatment)
EditText etTreatment;
@BindView(R.id.etreleased)
EditText etreleased;
@BindView(R.id.etMethodofDestruction)
EditText etMethodofDestruction;
@BindView(R.id.etSerialNumber)
EditText etSerialNumber;
@BindView(R.id.etRelevantInformation)
EditText etRelevantInformation;
private GPSTracker mGPS;
KEPHIS app;
DataBaseAdapter db;
private String damagedCauesd, plantPart, sampleSizeInspected, typeOfDisease, pathogenIdentified, healthClean, treatment, released;
private String methodofDestruction, seriallNumber, relevantInformation;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.activity_consignment_inspection5_records, container, false);
ButterKnife.bind(this, view);
app = (KEPHIS) Objects.requireNonNull(getActivity()).getApplication();
db = new DataBaseAdapter(getContext()).open();
return view;
}
public void postDataToSQLite() {
}
boolean validateSpinner(Spinner spinner, String error) {
View selectedView = spinner.getSelectedView();
if (selectedView != null && selectedView instanceof TextView) {
TextView selectedTextView = (TextView) selectedView;
if (selectedTextView.getText().equals("Select")) {
selectedTextView.setError(error);
Toast.makeText(getActivity(), "Field Required", Toast.LENGTH_SHORT).show();
return false;
}
}
return true;
}
@Override
public void onNextClicked(StepperLayout.OnNextClickedCallback callback) {
}
@Override
public void onCompleteClicked(StepperLayout.OnCompleteClickedCallback callback) {
damagedCauesd = Objects.requireNonNull(etDamageCaused.getText()).toString().trim();
plantPart = Objects.requireNonNull(etPlantPart.getText()).toString().trim();
sampleSizeInspected = Objects.requireNonNull(etSampleSizeInspected.getText()).toString().trim();
typeOfDisease = Objects.requireNonNull(etTypeofDisease.getText()).toString().trim();
pathogenIdentified = Objects.requireNonNull(etPathogenIdentified.getText()).toString().trim();
healthClean = Objects.requireNonNull(etHealthClean.getText()).toString().trim();
treatment = Objects.requireNonNull(etTreatment.getText()).toString().trim();
released = Objects.requireNonNull(etreleased.getText()).toString().trim();
methodofDestruction = Objects.requireNonNull(etMethodofDestruction.getText()).toString().trim();
seriallNumber = Objects.requireNonNull(etSerialNumber.getText()).toString().trim();
relevantInformation = Objects.requireNonNull(etRelevantInformation.getText()).toString().trim();
if (TextUtils.isEmpty(damagedCauesd)) {
etDamageCaused.setError("Field Required");
return;
} else if (TextUtils.isEmpty(plantPart)) {
etPlantPart.setError("Field Required");
return;
} else if (TextUtils.isEmpty(sampleSizeInspected)) {
etSampleSizeInspected.setError("Field Required");
return;
} else if (TextUtils.isEmpty(typeOfDisease)) {
etTypeofDisease.setError("Field Required");
return;
} else if (TextUtils.isEmpty(pathogenIdentified)) {
etPathogenIdentified.setError("Field Required");
return;
} else if (TextUtils.isEmpty(healthClean)) {
etHealthClean.setError("Field Required");
return;
} else if (TextUtils.isEmpty(treatment)) {
etTreatment.setError("Field Required");
return;
} else if (TextUtils.isEmpty(released)) {
etreleased.setError("Field Required");
return;
} else if (TextUtils.isEmpty(methodofDestruction)) {
etMethodofDestruction.setError("Field Required");
return;
} else if (TextUtils.isEmpty(seriallNumber)) {
etSerialNumber.setError("Field Required");
return;
} else if (TextUtils.isEmpty(relevantInformation)) {
etRelevantInformation.setError("Field Required");
return;
} else {
ConsignmentIspectionBus consignmentIspectionBus = ConsignmentIspectionBus.getInstance();
consignmentIspectionBus.setDamagedCauesd(damagedCauesd);
consignmentIspectionBus.setPlantPart(plantPart);
consignmentIspectionBus.setSampleSizeInspected(sampleSizeInspected);
consignmentIspectionBus.setTypeOfDisease(typeOfDisease);
consignmentIspectionBus.setPathogenIdentified(pathogenIdentified);
consignmentIspectionBus.setHealthClean(healthClean);
consignmentIspectionBus.setTreatment(treatment);
consignmentIspectionBus.setReleased(released);
consignmentIspectionBus.setMethodofDestruction(methodofDestruction);
consignmentIspectionBus.setSeriallNumber(seriallNumber);
consignmentIspectionBus.setRelevantInformation(relevantInformation);
long consi_inspection_id = db.updateConsignmentIspection(consignmentIspectionBus.getLocalID(),
consignmentIspectionBus.getSsInspector(),
consignmentIspectionBus.getSectionunit(),
consignmentIspectionBus.getConsignmentReport(),
consignmentIspectionBus.getIsadditionalInspections(),
consignmentIspectionBus.getAdditionalInspectionRemarks(),
consignmentIspectionBus.getFirNumber(),
consignmentIspectionBus.getDescription(),
consignmentIspectionBus.getValidUntil(),
consignmentIspectionBus.getFieldInspection());
db.insertVarietyDetails(Integer.parseInt(String.valueOf(consi_inspection_id)),
consignmentIspectionBus.getProducts(),
consignmentIspectionBus.getNetWeight(),
consignmentIspectionBus.getGrossWeiight(),
consignmentIspectionBus.getProductCategory(),
consignmentIspectionBus.getCommodityForm(),
consignmentIspectionBus.getVariety(),
consignmentIspectionBus.getQuantity(),
consignmentIspectionBus.getQuantityUnit(),
consignmentIspectionBus.getQuantityPassed(),
consignmentIspectionBus.getQuantityRejected(),
consignmentIspectionBus.getNumberofpackages(),
consignmentIspectionBus.getRejectedPackages(),
consignmentIspectionBus.getDamagedCauesd(),
consignmentIspectionBus.getPlantPart(),
consignmentIspectionBus.getSampleSizeInspected(),
consignmentIspectionBus.getTypeOfDisease(),
consignmentIspectionBus.getPathogenIdentified(),
consignmentIspectionBus.getHealthClean(),
consignmentIspectionBus.getTreatment(),
consignmentIspectionBus.getReleased(),
consignmentIspectionBus.getMethodofDestruction(),
consignmentIspectionBus.getSeriallNumber(),
consignmentIspectionBus.getRelevantInformation(), "0");
}
}
@Override
public void onBackClicked(StepperLayout.OnBackClickedCallback callback) {
callback.goToPrevStep();
}
@Nullable
@Override
public VerificationError verifyStep() {
return null;
}
@Override
public void onSelected() {
}
@Override
public void onError(@NonNull VerificationError error) {
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
}
| [
"[email protected]"
] | |
24ac9f3fed3aac6e8727c161966fa20cadef7ecc | 52b8b68638e79bec7fe4525379424ce68ee7e016 | /calculadora/src/calculadora/Resta.java | 4ad41fa0a851ec3ab64d16665d05af2df011f9f0 | [] | no_license | nico22utn/ing | d4d692fd96fca0d914b33a5812a871930cb12fbf | 0db3cdbfb094f9c51113820271088287e7b367fd | refs/heads/master | 2020-03-29T00:58:12.296581 | 2017-06-18T20:21:45 | 2017-06-18T20:21:45 | 94,637,677 | 1 | 3 | null | 2017-06-18T20:21:46 | 2017-06-17T17:03:23 | Java | UTF-8 | Java | false | false | 325 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package calculadora;
/**
*
* @author dacan
*/
public class Resta {
public int restarNumernos(int a, int b){
return a-b;
}
}
| [
"[email protected]"
] | |
93017d191ce992df1bc292c0dc2e3a80a078d439 | 7e1db8332d6ea2c917b80ee856f024b314a4eea7 | /src/br/com/alura/jdbc/teste/TestaConexao2.java | 85032b3c7e504674989426da791e10cf7ccfb157 | [] | no_license | AliceMeneses/curso-alura-jdbc | 6cd258bb58c1d7c6298e497ee5cafdfdda3c1505 | 19e8cfe0766e7cb3be07ff88fed457fc8355067b | refs/heads/master | 2023-02-16T02:23:29.559481 | 2021-01-08T22:55:47 | 2021-01-08T22:55:47 | 328,030,435 | 1 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 362 | java | package br.com.alura.jdbc.teste;
import java.sql.SQLException;
import br.com.alura.jdbc.factory.ConnectionFactory;
public class TestaConexao2 {
public static void main(String[] args) throws SQLException {
ConnectionFactory cf = new ConnectionFactory();
for(int i = 1; i <=20; i++) {
cf.conectar();
System.out.println("Conex„o:" + i);
}
}
}
| [
"[email protected]"
] | |
977e8f5dd5c3f39d6ce504b7f43cb746fccd5822 | 16d4fcaf824d905aac140f11a309e17e53b71c53 | /testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/acc/base/Client.java | 0ec3f44e08edf544a065244af0eff0bc98b428b2 | [] | no_license | AlerantAppNGIN/jdiameter | a0f4a1ebaa68aa58698ddcc89f21509f5ad466c6 | e731da60c2baaf33ff1267e9f0cafc2231019016 | refs/heads/master | 2021-05-23T04:59:41.004761 | 2020-05-12T10:40:18 | 2020-05-12T10:40:18 | 39,768,922 | 2 | 1 | null | 2015-07-27T10:31:46 | 2015-07-27T10:31:46 | null | UTF-8 | Java | false | false | 6,886 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual
* contributors as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a full listing
* of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License, v. 2.0.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License,
* v. 2.0 along with this distribution; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.mobicents.diameter.stack.functional.acc.base;
import org.jdiameter.api.IllegalDiameterStateException;
import org.jdiameter.api.InternalException;
import org.jdiameter.api.OverloadException;
import org.jdiameter.api.RouteException;
import org.jdiameter.api.acc.ClientAccSession;
import org.jdiameter.api.acc.events.AccountAnswer;
import org.jdiameter.api.acc.events.AccountRequest;
import org.jdiameter.api.app.AppAnswerEvent;
import org.jdiameter.api.app.AppRequestEvent;
import org.jdiameter.api.app.AppSession;
import org.mobicents.diameter.stack.functional.Utils;
import org.mobicents.diameter.stack.functional.acc.AbstractClient;
/**
* Base implementation of Client
*
* @author <a href="mailto:[email protected]"> Alexandre Mendonca </a>
* @author <a href="mailto:[email protected]"> Bartosz Baranowski </a>
*/
public class Client extends AbstractClient {
protected boolean sentINITIAL;
protected boolean sentINTERIM;
protected boolean sentTERMINATE;
protected boolean sentEVENT;
protected boolean receiveINITIAL;
protected boolean receiveINTERIM;
protected boolean receiveTERMINATE;
protected boolean receiveEVENT;
/**
*
*/
public Client() {
// TODO Auto-generated constructor stub
}
public void sendInitial() throws Exception {
AccountRequest initialRequest = super.createAcc(ACC_REQUEST_TYPE_INITIAL, this.ccRequestNumber, super.clientAccSession);
this.ccRequestNumber++;
super.clientAccSession.sendAccountRequest(initialRequest);
Utils.printMessage(log, super.stack.getDictionary(), initialRequest.getMessage(), true);
this.sentINITIAL = true;
}
public void sendInterim() throws Exception {
if (!receiveINITIAL) {
throw new Exception();
}
AccountRequest interimRequest = super.createAcc(ACC_REQUEST_TYPE_INTERIM, this.ccRequestNumber, super.clientAccSession);
this.ccRequestNumber++;
super.clientAccSession.sendAccountRequest(interimRequest);
Utils.printMessage(log, super.stack.getDictionary(), interimRequest.getMessage(), true);
this.sentINTERIM = true;
}
public void sendTermination() throws Exception {
if (!receiveINTERIM) {
throw new Exception();
}
AccountRequest terminateRequest = super.createAcc(ACC_REQUEST_TYPE_TERMINATE, this.ccRequestNumber, super.clientAccSession);
this.ccRequestNumber++;
super.clientAccSession.sendAccountRequest(terminateRequest);
Utils.printMessage(log, super.stack.getDictionary(), terminateRequest.getMessage(), true);
this.sentTERMINATE = true;
}
public void sendEvent() throws Exception {
AccountRequest eventRequest = super.createAcc(ACC_REQUEST_TYPE_TERMINATE, this.ccRequestNumber, super.clientAccSession);
this.ccRequestNumber++;
super.clientAccSession.sendAccountRequest(eventRequest);
Utils.printMessage(log, super.stack.getDictionary(), eventRequest.getMessage(), true);
this.sentEVENT = true;
}
/*
* (non-Javadoc)
*
* @see org.jdiameter.api.acc.ClientAccSessionListener#doCreditControlAnswer( org.jdiameter.api.acc.ClientAccSession,
* org.jdiameter.api.acc.events.JCreditControlRequest, org.jdiameter.api.acc.events.JCreditControlAnswer)
*/
public void doAccAnswerEvent(ClientAccSession session, AccountRequest request, AccountAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException,
OverloadException {
try {
Utils.printMessage(log, super.stack.getDictionary(), answer.getMessage(), false);
switch (answer.getAccountingRecordType()) {
case ACC_REQUEST_TYPE_INITIAL:
if (receiveINITIAL) {
fail("Received INITIAL more than once!", null);
}
receiveINITIAL = true;
break;
case ACC_REQUEST_TYPE_INTERIM:
if (receiveINTERIM) {
fail("Received INTERIM more than once!", null);
}
receiveINTERIM = true;
break;
case ACC_REQUEST_TYPE_TERMINATE:
if (receiveTERMINATE) {
fail("Received TERMINATE more than once!", null);
}
receiveTERMINATE = true;
break;
case ACC_REQUEST_TYPE_EVENT:
if (receiveEVENT) {
fail("Received EVENT more than once!", null);
}
receiveEVENT = true;
break;
default:
}
}
catch (Exception e) {
e.printStackTrace();
}
}
/*
* (non-Javadoc)
*
* @see org.jdiameter.api.acc.ClientAccSessionListener#doOtherEvent(org.jdiameter .api.app.AppSession,
* org.jdiameter.api.app.AppRequestEvent, org.jdiameter.api.app.AppAnswerEvent)
*/
public void doOtherEvent(AppSession session, AppRequestEvent request, AppAnswerEvent answer) throws InternalException, IllegalDiameterStateException, RouteException,
OverloadException {
fail("Received \"Other\" event, request[" + request + "], answer[" + answer + "], on session[" + session + "]", null);
}
// ------------ getters for some vars;
public boolean isSentINITIAL() {
return sentINITIAL;
}
public boolean isSentEVENT() {
return sentEVENT;
}
public boolean isReceiveEVENT() {
return receiveEVENT;
}
public boolean isSentINTERIM() {
return sentINTERIM;
}
public boolean isSentTERMINATE() {
return sentTERMINATE;
}
public boolean isReceiveINITIAL() {
return receiveINITIAL;
}
public boolean isReceiveINTERIM() {
return receiveINTERIM;
}
public boolean isReceiveTERMINATE() {
return receiveTERMINATE;
}
// ------------ getters for some vars;
@Override
protected int getChargingUnitsTime() {
return 10;
}
@Override
protected String getServiceContextId() {
return "tralalalal ID";
}
}
| [
"ammendonca"
] | ammendonca |
3fd9daba0d3d72d919046737439925fbd2d6dcd0 | 9fed72d51bcb7c64001be7b53af03c0138e97fd2 | /ratelimit-core/src/main/java/com/miracle/ratelimit/handler/RateLimitHandler.java | 48b79c9d566f9ca17df28ef7a4dcc2f484730b43 | [] | no_license | cangchen8180/ratelimit | 553c2133e918c8a2c54c8001e8c6770f7acb25e0 | a164a07a3d879f3f5bf45dd6dd582cfc0afa4fa7 | refs/heads/master | 2023-03-07T20:07:29.062173 | 2020-08-07T11:23:35 | 2020-08-07T11:23:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.miracle.ratelimit.handler;
import java.util.List;
import java.util.Map;
import com.miracle.ratelimit.support.RateLimitConfig;
public interface RateLimitHandler {
boolean doCheck(String key, List<RateLimitConfig> rateLimitConfigs, Map<String, Object> params);
} | [
"https://github.com/MIracleCczs"
] | https://github.com/MIracleCczs |
8068b06d854ff0bae3171f9762a16920de2010e1 | 29492333c538b0aeb80170046802a37512ec94cd | /BuildArray.java | 228aad66dde2ba3bc1c817f5985767082c415049 | [] | no_license | xuehui-code/test | 7d644b6ad88d46fb561448f4e22885b6830aabf1 | 42a10804677f071b8c0b2202f3b5db3dbce12ec2 | refs/heads/main | 2023-06-04T00:13:24.100794 | 2021-06-24T14:05:15 | 2021-06-24T14:05:15 | 310,495,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java |
import java.util.Arrays;
import java.util.Random;
public class BuildArray {
public static long[] 构建随机数组() {
Random random = new Random(20201018);
long[] array = new long[10];
for (int i = 0; i < 10; i++) {
array[i] = random.nextInt(100);
}
return array;
}
public static long[] 构建完全有序数组() {
long[] array = 构建随机数组();
Arrays.sort(array);
return array;
}
private static void swap(long[] array, int i, int j) {
long t = array[i];
array[i] = array[j];
array[j] = t;
}
public static long[] 构建完全逆序的数组() {
long[] array = 构建完全有序数组();
swap(array, 0, 9);
swap(array, 1, 8);
swap(array, 2, 7);
swap(array, 3, 6);
swap(array, 4, 5);
return array;
}
public static long[] 构建完全相等的数组() {
long[] array = new long[10];
for (int i = 0; i < 10; i++) {
array[i] = 9;
}
return array;
}
}
| [
"[email protected]"
] | |
10f303637f7c6a4ed1df0b8d29856285a04a83bf | f9ae114d4df0886dc3555b97b27a8c9f412fdd15 | /MyCloudMusic/app/src/main/java/com/example/mycloudmusic/span/MClickableSpan.java | 8dde092ff2ff3ded2c798b596ef077b78e553039 | [] | no_license | LIULIUQIAN/MyCloudMusic | f4b7c7836c1bf099e5ee8b09242340597ea36a2c | 7d4f0bd8eb82d7a1697a8b878db97b979d741c84 | refs/heads/master | 2020-12-14T06:54:19.927260 | 2020-02-29T13:44:03 | 2020-02-29T13:44:03 | 234,672,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.example.mycloudmusic.span;
import android.media.audiofx.Visualizer;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import androidx.annotation.NonNull;
public abstract class MClickableSpan extends ClickableSpan {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
ds.setColor(ds.linkColor);
// ds.setUnderlineText(true);
}
}
| [
"FFzf2016"
] | FFzf2016 |
76bbdb9cfca5dcaea61cbcb0958e3ebff16f5af7 | ed865190ed878874174df0493b4268fccb636a29 | /PuridiomTimerTask/src/com/tsa/puridiom/timer/ScheduleStart.java | b59bd0b93e815c02bbd65cd3161ddbcc7b68abdc | [] | no_license | zach-hu/srr_java8 | 6841936eda9fdcc2e8185b85b4a524b509ea4b1b | 9b6096ba76e54da3fe7eba70989978edb5a33d8e | refs/heads/master | 2021-01-10T00:57:42.107554 | 2015-11-06T14:12:56 | 2015-11-06T14:12:56 | 45,641,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,849 | java | package com.tsa.puridiom.timer;
import java.util.Calendar;
import java.util.TimeZone;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.hibernate.encryptor.HibernatePBEEncryptorRegistry;
import com.tsagate.foundation.utility.Dates;
public class ScheduleStart
{
/**
* @param args
*/
public static void main(String[] args)
{
StandardPBEStringEncryptor strongEncryptor = new StandardPBEStringEncryptor();
strongEncryptor.setPassword("tsapuridiom");
HibernatePBEEncryptorRegistry registry =
HibernatePBEEncryptorRegistry.getInstance();
registry.registerPBEStringEncryptor("hibernateEncryptor", strongEncryptor);
if(args == null || args.length < 1)
{
args = new String[1];
args[0] = "bsc04p";
}
if(args != null && args.length > 0)
{
Runtime runtime = Runtime.getRuntime();
long heapMaxSize = runtime.maxMemory() / 1024;
System.err.println("Allocated memory: " + heapMaxSize) ;
System.err.println("free memory: " + runtime.freeMemory()/ 1024) ;
for (int i = 0; i < args.length; i++)
{
System.out.println("Schedule starts at " + Calendar.getInstance().getTime() + "for oid: " + args[i]);
System.err.println("Initial used memory: " + (runtime.totalMemory() - runtime.freeMemory())/ 1024) ;
ScheduleManager.getInstance().start(args[i]);
System.out.println("Schedule done: " + Dates.getNow("", "") + " " + TimeZone.getDefault().getID());
System.err.println("Used memory: " + (runtime.totalMemory() - runtime.freeMemory())/ 1024) ;
System.err.println("free memory: " + runtime.freeMemory()/ 1024) ;
runtime.gc();
runtime.gc();
System.err.println("after gc: " + runtime.freeMemory()/ 1024) ;
System.err.println("after gc used memory: " + (runtime.totalMemory() - runtime.freeMemory())/ 1024) ;
}
}
System.exit(0);
}
}
| [
"brickerz@9227675a-84a3-4efe-bc6c-d7b3a3cf6466"
] | brickerz@9227675a-84a3-4efe-bc6c-d7b3a3cf6466 |
2d205ac11be0024fd97635ca45450b44b6ea692b | 1747f14d3314972867a83610c6ced47bccddd95f | /BerekeningUtils.java | 7dff733bce92108a7e886c437c1414dceafb8d3b | [] | no_license | HiddeVogelpoel/InformaticaJava | 2d79089e517c911ac9724b446fa35f10b4009e0f | 2858ae27fa54280f9efdb9641fd9d048b80af032 | refs/heads/master | 2020-06-11T06:59:36.005428 | 2019-06-26T10:36:31 | 2019-06-26T10:36:31 | 193,884,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 143 | java | package me.hidde.informatica;
public class BerekeningUtils {
public double rotatiehoek(double rotaties) {
return (360 / rotaties);
}
}
| [
"[email protected]"
] | |
f46903675eaff726d73b85cda10e648bfde384b2 | b9e617033fc4e22d881500d23890a422ab11345c | /app/src/main/java/ee/skyhigh/l1nde/pickayear/data/dao/ScoreDao.java | e0c65154bf329b9299474312d0fb050bc1928e0b | [] | no_license | L1nde/Pick-a-year | 0b25e6118c4e98621df194e6efa406496046e0a6 | 8724b3abaacd1a0c5ad700b8b85d7521d1c7deb2 | refs/heads/master | 2020-03-23T08:00:05.728942 | 2018-08-04T13:56:31 | 2018-08-04T13:56:31 | 141,302,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package ee.skyhigh.l1nde.pickayear.data.dao;
import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import java.util.List;
import ee.skyhigh.l1nde.pickayear.data.entites.ScoreEntity;
@Dao
public interface ScoreDao {
@Insert
void insert(ScoreEntity scoreEntity);
@Query("select * from leaderboard order by score DESC limit 10")
LiveData<List<ScoreEntity>> getTop10();
@Query("delete from leaderboard")
void deleteAll();
}
| [
"[email protected]"
] | |
d8910659ece36c54920a011901ffa48550c804f5 | 5a43e7d288da300741b37d3f29ce99623316b652 | /Track1Umanitoba/src/main/java/task_1_idash/requestHandler.java | fdc29c78eb24b0e434fa45ccc5cd2343a4587a50 | [] | no_license | wasifUofM/Secure_De_duplication_IdashTrack1 | f3c038c1ec2f73cb96d6992ccc42b5eae8bc4288 | 91bb56b2c5d543443fc7b37804ef189fb15df140 | refs/heads/master | 2022-11-12T01:45:50.499649 | 2020-06-12T00:22:48 | 2020-06-12T00:22:48 | 111,227,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,433 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package task_1_idash;
import static dataset_Preprocessing.BFCreate.expectedSize;
import static dataset_Preprocessing.BFCreate.falsePositiveProbability;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.math.BigInteger;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import static task_1_idash.main.center_1_port;
import static task_1_idash.main.center_Ip;
/**
*
* @author wasif
*/
public class requestHandler extends Thread {
SSLSocket client;
static int centre_num;
static String centre_total; //total num ber of centers
// static int centre_total=50;
static int[] dup_records = new int[100];
static int len = 0;
String duplicate;
static ArrayList<String> list = new ArrayList<String>();
static BigInteger[] server_val, centre_val;
public requestHandler(int n) {
centre_num = n;
centre_total = "c" + centre_num;
}
requestHandler(SSLSocket ss) throws NoSuchAlgorithmException, KeyManagementException {
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(null, null, null);
this.client = ss;
this.client.setEnabledCipherSuites(client.getSupportedCipherSuites());
}
@Override
public void run() {
try {
ObjectInputStream is = new ObjectInputStream(client.getInputStream());
ObjectOutputStream os;
os = new ObjectOutputStream(client.getOutputStream());
create_Record m = (create_Record) is.readObject();
String s1 = "c"; //data came from centre to match with server data
//if(m.type.equals(s1))
if (m.type.contains(s1)) {
// System.out.println("BitSet recieved from Centre: "+m.type+" "+ m.bs);
BloomFilter<String> bloomFilter = new BloomFilter<String>(falsePositiveProbability, expectedSize);
/**
* test block
*
*
*/
bloomFilter.setBitSet(m.bs);
// double falsePositiveProbability = 0.001;
// int expectedSize = 1000000;
// duplicate="dup";
for (int i = 0; i < server_val.length; i++) {
// BloomFilter<String> bloomFilter = new BloomFilter<String>(Math.ceil(-(Math.log(falsePositiveProbability) / Math.log(2))) / Math.log(2), expectedSize, 1);
// bloomFilter.add(requestHandler.server_val[i].toString()); //generating bloom filter bitset for server record (from center 1)
// BitSet b1 = bloomFilter.getBitSet();
// System.out.println("BitSet recieved from server s1"+ b1);
boolean chk = bloomFilter.contains(this.server_val[i].toString());
// boolean chk = b1.intersects(m.bs); //check if record ecista in bloom filter recieved from center 2
// System.out.println("check is"+ chk+"for element"+i);
if (chk == true) {
String st = "" + i;
if (!list.contains(st)) {
list.add(st);
}
}
}
//System.out.println("BitSet recieved from server s1"+ b1);
if (m.type.equals(centre_total)&& list!=null) {
duplicate = list.toString();
m.set_duplicates(duplicate);
send_response(m); //send matching response to data centre c1
}
// }
} else {
requestHandler.server_val = m.get_Records();
//System.out.println("in server value"+ Arrays.toString(requestHandler.server_val));
}
os.writeObject(m);
} catch (IOException | ClassNotFoundException | KeyManagementException | NoSuchAlgorithmException e) {
System.err.println("Exception caught in handler: client disconnected");
} finally {
try {
client.close();
} catch (IOException e) {
}
}
}
public void send_response(create_Record m) throws IOException, NoSuchAlgorithmException, KeyManagementException {
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(null, null, null);
SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket s = (SSLSocket) factory.createSocket(center_Ip,center_1_port); //port for sending response center1
s.setEnabledCipherSuites(s.getSupportedCipherSuites());
m.type = "c1";
request_Sender sender = new request_Sender(s, m); //sending response to centre c1
sender.start();
}
}
| [
"[email protected]"
] | |
92b78db467aa798efd320b4d2360bdb2d26f7977 | 70fe173107f8f9f702da6423e32e282d9257d8ac | /src/com/you/test/Test567.java | 997d27c7d3273f30583bfa05ae4c86662c612702 | [] | no_license | ywcdjbhl/test | 76e0cbd07be07fec37339675f1cb34c85d473be6 | 630e1d4940331b5966335a17e130275b9b37f6b9 | refs/heads/master | 2021-07-10T22:07:29.303515 | 2020-09-02T05:33:30 | 2020-09-02T05:33:30 | 162,388,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 254 | java | package com.you.test;
import java.lang.reflect.Array;
/**
* java.lang.reflect.Array.get
*/
public class Test567 {
public static void main(String[] args) {
Double[] ds = new Double[] {4D, 5D, 6D, 7D, 8D};
Array.get(ds, 5);
}
}
| [
"[email protected]"
] | |
926e53ce442dd19a9254206ec1ef2c73cfe623a9 | da8260682bed60ccf604a6fe386a270f6ab046ed | /organization-service/src/main/java/br/com/organization/data/Organization.java | a60a4dbb273ee389553a0c3bd37d6e38e9b67a55 | [] | no_license | giovaneroggen/demo | 67809b1c9f0c94ee8a69ff383cfba37cbbb533bd | 9a017def52c0ddf356549635a238d31d11377835 | refs/heads/master | 2021-09-01T21:05:50.559591 | 2017-12-28T16:00:22 | 2017-12-28T16:00:22 | 105,590,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package br.com.organization.data;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.time.LocalDateTime;
/**
* Created by giovane.silva on 18/09/2017.
*/
@Data
public class Organization {
@Id
private String id;
private String name;
private LocalDateTime startDate;
}
| [
"="
] | = |
44c0858208ed39b36707a03f13131312c4c0aad8 | a1051b749a545de3163b456aea82964141bcba85 | /SingleFileDownload/src/com/example/db/DBHelper.java | 2663e7b394b83c2b7919a6dde036ff0497ec6d39 | [] | no_license | chenrunlin/SingleFileDownload | 97dd9e42051a1531632fe55cf36cbfaf40cd34b6 | 9851cddfe0024a2700c93bf466fa9a084d460122 | refs/heads/master | 2016-08-11T17:27:31.489301 | 2016-02-23T06:53:30 | 2016-02-23T06:53:30 | 52,336,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package com.example.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class DBHelper extends SQLiteOpenHelper {
public static final String DB_NAME = "download.db";
public static final int VERSION = 1;
public static final String SQL_CREATE = "create table thread_info( id integer primary key autoincrement," +
" thread_id integer, url text, start integer, end integer, finished integer)";
public static final String SQL_DROP = "drop table if exists thread_info";
public DBHelper(Context context) {
super(context, DB_NAME, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(SQL_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
db.execSQL(SQL_DROP);
db.execSQL(SQL_CREATE);
}
}
| [
"[email protected]"
] | |
b22859b96c98684be2ae8b54c177392ec6f0ea3e | db6603229cc6e680be32c7f334a8bd8f88262563 | /src/main/java/cn/com/sand/frame/athena/annotation/tag/Athena.java | 34195828e433a800f122da68924997ca62dd68a3 | [] | no_license | shangjiang007/athena | 195de05c31f6c2af38f49f3948035aeb18c01635 | 42fb7b6576ba18001a4bb7e715eb76dd33f4d140 | refs/heads/master | 2021-01-17T17:50:05.711334 | 2016-06-03T09:03:17 | 2016-06-03T09:03:17 | 60,334,047 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | /**
* Copyright : http://www.sandpay.com.cn , 2016年4月27日
* Project : athena
* $Id$
* $Revision$
* Last Changed by SJ at 2016年4月27日 下午1:53:49
* $URL$
*
* Change Log
* Author Change Date Comments
*-------------------------------------------------------------
* SJ 2016年4月27日 Initailized
*/
package cn.com.sand.frame.athena.annotation.tag;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @ClassName :Athena
* @author : SJ
* @Date : 2016年4月27日 下午1:53:49
* @version 1.0.0
*
*/
@Documented
@Target(value = { FIELD, PACKAGE, TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Athena
{
public String value() default "";
}
| [
"[email protected]"
] | |
52776f244b8050f5d8c6f2d2d8cbb1c1af2b55c8 | 99b1e2aa506a84413629a03078a2ee8fb85c4bad | /src/test/java/net/kaczmarzyk/DateE2eTest.java | a77430e2c34c538f9b86bff028ee82204b684c7d | [
"Apache-2.0"
] | permissive | joshrussell/specification-arg-resolver | ad472c407f1045cc26749109de40576d4c2294fa | da15925bc3f930baa42435633a882b9aed91aeed | refs/heads/master | 2020-12-25T10:49:21.031150 | 2016-11-08T19:44:36 | 2016-11-08T19:44:36 | 52,445,880 | 0 | 0 | null | 2016-02-24T13:50:37 | 2016-02-24T13:50:37 | null | UTF-8 | Java | false | false | 4,138 | java | /**
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.kaczmarzyk;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import net.kaczmarzyk.spring.data.jpa.Customer;
import net.kaczmarzyk.spring.data.jpa.CustomerRepository;
import net.kaczmarzyk.spring.data.jpa.domain.DateAfter;
import net.kaczmarzyk.spring.data.jpa.domain.DateBefore;
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
public class DateE2eTest extends E2eTestBase {
@Controller
public static class DateSpecsController {
@Autowired
CustomerRepository customerRepo;
@RequestMapping(value = "/customers", params = "registeredBefore")
@ResponseBody
public Object findCustomersRegisteredBefore(
@Spec(path="registrationDate", params="registeredBefore", config="dd-MM-yyyy", spec=DateBefore.class) Specification<Customer> spec) {
return customerRepo.findAll(spec);
}
@RequestMapping(value = "/customers", params = "registeredAfter")
@ResponseBody
public Object findCustomersRegisteredAfter(
@Spec(path="registrationDate", params="registeredAfter", spec=DateAfter.class) Specification<Customer> spec) {
return customerRepo.findAll(spec);
}
@RequestMapping(value = "/customers", params = {"registeredBefore", "registeredAfter"})
@ResponseBody
public Object findCustomersRegisteredBetween(
@Spec(path="registrationDate", params={"registeredAfter", "registeredBefore"}, spec=DateBetween.class) Specification<Customer> spec) {
return customerRepo.findAll(spec);
}
}
@Test
public void findsByDateBeforeWithCustomDateFormat() throws Exception {
mockMvc.perform(get("/customers")
.param("registeredBefore", "16-03-2014")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$[0].firstName").value("Homer"))
.andExpect(jsonPath("$[1].firstName").value("Moe"))
.andExpect(jsonPath("$[2]").doesNotExist());
}
@Test
public void findsByDateBetween() throws Exception {
mockMvc.perform(get("/customers")
.param("registeredAfter", "2014-03-16")
.param("registeredBefore", "2014-03-30")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$[0].firstName").value("Marge"))
.andExpect(jsonPath("$[1].firstName").value("Bart"))
.andExpect(jsonPath("$[2].firstName").value("Lisa"))
.andExpect(jsonPath("$[3].firstName").value("Ned"))
.andExpect(jsonPath("$[4]").doesNotExist());
}
@Test
public void findsByDateAfter() throws Exception {
mockMvc.perform(get("/customers")
.param("registeredAfter", "2014-03-26")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$[0].firstName").value("Lisa"))
.andExpect(jsonPath("$[1].firstName").value("Maggie"))
.andExpect(jsonPath("$[2]").doesNotExist());
}
}
| [
"[email protected]"
] | |
1fc972a30dc3179b97e30e1e5607307008c198c0 | 22a64bee0dcd2733cf53ec0f6c00947597fcc331 | /client/user/src/main/java/com/zdd/user/model/bean/UserBean.java | 04b2466e9bc0fb75ef807071eaa691b7e1a7df77 | [] | no_license | zhengdayday/news | 26f83cf425f54a900a6b96382463db35464f355a | 13839a8a8bb0eaade820547a4428db7c6597a031 | refs/heads/master | 2020-04-06T17:38:11.673637 | 2019-01-11T12:19:03 | 2019-01-11T12:19:03 | 157,667,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package com.zdd.user.model.bean;
import com.zdd.common.model.BaseModel;
public class UserBean extends BaseModel{
private String mobile;
private String password;
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
adb83b1f95dcd83591fcd5ad259cf4f42c3db058 | 73a6f9eb998fd807afd44470092e4726cac8200b | /app/src/main/java/com/elchananalon/decibelmeter/LoudestMeasurements.java | fc664ee317213be65360d084c32e153f383a8b01 | [] | no_license | AlonSchwartz/DecibelMeter | 38b76df34e31d1564e342ef31384f8d165988827 | aa05300ff335d66a3622833180f4e90d9d1c4b24 | refs/heads/master | 2020-04-14T21:30:27.370417 | 2019-01-19T20:36:39 | 2019-01-19T20:36:39 | 164,130,995 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,045 | java | package com.elchananalon.decibelmeter;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
import java.util.ArrayList;
public class LoudestMeasurements extends AppCompatActivity {
private ArrayList<Measurement> measurmentsList;
private MeasurementsAdapter myAdapter;
private ListView measurementsView;
private SQLiteDatabase measurementsDB = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loudest_measurements);
// init view + list
measurementsView = findViewById(R.id.dlist_measurements); //set the custom list view
measurmentsList = new ArrayList<>();
// open DB and then load last measurements
measurementsDB = openOrCreateDatabase("Measurements", MODE_PRIVATE, null);
String sql = "CREATE TABLE IF NOT EXISTS measurements (id integer primary key, location VARCHAR, timeTaken VARCHAR, result VARDOUBLE,waypoints VARCHAR);";
measurementsDB.execSQL(sql);
loadLastMeasurements();
// Create adapter and set it to display
myAdapter = new MeasurementsAdapter(this, R.layout.measurements_list_view, measurmentsList);
measurementsView.setAdapter(myAdapter);
}
// To load the last measurements from DB
private void loadLastMeasurements(){
String sql = "SELECT * FROM measurements ORDER BY result DESC LIMIT 5";
Cursor cursor = measurementsDB.rawQuery(sql, null);
int locationColumn = cursor.getColumnIndex("location");
int timeTakenColumn = cursor.getColumnIndex("timeTaken");
int resultColumn = cursor.getColumnIndex("result");
int wayPointsColumn = cursor.getColumnIndex("waypoints");
cursor.moveToFirst();
// try-finally to MAKE SURE that even if some error occurred while reading cursor - the cursor will be closed. it will prevent memory leak.
// We want cursor the be closed as soon as we finish our work with it.
try {
if (cursor != null && (cursor.getCount() > 0)) {
// As long we have data - get it and add it to the measurements list
do {
String location = cursor.getString(locationColumn);
String time = cursor.getString(timeTakenColumn);
String result = cursor.getString(resultColumn);
String waypoints = cursor.getString(wayPointsColumn);
// index is 0 to show latest measurements first
measurmentsList.add( new Measurement(Double.valueOf(result), location, waypoints, time));
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
}
protected void onDestroy()
{
measurementsDB.close();
super.onDestroy();
}
}
| [
"[email protected]"
] | |
81cfa28dc4c6e9a90d7d4386c6737a7fc8f216c3 | 5ca3901b424539c2cf0d3dda52d8d7ba2ed91773 | /src_procyon/com/google/security/zynamics/bindiff/gui/tabpanels/projecttabpanel/treenodepanels/tables/FunctionDiffViewsTableModel.java | c755c69a09151445ed877f3ba603548811285f7c | [] | no_license | fjh658/bindiff | c98c9c24b0d904be852182ecbf4f81926ce67fb4 | 2a31859b4638404cdc915d7ed6be19937d762743 | refs/heads/master | 2021-01-20T06:43:12.134977 | 2016-06-29T17:09:03 | 2016-06-29T17:09:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,182 | java | package com.google.security.zynamics.bindiff.gui.tabpanels.projecttabpanel.treenodepanels.tables;
import java.util.*;
import com.google.security.zynamics.zylib.general.*;
import com.google.security.zynamics.bindiff.gui.tabpanels.projecttabpanel.treenodepanels.renderers.comparators.*;
import com.google.security.zynamics.zylib.general.comparators.*;
import com.google.security.zynamics.bindiff.project.diff.*;
import com.google.security.zynamics.bindiff.utils.*;
import com.google.security.zynamics.bindiff.project.rawcallgraph.*;
import com.google.security.zynamics.bindiff.enums.*;
import com.google.security.zynamics.bindiff.gui.tabpanels.projecttabpanel.treenodepanels.renderers.*;
import com.google.security.zynamics.bindiff.project.helpers.*;
import com.google.security.zynamics.zylib.disassembly.*;
public class FunctionDiffViewsTableModel extends AbstractFunctionDiffViewsTableModel
{
public static final int VIEWNAME = 0;
public static final int SIMILARITY = 1;
public static final int CONFIDENCE = 2;
public static final int PRIMARY_ADDRESS = 3;
public static final int PRIMARY_NAME = 4;
public static final int SECONDARY_ADDRESS = 5;
public static final int SECONDARY_NAME = 6;
public static final int BASICBLOCK_MATCHES = 7;
public static final int JUMP_MATCHES = 8;
private static final String[] COLUMNS;
private final List sorters;
public FunctionDiffViewsTableModel(final List list) {
super(list);
this.sorters = new ArrayList();
}
@Override
public int getColumnCount() {
return FunctionDiffViewsTableModel.COLUMNS.length;
}
@Override
public String getColumnName(final int n) {
return FunctionDiffViewsTableModel.COLUMNS[n];
}
@Override
public List getSorters() {
this.sorters.add(new Pair(0, new LexicalComparator()));
this.sorters.add(new Pair(3, new HexStringComparator()));
this.sorters.add(new Pair(4, new LexicalComparator()));
this.sorters.add(new Pair(7, new PercentageThreeBarCellDataComparator()));
this.sorters.add(new Pair(1, new DoubleComparator()));
this.sorters.add(new Pair(2, new DoubleComparator()));
this.sorters.add(new Pair(8, new PercentageThreeBarCellDataComparator()));
this.sorters.add(new Pair(6, new LexicalComparator()));
this.sorters.add(new Pair(5, new HexStringComparator()));
return this.sorters;
}
@Override
public Object getValueAt(final int n, final int n2) {
final Diff diff = this.functionDiffViewList.get(n);
final String forceFilenameEndsNotWithExtension = CFileUtils.forceFilenameEndsNotWithExtension(diff.getMatchesDatabase().getName(), "BinDiff");
final RawFunction rawFunction = diff.getCallgraph(ESide.PRIMARY).getNodes().get(0);
final RawFunction rawFunction2 = diff.getCallgraph(ESide.SECONDARY).getNodes().get(0);
final IAddress address = rawFunction.getAddress();
final IAddress address2 = rawFunction2.getAddress();
final int sizeOfMatchedBasicblocks = rawFunction.getSizeOfMatchedBasicblocks();
final int n3 = rawFunction.getSizeOfBasicblocks() - sizeOfMatchedBasicblocks;
final int n4 = rawFunction2.getSizeOfBasicblocks() - sizeOfMatchedBasicblocks;
final int sizeOfMatchedJumps = rawFunction.getSizeOfMatchedJumps();
final int n5 = rawFunction.getSizeOfJumps() - sizeOfMatchedJumps;
final int n6 = rawFunction2.getSizeOfJumps() - sizeOfMatchedJumps;
final PercentageThreeBarCellData percentageThreeBarCellData = new PercentageThreeBarCellData(n3, sizeOfMatchedBasicblocks, n4, this.getColumnSortRelevance(n2));
final PercentageThreeBarCellData percentageThreeBarCellData2 = new PercentageThreeBarCellData(n5, sizeOfMatchedJumps, n6, this.getColumnSortRelevance(n2));
switch (n2) {
case 0: {
return forceFilenameEndsNotWithExtension;
}
case 3: {
return address.toHexString();
}
case 4: {
return rawFunction.getName();
}
case 7: {
return percentageThreeBarCellData;
}
case 2: {
return MatchesGetter.getFunctionMatch(diff, rawFunction).getConfidence();
}
case 1: {
return MatchesGetter.getFunctionMatch(diff, rawFunction).getSimilarity();
}
case 8: {
return percentageThreeBarCellData2;
}
case 6: {
return rawFunction2.getName();
}
case 5: {
return address2.toHexString();
}
default: {
return null;
}
}
}
public void deleteDiff(final Diff diff) {
if (this.functionDiffViewList.remove(diff)) {
this.fireTableDataChanged();
}
}
static {
COLUMNS = new String[] { "View Name", "Similarity", "Confidence", "Address", "Primary Name", "Address", "Secondary Name", "Basic Blocks", "Jumps" };
}
}
| [
"[email protected]"
] | |
5eedc222d3654951354a2ac6c0c8e5cc32deff55 | 547e9e81254d37c51be793fb78bd46f6d91b075e | /app/src/main/java/localapp/zingohotels/com/localapp/Model/Values.java | 2cb5acb22c7b46777d87578f7fce5f5bc8ed9ec7 | [] | no_license | zingohotels/ZingoLocalAppBackup | a348821d5d00dd76d2a7d2daafc6c2c0b9afeeab | 9d12caa8ca4e986dcf4644cbbbd9264c81a6261e | refs/heads/master | 2021-04-30T02:02:52.275310 | 2019-05-14T08:32:28 | 2019-05-14T08:32:28 | 121,493,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | package localapp.zingohotels.com.localapp.Model;
/**
* Created by ZingoHotels.com on 1/30/2018.
*/
public class Values {
}
| [
"[email protected]"
] | |
f1ff1c356ed69bad943510747992fb88c6ee970f | 4a1773d1d68f69a383ce44fd3d1342d76ef3bb59 | /swg-acs-core/message/src/main/java/com/swg/acs/message/GetOptionsResponse.java | 8bb60c9f32e624014c275fbe388de82a06788a0f | [] | no_license | swg-corp/swg-acs | ae74593b9996d3138c7a4cd5312cfe905550a3d4 | 9a2cdf5e87d718ca151ca6409f963309790277f7 | refs/heads/master | 2021-01-15T18:26:25.548637 | 2012-07-06T15:39:17 | 2012-07-06T15:39:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,839 | java | /**
*
*/
package com.swg.acs.message;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.swg.acs.MessageArgument;
import com.swg.acs.MessageBody;
import com.swg.acs.message.cwmp.ArgumentFactory;
import com.swg.acs.message.cwmp.CwmpMessage;
/**
* @author satriaprayoga
*
*/
public class GetOptionsResponse extends CwmpMessage{
private static final long serialVersionUID = 1452457475351220634L;
private List<OptionStruct> optionList;
public GetOptionsResponse() {
super("GetOptionsResponse");
optionList=new ArrayList<GetOptionsResponse.OptionStruct>();
}
class OptionStruct {
protected String optionName;
protected String voucherSN;
protected int state;
protected int mode;
protected String startDate;
protected String expirationDate;
protected boolean transferable;
}
@Override
protected void configureBody(MessageBody bodyPart,
ArgumentFactory argumentFactory) {
}
@Override
protected void configureParse(MessageBody messageBody) {
MessageArgument optionArg=messageBody.getChild("OptionList");
Iterator<MessageArgument> iterator=optionArg.childIterator();
while(iterator.hasNext()){
MessageArgument arg=iterator.next();
OptionStruct struct=new OptionStruct();
struct.optionName=arg.getChild("OptionName").getValue();
struct.voucherSN=arg.getChild("VoucherSN").getValue();
struct.state=Integer.parseInt(arg.getChild("State").getValue());
struct.mode=Integer.parseInt(arg.getChild("Mode").getValue());
struct.startDate=arg.getChild("StartDate").getValue();
struct.expirationDate=arg.getChild("ExpirationDate").getValue();
struct.transferable=Boolean.parseBoolean(arg.getChild("IsTransferable").getValue());
optionList.add(struct);
}
}
public List<OptionStruct> getOptionList() {
return optionList;
}
}
| [
"[email protected]"
] | |
385988283b9de6e09f73ecd375e80bff0bb493e2 | 9bddaa631ed8c3637ab0f4fce69f5f75b1d419a8 | /7_abstract/E.java | 1c9028bf17b563626d76a29f5a01825e628e84fd | [] | no_license | tornado1512/Core_Java_Prac | 08f37248dbcae080631baf5bf6b823a3fc5a6e16 | 67af20baaa6268b719882371425a7e79d28b8b7b | refs/heads/master | 2020-07-02T11:18:54.098249 | 2019-10-19T18:43:15 | 2019-10-19T18:43:15 | 201,226,041 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | abstract class E //abstract class can have abstract and non abstract method
{
void show9(){
}
abstract void ho();
} | [
"[email protected]"
] | |
025a882f0502e793eda6337a6fa15bcbe5eaaa96 | 935a7658f52fd1e42fcd6cce875910abcc24bc53 | /src/main/java/almundo/callcenter/constants/StatusType.java | 2470818ff88cad45188a5a97a34db55555aa5eb2 | [] | no_license | JaviElMago/Test | 459d4595240959434b3d510dc3322049f2fea689 | d6a5da3916a888ee83b69347270d2e67ac5a120e | refs/heads/master | 2020-03-16T16:15:20.813946 | 2018-05-09T15:45:02 | 2018-05-09T15:45:02 | 132,778,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package almundo.callcenter.constants;
/**
* Enum useful to handling status of the employees
* @author hflores
*
*/
public enum StatusType {
IDLE("idle"),
BUSY("busy");
private StatusType(String type) {
}
public String getType() {
return this.getType();
}
}
| [
"[email protected]"
] | |
a138932c982f20da8fa45ed7e5977bcad3ab7962 | 97422cd83fe2d0bd4a50b3f57fe23d81e745e4d0 | /app/src/main/java/com/eastflag/firstproject/event/Event1Activity.java | a0079d64d66356289a37bc85bf9474d71bbe9595 | [] | no_license | eastflag/FirstProject | 512f299d53003aac0c2599a4c662e2c751edafd5 | c86ccde32fcb0ca332f70222a3528faa2b63e604 | refs/heads/master | 2021-01-10T12:25:13.185169 | 2016-04-09T05:40:51 | 2016-04-09T05:40:51 | 54,244,779 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,025 | java | package com.eastflag.firstproject.event;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.eastflag.firstproject.R;
public class Event1Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event1);
Button btn1 = (Button) findViewById(R.id.button1);
//1-2 리스너 생성 : myClick
MyClick myClick = new MyClick();
//2. 이벤트 발생자가 리스너에게 일을 위임
btn1.setOnClickListener(myClick);
}
//1-1. 리스너(OnClickListener) 생성
class MyClick implements View.OnClickListener {
@Override
public void onClick(View v) {
//토스트 메시지 띄우기
Toast.makeText(Event1Activity.this, "clicked", Toast.LENGTH_SHORT).show();
}
}
}
| [
"[email protected]"
] | |
9053423f51de827f073bfc48064ad6af06fdf590 | 11057e8a81155b947029e201030afdd33a35fa05 | /main/src/main/java/me/datatags/commandminerewards/commands/cmd/CmdRemoveCommand.java | ed23f406cf7d80ba19bf74fab33cec81f76e6962 | [
"MIT"
] | permissive | datatags/CommandMineRewards | fbcd2283b4a9616785ce1c6a8ed2a78bfb342bf9 | 8c8ca3401f1dd1805a25be1e3fa17f349c059dcc | refs/heads/master | 2023-08-17T10:40:24.774490 | 2023-08-15T04:42:05 | 2023-08-15T04:42:05 | 64,720,160 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,375 | java | package me.datatags.commandminerewards.commands.cmd;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import me.datatags.commandminerewards.CMRPermission;
import me.datatags.commandminerewards.Reward;
import me.datatags.commandminerewards.Exceptions.CommandNotInListException;
import me.datatags.commandminerewards.Exceptions.InvalidRewardException;
import me.datatags.commandminerewards.Exceptions.InvalidRewardGroupException;
import me.datatags.commandminerewards.commands.ArgType;
public class CmdRemoveCommand extends CmdCommand {
@Override
public String getName() {
return "remove";
}
@Override
public String getBasicDescription() {
return "Removes a reward command";
}
@Override
public String getExtensiveDescription() {
return "Removes a reward command from the selected reward. You can remove by ID or typing the full command, but ID is recommended. You can get the ID with /cmr command list";
}
@Override
public String getUsage() {
return "<rewardSection> <reward> <index|command>";
}
@Override
public String[] getExamples() {
return new String[] {"genericRewards bigReward 2", "cropRewards smallReward eco give %player% 100"};
}
@Override
public int getMinArgs() {
return 3;
}
@Override
public int getMaxArgs() {
return -1;
}
@Override
public ArgType[] getArgs() {
return new ArgType[] {ArgType.REWARD_SECTION, ArgType.REWARD};
}
@Override
public CMRPermission getPermission() {
return CMRPermission.COMMAND_MODIFY;
}
@Override
public boolean onCommand(CommandSender sender, String[] args) {
String rewardSection = args[0];
String rewardName = args[1];
Reward reward;
try {
reward = new Reward(rewardSection, rewardName);
} catch (InvalidRewardGroupException | InvalidRewardException ex) {
sender.sendMessage(ChatColor.RED + ex.getMessage());
return true;
}
if (args.length == 3) {
int index;
try {
index = Integer.parseInt(args[2]);
} catch (NumberFormatException e) {
try {
reward.removeCommand(args[2]);
} catch (ArrayIndexOutOfBoundsException | CommandNotInListException ex) {
sender.sendMessage(ChatColor.RED + ex.getMessage());
return true;
}
sender.sendMessage(ChatColor.GREEN + "Successfully removed command!");
return true;
}
try {
reward.removeCommand(index);
} catch (ArrayIndexOutOfBoundsException e) {
sender.sendMessage(ChatColor.RED + e.getMessage());
return true;
}
sender.sendMessage(SUCCESS);
} else if (args.length > 3) {
String command = parseCommand(2, args);
try {
reward.removeCommand(command);
} catch (CommandNotInListException e) {
sender.sendMessage(ChatColor.RED + e.getMessage());
return true;
}
sender.sendMessage(ChatColor.GREEN + "Successfully removed command!");
}
return true;
}
}
| [
"[email protected]"
] | |
c984e255a2af1db15cadcbcbc9ad391658fe2588 | a5b48bf62c66d511468554f0e4e2e0251f09d46f | /22-jpa-crud-demo/src/main/java/com/luv2code/spring/demo/CruddemoApplication/dao/EmployeeDAO.java | c2c7dfe0332d7c4095c9e0773d8441bdaacffd18 | [] | no_license | mubashir-mindfiresol/eclipse-workspace | 9eed12325e83da00dcb79f1b5f20a6d98d97cba3 | f67013c51308da4d23dda89f0bc5516d2f433ad5 | refs/heads/main | 2023-03-20T05:58:30.848872 | 2021-03-09T06:52:23 | 2021-03-09T06:52:23 | 341,240,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.luv2code.spring.demo.CruddemoApplication.dao;
import java.util.List;
import com.luv2code.spring.demo.CruddemoApplication.entity.Employee;
public interface EmployeeDAO {
public List<Employee> findAll();
public Employee findById(int theId);
public void save(Employee theEmployee);
public void deleteById(int theId);
}
| [
"[email protected]"
] | |
8eb18e0daa3b7000ae4db65a295db5c8d7dd3d1d | 0b9036df55919cbaade54da0621d640f6807f91a | /mango-backup/src/main/java/com/louis/mango/backup/controller/MySqlBackupController.java | 05b79ae3b933e55931d17eab018e070cd34465d4 | [] | no_license | fws433/mango | ef553ec5986264979f606a6b8768ff80d940bedc | 5930c2428a3c896cceebdf9a7fb1d0cec05d6000 | refs/heads/master | 2023-07-21T10:49:56.782214 | 2020-03-24T04:47:31 | 2020-03-24T04:51:22 | 249,614,558 | 0 | 0 | null | 2023-07-18T20:52:17 | 2020-03-24T04:41:58 | Java | UTF-8 | Java | false | false | 4,642 | java | package com.louis.mango.backup.controller;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.louis.mango.backup.datasource.BackupDataSourceProperties;
import com.louis.mango.backup.service.MysqlBackupService;
import com.louis.mangocommon.utils.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.louis.mango.backup.constants.BackupConstants;
import com.louis.mango.backup.util.HttpResult;
import com.louis.mangocommon.utils.ReflectionUtils;
import javax.servlet.http.HttpServlet;
/**
* 系统数据备份还原
* @author Louis
* @date Jan 15, 2019
*/
@RestController
@RequestMapping("/backup")
public class MySqlBackupController {
@Autowired
MysqlBackupService mysqlBackupService;
@Autowired
BackupDataSourceProperties properties;
@GetMapping("/backup")
public HttpResult backup(){
String backupFolderName=BackupConstants.DEFAULT_BACKUP_NAME+"_"
+(new SimpleDateFormat(BackupConstants.DATE_FORMAT)).format(new Date());
return backup(backupFolderName);
}
private HttpResult backup(String backupFodlerName){
String host=properties.getHost();
String userName=properties.getUserName();
String password=properties.getPassword();
String database=properties.getDatabase();
String backupFolderPath=BackupConstants.BACKUP_FOLDER+backupFodlerName+File.separator;
String fileName=BackupConstants.BACKUP_FILE_NAME;
try{
boolean success=mysqlBackupService.backup(host,userName,password,backupFolderPath,fileName,database);
if(!success){
HttpResult.error("数据备份失败");
}
}catch(Exception e){
return HttpResult.error(500,e.getMessage());
}
return HttpResult.ok();
}
@GetMapping("/restore")
public HttpResult restore(@RequestParam String name) throws IOException {
String host = properties.getHost();
String userName = properties.getUserName();
String password = properties.getPassword();
String database = properties.getDatabase();
String restoreFilePath = BackupConstants.RESTORE_FOLDER + name;
try {
mysqlBackupService.restore(restoreFilePath, host, userName, password, database);
} catch (Exception e) {
return HttpResult.error(500, e.getMessage());
}
return HttpResult.ok();
}
@GetMapping("/findRecords")
public HttpResult findBackupRecords() {
if(!new File(BackupConstants.DEFAULT_RESTORE_FILE).exists()) {
// 初始默认备份文件
backup(BackupConstants.DEFAULT_BACKUP_NAME);
}
List<Map<String, String>> backupRecords = new ArrayList<>();
File restoreFolderFile = new File(BackupConstants.RESTORE_FOLDER);
if(restoreFolderFile.exists()) {
for(File file:restoreFolderFile.listFiles()) {
Map<String, String> backup = new HashMap<>();
backup.put("name", file.getName());
backup.put("title", file.getName());
if(BackupConstants.DEFAULT_BACKUP_NAME.equalsIgnoreCase(file.getName())) {
backup.put("title", "系统默认备份");
}
backupRecords.add(backup);
}
}
// 排序,默认备份最前,然后按时间戳排序,新备份在前面
backupRecords.sort((o1, o2) -> BackupConstants.DEFAULT_BACKUP_NAME.equalsIgnoreCase(o1.get("name")) ? -1
: BackupConstants.DEFAULT_BACKUP_NAME.equalsIgnoreCase(o2.get("name")) ? 1 : o2.get("name").compareTo(o1.get("name")));
return HttpResult.ok(backupRecords);
}
@GetMapping("/delete")
public HttpResult deleteBackupRecord(@RequestParam String name) {
if(BackupConstants.DEFAULT_BACKUP_NAME.equals(name)) {
return HttpResult.error("系统默认备份无法删除!");
}
String restoreFilePath = BackupConstants.BACKUP_FOLDER + name;
try {
FileUtils.deleteFile(new File(restoreFilePath));
} catch (Exception e) {
return HttpResult.error(500, e.getMessage());
}
return HttpResult.ok();
}
}
| [
"[email protected]"
] | |
f93b3f923838fdd585fb0aa7b907a782c1e8c761 | e7aee1373c6a20868b3c49115e06e59962b58b22 | /BOJ/4436 엘프의 검/Main.java | 78176c8fc76d186b36bd83dd38bcc401d43f6379 | [] | no_license | hanhb1011/BaekJoon | b590cc76196b164cd470feb2cf8c680d37fa4448 | 2c5e1112960006503a5e691779653c43aeedeb6f | refs/heads/master | 2021-07-16T15:42:49.316500 | 2019-02-10T07:52:23 | 2019-02-10T07:52:23 | 103,599,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 446 | java | import java.util.*;
public class Main{
static int res;
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
while(sc.hasNext()){
long v=Long.valueOf(sc.nextLine());
int k=1,r=0,n[]=new int[10];
while(r!=10){
String s= String.valueOf(k++*v);
for(int i=0;i<s.length();i++){
int j=s.charAt(i)-48;
if(n[j]==0) {
n[j] = 1;
r++;
}
}
}
System.out.println(k-1);
}
}
} | [
"[email protected]"
] | |
ce9919311e6b6a7c25b6a7b495a7c5532c830ec4 | 4f37081ed62e44afa0b2465388a8adf9b5490b13 | /content/public/android/java/src/org/chromium/content/browser/selection/SelectionPopupControllerImpl.java | 40cf354b9a260a17332e269b1ccc723bb5bbd51c | [
"BSD-3-Clause"
] | permissive | zowhair/chromium | 05b9eed58a680941c3595d52c3c77b620ef2c3ac | d84d5ef83e401ec210fcb14a92803bf339e1ccce | refs/heads/master | 2023-03-04T23:15:10.914156 | 2018-03-15T11:27:44 | 2018-03-15T11:27:44 | 125,359,706 | 1 | 0 | null | 2018-03-15T11:50:44 | 2018-03-15T11:50:43 | null | UTF-8 | Java | false | false | 56,920 | java | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser.selection;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.SearchManager;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Build;
import android.provider.Browser;
import android.support.annotation.Nullable;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.text.style.ParagraphStyle;
import android.text.style.UpdateAppearance;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.WindowManager;
import android.view.textclassifier.TextClassifier;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.content.R;
import org.chromium.content.browser.ContentClassFactory;
import org.chromium.content.browser.PopupController;
import org.chromium.content.browser.PopupController.HideablePopup;
import org.chromium.content.browser.WindowAndroidChangedObserver;
import org.chromium.content.browser.WindowEventObserver;
import org.chromium.content.browser.webcontents.WebContentsImpl;
import org.chromium.content.browser.webcontents.WebContentsUserData;
import org.chromium.content.browser.webcontents.WebContentsUserData.UserDataFactory;
import org.chromium.content_public.browser.ActionModeCallbackHelper;
import org.chromium.content_public.browser.ImeEventObserver;
import org.chromium.content_public.browser.SelectionClient;
import org.chromium.content_public.browser.SelectionPopupController;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.DeviceFormFactor;
import org.chromium.ui.base.MenuSourceType;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.touch_selection.SelectionEventType;
import java.util.List;
/**
* Implementation of the interface {@link SelectionPopupController}.
*/
@JNINamespace("content")
@TargetApi(Build.VERSION_CODES.M)
public class SelectionPopupControllerImpl extends ActionModeCallbackHelper
implements ImeEventObserver, SelectionPopupController, WindowEventObserver,
WindowAndroidChangedObserver, HideablePopup {
private static final String TAG = "SelectionPopupCtlr"; // 20 char limit
/**
* Android Intent size limitations prevent sending over a megabyte of data. Limit
* query lengths to 100kB because other things may be added to the Intent.
*/
private static final int MAX_SHARE_QUERY_LENGTH = 100000;
// Default delay for reshowing the {@link ActionMode} after it has been
// hidden. This avoids flickering issues if there are trailing rect
// invalidations after the ActionMode is shown. For example, after the user
// stops dragging a selection handle, in turn showing the ActionMode, the
// selection change response will be asynchronous. 300ms should accomodate
// most such trailing, async delays.
private static final int SHOW_DELAY_MS = 300;
// A large value to force text processing menu items to be at the end of the
// context menu. Chosen to be bigger than the order of possible items in the
// XML template.
// TODO(timav): remove this constant and use show/hide for Assist item instead
// of adding and removing it once we switch to Android O SDK. The show/hide method
// does not require ordering information.
private static final int MENU_ITEM_ORDER_TEXT_PROCESS_START = 100;
// A flag to determine if we should get readback view from WindowAndroid.
// The readback view could be the ContainerView, which WindowAndroid has no control on that.
// Embedders should set this properly to use the correct view for readback.
private static boolean sShouldGetReadbackViewFromWindowAndroid = false;
private static final class UserDataFactoryLazyHolder {
private static final UserDataFactory<SelectionPopupControllerImpl> INSTANCE =
SelectionPopupControllerImpl::new;
}
private Context mContext;
private WindowAndroid mWindowAndroid;
private WebContentsImpl mWebContents;
private ActionMode.Callback mCallback;
private long mNativeSelectionPopupController;
private SelectionClient.ResultCallback mResultCallback;
// Used to customize PastePopupMenu
private ActionMode.Callback mNonSelectionCallback;
// Selection rectangle in DIP.
private final Rect mSelectionRect = new Rect();
// Self-repeating task that repeatedly hides the ActionMode. This is
// required because ActionMode only exposes a temporary hide routine.
private Runnable mRepeatingHideRunnable;
private View mView;
private ActionMode mActionMode;
private MenuDescriptor mActionMenuDescriptor;
// Bit field for mappings from menu item to a flag indicating it is allowed.
private int mAllowedMenuItems;
private boolean mHidden;
private boolean mEditable;
private boolean mIsPasswordType;
private boolean mIsInsertionForTesting;
private boolean mCanSelectAllForPastePopup;
private boolean mCanEditRichly;
private boolean mUnselectAllOnDismiss;
private String mLastSelectedText;
private int mLastSelectionOffset;
// Tracks whether a touch selection is currently active.
private boolean mHasSelection;
// Lazily created paste popup menu, triggered either via long press in an
// editable region or from tapping the insertion handle.
private PastePopupMenu mPastePopupMenu;
private boolean mWasPastePopupShowingOnInsertionDragStart;
/**
* The {@link SelectionClient} that processes textual selection, or {@code null} if none
* exists.
*/
private SelectionClient mSelectionClient;
// SelectionMetricsLogger, could be null.
private SmartSelectionMetricsLogger mSelectionMetricsLogger;
private PopupController mPopupController;
// The classificaton result of the selected text if the selection exists and
// SelectionClient was able to classify it, otherwise null.
private SelectionClient.Result mClassificationResult;
// Whether a scroll is in progress.
private boolean mScrollInProgress;
private boolean mPreserveSelectionOnNextLossOfFocus;
private boolean mInitialized;
/**
* The {@link SelectionInsertionHandleObserver} that processes handle events, or {@code null} if
* none exists.
*/
private SelectionInsertionHandleObserver mHandleObserver;
/**
* An interface for getting {@link View} for readback.
*/
public interface ReadbackViewCallback {
/**
* Gets the {@link View} for readback.
*/
View getReadbackView();
}
/**
* Sets to use the readback view from {@link WindowAndroid}.
*/
public static void setShouldGetReadbackViewFromWindowAndroid() {
sShouldGetReadbackViewFromWindowAndroid = true;
}
/**
* Create {@link SelectionPopupController} instance.
* @param context Context for action mode.
* @param window WindowAndroid instance.
* @param webContents WebContents instance.
* @param view Container view.
*/
public static SelectionPopupControllerImpl create(
Context context, WindowAndroid window, WebContents webContents, View view) {
SelectionPopupControllerImpl controller = WebContentsUserData.fromWebContents(webContents,
SelectionPopupControllerImpl.class, UserDataFactoryLazyHolder.INSTANCE);
assert controller != null && !controller.initialized();
controller.init(context, window, view, true);
return controller;
}
/**
* Get {@link SelectionPopupController} object used for the give WebContents.
* {@link #create()} should precede any calls to this.
* @param webContents {@link WebContents} object.
* @return {@link SelectionPopupController} object. {@code null} if not available because
* {@link #create()} is not called yet.
*/
public static SelectionPopupControllerImpl fromWebContents(WebContents webContents) {
return WebContentsUserData.fromWebContents(
webContents, SelectionPopupControllerImpl.class, null);
}
/**
* Create {@link SelectionPopupController} instance. Note that it will create an instance with
* no link to native side for testing only.
* @param context Context for action mode.
* @param window WindowAndroid instance.
* @param webContents WebContents instance.
* @param view Container view.
* @param popupController {@link PopupController} mocked for testing.
*/
public static SelectionPopupControllerImpl createForTesting(Context context,
WindowAndroid window, WebContents webContents, View view,
PopupController popupController) {
SelectionPopupControllerImpl controller = new SelectionPopupControllerImpl(webContents);
controller.setPopupControllerForTesting(popupController);
controller.init(context, window, view, false);
return controller;
}
private void setPopupControllerForTesting(PopupController popupController) {
mPopupController = popupController;
}
/**
* Create {@link SelectionPopupControllerImpl} instance.
* @param webContents WebContents instance.
*/
public SelectionPopupControllerImpl(WebContents webContents) {
mWebContents = (WebContentsImpl) webContents;
}
/**
* @param context Context for action mode.
* @param window WindowAndroid instance.
* @param view Container view.
*/
private void init(Context context, WindowAndroid window, View view, boolean initializeNative) {
mContext = context;
mWindowAndroid = window;
mView = view;
// The menu items are allowed by default.
mAllowedMenuItems = MENU_ITEM_SHARE | MENU_ITEM_WEB_SEARCH | MENU_ITEM_PROCESS_TEXT;
mRepeatingHideRunnable = new Runnable() {
@Override
public void run() {
assert mHidden;
final long hideDuration = getDefaultHideDuration();
// Ensure the next hide call occurs before the ActionMode reappears.
mView.postDelayed(mRepeatingHideRunnable, hideDuration - 1);
hideActionModeTemporarily(hideDuration);
}
};
mResultCallback = new SmartSelectionCallback();
mLastSelectedText = "";
initHandleObserver();
if (initializeNative) mNativeSelectionPopupController = nativeInit(mWebContents);
getPopupController().registerPopup(this);
mInitialized = true;
}
private boolean initialized() {
return mInitialized;
}
public static String sanitizeQuery(String query, int maxLength) {
if (TextUtils.isEmpty(query) || query.length() < maxLength) return query;
Log.w(TAG, "Truncating oversized query (" + query.length() + ").");
return query.substring(0, maxLength) + "…";
}
/**
* Update the container view.
*/
public void setContainerView(View view) {
assert view != null;
// Cleans up action mode before switching to a new container view.
if (isActionModeValid()) finishActionMode();
mUnselectAllOnDismiss = true;
destroyPastePopup();
mView = view;
initHandleObserver();
}
// ImeEventObserver
@Override
public void onNodeAttributeUpdated(boolean editable, boolean password) {
updateSelectionState(editable, password);
}
@Override
public void setActionModeCallback(ActionMode.Callback callback) {
mCallback = callback;
}
@Override
public void setNonSelectionActionModeCallback(ActionMode.Callback callback) {
mNonSelectionCallback = callback;
}
@Override
public SelectionClient.ResultCallback getResultCallback() {
return mResultCallback;
}
public SelectionClient.Result getClassificationResult() {
return mClassificationResult;
}
/**
* Gets the current {@link SelectionClient}.
*/
public SelectionClient getSelectionClient() {
return mSelectionClient;
}
@Override
public boolean isActionModeValid() {
return mActionMode != null;
}
// True if action mode is initialized to a working (not a no-op) mode.
private boolean isActionModeSupported() {
return mCallback != EMPTY_CALLBACK;
}
@Override
public void setAllowedMenuItems(int allowedMenuItems) {
mAllowedMenuItems = allowedMenuItems;
}
@VisibleForTesting
@CalledByNative
public void showSelectionMenu(int left, int top, int right, int bottom, int handleHeight,
boolean isEditable, boolean isPasswordType, String selectionText,
int selectionStartOffset, boolean canSelectAll, boolean canRichlyEdit,
boolean shouldSuggest, @MenuSourceType int sourceType) {
int offsetBottom = bottom;
// Legacy action mode expects the selection rectangle not to include touch handle.
if (supportsFloatingActionMode()) offsetBottom += handleHeight;
mSelectionRect.set(left, top, right, offsetBottom);
mEditable = isEditable;
mLastSelectedText = selectionText;
mLastSelectionOffset = selectionStartOffset;
mHasSelection = selectionText.length() != 0;
mIsPasswordType = isPasswordType;
mCanSelectAllForPastePopup = canSelectAll;
mCanEditRichly = canRichlyEdit;
mUnselectAllOnDismiss = true;
if (hasSelection()) {
// Device is not provisioned, don't trigger SelectionClient logic at all.
boolean blockSelectionClient = !ApiCompatibilityUtils.isDeviceProvisioned(mContext);
// Disable SelectionClient logic if it's incognito.
blockSelectionClient |= isIncognito();
if (!blockSelectionClient && mSelectionMetricsLogger != null) {
switch (sourceType) {
case MenuSourceType.MENU_SOURCE_ADJUST_SELECTION:
mSelectionMetricsLogger.logSelectionModified(
mLastSelectedText, mLastSelectionOffset, mClassificationResult);
break;
case MenuSourceType.MENU_SOURCE_ADJUST_SELECTION_RESET:
mSelectionMetricsLogger.logSelectionAction(mLastSelectedText,
mLastSelectionOffset, SmartSelectionMetricsLogger.ActionType.RESET,
/* SelectionClient.Result = */ null);
break;
case MenuSourceType.MENU_SOURCE_TOUCH_HANDLE:
break;
default:
mSelectionMetricsLogger.logSelectionStarted(
mLastSelectedText, mLastSelectionOffset, isEditable);
}
}
// From selection adjustment, show menu directly.
if (!blockSelectionClient
&& sourceType == MenuSourceType.MENU_SOURCE_ADJUST_SELECTION) {
showActionModeOrClearOnFailure();
return;
}
// Show menu if we need to block SelectionClient or there is no updates from
// SelectionClient.
if (blockSelectionClient || mSelectionClient == null
|| !mSelectionClient.requestSelectionPopupUpdates(shouldSuggest)) {
showActionModeOrClearOnFailure();
}
} else {
createAndShowPastePopup();
}
}
/**
* Show (activate) android action mode by starting it.
*
* <p>Action mode in floating mode is tried first, and then falls back to
* a normal one.
* <p> If the action mode cannot be created the selection is cleared.
*/
public void showActionModeOrClearOnFailure() {
if (!isActionModeSupported() || !hasSelection()) return;
// Just refresh non-floating action mode if it already exists to avoid blinking.
if (isActionModeValid() && !isFloatingActionMode()) {
// Try/catch necessary for framework bug, crbug.com/446717.
try {
mActionMode.invalidate();
} catch (NullPointerException e) {
Log.w(TAG, "Ignoring NPE from ActionMode.invalidate() as workaround for L", e);
}
hideActionMode(false);
return;
}
// Reset overflow menu (see crbug.com/700929).
destroyActionModeAndKeepSelection();
assert mWebContents != null;
ActionMode actionMode = supportsFloatingActionMode() ? startFloatingActionMode()
: mView.startActionMode(mCallback);
if (actionMode != null) {
// This is to work around an LGE email issue. See crbug.com/651706 for more details.
LGEmailActionModeWorkaround.runIfNecessary(mContext, actionMode);
}
mActionMode = actionMode;
mUnselectAllOnDismiss = true;
if (!isActionModeValid()) clearSelection();
}
@TargetApi(Build.VERSION_CODES.M)
private ActionMode startFloatingActionMode() {
ActionMode actionMode = mView.startActionMode(
new FloatingActionModeCallback(this, mCallback), ActionMode.TYPE_FLOATING);
return actionMode;
}
private void createAndShowPastePopup() {
if (mView.getParent() == null || mView.getVisibility() != View.VISIBLE) {
return;
}
if (!supportsFloatingActionMode() && !canPaste() && mNonSelectionCallback == null) return;
destroyPastePopup();
PastePopupMenu.PastePopupMenuDelegate delegate =
new PastePopupMenu.PastePopupMenuDelegate() {
@Override
public void paste() {
SelectionPopupControllerImpl.this.paste();
mWebContents.dismissTextHandles();
}
@Override
public void pasteAsPlainText() {
SelectionPopupControllerImpl.this.pasteAsPlainText();
mWebContents.dismissTextHandles();
}
@Override
public boolean canPaste() {
return SelectionPopupControllerImpl.this.canPaste();
}
@Override
public void selectAll() {
SelectionPopupControllerImpl.this.selectAll();
}
@Override
public boolean canSelectAll() {
return SelectionPopupControllerImpl.this.canSelectAll();
}
@Override
public boolean canPasteAsPlainText() {
return SelectionPopupControllerImpl.this.canPasteAsPlainText();
}
};
Context windowContext = mWindowAndroid.getContext().get();
if (windowContext == null) return;
if (supportsFloatingActionMode()) {
mPastePopupMenu = new FloatingPastePopupMenu(
windowContext, mView, delegate, mNonSelectionCallback);
} else {
mPastePopupMenu = new LegacyPastePopupMenu(windowContext, mView, delegate);
}
showPastePopup();
}
private void showPastePopup() {
try {
mPastePopupMenu.show(getSelectionRectRelativeToContainingView());
} catch (WindowManager.BadTokenException e) {
}
}
@Override
public boolean supportsFloatingActionMode() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}
// HideablePopup implementation
@Override
public void hide() {
destroyPastePopup();
}
public void destroyPastePopup() {
if (isPastePopupShowing()) {
mPastePopupMenu.hide();
mPastePopupMenu = null;
}
}
@VisibleForTesting
public boolean isPastePopupShowing() {
return mPastePopupMenu != null;
}
// Composition methods for android.view.ActionMode
/**
* @see ActionMode#finish()
*/
@Override
public void finishActionMode() {
mHidden = false;
if (mView != null) mView.removeCallbacks(mRepeatingHideRunnable);
if (isActionModeValid()) {
mActionMode.finish();
// Should be nulled out in case #onDestroyActionMode() is not invoked in response.
mActionMode = null;
mActionMenuDescriptor = null;
}
}
/**
* @see ActionMode#invalidateContentRect()
*/
public void invalidateContentRect() {
if (supportsFloatingActionMode() && isActionModeValid()) {
mActionMode.invalidateContentRect();
}
}
// WindowAndroidChangedObserver
@Override
public void onWindowAndroidChanged(WindowAndroid newWindowAndroid) {
mWindowAndroid = newWindowAndroid;
initHandleObserver();
}
// WindowEventObserver
@Override
public void onWindowFocusChanged(boolean gainFocus) {
if (supportsFloatingActionMode() && isActionModeValid()) {
mActionMode.onWindowFocusChanged(gainFocus);
}
}
@Override
public void onAttachedToWindow() {
updateTextSelectionUI(true);
}
@Override
public void onDetachedFromWindow() {
// WebView uses PopupWindows for handle rendering, which may remain
// unintentionally visible even after the WebView has been detached.
// Override the handle visibility explicitly to address this, but
// preserve the underlying selection for detachment cases like screen
// locking and app switching.
updateTextSelectionUI(false);
}
public void setScrollInProgress(boolean touchScrollInProgress, boolean scrollInProgress) {
mScrollInProgress = scrollInProgress;
// The active fling count reflected in |scrollInProgress| isn't reliable with WebView,
// so only use the active touch scroll signal for hiding. The fling animation
// movement will naturally hide the ActionMode by invalidating its content rect.
hideActionMode(touchScrollInProgress);
}
/**
* Whether a touch scroll sequence is active, used to hide text selection
* handles. Note that a scroll sequence will *always* bound a pinch
* sequence, so this will also be true for the duration of a pinch gesture.
*/
public boolean getScrollInProgress() {
return mScrollInProgress;
}
/**
* Hide or reveal the ActionMode. Note that this only has visible
* side-effects if the underlying ActionMode supports hiding.
* @param hide whether to hide or show the ActionMode.
*/
private void hideActionMode(boolean hide) {
if (!isFloatingActionMode()) return;
if (mHidden == hide) return;
mHidden = hide;
if (mHidden) {
mRepeatingHideRunnable.run();
} else {
mView.removeCallbacks(mRepeatingHideRunnable);
// To show the action mode that is being hidden call hide() again with a short delay.
hideActionModeTemporarily(SHOW_DELAY_MS);
}
}
/**
* @see ActionMode#hide(long)
*/
private void hideActionModeTemporarily(long duration) {
assert isFloatingActionMode();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (isActionModeValid()) mActionMode.hide(duration);
}
}
private boolean isFloatingActionMode() {
return supportsFloatingActionMode() && isActionModeValid()
&& mActionMode.getType() == ActionMode.TYPE_FLOATING;
}
private long getDefaultHideDuration() {
if (supportsFloatingActionMode()) {
return ViewConfiguration.getDefaultActionModeHideDuration();
}
return 2000;
}
// Default handlers for action mode callbacks.
@Override
public void onCreateActionMode(ActionMode mode, Menu menu) {
mode.setTitle(DeviceFormFactor.isTablet()
? mContext.getString(R.string.actionbar_textselection_title)
: null);
mode.setSubtitle(null);
createActionMenu(mode, menu);
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
menu.removeGroup(R.id.select_action_menu_default_items);
menu.removeGroup(R.id.select_action_menu_assist_items);
menu.removeGroup(R.id.select_action_menu_text_processing_menus);
createActionMenu(mode, menu);
return true;
}
/**
* Initialize the menu by populating all the available items. Embedders should remove
* the items that are not relevant to the input text being edited.
*/
public static void initializeMenu(Context context, ActionMode mode, Menu menu) {
try {
mode.getMenuInflater().inflate(R.menu.select_action_menu, menu);
} catch (Resources.NotFoundException e) {
// TODO(tobiasjs) by the time we get here we have already
// caused a resource loading failure to be logged. WebView
// resource access needs to be improved so that this
// logspam can be avoided.
new MenuInflater(context).inflate(R.menu.select_action_menu, menu);
}
}
@TargetApi(Build.VERSION_CODES.O)
public static void setPasteAsPlainTextMenuItemTitle(Menu menu) {
MenuItem item = menu.findItem(R.id.select_action_menu_paste_as_plain_text);
if (item == null) return;
// android.R.string.paste_as_plain_text is available in SDK since O.
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
item.setTitle(android.R.string.paste_as_plain_text);
}
private void createActionMenu(ActionMode mode, Menu menu) {
initializeMenu(mContext, mode, menu);
mActionMenuDescriptor = createActionMenuDescriptor();
mActionMenuDescriptor.apply(menu);
setPasteAsPlainTextMenuItemTitle(menu);
if (!hasSelection() || isSelectionPassword()) return;
initializeTextProcessingMenu(menu);
}
private MenuDescriptor createActionMenuDescriptor() {
MenuDescriptor descriptor = new MenuDescriptor();
updateAssistMenuItem(descriptor);
if (!isFocusedNodeEditable() || !canPaste()) {
descriptor.removeItem(R.id.select_action_menu_paste);
descriptor.removeItem(R.id.select_action_menu_paste_as_plain_text);
}
if (!canPasteAsPlainText()) {
descriptor.removeItem(R.id.select_action_menu_paste_as_plain_text);
}
if (!hasSelection()) {
descriptor.removeItem(R.id.select_action_menu_select_all);
descriptor.removeItem(R.id.select_action_menu_cut);
descriptor.removeItem(R.id.select_action_menu_copy);
descriptor.removeItem(R.id.select_action_menu_share);
descriptor.removeItem(R.id.select_action_menu_web_search);
return descriptor;
}
if (!isFocusedNodeEditable()) {
descriptor.removeItem(R.id.select_action_menu_cut);
}
if (isFocusedNodeEditable() || !isSelectActionModeAllowed(MENU_ITEM_SHARE)) {
descriptor.removeItem(R.id.select_action_menu_share);
}
if (isFocusedNodeEditable() || isIncognito()
|| !isSelectActionModeAllowed(MENU_ITEM_WEB_SEARCH)) {
descriptor.removeItem(R.id.select_action_menu_web_search);
}
if (isSelectionPassword()) {
descriptor.removeItem(R.id.select_action_menu_copy);
descriptor.removeItem(R.id.select_action_menu_cut);
}
return descriptor;
}
private boolean needsActionMenuUpdate() {
return !createActionMenuDescriptor().equals(mActionMenuDescriptor);
}
private boolean canPaste() {
ClipboardManager clipMgr =
(ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
return clipMgr.hasPrimaryClip();
}
// Check if this Spanned is formatted text.
private boolean hasStyleSpan(Spanned spanned) {
// Only check against those three classes below, which could affect text appearance, since
// there are other kind of classes won't affect appearance.
Class<?>[] styleClasses = {
CharacterStyle.class, ParagraphStyle.class, UpdateAppearance.class};
for (Class<?> clazz : styleClasses) {
if (spanned.nextSpanTransition(-1, spanned.length(), clazz) < spanned.length()) {
return true;
}
}
return false;
}
// Check if need to show "paste as plain text" option.
// Don't show "paste as plain text" when "paste" and "paste as plain text" would do exactly the
// same.
@VisibleForTesting
public boolean canPasteAsPlainText() {
// String resource "paste_as_plain_text" only exist in O.
// Also this is an O feature, we need to make it consistant with TextView.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return false;
if (!mCanEditRichly) return false;
ClipboardManager clipMgr =
(ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
if (!clipMgr.hasPrimaryClip()) return false;
ClipData clipData = clipMgr.getPrimaryClip();
ClipDescription description = clipData.getDescription();
CharSequence text = clipData.getItemAt(0).getText();
boolean isPlainType = description.hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN);
// On Android, Spanned could be copied to Clipboard as plain_text MIME type, but in some
// cases, Spanned could have text format, we need to show "paste as plain text" when
// that happens.
if (isPlainType && (text instanceof Spanned)) {
Spanned spanned = (Spanned) text;
if (hasStyleSpan(spanned)) return true;
}
return description.hasMimeType(ClipDescription.MIMETYPE_TEXT_HTML);
}
private void updateAssistMenuItem(MenuDescriptor descriptor) {
// There is no Assist functionality before Android O.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
if (mClassificationResult != null && mClassificationResult.hasNamedAction()) {
descriptor.addItem(R.id.select_action_menu_assist_items, android.R.id.textAssist, 1,
mClassificationResult.label, mClassificationResult.icon);
}
}
/**
* Intialize the menu items for processing text, if there is any.
*/
private void initializeTextProcessingMenu(Menu menu) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|| !isSelectActionModeAllowed(MENU_ITEM_PROCESS_TEXT)) {
return;
}
PackageManager packageManager = mContext.getPackageManager();
List<ResolveInfo> supportedActivities =
packageManager.queryIntentActivities(createProcessTextIntent(), 0);
for (int i = 0; i < supportedActivities.size(); i++) {
ResolveInfo resolveInfo = supportedActivities.get(i);
CharSequence label = resolveInfo.loadLabel(mContext.getPackageManager());
menu.add(R.id.select_action_menu_text_processing_menus, Menu.NONE,
MENU_ITEM_ORDER_TEXT_PROCESS_START + i, label)
.setIntent(createProcessTextIntentForResolveInfo(resolveInfo))
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
}
@TargetApi(Build.VERSION_CODES.M)
private static Intent createProcessTextIntent() {
return new Intent().setAction(Intent.ACTION_PROCESS_TEXT).setType("text/plain");
}
@TargetApi(Build.VERSION_CODES.M)
private Intent createProcessTextIntentForResolveInfo(ResolveInfo info) {
boolean isReadOnly = !isFocusedNodeEditable();
return createProcessTextIntent()
.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, isReadOnly)
.setClassName(info.activityInfo.packageName, info.activityInfo.name);
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
if (!isActionModeValid()) return true;
int id = item.getItemId();
int groupId = item.getGroupId();
if (hasSelection() && mSelectionMetricsLogger != null) {
mSelectionMetricsLogger.logSelectionAction(mLastSelectedText, mLastSelectionOffset,
getActionType(id), mClassificationResult);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && id == android.R.id.textAssist) {
doAssistAction();
mode.finish();
} else if (id == R.id.select_action_menu_select_all) {
selectAll();
} else if (id == R.id.select_action_menu_cut) {
cut();
mode.finish();
} else if (id == R.id.select_action_menu_copy) {
copy();
mode.finish();
} else if (id == R.id.select_action_menu_paste) {
paste();
mode.finish();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& id == R.id.select_action_menu_paste_as_plain_text) {
pasteAsPlainText();
mode.finish();
} else if (id == R.id.select_action_menu_share) {
share();
mode.finish();
} else if (id == R.id.select_action_menu_web_search) {
search();
mode.finish();
} else if (groupId == R.id.select_action_menu_text_processing_menus) {
processText(item.getIntent());
// The ActionMode is not dismissed to match the behavior with
// TextView in Android M.
} else {
return false;
}
return true;
}
@Override
public void onDestroyActionMode() {
mActionMode = null;
mActionMenuDescriptor = null;
if (mUnselectAllOnDismiss) {
mWebContents.dismissTextHandles();
clearSelection();
}
}
/**
* Called when an ActionMode needs to be positioned on screen, potentially occluding view
* content. Note this may be called on a per-frame basis.
*
* @param mode The ActionMode that requires positioning.
* @param view The View that originated the ActionMode, in whose coordinates the Rect should
* be provided.
* @param outRect The Rect to be populated with the content position.
*/
@Override
public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
outRect.set(getSelectionRectRelativeToContainingView());
}
private Rect getSelectionRectRelativeToContainingView() {
float deviceScale = getDeviceScaleFactor();
Rect viewSelectionRect = new Rect((int) (mSelectionRect.left * deviceScale),
(int) (mSelectionRect.top * deviceScale),
(int) (mSelectionRect.right * deviceScale),
(int) (mSelectionRect.bottom * deviceScale));
// The selection coordinates are relative to the content viewport, but we need
// coordinates relative to the containing View.
viewSelectionRect.offset(
0, (int) mWebContents.getRenderCoordinates().getContentOffsetYPix());
return viewSelectionRect;
}
private float getDeviceScaleFactor() {
return mWebContents.getRenderCoordinates().getDeviceScaleFactor();
}
private int getActionType(int menuItemId) {
if (menuItemId == R.id.select_action_menu_select_all) {
return SmartSelectionMetricsLogger.ActionType.SELECT_ALL;
}
if (menuItemId == R.id.select_action_menu_cut) {
return SmartSelectionMetricsLogger.ActionType.CUT;
}
if (menuItemId == R.id.select_action_menu_copy) {
return SmartSelectionMetricsLogger.ActionType.COPY;
}
if (menuItemId == R.id.select_action_menu_paste
|| menuItemId == R.id.select_action_menu_paste_as_plain_text) {
return SmartSelectionMetricsLogger.ActionType.PASTE;
}
if (menuItemId == R.id.select_action_menu_share) {
return SmartSelectionMetricsLogger.ActionType.SHARE;
}
if (menuItemId == android.R.id.textAssist) {
return SmartSelectionMetricsLogger.ActionType.SMART_SHARE;
}
return SmartSelectionMetricsLogger.ActionType.OTHER;
}
/**
* Perform an action that depends on the semantics of the selected text.
*/
@VisibleForTesting
void doAssistAction() {
if (mClassificationResult == null || !mClassificationResult.hasNamedAction()) return;
assert mClassificationResult.onClickListener != null
|| mClassificationResult.intent != null;
if (mClassificationResult.onClickListener != null) {
mClassificationResult.onClickListener.onClick(mView);
return;
}
if (mClassificationResult.intent != null) {
Context context = mWindowAndroid.getContext().get();
if (context == null) return;
context.startActivity(mClassificationResult.intent);
return;
}
}
/**
* Perform a select all action.
*/
@VisibleForTesting
public void selectAll() {
mWebContents.selectAll();
mClassificationResult = null;
// Even though the above statement logged a SelectAll user action, we want to
// track whether the focus was in an editable field, so log that too.
if (isFocusedNodeEditable()) {
RecordUserAction.record("MobileActionMode.SelectAllWasEditable");
} else {
RecordUserAction.record("MobileActionMode.SelectAllWasNonEditable");
}
}
/**
* Perform a cut (to clipboard) action.
*/
@VisibleForTesting
public void cut() {
mWebContents.cut();
}
/**
* Perform a copy (to clipboard) action.
*/
@VisibleForTesting
public void copy() {
mWebContents.copy();
}
/**
* Perform a paste action.
*/
@VisibleForTesting
public void paste() {
mWebContents.paste();
}
/**
* Perform a paste as plain text action.
*/
@VisibleForTesting
void pasteAsPlainText() {
mWebContents.pasteAsPlainText();
}
/**
* Perform a share action.
*/
@VisibleForTesting
public void share() {
RecordUserAction.record("MobileActionMode.Share");
String query = sanitizeQuery(getSelectedText(), MAX_SHARE_QUERY_LENGTH);
if (TextUtils.isEmpty(query)) return;
Intent send = new Intent(Intent.ACTION_SEND);
send.setType("text/plain");
send.putExtra(Intent.EXTRA_TEXT, query);
try {
Intent i = Intent.createChooser(send, mContext.getString(R.string.actionbar_share));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(i);
} catch (android.content.ActivityNotFoundException ex) {
// If no app handles it, do nothing.
}
}
/**
* Perform a processText action (translating the text, for example).
*/
private void processText(Intent intent) {
RecordUserAction.record("MobileActionMode.ProcessTextIntent");
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
String query = sanitizeQuery(getSelectedText(), MAX_SEARCH_QUERY_LENGTH);
if (TextUtils.isEmpty(query)) return;
intent.putExtra(Intent.EXTRA_PROCESS_TEXT, query);
// Intent is sent by WindowAndroid by default.
try {
mWindowAndroid.showIntent(intent, new WindowAndroid.IntentCallback() {
@Override
public void onIntentCompleted(WindowAndroid window, int resultCode, Intent data) {
onReceivedProcessTextResult(resultCode, data);
}
}, null);
} catch (android.content.ActivityNotFoundException ex) {
// If no app handles it, do nothing.
}
}
/**
* Perform a search action.
*/
@VisibleForTesting
public void search() {
RecordUserAction.record("MobileActionMode.WebSearch");
String query = sanitizeQuery(getSelectedText(), MAX_SEARCH_QUERY_LENGTH);
if (TextUtils.isEmpty(query)) return;
Intent i = new Intent(Intent.ACTION_WEB_SEARCH);
i.putExtra(SearchManager.EXTRA_NEW_SEARCH, true);
i.putExtra(SearchManager.QUERY, query);
i.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
mContext.startActivity(i);
} catch (android.content.ActivityNotFoundException ex) {
// If no app handles it, do nothing.
}
}
/**
* @return true if the current selection is of password type.
*/
@VisibleForTesting
public boolean isSelectionPassword() {
return mIsPasswordType;
}
@Override
public boolean isFocusedNodeEditable() {
return mEditable;
}
/**
* @return true if the current selection is an insertion point.
*/
@VisibleForTesting
public boolean isInsertionForTesting() {
return mIsInsertionForTesting;
}
/**
* @return true if the current selection can select all.
*/
@VisibleForTesting
public boolean canSelectAll() {
return mCanSelectAllForPastePopup;
}
/**
* @return true if the current selection is for incognito content.
* Note: This should remain constant for the callback's lifetime.
*/
private boolean isIncognito() {
return mWebContents.isIncognito();
}
/**
* @param actionModeItem the flag for the action mode item in question. The valid flags are
* {@link #MENU_ITEM_SHARE}, {@link #MENU_ITEM_WEB_SEARCH}, and
* {@link #MENU_ITEM_PROCESS_TEXT}.
* @return true if the menu item action is allowed. Otherwise, the menu item
* should be removed from the menu.
*/
private boolean isSelectActionModeAllowed(int actionModeItem) {
boolean isAllowedByClient = (mAllowedMenuItems & actionModeItem) != 0;
if (actionModeItem == MENU_ITEM_SHARE) {
return isAllowedByClient && isShareAvailable();
}
return isAllowedByClient;
}
@Override
public void onReceivedProcessTextResult(int resultCode, Intent data) {
if (mWebContents == null || resultCode != Activity.RESULT_OK || data == null) return;
// Do not handle the result if no text is selected or current selection is not editable.
if (!hasSelection() || !isFocusedNodeEditable()) return;
CharSequence result = data.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);
if (result != null) {
// TODO(hush): Use a variant of replace that re-selects the replaced text.
// crbug.com/546710
mWebContents.replace(result.toString());
}
}
@Override
public void setPreserveSelectionOnNextLossOfFocus(boolean preserve) {
mPreserveSelectionOnNextLossOfFocus = preserve;
}
public boolean getPreserveSelectionOnNextLossOfFocus() {
return mPreserveSelectionOnNextLossOfFocus;
}
@Override
public void updateTextSelectionUI(boolean focused) {
setTextHandlesTemporarilyHidden(!focused);
if (focused) {
restoreSelectionPopupsIfNecessary();
} else {
destroyActionModeAndKeepSelection();
getPopupController().hideAllPopups();
}
}
private void setTextHandlesTemporarilyHidden(boolean hide) {
if (mNativeSelectionPopupController == 0) return;
nativeSetTextHandlesTemporarilyHidden(mNativeSelectionPopupController, hide);
}
public void restoreSelectionPopupsIfNecessary() {
if (hasSelection() && !isActionModeValid()) {
showActionModeOrClearOnFailure();
}
}
// All coordinates are in DIP.
@VisibleForTesting
@CalledByNative
void onSelectionEvent(int eventType, int left, int top, int right, int bottom) {
// Ensure the provided selection coordinates form a non-empty rect, as required by
// the selection action mode.
if (left == right) ++right;
if (top == bottom) ++bottom;
switch (eventType) {
case SelectionEventType.SELECTION_HANDLES_SHOWN:
break;
case SelectionEventType.SELECTION_HANDLES_MOVED:
mSelectionRect.set(left, top, right, bottom);
invalidateContentRect();
break;
case SelectionEventType.SELECTION_HANDLES_CLEARED:
mLastSelectedText = "";
mLastSelectionOffset = 0;
mHasSelection = false;
mUnselectAllOnDismiss = false;
mSelectionRect.setEmpty();
if (mSelectionClient != null) mSelectionClient.cancelAllRequests();
finishActionMode();
break;
case SelectionEventType.SELECTION_HANDLE_DRAG_STARTED:
hideActionMode(true);
break;
case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED:
mWebContents.showContextMenuAtTouchHandle(left, bottom);
if (mHandleObserver != null) {
mHandleObserver.handleDragStopped();
}
break;
case SelectionEventType.INSERTION_HANDLE_SHOWN:
mSelectionRect.set(left, top, right, bottom);
mIsInsertionForTesting = true;
break;
case SelectionEventType.INSERTION_HANDLE_MOVED:
mSelectionRect.set(left, top, right, bottom);
if (!mScrollInProgress && isPastePopupShowing()) {
showPastePopup();
} else {
destroyPastePopup();
}
break;
case SelectionEventType.INSERTION_HANDLE_TAPPED:
if (mWasPastePopupShowingOnInsertionDragStart) {
destroyPastePopup();
} else {
mWebContents.showContextMenuAtTouchHandle(
mSelectionRect.left, mSelectionRect.bottom);
}
mWasPastePopupShowingOnInsertionDragStart = false;
break;
case SelectionEventType.INSERTION_HANDLE_CLEARED:
destroyPastePopup();
mIsInsertionForTesting = false;
if (!hasSelection()) mSelectionRect.setEmpty();
break;
case SelectionEventType.INSERTION_HANDLE_DRAG_STARTED:
mWasPastePopupShowingOnInsertionDragStart = isPastePopupShowing();
destroyPastePopup();
break;
case SelectionEventType.INSERTION_HANDLE_DRAG_STOPPED:
if (mWasPastePopupShowingOnInsertionDragStart) {
mWebContents.showContextMenuAtTouchHandle(
mSelectionRect.left, mSelectionRect.bottom);
}
mWasPastePopupShowingOnInsertionDragStart = false;
if (mHandleObserver != null) {
mHandleObserver.handleDragStopped();
}
break;
default:
assert false : "Invalid selection event type.";
}
if (mSelectionClient != null) {
final float deviceScale = getDeviceScaleFactor();
final int xAnchorPix = (int) (mSelectionRect.left * deviceScale);
final int yAnchorPix = (int) (mSelectionRect.bottom * deviceScale);
mSelectionClient.onSelectionEvent(eventType, xAnchorPix, yAnchorPix);
}
}
@VisibleForTesting
@CalledByNative
/* package */ void onDragUpdate(float x, float y) {
if (mHandleObserver != null) {
final float deviceScale = getDeviceScaleFactor();
x *= deviceScale;
// The selection coordinates are relative to the content viewport, but we need
// coordinates relative to the containing View, so adding getContentOffsetYPix().
y = y * deviceScale + mWebContents.getRenderCoordinates().getContentOffsetYPix();
mHandleObserver.handleDragStartedOrMoved(x, y);
}
}
@Override
public void clearSelection() {
if (mWebContents == null || !isActionModeSupported()) return;
mWebContents.collapseSelection();
mClassificationResult = null;
}
private PopupController getPopupController() {
if (mPopupController == null) {
mPopupController = PopupController.fromWebContents(mWebContents);
}
return mPopupController;
}
/**
* @return The context used for SelectionPopupController.
*/
@CalledByNative
private Context getContext() {
return mContext;
}
@CalledByNative
private void onSelectionChanged(String text) {
if (text.length() == 0 && hasSelection() && mSelectionMetricsLogger != null) {
mSelectionMetricsLogger.logSelectionAction(mLastSelectedText, mLastSelectionOffset,
SmartSelectionMetricsLogger.ActionType.ABANDON,
/* SelectionClient.Result = */ null);
}
mLastSelectedText = text;
if (mSelectionClient != null) {
mSelectionClient.onSelectionChanged(text);
}
}
/**
* Sets the client that implements selection augmenting functionality, or null if none exists.
*/
@Override
public void setSelectionClient(@Nullable SelectionClient selectionClient) {
mSelectionClient = selectionClient;
if (mSelectionClient != null) {
mSelectionMetricsLogger =
(SmartSelectionMetricsLogger) mSelectionClient.getSelectionMetricsLogger();
}
mClassificationResult = null;
assert !mHidden;
}
/**
* Sets the handle observer, or null if none exists.
*/
@VisibleForTesting
void setSelectionInsertionHandleObserver(
@Nullable SelectionInsertionHandleObserver handleObserver) {
mHandleObserver = handleObserver;
}
private void initHandleObserver() {
mHandleObserver = ContentClassFactory.get().createHandleObserver(() -> {
if (sShouldGetReadbackViewFromWindowAndroid) {
return mWindowAndroid == null ? null : mWindowAndroid.getReadbackView();
} else {
return mView;
}
});
}
@CalledByNative
private void onSelectWordAroundCaretAck(boolean didSelect, int startAdjust, int endAdjust) {
if (mSelectionClient != null) {
mSelectionClient.selectWordAroundCaretAck(didSelect, startAdjust, endAdjust);
}
}
public void destroyActionModeAndUnselect() {
mUnselectAllOnDismiss = true;
finishActionMode();
}
public void destroyActionModeAndKeepSelection() {
mUnselectAllOnDismiss = false;
finishActionMode();
}
public void updateSelectionState(boolean editable, boolean isPassword) {
if (!editable) destroyPastePopup();
if (editable != isFocusedNodeEditable() || isPassword != isSelectionPassword()) {
mEditable = editable;
mIsPasswordType = isPassword;
if (isActionModeValid()) mActionMode.invalidate();
}
}
@Override
public boolean hasSelection() {
return mHasSelection;
}
@Override
public String getSelectedText() {
return mLastSelectedText;
}
private boolean isShareAvailable() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
return mContext.getPackageManager()
.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
.size()
> 0;
}
// The callback class that delivers the result from a SmartSelectionClient.
private class SmartSelectionCallback implements SelectionClient.ResultCallback {
@Override
public void onClassified(SelectionClient.Result result) {
// If the selection does not exist any more, discard |result|.
if (!hasSelection()) {
mClassificationResult = null;
return;
}
// Do not allow classifier to shorten the selection. If the suggested selection is
// smaller than the original we throw away classification result and show the menu.
// TODO(amaralp): This was added to fix the SelectAll problem in
// http://crbug.com/714106. Once we know the cause of the original selection we can
// remove this check.
if (result.startAdjust > 0 || result.endAdjust < 0) {
mClassificationResult = null;
showActionModeOrClearOnFailure();
return;
}
// The classificationresult is a property of the selection. Keep it even the action
// mode has been dismissed.
mClassificationResult = result;
// Update the selection range if needed.
if (!(result.startAdjust == 0 && result.endAdjust == 0)) {
// This call will cause showSelectionMenu again.
mWebContents.adjustSelectionByCharacterOffset(
result.startAdjust, result.endAdjust, /* showSelectionMenu = */ true);
return;
}
// We won't do expansion here, however, we want to 1) for starting a new logging
// session, log non selection expansion event to match the behavior of expansion case.
// 2) log selection handle dragging triggered selection change.
if (mSelectionMetricsLogger != null) {
mSelectionMetricsLogger.logSelectionModified(
mLastSelectedText, mLastSelectionOffset, mClassificationResult);
}
// Rely on this method to clear |mHidden| and unhide the action mode.
showActionModeOrClearOnFailure();
}
};
@Override
public void destroySelectActionMode() {
finishActionMode();
}
@Override
public boolean isSelectActionBarShowing() {
return isActionModeValid();
}
@Override
public ActionModeCallbackHelper getActionModeCallbackHelper() {
return this;
}
@Override
public void setTextClassifier(TextClassifier textClassifier) {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
SelectionClient client = getSelectionClient();
if (client != null) client.setTextClassifier(textClassifier);
}
@Override
public TextClassifier getTextClassifier() {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
SelectionClient client = getSelectionClient();
return client == null ? null : client.getTextClassifier();
}
@Override
public TextClassifier getCustomTextClassifier() {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
SelectionClient client = getSelectionClient();
return client == null ? null : client.getCustomTextClassifier();
}
private native long nativeInit(WebContents webContents);
private native void nativeSetTextHandlesTemporarilyHidden(
long nativeSelectionPopupController, boolean hidden);
}
| [
"[email protected]"
] | |
a8f1ec7423260f6a6d65820b1fb693cbdfc76f7e | 9099d250ba2a5f6295d834b0308f2002cb6555bb | /src/main/java/uk/gov/cshr/scanner/swagger/SwaggerUIController.java | 03e9a6817a742b4d500e33f9a2b5f1dc7f0f10ff | [
"MIT"
] | permissive | Civil-Service-Human-Resources/cshr-scanning-service | 0fdb121cfb232e14a74dce7c276e56fa59d8f72c | a96c6ff3cf75b3af1e35c97ebfccefdd63306bc7 | refs/heads/develop | 2020-03-22T20:08:10.751778 | 2018-09-18T10:48:24 | 2018-09-18T10:48:24 | 140,575,168 | 0 | 0 | MIT | 2018-09-05T15:05:49 | 2018-07-11T12:56:07 | Java | UTF-8 | Java | false | false | 998 | java | package uk.gov.cshr.scanner.swagger;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* This class is responsible for ensuring that the Swagger UI html page is only accessible when a specific profile is
* enabled on startup.
*/
@Profile("!dev")
@RestController
public class SwaggerUIController {
/**
* This method is responsible for preventing access to the swagger-ui.html page if a specific profile is not enabled.
*
* @param httpResponse the response to be returned
*/
@RequestMapping(value = "swagger-ui.html", method = RequestMethod.GET)
public void getSwagger(HttpServletResponse httpResponse) {
httpResponse.setStatus(HttpStatus.NOT_FOUND.value());
}
} | [
"[email protected]"
] | |
33624eb5e984087e5767ce21ebdf5f0702acb99d | d1a453c8803aeb19d10a579c962db45b8872d2a6 | /Tutorial6/src/Application.java | 2fbf01d5783a06868ce607eeb957ed090c1ceea6 | [] | no_license | rojjas90/java-tutorial-udm | b3e8daf9b308fba5ab7567e45ff3ae7e41902024 | 8a98dffc92b66f4e22e94b2049f46b4331146204 | refs/heads/master | 2020-07-21T21:02:28.652095 | 2016-12-06T23:54:28 | 2016-12-06T23:54:28 | 73,839,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java |
public class Application {
public static void main(String[] args) {
int value = 15;
if (value < 10)
System.out.println("Value is less than 10");
else if (value >= 10) {
System.out.println("Value is equal or higher than 10");
} else {
System.out.println("None of the above");
}
// using break inside while loop
int loop = 0;
while (true) {
System.out.println("Lopping " + loop);
if (loop == 5) {
break;
}
loop++;
}
}
}
| [
"[email protected]"
] | |
8dce64ebbd820dabb7979cbd55b2682c0e1de635 | 4653d3017360d8dabb2a3e35bb947f33871713a2 | /List_inArraySlots.java | 5830e49ac0b8dbd8690d89a45767c20e6bcee1cd | [] | no_license | AkashDas2002/57_List_inChainOfNodes | 67a9a9119666c748bd09d94f4097459bb11e19b4 | ac73dc566a0f5b0abe01df2fa72affb7961bacc1 | refs/heads/master | 2020-05-01T00:50:53.977362 | 2019-03-27T21:46:26 | 2019-03-27T21:46:26 | 177,179,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,333 | java | /**
Implement a list of integer elements, including
both data and operations.
ORIGINAL CODE FROM solutionsHolmes
*/
public class List_inArraySlots {
private int[] elements; // container for the elements of the list
private int filledElements; // the number of elements in this list
private static final int INITIAL_CAPACITY = 10;
/**
Construct an empty list with a small initial capacity.
*/
public List_inArraySlots() {
elements = new int[ INITIAL_CAPACITY];
// filledElements has been initialized to the desired value, 0
}
/**
@return the number of elements in this list
*/
public int size() {
return filledElements;
}
/**
@return a string representation of this list,
in [a,b,c,] format
*/
public String toString() {
String result = "[";
for( int elemIndex = 0; elemIndex < filledElements; elemIndex++)
result += elements[ elemIndex] + ",";
return result + "]";
}
/**
Appends @value to the end of this list.
@return true, in keeping with conventions yet to be discussed
*/
public boolean add( int value) {
// expand if necessary
if( filledElements == elements.length) expand();
elements[ filledElements] = value;
filledElements++;
// idiomatic version: elements[ filledElements++] = value;
return true;
}
/**
Double the capacity of the List_inArraySlots,
preserving existing data.
*/
private void expand() {
System.out.println( "expand... (for debugging)");
/* S.O.P. rules for debugging:
Working methods should be silent. But during
development, the programmer must verify that
this method is called when that is appropriate.
So test using the println(), then comment it out.
*/
int[] bigger = new int[ elements.length * 2];
for( int elemIndex = 0; elemIndex < filledElements; elemIndex++)
bigger[ elemIndex] = elements[ elemIndex];
elements = bigger;
}
// --------- end of "code that worked in v0" ---------
/**
accessor
@return element @index from this list
precondition: @index is within the bounds of the array.
(Having warned the user about this precondition,
you should NOT complicate your code to check
whether user violated the condition.)
*/
public int get( int index ) {
// E-Z! pass through the request to the array object
return elements[ index];
}
/**
Set value at @index to @newValue
@return old value at @index
@precondition: @index is within the bounds of this list.
*/
public int set( int index, int newValue ) {
int saveForReturn = get( index);
elements[ index] = newValue;
return saveForReturn;
}
/**
Insert @value at position @index in this list.
Shift the element currently at that position (if any)
and any subsequent elements to the right
(that is, increase the index associated with each).
*/
public void add( int index, int value) {
if( index == filledElements) // adding at end of list
add( value);
else {// need space
// open up space, expanding if necessary
add( elements[ filledElements-1]);
// move the hole left / shift "subsequent elements" right
for( int hole = filledElements-1; hole > index; hole--)
elements[ hole] = elements[ hole-1];
elements[ index] = value; // store new value
}
}
/**
Remove the element at position @index in this list.
Shift any subsequent elements to the left (that is,
decrease the index associated with each).
@return the value that was removed from the list
*/
public int remove( int index) {
int result = elements[ index]; // save for returning
for( int put = index; put < filledElements-1; put++)
elements[ put] = elements[ put+1];
filledElements--;
return result;
}
public boolean addAsHead(int val) {
add( 0, val);
return true;
}
}
| [
"[email protected]"
] | |
b32c034099ade616c1e0657fea4e3e297113dab4 | 47f2c2a8cbd9bc2b28c4254e77e5a7b099faaa1f | /record-builder-test/src/main/java/io/soabase/recordbuilder/test/Usage.java | f50c441096e92567431f0b71ddcbb829ae4bc5ae | [
"Apache-2.0"
] | permissive | thiago-amm/record-builder | 0378d2dff3b6a7d86cc2319b79c78b5afb187fe1 | 3b8c3ff9e3108e3c08a4bdbb9fe9d57442b97eed | refs/heads/master | 2023-08-31T04:35:43.124755 | 2021-10-20T04:24:38 | 2021-10-21T18:00:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,197 | java | /**
* Copyright 2019 Jordan Zimmerman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.soabase.recordbuilder.test;
public class Usage {
public static void main(String[] args) {
var hey = SimpleRecordBuilder.builder().i(10).s("hey").build();
System.out.println(hey);
var hey2 = SimpleRecordBuilder.builder(hey).i(100).build();
System.out.println(hey2);
var person = new PersonRecord("me", 42);
outputPerson(person);
var aged = PersonRecordBuilder.builder(person).age(100).build();
outputPerson(aged);
}
private static void outputPerson(Person p) {
System.out.println(p.toString());
}
}
| [
"[email protected]"
] | |
40710eb519b788e43ed83614d75971b5654caed4 | 2017ced58d0fe3b7c6f55d204c8baa26b35ad982 | /web-service/src/main/java/com/phengtola/configurations/securities/CustomAccessDeniedHandler.java | 98f01cf1703e06bbe51ecbf382d917078c846007 | [] | no_license | phengtola/Article-CRUD-Maven-Multi-Module-Project | 03f83faae3d29db004440e4c29ba52fd62d9f8e8 | 1d45514d3d7bae1af8c8bfa5f693df707601f98b | refs/heads/master | 2021-01-01T06:41:11.591604 | 2017-07-18T08:57:55 | 2017-07-18T08:57:55 | 97,484,261 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,234 | java | package com.phengtola.configurations.securities;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;
@Component("customAccesDeniedHandler")
public class CustomAccessDeniedHandler implements AccessDeniedHandler{
private static Logger logger = LoggerFactory.getLogger(CustomAccessDeniedHandler.class);
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedEx)
throws IOException, ServletException {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if(auth != null){
logger.info("Username: '" + auth.getName() + "' attempted to access the protected URL: '"+ request.getRequestURI() );
}
response.sendRedirect("/error/403");
}
}
| [
"[email protected]"
] | |
bf37fbc5a74234158d7146e6eeff459194526566 | b688e9cb8e2567e171c0cfe2c193203b701ae86f | /src/main/java/com/xinchuang/entity/PageVo.java | 8ec9d72301c0bbe456a78d468211ff26a062374b | [] | no_license | yinzt/test | 0e33813c32d4faac29c8b502bc49ed600dd97f22 | 9b5b24cacdc2a7161dc499cd8a3b9df610a45135 | refs/heads/master | 2023-05-14T18:32:35.388631 | 2023-04-28T02:14:20 | 2023-04-28T02:14:20 | 86,336,834 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package com.xinchuang.entity;
import lombok.Data;
/**
* @author gulian.chensr
*/
@Data
public class PageVo{
private int offset;
private int limit;
private String orderByColumn;
private String isAsc;
}
| [
"[email protected]"
] | |
d108a1e1eff9f7a626b7e3612529e706a0b15fd3 | 777d3cefdb05a29501583b649a416e61f28372ea | /WEB-INF/service/com/vietnamobile/model/QuestionEntryModel.java | 19123e6ba54e2b4f645c92cd41195227b5de2fac | [] | no_license | kiendt93/Iskool-TestOnline-docrootFolder | 712fdadec38158e9ed65f36fb30411be3f231bbc | 2726a39e114d1744ab8196dbb1a3b406a7f20f79 | refs/heads/master | 2021-01-20T09:16:55.028294 | 2017-05-04T07:13:22 | 2017-05-04T07:13:22 | 90,232,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,369 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.vietnamobile.model;
import com.liferay.portal.kernel.bean.AutoEscape;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.BaseModel;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.GroupedModel;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.expando.model.ExpandoBridge;
import java.io.Serializable;
import java.util.Date;
/**
* The base model interface for the QuestionEntry service. Represents a row in the "iskools_QuestionEntry" database table, with each column mapped to a property of this class.
*
* <p>
* This interface and its corresponding implementation {@link com.vietnamobile.model.impl.QuestionEntryModelImpl} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link com.vietnamobile.model.impl.QuestionEntryImpl}.
* </p>
*
* @author duymb
* @see QuestionEntry
* @see com.vietnamobile.model.impl.QuestionEntryImpl
* @see com.vietnamobile.model.impl.QuestionEntryModelImpl
* @generated
*/
public interface QuestionEntryModel extends BaseModel<QuestionEntry>,
GroupedModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this interface directly. All methods that expect a question entry model instance should use the {@link QuestionEntry} interface instead.
*/
/**
* Returns the primary key of this question entry.
*
* @return the primary key of this question entry
*/
public long getPrimaryKey();
/**
* Sets the primary key of this question entry.
*
* @param primaryKey the primary key of this question entry
*/
public void setPrimaryKey(long primaryKey);
/**
* Returns the question entry ID of this question entry.
*
* @return the question entry ID of this question entry
*/
public long getQuestionEntryId();
/**
* Sets the question entry ID of this question entry.
*
* @param questionEntryId the question entry ID of this question entry
*/
public void setQuestionEntryId(long questionEntryId);
/**
* Returns the group ID of this question entry.
*
* @return the group ID of this question entry
*/
@Override
public long getGroupId();
/**
* Sets the group ID of this question entry.
*
* @param groupId the group ID of this question entry
*/
@Override
public void setGroupId(long groupId);
/**
* Returns the company ID of this question entry.
*
* @return the company ID of this question entry
*/
@Override
public long getCompanyId();
/**
* Sets the company ID of this question entry.
*
* @param companyId the company ID of this question entry
*/
@Override
public void setCompanyId(long companyId);
/**
* Returns the user ID of this question entry.
*
* @return the user ID of this question entry
*/
@Override
public long getUserId();
/**
* Sets the user ID of this question entry.
*
* @param userId the user ID of this question entry
*/
@Override
public void setUserId(long userId);
/**
* Returns the user uuid of this question entry.
*
* @return the user uuid of this question entry
* @throws SystemException if a system exception occurred
*/
@Override
public String getUserUuid() throws SystemException;
/**
* Sets the user uuid of this question entry.
*
* @param userUuid the user uuid of this question entry
*/
@Override
public void setUserUuid(String userUuid);
/**
* Returns the user name of this question entry.
*
* @return the user name of this question entry
*/
@AutoEscape
@Override
public String getUserName();
/**
* Sets the user name of this question entry.
*
* @param userName the user name of this question entry
*/
@Override
public void setUserName(String userName);
/**
* Returns the create date of this question entry.
*
* @return the create date of this question entry
*/
@Override
public Date getCreateDate();
/**
* Sets the create date of this question entry.
*
* @param createDate the create date of this question entry
*/
@Override
public void setCreateDate(Date createDate);
/**
* Returns the modified date of this question entry.
*
* @return the modified date of this question entry
*/
@Override
public Date getModifiedDate();
/**
* Sets the modified date of this question entry.
*
* @param modifiedDate the modified date of this question entry
*/
@Override
public void setModifiedDate(Date modifiedDate);
/**
* Returns the subject of this question entry.
*
* @return the subject of this question entry
*/
@AutoEscape
public String getSubject();
/**
* Sets the subject of this question entry.
*
* @param subject the subject of this question entry
*/
public void setSubject(String subject);
/**
* Returns the level question of this question entry.
*
* @return the level question of this question entry
*/
public int getLevelQuestion();
/**
* Sets the level question of this question entry.
*
* @param levelQuestion the level question of this question entry
*/
public void setLevelQuestion(int levelQuestion);
/**
* Returns the answer of this question entry.
*
* @return the answer of this question entry
*/
@AutoEscape
public String getAnswer();
/**
* Sets the answer of this question entry.
*
* @param answer the answer of this question entry
*/
public void setAnswer(String answer);
/**
* Returns the score of this question entry.
*
* @return the score of this question entry
*/
public double getScore();
/**
* Sets the score of this question entry.
*
* @param score the score of this question entry
*/
public void setScore(double score);
/**
* Returns the question content of this question entry.
*
* @return the question content of this question entry
*/
@AutoEscape
public String getQuestionContent();
/**
* Sets the question content of this question entry.
*
* @param questionContent the question content of this question entry
*/
public void setQuestionContent(String questionContent);
/**
* Returns the a of this question entry.
*
* @return the a of this question entry
*/
@AutoEscape
public String getA();
/**
* Sets the a of this question entry.
*
* @param a the a of this question entry
*/
public void setA(String a);
/**
* Returns the b of this question entry.
*
* @return the b of this question entry
*/
@AutoEscape
public String getB();
/**
* Sets the b of this question entry.
*
* @param b the b of this question entry
*/
public void setB(String b);
/**
* Returns the c of this question entry.
*
* @return the c of this question entry
*/
@AutoEscape
public String getC();
/**
* Sets the c of this question entry.
*
* @param c the c of this question entry
*/
public void setC(String c);
/**
* Returns the d of this question entry.
*
* @return the d of this question entry
*/
@AutoEscape
public String getD();
/**
* Sets the d of this question entry.
*
* @param d the d of this question entry
*/
public void setD(String d);
/**
* Returns the title of this question entry.
*
* @return the title of this question entry
*/
@AutoEscape
public String getTitle();
/**
* Sets the title of this question entry.
*
* @param title the title of this question entry
*/
public void setTitle(String title);
/**
* Returns the selection1 of this question entry.
*
* @return the selection1 of this question entry
*/
@AutoEscape
public String getSelection1();
/**
* Sets the selection1 of this question entry.
*
* @param selection1 the selection1 of this question entry
*/
public void setSelection1(String selection1);
/**
* Returns the selection2 of this question entry.
*
* @return the selection2 of this question entry
*/
@AutoEscape
public String getSelection2();
/**
* Sets the selection2 of this question entry.
*
* @param selection2 the selection2 of this question entry
*/
public void setSelection2(String selection2);
/**
* Returns the selection3 of this question entry.
*
* @return the selection3 of this question entry
*/
@AutoEscape
public String getSelection3();
/**
* Sets the selection3 of this question entry.
*
* @param selection3 the selection3 of this question entry
*/
public void setSelection3(String selection3);
/**
* Returns the selection4 of this question entry.
*
* @return the selection4 of this question entry
*/
@AutoEscape
public String getSelection4();
/**
* Sets the selection4 of this question entry.
*
* @param selection4 the selection4 of this question entry
*/
public void setSelection4(String selection4);
/**
* Returns the type exam of this question entry.
*
* @return the type exam of this question entry
*/
@AutoEscape
public String getTypeExam();
/**
* Sets the type exam of this question entry.
*
* @param typeExam the type exam of this question entry
*/
public void setTypeExam(String typeExam);
/**
* Returns the in exam of this question entry.
*
* @return the in exam of this question entry
*/
public int getInExam();
/**
* Sets the in exam of this question entry.
*
* @param inExam the in exam of this question entry
*/
public void setInExam(int inExam);
/**
* Returns the status of this question entry.
*
* @return the status of this question entry
*/
public int getStatus();
/**
* Sets the status of this question entry.
*
* @param status the status of this question entry
*/
public void setStatus(int status);
@Override
public boolean isNew();
@Override
public void setNew(boolean n);
@Override
public boolean isCachedModel();
@Override
public void setCachedModel(boolean cachedModel);
@Override
public boolean isEscapedModel();
@Override
public Serializable getPrimaryKeyObj();
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj);
@Override
public ExpandoBridge getExpandoBridge();
@Override
public void setExpandoBridgeAttributes(BaseModel<?> baseModel);
@Override
public void setExpandoBridgeAttributes(ExpandoBridge expandoBridge);
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext);
@Override
public Object clone();
@Override
public int compareTo(com.vietnamobile.model.QuestionEntry questionEntry);
@Override
public int hashCode();
@Override
public CacheModel<com.vietnamobile.model.QuestionEntry> toCacheModel();
@Override
public com.vietnamobile.model.QuestionEntry toEscapedModel();
@Override
public com.vietnamobile.model.QuestionEntry toUnescapedModel();
@Override
public String toString();
@Override
public String toXmlString();
} | [
"[email protected]"
] | |
4e076c97cdf16f77716b989a4dbb9a269a2b4fa7 | fda8201bc53d80e291255f2fa26833460c9e714a | /src/main/java/com/jiadong/aspect/LogAspect.java | 711c55b8f3116ead3507025c2ae030393ec31b85 | [] | no_license | JohnMai1994/Blog_Manage_System | 425ad0ef239a2ebd5767c8a92837edf452c1d98b | 8464d62d112fd143ba97cb24585148a71d0b7351 | refs/heads/master | 2022-12-15T07:00:40.831778 | 2020-09-11T05:11:01 | 2020-09-11T05:11:01 | 294,601,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,398 | java | package com.jiadong.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
@Aspect
@Component
public class LogAspect {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Pointcut("execution(* com.jiadong.web.*.*(..))")
public void log() {
}
@Before("log()")
public void doBefore(JoinPoint joinPoint){
logger.info("===============doBefore===================");
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
String url = request.getRequestURL().toString();
String ip = request.getRemoteAddr();
String classMethod = joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName();
Object[] args = joinPoint.getArgs();
RequestLog requestLog = new RequestLog(url, ip,classMethod,args);
logger.info("Request: {}",requestLog);
}
@AfterReturning(returning = "result", pointcut = "log()")
public void doAfterRuturn(Object result) {
logger.info("===============doAfterRuturn===================");
logger.info("Result: {}",result);
}
@After("log()")
public void doAfter(){
// logger.info("===============doAfter===================");
}
private class RequestLog{
private String url;
private String ip;
private String classMethod;
private Object[] args;
public RequestLog(String url, String ip, String classMethod, Object[] args) {
this.url = url;
this.ip = ip;
this.classMethod = classMethod;
this.args = args;
}
@Override
public String toString() {
return "{" +
"url='" + url + '\'' +
", ip='" + ip + '\'' +
", classMethod='" + classMethod + '\'' +
", args=" + Arrays.toString(args) +
'}';
}
}
}
| [
"[email protected]"
] | |
b5508d63e72a4404e2912b3ce39399cbe779178b | 4b7f865c9262ec3f15796b16ce1b5c92d72d42c5 | /ALVIN ANUGRAH ARRAFI_4C_18090121/Aplikasi.java | 6c62bc669ff70c7894871773dbfa74e4bd462ca5 | [] | no_license | alvinanugrah1922/UTS-OOP | e7e562466f70b562fbe748bcbdf719b49ca194cc | 487192c5d7da50551e22a43811076340d5aafcd3 | refs/heads/master | 2022-04-22T04:36:43.381416 | 2020-04-22T08:55:56 | 2020-04-22T08:55:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,505 | java | package uts;
import java.util.Scanner;
import java.util.Vector;
import java.util.*;
public class Aplikasi {
Scanner scan = new Scanner(System.in);
Vector<Mahasiswa> vecMahasiswa = new Vector<Mahasiswa>();
int menu, nim;
String nama, kelas;
Mahasiswa m;
public Aplikasi() {
do {
System.out.println("Merekam Data Mahasiswa");
System.out.println("================");
System.out.println("1. Tambah Mahasiswa");
System.out.println("2. Hapus Mahasiswa");
System.out.println("3. Tampilkan Mahasiswa");
System.out.println("4. Ubah Mahasiswa");
System.out.println("5. Exit");
System.out.print("Pilih >> ");
menu = scan.nextInt();
scan.nextLine();
if (menu == 1) {
System.out.print("Masukan nim [8 Angka] : ");
nim = scan.nextInt();
scan.nextLine();
do {
System.out.print("Masukan nama [3 - 50 huruf] : ");
nama = scan.nextLine();
} while (nama.length() < 3 || nama.length() > 50);
do {
System.out.print("Pilih kelas [Kelas A|Kelas B|Kelas C|Kelas D] : ");
kelas = scan.nextLine();
} while (!kelas.equals("Kelas A") && !kelas.equals("Kelas B") && !kelas.equals("Kelas C")
&& !kelas.equals("Kelas D"));
// id = "" + Math.abs(rand.nextInt() % 10) + Math.abs(rand.nextInt() % 10) +
// Math.abs(rand.nextInt() % 10);
m = new Mahasiswa(nim, nama, kelas);
vecMahasiswa.add(m);
} else if (menu == 2) {
viewMahasiswa();
int index = 0, flag = 0;
System.out.print("Masukan nama untuk menghapus : ");
nama = scan.nextLine();
for (Mahasiswa mahasiswa : vecMahasiswa) {
if (mahasiswa.getNama().equals(nama)) {
flag = 1;
vecMahasiswa.remove(index);
break;
}
index++;
}
if (flag == 0) {
System.out.println("Data mahasiswa tidak ada!");
System.out.println("Press enter to continue");
scan.nextLine();
}
} else if (menu == 3) {
if (vecMahasiswa.size() == 0) {
System.out.println("Data mahasiswa tidak ada!");
System.out.println("Press enter to continue");
scan.nextLine();
} else {
viewMahasiswa();
}
} else if (menu == 4) {
}
} while (menu != 5);
}
private void viewMahasiswa() {
System.out.println("Mahasiswa List");
System.out.println("===========");
for (Mahasiswa m : vecMahasiswa) {
System.out.println(m.getNim() + " " + m.getNama() + " " + m.getKelas());
}
System.out.println("===========");
}
public static void main(String[] args) {
new Aplikasi();
}
}
| [
"[email protected]"
] | |
c3bae40ec4f2143d742cb97ee59063bfa6d6ec47 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/com/huawei/hwsqlite/SQLiteDatabaseConfiguration.java | c63e5a70e74da012f35de048bd063499f0e7ce74 | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,100 | java | package com.huawei.hwsqlite;
import java.util.ArrayList;
import java.util.Locale;
import java.util.regex.Pattern;
public final class SQLiteDatabaseConfiguration {
private static final Pattern EMAIL_IN_DB_PATTERN = Pattern.compile("[\\w\\.\\-]+@[\\w\\.\\-]+");
public static final String MEMORY_DB_PATH = ":memory:";
public final ArrayList<SQLiteAttached> attachedAlias = new ArrayList<>();
public final ArrayList<SQLiteCustomFunction> customFunctions = new ArrayList<>();
public SQLiteEncryptKeyLoader encryptKeyLoader = null;
public boolean foreignKeyConstraintsEnabled;
public final String label;
public Locale locale;
public int maxConnectionCount;
public int maxSqlCacheSize;
public int openFlags;
public final String path;
public SQLiteDatabaseConfiguration(String path2, int openFlags2) {
if (path2 != null) {
this.path = path2;
this.label = stripPathForLogs(path2);
this.openFlags = openFlags2;
this.maxSqlCacheSize = 25;
this.maxConnectionCount = 0;
this.locale = Locale.getDefault();
return;
}
throw new IllegalArgumentException("path must not be null.");
}
public SQLiteDatabaseConfiguration(SQLiteDatabaseConfiguration other) {
if (other != null) {
this.path = other.path;
this.label = other.label;
updateParametersFrom(other);
return;
}
throw new IllegalArgumentException("other must not be null.");
}
public void updateParametersFrom(SQLiteDatabaseConfiguration other) {
if (other == null) {
throw new IllegalArgumentException("other must not be null.");
} else if (this.path.equals(other.path)) {
this.openFlags = other.openFlags;
this.maxSqlCacheSize = other.maxSqlCacheSize;
this.maxConnectionCount = other.maxConnectionCount;
this.locale = other.locale;
this.foreignKeyConstraintsEnabled = other.foreignKeyConstraintsEnabled;
this.customFunctions.clear();
this.customFunctions.addAll(other.customFunctions);
this.encryptKeyLoader = other.encryptKeyLoader;
this.attachedAlias.clear();
this.attachedAlias.addAll(other.attachedAlias);
} else {
throw new IllegalArgumentException("other configuration must refer to the same database.");
}
}
public boolean isInMemoryDb() {
return this.path.equalsIgnoreCase(MEMORY_DB_PATH);
}
public byte[] getEncryptKey() {
if (this.encryptKeyLoader == null) {
return new byte[0];
}
return this.encryptKeyLoader.getEncryptKey();
}
public void updateEncryptKeyLoader(SQLiteEncryptKeyLoader newLoader) {
this.encryptKeyLoader = newLoader;
}
public boolean addAttachAlias(SQLiteAttached attached) {
if (isAttachAliasExists(attached.alias)) {
return false;
}
this.attachedAlias.add(attached);
return true;
}
public boolean removeAttachAlias(String alias) {
SQLiteAttached attached = findAttachedAlias(alias);
if (attached == null) {
return false;
}
this.attachedAlias.remove(attached);
return true;
}
public boolean isAttachAliasExists(String alias) {
return findAttachedAlias(alias) != null;
}
private static String stripPathForLogs(String path2) {
if (path2.indexOf(64) == -1) {
return path2;
}
return EMAIL_IN_DB_PATTERN.matcher(path2).replaceAll("XX@YY");
}
private SQLiteAttached findAttachedAlias(String alias) {
if (alias != null) {
int length = this.attachedAlias.size();
for (int i = 0; i < length; i++) {
SQLiteAttached orig = this.attachedAlias.get(i);
if (alias.equals(orig.alias)) {
return orig;
}
}
}
return null;
}
}
| [
"[email protected]"
] | |
1f902168466bcc2cb6c51023981ca3dbaa5ed1d0 | 84b38ea2f96a9d9b7d6142a73fbf0b03db41a4a6 | /src/main/java/com/athena/chameleon/engine/entity/xml/application/jeus/v5_0/JaxrSourceType.java | d48ffe9a54285358e454c0871349d370ccb5266e | [
"Apache-2.0"
] | permissive | OpenSourceConsulting/playce-chameleon | 06916eae62ba0bdf3088c5364544ae1f6acbe69b | 356a75674495d2946aaf2c2b40f78ecf388fefd0 | refs/heads/master | 2022-12-04T10:06:02.135611 | 2020-08-11T04:27:17 | 2020-08-11T04:27:17 | 5,478,313 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,356 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0-b52-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.09.17 at 02:39:44 오후 KST
//
package com.athena.chameleon.engine.entity.xml.application.jeus.v5_0;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for jaxr-sourceType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="jaxr-sourceType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="jaxr-entry" type="{http://www.tmaxsoft.com/xml/ns/jeus}jaxr-entryType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "jaxr-sourceType", propOrder = {
"jaxrEntry"
})
public class JaxrSourceType {
@XmlElement(name = "jaxr-entry", namespace = "http://www.tmaxsoft.com/xml/ns/jeus", required = true)
protected List<JaxrEntryType> jaxrEntry;
/**
* Gets the value of the jaxrEntry property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the jaxrEntry property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getJaxrEntry().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JaxrEntryType }
*
*
*/
public List<JaxrEntryType> getJaxrEntry() {
if (jaxrEntry == null) {
jaxrEntry = new ArrayList<JaxrEntryType>();
}
return this.jaxrEntry;
}
}
| [
"[email protected]"
] | |
af31e0b2722aecbbbb4c6baa98ebfaf466340b0b | 236cbe74934120bed1153dd7a9347c1e74583fc1 | /gulimall-order/src/main/java/com/xiaochen/gulimall/order/dao/OrderReturnApplyDao.java | f0c75fdd4179d8a466b4a2b59a2be4dd43bc6a75 | [
"Apache-2.0"
] | permissive | 591343/gulimall | 4c2907b6056e76a69852b053e64c1eab1f232a58 | ff8de8e83396ddf80971f5741e69205ce3864b45 | refs/heads/main | 2023-08-22T22:10:37.316636 | 2021-10-18T08:29:37 | 2021-10-18T08:29:37 | 387,088,659 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package com.xiaochen.gulimall.order.dao;
import com.xiaochen.gulimall.order.entity.OrderReturnApplyEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ?????˻????
*
* @author chenxiao
* @email [email protected]
* @date 2021-07-21 14:14:13
*/
@Mapper
public interface OrderReturnApplyDao extends BaseMapper<OrderReturnApplyEntity> {
}
| [
"[email protected]"
] | |
f78fbe9de7733a64fc1d71a7b9cda584774d9012 | 9bfe2e513faec9d12123e49f9bb400bf8885a76d | /src/controller/GameServlet.java | 63dba1379204c4993a348b6a742875cc637d66e6 | [] | no_license | Shivam-Coding/Gamester | d20a4e28d2ac6c6834d4f1b8c2921188482d30eb | a856c8dd2f33c46223da74c8fd3179b4c1529d1f | refs/heads/master | 2020-03-20T23:03:25.301734 | 2018-06-19T01:53:18 | 2018-06-19T01:53:18 | 137,826,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package controller;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import DAO.Games;
/**
* Servlet implementation class GameServlet
*/
public class GameServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public GameServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Games games = new Games();
try {
ArrayList<String[]> list = games.gamesData("10","name");
request.setAttribute("data", list);
request.getRequestDispatcher("games.jsp").forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
e010bbbfcb0f29a65ca95e3fa1b4b18e6a50663f | dd97e9705b1b02ae91623b8f38cc15efbe046c3f | /src/main/java/com/xishan/store/base/annoation/ResponseJsonFormat.java | cb7feff97f576265c08f836600bbaf9b72d7d75d | [] | no_license | 404008945/base-common | 937ae6ae5d5bc37a90371dffef09c5cf9fb342d7 | 888a7a7d004b3de84a32fc5329c0ea1d62bedbfe | refs/heads/master | 2023-01-20T21:43:17.613563 | 2021-01-21T12:15:29 | 2021-01-21T12:15:29 | 314,751,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.xishan.store.base.annoation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 表示需要把返回结果包装为Response
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ResponseJsonFormat {
}
| [
"[email protected]"
] | |
e07bd26985b6f97cd2f4cccc7838fa594a4da86d | e0e426e5d38b1937d9f3ba8628bccd9cdbdc42fd | /src/main/java/org/lanternpowered/function/CharToFloatFunction.java | 06cce039319ef045fc2ff6c682ed225d7c0c9023 | [
"MIT"
] | permissive | LanternPowered/PrimitiveFunctions | 7d1c22f1075b843a335e0aa862040844af85e079 | 32a00d3ef63325634ecad67ceb80942a4e9a52dc | refs/heads/master | 2021-01-20T06:11:55.557644 | 2017-05-03T11:37:01 | 2017-05-03T11:37:01 | 89,850,857 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,534 | java | /*
* This file is part of PrimitiveFunctions, licensed under the MIT License (MIT).
*
* Copyright (c) LanternPowered <https://github.com/LanternPowered>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the Software), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, andor sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.lanternpowered.function;
import static java.util.Objects.requireNonNull;
import java.util.function.Function;
@FunctionalInterface
public interface CharToFloatFunction extends Function<Character, Float> {
/**
* Gets a casted {@link CharToFloatFunction}.
*
* @return The char to float function
*/
static CharToFloatFunction cast() {
return v -> (float) v;
}
/**
* Converts the given {@link Function<Character, Float>} into
* a {@link CharToFloatFunction}.
*
* @param function The function
* @return The char to float function
*/
static CharToFloatFunction of(Function<Character, Float> function) {
requireNonNull(function, "function");
return function instanceof CharToFloatFunction ? (CharToFloatFunction) function : function::apply;
}
/**
* Applies this function to the given argument.
*
* @param value The value
* @return The function result
*/
float applyAsFloat(char value);
/**
* Applies this function to the given argument.
*
* @param value The value
* @return The function result
*/
@Override
default Float apply(Character value) {
return applyAsFloat(value);
}
}
| [
"[email protected]"
] | |
d131ed49c257a33b87d29c7bbe416060fdd013c0 | c1cf9451a27741c09981e14dc2dbe6ffbd0a2e58 | /src/cn/qziedu/wzb/po/ArticleExample.java | e9ee65c837fa6d73b9fbac85a5a28c4f9eb61e95 | [] | no_license | omgyyx/CangKu | 05e8fd4dd1286188f55ba319a54fbf473f64e816 | feacbdee2cb96ef85e2c3c0a86973771598cfe58 | refs/heads/master | 2023-01-22T15:28:54.922352 | 2020-12-01T07:43:30 | 2020-12-01T07:43:30 | 317,453,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,582 | java | package cn.qziedu.wzb.po;
import java.util.ArrayList;
import java.util.List;
public class ArticleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ArticleExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andCatIdIsNull() {
addCriterion("cat_id is null");
return (Criteria) this;
}
public Criteria andCatIdIsNotNull() {
addCriterion("cat_id is not null");
return (Criteria) this;
}
public Criteria andCatIdEqualTo(Integer value) {
addCriterion("cat_id =", value, "catId");
return (Criteria) this;
}
public Criteria andCatIdNotEqualTo(Integer value) {
addCriterion("cat_id <>", value, "catId");
return (Criteria) this;
}
public Criteria andCatIdGreaterThan(Integer value) {
addCriterion("cat_id >", value, "catId");
return (Criteria) this;
}
public Criteria andCatIdGreaterThanOrEqualTo(Integer value) {
addCriterion("cat_id >=", value, "catId");
return (Criteria) this;
}
public Criteria andCatIdLessThan(Integer value) {
addCriterion("cat_id <", value, "catId");
return (Criteria) this;
}
public Criteria andCatIdLessThanOrEqualTo(Integer value) {
addCriterion("cat_id <=", value, "catId");
return (Criteria) this;
}
public Criteria andCatIdIn(List<Integer> values) {
addCriterion("cat_id in", values, "catId");
return (Criteria) this;
}
public Criteria andCatIdNotIn(List<Integer> values) {
addCriterion("cat_id not in", values, "catId");
return (Criteria) this;
}
public Criteria andCatIdBetween(Integer value1, Integer value2) {
addCriterion("cat_id between", value1, value2, "catId");
return (Criteria) this;
}
public Criteria andCatIdNotBetween(Integer value1, Integer value2) {
addCriterion("cat_id not between", value1, value2, "catId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
c484e838a05141c044a8a27dcb04ec2754a031ef | f867ef9b0388c4022a0eabdb35a0ee732d7849b0 | /src/main/java/xyz/mrdeveloper/playgirl/MusicRetriever.java | 3712f8b6ba9d6a064e68108bbfa8349194106f5e | [] | no_license | citizenTwo/MusicPlayer | 2196992dbd1322511415272cd3ac3ee9dbe20a99 | 12f9e9fcc3544a496ee0923bfe56d0ce1bc08ede | refs/heads/master | 2021-10-09T02:24:59.849039 | 2018-03-03T17:35:05 | 2018-03-03T17:35:05 | 100,494,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,182 | java | package xyz.mrdeveloper.playgirl;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Lakshay Raj on 15-04-2017.
*/
public class MusicRetriever {
ContentResolver contentResolver;
Context context;
HashMap<Long, Integer> albumListDirectory;
ArrayList<Song> songList;
ArrayList<Album> albumList;
public MusicRetriever(ContentResolver contentResolver, Context context) {
this.context = context;
this.contentResolver = contentResolver;
songList = new ArrayList<>();
albumList = new ArrayList<>();
albumListDirectory = new HashMap<>();
}
public void GenerateList() {
ContentResolver musicResolver = contentResolver;
Uri musicUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
Cursor musicCursor = musicResolver.query(musicUri, null, null, null, null);
if (musicCursor != null && musicCursor.moveToFirst()) {
int titleColumn = musicCursor.getColumnIndex(MediaStore.Audio.Media.TITLE);
int idColumn = musicCursor.getColumnIndex(MediaStore.Audio.Media._ID);
int artistColumn = musicCursor.getColumnIndex(MediaStore.Audio.Media.ARTIST);
int pathColumn = musicCursor.getColumnIndex(MediaStore.Audio.Media.DATA);
int albumColumn = musicCursor.getColumnIndex(MediaStore.Audio.Media.ALBUM);
int albumidColumn = musicCursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID);
do {
long thisId = musicCursor.getLong(idColumn);
String thisTitle = musicCursor.getString(titleColumn);
String thisArtist = musicCursor.getString(artistColumn);
String thisPath = musicCursor.getString(pathColumn);
String thisAlbum = musicCursor.getString(albumColumn);
long thisAlbumID = musicCursor.getLong(albumidColumn);
songList.add(new Song(thisId, thisTitle, thisArtist, thisPath, context));
if (albumListDirectory.containsKey(thisAlbumID)) {
Album album = albumList.get(albumListDirectory.get(thisAlbumID));
album.AddSong(new Song(thisId, thisTitle, thisArtist, thisPath, context));
} else {
Album album = new Album(thisAlbum, thisArtist, thisPath);
album.AddSong(new Song(thisId, thisTitle, thisArtist, thisPath, context));
albumList.add(album);
albumListDirectory.put(thisAlbumID, albumList.size() - 1);
}
}
while (musicCursor.moveToNext());
} else {
Log.d("Check", "The musicCursor is null or not able to move to first");
}
}
public ArrayList<Album> getAlbumList() {
return albumList;
}
public ArrayList<Song> getSongList() {
return songList;
}
}
| [
"[email protected]"
] | |
845825190f57640969d49b65e9654a07fc98452f | 619be8454898103596cbba9f853af5d034097992 | /2.JavaCore/src/com/javarush/task/task20/task2010/Solution.java | e2853f3d604a5da369dc5f18309c1c6eadfdd0a8 | [] | no_license | AndryMaxy/JavaRush | 4dae8d9dca41fbcaf4cce91e0afbbed0f378f6ea | da981660731de4804de0ed4486fc9561c22111ca | refs/heads/master | 2020-04-01T05:32:25.159398 | 2018-10-13T20:27:35 | 2018-10-13T20:27:35 | 152,908,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 681 | java | package com.javarush.task.task20.task2010;
import java.io.Serializable;
/*
Как сериализовать что-то свое?
*/
public class Solution {
public static class Object implements Serializable {
public String string1;
public String string2;
}
public static int countStrings;
public static class String implements Serializable{
private final int number;
public String() {
number = ++countStrings;
}
public void print() {
System.out.println("string #" + number);
}
}
public static void main(java.lang.String[] args) {
new String().print();
}
}
| [
"[email protected]"
] | |
0925aa3bee208292f90cb401539b13eb63f15557 | b2cfb2fd68e3f771c10b12864058b973f3e46a25 | /src/com/dway/twalay/PlayerScreen.java | 9eba4538d2023fb24a83f9264b844e93654d13a3 | [] | no_license | lekanbar/twalay | 3c461c53c96d06748c1ea400182814a3c2bc98b3 | c3a8a3071a72fbb9e3c9ccca1a4619a30ad5fe31 | refs/heads/master | 2021-01-23T09:28:40.335595 | 2015-04-22T12:11:15 | 2015-04-22T12:11:15 | 34,387,518 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,148 | java | package com.dway.twalay;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.media.PlayerListener;
import javax.microedition.media.control.VolumeControl;
import com.twitterapime.rest.UserAccountManager;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.system.KeyListener;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.DrawStyle;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.Screen;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.decor.BackgroundFactory;
import rimx.media.streaming.StreamingPlayer;
import rimx.media.streaming.StreamingPlayerListener;
public class PlayerScreen extends MainScreen implements StreamingPlayerListener, KeyListener, TimeLineFieldListener {
private StreamingPlayer sp;
private VolumeControl volC;
private PlayerScreen playerScreen;
private long lastBufferUpdate = System.currentTimeMillis();
private String url="";
private String contentType = "audio/mpeg";
private int bitRate = 128000;
private int initBuffer = (bitRate/8)*5;
private int restartThreshold = (bitRate/8)*3;
private int bufferCapacity = 4194304;
private int bufferLeakSize = bufferCapacity/3;
private int connectionTimeout = 6000;
private boolean eventLogEnabled = false;
private boolean sdLogEnabled = false;
private int logLevel = 0;
UserAccountManager m;
private AlbumArtField albumArt;
private Field videoField;
private TimeLineField timeSeeker;
private TimeLineField byteSeeker;
private long bufferStartsAt = 0;
private long len = 0;
private String status = "Welcome! Click play to start streaming";
private long nowPlaying = 0;
private long nowReading = 0;
public PlayerScreen(final UserAccountManager m, String url){
super(Screen.NO_HORIZONTAL_SCROLL|Screen.NO_VERTICAL_SCROLL);
this.playerScreen = this;
this.url = url;
this.m = m;
timeSeeker = new TimeLineField(Display.getWidth(), 40, 3);
timeSeeker.setBufferVisible(false);
timeSeeker.addTimeLineFieldListener(this);
byteSeeker = new TimeLineField(Display.getWidth(), 40, 16000);
byteSeeker.addTimeLineFieldListener(this);
byteSeeker.setFocusable(false);
albumArt = new AlbumArtField(Bitmap.getBitmapResource("icon.png"), "");
add(albumArt);
//add(timeSeeker);
add(byteSeeker);
HorizontalFieldManager hfm = new HorizontalFieldManager(Field.FIELD_HCENTER);
hfm.setBackground(BackgroundFactory.createSolidBackground(Color.BLACK));
ButtonField btnPlay = new ButtonField("Play");
btnPlay.setChangeListener(new FieldChangeListener(){
public void fieldChanged(Field field, int context) {
play();
}
});
hfm.add(btnPlay);
ButtonField btnPause = new ButtonField("Pause");
btnPause.setChangeListener(new FieldChangeListener(){
public void fieldChanged(Field field, int context) {
pause();
}
});
hfm.add(btnPause);
ButtonField btnStop = new ButtonField("Stop");
btnStop.setChangeListener(new FieldChangeListener(){
public void fieldChanged(Field field, int context) {
stop();
}
});
hfm.add(btnStop);
add(hfm);
MenuItem mi1 = new MenuItem("Play", 1, 1) {
public void run() {
play();
}
};
MenuItem mi2 = new MenuItem("Pause", 1, 2) {
public void run() {
pause();
}
};
MenuItem mi3 = new MenuItem("Resume", 1, 3) {
public void run() {
resume();
}
};
MenuItem mi4 = new MenuItem("Stop", 1, 4) {
public void run() {
stop();
}
};
addMenuItem(mi1);
addMenuItem(mi2);
addMenuItem(mi3);
addMenuItem(mi4);
addMenuItem(MenuItem.separator(5));
}
public void play(){
new Thread(){
public void run(){
try{
if(sp==null){
sp = new StreamingPlayer(url, contentType);
sp.setBufferCapacity(bufferCapacity);
sp.setInitialBuffer(initBuffer);
sp.setRestartThreshold(restartThreshold);
sp.setBufferLeakSize(bufferLeakSize);
sp.setConnectionTimeout(connectionTimeout);
sp.setLogLevel(logLevel);
sp.enableLogging(eventLogEnabled, sdLogEnabled);
sp.addStreamingPlayerListener(playerScreen);
sp.realize();
volC = (VolumeControl)sp.getControl("VolumeControl");
if(contentType.toLowerCase().indexOf("audio")!=-1){
if(!(getField(0)==albumArt)){
UiApplication.getUiApplication().invokeLater(new Runnable(){
public void run(){
replace(videoField, (Field)albumArt);
}
});
}
}
sp.start();
} else{
sp.stop();
sp.close();
sp = null;
run();
}
} catch(Throwable t){
//log(t.toString());
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
synchronized (UiApplication.getEventLock()) {
Dialog.alert("No internet connection :(, or the vTweet doesn't exist, check and please try again.");
//System.exit(0);
close();
}
}
});
}
}
}.start();
}
/*class HomeMenuItem extends MenuItem {
public HomeMenuItem() {
super("Home", 10, 10);
}
public void run() {
TwalayHome.getUiApplication().pushScreen(new Home(m));
close();
}
}*/
public void seek(final long position){
new Thread(){
public void run(){
try{
sp.setMediaTime(position*1000000);
} catch(MediaException me){
}
}
}.start();
}
public void pause(){
try{
if(sp!=null){
sp.stop();
}
} catch(Throwable t){
}
}
public void resume(){
try{
if(sp!=null){
if(sp.getState()!=Player.STARTED){
sp.start();
}
}
} catch(Throwable t){
}
}
public void stop(){
try{
if(sp!=null){
sp.close();
timeSeeker.setBuffered(0, 0);
timeSeeker.setLength(0);
timeSeeker.setNow(0);
byteSeeker.setBuffered(0, 0);
byteSeeker.setLength(0);
byteSeeker.setNow(0);
byteSeeker.setStatus("Closed.");
timeSeeker.update();
byteSeeker.update();
}
} catch(Throwable t){
//log(t.toString());
}
}
public void setMediaTitle(String titleText){
albumArt.setMediaTitle(titleText);
}
public void setVideoField(Field vField){
replace(getField(0), vField);
}
public int getVideoAreaHeight(){
return albumArt.getHeight();
}
public int getVideoAreaWidth(){
return albumArt.getWidth();
}
protected void paintBackground(Graphics graphics) {
super.paintBackground(graphics);
graphics.setColor(Color.BLACK);
graphics.fillRect(0, 0, getWidth(), getHeight());
}
/** StreamingPlayerListener Implementation */
public void bufferStatusChanged(long bufferStartsAt, long len) {
this.bufferStartsAt = bufferStartsAt;
this.len = len;
boolean update = (System.currentTimeMillis()-lastBufferUpdate)>25;
if(!update)
return;
lastBufferUpdate = System.currentTimeMillis();
timeSeeker.setBuffered(bufferStartsAt, len);
timeSeeker.setNow(nowPlaying);
byteSeeker.setBuffered(bufferStartsAt, len);
byteSeeker.setNow(nowReading);
byteSeeker.setStatus(this.status);
timeSeeker.update();
byteSeeker.update();
}
public void downloadStatusUpdated(final long totalDownloaded) {
}
public void feedPaused(final long available) {
this.status = "Buffering..";
boolean update = (System.currentTimeMillis()-lastBufferUpdate)>25;
if(!update)
return;
lastBufferUpdate = System.currentTimeMillis();
timeSeeker.setBuffered(bufferStartsAt, len);
timeSeeker.setNow(nowPlaying);
byteSeeker.setBuffered(bufferStartsAt, len);
byteSeeker.setNow(nowReading);
byteSeeker.setStatus(this.status);
timeSeeker.update();
}
public void feedRestarted(final long available) {
this.status = "Reading..";
boolean update = (System.currentTimeMillis()-lastBufferUpdate)>25;
if(!update)
return;
lastBufferUpdate = System.currentTimeMillis();
timeSeeker.setBuffered(bufferStartsAt, len);
timeSeeker.setNow(nowPlaying);
byteSeeker.setBuffered(bufferStartsAt, len);
byteSeeker.setNow(nowReading);
byteSeeker.setStatus(this.status);
timeSeeker.update();
byteSeeker.update();
}
public void initialBufferCompleted(final long available) {
this.status = "Reading..";
boolean update = (System.currentTimeMillis()-lastBufferUpdate)>25;
if(!update)
return;
lastBufferUpdate = System.currentTimeMillis();
timeSeeker.setBuffered(bufferStartsAt, len);
timeSeeker.setNow(nowPlaying);
byteSeeker.setBuffered(bufferStartsAt, len);
byteSeeker.setNow(nowReading);
byteSeeker.setStatus(this.status);
timeSeeker.update();
byteSeeker.update();
}
public void playerUpdate(String event, Object eventData) {
if(event.equals(PlayerListener.END_OF_MEDIA)){
stop();
} else if(event.equalsIgnoreCase(PlayerListener.ERROR)){
Dialog.inform(event+ ": " + eventData);
}
}
public byte[] preprocessData(byte[] bytes, int off, int len) {
return null;
}
public void nowReading(long now) {
this.nowReading = now;
boolean update = (System.currentTimeMillis()-lastBufferUpdate)>25;
if(!update)
return;
lastBufferUpdate = System.currentTimeMillis();
timeSeeker.setBuffered(bufferStartsAt, len);
timeSeeker.setNow(nowPlaying);
byteSeeker.setBuffered(bufferStartsAt, len);
byteSeeker.setNow(nowReading);
byteSeeker.setStatus(this.status);
timeSeeker.update();
byteSeeker.update();
}
public void nowPlaying(long now){
this.nowPlaying = now/1000000;
boolean update = (System.currentTimeMillis()-lastBufferUpdate)>25;
if(!update)
return;
lastBufferUpdate = System.currentTimeMillis();
timeSeeker.setBuffered(bufferStartsAt, len);
timeSeeker.setNow(nowPlaying);
byteSeeker.setBuffered(bufferStartsAt, len);
byteSeeker.setNow(nowReading);
byteSeeker.setStatus(this.status);
timeSeeker.update();
byteSeeker.update();
}
public void contentLengthUpdated(long contentLength){
timeSeeker.setLength(sp.getDuration()/1000000);
byteSeeker.setLength(contentLength);
//albumArt.setMediaTitle(sp.getLocator().substring(sp.getLocator().lastIndexOf('/')+1, sp.getLocator().indexOf(';')));
}
public void streamingError(final int code){
UiApplication.getUiApplication().invokeLater(new Runnable(){
public void run(){
switch(code){
case StreamingPlayerListener.ERROR_DOWNLOADING:
byteSeeker.setStatus("An error occured while downloading..");
break;
case StreamingPlayerListener.ERROR_SEEKING:
byteSeeker.setStatus("Error seeking..");
break;
case StreamingPlayerListener.ERROR_OPENING_CONNECTION:
byteSeeker.setStatus("Error openning connection..");
break;
case StreamingPlayerListener.ERROR_PLAYING_MEDIA:
byteSeeker.setStatus("Error Playing Media..Closed!");
break;
}
}
});
}
private class AlbumArtField extends Field{
Bitmap bitmap;
String title;
public AlbumArtField(Bitmap bitmap, String title){
this.bitmap = bitmap;
this.title = title;
}
protected void layout(int width, int height) {
setExtent(Display.getWidth(), Display.getHeight()-timeSeeker.getHeight()-byteSeeker.getHeight());
timeSeeker.setWidth(Display.getWidth());
byteSeeker.setWidth(Display.getWidth());
}
protected void paintBackground(Graphics graphics) {
super.paintBackground(graphics);
graphics.setColor(Color.BLACK);
graphics.fillRect(0, 0, getWidth(), getHeight());
}
protected void paint(Graphics graphics){
if(bitmap!=null)
graphics.drawBitmap((getWidth()/2)-(bitmap.getWidth()/2), (getHeight()/2)-(bitmap.getHeight()/2), bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);
graphics.setColor(Color.YELLOWGREEN);
graphics.drawText(title, (0), (getHeight()/2)+(bitmap.getHeight()/2)+10, DrawStyle.HCENTER, getWidth());
}
public void setMediaTitle(String titleText){
title = titleText;
invalidate();
}
}
public boolean keyChar(char key, int status, int time) {
// TODO Auto-generated method stub
return false;
}
public boolean keyDown(int keycode, int time) {
if(volC!=null){
int key = Keypad.key(keycode);
if(key==Keypad.KEY_VOLUME_UP)
volC.setLevel(volC.getLevel()+10);
else if(key==Keypad.KEY_VOLUME_DOWN)
volC.setLevel(volC.getLevel()-10);
}
return false;
}
public boolean keyRepeat(int keycode, int time) {
if(volC!=null){
int key = Keypad.key(keycode);
if(key==Keypad.KEY_VOLUME_UP)
volC.setLevel(volC.getLevel()+10);
else if(key==Keypad.KEY_VOLUME_DOWN)
volC.setLevel(volC.getLevel()-10);
}
return false;
}
public boolean keyStatus(int keycode, int time) {
// TODO Auto-generated method stub
return false;
}
public boolean keyUp(int keycode, int time) {
// TODO Auto-generated method stub
return false;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public void setLogLevel(int level){
this.logLevel = level;
}
public void setEventLogEnabled(boolean value){
this.eventLogEnabled = value;
}
public void setSDLogEnabled(boolean value){
this.sdLogEnabled = value;
}
public boolean getEventLogEnabled(){
return this.eventLogEnabled;
}
public boolean getSDLogEnabled(){
return this.sdLogEnabled;
}
public int getBitRate() {
return bitRate;
}
public void setBitRate(int bitRate) {
this.bitRate = bitRate;
}
public int getInitBuffer() {
return initBuffer;
}
public void setInitBuffer(int initBuffer) {
this.initBuffer = initBuffer;
}
public int getRestartThreshold() {
return restartThreshold;
}
public void setRestartThreshold(int restartThreshold) {
this.restartThreshold = restartThreshold;
}
public int getBufferCapacity() {
return bufferCapacity;
}
public int getBufferLeakSize() {
return bufferLeakSize;
}
public void setBufferLeakSize(int bufferLeakSize) {
this.bufferLeakSize = bufferLeakSize;
}
public int getConnectionTimeout() {
return connectionTimeout;
}
public void setConnectionTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
public void setBufferCapacity(int bufferCapacity) {
this.bufferCapacity = bufferCapacity;
}
public boolean onClose() {
if(sp!=null){
try {
sp.close();
} catch (Throwable e) {
return super.onClose();
}
}
return super.onClose();
}
protected boolean onSavePrompt() {
return true;
}
}
| [
"[email protected]"
] | |
ee0d734a3f2f8829f258d31a7e51935d8259843f | 0895c6dd428d44bf68f8457fcdcc3ce6bd67a9f9 | /Day2/08_LoopsContinued/SpinningTriangles/src/spinningtriangles/SpinningTriangles.java | 70c370c4ef4a37b4b33a24d67309ca2f4712bb2d | [] | no_license | jcchurch/APSUJavaCamp | 8e1492f6d1766f97778a9e19de761a2d9b6e6a38 | c78d94884b15adc7793d4240a660f41b7635d62a | refs/heads/master | 2020-03-18T23:02:44.770715 | 2018-06-29T19:19:14 | 2018-06-29T19:19:14 | 135,379,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,368 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package spinningtriangles;
import java.util.Random;
import javafx.scene.paint.Color;
import turtles.Sandbox;
import turtles.Turtle;
/**
*
* @author jcchurch
*/
public class SpinningTriangles extends Sandbox {
@Override
public void draw() {
Random rng = new Random();
Turtle turtle = new Turtle();
add(turtle);
Color[] colors = {Color.RED, Color.ORANGE, Color.YELLOW, Color.GREEN, Color.BLUE, Color.INDIGO, Color.VIOLET };
int size = 300;
for (int i = 0; i < 72; i++) {
turtle.up();
turtle.forward(size / 2);
turtle.down();
turtle.setColor(colors[i % 7]);
turtle.left(150);
for (int s = 0; s < 3; s++) {
turtle.forward(size);
turtle.left(120);
}
turtle.left(30);
turtle.up();
turtle.forward(size / 2);
turtle.down();
turtle.left(185);
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"[email protected]"
] | |
840aee87ce17dfedf6c63db0bb379ba08cbaa228 | 3a1bb0141d98617d11e2da0fe5db5d060ae10e8d | /Desktop/untitled folder 2/ClassOnlyCMAR_App.java | 9c7c8d35e1e602f73321dbc5673595c37afa48de | [] | no_license | URCSC440/CMAR | 8aeefad61151b9fd3a3be9b6fc312876f6759228 | b9cdf94f06e3fd6fa2e71e8b4b4003e10f704890 | refs/heads/master | 2021-01-10T15:25:05.563361 | 2015-11-22T22:16:50 | 2015-11-22T22:16:50 | 46,683,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,271 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author katie
*/
/* -------------------------------------------------------------------------- */
/* */
/* APRIORI-TFP CMAR (CLASSIFICATION BASED ON */
/* MULTIPLE ASSOCIATION RULES) CLASSIFIER ONLY APPLICATION */
/* */
/* Frans Coenen */
/* */
/* Friday 5 March 2004 */
/* */
/* Department of Computer Science */
/* The University of Liverpool */
/* */
/* -------------------------------------------------------------------------- */
import java.io.*;
/* Classification application the CMAR (Classification based on Multiple
Associate Rules) algorithm proposed by Wenmin Li, Jiawei Han and Jian Pei,
but founded on Apriori-TFP. Build only a classifier does not test accuracy.
Compile using:
javac ClassOnlyCMAR_App.java
Run using java, Example:
java ClassOnlyCMAR_App -FpimaIndians.D42.N768.C2.num -N2 -S1 -C50
(-F filename, -N number of classifiers) would produce a classifier of the
form:
(1) {1 4 5 7} -> {41} 91.48%, (172.0, 188.0, 500.0)
(2) {4 5 7} -> {41} 90.64%, (184.0, 203.0, 500.0)
(3) {15} -> {41} 90.64%, (155.0, 171.0, 500.0)
(4) {1 5 7} -> {41} 89.9%, (187.0, 208.0, 500.0)
(5) {2 4 7} -> {41} 89.74%, (175.0, 195.0, 500.0)
(6) {1 2 4 7} -> {41} 89.18%, (165.0, 185.0, 500.0)
(7) {5 7} -> {41} 88.88%, (200.0, 225.0, 500.0)
(8) {1 4 7} -> {41} 87.9%, (218.0, 248.0, 500.0)
(9) {4 7} -> {41} 87.5%, (231.0, 264.0, 500.0)
(10) {1 6 7} -> {41} 87.3%, (165.0, 189.0, 500.0)
(11) {6 7} -> {41} 86.89%, (179.0, 206.0, 500.0)
(12) {1 2 7} -> {41} 85.59%, (208.0, 243.0, 500.0)
(13) {1 4 5 6} -> {41} 85.55%, (154.0, 180.0, 500.0)
(14) {2 7} -> {41} 85.38%, (222.0, 260.0, 500.0)
(15) {1 2 4 5} -> {41} 83.88%, (177.0, 211.0, 500.0)
(16) {1 7} -> {41} 83.18%, (282.0, 339.0, 500.0)
(17) {1 5 6} -> {41} 83.16%, (163.0, 196.0, 500.0)
(18) {1 4 6} -> {41} 83.11%, (187.0, 225.0, 500.0)
(19) {2 4 5} -> {41} 82.71%, (201.0, 243.0, 500.0)
(20) {4 5 6} -> {41} 82.6%, (171.0, 207.0, 500.0)
(21) {2 4 6} -> {41} 82.44%, (155.0, 188.0, 500.0)
(22) {7} -> {41} 81.74%, (300.0, 367.0, 500.0)
(23) {1 4 5} -> {41} 81.29%, (239.0, 294.0, 500.0)
(24) {1 2 4} -> {41} 80.91%, (229.0, 283.0, 500.0)
(25) {4 6} -> {41} 80.62%, (208.0, 258.0, 500.0)
Percentage value is the confidence. Values in brackets are: support for
rule, support for antecdent (same as that for rule if confidence is to be
100%) and support for consequent. */
public class ClassOnlyCMAR_App {
// ------------------- FIELDS ------------------------
// None
// ---------------- CONSTRUCTORS ---------------------
// None
// ------------------ METHODS ------------------------
public static void main(String[] args) throws IOException {
double time1 = (double) System.currentTimeMillis();
// Create instance of class ClassificationPRM
AprioriTFP_CMAR newClassification = new AprioriTFP_CMAR(args);
// Read data to be mined from file (method in AssocRuleMining class)
// and set number of rows in training set
newClassification.inputDataSet();
newClassification.setNumRowsInTrainingSet
(newClassification.getNumberOfRows());
// Reorder input data according to frequency of single attributes
// excluding classifiers. Proceed as follows: (1) create a conversion
// array (with classifiers left at end), (2) reorder the attributes
// according to this array. Do not throw away unsupported attributes
// as when data set is split (if distribution is not exactly even) we
// may have thrown away supported attributes that contribute to the
// generation of CRs. NB Never throw away classifiers even if
// unsupported!
newClassification.idInputDataOrdering(); // ClassificationAprioriT
newClassification.recastInputData(); // AssocRuleMining
// Mine data, produce T-tree and generate CRs
newClassification.startClassification();
double accuracy = newClassification.getAccuracy();
newClassification.outputDuration(time1,
(double) System.currentTimeMillis());
// Output
//newClassification.outputFrequentSets();
newClassification.outputNumFreqSets();
newClassification.outputNumUpdates();
newClassification.outputStorage();
//newClassification.outputTtree();
System.out.println("Accuracy = " + accuracy);
newClassification.outputNumCMARrules();
newClassification.outputCMARrules();
// End
System.exit(0);
}
}
| [
"[email protected]"
] | |
d56542755d016a59b5c9f1d839439c8346bca4ee | 7c7e05b16116186ee2d412a16436ac800e94097a | /awe-common/src/main/java/awe/idea/com/common/utils/MD5Utils.java | 223292f4394456ebb97edf5c3b7ecb2782937496 | [
"Apache-2.0"
] | permissive | gitsamyivan/awe-idea | 52e40615d3d6950581fda4e3dc2ef457c2985297 | d35b09bd5944cbfa2beb039a86b9064d0d6751d0 | refs/heads/main | 2023-01-02T16:32:50.595695 | 2020-10-25T14:53:24 | 2020-10-25T14:53:37 | 307,090,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package awe.idea.com.common.utils;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;
/**
* MD5加密工具
*
* @author ZhouChenglin
* @email [email protected]
* @url www.chenlintech.com
* @date 2017年8月8日 下午5:17:34
*/
public class MD5Utils {
private static final String SALT = "1qazxsw2";
private static final String ALGORITH_NAME = "md5";
private static final int HASH_ITERATIONS = 2;
/**
* 使用md5生成加密后的密码
* @param pswd
* @return
*/
public static String encrypt(String pswd) {
String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(SALT), HASH_ITERATIONS).toHex();
return newPassword;
}
/**
* 使用md5生成加密后的密码
* @param username
* @param pswd
* @return
*/
public static String encrypt(String username, String pswd) {
String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(username + SALT), HASH_ITERATIONS).toHex();
return newPassword;
}
}
| [
"[email protected]"
] | |
44e7711e2d7442899bb3e8be6ff757b4210fbaf1 | 97b6a4b4c8c6d3b76fcdae38c73fa3a7750a5ce7 | /BuildApp/android/app/src/main/java/com/buildapp/MainActivity.java | c9f62aa1782438d276fe619a4a5f19f4f3e2dbcc | [] | no_license | tushar1907/React-Native-Weather-Application | d57da69711017abe135c30caafd60072affc6892 | 47ee4a9c0ad79bface5834f6803085a52082a74b | refs/heads/master | 2020-04-02T04:52:20.194717 | 2018-10-26T00:56:32 | 2018-10-26T00:56:32 | 154,040,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.buildapp;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "BuildApp";
}
}
| [
"[email protected]"
] | |
896698bc23e56438fd0c736d51c881d52133f62d | d44665662d1fa8e1d1c394902a31ea8d2a8e0c71 | /app/src/main/java/com/live/viralinstatags/Artu/Camerau.java | 9713ae51662c693624d8ae21a3c8a876feebe0a0 | [] | no_license | himanshulakhera98/InstagramTag-App | 22e954bfb6ccbb2fe342ed72bab8a3b41d158830 | 7b81e1f53074d907f1c2a7cb601a2ff7bbe1ee1b | refs/heads/master | 2020-05-05T06:31:38.581114 | 2019-05-02T03:45:03 | 2019-05-02T03:45:03 | 179,791,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,228 | java | package com.live.viralinstatags.Artu;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.live.viralinstatags.R;
public class Camerau extends AppCompatActivity {
EditText text;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camerau);
text = findViewById(R.id.textb);
button = findViewById(R.id.buttona);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("textb", text.getEditableText().toString() );
clipboard.setPrimaryClip(clip);
Toast.makeText(Camerau.this, "Copied", Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"[email protected]"
] | |
aedeea11d58980e479aeafb6b3215d135fe1b981 | 8e97bc3937b4f9245758e74a31625da364cca69c | /app/src/main/java/com/example/emma/mishmosh/City.java | 59a1a79dd44c9def247c092ad7840a7b9f639e30 | [] | no_license | emmabeanween/mish-mosh | 60e3f461e77fb51c46659a592f87e9f24c801f0e | 5690b5da7b2492ee4716ac1f64d690ec5dcc7827 | refs/heads/master | 2021-10-20T05:26:43.567388 | 2019-02-26T03:27:55 | 2019-02-26T03:27:55 | 107,831,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.example.emma.mishmosh;
/**
* Created by Emma on 7/13/17.
*/
public class City {
private String title;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
| [
"[email protected]"
] | |
484297d314f5837f24f36bab8ed0a816fb56914d | eb48043ca8de4b4352dbd75c3f787ccd7236d011 | /app/src/main/java/com/schopfen/Booth/Activities/InboxActivity.java | 7a6adacde2bd380c72c585287695c8e416578918 | [] | no_license | M-AhsanR/Booth-App | dfb9ae71a3590af46c3a0ce913e5fa4081b5b12a | c4007ffee20e23fd2e4d3ecc2acb602c35da44d6 | refs/heads/master | 2021-03-04T10:40:45.733915 | 2020-03-09T13:29:09 | 2020-03-09T13:29:09 | 246,027,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,180 | java | package com.schopfen.Booth.Activities;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.schopfen.Booth.Adapters.HomeHomePagerAdapter;
import com.schopfen.Booth.Adapters.InboxAdapter;
import com.schopfen.Booth.ApiStructure.ApiModelClass;
import com.schopfen.Booth.ApiStructure.Constants;
import com.schopfen.Booth.ApiStructure.ServerCallback;
import com.schopfen.Booth.BuildConfig;
import com.schopfen.Booth.CustomLoader;
import com.schopfen.Booth.DataClasses.BaseClass;
import com.schopfen.Booth.DataClasses.TimeAgo;
import com.schopfen.Booth.Models.InboxModel;
import com.schopfen.Booth.Models.ProductImagesData;
import com.schopfen.Booth.MyChatService;
import com.schopfen.Booth.R;
import com.squareup.picasso.Picasso;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static android.text.Spanned.SPAN_INCLUSIVE_INCLUSIVE;
public class InboxActivity extends AppCompatActivity {
SharedPreferences sharedpreferences;
SharedPreferences.Editor mEditor;
public static final String MyPREFERENCES = "MyPrefs";
RecyclerView inbox_recycler;
SwipeRefreshLayout swipe_inbox;
TextView inbox_size_text, nochats_text;
ArrayList<InboxModel> inboxModelArrayList = new ArrayList<>();
@Override
protected void onStop() {
super.onStop();
if (CustomLoader.dialog != null){
CustomLoader.dialog.dismiss();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (CustomLoader.dialog != null){
CustomLoader.dialog.dismiss();
}
}
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isNetworkAvailable()){
Intent intent = new Intent(InboxActivity.this, MyChatService.class);
// i.putExtra("KEY1", "Value to be used by the service");
startService(intent);
setContentView(R.layout.activity_inbox);
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
mEditor = sharedpreferences.edit();
inbox_recycler = findViewById(R.id.inbox_recycler);
swipe_inbox = findViewById(R.id.swipe_inbox);
inbox_size_text = findViewById(R.id.inbox_size_text);
nochats_text = findViewById(R.id.nochats_text);
InboxApi();
swipe_inbox.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
InboxApi();
}
});
}else {
setContentView(R.layout.activity_inbox);
}
}
private void InboxApi(){
CustomLoader.showDialog(InboxActivity.this);
Map<String, String> body = new HashMap<String, String>();
body.put("UserID", sharedpreferences.getString("UserID", " "));
body.put("Type", sharedpreferences.getString("LastState", " "));
body.put("AndroidAppVersion", String.valueOf(BuildConfig.VERSION_CODE));
HashMap<String, String> header = new HashMap<String, String>();
header.put("Verifytoken", sharedpreferences.getString("ApiToken", " "));
ApiModelClass.GetApiResponse(Request.Method.POST, Constants.URL.INBOX, InboxActivity.this, body, header, new ServerCallback() {
@Override
public void onSuccess(String result, String ERROR) {
CustomLoader.dialog.dismiss();
if (ERROR.isEmpty()) {
Log.e("Inbox", " " + result);
try {
JSONObject jsonObject = new JSONObject(String.valueOf(result));
int status = jsonObject.getInt("status");
if (status == 200) {
swipe_inbox.setRefreshing(false);
inboxModelArrayList.clear();
JSONArray ChatRooms = jsonObject.getJSONArray("ChatRooms");
for (int i = 0; i < ChatRooms.length(); i++){
JSONObject jsonObject1 = ChatRooms.getJSONObject(i);
String ChatID = jsonObject1.getString("ChatID");
String ConversationSenderID = jsonObject1.getString("ConversationSenderID");
String ConversationSenderName = jsonObject1.getString("ConversationSenderName");
String ConversationSenderUserName = jsonObject1.getString("ConversationSenderUserName");
String ConversationSenderImage = jsonObject1.getString("ConversationSenderImage");
String ConversationReceiverID = jsonObject1.getString("ConversationReceiverID");
String ConversationReceiverName = jsonObject1.getString("ConversationReceiverName");
String ConversationReceiverUserName = jsonObject1.getString("ConversationReceiverUserName");
String ConversationReceiverImage = jsonObject1.getString("ConversationReceiverImage");
String Type = jsonObject1.getString("Type");
String ReceiverType = jsonObject1.getString("ReceiverType");
String ChatMessageID = jsonObject1.getString("ChatMessageID");
String SenderID = jsonObject1.getString("SenderID");
String ReceiverID = jsonObject1.getString("ReceiverID");
String IsReadBySender = jsonObject1.getString("IsReadBySender");
String IsReadByReceiver = jsonObject1.getString("IsReadByReceiver");
String Image = jsonObject1.getString("Image");
String CompressedImage = jsonObject1.getString("CompressedImage");
String Message = jsonObject1.getString("Message");
String CreatedAt = jsonObject1.getString("CreatedAt");
String HasUnreadMessage = jsonObject1.getString("HasUnreadMessage");
String UnreadMessageCount = jsonObject1.getString("UnreadMessageCount");
inboxModelArrayList.add(new InboxModel(ChatID, ConversationSenderID, ConversationSenderName, ConversationSenderUserName,
ConversationSenderImage, ConversationReceiverID,
ConversationReceiverName, ConversationReceiverUserName, ConversationReceiverImage,
Type, ReceiverType, ChatMessageID, SenderID, ReceiverID,
IsReadBySender, IsReadByReceiver, Image, CompressedImage, Message, CreatedAt, HasUnreadMessage,
UnreadMessageCount));
}
if (inboxModelArrayList.isEmpty()){
nochats_text.setVisibility(View.VISIBLE);
inbox_recycler.setVisibility(View.GONE);
}else {
nochats_text.setVisibility(View.GONE);
inbox_recycler.setVisibility(View.VISIBLE);
}
inbox_size_text.setText("(" + String.valueOf(inboxModelArrayList.size()) + ")");
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(InboxActivity.this);
inbox_recycler.setLayoutManager(linearLayoutManager);
InboxAdapter inboxAdapter = new InboxAdapter(InboxActivity.this, inboxModelArrayList, new InboxAdapter.CustomItemClickListener() {
@Override
public void onItemClick(View v, int position) {
}
});
inbox_recycler.setAdapter(inboxAdapter);
CustomLoader.dialog.dismiss();
} else {
CustomLoader.dialog.dismiss();
Toast.makeText(InboxActivity.this, String.valueOf(status), Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
CustomLoader.dialog.dismiss();
e.printStackTrace();
}
} else {
CustomLoader.dialog.dismiss();
Toast.makeText(InboxActivity.this, ERROR, Toast.LENGTH_SHORT).show();
}
}
});
}
}
| [
"[email protected]"
] | |
0acd5228fbe064bde26e79a315d25c3b4fc8d0f0 | 8fa1af38758c2a88c4801b04114a72637e129ff8 | /src/main/java/edu/uw/zookeeper/safari/control/volumes/VolumeOperationProposer.java | baac361f3a91fe92e8e674074fe5c82c16b67b5f | [
"Apache-2.0"
] | permissive | lisaglendenning/safari | 2caf36e72a43721f5ff06be24073d4c1bfc2bb72 | 3f36e5354db115644e9e1eaa65136a4dc759024f | refs/heads/master | 2016-09-06T06:56:57.547823 | 2015-07-02T21:56:25 | 2015-07-02T21:56:25 | 12,796,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,997 | java | package edu.uw.zookeeper.safari.control.volumes;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import edu.uw.zookeeper.client.SubmittedRequests;
import edu.uw.zookeeper.common.LoggingFutureListener;
import edu.uw.zookeeper.common.Pair;
import edu.uw.zookeeper.data.Materializer;
import edu.uw.zookeeper.data.Operations;
import edu.uw.zookeeper.data.RelativeZNodePath;
import edu.uw.zookeeper.protocol.Operation;
import edu.uw.zookeeper.protocol.proto.Records;
import edu.uw.zookeeper.safari.VersionedId;
import edu.uw.zookeeper.safari.control.schema.ControlSchema;
import edu.uw.zookeeper.safari.control.schema.ControlZNode;
import edu.uw.zookeeper.safari.control.schema.LinkVolumeLogEntry;
import edu.uw.zookeeper.safari.control.schema.VolumeLogEntryPath;
import edu.uw.zookeeper.safari.schema.volumes.MergeParameters;
import edu.uw.zookeeper.safari.schema.volumes.VolumeOperation;
import edu.uw.zookeeper.safari.schema.volumes.VolumeOperator;
public class VolumeOperationProposer<O extends Operation.ProtocolResponse<?>> implements AsyncFunction<VolumeLogEntryPath,Pair<VolumeLogEntryPath, Optional<VolumeLogEntryPath>>> {
public static <O extends Operation.ProtocolResponse<?>> ListenableFuture<Pair<VolumeLogEntryPath,Optional<VolumeLogEntryPath>>> forProposal(
VolumeOperationCoordinatorEntry proposal,
Materializer<ControlZNode<?>,O> materializer) {
return Futures.transform(
proposal,
new VolumeOperationProposer<O>(proposal.operation(),
materializer));
}
protected final Materializer<ControlZNode<?>,O> materializer;
protected final VolumeOperation<?> operation;
protected VolumeOperationProposer(
VolumeOperation<?> operation,
Materializer<ControlZNode<?>,O> materializer) {
this.operation = operation;
this.materializer = materializer;
}
@Override
public ListenableFuture<Pair<VolumeLogEntryPath, Optional<VolumeLogEntryPath>>> apply(
final VolumeLogEntryPath proposal) throws Exception {
return Futures.transform(
LoggingFutureListener.listen(
LogManager.getLogger(this),
VolumeOperationEntryLinks.forOperation(
proposal,
operation,
materializer)),
new Function<Optional<VolumeLogEntryPath>,Pair<VolumeLogEntryPath, Optional<VolumeLogEntryPath>>>() {
@Override
public Pair<VolumeLogEntryPath, Optional<VolumeLogEntryPath>> apply(
Optional<VolumeLogEntryPath> input) {
return Pair.create(proposal, input);
}
});
}
public static final class VolumeOperationEntryLinks<O extends Operation.ProtocolResponse<?>> implements AsyncFunction<List<O>,VolumeLogEntryPath> {
public static <O extends Operation.ProtocolResponse<?>> ListenableFuture<Optional<VolumeLogEntryPath>> forOperation(
VolumeLogEntryPath entry,
VolumeOperation<?> operation,
Materializer<ControlZNode<?>,O> materializer) {
if (operation.getOperator().getOperator() != VolumeOperator.MERGE) {
return Futures.immediateFuture(Optional.<VolumeLogEntryPath>absent());
}
final VersionedId volume = ((MergeParameters) operation.getOperator().getParameters()).getParent();
final RelativeZNodePath link = ControlSchema.Safari.Volumes.Volume.Log.Version.Entry.PATH.relative(entry.path());
return Futures.transform(
create(link, volume, materializer),
new Function<VolumeLogEntryPath, Optional<VolumeLogEntryPath>>() {
@Override
public Optional<VolumeLogEntryPath> apply(
VolumeLogEntryPath input) {
return Optional.of(input);
}
});
}
public static <O extends Operation.ProtocolResponse<?>> ListenableFuture<VolumeLogEntryPath> create(
RelativeZNodePath link,
VersionedId volume,
Materializer<ControlZNode<?>,O> materializer) {
VolumesSchemaRequests<O>.VolumeSchemaRequests.VolumeVersionSchemaRequests schema =
VolumesSchemaRequests.create(materializer)
.version(volume);
return Futures.transform(
SubmittedRequests.submit(
materializer,
schema.children()),
new VolumeOperationEntryLinks<O>(
link,
schema));
}
private final RelativeZNodePath link;
private final VolumesSchemaRequests<O>.VolumeSchemaRequests.VolumeVersionSchemaRequests schema;
protected VolumeOperationEntryLinks(
RelativeZNodePath link,
VolumesSchemaRequests<O>.VolumeSchemaRequests.VolumeVersionSchemaRequests schema) {
this.link = link;
this.schema = schema;
}
@Override
public ListenableFuture<VolumeLogEntryPath> apply(
List<O> input) throws Exception {
for (Operation.ProtocolResponse<?> response: input) {
Operations.unlessError(response.record());
}
final Materializer<ControlZNode<?>,O> materializer = schema.volume().volumes().getMaterializer();
Optional<VolumeLogEntryPath> entry = Optional.absent();
List<Records.Request> requests = ImmutableList.of();
materializer.cache().lock().readLock().lock();
try {
ControlSchema.Safari.Volumes.Volume.Log.Version node = ControlSchema.Safari.Volumes.Volume.Log.Version.fromTrie(
materializer.cache().cache(), schema.volume().getVolume(), schema.getVersion());
for (ControlSchema.Safari.Volumes.Volume.Log.Version.Entry e: node.entries().values()) {
if (e.data().get() == null) {
if (requests.isEmpty()) {
requests = Lists.newLinkedList();
}
requests.addAll(schema.entry(e.name()).get());
} else if ((e.data().get() instanceof LinkVolumeLogEntry) && e.data().get().get().equals(link)) {
entry = Optional.of(
VolumeLogEntryPath.valueOf(
VersionedId.valueOf(
e.version().name(),
e.version().log().volume().name()),
e.name()));
break;
}
}
} finally {
materializer.cache().lock().readLock().unlock();
}
if (entry.isPresent()) {
return Futures.immediateFuture(entry.get());
}
if (requests.isEmpty()) {
requests = ImmutableList.<Records.Request>of(schema.logLink(link));
}
return Futures.transform(
SubmittedRequests.submit(
materializer,
requests),
this);
}
}
}
| [
"[email protected]"
] | |
2d998401a59cfc4a89ff511247624521b439be9d | 6fb89a4a14d2395b6306d056b94af06538ec4c78 | /app/src/androidTest/java/com/example/jxxy/lx/ExampleInstrumentedTest.java | 7841dac63fb531033689b44799b40eb937c33cf3 | [] | no_license | AHAHAHHAHAHA/lx01 | f79bf4509035008bb490c7dd9d3103f346d04802 | b2b9abce2f25655420410edcfef6eb306c49d6c5 | refs/heads/master | 2020-09-16T18:30:35.394356 | 2019-11-25T03:30:09 | 2019-11-25T03:30:09 | 223,853,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package com.example.jxxy.lx;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.jxxy.lx", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
a066a3de520183d934cf9c4bc408907655ecf7cd | 4f1b88772571df55d81b689bfff889666ac4027d | /TerminwahlKop/src_dataClasses/mein/projekt/ZeitfuerTermin.java | 17b89363e1e118dd064903dc6f7eca4011ffc198 | [] | no_license | MetehanKilin/AxonTest | f2bbffeb4d21936389f748f049619ebb1ed10a4a | 48df6167afc14e40d47db667a0dfaf5bda174bcd | refs/heads/master | 2021-01-19T09:29:08.189020 | 2017-02-28T15:30:08 | 2017-02-28T15:30:08 | 82,118,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,452 | java | package mein.projekt;
/**
*/
@SuppressWarnings("all")
@javax.annotation.Generated(comments="This is the java file of the ivy data class ZeitfuerTermin", value={"ch.ivyteam.ivy.scripting.streamInOut.IvyScriptJavaClassBuilder"})
public class ZeitfuerTermin extends ch.ivyteam.ivy.scripting.objects.CompositeObject
{
/** SerialVersionUID */
private static final long serialVersionUID = -1328403011317968575L;
private ch.ivyteam.ivy.scripting.objects.Time ab;
/**
* Gets the field ab.
* @return the value of the field ab; may be null.
*/
public ch.ivyteam.ivy.scripting.objects.Time getAb()
{
return ab;
}
/**
* Sets the field ab.
* @param _ab the new value of the field ab.
*/
public void setAb(ch.ivyteam.ivy.scripting.objects.Time _ab)
{
ab = _ab;
}
private ch.ivyteam.ivy.scripting.objects.Time bis;
/**
* Gets the field bis.
* @return the value of the field bis; may be null.
*/
public ch.ivyteam.ivy.scripting.objects.Time getBis()
{
return bis;
}
/**
* Sets the field bis.
* @param _bis the new value of the field bis.
*/
public void setBis(ch.ivyteam.ivy.scripting.objects.Time _bis)
{
bis = _bis;
}
private ch.ivyteam.ivy.scripting.objects.Date Datum;
/**
* Gets the field Datum.
* @return the value of the field Datum; may be null.
*/
public ch.ivyteam.ivy.scripting.objects.Date getDatum()
{
return Datum;
}
/**
* Sets the field Datum.
* @param _Datum the new value of the field Datum.
*/
public void setDatum(ch.ivyteam.ivy.scripting.objects.Date _Datum)
{
Datum = _Datum;
}
private java.lang.String Ort;
/**
* Gets the field Ort.
* @return the value of the field Ort; may be null.
*/
public java.lang.String getOrt()
{
return Ort;
}
/**
* Sets the field Ort.
* @param _Ort the new value of the field Ort.
*/
public void setOrt(java.lang.String _Ort)
{
Ort = _Ort;
}
private ch.ivyteam.ivy.scripting.objects.Record Kommentar;
/**
* Gets the field Kommentar.
* @return the value of the field Kommentar; may be null.
*/
public ch.ivyteam.ivy.scripting.objects.Record getKommentar()
{
return Kommentar;
}
/**
* Sets the field Kommentar.
* @param _Kommentar the new value of the field Kommentar.
*/
public void setKommentar(ch.ivyteam.ivy.scripting.objects.Record _Kommentar)
{
Kommentar = _Kommentar;
}
}
| [
"[email protected]"
] | |
bb24e67ac6b4d6329c7928250f807ef88c3bbd37 | 995c1b7c61bbf6e28d69bc36d4721be9c1a3b7c4 | /xxpay-service/src/main/java/org/xxpay/service/impl/SysIndustryCodeServiceImpl.java | 09d852dcd9cdc014777c5d77831f3eda7169d6c0 | [] | no_license | launchfirst2020/xxpay4new | 94bdb9cf3c974ac51214a13dfec279b8c34029d1 | 54247cd9cf64aacfffe84455a7ac1bf61420ffc2 | refs/heads/master | 2023-04-09T21:10:13.344707 | 2021-01-22T09:10:28 | 2021-01-22T09:10:28 | 331,880,197 | 5 | 9 | null | null | null | null | UTF-8 | Java | false | false | 2,161 | java | package org.xxpay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.xxpay.core.entity.SysIndustryCode;
import org.xxpay.core.service.ISysIndustryCodeService;
import org.xxpay.service.dao.mapper.SysIndustryCodeMapper;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 行业编码表 服务实现类
* </p>
*
* @author xxpay generator
* @since 2019-09-27
*/
@Service
public class SysIndustryCodeServiceImpl extends ServiceImpl<SysIndustryCodeMapper, SysIndustryCode> implements ISysIndustryCodeService {
@Override
public String formatIndustryInfo(Integer industryCode){
List<SysIndustryCode> nameList = new ArrayList<>();
recursionFormatIndustryInfo(industryCode, nameList);
String result = "";
for(int i = 0; i < nameList.size(); i++){
result += "[" + nameList.get(i).getIndustryName() + "]";
if(i != (nameList.size() - 1) ){ //非最后一位
result += " - ";
}
}
return result;
}
@Override
public String getAllIndustryCode(Integer industryCode){
List<SysIndustryCode> list = new ArrayList<>();
recursionFormatIndustryInfo(industryCode, list);
String result = "";
for(int i = 0; i < list.size(); i++){
result += list.get(i).getIndustryCode();
if(i != (list.size() - 1) ){ //非最后一位
result += ",";
}
}
return result;
}
/** 递归拼接, 按照 一级 / 二级 /三级 放入list中 **/
private void recursionFormatIndustryInfo(Integer industryCode, List<SysIndustryCode> list){
SysIndustryCode sysIndustryCode = this.getById(industryCode);
if(sysIndustryCode == null) return;
if(sysIndustryCode.getParentCode() == null || sysIndustryCode.getParentCode() == 0 ){ //最顶级
list.add(sysIndustryCode);
return ;
}
recursionFormatIndustryInfo(sysIndustryCode.getParentCode(), list);
list.add(sysIndustryCode);
}
}
| [
"[email protected]"
] | |
0ce3d831c740fee1ea93ea681b470e9d76a3c59f | 3d511ea94310fc15ba1a7ce333e133389da5b3a9 | /parsers/SAXDanceParser.java | da8ac12be314ff9a78629ba23bcf96c35bb369e6 | [] | no_license | savelichev/ThirdProject_XML | 1f144292086809bc898c0c7608cbcee4ebdc9e26 | c9cba88c3cf246fde79e446cd478010f4e9a37df | refs/heads/master | 2021-01-17T20:55:47.132421 | 2016-06-07T02:13:30 | 2016-06-07T02:13:30 | 59,860,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,272 | java | package parsers;
import entity.DanceMain;
import entity.DanceType;
import entity.MusicType;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
public class SAXDanceParser extends DefaultHandler {
private String thisElement;
private DanceMain dance = new DanceMain();
public DanceMain getDance() {
return dance;
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
thisElement = qName;
if (thisElement.equals("dance")) {
dance.setTitle(attributes.getValue(0));
dance.setId(new Integer(attributes.getValue(1)));
}
}
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
String s = new String(ch, start, length);
if (!(s.trim().equals(""))) {
if (thisElement.equals("type")) {
if (s.equals("ballroom")) {
dance.setType(DanceType.BALLROOM);
} else if (s.equals("street")) {
dance.setType(DanceType.STREET);
} else if (s.equals("ballet")) {
dance.setType(DanceType.BALLET);
} else if (s.equals("latinos")) {
dance.setType(DanceType.LATINOS);
} else if (s.equals("folk")) {
dance.setType(DanceType.FOLK);
}
}
if (thisElement.equals("scene")) {
dance.setScene(s);
}
if (thisElement.equals("numberOfDancers")) {
dance.setNumberOfDancers(Integer.parseInt((s)));
}
if (thisElement.equals("number")) {
dance.setNumber(new Integer(s));
}
if (thisElement.equals("mt:music")) {
if (s.equals("phonogram")) {
dance.setMusic(MusicType.PHONOGRAM);
} else if (s.equals("live")) {
dance.setMusic(MusicType.LIVE);
}
}
if (thisElement.equals("dancer")) {
dance.getDancers().getDancer().add(s);
}
}
}
}
| [
"[email protected]"
] | |
77779912e2f48ea3c922356b60ce67f3dd6c0016 | d9fb59cf1a5177dcb07fbab99706c01b63230cdc | /app/src/main/java/com/dentech/engineeringapp/viewholders/UserViewHolder.java | 23021c2ee4a326ccf8c9446f077fb80a6d21f9eb | [] | no_license | OlukaDenis/Solarsizing | 0226be41615790a51ed9d5873ac1ab25f6e12dd3 | db8256e0807bb5e04e5fa8440c12e0c2ae5496e8 | refs/heads/master | 2020-06-01T23:29:41.045102 | 2019-06-09T05:00:20 | 2019-06-09T05:00:20 | 190,965,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package com.dentech.engineeringapp.viewholders;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.dentech.engineeringapp.R;
public class UserViewHolder extends RecyclerView.ViewHolder {
public TextView mProjectName, mProjectDate;
public UserViewHolder(@NonNull View itemView) {
super(itemView);
mProjectName = (TextView) itemView.findViewById(R.id.tv_project_name);
mProjectDate = (TextView) itemView.findViewById(R.id.tv_project_date);
}
}
| [
"[email protected]"
] | |
640098a07085e1c6dd38f70afa14a87e836e8a94 | ad19036ffc0b13025b63a4ae163c488f957fbe41 | /src/test/java/com/enjoy/dp/Prototype/example7/Example7Test.java | 6f8eb63e7aa5cf69c6ed4b2facbf749ddb0ebc50 | [] | no_license | wz3118103/JavaDesignPatterns | b5b6a85618fe893a630e20ea91c1e041e26d30ba | 8c3cd241bb0b1bc6fc9460d329118a399cb2a750 | refs/heads/master | 2021-07-05T14:52:12.734497 | 2020-09-14T14:41:44 | 2020-09-14T14:41:44 | 150,911,509 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | package com.enjoy.dp.Prototype.example7;
import org.junit.Test;
/**
* @Author : Wang Zhen.
* @Date : Created in 16:08 2018/10/9
* @Description :
* @Modified By :
* @Version :
*/
public class Example7Test {
@Test
public void example7Test() {
try {
// 初始化原型管理器
Prototype p1 = new ConcretePrototype1();
PrototypeManager.setPrototype("Prototype1", p1);
// 获取原型来创建对象
Prototype p3 = PrototypeManager.getPrototype("Prototype1").clone();
p3.setName("张三");
System.out.println("第一个实例:" + p3);
// 有人动态的切换了实现
Prototype p2 = new ConcretePrototype2();
PrototypeManager.setPrototype("Prototype1", p2);
// 重新获取原型来创建对象
Prototype p4 = PrototypeManager.getPrototype("Prototype1").clone();
p4.setName("李四");
System.out.println("第二个实例:" + p4);
// 有人注销了这个原型
PrototypeManager.removePrototype("Prototype1");
// 再次获取原型来创建对象
Prototype p5 = PrototypeManager.getPrototype("Prototype1").clone();
p5.setName("王五");
System.out.println("第三个实例:" + p5);
} catch (Exception err) {
System.err.println(err.getMessage());
}
}
}
| [
"[email protected]"
] | |
12990618d18043687a933b4fdaff14015bb84d6b | 9f6cf676a0d5f008de61055d5a7003130d11e478 | /common/mongodb/src/main/java/com/redhat/thermostat/gateway/common/mongodb/filters/MongoRequestFilters.java | e705491b12bb08387d45b936b908260e9a309e8f | [] | no_license | jerboaa/thermostat-ng-web-gateway | 35696280d0ae9f2fa62031374048ebd549dc8465 | 4daf75ad649ac4fefeca7b840683e262b7103f5e | refs/heads/master | 2021-01-19T07:33:36.891963 | 2017-04-03T17:08:57 | 2017-04-03T17:08:57 | 87,553,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,535 | java | /*
* Copyright 2012-2017 Red Hat, Inc.
*
* This file is part of Thermostat.
*
* Thermostat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or (at your
* option) any later version.
*
* Thermostat is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Thermostat; see the file COPYING. If not see
* <http://www.gnu.org/licenses/>.
*
* Linking this code with other modules is making a combined work
* based on this code. Thus, the terms and conditions of the GNU
* General Public License cover the whole combination.
*
* As a special exception, the copyright holders of this code give
* you permission to link this code with independent modules to
* produce an executable, regardless of the license terms of these
* independent modules, and to copy and distribute the resulting
* executable under terms of your choice, provided that you also
* meet, for each linked independent module, the terms and conditions
* of the license of that module. An independent module is a module
* which is not derived from or based on this code. If you modify
* this code, you may extend this exception to your version of the
* library, but you are not obligated to do so. If you do not wish
* to do so, delete this exception statement from your version.
*/
package com.redhat.thermostat.gateway.common.mongodb.filters;
import static com.mongodb.client.model.Filters.and;
import static com.mongodb.client.model.Filters.eq;
import static com.mongodb.client.model.Filters.exists;
import static com.mongodb.client.model.Filters.gt;
import static com.mongodb.client.model.Filters.gte;
import static com.mongodb.client.model.Filters.lt;
import static com.mongodb.client.model.Filters.lte;
import static com.mongodb.client.model.Filters.or;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bson.conversions.Bson;
public class MongoRequestFilters {
public static Bson buildFilter(List<String> queries, List<String> tags) {
List<Bson> filters = new ArrayList<>();
filters.add(buildQueriesFilter(queries));
filters.add(buildTagsFilter(tags));
return and(filters);
}
private static Bson buildTagsFilter(List<String> tags) {
List<Bson> filters = new ArrayList<>();
filters.add(exists("tags", false));
if (tags != null && !tags.isEmpty()) {
for (String tag : tags) {
filters.add(eq("tags", tag));
}
}
return or(filters);
}
private static Bson buildQueriesFilter(List<String> queries) {
List<Bson> filters = new ArrayList<>();
for (String filter : queries) {
Pattern p = Pattern.compile("(<=|>=|<|>|=)");
Matcher m = p.matcher(filter);
if (m.find()) {
String key = filter.substring(0, m.start());
String comparator = filter.substring(m.start(), m.end());
String valueInput = filter.substring(m.end());
Object value;
try {
value = Double.parseDouble(valueInput);
} catch (Exception e) {
if (valueInput.startsWith("\"") && valueInput.endsWith("\"")) {
value = valueInput.substring(1, valueInput.length()-1);
} else {
value = valueInput;
}
}
switch (comparator) {
case "<=":
filters.add(lte(key, value));
break;
case ">=":
filters.add(gte(key, value));
break;
case "=":
filters.add(eq(key, value));
break;
case ">":
filters.add(gt(key, value));
break;
case "<":
filters.add(lt(key, value));
break;
}
}
}
return and(filters);
}
}
| [
"[email protected]"
] | |
7a9ab393938185bf8732a8a3cf4be64192edffbc | db77bbcf6b7be8112eb676677ac6e5ffc928b91c | /Lab2Arcanoid3D/src/DYN4JBox.java | 44c2c7354c2105f6f829b18f0218e2c418f62fdf | [] | no_license | AlexanderChibirev/ComputerGraphics | 7bd74c5ebff1a3470636d5efce633b6c4d910813 | 29b2f4e243e302347b8fb107fe879cb8d4511eb0 | refs/heads/master | 2021-01-18T18:51:55.145522 | 2017-01-11T22:05:14 | 2017-01-11T22:05:14 | 68,323,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | import java.util.Vector;
import org.dyn4j.dynamics.Body;
import org.dyn4j.dynamics.BodyFixture;
import org.dyn4j.geometry.MassType;
import org.dyn4j.geometry.Rectangle;
import org.dyn4j.geometry.Vector2;
public class DYN4JBox extends Body {
private Vector<Body> mBox = new Vector<Body>();
public DYN4JBox() {
createBox();
}
private void createRect(final Vector2 size, final double angle, Vector2 translate)
{
Body rect = new Body();
rect.addFixture(new BodyFixture(new Rectangle(size.x, size.y)));
rect.setMass(MassType.INFINITE);
rect.rotate(angle);
rect.translate(translate.x, translate.y);
mBox.add(rect);
}
private void createBox() {
createRect(new Vector2(13.2, .5), 1.57, new Vector2(8.6, 0));//right
createRect(new Vector2(17.0, .5), 0, new Vector2(0, 6.4)); //up
createRect(new Vector2(13.2, .5), -1.57, new Vector2(-8.6, 0));//left
createRect(new Vector2(17.0, .5), 0, new Vector2(0, -6.4)); //floor for died ball
}
public Vector<Body> getBox() {
return mBox;
}
}
| [
"[email protected]"
] | |
138a283427258656f01f913c6d5979dab56a69ac | 10879a57592fd44eb01896d3c88400a718f906d5 | /src/com/cug2/EditServlet.java | de88004ec10423c72c8bd1e2cf8f74687f83d0e0 | [] | no_license | yuyang4600/BAOMING4 | 0c3ac1be3c38d6119a5691081a8f3bec1aa63b7d | d42db18e29ecb41dea2148926462372cf5b65915 | refs/heads/master | 2021-01-20T12:20:43.638640 | 2017-12-21T01:48:59 | 2017-12-21T01:48:59 | 82,649,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,472 | java | package com.cug2;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.cug.CreateConnection;
import com.cug.UsersCl;
public class EditServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
String name = request.getParameter("name");
String sex = request.getParameter("sex");
String birth = request.getParameter("birth");
String place = request.getParameter("place");
String grade = request.getParameter("grade");
String pro = request.getParameter("pro");
String num = request.getParameter("num");
String email = request.getParameter("email");
String addre = request.getParameter("addre");
String post = request.getParameter("post");
UsersCl edit = new UsersCl();
boolean a = edit.Edit(name, sex, birth, place, grade, pro, num, email, addre, post);
if(a){
request.getRequestDispatcher("save2.jsp").forward(request,response);
}else{
request.getRequestDispatcher("err.jsp").forward(request,response);
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.