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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ea21a5f09c9e5f391deec34dd1f8e6738f5c3bad | 7b5d325e2d29bb0c2aa1fc714828705236fa1a06 | /src/_822/IsUgly.java | e9edf5fd673679d1c1c981d83a80fb3df629ac57 | [] | no_license | qued3er/leetcode | eb3ef0aa10f2ebf49aa66187260f1b9f78c73a74 | 2135a26e7eab269d5fdf333932ca6a9846471f3c | refs/heads/master | 2023-01-02T15:28:37.888480 | 2020-11-02T08:34:38 | 2020-11-02T08:34:38 | 290,907,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package _822;
/**
* @author li
* @Title:
* @Description:
* @date 2020/8/2217:07
*/
public class IsUgly {
public boolean isUgly(int num) {
//如何判断一个数能够被2/3整除看他对该数取余是否为0
while((num&0x00000001)==0){
//为什么除不行
// num=num/2;
num=num>>1;
}
while(num%3==0){
// num=num>>2;
num=num/3;
}
while (num%5==0){
num=num/5;
}
if (num==1){
return true;
}
return false;
}
public static void main(String[] args) {
IsUgly isUgly=new IsUgly();
System.out.println(isUgly.isUgly(6));
}
}
| [
"[email protected]"
] | |
bdbf961095920b0b93103f1f68819baf9832d8cb | bc8e436ad945cc075b9d47869e82529d972969b6 | /ocsp-qa/src/main/java/org/xipki/ocsp/qa/benchmark/HttpClient.java | 8f5db7f3ea60e47d17737be7a7d19ed078e0037d | [
"Apache-2.0"
] | permissive | etsangsplk/xipki | 283ac407756c2856a91e01787db271f8a92bb4b0 | 230365bf7e5686b83a186e2bebcef49c08b55887 | refs/heads/master | 2020-03-18T13:16:57.382344 | 2018-05-24T05:19:10 | 2018-05-24T05:19:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,881 | java | /*
*
* Copyright (c) 2013 - 2018 Lijun Liao
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xipki.ocsp.qa.benchmark;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xipki.common.concurrent.CountLatch;
import org.xipki.common.util.LogUtil;
import org.xipki.common.util.ParamUtil;
import org.xipki.ocsp.client.api.OcspRequestorException;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpClientCodec;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.timeout.ReadTimeoutHandler;
import io.netty.handler.timeout.WriteTimeoutHandler;
/**
* TODO.
* @author Lijun Liao
* @since 2.2.0
*/
final class HttpClient {
private static final Logger LOG = LoggerFactory.getLogger(HttpClient.class);
private class HttpClientInitializer extends ChannelInitializer<SocketChannel> {
public HttpClientInitializer() {
}
@Override
public void initChannel(SocketChannel ch) {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new ReadTimeoutHandler(60, TimeUnit.SECONDS))
.addLast(new WriteTimeoutHandler(60, TimeUnit.SECONDS))
.addLast(new HttpClientCodec())
.addLast(new HttpObjectAggregator(65536))
.addLast(new HttpClientHandler());
}
}
private class HttpClientHandler extends SimpleChannelInboundHandler<FullHttpResponse> {
@Override
public void channelRead0(ChannelHandlerContext ctx, FullHttpResponse resp) {
try {
decrementPendingRequests();
responseHandler.onComplete(resp);
} catch (Throwable th) {
LOG.error("unexpected error", th);
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
decrementPendingRequests();
ctx.close();
LOG.warn("error", cause);
responseHandler.onError();
}
}
private static Boolean epollAvailable;
private static Boolean kqueueAvailable;
private final CountLatch latch = new CountLatch(0, 0);
private int queueSize = 1000;
private String uri;
private OcspBenchmark responseHandler;
private EventLoopGroup workerGroup;
private Channel channel;
private int pendingRequests = 0;
static {
String os = System.getProperty("os.name").toLowerCase();
ClassLoader loader = HttpClient.class.getClassLoader();
if (os.contains("linux")) {
try {
Class<?> checkClazz = Class.forName("io.netty.channel.epoll.Epoll", false, loader);
Method mt = checkClazz.getMethod("isAvailable");
Object obj = mt.invoke(null);
if (obj instanceof Boolean) {
epollAvailable = (Boolean) obj;
}
} catch (Throwable th) {
if (th instanceof ClassNotFoundException) {
LOG.info("epoll linux is not in classpath");
} else {
LogUtil.warn(LOG, th, "could not use Epoll transport");
}
}
} else if (os.contains("mac os") || os.contains("os x")) {
try {
Class<?> checkClazz = Class.forName("io.netty.channel.epoll.kqueue.KQueue", false, loader);
Method mt = checkClazz.getMethod("isAvailable");
Object obj = mt.invoke(null);
if (obj instanceof Boolean) {
kqueueAvailable = (Boolean) obj;
}
} catch (Throwable th) {
LogUtil.warn(LOG, th, "could not use KQueue transport");
}
}
}
public HttpClient(String uri, OcspBenchmark responseHandler, int queueSize) {
this.uri = ParamUtil.requireNonNull("uri", uri);
if (queueSize > 0) {
this.queueSize = queueSize;
}
this.responseHandler = ParamUtil.requireNonNull("responseHandler", responseHandler);
this.workerGroup = new NioEventLoopGroup(1);
}
@SuppressWarnings("unchecked")
public void start() throws Exception {
URI uri = new URI(this.uri);
String scheme = (uri.getScheme() == null) ? "http" : uri.getScheme();
if (!"http".equalsIgnoreCase(scheme)) {
System.err.println("Only HTTP is supported.");
return;
}
int port = uri.getPort();
if (port == -1) {
port = 80;
}
Class<? extends SocketChannel> channelClass = NioSocketChannel.class;
final int numThreads = 1;
ClassLoader loader = getClass().getClassLoader();
if (epollAvailable != null && epollAvailable.booleanValue()) {
try {
channelClass = (Class<? extends SocketChannel>)
Class.forName("io.netty.channel.epoll.EpollSocketChannel", false, loader);
Class<?> clazz = Class.forName("io.netty.channel.epoll.EpollEventLoopGroup", true, loader);
Constructor<?> constructor = clazz.getConstructor(int.class);
this.workerGroup = (EventLoopGroup) constructor.newInstance(numThreads);
LOG.info("use Epoll Transport");
} catch (Throwable th) {
if (th instanceof ClassNotFoundException) {
LOG.info("epoll linux is not in classpath");
} else {
LogUtil.warn(LOG, th, "could not use Epoll transport");
}
channelClass = null;
this.workerGroup = null;
}
} else if (kqueueAvailable != null && kqueueAvailable.booleanValue()) {
try {
channelClass = (Class<? extends SocketChannel>)
Class.forName("io.netty.channel.kqueue.KQueueSocketChannel", false, loader);
Class<?> clazz = Class.forName("io.netty.channel.kqueue.KQueueEventLoopGroup",
true, loader);
Constructor<?> constructor = clazz.getConstructor(int.class);
this.workerGroup = (EventLoopGroup) constructor.newInstance(numThreads);
LOG.info("Use KQueue Transport");
} catch (Exception ex) {
LogUtil.warn(LOG, ex, "could not use KQueue transport");
channelClass = null;
this.workerGroup = null;
}
}
if (this.workerGroup == null) {
channelClass = NioSocketChannel.class;
this.workerGroup = new NioEventLoopGroup(numThreads);
}
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(workerGroup)
.option(ChannelOption.SO_KEEPALIVE, true)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 60000)
.channel(channelClass)
.handler(new HttpClientInitializer());
String host = (uri.getHost() == null) ? "127.0.0.1" : uri.getHost();
// Make the connection attempt.
this.channel = bootstrap.connect(host, port).syncUninterruptibly().channel();
}
public void send(FullHttpRequest request) throws OcspRequestorException {
if (!channel.isActive()) {
throw new OcspRequestorException("channel is not active");
}
try {
latch.await(5, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
throw new OcspRequestorException("sending poll is full");
}
incrementPendingRequests();
ChannelFuture future = this.channel.writeAndFlush(request);
future.awaitUninterruptibly();
}
public void shutdown() {
if (channel != null) {
channel = null;
}
this.workerGroup.shutdownGracefully();
}
private void incrementPendingRequests() {
synchronized (latch) {
if (++pendingRequests >= queueSize) {
if (latch.getCount() == 0) {
latch.countUp();
}
}
}
}
private void decrementPendingRequests() {
synchronized (latch) {
if (--pendingRequests < queueSize) {
final int count = (int) latch.getCount();
if (count > 0) {
while (latch.getCount() != 0) {
latch.countDown();
}
} else if (count < 0) {
while (latch.getCount() != 0) {
latch.countUp();
}
}
}
}
}
}
| [
"[email protected]"
] | |
5f232312f771a016b2d1577e69fabd001e892abf | 792361f175acea714ba5b10c58e679e27ea59d9b | /Lab_2/CrypArgumentException.java | 51d45c4af35a8c0aeacf5cf732ecd02a3be00f16 | [] | no_license | NigelNelson/Software_Component_Design | ceb9ef0106e034ac67dddc9d31d126d6d4d4ca46 | c972807df66ed34c35b792c30c0e8853855b3cb9 | refs/heads/main | 2023-03-14T19:03:07.558635 | 2021-03-08T23:41:34 | 2021-03-08T23:41:34 | 345,816,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package nelsonni;
/**
* This class represents an error that happens while running the CrypStick program.
*
* By using it, we are able to distinguish between errors that our code generates
* and general Java errors that we do not anticipate.
*/
public class CrypArgumentException extends IllegalArgumentException {
public CrypArgumentException(String message, Throwable cause) {
super(message, cause);
}
public CrypArgumentException(String s) {
super(s);
}
public CrypArgumentException(Throwable cause) {
super(cause);
}
}
| [
"[email protected]"
] | |
abad9e86f152fa7682bc3f010bb893fa3bd5a095 | b6d520e087d98a3d667e126902add293adfb8431 | /src/二叉搜索树_BST/映射_map/printer/Strings.java | dbcf7d3ba9b40a87b7b01904cdf3d4dad5ec52a6 | [] | no_license | zyh2316549044/data_structure | 04821e88890c3a6b74aa13b65c14b73b3ff0689e | 50f4dc8c5a99e1844c7b4df9d5da3718b3623cf3 | refs/heads/master | 2022-06-14T06:17:47.778717 | 2020-05-07T05:25:11 | 2020-05-07T05:25:11 | 261,954,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package 映射_map.printer;
public class Strings {
public static String repeat(String string, int count) {
if (string == null) return null;
StringBuilder builder = new StringBuilder();
while (count-- > 0) {
builder.append(string);
}
return builder.toString();
}
public static String blank(int length) {
if (length < 0) return null;
if (length == 0) return "";
return String.format("%" + length + "s", "");
}
}
| [
"[email protected]"
] | |
5d45704e71e60eb199835cd6d9ddc9c243e112a2 | f426273c8c6546bc90b699bd3644c646721704ab | /src/main/java/com/example/course/model/converters/BankParseIn.java | b01a34ca660e349e38b24a007e6d8cf93dd70844 | [] | no_license | argosumy/RestServise | 9a4eb8625b7253f5dfaf87105eefeae47a7fe21c | 74b722d94abfb00dac4a07f5a5a4d0ec5d1cf8d1 | refs/heads/master | 2021-03-16T16:10:17.242285 | 2020-12-28T12:00:50 | 2020-12-28T12:00:50 | 246,916,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.example.course.model.converters;
import com.example.course.model.exchange.Exchange;
import org.json.JSONException;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
public interface BankParseIn {
public Exchange parserXmlDom(String xmlDom) throws IOException, SAXException, ParserConfigurationException;
public Exchange parseJson(String json) throws JSONException;
public String creatURL(String date, String format, String url);
public TypeBank.typeBank getTipeBank();
}
| [
"[email protected]"
] | |
10cb0ce0e74c8cf72a17f9e70ae870ccb5f55098 | 77e2db8319e06e09e3e42ed73a48c21c9858d2ef | /studios/icvfx/pipeline-local/src/com/intelligentcreatures/pipeline/plugin/WtmCollection/v1_0_0/stages/NukeReadStage.java | 2ef905dc309f48226403a8fbf43b22196323bc96 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | JimCallahan/Pipeline | 8e47b6124d322bb063e54d3a99b3ab273e8f825e | 948ea80b84e13de69f049210b63e1d58f7a8f9de | refs/heads/master | 2021-01-10T18:37:22.859871 | 2015-10-26T21:05:21 | 2015-10-26T21:05:21 | 21,285,228 | 10 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,751 | java | // $Id: NukeReadStage.java,v 1.5 2008/03/23 05:09:58 jim Exp $
package com.intelligentcreatures.pipeline.plugin.WtmCollection.v1_0_0.stages;
import com.intelligentcreatures.pipeline.plugin.WtmCollection.v1_0_0.*;
import us.temerity.pipeline.*;
import us.temerity.pipeline.builder.*;
import us.temerity.pipeline.builder.BuilderInformation.StageInformation;
import us.temerity.pipeline.stages.*;
import java.util.*;
/*------------------------------------------------------------------------------------------*/
/* N U K E R E A D S T A G E */
/*------------------------------------------------------------------------------------------*/
/**
* Creates a node which uses the NukeRead action.
*/
public
class NukeReadStage
extends StandardStage
{
/*----------------------------------------------------------------------------------------*/
/* C O N S T R U C T O R */
/*----------------------------------------------------------------------------------------*/
/**
* Construct a new stage.
*
* @param name
* The name of the stage.
*
* @param desc
* A description of what the stage should do.
*
* @param stageInfo
* Class containing basic information shared among all stages.
*
* @param context
* The {@link UtilContext} that this stage acts in.
*
* @param client
* The instance of Master Manager that the stage performs all its actions in.
*
* @param nodeName
* The name of the node that is to be created.
*
* @param imageName
* The name of source image node.
*/
protected
NukeReadStage
(
String name,
String desc,
StageInformation stageInfo,
UtilContext context,
MasterMgrClient client,
String nodeName,
String imageName,
PluginContext action
)
throws PipelineException
{
super(name, desc,
stageInfo, context, client,
nodeName, "nk",
null,
action);
addLink(new LinkMod(imageName, LinkPolicy.Dependency));
addSingleParamValue("ImageSource", imageName);
}
/**
* Construct a new stage.
*
* @param stageInfo
* Class containing basic information shared among all stages.
*
* @param context
* The {@link UtilContext} that this stage acts in.
*
* @param client
* The instance of Master Manager that the stage performs all its actions in.
*
* @param nodeName
* The name of the node that is to be created.
*
* @param imageName
* The name of source image node.
*/
public
NukeReadStage
(
StageInformation stageInfo,
UtilContext context,
MasterMgrClient client,
String nodeName,
String imageName
)
throws PipelineException
{
this("NukeRead",
"Creates a node which uses the NukeRead action.",
stageInfo, context, client,
nodeName, imageName,
new PluginContext("NukeRead"));
}
/**
* Construct a new stage.
*
* @param stageInfo
* Class containing basic information shared among all stages.
*
* @param context
* The {@link UtilContext} that this stage acts in.
*
* @param client
* The instance of Master Manager that the stage performs all its actions in.
*
* @param nodeName
* The name of the node that is to be created.
*
* @param imageName
* The name of source image node.
*
* @param missingFrames
* How to handle missing frames.
*/
public
NukeReadStage
(
StageInformation stageInfo,
UtilContext context,
MasterMgrClient client,
String nodeName,
String imageName,
String missingFrames
)
throws PipelineException
{
this(stageInfo, context, client,
nodeName, imageName);
if(missingFrames != null)
addSingleParamValue("MissingFrames", missingFrames);
}
/*----------------------------------------------------------------------------------------*/
/* O V E R R I D E S */
/*----------------------------------------------------------------------------------------*/
/**
* See {@link BaseStage#getStageFunction()}
*/
@Override
public String
getStageFunction()
{
return ICStageFunction.aNukeScript;
}
/*----------------------------------------------------------------------------------------*/
/* S T A T I C I N T E R N A L S */
/*----------------------------------------------------------------------------------------*/
private static final long serialVersionUID = 7286056856278936588L;
}
| [
"[email protected]"
] | |
ddd651670fc5741760befe71fc01ff1ef0b99862 | a12962dda3ab01d5bb40472c74a6f132b96cdc41 | /smarthome_wl_simplify--/src/main/java/com/fbee/smarthome_wl/adapter/EquesArlarmAdapter.java | 675396cb3ed0377c93b77ef988b1159ce3ac1b00 | [] | no_license | sengeiou/smarthome_wl_master1 | bfc6c0447e252074f52eec71f09711f1258e8d5f | f69359df5e38d9283741621f82f5f17ae0b58c86 | refs/heads/master | 2021-10-10T02:13:34.351874 | 2019-01-06T12:51:56 | 2019-01-06T12:51:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,105 | java | package com.fbee.smarthome_wl.adapter;
import android.content.Context;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.fbee.smarthome_wl.R;
import com.fbee.smarthome_wl.bean.EquesAlarmInfo;
import com.fbee.smarthome_wl.bean.SeleteEquesDeviceInfo;
import com.fbee.smarthome_wl.utils.ImageLoader;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* Created by WLPC on 2016/12/14.
*/
public class EquesArlarmAdapter extends BaseAdapter {
private final List<EquesAlarmInfo.AlarmsEntity> alarms;
private final List<SeleteEquesDeviceInfo> seletes;
private boolean b;
private List<URL> urls;
private String devName;
private HashMap<Integer, Boolean> isSelected;
public int isCheckBoxVisiable;
public static final int CHECKBOX_GONE = 2;
private Context context;
public EquesArlarmAdapter(Context context, String devName, List<EquesAlarmInfo.AlarmsEntity> alarms,
List<SeleteEquesDeviceInfo> seletes, boolean b, List<URL> urls) {
isSelectedMap = new HashMap<Integer, Boolean>();
this.b = b;
this.seletes = seletes;
this.alarms = alarms;
this.context = context;
this.devName = devName;
this.urls = urls;
}
public void setB(boolean b) {
this.b = b;
}
public void addAllData(List<EquesAlarmInfo.AlarmsEntity> alarms) {
isSelectedMap = null;
this.alarms.addAll(alarms);
notifyDataSetChanged();
}
private HashMap<Integer, Boolean> isSelectedMap;
public boolean getisSelectedAt(int position) {
//如果当前位置的key值为空,则表示该item未被选择过,返回false,否则返回true
if (isSelectedMap.get(position) != null) {
return isSelectedMap.get(position);
}
return false;
}
public void setItemisSelectedMap(int position, boolean isSelectedMap) {
this.isSelectedMap.put(position, isSelectedMap);
notifyDataSetChanged();
}
@Override
public int getCount() {
return (alarms == null) ? 0 : alarms.size();
}
@Override
public Object getItem(int position) {
return alarms.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
EquesArlarmAdapter.ViewHolder holder = null;
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.item_eques_visitor_list, null);
holder = new EquesArlarmAdapter.ViewHolder();
holder.iv = (ImageView) convertView.findViewById(R.id.iv);
holder.title = (TextView) convertView.findViewById(R.id.title);
holder.summary = (TextView) convertView.findViewById(R.id.summary);
holder.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox);
convertView.setTag(holder);
} else {
holder = (EquesArlarmAdapter.ViewHolder) convertView.getTag();
}
if (b) {
isCheckBoxVisiable = CheckBox.VISIBLE;
} else {
isCheckBoxVisiable = View.GONE;
}
holder.checkBox.setVisibility(isCheckBoxVisiable);
SimpleDateFormat formatter = new SimpleDateFormat(
"yyyy年MM月dd日 HH:mm:ss");
EquesAlarmInfo.AlarmsEntity alarmsEntity = alarms.get(position);
if (alarmsEntity != null) {
Date curDate = new Date((alarmsEntity.getCreate() == 0) ? alarmsEntity.getTime() : alarmsEntity.getCreate());// 获取当前时间
String str = formatter.format(curDate);
holder.summary.setText(str);
int tag = alarmsEntity.getType();
if (tag == 3) {
holder.title.setText(devName + "猫眼单拍");
} else if (tag == 4) {
holder.title.setText(devName + "猫眼多拍");
} else if (tag == 5) {
holder.title.setText(devName + "猫眼视频");
}
}
ImageLoader.load(Uri.parse(urls.get(position).toString()), holder.iv, R.mipmap.item_visitor, R.mipmap.item_visitor);
holder.checkBox.setChecked(getisSelectedAt(position));
// holder.iv.setImageBitmap(bitmaps.get(position));
// final int myposition = position;
// holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// if(!buttonView.isPressed())return;
// onItemCheckedChangedListener.onItemCheckedChanged(buttonView, myposition, isChecked);
// }
// });
// if(isCheckBoxVisiable==CHECKBOX_GONE){
// holder.checkBox.setVisibility(View.GONE);
// }else if(isCheckBoxVisiable==CHECKBOX_VISIBLE){
// holder.checkBox.setVisibility(View.VISIBLE);
// holder.checkBox.setChecked(isSelected.get(position));
//
// }
return convertView;
}
//
// public interface OnItemCheckedChanged {
// public void onItemCheckedChanged(CompoundButton view, int position, boolean isChecked);
// }
// private OnItemCheckedChanged onItemCheckedChangedListener;
// public void setOnItemCheckedChangedListener(OnItemCheckedChanged onItemCheckedChangedListener) {
// this.onItemCheckedChangedListener = onItemCheckedChangedListener;
// }
public class ViewHolder {
public ImageView iv;
public TextView title;
public TextView summary;
public CheckBox checkBox;
}
}
| [
"[email protected]"
] | |
f6ff641050cfb28147b60edab80807450fe0e4db | aa63e6cc382dcd1603f4d4950c5da06f8c8815a4 | /java7-fs-dropbox/src/main/java/com/github/fge/fs/dropbox/attr/DropboxBasicFileAttributes.java | 7caa16f322b9b6522f4c99b84e83d43cf5f29d4b | [] | no_license | fge/java7-filesystems | d205fd20a21a917bf38ab28a862fd914700a6f6c | f54355190e5e1f565b3187eb59087d51c6346fbc | refs/heads/master | 2023-03-28T19:11:08.489416 | 2015-12-19T17:25:26 | 2015-12-19T17:25:26 | 47,763,462 | 7 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | package com.github.fge.fs.dropbox.attr;
import com.dropbox.core.v2.DbxFiles;
import com.github.fge.fs.api.attr.attributes.AbstractBasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.util.Date;
public final class DropboxBasicFileAttributes
extends AbstractBasicFileAttributes
{
private final DbxFiles.Metadata metadata;
public DropboxBasicFileAttributes(final DbxFiles.Metadata metadata)
{
this.metadata = metadata;
}
@Override
public boolean isRegularFile()
{
return metadata instanceof DbxFiles.FileMetadata;
}
@Override
public boolean isDirectory()
{
return metadata instanceof DbxFiles.FolderMetadata;
}
@Override
public long size()
{
return isDirectory() ? 0L : ((DbxFiles.FileMetadata) metadata).size;
}
@Override
public FileTime lastModifiedTime()
{
if (isDirectory())
return EPOCH;
final Date modified = ((DbxFiles.FileMetadata) metadata).serverModified;
return FileTime.from(modified.toInstant());
}
}
| [
"[email protected]"
] | |
ac8c0b784d3b0a30575f5cfb05a65181898b7c98 | 5b18c2aa61fd21f819520f1b614425fd6bc73c71 | /src/main/java/com/sinosoft/claimzy/util/BLGetMaxNo.java | 05f2ea964d77eab86380297b32d55f580e21706f | [] | no_license | Akira-09/claim | 471cc215fa77212099ca385e7628f3d69f83d6d8 | 6dd8a4d4eedb47098c09c2bf3f82502aa62220ad | refs/heads/master | 2022-01-07T13:08:27.760474 | 2019-03-24T23:50:09 | 2019-03-24T23:50:09 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,821 | java | package com.sinosoft.claimzy.util;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.sinosoft.utility.error.UserException;
/**
* 获得上传批次类
* @author yewenxiang
*
*/
public class BLGetMaxNo {
public String getMaxNo(String groupNo) throws UserException, Exception{
String strWhere = "1=1 ";
BLPrpAgriMaxNo blAgriMaxNo = new BLPrpAgriMaxNo();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String newdate = sdf.format(date);
String batchNo="";
blAgriMaxNo.query(strWhere);
String seirNo= blAgriMaxNo.getArr(0).getGroupNo();
String maxNo = blAgriMaxNo.getArr(0).getMaxNo();
String newmaxNo ="";
DBPrpAgriMaxNo dbAgriMaxNo = new DBPrpAgriMaxNo();
PrpAgriMaxNoSchema schema = new PrpAgriMaxNoSchema();
if(!seirNo.substring(6,14).equals(newdate.substring(0,8))){
newmaxNo="00001";
seirNo=groupNo+newdate;
dbAgriMaxNo.setGroupNo(seirNo);
int num = Integer.parseInt(newmaxNo)+1;
DecimalFormat dec = new DecimalFormat("00000");
String siralNo = dec.format(num);
dbAgriMaxNo.setMaxNo(siralNo);
blAgriMaxNo.setArr(schema);
dbAgriMaxNo.update(maxNo);
batchNo =seirNo+newmaxNo;
}else{
seirNo=groupNo+newdate;
dbAgriMaxNo.setGroupNo(seirNo);
int num = Integer.parseInt(maxNo)+1;
DecimalFormat dec = new DecimalFormat("00000");
String siralNo = dec.format(num);
dbAgriMaxNo.setMaxNo(siralNo);
blAgriMaxNo.setArr(schema);
dbAgriMaxNo.update(maxNo);
batchNo =seirNo+maxNo;
}
DBPrpAgriMaxUse dbAgriMaxUse = new DBPrpAgriMaxUse();
dbAgriMaxUse.setGroupNo(groupNo+newdate);
dbAgriMaxUse.setMaxNo(maxNo);
dbAgriMaxUse.insert();
return batchNo;
}
}
| [
"[email protected]"
] | |
00d3cf2f8c9b134e114df07c7ea31922cf628123 | 8e44449fe51ea8afc88a6025c0199be4671a9bd1 | /smartcontract/billing-contract/src/main/java/ru/leadersofdigitalsvo/billingcontract/BillContext.java | 3ef086cdb4c9fd47e953eace385d208277987b00 | [] | no_license | bukhmastov/leadersofdigitalsvo | 7756f5f94b6b7d03efdad4106dbe76789c7918f2 | 3bac8928418f13852589da9261fbf7fbaf176031 | refs/heads/master | 2023-07-22T05:20:15.530476 | 2021-09-05T02:33:38 | 2021-09-05T02:33:38 | 402,870,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package ru.leadersofdigitalsvo.billingcontract;
import org.hyperledger.fabric.contract.Context;
import org.hyperledger.fabric.shim.ChaincodeStub;
public class BillContext extends Context {
public BillContext(ChaincodeStub stub) {
super(stub);
this.billList = new BillList(this);
}
public BillList billList;
}
| [
"[email protected]"
] | |
fd1b52bedefac04e9ae6500a4d7238a03fde4f1c | bb6cf94ffcea85bfb06f639f2c424e4ab5a24445 | /BECE/rcm-rest_gf/src/main/java/com/yk/rcm/pre/service/impl/PreMeetingInfoService.java | b0969b1dfad3bff84b2a63d6e32658c0b5a8a6b5 | [] | no_license | wuguosong/riskcontrol | 4c0ef81763f45e87b1782e61ea45a13006ddde95 | d7a54a352f8aea0e00533d76954247a9143ae56d | refs/heads/master | 2022-12-18T03:12:52.449005 | 2020-03-10T15:38:39 | 2020-03-10T15:38:39 | 246,329,490 | 0 | 0 | null | 2022-12-16T05:02:28 | 2020-03-10T14:53:15 | JavaScript | UTF-8 | Java | false | false | 4,842 | java | package com.yk.rcm.pre.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import util.ThreadLocalUtil;
import util.Util;
import com.mongodb.BasicDBObject;
import com.yk.common.IBaseMongo;
import com.yk.rcm.formalAssessment.dao.IFormalAssessmentInfoMapper;
import com.yk.rcm.pre.dao.IPreMeetingInfoMapper;
import com.yk.rcm.pre.service.IPreMeetingInfoService;
import common.Constants;
import common.PageAssistant;
/**
* 投标评审参会信息service
* @author shaosimin
*/
@Service
@Transactional
public class PreMeetingInfoService implements IPreMeetingInfoService {
@Resource
private IPreMeetingInfoMapper PreMeetingInfoMapper;
@Resource
private IBaseMongo baseMongo;
@Override
public void queryInformationList(PageAssistant page) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("page", page);
if(!ThreadLocalUtil.getIsAdmin()){
//管理员能看所有的
params.put("createBy", ThreadLocalUtil.getUserId());
}
if(page.getParamMap() != null){
params.putAll(page.getParamMap());
}
List<Map<String, Object>> list = this.PreMeetingInfoMapper.queryInformationList(params);
page.setList(list);
}
@Override
public void queryInformationListed(PageAssistant page) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("page", page);
if(!ThreadLocalUtil.getIsAdmin()){
//管理员能看所有的
params.put("createBy", ThreadLocalUtil.getUserId());
}
if(page.getParamMap() != null){
params.putAll(page.getParamMap());
}
List<Map<String, Object>> list = this.PreMeetingInfoMapper.queryInformationListed(params);
page.setList(list);
}
@Override
public void addMeetingInfo(String json) {
Document pfr = Document.parse(json);
Document meeting = new Document();
Map<String, Object> meetingInfo = new HashMap<String, Object>();
//修改oracle的stage状态
Map<String, Object> map = new HashMap<String, Object>();
map.put("stage", "3.5");
map.put("need_meeting", "1");
map.put("metting_commit_time", Util.getTime());
map.put("businessId", pfr.getString("_id"));
this.PreMeetingInfoMapper.updateStage(map);
//参会信息保存到mongo投标评审apply下
Document apply = (Document) pfr.get("apply");
String projectName = apply.getString("projectName");
meeting.put("projectName", projectName);
meeting.put("user_id", ThreadLocalUtil.getUserId());
meeting.put("serviceType", apply.get("serviceType"));
meeting.put("isUrgent", pfr.get("isUrgent"));
meeting.put("projectRating", pfr.get("projectRating"));
meeting.put("projectType1", pfr.get("projectType1"));
meeting.put("projectType2", pfr.get("projectType2"));
meeting.put("projectType3", pfr.get("projectType3"));
meeting.put("ratingReason", pfr.get("ratingReason"));
meeting.put("participantMode", pfr.get("participantMode"));
meeting.put("division", pfr.get("division"));
meeting.put("investment", pfr.get("investment"));
meeting.put("agenda", pfr.get("agenda"));
meeting.put("contacts", pfr.get("contacts"));
meeting.put("telephone", pfr.get("telephone"));
meeting.put("create_date", Util.getTime());
meetingInfo.put("meetingInfo", meeting);
String id = pfr.getString("_id");
meetingInfo.put("_id",new ObjectId(id));
this.baseMongo.updateSetByObjectId(id, meetingInfo, Constants.RCM_PRE_INFO);
}
@Override
public Map<String, Object> queryMeetingInfoById(String id) {
Map<String, Object> queryByCondition = baseMongo.queryById(id, Constants.RCM_PRE_INFO);
return queryByCondition;
}
@Override
public void updateStageById(String businessId, String stage,String need_meeting) {
Map<String, Object> map = new HashMap<String, Object>();
String[] businessIdArr = businessId.split(",");
for (String id : businessIdArr) {
map.put("businessId", id);
map.put("stage", "9");
map.put("need_meeting", "0");
map.put("metting_commit_time", Util.getTime());
this.PreMeetingInfoMapper.updateStage(map);
}
}
@Override
public PageAssistant queryNotMeetingList(PageAssistant page) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("page", page);
if(!ThreadLocalUtil.getIsAdmin()){
//管理员能看所有的
params.put("createBy", ThreadLocalUtil.getUserId());
}
if(page.getParamMap() != null){
params.putAll(page.getParamMap());
}
String orderBy = page.getOrderBy();
if(orderBy == null){
orderBy = " notice_create_time desc ";
}
params.put("orderBy", orderBy);
List<Map<String,Object>> list = this.PreMeetingInfoMapper.queryNotMeetingList(params);
page.setList(list);
return page;
}
}
| [
"[email protected]"
] | |
cf2c0fc4121c4dbc55f813dc404ff45f87a050c5 | d287fd77e5c61d1305a8799998024152dc1646c1 | /src/OOP/Nested/Type/Easy/Question1/Application.java | 46d8e604a8aa650048cf1255d3ab1657ec7f0b15 | [] | no_license | Prilipko/quizzes | 2ae980c2b6fab7a6724e542174b1a0cf5bf0c49b | fc6e1a2353416afab9e2109f3beb9947561fa439 | refs/heads/master | 2016-08-12T14:33:55.675912 | 2015-12-17T20:58:15 | 2015-12-17T20:58:41 | 48,197,573 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package OOP.Nested.Type.Easy.Question1;
//В данном примере:
public class Application {
public void f() {
X x = new X();
}
public static class X {
}
}
//A. создается anonymous inner class
//B. создается not anonymous inner class
//C. создается anonymous static nested class
//>D. создается not anonymous static nested class
//E. данный пример не компилируется | [
"[email protected]"
] | |
a6e34464e7325143e7f1accd5ed3d44921c0d54b | 20873bf3eec5b00f5bbe6756b7a4a1c993663588 | /app/src/main/java/com/android/solulabtest/utils/LocationAddress.java | e3250aea8ee26f53c26ed3e548c5be9398a207b7 | [] | no_license | fesu/SoluLabTest | 57382e33d19ca4d2d420c54c8f5d54e8cf7c65d0 | d0196abd5338a680427b224fa8051c8bb849f1cd | refs/heads/master | 2020-08-06T04:52:49.145446 | 2019-10-10T12:04:38 | 2019-10-10T12:04:38 | 212,841,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,013 | java | package com.android.solulabtest.utils;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
public class LocationAddress {
private static final String TAG = "LocationAddress";
public static void getAddressFromLocation(final double latitude, final double longitude,
final Context context, final Handler handler) {
Thread thread = new Thread() {
@Override
public void run() {
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
String result = null;
try {
List<Address> addressList = geocoder.getFromLocation(
latitude, longitude, 1);
if (addressList != null && addressList.size() > 0) {
Address address = addressList.get(0);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {
sb.append(address.getAddressLine(i)).append("\n");
}
if (address.getMaxAddressLineIndex() == 0)
sb.append(address.getAddressLine(0)).append("\n");
sb.append("\nLocality : ").append(address.getLocality()).append("\n");
sb.append("Postal code : ").append(address.getPostalCode()).append("\n");
sb.append("Country : ").append(address.getCountryName());
result = sb.toString();
}
} catch (IOException e) {
Log.e(TAG, "Unable connect to Geocoder", e);
} finally {
Message message = Message.obtain();
message.setTarget(handler);
if (result != null) {
message.what = 1;
Bundle bundle = new Bundle();
result = "Latitude: " + latitude + " Longitude: " + longitude +
"\n\nAddress: " + result;
bundle.putString("address", result);
message.setData(bundle);
} else {
message.what = 1;
Bundle bundle = new Bundle();
result = "Latitude: " + latitude + " Longitude: " + longitude +
"\n Unable to get address for this lat-long.";
bundle.putString("address", result);
message.setData(bundle);
}
message.sendToTarget();
}
}
};
thread.start();
}
} | [
"[email protected]"
] | |
6aeda817a132f3effb2473fac14b8bf7e0177136 | b5f0af4f76c754aa5f4f4e24282ee30d9d667420 | /Test_list2/app/src/main/java/com/chadfunckes/test_list2/View_Adapters/MainExpandableListAdapter.java | 434e7681b13bcd927934611d426a5e7529892b36 | [] | no_license | ChadFunckes/MasterListAPP | 65739f83b6465aa76ea12e7daec6d7bea2e9ca95 | 396e45c6011a77f7c9dbf92b8211b2e784bd998b | refs/heads/master | 2020-12-11T05:45:14.302018 | 2016-06-23T01:24:24 | 2016-06-23T01:24:24 | 48,305,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,452 | java | package com.chadfunckes.test_list2.View_Adapters;
import java.util.HashMap;
import java.util.List;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.chadfunckes.test_list2.Alarm_Activity;
import com.chadfunckes.test_list2.Models.Group;
import com.chadfunckes.test_list2.Models.ListItem;
import com.chadfunckes.test_list2.MainActivity;
import com.chadfunckes.test_list2.MapsActivity;
import com.chadfunckes.test_list2.R;
public class MainExpandableListAdapter extends BaseExpandableListAdapter {
private final String TAG = "MainExpandableListAdapter";
private final Context _context;
private final List<Group> _listDataHeader; // header groups
// child data in format of header Group, child object
private final HashMap<Group, List<ListItem>> _listDataChild;
public MainExpandableListAdapter(Context context, List<Group> listDataHeader,
HashMap<Group, List<ListItem>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
Log.d(TAG, "on get child, Group pos is: " + groupPosition + " child position is " + childPosititon);
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final ListItem thisChild = (ListItem) getChild(groupPosition,childPosition);
final String childText = thisChild.name;
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_item, null);
}
// set text for the title
TextView txtListChild = (TextView) convertView.findViewById(R.id.item_text);
txtListChild.setText(childText); // set text to the name of the object
if (thisChild.finished == 1) txtListChild.setPaintFlags(txtListChild.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); // set strikethough if item is finished
else txtListChild.setPaintFlags(txtListChild.getPaintFlags() & (~ Paint.STRIKE_THRU_TEXT_FLAG));
// set image button onClicks for child items
ImageView trash = (ImageView) convertView.findViewById(R.id.deleteItem);
trash.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(_context).setTitle("Confirm Delete")
.setMessage("Are you sure you want to delete " + thisChild.name + "?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MainActivity.database.removeItem(thisChild._id);
MainActivity.redrawList();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// canceled
}
}).show();
}
});
ImageView alarm = (ImageView)convertView.findViewById(R.id.addAlarm);
alarm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "alarm hit on child " + childText);
Intent intent = new Intent(_context, Alarm_Activity.class);
intent.putExtra("IID", thisChild._id);
intent.putExtra("GID", thisChild.groupID);
intent.putExtra("GROUP_NAME", MainActivity.database.getGroupName(thisChild.groupID));
intent.putExtra("ITEM_NAME", thisChild.name);
intent.putExtra("CALLED_ON", "ITEM");
_context.startActivity(intent);
}
});
ImageView map = (ImageView)convertView.findViewById(R.id.addMap);
map.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "map hit on child " + childText);
Intent intent = new Intent(_context, MapsActivity.class);
intent.putExtra("CALLED_ON", "ITEM");
intent.putExtra("GID", thisChild.groupID);
intent.putExtra("GROUP_NAME", MainActivity.database.getGroupName(thisChild.groupID));
intent.putExtra("IID", thisChild._id);
intent.putExtra("ITEM_NAME", thisChild.name);
_context.startActivity(intent);
}
});
return convertView;
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.size();
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return _listDataHeader.get(groupPosition)._id;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return _listDataChild.get(_listDataHeader.get(groupPosition)).get(childPosition)._id;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
final Group thisGroup = (Group) getGroup(groupPosition);
String headerTitle = thisGroup.name;
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
}
// set the text to be used in the list
TextView lblListHeader = (TextView) convertView
.findViewById(R.id.lblListHeader);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
// set onClicks for the groups
ImageView trash = (ImageView) convertView.findViewById(R.id.trashcan);
trash.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(_context).setTitle("Confirm Delete")
.setMessage("Are you sure you want to delete " + thisGroup.name + " and all sub tasks?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MainActivity.database.removeGroup(thisGroup._id);
MainActivity.redrawList();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// cancell
}
}).show();
}
});
ImageView alarm = (ImageView) convertView.findViewById(R.id.alarmclock);
alarm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "alarm button for Group " + thisGroup.name);
Intent intent = new Intent(_context, Alarm_Activity.class);
intent.putExtra("IID", -1);
intent.putExtra("GID", thisGroup._id);
intent.putExtra("GROUP_NAME", thisGroup.name);
intent.putExtra("CALLED_ON", "GROUP");
_context.startActivity(intent);
}
});
ImageView map = (ImageView) convertView.findViewById(R.id.map);
map.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "Map clicked for Group " + thisGroup.name);
Intent intent = new Intent(_context, MapsActivity.class);
intent.putExtra("CALLED_ON", "GROUP");
intent.putExtra("GID", thisGroup._id);
intent.putExtra("GROUP_NAME", thisGroup.name);
_context.startActivity(intent);
}
});
ImageView addItem = (ImageView) convertView.findViewById(R.id.addItem);
addItem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Add item into Group via dialog box
final EditText input = new EditText(_context);
new AlertDialog.Builder(_context).setView(input)
.setTitle("Add Item")
.setMessage("Enter new Item")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (input.getText().toString().equals("")){
Toast.makeText(_context, "You must enter a name", Toast.LENGTH_SHORT).show();
}
else {
ListItem newItem = new ListItem();
newItem.name = input.getText().toString();
MainActivity.database.addItem(thisGroup._id, newItem);
MainActivity.redrawList();
}
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
}).show();
}
});
return convertView;
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
} | [
"[email protected]"
] | |
284f91130270d16b284c33289bf0a9675236ce42 | 60a2be704f988c4d6005cbe5fd990dcd722546eb | /informatorio-parent/informatorio-persist/src/main/java/org.informatorio.site.persist/exceptions/NoStudentException.java | 2ee2a2f624d5681ab33cdc20812b976508b3c49b | [] | no_license | dariov21/informatorioVirtual | 53b7ff684740e0d3c887f1a53f9d4ad8e439148e | bc1cabcdbaf1def7bc4a923e7ab60be5e34f561a | refs/heads/master | 2021-01-23T16:41:23.663465 | 2013-01-14T00:12:31 | 2013-01-14T00:12:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package org.informatorio.site.persist.exceptions;
/**
* Created with IntelliJ IDEA.
* User: nico
* Date: 06/01/13
* Time: 12:38
* To change this template use File | Settings | File Templates.
*/
public class NoStudentException extends Exception{
}
| [
"[email protected]"
] | |
a23029773b7bfa51c9e47264cac940d51143d95d | 35754739a031d157ed5bcb8074a66de0e44ba486 | /maven_rich/src/main/java/src/map/Hospital.java | 74605db925f240c53c3828903803206e5f0a1e85 | [] | no_license | almazhou/RichGameSourceCode | 902ba215e2f2eaf868de8bcb91ea41d71ec363be | bd357242648d591c7533db68b21c13717516768f | refs/heads/master | 2016-09-05T18:43:16.648151 | 2013-05-14T12:03:35 | 2013-05-14T12:03:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package src.map;
import src.player.Player;
public class Hospital extends LandForm {
Hospital(int index){
super("H",index);
}
@Override
public void PassByImpact(Player player) {
if(player.getTimeInHospital()>0) {
System.out.println(this.name+">玩家仍然在医院养病!还有"+player.getTimeInHospital()+"天出院!");
return;
}
}
}
| [
"[email protected]"
] | |
125068732c2a78d3d734ca72c11ae660fc25c831 | e437dbcd6430fbbae3efa57f94d9846eef664f26 | /src/main/java/Licht/Kronleuchter.java | 6e14e1bc006f2cce5acdd6111b70baafdffe44c0 | [] | no_license | slimouGit/TTD | 4afe2ef15e7352f13038cedac9b5e9969ae42cc0 | 9b8f63500847947271dfc2295f721537a90eba75 | refs/heads/master | 2022-04-12T21:03:08.596906 | 2020-02-23T11:28:57 | 2020-02-23T11:28:57 | 190,848,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package Licht;
public class Kronleuchter implements Licht{
private boolean an = false;
public boolean isAn() {
return false;
}
public void schalteAus() {
this.an = false;
System.out.println("Der Kronleuchter geht aus.");
}
public void schalteAn() {
this.an = true;
System.out.println("Der Kronleuchter erstrahlt in güldenem Glanze!");
}
}
| [
"[email protected]"
] | |
19f2fa7191fa390b314f38339d45ebbacd8b15a1 | ec286a5e1f4c330f30596753c45e4b8d4c111294 | /src/main/java/com/ppdai/riches/adminanalysis/service/sys/impl/UserServiceImpl.java | 0433d15e2dd1d118713582d142eb6908cdd3ee6a | [] | no_license | wu05281/admin-web | 733d83a78db04345b3aa522c87c0edfc4763e88d | 568c65fbedeb645ca14d986ef2e59a863065636f | refs/heads/master | 2021-01-01T03:36:32.791912 | 2016-05-25T07:31:52 | 2016-05-25T07:31:52 | 59,634,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,314 | java | package com.ppdai.riches.adminanalysis.service.sys.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ppdai.riches.adminanalysis.dao.BaseDaoI;
import com.ppdai.riches.adminanalysis.framework.constant.GlobalConstant;
import com.ppdai.riches.adminanalysis.model.sys.Torganization;
import com.ppdai.riches.adminanalysis.model.sys.Tresource;
import com.ppdai.riches.adminanalysis.model.sys.Trole;
import com.ppdai.riches.adminanalysis.model.sys.Tuser;
import com.ppdai.riches.adminanalysis.pageModel.base.PageFilter;
import com.ppdai.riches.adminanalysis.pageModel.base.SessionInfo;
import com.ppdai.riches.adminanalysis.pageModel.sys.User;
import com.ppdai.riches.adminanalysis.service.base.ServiceException;
import com.ppdai.riches.adminanalysis.service.sys.UserServiceI;
import com.ppdai.riches.adminanalysis.utils.MD5Util;
@Service
public class UserServiceImpl implements UserServiceI {
@Autowired
private BaseDaoI<Tuser> userDao;
@Autowired
private BaseDaoI<Trole> roleDao;
@Autowired
private BaseDaoI<Torganization> organizationDao;
@Override
public void add(User u) {
Tuser t = new Tuser();
BeanUtils.copyProperties(u, t);
t.setIsdefault(1);
t.setOrganization( organizationDao.get(Torganization.class, u.getOrganizationId()));
List<Trole> roles = new ArrayList<Trole>();
if (u.getRoleIds() != null) {
for (String roleId : u.getRoleIds().split(",")) {
roles.add(roleDao.get(Trole.class, Long.valueOf(roleId)));
}
}
t.setRoles(new HashSet<Trole>(roles));
t.setPassword(MD5Util.md5(u.getPassword()));
t.setState(GlobalConstant.ENABLE);
t.setCreatedatetime(new Date());
userDao.save(t);
}
@Override
public void delete(Long id) {
Tuser t = userDao.get(Tuser.class, id);
del(t);
}
private void del(Tuser t) {
userDao.delete(t);
}
@Override
public void edit(User user) {
Tuser t = userDao.get(Tuser.class,user.getId());
t.setAge(user.getAge());
t.setLoginname(user.getLoginname());
t.setName(user.getName());
t.setOrganization(organizationDao.get(Torganization.class,user.getOrganizationId()));
List<Trole> roles = new ArrayList<Trole>();
if (user.getRoleIds() != null) {
for (String roleId : user.getRoleIds().split(",")) {
roles.add(roleDao.get(Trole.class, Long.valueOf(roleId)));
}
}
t.setRoles(new HashSet<Trole>(roles));
t.setSex(user.getSex());
t.setUsertype(user.getUsertype());
if(user.getPassword()!=null&&!"".equals(user.getPassword())){
t.setPassword(MD5Util.md5(user.getPassword()));
}
userDao.update(t);
}
@Override
public User get(Long id) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", id);
Tuser t = userDao.get("from Tuser t left join fetch t.roles role where t.id = :id", params);
User u = new User();
BeanUtils.copyProperties(t, u);
if(t.getOrganization()!=null){
u.setOrganizationId(t.getOrganization().getId());
u.setOrganizationName(t.getOrganization().getName());
}
if (t.getRoles() != null && !t.getRoles().isEmpty()) {
String roleIds = "";
String roleNames = "";
boolean b = false;
for (Trole role : t.getRoles()) {
if (b) {
roleIds += ",";
roleNames += ",";
} else {
b = true;
}
roleIds += role.getId();
roleNames += role.getName();
}
u.setRoleIds(roleIds);
u.setRoleNames(roleNames);
}
return u;
}
@Override
public User login(User user) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("loginname", user.getLoginname());
params.put("password", MD5Util.md5(user.getPassword()));
Tuser t = userDao.get("from Tuser t where t.loginname = :loginname and t.password = :password", params);
if (t != null) {
User u = new User();
BeanUtils.copyProperties(t, u);
return u;
}
return null;
}
@Override
public List<String> resourceList(Long id) {
List<String> resourceList = new ArrayList<String>();
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", id);
Tuser t = userDao.get(
"from Tuser t join fetch t.roles role join fetch role.resources resource where t.id = :id", params);
if (t != null) {
Set<Trole> roles = t.getRoles();
if ((roles != null) && !roles.isEmpty()) {
for (Trole role : roles) {
Set<Tresource> resources = role.getResources();
if ((resources != null) && !resources.isEmpty()) {
for (Tresource resource : resources) {
if ((resource != null) && (resource.getUrl() != null)) {
resourceList.add(resource.getUrl());
}
}
}
}
}
}
return resourceList;
}
@Override
public List<User> dataGrid(User user, PageFilter ph) {
List<User> ul = new ArrayList<User>();
Map<String, Object> params = new HashMap<String, Object>();
String hql = " from Tuser t ";
List<Tuser> l = userDao.find(hql + whereHql(user, params) + orderHql(ph), params, ph.getPage(), ph.getRows());
for (Tuser t : l) {
User u = new User();
BeanUtils.copyProperties(t, u);
Set<Trole> roles = t.getRoles();
if ((roles != null) && !roles.isEmpty()) {
String roleIds = "";
String roleNames = "";
boolean b = false;
for (Trole tr : roles) {
if (b) {
roleIds += ",";
roleNames += ",";
} else {
b = true;
}
roleIds += tr.getId();
roleNames += tr.getName();
}
u.setRoleIds(roleIds);
u.setRoleNames(roleNames);
}
if (t.getOrganization() != null) {
u.setOrganizationId(t.getOrganization().getId());
u.setOrganizationName(t.getOrganization().getName());
}
ul.add(u);
}
return ul;
}
@Override
public Long count(User user, PageFilter ph) {
Map<String, Object> params = new HashMap<String, Object>();
String hql = " from Tuser t ";
return userDao.count("select count(*) " + hql + whereHql(user, params), params);
}
private String whereHql(User user, Map<String, Object> params) {
String hql = "";
if (user != null) {
hql += " where 1=1 ";
if (user.getName() != null) {
hql += " and t.name like :name";
params.put("name", "%%" + user.getName() + "%%");
}
if(user.getOrganizationId()!=null){
hql += " and t.organization.id ="+user.getOrganizationId();
}
}
return hql;
}
private String orderHql(PageFilter ph) {
String orderString = "";
if ((ph.getSort() != null) && (ph.getOrder() != null)) {
orderString = " order by t." + ph.getSort() + " " + ph.getOrder();
}
return orderString;
}
@Override
public boolean editUserPwd(SessionInfo sessionInfo, String oldPwd, String pwd) {
Tuser u = userDao.get(Tuser.class, sessionInfo.getId());
if (u.getPassword().equalsIgnoreCase(MD5Util.md5(oldPwd))) {// 说明原密码输入正确
u.setPassword(MD5Util.md5(pwd));
return true;
}
return false;
}
@Override
public User getByLoginName(User user) {
Tuser t = userDao.get("from Tuser t where t.loginname = '"+user.getLoginname()+"'");
User u = new User();
if(t!=null){
BeanUtils.copyProperties(t, u);
}else{
return null;
}
return u;
}
}
| [
"[email protected]"
] | |
c920c9f7deff1a34d083be9b3af508ac5c957eb9 | 228d1530c99c6275602fcc3ed7cb3f7f21a827c6 | /src/main/java/io/pacworx/atp/autotrade/domain/binance/BinanceTickerStatistics.java | aff4f47fc00b45f6d3099b4c342dc41208d0d945 | [] | no_license | packowitz/atp-api | 4cdd684ff79e2f5065cc8943cf59899430b9d18e | d935798119d4ab23adc7dc99d055fd8aaf0aaed1 | refs/heads/master | 2021-01-13T07:21:50.345172 | 2018-06-06T23:00:00 | 2018-06-06T23:00:00 | 71,520,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,169 | java | package io.pacworx.atp.autotrade.domain.binance;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* 24 hour price change statistics for a ticker.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class BinanceTickerStatistics implements Comparable<BinanceTickerStatistics> {
/**
* Ticker symbol.
*/
private String symbol;
/**
* Price change during the last 24 hours.
*/
private String priceChange;
/**
* Price change, in percentage, during the last 24 hours.
*/
private String priceChangePercent;
/**
* Weighted average price.
*/
private String weightedAvgPrice;
/**
* Previous close price.
*/
private String prevClosePrice;
/**
* Last price.
*/
private String lastPrice;
/**
* Bid price.
*/
private String bidPrice;
/**
* Ask price.
*/
private String askPrice;
/**
* Open price 24 hours ago.
*/
private String openPrice;
/**
* Highest price during the past 24 hours.
*/
private String highPrice;
/**
* Lowest price during the past 24 hours.
*/
private String lowPrice;
/**
* Total volume during the past 24 hours.
*/
private BigDecimal volume;
/**
* Total quote volume during the past 24 hours.
*/
private BigDecimal quoteVolume;
/**
* Open time.
*/
private long openTime;
/**
* Close time.
*/
private long closeTime;
/**
* First trade id.
*/
private long firstId;
/**
* Last trade id.
*/
private long lastId;
/**
* Total number of trades during the last 24 hours.
*/
private long count;
public String getPriceChange() {
return priceChange;
}
public void setPriceChange(String priceChange) {
this.priceChange = priceChange;
}
public String getPriceChangePercent() {
return priceChangePercent;
}
public void setPriceChangePercent(String priceChangePercent) {
this.priceChangePercent = priceChangePercent;
}
public String getWeightedAvgPrice() {
return weightedAvgPrice;
}
public void setWeightedAvgPrice(String weightedAvgPrice) {
this.weightedAvgPrice = weightedAvgPrice;
}
public String getPrevClosePrice() {
return prevClosePrice;
}
public void setPrevClosePrice(String prevClosePrice) {
this.prevClosePrice = prevClosePrice;
}
public String getLastPrice() {
return lastPrice;
}
public void setLastPrice(String lastPrice) {
this.lastPrice = lastPrice;
}
public String getBidPrice() {
return bidPrice;
}
public void setBidPrice(String bidPrice) {
this.bidPrice = bidPrice;
}
public String getAskPrice() {
return askPrice;
}
public void setAskPrice(String askPrice) {
this.askPrice = askPrice;
}
public String getOpenPrice() {
return openPrice;
}
public void setOpenPrice(String openPrice) {
this.openPrice = openPrice;
}
public String getHighPrice() {
return highPrice;
}
public void setHighPrice(String highPrice) {
this.highPrice = highPrice;
}
public String getLowPrice() {
return lowPrice;
}
public void setLowPrice(String lowPrice) {
this.lowPrice = lowPrice;
}
public BigDecimal getVolume() {
return volume;
}
public void setVolume(BigDecimal volume) {
this.volume = volume;
}
public BigDecimal getQuoteVolume() {
return quoteVolume;
}
public void setQuoteVolume(BigDecimal quoteVolume) {
this.quoteVolume = quoteVolume;
}
public long getOpenTime() {
return openTime;
}
public void setOpenTime(long openTime) {
this.openTime = openTime;
}
public long getCloseTime() {
return closeTime;
}
public void setCloseTime(long closeTime) {
this.closeTime = closeTime;
}
public long getFirstId() {
return firstId;
}
public void setFirstId(long firstId) {
this.firstId = firstId;
}
public long getLastId() {
return lastId;
}
public void setLastId(long lastId) {
this.lastId = lastId;
}
public long getCount() {
return count;
}
public void setCount(long count) {
this.count = count;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
@Override
public int compareTo(BinanceTickerStatistics o) {
return this.getSymbol().compareTo(o.getSymbol());
}
} | [
"[email protected]"
] | |
e488505abee1d0aab3743d9a3ff9c4d0314b1fe0 | bdc1587caa1bbb78635b0ecba2872b0bbaa4d122 | /service-consumer/src/test/java/com/dingjianjun/ServiceConsumerApplicationTests.java | fb14ba9496d8ca41a0b9220a043c61a0d0342976 | [] | no_license | jianjunding234/springcloud-tech-stack | 641c219e33005ba4d5d9bbcf505748b6aa008faa | e9b38c22924144af6b2e9d2a21af61aee18654c2 | refs/heads/master | 2023-05-25T08:11:43.834562 | 2020-05-28T01:50:15 | 2020-05-28T01:50:15 | 254,527,511 | 0 | 0 | null | 2021-06-04T02:39:37 | 2020-04-10T02:39:32 | Java | UTF-8 | Java | false | false | 225 | java | package com.dingjianjun;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ServiceConsumerApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
9e5695eeccf619eca1f4d666b3587a844879de2c | 67d8a47036fb3e7a788dab265f1e63f6ec453ba3 | /src/main/java/botmanager/bots/suggestionbox/commands/ReactionManagerCommand.java | 99718602ed4f051ff4f9ff07a106e28e87b622c0 | [] | no_license | phammalex/BotManager | d4793b5897c56aab4a1942ee28f8791505d5e61e | ad6c17b3d13b46205b770d9bfd47d85281766308 | refs/heads/master | 2022-12-25T00:28:42.912926 | 2020-10-11T17:31:32 | 2020-10-11T17:31:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | package botmanager.bots.suggestionbox.commands;
import botmanager.bots.suggestionbox.SuggestionBox;
import botmanager.bots.suggestionbox.generic.SuggestionBoxCommandBase;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.Event;
import net.dv8tion.jda.api.events.message.guild.react.GuildMessageReactionAddEvent;
/**
*
* @author MC_2018 <[email protected]>
*/
public class ReactionManagerCommand extends SuggestionBoxCommandBase {
public ReactionManagerCommand(SuggestionBox bot) {
super(bot);
}
@Override
public void run(Event genericEvent) {
GuildMessageReactionAddEvent event;
Message message;
String emoteName;
if (!(genericEvent instanceof GuildMessageReactionAddEvent)) {
return;
}
event = (GuildMessageReactionAddEvent) genericEvent;
emoteName = event.getReactionEmote().getName();
if (!event.getChannel().getName().equalsIgnoreCase("user-suggestions") && !event.getChannel().getName().equalsIgnoreCase("emote-suggestions")) {
return;
}
message = event.getChannel().retrieveMessageById(event.getMessageId()).complete();
String[] messageSplit = message.getContentRaw().split(" ");
String potentialId = "";
if (messageSplit.length >= 3) {
potentialId = messageSplit[2];
}
if (potentialId.contains(event.getMember().getId())) {
event.getReaction().removeReaction(event.getUser()).queue();
return;
}
if (emoteName.equalsIgnoreCase("upvote") || emoteName.equalsIgnoreCase("downvote")) {
return;
}
event.getReaction().removeReaction(event.getUser()).queue();
}
@Override
public String info() {
return null;
}
}
| [
"="
] | = |
82c89a7134a47aef7628055ac795c039870c13ef | 9b9115a8885fada6db04b66c0d4f8223bc04e39c | /src/main/java/com/hugomage/aquafina/entity/ManOWarEntity.java | 48bd82842633f8b1f16cd2969f685ec66b48ceef | [] | no_license | HugoMage/Aquafina | 12ef2baaeb9f8305d5606c5be66f0cbb1d887595 | 01d482a6d719663406e3ee6ff92fd5ff0056c3e9 | refs/heads/main | 2023-09-03T12:36:04.044241 | 2021-11-06T14:15:18 | 2021-11-06T14:15:18 | 411,448,409 | 1 | 0 | null | 2021-10-15T00:03:59 | 2021-09-28T21:51:39 | Java | UTF-8 | Java | false | false | 6,576 | java | package com.hugomage.aquafina.entity;
import com.hugomage.aquafina.registry.RegistryHandler;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ILivingEntityData;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.ai.goal.HurtByTargetGoal;
import net.minecraft.entity.ai.goal.RandomSwimmingGoal;
import net.minecraft.entity.passive.fish.AbstractGroupFishEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.IServerWorld;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public class ManOWarEntity extends AbstractGroupFishEntity {
public float xBodyRot;
public float xBodyRotO;
public float zBodyRot;
public float zBodyRotO;
public float tentacleMovement;
public float oldTentacleMovement;
public float tentacleAngle;
public float oldTentacleAngle;
private float speed;
private float tentacleSpeed;
private float rotateSpeed;
private float tx;
private float ty;
private float tz;
public ManOWarEntity(EntityType<? extends ManOWarEntity> p_i49856_1_, World p_i49856_2_) {
super(p_i49856_1_, p_i49856_2_);
}
private static final DataParameter<Integer> VARIANT = EntityDataManager.defineId(ManOWarEntity.class, DataSerializers.INT);
public static AttributeModifierMap.MutableAttribute setCustomAttributes() {
return MobEntity.createMobAttributes().add(Attributes.MAX_HEALTH, 10).add(Attributes.ATTACK_DAMAGE, 3D).add(Attributes.MOVEMENT_SPEED, 0.1);
}
@Override
public ItemStack getPickedResult(RayTraceResult target) {
return new ItemStack(RegistryHandler.MANOWAR_SPAWN_EGG.get());
}
@Override
protected ItemStack getBucketItemStack() {
return new ItemStack(RegistryHandler.MANOWAR_BUCKET.get());
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new ManOWarEntity.MoveRandomGoal(this));
this.targetSelector.addGoal(2, new HurtByTargetGoal(this));
}
public void aiStep() {
if (!this.isInWater() && this.onGround && this.verticalCollision) {
this.onGround = false;
this.hasImpulse = false;
}
super.aiStep();
}
public void playerTouch(PlayerEntity p_70100_1_) {
p_70100_1_.addEffect(new EffectInstance(Effects.POISON, 60, 3));
}
public int getVariant() {
return this.entityData.get(VARIANT);
}
private void setVariant(int variant) {
this.entityData.set(VARIANT, variant);
}
protected void saveToBucketTag(ItemStack bucket) {
CompoundNBT compoundnbt = bucket.getOrCreateTag();
compoundnbt.putInt("Variant", this.getVariant());
if (this.hasCustomName()) {
bucket.setHoverName(this.getCustomName());
}
}
public void setMovementVector(float p_175568_1_, float p_175568_2_, float p_175568_3_) {
this.tx = p_175568_1_;
this.ty = p_175568_2_;
this.tz = p_175568_3_;
}
public boolean hasMovementVector() {
return this.tx != 0.0F || this.ty != 0.0F || this.tz != 0.0F;
}
@Override
protected void defineSynchedData() {
super.defineSynchedData();
this.entityData.define(VARIANT, 0);
}
@Override
public void addAdditionalSaveData(CompoundNBT compound) {
super.addAdditionalSaveData(compound);
compound.putInt("Variant", getVariant());
}
@Override
public void readAdditionalSaveData(CompoundNBT compound) {
super.readAdditionalSaveData(compound);
setVariant(compound.getInt("Variant"));
}
class MoveRandomGoal extends Goal {
private final ManOWarEntity squid;
public MoveRandomGoal(ManOWarEntity p_i48823_2_) {
this.squid = p_i48823_2_;
}
public boolean canUse() {
return true;
}
public void tick() {
int i = this.squid.getNoActionTime();
if (i > 100) {
this.squid.setMovementVector(0.0F, 0.0F, 0.0F);
} else if (this.squid.getRandom().nextInt(50) == 0 || !this.squid.hasMovementVector()) {
float f = this.squid.getRandom().nextFloat() * ((float)Math.PI * 2F);
float f1 = MathHelper.cos(f) * 0.2F;
float f2 = -0.1F + this.squid.getRandom().nextFloat() * 0.2F;
float f3 = MathHelper.sin(f) * 0.2F;
this.squid.setMovementVector(f1, f2, f3);
}
}
}
@Nullable
@Override
public ILivingEntityData finalizeSpawn(IServerWorld worldIn, DifficultyInstance difficultyIn, SpawnReason reason, @Nullable ILivingEntityData spawnDataIn, @Nullable CompoundNBT dataTag) {
spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag);
if (dataTag == null) {
setVariant(random.nextInt(1));
} else {
if (dataTag.contains("Variant", 3)){
this.setVariant(dataTag.getInt("Variant"));
}
}
return spawnDataIn;
}
static class SwimGoal extends RandomSwimmingGoal {
private final ManOWarEntity fish;
public SwimGoal(ManOWarEntity fish) {
super(fish, 2.0D, 40);
this.fish = fish;
}
public boolean canUse() {
return super.canUse();
}
}
protected SoundEvent getAmbientSound() {
return SoundEvents.COD_AMBIENT;
}
protected SoundEvent getDeathSound() {
return SoundEvents.COD_DEATH;
}
protected SoundEvent getHurtSound(DamageSource damageSourceIn) {
return SoundEvents.COD_HURT;
}
protected SoundEvent getFlopSound() {
return SoundEvents.COD_FLOP;
}
}
| [
"[email protected]"
] | |
5aa5a900552789db4cff79888b98d0009e157fff | ddfa7b37825c51930866745ff9f63e2ec45ed45a | /src/date.java | 53fb55968be598592659f2f5073b7a5a0006f3e3 | [] | no_license | rajdeepd192/Ticket_Booking_v2.0 | 8af3fd16487b2df4ad48bf394164c09ccbb17557 | 4f1fa8f6cda5d539090b3118de99ffcf8d3f3aad | refs/heads/master | 2023-01-10T14:00:04.762225 | 2020-11-08T11:39:22 | 2020-11-08T11:39:22 | 311,049,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | import java.util.Calendar;
import java.util.Date;
import java.io.*;
public class date
{
int yy,mm,dd;
boolean f;
public void displ()throws IOException
{
Calendar c=Calendar.getInstance();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
for(;;)
{
System.out.println("Enter year:-");
yy=Integer.parseInt(br.readLine());
System.out.println("Enter month:-");
mm=Integer.parseInt(br.readLine());
System.out.println("Enter day:-");
dd=Integer.parseInt(br.readLine());
System.out.println("Today is:-"+c.get(Calendar.DATE)+"/"+(c.get(Calendar.MONTH)+1)+"/"+c.get(Calendar.YEAR));
int mmst=c.get(Calendar.MONTH)+1;
int md=mm-mmst;
int ddst=c.get(Calendar.DATE);
int ddd=(dd-ddst)+md*30;
System.out.println("differ date="+ddd);
System.out.println("requested date is:-"+dd+"/"+mm+"/"+yy);
if(ddd>=60||ddd<1)
{
System.out.println("Not possible before 60 days or before current date:RenEnter new date");
}
else{
System.out.println("VALID DATE...NOW CHECK THE VACANT BERTH");
break;
}
}
}
}
| [
"[email protected]"
] | |
8bf3a8a5cc022cfff85ef49badf45dcd10bb2dc6 | 1fd854156079cdb1cb5b7b69708ecd9045691a4e | /app/src/main/java/pl/eduweb/podcastplayer/UserStorage.java | 3655d73bedc2b035535f63825bec1d59a89a8bf7 | [
"Apache-2.0"
] | permissive | smdremedy/PodcastPlayer | 426aad5b2ad2b989fb0956592666649b32ba9a97 | 5147b39fdfcf74d457b569ba51d8dbcac95915c6 | refs/heads/master | 2020-07-02T08:10:26.908668 | 2016-08-30T21:53:46 | 2016-08-30T21:53:46 | 66,980,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,867 | java | package pl.eduweb.podcastplayer;
import android.content.SharedPreferences;
import pl.eduweb.podcastplayer.api.UserResponse;
/**
* Created by Autor on 2016-07-06.
*/
public class UserStorage {
public static final String SESSION_TOKEN = "sessionToken";
public static final String USERNAME = "username";
public static final String EMAIL = "email";
public static final String FIRST_NAME = "firstName";
public static final String LAST_NAME = "lastName";
public static final String USER_ID = "userId";
private final SharedPreferences preferences;
public UserStorage(SharedPreferences preferences) {
this.preferences = preferences;
}
public void save(UserResponse userResponse) {
SharedPreferences.Editor editor = preferences.edit();
editor.putString(SESSION_TOKEN, userResponse.sessionToken);
editor.putString(USERNAME, userResponse.username);
editor.putString(EMAIL, userResponse.email);
editor.putString(FIRST_NAME, userResponse.firstName);
editor.putString(LAST_NAME, userResponse.lastName);
editor.putString(USER_ID, userResponse.objectId);
editor.apply();
}
public boolean hasToLogin() {
return preferences.getString(SESSION_TOKEN, "").isEmpty();
}
public void logout() {
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.apply();
}
public String getFullName() {
return String.format("%s %s", preferences.getString(FIRST_NAME, ""), preferences.getString(LAST_NAME, ""));
}
public String getEmail() {
return preferences.getString(EMAIL, "");
}
public String getUserId() {
return preferences.getString(USER_ID, "");
}
public String getToken() {
return preferences.getString(SESSION_TOKEN, "");
}
}
| [
"[email protected]"
] | |
0fdf88498d96ef3469167ca614ad3166b0e95c5e | d9b2af84bce701e122641fe57636c39ad6b95ab9 | /src/impl/Factory.java | 0a284cb5bc4b118d8be51d777be4337b010469df | [] | no_license | sg279/W03PracticalExtension | 77feceea541d013641a7f6dd453e8fe2994a5a1d | ce7e12b7be2fa3f8f1fb6abb6f99b683f931321a | refs/heads/master | 2020-03-30T06:53:53.161291 | 2018-10-02T09:03:16 | 2018-10-02T09:03:16 | 150,898,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,303 | java | package impl;
import interfaces.*;
/**
* This class implements a singleton factory.
*
*/
public final class Factory implements IFactory {
private static IFactory factoryInstance = null;
private Factory() {
}
/**
* Method which returns an instance of the singleton Factory class.
* @return the instance of the Factory
*/
public static IFactory getInstance() {
if (factoryInstance == null) {
factoryInstance = new Factory();
}
return factoryInstance;
}
@Override
public ILoyaltyCardOwner makeLoyaltyCardOwner(String email, String name) {
//Create a new LoyaltyCardOwner called loyaltyCardOwner by calling the LoyaltyCardOwner constructor with the email and string parameters parsed as parameters
LoyaltyCardOwner loyaltyCardOwner = new LoyaltyCardOwner(email, name);
//Return the loyaltyCardOwner
return loyaltyCardOwner;
}
@Override
public ILoyaltyCard makeLoyaltyCard(ILoyaltyCardOwner loyaltyCardOwner) {
//Create a new LoyaltyCard called loyaltyCard by calling the LoyaltyCard constructor with the ILoyaltyCard parameter parsed as a parameter
LoyaltyCard loyaltyCard = new LoyaltyCard(loyaltyCardOwner);
//Return the loyaltyCard
return loyaltyCard;
}
@Override
public ILoyaltyCardOperator makeLoyaltyCardOperator() {
//Create a new LoyaldyCardOperator called loyaltyCardOperator by calling the LoyaltyCardOperator constructor
LoyaltyCardOperator loyaltyCardOperator = new LoyaltyCardOperator();
//Return the loyaltyCardOperator
return loyaltyCardOperator;
}
@Override
public IProduct makeProduct(String name) {
//Create a new product object called product by calling the product constructor with name as a parameter
Product product = new Product(name);
//Return the product object
return product;
}
@Override
public IProduct makeProduct(String name, double promotion) {
//Create a new product object called product by calling the product constructor with name and promotion parsed as parameters
Product product = new Product(name, promotion);
//Return the product object
return product;
}
}
| [
"[email protected]"
] | |
ec60880185c77d76e312dc8bf969c54bb385da8b | 005553bcc8991ccf055f15dcbee3c80926613b7f | /generated/com/guidewire/_generated/typekey/ValidationLevelInternalAccess.java | 8c33e5f5d2fa208db880ad482ee4be081497edad | [] | no_license | azanaera/toggle-isbtf | 5f14209cd87b98c123fad9af060efbbee1640043 | faf991ec3db2fd1d126bc9b6be1422b819f6cdc8 | refs/heads/master | 2023-01-06T22:20:03.493096 | 2020-11-16T07:04:56 | 2020-11-16T07:04:56 | 313,212,938 | 0 | 0 | null | 2020-11-16T08:48:41 | 2020-11-16T06:42:23 | null | UTF-8 | Java | false | false | 716 | java | package com.guidewire._generated.typekey;
@javax.annotation.processing.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "ValidationLevel.eti;ValidationLevel.eix;ValidationLevel.etx")
@java.lang.SuppressWarnings(value = {"deprecation", "unchecked"})
public class ValidationLevelInternalAccess {
public static final com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.TypeKeyFriendAccess<typekey.ValidationLevel>> FRIEND_ACCESSOR = new com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.TypeKeyFriendAccess<typekey.ValidationLevel>>(typekey.ValidationLevel.class);
private ValidationLevelInternalAccess() {
}
} | [
"[email protected]"
] | |
d79cd640c370e45547675bb45cee8d89184e0b5f | 609f726c4360957d1332b38896cf3fab8c1ba5de | /oxUtil/src/main/java/org/gluu/util/Triple.java | 9238c314999ebf0a5190a43825323fe661bd9277 | [
"MIT"
] | permissive | GluuFederation/oxCore | f2a3749710a61c0471c9347e04d85121deb9537e | 918ea9cbf7ad7d4a4a9d88108ef0c2f36cbcf733 | refs/heads/master | 2023-08-08T00:36:31.395698 | 2023-07-17T19:58:42 | 2023-07-17T19:58:42 | 18,150,075 | 15 | 16 | MIT | 2023-07-18T18:22:14 | 2014-03-26T19:00:16 | Java | UTF-8 | Java | false | false | 2,116 | java | /*
* oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2014, Gluu
*/
package org.gluu.util;
/**
* @author Yuriy Zabrovarnyy
* @version 0.9, 26/11/2012
*/
public class Triple<A, B, C> {
private A first;
private B second;
private C third;
public Triple() {
}
public Triple(A first, B second, C third) {
this.first = first;
this.second = second;
this.third = third;
}
public A getFirst() {
return first;
}
public void setFirst(A first) {
this.first = first;
}
public B getSecond() {
return second;
}
public void setSecond(B second) {
this.second = second;
}
public C getThird() {
return third;
}
public void setThird(C third) {
this.third = third;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Triple triple = (Triple) o;
if (first != null ? !first.equals(triple.first) : triple.first != null) {
return false;
}
if (second != null ? !second.equals(triple.second) : triple.second != null) {
return false;
}
if (third != null ? !third.equals(triple.third) : triple.third != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = first != null ? first.hashCode() : 0;
result = 31 * result + (second != null ? second.hashCode() : 0);
result = 31 * result + (third != null ? third.hashCode() : 0);
return result;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Triple");
sb.append("{first=").append(first);
sb.append(", second=").append(second);
sb.append(", third=").append(third);
sb.append('}');
return sb.toString();
}
}
| [
"[email protected]"
] | |
1bb0db4916da397aac9da1b8dfaa51fa2a54d624 | 8adc4e0536ebf07054ba0acdbf0b2c2b987c267a | /xmy/xmy-user-service/src/main/java/com/zfj/xmy/user/service/wap/impl/WapShoppingCardServiceImpl.java | ca064a127df04c4bc3c2ce2a9cd2652dafbcce90 | [] | no_license | haifeiforwork/xmy | f53c9e5f8d345326e69780c9ae6d7cf44e951016 | abcf424be427168f9a9dac12a04f5a46224211ab | refs/heads/master | 2020-05-03T02:05:40.499935 | 2018-03-06T09:21:15 | 2018-03-06T09:21:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,032 | java | package com.zfj.xmy.user.service.wap.impl;
import java.math.BigDecimal;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zfj.xmy.common.ReqData;
import com.zfj.xmy.common.ReqUtil;
import com.zfj.xmy.common.SystemConstant;
import com.zfj.xmy.common.persistence.dao.ShoppingCardMapper;
import com.zfj.xmy.common.persistence.pojo.ShoppingCard;
import com.zfj.xmy.user.persistence.dao.ShoppingCartExMapper;
import com.zfj.xmy.user.persistence.wap.dto.ShoppingCartOutDto;
import com.zfj.xmy.user.service.wap.WapShoppingCardService;
@Service
public class WapShoppingCardServiceImpl implements WapShoppingCardService{
@Autowired
private ShoppingCardMapper shoppingCardMapper;
@Autowired
private ShoppingCartExMapper shoppingCartExMapper;
/**
* 根据用户ID查询改用户所有绑定的购物卡
*/
@Override
public List<ShoppingCard> findShoppingCardByUserId(Long userId) {
ReqData reqData = new ReqData();
reqData.putValue("user_id", userId, SystemConstant.REQ_PARAMETER_EQ);
List<ShoppingCard> selectByExample = shoppingCardMapper.selectByExample(ReqUtil.reqParameterToCriteriaParameter(reqData));
return selectByExample;
}
/**
* 修改
*/
@Override
public void updateShoppingCard(Long id, Integer type, BigDecimal money) {
ShoppingCard oldCard = shoppingCardMapper.selectByPrimaryKey(id);
if (type == SystemConstant.userSpendPoints.SPEND_TYPE_SAVE) {//存入余额
oldCard.setBalance(oldCard.getBalance().add(money));//+ userSpendPoints.getMoneyPoint());
} else {
oldCard.setBalance(oldCard.getBalance().subtract(money));//- userSpendPoints.getMoneyPoint());
}
shoppingCardMapper.updateByPrimaryKey(oldCard);
}
@Override
public Integer findCountByUserId(Long userId) {
List<ShoppingCartOutDto> findShoppingCartGoodsCount = shoppingCartExMapper.findShoppingCartGoodsCount(userId);
return findShoppingCartGoodsCount.size();
}
}
| [
"[email protected]"
] | |
5df578fe1f960a990b70904f44462d5d77d29e08 | eb001b418927ca4f04b39539eedb696cb3c0fd1f | /tranthian/src/main/java/com/example/tranthian/entity/Book.java | ad4e378215168a65fc71ff9d4119daaf0117c481 | [] | no_license | tranthian-snake/EADExam | f4225ee5ab9af774687880c7c1e12f0586fc9903 | 8a0e8b956f8f885a21d3985ff91988e6a1d86cd2 | refs/heads/master | 2023-05-31T05:44:29.745044 | 2021-06-19T12:04:12 | 2021-06-19T12:04:12 | 378,392,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,525 | java | package com.example.tranthian.entity;
import javax.persistence.*;
@Entity
@Table(name = "book")
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int book_id;
@Column(name = "name")
private String name;
@Column(name = "author")
private String author;
@Column(name = "genre")
private String genre;
@Column(name = "publish_id")
private String publish_id;
@ManyToOne()
@JoinColumn(name = "publish_id", insertable = false, updatable = false)
private Publisher publisher;
public int getBook_id() {
return book_id;
}
public void setBook_id(int book_id) {
this.book_id = book_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public Publisher getPublisher() {
return publisher;
}
public void setPublisher(Publisher publisher) {
this.publisher = publisher;
}
public String getPublish_id() {
return publish_id;
}
public void setPublish_id(String publish_id) {
this.publish_id = publish_id;
}
}
| [
"[email protected]"
] | |
0f8701cf2cf73fa077e5f7ae01ca184078c87987 | 8c994ce51119ed095038b34c21cc6cde5993d70a | /classi/Mar09/src/beppe/Mar09.java | 5a76c344ffa944d6ce6e5873ccf42cc65c484d0c | [] | no_license | joker92/java | f0350a9f91832a28fd3db21658a82d2ea93351e3 | 531c89a63778ef943111c7080b3f901ab340c9a6 | refs/heads/master | 2021-01-18T23:50:59.058593 | 2016-07-06T13:29:07 | 2016-07-06T13:29:07 | 51,456,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,526 | 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 beppe;
import java.util.ArrayList;
/**
*
* @author svilupposw
*/
public class Mar09 {
public static void main(String[] args) {
//arraylist e un semplice array non si usano le []
//perche e un array statico
//l array sotto e vuoto
//<String> e un tipo generico
//(i primitivi non si possono con i generici)
//questo oggetto che ti passo con la get e una stringa
ArrayList <String> rubrica = new ArrayList<>();
//con nome variabile.add posso aggiungere
//tutti i valori nell array che voglio
rubrica.add("giuseppe trz 115641");
String voceInRubrica=rubrica.get(0);
ArrayList<Integer> temperature=new ArrayList<>();
temperature.add(17);
temperature.add(15);
temperature.add(11);
int temp= temperature.get(0);
for (int t: temperature){
System.out.println(t);
}
ArrayList<Documento> docs =new ArrayList<>();
docs.add(new Fattura());
ContenitoreGenerico<Fattura> cg =new ContenitoreGenerico<>();
cg.setContenuto(new Fattura());
Fattura voce=cg.getContenuto();
Class <? extends Documento> descrviCommessa= Commessa.class;
}
}
| [
"[email protected]"
] | |
f3f90268ecbad4b269664217614877879f1b6ca2 | 8f6007d3687bb5596fe0b3941b3374213ed68293 | /pizzahut/pizzahutstorefront/web/testsrc/com/pizzahutstore/storefront/controllers/cms/PurchasedCategorySuggestionComponentControllerTest.java | d82729b37344d2926c48becb5eb7aabf773ddb97 | [] | no_license | vamshivushakola/Pizzahut | 6ccc763ca6381c7b7c59b2f808d6c4f64b324c08 | b3e226a94e9bc04316c8ea812e32444287729d73 | refs/heads/master | 2021-01-20T20:18:12.137312 | 2016-06-14T12:19:08 | 2016-06-14T12:19:08 | 61,121,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,669 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package com.pizzahutstore.storefront.controllers.cms;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.acceleratorcms.model.components.PurchasedCategorySuggestionComponentModel;
import de.hybris.platform.acceleratorcms.model.components.SimpleSuggestionComponentModel;
import de.hybris.platform.catalog.enums.ProductReferenceTypeEnum;
import de.hybris.platform.category.model.CategoryModel;
import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException;
import de.hybris.platform.cms2.servicelayer.services.impl.DefaultCMSComponentService;
import de.hybris.platform.commercefacades.product.data.ProductData;
import com.pizzahutstore.facades.suggestion.SimpleSuggestionFacade;
import com.pizzahutstore.storefront.controllers.ControllerConstants;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.ui.Model;
import junit.framework.Assert;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
/**
* Unit test for {@link PurchasedCategorySuggestionComponentController}
*/
@UnitTest
public class PurchasedCategorySuggestionComponentControllerTest
{
private static final String COMPONENT_UID = "componentUid";
private static final String TEST_COMPONENT_UID = "componentUID";
private static final String TEST_TYPE_CODE = SimpleSuggestionComponentModel._TYPECODE;
private static final String TEST_TYPE_VIEW = ControllerConstants.Views.Cms.ComponentPrefix
+ StringUtils.lowerCase(TEST_TYPE_CODE);
private static final String TITLE = "title";
private static final String TITLE_VALUE = "Accessories";
private static final String SUGGESTIONS = "suggestions";
private static final String COMPONENT = "component";
private static final String CATEGORY_CODE = "CategoryCode";
private PurchasedCategorySuggestionComponentController purchasedCategorySuggestionComponentController;
@Mock
private PurchasedCategorySuggestionComponentModel purchasedCategorySuggestionComponentModel;
@Mock
private Model model;
@Mock
private DefaultCMSComponentService cmsComponentService;
@Mock
private SimpleSuggestionFacade simpleSuggestionFacade;
@Mock
private HttpServletRequest request;
@Mock
private HttpServletResponse response;
@Mock
private ProductData productData;
@Mock
private CategoryModel categoryModel;
private final List<ProductData> productDataList = Collections.singletonList(productData);
@Before
public void setUp()
{
MockitoAnnotations.initMocks(this);
purchasedCategorySuggestionComponentController = new PurchasedCategorySuggestionComponentController();
purchasedCategorySuggestionComponentController.setCmsComponentService(cmsComponentService);
ReflectionTestUtils
.setField(purchasedCategorySuggestionComponentController, "simpleSuggestionFacade", simpleSuggestionFacade);
}
@Test
public void testRenderComponent() throws Exception
{
given(purchasedCategorySuggestionComponentModel.getMaximumNumberProducts()).willReturn(Integer.valueOf(1));
given(purchasedCategorySuggestionComponentModel.getTitle()).willReturn(TITLE_VALUE);
given(purchasedCategorySuggestionComponentModel.getProductReferenceTypes()).willReturn(
Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES));
given(purchasedCategorySuggestionComponentModel.getCategory()).willReturn(categoryModel);
given(categoryModel.getCode()).willReturn(CATEGORY_CODE);
given(Boolean.valueOf(purchasedCategorySuggestionComponentModel.isFilterPurchased())).willReturn(Boolean.TRUE);
given(simpleSuggestionFacade.getReferencesForPurchasedInCategory(Mockito.anyString(), Mockito.anyList(),
Mockito.anyBoolean(), Mockito.<Integer> any())).willReturn(productDataList);
final String viewName = purchasedCategorySuggestionComponentController.handleComponent(request, response, model,
purchasedCategorySuggestionComponentModel);
verify(model, Mockito.times(1)).addAttribute(TITLE, TITLE_VALUE);
verify(model, Mockito.times(1)).addAttribute(SUGGESTIONS, productDataList);
Assert.assertEquals(TEST_TYPE_VIEW, viewName);
}
@Test
public void testRenderComponentUid() throws Exception
{
given(request.getAttribute(COMPONENT_UID)).willReturn(TEST_COMPONENT_UID);
given(cmsComponentService.getAbstractCMSComponent(TEST_COMPONENT_UID)).willReturn(purchasedCategorySuggestionComponentModel);
given(purchasedCategorySuggestionComponentModel.getMaximumNumberProducts()).willReturn(Integer.valueOf(1));
given(purchasedCategorySuggestionComponentModel.getTitle()).willReturn(TITLE_VALUE);
given(purchasedCategorySuggestionComponentModel.getProductReferenceTypes()).willReturn(
Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES));
given(purchasedCategorySuggestionComponentModel.getCategory()).willReturn(categoryModel);
given(categoryModel.getCode()).willReturn(CATEGORY_CODE);
given(Boolean.valueOf(purchasedCategorySuggestionComponentModel.isFilterPurchased())).willReturn(Boolean.TRUE);
given(simpleSuggestionFacade.getReferencesForPurchasedInCategory(Mockito.anyString(), Mockito.anyList(),
Mockito.anyBoolean(), Mockito.<Integer> any())).willReturn(productDataList);
final String viewName = purchasedCategorySuggestionComponentController.handleGet(request, response, model);
verify(model, Mockito.times(1)).addAttribute(COMPONENT, purchasedCategorySuggestionComponentModel);
verify(model, Mockito.times(1)).addAttribute(TITLE, TITLE_VALUE);
verify(model, Mockito.times(1)).addAttribute(SUGGESTIONS, productDataList);
Assert.assertEquals(TEST_TYPE_VIEW, viewName);
}
@Test(expected = AbstractPageController.HttpNotFoundException.class)
public void testRenderComponentNotFound() throws Exception
{
given(request.getAttribute(COMPONENT_UID)).willReturn(null);
given(request.getParameter(COMPONENT_UID)).willReturn(null);
purchasedCategorySuggestionComponentController.handleGet(request, response, model);
}
@Test(expected = AbstractPageController.HttpNotFoundException.class)
public void testRenderComponentNotFound2() throws Exception
{
given(request.getAttribute(COMPONENT_UID)).willReturn(null);
given(request.getParameter(COMPONENT_UID)).willReturn(TEST_COMPONENT_UID);
given(cmsComponentService.getSimpleCMSComponent(TEST_COMPONENT_UID)).willReturn(null);
purchasedCategorySuggestionComponentController.handleGet(request, response, model);
}
@Test(expected = AbstractPageController.HttpNotFoundException.class)
public void testRenderComponentNotFound3() throws Exception
{
given(request.getAttribute(COMPONENT_UID)).willReturn(TEST_COMPONENT_UID);
given(cmsComponentService.getSimpleCMSComponent(TEST_COMPONENT_UID)).willReturn(null);
given(cmsComponentService.getSimpleCMSComponent(TEST_COMPONENT_UID)).willThrow(new CMSItemNotFoundException(""));
purchasedCategorySuggestionComponentController.handleGet(request, response, model);
}
}
| [
"[email protected]"
] | |
2e7af4f0d218044f38984a31ba517798f418a41e | f61b6f98bd7b7b1f38f6b44621f660c06925c2d8 | /src/main/java/com/project/basic/conf/MessageSourceUtil.java | d777afda725ee4ac016e8459a1a04c12ed65045b | [] | no_license | pro-open/common-basic | c8f2312dc7421d9fedf649175970051a53e34419 | 2dc4bc914b94f81c37457cded63fb702bc1e3c43 | refs/heads/master | 2020-04-04T00:27:37.105214 | 2019-04-04T15:41:11 | 2019-04-04T15:41:11 | 155,650,582 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package com.project.basic.conf;
import java.util.Locale;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
/**
* 国际化提示文案信息封装类
*
* @Author LiuBao
* @Version 2.0
* @Date 2018年10月26日
*/
@Component
public class MessageSourceUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(MessageSourceUtil.class);
@Resource
private MessageSource messageSource;
/**
* 获取code对应的message
*/
public String getMessage(String code) {
return getMessage(code, null);
}
/**
*
* 获取code对应的message
*
* @param code :对应messages配置的key.
* @param args : 参数.
*/
public String getMessage(String code, Object[] args) {
return getMessage(code, args, "");
}
/**
* 这里使用比较方便的方法,不依赖HttpServletRequest.
*
* @param code :对应messages配置的key.
* @param args : 参数.
* @param defaultMessage : 没有设置key的时候的默认值.
*/
public String getMessage(String code, Object[] args, String defaultMessage) {
Locale locale = LocaleContextHolder.getLocale();
//locale=Locale.SIMPLIFIED_CHINESE;
if(!Locale.SIMPLIFIED_CHINESE.equals(locale)){
locale=Locale.US;
}
LOGGER.info("now the locale is:{}",locale);
String message = messageSource.getMessage(code, args, defaultMessage, locale);
return message;
}
}
| [
"[email protected]"
] | |
33f7a94014f318b5fff5b81bfa8c9108d4b58254 | e570a7ed32f60936d03db9399faefff581b9904b | /shubh-chintak-backend-common/src/main/java/org/shubhchintak/common/dto/RoleDTO.java | 132f29620fd91781d3d1694dac8869da22024f41 | [] | no_license | sudhanshu11a/shubh-chintak-backend | eee63f4ffd2f74bb7f9a1f9d654887da2cf9b83b | 9e574bbaf02e0836fe6768d6a839adf28d851f63 | refs/heads/master | 2021-01-19T00:21:25.287315 | 2019-01-07T05:58:15 | 2019-01-07T05:58:15 | 87,160,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | /**
*
*/
package org.shubhchintak.common.dto;
import org.shubhchintak.common.enums.RoleEnum;
/**
* @author sudhanshusharma
*
*/
public class RoleDTO extends BaseDTO {
/**
*
*/
private static final long serialVersionUID = 5267413300561228850L;
private RoleEnum roleName;
private String description;
public RoleEnum getRoleName() {
return roleName;
}
public void setRoleName(RoleEnum roleName) {
this.roleName = roleName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"[email protected]"
] | |
5a3bdcc98f74c854b414b74428abb5513dd0c3dd | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/63/org/apache/commons/math/linear/SingularValueDecompositionImpl_getNorm_243.java | 8354c9d5bdb3d450fd55c0529150693c88bb8fba | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 783 | java |
org apach common math linear
calcul compact singular decomposit matrix
singular decomposit matrix set matric
sigma time sigma time
time matrix time orthogon matrix sigma
time diagon matrix posit element time
orthogon matrix orthogon
min
version revis date
singular decomposit impl singularvaluedecompositionimpl
inherit doc inheritdoc
norm getnorm invalid matrix except invalidmatrixexcept
singular valu singularvalu
| [
"[email protected]"
] | |
0c282ac5b16a21eb99b96f6e5e6aa3e1a8a84a05 | 66ef83660729980ca40171c591750ff8eb517a3d | /src/main/java/com/jayden/mall/controller/SmsHomeRecommendSubjectController.java | b891ec0d26247ee69b89d7e5fa06a6130c8b368c | [] | no_license | BruceLee12013/mall | b24bab18109fcbd715d9683d88b4f18742d1a957 | 8838a1f2a3a39c0f2cc089e392ece53e8695bea9 | refs/heads/master | 2023-01-18T16:46:46.619486 | 2020-11-11T09:37:49 | 2020-11-11T09:37:49 | 311,924,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,172 | java | package com.jayden.mall.controller;
import com.jayden.mall.common.ApiRestResponse;
import com.jayden.mall.exception.BusinessExceptionEnum;
import com.jayden.mall.model.pojo.SmsHomeRecommendSubject;
import com.jayden.mall.service.SmsHomeRecommendSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Api(tags = "SmsHomeRecommendSubjectController", description = "首页专题推荐管理")
@RequestMapping("/home/recommendSubject")
public class SmsHomeRecommendSubjectController {
@Autowired
private SmsHomeRecommendSubjectService recommendSubjectService;
@ApiOperation("添加首页推荐专题")
@PostMapping("/create")
public ApiRestResponse create(@RequestBody List<SmsHomeRecommendSubject> homeBrandList) {
int count = recommendSubjectService.create(homeBrandList);
if (count <= 0) {
return ApiRestResponse.error(BusinessExceptionEnum.CREATE_FAILED);
}
return ApiRestResponse.success();
}
@ApiOperation("修改推荐排序")
@PostMapping("/update/sort/{id}")
public ApiRestResponse updateSort(@PathVariable Long id, Integer sort) {
int count = recommendSubjectService.updateSort(id, sort);
if (count <= 0) {
return ApiRestResponse.error(BusinessExceptionEnum.UPDATE_FAILED);
}
return ApiRestResponse.success();
}
@ApiOperation("批量删除推荐")
@PostMapping("/delete")
public ApiRestResponse delete(@RequestParam("ids") List<Long> ids) {
int count = recommendSubjectService.delete(ids);
if (count <= 0) {
return ApiRestResponse.error(BusinessExceptionEnum.DELETE_FAILED);
}
return ApiRestResponse.success();
}
@ApiOperation("批量修改推荐状态")
@PostMapping( "/update/recommendStatus")
public ApiRestResponse updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = recommendSubjectService.updateRecommendStatus(ids, recommendStatus);
if (count <= 0) {
return ApiRestResponse.error(BusinessExceptionEnum.UPDATE_FAILED);
}
return ApiRestResponse.success();
}
@ApiOperation("分页查询推荐")
@GetMapping("/list")
public ApiRestResponse list(@RequestParam(value = "subjectName", required = false) String subjectName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeRecommendSubject> homeBrandList = recommendSubjectService.list(subjectName, recommendStatus, pageSize, pageNum);
return ApiRestResponse.success(homeBrandList);
}
}
| [
"[email protected]"
] | |
40894391076e30efee5ab6b9c1feb8e2c92fafa5 | 67bc401a6b72850d4c4dfd62c7bcdc62419b0fa3 | /src/main/java/com/amazingfour/crms/dao/BaseDao.java | fa1a095a12ff35abd7c52c04a399e89e9cbb4a99 | [] | no_license | Dicky-pong/CloudResource | 813bf64ec97f41c19b51f0a85771ec05c0029843 | c7429d3b0809b3d61cbcc0239b65771aea5e86f9 | refs/heads/master | 2022-12-21T15:18:45.311970 | 2019-06-16T15:35:32 | 2019-06-16T15:35:32 | 166,563,888 | 0 | 0 | null | 2022-12-16T04:31:33 | 2019-01-19T15:48:57 | JavaScript | UTF-8 | Java | false | false | 610 | java | package com.amazingfour.crms.dao;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Created by Huy on 2016-01-08.
*/
public interface BaseDao<T,ID extends Serializable> {
//查询所有
public List<T> find(Map<String, Object> map); //map可以存放一些其它数据,如用于分页查询的start(起始页)和size(每页数量)
//根据id查一个
public T findById(ID id);
//查询数量
public int count(T domain);
//增
public void insert(T domain);
//删
public int delete(ID id);
//改
public int update(T domain);
}
| [
"[email protected]"
] | |
e2d18603702fb41f1811c1323e94f43e5db22791 | f6e2cf5e64e1047d3f2f6f583845c63f31781959 | /eurekaserver/src/main/java/com/yao/controller/HelloController.java | c8032029fbf891fda8f2ae8505aac1e1ad8c4636 | [] | no_license | shanyao19940801/SpringCloudDemo | b0746d78cc5982070f896f30b821fdef0d9e03a7 | a21fdf3b10b68fb14fa6d5ee38e41fea268bb6c0 | refs/heads/master | 2020-03-24T21:20:20.269867 | 2018-08-12T15:08:47 | 2018-08-12T15:08:47 | 143,026,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package com.yao.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Greetings from Spring boot";
}
}
| [
"[email protected]"
] | |
c6bd922a1e18d115d8f2ec7ee0cff3571f2f5a3f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/34/34_5d5c5181ac5a3e5a09681f897811dab32aed1013/Project/34_5d5c5181ac5a3e5a09681f897811dab32aed1013_Project_t.java | 85b34df25bf7a3320e8e63c6feda26d58a095dd4 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 44,289 | java | /*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.core.internal.resources;
import java.net.URI;
import java.util.*;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.internal.events.LifecycleEvent;
import org.eclipse.core.internal.utils.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.resources.team.IMoveDeleteHook;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.content.IContentTypeMatcher;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.osgi.util.NLS;
public class Project extends Container implements IProject {
protected Project(IPath path, Workspace container) {
super(path, container);
}
/*
* If the creation boolean is true then this method is being called on project creation.
* Otherwise it is being called via #setDescription. The difference is that we don't allow
* some description fields to change value after project creation. (e.g. project location)
*/
protected MultiStatus basicSetDescription(ProjectDescription description, int updateFlags) {
String message = Messages.resources_projectDesc;
MultiStatus result = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.FAILED_WRITE_METADATA, message, null);
ProjectDescription current = internalGetDescription();
current.setComment(description.getComment());
// set the build order before setting the references or the natures
current.setBuildSpec(description.getBuildSpec(true));
// set the references before the natures
boolean flushOrder = false;
IProject[] oldReferences = current.getReferencedProjects();
IProject[] newReferences = description.getReferencedProjects();
if (!Arrays.equals(oldReferences, newReferences)) {
current.setReferencedProjects(newReferences);
flushOrder = true;
}
oldReferences = current.getDynamicReferences();
newReferences = description.getDynamicReferences();
if (!Arrays.equals(oldReferences, newReferences)) {
current.setDynamicReferences(newReferences);
flushOrder = true;
}
if (flushOrder)
workspace.flushBuildOrder();
// the natures last as this may cause recursive calls to setDescription.
if ((updateFlags & IResource.AVOID_NATURE_CONFIG) == 0)
workspace.getNatureManager().configureNatures(this, current, description, result);
else
current.setNatureIds(description.getNatureIds(false));
return result;
}
/* (non-Javadoc)
* @see IProject#build(int, IProgressMonitor)
*/
public void build(int trigger, IProgressMonitor monitor) throws CoreException {
internalBuild(trigger, null, null, monitor);
}
/* (non-Javadoc)
* @see IProject#build(int, String, Map, IProgressMonitor)
*/
public void build(int trigger, String builderName, Map args, IProgressMonitor monitor) throws CoreException {
Assert.isNotNull(builderName);
internalBuild(trigger, builderName, args, monitor);
}
/**
* Checks that this resource is accessible. Typically this means that it
* exists. In the case of projects, they must also be open.
* If phantom is true, phantom resources are considered.
*
* @exception CoreException if this resource is not accessible
*/
public void checkAccessible(int flags) throws CoreException {
super.checkAccessible(flags);
if (!isOpen(flags)) {
String message = NLS.bind(Messages.resources_mustBeOpen, getFullPath());
throw new ResourceException(IResourceStatus.PROJECT_NOT_OPEN, getFullPath(), message, null);
}
}
/**
* Checks validity of the given project description.
*/
protected void checkDescription(IProject project, IProjectDescription desc, boolean moving) throws CoreException {
URI location = desc.getLocationURI();
if (location == null)
return;
String message = Messages.resources_invalidProjDesc;
MultiStatus status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.INVALID_VALUE, message, null);
status.merge(workspace.validateName(desc.getName(), IResource.PROJECT));
if (moving) {
// if we got here from a move call then we should check the location in the description since
// its possible that we want to do a rename without moving the contents. (and we shouldn't
// throw an Overlapping mapping exception in this case) So if the source description's location
// is null (we are using the default) or if the locations aren't equal, then validate the location
// of the new description. Otherwise both locations aren't null and they are equal so ignore validation.
URI sourceLocation = internalGetDescription().getLocationURI();
if (sourceLocation == null || !sourceLocation.equals(location))
status.merge(workspace.validateProjectLocationURI(project, location));
} else
// otherwise continue on like before
status.merge(workspace.validateProjectLocationURI(project, location));
if (!status.isOK())
throw new ResourceException(status);
}
/* (non-Javadoc)
* @see IProject#close(IProgressMonitor)
*/
public void close(IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
String msg = NLS.bind(Messages.resources_closing_1, getName());
monitor.beginTask(msg, Policy.totalWork);
final ISchedulingRule rule = workspace.getRuleFactory().modifyRule(this);
try {
// Do this before the prepare to allow lifecycle participants to change the tree.
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CLOSE, this));
workspace.prepareOperation(rule, monitor);
ResourceInfo info = getResourceInfo(false, false);
int flags = getFlags(info);
checkExists(flags, true);
monitor.subTask(msg);
if (!isOpen(flags))
return;
// Signal that this resource is about to be closed. Do this at the very
// beginning so that infrastructure pieces have a chance to do clean up
// while the resources still exist.
workspace.beginOperation(true);
// flush the build order early in case there is a problem
workspace.flushBuildOrder();
IProgressMonitor sub = Policy.subMonitorFor(monitor, Policy.opWork / 2, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL);
IStatus saveStatus = workspace.getSaveManager().save(ISaveContext.PROJECT_SAVE, this, sub);
internalClose();
monitor.worked(Policy.opWork / 2);
if (saveStatus != null && !saveStatus.isOK())
throw new ResourceException(saveStatus);
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/* (non-Javadoc)
* @see IResource#copy(IPath, int, IProgressMonitor)
*/
public void copy(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException {
// FIXME - the logic here for copying projects needs to be moved to Resource.copy
// so that IResource.copy(IPath,int,IProgressMonitor) works properly for
// projects and honours all update flags
monitor = Policy.monitorFor(monitor);
if (destination.segmentCount() == 1) {
// copy project to project
String projectName = destination.segment(0);
IProjectDescription desc = getDescription();
desc.setName(projectName);
desc.setLocation(null);
internalCopy(desc, updateFlags, monitor);
} else {
// will fail since we're trying to copy a project to a non-project
checkCopyRequirements(destination, IResource.PROJECT, updateFlags);
}
}
/* (non-Javadoc)
* @see IResource#copy(IProjectDescription, int, IProgressMonitor)
*/
public void copy(IProjectDescription destination, int updateFlags, IProgressMonitor monitor) throws CoreException {
// FIXME - the logic here for copying projects needs to be moved to Resource.copy
// so that IResource.copy(IProjectDescription,int,IProgressMonitor) works properly for
// projects and honours all update flags
Assert.isNotNull(destination);
internalCopy(destination, updateFlags, monitor);
}
protected void copyMetaArea(IProject source, IProject destination, IProgressMonitor monitor) throws CoreException {
IFileStore oldMetaArea = EFS.getFileSystem(EFS.SCHEME_FILE).getStore(workspace.getMetaArea().locationFor(source));
IFileStore newMetaArea = EFS.getFileSystem(EFS.SCHEME_FILE).getStore(workspace.getMetaArea().locationFor(destination));
oldMetaArea.copy(newMetaArea, EFS.NONE, monitor);
}
/* (non-Javadoc)
* @see IProject#create(IProgressMonitor)
*/
public void create(IProgressMonitor monitor) throws CoreException {
create(null, monitor);
}
/* (non-Javadoc)
* @see IProject#create(IProjectDescription, IProgressMonitor)
*/
public void create(IProjectDescription description, IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
monitor.beginTask(Messages.resources_create, Policy.totalWork);
checkValidPath(path, PROJECT, false);
final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
try {
workspace.prepareOperation(rule, monitor);
checkDoesNotExist();
if (description != null)
checkDescription(this, description, false);
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CREATE, this));
workspace.beginOperation(true);
workspace.createResource(this, false);
workspace.getMetaArea().create(this);
ProjectInfo info = (ProjectInfo) getResourceInfo(false, true);
// setup description to obtain project location
ProjectDescription desc;
if (description == null) {
desc = new ProjectDescription();
} else {
desc = (ProjectDescription) ((ProjectDescription) description).clone();
desc.setLocationURI(FileUtil.canonicalURI(description.getLocationURI()));
}
desc.setName(getName());
internalSetDescription(desc, false);
// see if there potentially are already contents on disk
final boolean hasSavedDescription = getLocalManager().hasSavedDescription(this);
boolean hasContent = hasSavedDescription;
//if there is no project description, there might still be content on disk
if (!hasSavedDescription)
hasContent = getLocalManager().hasSavedContent(this);
try {
// look for a description on disk
if (hasSavedDescription) {
updateDescription();
//make sure the .location file is written
workspace.getMetaArea().writePrivateDescription(this);
} else {
//write out the project
writeDescription(IResource.FORCE);
}
} catch (CoreException e) {
workspace.deleteResource(this);
throw e;
}
// inaccessible projects have a null modification stamp.
// set this after setting the description as #setDescription
// updates the stamp
info.clearModificationStamp();
//if a project already had content on disk, mark the project as having unknown children
if (hasContent)
info.set(ICoreConstants.M_CHILDREN_UNKNOWN);
workspace.getSaveManager().requestSnapshot();
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/* (non-Javadoc)
* @see IProject#delete(boolean, boolean, IProgressMonitor)
*/
public void delete(boolean deleteContent, boolean force, IProgressMonitor monitor) throws CoreException {
int updateFlags = force ? IResource.FORCE : IResource.NONE;
updateFlags |= deleteContent ? IResource.ALWAYS_DELETE_PROJECT_CONTENT : IResource.NEVER_DELETE_PROJECT_CONTENT;
delete(updateFlags, monitor);
}
/* (non-Javadoc)
* @see IResource#delete(boolean, IProgressMonitor)
*/
public void delete(boolean force, IProgressMonitor monitor) throws CoreException {
int updateFlags = force ? IResource.FORCE : IResource.NONE;
delete(updateFlags, monitor);
}
public void deleteResource(boolean convertToPhantom, MultiStatus status) throws CoreException {
super.deleteResource(convertToPhantom, status);
// Delete the project metadata.
workspace.getMetaArea().delete(this);
// Clear the history store.
clearHistory(null);
}
protected void fixupAfterMoveSource() {
workspace.deleteResource(this);
}
/*
* (non-Javadoc)
* @see IProject#getContentTypeMatcher
*/
public IContentTypeMatcher getContentTypeMatcher() throws CoreException {
return workspace.getContentDescriptionManager().getContentTypeMatcher(this);
}
/* (non-Javadoc)
* @see IContainer#getDefaultCharset(boolean)
*/
public String getDefaultCharset(boolean checkImplicit) {
// non-existing resources default to parent's charset
if (!exists())
return checkImplicit ? ResourcesPlugin.getEncoding() : null;
return workspace.getCharsetManager().getCharsetFor(getFullPath(), checkImplicit);
}
/* (non-Javadoc)
* @see IProject#getDescription()
*/
public IProjectDescription getDescription() throws CoreException {
ResourceInfo info = getResourceInfo(false, false);
checkAccessible(getFlags(info));
ProjectDescription description = ((ProjectInfo) info).getDescription();
//if the project is currently in the middle of being created, the description might not be available yet
if (description == null)
checkAccessible(NULL_FLAG);
return (IProjectDescription) description.clone();
}
/* (non-Javadoc)
* @see IProject#getNature(String)
*/
public IProjectNature getNature(String natureID) throws CoreException {
// Has it already been initialized?
ProjectInfo info = (ProjectInfo) getResourceInfo(false, false);
checkAccessible(getFlags(info));
IProjectNature nature = info.getNature(natureID);
if (nature == null) {
// Not initialized yet. Does this project have the nature?
if (!hasNature(natureID))
return null;
nature = workspace.getNatureManager().createNature(this, natureID);
info.setNature(natureID, nature);
}
return nature;
}
/* (non-Javadoc)
* @see IResource#getParent()
*/
public IContainer getParent() {
return workspace.getRoot();
}
/** (non-Javadoc)
* @see IProject#getPluginWorkingLocation(IPluginDescriptor)
* @deprecated
*/
public IPath getPluginWorkingLocation(IPluginDescriptor plugin) {
if (plugin == null)
return null;
return getWorkingLocation(plugin.getUniqueIdentifier());
}
/* (non-Javadoc)
* @see IResource#getProject()
*/
public IProject getProject() {
return this;
}
/* (non-Javadoc)
* @see IResource#getProjectRelativePath()
*/
public IPath getProjectRelativePath() {
return Path.EMPTY;
}
/* (non-Javadoc)
* @see IResource#getRawLocation()
*/
public IPath getRawLocation() {
ProjectDescription description = internalGetDescription();
return description == null ? null : description.getLocation();
}
/* (non-Javadoc)
* @see IResource#getRawLocation()
*/
public URI getRawLocationURI() {
ProjectDescription description = internalGetDescription();
return description == null ? null : description.getLocationURI();
}
/* (non-Javadoc)
* @see IProject#getReferencedProjects()
*/
public IProject[] getReferencedProjects() throws CoreException {
ResourceInfo info = getResourceInfo(false, false);
checkAccessible(getFlags(info));
ProjectDescription description = ((ProjectInfo) info).getDescription();
//if the project is currently in the middle of being created, the description might not be available yet
if (description == null)
checkAccessible(NULL_FLAG);
return description.getAllReferences(true);
}
/* (non-Javadoc)
* @see IProject#getReferencingProjects()
*/
public IProject[] getReferencingProjects() {
IProject[] projects = workspace.getRoot().getProjects();
List result = new ArrayList(projects.length);
for (int i = 0; i < projects.length; i++) {
Project project = (Project) projects[i];
if (!project.isAccessible())
continue;
ProjectDescription description = project.internalGetDescription();
if (description == null)
continue;
IProject[] references = description.getAllReferences(false);
for (int j = 0; j < references.length; j++)
if (references[j].equals(this)) {
result.add(projects[i]);
break;
}
}
return (IProject[]) result.toArray(new IProject[result.size()]);
}
/* (non-Javadoc)
* @see IResource#getType()
*/
public int getType() {
return PROJECT;
}
/*
* (non-Javadoc)
* @see IProject#getWorkingLocation(String)
*/
public IPath getWorkingLocation(String id) {
if (id == null || !exists())
return null;
IPath result = workspace.getMetaArea().getWorkingLocation(this, id);
result.toFile().mkdirs();
return result;
}
/* (non-Javadoc)
* @see IProject#hasNature(String)
*/
public boolean hasNature(String natureID) throws CoreException {
checkAccessible(getFlags(getResourceInfo(false, false)));
// use #internal method to avoid copy but still throw an
// exception if the resource doesn't exist.
IProjectDescription desc = internalGetDescription();
if (desc == null)
checkAccessible(NULL_FLAG);
return desc.hasNature(natureID);
}
/**
* Implements all build methods on IProject.
*/
protected void internalBuild(int trigger, String builderName, Map args, IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
final ISchedulingRule rule = workspace.getRuleFactory().buildRule();
try {
monitor.beginTask("", Policy.opWork); //$NON-NLS-1$
try {
workspace.prepareOperation(rule, monitor);
ResourceInfo info = getResourceInfo(false, false);
int flags = getFlags(info);
if (!exists(flags, true) || !isOpen(flags))
return;
workspace.beginOperation(true);
workspace.aboutToBuild(this, trigger);
IStatus result;
try {
result = workspace.getBuildManager().build(this, trigger, builderName, args, Policy.subMonitorFor(monitor, Policy.opWork));
} finally {
//must fire POST_BUILD if PRE_BUILD has occurred
workspace.broadcastBuildEvent(this, IResourceChangeEvent.POST_BUILD, trigger);
}
if (!result.isOK())
throw new ResourceException(result);
} finally {
//building may close the tree, but we are still inside an operation so open it
if (workspace.getElementTree().isImmutable())
workspace.newWorkingTree();
workspace.endOperation(rule, false, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/**
* Closes the project. This is called during restore when there is a failure
* to read the project description. Since it is called during workspace restore,
* it cannot start any operations.
*/
protected void internalClose() throws CoreException {
workspace.flushBuildOrder();
getMarkerManager().removeMarkers(this, IResource.DEPTH_INFINITE);
// remove each member from the resource tree.
// DO NOT use resource.delete() as this will delete it from disk as well.
IResource[] members = members(IContainer.INCLUDE_PHANTOMS | IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS);
for (int i = 0; i < members.length; i++) {
Resource member = (Resource) members[i];
workspace.deleteResource(member);
}
// finally mark the project as closed.
ResourceInfo info = getResourceInfo(false, true);
info.clear(M_OPEN);
info.clearSessionProperties();
info.clearModificationStamp();
info.setSyncInfo(null);
}
protected void internalCopy(IProjectDescription destDesc, int updateFlags, IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
String message = NLS.bind(Messages.resources_copying, getFullPath());
monitor.beginTask(message, Policy.totalWork);
String destName = destDesc.getName();
IPath destPath = new Path(destName).makeAbsolute();
Project destination = (Project) workspace.getRoot().getProject(destName);
final ISchedulingRule rule = workspace.getRuleFactory().copyRule(this, destination);
try {
workspace.prepareOperation(rule, monitor);
// The following assert method throws CoreExceptions as stated in the IProject.copy API
// and assert for programming errors. See checkCopyRequirements for more information.
assertCopyRequirements(destPath, IResource.PROJECT, updateFlags);
checkDescription(destination, destDesc, false);
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_COPY, this, destination, updateFlags));
workspace.beginOperation(true);
getLocalManager().refresh(this, DEPTH_INFINITE, true, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
// close the property store so incorrect info is not copied to the destination
getPropertyManager().closePropertyStore(this);
getLocalManager().getHistoryStore().closeHistoryStore(this);
// copy the meta area for the project
copyMetaArea(this, destination, Policy.subMonitorFor(monitor, Policy.opWork * 5 / 100));
// copy just the project and not its children yet (tree node, properties)
internalCopyProjectOnly(destination, Policy.subMonitorFor(monitor, Policy.opWork * 5 / 100));
// set the description
destination.internalSetDescription(destDesc, false);
//create the directory for the new project
destination.getStore().mkdir(EFS.NONE, Policy.subMonitorFor(monitor, Policy.opWork * 5 / 100));
// call super.copy for each child (excluding project description file)
//make it a best effort copy
message = Messages.resources_copyProblem;
MultiStatus problems = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.INTERNAL_ERROR, message, null);
IResource[] children = members(IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS);
final int childCount = children.length;
final int childWork = childCount > 1 ? Policy.opWork * 50 / 100 / (childCount - 1) : 0;
for (int i = 0; i < childCount; i++) {
IResource child = children[i];
if (!isProjectDescriptionFile(child)) {
try {
child.copy(destPath.append(child.getName()), updateFlags, Policy.subMonitorFor(monitor, childWork));
} catch (CoreException e) {
problems.merge(e.getStatus());
}
}
}
// write out the new project description to the meta area
try {
destination.writeDescription(IResource.FORCE);
} catch (CoreException e) {
try {
destination.delete((updateFlags & IResource.FORCE) != 0, null);
} catch (CoreException e2) {
// ignore and rethrow the exception that got us here
}
throw e;
}
monitor.worked(Policy.opWork * 5 / 100);
// refresh local
monitor.subTask(Messages.resources_updating);
getLocalManager().refresh(destination, DEPTH_INFINITE, true, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
if (!problems.isOK())
throw new ResourceException(problems);
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/*
* Copies just the project and no children. Does NOT copy the meta area.
*/
protected void internalCopyProjectOnly(IResource destination, IProgressMonitor monitor) throws CoreException {
// close the property store so bogus values aren't copied to the destination
getPropertyManager().closePropertyStore(this);
getLocalManager().getHistoryStore().closeHistoryStore(this);
// copy the tree and properties
workspace.copyTree(this, destination.getFullPath(), IResource.DEPTH_ZERO, IResource.NONE, false);
getPropertyManager().copy(this, destination, IResource.DEPTH_ZERO);
ProjectInfo info = (ProjectInfo) ((Resource) destination).getResourceInfo(false, true);
//clear properties, markers, and description for the new project, because they shouldn't be copied.
info.description = null;
info.natures = null;
info.setMarkers(null);
info.clearSessionProperties();
}
/**
* This is an internal helper method. This implementation is different from the API
* method getDescription(). This one does not check the project accessibility. It exists
* in order to prevent "chicken and egg" problems in places like the project creation.
* It may return null.
*/
public ProjectDescription internalGetDescription() {
ProjectInfo info = (ProjectInfo) getResourceInfo(false, false);
if (info == null)
return null;
return info.getDescription();
}
/**
* Sets this project's description to the given value. This is the body of the
* corresponding API method but is needed separately since it is used
* during workspace restore (i.e., when you cannot do an operation)
*/
void internalSetDescription(IProjectDescription value, boolean incrementContentId) {
ProjectInfo info = (ProjectInfo) getResourceInfo(false, true);
info.setDescription((ProjectDescription) value);
getLocalManager().setLocation(this, info, value.getLocationURI());
if (incrementContentId) {
info.incrementContentId();
//if the project is not accessible, stamp will be null and should remain null
if (info.getModificationStamp() != NULL_STAMP)
workspace.updateModificationStamp(info);
}
}
public void internalSetLocal(boolean flag, int depth) throws CoreException {
// do nothing for projects, but call for its children
if (depth == IResource.DEPTH_ZERO)
return;
if (depth == IResource.DEPTH_ONE)
depth = IResource.DEPTH_ZERO;
// get the children via the workspace since we know that this
// resource exists (it is local).
IResource[] children = getChildren(IResource.NONE);
for (int i = 0; i < children.length; i++)
((Resource) children[i]).internalSetLocal(flag, depth);
}
/* (non-Javadoc)
* @see IResource#isAccessible()
*/
public boolean isAccessible() {
return isOpen();
}
public boolean isLinked(int options) {
return false;//projects are never linked
}
/**
* @see IResource#isLocal(int)
* @deprecated
*/
public boolean isLocal(int depth) {
// the flags parameter is ignored for projects so pass anything
return isLocal(-1, depth);
}
/**
* @see IResource#isLocal(int)
* @deprecated
*/
public boolean isLocal(int flags, int depth) {
// don't check the flags....projects are always local
if (depth == DEPTH_ZERO)
return true;
if (depth == DEPTH_ONE)
depth = DEPTH_ZERO;
// get the children via the workspace since we know that this
// resource exists (it is local).
IResource[] children = getChildren(IResource.NONE);
for (int i = 0; i < children.length; i++)
if (!children[i].isLocal(depth))
return false;
return true;
}
/* (non-Javadoc)
* @see IProject#isNatureEnabled(String)
*/
public boolean isNatureEnabled(String natureId) throws CoreException {
checkAccessible(getFlags(getResourceInfo(false, false)));
return workspace.getNatureManager().isNatureEnabled(this, natureId);
}
/* (non-Javadoc)
* @see IProject#isOpen()
*/
public boolean isOpen() {
ResourceInfo info = getResourceInfo(false, false);
return isOpen(getFlags(info));
}
/* (non-Javadoc)
* @see IProject#isOpen()
*/
public boolean isOpen(int flags) {
return flags != NULL_FLAG && ResourceInfo.isSet(flags, M_OPEN);
}
/**
* Returns true if this resource represents the project description file, and
* false otherwise.
*/
protected boolean isProjectDescriptionFile(IResource resource) {
return resource.getType() == IResource.FILE && resource.getFullPath().segmentCount() == 2 && resource.getName().equals(IProjectDescription.DESCRIPTION_FILE_NAME);
}
/* (non-Javadoc)
* @see IProject#move(IProjectDescription, boolean, IProgressMonitor)
*/
public void move(IProjectDescription destination, boolean force, IProgressMonitor monitor) throws CoreException {
Assert.isNotNull(destination);
move(destination, force ? IResource.FORCE : IResource.NONE, monitor);
}
/* (non-Javadoc)
* @see IResource#move(IProjectDescription, int, IProgressMonitor)
*/
public void move(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException {
Assert.isNotNull(description);
monitor = Policy.monitorFor(monitor);
try {
String message = NLS.bind(Messages.resources_moving, getFullPath());
monitor.beginTask(message, Policy.totalWork);
IProject destination = workspace.getRoot().getProject(description.getName());
final ISchedulingRule rule = workspace.getRuleFactory().moveRule(this, destination);
try {
workspace.prepareOperation(rule, monitor);
// The following assert method throws CoreExceptions as stated in the IResource.move API
// and assert for programming errors. See checkMoveRequirements for more information.
if (!getName().equals(description.getName())) {
IPath destPath = Path.ROOT.append(description.getName());
assertMoveRequirements(destPath, IResource.PROJECT, updateFlags);
}
checkDescription(destination, description, true);
workspace.beginOperation(true);
message = Messages.resources_moveProblem;
MultiStatus status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, message, null);
WorkManager workManager = workspace.getWorkManager();
ResourceTree tree = new ResourceTree(getLocalManager(), workManager.getLock(), status, updateFlags);
IMoveDeleteHook hook = workspace.getMoveDeleteHook();
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_MOVE, this, destination, updateFlags));
int depth = 0;
try {
depth = workManager.beginUnprotected();
if (!hook.moveProject(tree, this, description, updateFlags, Policy.subMonitorFor(monitor, Policy.opWork / 2)))
tree.standardMoveProject(this, description, updateFlags, Policy.subMonitorFor(monitor, Policy.opWork / 2));
} finally {
workManager.endUnprotected(depth);
}
// Invalidate the tree for further use by clients.
tree.makeInvalid();
if (!tree.getStatus().isOK())
throw new ResourceException(tree.getStatus());
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/* (non-Javadoc)
* @see IProject#open(IProgressMonitor)
*/
public void open(int updateFlags, IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
String msg = NLS.bind(Messages.resources_opening_1, getName());
monitor.beginTask(msg, Policy.totalWork);
monitor.subTask(msg);
final ISchedulingRule rule = workspace.getRuleFactory().modifyRule(this);
try {
workspace.prepareOperation(rule, monitor);
ProjectInfo info = (ProjectInfo) getResourceInfo(false, false);
int flags = getFlags(info);
checkExists(flags, true);
if (isOpen(flags))
return;
workspace.beginOperation(true);
// flush the build order early in case there is a problem
workspace.flushBuildOrder();
info = (ProjectInfo) getResourceInfo(false, true);
info.set(M_OPEN);
//clear the unknown children immediately to avoid background refresh
boolean unknownChildren = info.isSet(M_CHILDREN_UNKNOWN);
if (unknownChildren)
info.clear(M_CHILDREN_UNKNOWN);
// the M_USED flag is used to indicate the difference between opening a project
// for the first time and opening it from a previous close (restoring it from disk)
boolean used = info.isSet(M_USED);
if (used) {
workspace.getSaveManager().restore(this, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
} else {
info.set(M_USED);
//reconcile any links in the project description
IStatus result = reconcileLinks(info.getDescription());
if (!result.isOK())
throw new CoreException(result);
workspace.updateModificationStamp(info);
monitor.worked(Policy.opWork * 20 / 100);
}
startup();
//request a refresh if the project has unknown members on disk
if (!used && unknownChildren) {
//refresh either in background or foreground
if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) {
workspace.refreshManager.refresh(this);
monitor.worked(Policy.opWork * 80 / 100);
} else {
refreshLocal(IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 80 / 100));
}
}
//creation of this project may affect overlapping resources
workspace.getAliasManager().updateAliases(this, getStore(), IResource.DEPTH_INFINITE, monitor);
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/* (non-Javadoc)
* @see IProject#open(IProgressMonitor)
*/
public void open(IProgressMonitor monitor) throws CoreException {
open(IResource.NONE, monitor);
}
/**
* The project description file has changed on disk, resulting in a changed
* set of linked resources. Perform the necessary creations and deletions of
* links to bring the links in sync with those described in the project description.
* @param newDescription the new project description that may have
* changed link descriptions.
* @return status ok if everything went well, otherwise an ERROR multi-status
* describing the problems encountered.
*/
public IStatus reconcileLinks(ProjectDescription newDescription) {
HashMap newLinks = newDescription.getLinks();
String msg = Messages.links_errorLinkReconcile;
MultiStatus status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.OPERATION_FAILED, msg, null);
//walk over old linked resources and remove those that are no longer defined
ProjectDescription oldDescription = internalGetDescription();
if (oldDescription != null) {
HashMap oldLinks = oldDescription.getLinks();
if (oldLinks != null) {
for (Iterator it = oldLinks.values().iterator(); it.hasNext();) {
LinkDescription oldLink = (LinkDescription) it.next();
Resource oldLinkResource = (Resource) findMember(oldLink.getProjectRelativePath());
if (oldLinkResource == null || !oldLinkResource.isLinked())
continue;
LinkDescription newLink = null;
if (newLinks != null)
newLink = (LinkDescription) newLinks.get(oldLink.getProjectRelativePath());
//if the new link is missing, or has different location or gender, then remove old link
if (newLink == null || !newLink.getLocationURI().equals(oldLinkResource.getLocationURI()) || newLink.getType() != oldLinkResource.getType()) {
try {
oldLinkResource.delete(IResource.NONE, null);
//refresh the resource, because removing a link can reveal a previously hidden resource in parent
oldLinkResource.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
status.merge(e.getStatus());
}
}
}
}
}
//walk over new links and create if necessary
if (newLinks == null)
return status;
//sort links to avoid creating nested links before their parents
List sortedLinks = new ArrayList(newLinks.values());
Collections.sort(sortedLinks);
for (Iterator it = sortedLinks.iterator(); it.hasNext();) {
LinkDescription newLink = (LinkDescription) it.next();
try {
Resource toLink = workspace.newResource(getFullPath().append(newLink.getProjectRelativePath()), newLink.getType());
IContainer parent = toLink.getParent();
if (parent != null && !parent.exists() && parent.getType() == FOLDER)
((Folder) parent).ensureExists(Policy.monitorFor(null));
toLink.createLink(newLink.getLocationURI(), IResource.REPLACE | IResource.ALLOW_MISSING_LOCAL, null);
} catch (CoreException e) {
status.merge(e.getStatus());
}
}
return status;
}
/* (non-Javadoc)
* @see IProject#setDescription(IProjectDescription, int, IProgressMonitor)
*/
public void setDescription(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException {
// FIXME - update flags should be honored:
// KEEP_HISTORY means capture .project file in local history
// FORCE means overwrite any existing .project file
monitor = Policy.monitorFor(monitor);
try {
monitor.beginTask(Messages.resources_setDesc, Policy.totalWork);
final ISchedulingRule rule = workspace.getRoot();
try {
//need to use root rule because nature configuration calls third party code
workspace.prepareOperation(rule, monitor);
ResourceInfo info = getResourceInfo(false, false);
checkAccessible(getFlags(info));
//if nothing has changed, we don't need to do anything
ProjectDescription oldDescription = internalGetDescription();
ProjectDescription newDescription = (ProjectDescription) description;
boolean hasPublicChanges = oldDescription.hasPublicChanges(newDescription);
boolean hasPrivateChanges = oldDescription.hasPrivateChanges(newDescription);
if (!hasPublicChanges && !hasPrivateChanges)
return;
checkDescription(this, newDescription, false);
//If we're out of sync and !FORCE, then fail.
//If the file is missing, we want to write the new description then throw an exception.
boolean hadSavedDescription = true;
if (((updateFlags & IResource.FORCE) == 0)) {
hadSavedDescription = getLocalManager().hasSavedDescription(this);
if (hadSavedDescription && !getLocalManager().isDescriptionSynchronized(this)) {
String message = NLS.bind(Messages.resources_projectDescSync, getName());
throw new ResourceException(IResourceStatus.OUT_OF_SYNC_LOCAL, getFullPath(), message, null);
}
}
//see if we have an old .prj file
if (!hadSavedDescription)
hadSavedDescription = workspace.getMetaArea().hasSavedProject(this);
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CHANGE, this));
workspace.beginOperation(true);
MultiStatus status = basicSetDescription(newDescription, updateFlags);
if (hadSavedDescription && !status.isOK())
throw new CoreException(status);
//write the new description to the .project file
writeDescription(oldDescription, updateFlags, hasPublicChanges, hasPrivateChanges);
//increment the content id even for private changes
info = getResourceInfo(false, true);
info.incrementContentId();
workspace.updateModificationStamp(info);
if (!hadSavedDescription) {
String msg = NLS.bind(Messages.resources_missingProjectMetaRepaired, getName());
status.merge(new ResourceStatus(IResourceStatus.MISSING_DESCRIPTION_REPAIRED, getFullPath(), msg));
}
if (!status.isOK())
throw new CoreException(status);
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/* (non-Javadoc)
* @see IProject#setDescription(IProjectDescription, IProgressMonitor)
*/
public void setDescription(IProjectDescription description, IProgressMonitor monitor) throws CoreException {
// funnel all operations to central method
setDescription(description, IResource.KEEP_HISTORY, monitor);
}
/**
* Restore the non-persisted state for the project. For example, read and set
* the description from the local meta area. Also, open the property store etc.
* This method is used when an open project is restored and so emulates
* the behaviour of open().
*/
protected void startup() throws CoreException {
if (!isOpen())
return;
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_OPEN, this));
}
/* (non-Javadoc)
* @see IResource#touch(IProgressMonitor)
*/
public void touch(IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
String message = NLS.bind(Messages.resources_touch, getFullPath());
monitor.beginTask(message, Policy.totalWork);
final ISchedulingRule rule = workspace.getRuleFactory().modifyRule(this);
try {
workspace.prepareOperation(rule, monitor);
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CHANGE, this));
workspace.beginOperation(true);
super.touch(Policy.subMonitorFor(monitor, Policy.opWork));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
/**
* The project description file on disk is better than the description in memory.
* Make sure the project description in memory is synchronized with the
* description file contents.
*/
protected void updateDescription() throws CoreException {
if (ProjectDescription.isWriting)
return;
ProjectDescription.isReading = true;
try {
workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CHANGE, this));
ProjectDescription description = getLocalManager().read(this, false);
//links can only be created if the project is open
IStatus result = null;
if (isOpen())
result = reconcileLinks(description);
internalSetDescription(description, true);
if (result != null && !result.isOK())
throw new CoreException(result);
} finally {
ProjectDescription.isReading = false;
}
}
/**
* Writes the project's current description file to disk.
*/
public void writeDescription(int updateFlags) throws CoreException {
writeDescription(internalGetDescription(), updateFlags, true, true);
}
/**
* Writes the project description file to disk. This is the only method
* that should ever be writing the description, because it ensures that
* the description isn't then immediately discovered as an incoming
* change and read back from disk.
* @param description The description to write
* @param updateFlags The write operation update flags
* @param hasPublicChanges Whether the public sections of the description have changed
* @param hasPrivateChanges Whether the private sections of the description have changed
* @exception CoreException On failure to write the description
*/
public void writeDescription(IProjectDescription description, int updateFlags, boolean hasPublicChanges, boolean hasPrivateChanges) throws CoreException {
if (ProjectDescription.isReading)
return;
ProjectDescription.isWriting = true;
try {
getLocalManager().internalWrite(this, description, updateFlags, hasPublicChanges, hasPrivateChanges);
} finally {
ProjectDescription.isWriting = false;
}
}
}
| [
"[email protected]"
] | |
7065fa2e5355d0d4f99cf2ccbbff02802395896f | c1a4318e8f43ebbc9185f0246a192677589c6712 | /actividadSiete/actividadSiete/src/actividadSiete/main.java | 7072415a2948a28c9733d7be8b68bc75773842fe | [] | no_license | Jeanette-Mosqueda/intrucciones-de-control | 97dddd3c5da5eace32611c99660a632495744822 | 2131e4c7cc6e0fd96eb68b46327c10a15680e6c5 | refs/heads/main | 2023-01-01T05:26:00.106558 | 2020-10-27T05:35:14 | 2020-10-27T05:35:14 | 307,595,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,718 | java | package actividadSiete;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class main {
public static BufferedReader entrada= new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
int opcion, rango;
boolean salir = false;
NumerosPrimos numerosPrimos=new NumerosPrimos();
do {
System.out.println("Que calculo quieres realizar hoy? ");
System.out.println("1° Imprimir Numeros Primos ");
System.out.println("2° Imprimir Seria de Fibonacci ");
System.out.println("3° Salir");
System.out.println("Elige una de las opciones ");
opcion = Integer.parseInt(entrada.readLine());
switch (opcion) {
case 1:
System.out.println("Ingresa la cantidad de numeros primos que quieres imprimir");
rango = Integer.parseInt(entrada.readLine());
numerosPrimos.primos(rango);
break;
case 2:
System.out.println("Ingresa la cantidad de numeros Para la Sucesion de Fibonacci a imprimir");
rango = Integer.parseInt(entrada.readLine());
Fibonacci.sucesion(rango);
break;
case 3:
salir=true;
break;
default:
System.out.println("Opción no valida, Solo hay opciones de calculos 1 y 2");
break;
}
}while (salir!=true);
}
}
| [
"[email protected]"
] | |
ad33d4d1729d86fe05d7b78129855beeb5a51f0d | ce2813f714d83602ee9b3b237c7304446ae741da | /src/LINTCODE11/LINTCODE1040.java | d28ac8cb62fbb2977b450c8e25278dbbffca831f | [] | no_license | tmhbatw/LINTCODEANSWER | bc54bb40a4826b0f9aa11aead4d99978a22e1ee8 | 7db879f075cde6e1b2fce86f6a3068e59f4e9b34 | refs/heads/master | 2021-12-13T16:38:05.780408 | 2021-10-09T16:50:59 | 2021-10-09T16:50:59 | 187,010,547 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package LINTCODE11;
public class LINTCODE1040 {
/*Description
* 整数数组arr(存在相同元素),将其拆分成一些“块”(分区),
* 并单独对每个块进行排序. 连接它们之后,结果为升序数组.
* 可以划分最多多少块?
* */
public int maxChunksToSorted(int[] arr) {
int count=0;
for(int i=0;i<arr.length;i++){
int max=Integer.MIN_VALUE;
count++;
while(true){
max=Math.max(max,arr[i]);
int j=arr.length-1;
for(;j>i;j--){
if(arr[j]<max)
break;
}
if(i==j)
break;
i++;
}
}
return count;
// Write your code here
}
}
| [
"[email protected]"
] | |
f388530907e31318a575335944c20b843e2e4d27 | 7679d05a14ac2d55ca87199a57e8d63f0950c89f | /src/main/java/com/wdw/wrpc/service/impl/CalculateImpl.java | 2effafecab243dc7143c28c12aa88b9c1f7de02c | [
"MIT"
] | permissive | wdw87/wRpc | aa858f7c6c9c6747431ad3ff4aa3e4c72aedcbcf | 0d79d746aa38aa13797d7d201e03699d2f310f93 | refs/heads/master | 2022-07-03T12:42:33.900415 | 2020-06-30T14:40:49 | 2020-06-30T14:40:49 | 248,723,506 | 13 | 0 | MIT | 2022-06-17T03:00:57 | 2020-03-20T10:04:56 | Java | UTF-8 | Java | false | false | 301 | java | package com.wdw.wrpc.service.impl;
import com.wdw.wrpc.service.CalculateInterFace;
public class CalculateImpl implements CalculateInterFace {
@Override
public int add(int a, int b) {
return a + b;
}
@Override
public int dec(int a, int b) {
return a - b;
}
}
| [
"[email protected]"
] | |
ea5d10949c212fc8dda8d53abe3da6a9498e5b0a | bc1fc2c53840c91c2f0af706e0b628d6e8a7367c | /design-pattern-core/src/main/java/com/liuhuan/study/design/creational/prototype/Client.java | 3acef9cd2c7bf190566cd7f8c460dd67f9ad4f9c | [
"Apache-2.0"
] | permissive | cliuhuan/design-pattern | 64933b884946c1323bb9ffade4cae85b62f8a65e | e0582c53aacd505e5e696d8dd0b804f5fbdce503 | refs/heads/master | 2022-11-21T09:58:43.776903 | 2020-07-27T03:51:15 | 2020-07-27T03:51:15 | 282,788,810 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 893 | java | package com.liuhuan.study.design.creational.prototype;
/**
* 原型模式
*/
public class Client {
public static void main(String[] args) {
System.out.println("原型模式完成对象的创建");
Sheep sheep = new Sheep("tom", 1, "白色");
sheep.friend = new Sheep("jack", 2, "黑色");
Sheep sheep2 = (Sheep)sheep.clone();
Sheep sheep3 = (Sheep)sheep.clone();
Sheep sheep4 = (Sheep)sheep.clone();
Sheep sheep5 = (Sheep)sheep.clone();
System.out.println("sheep2 =" + sheep2 + "sheep2.friend=" + sheep2.friend.hashCode());
System.out.println("sheep3 =" + sheep3 + "sheep3.friend=" + sheep3.friend.hashCode());
System.out.println("sheep4 =" + sheep4 + "sheep4.friend=" + sheep4.friend.hashCode());
System.out.println("sheep5 =" + sheep5 + "sheep5.friend=" + sheep5.friend.hashCode());
}
}
| [
"[email protected]"
] | |
5a3d9ae76ea6eab8b5fb16e9c63de81919e84e32 | a27ebf74ca6d60337ce4f451a2059fcedf29042d | /src/com/ssiot/remote/data/ControlController.java | f4586ec380dabd2866ee384eccb1abca59ca210e | [] | no_license | ldseop/jurong | 04f2964314a0f093486bbaa85a719b439bf3db19 | 90024ce325c6ff551221b9deb025265e21c23b65 | refs/heads/master | 2021-01-19T22:43:35.454508 | 2016-01-18T04:48:31 | 2016-01-18T04:48:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,134 | java | package com.ssiot.remote.data;
import android.text.TextUtils;
import android.util.Log;
import com.ssiot.jurong.JuRongActivity;
import com.ssiot.remote.data.business.ControlActionInfo;
import com.ssiot.remote.data.business.ControlLog;
import com.ssiot.remote.data.model.ControlActionInfoModel;
import com.ssiot.remote.data.model.ControlLogModel;
import java.sql.Timestamp;
import java.util.List;
public class ControlController{
private static final String tag = "ControlController";
ControlActionInfo controlActionInfoBll = new ControlActionInfo();
ControlLog controllogbll = new ControlLog();
public boolean SaveControlTimeUser(String timeCondition, String seldevice, String UniqueID, int controlType, String DeviceNos,String updateid){
if (TextUtils.isEmpty(timeCondition)){
Log.e(tag, "----SaveControlTimeUser!!!!----timeCondition = null");
return false;
}
ControlActionInfoModel controlActionInfo = new ControlActionInfoModel();
// object id = Session["ControlID"];
if (!TextUtils.isEmpty(updateid)){//更新
controlActionInfo = controlActionInfoBll.GetModel(Integer.parseInt(updateid));
controlActionInfo._areaid = GetNowAccountAreaID();
controlActionInfo._controlname = getControlTypeString(controlType);
controlActionInfo._uniqueid = UniqueID;
controlActionInfo._deviceno = Integer.parseInt(DeviceNos);
controlActionInfo._controltype = controlType;
controlActionInfo._controlcondition = timeCondition;
controlActionInfo._operatetime = new Timestamp(System.currentTimeMillis());
controlActionInfo._statenow = 0;
controlActionInfo._operate = "打开";
return updateControlActionInfoAndAddLog(controlActionInfo);
} else {//添加
if (seldevice == null && DeviceNos != ""){
if (DeviceNos.endsWith(",")){
DeviceNos = DeviceNos.substring(0, DeviceNos.length()-1);
}
String[] nos = DeviceNos.split(",");
for (String devicetmp : nos){
controlActionInfo._areaid = GetNowAccountAreaID();
controlActionInfo._controlname = getControlTypeString(controlType);// (string)Session["controlActionName"];
controlActionInfo._uniqueid = UniqueID;
controlActionInfo._deviceno = Integer.parseInt(devicetmp);
controlActionInfo._controltype = controlType;
controlActionInfo._controlcondition = timeCondition;
controlActionInfo._operatetime = new Timestamp(System.currentTimeMillis());
controlActionInfo._statenow = 0;
controlActionInfo._operate = "打开";
if(false == addControlActionInfoAndAddLog(controlActionInfo)){
return false;
}
}
return true;
}
}
return false;
}
private boolean updateControlActionInfoAndAddLog(ControlActionInfoModel controlActionInfo){//ControlActionInfo表 ControlLog表
if (controlActionInfoBll.Update(controlActionInfo)) {
List<ControlLogModel> controlLog_list = DataAPI.ConvertControlActionInfoToControlLog(controlActionInfo);
try {
int rtnCount = controllogbll.AddManyCount(controlLog_list);
if (rtnCount == 0) {
return false;
} else {
return true;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
} else {
return false;
}
}
private boolean addControlActionInfoAndAddLog(ControlActionInfoModel controlActionInfo){//ControlActionInfo表 ControlLog表
if (controlActionInfoBll.Add(controlActionInfo) > 0) {
List<ControlLogModel> controlLog_list = DataAPI.ConvertControlActionInfoToControlLog(controlActionInfo);
try {
int rtnCount = controllogbll.AddManyCount(controlLog_list);
if (rtnCount == 0) {
return false;
} else {
return true;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
} else {
return false;
}
}
private String getControlTypeString (int controlType){
String names = "";
if (controlType == 1) {
names = "立即开启";
} else if (controlType == 3) {
names = "定时";
} else if (controlType == 5) {
names = "循环";
}
return names;
}
private int GetNowAccountAreaID(){
if (JuRongActivity.AreaID < 0){
Log.e(tag, "----!!!! MainActivity.AreaID < 0");
}
return JuRongActivity.AreaID;
}
} | [
"[email protected]"
] | |
75950bd455b9530f2d25151204075e978fc8c9ec | 2f2acaf4b2ed2925ad3c82abda6c35783304645a | /FSM8/src/main/java/fr/keyser/n/fsm/State.java | b8b2b66eb57162f6bdaa0ac910e7dc3d119c8b09 | [] | no_license | pierrealainkeyser/FSM | aa2521e78a71fa73fb59e44a40748b70312d6562 | 61e89d538f84c7cc5d172e653708fc55181caece | refs/heads/master | 2021-06-11T15:14:35.778722 | 2019-09-19T10:42:07 | 2019-09-19T10:42:07 | 109,716,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,407 | java | package fr.keyser.n.fsm;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public final class State {
private final List<String> states;
private final String inner;
public State(Collection<String> states) {
this(new ArrayList<>(states));
}
private State(List<String> states) {
this.states = states;
this.inner = this.states.stream().collect(Collectors.joining("/"));
}
public State(String... states) {
this(Arrays.asList(states));
}
public List<String> values() {
return Collections.unmodifiableList(states);
}
public Stream<State> diff(State other, boolean reversed) {
int mySize = states.size();
int otherSize = other.states.size();
int common = 0;
boolean done = false;
while (common < mySize && common < otherSize && !done) {
if (!states.get(common).equals(other.states.get(common))) {
done = true;
} else
++common;
}
int to = mySize + 1;
int from = common + 1;
IntStream range = IntStream.range(from, to);
if (reversed)
range = range.map(i -> to - i + from - 1);
return range.mapToObj(this::subState);
}
public Stream<State> states() {
IntStream range = IntStream.range(1, states.size() + 1);
return range.mapToObj(this::subState);
}
private State subState(int index) {
return new State(states.subList(0, index));
}
public State sub(String state) {
List<String> states = new ArrayList<>(this.states.size() + 1);
states.addAll(this.states);
states.add(state);
return new State(states);
}
@Override
public String toString() {
return inner;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((inner == null) ? 0 : inner.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
State other = (State) obj;
if (inner == null) {
if (other.inner != null)
return false;
} else if (!inner.equals(other.inner))
return false;
return true;
}
}
| [
"[email protected]"
] | |
c3acf1e32b31598bcbdb38d8d20d8594b39c91fb | a669c43c95809588e432cb000a953bdf5326dcd6 | /app/src/main/java/com/example/administrator/newss/adapter/ImageAdapter.java | 66db5a24a0cd05e7c54eac2c763bba0038343305 | [] | no_license | hanxunbu/ButterKnife | 870b95ca2515208796d2cd467075f4980fff2375 | 498cf347e48268d0de034be4bcfc9504d4e1ad00 | refs/heads/master | 2021-01-19T21:31:55.498317 | 2017-02-20T03:28:25 | 2017-02-20T03:28:25 | 82,511,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,877 | java | package com.example.administrator.newss.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.example.administrator.newss.R;
import com.example.administrator.newss.entity.ImageInfo;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2017/1/11.
*/
public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ImageHolder>{
private List<ImageInfo> list = new ArrayList<>();
private Context context;
public ImageAdapter(Context context) {
this.context = context;
}
public List<ImageInfo> getList() {
return list;
}
public void setList(List<ImageInfo> list) {
this.list = list;
}
/**创建一个ViewHolder*/
@Override
public ImageHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.adapter_image_item,null);
return new ImageHolder(view);
}
/**绑定ViewHolder*/
@Override
public void onBindViewHolder(ImageHolder holder, int position) {
//给控件赋值
Picasso.with(context)
.load(list.get(position).getUrl())
.error(R.mipmap.ic_launcher)
.into(holder.iv);
}
/**返回RecyclerView的项数*/
@Override
public int getItemCount() {
return list.size();
}
/**ViewHolder*/
public class ImageHolder extends RecyclerView.ViewHolder{
ImageView iv;
public ImageHolder(View itemView) {
super(itemView);
//找到管理的控件
iv = (ImageView) itemView.findViewById(R.id.adapter_image_item_iv);
}
}
}
| [
"[email protected]"
] | |
6b21bdb042c9a0d3c04a6372ffb7ce42e4420a1e | 0fdcb6bb6acac8017d57973591319784c79daa9b | /src/CommandNodes/TurtleCommandNode.java | 66ec66fcb4c1d3140b677ba2af126e94f63c4a90 | [
"MIT"
] | permissive | ericl3/logo-IDE | dab053348aa290c24d0e58cd0fb47f05ee9ae160 | d2bceda2f173e86e138ab56484855f3663163c57 | refs/heads/master | 2020-05-09T20:19:38.484943 | 2019-04-15T03:05:50 | 2019-04-15T03:05:50 | 181,402,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package CommandNodes;
import Handlers.HandlerInterfaces.CommandHandlerInterface;
/**
* @author Mary Gooneratne
* Abstract CommandNode that serves as the framework for all CommandNodes that alter turtle properties
*/
public abstract class TurtleCommandNode extends CommandNode {
private int myChildrenIndex;
/**
* Instantiates TurtleCommandNode
* @param inHandler handles this node
*/
public TurtleCommandNode(CommandHandlerInterface inHandler){
super(inHandler);
}
public TurtleCommandNode(CommandHandlerInterface inHandler, CommandNode inParent){
super(inHandler, inParent);
}
protected double getPixels(){
return this.getNextDouble();
}
protected double getDegrees(){
return this.getNextDouble();
}
protected double getX(){
return this.getNextDouble();
}
protected double getY(){
return this.getNextDouble();
}
protected abstract void parseParameters();
/**
* Parses command parameters and calls appropriate execution method on handler
*/
public abstract void execute();
}
| [
"[email protected]"
] | |
8bd8956c67778719aff0cfe79b884676c627ce25 | 90556a9e7527c78c44d02ce9920e4fee47c61d01 | /src/main/java/org/brapi/test/BrAPITestServer/serializer/CustomStringToEnumConverter.java | 6434e5b6f3969536dbc503e8fce04087a1adf0c3 | [
"MIT"
] | permissive | plantbreeding/brapi-Java-TestServer | 0f6cddb58b645294fca586a4b6068b68ffd6b911 | 5b600ca0fd130add5591101d39c5afd9d7b1cb06 | refs/heads/brapi-server-v2 | 2023-08-08T01:58:53.975315 | 2023-07-13T16:26:26 | 2023-07-13T16:26:26 | 109,435,642 | 5 | 7 | MIT | 2023-09-13T15:22:18 | 2017-11-03T19:35:24 | Java | UTF-8 | Java | false | false | 494 | java | package org.brapi.test.BrAPITestServer.serializer;
import org.springframework.core.convert.converter.Converter;
import io.swagger.model.WSMIMEDataTypes;
public class CustomStringToEnumConverter implements Converter<String, WSMIMEDataTypes> {
@Override
public WSMIMEDataTypes convert(String source) {
WSMIMEDataTypes dataType = WSMIMEDataTypes.fromValue(source);
if (dataType == null) {
dataType = WSMIMEDataTypes.valueOf(source);
}
return dataType;
}
}
| [
"[email protected]"
] | |
4e14b7652030acf9f1db11822b4e9b4b72340250 | bd15574da9cbb62dc20188548ed8015df30e5a57 | /src/main/java/Routes/RouteObject.java | 8e3bdf77be0aaf389f00e1c999969d6b721f6555 | [] | no_license | tylerhoh/NoteApp | 99f691a27b334ffb2304746049a303765383a979 | 98b8e9aedc9d00b896d2237ab3c955afc4200612 | refs/heads/master | 2022-05-31T18:31:13.021669 | 2019-11-28T04:36:03 | 2019-11-28T04:36:03 | 221,534,765 | 0 | 0 | null | 2022-05-20T21:15:39 | 2019-11-13T19:23:23 | Java | UTF-8 | Java | false | false | 248 | java | package Routes;
import DAO.NoteHandler;
import DTO.Response;
public class RouteObject {
public Response localRes;
protected NoteHandler noteDatabase = NoteHandler.getDataBase();
public Response create(){
return null;
}
}
| [
"[email protected]"
] | |
a2e061993b15e5145dc9ef61d87b22e8e4f5489f | d1b5c374c4ff545a81c5be777fbf891f7299eae4 | /src/main/java/ru/olgak/folks/api/search/EntityFieldFilter.java | b0ce86822c3ebad46d39d68e8e171e9e8ff409be | [] | no_license | blackberryP1e/Folks_practice | 7b11e05f7eea2a969bbb23575f9c009c57b84a80 | 0ce7b56546d0c1be8456cfd6272a969f0d9fd9af | refs/heads/master | 2022-11-30T23:43:55.200131 | 2020-01-20T15:30:02 | 2020-01-20T15:30:02 | 235,117,972 | 0 | 1 | null | 2022-11-24T03:40:15 | 2020-01-20T14:17:48 | Java | UTF-8 | Java | false | false | 3,649 | java | package ru.olgak.folks.api.search;
import java.util.regex.Pattern;
/**
* Класс <class>EntityFieldFilter</class>
*
* @author nikolaig
*/
public abstract class EntityFieldFilter<T> {
/** Значение фильтра */
protected T value;
/**
* Возвращает строковое представление значения фильтра
*
* @return Возвращает строковое представление значения фильтра
*/
public abstract String getValueAsString();
/** Класс <code>EmptyValue</code> реализует фильтр для пустых значений */
public static final class EmptyValue extends EntityFieldFilter<Void> {
@Override
public String getValueAsString() {
return null;
}
}
/** Класс <code>NotEmptyValue</code> реализует фильтр для не пустых значений */
public static final class NotEmptyValue extends EntityFieldFilter<Void> {
@Override
public String getValueAsString() {
return null;
}
}
/** Класс <code>PatternValue</code> реализует фильтр для регулярного выражения */
public static final class PatternValue extends EntityFieldFilter<String> {
/** Зарезервированные символы регулярного выражения */
public static final String PATTERN_SPECIAL_CHARACTERS = "^$\\|.+*?=![](){}";
/** Зарезервированный символ для выражения ".*" */
public static final String MATCH_ANY_CHARACTER = "%";
/** Зарезервированный символ для выражения "." */
public static final String MATCH_SINGLE_CHARACTER = "_";
/** Опции регулярного выражения по умолчанию */
public static final Integer DEFAULT_FLAGS = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
/** Опции регулярного выражения */
private Integer flags = DEFAULT_FLAGS;
/** Конструктор класса <code>PatternValue</code> */
public PatternValue() {
}
/**
* Конструктор класса <code>PatternValue</code>
*
* @param pattern регулярное выражение
*/
public PatternValue(String pattern) {
this.value = pattern;
}
@Override
public String getValueAsString() {
return getPattern();
}
/**
* Возвращает значение регулярного выражения
*
* @return Возвращает значение регулярного выражения
*/
public String getPattern() {
return value;
}
public Integer getFlags() {
return flags;
}
/**
* Конвертирует значение в синтаксис регулярного выражения
*
* @param value значение
* @return Возвращает значение в синтаксисе регулярного выражения
*/
public static String convertToPatternSyntax(String value) {
return value.replaceAll(MATCH_ANY_CHARACTER, ".*").replaceAll(MATCH_SINGLE_CHARACTER, ".");
}
}
}
| [
"[email protected]"
] | |
d408f2a0c09128ce020a6a20bd1beb9211cbad48 | c317857e05a4d3de4b1fac82fab5c48ae5fea99c | /src/BuilderDP/PackBuilder.java | 097bb6442f9c870cfc87df27251c094967bd2a56 | [] | no_license | victor0198utm/TMPS_Lab1 | 8b5e7100e4938c288d4b9d7ba2e6063c6048811d | 34295168e6d22b2d5461d38ba263c1c0aef61e4d | refs/heads/main | 2023-08-24T21:27:04.671979 | 2021-10-03T13:39:03 | 2021-10-03T13:39:03 | 413,064,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 688 | java | package BuilderDP;
import BuilderDP.CarTypes.Car;
import java.util.ArrayList;
import java.util.List;
public class PackBuilder {
private final List<Car> cars = new ArrayList<Car>();
public void addItem(Car car){
cars.add(car);
}
public float getCost(){
float cost = 0.0f;
for (Car car : cars) {
cost += car.getPrice();
}
return cost;
}
public void showCars(){
for (Car car: cars) {
System.out.println(car.getModelName());
System.out.println(car.automationLevel().getAutomationLevel());
System.out.println("Price : " + car.getPrice() + " $\n");
}
}
}
| [
"[email protected]"
] | |
462ab7b14bf4d6317ec4c3d0135498d55c4f532e | 82bda3ed7dfe2ca722e90680fd396935c2b7a49d | /app-meipai/src/main/java/com/arashivision/onecamera/exception/StorageFileNotExistException.java | 3659174ad26723ae0c7e1b874135ebaec2bb6f2c | [] | no_license | cvdnn/PanoramaApp | 86f8cf36d285af08ba15fb32348423af7f0b7465 | dd6bbe0987a46f0b4cfb90697b38f37f5ad47cfc | refs/heads/master | 2023-03-03T11:15:40.350476 | 2021-01-29T09:14:06 | 2021-01-29T09:14:06 | 332,968,433 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package com.arashivision.onecamera.exception;
public class StorageFileNotExistException extends CameraIOException {
public StorageFileNotExistException(String str) {
super(str);
}
}
| [
"[email protected]"
] | |
a8f2eac8d16e17e41487294eec2024040e1c6d7d | 90be516983da819bdfe398d1ff0cb0e1aec8be67 | /src/main/java/com/deloitte/poc/searchprovider/repository/ProviderDao.java | abe8f230c93f04e4dd9a5d86ea99f84758e91ff3 | [] | no_license | venkateshbussa16/poc-searchProvider | ea2569e82cc784f00b3b8260bc4d48136a200e79 | 34e684cc05bca2d7967e72f76d2e4dc61e222eb7 | refs/heads/master | 2020-04-11T12:47:44.118038 | 2018-12-21T10:21:39 | 2018-12-21T10:21:39 | 161,792,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 866 | java | package com.deloitte.poc.searchprovider.repository;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.deloitte.poc.searchprovider.bean.Provider;
@Component
public class ProviderDao {
@Autowired
private ProviderRepository providerRepository;
public List<Provider> getProvidersById(String providerId){
return providerRepository.findByProviderId(providerId);
}
public List<Provider> getProvidersByPfin(String pfin){
return providerRepository.findByPfin(pfin);
}
public List<Provider> getProvidersByLicence(String licence){
return providerRepository.findByLicense(licence);
}
public Provider save(Provider provider) {
return providerRepository.save(provider);
}
public void deleteProvider(Long id) {
providerRepository.deleteById(id);
}
}
| [
"[email protected]"
] | |
273e49ba898c156a435b389c655371021833088c | 12d215c7d24a66204a21c3268967d94f22e27ebb | /src/org/whiskeysierra/impairedvision/Vision.java | 0887fd4b7b4fdb40f7c87ae1c290f0890f829e58 | [] | no_license | whiskeysierra/impaired-vision | f08c8e8f2bbd26582ba0e4d8b7203a128c644892 | 02d3d71bd8713836a943899cadbfc0cd8100bdee | refs/heads/master | 2016-09-06T11:59:57.897581 | 2011-09-28T10:14:10 | 2011-09-28T10:14:10 | 1,800,544 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package org.whiskeysierra.impairedvision;
import android.graphics.ColorFilter;
import android.hardware.Camera;
import com.google.common.base.Function;
interface Vision {
public static final Function<Vision, String> NAME = new Function<Vision, String>() {
@Override
public String apply(Vision vision) {
return vision.getName();
}
};
void configure(Camera camera);
ColorFilter getFilter();
String getName();
}
| [
"[email protected]"
] | |
6268146c002538b1f9082c3d5e416bd1b103fcf4 | ea49a926a580b6089c9739f692c8436cfaf28e5e | /app/src/main/java/it/uniparthenope/fairwind/services/logger/SecureFilePacker.java | 362028dd35eb6b629e57a35a787045d3b2dc850e | [
"Apache-2.0"
] | permissive | OpenFairWind/fairwind | 556477772838cca1f8d6f5df4045d7847e264bce | c51ec332b370470993ca13d3775f9456ec6e87d5 | refs/heads/main | 2023-03-12T23:03:02.598774 | 2021-03-03T16:21:54 | 2021-03-03T16:21:54 | 344,184,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package it.uniparthenope.fairwind.services.logger;
import java.io.File;
import java.io.IOException;
import java.security.GeneralSecurityException;
/**
* Created by raffaelemontella on 28/06/2017.
*/
public interface SecureFilePacker {
public void pack(File source, File destination) throws IOException, GeneralSecurityException;
}
| [
"[email protected]"
] | |
b5032a0202bdaa3830f42c5ca29879d0f6e2e2c6 | 28823b037ca34bd377de9f67cec3553932aa3013 | /src/test/java/org/apache/ibatis/submitted/serializecircular/Attribute.java | 072c7addf2f80e4efa441c275b4c4997446ab18c | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | janforp/mybatis | 9240dea373aa7615ebb10fd44c5f0b02b8d6c0d0 | bd8dad6ef602e07c8cd14c5db79186071c5ff90b | refs/heads/master | 2022-07-08T19:43:24.594569 | 2020-04-04T14:31:56 | 2020-04-04T14:31:56 | 246,563,112 | 0 | 0 | Apache-2.0 | 2022-06-29T19:34:00 | 2020-03-11T12:20:26 | Java | UTF-8 | Java | false | false | 982 | java | /*
* Copyright 2012 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 org.apache.ibatis.submitted.serializecircular;
import java.io.Serializable;
public class Attribute implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
| [
"[email protected]"
] | |
9643dfc7238ff5794b1facda15a7b96e04c52041 | f69c9bcf2522e9dcd89373fcd1e9e70d60970871 | /src/main/java/com/ovopark/hikaricpprometheusdemo/controller/TestController.java | 9938605f789f251ad0e2edff79944fb2905352b5 | [] | no_license | MiskOoo/hikarip-prometheus-demo | 8a26e34930196a6372ac345d82d367792346554c | b7d613f61b4167b42ba434cbd115a3c8a05cf245 | refs/heads/master | 2023-02-02T02:24:27.021151 | 2020-12-18T08:25:46 | 2020-12-18T08:25:46 | 322,532,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package com.ovopark.hikaricpprometheusdemo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ovopark.hikaricpprometheusdemo.bean.User;
import com.ovopark.hikaricpprometheusdemo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.xml.ws.WebEndpoint;
import java.util.List;
@Component
@RestControllerEndpoint(id = "test")
public class TestController {
public static int i = 1;
@Autowired
UserMapper userMapper;
@RequestMapping("/Hikar")
public String testHikar(){
System.out.println("进行第" + i + "次查询...");
List<User> users = userMapper.selectAll();
System.out.println("查询结果...."+users.toString());
i++;
return "进入test";
}
}
| [
"[email protected]"
] | |
c00c76dc39c94d437f09eabf7bf29b3a99c8e283 | 6e04886322ba4e3f501dde8d1226eb0f0c99f516 | /internal-backport/src/main/java/groovy/transform/NamedParams.java | cd2b0336e857fb426541b86ab1287f243208c9eb | [
"Apache-2.0"
] | permissive | wujunshen/spock | a6ee7d827ac13435440eb5cd18571e1f30f75eb6 | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | refs/heads/master | 2020-06-12T06:40:20.996876 | 2019-03-26T13:47:48 | 2019-03-26T13:47:48 | 194,222,244 | 1 | 0 | Apache-2.0 | 2019-06-28T06:46:52 | 2019-06-28T06:46:51 | null | UTF-8 | Java | false | false | 1,321 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package groovy.transform;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* WARNING: This is only present here so that we can build with 2.4 as well, the code will not be shipped.
*
* Collector annotation for {@link NamedParam}.
*
* @since 2.5.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface NamedParams {
NamedParam[] value();
}
| [
"[email protected]"
] | |
64c36b14fe5f40552604c128c6048ec6b11fca16 | b8fca8799590a0305c7a16fe54858e5694b3d02e | /src/main/java/com/qainfotech/maven/Tatoc/course/FrameDungeon.java | 5756098a7339466950b039a523828d51753c4772 | [] | no_license | DigvijayQAIT/Maven_Automation_Training | 5530b0b4c7c629e0c2bf80eb84b7e6375b6d37fc | da0a134268e3205f28559e1312ffd746ea140079 | refs/heads/master | 2020-03-21T01:33:55.475323 | 2018-06-21T17:37:20 | 2018-06-21T17:37:20 | 137,948,212 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package com.qainfotech.maven.Tatoc.course;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class FrameDungeon {
public boolean colorMatching(WebDriver driver) {
driver.switchTo().frame("main");
String boxOneColor = driver.findElement(By.id("answer")).getAttribute("class");
driver.switchTo().frame("child");
String boxTwoColor = driver.findElement(By.id("answer")).getAttribute("class");
while (!boxOneColor.equals(boxTwoColor)) {
driver.switchTo().parentFrame();
driver.findElement(By.linkText("Repaint Box 2")).click();
driver.switchTo().frame("child");
boxTwoColor = driver.findElement(By.id("answer")).getAttribute("class");
}
driver.switchTo().parentFrame();
driver.findElement(By.linkText("Proceed")).click();
String expectedUrl = "http://10.0.1.86/tatoc/basic/drag";
String actualUrl = driver.getCurrentUrl();
if (expectedUrl.equals(actualUrl)) {
return true;
}
return false;
}
}
| [
"[email protected]"
] | |
1185e3fc9858989d5e935f261a3a7eeea997c385 | c634f8faa88acc4698a5ddbe6a86f15f5de3260d | /src/main/java/Intake2020/services/CsFAQServiceImpl.java | 7c852304830af9f401675f9d88689f407570323d | [] | no_license | changwng/WebPortpoilo | 6adaeb83f1bacc068c3f1711914f61f32ac8466f | e5dfd326cdacae12aac6908d9e3019139ec9f628 | refs/heads/master | 2023-01-19T23:36:55.463823 | 2020-11-23T08:43:54 | 2020-11-23T08:43:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,705 | java | package Intake2020.services;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import Intake2020.domain.dto.CsFAQDto;
import Intake2020.mapper.CsFAQMapper;
@Service
public class CsFAQServiceImpl implements CsFAQService {
@Autowired
private CsFAQMapper csFAQMapper;
@Autowired
private HttpServletRequest request;
/*FAQ게시판 목록*/
@Override
public List<CsFAQDto> faqlist() {
return csFAQMapper.list();
}
/*FAQ게시판 글쓰기*/
@Override
public void write(CsFAQDto dto) {
dto.setUser_ip(request.getRemoteAddr());
csFAQMapper.write(dto);
}
/*FAQ게시판 상세정보*/
@Override
public CsFAQDto detail(int no) {
return csFAQMapper.detail(no);
}
/*FAQ게시판 삭제*/
@Override
public void delete(int no) {
csFAQMapper.delete(no);
}
/*FAQ게시판 수정*/
@Override
public void edit(CsFAQDto dto) {
csFAQMapper.edit(dto);
}
/*FAQ게시판 조회수증가*/
@Override
public void increase(int no) {
csFAQMapper.increase(no);
}
/*---------------FAQ게시판 검색---------------*/
@Override
public List<CsFAQDto> searchAll(String search_option, String keyword) {
System.out.println("search_option: "+search_option);
System.out.println("keyword: "+keyword);
Map<String,String> map =new HashMap<String,String>();
map.put("search_option", search_option);
map.put("keyword", keyword);
return csFAQMapper.searchAll(map);
}
/*페이징과 하게될때 int count_jpa페이징과 참고해서*/
}
| [
"[email protected]"
] | |
10eddcf77b34e020d52a569c0ef1bd28d228d00d | 78cbd63ac9ae6f93f28ccc89f3650ef5525109aa | /app/src/main/java/com/example/movs_project/Model/Player.java | eb7a4f9085efa83870a81f4c6d66453026f9a818 | [] | no_license | r4ptus/Movs_Project | 0ade533f4f8f502165b5134035bddea25c12f276 | 61fc5975204bcb10ab10bb10a2ad6715dc18d155 | refs/heads/master | 2020-04-29T03:20:55.767010 | 2019-08-28T14:13:27 | 2019-08-28T14:13:27 | 175,805,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,696 | java | package com.example.movs_project.Model;
import java.io.Serializable;
public class Player implements Serializable {
private String id;
private String summonerName;
private String rank;
private String wlRatio;
private Long championPoints;
private int playerIcon;
private int championIcon;
private int spell1;
private int spell2;
private int primaryMastery;
private int primaryMastery1;
private int primaryMastery2;
private int primaryMastery3;
private int primaryMastery4;
private int perk1;
private int perk2;
private int perk3;
private int subMastery;
private int subMastery1;
private int subMastery2;
private int queueType;
private int championLvl;
private String gameType;
private int level;
public String getId(){return id;}
public String getSummonerName() {
return summonerName;
}
public void setSummonerName(String summonerName) {
this.summonerName = summonerName;
}
public int getPlayerIcon() {
return playerIcon;
}
public void setPlayerIcon(int playerIcon) {
this.playerIcon = playerIcon;
}
public int getChampionIcon() {
return championIcon;
}
public void setChampionIcon(int championIcon) {
this.championIcon = championIcon;
}
public int getSpell1() {
return spell1;
}
public void setSpell1(int spell1) {
this.spell1 = spell1;
}
public int getSpell2() {
return spell2;
}
public void setSpell2(int spell2) {
this.spell2 = spell2;
}
public int getPrimaryMastery() {
return primaryMastery;
}
public void setPrimaryMastery(int primaryMastery) {
this.primaryMastery = primaryMastery;
}
public int getSubMastery() {
return subMastery;
}
public void setSubMastery(int subMastery) {
this.subMastery = subMastery;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
public String getWlRatio() {
return wlRatio;
}
public void setWlRatio(String wlRatio) {
this.wlRatio = wlRatio;
}
public Long getChampionPoints() {
return championPoints;
}
public void setChampionPoints(Long championPoints) {
this.championPoints = championPoints;
}
public int getPrimaryMastery1() {
return primaryMastery1;
}
public void setPrimaryMastery1(int primaryMastery1) {
this.primaryMastery1 = primaryMastery1;
}
public int getPrimaryMastery2() {
return primaryMastery2;
}
public void setPrimaryMastery2(int primaryMastery2) {
this.primaryMastery2 = primaryMastery2;
}
public int getPrimaryMastery3() {
return primaryMastery3;
}
public void setPrimaryMastery3(int primaryMastery3) {
this.primaryMastery3 = primaryMastery3;
}
public int getSubMastery1() {
return subMastery1;
}
public void setSubMastery1(int subMastery1) {
this.subMastery1 = subMastery1;
}
public int getSubMastery2() {
return subMastery2;
}
public void setSubMastery2(int subMastery2) {
this.subMastery2 = subMastery2;
}
public int getPrimaryMastery4() {
return primaryMastery4;
}
public void setPrimaryMastery4(int primaryMastery4) {
this.primaryMastery4 = primaryMastery4;
}
public int getPerk1() {
return perk1;
}
public void setPerk1(int perk1) {
this.perk1 = perk1;
}
public int getPerk2() {
return perk2;
}
public void setPerk2(int perk2) {
this.perk2 = perk2;
}
public int getPerk3() {
return perk3;
}
public void setPerk3(int perk3) {
this.perk3 = perk3;
}
public int getQueueType(){return queueType;}
public int getChampionLvl() {
return championLvl;
}
public void setChampionLvl(int championLvl) {
this.championLvl = championLvl;
}
public String getGameType() {
return gameType;
}
public int getLevel() {
return level;
}
public Player(String id, String name, int playerIcon, int level)
{
this.id = id;
summonerName = name;
this.playerIcon = playerIcon;
this.level = level;
}
public Player(String id,String summonerName, String rank, String wlRatio, Long championPoints, int playerIcon, int championIcon, int spell1, int spell2, int primaryMastery, int primaryMastery1, int primaryMastery2, int primaryMastery3, int primaryMastery4, int perk1, int perk2, int perk3, int subMastery, int subMastery1, int subMastery2,int queueType,String gameType) {
this.id = id;
this.summonerName = summonerName;
this.rank = rank;
this.wlRatio = wlRatio;
this.championPoints = championPoints;
this.playerIcon = playerIcon;
this.championIcon = championIcon;
this.spell1 = spell1;
this.spell2 = spell2;
this.primaryMastery = primaryMastery;
this.primaryMastery1 = primaryMastery1;
this.primaryMastery2 = primaryMastery2;
this.primaryMastery3 = primaryMastery3;
this.primaryMastery4 = primaryMastery4;
this.perk1 = perk1;
this.perk2 = perk2;
this.perk3 = perk3;
this.subMastery = subMastery;
this.subMastery1 = subMastery1;
this.subMastery2 = subMastery2;
this.queueType = queueType;
this.gameType = gameType;
}
@Override
public String toString() {
return "Player{" +
"id=" + id +
", summonerName='" + summonerName + '\'' +
", rank='" + rank + '\'' +
", wlRatio='" + wlRatio + '\'' +
", championPoints=" + championPoints +
", playerIcon=" + playerIcon +
", championIcon=" + championIcon +
", spell1=" + spell1 +
", spell2=" + spell2 +
", primaryMastery=" + primaryMastery +
", primaryMastery1=" + primaryMastery1 +
", primaryMastery2=" + primaryMastery2 +
", primaryMastery3=" + primaryMastery3 +
", primaryMastery4=" + primaryMastery4 +
", perk1=" + perk1 +
", perk2=" + perk2 +
", perk3=" + perk3 +
", subMastery=" + subMastery +
", subMastery1=" + subMastery1 +
", subMastery2=" + subMastery2 +
'}';
}
}
| [
"[email protected]"
] | |
ac94969e6f8329b9905aa0551718d9d1cf7de664 | 7a157ff307823d28cd5438553ad23d01b16d4f7a | /core/src/main/java/com/se/algorithm/CheckSum.java | 5f58e4475f9b29b5d2e5d9d497063e97b288af8c | [] | no_license | ndqvinh2109/soft_dev_engineer | cce407c93b94b92c567f93640046369813a99e42 | 7336ad76abf1204938946619ee6c24995769d4a4 | refs/heads/master | 2020-03-27T10:10:27.617212 | 2020-03-07T12:31:04 | 2020-03-07T12:31:04 | 146,400,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,084 | java | package com.se.algorithm;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class CheckSum {
/*
An array with two integers a and b that add up to a certain number
Sample Input
arr = {1,21,3,14,5,60,7,6}
value = 27
Sample Output
arr = {21,6} or {6,21}
*/
public static int[] findSum(int[] arr, int value) {
int[] result = new int[2];
// write your code here
Map<Integer, Integer> hm = new HashMap<>();
for (int i = 0; i < arr.length; i++) {
hm.put(value - arr[i], i);
}
int k = 0;
for (int i = 0; i < arr.length; i++) {
if (hm.containsKey(arr[i])) {
result[k++] = arr[i];
}
}
return result; // return the elements in the array whose sum is equal to the value passed as parameter
}
public String solution(String s) {
char c = s.charAt(0);
if (Character.isUpperCase(c)) { // please fix condition
return "upper";
} else if (Character.isLowerCase(c)) { // please fix condition
return "lower";
} else if (Character.isDigit(c)) { // please fix condition
return "digit";
} else {
return "other";
}
}
public String solution2(int A) {
String s = String.valueOf(A);
StringBuilder returnedS = new StringBuilder();
int i = -1;
int j = s.length();
while ((i + 1) != j) {
++i;
j = s.length() - i - 1;
returnedS.append(s.charAt(i));
if (i < j) {
returnedS.append(s.charAt(j));
}
}
return returnedS.toString();
}
public static void main(String args[]) {
int[] numbers = {2, 4, 3, 5, 7, 8, 9};
int[] numbersWithDuplicates = {2, 4, 3, 5, 6, -2, 4, 7, 8, 9};
prettyPrint(numbers, 7);
prettyPrint(numbersWithDuplicates, 7);
}
/**
* Prints all pair of integer values from given array whose sum is is equal to given number. * complexity of this solution is O(n^2)
*/
public static void printPairs(int[] array, int sum) {
for (int i = 0; i < array.length; i++) {
int first = array[i];
for (int j = i + 1; j < array.length; j++) {
int second = array[j];
if ((first + second) == sum) {
System.out.printf("(%d, %d) %n", first, second);
}
}
}
}
/**
* Utility method to print input and output for better explanation.
*/
public static void prettyPrint(int[] givenArray, int givenSum) {
System.out.println("Given array : " + Arrays.toString(givenArray));
System.out.println("Given sum : " + givenSum);
System.out.println("Integer numbers, whose sum is equal to value : " + givenSum);
printPairs(givenArray, givenSum);
}
}
| [
"[email protected]"
] | |
39aa7743a56fa15d270c07a15accc8d4d8d85fd3 | 516fb367430d4c1393f4cd726242618eca862bda | /sources/com/google/android/gms/internal/ads/zzbii.java | 2294c8d9ed39fce1df182da7146c1706600ccdf4 | [] | no_license | cmFodWx5YWRhdjEyMTA5/Gaana2 | 75d6d6788e2dac9302cff206a093870e1602921d | 8531673a5615bd9183c9a0466325d0270b8a8895 | refs/heads/master | 2020-07-22T15:46:54.149313 | 2019-06-19T16:11:11 | 2019-06-19T16:11:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,279 | java | package com.google.android.gms.internal.ads;
import android.annotation.TargetApi;
import android.webkit.WebView;
import com.google.android.gms.common.util.PlatformVersion;
import com.google.android.gms.common.util.VisibleForTesting;
@zzark
final class zzbii {
@VisibleForTesting
private static Boolean zzfbi;
private zzbii() {
}
@TargetApi(19)
private static boolean zzb(WebView webView) {
boolean booleanValue;
synchronized (zzbii.class) {
if (zzfbi == null) {
try {
webView.evaluateJavascript("(function(){})()", null);
zzfbi = Boolean.valueOf(true);
} catch (IllegalStateException unused) {
zzfbi = Boolean.valueOf(false);
}
}
booleanValue = zzfbi.booleanValue();
}
return booleanValue;
}
@TargetApi(19)
static void zza(WebView webView, String str) {
if (PlatformVersion.isAtLeastKitKat() && zzb(webView)) {
webView.evaluateJavascript(str, null);
return;
}
String str2 = "javascript:";
str = String.valueOf(str);
webView.loadUrl(str.length() != 0 ? str2.concat(str) : new String(str2));
}
}
| [
"[email protected]"
] | |
55b6699fa078d3277b8b4cc419a72a018a06d58f | 3a5c12b45a772c13b3264da7655e19ab23f3e2c8 | /SessionScheduleManagementSystem_158175/src/com/cg/dao/ITrainingDAO.java | 3fc0eb810dcbda65548230f0d6fcad45c59ec168 | [] | no_license | niraj3124/final1 | 55d19e00bcead86fa1f5357de7f564a7397cd0b2 | a4bc1e7ef70919782b5c1254a2a02d4d5eff0c31 | refs/heads/master | 2020-04-01T09:09:38.756149 | 2018-10-15T06:21:52 | 2018-10-15T06:21:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.cg.dao;
import java.util.ArrayList;
import com.cg.bean.ScheduledSessions;
public interface ITrainingDAO {
ArrayList<ScheduledSessions> sessionsdatalist();
}
| [
"[email protected]"
] | |
fa4f31e1f581f6414058c837ce99a7a91f4f8236 | 5a6a40fef89bcfc07f11be40647eb4e468b3ca6f | /framework-system/system-authorization-core/src/main/java/com/zwj/system/authorication/resource/entity/ResourceEntity.java | 0f065e40311a05a8831399c0e290e510123692bb | [] | no_license | Fribblezhu/zwj-framework | 76666f57244ca52a3e3092ea76902c445cde28c1 | ff7532536a534575a719d570bbec74089302a99c | refs/heads/master | 2022-12-21T14:45:08.639438 | 2019-08-25T11:45:51 | 2019-08-25T11:45:51 | 188,528,363 | 0 | 0 | null | 2022-12-10T05:28:51 | 2019-05-25T06:17:15 | Java | UTF-8 | Java | false | false | 1,895 | java | package com.zwj.system.authorication.resource.entity;
import com.zwj.framework.common.entity.simple.GenericSortStringIdEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
/**
* @author: zwj
* @Date: 6/18/19
* @Time: 4:42 PM
* @description:
*/
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "t_resource")
public class ResourceEntity extends GenericSortStringIdEntity implements IResourceEntity{
private String name;
private String code;
private String url;
@Column(name = "image_url")
private String imageUrl;
private String comments;
private Integer typing;
@Column(name = "system_id")
private String systemId;
@Column(name = "system_code")
private String systemCode;
@Column(name = "tenant_id")
private String tenantId;
private Integer status;
@Column(name = "approval_status")
private Integer approvalStatus;
@Column(name = "is_menu")
private Integer isMenu;
@Column(name = "module_id")
private String moduleId;
@Column(name = "source_file")
private String sourceFile;
@Column(name = "invoke_function")
private String invokeFunction;
@Column(name = "parent_id")
private String parentId;
@Column(name = "level")
private String level;
@Column(name = "path")
private String path;
@ManyToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
@JoinTable(
name = "t_link_resource_pool",
joinColumns = @JoinColumn(name = "resource_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "resource_pool_id", referencedColumnName = "id")
)
private Set<ResourcePoolEntity> resourcePool = new HashSet<>();
}
| [
"[email protected]"
] | |
7ed2c7f5dd8ca8f47cdbfdf3ec2136d6a351ad96 | f836a9a6229d6fec05fa44deb4b6d9915bdaabea | /XiaoYuanFenApp/app/src/main/java/com/theaty/xiaoyuan/WBShareActivity.java | a6b6a3f1da2e16dbf56d01a84c44487720df18ef | [
"Apache-2.0"
] | permissive | fugx/XiaoYuanFen | 40be36dd3a799ce02e488d2a9ead13d8be8cb2ec | 6b936f023601fc6058ba112266d06c72147a2b62 | refs/heads/master | 2020-04-10T22:48:21.471827 | 2019-09-15T13:01:55 | 2019-09-15T13:01:55 | 161,333,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package com.theaty.xiaoyuan;
import com.umeng.socialize.media.WBShareCallBackActivity;
/**
* Created by wangfei on 15/12/3.
*/
public class WBShareActivity extends WBShareCallBackActivity {
}
| [
"[email protected]"
] | |
ecdc0b326b4bfa6263027aec6e4147dc1aab7554 | 4abd603f82fdfa5f5503c212605f35979b77c406 | /html/Programs/hw7-2-diff/r04546014-117-0/Diff.java | 1e67e41ed72589bd9eb7cbee79b887a38e7274db | [] | no_license | dn070017/1042-PDSA | b23070f51946c8ac708d3ab9f447ab8185bd2a34 | 5e7d7b1b2c9d751a93de9725316aa3b8f59652e6 | refs/heads/master | 2020-03-20T12:13:43.229042 | 2018-06-15T01:00:48 | 2018-06-15T01:00:48 | 137,424,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,388 | java | import java.io.BufferedReader;
import java.io.FileReader;
public class HandPQ {
public static void main(String[] args) throws Exception {
try (BufferedReader br = new BufferedReader(new FileReader(args[0]))) {
String[] header = br.readLine().split("","");
int count = Integer.parseInt(header[0]);
int target = Integer.parseInt(header[1]);
Hand[] hand = new Hand[count];//訂出幾個人
Card[][] card = new Card[count][];//前面格子代表每一個人,後面格子代表他的每一張牌
MinPQ pq = new MinPQ();
for (int i = 0; i < count; i++) {
String[] PlayerHand = br.readLine().split("","");//讀每一個player的手牌
card[i] = new Card[5];
for (int j = 0; j < 5; j++) {
String[] sf = PlayerHand[i].split(""_"");//讀每一張排的花色和數字
card[i][j] = new Card(sf[1], sf[0]);
}
hand[i] = new Hand(card[i]);
pq.insert(hand[i]);
if (pq.size() > target) {
pq.delMin();
}
}
Hand[] kk = new Hand[5];
Card[] anser = hand[count - target].getCards();
System.out.println(pq.delMin());
}
}
}
| [
"[email protected]"
] | |
a0fb46c2f30da7d6f82c53f6156b699e7b7b8a7b | 83ee8fc629710f12911c858b036d36094540dfd4 | /src/main/java/com/ichaoge/pet/service/impl/PhotoAlbumLabelSortServiceImpl.java | fc13d737bb0ae31a3012b1a6d8e8ea1e60ca8ffc | [] | no_license | lchaoge/ichaoge-pet | 9736da2f825cb24beba3d43e50bc299c600244c9 | 80e17fbffd170a6997b61ed43e8599b8b9a222d1 | refs/heads/master | 2020-03-27T10:05:05.217989 | 2018-09-30T09:44:53 | 2018-09-30T09:44:53 | 144,673,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,815 | java | package com.ichaoge.pet.service.impl;
import com.ichaoge.pet.dao.mapper.PhotoAlbumLabelSortMapper;
import com.ichaoge.pet.domain.entity.PhotoAlbumImageExample;
import com.ichaoge.pet.domain.entity.PhotoAlbumLabelSort;
import com.ichaoge.pet.domain.entity.PhotoAlbumLabelSortExample;
import com.ichaoge.pet.domain.inputParam.PhotoAlbumLabelSortParam;
import com.ichaoge.pet.service.iservice.PhotoAlbumLabelSortServiceI;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;
/**
* Created by chaoge on 2018/9/25.
*/
@Service
@Transactional
public class PhotoAlbumLabelSortServiceImpl extends RuntimeException implements PhotoAlbumLabelSortServiceI {
@Resource
private PhotoAlbumLabelSortMapper photoAlbumLabelSortMapper;
@Override
public int countByExample(PhotoAlbumLabelSortExample example) {
return photoAlbumLabelSortMapper.countByExample(example);
}
@Override
public int deleteByExample(PhotoAlbumLabelSortExample example) {
return photoAlbumLabelSortMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return photoAlbumLabelSortMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PhotoAlbumLabelSort record) {
return photoAlbumLabelSortMapper.insert(record);
}
@Override
public int insertSelective(PhotoAlbumLabelSort record) {
return photoAlbumLabelSortMapper.insertSelective(record);
}
@Override
public List<PhotoAlbumLabelSort> selectByExample(PhotoAlbumLabelSortParam param) {
PhotoAlbumLabelSortExample photoAlbumLabelSortExample = new PhotoAlbumLabelSortExample();
PhotoAlbumLabelSortExample.Criteria criteria = photoAlbumLabelSortExample.createCriteria();
if (param.getId()!=null) {
criteria.andIdEqualTo(param.getId());
}
if (param.getPhotoAlbumId()!=null) {
criteria.andPhotoAlbumIdEqualTo(param.getPhotoAlbumId());
}
if(param.getLabelSortId()!=null){
criteria.andLabelSortIdEqualTo(param.getLabelSortId());
}
photoAlbumLabelSortExample.setOrderByClause("id desc");
return photoAlbumLabelSortMapper.selectByExample(photoAlbumLabelSortExample);
}
@Override
public PhotoAlbumLabelSort selectByPrimaryKey(Long id) {
return photoAlbumLabelSortMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PhotoAlbumLabelSort record) {
return photoAlbumLabelSortMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PhotoAlbumLabelSort record) {
return photoAlbumLabelSortMapper.updateByPrimaryKey(record);
}
}
| [
"[email protected]"
] | |
f1bef67fa56a5864a85840735d782107e8b3661f | 5ee94bb2987ce16eea872f4ad8e30427213382d5 | /src/main/java/com/qy/test/service/AuditEventService.java | 4fca78726a22ccf4c8fbf843b69fbeede4cf308c | [] | no_license | jiangzhixiao/jhipsterSampleApplication | 302435560a29d83cd9bebe0d725229a40adf66b6 | 90383670776ca5d8e0269e24073a3db4dd23c652 | refs/heads/master | 2021-08-18T23:41:38.198239 | 2017-11-24T07:15:58 | 2017-11-24T07:15:58 | 111,887,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,761 | java | package com.qy.test.service;
import com.qy.test.config.audit.AuditEventConverter;
import com.qy.test.repository.PersistenceAuditEventRepository;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.util.Optional;
/**
* Service for managing audit events.
* <p>
* This is the default implementation to support SpringBoot Actuator AuditEventRepository
*/
@Service
@Transactional
public class AuditEventService {
private final PersistenceAuditEventRepository persistenceAuditEventRepository;
private final AuditEventConverter auditEventConverter;
public AuditEventService(
PersistenceAuditEventRepository persistenceAuditEventRepository,
AuditEventConverter auditEventConverter) {
this.persistenceAuditEventRepository = persistenceAuditEventRepository;
this.auditEventConverter = auditEventConverter;
}
public Page<AuditEvent> findAll(Pageable pageable) {
return persistenceAuditEventRepository.findAll(pageable)
.map(auditEventConverter::convertToAuditEvent);
}
public Page<AuditEvent> findByDates(Instant fromDate, Instant toDate, Pageable pageable) {
return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable)
.map(auditEventConverter::convertToAuditEvent);
}
public Optional<AuditEvent> find(Long id) {
return Optional.ofNullable(persistenceAuditEventRepository.findOne(id)).map
(auditEventConverter::convertToAuditEvent);
}
}
| [
"[email protected]"
] | |
c49083f63a58bbe207b8c84a191b9a3a510a2b57 | 81346305002f13a0e3ae8b45541ad92318d67a8e | /app/src/androidTest/java/calculator/charan/com/ExampleInstrumentedTest.java | c36b4dfd1ef8f968e0a1e2d14d52a14aeb4ba885 | [] | no_license | CharanRamasamy/Calculator_Application | 56d3f0f5bac076998d69121f35963317adf5b5ad | 14a5955da4665eb7edfdd6199a9f692174d35f53 | refs/heads/master | 2021-09-07T16:22:14.881363 | 2018-02-26T03:09:15 | 2018-02-26T03:09:15 | 122,810,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | package calculator.charan.com;
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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("calculator.charan.com", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
7ab3f05a3fab4b5f09ab8bd6ab10ef43a3bf18e3 | 8db683ef2d51905b802de02f4a53e9e16c87d5ec | /src/main/java/gwt/material/design/addins/client/pinch/events/OnZoomStartEvent.java | d91ca6e1692717fd0f9b7b04d9f88ae88dee8c4f | [
"Apache-2.0"
] | permissive | GwtMaterialDesign/gwt-material-addins | 9ed4a713bbd66a2f7971d8372825d9ee561a410a | 8b25a900f8855d043a32d581eae9e8a2eb21cedc | refs/heads/master | 2023-09-04T11:22:48.392326 | 2023-07-28T00:00:38 | 2023-07-28T00:00:38 | 46,502,665 | 40 | 57 | Apache-2.0 | 2023-07-28T00:00:40 | 2015-11-19T15:49:50 | JavaScript | UTF-8 | Java | false | false | 1,456 | java | /*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2022 GwtMaterialDesign
* %%
* 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%
*/
package gwt.material.design.addins.client.pinch.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HasHandlers;
public class OnZoomStartEvent extends GwtEvent<OnZoomStartEvent.OnZoomStartHandler> {
public interface OnZoomStartHandler extends EventHandler {
void onOnZoomStart(OnZoomStartEvent event);
}
public static final Type<OnZoomStartHandler> TYPE = new Type<>();
public static void fire(HasHandlers source) {
source.fireEvent(new OnZoomStartEvent());
}
@Override
public Type<OnZoomStartHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(OnZoomStartHandler handler) {
handler.onOnZoomStart(this);
}
} | [
"[email protected]"
] | |
26e09596e8d7159fc47b47d3c4e49bbb79b711e8 | 9ec0abada6f1930fc42f249ff60cd1a3b5f63bad | /src/buyersDetails.java | 250a5edb83969fbb7c472f080bd1b98a14595493 | [] | no_license | modiS24/Payment-Billing-System | b0764190ea589cb1f0cbcea11f4d7e699d8949ea | edd3d437ec02836b0fc5f44c3d339660264f9385 | refs/heads/master | 2022-11-27T10:52:14.077948 | 2020-08-06T10:37:47 | 2020-08-06T10:37:47 | 260,142,572 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,719 | java | import javax.swing.JTable;
import java.sql.*;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
import project.ConnectionProvider;
/*
* 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 hp
*/
public class buyersDetails extends javax.swing.JFrame {
/**
* Creates new form buyersDetails
*/
public buyersDetails() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jSeparator2 = new javax.swing.JSeparator();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setLocation(new java.awt.Point(380, 200));
setUndecorated(true);
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
});
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Buyers Details ani.gif"))); // NOI18N
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(171, 0, -1, -1));
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buyer Details.png"))); // NOI18N
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(104, 0, -1, -1));
getContentPane().add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, 576, 10));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(22, 95, 566, 289));
getContentPane().add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 402, 576, 10));
jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/print.png"))); // NOI18N
jButton1.setText("Print");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 419, -1, -1));
jButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/close Jframe.png"))); // NOI18N
jButton2.setText("Close");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(477, 419, -1, -1));
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/all page background image.png"))); // NOI18N
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 600, 450));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
setVisible(false);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
try{
jTable1.print(JTable.PrintMode.NORMAL);
}
catch(Exception e){}
}//GEN-LAST:event_jButton1ActionPerformed
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
// TODO add your handling code here:
try{
Connection con=ConnectionProvider.getcon();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from buyer");
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_formComponentShown
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(buyersDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(buyersDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(buyersDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(buyersDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new buyersDetails().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
181eaf20af179b7ad386325a31b06246b75b85af | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/com/amap/location/offline/b/b/c.java | 27ab0159268bf50b54494a84d62eecee1c3e3040 | [] | no_license | shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391040 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package com.amap.location.offline.b.b;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/* compiled from: LocationDbOpenHelper */
class c extends SQLiteOpenHelper {
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
}
c(Context context) {
super(context, "OffLocation.db", null, 1);
}
public void onCreate(SQLiteDatabase sQLiteDatabase) {
a.a(sQLiteDatabase);
b.a(sQLiteDatabase);
}
}
| [
"[email protected]"
] | |
0a3f6ac926671b39fd4062ef8d76bda6af6c2127 | b261ec37d68557f3340e4265a05e27560f90034f | /android-navy/src/com/jonnyzzz/android/navy/CurrentWifis.java | 192fdb022da6d8346f0f88203476787ce43a1946 | [] | no_license | jonnyzzz/android-navy | ecfd5c1d4394955943a62d26d9814278f7c5f6b5 | e59f988747b11ff029c339fb31a30318559f82cf | refs/heads/master | 2021-01-21T06:55:29.486683 | 2013-05-17T22:01:05 | 2013-05-17T22:01:05 | 34,039,208 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,146 | java | package com.jonnyzzz.android.navy;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
public class CurrentWifis extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (!wifi.isWifiEnabled()) {
Toast.makeText(getApplicationContext(), "wifi is disabled... making it enabled", Toast.LENGTH_LONG).show();
wifi.setWifiEnabled(true);
}
final ListView lv = (ListView) findViewById(R.id.main_wifis_list);
final List<ScanViewItem> detectedWifis = new ArrayList<ScanViewItem>();
final ScanLog myLog = new ScanLog();
final AtomicReference<ScanState> myPersistedState = new AtomicReference<ScanState>(new ScanState());
final AtomicBoolean myScanRunning = new AtomicBoolean(false);
final AtomicBoolean myShowDiff = new AtomicBoolean(false);
final ArrayAdapter<ScanViewItem> adapter = new ArrayAdapter<ScanViewItem>(CurrentWifis.this, R.layout.list_item, detectedWifis) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
row = CurrentWifis.this.getLayoutInflater().inflate(R.layout.list_item, parent, false);
}
final ScanViewItem item = detectedWifis.get(position);
final TextView bssid = (TextView) row.findViewById(R.id.listItem_BSSID);
final TextView level = (TextView) row.findViewById(R.id.listItem_Level);
final TextView diff = (TextView) row.findViewById(R.id.listItem_selected_Level);
bssid.setText(item.getBSSID());
level.setText(n(item.getActualLevel()));
diff.setText(n(item.getRecordedLevel()));
diff.setVisibility(!myShowDiff.get() || item.getRecordedLevel() == null ? View.INVISIBLE : View.VISIBLE);
level.setVisibility(item.getActualLevel() == null ? View.INVISIBLE : View.VISIBLE);
level.setBackgroundResource(item.isMatch() ? R.color.wifi_list_actual_bg_matching : R.color.wifi_list_actual_bg_default);
diff.setBackgroundResource(item.isMatch() ? R.color.wifi_list_stored_bg_matching : R.color.wifi_list_stored_bg_default);
return row;
}
@NotNull
private String n(Object o) {
if (o == null) return "-\u221E";
return o.toString();
}
};
lv.setAdapter(adapter);
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context c, Intent intent) {
final List<ScanResult> results = wifi.getScanResults();
final ScanState ss = new ScanState();
for (ScanResult result : results) {
ss.add(result);
}
detectedWifis.clear();
detectedWifis.addAll(ScanState.toItems(ss, myPersistedState.get()));
adapter.notifyDataSetChanged();
myLog.addResults(ss);
if (myScanRunning.get()) {
wifi.startScan();
}
}
}, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
findViewById(R.id.main_share_scan).setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
myScanRunning.set(!myScanRunning.get());
if (myScanRunning.get()) {
wifi.startScan();
}
updateScanButton(myScanRunning.get());
}
});
findViewById(R.id.main_share_button).setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
i.putExtra(Intent.EXTRA_SUBJECT, "[scan]");
i.setType("plain/text");
final Gson gson = new GsonBuilder().setPrettyPrinting().create();
i.putExtra(Intent.EXTRA_TEXT, "Data:\r\n" + gson.toJson(myLog));
myLog.reset();
myScanRunning.set(false);
updateScanButton(false);
view.getContext().startActivity(i);
}
});
findViewById(R.id.main_store).setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
myShowDiff.set(true);
myPersistedState.set(myLog.getLatestState());
}
});
}
private void updateScanButton(boolean scanning) {
final Button bt = (Button) findViewById(R.id.main_share_scan);
if (scanning) {
bt.setText("Stop Scan!");
} else {
bt.setText("Re-Start Scan!");
}
}
}
| [
"[email protected]"
] | |
8d24361e708afe2fbfe7fb4347a3e4ce1be47b42 | 19836412c3b323e12ad3b9f105f0ff9b46a5a3d8 | /src/main/java/br/com/zupacademy/achiley/casadocodigo/shared/ExistsId.java | e97765fbc85d9ed55b26aa983774c1b9898692b0 | [
"Apache-2.0"
] | permissive | achileyd/orange-talents-06-template-casa-do-codigo | 8414014458c8e6e062da5bdeafc2ae6a66ceb594 | 12fc8fc925967c8da3f61088ba541a3b52174fff | refs/heads/main | 2023-06-16T23:41:33.231039 | 2021-07-06T23:17:46 | 2021-07-06T23:17:46 | 381,093,239 | 0 | 0 | Apache-2.0 | 2021-06-28T16:17:57 | 2021-06-28T16:17:57 | null | UTF-8 | Java | false | false | 693 | java | package br.com.zupacademy.achiley.casadocodigo.shared;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@Documented
@Constraint(validatedBy = ExistsIdValidator.class)
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ExistsId {
String message() default "{br.com.zupacademy.achiley.casadocodigo.shared.existsid}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
Class<?> domainClass();
}
| [
"[email protected]"
] | |
9c643661ea50ccab6f21016d15e100517f6ff77d | 8599e98dbb858029185fad43690cb94f113329e1 | /exercicosDiversos/src/TesteDeSelecao1.java | b8f8013f37a85f3d985a1bb0fa847207bcdb0e8c | [] | no_license | irandijunior1903/ExerciciosJava8 | bb4d08139c3382388886fbde91aba27cad977c52 | 111e158ef116a816a06e0bffdc461e6caafba5ca | refs/heads/master | 2021-04-06T05:25:02.390904 | 2018-03-14T19:45:43 | 2018-03-14T19:45:43 | 125,263,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | import java.util.Scanner;
public class TesteDeSelecao1 {
public static void main(String []agrs) {
Scanner scan = new Scanner(System.in);
String [] numeros = scan.nextLine().split(" ");
int A = Integer.parseInt(numeros[0]);
int B = Integer.parseInt(numeros[1]);
int C = Integer.parseInt(numeros[2]);
int D = Integer.parseInt(numeros[3]);
boolean condicao = (B>C && D >A) && (C+D > A+B) && (C > 0 && D >0) && A==C;
if (condicao == true) {
System.out.println("Valores aceitos");
} else {
System.out.println("Valores nao aceitos");
}
scan.close();
}
}
| [
"[email protected]"
] | |
bc3a3592c11e9a54b9fabadb68532d20ad1c105d | 96123253a553675c0d5a95902a4b21e3861fb70d | /FinancasPessoais/src/app/model/Despesa.java | ca8dca6d0b250bf002a2b29a83133de43df5dee5 | [] | no_license | diogocs1/FPessoais | f24626e23ad972d4cbb12004c2b248f736590750 | 0ecef2c9d443e13e1a453665ab0cedfa831cfa3e | refs/heads/master | 2021-01-01T19:39:10.709185 | 2014-03-20T12:59:00 | 2014-03-20T12:59:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,114 | java | package app.model;
import javafx.scene.control.Dialogs;
import app.logica.Verifica;
public class Despesa {
private int id;
private Usuario pessoa;
private String descricao;
private String vencimento;
private String status;
private String prioridade;
private double valor;
public Despesa (int id,Usuario pessoa, String descricao, String vencimento, String prioridade,String status, double valor) throws IllegalArgumentException{
setId(id);
setPessoa(pessoa);
setDescricao(descricao);
setVencimento(vencimento);
setPrioridade(prioridade);
setStatus(status);
setValor(valor);
}
public Despesa (Usuario pessoa, String descricao, String vencimento, String prioridade,String status, double valor) throws IllegalArgumentException{
setPessoa(pessoa);
setDescricao(descricao);
setVencimento(vencimento);
setPrioridade(prioridade);
setStatus(status);
setValor(valor);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public String getVencimento() {
return vencimento;
}
public void setVencimento(String vencimento){
try{
if (Verifica.validaData(vencimento)){
this.vencimento = vencimento;
}
}catch (IllegalArgumentException e){
Dialogs.showErrorDialog(null, "Data inválida!");
}
}
public String getPrioridade() {
return prioridade;
}
public void setPrioridade(String prioridade) {
this.prioridade = prioridade;
}
public double getValor() {
return valor;
}
public void setValor(double valor) throws IllegalArgumentException{
if (valor >= 0){
this.valor = valor;
}else{
throw new IllegalArgumentException("Valor inválido!");
}
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Usuario getPessoa() {
return pessoa;
}
public void setPessoa(Usuario pessoa) {
this.pessoa = pessoa;
}
@Override
public String toString() {
return vencimento + " : "+ descricao;
}
} | [
"diogo@diogo-14F"
] | diogo@diogo-14F |
af1c3be9ad78d10358d26e6d87691d1c3dfb5ed2 | ef8c08782883cc81fa1ae1a57b44c1b6340db20d | /ev/endrov/flowBasic/logic/EvOpNotImage.java | 93d50d1b8817f051cdbd8aa61c0cad4cf40c77c8 | [] | no_license | javierfdr/Endrov-collaboration | 574b9973bfa1d63748c7ad79cbb7f552fba51f8f | c45cdae3b977cf3167701d45403d900b22501291 | refs/heads/master | 2020-05-21T11:42:29.363246 | 2010-09-20T15:24:02 | 2010-09-20T15:24:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | /***
* Copyright (C) 2010 Johan Henriksson
* This code is under the Endrov / BSD license. See www.endrov.net
* for the full text and how to cite.
*/
package endrov.flowBasic.logic;
import endrov.flow.EvOpSlice1;
import endrov.imageset.EvPixels;
import endrov.imageset.EvPixelsType;
/**
* NOT a
* @author Johan Henriksson
*/
public class EvOpNotImage extends EvOpSlice1
{
public EvPixels exec1(EvPixels... p)
{
return not(p[0]);
}
private static EvPixels not(EvPixels a)
{
//Should use the common higher type here
a=a.getReadOnly(EvPixelsType.INT);
int w=a.getWidth();
int h=a.getHeight();
EvPixels out=new EvPixels(a.getType(),w,h);
int[] aPixels=a.getArrayInt();
int[] outPixels=out.getArrayInt();
for(int i=0;i<aPixels.length;i++)
outPixels[i]=aPixels[i]!=0 ? 0 : 1;
return out;
}
} | [
"[email protected]"
] | |
b9d0fcf94e8caaa579c959f7c019ecb4810697d6 | e615101180a1d3e78cbd1d66162ec42b8999bb9c | /lims-integration/src/gen/java/clarity/com/genologics/ri/containertype/CalibrantWell.java | a977c1e60fded6ef56e413416329e85c4954bcaa | [] | no_license | espre05/test-projects | 7522a76d41e6e6a822d2475e8246aab1730f2e46 | 26120053987e7570f0697a7e80b395edc0899475 | refs/heads/master | 2021-01-18T21:29:49.198194 | 2016-04-26T20:26:55 | 2016-04-26T20:26:55 | 31,580,648 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,453 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// 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: 2015.07.18 at 10:21:26 AM PDT
//
package com.genologics.ri.containertype;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
*
* Deprecated, this property is no longer supported.
* Calibrant-well is a child element of container type and identifies a well location that is
* reserved for calibrants in containers of the container type.
*
*
* <p>Java class for calibrant-well complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="calibrant-well">
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "calibrant-well", propOrder = {
"value"
})
public class CalibrantWell {
@XmlValue
protected String value;
@XmlAttribute(name = "name")
protected String name;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
}
| [
"pnatarajan"
] | pnatarajan |
978f9e105ea2b6f11ebba4f3fa020dfd59abd840 | eac0b43bd7bf55f9c59c6867cc52706f5a8b9c1c | /eshop-v3/eshop-promotion/src/main/java/com/zhss/eshop/promotion/api/PromotionService.java | 32c156204bcaceed12802727e6045f31bbf2558d | [] | no_license | fengqing90/Learn | b017fa9d40cb0592ee63f77f620a8a8f39f046b9 | 396f48eddb5b78a4fdb880d46ea1f2b109b707e4 | refs/heads/master | 2022-11-22T01:44:05.803929 | 2021-08-04T03:57:26 | 2021-08-04T03:57:26 | 144,801,377 | 0 | 3 | null | 2022-11-16T06:59:58 | 2018-08-15T03:29:15 | Java | UTF-8 | Java | false | false | 3,816 | java | package com.zhss.eshop.promotion.api;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zhss.eshop.common.util.DateProvider;
import com.zhss.eshop.common.util.ObjectUtils;
import com.zhss.eshop.promotion.constant.CouponStatus;
import com.zhss.eshop.promotion.dao.CouponAchieveDAO;
import com.zhss.eshop.promotion.dao.CouponDAO;
import com.zhss.eshop.promotion.dao.PromotionActivityDAO;
import com.zhss.eshop.promotion.domain.CouponAchieveDO;
import com.zhss.eshop.promotion.domain.CouponDTO;
import com.zhss.eshop.promotion.domain.PromotionActivityDTO;
/**
* 促销中心service组件
* @author zhonghuashishan
*
*/
@RestController
public class PromotionService implements PromotionApi {
private static final Logger logger = LoggerFactory.getLogger(PromotionService.class);
/**
* 促销活动管理DAO组件
*/
@Autowired
private PromotionActivityDAO promotionActivityDAO;
/**
* 优惠券领取记录管理DAO组件
*/
@Autowired
private CouponAchieveDAO couponAchieveDAO;
/**
* 优惠券管理DAO组件
*/
@Autowired
private CouponDAO couponDAO;
/**
* 日期辅助组件
*/
@Autowired
private DateProvider dateProvider;
/**
* 根据商品id查询促销活动
* @param goodsId 商品id
* @return 促销活动
*/
@Override
public List<PromotionActivityDTO> listByGoodsId(@PathVariable("goodsId") Long goodsId) {
try {
return ObjectUtils.convertList(promotionActivityDAO.listEnabledByGoodsId(goodsId),
PromotionActivityDTO.class);
} catch (Exception e) {
logger.error("error", e);
return new ArrayList<PromotionActivityDTO>();
}
}
/**
* 根据id查询促销活动
* @param id 促销活动id
* @return 促销活动
*/
@Override
public PromotionActivityDTO getById(@PathVariable("id") Long id) {
try {
return promotionActivityDAO.getById(id).clone(PromotionActivityDTO.class);
} catch(Exception e) {
logger.error("Error", e);
return null;
}
}
/**
* 查询用户当前可以使用的有效优惠券
* @param userAccountId 用户账号id
* @return 有效优惠券
*/
@Override
public List<CouponDTO> listValidByUserAccountId(@PathVariable("userAccountId" )Long userAccountId) {
List<CouponDTO> coupons = new ArrayList<CouponDTO>();
try {
List<CouponAchieveDO> couponAchieves = couponAchieveDAO
.listUnsedByUserAccountId(userAccountId);
for(CouponAchieveDO couponAchieve : couponAchieves) {
CouponDTO coupon = couponDAO.getById(couponAchieve.getCouponId())
.clone(CouponDTO.class);
if(CouponStatus.GIVING_OUT.equals(coupon.getStatus()) ||
CouponStatus.GIVEN_OUT.equals(coupon.getStatus())) {
coupons.add(coupon);
}
}
} catch (Exception e) {
logger.error("error", e);
}
return coupons;
}
/**
* 使用优惠券
* @param couponId 优惠券id
* @param userAccountId 用户账号id
* @return 处理结果
*/
@Override
public Boolean useCoupon(
@RequestParam("couponId") Long couponId,
@RequestParam("userAccountId") Long userAccountId) {
try {
CouponAchieveDO couponAchieve = new CouponAchieveDO();
couponAchieve.setCouponId(couponId);
couponAchieve.setUserAccountId(userAccountId);
couponAchieve.setUsed(1);
couponAchieve.setUsedTime(dateProvider.getCurrentTime());
couponAchieve.setGmtModified(dateProvider.getCurrentTime());
couponAchieveDAO.update(couponAchieve);
return true;
} catch (Exception e) {
logger.error("error", e);
return false;
}
}
}
| [
"[email protected]"
] | |
92643958690d4de2f3e1f36bf39d38cb87b425b2 | 240cd759084c2058000629ece5295db6ad3cd011 | /Cipher.java | 757a5606a794313741140c32f08516a56ccf0ccf | [] | no_license | SheshanVerma/KryptoNote | c0d0a2e47d46ec4bbeb11c903063a5c36be07407 | 8d74867df65d4bc98464d3a09b0181f6c240fa5d | refs/heads/main | 2023-03-06T12:35:29.951181 | 2021-02-18T19:05:55 | 2021-02-18T19:05:55 | 340,149,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,616 | java | package com.example.kryptonote;
public class Cipher {
private String key;
public static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public Cipher (String k)
{
this.key = k;
}
public String makePad(String note)
{
String pad = this.key;
for (; pad.length()<note.length();)
{
pad += this.key;
}
return pad;
}
public String encrypt(String note)
{
String pad = makePad(note);
String result = " ";
for (int i =0; i<note.length();i++)
{
String c = note.substring(i,i+1);
int position = ALPHABET.indexOf(c);
int shift = Integer.parseInt(pad.substring(i,i+1));
int newPosition = (position + shift) % ALPHABET.length();
result = result + ALPHABET.substring(newPosition,newPosition + 1);
}
return result;
}
public String decrypt (String note)
{
String pad = makePad(note);
String result = " ";
for (int i =0; i<note.length();i++)
{
String c = note.substring(i,i+1);
int position = ALPHABET.indexOf(c);
int shift = Integer.parseInt(pad.substring(i,i+1));
int newPosition = (position - shift) % ALPHABET.length();
if(newPosition<0)
{
newPosition = newPosition + ALPHABET.length();
}
result = result + ALPHABET.substring(newPosition,newPosition + 1);
}
return result;
}
} | [
"[email protected]"
] | |
e4ee93d2cf2b2fb6dcef8746090aaab151ff48a6 | 063645fddba17020cfb5a6aecd553a73e6e7b368 | /src/main/java/demo/service/impl/LocationServiceImpl.java | cc828706ed60e4a2ac9a13cdf045be095483b4db | [] | no_license | huixiangye/running-location-service | 7ef8780dd0e13f88ee4811e3ae32151f3bb7b93e | 82c0e0710412c9b6e6e4fbdd9fdb22fef1260e30 | refs/heads/master | 2020-03-21T21:33:13.364247 | 2018-08-09T05:57:51 | 2018-08-09T05:57:51 | 139,069,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,389 | java | package demo.service.impl;
import demo.domain.Location;
import demo.domain.LocationRepository;
import demo.service.LocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by yehuixiang on 6/27/18.
*/
@Service
public class LocationServiceImpl implements LocationService {
private LocationRepository locationRepository;
//依赖注入构造器注入
@Autowired
public LocationServiceImpl(LocationRepository locationRepository){
this.locationRepository = locationRepository;
}
@Override
public List<Location> saveRunningLocation(List<Location> runningLocations) {
return locationRepository.save(runningLocations);
}
@Override
public void deleteAll() {
locationRepository.deleteAll();
}
@Override
public Page<Location> findByRunnerMovementType(String movementType, Pageable pageable) {
return locationRepository.findByRunnerMovementType(Location.RunnerMovementType.valueOf(movementType),pageable);
}
@Override
public Page<Location> findByUnitInfoRunningId(String runningId, Pageable pageable) {
return locationRepository.findByUnitInfoRunningId(runningId, pageable);
}
}
| [
"[email protected]"
] | |
7476a5b63d32dfc4461a8833ac8fdb221277ee32 | 8effa66fd73517132374fc16441f97780dcb3204 | /src/main/java/com/lujunjie/mediator/PartyMember.java | 8bf468b0e1d2c9575f14c22db261d80761140bdc | [] | no_license | Lujnjie/DemoDesignPatternt | 3230d0523d9cd8c16977a29d4c5e913e0435b222 | 77ad4d5efbd3f20fd4013c725a0aadb0717a9c0c | refs/heads/master | 2022-11-23T22:24:12.963854 | 2020-07-17T10:25:12 | 2020-07-17T10:25:12 | 278,973,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | package com.lujunjie.mediator;
public interface PartyMember {
void joinParty(Party party);
void partyAction(Action action);
void act(Action action);
}
| [
"[email protected]"
] | |
3d2cfc69bbdf3700e7b8b65c24ce0d461773e24e | 276bb8cca5c46a36a56f89a8e62497cf9399654e | /src/test/java/com/example/projectb/ProjectBApplicationTests.java | 625124c3675352f54cf5495af813ecd47b6d99b0 | [] | no_license | VMormoris/ProjectB | c04fe277ae0c600b01ab62875007f7af537bcb54 | e543aa4f352e970e6ef85fd0b22bc57996333526 | refs/heads/master | 2023-02-11T17:27:07.275684 | 2021-01-05T10:27:09 | 2021-01-05T10:27:09 | 326,952,414 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package com.example.projectb;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ProjectBApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
6fafe97e7718b2a108234f581737d133b29791a0 | 32eadf6e58249fcc36492df12a956db2e11de86a | /test/generics/MS_2.java | c3ad0eeee5f7305b491698aaa35d8d1ade3ad47a | [] | no_license | saiema/MuJava | a9dd8f9a3180d6390ff3f18f28627af3c096c7c8 | a4e126f703f7c9ea8f9712e20ad903aea0eec4cf | refs/heads/master | 2022-09-19T03:00:35.748422 | 2022-09-12T18:04:32 | 2022-09-12T18:04:32 | 23,648,721 | 4 | 0 | null | 2019-04-17T12:14:56 | 2014-09-04T04:43:48 | Java | UTF-8 | Java | false | false | 196 | java | package generics;
import java.util.List;
public class MS_2 {
public void defMethod(List<Integer> param1){}
public void radiatedMethod() {
int i = 1;
int j = i++; //mutGenLimit 1
}
}
| [
"[email protected]"
] | |
6ae630f8e544acf7b28e4b9e7ffdb2a6ca58bfc0 | 2309df7664bf6797884c629feeac1a702468b7c8 | /qunyingzhuan/src/main/java/com/mrrun/qunyingzhuan/ui/chapter6/view/ShadowView.java | 86fa0a6a5ab9075a911578dfed4cbba3b46956c8 | [] | no_license | 1218683832/QunYingZhuan | af5593ab6dc659ad3d3307cee08606c13def4e55 | 751683e5a0dcbbefc7994670f522b4508ab127f5 | refs/heads/master | 2021-01-25T09:52:37.624057 | 2018-02-28T18:23:35 | 2018-02-28T18:23:35 | 123,324,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,341 | java | package com.mrrun.qunyingzhuan.ui.chapter6.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by lipin on 2017/10/24.
* 具有倒影效果的图片
*/
public class ShadowView extends View {
private Bitmap mSrcBtimap, mRefBitmap;
private Paint mPaint;
private LinearGradient mLinearGradient;
private Matrix matrix;
public ShadowView(Context context) {
super(context);
init();
}
public ShadowView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
public ShadowView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
mPaint = new Paint();
matrix = new Matrix();
matrix.setScale(1f, -1f);// 图片垂直翻转
mSrcBtimap = ((BitmapDrawable) this.getBackground()).getBitmap();
mRefBitmap = Bitmap.createBitmap(mSrcBtimap,0, 0, mSrcBtimap.getWidth(), mSrcBtimap.getHeight(),
matrix, true);
mLinearGradient = new LinearGradient(0, mSrcBtimap.getHeight(), 0,
mSrcBtimap.getHeight() + mSrcBtimap.getHeight(), 0XDD000000, 0X10000000, Shader.TileMode.CLAMP);
mPaint.setShader(mLinearGradient);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.WHITE);// 绘制画布背景色
canvas.drawBitmap(mSrcBtimap, 0, 0, null);// 绘制原图
canvas.drawBitmap(mRefBitmap, 0, mSrcBtimap.getHeight(), null);// 绘制原图垂直翻转后的图
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));// 先画的图形
canvas.drawRect(0f, mSrcBtimap.getHeight(), mSrcBtimap.getWidth(), mSrcBtimap.getHeight() * 2, mPaint);// 绘制倒影遮盖层,渐变效果
mPaint.setXfermode(null);
}
} | [
"[email protected]"
] | |
80bae3d8c9ae61177f560521537dd7d274402507 | c43b36b0b5082d47a886df96a0efefbc158e0c16 | /app/src/main/java/com/cogent/harikrishna/cogentcptopt/adapterClasses/Searchadapter.java | 7121c5bb5487b43ba27dc47d56d576c2f0715430 | [] | no_license | cptopt/cogentcptopt | 3fd5c60b91575f5966cf34542197bbd8452bbc03 | 2c04ff6fdda3c101a67472365fa755e72b531dda | refs/heads/master | 2021-01-09T06:15:01.816369 | 2016-08-20T09:15:48 | 2016-08-20T09:15:48 | 63,135,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | package com.cogent.harikrishna.cogentcptopt.adapterClasses;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import com.cogent.harikrishna.cogentcptopt.subTabs.CompaniesTab;
import com.cogent.harikrishna.cogentcptopt.subTabs.Jobstab;
import com.cogent.harikrishna.cogentcptopt.subTabs.Salariestab;
/**
* Created by Hari Krishna on 7/15/2016.
*/
public class Searchadapter extends FragmentStatePagerAdapter {
int mNumoftabs;
public Searchadapter(FragmentManager fm, int NumOfTabs) {
super(fm);
this.mNumoftabs = NumOfTabs;
}
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
Jobstab job = new Jobstab();
return job;
case 1:
CompaniesTab companies = new CompaniesTab();
return companies;
case 2:
Salariestab salaries = new Salariestab();
return salaries;
}
return null;
}
@Override
public int getCount() {
return mNumoftabs;
}
}
| [
"[email protected]"
] | |
a45e9485bdee5b19d54773e526b04f134cfa4e71 | c213992f2840abf90f8b55ee4a5327827d57326a | /Library1_JSE2/src/library1/TBook.java | b47fcdaa2615f6fd178603bdd3c3612eb6b19f53 | [] | no_license | Koval92/ISM_Labs | 74ce7794fd65a3c21f7a1516f5e6be3b33baaaec | 688edad7bdeb3a7e88ab2aa362bbc20f1b5f8a2f | refs/heads/master | 2021-01-13T09:09:56.511041 | 2015-04-01T20:19:05 | 2015-04-01T20:19:05 | 32,418,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,732 | java | package library1;
import java.util.Date;
import java.util.Objects;
public class TBook {
private int number;
private TLoan loan = null;
TTitle_book mTitle_book;
public TLoan getLoan() {
return loan;
}
public void setLoan(TLoan loan) {
this.loan = loan;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public TTitle_book getmTitle_book() {
return mTitle_book;
}
public void setmTitle_book(TTitle_book mTitle_book) {
this.mTitle_book = mTitle_book;
}
public boolean period_pass(Object data) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void startPeriod(Object data) {
}
public Date getPeriod() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setPeriod(Date period) {
}
@Override
public String toString() {
return mTitle_book.toString() + " Number: " + number + loanToString();
}
@Override
public int hashCode() {
int hash = 7;
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TBook other = (TBook) obj;
if (this.number != other.number) {
return false;
}
if (!Objects.equals(this.mTitle_book, other.mTitle_book)) {
return false;
}
return true;
}
private String loanToString() {
return loan == null ? "" : loan.getClientAsString();
}
}
| [
"[email protected]"
] | |
fde5027c87f2e024fec944c38dfd1c0076d015ba | d502ba2480aea84241f3bd98578a887849df9df8 | /karen.margaryan/StructuralPatterns/AdapterPattern/src/adapter/player/test/Main.java | b7e6f4a28df9372e8b4a5500715d0d0f6f743f9a | [] | no_license | synergytrainings/design-patterns | 821ba0e4c6c0c09ef892312256f6cdcf7e0736f4 | f0fd39de32c3f9f7f6b13377904a0c29589720bc | refs/heads/master | 2020-12-25T19:26:01.181499 | 2015-04-17T05:15:03 | 2015-04-17T05:15:17 | 25,835,095 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package adapter.player.test;
import adapter.player.MyUniversalPlayer;
public class Main {
public static void main(String[] args) {
MyUniversalPlayer universalPlayer = new MyUniversalPlayer();
universalPlayer.play("mp4", "PrideAndPrejudice.mp4");
universalPlayer.play("mp3", "AndreaBochelli.mp3");
}
}
| [
"[email protected]"
] | |
5b5b82701bc0bd5daacfe01ec2060caf7e135f16 | 1e20b24cc8e09cc21fc4dc95ba2f89e20757e235 | /SpringMVC+Mybatis/Learn_Spring/src/dynamicProxy/UserBImpl.java | 2904cf1824a2ab0ed8c82b198fe768e81300a80a | [] | no_license | Cooper111/Spring_Note | b642d44c1fa9c483247a4a65a16a281940a10236 | 477ab1dd6a1d158342be90f6109e3396ca2a48b8 | refs/heads/master | 2020-12-03T21:39:27.008298 | 2020-02-06T19:01:14 | 2020-02-06T19:01:14 | 231,494,260 | 2 | 0 | null | null | null | null | GB18030 | Java | false | false | 274 | java | package dynamicProxy;
public class UserBImpl implements UserB{
@Override
public void save() {
System.out.println("正在保存B类用户……");
}
@Override
public void update() {
System.out.println("正在更新B类用户……");
}
}
| [
"[email protected]"
] | |
5ce46c58a0f6e2e20b0838532820875cf76ac7fe | 16416e8e889a80fb1c66e433085c1d9a3bc96d8f | /app/src/main/java/id/ac/unud1805551035/Mahasiswa.java | ebc1116d50f37836265db2d42edcada95ddc3c74 | [] | no_license | adyahoo/progmobRecycler | 992f8217816c5dd312cbd2c8e50da0740bba09e3 | 4e8c15690bc0c7ba45c65886cb121794f963ab4f | refs/heads/master | 2022-04-15T16:00:44.086104 | 2020-04-14T15:32:34 | 2020-04-14T15:32:34 | 255,646,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | package id.ac.unud1805551035;
public class Mahasiswa {
private String nama;
private String nim;
private String email;
public Mahasiswa(String nama, String nim, String email){
this.nama = nama;
this.nim = nim;
this.email = email;
}
public String getNama(){
return nama;
}
public void setNama(String nama){
this.nama = nama;
}
public String getNim(){
return nim;
}
public void setNim(String nim){
this.nim = nim;
}
public String getEmail(){
return email;
}
public void setEmail(String email){
this.email = email;
}
}
| [
"[email protected]"
] | |
82615f904f08b9f768aa05337397305492ed4ba6 | 4ebda563d15f6158647731b7fe15225ec4c6df52 | /src/main/java/com/guigu/restaurant/user/service/impl/UserServiceimpl.java | 903a18a425a3bf56ab54a9a70badb2595f5a76b8 | [] | no_license | guiguTest/RestaurantTest | f270b80bc417b49cd0e5ea52c669ea7adb0dca9d | c84177c31537b0806c3f6d92e38afef639cc7496 | refs/heads/master | 2021-09-10T05:46:35.606615 | 2018-03-21T07:57:33 | 2018-03-21T07:57:33 | 126,103,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,503 | java | package com.guigu.restaurant.user.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.guigu.restaurant.mapper.UserMapper;
import com.guigu.restaurant.po.User;
import com.guigu.restaurant.po.UserExample;
import com.guigu.restaurant.po.UserExample.Criteria;
import com.guigu.restaurant.user.service.UserService;
@Service("userServiceimpl")
public class UserServiceimpl implements UserService{
@Resource(name="userMapper")
private UserMapper userMapper;
@Override
public List<User> findUserList(User user) {
UserExample userExample=new UserExample();
Criteria criteria=userExample.createCriteria();
if(user.getUserName()!=null) {
user.setUserName("%"+user.getUserName()+"%");
criteria.andUserNameLike(user.getUserName());
}
return userMapper.selectByExample(userExample);
}
@Override
public User findUserById(Integer userId) {
return userMapper.selectByPrimaryKey(userId);
}
@Override
public boolean addUser(User user) {
int i=userMapper.insertSelective(user);
if(i>0) {
return true;
}
return false;
}
@Override
public boolean updateUser(User user) {
int i=userMapper.updateByPrimaryKeySelective(user);
if(i>0) {
return true;
}
return false;
}
@Override
public boolean deleteUser(Integer userId) {
int i=userMapper.deleteByPrimaryKey(userId);
if(i>0) {
return true;
}
return false;
}
}
| [
"yhtx-22@tx15"
] | yhtx-22@tx15 |
b73b7f244133efb372d574d2b36fc2de10de5c50 | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/51_jiprof-com.mentorgen.tools.profile.instrument.clfilter.CustomMultiClassLoaderFilter-0.5-8/com/mentorgen/tools/profile/instrument/clfilter/CustomMultiClassLoaderFilter_ESTest_scaffolding.java | 56d35a26be450bafe6aef6108bff2a4a1df40381 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Oct 29 16:19:11 GMT 2019
*/
package com.mentorgen.tools.profile.instrument.clfilter;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class CustomMultiClassLoaderFilter_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
] | |
67f84cbfb68c20e4706e6092154bc0560dfd2683 | 0ca7e7d714da0bd969e381c92a46be74edf3219b | /src/com/jeecms/bbs/dao/impl/BbsMagicLogDaoImpl.java | a70afc4dbe7cf92fc923be1d703d6707a13fdf93 | [] | no_license | huanghengmin/jeebbs | 1bf6ba3eb2ab9fd3020b1230ccaf530cbc7c45f8 | cf8494cdfb1539f1503ff688dbbb23e203a67ee4 | refs/heads/master | 2020-12-31T05:55:32.737038 | 2016-04-18T08:09:59 | 2016-04-18T08:09:59 | 56,489,180 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,124 | java | package com.jeecms.bbs.dao.impl;
import org.springframework.stereotype.Repository;
import com.jeecms.bbs.entity.BbsMemberMagic;
import com.jeecms.bbs.dao.BbsMemberMagicDao;
import com.jeecms.common.hibernate3.Finder;
import com.jeecms.common.hibernate3.HibernateBaseDao;
import com.jeecms.common.page.Pagination;
@Repository
public class BbsMagicLogDaoImpl extends
HibernateBaseDao<BbsMemberMagic, Integer> implements BbsMemberMagicDao {
public Pagination getPage(Integer userId, int pageNo, int pageSize) {
String hql = "from BbsMemberMagic magic ";
Finder finder = Finder.create(hql);
Pagination page = find(finder, pageNo, pageSize);
return page;
}
public BbsMemberMagic findById(Integer id) {
BbsMemberMagic entity = get(id);
return entity;
}
public BbsMemberMagic save(BbsMemberMagic bean) {
getSession().save(bean);
return bean;
}
public BbsMemberMagic deleteById(Integer id) {
BbsMemberMagic entity = super.get(id);
if (entity != null) {
getSession().delete(entity);
}
return entity;
}
protected Class<BbsMemberMagic> getEntityClass() {
return BbsMemberMagic.class;
}
} | [
"[email protected]"
] | |
4f46d601452ca1187c8cdba1958a20bb24e5c485 | 3fd2663253a02cca847eece4405a1df4e49ded48 | /src/main/java/com/uber/uberapi/exceptions/InvalidPassengerException.java | 8b209b9767564a6c6acf829a19a5688dfdd0f15d | [] | no_license | mrgarg2/uberapi | 26aec3beb0696af2be3a8a571cfcddf7c68855b4 | d785dce3903317e38f707ed1f11a1c51cb664a04 | refs/heads/main | 2023-01-22T15:01:09.330883 | 2020-11-28T10:07:28 | 2020-11-28T10:07:28 | 316,700,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package com.uber.uberapi.exceptions;
public class InvalidPassengerException extends UberException {
public InvalidPassengerException(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
63ce68d2ea5b500949541be737ccffaa74c1951c | 6febe2b8b5d327dcd4c8856a6ba366162b1ab8d4 | /src/main/java/cn/sp/GsAsyncMethodApplication.java | 499b499f738aaa117a5101e13b158b8d9424e9ee | [] | no_license | 2YSP/gs-async-method | 71412d18cf43e898bef6ba3b222c6fa3216da41b | 86b1900c8917d60c3c2a428bced378d8cd205e5a | refs/heads/master | 2021-09-05T04:07:56.871241 | 2018-01-24T03:07:36 | 2018-01-24T03:07:36 | 118,702,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | package cn.sp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
@EnableAsync//开启异步执行任务
@SpringBootApplication
public class GsAsyncMethodApplication {
public static void main(String[] args) {
SpringApplication.run(GsAsyncMethodApplication.class, args);
}
/**
* add Executor
* default use SimpleAsyncTaskExecutor
* @return
*/
@Bean
public Executor asyncExecutor(){
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
executor.setMaxPoolSize(2);
executor.setQueueCapacity(500);
executor.setThreadNamePrefix("GithubLookup-");
executor.initialize();
return executor;
}
}
| [
"[email protected]"
] | |
53115b97327d7868f9006bf7b9ca675f37e1a9e0 | abbc7c1c51e49c00c1a154cc72fbf685349690c7 | /EventHandling/Main.java | 7fbc2f3ef66c329a748de1194dc867ebecce153a | [] | no_license | MaheshHada/Popl-Assignments | 6a9ab3c6f7c75b1cb586c741a7a1a8c40eddb860 | 16287be07de27e65a0cf8c31903a652cf7f0c733 | refs/heads/master | 2021-07-24T15:49:50.826529 | 2017-11-06T01:41:00 | 2017-11-06T01:41:00 | 109,520,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | import java.lang.*;
public class Main {
public static void main(String[] args) throws Exception {
new Tab("www.google.com", 10);
new Tab("www.amazon.com", 5);
}
}
| [
"[email protected]"
] | |
e5e2f436c1ea74c9750fb36f427ba0e9120be7f7 | e7af8f145851cf0efd31f78b20bf85723f078ef3 | /src/main/java/be/ceau/chart/dataset/PieDataset.java | eee62b111023abd3ff3f5b869712b337824b25f7 | [
"Apache-2.0"
] | permissive | mdewilde/chart | 1b157c1357c90d873245360b7e64da281539d000 | 7d896c8c316a3c62bfcd0b75955bf92c559708cf | refs/heads/master | 2023-08-17T14:18:09.655883 | 2023-08-06T16:41:47 | 2023-08-06T16:41:47 | 37,681,702 | 115 | 56 | Apache-2.0 | 2023-08-06T16:20:22 | 2015-06-18T19:59:40 | Java | UTF-8 | Java | false | false | 2,272 | java | /*
Copyright 2023 Marceau Dewilde <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package be.ceau.chart.dataset;
import java.math.BigDecimal;
import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonInclude(Include.NON_EMPTY)
@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
public class PieDataset extends RoundDataset<PieDataset, BigDecimal> {
/**
* Sets the backing data list to the argument, replacing any data already
* added or set
*
* @param data
* The data to plot in a line
*/
public PieDataset setData(int... data) {
clearData();
if (data != null) {
for (int i = 0; i < data.length; i++) {
this.data.add(new BigDecimal(data[i]));
}
}
return this;
}
/**
* Sets the backing data list to the argument, replacing any data already
* added or set
*
* @param data
* The data to plot in a line
*/
public PieDataset setData(double... data) {
clearData();
if (data != null) {
for (int i = 0; i < data.length; i++) {
this.data.add(new BigDecimal(String.valueOf(data[i])));
}
}
return this;
}
/**
* Add the data point to this {@code Dataset}
*
* @see #setData(Collection)
*/
public PieDataset addData(int data) {
this.data.add(new BigDecimal(data));
return this;
}
/**
* Add the data point to this {@code Dataset}
*
* @see #setData(Collection)
*/
public PieDataset addData(double data) {
this.data.add(new BigDecimal(String.valueOf(data)));
return this;
}
}
| [
"[email protected]"
] | |
b83316cc3cbff1a33a403b89ae37e80923ab025f | 40c08131c55eeb4e3ea91536358bc6cf3d029c22 | /1541. Minimum Insertions to Balance a Parentheses String.java | 78f9fbaf1dce9b84e7e4c8e58829cdb240716042 | [] | no_license | xueyaohuang/RoadToCodeFarmer | 8840c7761cc48b69c67991aca063762d3c3dfb46 | a08e5bd2dec3e6c38dab5893a324e2dd594f4e82 | refs/heads/master | 2022-08-31T19:33:22.568363 | 2022-08-10T03:10:45 | 2022-08-10T03:10:45 | 139,095,065 | 3 | 5 | null | 2021-09-29T06:44:02 | 2018-06-29T03:12:49 | Java | UTF-8 | Java | false | false | 2,252 | java | /*
Use a stack to keep opening brackets. If you face single closing ')' add 1 to the answer and consider it as '))'.
If you have '))' with empty stack, add 1 to the answer, If after finishing you have x opening remaining in the stack, add 2x to the answer.
*/
class Solution {
public int minInsertions(String s) {
Deque<Character> stack = new ArrayDeque<>();
int count = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '(') {
stack.push('(');
} else {
// has '))'
if (i < s.length() - 1 && s.charAt(i + 1) == ')') {
if (!stack.isEmpty()) { // can pair with a '('
stack.pop();
} else {
count++; // can not pair with a '(', so count++
}
i++;
} else { // single ')'
count++; // single ')', make it '))' first and see if there is a '(' in the stack to pair with it
if (!stack.isEmpty()) {
stack.pop();
} else {
count++;
}
}
}
}
return count + stack.size() * 2;
}
}
// Stack can be replaced with a counter (count num of '(') as we are guaranteed to have only '(' and ')'
// almost the same as solution 1
class Solution {
public int minInsertions(String s) {
int open = 0;
int count = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '(') {
open++;
} else {
if (i < s.length() - 1 && s.charAt(i + 1) == ')') {
if (open > 0) {
open--;
} else {
count++;
}
i++;
} else {
count++;
if (open > 0) {
open--;
} else {
count++;
}
}
}
}
return count + open * 2;
}
}
| [
"[email protected]"
] | |
39f4aa6ed8ffbedacb2f77eeea54191c182a87f9 | 5a5c9d7f0e5047254d03c03814b13426b06dc7b3 | /src/com/jason/designPatterns/complex/observe/QuackObservable.java | ae402081244e36c841634545f93784c0985446f6 | [] | no_license | cheng-jason/DesignPatterns | 467a128f53672419fe897f2377fe2f6898729202 | ecb745e5ff3fe78ee3836ab7608f061723335a55 | refs/heads/master | 2020-03-08T07:33:03.174468 | 2018-12-20T06:44:20 | 2018-12-20T06:44:20 | 127,996,967 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package com.jason.designPatterns.complex.observe;
/**
* 观察者模式
* @author liuwch
* @creation 2018-8-29
*/
public interface QuackObservable {
public void registerObserver(Observer ob);
public void notifyObserver();
}
| [
"[email protected]"
] | |
0cedc42b21f8293fb8058c55da63c332b7354b25 | 099c6a54225e9ba62ec13258f1b2773a3d238981 | /app/src/main/java/au/com/kbrsolutions/melbournepublictransport/adapters/StopsAdapter.java | fe39ed2d4268e4f84e0195c7f7c13195142da31c | [] | no_license | brugienis/Capstone-Project | 0e48a989add106af6bb219514ef39e2d6f76bbe3 | df855d45c22eed289a4a3669b9c4351135e5ddfd | refs/heads/master | 2020-05-21T22:15:48.503658 | 2018-01-09T05:53:46 | 2018-01-09T05:53:46 | 63,374,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,006 | java | package au.com.kbrsolutions.melbournepublictransport.adapters;
import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.CursorAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import au.com.kbrsolutions.melbournepublictransport.R;
import au.com.kbrsolutions.melbournepublictransport.data.LatLngDetails;
import au.com.kbrsolutions.melbournepublictransport.data.StopDetails;
import au.com.kbrsolutions.melbournepublictransport.fragments.StopsFragment;
/**
*
* Adapter used by StopsFragment.
*
*/
public class StopsAdapter extends CursorAdapter {
private static StopsFragment.OnStopFragmentInteractionListener mListener;
@SuppressWarnings("unused")
private static final String TAG = StopsAdapter.class.getSimpleName();
public static class ViewHolder {
public final TextView locationNameView;
public final ImageView departuresImageId;
public final ImageView mapImageId;
public StopDetails stopDetails;
public ViewHolder(View view) {
locationNameView = (TextView) view.findViewById(R.id.locationNameId);
departuresImageId = (ImageView) view.findViewById(R.id.departuresImageId);
departuresImageId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (null != mListener) {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that a departure image was touched.
startNextDeparturesSearch(stopDetails);
}
}
});
mapImageId = (ImageView) view.findViewById(R.id.mapImageId);
mapImageId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showSelectedStopOnMap(stopDetails.locationName, new LatLngDetails(stopDetails.latitude, stopDetails.longitude));
}
});
}
}
private static void startNextDeparturesSearch(StopDetails stopDetails) {
mListener.startNextDeparturesSearch(stopDetails);
}
private static void showSelectedStopOnMap(String stopName, LatLngDetails latLonDetails) {
mListener.showStopOnMap(stopName, latLonDetails);
}
public StopsAdapter(
Context context,
StopsFragment.OnStopFragmentInteractionListener listener) {
super(context, null, 0);
mListener = listener;
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = LayoutInflater.from(context).inflate(R.layout.fragment_stops_list, parent, false);
StopsAdapter.ViewHolder viewHolder = new StopsAdapter.ViewHolder(view);
view.setTag(viewHolder);
return view;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
StopsAdapter.ViewHolder viewHolder = (StopsAdapter.ViewHolder) view.getTag();
String locationName = cursor.getString(StopsFragment.COL_STOP_DETAILS_LOCATION_NAME);
StopDetails stopDetails = new StopDetails(
cursor.getInt(StopsFragment.COL_STOP_DETAILS_ID),
cursor.getInt(StopsFragment.COL_STOP_DETAILS_ROUTE_TYPE),
cursor.getString(StopsFragment.COL_STOP_DETAILS_STOP_ID),
cursor.getString(StopsFragment.COL_STOP_DETAILS_LOCATION_NAME),
cursor.getDouble(StopsFragment.COL_STOP_DETAILS_LATITUDE),
cursor.getDouble(StopsFragment.COL_STOP_DETAILS_LONGITUDE),
cursor.getString(StopsFragment.COL_STOP_DETAILS_FAVORITE));
viewHolder.locationNameView.setText(locationName);
viewHolder.stopDetails = stopDetails;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.