blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 5
132
| path
stringlengths 2
382
| src_encoding
stringclasses 34
values | length_bytes
int64 9
3.8M
| score
float64 1.5
4.94
| int_score
int64 2
5
| detected_licenses
listlengths 0
142
| license_type
stringclasses 2
values | text
stringlengths 9
3.8M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
79ca73cf4f9bdb124de6126fcb35146d3478b8ef
|
Java
|
hortonworks/cloudbreak
|
/core/src/main/java/com/sequenceiq/cloudbreak/service/upgrade/sync/CmSyncImageUpdateService.java
|
UTF-8
| 2,970
| 2
| 2
|
[
"LicenseRef-scancode-warranty-disclaimer",
"ANTLR-PD",
"CDDL-1.0",
"bzip2-1.0.6",
"Zlib",
"BSD-3-Clause",
"MIT",
"EPL-1.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-jdbm-1.00",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
package com.sequenceiq.cloudbreak.service.upgrade.sync;
import java.util.Optional;
import java.util.Set;
import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.sequenceiq.cloudbreak.cloud.model.catalog.Image;
import com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException;
import com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException;
import com.sequenceiq.cloudbreak.domain.stack.Stack;
import com.sequenceiq.cloudbreak.service.image.StatedImage;
import com.sequenceiq.cloudbreak.service.stack.StackImageService;
import com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmSyncOperationSummary;
@Component
public class CmSyncImageUpdateService {
private static final Logger LOGGER = LoggerFactory.getLogger(CmSyncImageUpdateService.class);
@Inject
private StackImageService stackImageService;
@Inject
private CmSyncImageFinderService cmSyncImageFinderService;
public void updateImageAfterCmSync(Stack stack, CmSyncOperationSummary cmSyncResult, Set<Image> candidateImages) {
com.sequenceiq.cloudbreak.cloud.model.Image currentImage = getCurrentImage(stack);
Optional<Image> targetImageOpt = findTargetImage(cmSyncResult, candidateImages, currentImage.getImageId(), stack.isDatalake());
if (targetImageOpt.isPresent()) {
Image targetImage = targetImageOpt.get();
if (!currentImage.getImageId().equals(targetImage.getUuid())) {
LOGGER.debug("Set new image to {}", targetImage.getUuid());
stackImageService.replaceStackImageComponent(stack, createStatedImage(targetImage, currentImage), currentImage);
} else {
LOGGER.debug("Not necessary to update the image because the current image already contains all the required parcels.");
}
} else {
LOGGER.debug("There is no candidate image found for update the current image.");
}
}
private Optional<Image> findTargetImage(CmSyncOperationSummary cmSyncResult, Set<Image> candidateImages, String currentImageId, boolean datalake) {
return cmSyncImageFinderService.findTargetImageForImageSync(cmSyncResult, candidateImages, currentImageId, datalake);
}
private StatedImage createStatedImage(Image targetImage, com.sequenceiq.cloudbreak.cloud.model.Image currentImage) {
return StatedImage.statedImage(targetImage, currentImage.getImageCatalogUrl(), currentImage.getImageCatalogName());
}
private com.sequenceiq.cloudbreak.cloud.model.Image getCurrentImage(Stack stack) {
try {
return stackImageService.getCurrentImage(stack.getId());
} catch (CloudbreakImageNotFoundException e) {
String message = "Could not find image";
LOGGER.error(message, e);
throw new CloudbreakServiceException(message, e);
}
}
}
| true
|
2ebee743c6c9252a54ee6c640a7b19f1670cacc1
|
Java
|
zhuxin-yan/ChatGap
|
/DroidChatREST/src/rest/CreateUser.java
|
UTF-8
| 2,493
| 2.515625
| 3
|
[] |
no_license
|
package rest;
import java.net.UnknownHostException;
import java.util.Date;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import mongo.MongoConnector;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
import com.mongodb.util.JSON;
import com.sun.jersey.multipart.FormDataParam;
@Path("/createUser")
public class CreateUser {
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
public String createUser(@FormParam(value="userName") String userName, @FormParam(value="chatRoom") String chatRoom) throws UnknownHostException {
Date date = new Date();
MongoClient mongoClient = MongoConnector.getMongoClient();
DB droidChat = mongoClient.getDB("droidChat");
DBCollection userCollection = droidChat.getCollection("users");
// Get number of messages so far so we know what messages to load first
DBCollection messages = droidChat.getCollection("messages");
DBCollection chatRooms = droidChat.getCollection("rooms");
if(!(chatRooms.find(new BasicDBObject().append("chatRoom", chatRoom)).hasNext())){
chatRooms.insert(new BasicDBObject().append("chatRoom", chatRoom).append("numUsers", 1));
}
else{
BasicDBObject chatUpdateQuery = new BasicDBObject().append("$inc", new BasicDBObject()
.append("numUsers", 1));
BasicDBObject searchChatRoom = new BasicDBObject().append("chatRoom", chatRoom);
chatRooms.update(searchChatRoom, chatUpdateQuery);
}
// If user name is in database return an error message
if(userCollection.find(new BasicDBObject().append("name", userName)).hasNext()){
return JSON.serialize(new BasicDBObject("success", false)
.append("errorMessage", "Entered name is not available."));
}
else{
// If name is free create new user
BasicDBObject newUser = new BasicDBObject("name", userName)
.append("date", date)
.append("chatting", true)
.append("messagesRead", messages.getCount())
.append("chatRoom", chatRoom);
// Insert new user into DB
userCollection.insert(newUser);
// Return JSON indicating a successful insertion and the data that was added
return JSON.serialize(new BasicDBObject("success", true)
.append("dataAdded", newUser));
}
}
}
| true
|
cc1dd6b63944733941f07225ff16dac160daa209
|
Java
|
kveola13/java-tutorials
|
/src/main/java/com/kveola/cb/functional/two/NoLong.java
|
UTF-8
| 281
| 2.5
| 2
|
[] |
no_license
|
package com.kveola.cb.functional.two;
import java.util.List;
import java.util.stream.Collectors;
public class NoLong {
public static List<String> noLong(List<String> strings) {
return strings.stream().filter(s -> s.length() < 4).collect(Collectors.toList());
}
}
| true
|
19249796a8e8769488dda8235cafe836a3186344
|
Java
|
VisheshSood/AkkaAssignment1
|
/main/additionalClasses/ReadFileInput.java
|
UTF-8
| 725
| 3.40625
| 3
|
[] |
no_license
|
package additionalClasses;
import java.io.InputStream;
/*
* ReadFileInput Class
*
* Allows the program to read the file that is saved in the resources directory, that
* is passed down in the main application.
*/
public class ReadFileInput {
private InputStream inputStream;
/*
* ReadFileInput function
* Takes a string of the filename and produces the input stream
*/
public ReadFileInput(String fileInput) {
inputStream = this.getClass().getClassLoader().getResourceAsStream(fileInput);
}
/*
* getInputStream function
* Returns the InputStream of type InputStream.
*/
public InputStream getInputStream() {
return inputStream;
}
}
| true
|
bace0afc945348a11197b548a3a1d0340e691503
|
Java
|
pigjay/zhujie
|
/piggame-service/src/main/java/com/piggame/service/system/SysRoleService.java
|
UTF-8
| 207
| 1.796875
| 2
|
[] |
no_license
|
package com.piggame.service.system;
import java.util.List;
import com.piggame.model.system.SysRole;
public interface SysRoleService {
List<SysRole> findAll();
SysRole findOne(Long id);
}
| true
|
30fd1525197696537645c1032a42d2ca849aa088
|
Java
|
mortenn/ContestManager
|
/src/no/runsafe/contestmanager/command/RemoveWorld.java
|
UTF-8
| 960
| 2.734375
| 3
|
[] |
no_license
|
package no.runsafe.contestmanager.command;
import no.runsafe.contestmanager.database.EntryRepository;
import no.runsafe.framework.api.IScheduler;
import no.runsafe.framework.api.command.AsyncCommand;
import no.runsafe.framework.api.command.ICommandExecutor;
import no.runsafe.framework.api.command.argument.IArgumentList;
import no.runsafe.framework.api.command.argument.WorldArgument;
public class RemoveWorld extends AsyncCommand
{
public RemoveWorld(IScheduler scheduler, EntryRepository entries)
{
super("remove", "Removes a world from the contest.", "contest.remove", scheduler, new WorldArgument(true));
this.entries = entries;
}
@Override
public String OnAsyncExecute(ICommandExecutor executor, IArgumentList parameters)
{
String world = parameters.get("world");
return entries.removeEntry(world)
? "The world " + world + " has been removed."
: "Could not remove the world " + world + "!";
}
private EntryRepository entries;
}
| true
|
75358ae6e93526bea1953d46b1bf2adf421caac3
|
Java
|
moscoper/Moscoper
|
/src/com/skycober/mineral/util/Trace.java
|
MacCentralEurope
| 848
| 2.25
| 2
|
[] |
no_license
|
package com.skycober.mineral.util;
import android.util.Log;
/**
* Զdebug
* @author Yes366
*
*/
public class Trace {
public final static void e(String tag, String msg, Throwable tr) {
if (BuildConfig.isDebug)
Log.e(tag, msg, tr);
}
public final static void e(String tag, String msg) {
if (BuildConfig.isDebug)
Log.e(tag, msg);
}
public final static void e(String msg) {
if (BuildConfig.isDebug)
Log.e("", msg);
}
public final static void e(Throwable tr) {
if (BuildConfig.isDebug)
Log.e("", "", tr);
}
public final static void d(String tag, String msg) {
if (BuildConfig.isDebug)
Log.d(tag, msg);
}
public final static void d(String msg) {
if (BuildConfig.isDebug)
Log.d("", msg);
}
public final static void d(Throwable tr) {
if (BuildConfig.isDebug)
Log.d("", "", tr);
}
}
| true
|
2899f228c9f2940cdd98dc869849bee0d13ced2d
|
Java
|
GabeOchieng/ggnn.tensorflow
|
/data/libgdx/GLSurfaceViewAPI18_getDebugFlags.java
|
UTF-8
| 157
| 2.3125
| 2
|
[] |
no_license
|
/**
* Get the current value of the debug flags.
* @return the current value of the debug flags.
*/
public int getDebugFlags() {
return mDebugFlags;
}
| true
|
aeab2cc1ed10dcbea603d4d31265edbfb935a366
|
Java
|
hamidrezaseifi/iflow-java
|
/iflow/workflow/src/main/java/com/pth/iflow/workflow/bl/impl/TokenValidator.java
|
UTF-8
| 2,185
| 1.859375
| 2
|
[] |
no_license
|
package com.pth.iflow.workflow.bl.impl;
import java.net.MalformedURLException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pth.iflow.common.enums.EModule;
import com.pth.iflow.common.exceptions.IFlowMessageConversionFailureException;
import com.pth.iflow.common.models.edo.ProfileResponseEdo;
import com.pth.iflow.common.models.edo.TokenProfileRequestEdo;
import com.pth.iflow.common.rest.IflowRestPaths;
import com.pth.iflow.workflow.bl.ITokenValidator;
import com.pth.iflow.workflow.config.WorkflowConfiguration;
import com.pth.iflow.workflow.exceptions.WorkflowCustomizedException;
import com.pth.iflow.workflow.models.ProfileResponse;
import com.pth.iflow.workflow.models.mapper.WorkflowModelEdoMapper;
import com.pth.iflow.workflow.services.IRestTemplateCall;
@Service
public class TokenValidator implements ITokenValidator {
private static final Logger logger = LoggerFactory.getLogger(TokenValidator.class);
private final IRestTemplateCall restTemplate;
private final WorkflowConfiguration.ModuleAccessConfig moduleAccessConfig;
public TokenValidator(@Autowired final IRestTemplateCall restTemplate,
@Autowired final WorkflowConfiguration.ModuleAccessConfig moduleAccessConfig) {
this.restTemplate = restTemplate;
this.moduleAccessConfig = moduleAccessConfig;
}
@Override
public ProfileResponse isTokenValid(final String token)
throws WorkflowCustomizedException, MalformedURLException, IFlowMessageConversionFailureException {
logger.debug("Validate token {} from profile service", token);
final TokenProfileRequestEdo profileRequest = new TokenProfileRequestEdo();
profileRequest.setToken(token);
final ProfileResponseEdo responseEdo = this.restTemplate.callRestPost(
this.moduleAccessConfig.generateProfileUrl(IflowRestPaths.ProfileModule.READ_PROFILE_TOKENINFO_URIBUILDER()), token, EModule.PROFILE,
profileRequest, ProfileResponseEdo.class, true);
return WorkflowModelEdoMapper.fromEdo(responseEdo);
}
}
| true
|
cb84240c2d0d7017f601579a907c90e010862517
|
Java
|
sudha2000/Lambdas_and_streams
|
/PalindromeCheck.java
|
UTF-8
| 908
| 3.625
| 4
|
[] |
no_license
|
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class PalindromeCheck
{
public static boolean isPalindrome(String input)
{
return input.equalsIgnoreCase(new StringBuilder().append(input).reverse().toString());
}
public static void main(String[] args)
{
try (Scanner sc = new Scanner(System.in)) {
List<String> strings_input = new ArrayList<String>();
List<String> result_ans;
Predicate<String> predicate=PalindromeCheck::isPalindrome;
int noOfStrings;
System.out.print("Enter no of strings : ");
noOfStrings = sc.nextInt();
System.out.println("Enter strings");
for(int iter=1;iter<=noOfStrings;iter++)
{
strings_input.add(sc.next());
}
result_ans=strings_input.stream().filter(predicate).collect(Collectors.toList());
System.out.println(result_ans);
}
}
}
| true
|
9b506201389000880a9f9b848ed9e79711057bca
|
Java
|
rbrbrb7290/ticket-server
|
/src/main/java/com/mrfofo/ticket/handler/CategoryHandler.java
|
UTF-8
| 681
| 2.046875
| 2
|
[] |
no_license
|
package com.mrfofo.ticket.handler;
import com.mrfofo.ticket.model.Product;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@Component
public class CategoryHandler {
public Mono<ServerResponse> findCategory(ServerRequest request) {
return Flux.just(Product.ProductCategory.values()).collectList().flatMap(category -> ServerResponse.ok().body(BodyInserters.fromObject(category)));
}
}
| true
|
d1c84e6447b21ebcb6975cb6c141310d337387d4
|
Java
|
nwpu043814/wifimaster4.2.02
|
/WiFi万能钥匙dex1-dex2jar.jar.src/cm/pass/sdk/utils/RequestBusiness.java
|
UTF-8
| 6,461
| 1.734375
| 2
|
[] |
no_license
|
package cm.pass.sdk.utils;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import cm.pass.sdk.account.UserInfo;
import cm.pass.sdk.auth.AuthnHelper;
import cm.pass.sdk.auth.TokenListener;
import cm.pass.sdk.b.b;
import cm.pass.sdk.interfaces.c;
import cm.pass.sdk.interfaces.e;
import cm.pass.sdk.interfaces.i;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.json.JSONObject;
public class RequestBusiness
{
private static final String TAG = "BusinessInternal";
private static ArrayList<Activity> mActivitySet = null;
private static RequestBusiness mInstalce = null;
private List<b.a.a.a> accounts;
private WeakReference<Context> mContext;
private boolean mIsChecked;
private RequestBusiness(Context paramContext)
{
this.mContext = new WeakReference(paramContext);
mActivitySet = new ArrayList();
}
public static RequestBusiness getInstance(Context paramContext)
{
try
{
if (mInstalce == null) {
syncInit(paramContext);
}
b.a();
paramContext = mInstalce;
return paramContext;
}
finally {}
}
private static void syncInit(Context paramContext)
{
try
{
RequestBusiness localRequestBusiness = new cm/pass/sdk/utils/RequestBusiness;
localRequestBusiness.<init>(paramContext);
mInstalce = localRequestBusiness;
return;
}
finally
{
paramContext = finally;
throw paramContext;
}
}
public void getAccessTokenByUserInfo(String paramString1, String paramString2, String paramString3, String paramString4, UserInfo paramUserInfo, c paramc)
{
if ((paramUserInfo == null) || (TextUtils.isEmpty(paramUserInfo.getAuthToken()))) {
paramc.a(false, "102", "userinfo is null ", "", "", "", "", "", "", "", "", "", "");
}
for (;;)
{
return;
if (this.mContext.get() != null)
{
String str6 = System.currentTimeMillis();
String str1 = m.a((Context)this.mContext.get()).a();
String str5 = m.a((Context)this.mContext.get()).b();
String str3 = l.a((Context)this.mContext.get()).c();
String str4 = l.a((Context)this.mContext.get()).f();
int i = r.b((Context)this.mContext.get());
String str2 = q.a((Context)this.mContext.get());
paramString4 = new RequestBusiness.3(this, paramString1, paramString2, i, str5, str1, str3, str4, new RequestBusiness.2(this, paramc, paramUserInfo, paramString4, paramString3, paramString1, str6), paramc, paramString4, paramString3, paramUserInfo, str6);
new d().a((Context)this.mContext.get(), paramUserInfo.getPassid(), paramUserInfo.getAuthToken(), paramString3, paramString1, paramString2, paramUserInfo.getTokenNonce(), paramUserInfo.getTimeStamp(), str1, str2, str3, str4, paramString4);
}
}
}
public List<UserInfo> getAllAccounts()
{
ArrayList localArrayList = new ArrayList();
if (this.mContext.get() != null)
{
this.accounts = cm.pass.sdk.account.a.a((Context)this.mContext.get()).a();
if ((this.accounts != null) && (this.accounts.size() > 0))
{
Iterator localIterator = this.accounts.iterator();
while (localIterator.hasNext())
{
Object localObject = (b.a.a.a)localIterator.next();
localObject = cm.pass.sdk.account.a.a((Context)this.mContext.get()).a((b.a.a.a)localObject);
if (localObject != null) {
localArrayList.add(localObject);
}
}
}
}
return localArrayList;
}
public void getKsByAccessToken(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, e parame)
{
if (this.mContext.get() != null)
{
paramString3 = new RequestBusiness.1(this, paramString3, paramString4, paramString5, paramString6, paramString2);
new d().a((Context)this.mContext.get(), paramString1, paramString2, paramString5, paramString3);
}
}
public void getLoginConfig(Context paramContext, String paramString, i parami)
{
j.c("BusinessInternal", "getLoginConfig");
if (this.mContext.get() != null) {
new d().a(paramContext, paramString, parami);
}
}
public void implicitSMSLogin(String paramString1, String paramString2, String paramString3, int paramInt, c paramc)
{
if (this.mContext.get() != null)
{
if (l.a((Context)this.mContext.get()).c("android.permission.SEND_SMS")) {
break label64;
}
paramc.a(false, "102205", "应用未授权,请检查发送短信权限【android.permission.SEND_SMS】", "", "", "", "", "", "", "", "", "", "4");
}
for (;;)
{
return;
label64:
String str3 = System.currentTimeMillis();
String str1 = m.a((Context)this.mContext.get()).a();
String str2 = t.a();
sendSms();
paramString1 = new RequestBusiness.7(this, paramString2, paramString3, paramInt, new RequestBusiness.6(this, paramString2, paramc, paramString1, str3));
new d().a((Context)this.mContext.get(), paramString2, "2", str1, str2, "", "", paramString1);
}
}
public void implicitWapLogin(String paramString1, String paramString2, String paramString3, int paramInt, boolean paramBoolean, c paramc)
{
String str2 = System.currentTimeMillis();
String str1 = t.a();
paramString1 = new RequestBusiness.5(this, paramString2, paramString3, paramInt, new RequestBusiness.4(this, paramc, paramString2, paramString1, str2), paramString1, paramc, str2);
if (this.mContext.get() != null) {
new d().a((Context)this.mContext.get(), paramString2, "1", "", str1, "", "", paramString1);
}
}
public void onCallbackTokenListener(JSONObject paramJSONObject, int paramInt)
{
if ((this.mContext.get() != null) && (AuthnHelper.getInstance((Context)this.mContext.get()).getTokenListener(paramInt) != null)) {
AuthnHelper.getInstance((Context)this.mContext.get()).getTokenListener(paramInt).onGetTokenComplete(paramJSONObject);
}
}
public void sendSms()
{
if (this.mContext.get() != null) {
new d().a((Context)this.mContext.get());
}
}
}
/* Location: /Users/hanlian/Downloads/WiFi万能钥匙dex1-dex2jar.jar!/cm/pass/sdk/utils/RequestBusiness.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
| true
|
0dfbe840e7a05e3f340580e3f0c75976a303b41b
|
Java
|
didierr2/twd
|
/src/main/java/twd/Equipement.java
|
UTF-8
| 4,899
| 2.375
| 2
|
[] |
no_license
|
package twd;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import lombok.Data;
@Data
public class Equipement implements Serializable {
public final static double PONDERATION_ATTAQUE_DEFENSE = 1.3;
public final static int NB_MAX_EFFET = 3;
public final static int SET_BONUS_NUMBER = 4;
public final static double SET_BONUS_VALUE = 1.2;
public final static int NB_MAX_OR_PAR_PERSO = 6;
double totalAttaque = 0;
double totalDefense = 0;
double totalRd = 0;
double totalCc = 0;
double totalDc = 0;
private static final long serialVersionUID = 1L;
public final Perso perso;
public Map<Integer, Insigne> insignes = new HashMap<>();
public void equipe(Insigne insigne) {
if (insigne.equipe) throw new IllegalStateException("L'insigne est deja equipe : " + insigne);
if (insignes.containsKey(insigne.emplacement)) throw new IllegalStateException("Un insigne de meme emplacement est deja equipe : " + insigne);
insigne.equipe = true;
insignes.put(insigne.emplacement, insigne);
}
public void desequipe(Insigne insigne) {
if (!insigne.equipe) throw new IllegalStateException("L'insigne n'est pas equipe : " + insigne);
if (!insignes.containsKey(insigne.emplacement)) throw new IllegalStateException("Aucun insigne de meme emplacement est equipe : " + insigne);
insigne.equipe = false;
insignes.remove(insigne.emplacement, insigne);
}
/**
* Calcul le total de points d'un équipement donné
* @return
*/
public int total() {
totalAttaque = perso.attaque;
totalDefense = perso.defense;
totalRd = perso.defense;
totalCc = perso.attaque;
totalDc = perso.attaque;
Profil profil = perso.getProfil();
for (Insigne insigne : insignes.values()) {
switch (insigne.effet) {
case "degats" :
totalAttaque = addEffet(totalAttaque, insigne);
break;
case "sante" :
totalDefense = addEffet(totalDefense, insigne);
break;
case "degats critiques" :
totalDc = addEffet(totalDc, insigne);
break;
case "coups critiques" :
totalCc = addEffet(totalCc, insigne);
break;
case "reduction degats" :
totalRd = addEffet(totalRd, insigne);
break;
default :
throw new IllegalStateException("L'effet de l'insigne n'est pas reconnu : " + insigne);
}
}
return (int)((totalAttaque * profil.pdegats) + (totalDefense * profil.psante) + (totalRd * profil.prd) + (totalDc * profil.pdc) + (totalCc * profil.pcc));
}
/**
* Ajoute l'effet et l'extra effet
*/
public double addEffet(double montant, Insigne insigne) {
int nbSet = 0;
// On compte le nombre d'insignes du meme set
for(Insigne ins : insignes.values()) {
if (ins.set.equals(insigne.set)) {
nbSet++;
}
}
double puissance = insigne.puissance;
double extraPuissance = insigne.extraPuissance;
if (nbSet >= SET_BONUS_NUMBER) {
puissance *= SET_BONUS_VALUE;
extraPuissance *= SET_BONUS_VALUE;
}
// Effet
if (insigne.puissance <= 1) {
montant = montant * (1 + puissance);
}
else {
montant += puissance;
}
// Extra effet
if (perso.equipiers.contains(insigne.extra)) {
if (insigne.extraPuissance <= 1) {
montant = montant * (1 + extraPuissance);
}
else {
montant += extraPuissance;
}
}
return montant;
}
public boolean isEquipable(Insigne insigne, int emplacement, Profil profil) {
// On compte le max d'insignes et le nombre d'insignes or
int nbOr = 0;
int nbEffet = 0;
for(Insigne ins : insignes.values()) {
if (ins.effet.equals(insigne.effet)) {
nbEffet++;
}
if (ins.etoiles == 5) {
nbOr++;
}
}
if (insigne.etoiles == 5) {
nbOr++;
}
return !insigne.equipe
&& profil.accept(insigne)
&& insigne.emplacement == emplacement
&& nbEffet < NB_MAX_EFFET
&& nbOr <= NB_MAX_OR_PAR_PERSO;
}
public String toString() {
String sb = "";
String bonus = "";
for (int i=1; i<=6; i++) {
Insigne ins = insignes.get(i);
if (ins != null) {
bonus += ins.set;
sb += String.format("[(%s) %s-%s> %s %s %s*", ins.csvLine, ins.emplacement, ins.set, ins.puissance, ins.effet, ins.etoiles);
if (ins.extra != null) {
sb += String.format(" (%s %s)", ins.extraPuissance, ins.extra);
}
sb += "]";
}
}
// Verifie s'il y a un bonus
if (bonus.chars().filter(ch -> ch == 'a').count() >= SET_BONUS_NUMBER
|| bonus.chars().filter(ch -> ch == 'b').count() >= SET_BONUS_NUMBER
|| bonus.chars().filter(ch -> ch == 'c').count() >= SET_BONUS_NUMBER
|| bonus.chars().filter(ch -> ch == 'd').count() >= SET_BONUS_NUMBER
|| bonus.chars().filter(ch -> ch == 'e').count() >= SET_BONUS_NUMBER
) {
sb = "BONUS - " + sb;
}
return sb;
}
}
| true
|
fae3701a6e5d1f61572ac95961bb84c825957887
|
Java
|
daniloricardo/valetao
|
/src/main/java/nelsys/modelo/Pessoa.java
|
UTF-8
| 439
| 2.265625
| 2
|
[] |
no_license
|
package nelsys.modelo;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Pessoa {
@Id
private String idpessoa;
private String nmpessoa;
public String getIdpessoa() {
return idpessoa;
}
public void setIdpessoa(String idpessoa) {
this.idpessoa = idpessoa;
}
public String getNmpessoa() {
return nmpessoa;
}
public void setNmpessoa(String nmpessoa) {
this.nmpessoa = nmpessoa;
}
}
| true
|
937f184aeec620762841d5d9dc47dfed146b713a
|
Java
|
wahrheitmusic/automation
|
/automation/gt-automation-master/src/main/java/core/rest/HttpResponseWrapper.java
|
UTF-8
| 1,414
| 2.390625
| 2
|
[] |
no_license
|
/*
* Canadian Tire Corporation, Ltd. Do not reproduce without permission in writing. Copyright (c) 2014 Canadian Tire
* Corporation, Ltd. All rights reserved.
*/
package core.rest;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
public class HttpResponseWrapper {
private final int statusCode;
private String body;
private String bodyEncoded;
private HttpResponse rawResponse;
public HttpResponseWrapper(final HttpResponse httpResponse) {
rawResponse = httpResponse;
statusCode = httpResponse.getStatusLine().getStatusCode();
try {
bodyEncoded = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
body = new String(bodyEncoded.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new RuntimeException("Could not parse response");
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Could not parse response");
}
}
public String getBody() {
return body;
}
public String getBodyEncoded() {
return bodyEncoded;
}
public int getStatusCode() {
return statusCode;
}
public HttpResponse getRawResponse() {
return rawResponse;
}
}
| true
|
abd52e7c21e2113af6921c9128421c96e3b1886c
|
Java
|
thucle99/lapTrinhMang
|
/Student-UDP/src/main/java/server/MainDao.java
|
UTF-8
| 1,014
| 2.5625
| 3
|
[] |
no_license
|
/*
* 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 server;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author thuc
*/
public class MainDao {
Connection con ;
String jdbcURL="jdbc:mysql://localhost:3306/student" ;
String username="root";
String password="123456";
public MainDao(){
try {
Class.forName("com.mysql.cj.jdbc.Driver") ;
con=DriverManager.getConnection(jdbcURL,username,password);
} catch (ClassNotFoundException ex) {
Logger.getLogger(MainDao.class.getName()).log(Level.SEVERE, null, ex);
} catch(SQLException e){
e.printStackTrace();
}
}
public Connection getConnection(){
return con;
}
}
| true
|
10b3517dbbfdcc03f75f972f2fb0e117c24570e9
|
Java
|
zheng-chang-wei/myproject
|
/7sy/后端/src/main/java/com/hirain/qsy/shaft/common/model/HistoryData.java
|
UTF-8
| 5,407
| 2.265625
| 2
|
[] |
no_license
|
package com.hirain.qsy.shaft.common.model;
import com.hirain.qsy.shaft.common.util.DateUtil;
import lombok.Data;
import java.util.Date;
/**
* @date 2020/05/28
* <p>
* Description:
**/
@Data
public class HistoryData {
/**
* 原始表主键
*/
private String originalprimarykey;
/**
* 车型
*/
private String trainType;
/**
* 车号
*/
private String trainNum;
/**
* 采集时间
*/
private String acquisitionTime;
/**
* 环境温度1
*/
private String ambientTemperature1;
/**
* 环境温度2
*/
private String ambientTemperature2;
/**
* GPS速度
*/
private String gpsSpeed;
/**
* 1轴测试点1温度-℃
*/
private String axle11;
/**
* 1轴测试点2温度-℃
*/
private String axle12;
private String axle13;
private String axle14;
private String axle15;
private String axle16;
private String axle21;
private String axle22;
private String axle23;
private String axle24;
private String axle25;
private String axle26;
private String axle31;
private String axle32;
private String axle33;
private String axle34;
private String axle35;
private String axle36;
private String axle41;
private String axle42;
private String axle43;
private String axle44;
private String axle45;
private String axle46;
private String axle51;
private String axle52;
private String axle53;
private String axle54;
private String axle55;
private String axle56;
private String axle61;
private String axle62;
private String axle63;
private String axle64;
private String axle65;
private String axle66;
public Date getAcquisitionTime() {
return DateUtil.string2Date(acquisitionTime);
}
// public Integer getAmbientTemperature1() {
// return Integer.valueOf(ambientTemperature1);
// }
//
// public Integer getAmbientTemperature2() {
// return Integer.valueOf(ambientTemperature2);
// }
//
// public Integer getGpsSpeed() {
// return Integer.valueOf(gpsSpeed);
// }
//
// public Integer getAxle11() {
// return Integer.valueOf(axle11);
// }
//
// public Integer getAxle12() {
// return Integer.valueOf(axle12);
// }
//
// public Integer getAxle13() {
// return Integer.valueOf(axle13);
// }
//
// public Integer getAxle14() {
// return Integer.valueOf(axle14);
// }
//
// public Integer getAxle15() {
// return Integer.valueOf(axle15);
// }
//
// public Integer getAxle16() {
// return Integer.valueOf(axle16);
// }
//
// public Integer getAxle21() {
// return Integer.valueOf(axle21);
// }
//
// public Integer getAxle22() {
// return Integer.valueOf(axle22);
// }
//
// public Integer getAxle23() {
// return Integer.valueOf(axle23);
// }
//
// public Integer getAxle24() {
// return Integer.valueOf(axle24);
// }
//
// public Integer getAxle25() {
// return Integer.valueOf(axle25);
// }
//
// public Integer getAxle26() {
// return Integer.valueOf(axle26);
// }
//
// public Integer getAxle31() {
// return Integer.valueOf(axle31);
// }
//
// public Integer getAxle32() {
// return Integer.valueOf(axle32);
// }
//
// public Integer getAxle33() {
// return Integer.valueOf(axle33);
// }
//
// public Integer getAxle34() {
// return Integer.valueOf(axle34);
// }
//
// public Integer getAxle35() {
// return Integer.valueOf(axle35);
// }
//
// public Integer getAxle36() {
// return Integer.valueOf(axle36);
// }
//
// public Integer getAxle41() {
// return Integer.valueOf(axle41);
// }
//
// public Integer getAxle42() {
// return Integer.valueOf(axle42);
// }
//
// public Integer getAxle43() {
// return Integer.valueOf(axle43);
// }
//
// public Integer getAxle44() {
// return Integer.valueOf(axle44);
// }
//
// public Integer getAxle45() {
// return Integer.valueOf(axle45);
// }
//
// public Integer getAxle46() {
// return Integer.valueOf(axle46);
// }
//
// public Integer getAxle51() {
// return Integer.valueOf(axle51);
// }
//
// public Integer getAxle52() {
// return Integer.valueOf(axle52);
// }
//
// public Integer getAxle53() {
// return Integer.valueOf(axle53);
// }
//
// public Integer getAxle54() {
// return Integer.valueOf(axle54);
// }
//
// public Integer getAxle55() {
// return Integer.valueOf(axle55);
// }
//
// public Integer getAxle56() {
// return Integer.valueOf(axle56);
// }
//
// public Integer getAxle61() {
// return Integer.valueOf(axle61);
// }
//
// public Integer getAxle62() {
// return Integer.valueOf(axle62);
// }
//
// public Integer getAxle63() {
// return Integer.valueOf(axle63);
// }
//
// public Integer getAxle64() {
// return Integer.valueOf(axle64);
// }
//
// public Integer getAxle65() {
// return Integer.valueOf(axle65);
// }
//
// public Integer getAxle66() {
// return Integer.valueOf(axle66);
// }
}
| true
|
96da969d7dfaa76798c8ebe78eded3602516017a
|
Java
|
cdc895642/SoftServe-TeamProject
|
/src/main/java/com/softserve/teamproject/repository/expression/EventExpressions.java
|
UTF-8
| 1,410
| 2.15625
| 2
|
[] |
no_license
|
package com.softserve.teamproject.repository.expression;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.softserve.teamproject.entity.QEvent;
import com.softserve.teamproject.entity.Room;
import java.time.LocalDateTime;
import java.util.List;
public class EventExpressions {
public static BooleanExpression getKeyDates() {
return QEvent.event.eventType.isKeyDate.eq(true);
}
public static BooleanExpression getEventByGroupId(Integer id) {
return QEvent.event.group.id.eq(id);
}
public static BooleanExpression getEventByGroupId(List<Integer> groups) {
return QEvent.event.group.id.in(groups);
}
public static BooleanExpression getEventBetweenDates(LocalDateTime start, LocalDateTime finish) {
return QEvent.event.start.between(start, finish);
}
public static BooleanExpression getEventsBeforeStart(LocalDateTime start) {
return QEvent.event.start.before(start);
}
public static BooleanExpression eventByEventTypeId(Integer id) {
return QEvent.event.eventType.id.eq(id);
}
public static BooleanExpression getNotKeyDates() {
return QEvent.event.eventType.isKeyDate.eq(false);
}
public static BooleanExpression getCrossedEvents(LocalDateTime start, LocalDateTime finish,
Integer roomId) {
return QEvent.event.start.before(finish).and(QEvent.event.end.after(start))
.and(QEvent.event.room.id.eq(roomId));
}
}
| true
|
01081976ccc2792040b6a134844023b09380ceb8
|
Java
|
fisrtplanhost/PerfectWasher-laundry-app
|
/app/src/main/java/com/webapppro/co/za/perfectwasher/OrderActivity.java
|
UTF-8
| 10,528
| 1.671875
| 2
|
[] |
no_license
|
package com.webapppro.co.za.perfectwasher;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TimePicker;
import android.widget.Toast;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
public class OrderActivity extends AppCompatActivity implements View.OnClickListener, OnMapReadyCallback {
EditText txtDate, txtTime, txtStreet, txtSuburb, txtTel, txtComplex, txtInstruction;
Button btnDatePicker, btnTimePicker, btnSendRequest;
ProgressBar progressBar;
private int mYear, mMonth, mDay, mHour, mMinute;
private FirebaseAuth mAuth;
Location currentLocation;
FusedLocationProviderClient fusedLocationProviderClient;
private static final int REQUEST_CODE = 101;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_order);
progressBar = (ProgressBar) findViewById(R.id.progress_bar);
txtStreet = (EditText) findViewById(R.id.field_street);
txtSuburb = (EditText) findViewById(R.id.field_suburb);
txtComplex = (EditText) findViewById(R.id.field_complex);
txtInstruction = (EditText) findViewById(R.id.field_instruction);
txtDate = (EditText) findViewById(R.id.field_date_collect);
txtTime = (EditText) findViewById(R.id.field_time_collect);
btnDatePicker = (Button) findViewById(R.id.btn_date_select);
btnTimePicker = (Button) findViewById(R.id.btn_time_select);
btnSendRequest = (Button) findViewById(R.id.btn_send_request);
btnDatePicker.setOnClickListener(this);
btnTimePicker.setOnClickListener(this);
btnSendRequest.setOnClickListener(this);
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
fetchLocation();
mAuth = FirebaseAuth.getInstance();
}
private void fetchLocation(){
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE);
return;
}
Task<Location> task = fusedLocationProviderClient.getLastLocation();
task.addOnSuccessListener(new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
if (location != null) {
currentLocation = location;
Toast.makeText(getApplicationContext(), currentLocation.getLatitude() + "" + currentLocation.getLongitude(), Toast.LENGTH_SHORT).show();
SupportMapFragment supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
assert supportMapFragment != null;
supportMapFragment.getMapAsync(OrderActivity.this);
}
}
});
}
@Override
public void onMapReady(GoogleMap googleMap) {
LatLng latLng = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude());
MarkerOptions markerOptions = new MarkerOptions().position(latLng).title("I am here!");
googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
googleMap.addMarker(markerOptions);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case REQUEST_CODE:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
fetchLocation();
}
break;
}
}
@Override
public void onClick(View v) {
if(v == btnDatePicker){
//Get Current Date
final Calendar calendar = Calendar.getInstance();
mYear = calendar.get(Calendar.YEAR);
mMonth = calendar.get(Calendar.MONTH);
mDay = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
txtDate.setText(dayOfMonth + "-" + (month + 1 ) + "-" + year);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
}
if (v == btnTimePicker){
//Get Current Time
final Calendar c = Calendar.getInstance();
mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE);
//Launch Time Picker Dialog
TimePickerDialog timePickerDialog = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
txtTime.setText(hourOfDay + ":" + minute);
}
}, mHour, mMinute, false);
timePickerDialog.show();
}if (v == btnSendRequest){
final String street = txtStreet.getText().toString();
final String suburb = txtSuburb.getText().toString();
final String complex = txtComplex.getText().toString();
final String instruction = txtInstruction.getText().toString();
final String dateP = txtDate.getText().toString();
final String timeP = txtTime.getText().toString();
if (TextUtils.isEmpty(street)){
txtStreet.setError("Street address required!");
return;
}
if (TextUtils.isEmpty(suburb)){
txtSuburb.setError("Suburb is required!");
return;
}
progressBarShow();
String userId = mAuth.getCurrentUser().getUid();
DatabaseReference dbRef = FirebaseDatabase.getInstance().getReference()
.child("Users").child(userId).child("Orders");
Map orderInfo = new HashMap();
orderInfo.put("Street", street);
orderInfo.put("Suburb", suburb);
orderInfo.put("Complex", complex);
orderInfo.put("Instruction", instruction);
orderInfo.put("Date", dateP);
orderInfo.put("Time", timeP);
dbRef.setValue(orderInfo).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
progressBarHide();
Toast.makeText(OrderActivity.this, "Order successful placed, we will contact you soon", Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
progressBarHide();
Toast.makeText(OrderActivity.this, "Order unsuccessful placed, Please Try Again!", Toast.LENGTH_SHORT).show();
}
});
}
}
private void goToNextActivity() {
AlertDialog dialog = new AlertDialog.Builder(this).create();
Intent intentNext = new Intent(OrderActivity.this, RequestActivity.class);
startActivity(intentNext);
finish();
}
private void progressBarHide() {
progressBar.setVisibility(View.GONE);
}
private void progressBarShow() {
progressBar.setVisibility(View.VISIBLE);
}
public void userLogout(View view) {
FirebaseAuth.getInstance().signOut();
startActivity(new Intent(OrderActivity.this, LoginActivity.class));
finish();
}
public void phoneCall(View view) {
String phoneNumber = "+27814722223";
String numberFormat = String.format("tel: %s",phoneNumber);
Intent dialNumber = new Intent(Intent.ACTION_DIAL);
dialNumber.setData(Uri.parse(numberFormat));
if (dialNumber.resolveActivity(getPackageManager()) != null) {
startActivity(dialNumber);
}else {
Toast.makeText(getApplicationContext(), "Error Calling", Toast.LENGTH_SHORT).show();
}
}
public void goToProfile(View view){
Intent proIntent = new Intent(OrderActivity.this, ProfileActivity.class);
startActivity(proIntent);
}
public void goToAbout(View view) {
startActivity(new Intent(OrderActivity.this, AboutActivity.class));
}
}
| true
|
71186a2ddb3d84a1c7b855f703b3ad5567935ad0
|
Java
|
felipeleao/pdac
|
/PdacSpring/SpringRemoteModShared/src/br/uniriotec/np2tec/propid/shared/classes/Pedido.java
|
UTF-8
| 2,993
| 2.15625
| 2
|
[] |
no_license
|
/*
* To change this template;
private String choose Tools | Templates
* and open the template in the editor.
*/
package br.uniriotec.np2tec.propid.shared.classes;
import java.io.Serializable;
import java.util.List;
/**
*
* @author Felipe
*/
public class Pedido implements Serializable{
private String o_orderkey;
private String o_custkey;
private String o_orderstatus;
private String o_totalprice;
private String o_orderdate;
private String o_orderpriority;
private String o_clerk;
private String o_shippriority;
private String o_comment;
private List<ItemPedido> itensPedido;
public Pedido(String o_orderkey, String o_custkey, String o_orderstatus,
String o_totalprice, String o_orderdate, String o_orderpriority,
String o_clerk, String o_shippriority, String o_comment){
this.o_orderkey = o_orderkey;
this.o_custkey = o_custkey;
this.o_orderstatus = o_orderstatus;
this.o_totalprice = o_totalprice;
this.o_orderdate = o_orderdate;
this.o_orderpriority = o_orderpriority;
this.o_clerk = o_clerk;
this.o_shippriority = o_shippriority;
this.o_comment = o_comment;
}
public String getO_orderkey() {
return o_orderkey;
}
public void setO_orderkey(String o_orderkey) {
this.o_orderkey = o_orderkey;
}
public String getO_custkey() {
return o_custkey;
}
public void setO_custkey(String o_custkey) {
this.o_custkey = o_custkey;
}
public String getO_orderstatus() {
return o_orderstatus;
}
public void setO_orderstatus(String o_orderstatus) {
this.o_orderstatus = o_orderstatus;
}
public String getO_totalprice() {
return o_totalprice;
}
public void setO_totalprice(String o_totalprice) {
this.o_totalprice = o_totalprice;
}
public String getO_orderdate() {
return o_orderdate;
}
public void setO_orderdate(String o_orderdate) {
this.o_orderdate = o_orderdate;
}
public String getO_orderpriority() {
return o_orderpriority;
}
public void setO_orderpriority(String o_orderpriority) {
this.o_orderpriority = o_orderpriority;
}
public String getO_clerk() {
return o_clerk;
}
public void setO_clerk(String o_clerk) {
this.o_clerk = o_clerk;
}
public String getO_shippriority() {
return o_shippriority;
}
public void setO_shippriority(String o_shippriority) {
this.o_shippriority = o_shippriority;
}
public String getO_comment() {
return o_comment;
}
public void setO_comment(String o_comment) {
this.o_comment = o_comment;
}
public List<ItemPedido> getItensPedido() {
return itensPedido;
}
public void setItensPedido(List<ItemPedido> itensPedido) {
this.itensPedido = itensPedido;
}
}
| true
|
a743a43253085740ffb93de0439f215f1198e47f
|
Java
|
PhiHuyHoang/Java
|
/java1/src/java1/Audi.java
|
UTF-8
| 660
| 3.125
| 3
|
[] |
no_license
|
/*
* 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 java1;
/**
*
* @author I352015
*/
public class Audi extends Car {
private Family family;
public Audi(String name, Person person, nationality newnationality, Family family) {
super(name, person, newnationality);
this.family = family;
}
public void driveable()
{
for(Person person : family.getListOfPerson())
{
System.out.println("I'm driven by " + person.getName());
}
}
}
| true
|
4a0950cae639a2c406dbd8bc4f8fcbad216c7a5f
|
Java
|
KongZouXiang/TradeSteward
|
/src/main/java/com/yunhe/basicdata/service/ICommodityListService.java
|
UTF-8
| 2,446
| 1.984375
| 2
|
[] |
no_license
|
package com.yunhe.basicdata.service;
import com.yunhe.basicdata.entity.Commclass;
import com.yunhe.basicdata.entity.CommodityList;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yunhe.basicdata.entity.WarehouseManagement;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* <p>
* 商品列表 服务类
* </p>
* @author 李恒逵, 唐凯宽
* @since 2019-01-02
*/
@Repository
public interface ICommodityListService extends IService<CommodityList> {
/**
* 查询商品列表 分页
* 三个参数
* @param current 当前页
* @param size 每页的条数
* @param commodityList 实体类
* @return f返回商品的信息
*/
Map selectAllcommList(int current, int size, CommodityList commodityList);
/**
* 新增商品列表
* @param commodityList 新增商品的实体类
* @return 返回增加的商品
*/
int insertComm(CommodityList commodityList);
/**
* 查询商品的详细信息
*
* @param id 查询商品的id
* @return 返回根据id查询信息
*/
CommodityList selectCommById(int id);
/**
* 更改商品的信息
*
* @param commodityList 更改商品的实体类
* @return 返回更改的信息
*/
int updateComm(CommodityList commodityList);
/**
* 删除商品的信息
*
* @param commodityList 删除商品的实体类
* @return 无返回
*/
int deleteComm(CommodityList commodityList);
/**
* 模糊查询
*
* @param data 模糊查询的条件
* @return 返回模糊查询的信息
*/
List<CommodityList> selectCommstlist(String data);
/**
*导出excel
* @return
*/
List<CommodityList> ExportExcel();
/**
* 查询商品所在的仓库
* @param id
* @return
*/
WarehouseManagement selectWmAndComm(int id);
/**
* 查询的是商品所在的分类
* @param id 商品的id
* @return
*/
Commclass selectclassAndComm(int id);
/**
* @author 史江浩
* @since 2019-01-14
* @return 查询商品
*/
Map selectComclassList1();
/**
* @author 史江浩
* @since 2019-01-21
* @param clName 查询的条件
* @return 根据商id查询的结果
*/
CommodityList selectListByClName(String clName);
}
| true
|
88e94763c30b6bf0bfa83fc530ff68fe898bf459
|
Java
|
pavlop/crackingtci
|
/DesignInterview_!/src/photoshop/Canvas.java
|
UTF-8
| 462
| 2.734375
| 3
|
[] |
no_license
|
package photoshop;
import java.util.ArrayList;
import java.util.List;
/**
*
*
*
*/
public class Canvas {
List<ShapeComponent> componentOnCanvas = new ArrayList<>();
public char[][] canvas;
public Canvas (int vert, int hor) {
canvas = new char[vert][hor];
}
public void put (ShapeComponent s) {
componentOnCanvas.add(s);
}
public void remove (ShapeComponent s) {
componentOnCanvas.remove(s);
}
}
| true
|
8caea596947c56f3293886caaa5f7a365dae1c6e
|
Java
|
jivanlo/demo-one
|
/src/main/java/com/demo/concept/Application.java
|
UTF-8
| 567
| 1.71875
| 2
|
[] |
no_license
|
package com.demo.concept;
import com.demo.concept.config.MainConfig;
import com.demo.concept.config.PersistenceConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
@ImportResource({ "application-context.xml" })
public class Application
{
public static void main(final String[] args)
{
SpringApplication.run(new Object[] { Application.class, MainConfig.class, PersistenceConfig.class }, args);
}
}
| true
|
6092faef61c2992e8b229f3f8cb393976abafd51
|
Java
|
izie-br/FrameworkMobile
|
/lib/src/test/java/com/quantium/mobile/framework/libandroidtest/server/BaseServerBean.java
|
UTF-8
| 3,438
| 2.40625
| 2
|
[] |
no_license
|
package com.quantium.mobile.framework.libandroidtest.server;
import org.json.JSONArray;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
public abstract class BaseServerBean {
private Object application;
private Map<?, ?> map;
public Map<?, ?> getMap() {
return map;
}
public void setMap(Map<?, ?> map) {
this.map = map;
mapValues();
}
public String getParameter(String name) {
Object obj = getMap().get(name);
if (obj == null)
return null;
if (obj instanceof String[]) {
String values[] = (String[]) obj;
if (values.length > 1) {
return new JSONArray(Arrays.asList(values)).toString();
} else {
return (values != null && values.length > 0) ? values[0] : null;
}
}
if (obj instanceof String) {
return (String) obj;
}
throw new IllegalArgumentException(
obj.getClass().getName() + "::" + obj.toString());
}
public Object getApplication() {
return application;
}
public void setApplication(Object application) {
this.application = application;
}
public void setAttribute(String name, Object value) {
Method method;
try {
if (value == null) {
method = application.getClass()
.getMethod("removeAttribute", String.class);
method.invoke(application, name);
} else {
method = application.getClass()
.getMethod("setAttribute", String.class, Object.class);
method.invoke(application, name, value);
}
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public Object getAttribute(String name) {
Method getAttribute;
try {
getAttribute = application.getClass()
.getMethod("getAttribute", String.class);
return getAttribute.invoke(application, name);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
private void mapValues() {
if (map == null)
return;
for (Object keyObj : map.keySet()) {
String key = keyObj.toString();
String methodName =
"set" +
Character.toUpperCase(key.charAt(0)) +
key.substring(1);
try {
Method m = this.getClass().getMethod(methodName, String.class);
m.setAccessible(true);
m.invoke(this, getParameter(key));
} catch (SecurityException e) {
} catch (NoSuchMethodException e) {
} catch (InvocationTargetException e) {
} catch (IllegalAccessException e) {
}
}
}
public abstract String getResponse();
}
| true
|
04e1faf5ecdd38ad0654fc07d14e0bcb207eec08
|
Java
|
victorherrerocazurro/CursoSpringMalagaJunio2017
|
/05_PersonaRest/src/main/java/com/viewnext/persona/rest/configuration/SpringConfiguration.java
|
UTF-8
| 471
| 1.617188
| 2
|
[] |
no_license
|
package com.viewnext.persona.rest.configuration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@EnableWebMvc
@ComponentScan("com.viewnext.persona.rest")
public class SpringConfiguration extends WebMvcConfigurerAdapter {
}
| true
|
7404a8c9ba5a371ac4a6a7c831aa9816813b1f1b
|
Java
|
esteban2050/Automate-StoreDemoQA
|
/src/main/java/com/store/demoqa/steptostep/tasks/searchProduct.java
|
UTF-8
| 1,513
| 2.671875
| 3
|
[] |
no_license
|
package com.store.demoqa.steptostep.tasks;
import static net.serenitybdd.screenplay.Tasks.instrumented;
import org.openqa.selenium.Keys;
import com.store.demoqa.steptostep.models.storeModel;
import com.store.demoqa.steptostep.userinterfaces.homeStoreComponents;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Performable;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.actions.Enter;
import net.thucydides.core.annotations.Step;
/**
*
* @author Juan Esteban Lopez Giraldo
*
*/
public class searchProduct implements Task{
//Variable privada de tipo storeModel.
private storeModel storemodel;
//Constructor.
public searchProduct (storeModel storemodel) {
this.storemodel= storemodel;
}
@Override
@Step("{0} fill the search bar with a product")
//metodo que lleva las interacciones
public <T extends Actor> void performAs(T actor)
{
//En estas interacciones, se hace clic en la barra del buscador de la pagina y se busca un
//elemento que es enviado por parametro desde el step Definitions y se manda con su propiedad get.
actor.attemptsTo(
Enter.theValue(storemodel.getProduct()).into(homeStoreComponents.SEARCH_BAR).thenHit(Keys.ENTER));
}
public static Performable doTheSearch(storeModel storemodel)
{
//El metodo instrumented recibe dos parametros, el primero es la clase a la cual hace referencia
//y el segundo es el parametro que recibe el metodo que lo contiene
return instrumented(searchProduct.class,storemodel);
}
}
| true
|
043030f16f99360a314c6754d54f335e20153282
|
Java
|
SAG-KeLP/kelp-core
|
/src/main/java/it/uniroma2/sag/kelp/learningalgorithm/classification/multiclassification/MultiLabelClassificationLearning.java
|
UTF-8
| 5,613
| 2.390625
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
* Copyright 2014 Simone Filice and Giuseppe Castellucci and Danilo Croce and Roberto Basili
* 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 it.uniroma2.sag.kelp.learningalgorithm.classification.multiclassification;
import java.util.Arrays;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeName;
import it.uniroma2.sag.kelp.data.dataset.Dataset;
import it.uniroma2.sag.kelp.data.label.Label;
import it.uniroma2.sag.kelp.learningalgorithm.LearningAlgorithm;
import it.uniroma2.sag.kelp.learningalgorithm.MetaLearningAlgorithm;
import it.uniroma2.sag.kelp.learningalgorithm.classification.ClassificationLearningAlgorithm;
import it.uniroma2.sag.kelp.predictionfunction.PredictionFunction;
import it.uniroma2.sag.kelp.predictionfunction.classifier.Classifier;
import it.uniroma2.sag.kelp.predictionfunction.classifier.multiclass.MultiLabelClassifier;
/**
* It is a meta algorithm that operates applying a multi label learning strategy over the base
* learning algorithm which is intended to be a binary learner. A multi label classification task
* is a multiclass problem in which each instance can belongs to zero, one or multiple classes.
* The multi label strategy will learn N different classifiers, where N is the number
* of classes involved in the dataset.
* In this strategy each classifier is learned by considering in turn the examples of a single
* class as positives, while all the other examples are considered as negative.
* <p>
*
* NOTE: the base learning algorithm must provide a duplicate method which properly works
*
* @author Simone Filice
*/
@JsonTypeName("multiLabel")
public class MultiLabelClassificationLearning implements ClassificationLearningAlgorithm, MetaLearningAlgorithm{
private Logger logger = LoggerFactory.getLogger(MultiLabelClassificationLearning.class);
private LearningAlgorithm baseAlgorithm;
@JsonIgnore
private LearningAlgorithm[] algorithms;
@JsonIgnore
private MultiLabelClassifier classifier;
private List<Label> labels;
public MultiLabelClassificationLearning(){
this.classifier = new MultiLabelClassifier();
}
/**
* Set the labels associated to this multi-classifier.
*/
@Override
public void setLabels(List<Label> labels){
this.labels=labels;
this.classifier.setLabels(labels);
}
/**
* Returns the labels to be learned
*
* @return the labels to be learned
*/
public List<Label> getLabels(){
return labels;
}
private void initialize() {
algorithms = new LearningAlgorithm[labels.size()];
Classifier[] binaryClassifier = new Classifier[labels.size()];
for(int i=0; i<labels.size(); i++){
try {
algorithms[i] = this.baseAlgorithm.duplicate();
algorithms[i].setLabels(Arrays.asList(labels.get(i)));
binaryClassifier[i] = (Classifier)algorithms[i].getPredictionFunction();
} catch (Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
System.exit(0);
}
}
classifier.setBinaryClassifiers(binaryClassifier);
}
/**
* This method will cause the meta-learning algorithm to learn
* N classifiers, where N is the number of classes in the dataset.
*/
@Override
public void learn(Dataset dataset) {
if(this.algorithms==null){
this.initialize();
}
for(int i=0; i<labels.size(); i++){
try {
algorithms[i].learn(dataset);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* This method will cause the reset of all the base algorithms
*/
@Override
public void reset() {
if(this.algorithms!=null){
for(LearningAlgorithm algo : this.algorithms){
algo.reset();
}
}
}
/**
* This method returns the learned PredictionFunction. It is of type
* MultiLabelClassifier.
*/
@Override
public MultiLabelClassifier getPredictionFunction() {
return this.classifier;
}
/**
* This method will set the type of the base algorithms to be learned.
*/
@Override
public void setBaseAlgorithm(LearningAlgorithm baseAlgorithm) {
this.baseAlgorithm=baseAlgorithm;
}
/**
* This method will return the base algorithm.
*/
@Override
public LearningAlgorithm getBaseAlgorithm() {
return baseAlgorithm;
}
/**
* This method will duplicate the current Learning algorithm
*/
@Override
public MultiLabelClassificationLearning duplicate(){
MultiLabelClassificationLearning copy = new MultiLabelClassificationLearning();
copy.setBaseAlgorithm(this.baseAlgorithm);
return copy;
}
@Override
public void setPredictionFunction(PredictionFunction predictionFunction) {
this.classifier = (MultiLabelClassifier) predictionFunction;
this.algorithms = new LearningAlgorithm[this.classifier.getLabels().size()];
this.labels = this.classifier.getLabels();
for(int i=0; i<this.classifier.getLabels().size(); i++){
this.algorithms[i] = this.baseAlgorithm.duplicate();
algorithms[i].setLabels(Arrays.asList(labels.get(i)));
this.algorithms[i].setPredictionFunction(this.classifier.getBinaryClassifiers()[i]);
}
}
}
| true
|
cc5ce01957f3bdeedfe9ced1b77f3fc6f6efe72d
|
Java
|
Cyprienzh/ach_automation
|
/ach_automation/src/ach_automation/CoreConnection.java
|
UTF-8
| 3,618
| 2.421875
| 2
|
[] |
no_license
|
package ach_automation;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import javax.net.ssl.SSLSocket;
import org.json.JSONObject;
public class CoreConnection extends Thread{
public final static int DISCONNECTED = 0;
public final static int CONNECTED = 1;
public final static int CLOSED = 2;
private SSLSocket module_socket;
private String module_name;
private String module_key;
private String core_host;
private int core_port;
private CoreInterface core_interface;
private int connection_state;
private PrintWriter os;
private BufferedReader is;
public CoreConnection(CoreInterface pCore, String pHost, int pPort, String pName, String pKey) {
this.core_interface = pCore;
this.core_host = pHost;
this.core_port = pPort;
this.module_name = pName;
this.module_key = pKey;
this.connection_state = DISCONNECTED;
}
public void run() {
try {
//Ouverture de la connexion au noyau ACH
module_socket = SSLSocketKeystoreFactory.getSocketWithCert(this.core_host, this.core_port, this.core_interface.getClass().getResourceAsStream("/PUBLIC_OWNET.jks"), "OwnetClientPassword", SSLSocketKeystoreFactory.SecureType.TLSv1_2);
module_socket.startHandshake();
}
catch(KeyManagementException | NoSuchAlgorithmException | CertificateException | KeyStoreException | IOException e) {e.printStackTrace();}
try {
//Ouverture du flux sortant
this.os = new PrintWriter(new OutputStreamWriter(module_socket.getOutputStream()));
//Construction du paquet IDENTITE
JSONObject identity_json = new JSONObject();
identity_json.put("type", "packet.identity");
identity_json.put("identity.module_name", this.module_name);
identity_json.put("identity.module_key", this.module_key);
//Envoi du paquet IDENTITE
this.os.println(identity_json);
this.os.flush();
}
catch(IOException e) {e.printStackTrace();}
try {
//Ouverture du flux entrant
this.is = new BufferedReader(new InputStreamReader(this.module_socket.getInputStream()));
}
catch(IOException e) {e.printStackTrace();}
String tmp_mes;
//Boucle de lecture des messages entrants
while(connection_state != CLOSED) {
try {
tmp_mes = is.readLine();
//Conversion du message reçu en structure JSON
JSONObject received_message = new JSONObject(tmp_mes);
switch(received_message.getString("type")) {
case "packet.ack":
//PAQUET ACKNOWLEDGMENT
this.connection_state = CONNECTED;
break;
default:
//Paquet envoye a default au noyau du module
this.core_interface.handleMessage(received_message);
break;
}
}
catch(IOException e) {e.printStackTrace();}
}
}
public void sendData(String dest_module, String data) {
//Creation du paquet data_message
JSONObject tmp_json = new JSONObject();
tmp_json.put("type", "packet.message_module");
tmp_json.put("message_module.dest",dest_module);
tmp_json.put("message_module.src",this.module_name);
tmp_json.put("message_module.content", data);
//Envoi du paquet
this.os.println(tmp_json);
this.os.flush();
}
public void sendLog(String log) {
//Creation du paquet log
JSONObject tmp_json = new JSONObject();
tmp_json.put("type", "packet.log");
tmp_json.put("log.message", log);
//Envoi du paquet
this.os.println(tmp_json);
this.os.flush();
}
}
| true
|
2b65cf5afa1d7b54f01c4ec7223d0cabca0740b0
|
Java
|
enjoyronald/TND
|
/TP3/TP_PIZZA/TP_PIZZA-war/src/java/gestionClient/Commande_Pizza.java
|
UTF-8
| 5,538
| 2.3125
| 2
|
[] |
no_license
|
/*
* 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 gestionClient;
import entite.CommandeFacadeLocal;
import entite.Pizza;
import entite.PizzaFacadeLocal;
import entite.Stock;
import entite.StockFacadeLocal;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
*
* @author enjoy
*/
public class Commande_Pizza extends HttpServlet {
@EJB
private StockFacadeLocal stockFacade;
@EJB
private PizzaFacadeLocal pizzaFacade;
@EJB
private CommandeFacadeLocal commandeFacade;
//private static final Logger LOG = Logger.getLogger(Commande_Pizza.class.getName());
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Commande Pizza" + Commande_Pizza.class + "</title>");
out.println("</head>");
out.println("<body>");
List lStock = stockFacade.findAll();
for (Iterator it = lStock.iterator(); it.hasNext();) {
Pizza elem = ((Stock) it.next()).getPizzaId();
out.println("Type : <b>" + elem.getPizzaId() + " </b> ");
out.println("Prix : " + elem.getPrix() + "<br/>");
}
out.println("<h1>Choisissez votre pizza : </h1>");
String type = request.getParameter("type");
if (type != null) {
Pizza pizza = pizzaFacade.find(type);
if (pizza != null) { // le nom n'est pas reférencé
try {
int quantite = new Integer(request.getParameter("quantite"));
String email = new String(request.getParameter("email"));
Stock spizza = stockFacade.findByPizzaId(type);
if(spizza.getQuantite() >= quantite){// la quantitée est disponible
int total = quantite * pizza.getPrix();
out.println("On ajoute une commande dont le prix total est :" + total + "<br/>");
stockFacade.update(type, spizza.getQuantite() - quantite);
commandeFacade.create(type, quantite, total, email);
//mise a jour de la quantite
out.println("Commande effectuée");
}else{
out.println("Pas suffisament de pizza en stock");
}
} catch (Exception ex) {
ex.printStackTrace();
}
} else {
out.println("pizza non trouvée--------");
}
} else {
out.println("<form method='POST'>");
out.println("Type: <input type='text' name='type'><br/>");
out.println("Quantité: <input type='text' name='quantite'><br/>");
out.println("Email: <input type='text' name='email'><br/>");
out.println("<input type='submit'><br/>");
out.println("</form>");
}
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| true
|
a3c46a0508c5092c27935b80574137d952626a8a
|
Java
|
GlobalLabstvr/java
|
/New folder/whileloopstatements/src/main/java/com/example/demo/WhileloopstatementsApplication.java
|
UTF-8
| 889
| 2.859375
| 3
|
[
"Apache-2.0"
] |
permissive
|
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WhileloopstatementsApplication {
public static void main(String[] args) {
SpringApplication.run(WhileloopstatementsApplication.class, args);
scanner reader= new scanner(system.in);
System.out.println("in how many attempts does the car start");
int attempts= readernext.in()
int count = 1;
int MaxAttempts =10;
while(count<=MaxAttempts) {
System.out.println("Roboat to attempts to starting car...");
if(count==attempts) {
System.out.println("roboat is successfully started the car in" + count +"attempts.");
break;
}
if(count==MaxAttempts) {
System.out.println("roboat start the car is failed..");
}
count++;
}
}
}
| true
|
de86cc53ad9334beed12d27cfe9a7e04e02c8a37
|
Java
|
MVishukumar/spring5-mvc-rest
|
/src/main/java/guru/springframework/services/CustomerServiceImpl.java
|
UTF-8
| 3,040
| 2.453125
| 2
|
[] |
no_license
|
package guru.springframework.services;
import guru.springframework.api.v1.mapper.CustomerMapper;
import guru.springframework.api.v1.model.CustomerDTO;
import guru.springframework.domain.Customer;
import guru.springframework.repositories.CustomerRepository;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
public class CustomerServiceImpl implements CustomerService {
private final CustomerRepository customerRepository;
private final CustomerMapper customerMapper;
public CustomerServiceImpl(CustomerRepository customerRepository, CustomerMapper customerMapper) {
this.customerRepository = customerRepository;
this.customerMapper = customerMapper;
}
@Override
public List<CustomerDTO> getAllCustomers() {
List<Customer> customerList = customerRepository.findAll();
return customerList
.stream()
.map(customer -> {
return customerMapper.customerToCustomerDTO(customer);
})
.collect(Collectors.toList());
}
@Override
public CustomerDTO getCustomerById(Long id) {
Optional<Customer> customer = customerRepository.findById(id);
if(customer.isPresent()) {
return customerMapper.customerToCustomerDTO(customer.get()) ;
} else {
throw new ResourceNotFoundException();
}
}
@Override
public CustomerDTO createNewCustomer(CustomerDTO customerDTO) {
Customer customer = customerMapper.customerDTOtoCustomer(customerDTO);
Customer customerSaved = customerRepository.save(customer);
return customerMapper.customerToCustomerDTO(customerSaved);
}
@Override
public CustomerDTO saveCustomerByDTO(Long id, CustomerDTO customerDTO) {
Customer customer = customerMapper.customerDTOtoCustomer(customerDTO);
customer.setId(id);
Customer customerSaved = customerRepository.save(customer);
CustomerDTO customerDTOSaved = customerMapper.customerToCustomerDTO(customerSaved);
return customerDTOSaved;
}
@Override
public CustomerDTO patchCustomer(Long id, CustomerDTO customerDTO) {
customerRepository.findById(id)
.map(customer -> {
if(customerDTO.getFirstname() != null) {
customer.setFirstname(customerDTO.getFirstname());
}
if(customerDTO.getLastname() != null) {
customer.setLastname(customerDTO.getLastname());
}
Customer customerSaved = customerRepository.save(customer);
return customerMapper.customerToCustomerDTO(customerSaved);
})
.orElseThrow(ResourceNotFoundException::new);
return null;
}
@Override
public void deleteCustomerById(Long id) {
customerRepository.deleteById(id);
}
}
| true
|
1e5bb9e49a3d19051b5930bd4650bc57388fe181
|
Java
|
TeodoraIoanaJipa/JavaWebProducts
|
/src/main/java/com/example/lab10/exceptions/NoRestaurantFoundException.java
|
UTF-8
| 100
| 1.664063
| 2
|
[] |
no_license
|
package com.example.lab10.exceptions;
public class NoRestaurantFoundException extends Exception{
}
| true
|
6381971f5e9fabc20b101d5032abef0a6510eac7
|
Java
|
clxy/PrestoRunner
|
/src/main/java/jp/co/intage/ssp/presto/CliOperator.java
|
UTF-8
| 1,122
| 2.5
| 2
|
[] |
no_license
|
package jp.co.intage.ssp.presto;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.UUID;
/**
* コマンドライン presto-cli 経由で実行
*/
public class CliOperator implements Operator {
private static final Log log = LogFactory.getLog(CliOperator.class);
private static final String CMD = "presto-cli --file %s";
@Override
public void operate(String sql) throws Exception {
String key = UUID.randomUUID().toString().replace("-", "") + ".sql";
Path file = Paths.get(key).getFileName();
Files.write(file, sql.getBytes());
String cmd = String.format(CMD, file.toAbsolutePath().toString());
log.info(cmd);
Process process =
new ProcessBuilder().inheritIO().command(cmd.split(" ")).start();
process.waitFor();
int exitValue = process.exitValue();
log.info("Exit Value : " + exitValue);
if (exitValue != 0) throw new RuntimeException("Failed : " + exitValue);
}
}
| true
|
c778bf19ba37e0143192978b44188dc64de19fb9
|
Java
|
Spkordell/CS2102Homework
|
/HW1/RobsJavas/RobsHW1Advanced/UnrankedPlayer.java
|
UTF-8
| 283
| 2.96875
| 3
|
[] |
no_license
|
public class UnrankedPlayer implements IContestant{
String name;
UnrankedPlayer (String name){
this.name = name;
}
// takes no input and returns a string representing the name- used to guarantee all IContestant have .name
public String returnName(){
return this.name;
}
}
| true
|
67239bd395866f95e6441ffc38c5074bfff20612
|
Java
|
mehmetgelmedi/DesignPatterns
|
/src/com/pwsturk/meg/Decorator/Burger.java
|
UTF-8
| 265
| 2.375
| 2
|
[] |
no_license
|
package com.pwsturk.meg.Decorator;
public abstract class Burger {
private String aciklama;
public void setAciklama(String aciklama) {
this.aciklama = aciklama;
}
public String getAciklama() {
return aciklama;
}
public abstract double fiyatlandir();
}
| true
|
101c4fa0f9e2ff3f68e9525e561b15839f039055
|
Java
|
doheejeon/education-java
|
/src/ch05/ex05/home_t/case02/Main.java
|
UTF-8
| 659
| 3.171875
| 3
|
[] |
no_license
|
package ch05.ex05.home_t.case02;
public class Main {
public static void main(String[] args) {
Ball ball = new Ball();
Player player1 = new Player();
Player player2 = new Player();
Player player3 = new Player();
player1.setName("최한석");
player2.setName("한아름");
player3.setName("양승일");
player3.kick(player2.pass(player1.pass(ball)));
}
}
/*과제내용
최한석, 한아름, 양승일이 축구를 한다.
한석이가 아름이한테 공을 패스한다.
아름이는 승일이한테 공을 패스한다.
승일이는 골을 넣는다.(공을찬다) -> 골을 넣는다를 다른 동사로 바꿔야한다.
*/
| true
|
500d60a8ae65aa16cb6adc182d4e5958e963c983
|
Java
|
linguochao1024/itdan
|
/lgc_design_mode/src/main/java/com/linguochao/design/action/strategy/duck/Duck.java
|
UTF-8
| 803
| 2.734375
| 3
|
[] |
no_license
|
package com.linguochao.design.action.strategy.duck;
import com.linguochao.design.action.strategy.flybehavior.FlyBehavior;
import com.linguochao.design.action.strategy.quackbehavior.QuackBehavior;
/**
* description
*
* @author linguochao
* @date 2020\4\11 0011
*/
public abstract class Duck {
FlyBehavior mFlyBehavior;
QuackBehavior mQuackBehavior;
public Duck() {
}
public void Fly() {
mFlyBehavior.fly();
}
public void Quack() {
mQuackBehavior.quack();
}
public abstract void display();
public void SetQuackBehavoir(QuackBehavior qb) {
mQuackBehavior = qb;
}
public void SetFlyBehavoir(FlyBehavior fb) {
mFlyBehavior = fb;
}
public void swim() {
System.out.println("~~im swim~~");
}
}
| true
|
e3bf39c76ef2c90fd94a3f0e544aeb345e3dfd04
|
Java
|
ruijietian/approximative-query-processing
|
/src/main/java/approximative/query/processing/graph/GraphLoader.java
|
UTF-8
| 4,924
| 2.25
| 2
|
[] |
no_license
|
package approximative.query.processing.graph;
import approximative.query.processing.exceptions.LoadGraphDataException;
import approximative.query.processing.util.Constants;
import oracle.pgx.api.GraphBuilder;
import oracle.pgx.api.PgxGraph;
import oracle.pgx.api.PgxSession;
import oracle.pgx.config.IdGenerationStrategy;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author LIRIS
* @version 1.0
* @since 1.0 6/13/18.
*/
class GraphLoader implements Loader {
private static final Logger LOG = LogManager.getLogger("GLOBAL");
private static volatile AtomicInteger idEdge = new AtomicInteger(-1);
private Set<LabelUse> labelUseSet;
private static Integer getIdEdge() {
return idEdge.incrementAndGet();
}
GraphLoader() {
this.labelUseSet = new HashSet<>();
}
@Override
public PgxGraph loadGraph(PgxSession session, String configPath) throws FileNotFoundException {
try {
File config = new File(configPath);
if (!config.exists())
throw new FileNotFoundException(String.format("File '%s' not found.", configPath));
return session.readGraphWithProperties(config.getPath());
} catch (ExecutionException | InterruptedException e) {
LOG.error(e.getMessage(), e);
throw new LoadGraphDataException("Graph could not be loaded.");
}
}
@Override
public Set<LabelUse> loadLabelsUse(String path) throws FileNotFoundException {
File file = new File(path);
if (!file.exists())
throw new FileNotFoundException(String.format("File '%s' not found", path));
boolean skipHead = true;
try (Scanner scanner = new Scanner(file)) {
while (scanner.hasNext()) {
if (!skipHead) {
String[] array = scanner.nextLine().split(" ");
labelUseSet.add(new LabelUse()
.setLabel(array[0])
.setPresentOnHNProperties(array[1].equals("1"))
.setPresentOnCrossEdges(array[2].equals("1"))
.setPresentOnReachCount(array[3].equals("1"))
.setPresentOnPathInCount(array[4].equals("1"))
.setPresentOnPathOutCount(array[5].equals("1"))
.setPresentOnSumInDegree(array[6].equals("1"))
.setPresentOnSumOutDegree(array[7].equals("1")));
}
skipHead = false;
}
}
return labelUseSet;
}
@Override
public PgxGraph loadGraph(PgxSession session, String edgeFile, String vertexFile) throws IOException, ExecutionException,
InterruptedException {
GraphBuilder<Integer> builder = session.createGraphBuilder(IdGenerationStrategy.USER_IDS, IdGenerationStrategy.USER_IDS);
if (new File(vertexFile).exists()) {
try (FileInputStream inputStream = new FileInputStream(vertexFile)) {
try (Scanner sc = new Scanner(inputStream, "UTF-8")) {
while (sc.hasNextLine()) {
String[] line = sc.nextLine().split(" ");
builder.addVertex(Integer.parseInt(line[0]))
.addLabel("Person");
}
// note that Scanner suppresses exceptions
if (sc.ioException() != null) {
throw sc.ioException();
}
}
}
}
if (!new File(edgeFile).exists())
throw new FileNotFoundException(String.format("File '%s' not found.", edgeFile));
try (FileInputStream inputStream = new FileInputStream(edgeFile)) {
try (Scanner sc = new Scanner(inputStream, "UTF-8")) {
while (sc.hasNextLine()) {
String[] line = sc.nextLine().split(Constants.SEPARATOR_CONFIG);
String labelPrefix = "";
if (line[1].chars().allMatch(Character::isDigit))
labelPrefix = Constants.LABEL_PREFIX;
builder.addEdge(getIdEdge(),
Integer.parseInt(line[0]), Integer.parseInt(line[2]))
.setLabel(labelPrefix.concat(line[1]));
}
// note that Scanner suppresses exceptions
if (sc.ioException() != null) {
throw sc.ioException();
}
}
}
return builder.build();
}
}
| true
|
f54f348fb8e950471f840c88dfe2d94133b8e4ad
|
Java
|
markjeffreymiller/servicetalk
|
/servicetalk-redis-api/src/main/java/io/servicetalk/redis/api/BlockingTransactedBufferRedisCommander.java
|
UTF-8
| 196,836
| 2.078125
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
* Copyright © 2018 Apple Inc. and the ServiceTalk project 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 io.servicetalk.redis.api;
import io.servicetalk.buffer.api.Buffer;
import java.util.Collection;
import java.util.List;
import javax.annotation.Generated;
import javax.annotation.Nullable;
/**
* Redis transacted command client that uses {@link Buffer} for keys and data.
* <p>
* Note that Redis Simple String responses are always returned as {@link String}. This API is provided for convenience
* for a more familiar sequential programming model.
*/
@Generated({})
public abstract class BlockingTransactedBufferRedisCommander implements AutoCloseable {
/**
* {@inheritDoc}
* <p>
* This will close the underlying {@link RedisRequester}!
*/
@Override
public abstract void close() throws Exception;
/**
* Append a value to a key.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.APPEND)
public abstract String append(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Authenticate to the server.
*
* @param password the password
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.AUTH)
public abstract String auth(Buffer password) throws Exception;
/**
* Asynchronously rewrite the append-only file.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BGREWRITEAOF)
public abstract String bgrewriteaof() throws Exception;
/**
* Asynchronously save the dataset to disk.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BGSAVE)
public abstract String bgsave() throws Exception;
/**
* Count set bits in a string.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITCOUNT)
public abstract String bitcount(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Count set bits in a string.
*
* @param key the key
* @param start the start
* @param end the end
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITCOUNT)
public abstract String bitcount(@RedisProtocolSupport.Key Buffer key, @Nullable Long start,
@Nullable Long end) throws Exception;
/**
* Perform arbitrary bitfield integer operations on strings.
*
* @param key the key
* @param operations the operations
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITFIELD)
public abstract String bitfield(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BitfieldOperation> operations) throws Exception;
/**
* Perform bitwise operations between strings.
*
* @param operation the operation
* @param destkey the destkey
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITOP)
public abstract String bitop(Buffer operation, @RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Perform bitwise operations between strings.
*
* @param operation the operation
* @param destkey the destkey
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITOP)
public abstract String bitop(Buffer operation, @RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Perform bitwise operations between strings.
*
* @param operation the operation
* @param destkey the destkey
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITOP)
public abstract String bitop(Buffer operation, @RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Perform bitwise operations between strings.
*
* @param operation the operation
* @param destkey the destkey
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITOP)
public abstract String bitop(Buffer operation, @RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Find first bit set or clear in a string.
*
* @param key the key
* @param bit the bit
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITPOS)
public abstract String bitpos(@RedisProtocolSupport.Key Buffer key, long bit) throws Exception;
/**
* Find first bit set or clear in a string.
*
* @param key the key
* @param bit the bit
* @param start the start
* @param end the end
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BITPOS)
public abstract String bitpos(@RedisProtocolSupport.Key Buffer key, long bit, @Nullable Long start,
@Nullable Long end) throws Exception;
/**
* Remove and get the first element in a list, or block until one is available.
*
* @param keys the keys
* @param timeout the timeout
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BLPOP)
public abstract String blpop(@RedisProtocolSupport.Key Collection<Buffer> keys, long timeout) throws Exception;
/**
* Remove and get the last element in a list, or block until one is available.
*
* @param keys the keys
* @param timeout the timeout
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BRPOP)
public abstract String brpop(@RedisProtocolSupport.Key Collection<Buffer> keys, long timeout) throws Exception;
/**
* Pop a value from a list, push it to another list and return it; or block until one is available.
*
* @param source the source
* @param destination the destination
* @param timeout the timeout
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BRPOPLPUSH)
public abstract String brpoplpush(@RedisProtocolSupport.Key Buffer source,
@RedisProtocolSupport.Key Buffer destination, long timeout) throws Exception;
/**
* Remove and return the member with the highest score from one or more sorted sets, or block until one is
* available.
*
* @param keys the keys
* @param timeout the timeout
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BZPOPMAX)
public abstract String bzpopmax(@RedisProtocolSupport.Key Collection<Buffer> keys, long timeout) throws Exception;
/**
* Remove and return the member with the lowest score from one or more sorted sets, or block until one is available.
*
* @param keys the keys
* @param timeout the timeout
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.BZPOPMIN)
public abstract String bzpopmin(@RedisProtocolSupport.Key Collection<Buffer> keys, long timeout) throws Exception;
/**
* Kill the connection of a client.
*
* @param id the id
* @param type the type
* @param addrIpPort the addrIpPort
* @param skipmeYesNo the skipmeYesNo
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLIENT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.KILL)
public abstract String clientKill(@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.ID) @Nullable Long id,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ClientKillType type,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.ADDR) @Nullable Buffer addrIpPort,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SKIPME) @Nullable Buffer skipmeYesNo) throws Exception;
/**
* Get the list of client connections.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLIENT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LIST)
public abstract String clientList() throws Exception;
/**
* Get the current connection name.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLIENT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GETNAME)
public abstract String clientGetname() throws Exception;
/**
* Stop processing commands from clients for some time.
*
* @param timeout the timeout
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLIENT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.PAUSE)
public abstract String clientPause(long timeout) throws Exception;
/**
* Instruct the server whether to reply to commands.
*
* @param replyMode the replyMode
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLIENT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.REPLY)
public abstract String clientReply(@RedisProtocolSupport.Option RedisProtocolSupport.ClientReplyReplyMode replyMode) throws Exception;
/**
* Set the current connection name.
*
* @param connectionName the connectionName
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLIENT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SETNAME)
public abstract String clientSetname(Buffer connectionName) throws Exception;
/**
* Assign new hash slots to receiving node.
*
* @param slot the slot
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.ADDSLOTS)
public abstract String clusterAddslots(long slot) throws Exception;
/**
* Assign new hash slots to receiving node.
*
* @param slot1 the slot1
* @param slot2 the slot2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.ADDSLOTS)
public abstract String clusterAddslots(long slot1, long slot2) throws Exception;
/**
* Assign new hash slots to receiving node.
*
* @param slot1 the slot1
* @param slot2 the slot2
* @param slot3 the slot3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.ADDSLOTS)
public abstract String clusterAddslots(long slot1, long slot2, long slot3) throws Exception;
/**
* Assign new hash slots to receiving node.
*
* @param slots the slots
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.ADDSLOTS)
public abstract String clusterAddslots(Collection<Long> slots) throws Exception;
/**
* Return the number of failure reports active for a given node.
*
* @param nodeId the nodeId
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT_FAILURE_REPORTS)
public abstract String clusterCountFailureReports(Buffer nodeId) throws Exception;
/**
* Return the number of local keys in the specified hash slot.
*
* @param slot the slot
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNTKEYSINSLOT)
public abstract String clusterCountkeysinslot(long slot) throws Exception;
/**
* Set hash slots as unbound in receiving node.
*
* @param slot the slot
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.DELSLOTS)
public abstract String clusterDelslots(long slot) throws Exception;
/**
* Set hash slots as unbound in receiving node.
*
* @param slot1 the slot1
* @param slot2 the slot2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.DELSLOTS)
public abstract String clusterDelslots(long slot1, long slot2) throws Exception;
/**
* Set hash slots as unbound in receiving node.
*
* @param slot1 the slot1
* @param slot2 the slot2
* @param slot3 the slot3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.DELSLOTS)
public abstract String clusterDelslots(long slot1, long slot2, long slot3) throws Exception;
/**
* Set hash slots as unbound in receiving node.
*
* @param slots the slots
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.DELSLOTS)
public abstract String clusterDelslots(Collection<Long> slots) throws Exception;
/**
* Forces a slave to perform a manual failover of its master.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.FAILOVER)
public abstract String clusterFailover() throws Exception;
/**
* Forces a slave to perform a manual failover of its master.
*
* @param options the options
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.FAILOVER)
public abstract String clusterFailover(@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ClusterFailoverOptions options) throws Exception;
/**
* Remove a node from the nodes table.
*
* @param nodeId the nodeId
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.FORGET)
public abstract String clusterForget(Buffer nodeId) throws Exception;
/**
* Return local key names in the specified hash slot.
*
* @param slot the slot
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GETKEYSINSLOT)
public abstract String clusterGetkeysinslot(long slot, long count) throws Exception;
/**
* Provides info about Redis Cluster node state.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.INFO)
public abstract String clusterInfo() throws Exception;
/**
* Returns the hash slot of the specified key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.KEYSLOT)
public abstract String clusterKeyslot(Buffer key) throws Exception;
/**
* Force a node cluster to handshake with another node.
*
* @param ip the ip
* @param port the port
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.MEET)
public abstract String clusterMeet(Buffer ip, long port) throws Exception;
/**
* Get Cluster config for the node.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.NODES)
public abstract String clusterNodes() throws Exception;
/**
* Reconfigure a node as a slave of the specified master node.
*
* @param nodeId the nodeId
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.REPLICATE)
public abstract String clusterReplicate(Buffer nodeId) throws Exception;
/**
* Reset a Redis Cluster node.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.RESET)
public abstract String clusterReset() throws Exception;
/**
* Reset a Redis Cluster node.
*
* @param resetType the resetType
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.RESET)
public abstract String clusterReset(@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ClusterResetResetType resetType) throws Exception;
/**
* Forces the node to save cluster state on disk.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SAVECONFIG)
public abstract String clusterSaveconfig() throws Exception;
/**
* Set the configuration epoch in a new node.
*
* @param configEpoch the configEpoch
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SET_CONFIG_EPOCH)
public abstract String clusterSetConfigEpoch(long configEpoch) throws Exception;
/**
* Bind a hash slot to a specific node.
*
* @param slot the slot
* @param subcommand the subcommand
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SETSLOT)
public abstract String clusterSetslot(long slot,
@RedisProtocolSupport.Option RedisProtocolSupport.ClusterSetslotSubcommand subcommand) throws Exception;
/**
* Bind a hash slot to a specific node.
*
* @param slot the slot
* @param subcommand the subcommand
* @param nodeId the nodeId
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SETSLOT)
public abstract String clusterSetslot(long slot,
@RedisProtocolSupport.Option RedisProtocolSupport.ClusterSetslotSubcommand subcommand,
@Nullable Buffer nodeId) throws Exception;
/**
* List slave nodes of the specified master node.
*
* @param nodeId the nodeId
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SLAVES)
public abstract String clusterSlaves(Buffer nodeId) throws Exception;
/**
* Get array of Cluster slot to node mappings.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CLUSTER)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SLOTS)
public abstract String clusterSlots() throws Exception;
/**
* Get array of Redis command details.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.COMMAND)
public abstract String command() throws Exception;
/**
* Get total number of Redis commands.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.COMMAND)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT)
public abstract String commandCount() throws Exception;
/**
* Extract keys given a full Redis command.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.COMMAND)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GETKEYS)
public abstract String commandGetkeys() throws Exception;
/**
* Get array of specific Redis command details.
*
* @param commandName the commandName
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.COMMAND)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.INFO)
public abstract String commandInfo(Buffer commandName) throws Exception;
/**
* Get array of specific Redis command details.
*
* @param commandName1 the commandName1
* @param commandName2 the commandName2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.COMMAND)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.INFO)
public abstract String commandInfo(Buffer commandName1, Buffer commandName2) throws Exception;
/**
* Get array of specific Redis command details.
*
* @param commandName1 the commandName1
* @param commandName2 the commandName2
* @param commandName3 the commandName3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.COMMAND)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.INFO)
public abstract String commandInfo(Buffer commandName1, Buffer commandName2, Buffer commandName3) throws Exception;
/**
* Get array of specific Redis command details.
*
* @param commandNames the commandNames
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.COMMAND)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.INFO)
public abstract String commandInfo(Collection<Buffer> commandNames) throws Exception;
/**
* Get the value of a configuration parameter.
*
* @param parameter the parameter
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CONFIG)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GET)
public abstract String configGet(Buffer parameter) throws Exception;
/**
* Rewrite the configuration file with the in memory configuration.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CONFIG)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.REWRITE)
public abstract String configRewrite() throws Exception;
/**
* Set a configuration parameter to the given value.
*
* @param parameter the parameter
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CONFIG)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SET)
public abstract String configSet(Buffer parameter, Buffer value) throws Exception;
/**
* Reset the stats returned by INFO.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.CONFIG)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.RESETSTAT)
public abstract String configResetstat() throws Exception;
/**
* Return the number of keys in the selected database.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DBSIZE)
public abstract String dbsize() throws Exception;
/**
* Get debugging information about a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DEBUG)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.OBJECT)
public abstract String debugObject(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Make the server crash.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DEBUG)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SEGFAULT)
public abstract String debugSegfault() throws Exception;
/**
* Decrement the integer value of a key by one.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DECR)
public abstract String decr(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Decrement the integer value of a key by the given number.
*
* @param key the key
* @param decrement the decrement
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DECRBY)
public abstract String decrby(@RedisProtocolSupport.Key Buffer key, long decrement) throws Exception;
/**
* Delete a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DEL)
public abstract String del(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Delete a key.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DEL)
public abstract String del(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Delete a key.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DEL)
public abstract String del(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Delete a key.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DEL)
public abstract String del(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Discard all commands issued after MULTI.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DISCARD)
public abstract String discard() throws Exception;
/**
* Return a serialized version of the value stored at the specified key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.DUMP)
public abstract String dump(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Echo the given string.
*
* @param message the message
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ECHO)
public abstract String echo(Buffer message) throws Exception;
/**
* Execute a Lua script server side.
*
* @param script the script
* @param numkeys the numkeys
* @param keys the keys
* @param args the args
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EVAL)
public abstract String eval(Buffer script, long numkeys, @RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> args) throws Exception;
/**
* Execute a Lua script server side.
*
* @param script the script
* @param numkeys the numkeys
* @param keys the keys
* @param args the args
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EVAL)
public abstract String evalList(Buffer script, long numkeys, @RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> args) throws Exception;
/**
* Execute a Lua script server side.
*
* @param script the script
* @param numkeys the numkeys
* @param keys the keys
* @param args the args
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EVAL)
public abstract String evalLong(Buffer script, long numkeys, @RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> args) throws Exception;
/**
* Execute a Lua script server side.
*
* @param sha1 the sha1
* @param numkeys the numkeys
* @param keys the keys
* @param args the args
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EVALSHA)
public abstract String evalsha(Buffer sha1, long numkeys, @RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> args) throws Exception;
/**
* Execute a Lua script server side.
*
* @param sha1 the sha1
* @param numkeys the numkeys
* @param keys the keys
* @param args the args
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EVALSHA)
public abstract String evalshaList(Buffer sha1, long numkeys, @RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> args) throws Exception;
/**
* Execute a Lua script server side.
*
* @param sha1 the sha1
* @param numkeys the numkeys
* @param keys the keys
* @param args the args
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EVALSHA)
public abstract String evalshaLong(Buffer sha1, long numkeys, @RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> args) throws Exception;
/**
* Execute all commands issued after MULTI.
*
* @return a {@link List} result
* @param <T> the type of elements
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EXEC)
public abstract <T> List<T> exec() throws Exception;
/**
* Determine if a key exists.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EXISTS)
public abstract String exists(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Determine if a key exists.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EXISTS)
public abstract String exists(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Determine if a key exists.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EXISTS)
public abstract String exists(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Determine if a key exists.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EXISTS)
public abstract String exists(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Set a key's time to live in seconds.
*
* @param key the key
* @param seconds the seconds
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EXPIRE)
public abstract String expire(@RedisProtocolSupport.Key Buffer key, long seconds) throws Exception;
/**
* Set the expiration for a key as a UNIX timestamp.
*
* @param key the key
* @param timestamp the timestamp
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.EXPIREAT)
public abstract String expireat(@RedisProtocolSupport.Key Buffer key, long timestamp) throws Exception;
/**
* Remove all keys from all databases.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.FLUSHALL)
public abstract String flushall() throws Exception;
/**
* Remove all keys from all databases.
*
* @param async the async
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.FLUSHALL)
public abstract String flushall(@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.FlushallAsync async) throws Exception;
/**
* Remove all keys from the current database.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.FLUSHDB)
public abstract String flushdb() throws Exception;
/**
* Remove all keys from the current database.
*
* @param async the async
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.FLUSHDB)
public abstract String flushdb(@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.FlushdbAsync async) throws Exception;
/**
* Add one or more geospatial items in the geospatial index represented using a sorted set.
*
* @param key the key
* @param longitude the longitude
* @param latitude the latitude
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOADD)
public abstract String geoadd(@RedisProtocolSupport.Key Buffer key, double longitude, double latitude,
Buffer member) throws Exception;
/**
* Add one or more geospatial items in the geospatial index represented using a sorted set.
*
* @param key the key
* @param longitude1 the longitude1
* @param latitude1 the latitude1
* @param member1 the member1
* @param longitude2 the longitude2
* @param latitude2 the latitude2
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOADD)
public abstract String geoadd(@RedisProtocolSupport.Key Buffer key, double longitude1, double latitude1,
Buffer member1, double longitude2, double latitude2, Buffer member2) throws Exception;
/**
* Add one or more geospatial items in the geospatial index represented using a sorted set.
*
* @param key the key
* @param longitude1 the longitude1
* @param latitude1 the latitude1
* @param member1 the member1
* @param longitude2 the longitude2
* @param latitude2 the latitude2
* @param member2 the member2
* @param longitude3 the longitude3
* @param latitude3 the latitude3
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOADD)
public abstract String geoadd(@RedisProtocolSupport.Key Buffer key, double longitude1, double latitude1,
Buffer member1, double longitude2, double latitude2, Buffer member2,
double longitude3, double latitude3, Buffer member3) throws Exception;
/**
* Add one or more geospatial items in the geospatial index represented using a sorted set.
*
* @param key the key
* @param longitudeLatitudeMembers the longitudeLatitudeMembers
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOADD)
public abstract String geoadd(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferLongitudeLatitudeMember> longitudeLatitudeMembers) throws Exception;
/**
* Returns the distance between two members of a geospatial index.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEODIST)
public abstract String geodist(@RedisProtocolSupport.Key Buffer key, Buffer member1,
Buffer member2) throws Exception;
/**
* Returns the distance between two members of a geospatial index.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @param unit the unit
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEODIST)
public abstract String geodist(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2,
@Nullable Buffer unit) throws Exception;
/**
* Returns members of a geospatial index as standard geohash strings.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOHASH)
public abstract String geohash(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Returns members of a geospatial index as standard geohash strings.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOHASH)
public abstract String geohash(@RedisProtocolSupport.Key Buffer key, Buffer member1,
Buffer member2) throws Exception;
/**
* Returns members of a geospatial index as standard geohash strings.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOHASH)
public abstract String geohash(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2,
Buffer member3) throws Exception;
/**
* Returns members of a geospatial index as standard geohash strings.
*
* @param key the key
* @param members the members
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOHASH)
public abstract String geohash(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> members) throws Exception;
/**
* Returns longitude and latitude of members of a geospatial index.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOPOS)
public abstract String geopos(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Returns longitude and latitude of members of a geospatial index.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOPOS)
public abstract String geopos(@RedisProtocolSupport.Key Buffer key, Buffer member1,
Buffer member2) throws Exception;
/**
* Returns longitude and latitude of members of a geospatial index.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOPOS)
public abstract String geopos(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2,
Buffer member3) throws Exception;
/**
* Returns longitude and latitude of members of a geospatial index.
*
* @param key the key
* @param members the members
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEOPOS)
public abstract String geopos(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> members) throws Exception;
/**
* Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a
* point.
*
* @param key the key
* @param longitude the longitude
* @param latitude the latitude
* @param radius the radius
* @param unit the unit
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEORADIUS)
public abstract String georadius(@RedisProtocolSupport.Key Buffer key, double longitude, double latitude,
double radius,
@RedisProtocolSupport.Option RedisProtocolSupport.GeoradiusUnit unit) throws Exception;
/**
* Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a
* point.
*
* @param key the key
* @param longitude the longitude
* @param latitude the latitude
* @param radius the radius
* @param unit the unit
* @param withcoord the withcoord
* @param withdist the withdist
* @param withhash the withhash
* @param count the count
* @param order the order
* @param storeKey the storeKey
* @param storedistKey the storedistKey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEORADIUS)
public abstract String georadius(@RedisProtocolSupport.Key Buffer key, double longitude, double latitude,
double radius,
@RedisProtocolSupport.Option RedisProtocolSupport.GeoradiusUnit unit,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusWithcoord withcoord,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusWithdist withdist,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusWithhash withhash,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusOrder order,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.STORE) @Nullable @RedisProtocolSupport.Key Buffer storeKey,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.STOREDIST) @Nullable @RedisProtocolSupport.Key Buffer storedistKey) throws Exception;
/**
* Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a
* member.
*
* @param key the key
* @param member the member
* @param radius the radius
* @param unit the unit
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEORADIUSBYMEMBER)
public abstract String georadiusbymember(@RedisProtocolSupport.Key Buffer key, Buffer member, double radius,
@RedisProtocolSupport.Option RedisProtocolSupport.GeoradiusbymemberUnit unit) throws Exception;
/**
* Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a
* member.
*
* @param key the key
* @param member the member
* @param radius the radius
* @param unit the unit
* @param withcoord the withcoord
* @param withdist the withdist
* @param withhash the withhash
* @param count the count
* @param order the order
* @param storeKey the storeKey
* @param storedistKey the storedistKey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GEORADIUSBYMEMBER)
public abstract String georadiusbymember(@RedisProtocolSupport.Key Buffer key, Buffer member, double radius,
@RedisProtocolSupport.Option RedisProtocolSupport.GeoradiusbymemberUnit unit,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusbymemberWithcoord withcoord,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusbymemberWithdist withdist,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusbymemberWithhash withhash,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.GeoradiusbymemberOrder order,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.STORE) @Nullable @RedisProtocolSupport.Key Buffer storeKey,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.STOREDIST) @Nullable @RedisProtocolSupport.Key Buffer storedistKey) throws Exception;
/**
* Get the value of a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GET)
public abstract String get(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Returns the bit value at offset in the string value stored at key.
*
* @param key the key
* @param offset the offset
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GETBIT)
public abstract String getbit(@RedisProtocolSupport.Key Buffer key, long offset) throws Exception;
/**
* Get a substring of the string stored at a key.
*
* @param key the key
* @param start the start
* @param end the end
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GETRANGE)
public abstract String getrange(@RedisProtocolSupport.Key Buffer key, long start, long end) throws Exception;
/**
* Set the string value of a key and return its old value.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.GETSET)
public abstract String getset(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Delete one or more hash fields.
*
* @param key the key
* @param field the field
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HDEL)
public abstract String hdel(@RedisProtocolSupport.Key Buffer key, Buffer field) throws Exception;
/**
* Delete one or more hash fields.
*
* @param key the key
* @param field1 the field1
* @param field2 the field2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HDEL)
public abstract String hdel(@RedisProtocolSupport.Key Buffer key, Buffer field1, Buffer field2) throws Exception;
/**
* Delete one or more hash fields.
*
* @param key the key
* @param field1 the field1
* @param field2 the field2
* @param field3 the field3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HDEL)
public abstract String hdel(@RedisProtocolSupport.Key Buffer key, Buffer field1, Buffer field2,
Buffer field3) throws Exception;
/**
* Delete one or more hash fields.
*
* @param key the key
* @param fields the fields
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HDEL)
public abstract String hdel(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> fields) throws Exception;
/**
* Determine if a hash field exists.
*
* @param key the key
* @param field the field
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HEXISTS)
public abstract String hexists(@RedisProtocolSupport.Key Buffer key, Buffer field) throws Exception;
/**
* Get the value of a hash field.
*
* @param key the key
* @param field the field
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HGET)
public abstract String hget(@RedisProtocolSupport.Key Buffer key, Buffer field) throws Exception;
/**
* Get all the fields and values in a hash.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HGETALL)
public abstract String hgetall(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Increment the integer value of a hash field by the given number.
*
* @param key the key
* @param field the field
* @param increment the increment
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HINCRBY)
public abstract String hincrby(@RedisProtocolSupport.Key Buffer key, Buffer field, long increment) throws Exception;
/**
* Increment the float value of a hash field by the given amount.
*
* @param key the key
* @param field the field
* @param increment the increment
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HINCRBYFLOAT)
public abstract String hincrbyfloat(@RedisProtocolSupport.Key Buffer key, Buffer field,
double increment) throws Exception;
/**
* Get all the fields in a hash.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HKEYS)
public abstract String hkeys(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Get the number of fields in a hash.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HLEN)
public abstract String hlen(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Get the values of all the given hash fields.
*
* @param key the key
* @param field the field
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMGET)
public abstract String hmget(@RedisProtocolSupport.Key Buffer key, Buffer field) throws Exception;
/**
* Get the values of all the given hash fields.
*
* @param key the key
* @param field1 the field1
* @param field2 the field2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMGET)
public abstract String hmget(@RedisProtocolSupport.Key Buffer key, Buffer field1, Buffer field2) throws Exception;
/**
* Get the values of all the given hash fields.
*
* @param key the key
* @param field1 the field1
* @param field2 the field2
* @param field3 the field3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMGET)
public abstract String hmget(@RedisProtocolSupport.Key Buffer key, Buffer field1, Buffer field2,
Buffer field3) throws Exception;
/**
* Get the values of all the given hash fields.
*
* @param key the key
* @param fields the fields
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMGET)
public abstract String hmget(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> fields) throws Exception;
/**
* Set multiple hash fields to multiple values.
*
* @param key the key
* @param field the field
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMSET)
public abstract String hmset(@RedisProtocolSupport.Key Buffer key, Buffer field, Buffer value) throws Exception;
/**
* Set multiple hash fields to multiple values.
*
* @param key the key
* @param field1 the field1
* @param value1 the value1
* @param field2 the field2
* @param value2 the value2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMSET)
public abstract String hmset(@RedisProtocolSupport.Key Buffer key, Buffer field1, Buffer value1, Buffer field2,
Buffer value2) throws Exception;
/**
* Set multiple hash fields to multiple values.
*
* @param key the key
* @param field1 the field1
* @param value1 the value1
* @param field2 the field2
* @param value2 the value2
* @param field3 the field3
* @param value3 the value3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMSET)
public abstract String hmset(@RedisProtocolSupport.Key Buffer key, Buffer field1, Buffer value1, Buffer field2,
Buffer value2, Buffer field3, Buffer value3) throws Exception;
/**
* Set multiple hash fields to multiple values.
*
* @param key the key
* @param fieldValues the fieldValues
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HMSET)
public abstract String hmset(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferFieldValue> fieldValues) throws Exception;
/**
* Incrementally iterate hash fields and associated values.
*
* @param key the key
* @param cursor the cursor
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HSCAN)
public abstract String hscan(@RedisProtocolSupport.Key Buffer key, long cursor) throws Exception;
/**
* Incrementally iterate hash fields and associated values.
*
* @param key the key
* @param cursor the cursor
* @param matchPattern the matchPattern
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HSCAN)
public abstract String hscan(@RedisProtocolSupport.Key Buffer key, long cursor,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.MATCH) @Nullable Buffer matchPattern,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count) throws Exception;
/**
* Set the string value of a hash field.
*
* @param key the key
* @param field the field
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HSET)
public abstract String hset(@RedisProtocolSupport.Key Buffer key, Buffer field, Buffer value) throws Exception;
/**
* Set the value of a hash field, only if the field does not exist.
*
* @param key the key
* @param field the field
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HSETNX)
public abstract String hsetnx(@RedisProtocolSupport.Key Buffer key, Buffer field, Buffer value) throws Exception;
/**
* Get the length of the value of a hash field.
*
* @param key the key
* @param field the field
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HSTRLEN)
public abstract String hstrlen(@RedisProtocolSupport.Key Buffer key, Buffer field) throws Exception;
/**
* Get all the values in a hash.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.HVALS)
public abstract String hvals(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Increment the integer value of a key by one.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.INCR)
public abstract String incr(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Increment the integer value of a key by the given amount.
*
* @param key the key
* @param increment the increment
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.INCRBY)
public abstract String incrby(@RedisProtocolSupport.Key Buffer key, long increment) throws Exception;
/**
* Increment the float value of a key by the given amount.
*
* @param key the key
* @param increment the increment
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.INCRBYFLOAT)
public abstract String incrbyfloat(@RedisProtocolSupport.Key Buffer key, double increment) throws Exception;
/**
* Get information and statistics about the server.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.INFO)
public abstract String info() throws Exception;
/**
* Get information and statistics about the server.
*
* @param section the section
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.INFO)
public abstract String info(@Nullable Buffer section) throws Exception;
/**
* Find all keys matching the given pattern.
*
* @param pattern the pattern
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.KEYS)
public abstract String keys(Buffer pattern) throws Exception;
/**
* Get the UNIX time stamp of the last successful save to disk.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LASTSAVE)
public abstract String lastsave() throws Exception;
/**
* Get an element from a list by its index.
*
* @param key the key
* @param index the index
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LINDEX)
public abstract String lindex(@RedisProtocolSupport.Key Buffer key, long index) throws Exception;
/**
* Insert an element before or after another element in a list.
*
* @param key the key
* @param where the where
* @param pivot the pivot
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LINSERT)
public abstract String linsert(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option RedisProtocolSupport.LinsertWhere where, Buffer pivot,
Buffer value) throws Exception;
/**
* Get the length of a list.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LLEN)
public abstract String llen(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Remove and get the first element in a list.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LPOP)
public abstract String lpop(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Prepend one or multiple values to a list.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LPUSH)
public abstract String lpush(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Prepend one or multiple values to a list.
*
* @param key the key
* @param value1 the value1
* @param value2 the value2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LPUSH)
public abstract String lpush(@RedisProtocolSupport.Key Buffer key, Buffer value1, Buffer value2) throws Exception;
/**
* Prepend one or multiple values to a list.
*
* @param key the key
* @param value1 the value1
* @param value2 the value2
* @param value3 the value3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LPUSH)
public abstract String lpush(@RedisProtocolSupport.Key Buffer key, Buffer value1, Buffer value2,
Buffer value3) throws Exception;
/**
* Prepend one or multiple values to a list.
*
* @param key the key
* @param values the values
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LPUSH)
public abstract String lpush(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> values) throws Exception;
/**
* Prepend a value to a list, only if the list exists.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LPUSHX)
public abstract String lpushx(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Get a range of elements from a list.
*
* @param key the key
* @param start the start
* @param stop the stop
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LRANGE)
public abstract String lrange(@RedisProtocolSupport.Key Buffer key, long start, long stop) throws Exception;
/**
* Remove elements from a list.
*
* @param key the key
* @param count the count
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LREM)
public abstract String lrem(@RedisProtocolSupport.Key Buffer key, long count, Buffer value) throws Exception;
/**
* Set the value of an element in a list by its index.
*
* @param key the key
* @param index the index
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LSET)
public abstract String lset(@RedisProtocolSupport.Key Buffer key, long index, Buffer value) throws Exception;
/**
* Trim a list to the specified range.
*
* @param key the key
* @param start the start
* @param stop the stop
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.LTRIM)
public abstract String ltrim(@RedisProtocolSupport.Key Buffer key, long start, long stop) throws Exception;
/**
* Outputs memory problems report.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MEMORY)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.DOCTOR)
public abstract String memoryDoctor() throws Exception;
/**
* Show helpful text about the different subcommands.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MEMORY)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.HELP)
public abstract String memoryHelp() throws Exception;
/**
* Show allocator internal stats.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MEMORY)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.MALLOC_STATS)
public abstract String memoryMallocStats() throws Exception;
/**
* Ask the allocator to release memory.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MEMORY)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.PURGE)
public abstract String memoryPurge() throws Exception;
/**
* Show memory usage details.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MEMORY)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.STATS)
public abstract String memoryStats() throws Exception;
/**
* Estimate the memory usage of a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MEMORY)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.USAGE)
public abstract String memoryUsage(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Estimate the memory usage of a key.
*
* @param key the key
* @param samplesCount the samplesCount
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MEMORY)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.USAGE)
public abstract String memoryUsage(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.SAMPLES) @Nullable Long samplesCount) throws Exception;
/**
* Get the values of all the given keys.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MGET)
public abstract String mget(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Get the values of all the given keys.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MGET)
public abstract String mget(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Get the values of all the given keys.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MGET)
public abstract String mget(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Get the values of all the given keys.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MGET)
public abstract String mget(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Move a key to another database.
*
* @param key the key
* @param db the db
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MOVE)
public abstract String move(@RedisProtocolSupport.Key Buffer key, long db) throws Exception;
/**
* Set multiple keys to multiple values.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSET)
public abstract String mset(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Set multiple keys to multiple values.
*
* @param key1 the key1
* @param value1 the value1
* @param key2 the key2
* @param value2 the value2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSET)
public abstract String mset(@RedisProtocolSupport.Key Buffer key1, Buffer value1,
@RedisProtocolSupport.Key Buffer key2, Buffer value2) throws Exception;
/**
* Set multiple keys to multiple values.
*
* @param key1 the key1
* @param value1 the value1
* @param key2 the key2
* @param value2 the value2
* @param key3 the key3
* @param value3 the value3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSET)
public abstract String mset(@RedisProtocolSupport.Key Buffer key1, Buffer value1,
@RedisProtocolSupport.Key Buffer key2, Buffer value2,
@RedisProtocolSupport.Key Buffer key3, Buffer value3) throws Exception;
/**
* Set multiple keys to multiple values.
*
* @param keyValues the keyValues
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSET)
public abstract String mset(@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferKeyValue> keyValues) throws Exception;
/**
* Set multiple keys to multiple values, only if none of the keys exist.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSETNX)
public abstract String msetnx(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Set multiple keys to multiple values, only if none of the keys exist.
*
* @param key1 the key1
* @param value1 the value1
* @param key2 the key2
* @param value2 the value2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSETNX)
public abstract String msetnx(@RedisProtocolSupport.Key Buffer key1, Buffer value1,
@RedisProtocolSupport.Key Buffer key2, Buffer value2) throws Exception;
/**
* Set multiple keys to multiple values, only if none of the keys exist.
*
* @param key1 the key1
* @param value1 the value1
* @param key2 the key2
* @param value2 the value2
* @param key3 the key3
* @param value3 the value3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSETNX)
public abstract String msetnx(@RedisProtocolSupport.Key Buffer key1, Buffer value1,
@RedisProtocolSupport.Key Buffer key2, Buffer value2,
@RedisProtocolSupport.Key Buffer key3, Buffer value3) throws Exception;
/**
* Set multiple keys to multiple values, only if none of the keys exist.
*
* @param keyValues the keyValues
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.MSETNX)
public abstract String msetnx(@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferKeyValue> keyValues) throws Exception;
/**
* Returns the kind of internal representation used in order to store the value associated with a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.OBJECT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.ENCODING)
public abstract String objectEncoding(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Returns the logarithmic access frequency counter of the object stored at the specified key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.OBJECT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.FREQ)
public abstract String objectFreq(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Returns a succinct help text.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.OBJECT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.HELP)
public abstract String objectHelp() throws Exception;
/**
* Returns the number of seconds since the object stored at the specified key is idle.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.OBJECT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.IDLETIME)
public abstract String objectIdletime(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Returns the number of references of the value associated with the specified key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.OBJECT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.REFCOUNT)
public abstract String objectRefcount(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Remove the expiration from a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PERSIST)
public abstract String persist(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Set a key's time to live in milliseconds.
*
* @param key the key
* @param milliseconds the milliseconds
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PEXPIRE)
public abstract String pexpire(@RedisProtocolSupport.Key Buffer key, long milliseconds) throws Exception;
/**
* Set the expiration for a key as a UNIX timestamp specified in milliseconds.
*
* @param key the key
* @param millisecondsTimestamp the millisecondsTimestamp
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PEXPIREAT)
public abstract String pexpireat(@RedisProtocolSupport.Key Buffer key, long millisecondsTimestamp) throws Exception;
/**
* Adds the specified elements to the specified HyperLogLog.
*
* @param key the key
* @param element the element
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFADD)
public abstract String pfadd(@RedisProtocolSupport.Key Buffer key, Buffer element) throws Exception;
/**
* Adds the specified elements to the specified HyperLogLog.
*
* @param key the key
* @param element1 the element1
* @param element2 the element2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFADD)
public abstract String pfadd(@RedisProtocolSupport.Key Buffer key, Buffer element1,
Buffer element2) throws Exception;
/**
* Adds the specified elements to the specified HyperLogLog.
*
* @param key the key
* @param element1 the element1
* @param element2 the element2
* @param element3 the element3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFADD)
public abstract String pfadd(@RedisProtocolSupport.Key Buffer key, Buffer element1, Buffer element2,
Buffer element3) throws Exception;
/**
* Adds the specified elements to the specified HyperLogLog.
*
* @param key the key
* @param elements the elements
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFADD)
public abstract String pfadd(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> elements) throws Exception;
/**
* Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFCOUNT)
public abstract String pfcount(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFCOUNT)
public abstract String pfcount(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFCOUNT)
public abstract String pfcount(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFCOUNT)
public abstract String pfcount(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Merge N different HyperLogLogs into a single one.
*
* @param destkey the destkey
* @param sourcekey the sourcekey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFMERGE)
public abstract String pfmerge(@RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Buffer sourcekey) throws Exception;
/**
* Merge N different HyperLogLogs into a single one.
*
* @param destkey the destkey
* @param sourcekey1 the sourcekey1
* @param sourcekey2 the sourcekey2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFMERGE)
public abstract String pfmerge(@RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Buffer sourcekey1,
@RedisProtocolSupport.Key Buffer sourcekey2) throws Exception;
/**
* Merge N different HyperLogLogs into a single one.
*
* @param destkey the destkey
* @param sourcekey1 the sourcekey1
* @param sourcekey2 the sourcekey2
* @param sourcekey3 the sourcekey3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFMERGE)
public abstract String pfmerge(@RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Buffer sourcekey1,
@RedisProtocolSupport.Key Buffer sourcekey2,
@RedisProtocolSupport.Key Buffer sourcekey3) throws Exception;
/**
* Merge N different HyperLogLogs into a single one.
*
* @param destkey the destkey
* @param sourcekeys the sourcekeys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PFMERGE)
public abstract String pfmerge(@RedisProtocolSupport.Key Buffer destkey,
@RedisProtocolSupport.Key Collection<Buffer> sourcekeys) throws Exception;
/**
* Ping the server.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PING)
public abstract String ping() throws Exception;
/**
* Ping the server.
*
* @param message the message
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PING)
public abstract String ping(Buffer message) throws Exception;
/**
* Set the value and expiration in milliseconds of a key.
*
* @param key the key
* @param milliseconds the milliseconds
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PSETEX)
public abstract String psetex(@RedisProtocolSupport.Key Buffer key, long milliseconds,
Buffer value) throws Exception;
/**
* Get the time to live for a key in milliseconds.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PTTL)
public abstract String pttl(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Post a message to a channel.
*
* @param channel the channel
* @param message the message
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBLISH)
public abstract String publish(Buffer channel, Buffer message) throws Exception;
/**
* Lists the currently active channels.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.CHANNELS)
public abstract String pubsubChannels() throws Exception;
/**
* Lists the currently active channels.
*
* @param pattern the pattern
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.CHANNELS)
public abstract String pubsubChannels(@Nullable Buffer pattern) throws Exception;
/**
* Lists the currently active channels.
*
* @param pattern1 the pattern1
* @param pattern2 the pattern2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.CHANNELS)
public abstract String pubsubChannels(@Nullable Buffer pattern1, @Nullable Buffer pattern2) throws Exception;
/**
* Lists the currently active channels.
*
* @param pattern1 the pattern1
* @param pattern2 the pattern2
* @param pattern3 the pattern3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.CHANNELS)
public abstract String pubsubChannels(@Nullable Buffer pattern1, @Nullable Buffer pattern2,
@Nullable Buffer pattern3) throws Exception;
/**
* Lists the currently active channels.
*
* @param patterns the patterns
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.CHANNELS)
public abstract String pubsubChannels(Collection<Buffer> patterns) throws Exception;
/**
* Returns the number of subscribers for the specified channels.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.NUMSUB)
public abstract String pubsubNumsub() throws Exception;
/**
* Returns the number of subscribers for the specified channels.
*
* @param channel the channel
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.NUMSUB)
public abstract String pubsubNumsub(@Nullable Buffer channel) throws Exception;
/**
* Returns the number of subscribers for the specified channels.
*
* @param channel1 the channel1
* @param channel2 the channel2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.NUMSUB)
public abstract String pubsubNumsub(@Nullable Buffer channel1, @Nullable Buffer channel2) throws Exception;
/**
* Returns the number of subscribers for the specified channels.
*
* @param channel1 the channel1
* @param channel2 the channel2
* @param channel3 the channel3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.NUMSUB)
public abstract String pubsubNumsub(@Nullable Buffer channel1, @Nullable Buffer channel2,
@Nullable Buffer channel3) throws Exception;
/**
* Returns the number of subscribers for the specified channels.
*
* @param channels the channels
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.NUMSUB)
public abstract String pubsubNumsub(Collection<Buffer> channels) throws Exception;
/**
* Returns the number of subscriptions to patterns.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.PUBSUB)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.NUMPAT)
public abstract String pubsubNumpat() throws Exception;
/**
* Return a random key from the keyspace.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RANDOMKEY)
public abstract String randomkey() throws Exception;
/**
* Enables read queries for a connection to a cluster slave node.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.READONLY)
public abstract String readonly() throws Exception;
/**
* Disables read queries for a connection to a cluster slave node.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.READWRITE)
public abstract String readwrite() throws Exception;
/**
* Rename a key.
*
* @param key the key
* @param newkey the newkey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RENAME)
public abstract String rename(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Key Buffer newkey) throws Exception;
/**
* Rename a key, only if the new key does not exist.
*
* @param key the key
* @param newkey the newkey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RENAMENX)
public abstract String renamenx(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Key Buffer newkey) throws Exception;
/**
* Create a key using the provided serialized value, previously obtained using DUMP.
*
* @param key the key
* @param ttl the ttl
* @param serializedValue the serializedValue
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RESTORE)
public abstract String restore(@RedisProtocolSupport.Key Buffer key, long ttl,
Buffer serializedValue) throws Exception;
/**
* Create a key using the provided serialized value, previously obtained using DUMP.
*
* @param key the key
* @param ttl the ttl
* @param serializedValue the serializedValue
* @param replace the replace
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RESTORE)
public abstract String restore(@RedisProtocolSupport.Key Buffer key, long ttl, Buffer serializedValue,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.RestoreReplace replace) throws Exception;
/**
* Return the role of the instance in the context of replication.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ROLE)
public abstract String role() throws Exception;
/**
* Remove and get the last element in a list.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RPOP)
public abstract String rpop(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Remove the last element in a list, prepend it to another list and return it.
*
* @param source the source
* @param destination the destination
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RPOPLPUSH)
public abstract String rpoplpush(@RedisProtocolSupport.Key Buffer source,
@RedisProtocolSupport.Key Buffer destination) throws Exception;
/**
* Append one or multiple values to a list.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RPUSH)
public abstract String rpush(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Append one or multiple values to a list.
*
* @param key the key
* @param value1 the value1
* @param value2 the value2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RPUSH)
public abstract String rpush(@RedisProtocolSupport.Key Buffer key, Buffer value1, Buffer value2) throws Exception;
/**
* Append one or multiple values to a list.
*
* @param key the key
* @param value1 the value1
* @param value2 the value2
* @param value3 the value3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RPUSH)
public abstract String rpush(@RedisProtocolSupport.Key Buffer key, Buffer value1, Buffer value2,
Buffer value3) throws Exception;
/**
* Append one or multiple values to a list.
*
* @param key the key
* @param values the values
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RPUSH)
public abstract String rpush(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> values) throws Exception;
/**
* Append a value to a list, only if the list exists.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.RPUSHX)
public abstract String rpushx(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Add one or more members to a set.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SADD)
public abstract String sadd(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Add one or more members to a set.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SADD)
public abstract String sadd(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2) throws Exception;
/**
* Add one or more members to a set.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SADD)
public abstract String sadd(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2,
Buffer member3) throws Exception;
/**
* Add one or more members to a set.
*
* @param key the key
* @param members the members
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SADD)
public abstract String sadd(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> members) throws Exception;
/**
* Synchronously save the dataset to disk.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SAVE)
public abstract String save() throws Exception;
/**
* Incrementally iterate the keys space.
*
* @param cursor the cursor
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCAN)
public abstract String scan(long cursor) throws Exception;
/**
* Incrementally iterate the keys space.
*
* @param cursor the cursor
* @param matchPattern the matchPattern
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCAN)
public abstract String scan(long cursor,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.MATCH) @Nullable Buffer matchPattern,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count) throws Exception;
/**
* Get the number of members in a set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCARD)
public abstract String scard(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Set the debug mode for executed scripts.
*
* @param mode the mode
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.DEBUG)
public abstract String scriptDebug(@RedisProtocolSupport.Option RedisProtocolSupport.ScriptDebugMode mode) throws Exception;
/**
* Check existence of scripts in the script cache.
*
* @param sha1 the sha1
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.EXISTS)
public abstract String scriptExists(Buffer sha1) throws Exception;
/**
* Check existence of scripts in the script cache.
*
* @param sha11 the sha11
* @param sha12 the sha12
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.EXISTS)
public abstract String scriptExists(Buffer sha11, Buffer sha12) throws Exception;
/**
* Check existence of scripts in the script cache.
*
* @param sha11 the sha11
* @param sha12 the sha12
* @param sha13 the sha13
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.EXISTS)
public abstract String scriptExists(Buffer sha11, Buffer sha12, Buffer sha13) throws Exception;
/**
* Check existence of scripts in the script cache.
*
* @param sha1s the sha1s
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.EXISTS)
public abstract String scriptExists(Collection<Buffer> sha1s) throws Exception;
/**
* Remove all the scripts from the script cache.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.FLUSH)
public abstract String scriptFlush() throws Exception;
/**
* Kill the script currently in execution.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.KILL)
public abstract String scriptKill() throws Exception;
/**
* Load the specified Lua script into the script cache.
*
* @param script the script
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SCRIPT)
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LOAD)
public abstract String scriptLoad(Buffer script) throws Exception;
/**
* Subtract multiple sets.
*
* @param firstkey the firstkey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFF)
public abstract String sdiff(@RedisProtocolSupport.Key Buffer firstkey) throws Exception;
/**
* Subtract multiple sets.
*
* @param firstkey the firstkey
* @param otherkey the otherkey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFF)
public abstract String sdiff(@RedisProtocolSupport.Key Buffer firstkey,
@Nullable @RedisProtocolSupport.Key Buffer otherkey) throws Exception;
/**
* Subtract multiple sets.
*
* @param firstkey the firstkey
* @param otherkey1 the otherkey1
* @param otherkey2 the otherkey2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFF)
public abstract String sdiff(@RedisProtocolSupport.Key Buffer firstkey,
@Nullable @RedisProtocolSupport.Key Buffer otherkey1,
@Nullable @RedisProtocolSupport.Key Buffer otherkey2) throws Exception;
/**
* Subtract multiple sets.
*
* @param firstkey the firstkey
* @param otherkey1 the otherkey1
* @param otherkey2 the otherkey2
* @param otherkey3 the otherkey3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFF)
public abstract String sdiff(@RedisProtocolSupport.Key Buffer firstkey,
@Nullable @RedisProtocolSupport.Key Buffer otherkey1,
@Nullable @RedisProtocolSupport.Key Buffer otherkey2,
@Nullable @RedisProtocolSupport.Key Buffer otherkey3) throws Exception;
/**
* Subtract multiple sets.
*
* @param firstkey the firstkey
* @param otherkeys the otherkeys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFF)
public abstract String sdiff(@RedisProtocolSupport.Key Buffer firstkey,
@RedisProtocolSupport.Key Collection<Buffer> otherkeys) throws Exception;
/**
* Subtract multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param firstkey the firstkey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFFSTORE)
public abstract String sdiffstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer firstkey) throws Exception;
/**
* Subtract multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param firstkey the firstkey
* @param otherkey the otherkey
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFFSTORE)
public abstract String sdiffstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer firstkey,
@Nullable @RedisProtocolSupport.Key Buffer otherkey) throws Exception;
/**
* Subtract multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param firstkey the firstkey
* @param otherkey1 the otherkey1
* @param otherkey2 the otherkey2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFFSTORE)
public abstract String sdiffstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer firstkey,
@Nullable @RedisProtocolSupport.Key Buffer otherkey1,
@Nullable @RedisProtocolSupport.Key Buffer otherkey2) throws Exception;
/**
* Subtract multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param firstkey the firstkey
* @param otherkey1 the otherkey1
* @param otherkey2 the otherkey2
* @param otherkey3 the otherkey3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFFSTORE)
public abstract String sdiffstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer firstkey,
@Nullable @RedisProtocolSupport.Key Buffer otherkey1,
@Nullable @RedisProtocolSupport.Key Buffer otherkey2,
@Nullable @RedisProtocolSupport.Key Buffer otherkey3) throws Exception;
/**
* Subtract multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param firstkey the firstkey
* @param otherkeys the otherkeys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SDIFFSTORE)
public abstract String sdiffstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer firstkey,
@RedisProtocolSupport.Key Collection<Buffer> otherkeys) throws Exception;
/**
* Change the selected database for the current connection.
*
* @param index the index
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SELECT)
public abstract String select(long index) throws Exception;
/**
* Set the string value of a key.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SET)
public abstract String set(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Set the string value of a key.
*
* @param key the key
* @param value the value
* @param expireDuration the expireDuration
* @param condition the condition
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SET)
public abstract String set(@RedisProtocolSupport.Key Buffer key, Buffer value,
@RedisProtocolSupport.Tuple @Nullable RedisProtocolSupport.ExpireDuration expireDuration,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.SetCondition condition) throws Exception;
/**
* Sets or clears the bit at offset in the string value stored at key.
*
* @param key the key
* @param offset the offset
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SETBIT)
public abstract String setbit(@RedisProtocolSupport.Key Buffer key, long offset, Buffer value) throws Exception;
/**
* Set the value and expiration of a key.
*
* @param key the key
* @param seconds the seconds
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SETEX)
public abstract String setex(@RedisProtocolSupport.Key Buffer key, long seconds, Buffer value) throws Exception;
/**
* Set the value of a key, only if the key does not exist.
*
* @param key the key
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SETNX)
public abstract String setnx(@RedisProtocolSupport.Key Buffer key, Buffer value) throws Exception;
/**
* Overwrite part of a string at key starting at the specified offset.
*
* @param key the key
* @param offset the offset
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SETRANGE)
public abstract String setrange(@RedisProtocolSupport.Key Buffer key, long offset, Buffer value) throws Exception;
/**
* Synchronously save the dataset to disk and then shut down the server.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SHUTDOWN)
public abstract String shutdown() throws Exception;
/**
* Synchronously save the dataset to disk and then shut down the server.
*
* @param saveMode the saveMode
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SHUTDOWN)
public abstract String shutdown(@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ShutdownSaveMode saveMode) throws Exception;
/**
* Intersect multiple sets.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTER)
public abstract String sinter(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Intersect multiple sets.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTER)
public abstract String sinter(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Intersect multiple sets.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTER)
public abstract String sinter(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Intersect multiple sets.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTER)
public abstract String sinter(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Intersect multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTERSTORE)
public abstract String sinterstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Intersect multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTERSTORE)
public abstract String sinterstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Intersect multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTERSTORE)
public abstract String sinterstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Intersect multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SINTERSTORE)
public abstract String sinterstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Determine if a given value is a member of a set.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SISMEMBER)
public abstract String sismember(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Make the server a slave of another instance, or promote it as master.
*
* @param host the host
* @param port the port
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SLAVEOF)
public abstract String slaveof(Buffer host, Buffer port) throws Exception;
/**
* Manages the Redis slow queries log.
*
* @param subcommand the subcommand
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SLOWLOG)
public abstract String slowlog(Buffer subcommand) throws Exception;
/**
* Manages the Redis slow queries log.
*
* @param subcommand the subcommand
* @param argument the argument
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SLOWLOG)
public abstract String slowlog(Buffer subcommand, @Nullable Buffer argument) throws Exception;
/**
* Get all the members in a set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SMEMBERS)
public abstract String smembers(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Move a member from one set to another.
*
* @param source the source
* @param destination the destination
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SMOVE)
public abstract String smove(@RedisProtocolSupport.Key Buffer source, @RedisProtocolSupport.Key Buffer destination,
Buffer member) throws Exception;
/**
* Sort the elements in a list, set or sorted set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SORT)
public abstract String sort(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Sort the elements in a list, set or sorted set.
*
* @param key the key
* @param byPattern the byPattern
* @param offsetCount the offsetCount
* @param getPatterns the getPatterns
* @param order the order
* @param sorting the sorting
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SORT)
public abstract String sort(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.BY) @Nullable Buffer byPattern,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LIMIT) @Nullable @RedisProtocolSupport.Tuple RedisProtocolSupport.OffsetCount offsetCount,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GET) Collection<Buffer> getPatterns,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.SortOrder order,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.SortSorting sorting) throws Exception;
/**
* Sort the elements in a list, set or sorted set.
*
* @param key the key
* @param storeDestination the storeDestination
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SORT)
public abstract String sort(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.STORE) @RedisProtocolSupport.Key Buffer storeDestination) throws Exception;
/**
* Sort the elements in a list, set or sorted set.
*
* @param key the key
* @param storeDestination the storeDestination
* @param byPattern the byPattern
* @param offsetCount the offsetCount
* @param getPatterns the getPatterns
* @param order the order
* @param sorting the sorting
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SORT)
public abstract String sort(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.STORE) @RedisProtocolSupport.Key Buffer storeDestination,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.BY) @Nullable Buffer byPattern,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LIMIT) @Nullable @RedisProtocolSupport.Tuple RedisProtocolSupport.OffsetCount offsetCount,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GET) Collection<Buffer> getPatterns,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.SortOrder order,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.SortSorting sorting) throws Exception;
/**
* Remove and return one or multiple random members from a set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SPOP)
public abstract String spop(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Remove and return one or multiple random members from a set.
*
* @param key the key
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SPOP)
public abstract String spop(@RedisProtocolSupport.Key Buffer key, @Nullable Long count) throws Exception;
/**
* Get one or multiple random members from a set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SRANDMEMBER)
public abstract String srandmember(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Get one or multiple random members from a set.
*
* @param key the key
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SRANDMEMBER)
public abstract String srandmember(@RedisProtocolSupport.Key Buffer key, long count) throws Exception;
/**
* Remove one or more members from a set.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SREM)
public abstract String srem(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Remove one or more members from a set.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SREM)
public abstract String srem(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2) throws Exception;
/**
* Remove one or more members from a set.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SREM)
public abstract String srem(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2,
Buffer member3) throws Exception;
/**
* Remove one or more members from a set.
*
* @param key the key
* @param members the members
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SREM)
public abstract String srem(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> members) throws Exception;
/**
* Incrementally iterate Set elements.
*
* @param key the key
* @param cursor the cursor
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SSCAN)
public abstract String sscan(@RedisProtocolSupport.Key Buffer key, long cursor) throws Exception;
/**
* Incrementally iterate Set elements.
*
* @param key the key
* @param cursor the cursor
* @param matchPattern the matchPattern
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SSCAN)
public abstract String sscan(@RedisProtocolSupport.Key Buffer key, long cursor,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.MATCH) @Nullable Buffer matchPattern,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count) throws Exception;
/**
* Get the length of the value stored in a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.STRLEN)
public abstract String strlen(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Add multiple sets.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNION)
public abstract String sunion(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Add multiple sets.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNION)
public abstract String sunion(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Add multiple sets.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNION)
public abstract String sunion(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Add multiple sets.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNION)
public abstract String sunion(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Add multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNIONSTORE)
public abstract String sunionstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Add multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNIONSTORE)
public abstract String sunionstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Add multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNIONSTORE)
public abstract String sunionstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Add multiple sets and store the resulting set in a key.
*
* @param destination the destination
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SUNIONSTORE)
public abstract String sunionstore(@RedisProtocolSupport.Key Buffer destination,
@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Swaps two Redis databases.
*
* @param index the index
* @param index1 the index1
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.SWAPDB)
public abstract String swapdb(long index, long index1) throws Exception;
/**
* Return the current server time.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.TIME)
public abstract String time() throws Exception;
/**
* Alters the last access time of a key(s). Returns the number of existing keys specified.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.TOUCH)
public abstract String touch(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Alters the last access time of a key(s). Returns the number of existing keys specified.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.TOUCH)
public abstract String touch(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Alters the last access time of a key(s). Returns the number of existing keys specified.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.TOUCH)
public abstract String touch(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Alters the last access time of a key(s). Returns the number of existing keys specified.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.TOUCH)
public abstract String touch(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Get the time to live for a key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.TTL)
public abstract String ttl(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Determine the type stored at key.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.TYPE)
public abstract String type(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.UNLINK)
public abstract String unlink(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.UNLINK)
public abstract String unlink(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.UNLINK)
public abstract String unlink(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.UNLINK)
public abstract String unlink(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Forget about all watched keys.
*
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.UNWATCH)
public abstract String unwatch() throws Exception;
/**
* Wait for the synchronous replication of all the write commands sent in the context of the current connection.
*
* @param numslaves the numslaves
* @param timeout the timeout
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.WAIT)
public abstract String wait(long numslaves, long timeout) throws Exception;
/**
* Watch the given keys to determine execution of the MULTI/EXEC block.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.WATCH)
public abstract String watch(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Watch the given keys to determine execution of the MULTI/EXEC block.
*
* @param key1 the key1
* @param key2 the key2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.WATCH)
public abstract String watch(@RedisProtocolSupport.Key Buffer key1,
@RedisProtocolSupport.Key Buffer key2) throws Exception;
/**
* Watch the given keys to determine execution of the MULTI/EXEC block.
*
* @param key1 the key1
* @param key2 the key2
* @param key3 the key3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.WATCH)
public abstract String watch(@RedisProtocolSupport.Key Buffer key1, @RedisProtocolSupport.Key Buffer key2,
@RedisProtocolSupport.Key Buffer key3) throws Exception;
/**
* Watch the given keys to determine execution of the MULTI/EXEC block.
*
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.WATCH)
public abstract String watch(@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Appends a new entry to a stream.
*
* @param key the key
* @param id the id
* @param field the field
* @param value the value
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XADD)
public abstract String xadd(@RedisProtocolSupport.Key Buffer key, Buffer id, Buffer field,
Buffer value) throws Exception;
/**
* Appends a new entry to a stream.
*
* @param key the key
* @param id the id
* @param field1 the field1
* @param value1 the value1
* @param field2 the field2
* @param value2 the value2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XADD)
public abstract String xadd(@RedisProtocolSupport.Key Buffer key, Buffer id, Buffer field1, Buffer value1,
Buffer field2, Buffer value2) throws Exception;
/**
* Appends a new entry to a stream.
*
* @param key the key
* @param id the id
* @param field1 the field1
* @param value1 the value1
* @param field2 the field2
* @param value2 the value2
* @param field3 the field3
* @param value3 the value3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XADD)
public abstract String xadd(@RedisProtocolSupport.Key Buffer key, Buffer id, Buffer field1, Buffer value1,
Buffer field2, Buffer value2, Buffer field3, Buffer value3) throws Exception;
/**
* Appends a new entry to a stream.
*
* @param key the key
* @param id the id
* @param fieldValues the fieldValues
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XADD)
public abstract String xadd(@RedisProtocolSupport.Key Buffer key, Buffer id,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferFieldValue> fieldValues) throws Exception;
/**
* Return the number of entires in a stream.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XLEN)
public abstract String xlen(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Return information and entries from a stream conusmer group pending entries list, that are messages fetched but
* never acknowledged.
*
* @param key the key
* @param group the group
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XPENDING)
public abstract String xpending(@RedisProtocolSupport.Key Buffer key, Buffer group) throws Exception;
/**
* Return information and entries from a stream conusmer group pending entries list, that are messages fetched but
* never acknowledged.
*
* @param key the key
* @param group the group
* @param start the start
* @param end the end
* @param count the count
* @param consumer the consumer
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XPENDING)
public abstract String xpending(@RedisProtocolSupport.Key Buffer key, Buffer group, @Nullable Buffer start,
@Nullable Buffer end, @Nullable Long count,
@Nullable Buffer consumer) throws Exception;
/**
* Return a range of elements in a stream, with IDs matching the specified IDs interval.
*
* @param key the key
* @param start the start
* @param end the end
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XRANGE)
public abstract String xrange(@RedisProtocolSupport.Key Buffer key, Buffer start, Buffer end) throws Exception;
/**
* Return a range of elements in a stream, with IDs matching the specified IDs interval.
*
* @param key the key
* @param start the start
* @param end the end
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XRANGE)
public abstract String xrange(@RedisProtocolSupport.Key Buffer key, Buffer start, Buffer end,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count) throws Exception;
/**
* Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each
* stream. Can block.
*
* @param keys the keys
* @param ids the ids
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XREAD)
public abstract String xread(@RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> ids) throws Exception;
/**
* Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each
* stream. Can block.
*
* @param count the count
* @param blockMilliseconds the blockMilliseconds
* @param keys the keys
* @param ids the ids
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XREAD)
public abstract String xread(@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.BLOCK) @Nullable Long blockMilliseconds,
@RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> ids) throws Exception;
/**
* Return new entries from a stream using a consumer group, or access the history of the pending entries for a given
* consumer. Can block.
*
* @param groupConsumer the groupConsumer
* @param keys the keys
* @param ids the ids
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XREADGROUP)
public abstract String xreadgroup(@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GROUP) @RedisProtocolSupport.Tuple RedisProtocolSupport.BufferGroupConsumer groupConsumer,
@RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> ids) throws Exception;
/**
* Return new entries from a stream using a consumer group, or access the history of the pending entries for a given
* consumer. Can block.
*
* @param groupConsumer the groupConsumer
* @param count the count
* @param blockMilliseconds the blockMilliseconds
* @param keys the keys
* @param ids the ids
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XREADGROUP)
public abstract String xreadgroup(@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.GROUP) @RedisProtocolSupport.Tuple RedisProtocolSupport.BufferGroupConsumer groupConsumer,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.BLOCK) @Nullable Long blockMilliseconds,
@RedisProtocolSupport.Key Collection<Buffer> keys,
Collection<Buffer> ids) throws Exception;
/**
* Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from
* greater to smaller IDs) compared to XRANGE.
*
* @param key the key
* @param end the end
* @param start the start
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XREVRANGE)
public abstract String xrevrange(@RedisProtocolSupport.Key Buffer key, Buffer end, Buffer start) throws Exception;
/**
* Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from
* greater to smaller IDs) compared to XRANGE.
*
* @param key the key
* @param end the end
* @param start the start
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.XREVRANGE)
public abstract String xrevrange(@RedisProtocolSupport.Key Buffer key, Buffer end, Buffer start,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param scoreMembers the scoreMembers
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zadd(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferScoreMember> scoreMembers) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param score the score
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zadd(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
double score, Buffer member) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param score1 the score1
* @param member1 the member1
* @param score2 the score2
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zadd(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
double score1, Buffer member1, double score2, Buffer member2) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param score1 the score1
* @param member1 the member1
* @param score2 the score2
* @param member2 the member2
* @param score3 the score3
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zadd(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
double score1, Buffer member1, double score2, Buffer member2, double score3,
Buffer member3) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param scoreMembers the scoreMembers
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zadd(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferScoreMember> scoreMembers) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param scoreMembers the scoreMembers
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zaddIncr(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferScoreMember> scoreMembers) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param score the score
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zaddIncr(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
double score, Buffer member) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param score1 the score1
* @param member1 the member1
* @param score2 the score2
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zaddIncr(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
double score1, Buffer member1, double score2, Buffer member2) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param score1 the score1
* @param member1 the member1
* @param score2 the score2
* @param member2 the member2
* @param score3 the score3
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zaddIncr(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
double score1, Buffer member1, double score2, Buffer member2, double score3,
Buffer member3) throws Exception;
/**
* Add one or more members to a sorted set, or update its score if it already exists.
*
* @param key the key
* @param condition the condition
* @param change the change
* @param scoreMembers the scoreMembers
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZADD)
public abstract String zaddIncr(@RedisProtocolSupport.Key Buffer key,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddCondition condition,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZaddChange change,
@RedisProtocolSupport.Tuple Collection<RedisProtocolSupport.BufferScoreMember> scoreMembers) throws Exception;
/**
* Get the number of members in a sorted set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZCARD)
public abstract String zcard(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Count the members in a sorted set with scores within the given values.
*
* @param key the key
* @param min the min
* @param max the max
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZCOUNT)
public abstract String zcount(@RedisProtocolSupport.Key Buffer key, double min, double max) throws Exception;
/**
* Increment the score of a member in a sorted set.
*
* @param key the key
* @param increment the increment
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZINCRBY)
public abstract String zincrby(@RedisProtocolSupport.Key Buffer key, long increment,
Buffer member) throws Exception;
/**
* Intersect multiple sorted sets and store the resulting sorted set in a new key.
*
* @param destination the destination
* @param numkeys the numkeys
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZINTERSTORE)
public abstract String zinterstore(@RedisProtocolSupport.Key Buffer destination, long numkeys,
@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Intersect multiple sorted sets and store the resulting sorted set in a new key.
*
* @param destination the destination
* @param numkeys the numkeys
* @param keys the keys
* @param weightses the weightses
* @param aggregate the aggregate
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZINTERSTORE)
public abstract String zinterstore(@RedisProtocolSupport.Key Buffer destination, long numkeys,
@RedisProtocolSupport.Key Collection<Buffer> keys,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.WEIGHTS) Collection<Long> weightses,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZinterstoreAggregate aggregate) throws Exception;
/**
* Count the number of members in a sorted set between a given lexicographical range.
*
* @param key the key
* @param min the min
* @param max the max
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZLEXCOUNT)
public abstract String zlexcount(@RedisProtocolSupport.Key Buffer key, Buffer min, Buffer max) throws Exception;
/**
* Remove and return members with the highest scores in a sorted set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZPOPMAX)
public abstract String zpopmax(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Remove and return members with the highest scores in a sorted set.
*
* @param key the key
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZPOPMAX)
public abstract String zpopmax(@RedisProtocolSupport.Key Buffer key, @Nullable Long count) throws Exception;
/**
* Remove and return members with the lowest scores in a sorted set.
*
* @param key the key
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZPOPMIN)
public abstract String zpopmin(@RedisProtocolSupport.Key Buffer key) throws Exception;
/**
* Remove and return members with the lowest scores in a sorted set.
*
* @param key the key
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZPOPMIN)
public abstract String zpopmin(@RedisProtocolSupport.Key Buffer key, @Nullable Long count) throws Exception;
/**
* Return a range of members in a sorted set, by index.
*
* @param key the key
* @param start the start
* @param stop the stop
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZRANGE)
public abstract String zrange(@RedisProtocolSupport.Key Buffer key, long start, long stop) throws Exception;
/**
* Return a range of members in a sorted set, by index.
*
* @param key the key
* @param start the start
* @param stop the stop
* @param withscores the withscores
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZRANGE)
public abstract String zrange(@RedisProtocolSupport.Key Buffer key, long start, long stop,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZrangeWithscores withscores) throws Exception;
/**
* Return a range of members in a sorted set, by lexicographical range.
*
* @param key the key
* @param min the min
* @param max the max
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZRANGEBYLEX)
public abstract String zrangebylex(@RedisProtocolSupport.Key Buffer key, Buffer min, Buffer max) throws Exception;
/**
* Return a range of members in a sorted set, by lexicographical range.
*
* @param key the key
* @param min the min
* @param max the max
* @param offsetCount the offsetCount
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZRANGEBYLEX)
public abstract String zrangebylex(@RedisProtocolSupport.Key Buffer key, Buffer min, Buffer max,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LIMIT) @Nullable @RedisProtocolSupport.Tuple RedisProtocolSupport.OffsetCount offsetCount) throws Exception;
/**
* Return a range of members in a sorted set, by score.
*
* @param key the key
* @param min the min
* @param max the max
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZRANGEBYSCORE)
public abstract String zrangebyscore(@RedisProtocolSupport.Key Buffer key, double min, double max) throws Exception;
/**
* Return a range of members in a sorted set, by score.
*
* @param key the key
* @param min the min
* @param max the max
* @param withscores the withscores
* @param offsetCount the offsetCount
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZRANGEBYSCORE)
public abstract String zrangebyscore(@RedisProtocolSupport.Key Buffer key, double min, double max,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZrangebyscoreWithscores withscores,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LIMIT) @Nullable @RedisProtocolSupport.Tuple RedisProtocolSupport.OffsetCount offsetCount) throws Exception;
/**
* Determine the index of a member in a sorted set.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZRANK)
public abstract String zrank(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Remove one or more members from a sorted set.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREM)
public abstract String zrem(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Remove one or more members from a sorted set.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREM)
public abstract String zrem(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2) throws Exception;
/**
* Remove one or more members from a sorted set.
*
* @param key the key
* @param member1 the member1
* @param member2 the member2
* @param member3 the member3
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREM)
public abstract String zrem(@RedisProtocolSupport.Key Buffer key, Buffer member1, Buffer member2,
Buffer member3) throws Exception;
/**
* Remove one or more members from a sorted set.
*
* @param key the key
* @param members the members
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREM)
public abstract String zrem(@RedisProtocolSupport.Key Buffer key, Collection<Buffer> members) throws Exception;
/**
* Remove all members in a sorted set between the given lexicographical range.
*
* @param key the key
* @param min the min
* @param max the max
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREMRANGEBYLEX)
public abstract String zremrangebylex(@RedisProtocolSupport.Key Buffer key, Buffer min,
Buffer max) throws Exception;
/**
* Remove all members in a sorted set within the given indexes.
*
* @param key the key
* @param start the start
* @param stop the stop
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREMRANGEBYRANK)
public abstract String zremrangebyrank(@RedisProtocolSupport.Key Buffer key, long start,
long stop) throws Exception;
/**
* Remove all members in a sorted set within the given scores.
*
* @param key the key
* @param min the min
* @param max the max
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREMRANGEBYSCORE)
public abstract String zremrangebyscore(@RedisProtocolSupport.Key Buffer key, double min,
double max) throws Exception;
/**
* Return a range of members in a sorted set, by index, with scores ordered from high to low.
*
* @param key the key
* @param start the start
* @param stop the stop
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREVRANGE)
public abstract String zrevrange(@RedisProtocolSupport.Key Buffer key, long start, long stop) throws Exception;
/**
* Return a range of members in a sorted set, by index, with scores ordered from high to low.
*
* @param key the key
* @param start the start
* @param stop the stop
* @param withscores the withscores
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREVRANGE)
public abstract String zrevrange(@RedisProtocolSupport.Key Buffer key, long start, long stop,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZrevrangeWithscores withscores) throws Exception;
/**
* Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.
*
* @param key the key
* @param max the max
* @param min the min
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREVRANGEBYLEX)
public abstract String zrevrangebylex(@RedisProtocolSupport.Key Buffer key, Buffer max,
Buffer min) throws Exception;
/**
* Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.
*
* @param key the key
* @param max the max
* @param min the min
* @param offsetCount the offsetCount
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREVRANGEBYLEX)
public abstract String zrevrangebylex(@RedisProtocolSupport.Key Buffer key, Buffer max, Buffer min,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LIMIT) @Nullable @RedisProtocolSupport.Tuple RedisProtocolSupport.OffsetCount offsetCount) throws Exception;
/**
* Return a range of members in a sorted set, by score, with scores ordered from high to low.
*
* @param key the key
* @param max the max
* @param min the min
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREVRANGEBYSCORE)
public abstract String zrevrangebyscore(@RedisProtocolSupport.Key Buffer key, double max,
double min) throws Exception;
/**
* Return a range of members in a sorted set, by score, with scores ordered from high to low.
*
* @param key the key
* @param max the max
* @param min the min
* @param withscores the withscores
* @param offsetCount the offsetCount
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREVRANGEBYSCORE)
public abstract String zrevrangebyscore(@RedisProtocolSupport.Key Buffer key, double max, double min,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZrevrangebyscoreWithscores withscores,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.LIMIT) @Nullable @RedisProtocolSupport.Tuple RedisProtocolSupport.OffsetCount offsetCount) throws Exception;
/**
* Determine the index of a member in a sorted set, with scores ordered from high to low.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZREVRANK)
public abstract String zrevrank(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Incrementally iterate sorted sets elements and associated scores.
*
* @param key the key
* @param cursor the cursor
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZSCAN)
public abstract String zscan(@RedisProtocolSupport.Key Buffer key, long cursor) throws Exception;
/**
* Incrementally iterate sorted sets elements and associated scores.
*
* @param key the key
* @param cursor the cursor
* @param matchPattern the matchPattern
* @param count the count
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZSCAN)
public abstract String zscan(@RedisProtocolSupport.Key Buffer key, long cursor,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.MATCH) @Nullable Buffer matchPattern,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.COUNT) @Nullable Long count) throws Exception;
/**
* Get the score associated with the given member in a sorted set.
*
* @param key the key
* @param member the member
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZSCORE)
public abstract String zscore(@RedisProtocolSupport.Key Buffer key, Buffer member) throws Exception;
/**
* Add multiple sorted sets and store the resulting sorted set in a new key.
*
* @param destination the destination
* @param numkeys the numkeys
* @param keys the keys
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZUNIONSTORE)
public abstract String zunionstore(@RedisProtocolSupport.Key Buffer destination, long numkeys,
@RedisProtocolSupport.Key Collection<Buffer> keys) throws Exception;
/**
* Add multiple sorted sets and store the resulting sorted set in a new key.
*
* @param destination the destination
* @param numkeys the numkeys
* @param keys the keys
* @param weightses the weightses
* @param aggregate the aggregate
* @return a {@link String} result
* @throws Exception if an exception occurs during the request processing.
*/
@RedisProtocolSupport.Cmd(RedisProtocolSupport.Command.ZUNIONSTORE)
public abstract String zunionstore(@RedisProtocolSupport.Key Buffer destination, long numkeys,
@RedisProtocolSupport.Key Collection<Buffer> keys,
@RedisProtocolSupport.SubCmd(RedisProtocolSupport.SubCommand.WEIGHTS) Collection<Long> weightses,
@RedisProtocolSupport.Option @Nullable RedisProtocolSupport.ZunionstoreAggregate aggregate) throws Exception;
}
| true
|
e599798a52b20866aaa7ea314905afa6831e8b3d
|
Java
|
Poovizhi98/FullStack_Training
|
/day5java/Covariantreturn.java
|
UTF-8
| 621
| 3.390625
| 3
|
[] |
no_license
|
package day5java;
class Covariantreturn {
int ratings;
void giveFeedback() {
System.out.println("Please give ratings for food");
}
}
class Dosa extends Covariantreturn{
}
class Animal{
public Covariantreturn eat(Covariantreturn covariant) {
Covariantreturn f=new Covariantreturn();
f.ratings=5;
return f;
}
}
class Cat extends Animal{
public Dosa eat(Covariantreturn covariant)
{
Dosa d=new Dosa();
d.ratings=1;
return d;
}
}
class Dog extends Animal{
public Dosa eat() {
System.out.println("Dog eats pedigree");
return null;
}
}
| true
|
edff596666505139d0448fb2624013f228516295
|
Java
|
jlsarmientoh/RecyclerMe
|
/app/src/main/java/com/prodigious/science/fair/recycleme/adapter/GoalAdapter.java
|
UTF-8
| 2,406
| 2.609375
| 3
|
[
"MIT"
] |
permissive
|
package com.prodigious.science.fair.recycleme.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.prodigious.science.fair.recycleme.model.Goal;
import java.util.List;
import fair.science.prodigious.com.recycleme.R;
/**
* Created by jsarmien on 10/22/15.
*/
public class GoalAdapter extends RecyclerView.Adapter<GoalAdapter.GoalViewHolder> {
private List<Goal> goals;
public GoalAdapter(List<Goal> goals) {
this.goals = goals;
}
@Override
public GoalViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater
.from(parent.getContext())
.inflate(R.layout.item_goal, parent, false);
GoalViewHolder viewHolder = new GoalViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(GoalViewHolder holder, int position) {
Goal goal = this.goals.get(position);
holder.setDescription(goal.getDescription());
holder.setImagePath(goal.getImageUrl());
holder.setPoints(goal.getPoints());
}
@Override
public int getItemCount() {
if(goals == null)
return 0;
return goals.size();
}
public void setGoals(List<Goal> newGoals){
this.goals = newGoals;
this.notifyDataSetChanged();
}
public static class GoalViewHolder extends RecyclerView.ViewHolder {
private TextView txtGoalDescription;
private ImageView imageGoal;
private TextView txtGoalPoints;
public GoalViewHolder(View itemView) {
super(itemView);
this.txtGoalDescription = (TextView) itemView.findViewById(R.id.txt_goal_description);
this.imageGoal = (ImageView) itemView.findViewById(R.id.image_goal);
this.txtGoalPoints = (TextView)itemView.findViewById(R.id.txt_goal_points);
}
public void setDescription(String description){
this.txtGoalDescription.setText(description);
}
public void setImagePath(String path){
//TODO add code to load goal's image
}
public void setPoints(int points){
this.txtGoalPoints.setText(Integer.toString(points));
}
}
}
| true
|
bacb6c949523aee53477bf2fa3cb1b26665d622e
|
Java
|
sddf2012/mytest
|
/mybatis/src/main/java/com/interceptor/MyInterceptor.java
|
UTF-8
| 2,055
| 2.875
| 3
|
[] |
no_license
|
package com.interceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* @author liu peng bo
* @date 2018/8/29
*/
@Intercepts(value = {@Signature(type = Map.class, method = "get", args = {Object.class}),
@Signature(type = Map.class, method = "put", args = {Object.class, Object.class})})
public class MyInterceptor implements Interceptor {
@Override
public Object intercept(Invocation invocation) {
if (invocation.getMethod().getName().equals("get")) {
return get(invocation);
} else {
return put(invocation);
}
}
private Object get(Invocation invocation) {
Object oldValue = "get ";
try {
oldValue = oldValue + String.valueOf(invocation.proceed());
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return oldValue;
}
private Object put(Invocation invocation) {
Object oldValue = "old ";
try {
oldValue = oldValue + String.valueOf(invocation.proceed());
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return oldValue;
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
@Override
public void setProperties(Properties properties) {
}
public static void main(String[] args) {
MyInterceptor interceptor=new MyInterceptor();
Map map=(Map)interceptor.plugin(new HashMap());
System.out.println(map.put(1,1));
System.out.println(map.get(1));
}
}
| true
|
a341001dc0b33e73c85beff63a78e41b05ed590c
|
Java
|
WuWenJie-GitHub/trackme
|
/trackme-webgis/src/main/java/com/trackme/webgis/TrackmeWebgisApplication.java
|
UTF-8
| 646
| 1.554688
| 2
|
[] |
no_license
|
package com.trackme.webgis;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@MapperScan("com.trackme.webgis.mapper")
@SpringBootApplication
public class TrackmeWebgisApplication {
public static void main(String[] args) {
SpringApplication.run(TrackmeWebgisApplication.class, args);
}
}
| true
|
eec683ba04884ea2013d87237be0f3fdae8b8f39
|
Java
|
hisun-base-team/hisun-sys
|
/src/main/java/com/hisun/saas/sys/tenant/role/controller/TenantRoleTpltController.java
|
UTF-8
| 9,847
| 1.664063
| 2
|
[] |
no_license
|
/*
* Copyright (c) 2018. Hunan Hisun Union Information Technology Co, Ltd. All rights reserved.
* http://www.hn-hisun.com
* 注意:本内容知识产权属于湖南海数互联信息技术有限公司所有,除非取得商业授权,否则不得用于商业目的.
*/
package com.hisun.saas.sys.tenant.role.controller;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.hisun.base.controller.BaseController;
import com.hisun.base.dao.util.CommonConditionQuery;
import com.hisun.base.dao.util.CommonOrder;
import com.hisun.base.dao.util.CommonOrderBy;
import com.hisun.base.dao.util.CommonRestrictions;
import com.hisun.base.exception.GenericException;
import com.hisun.base.vo.PagerVo;
import com.hisun.saas.sys.auth.UserLoginDetailsUtil;
import com.hisun.saas.sys.log.LogOperateType;
import com.hisun.saas.sys.log.RequiresLog;
import com.hisun.saas.sys.tenant.resource.entity.TenantResource;
import com.hisun.saas.sys.tenant.role.entity.TenantRoleTplt;
import com.hisun.saas.sys.tenant.role.entity.TenantRoleTpltResource;
import com.hisun.saas.sys.tenant.role.service.TenantRoleTpltService;
import com.hisun.saas.sys.tenant.role.vo.TenantRoleTpltVo;
import com.hisun.saas.sys.util.EntityWrapper;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/sys/tenant/role/tplt")
public class TenantRoleTpltController extends BaseController {
@Resource
private TenantRoleTpltService tenantRoleTpltService;
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value = "/list")
public ModelAndView list(HttpServletRequest request,
@RequestParam(value="pageNum",defaultValue="1")int pageNum,
@RequestParam(value="pageSize",defaultValue="10") int pageSize) throws GenericException {
Map<String, Object> map = Maps.newHashMap();
try{
CommonConditionQuery query = new CommonConditionQuery();
Long total = this.tenantRoleTpltService.count(query);
CommonOrderBy orderBy = new CommonOrderBy();
orderBy.add(CommonOrder.asc("roleName"));
List<TenantRoleTplt> queryList = this.tenantRoleTpltService.list(query, orderBy, pageNum, pageSize);
List<TenantRoleTpltVo> vos = Lists.newArrayList();
TenantRoleTpltVo vo = null;
for(TenantRoleTplt entity: queryList){
vo = new TenantRoleTpltVo();
BeanUtils.copyProperties(vo,entity);
vos.add(vo);
}
PagerVo<TenantRoleTpltVo> pager = new PagerVo<TenantRoleTpltVo>(vos, total.intValue(), pageNum, pageSize);
request.setAttribute("pager", pager);
}catch(Exception e){
logger.error(e);
throw new GenericException(e);
}
return new ModelAndView("saas/sys/tenant/role/tplt/listRoleTplt",map);
}
@RequiresLog(operateType = LogOperateType.DELETE,description = "删除角色模板${id}")
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public @ResponseBody Map<String, Object> get(@PathVariable("id") String id) throws GenericException {
Map<String, Object> map = new HashMap<String, Object>();
try {
if (StringUtils.isNotBlank(id)) {
TenantRoleTplt entity = this.tenantRoleTpltService.getByPK(id);
map.put("data", entity);
map.put("success", true);
} else {
throw new GenericException("错误:参数不正确。");
}
} catch (Exception e) {
throw new GenericException(e);
}
return map;
}
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value = "/add")
public ModelAndView add() {
return new ModelAndView("saas/sys/tenant/role/tplt/addRoleTplt");
}
@RequiresLog(operateType = LogOperateType.SAVE,description = "增加角色模板:${vo.name}")
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value = "/save", method = RequestMethod.POST)
public @ResponseBody Map<String, Object> save(TenantRoleTpltVo vo)throws GenericException{
Map<String, Object> map = new HashMap<String, Object>();
try {
if(this.tenantRoleTpltService.existRoleCode(vo.getRoleCodePrefix())==false){
TenantRoleTplt entity = new TenantRoleTplt();
BeanUtils.copyProperties(entity,vo);
EntityWrapper.wrapperSaveBaseProperties(entity, UserLoginDetailsUtil.getUserLoginDetails());
String resourceIds = vo.getResourceIds();
String resourceNames = vo.getResourceNames();
if(resourceIds!=null&& resourceIds.length()>0){
String[] resourceIdArray = resourceIds.split(",");
String[] resourceNameArray = resourceNames.split(",");
int i =0;
for(String id : resourceIdArray){
if(id.equals("1")) continue;
TenantRoleTpltResource tenantRoleTpltResource = new TenantRoleTpltResource();
tenantRoleTpltResource.setResourceName(resourceNameArray[i]);
tenantRoleTpltResource.setTenantResource(new TenantResource(id));
entity.addTenantRoleTpltResource(tenantRoleTpltResource);
i++;
}
}
tenantRoleTpltService.save(entity);
map.put("success", true);
}else{
logger.error("角色模板代码已存在!");
throw new GenericException("角色模板代码已存在!");
}
} catch (Exception e) {
logger.error(e);
throw new GenericException(e.getMessage());
}
return map;
}
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value = "/code/check")
public @ResponseBody Map<String, Object> check(@RequestParam("code") String code,@RequestParam(value="id",required=false)String id) throws GenericException {
Map<String, Object> map = Maps.newHashMap();
if(StringUtils.isNotBlank(id)){
TenantRoleTplt entity = this.tenantRoleTpltService.getByPK(id);
if(StringUtils.equalsIgnoreCase(entity.getRoleCodePrefix(), code)){
map.put("success", true);
}else{
if(this.tenantRoleTpltService.existRoleCode(code)==true){
map.put("success", false);
}else{
map.put("success", true);
}
}
}else{
if(this.tenantRoleTpltService.existRoleCode(code)==true){
map.put("success", false);
}else{
map.put("success", true);
}
}
return map;
}
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value="/edit/{id}",method = RequestMethod.GET)
public ModelAndView edit(@PathVariable("id") String id)throws GenericException{
Map<String,Object> map = new HashMap<String,Object>();
TenantRoleTpltVo vo = new TenantRoleTpltVo();
try {
TenantRoleTplt entity = this.tenantRoleTpltService.getByPK(id);
List<TenantRoleTpltResource> tenantRoleTpltResources = entity.getTenantRoleTpltResources();
if(tenantRoleTpltResources!=null&&tenantRoleTpltResources.size()>0){
StringBuffer resourceIds = new StringBuffer();
StringBuffer resourceNames = new StringBuffer();
for(TenantRoleTpltResource tenantRoleTpltResource: tenantRoleTpltResources){
resourceIds.append(",").append(tenantRoleTpltResource.getTenantResource().getId());
resourceNames.append(",").append(tenantRoleTpltResource.getResourceName());
}
vo.setResourceIds(resourceIds.toString().substring(1,resourceIds.length()));
vo.setResourceNames(resourceNames.toString().substring(1,resourceNames.length()));
}
BeanUtils.copyProperties(vo,entity);
} catch (Exception e) {
logger.error(e);
throw new GenericException(e.getMessage());
}
map.put("vo", vo);
return new ModelAndView("saas/sys/tenant/role/tplt/updateRoleTplt",map);
}
@RequiresLog(operateType = LogOperateType.UPDATE,description = "修改角色模板:${vo.name}")
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value = "/update")
public @ResponseBody Map<String, Object> update(TenantRoleTpltVo vo) throws GenericException {
Map<String, Object> map = new HashMap<String, Object>();
try {
TenantRoleTplt tenantRoleTplt = this.tenantRoleTpltService.getByPK(vo.getId());
BeanUtils.copyProperties(tenantRoleTplt,vo);
List<TenantRoleTpltResource> tenantRoleTpltResources = new ArrayList<>();
String resourceIds = vo.getResourceIds();
String resourceNames = vo.getResourceNames();
if(resourceIds!=null&& resourceIds.length()>0){
String[] resourceIdArray = resourceIds.split(",");
String[] resourceNameArray = resourceNames.split(",");
int i =0;
for(String id : resourceIdArray){
if(id.equals("1")) {
i++;
continue;
}
TenantRoleTpltResource tenantRoleTpltResource = new TenantRoleTpltResource();
tenantRoleTpltResource.setResourceName(resourceNameArray[i]);
tenantRoleTpltResource.setTenantResource(new TenantResource(id));
tenantRoleTpltResource.setTenantRoleTplt(tenantRoleTplt);
tenantRoleTpltResources.add(tenantRoleTpltResource);
i++;
}
}
this.tenantRoleTpltService.update(tenantRoleTplt,tenantRoleTpltResources);
map.put("success", true);
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
throw new GenericException(e.getMessage());
}
return map;
}
@RequiresLog(operateType = LogOperateType.UPDATE,description = "修改角色模板:${vo.name}")
@RequiresPermissions("sys-tenantRoleTplt:*")
@RequestMapping(value = "/delete/{id}")
public @ResponseBody Map<String, Object> delete(@PathVariable("id") String id) throws GenericException {
Map<String, Object> map = new HashMap<String, Object>();
try {
if (StringUtils.isNotBlank(id)) {
this.tenantRoleTpltService.deleteByPK(id);
map.put("success", true);
}
} catch (Exception e) {
logger.error(e);
throw new GenericException(e.getMessage());
}
return map;
}
}
| true
|
16c1bc722840a2c1d720d84d7b898b406af33e66
|
Java
|
SHawkins1911/Maven.ExceptionalPhoneNumbers
|
/src/main/java/com/zipcodewilmington/exceptions/InvalidPhoneNumberFormatException.java
|
UTF-8
| 436
| 2.578125
| 3
|
[] |
no_license
|
package com.zipcodewilmington.exceptions;
/**
* Created by leon on 5/10/17.
*/ // Checked Exception
public final class InvalidPhoneNumberFormatException extends Exception {
private String errorMessage;
public InvalidPhoneNumberFormatException(){}
public InvalidPhoneNumberFormatException(String message){
errorMessage = message;
}
public String getErrorMessage(){
return errorMessage;
}
}
| true
|
8daf0f7498780729ea3c8e1997100a65ff9e84e7
|
Java
|
TTobi200/Coordz
|
/src/de/util/CooDBImportUtil.java
|
WINDOWS-1252
| 970
| 2.421875
| 2
|
[] |
no_license
|
/*
* $Header$
*
* $Log$
* Copyright 2017 T.Ohm . All Rights Reserved.
*/
package de.util;
import java.util.Scanner;
import de.coordz.CooSystem;
import de.coordz.db.xml.CooDBModel;
import de.util.log.CooLog;
public class CooDBImportUtil
{
/** {@link String} for the DB image folder */
public static final String IMAGE_FOLDER = "images";
public static boolean requestUserProceed()
{
boolean proceed = Boolean.FALSE;
CooDBModel model = CooSystem.getModel();
String dbHost = model.dbHostProperty().get();
String dbName = model.dbNameProperty().get();
String dbUser = model.dbUserProperty().get();
// Ask the user if really want to import xml data
CooLog.debug("Do you really want to import all data to " +
dbUser + "@" + dbName + " on " + dbHost + "? (Y - Yes)");
try(Scanner scan = new Scanner(System.in))
{
proceed = scan.next().toUpperCase().equals("Y");
}
return proceed;
}
}
| true
|
bf1a5459bc53a983077db998b61261e694af7103
|
Java
|
jasminjahanpuspo/All_Lab_Code
|
/JAVA/Java session 1/1.Java Assignment 1/ch(1-7)/Matrix/src/matrix/Matrix.java
|
UTF-8
| 446
| 3.0625
| 3
|
[] |
no_license
|
package matrix;
public class Matrix {
public static void main(String[] args) {
double m[][]={
{0*0,1*0,2*0,3*0},
{0*1,1*1,2*1,3*1},
{0*2,1*2,2*2,3*2},
{0*3,1*3,2*3,3*3}
};
int i,j;
for(i=0; i<4; i++){
for(j=0; j<4; j++){
System.out.print(m[i][j]+" ");
}
System.out.println();
}
}
}
| true
|
6916d027adb4ecbe47ebd7d7ecf346e5e45835d9
|
Java
|
JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
|
/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestMMPView4.java
|
UTF-8
| 47,491
| 1.773438
| 2
|
[] |
no_license
|
/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
package com.nokia.carbide.cpp.epoc.engine.tests.model;
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
public class TestMMPView4 extends BaseMMPViewTest {
// apparently feeding garbage to the parser can cause problems
public void testBug3597_2() {
String text = "// e32\\include\\e32des8.h\r\n" +
"//\r\n" +
"// Copyright (c) 1995-2004 Symbian Software Ltd. All rights reserved.\r\n" +
"//\r\n" +
"\r\n" +
"#ifndef __E32DES8_H__\r\n" +
"#define __E32DES8_H__\r\n" +
"\r\n" +
"/**\r\n" +
"@internalComponent\r\n" +
"*/\r\n" +
"const TUint KMaskDesLength8=0xfffffff;\r\n" +
"/**\r\n" +
"@internalComponent\r\n" +
"*/\r\n" +
"const TInt KShiftDesType8=28;\r\n" +
"\r\n" +
"class TBufCBase8;\r\n" +
"class TDes8;\r\n" +
"class TPtrC8;\r\n" +
"class TPtr8;\r\n" +
"class TPtr16;\r\n" +
"#ifndef __KERNEL_MODE__\r\n" +
"class HBufC8;\r\n" +
"#endif\r\n" +
"class TDesC8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"Abstract base class for 8-bit non-modifiable descriptors.\r\n" +
"\r\n" +
"The class encapsulates the data member containing the length of data\r\n" +
"represented by an 8-bit descriptor. It also provides member functions through\r\n" +
"which the data can be accessed, but not modified.\r\n" +
"\r\n" +
"Data represented by this class is treated as a contiguous set of 8-bit (i.e. \r\n" +
"single byte) values or data items.\r\n" +
"\r\n" +
"This class cannot be instantiated as it is intended to form part of a class \r\n" +
"hierarchy; it provides a well defined part of descriptor behaviour. It can, \r\n" +
"however, be passed as an argument type for functions which want access to \r\n" +
"descriptor data but do not need to modify that data.\r\n" +
"\r\n" +
"@see TDesC\r\n" +
"@see TPtrC8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" inline TBool operator<(const TDesC8 &aDes) const;\r\n" +
" inline TBool operator<=(const TDesC8 &aDes) const;\r\n" +
" inline TBool operator>(const TDesC8 &aDes) const;\r\n" +
" inline TBool operator>=(const TDesC8 &aDes) const;\r\n" +
" inline TBool operator==(const TDesC8 &aDes) const;\r\n" +
" inline TBool operator!=(const TDesC8 &aDes) const;\r\n" +
" inline const TUint8 &operator[](TInt anIndex) const;\r\n" +
" inline TInt Length() const;\r\n" +
" inline TInt Size() const;\r\n" +
" IMPORT_C const TUint8 *Ptr() const;\r\n" +
" IMPORT_C TInt Compare(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt Match(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt MatchF(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt MatchC(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt Locate(TChar aChar) const;\r\n" +
" IMPORT_C TInt LocateReverse(TChar aChar) const;\r\n" +
" IMPORT_C TInt Find(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt Find(const TUint8 *pS,TInt aLenS) const;\r\n" +
" IMPORT_C TPtrC8 Left(TInt aLength) const;\r\n" +
" IMPORT_C TPtrC8 Right(TInt aLength) const;\r\n" +
" IMPORT_C TPtrC8 Mid(TInt aPos) const;\r\n" +
" IMPORT_C TPtrC8 Mid(TInt aPos,TInt aLength) const;\r\n" +
" IMPORT_C TInt CompareF(const TDesC8 &aDes) const;\r\n" +
"#ifndef __KERNEL_MODE__\r\n" +
" IMPORT_C TInt CompareC(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt LocateF(TChar aChar) const;\r\n" +
" IMPORT_C TInt LocateReverseF(TChar aChar) const;\r\n" +
" IMPORT_C TInt FindF(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt FindF(const TUint8 *pS,TInt aLenS) const;\r\n" +
" IMPORT_C TInt FindC(const TDesC8 &aDes) const;\r\n" +
" IMPORT_C TInt FindC(const TUint8 *pS,TInt aLenS) const;\r\n" +
" IMPORT_C HBufC8 *Alloc() const;\r\n" +
" IMPORT_C HBufC8 *AllocL() const;\r\n" +
" IMPORT_C HBufC8 *AllocLC() const;\r\n" +
"#endif\r\n" +
"protected:\r\n" +
" inline TDesC8(TInt aType,TInt aLength);\r\n" +
" inline TDesC8() {}\r\n" +
"// delay this for a while\r\n" +
"#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS\r\n" +
" inline TDesC8( const TDesC8& aOther) : iLength(aOther.iLength) {}\r\n" +
"#endif\r\n" +
"// inline ~TDesC8() {} Commented out for the moment since it breaks code\r\n" +
" inline TInt Type() const;\r\n" +
" inline void DoSetLength(TInt aLength);\r\n" +
" IMPORT_C const TUint8 &AtC(TInt anIndex) const;\r\n" +
"private:\r\n" +
" TUint iLength;\r\n" +
" __DECLARE_TEST;\r\n" +
" };\r\n" +
"//\r\n" +
"class TPtrC8 : public TDesC8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"8-bit non-modifiable pointer descriptor.\r\n" +
"\r\n" +
"This is a descriptor class intended for instantiation and encapsulates a\r\n" +
"pointer to the 8-bit data that it represents. The data can live in ROM or RAM\r\n" +
"and this location is separate from the descriptor object itself.\r\n" +
"\r\n" +
"The data is intended to be accessed, but not changed, through this descriptor. \r\n" +
"The base class provides the functions through which data is accessed.\r\n" +
"\r\n" +
"@see TPtr8\r\n" +
"@see TDesC8\r\n" +
"@see TDes8\r\n" +
"@see TBufC8\r\n" +
"@see TBuf8\r\n" +
"@see HBufC8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" IMPORT_C TPtrC8();\r\n" +
" IMPORT_C TPtrC8(const TDesC8 &aDes);\r\n" +
" IMPORT_C TPtrC8(const TUint8 *aString);\r\n" +
" IMPORT_C TPtrC8(const TUint8 *aBuf,TInt aLength);\r\n" +
" inline void Set(const TUint8 *aBuf,TInt aLength);\r\n" +
" inline void Set(const TDesC8 &aDes);\r\n" +
" inline void Set(const TPtrC8& aPtr);\r\n" +
"private:\r\n" +
" TPtrC8& operator=(const TPtrC8 &aDes);\r\n" +
"protected:\r\n" +
" const TUint8 *iPtr;\r\n" +
"private:\r\n" +
" __DECLARE_TEST;\r\n" +
" };\r\n" +
"//\r\n" +
"class TDes8Overflow\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"An interface that defines an overflow handler for an 8-bit descriptor.\r\n" +
"\r\n" +
"The interface encapsulates a function that is called when an attempt to append \r\n" +
"formatted text fails because the descriptor is already at its maximum length.\r\n" +
"\r\n" +
"A derived class must provide an implementation for the Overflow() member\r\n" +
"function.\r\n" +
"\r\n" +
"@see TDes8::AppendFormat\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" /**\r\n" +
" Handles the overflow.\r\n" +
" \r\n" +
" This function is called when the TDes8::AppendFormat() variant that takes\r\n" +
" an overflow handler argument, fails.\r\n" +
" \r\n" +
" @param aDes The 8-bit modifiable descriptor whose overflow results in the \r\n" +
" call to this overflow handler.\r\n" +
" */\r\n" +
" virtual void Overflow(TDes8 &aDes)=0;\r\n" +
" };\r\n" +
"//\r\n" +
"class TDesC16;\r\n" +
"class TRealFormat;\r\n" +
"class TDes8 : public TDesC8\r\n" +
"/** \r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"Abstract base class for 8-bit modifiable descriptors.\r\n" +
"\r\n" +
"The class encapsulates the data member containing the maximum length of data\r\n" +
"represented by an 8-bit descriptor. It also provides member functions through\r\n" +
"which the data can be modified.\r\n" +
"\r\n" +
"The class adds to the behaviour provided by TDesC8.\r\n" +
"\r\n" +
"This class cannot be instantiated as it is intended to form part of a class \r\n" +
"hierarchy; it provides a well defined part of descriptor behaviour. It can, \r\n" +
"however, be passed as an argument type for functions which need to both modify \r\n" +
"and access descriptor data.\r\n" +
"\r\n" +
"@see TDes\r\n" +
"@see TDesC8\r\n" +
"@see TDesC16\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" inline TDes8& operator=(const TUint8 *aString);\r\n" +
" inline TDes8& operator=(const TDesC8 &aDes);\r\n" +
" inline TDes8& operator=(const TDes8 &aDes);\r\n" +
" inline TInt MaxLength() const;\r\n" +
" inline TInt MaxSize() const;\r\n" +
" inline const TUint8 &operator[](TInt anIndex) const;\r\n" +
" inline TUint8 &operator[](TInt anIndex);\r\n" +
" inline TDes8 &operator+=(const TDesC8 &aDes);\r\n" +
" IMPORT_C void Zero();\r\n" +
" IMPORT_C void SetLength(TInt aLength);\r\n" +
" IMPORT_C void SetMax();\r\n" +
" IMPORT_C void Copy(const TDesC8 &aDes);\r\n" +
" IMPORT_C void Copy(const TUint8 *aBuf,TInt aLength);\r\n" +
" IMPORT_C void Copy(const TUint8 *aString);\r\n" +
" IMPORT_C void Copy(const TDesC16 &aDes);\r\n" +
" IMPORT_C void Append(TChar aChar);\r\n" +
" IMPORT_C void Append(const TDesC8 &aDes);\r\n" +
" IMPORT_C void Append(const TDesC16 &aDes);\r\n" +
" IMPORT_C void Append(const TUint8 *aBuf,TInt aLength);\r\n" +
" IMPORT_C void Fill(TChar aChar);\r\n" +
" IMPORT_C void Fill(TChar aChar,TInt aLength);\r\n" +
" IMPORT_C void FillZ();\r\n" +
" IMPORT_C void FillZ(TInt aLength);\r\n" +
" IMPORT_C void Num(TInt64 aVal);\r\n" +
" IMPORT_C void Num(TUint64 aVal, TRadix aRadix);\r\n" +
" IMPORT_C void NumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);\r\n" +
" IMPORT_C void AppendNum(TInt64 aVal);\r\n" +
" IMPORT_C void AppendNum(TUint64 aVal, TRadix aRadix);\r\n" +
" IMPORT_C void AppendNumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);\r\n" +
"#ifndef __KERNEL_MODE__\r\n" +
" IMPORT_C TPtr8 LeftTPtr(TInt aLength) const;\r\n" +
" IMPORT_C TPtr8 RightTPtr(TInt aLength) const;\r\n" +
" IMPORT_C TPtr8 MidTPtr(TInt aPos) const;\r\n" +
" IMPORT_C TPtr8 MidTPtr(TInt aPos,TInt aLength) const;\r\n" +
" IMPORT_C const TUint8 *PtrZ();\r\n" +
" IMPORT_C void CopyF(const TDesC8 &aDes);\r\n" +
" IMPORT_C void CopyC(const TDesC8 &aDes);\r\n" +
" IMPORT_C void CopyLC(const TDesC8 &aDes);\r\n" +
" IMPORT_C void CopyUC(const TDesC8 &aDes);\r\n" +
" IMPORT_C void CopyCP(const TDesC8 &aDes);\r\n" +
" IMPORT_C void Swap(TDes8 &aDes);\r\n" +
" IMPORT_C void AppendFill(TChar aChar,TInt aLength);\r\n" +
" IMPORT_C void ZeroTerminate();\r\n" +
" IMPORT_C void Fold();\r\n" +
" IMPORT_C void Collate();\r\n" +
" IMPORT_C void LowerCase();\r\n" +
" IMPORT_C void UpperCase();\r\n" +
" IMPORT_C void Capitalize();\r\n" +
" IMPORT_C void Repeat(const TUint8 *aBuf,TInt aLength);\r\n" +
" IMPORT_C void Repeat(const TDesC8 &aDes);\r\n" +
" IMPORT_C void Trim();\r\n" +
" IMPORT_C void TrimAll();\r\n" +
" IMPORT_C void TrimLeft();\r\n" +
" IMPORT_C void TrimRight();\r\n" +
" IMPORT_C void Insert(TInt aPos,const TDesC8 &aDes);\r\n" +
" IMPORT_C void Delete(TInt aPos,TInt aLength);\r\n" +
" IMPORT_C void Replace(TInt aPos,TInt aLength,const TDesC8 &aDes);\r\n" +
" IMPORT_C void Justify(const TDesC8 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill);\r\n" +
" IMPORT_C void NumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);\r\n" +
" IMPORT_C void NumUC(TUint64 aVal, TRadix aRadix=EDecimal);\r\n" +
" IMPORT_C TInt Num(TReal aVal,const TRealFormat &aFormat) __SOFTFP;\r\n" +
" IMPORT_C void AppendNumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);\r\n" +
" IMPORT_C TInt AppendNum(TReal aVal,const TRealFormat &aFormat) __SOFTFP;\r\n" +
" IMPORT_C void AppendNumUC(TUint64 aVal,TRadix aRadix=EDecimal);\r\n" +
" IMPORT_C void Format(TRefByValue<const TDesC8> aFmt,...);\r\n" +
" IMPORT_C void FormatList(const TDesC8 &aFmt,VA_LIST aList);\r\n" +
" IMPORT_C void AppendJustify(const TDesC8 &Des,TInt aWidth,TAlign anAlignment,TChar aFill);\r\n" +
" IMPORT_C void AppendJustify(const TDesC8 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);\r\n" +
" IMPORT_C void AppendJustify(const TUint8 *aString,TInt aWidth,TAlign anAlignment,TChar aFill);\r\n" +
" IMPORT_C void AppendJustify(const TUint8 *aString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);\r\n" +
" IMPORT_C void AppendFormat(TRefByValue<const TDesC8> aFmt,TDes8Overflow *aOverflowHandler,...);\r\n" +
" IMPORT_C void AppendFormat(TRefByValue<const TDesC8> aFmt,...);\r\n" +
" IMPORT_C void AppendFormatList(const TDesC8 &aFmt,VA_LIST aList,TDes8Overflow *aOverflowHandler=NULL);\r\n" +
" IMPORT_C TPtr16 Expand();\r\n" +
" IMPORT_C void Collapse();\r\n" +
"#endif //__KERNEL_MODE__\r\n" +
"protected:\r\n" +
" inline TDes8(TInt aType,TInt aLength,TInt aMaxLength);\r\n" +
" inline TUint8 *WPtr() const;\r\n" +
" inline TDes8() {}\r\n" +
"// delay this for a while\r\n" +
"#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS\r\n" +
" inline TDes8(const TDes8& aOther) : TDesC8(aOther), iMaxLength(aOther.iMaxLength) {}\r\n" +
"#endif\r\n" +
" void DoAppendNum(TUint64 aVal, TRadix aRadix, TUint aA, TInt aW);\r\n" +
" void DoPadAppendNum(TInt aLength, TInt aW, const TUint8* aBuf);\r\n" +
"protected:\r\n" +
" TInt iMaxLength;\r\n" +
" __DECLARE_TEST;\r\n" +
" };\r\n" +
"//\r\n" +
"class TPtr8 : public TDes8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"8-bit modifiable pointer descriptor.\r\n" +
"\r\n" +
"This is a descriptor class intended for instantiation and encapsulates a\r\n" +
"pointer to the 8-bit data that it represents. The data can live in ROM or\r\n" +
"RAM and this location is separate from the descriptor object itself.\r\n" +
"\r\n" +
"The data is intended to be accessed and modified through this descriptor. \r\n" +
"The base classes provide the functions through which the data can be \r\n" +
"manipulated.\r\n" +
"\r\n" +
"@see TPtr\r\n" +
"@see TPtrC8\r\n" +
"@see TDesC8\r\n" +
"@see TDes8\r\n" +
"@see TBufC8\r\n" +
"@see TBuf8\r\n" +
"@see HBufC8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" IMPORT_C TPtr8(TUint8 *aBuf,TInt aMaxLength);\r\n" +
" IMPORT_C TPtr8(TUint8 *aBuf,TInt aLength,TInt aMaxLength);\r\n" +
" inline TPtr8& operator=(const TUint8 *aString);\r\n" +
" inline TPtr8& operator=(const TDesC8& aDes);\r\n" +
" inline TPtr8& operator=(const TPtr8& aPtr);\r\n" +
" inline void Set(TUint8 *aBuf,TInt aLength,TInt aMaxLength);\r\n" +
" inline void Set(const TPtr8 &aPtr);\r\n" +
"private:\r\n" +
" IMPORT_C TPtr8(TBufCBase8 &aLcb,TInt aMaxLength);\r\n" +
"protected:\r\n" +
" TUint8 *iPtr;\r\n" +
"private:\r\n" +
" friend class TBufCBase8;\r\n" +
" __DECLARE_TEST;\r\n" +
" };\r\n" +
"//\r\n" +
"class TBufCBase8 : public TDesC8\r\n" +
"/**\r\n" +
"@internalAll\r\n" +
"*/\r\n" +
" {\r\n" +
"protected:\r\n" +
" IMPORT_C TBufCBase8();\r\n" +
" inline TBufCBase8(TInt aLength);\r\n" +
" IMPORT_C TBufCBase8(const TUint8 *aString,TInt aMaxLength);\r\n" +
" IMPORT_C TBufCBase8(const TDesC8 &aDes,TInt aMaxLength);\r\n" +
" IMPORT_C void Copy(const TUint8 *aString,TInt aMaxLength);\r\n" +
" IMPORT_C void Copy(const TDesC8 &aDes,TInt aMaxLength);\r\n" +
" inline TPtr8 DoDes(TInt aMaxLength);\r\n" +
" inline TUint8 *WPtr() const;\r\n" +
" };\r\n" +
"//\r\n" +
"#ifndef __KERNEL_MODE__\r\n" +
"class RReadStream;\r\n" +
"class HBufC8 : public TBufCBase8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"8-bit heap descriptor.\r\n" +
"\r\n" +
"This is a descriptor class which provides a buffer of fixed length, allocated \r\n" +
"on the heap, for containing and accessing data.\r\n" +
"\r\n" +
"The class is intended for instantiation.\r\n" +
"\r\n" +
"Heap descriptors have the important property that they can be made larger \r\n" +
"or smaller, changing the size of the descriptor buffer. This is achieved by \r\n" +
"reallocating the descriptor. Unlike the behaviour of dynamic buffers, \r\n" +
"reallocation is not done automatically.\r\n" +
"\r\n" +
"Data is intended to be accessed, but not modified; however, it can be \r\n" +
"completely replaced using the assignment operators of this class. The base\r\n" +
"class (TDesC8) provides the functions through which the data is accessed.\r\n" +
"\r\n" +
"The descriptor is hosted by a heap cell, and the 8-bit data that the\r\n" +
"descriptor represents is part of the descriptor object itself. The size of the\r\n" +
"cell depends on the requested maximum length of the descriptor buffer when the\r\n" +
"descriptor is created or re-allocated.\r\n" +
"\r\n" +
"It is important to note that the size of the allocated cell, and, therefore, \r\n" +
"the resulting maximum length of the descriptor, may be larger than requested \r\n" +
"due to the way memory is allocated in Symbian OS. The amount by which this \r\n" +
"may be rounded up depends on the platform and build type.\r\n" +
"\r\n" +
"@see HBufC\r\n" +
"@see TPtr8\r\n" +
"@see TDesC8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" IMPORT_C static HBufC8 *New(TInt aMaxLength);\r\n" +
" IMPORT_C static HBufC8 *NewL(TInt aMaxLength);\r\n" +
" IMPORT_C static HBufC8 *NewLC(TInt aMaxLength);\r\n" +
" IMPORT_C static HBufC8 *NewMax(TInt aMaxLength);\r\n" +
" IMPORT_C static HBufC8 *NewMaxL(TInt aMaxLength);\r\n" +
" IMPORT_C static HBufC8 *NewMaxLC(TInt aMaxLength);\r\n" +
" IMPORT_C static HBufC8 *NewL(RReadStream &aStream,TInt aMaxLength);\r\n" +
" IMPORT_C static HBufC8 *NewLC(RReadStream &aStream,TInt aMaxLength);\r\n" +
" IMPORT_C HBufC8& operator=(const TUint8 *aString);\r\n" +
" IMPORT_C HBufC8& operator=(const TDesC8 &aDes);\r\n" +
" inline HBufC8& operator=(const HBufC8 &aLcb);\r\n" +
" IMPORT_C HBufC8 *ReAlloc(TInt aMaxLength);\r\n" +
" IMPORT_C HBufC8 *ReAllocL(TInt aMaxLength);\r\n" +
" IMPORT_C TPtr8 Des();\r\n" +
"private:\r\n" +
" inline HBufC8(TInt aLength);\r\n" +
"private:\r\n" +
" TText8 iBuf[1];\r\n" +
" __DECLARE_TEST;\r\n" +
" };\r\n" +
"#endif\r\n" +
"//\r\n" +
"/**\r\n" +
"@internalComponent\r\n" +
"*/\r\n" +
"#define __Size8 (sizeof(TInt)/sizeof(TInt8))\r\n" +
"/**\r\n" +
"@internalComponent\r\n" +
"*/\r\n" +
"#define __Align8(s) ((((s)+__Size8-1)/__Size8)*__Size8)\r\n" +
"//\r\n" +
"template <TInt S>\r\n" +
"class TBufC8 : public TBufCBase8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"8-bit non-modifiable buffer descriptor. \r\n" +
"\r\n" +
"This is a descriptor class which provides a buffer of fixed length for\r\n" +
"containing and accessing TUint8 data.\r\n" +
"\r\n" +
"The class intended for instantiation. The 8-bit data that the descriptor\r\n" +
"represents is part of the descriptor object itself. \r\n" +
"\r\n" +
"The class is templated, based on an integer value which defines the size of \r\n" +
"the descriptor\'s data area.\r\n" +
"\r\n" +
"The data is intended to be accessed, but not modified; however, it can be \r\n" +
"completely replaced using the assignment operators of this class. The base \r\n" +
"class provides the functions through which the data is accessed.\r\n" +
"\r\n" +
"@see TBufC\r\n" +
"@see TDesC8\r\n" +
"@see TPtr8\r\n" +
"@see TUint8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" inline TBufC8();\r\n" +
" inline TBufC8(const TUint8 *aString);\r\n" +
" inline TBufC8(const TDesC8 &aDes);\r\n" +
" inline TBufC8<S> &operator=(const TUint8 *aString);\r\n" +
" inline TBufC8<S> &operator=(const TDesC8 &aDes);\r\n" +
" inline TPtr8 Des();\r\n" +
"protected:\r\n" +
" TUint8 iBuf[__Align8(S)];\r\n" +
" };\r\n" +
"//\r\n" +
"class TBufBase8 : public TDes8\r\n" +
"/**\r\n" +
"@internalAll\r\n" +
"*/\r\n" +
" {\r\n" +
"protected:\r\n" +
" IMPORT_C TBufBase8(TInt aMaxLength);\r\n" +
" IMPORT_C TBufBase8(TInt aLength,TInt aMaxLength);\r\n" +
" IMPORT_C TBufBase8(const TUint8* aString,TInt aMaxLength);\r\n" +
" IMPORT_C TBufBase8(const TDesC8& aDes,TInt aMaxLength);\r\n" +
" };\r\n" +
"//\r\n" +
"template <TInt S>\r\n" +
"class TBuf8 : public TBufBase8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"A descriptor class which provides a buffer of fixed length for\r\n" +
"containing, accessing and manipulating TUint8 data.\r\n" +
"\r\n" +
"The class is intended for instantiation. The 8-bit data that the descriptor \r\n" +
"represents is part of the descriptor object itself.\r\n" +
"\r\n" +
"The class is templated, based on an integer value which determines the size \r\n" +
"of the data area which is created as part of the buffer descriptor object; \r\n" +
"this is also the maximum length of the descriptor.\r\n" +
"\r\n" +
"The data is intended to be both accessed and modified. The base classes provide \r\n" +
"the functions through which the data is accessed.\r\n" +
"\r\n" +
"@see TBuf\r\n" +
"@see TDesC8\r\n" +
"@see TDes8\r\n" +
"@see TPtr8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" inline TBuf8();\r\n" +
" inline explicit TBuf8(TInt aLength);\r\n" +
" inline TBuf8(const TUint8* aString);\r\n" +
" inline TBuf8(const TDesC8& aDes);\r\n" +
" inline TBuf8<S>& operator=(const TUint8* aString);\r\n" +
" inline TBuf8<S>& operator=(const TDesC8& aDes);\r\n" +
" inline TBuf8<S>& operator=(const TBuf8<S>& aBuf);\r\n" +
"protected:\r\n" +
" TUint8 iBuf[__Align8(S)];\r\n" +
" };\r\n" +
"\r\n" +
"//\r\n" +
"template <TInt S>\r\n" +
"class TAlignedBuf8 : public TBufBase8\r\n" +
"/**\r\n" +
"@internalComponent\r\n" +
"\r\n" +
"A descriptor class functionally identical to TBuf8, the only\r\n" +
"difference from it being that TAlignedBuf8\'s internal buffer \r\n" +
"is guaranteed to be 64-bit aligned.\r\n" +
"\r\n" +
"At present this class is not intended for general use. It exists\r\n" +
"solely to support TPckgBuf which derives from it.\r\n" +
"\r\n" +
"@see TBuf8\r\n" +
"@see TPckgBuf\r\n" +
"*/\r\n" +
"{\r\n" +
"public:\r\n" +
" inline TAlignedBuf8();\r\n" +
" inline explicit TAlignedBuf8(TInt aLength);\r\n" +
" inline TAlignedBuf8(const TUint8* aString);\r\n" +
" inline TAlignedBuf8(const TDesC8& aDes);\r\n" +
" inline TAlignedBuf8<S>& operator=(const TUint8* aString);\r\n" +
" inline TAlignedBuf8<S>& operator=(const TDesC8& aDes);\r\n" +
" inline TAlignedBuf8<S>& operator=(const TAlignedBuf8<S>& aBuf);\r\n" +
"protected:\r\n" +
" union {\r\n" +
" double only_here_to_force_8byte_alignment;\r\n" +
" TUint8 iBuf[__Align8(S)];\r\n" +
" };\r\n" +
"};\r\n" +
"\r\n" +
"#ifndef __KERNEL_MODE__\r\n" +
"\r\n" +
"class RBuf8 : public TDes8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"8 bit resizable buffer descriptor.\r\n" +
"\r\n" +
"The class provides a buffer that contains, accesses and manipulates\r\n" +
"TUint8 data. The buffer itself is on the heap, and is managed by the class.\r\n" +
"\r\n" +
"Internally, RBuf8 behaves in one of two ways:\r\n" +
"\r\n" +
"- as a TPtr8 descriptor type, where the buffer just contains data\r\n" +
"- as a pointer to a heap descriptor, an HBufC8* type, where the buffer\r\n" +
" contains both descriptor information and the data.\r\n" +
"\r\n" +
"Note that the handling of the distinction is hidden from view.\r\n" +
"\r\n" +
"An RBuf8 object can allocate its own buffer. Alternatively, it can take\r\n" +
"ownership of a pre-existing section of allocated memory, or it can take\r\n" +
"ownership of a pre-existing heap descriptor. It can also reallocate the buffer\r\n" +
"to resize it. Regardless of the way in which the buffer has been allocated,\r\n" +
"the RBuf8 object is responsible for freeing memory when the object itself is closed.\r\n" +
"\r\n" +
"The class is intended for instantiation.\r\n" +
"\r\n" +
"The class is derived from TDes8, which means that data can be both accessed\r\n" +
"and modified. The base classes provide the functions through which the data is\r\n" +
"accessed. In addition, an RBuf8 object can be passed to any function that is\r\n" +
"prototyped to take a TDes8 or a TDesC8 type.\r\n" +
"\r\n" +
"@see TBuf8\r\n" +
"@see TPtr8\r\n" +
"@see HBufC8\r\n" +
"@see TDesC8\r\n" +
"@see TDes8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" IMPORT_C RBuf8();\r\n" +
" IMPORT_C explicit RBuf8(HBufC8* aHBuf);\r\n" +
" IMPORT_C void Assign(const RBuf8& aRBuf);\r\n" +
" IMPORT_C void Assign(TUint8 *aHeapCell,TInt aMaxLength);\r\n" +
" IMPORT_C void Assign(TUint8 *aHeapCell,TInt aLength,TInt aMaxLength);\r\n" +
" IMPORT_C void Assign(HBufC8* aHBuf);\r\n" +
" IMPORT_C void Swap(RBuf8& aRBuf);\r\n" +
" IMPORT_C TInt Create(TInt aMaxLength);\r\n" +
" IMPORT_C void CreateL(TInt aMaxLength);\r\n" +
" IMPORT_C TInt CreateMax(TInt aMaxLength);\r\n" +
" IMPORT_C void CreateMaxL(TInt aMaxLength);\r\n" +
" inline void CreateL(RReadStream &aStream,TInt aMaxLength);\r\n" +
" IMPORT_C TInt Create(const TDesC8& aDes);\r\n" +
" IMPORT_C void CreateL(const TDesC8& aDes);\r\n" +
" IMPORT_C TInt Create(const TDesC8& aDes,TInt aMaxLength);\r\n" +
" IMPORT_C void CreateL(const TDesC8& aDes,TInt aMaxLength);\r\n" +
" IMPORT_C TInt ReAlloc(TInt aMaxLength);\r\n" +
" IMPORT_C void ReAllocL(TInt aMaxLength);\r\n" +
" IMPORT_C void Close();\r\n" +
" IMPORT_C void CleanupClosePushL();\r\n" +
"\r\n" +
"protected:\r\n" +
" IMPORT_C RBuf8(TInt aType,TInt aLength,TInt aMaxLength);\r\n" +
" RBuf8(const RBuf8&); // Outlaw copy construction\r\n" +
" union\r\n" +
" {\r\n" +
" TUint8* iEPtrType; //Pointer to data used when RBuf is of EPtr type\r\n" +
" HBufC8* iEBufCPtrType; //Pointer to data used when RBuf is of EBufCPtr type\r\n" +
" };\r\n" +
" __DECLARE_TEST;\r\n" +
" };\r\n" +
"\r\n" +
"#endif\r\n" +
"\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"Value reference used in operator TLitC8::__TRefDesC8()\r\n" +
"\r\n" +
"@see TRefByValue\r\n" +
"*/\r\n" +
"typedef TRefByValue<const TDesC8> __TRefDesC8;\r\n" +
"\r\n" +
"\r\n" +
"\r\n" +
"\r\n" +
"template <TInt S>\r\n" +
"class TLitC8\r\n" +
"/**\r\n" +
"@publishedAll\r\n" +
"@released\r\n" +
"\r\n" +
"Encapsulates literal text. \r\n" +
"\r\n" +
"This is always constructed using an _LIT8 macro.\r\n" +
"\r\n" +
"This class is build independent; i.e. an explicit 8-bit build variant\r\n" +
"is generated for both a non-Unicode build and a Unicode build.\r\n" +
"\r\n" +
"The class has no explicit constructors.\r\n" +
"\r\n" +
"@see _LIT8\r\n" +
"*/\r\n" +
" {\r\n" +
"public:\r\n" +
" inline const TDesC8* operator&() const;\r\n" +
" inline operator const TDesC8&() const;\r\n" +
" inline const TDesC8& operator()() const;\r\n" +
" inline operator const __TRefDesC8() const;\r\n" +
"public:\r\n" +
" /**\r\n" +
" @internalComponent\r\n" +
" */\r\n" +
" TUint iTypeLength;\r\n" +
" \r\n" +
" /**\r\n" +
" @internalComponent\r\n" +
" */\r\n" +
" TText8 iBuf[__Align8(S)];\r\n" +
" };\r\n" +
"\r\n" +
"#endif\r\n" +
"";
allowParseErrors = true;
makeModel(text);
IMMPView view = getView(mmpConfig);
commitTest(view, text);
}
/**
* This bug is essentially caused by getting the wrong IDocument mapping
* for the main translation unit. The full hairy text of the MMPs and includes
* is left here just for fun, I guess.
*/
public void testBug3674() {
final String sdk_version = "#ifndef SDK_VERSION_MMP\r\n" +
"#define SDK_VERSION_MMP\r\n" +
"MACRO __SDK_VERSION_MMP__\r\n" +
"MACRO __S60V2__\r\n" +
"#define __S60V2__\r\n" +
"MACRO __S60V3__\r\n" +
"#define __S60V3__\r\n" +
"#define __SDK__ S60_3rd_MR\r\n" +
"#ifdef WINS\r\n" +
"#define DEFFILENAME(x) EXPORTUNFROZEN\r\n" +
"#define FACTORYDEFFILENAME(x) DEFFILE .\\ ## S60_3rd_MR ## \\ ## x ## -wins.DEF\r\n" +
"#else\r\n" +
"#define DEFFILENAME(x) EXPORTUNFROZEN\r\n" +
"#define FACTORYDEFFILENAME(x) DEFFILE .\\ ## S60_3rd_MR ## \\ ## x ## -thumb.DEF\r\n" +
"#endif\r\n" +
"\r\n" +
"#endif // SDK_VERSION_MMP\r\n" +
"";
String context = "#ifndef __CONTEXT_MMP_INCLUDED__\r\n" +
"#define __CONTEXT_MMP_INCLUDED__ 1\r\n" +
"MACRO __CONTEXT_MMP__\r\n" +
"#ifdef __S60V3__\r\n" +
"SRCDBG\r\n" +
"CAPABILITY ReadDeviceData ReadUserData WriteUserData LocalServices Location NetworkServices UserEnvironment WriteDeviceData SwEvent\r\n" +
"#endif\r\n" +
"\r\n" +
"#endif\r\n" +
"";
String context_uids = "/*\r\n" +
" * UIDs for Context components\r\n" +
" *\r\n" +
" * *app.h files should include this, instead of\r\n" +
" * defining the value\r\n" +
" * NOTE: these values are automatically updated\r\n" +
" * in the pkg files by update_sis_versions.pl\r\n" +
" * but have to manually updated in *_common.mmp\r\n" +
" *\r\n" +
"\r\n" +
"Jaiku UIDs:\r\n" +
"0x200084B3 - 0x200084C6\r\n" +
"0x200089E1 - 0x200089F4\r\n" +
"\r\n" +
" */\r\n" +
"#define CONTEXT_UID_CONTEXT_LOG 0x200084B3\r\n" +
"#define CONTEXT_UID_CL_AUTOSTART 0x200084B4\r\n" +
"#define CONTEXT_UID_STARTER 0x200084B5\r\n" +
"\r\n" +
"#define CONTEXT_UID_CONTEXTSERVER 0x200084B6\r\n" +
"#define CONTEXT_UID_CONTEXTCLIENT 0x200084B7\r\n" +
"#define CONTEXT_UID_CONTEXTCOMMON 0x200084B8\r\n" +
"\r\n" +
"#define CONTEXT_UID_CONTEXTNOTIFY 0x200084B9\r\n" +
"#define CONTEXT_UID_CONTEXTNOTIFYCLIENT 0x200084BA\r\n" +
"\r\n" +
"#define CONTEXT_UID_CONTEXTCONTACTS 0x200084BB\r\n" +
"#define CONTEXT_UID_BLACKBOARDDATA 0x200084BC\r\n" +
"#define CONTEXT_UID_BLACKBOARDSERVER 0x200084BD\r\n" +
"\r\n" +
"#define CONTEXT_UID_BLACKBOARDCLIENT 0x200084BE\r\n" +
"#define CONTEXT_UID_BLACKBOARDFACTORY 0x200084BF\r\n" +
"#define CONTEXT_UID_CONTEXTSENSORS 0x200084C1\r\n" +
"#define CONTEXT_UID_SENSORDATAFACTORY 0x200084C2\r\n" +
"#define CONTEXT_UID_CONTEXTNETWORK 0x200084C3\r\n" +
"#define CONTEXT_UID_CONTEXTCOMMON2 0x200084C4\r\n" +
"#define CONTEXT_UID_CONTEXTMEDIA 0x200084C5\r\n" +
"\r\n" +
"#define CONTEXT_UID_CONTEXTMEDIAFACTORY 0x200084C6\r\n" +
"#define CONTEXT_UID_CONTEXTSENSORDATA 0x200089E1\r\n" +
"#define CONTEXT_UID_CONTEXTUI 0x200089E2\r\n" +
"#define CONTEXT_UID_CONTEXTMEDIADATA 0x200089E3\r\n" +
"\r\n" +
"#define CONTEXT_UID_CONTEXTMEDIAUI 0x200089E4\r\n" +
"\r\n" +
"#define CONTEXT_UID_SETTINGS 0x200089E5\r\n" +
"#define CONTEXT_UID_SHUTTER 0x200089E6\r\n" +
"#define CONTEXT_UID_EXPAT 0x200089E7\r\n" +
"#define CONTEXT_UID_CONTEXTCONTACTSUI 0x200089E8\r\n" +
"#define CONTEXT_UID_CONTEXTCOMMSENSORS 0x200089E9\r\n" +
"#define CONTEXT_UID_CONTEXTSTARTER 0x200089EA\r\n" +
"#define CONTEXT_UID_CONTEXTWELCOME 0x200089EB\r\n" +
"#define CONTEXT_UID_JAIKUUIKIT 0x200089EC\r\n" +
"#define CONTEXT_UID_JAIKUTOOL 0x200089ED\r\n" +
"\r\n" +
"#define CONTEXT_UID_SYMBIANOSUNIT 0x200089EE\r\n" +
"";
String bb_common = "/* \r\n" +
" Copyright (C) 0000 Test Code Comments\r\n" +
"\r\n" +
" blah blah blah bla blah blah blah bla blah blah blah bla\r\n" +
" blah blah blah bla blah blah blah bla blah blah blah bla\r\n" +
" blah blah blah bla blah blah blah bla blah blah blah bla\r\n" +
" blah blah blah bla blah blah blah bla blah blah blah bla.\r\n" +
"\r\n" +
" blah blah blah bla blah blah blah bla blah blah blah bla\r\n" +
" blah blah blah bla blah blah blah bla blah blah blah bla\r\n" +
" blah blah blah bla blah blah blah bla blah blah blah blah.\r\n" +
"\r\n" +
"\r\n" +
"*/\r\n" +
"\r\n" +
"#include \"..\\..\\context_uids.rh\"\r\n" +
"#include <sdk_version.mmp>\r\n" +
"#include \"..\\..\\context.mmp\"\r\n" +
"\r\n" +
"TARGET BlackBoardData.dll\r\n" +
"TARGETTYPE dll\r\n" +
"UID 0x1000008d CONTEXT_UID_BLACKBOARDDATA\r\n" +
"START ARMI\r\n" +
"TARGETPATH \\system\\libs\r\n" +
"END\r\n" +
"START THUMB\r\n" +
"TARGETPATH \\system\\libs\r\n" +
"END\r\n" +
"\r\n" +
"DEFFILENAME(BlackBoardData)\r\n" +
"\r\n" +
"SOURCEPATH ..\\src\r\n" +
"SOURCE concretedata.cpp\r\n" +
"SOURCE bbdata.cpp\r\n" +
"SOURCE bbutil.cpp\r\n" +
"SOURCE bbxml.cpp\r\n" +
"SOURCE bbdll.cpp\r\n" +
"SOURCE bblist.cpp\r\n" +
"SOURCE bberrorinfo.cpp\r\n" +
"SOURCE bb_incoming.cpp\r\n" +
"SOURCE bbtuple.cpp\r\n" +
"SOURCE csd_md5hash.cpp\r\n" +
"SOURCE csd_uuid.cpp\r\n" +
"\r\n" +
"USERINCLUDE ..\\inc ..\\..\\ContextCompat\\inc\r\n" +
"USERINCLUDE ..\\..\\contextcommon\\inc ..\\..\\expat\\lib ..\\..\r\n" +
"\r\n" +
"SYSTEMINCLUDE \\epoc32\\include \\epoc32\\include\\libc\r\n" +
"\r\n" +
"LIBRARY euser.lib contextcommon.lib estor.lib\r\n" +
"LIBRARY contextexpat.lib bafl.lib\r\n" +
"LIBRARY efsrv.lib\r\n" +
"";
String mmp = "#include <sdk_version.mmp>\r\n" +
"#include \"..\\..\\context.mmp\"\r\n" +
"DEFFILENAME(BlackBoardData)\r\n" +
"#include \"..\\common\\BlackBoard_common.mmp\"\r\n" +
"";
parserConfig.getFilesystem().put("sdk_version.mmp", sdk_version);
parserConfig.getFilesystem().put("context.mmp", context);
parserConfig.getFilesystem().put("Blackboard_common.mmp", bb_common);
parserConfig.getFilesystem().put("context_uids.rh", context_uids);
makeModel(mmp);
IMMPView view = getView(mmpConfig);
checkNoProblems(view);
commitTest(view, mmp);
}
public void testMacroMungingBug3700() {
String header = "#define MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE \\\r\n" +
" \\epoc32\\include \\\r\n" +
" \\epoc32\\include\\oem \\\r\n" +
" \\epoc32\\include\\middleware \\\r\n" +
" \\epoc32\\include\\domain\\middleware \\\r\n" +
" \\epoc32\\include\\osextensions \\\r\n" +
" \\epoc32\\include\\domain\\osextensions\r\n";
String text = "#include <data_caging_paths.hrh>\r\n" +
"USERINCLUDE ..\\FeedsServer\\Client\\inc\r\n" +
"USERINCLUDE ..\\FeedsServer\\Common\\inc\r\n" +
"USERINCLUDE ..\\..\\inc\r\n" +
"\r\n" +
"MW_LAYER_SYSTEMINCLUDE\r\n" +
"\r\n" +
"\r\n" +
"// Libraries\r\n" +
"LIBRARY euser.lib\r\n" +
"DEBUGLIBRARY flogger.lib\r\n" +
"LIBRARY efsrv.lib\r\n" +
"LIBRARY estor.lib\r\n" +
"LIBRARY esock.lib\r\n" +
"";
String text1 = "#include <data_caging_paths.hrh>\r\n" +
"USERINCLUDE ..\\FeedsServer\\Client\\inc\r\n" +
"USERINCLUDE ..\\FeedsServer\\Common\\inc\r\n" +
"USERINCLUDE ..\\..\\inc\r\n" +
"\r\n" +
"#if 0\r\n" +
"MW_LAYER_SYSTEMINCLUDE\r\n" +
"#endif\r\n" +
"SYSTEMINCLUDE \\epoc32\\include\\oem \\epoc32\\include \\epoc32\\include\\middleware \\epoc32\\include\\domain\\middleware \\epoc32\\include\\osextensions \\epoc32\\include\\domain\\osextensions\r\n" +
"\r\n" +
"\r\n" +
"// Libraries\r\n" +
"LIBRARY euser.lib\r\n" +
"DEBUGLIBRARY flogger.lib\r\n" +
"LIBRARY efsrv.lib\r\n" +
"LIBRARY estor.lib\r\n" +
"LIBRARY esock.lib\r\n" +
"";
String text2 = "#include <data_caging_paths.hrh>\r\n" +
"USERINCLUDE ..\\FeedsServer\\Client\\inc\r\n" +
"USERINCLUDE ..\\FeedsServer\\Common\\inc\r\n" +
"USERINCLUDE ..\\..\\inc\r\n" +
"\r\n" +
"#if 0\r\n" +
"MW_LAYER_SYSTEMINCLUDE\r\n" +
"#endif\r\n" +
"SYSTEMINCLUDE \\epoc32\\include\\oem \\epoc32\\include\\middleware \\epoc32\\include\\domain\\middleware \\epoc32\\include\\osextensions \\epoc32\\include\\domain\\osextensions\r\n" +
"\r\n" +
"\r\n" +
"// Libraries\r\n" +
"LIBRARY euser.lib\r\n" +
"DEBUGLIBRARY flogger.lib\r\n" +
"LIBRARY efsrv.lib\r\n" +
"LIBRARY estor.lib\r\n" +
"LIBRARY esock.lib\r\n" +
"";
String text3 = "#include <data_caging_paths.hrh>\r\n" +
"USERINCLUDE ..\\FeedsServer\\Client\\inc\r\n" +
"USERINCLUDE ..\\FeedsServer\\Common\\inc\r\n" +
"USERINCLUDE ..\\..\\inc\r\n" +
"\r\n" +
"#if 0\r\n"+
"MW_LAYER_SYSTEMINCLUDE\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE \\epoc32\\include \\epoc32\\include\\oem \\epoc32\\include\\middleware \\epoc32\\include\\osextensions \\epoc32\\include\\domain\\osextensions\r\n" +
"\r\n" +
"\r\n" +
"// Libraries\r\n" +
"LIBRARY euser.lib\r\n" +
"DEBUGLIBRARY flogger.lib\r\n" +
"LIBRARY efsrv.lib\r\n" +
"LIBRARY estor.lib\r\n" +
"LIBRARY esock.lib\r\n" +
"";
String text4 = "#include <data_caging_paths.hrh>\r\n" +
"USERINCLUDE ..\\FeedsServer\\Client\\inc\r\n" +
"USERINCLUDE ..\\FeedsServer\\Common\\inc\r\n" +
"USERINCLUDE ..\\..\\inc\r\n" +
"\r\n" +
"#if 0\r\n"+
"MW_LAYER_SYSTEMINCLUDE\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE \\epoc32\\include \\epoc32\\include\\oem \\epoc32\\include\\middleware \\epoc32\\include\\domain\\middleware \\epoc32\\include\\osextensions\r\n" +
"\r\n" +
"\r\n" +
"// Libraries\r\n" +
"LIBRARY euser.lib\r\n" +
"DEBUGLIBRARY flogger.lib\r\n" +
"LIBRARY efsrv.lib\r\n" +
"LIBRARY estor.lib\r\n" +
"LIBRARY esock.lib\r\n" +
"";
String text5 = "#include <data_caging_paths.hrh>\r\n" +
"USERINCLUDE ..\\FeedsServer\\Client\\inc\r\n" +
"USERINCLUDE ..\\FeedsServer\\Common\\inc\r\n" +
"USERINCLUDE ..\\..\\inc\r\n" +
"\r\n" +
"#if 0\r\n"+
"MW_LAYER_SYSTEMINCLUDE\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE \\epoc32\\include \\epoc32\\foo \\epoc32\\include\\middleware \\epoc32\\include\\domain\\middleware \\epoc32\\include\\osextensions \\epoc32\\include\\domain\\osextensions\r\n" +
"\r\n" +
"\r\n" +
"// Libraries\r\n" +
"LIBRARY euser.lib\r\n" +
"DEBUGLIBRARY flogger.lib\r\n" +
"LIBRARY efsrv.lib\r\n" +
"LIBRARY estor.lib\r\n" +
"LIBRARY esock.lib\r\n" +
"";
parserConfig.getFilesystem().put("data_caging_paths.hrh",
header);
makeModel(text);
IMMPView view = getView(mmpConfig);
commitTest(view, text);
// move entry
makeModel(text);
view = getView(mmpConfig);
IPath p = view.getSystemIncludes().remove(1);
view.getSystemIncludes().add(0, p);
commitTest(view, text1);
// remove from start
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().remove(0);
commitTest(view, text2);
// remove from middle
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().remove(3);
commitTest(view, text3);
// remove from end
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().remove(5);
commitTest(view, text4);
// change in middle
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().set(1, new Path("/epoc32/foo"));
commitTest(view, text5);
}
public void testMacroMungingBug3700_2() {
String header = "#define MY_SYSTEM_INCLUDE \\epoc32\\foo\n";
String text = "#include <data_caging_paths.hrh>\r\n" +
"SYSTEMINCLUDE \\epoc32\\include MY_SYSTEM_INCLUDE ..\\src\r\n" +
"";
// can't avoid the #if 0 yet
String text2 = "#include <data_caging_paths.hrh>\r\n" +
"#if 0\r\n"+
"SYSTEMINCLUDE \\epoc32\\include MY_SYSTEM_INCLUDE ..\\src\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE \\epoc32\\include MY_SYSTEM_INCLUDE ..\\src ..\\inc\r\n" +
"";
String text3 = "#include <data_caging_paths.hrh>\r\n" +
"#if 0\r\n"+
"SYSTEMINCLUDE \\epoc32\\include MY_SYSTEM_INCLUDE ..\\src\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE MY_SYSTEM_INCLUDE ..\\src\r\n" +
"";
String text4 = "#include <data_caging_paths.hrh>\r\n" +
"#if 0\r\n"+
"SYSTEMINCLUDE \\epoc32\\include MY_SYSTEM_INCLUDE ..\\src\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE \\epoc32\\include \\epoc32\\arglebargle ..\\src\r\n" +
"";
parserConfig.getFilesystem().put("data_caging_paths.hrh",
header);
makeModel(text);
IMMPView view = getView(mmpConfig);
commitTest(view, text);
// add to end
view.getSystemIncludes().add(new Path("inc"));
commitTest(view, text2);
// remove from start
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().remove(0);
commitTest(view, text3);
// change
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().set(1, new Path("/epoc32/arglebargle"));
commitTest(view, text4);
}
public void testMacroMungingBug3700_3() {
String header = "#define MY_SYSTEM_INCLUDE SYSTEMINCLUDE \\epoc32\\foo\n";
String text = "#include <data_caging_paths.hrh>\r\n" +
"MY_SYSTEM_INCLUDE ..\\src\r\n" +
"";
// can't avoid the #if 0 yet
// don't try to preserve MY_SYSTEM_INCLUDE yet... too weird when it spans one child and part of parent
String text2 = "#include <data_caging_paths.hrh>\r\n" +
"#if 0\r\n"+
"MY_SYSTEM_INCLUDE ..\\src\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE \\epoc32\\foo ..\\src ..\\inc\r\n" +
"";
String text3 = "#include <data_caging_paths.hrh>\r\n" +
"#if 0\r\n"+
"MY_SYSTEM_INCLUDE ..\\src\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE ..\\src\r\n" +
"";
String text4 = "#include <data_caging_paths.hrh>\r\n" +
"#if 0\r\n"+
"MY_SYSTEM_INCLUDE ..\\src\r\n" +
"#endif\r\n"+
"SYSTEMINCLUDE \\epoc32\\foo \\epoc32\\arglebargle\r\n" +
"";
parserConfig.getFilesystem().put("data_caging_paths.hrh",
header);
makeModel(text);
IMMPView view = getView(mmpConfig);
commitTest(view, text);
// add to end
view.getSystemIncludes().add(new Path("inc"));
commitTest(view, text2);
// remove from start
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().remove(0);
commitTest(view, text3);
// change
makeModel(text);
view = getView(mmpConfig);
view.getSystemIncludes().set(1, new Path("/epoc32/arglebargle"));
commitTest(view, text4);
}
public void testBug3765() {
String text =
"UID 0x2 0x3\n"
;
makeModel(text);
IMMPView view = getView(mmpConfig);
checkNoProblems(view);
view.setUid2(null);
String text2=
"UID 0 0x3\n"
;
commitTest(view, text2);
}
public void testReorderInList() {
String text =
"SOURCE a.cpp b.cpp c.cpp\n"
;
makeModel(text);
IMMPView view = getView(mmpConfig);
checkNoProblems(view);
IPath first = view.getSources().remove(0);
view.getSources().add(first);
String text2=
"SOURCE b.cpp c.cpp a.cpp\n";
;
commitTest(view, text2);
}
public void testBug4822() {
String text =
"#define concat2(a,b) concatx(a,b,,,,,,)\r\n" +
"#define concat3(a,b,c) concatx(a,b,c,,,,,)\r\n" +
"#define concat4(a,b,c,d) concatx(a,b,c,d,,,,)\r\n" +
"#define concat5(a,b,c,d,e) concatx(a,b,c,d,e,,,)\r\n" +
"#define concat6(a,b,c,d,e,f) concatx(a,b,c,d,e,f,,)\r\n" +
"#define concat7(a,b,c,d,e,f,g) concatx(a,b,c,d,e,f,g,)\r\n" +
"#define concat8(a,b,c,d,e,f,g,h) concatx(a,b,c,d,e,f,g,h)\r\n" +
"#define concatx(x1,x2,x3,x4,x5,x6,x7,x8) x1 ## x2 ## x3 ## x4 ## x5 ## x6 ## x7 ## x8 \r\n" +
"#define AbsPathUnderCedarGenericBase(x) \\src\\cedar\\generic\\base ## x\r\n" +
"SYSTEMINCLUDE AbsPathUnderCedarGenericBase(\\e32\\drivers\\pbus\\mmc\\sdcard\\sdcard3c)\n";
makeModel(text);
IMMPView view = getView(mmpConfig);
checkNoProblems(view);
IPath path = view.getSystemIncludes().get(0);
assertEquals(new Path("/src/cedar/generic/base/e32/drivers/pbus/mmc/sdcard/sdcard3c"),
path);
}
}
| true
|
cfc40b604a70c5f37255264fe0adea7395186243
|
Java
|
DTLink92/test-Backend
|
/src/main/java/com/dh/spring5webapp/repositories/ProjectRepository.java
|
UTF-8
| 224
| 1.664063
| 2
|
[] |
no_license
|
package com.dh.spring5webapp.repositories;
import com.dh.spring5webapp.model.Project;
import org.springframework.data.repository.CrudRepository;
public interface ProjectRepository extends CrudRepository<Project, Long> {
}
| true
|
bd4c486a40394cb3343f1452abd46598909c0cc2
|
Java
|
spinscale/talk-elasticsearch-security-manager-and-seccomp
|
/src/main/java/de/spinscale/security/samples/SecurityManagerSamples.java
|
UTF-8
| 1,882
| 2.671875
| 3
|
[
"Apache-2.0"
] |
permissive
|
package de.spinscale.security.samples;
import java.io.FilePermission;
import java.lang.reflect.ReflectPermission;
import java.net.SocketPermission;
import java.security.Permission;
import java.security.Policy;
import java.security.ProtectionDomain;
public class SecurityManagerSamples {
public static void main(String[] args) throws Exception {
Policy.setPolicy(new CustomPolicy(
// samples 1-3
new ReflectPermission("suppressAccessChecks"),
new RuntimePermission("accessDeclaredMembers"),
// Sample 3
new RuntimePermission("accessClassInPackage.sun.misc"),
// sample 4
new SocketPermission("localhost", "resolve,connect"),
new SocketPermission("127.0.0.1:9999", "resolve,connect"),
new FilePermission("/etc/passwd", "read"),
// sample 5
new FilePermission( "/bin/ls", "execute")
));
System.setSecurityManager(new SecurityManager());
Sample01.main(new String[0]);
Sample02.main(new String[0]);
Sample03.main(new String[0]);
Sample04.main(new String[0]);
Sample05.main(new String[0]);
}
public static final class CustomPolicy extends Policy {
private final Permission[] permissions;
CustomPolicy(Permission ... permissions) {
this.permissions = permissions;
}
@Override
public boolean implies(final ProtectionDomain domain, final Permission permission) {
for (Permission p : permissions) {
if (p.getName().equals(permission.getName()) &&
p.getClass().getName().equals(permission.getClass().getName())) {
return true;
}
}
return false;
}
}
}
| true
|
789d0dedaf91a084ccae56c54e97f710decaacad
|
Java
|
natrid/BikeHours
|
/LogEntry.java
|
UTF-8
| 753
| 3.09375
| 3
|
[] |
no_license
|
package com.daniel.bikehours;
public class LogEntry {
long time = 0;
String location = "";
int ridingTime = 0;
public LogEntry(long time, String location, int ridingTime){
this.time = time;
this.location = location;
this.ridingTime = ridingTime;
}
public LogEntry(String data){
String[] table = data.split(";");
this.time = Long.parseLong(table[0]);
this.location = table[1];
this.ridingTime = Integer.parseInt(table[2]);
}
public long getTime() { return time; }
public String getLocation() { return location; }
public int getRidingTime() { return ridingTime; }
public String getData(){
return time+";"+location+";"+ridingTime;
}
}
| true
|
71c3de51bd783643080746c0b3476be9aa9949ab
|
Java
|
Jevford/INF-122-Final-Project
|
/player/src/player/Multiplayer.java
|
UTF-8
| 2,494
| 3.21875
| 3
|
[] |
no_license
|
package player;
public class Multiplayer {
Player player1;
Player player2;
Player currentPlayer;
boolean player1GameActive;
boolean player2GameActive;
public Multiplayer () {
player1 = new Player();
player2 = new Player();
currentPlayer = player1;
player1GameActive = true;
player2GameActive = false;
}
public Multiplayer (boolean active) {
player1 = new Player();
player2 = new Player();
currentPlayer = player1;
player2GameActive = active;
}
public Player getCurrentPlayer() {
return currentPlayer;
}
public void setCurrentPlayer(Player currentPlayer) {
this.currentPlayer = currentPlayer;
}
public Player getPlayer1() {
return player1;
}
public void setPlayer1(Player player1) {
this.player1 = player1;
}
public Player getPlayer2() {
return player2;
}
public void setPlayer2(Player player2) {
this.player2 = player2;
}
public void switchPlayer () {
if(currentPlayer == player1) currentPlayer = player2;
else currentPlayer = player1;
}
public boolean isPlayer1GameActive() {
return player1GameActive;
}
public void setPlayer1GameActive(boolean player1GameActive) {
this.player1GameActive = player1GameActive;
}
public boolean isPlayer2GameActive() {
return player2GameActive;
}
public void setPlayer2GameActive(boolean player2GameActive) {
this.player2GameActive = player2GameActive;
}
public boolean isPlayer1 () {
return currentPlayer == player1;
}
public int getPlayer1HighScore () {
return player1.getHighScore();
}
public int getPlayer2HighScore () {
return player2.getHighScore();
}
public void setPlayer1HighScore (int score) {
player1.setHighScore(score);
}
public void setPlayer2HighScore (int score) {
player2.setHighScore(score);
}
public boolean isGameActive() {
return (isPlayer1GameActive() || isPlayer2GameActive());
}
public void setCurrentPlayerHighScore (int score ) {
currentPlayer.setHighScore(score);
}
public int getCurrentPlayerHighScore () {
return currentPlayer.getHighScore();
}
public void switchActiveGame() {
if(player2GameActive) player2GameActive = false;
else player2GameActive = true;
}
}
| true
|
5b930b5027187e1bfe93a3d10e3ef7c3d4aa4a2f
|
Java
|
ILYOZZZZ/duoNotaryPractiseApp
|
/app-duonotarypraktika-server/src/main/java/uz/pdp/appduonotarypraktikaserver/controller/team3Controller/DocAmountPricingController.java
|
UTF-8
| 2,044
| 2.203125
| 2
|
[] |
no_license
|
package uz.pdp.appduonotarypraktikaserver.controller.team3Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import uz.pdp.appduonotarypraktikaserver.payload.ApiResponse;
import uz.pdp.appduonotarypraktikaserver.payload.ReqDocAmountPricing;
import uz.pdp.appduonotarypraktikaserver.service.team3Servıce.DocAmountPricingService;
import java.util.UUID;
@RestController
@RequestMapping("api/docAmountPricing")
public class DocAmountPricingController {
@Autowired
DocAmountPricingService docAmountPricingService;
@GetMapping
public HttpEntity<?> getDocAmountPricing(@RequestParam Integer page,@RequestParam Integer size){
ApiResponse apiResponse=docAmountPricingService.getDocAmountPricing(page,size);
return ResponseEntity.status(apiResponse.isSuccess()? HttpStatus.OK:HttpStatus.CONFLICT).body(apiResponse);
}
@PostMapping
public HttpEntity<?> saveDocAmountPricing(@RequestBody ReqDocAmountPricing reqDocAmountPricing){
ApiResponse apiResponse=docAmountPricingService.saveDocAmountPricing(reqDocAmountPricing);
return ResponseEntity.status(apiResponse.isSuccess()?HttpStatus.OK:HttpStatus.CONFLICT).body(apiResponse);
}
@PutMapping
public HttpEntity<?> editDocAmountPricing(@RequestBody ReqDocAmountPricing reqDocAmountPricing){
ApiResponse apiResponse=docAmountPricingService.editDocAmountPricing(reqDocAmountPricing);
return ResponseEntity.status(apiResponse.isSuccess()?HttpStatus.OK:HttpStatus.CONFLICT).body(apiResponse);
}
@DeleteMapping("{id}")
public HttpEntity<?> deleteDocAmountPricing(@PathVariable UUID id){
ApiResponse apiResponse=docAmountPricingService.deleteDocAmountPricing(id);
return ResponseEntity.status(apiResponse.isSuccess()?HttpStatus.OK:HttpStatus.CONFLICT).body(apiResponse);
}
}
| true
|
ee574d78b50ecf5d34996e134004ba45863ee074
|
Java
|
infinitechnic/horse-racing-data-extraction
|
/src/main/java/com/infinitechnic/horseracing/data/hkjc/service/race/history/biz/ExtractRaceResultImpl.java
|
UTF-8
| 8,091
| 2.28125
| 2
|
[] |
no_license
|
package com.infinitechnic.horseracing.data.hkjc.service.race.history.biz;
import com.infinitechnic.horseracing.data.hkjc.entity.horse.Horse;
import com.infinitechnic.horseracing.data.hkjc.entity.jockey.Jockey;
import com.infinitechnic.horseracing.data.hkjc.entity.race.history.RaceResult;
import com.infinitechnic.horseracing.data.hkjc.entity.race.history.ResultRecord;
import com.infinitechnic.horseracing.data.hkjc.entity.trainer.Trainer;
import com.infinitechnic.horseracing.data.hkjc.exception.ServiceFailureException;
import com.infinitechnic.horseracing.data.hkjc.exception.ServiceRenderException;
import com.infinitechnic.util.DateUtil;
import com.infinitechnic.util.StringUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Deprecated
//@Service
public class ExtractRaceResultImpl implements ExtractRaceResult {
@Override
public RaceResult render(Date raceDate, String venue, Integer raceNumber) throws ServiceRenderException, ServiceFailureException {
RaceResult raceResult = null;
try {
Document doc = Jsoup.connect(StringUtil.concat("http://racing.hkjc.com/racing/Info/Meeting/Results/English/Local/", DateUtil.format(raceDate, "yyyyMMdd"), "/", venue, "/", StringUtil.toString(raceNumber))).get();
Elements elements = doc.select("div.clearDivFloat.rowDiv15 table.draggable");
Assert.isTrue(elements.size() == 1);
if (elements.size() == 1) {
parseHtml(raceResult = new RaceResult(raceDate, raceNumber), elements.get(0));
}
} catch (IOException ioe) {
throw new ServiceFailureException(ioe);
}
return raceResult;
}
private void parseHtml(RaceResult raceResult, Element element) {
element.select("tbody tr.trBgGrey,tr.trBgWhite").forEach(tr -> {
ResultRecord resultRecord = toResultRecord(tr);
if (resultRecord != null) {
raceResult.getResultRecords().add(resultRecord);
}
});
}
private ResultRecord toResultRecord(Element element) {
Elements elements = element.select("td[nowrap]");
ResultRecord resultRecord = null;
if (elements.size() == 12) {
String place = elements.get(0).html();
String horseNo = elements.get(1).html();
// Horse
// System.out.println(elements.get(2).html());
Horse horse = extractHorseProfile(elements.get(2));
String horseId = horse.getId();
String horseName = horse.getName();
// Jockey
// System.out.println(elements.get(3).html());
Jockey jockey = extractJockeyProfile(elements.get(3));
String jockeyId = jockey.getId();
String jockeyName = jockey.getName();
// Trainer
// System.out.println(elements.get(4).html());
Trainer trainer = extractTrainerProfile(elements.get(4));
String trainerId = trainer.getId();
String trainerName = trainer.getName();
String actualWeight = elements.get(5).html();
String horseWeight = elements.get(6).html();
String draw = elements.get(7).html();
String lbw = elements.get(8).html();
List<Integer> runningPositions = extractRunningPositions(elements.get(9));
String finishTime = elements.get(10).html();
String winOdds = elements.get(11).html();
resultRecord = new ResultRecord();
resultRecord.setPlace(place);
resultRecord.setHorseNo(horseNo);
resultRecord.setHorse(horse);
resultRecord.setJockey(jockey);
resultRecord.setTrainer(trainer);
resultRecord.setActualWeight(actualWeight);
resultRecord.setHorseWeight(horseWeight);
resultRecord.setDraw(draw);
resultRecord.setLbw(lbw);
resultRecord.getRunningPositions().addAll(runningPositions);
resultRecord.setFinishTime(finishTime);
resultRecord.setWinOdds(winOdds);
}
return resultRecord;
/*
System.out.println("---------------------------------");
System.out.println("place: " + place);
System.out.println("horseNo: " + horseNo);
System.out.println("horseId: " + horseId);
System.out.println("horseName: " + horseName);
System.out.println("jockeyId: " + jockeyId);
System.out.println("jockeyName: " + jockeyName);
System.out.println("trainerId: " + trainerId);
System.out.println("trainerName: " + trainerName);
System.out.println("actualWeight: " + actualWeight);
System.out.println("horseWeight: " + horseWeight);
System.out.println("draw: " + draw);
System.out.println("lbw: " + lbw);
System.out.println("runningPositions: " + runningPositions);
System.out.println("finishTime: " + finishTime);
System.out.println("winOdds: " + winOdds);
*/
}
public Horse extractHorseProfile(Element element) {
//TODO: Retrieve if exist else create a new one
Horse horse = new Horse();
String lineRegExp = "^<a href=\"(.+)\">(.+)</a>\\((.+)\\)$";
Pattern linePattern = Pattern.compile(lineRegExp);
//Matcher lineMatcher = pattern.matcher("<a href=\"http://www.hkjc.com/english/racing/horse.asp?horseno=P227\">FUNNY FORTUNE</a>(P227)");
Matcher lineMatcher = linePattern.matcher(element.html());
// Assert.assertTrue(lineMatcher.matches());
if (lineMatcher.matches()) {
//System.out.println(matcher.group(1));
horse.setName(lineMatcher.group(2));
horse.setId(lineMatcher.group(3));
}
return horse;
}
public Jockey extractJockeyProfile(Element element) {
//TODO: Retrieve if exist else create a new one
Jockey jockey = new Jockey();
String lineRegExp = "^<a href=\"(.+)\">(.+)</a>$";
String hrefRegExp = "^.+jockeycode=(.+)&.+$";
Pattern linePattern = Pattern.compile(lineRegExp);
Pattern hrefPattern = Pattern.compile(hrefRegExp);
Matcher lineMatcher = linePattern.matcher(element.html());
// Assert.assertTrue(lineMatcher.matches());
if (lineMatcher.matches()) {
jockey.setName(lineMatcher.group(2));
Matcher hrefMatcher = hrefPattern.matcher(lineMatcher.group(1));
// Assert.assertTrue(hrefMatcher.matches());
if(hrefMatcher.matches()) {
jockey.setId(hrefMatcher.group(1));
}
}
return jockey;
}
public Trainer extractTrainerProfile(Element element) {
//TODO: Retrieve if exist else create a new one
Trainer trainer = new Trainer();
String lineRegExp = "^<a href=\"(.+)\">(.+)</a>$";
String hrefRegExp = "^.+trainercode=(.+)&.+$";
Pattern linePattern = Pattern.compile(lineRegExp);
Pattern hrefPattern = Pattern.compile(hrefRegExp);
Matcher lineMatcher = linePattern.matcher(element.html());
// Assert.assertTrue(lineMatcher.matches());
if (lineMatcher.matches()) {
trainer.setName(lineMatcher.group(2));
Matcher hrefMatcher = hrefPattern.matcher(lineMatcher.group(1));
// Assert.assertTrue(hrefMatcher.matches());
if(hrefMatcher.matches()) {
trainer.setId(hrefMatcher.group(1));
}
}
return trainer;
}
private List<Integer> extractRunningPositions(Element element) {
return element.select("tr td").stream().map(td -> Integer.parseInt(td.html())).collect(Collectors.toList());
}
}
| true
|
38e0ca1158a28210d6a3e00be5a8b8431ec43daf
|
Java
|
wx409475835/MyEclipseWorkSpace
|
/LibraryManager2/src/com/dw/dao/BorrowDao.java
|
GB18030
| 542
| 1.9375
| 2
|
[] |
no_license
|
package com.dw.dao;
/**
* ݷʲ㣬ѧϢCRUD
* @author DY1101shaoyuxian
*/
import java.util.List;
import com.dw.model.Book;
import com.dw.model.Borrow;
public interface BorrowDao {
//public Book findBookByid(int id);
public int borrowBook(String name,int id);
//public boolean updateBook(Book stu);
//@SuppressWarnings("unchecked")
//public List StSelect();
public boolean backBook(String name,int id);
public List bbListSelect();
public List brListSelect(String username);
}
| true
|
ed6fa1f50188e0219c9d2fdbdd26cf7a80c3d97a
|
Java
|
ibrahimAboelsuod/Bubbly
|
/app/src/main/java/com/example/mazonna/bubbly/NewExam.java
|
UTF-8
| 2,319
| 1.914063
| 2
|
[] |
no_license
|
package com.example.mazonna.bubbly;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
public class NewExam extends AppCompatActivity {
public static final int request_capture =1;
ImageView result_photo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_exam);
Button click = (Button) findViewById(R.id.btnAddScan);
result_photo= (ImageView)findViewById(R.id.imageView);
if(!hasCamera())
{
click.setEnabled(false);
}
}
public boolean hasCamera()
{
return getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
}
public void lanchCamera(View v)
{
Intent i = new Intent (MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, request_capture);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == request_capture && resultCode==RESULT_OK)
{
Bundle extras = data.getExtras();
Bitmap photo =(Bitmap)extras.get("data");
result_photo.setImageBitmap(photo);
}
}
public void onCorrect (View v) {
EditText ed = (EditText) findViewById(R.id.edtxtSubjectName);
String S = ed.getText().toString();
if (S.matches("")) {
Toast toast = Toast.makeText(getApplicationContext(), "Enter Subject name", Toast.LENGTH_LONG);
toast.show();
} else {
Intent i = new Intent(getApplicationContext(), GradesSheet.class);
startActivity(i);
}
}
private static final int EDIT_REQUEST_CODE = 44;
public void onSet (View v){
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/plain");
startActivityForResult(intent, EDIT_REQUEST_CODE);
}
}
| true
|
c81c5c7ae6b51b9f7ec04d4d1f26e5b6f9fbe7f1
|
Java
|
dualtete/Du_An_1
|
/src/GUI/frmLogin.java
|
UTF-8
| 14,661
| 1.90625
| 2
|
[] |
no_license
|
/*
* 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 GUI;
import java.awt.Color;
import javax.swing.JOptionPane;
import GUI.frmMain;
import javax.swing.ImageIcon;
/**
*
* @author Admin
*/
public class frmLogin extends javax.swing.JFrame {
Color buttondefault;
public frmLogin() {
initComponents();
this.getRootPane().setDefaultButton(btnSignup);
buttondefault = new Color(0, 102, 153);
btnSignup.setBackground(buttondefault);
show.setVisible(true);
show.setEnabled(true);
dis.setVisible(false);
dis.setEnabled(false);
}
/**
* 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() {
pnlTong = new javax.swing.JPanel();
pnlRight = new javax.swing.JPanel();
btnSignup = new javax.swing.JButton();
lblPass = new javax.swing.JLabel();
sptMatKhau = new javax.swing.JSeparator();
txtName = new javax.swing.JTextField();
lblThoat = new javax.swing.JLabel();
sptTenDN = new javax.swing.JSeparator();
txtPass = new javax.swing.JPasswordField();
lblName = new javax.swing.JLabel();
ckbRemember = new javax.swing.JCheckBox();
lblForget = new javax.swing.JLabel();
lblUser = new javax.swing.JLabel();
dis = new javax.swing.JLabel();
show = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
lblLogo = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setLocationByPlatform(true);
setUndecorated(true);
pnlTong.setBackground(new java.awt.Color(255, 255, 255));
pnlTong.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
pnlRight.setBackground(new java.awt.Color(255, 255, 255));
pnlRight.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
btnSignup.setBackground(new java.awt.Color(0, 102, 153));
btnSignup.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btnSignup.setForeground(new java.awt.Color(255, 255, 255));
btnSignup.setText("ĐĂNG NHẬP");
btnSignup.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
btnSignup.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSignupActionPerformed(evt);
}
});
pnlRight.add(btnSignup, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 400, 310, 40));
lblPass.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
lblPass.setForeground(new java.awt.Color(51, 51, 51));
lblPass.setText("MẬT KHẨU");
pnlRight.add(lblPass, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 250, 90, -1));
pnlRight.add(sptMatKhau, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 320, 310, -1));
txtName.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
txtName.setForeground(new java.awt.Color(51, 51, 51));
txtName.setText("ADMIN");
txtName.setBorder(null);
txtName.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtNameFocusGained(evt);
}
});
txtName.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtNameMouseClicked(evt);
}
});
txtName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNameActionPerformed(evt);
}
});
pnlRight.add(txtName, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 190, 310, 30));
lblThoat.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
lblThoat.setForeground(new java.awt.Color(204, 204, 0));
lblThoat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8_delete_sign_30px_1.png"))); // NOI18N
lblThoat.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
lblThoatMouseClicked(evt);
}
});
pnlRight.add(lblThoat, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 0, 30, 30));
pnlRight.add(sptTenDN, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 230, 310, -1));
txtPass.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
txtPass.setForeground(new java.awt.Color(51, 51, 51));
txtPass.setHorizontalAlignment(javax.swing.JTextField.LEFT);
txtPass.setText("admin");
txtPass.setBorder(null);
txtPass.setEchoChar((char)8226);
txtPass.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtPassFocusGained(evt);
}
});
txtPass.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtPassMouseClicked(evt);
}
});
pnlRight.add(txtPass, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 280, 260, 30));
lblName.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
lblName.setForeground(new java.awt.Color(0, 102, 153));
lblName.setText("TÊN ĐĂNG NHẬP");
pnlRight.add(lblName, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 160, 160, -1));
ckbRemember.setBackground(new java.awt.Color(255, 255, 255));
ckbRemember.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
ckbRemember.setForeground(new java.awt.Color(51, 51, 51));
ckbRemember.setSelected(true);
ckbRemember.setText("Ghi Nhớ");
pnlRight.add(ckbRemember, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 350, -1, 20));
lblForget.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
lblForget.setForeground(new java.awt.Color(51, 51, 51));
lblForget.setText("Quên Mật Khẩu");
pnlRight.add(lblForget, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 350, -1, 20));
lblUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8_user_male_circle_100px.png"))); // NOI18N
pnlRight.add(lblUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 30, -1, -1));
dis.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8_visible_25px.png"))); // NOI18N
dis.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
disMouseClicked(evt);
}
});
pnlRight.add(dis, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 280, -1, 40));
show.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8_hide_25px.png"))); // NOI18N
show.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
showMouseClicked(evt);
}
});
pnlRight.add(show, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 280, -1, 40));
pnlTong.add(pnlRight, new org.netbeans.lib.awtextra.AbsoluteConstraints(505, 0, 475, 500));
jLabel4.setBackground(new java.awt.Color(1, 91, 126));
jLabel4.setFont(new java.awt.Font("Dosis", 3, 14)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("dienmayvituan.vn");
jLabel4.setOpaque(true);
pnlTong.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 450, 160, 40));
lblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Untitled-1.png"))); // NOI18N
pnlTong.add(lblLogo, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 510, -1));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnlTong, javax.swing.GroupLayout.PREFERRED_SIZE, 1002, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnlTong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void txtPassMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtPassMouseClicked
//txtPass.setText("");
}//GEN-LAST:event_txtPassMouseClicked
private void txtPassFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtPassFocusGained
lblPass.setForeground(new Color(0, 102, 153));
lblName.setForeground(new Color(51, 51, 51));
txtPass.setForeground(new Color(0, 102, 153));
txtName.setForeground(new Color(51, 51, 51));
// sptMatKhau.setBackground(new Color(204, 204, 0));
// sptTenDN.setBackground(new Color(204, 204, 255));
}//GEN-LAST:event_txtPassFocusGained
private void lblThoatMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblThoatMouseClicked
int nutBam = JOptionPane.showConfirmDialog(this, "Bạn có chắc chắn muốn thoát không", "Xác nhận thoát chương trình", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (nutBam == JOptionPane.OK_OPTION) {
System.exit(0);
}
}//GEN-LAST:event_lblThoatMouseClicked
private void txtNameMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtNameMouseClicked
//txtName.setText("");
}//GEN-LAST:event_txtNameMouseClicked
private void txtNameFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNameFocusGained
lblName.setForeground(new Color(0, 102, 153));
lblPass.setForeground(new Color(51, 51, 51));
txtName.setForeground(new Color(0, 102, 153));
txtPass.setForeground(new Color(51, 51, 51));
sptTenDN.setForeground(new Color(0, 102, 153));
// sptMatKhau.setBackground(new Color(204,204,255));
}//GEN-LAST:event_txtNameFocusGained
private void btnSignupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSignupActionPerformed
this.dispose();
frmMain frm = new frmMain();
frm.setVisible(true);
}//GEN-LAST:event_btnSignupActionPerformed
private void disMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_disMouseClicked
show.setVisible(true);
show.setEnabled(true);
txtPass.setEchoChar((char)8226);
dis.setVisible(false);
dis.setEnabled(false);
}//GEN-LAST:event_disMouseClicked
private void showMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_showMouseClicked
dis.setVisible(true);
dis.setEnabled(true);
txtPass.setEchoChar((char)0);
show.setVisible(false);
show.setEnabled(false);
}//GEN-LAST:event_showMouseClicked
private void txtNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtNameActionPerformed
/**
* @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(frmLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmLogin.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 frmLogin().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnSignup;
private javax.swing.JCheckBox ckbRemember;
private javax.swing.JLabel dis;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel lblForget;
private javax.swing.JLabel lblLogo;
private javax.swing.JLabel lblName;
private javax.swing.JLabel lblPass;
private javax.swing.JLabel lblThoat;
private javax.swing.JLabel lblUser;
private javax.swing.JPanel pnlRight;
private javax.swing.JPanel pnlTong;
private javax.swing.JLabel show;
private javax.swing.JSeparator sptMatKhau;
private javax.swing.JSeparator sptTenDN;
private javax.swing.JTextField txtName;
private javax.swing.JPasswordField txtPass;
// End of variables declaration//GEN-END:variables
}
| true
|
0a1d3f9468f73f10609d023cd556fabdd81b3087
|
Java
|
HernerAttila/FollowYou
|
/app/src/main/java/com/example/torpe/teszt/TrackGPS.java
|
UTF-8
| 4,306
| 2.03125
| 2
|
[] |
no_license
|
package com.example.torpe.teszt;
/**
* Location imports
*/
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
/**
* Service imports
*/
import android.app.Service;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
/**
* Created by Torpe on 2017. 02. 19..
*/
public class TrackGPS extends Service implements LocationListener {
/**
*
*/
boolean checkGPS = false;
boolean checkNetwork = false;
// boolean mobileConnected = false;
// boolean wifiConnected = false;
boolean canGetLocation = false;
final private int RequestLocationAcces = 1;
Location loc;
LocationManager locManager;
double latitude;
double longitude;
public TrackGPS() {
locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
// if (Build.VERSION.SDK_INT >= 23) {
// check_permission();
// }
}
// private void check_permission() {
// if (ActivityCompat.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)
// == PackageManager.PERMISSION_GRANTED) {
// canGetLocation = true;
// start_gps();
// } else {
// ActivityCompat.requestPermissions(this,
// new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
// RequestLocationAcces);
// }
// }
// @Override
// public void onRequestPermissionsResult(int requestCode,
// String permissions[], int[] grantResults) {
// switch (requestCode) {
// case RequestLocationAcces: {
// // If request is cancelled, the result arrays are empty.
// if (grantResults.length > 0
// && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//
// // permission was granted, yay! Do the
// // contacts-related task you need to do.
// canGetLocation = true;
// start_gps();
//
// } else {
//
// // permission denied, boo! Disable the
// // functionality that depends on this permission.
// canGetLocation = false;
// }
// return;
// }
//
// // other 'case' lines to check for other
// // permissions this app might request
// }
// }
// private void checkNetworkConnection() {
// ConnectivityManager connMgr =
// (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
// NetworkInfo activeInfo = connMgr.getActiveNetworkInfo();
// if (activeInfo != null && activeInfo.isConnected()) {
// wifiConnected = activeInfo.getType() == ConnectivityManager.TYPE_WIFI;
// mobileConnected = activeInfo.getType() == ConnectivityManager.TYPE_MOBILE;
// if(wifiConnected) {
// Log.i(TAG, getString(R.string.wifi_connection));
// } else if (mobileConnected){
// Log.i(TAG, getString(R.string.mobile_connection));
// }
// } else {
// Log.i(TAG, getString(R.string.no_wifi_or_mobile));
// }
// }
// void start_gps() {
// locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
// }
public double getLongitude() {
if (loc != null) {
longitude = loc.getLongitude();
}
return longitude;
}
public double getLatitude() {
if (loc != null) {
latitude = loc.getLatitude();
}
return latitude;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onLocationChanged(Location location) {
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override
public void onProviderEnabled(String s) {
}
@Override
public void onProviderDisabled(String s) {
}
}
| true
|
ac532b6bac3b5718d1740b691c0251b6f826339e
|
Java
|
DVdiego/cines
|
/cinesgrupo6/src/main/java/com/pse/cine/json/MovieWriter.java
|
UTF-8
| 1,682
| 2.484375
| 2
|
[] |
no_license
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.pse.cine.json;
import com.pse.cines.entities.Movie;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.json.Json;
import javax.json.stream.JsonGenerator;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
/**
*
* @author Home
*/
@Provider
@Produces(MediaType.APPLICATION_JSON)
public class MovieWriter implements MessageBodyWriter<Movie> {
@Override
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return Movie.class.isAssignableFrom(type);
}
@Override
public long getSize(Movie t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return -1;
}
@Override
public void writeTo(Movie t, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException,
WebApplicationException {
JsonGenerator gen = Json.createGenerator(entityStream);
gen.writeStartObject()
.write("id", t.getId()).write("name", t.getName()).write("actors", t.getActors()).writeEnd();
gen.flush();
}
}
| true
|
660422389442cb4c7791a341e20af75d13a3a09a
|
Java
|
hmatida/BEPF
|
/src/main/java/br/com/personal_financee/pf/PfApplication.java
|
UTF-8
| 2,214
| 2.15625
| 2
|
[] |
no_license
|
package br.com.personal_financee.pf;
import br.com.personal_financee.pf.models.ProfileEnum;
import br.com.personal_financee.pf.models.Users;
import br.com.personal_financee.pf.repositories.UserRepository;
import br.com.personal_financee.pf.utility.SendEmailBeforeVcto;
import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.password.PasswordEncoder;
@SpringBootApplication
public class PfApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(PfApplication.class, args);
}
@Bean
CommandLineRunner init(UserRepository userRepository, PasswordEncoder passwordEncoder){
return args -> {
initUser(userRepository, passwordEncoder);
initQuartzJob();
};
}
private void initUser(UserRepository userRepository, PasswordEncoder passwordEncoder){
Users admin = new Users();
admin.setLogin("admin");
admin.setPassword(passwordEncoder.encode("ZQwJDS956"));
admin.setProfileEnum(ProfileEnum.ROLE_ADMIN);
Users find = userRepository.findByLogin(admin.getLogin());
if (find == null){
userRepository.save(admin);
}
}
private void initQuartzJob() {
SchedulerFactory shedFact = new StdSchedulerFactory();
try {
Scheduler scheduler = shedFact.getScheduler();
scheduler.start();
JobBuilder jobBuilder = JobBuilder.newJob(SendEmailBeforeVcto.class);
jobBuilder.withIdentity("validadorJOB", "grupo01");
JobDetail job = jobBuilder.build();
Trigger trigger = TriggerBuilder.newTrigger()
.withIdentity("validadorTRIGGER", "grupo01")
.withSchedule(CronScheduleBuilder.cronSchedule("0 30 8 * * ?"))
.build();
scheduler.scheduleJob(job, trigger);
System.out.println("------------Trigger de e-mail em execução------------");
} catch (SchedulerException e1) {
e1.printStackTrace();
}
}
}
| true
|
783fa4a93c7537cbd0df96b218883922cb612bc9
|
Java
|
ihmcrobotics/ihmc-open-robotics-software
|
/example-simulations/src/main/java/us/ihmc/exampleSimulations/omniWrist/OmniWristController.java
|
UTF-8
| 3,370
| 2.21875
| 2
|
[
"Apache-2.0"
] |
permissive
|
package us.ihmc.exampleSimulations.omniWrist;
import us.ihmc.robotics.controllers.PDController;
import us.ihmc.yoVariables.registry.YoRegistry;
import us.ihmc.yoVariables.variable.YoDouble;
import us.ihmc.robotics.math.functionGenerator.YoFunctionGenerator;
import us.ihmc.robotics.math.functionGenerator.YoFunctionGeneratorMode;
import us.ihmc.simulationconstructionset.PinJoint;
import us.ihmc.simulationconstructionset.Robot;
import us.ihmc.simulationconstructionset.util.RobotController;
public class OmniWristController implements RobotController
{
private final YoRegistry registry = new YoRegistry(getClass().getSimpleName());
private final PDController pdControllerA, pdControllerB;
private final YoDouble q_d_jointOneA = new YoDouble("q_d_jointOneA", registry);
private final YoDouble q_d_jointOneB = new YoDouble("q_d_jointOneB", registry);
private final YoDouble qd_d_jointOneA = new YoDouble("qd_d_jointOneA", registry);
private final YoDouble qd_d_jointOneB = new YoDouble("qd_d_jointOneB", registry);
private final YoFunctionGenerator functionGeneratorA, functionGeneratorB;
private final PinJoint jointOneA, jointOneB, jointOneC, jointOneD;
public OmniWristController(Robot robot)
{
jointOneA = (PinJoint) robot.getJoint("jointOneA");
jointOneB = (PinJoint) robot.getJoint("jointOneB");
jointOneC = (PinJoint) robot.getJoint("jointOneC");
jointOneD = (PinJoint) robot.getJoint("jointOneD");
pdControllerA = new PDController("ControllerA", registry);
pdControllerB = new PDController("ControllerB", registry);
pdControllerA.setProportionalGain(1000.0);
pdControllerA.setDerivativeGain(50.0);
pdControllerB.setProportionalGain(1000.0);
pdControllerB.setDerivativeGain(50.0);
functionGeneratorA = new YoFunctionGenerator("functionA", robot.getYoTime(), registry);
functionGeneratorB = new YoFunctionGenerator("functionB", robot.getYoTime(), registry);
functionGeneratorA.setMode(YoFunctionGeneratorMode.SINE);
functionGeneratorB.setMode(YoFunctionGeneratorMode.SINE);
functionGeneratorA.setAmplitude(Math.PI/8.0);
functionGeneratorA.setOffset(-0.4);
functionGeneratorA.setFrequency(1.0 * 0.33);
functionGeneratorB.setAmplitude(Math.PI/8.0);
functionGeneratorB.setOffset(-0.4);
functionGeneratorB.setFrequency(1.0 * 1.0);
}
@Override
public void initialize()
{
}
@Override
public YoRegistry getYoRegistry()
{
return registry;
}
@Override
public String getName()
{
return registry.getName();
}
@Override
public String getDescription()
{
return getName();
}
@Override
public void doControl()
{
q_d_jointOneA.set(functionGeneratorA.getValue());
q_d_jointOneB.set(functionGeneratorB.getValue());
qd_d_jointOneA.set(functionGeneratorA.getValueDot());
qd_d_jointOneB.set(functionGeneratorB.getValueDot());
jointOneA.setTau(pdControllerA.compute(jointOneA.getQ(), q_d_jointOneA.getDoubleValue(), jointOneA.getQD(), qd_d_jointOneA.getDoubleValue()));
jointOneB.setTau(pdControllerB.compute(jointOneB.getQ(), q_d_jointOneB.getDoubleValue(), jointOneB.getQD(), qd_d_jointOneB.getDoubleValue()));
}
}
| true
|
3a2f6c786d980df38c2109bfe2a9196e8f704606
|
Java
|
ghuntley/TraceTogether_1.6.1.apk
|
/jadx/sources/o/C2200.java
|
UTF-8
| 809
| 1.75
| 2
|
[] |
no_license
|
package o;
import o.C2248;
/* renamed from: o.Ϸ reason: contains not printable characters */
final class C2200 extends C2248.If {
/* renamed from: ı reason: contains not printable characters */
private final /* synthetic */ C2248 f10450;
/* renamed from: ǃ reason: contains not printable characters */
private final /* synthetic */ boolean f10451;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
C2200(C2248 r1, boolean z) {
super(r1);
this.f10450 = r1;
this.f10451 = z;
}
/* access modifiers changed from: package-private */
/* renamed from: ǃ reason: contains not printable characters */
public final void m11607() {
this.f10450.f10558.setDataCollectionEnabled(this.f10451);
}
}
| true
|
9e0f26fa5d2d53cf09b640f8b6c4dfca11041ff1
|
Java
|
mazingHins/yogu_server
|
/services/xcommon/src/main/java/com/yogu/core/web/ParameterUtil.java
|
UTF-8
| 14,561
| 2.84375
| 3
|
[] |
no_license
|
package com.yogu.core.web;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.yogu.core.web.exception.ServiceException;
/**
* 参数判断的工具类
*
* @author linyi 2014年3月21日
*/
public class ParameterUtil {
/**
* 从http request中取出参数'key'的值,并转换成short类型返回<br>
* value为空时(包括不传),返回0
*/
public static short getShortParam(HttpServletRequest request, String key) {
return getShortParam(request, key, (short) 0);
}
/**
* 从http request中取出参数'key'的值,并转换成short类型返回<br>
* value为空时(包括不传),使用指定的默认值
*/
public static short getShortParam(HttpServletRequest request, String key, short def) {
String value = request.getParameter(key);
if (StringUtils.isBlank(value))
return def;
return Short.parseShort(value);
}
/**
* 从http request中取出参数'key'的值,并转换成int类型返回<br>
* value为空时(包括不传),返回0
*/
public static int getIntParam(HttpServletRequest request, String key) {
return getIntParam(request, key, 0);
}
/**
* 从http request中取出参数'key'的值,并转换成int类型返回<br>
* value为空时(包括不传),使用指定的默认值
*/
public static int getIntParam(HttpServletRequest request, String key, int def) {
String value = request.getParameter(key);
if (StringUtils.isBlank(value))
return def;
return Integer.parseInt(value);
}
/**
* 从http request中取出参数'key'的值,并转换成int类型返回<br>
* value为空时(包括不传),返回0
*/
public static long getLongParam(HttpServletRequest request, String key) {
return getIntParam(request, key, 0);
}
/**
* 从http request中取出参数'key'的值,并转换成int类型返回<br>
* value为空时(包括不传),使用指定的默认值
*/
public static long getLongParam(HttpServletRequest request, String key, long def) {
String value = request.getParameter(key);
if (StringUtils.isBlank(value))
return def;
return Integer.parseInt(value);
}
/**
* 按指定的字符分隔字符串,转换成String[]<br>
* 忽略blank的
*/
public static String[] str2strs(String str, char separatorChars) {
String string = StringUtils.trimToNull(str);
if (null == string)
return null;
String[] split = StringUtils.split(string, separatorChars);
List<String> list = new ArrayList<String>();
for (String s : split) {
String tmp = StringUtils.trimToNull(s);
if (null == tmp)
continue;
list.add(tmp);
}
return list.toArray(new String[list.size()]);
}
/**
* 按指定的字符分隔字符串,转换成String[]<br>
* 忽略blank的
*/
public static String[] str2strs(String str, String separatorChars) {
String string = StringUtils.trimToNull(str);
if (null == string)
return null;
String[] split = StringUtils.split(string, separatorChars);
List<String> list = new ArrayList<String>();
for (String s : split) {
String tmp = StringUtils.trimToNull(s);
if (null == tmp)
continue;
list.add(tmp);
}
return list.toArray(new String[list.size()]);
}
/**
* 将英文逗号分隔的字符串,转换成String[]<br>
* 忽略blank的
*/
public static String[] str2strs(String str) {
return str2strs(str, ",");
}
/**
* 将英文逗号分隔的字符串,转换成int[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static int[] str2ints(String str) {
return str2ints(str, ",");
}
/**
* 将指定符号分隔的字符串,转换成int[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static int[] str2ints(String str, String separatorChars) {
String[] strs = str2strs(str);
if (null == strs)
return null;
int[] ls = new int[strs.length];
int index = 0;
for (String tmp : strs)
ls[index++] = Integer.parseInt(tmp);
return ls;
}
/**
* 将英文逗号分隔的字符串,转换成long[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static long[] str2longs(String str) {
return str2longs(str, ",");
}
/**
* 将指定符号分隔的字符串,转换成long[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static long[] str2longs(String str, String separatorChars) {
String[] strs = str2strs(str, separatorChars);
if (null == strs)
return new long[0];
long[] ls = new long[strs.length];
int index = 0;
for (String tmp : strs)
ls[index++] = Long.parseLong(tmp);
return ls;
}
/**
* 将英文逗号分隔的字符串,转换成long[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static short[] str2shorts(String str) {
return str2shorts(str, ",");
}
/**
* 将英文逗号分隔的字符串,转换成long[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static short[] str2shorts(String str, String separatorChars) {
String[] strs = str2strs(str, separatorChars);
if (null == strs)
return null;
short[] ls = new short[strs.length];
int index = 0;
for (String tmp : strs)
ls[index++] = Short.parseShort(tmp);
return ls;
}
/**
* 将英文逗号分隔的字符串,转换成double[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static double[] str2double(String str) {
return str2double(str, ",");
}
/**
* 将指定字符串分隔的字符串,转换成double[]<br>
* 忽略blank的<br>
* 中间转换异常,则抛出外层
*/
public static double[] str2double(String str, String separatorChars) {
String[] strs = str2strs(str, separatorChars);
if (null == strs)
return null;
double[] ls = new double[strs.length];
int index = 0;
for (String tmp : strs)
ls[index++] = Double.parseDouble(tmp);
return ls;
}
/**
* 将Number类型列表转成字符串,每个元素用英文逗号分隔
* @param list - 列表数据
* @author hins
* @date 2016年9月22日 下午5:11:40
* @return String
*/
public static String listToString(List<? extends Number> list) {
if (list == null || list.isEmpty())
return "";
return StringUtils.join(list, ",");
}
/**
* 将Long类型数组转成字符串,每个元素用英文逗号分隔
* @param array 数组
* @author hins
* @date 2016年9月22日 下午5:14:09
* @return String
*/
public static String listToString(Long[] array) {
if (array == null || array.length ==0)
return "";
return StringUtils.join(array, ",");
}
/**
* 限定参数不能为空(null,""),也不可以全部字符是空格,否则抛出ServiceException
*
* @param s
* - 字符串
* @param errorMessage
* - 出错时的异常错误信息
* @throws com.yogu.core.web.exception.ServiceException
* - 出错时抛出异常
*/
public static void assertNotBlank(String s, String errorMessage) {
if (StringUtils.isBlank(s)) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定参数必须为true,否则抛出ServiceException
*
* @param b
* - 布尔值
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*
* @author liuying 2014-08-18
*/
public static void assertTrue(boolean b, String errorMessage) {
if (!b) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定参数的长度不能超过指定值,否则抛出异常。 当 s 不等于null,并且长度超出maxLength才抛出异常。
*
* @param s
* - 要判断的字符串
* @param maxLength
* - 指定长度
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertMaxLength(String s, int maxLength,
String errorMessage) {
if (s != null && s.length() > maxLength) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定一个整数不能是负数,否则抛出ServiceException
*
* @param n
* - 要判断的整数
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertNonnegativeInt(int n, String errorMessage) {
if (n < 0) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定a必须大于等于b,否则抛出ServiceException
*
* @param a
* @param b
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertGreaterThanOrEqual(int a, int b,
String errorMessage) {
if (a < b) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定a必须大于等于b,否则抛出ServiceException
*
* @param a
* @param b
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertGreaterThanOrEqual(short a, short b,
String errorMessage) {
if (a < b) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定a必须等于b,否则抛出ServiceException
*
* @param a
* @param b
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertEqual(int a, int b,
String errorMessage) {
if (a != b) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定a必须大于等于b,否则抛出ServiceException
*
* @param a
* @param b
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertGreaterThanOrEqual(long a, long b,
String errorMessage) {
if (a < b) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 限定输入值必须是指定列表的其中之一,否则抛出ServiceException
*
* @param a
* - 输入值
* @param errorMessage
* - 出错时的异常错误信息
* @param values
* - 指定列表
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertOneOfThem(short a, String errorMessage,
short... values) {
boolean pass = false;
if (values != null) {
for (short n : values) {
if (a == n) {
pass = true;
break;
}
}
} else {
throw new IllegalArgumentException("values为空");
}
if (!pass) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 判断参数必须大于 0,否则抛出异常
*
* @param n
* - 要判断的数字
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertGreaterThanZero(int n, String errorMessage) {
if (n < 1) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 判断参数必须大于 0,否则抛出异常
*
* @param n
* - 要判断的数字
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertGreaterThanZero(long n, String errorMessage) {
if (n < 1L) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 判断参数列表里必须有一个大于0
*
* @param values
* - 要判断的数字组合
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertOneOfThemThanZero(String errorMessage,
int... values) {
boolean exception = true;
if (values != null) {
for (int n : values) {
if (n >= 0) {
exception = false;
break;
}
}
}
if (exception) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 判断参数不能为null,否则抛出异常
*
* @param o
* - 要判断的参数
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertNotNull(Object o, String errorMessage) {
if (o == null) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 判断时间范围的合法性,end>=start,否则抛出异常
*
* @param start
* - 开始时间,不能为null
* @param end
* - 结束时间,不能为null
* @param errorMessage
* - 出错时的异常错误信息
* @throws ServiceException
* - 出错时抛出异常
*/
public static void assertTimeRange(Date start, Date end, String errorMessage) {
if (start == null || end == null) {
throw new IllegalArgumentException("start或end为空");
}
if (start.after(end)) {
throw new ServiceException(ResultCode.PARAMETER_ERROR, errorMessage);
}
}
/**
* 确保页码是正确的
*
* @param page
* - 要判断的页码
* @return 如果页面错误,令页码=1,否则返回传入的值
*/
public static int ensurePage(int page) {
if (page < 1) {
page = 1;
}
return page;
}
@SuppressWarnings("unchecked")
public static <T> T[] str2Arrars(String str, Class<T> clazz) throws Exception {
String[] split = str.split(",");
List<T> list = new ArrayList<T>(split.length);
for(int i = 0; i < split.length; i++){
if(clazz.newInstance() instanceof Integer){
list.add((T) split[i]);
}
}
System.out.println(Arrays.toString((T[]) list.toArray()));
return (T[])list.toArray();
}
public static void main(String[] args) throws Exception{
String str = "1,2,3";
Integer[] str2Arrars = ParameterUtil.str2Arrars(str, Integer.class);
System.out.println(str2Arrars);
}
}
| true
|
ffa06a59e3a591fef8a64046e6c5152f4d9b42ad
|
Java
|
Fed03/xavier-fit
|
/mutator/src/main/java/com/fteotini/Xavier/mutator/Visitors/AnnotationVisitors/ValuesReplacer/AnnotationValuesReplacer.java
|
UTF-8
| 5,413
| 2.625
| 3
|
[] |
no_license
|
package com.fteotini.Xavier.mutator.Visitors.AnnotationVisitors.ValuesReplacer;
import com.fteotini.Xavier.mutator.Visitors.AnnotationVisitors.AnnotationVisitorWrapper;
import com.fteotini.Xavier.mutator.Visitors.AsmConfig;
import net.bytebuddy.jar.asm.AnnotationVisitor;
import net.bytebuddy.jar.asm.Type;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
import java.util.stream.Collectors;
public class AnnotationValuesReplacer<K extends Annotation> implements AnnotationVisitorWrapper {
private final String annotationDescriptor;
private final Class<K> annotationType;
private final List<NewValueEntry> newValueEntries;
public AnnotationValuesReplacer(Class<K> annotationType, Map<String, Object> newValuesMap) {
annotationDescriptor = Type.getDescriptor(annotationType);
this.annotationType = annotationType;
newValueEntries = newValuesMap
.entrySet()
.stream()
.map(this::buildNewValue)
.collect(Collectors.toList());
}
@Override
public AnnotationVisitor wrap(Supplier<AnnotationVisitor> annotationVisitor, String descriptor, boolean visible) {
var visitor = annotationVisitor.get();
if (annotationDescriptor.equals(descriptor)) {
visitor = new ValueReplacer(visitor);
}
return visitor;
}
private static boolean isArray(Class<?> type) {
Class<?> arrayElementsType = type.getComponentType();
return type.isArray() && (
arrayElementsType.isAnnotation() || arrayElementsType.isEnum() || isPrimitive(arrayElementsType) || isArray(arrayElementsType)
);
}
private static boolean isPrimitive(Class<?> type) {
return type.isPrimitive() || type == String.class;
}
private NewValueEntry buildNewValue(Map.Entry<String, Object> newValueEntry) {
var method = getMethodByName(newValueEntry.getKey());
var newValue = newValueEntry.getValue();
var valueType = getValueType(newValue);
return new NewValueEntry(method, newValue, valueType);
}
private ValueType getValueType(Object newValue) {
ValueType valueType;
Class<?> newValueType = newValue.getClass();
if (isPrimitive(newValueType)) {
valueType = ValueType.Primitive;
} else if (newValueType.isEnum()) {
valueType = ValueType.Enum;
} else if (newValueType.isAnnotation()) {
valueType = ValueType.Annotation;
} else if (isArray(newValueType)) {
valueType = ValueType.Array;
} else {
throw new RuntimeException(String.format("The newValue type [%s] is not among the ones allowed for Annotation by Java", newValueType));
}
return valueType;
}
private Method getMethodByName(String methodName) {
try {
return annotationType.getDeclaredMethod(methodName);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
private List<NewValueEntry> getNewValueEntriesByType(ValueType valueType) {
return newValueEntries.stream()
.filter(newValueEntry -> newValueEntry.isOfType(valueType))
.collect(Collectors.toList());
}
private class ValueReplacer extends AnnotationVisitor {
ValueReplacer(AnnotationVisitor parent) {
super(AsmConfig.ASM_VERSION, parent);
}
@Override
public void visitEnd() {
visitPrimitive();
visitEnum();
visitArrays();
super.visitEnd();
}
private void visitArrays() {
for (NewValueEntry newValueEntry : getNewValueEntriesByType(ValueType.Array)) {
var visitor = super.visitArray(newValueEntry.getName());
visitArrayElements(visitor, newValueEntry.getNewValue());
visitor.visitEnd();
}
}
private void visitArrayElements(AnnotationVisitor visitor, Object newValue) {
var arrayElements = convertToArrayOfObjs(newValue);
for (var element : arrayElements) {
visitor.visit(null, element);
}
}
private Object[] convertToArrayOfObjs(Object obj) {
if (obj instanceof Object[])
return (Object[]) obj;
var arrLength = Array.getLength(obj);
var resultingArr = new Object[arrLength];
for (int i = 0; i < arrLength; i++) {
resultingArr[i] = Array.get(obj, i);
}
return resultingArr;
}
private void visitEnum() {
for (NewValueEntry newValueEntry : getNewValueEntriesByType(ValueType.Enum)) {
var newValue = newValueEntry.getNewValue();
var enumType = Type.getDescriptor(newValue.getClass());
super.visitEnum(newValueEntry.getName(), enumType, newValue.toString());
}
}
private void visitPrimitive() {
for (NewValueEntry newValueEntry : getNewValueEntriesByType(ValueType.Primitive)) {
super.visit(newValueEntry.getName(), newValueEntry.getNewValue());
}
}
}
}
| true
|
47e01e535d3a3843b4ea76a98bfaba8a806ca0d1
|
Java
|
BlakeBr0/ExtendedCrafting
|
/src/main/java/com/blakebr0/extendedcrafting/util/IngredientListCache.java
|
UTF-8
| 2,917
| 2.421875
| 2
|
[
"MIT"
] |
permissive
|
package com.blakebr0.extendedcrafting.util;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class IngredientListCache {
private static final IngredientListCache INSTANCE = new IngredientListCache();
private final Map<ResourceLocation, List<List<Component>>> lists;
private IngredientListCache() {
this.lists = new HashMap<>();
}
public List<Component> getIngredientsList(ResourceLocation id, NonNullList<Ingredient> ingredients) {
return this.lists.computeIfAbsent(id, r -> createIngredientsList(ingredients))
.stream()
.map(l -> {
var index = (System.currentTimeMillis() / 2000L) % l.size();
return l.get(Math.toIntExact(index));
})
.toList();
}
public void onResourceManagerReload(ResourceManager manager) {
this.lists.clear();
}
public static IngredientListCache getInstance() {
return INSTANCE;
}
private static List<List<Component>> createIngredientsList(NonNullList<Ingredient> ingredients) {
var lists = new ArrayList<ItemList>();
for (var ingredient : ingredients) {
var items = Arrays.stream(ingredient.getItems()).map(ItemStack::getItem).toList();
var matched = false;
// increment quantity if there's already a matching list
for (var list : lists) {
if (list.containsAll(items)) {
list.quantity++;
matched = true;
break;
}
}
if (!matched) {
lists.add(new ItemList(items));
}
}
return lists.stream()
.map(s -> s.items.stream()
.map(i -> (Component) Component.literal(s.quantity + "x ").append(i.getDefaultInstance().getHoverName()))
.toList()
)
.toList();
}
private static class ItemList {
private final Set<Item> itemSet;
public final List<Item> items;
public int quantity;
public ItemList(List<Item> items) {
this.itemSet = new HashSet<>(items);
this.items = items;
this.quantity = 1;
}
public boolean containsAll(Collection<Item> items) {
return this.itemSet.containsAll(items);
}
}
}
| true
|
c2259b4601915f040ad27d432be09ccc509f194f
|
Java
|
himi98/LearnJava
|
/Lesson-15/SOLUTIONS/Solution-ChallengeActivity1-UndestandingComparators/src/understandingcomparators/StudentGpaDescendingComparator.java
|
UTF-8
| 344
| 2.859375
| 3
|
[
"MIT"
] |
permissive
|
package understandingcomparators;
import java.util.Comparator;
public class StudentGpaDescendingComparator implements Comparator<Student> {
@Override
public int compare(Student s1, Student s2) {
// TODO: Compare gpa's of students in descending order
return (int)(1000*(s2.getGPA()-s1.getGPA()));
}
}
| true
|
15e3cb38a25a7703414e20f4af64398cdd5a4447
|
Java
|
pabloag3/pclsystem
|
/pclsystemBackE/src/main/java/com/lawyersys/pclsystembacke/entities/TiposActividades.java
|
UTF-8
| 3,602
| 2.28125
| 2
|
[] |
no_license
|
package com.lawyersys.pclsystembacke.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author carlo
*/
@Entity
@Table(name = "tipos_actividades")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "TiposActividades.findAll", query = "SELECT t FROM TiposActividades t")
, @NamedQuery(name = "TiposActividades.findByCodTipoActividad", query = "SELECT t FROM TiposActividades t WHERE t.codTipoActividad = :codTipoActividad")
, @NamedQuery(name = "TiposActividades.findByDescripcion", query = "SELECT t FROM TiposActividades t WHERE t.descripcion = :descripcion")})
public class TiposActividades implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "cod_tipo_actividad")
private Integer codTipoActividad;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "descripcion")
private String descripcion;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "codTipoActividad")
@JsonIgnore
private List<Actividades> actividadesList;
public TiposActividades() {
}
public TiposActividades(Integer codTipoActividad) {
this.codTipoActividad = codTipoActividad;
}
public TiposActividades(Integer codTipoActividad, String descripcion) {
this.codTipoActividad = codTipoActividad;
this.descripcion = descripcion;
}
public Integer getCodTipoActividad() {
return codTipoActividad;
}
public void setCodTipoActividad(Integer codTipoActividad) {
this.codTipoActividad = codTipoActividad;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
@XmlTransient
public List<Actividades> getActividadesList() {
return actividadesList;
}
public void setActividadesList(List<Actividades> actividadesList) {
this.actividadesList = actividadesList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (codTipoActividad != null ? codTipoActividad.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TiposActividades)) {
return false;
}
TiposActividades other = (TiposActividades) object;
if ((this.codTipoActividad == null && other.codTipoActividad != null) || (this.codTipoActividad != null && !this.codTipoActividad.equals(other.codTipoActividad))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.lawyersys.pclsystembacke.TiposActividades[ codTipoActividad=" + codTipoActividad + " ]";
}
}
| true
|
69bb8a960fae28620790268f1a78da57ec66bd5c
|
Java
|
LoomDev/Loom
|
/server/src/main/java/org/loomdev/loom/event/world/WorldEventImpl.java
|
UTF-8
| 1,308
| 2.375
| 2
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
package org.loomdev.loom.event.world;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.loomdev.api.event.Cancelable;
import org.loomdev.api.event.world.WorldEvent;
import org.loomdev.api.world.World;
import org.loomdev.loom.event.EventImpl;
public class WorldEventImpl extends EventImpl implements WorldEvent, Cancelable {
private final World world;
private boolean canceled;
public WorldEventImpl(Level level) {
this.world = level.getLoomWorld();
}
@Override
@NotNull
public World getWorld() {
return world;
}
@Override
public boolean isCanceled() {
return canceled;
}
@Override
public void setCanceled(boolean canceled) {
this.canceled = canceled;
}
public static class TimeSkipImpl extends WorldEventImpl implements WorldEvent.TimeSkip {
private long skippedTicks;
public TimeSkipImpl(Level level, long skippedTicks) {
super(level);
this.skippedTicks = skippedTicks;
}
@Override
public long getSkippedTicks() {
return skippedTicks;
}
@Override
public void setSkippedTicks(long skippedTicks) {
this.skippedTicks = skippedTicks;
}
}
}
| true
|
8869dbaf80af7274fea7da3e88d4c5c37c4399a8
|
Java
|
manikandan-uthaman/mediqu
|
/appointment-service/src/main/java/com/mediqu/dashboard/appointmentservice/AppointmentController.java
|
UTF-8
| 3,544
| 2.234375
| 2
|
[] |
no_license
|
package com.mediqu.dashboard.appointmentservice;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.mediqu.dashboard.appointmentservice.dto.AppointmentDto;
import com.mediqu.dashboard.appointmentservice.dto.DoctorDto;
import com.mediqu.dashboard.appointmentservice.dto.PatientDto;
import com.mediqu.dashboard.appointmentservice.entity.Appointment;
@RestController
@RequestMapping(path = "/appointments")
public class AppointmentController {
@Autowired
private AppointmentRepository appointmentRepository;
@Autowired
private RestTemplate restTemplate;
@Value("${doctor.service.url}")
private String doctorServiceUrl;
@Value("${patient.service.url}")
private String patientServiceUrl;
@GetMapping
public List<AppointmentDto> getRecentAppointments(@RequestParam(name = "doctor", required = false) Integer doctorId, @RequestParam(name = "patient", required = false) Integer patientId) {
List<Appointment> appointments = new ArrayList<Appointment>();
List<AppointmentDto> result = new ArrayList<AppointmentDto>();
if(doctorId != null) {
appointments = appointmentRepository.findByDoctorId(doctorId);
} else if(patientId != null) {
appointments = appointmentRepository.findByPatientId(patientId);
} else {
appointments = appointmentRepository.findTop10ByOrderByStartTimeDesc();
}
if(CollectionUtils.isEmpty(appointments)) {
return result;
}
StringBuilder sbr = new StringBuilder();
sbr.append(doctorServiceUrl);
sbr.append("/doctors?id=");
sbr.append(
appointments.stream().map(app -> String.valueOf(app.getDoctorId())).collect(Collectors.joining(","))
);
ResponseEntity<DoctorDto[]> doctors = restTemplate.getForEntity(sbr.toString(), DoctorDto[].class);
StringBuilder sb = new StringBuilder();
sb.append(patientServiceUrl);
sb.append("/patients?id=");
sb.append(
appointments.stream().map(app -> String.valueOf(app.getPatientId())).collect(Collectors.joining(","))
);
ResponseEntity<PatientDto[]> patients = restTemplate.getForEntity(sb.toString(), PatientDto[].class);
appointments.forEach(app -> {
AppointmentDto appointment = new AppointmentDto();
appointment.setId(app.getId());
appointment.setStartTime(app.getStartTime());
appointment.setEndTime(app.getEndTime());
appointment.setDoctor(getDoctor(doctors.getBody(), app.getDoctorId()));
appointment.setPatient(getPatient(patients.getBody(), app.getPatientId()));
result.add(appointment);
});
return result;
}
private DoctorDto getDoctor(DoctorDto[] doctors, Integer id) {
return Arrays.asList(doctors).stream().filter(doc -> doc.getId() == id).findFirst().orElse(new DoctorDto());
}
private PatientDto getPatient(PatientDto[] patients, Integer id) {
return Arrays.asList(patients).stream().filter(p -> p.getId() == id).findFirst().orElse(new PatientDto());
}
}
| true
|
16ab04a90cd8fd4228c6083d842fb7768e3d4af3
|
Java
|
fusion-jena/CoMerger
|
/SourceCode/src/fusion/comerger/general/output/Evaluator.java
|
UTF-8
| 3,291
| 2.359375
| 2
|
[
"Apache-2.0"
] |
permissive
|
package fusion.comerger.general.output;
/*
* Please refer to https://github.com/fusion-jena/OAPT
* Algergawy, Alsayed, Samira Babalou, Mohammad J. Kargar, and S. Hashem Davarpanah. "SeeCOnt: A new seeding-based clustering approach for ontology matching." In East European Conference on Advances in Databases and Information Systems, pp. 245-258. Springer, Cham, 2015.
* 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.
*/
public class Evaluator
{
public ResultData compare(Alignment as1, Alignment as2)
{
if (as1 == null || as2 == null) {
return null;
}
int found = as1.size();
int exist = as2.size();
int correct = 0;
if (found == 0 || exist == 0) {
return null;
}
ResultData result = new ResultData();
Alignment errorAlignment = new Alignment();
Alignment correctAlignment = new Alignment();
Alignment lostAlignment = new Alignment();
for (int i = 0; i < found; i++) {
Mapping map1 = as1.getMapping(i);
boolean flag = true;
for (int j = 0; j < exist; j++) {
Mapping map2 = as2.getMapping(j);
if (map1.equals(map2)) {
correct++;
correctAlignment.addMapping(map1);
flag = false;
break;
}
}
if (flag == true) {
errorAlignment.addMapping(map1);
}
}
for (int i = 0; i < exist; i++) {
Mapping map1 = as2.getMapping(i);
boolean flag = true;
for (int j = 0; j < found; j++) {
Mapping map2 = as1.getMapping(j);
if (map1.equals(map2)) {
flag = false;
break;
}
}
if (flag == true) {
lostAlignment.addMapping(map1);
}
}
System.out.println("Found: " + found +
", Exist: " + exist + ", Correct: " + correct);
double prec = (double) correct / found;
double rec = (double) correct / exist;
System.out.println("Precision: " + prec + ", Recall: " + rec);
// F-measure
double fm = (1 + Parameters.alpha) * (prec * rec) / (Parameters.alpha * prec + rec);
System.out.println("F-Measure: " + fm);
result.setFound(found);
result.setExist(exist);
result.setCorrect(correct);
result.setPrecision(prec);
result.setRecall(rec);
result.setFMeasure(fm);
result.setCorrectAlignment(correctAlignment);
result.setErrorAlignment(errorAlignment);
result.setLostAlignment(lostAlignment);
return result;
}
}
| true
|
9acb4eb55ab23d3329650da6b31adf8cd611cdc7
|
Java
|
qiuhoude/Houde_mobilesafe
|
/app/src/main/java/com/qiu/houde_mobilesafe/receiver/SmsReceiver.java
|
UTF-8
| 2,307
| 2.328125
| 2
|
[] |
no_license
|
package com.qiu.houde_mobilesafe.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.telephony.SmsMessage;
import com.qiu.houde_mobilesafe.R;
import com.qiu.houde_mobilesafe.service.LocationService;
import com.qiu.houde_mobilesafe.utils.Consts;
import com.qiu.houde_mobilesafe.utils.Logs;
import com.qiu.houde_mobilesafe.utils.SPUtils;
public class SmsReceiver extends BroadcastReceiver {
public SmsReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
//读取短信
Object[] objects = (Object[]) intent.getExtras().get("pdus");
for (Object object : objects) {// 短信最多140字节,
// 超出的话,会分为多条短信发送,所以是一个数组,因为我们的短信指令很短,所以for循环只执行一次
SmsMessage message = SmsMessage.createFromPdu((byte[]) object);
String originatingAddress = message.getOriginatingAddress();// 短信来源号码
String messageBody = message.getMessageBody();// 短信内容
Logs.d(originatingAddress + ":" + messageBody);
if ("#*alarm*#".equals(messageBody)) {
// 播放报警音乐, 即使手机调为静音,也能播放音乐, 因为使用的是媒体声音的通道,和铃声无关
MediaPlayer player = MediaPlayer.create(context, R.raw.alarm);
player.setVolume(1f, 1f);
player.setLooping(true);
player.start();
} else if ("#*location*#".equals(messageBody)) {
// 获取经纬度坐标
context.startService(new Intent(context, LocationService.class));// 开启定位服务
String location = (String) SPUtils.get(context, Consts.LOCATION, "getting location...");
Logs.d("location:" + location);
} else if ("#*wipedata*#".equals(messageBody)) {
Logs.d("远程清除数据");
} else if ("#*lockscreen*#".equals(messageBody)) {
Logs.d("远程锁屏");
}
abortBroadcast();// 中断短信的传递, 从而系统短信app就收不到内容了
}
}
}
| true
|
a2bf29ba1a5ae6b37a27ecf864e2cb463587e5e2
|
Java
|
HemaSelenium/itsmyaccountNew
|
/src/dashboard/MemberSocietyDocuments.java
|
UTF-8
| 2,363
| 2.296875
| 2
|
[] |
no_license
|
package dashboard;
import java.io.IOException;
import org.testng.Reporter;
import org.testng.annotations.Test;
import common.GlobalVariablesCalling;
import common.TestBase;
import common.VariableCalling;
import common.VariableCalling2;
public class MemberSocietyDocuments extends TestBase{
@Test(priority=1)
public void Login(){
Reporter.log("Script Name:Member---->Application--->CurrentEvents", true);
Reporter.log("----------------------------------------------", true);
Reporter.log(" ", true);
helper.Navigate(GlobalVariablesCalling.EnterUrl);
helper.SetValue1("UserName", GlobalVariablesCalling.EnterMemberUserId);
helper.SetValue1("Password", GlobalVariablesCalling.EnterMemberPassword);
helper.ClickByID(VariableCalling.SelectTermsAndConditions);
helper.ClickByXpath(VariableCalling.LoginButton);
}
@Test(priority = 2, dependsOnMethods = "Login")
public void DocumentsList()throws InterruptedException, IOException {
helper.ClickByXpath(VariableCalling.ClickOnApplicationButton);
helper.DeepSleep();
helper.ClickByXpath(VariableCalling.ClickOnSocietyDocuments);
helper.DeepSleep();
Reporter.log("Society Documents Only Able To View", true);
helper.TakeScreenShot("MemberSocietyDocuments");
}
@Test(priority=3,dependsOnMethods = "DocumentsList")
public void Search() throws InterruptedException, IOException{
String EnterDocumentNameToSearch=helper.GetValueByXpath(VariableCalling2.TypeOfEventInFirstRow);
Reporter.log("Searching For Current Event Of: "+EnterDocumentNameToSearch, true);
helper.ClickByXpath(VariableCalling.ClickOnSearchButton);
Thread.sleep(3000);
helper.SetValueByXpath(VariableCalling.EnterDataToSearchInSearchFunction, EnterDocumentNameToSearch);
helper.ClickByXpath(VariableCalling.ClickOnFindButton);
Thread.sleep(2000);
helper.ClickByXpath(VariableCalling.CloseSearchFunction);
Thread.sleep(2000);
helper.TakeScreenShot("SearchDocumentName");
}
@Test(priority=4,dependsOnMethods = "Search")
public void Results(){
Reporter.log(" ", true);
Reporter.log("Files Stored in (Path Name)", true);
Reporter.log("-----------------------------", true);
Reporter.log("File Name : "+GlobalVariablesCalling.ScreenShotsFileName+"MemberSocietyDocuments" + " MemberSocietyDocuments", true);
Reporter.log("File Name : "+GlobalVariablesCalling.ScreenShotsFileName+"SearchDocumentName" + " SearchDocumentName", true);
Reporter.log(" ", true);
}}
| true
|
1931551d82f788ea71650dad0eddf1aa879959e9
|
Java
|
mwquarles/mini_project
|
/src/main/java/com/mwqdev/miniproject/domain/DataUpload.java
|
UTF-8
| 2,729
| 2.40625
| 2
|
[] |
no_license
|
package com.mwqdev.miniproject.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A DataUpload.
*/
@Entity
@Table(name = "data_upload")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class DataUpload implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Lob
@Column(name = "csv_upload", nullable = false)
private byte[] csvUpload;
@Column(name = "csv_upload_content_type", nullable = false)
private String csvUploadContentType;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public byte[] getCsvUpload() {
return csvUpload;
}
public DataUpload csvUpload(byte[] csvUpload) {
this.csvUpload = csvUpload;
return this;
}
// Convert CSV byte code to string
public String getCsvUploadString() {
byte[] csvByte = getCsvUpload();
String csvString = new String(csvByte);
return csvString;
}
public void setCsvUpload(byte[] csvUpload) {
this.csvUpload = csvUpload;
}
public String getCsvUploadContentType() {
return csvUploadContentType;
}
public DataUpload csvUploadContentType(String csvUploadContentType) {
this.csvUploadContentType = csvUploadContentType;
return this;
}
public void setCsvUploadContentType(String csvUploadContentType) {
this.csvUploadContentType = csvUploadContentType;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DataUpload dataUpload = (DataUpload) o;
if (dataUpload.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), dataUpload.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "DataUpload{" +
"id=" + getId() +
", csvUpload='" + getCsvUpload() + "'" +
", csvUploadContentType='" + getCsvUploadContentType() + "'" +
"}";
}
}
| true
|
ac756ec6a29bee8e59d2870ffde94bed4b8f25ed
|
Java
|
chokojung12/2015-2-advanced-object
|
/advanced object/GraphicEditor_v0.8_Alpha_Rev/src/transformer/CResizer.java
|
UTF-8
| 2,241
| 2.609375
| 3
|
[] |
no_license
|
package transformer;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
public class CResizer extends CTransformer{
@Override
public void initTransforming(int x, int y) {
getShapeManager().setPP(x, y);
oldP.setLocation(x,y);
}
private Point2D computeScale(Point previous, Point current){
int deltaW=0;
int deltaH=0;
switch(getShapeManager().geteAnchorType()){
case EE: deltaW = current.x-previous.x; deltaH = 0; break;
case WW: deltaW = -(current.x-previous.x); deltaH = 0; break;
case SS: deltaW = 0; deltaH = current.y-previous.y; break;
case NN: deltaW = 0; deltaH = -(current.y-previous.y); break;
case SE: deltaW = current.x-previous.x; deltaH = current.y-previous.y; break;
case NE: deltaW = current.x-previous.x; deltaH = -(current.y-previous.y); break;
case SW: deltaW = -(current.x-previous.x); deltaH = current.y-previous.y; break;
case NW: deltaW = -(current.x-previous.x); deltaH = -(current.y-previous.y); break;
default: break;
}
double w = getShapeManager().getBounds().getWidth();
double h = getShapeManager().getBounds().getHeight();
double x = 1.0;
double y = 1.0;
if (w > 0.0)
x += deltaW / w;// + x;
if (h > 0.0)
y += deltaH / h;// + y;
return new Point2D.Double(x, y);
}
@Override
public void keepTransforming(Graphics2D g2D, int x, int y) {
AffineTransform savedAT = g2D.getTransform();
g2D.translate(this.getAnchorP().getX(), this.getAnchorP().getY());
getShapeManager().draw(g2D);
Point2D scale = computeScale(oldP, new Point(x, y));
affineTransform.setToScale(scale.getX(), scale.getY());
getShapeManager().setShape(affineTransform.createTransformedShape(getShapeManager().getShape()));
if (getShapeManager().isSelected()) {
getShapeManager().getAnchors().setTransformedShape(affineTransform);
}
oldP.setLocation(x,y);
getShapeManager().draw(g2D);
g2D.setTransform(savedAT);
}
@Override
public void finishTransforming(Graphics2D g2D, int x, int y) {
panel.getClipBoard().addClip(panel.getShapes());
}
@Override
public void addPoint(int x, int y) {
// TODO Auto-generated method stub
}
}
| true
|
560ded5cdc608e70d7ca5accb52e5fae03a7182b
|
Java
|
israzaman/Android_Calculator
|
/Calculator/src/my/calculator/android/AndroidHistoryActivity.java
|
UTF-8
| 1,839
| 2.40625
| 2
|
[] |
no_license
|
package my.calculator.android;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import android.app.Activity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;
import android.widget.Toast;
public class AndroidHistoryActivity extends Activity {
TextView textviewhistory;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.history);
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onRestart() {
// TODO Auto-generated method stub
super.onRestart();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
textviewhistory=(TextView)findViewById(R.id.history_text_view);
textviewhistory.setMovementMethod(new ScrollingMovementMethod());
readfile();
}
public void readfile()
{
String filename="internalMemory";
try {
FileInputStream fin = openFileInput(filename);
int c;
String temp="";
while( (c = fin.read()) != -1){
temp = temp + Character.toString((char)c);
}
textviewhistory.setText(temp);
}
catch(Exception e){
}
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
}
| true
|
d46ef9d7dfcc510f92877910e593f78e604da5c5
|
Java
|
ytatarynovich/AliakseichykavaTatarynovich
|
/5_Unit_Tests/bank/src/main/java/com/epam/jmp/bank/RatesGenerator.java
|
UTF-8
| 760
| 2.53125
| 3
|
[] |
no_license
|
package com.epam.jmp.bank;
import org.apache.log4j.Logger;
import com.epam.jmp.bank.services.CurrencyService;
/**
* @author Hanna_Aliakseichykava
*/
public class RatesGenerator implements Runnable {
private static final int DELAY = 30000;
private static final Logger log = Logger.getLogger(RatesGenerator.class);
private CurrencyService currencyService;
public RatesGenerator(CurrencyService currencyService) {
this.currencyService = currencyService;
}
@Override
public void run() {
while(true) {
currencyService.generateNewRates();
//log.info("New rates are generated (in thread [" + Thread.currentThread().getName() + "])");
try {
Thread.sleep(DELAY);
} catch (InterruptedException e) {
log.warn(e);
}
}
}
}
| true
|
9a83db28b1b520ac9b38d87c73e3593e015ebaed
|
Java
|
CaptainDougG/Movable-sprite
|
/MovableSpriteAnimation/sprites/IMGSprite.java
|
UTF-8
| 4,578
| 2.84375
| 3
|
[] |
no_license
|
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class IMGSprite implements DisplayableSprite, MovableSprite {
private double ROTATION_SPEED = 180;
private static Image upImage;
private static Image[] rotatedImages = new Image[360];
//private static Image rightImage;
//private static Image leftImage;
//private static Image downImage;
//private static Image direction;
private double centerX = 0;
private double centerY = 0;
private double width = 50;
private double height = 50;
private double velocityX = 0;
private double velocityY = 0;
private boolean dispose = false;
private double currentAngle = 0;
public IMGSprite() {
if (upImage == null) {
try {
upImage = ImageIO.read(new File("res/IMG/pixil-frame-0 (2).png"));
//rightImage = ImageIO.read(new File("res/IMG/pixil-frame-0 (3).png"));
//leftImage = ImageIO.read(new File("res/IMG/pixil-frame-0.png"));
//downImage = ImageIO.read(new File("res/IMG/pixil-frame-0 (1).png"));
//direction = upImage;
}
catch (IOException e) {
System.out.println(e.toString());
}
for (int i = 0; i < 360; i++) {
rotatedImages[i] = ImageRotator.rotate(upImage, i);
}
}
}
@Override
public void setCenterX(double centerX) {
this.centerX = centerX;
}
@Override
public void setCenterY(double centerY) {
this.centerY = centerY;
}
@Override
public void moveX(double pixelsPerSecond) {
this.velocityX = pixelsPerSecond;
}
@Override
public void moveY(double pixelsPerSecond) {
this.velocityY = pixelsPerSecond;
}
@Override
public void stop() {
this.velocityX = 0;
this.velocityY = 0;
}
@Override
public Image getImage() {
return rotatedImages[(int)currentAngle];
/*if (this.velocityX > 0) {
direction = rightImage;
return direction;
}
if (this.velocityY < 0) {
direction = upImage;
return direction;
}
if (this.velocityX < 0) {
direction = leftImage;
return direction;
}
if (this.velocityY > 0) {
direction = downImage;
return direction;
}
else {
return direction;
}*/
}
@Override
public boolean getVisible() {
return true;
}
@Override
public double getMinX() {
return centerX - (width / 2);
}
@Override
public double getMaxX() {
return centerX + (width / 2);
}
@Override
public double getMinY() {
return centerY - (height / 2);
}
@Override
public double getMaxY() {
return centerY + (height / 2);
}
@Override
public double getHeight() {
return height;
}
@Override
public double getWidth() {
return width;
}
@Override
public double getCenterX() {
// TODO Auto-generated method stub
return this.centerX;
}
@Override
public double getCenterY() {
// TODO Auto-generated method stub
return this.centerY;
}
@Override
public boolean getDispose() {
// TODO Auto-generated method stub
return dispose;
}
@Override
public void update(Universe universe, KeyboardInput keyboard, long actual_delta_time) {
// TODO Auto-generated method stub
//double distanceX = this.velocityX * actual_delta_time * 0.001;
//double distanceY = this.velocityY * actual_delta_time * 0.001;
//LEFT
if (keyboard.keyDown(37)) {
currentAngle -= (ROTATION_SPEED * (actual_delta_time * 0.001));
}
// RIGHT
if (keyboard.keyDown(39)) {
currentAngle += (ROTATION_SPEED * (actual_delta_time * 0.001));
}
//UP
if (keyboard.keyDown(38)) {
double angleInRadians = Math.toRadians(currentAngle);
}
// DOWN
if (keyboard.keyDown(40)) {
}
//SPACE
if (keyboard.keyDown(32)) {
}
if (currentAngle >= 360) {
currentAngle -= 360;
}
if (currentAngle < 0) {
currentAngle += 360;
}
currentAngle %= 360;
this.height = rotatedImages[(int)currentAngle].getHeight(null);
this.width = rotatedImages[(int)currentAngle].getWidth(null);
//calculate new position assuming there are no changes in direction
double movement_x = (this.velocityX * actual_delta_time * 0.001);
double movement_y = (this.velocityY * actual_delta_time * 0.001);
this.centerX = this.centerX + movement_x;
this.centerY = this.getCenterY() + movement_y;
}
//this.centerX += distanceX;
//this.centerY += distanceY;
}
| true
|
fe3eb6a7310e71eab5eff2b882f6542c28e6f7fe
|
Java
|
LTR4L/ltr4l
|
/src/main/java/org/ltr4l/cli/FeatureExtract.java
|
UTF-8
| 4,970
| 2.21875
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
* Copyright 2018 org.LTR4L
*
* 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.ltr4l.cli;
import org.apache.commons.cli.*;
import org.ltr4l.Version;
import org.ltr4l.click.*;
import org.ltr4l.lucene.solr.client.FeatureExtractor;
import java.io.*;
import java.lang.invoke.MethodHandles;
public class FeatureExtract {
private static final String REQUIRED_ARG = "<solrUrl> <configFile> <impressionLogFile> <outputFile> <borders>";
private static String outputFile;
public static void main (String args[]) throws Exception{
Options options = createOptions();
CommandLine line = getCommandLine(options, args);
if(line.hasOption("help")) printUsage(options);
if(line.hasOption("version")){
System.out.printf("%s release %s\n", MethodHandles.lookup().lookupClass().getCanonicalName(), Version.version);
System.exit(0);
}
String[] params = line.getArgs();
if(params == null || params.length == 0){
System.err.printf("No required argument %s specified", REQUIRED_ARG);
printUsage(options);
}
else if(params.length > 6){
System.err.printf("Too many argument is specified: %s", params[6]);
printUsage(options);
}
String url = line.hasOption("url") ? line.getOptionValue("url") : params[0];
String configFile = line.hasOption("configFile") ? line.getOptionValue("configFile") : params[1];
String impressionLogFile = line.hasOption("impressionLog") ? line.getOptionValue("impressionLog") : params[2];
outputFile = line.hasOption("outputFile") ? line.getOptionValue("outputFile") : params[3];
String bordersListStr = line.hasOption("borders") ? line.getOptionValue("borders") : params[4];
String idField = null;
if (params.length == 6) {
idField = params[5];
} else if (line.hasOption("idField")) {
line.getOptionValue("idField");
} else {
idField = "id";
}
String trainingData = extract(url, configFile, impressionLogFile, bordersListStr, idField);
writeTrainingData(trainingData);
}
private static Options createOptions(){
Option help = new Option( "help", "print this message" );
Option confFile = Option.builder("conf").argName("file").hasArg()
.desc("use given file for configuration").build();
Option verbose = new Option( "verbose", "be extra verbose" );
Option noverbose = new Option( "noverbose", "override verboseness" );
Option debug = new Option( "debug", "print debugging information" );
Options options = new Options();
options.addOption(help)
.addOption(confFile)
.addOption(verbose)
.addOption(noverbose)
.addOption(debug);
return options;
}
private static void printUsage(Options options){
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp( REQUIRED_ARG,
"\nExecute feature extraction with Apache Solr. Required argument json file name for job configuration.\n\n",
options, null, true );
System.exit(0);
}
private static CommandLine getCommandLine(Options options, String[] args){
CommandLineParser parser = new DefaultParser();
CommandLine line = null;
try {
// parse the command line arguments
line = parser.parse(options, args);
}
catch(ParseException exp) {
// oops, something went wrong
System.err.printf("Parsing failed. Reason: %s\n\n", exp.getMessage());
printUsage(options);
}
return line;
}
private static String extract(String url, String confFile, String impressionLogFileName, String bordersListStr, String idField) throws Exception {
File impressionLogFile = new File(impressionLogFileName);
if (!impressionLogFile.canRead()) {
System.err.printf("Cannot read impression log file: %s\n\n", impressionLogFile);
System.exit(-1);
}
CMQueryHandler cmQueryHandler = new CMQueryHandler(new FileInputStream(impressionLogFile));
FeatureExtractor featureExtractor = new FeatureExtractor(url, confFile, cmQueryHandler, idField);
featureExtractor.execute();
return featureExtractor.getMSFormatTrainingData(bordersListStr);
}
private static void writeTrainingData(String trainingData) {
try (FileWriter fw = new FileWriter(new File(outputFile))) {
fw.write(trainingData);
} catch (IOException ioe) {
ioe.printStackTrace();
System.err.println("Exception happened while writing training data");
System.exit(-1);
}
}
}
| true
|
191af55e0a444834ceb0a62a0fd2137e485e84e3
|
Java
|
phunv-vjp/Shopme
|
/ShopmeWebParent/ShopmeFrontEnd/src/main/java/com/shopme/service/impl/ICustomerService.java
|
UTF-8
| 1,033
| 2.015625
| 2
|
[] |
no_license
|
package com.shopme.service.impl;
import java.util.List;
import com.shopme.common.entity.AuthenticationType;
import com.shopme.common.entity.Country;
import com.shopme.common.entity.Customer;
import com.shopme.common.exception.CustomerNotFoundException;
public interface ICustomerService {
public List<Country> listAllCountries();
public boolean isEmailUnique(String email);
public void registerCustomer(Customer customer);
public boolean verify(String verificationCode);
public Customer getCustomerByEmail(String email);
public void updateAuthenticationType(Customer customer, AuthenticationType type);
public void addNewCustomerUponOAuthLogin(String name, String email, String countryCode,
AuthenticationType authenticationType);
public void update(Customer customerInForm);
public String updateResetPasswordToken(String email) throws CustomerNotFoundException;
public Customer getByResetPasswordToken(String token);
public void updatePassword(String token, String newPassword) throws CustomerNotFoundException;
}
| true
|
c1a8fa0486a18cb2a7e69324968774d5897bd8ed
|
Java
|
roboautomator/photo-website-api
|
/src/test/java/com/roboautomator/app/component/collection/CollectionUpdateTest.java
|
UTF-8
| 3,456
| 2.515625
| 3
|
[
"MIT"
] |
permissive
|
package com.roboautomator.app.component.collection;
import com.roboautomator.app.component.image.ImageEntity;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Set;
import org.junit.jupiter.api.Test;
public class CollectionUpdateTest {
private static final String TITLE = "test-title";
private static final Integer INDEX = 0;
private static final Integer TITLE_IMAGE = 1;
private static final String TAG_TITLE = "test-tag-title";
private static final String TAG_COLOUR = "test-tag-colour";
private static final Set <ImageEntity> IMAGES = Set.of(ImageEntity.builder().build());
@Test
void shouldBuildNewCollectionUpdateFromBuilder() {
var collectionUpdate = CollectionUpdate.builder().title(TITLE).index(INDEX).titleImage(TITLE_IMAGE)
.tagTitle(TAG_TITLE).tagColour(TAG_COLOUR).images(IMAGES).build();
assertThat(collectionUpdate.getTitle()).isEqualTo(TITLE);
assertThat(collectionUpdate.getIndex()).isEqualTo(INDEX);
assertThat(collectionUpdate.getTitleImage()).isEqualTo(TITLE_IMAGE);
assertThat(collectionUpdate.getTagTitle()).isEqualTo(TAG_TITLE);
assertThat(collectionUpdate.getTagColour()).isEqualTo(TAG_COLOUR);
assertThat(collectionUpdate.getImages()).isEqualTo(IMAGES);
}
@Test
void shouldHaveAllValuesInToStringMethod(){
var collectionUpdate = CollectionUpdate.builder().title(TITLE).index(INDEX).titleImage(TITLE_IMAGE)
.tagTitle(TAG_TITLE).tagColour(TAG_COLOUR).images(IMAGES).build();
assertThat(collectionUpdate.toString()).contains("title=" + TITLE);
assertThat(collectionUpdate.toString()).contains("index=" + INDEX);
assertThat(collectionUpdate.toString()).contains("titleImage=" + TITLE_IMAGE );
assertThat(collectionUpdate.toString()).contains("tagTitle=" + TAG_TITLE);
assertThat(collectionUpdate.toString()).contains("tagColour=" + TAG_COLOUR);
}
@Test
void shouldBuildCollectionUpdate() {
var collectionUpdateBuilder = CollectionUpdate.builder().title(TITLE).index(INDEX).titleImage(TITLE_IMAGE)
.tagTitle(TAG_TITLE).images(IMAGES).tagColour(TAG_COLOUR);
assertThat(collectionUpdateBuilder.toString()).contains("title=" + TITLE);
assertThat(collectionUpdateBuilder.toString()).contains("index=" + INDEX);
assertThat(collectionUpdateBuilder.toString()).contains("titleImage=" + TITLE_IMAGE);
assertThat(collectionUpdateBuilder.toString()).contains("tagTitle=" + TAG_TITLE);
assertThat(collectionUpdateBuilder.toString()).contains("tagColour=" + TAG_COLOUR);
assertThat(collectionUpdateBuilder.build()).isNotNull();
}
@Test
void shouldCreateCollectionEntityFromUpdate(){
var collectionUpdate = CollectionUpdate.builder().title(TITLE).index(INDEX).titleImage(TITLE_IMAGE)
.tagTitle(TAG_TITLE).tagColour(TAG_COLOUR).images(IMAGES).build();
var collection = collectionUpdate.toCollectionEntity();
assertThat(collection.getTitle()).isEqualTo(TITLE);
assertThat(collection.getIndex()).isEqualTo(INDEX);
assertThat(collection.getTitleImage()).isEqualTo(TITLE_IMAGE);
assertThat(collection.getTagTitle()).isEqualTo(TAG_TITLE);
assertThat(collection.getTagColour()).isEqualTo(TAG_COLOUR);
assertThat(collection.getImages()).isEqualTo(IMAGES);
}
}
| true
|
9135e482d604afc0e05efa4c686feedb722455af
|
Java
|
seanp369/candice-dailey-art
|
/service/src/main/java/com/candicedailey/art/api/response/Image.java
|
UTF-8
| 664
| 2.484375
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.candicedailey.art.api.response;
public class Image {
private final String url;
private final String thumbUrl;
private final String description;
private final int order;
public Image(String url, String thumbUrl, String description, int order) {
this.url = url;
this.thumbUrl = thumbUrl;
this.description = description;
this.order = order;
}
public String getUrl() {
return url;
}
public String getThumbUrl() {
return thumbUrl;
}
public String getDescription() {
return description;
}
public int getOrder() {
return order;
}
}
| true
|
f190c3a73cfd4dc0d3ab5baa5bb3a644f9832737
|
Java
|
Vageeshshankhdhar/Blood-Bank-Application
|
/src/com/bloodbank/dao/ContactDetailDao.java
|
UTF-8
| 549
| 1.9375
| 2
|
[] |
no_license
|
package com.bloodbank.dao;
import java.util.List;
import com.bloodbank.model.AccountDetail;
import com.bloodbank.model.ContactDetail;
import com.bloodbank.model.DonorDetail;
import com.bloodbank.model.StaffDetail;
public interface ContactDetailDao {
public boolean isContactInserted(ContactDetail cd);
public List<DonorDetail> getAllContacts();
public List<AccountDetail> getAllStaffsNames();
public List<AccountDetail> getAllStaffs();
public boolean isStaffDeleted(int id);
public List<AccountDetail> getAllUsers();
}
| true
|
87153df73d2a814635a3d37c0398e6443b443ece
|
Java
|
RomanovaNI/Yandex_task
|
/src/test/java/com/example/testTask/fw/FilterHelper.java
|
UTF-8
| 1,276
| 2.078125
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.example.testTask.fw;
import com.example.testTask.models.Item;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class FilterHelper extends HelperBase {
public FilterHelper(WebDriver wd) {
super(wd);
}
public String getItemNameFromListByOrder(int number) {
return wd.findElement(By.xpath("//*[@data-autotest-id='product-snippet'][\"+number+\"]//h3")).getText();
//*[@data-autotest-id='product-snippet']["+number+"]//h3
// "//div[@class='_2Qo3ODl0by _1eVTqI-ogb cia-vs']/article["+ number +"]/div[4]//h3"
}
/* public String foundItem(){
return wd.findElement(By.xpath("/html/body/div[2]/div[3]/div[3]/div[4]/div/div[1]/div/div[1]/div/article[3]/div[4]/div[1]/h3")).getText();
}*/
public void filterItem(Item item) {
click(By.cssSelector("[href='/catalog--"+ item.getItemType() +"']"));
//click(By.cssSelector("[data-id='button-all']"));
//Actions actions=new Actions(wd);
// actions.sendKeys(Keys.PAGE_DOWN).build().perform();
type(By.cssSelector("#glpricefrom"), item.getPriceFrom());
type(By.cssSelector("#glpriceto"), item.getPriceTo());
click(By.xpath("//span[text()='"+ item.getBrand() +"']"));
}
}
| true
|
e0232d3d371280dd7a002d5ebde65c0e6c36ec88
|
Java
|
cartoonYu/CommonAlgorithms
|
/src/main/java/org/CommonAlgorithms/Sort/MergeSort.java
|
UTF-8
| 1,794
| 3.578125
| 4
|
[
"Apache-2.0"
] |
permissive
|
package org.CommonAlgorithms.Sort;
public class MergeSort {
/**
* 1. About Complexity
* 1.1 Best time Complexity is O(n log n)
* 1.2 Worst time Complexity is O(n log n)
* 1.3 Average time Complexity is O(n log n)
* 1.2 Space Complexity is O(n)
* 2. Stability
* 2.1 stable
* 3. how it run
* 3.1 this algorithm is base on recursive partition
* 3.2 recurse to divide to be sorted array to one element and n array
* 3.3 set every element between start and end to temp array
* 3.4 circulate current start to end,compare left element to right element in temp array and set element according to condition
* 4. Q&A
* @param data
*/
public static void sort(int[] data) {
int[] temp = new int[data.length];
sort(data, temp, 0, data.length - 1);
}
private static void sort(int[] data, int[] temp, int start, int end) {
if (start >= end) {
return;
}
int mid = start + ((end - start) >> 1);
sort(data, temp, start, mid);
sort(data, temp, mid + 1, end);
merge(data, temp, start, end, mid);
}
private static void merge(int[] data, int[] temp, int start, int end, int mid) {
for (int i = start; i <= end; i++) {
temp[i] = data[i];
}
int left = start;
int right = mid + 1;
for (int i = start; i <= end; i++) {
if (left > mid) {
data[i] = temp[right++];
} else if (right > end) {
data[i] = temp[left++];
} else if (temp[right] < temp[left]) {
data[i] = temp[right++];
} else {
data[i] = temp[left++];
}
}
}
}
| true
|
5b8b989d8d5888cc8cb3b1c987487c720a6a578b
|
Java
|
vaibhav-jani/AndroidGraphExperiments
|
/GeometricDrawings/src/x/y/NothingSpecialInThis.java
|
UTF-8
| 2,880
| 2.59375
| 3
|
[] |
no_license
|
package x.y;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import curves.Curve;
import curves.CurveAttributes;
import displaywindow.SurfaceAttributes;
import displaywindow.SurfacePoint;
import displaywindow.SurfaceRenderer;
import drawings.Drawing;
public class NothingSpecialInThis extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
int l1 = 64*4;
int w1 = 32*4;
int d1 = -24*4;
int l2 = 64*1;
int w2 = 32*1;
int d2 = -24*1;
ArrayList<Curve> curves = new ArrayList<Curve>();
drawCubeOncurves(curves, l1, w1, d1, 0, 0);
drawCubeOncurves(curves, l2, w2, d2, 0, 0);
SurfaceAttributes surfaceAttributes = new SurfaceAttributes();
Drawing drawing = new Drawing();
drawing.setCurves(curves);
setContentView(new SurfaceRenderer(this, drawing, surfaceAttributes));
}
private void drawCubeOncurves(ArrayList<Curve> curves, int len, int wid, int dep, int start_x, int start_y ){
SurfacePoint p1 = new SurfacePoint(start_x, start_y);
SurfacePoint p2 = new SurfacePoint(start_x+wid, start_y);
SurfacePoint p3 = new SurfacePoint(start_x+wid, len+start_y);
SurfacePoint p4 = new SurfacePoint(start_x, len+start_y);
SurfacePoint p5 = new SurfacePoint(p1.x - dep, p1.y - dep);
SurfacePoint p6 = new SurfacePoint(p2.x - dep, p2.y - dep);
SurfacePoint p7 = new SurfacePoint(p3.x - dep, p3.y - dep);
SurfacePoint p8 = new SurfacePoint(p4.x - dep, p4.y - dep);
curves.add(getBlueLine(p1, p2));
curves.add(getBlueLine(p2, p3));
curves.add(getBlueLine(p3, p4));
curves.add(getBlueLine(p4, p1));
curves.add(getBlueLine(p5, p6));
curves.add(getBlueLine(p6, p7));
curves.add(getBlueLine(p7, p8));
curves.add(getBlueLine(p8, p5));
curves.add(getBlueLine(p1, p5));
curves.add(getBlueLine(p2, p6));
curves.add(getBlueLine(p3, p7));
curves.add(getBlueLine(p4, p8));
}
Curve getBlueLine(SurfacePoint p1, SurfacePoint p2) {
CurveAttributes defAttribs = new CurveAttributes();
ArrayList<SurfacePoint> p1p2 = new ArrayList<SurfacePoint>();
p1p2.add(p1);
p1p2.add(p2);
Curve line = new Curve(p1p2, defAttribs);
return line;
}
Curve getRedLine(SurfacePoint p1, SurfacePoint p2) {
CurveAttributes defAttribs = new CurveAttributes();
defAttribs.setPathColor("#FF0000");
ArrayList<SurfacePoint> p1p2 = new ArrayList<SurfacePoint>();
p1p2.add(p1);
p1p2.add(p2);
Curve line = new Curve(p1p2, defAttribs);
return line;
}
}
| true
|
a7d7308016829bf80d8e2dc164d0f7f6a410101a
|
Java
|
wilsoncaetanodevelop/Fila1
|
/src/mained/fila.java
|
UTF-8
| 1,570
| 2.9375
| 3
|
[] |
no_license
|
package mained;
public class fila {
private int tamanho;
private int final_fila;
private Pessoa[] vetor;
public int getTamanho() {
return tamanho;
}
public boolean setTamanho(int tamanho) {
if (tamanho > 2 && tamanho < 100) {
this.tamanho = tamanho;
vetor = new Pessoa[tamanho];
return true;
} else {
return false;
}
}
public int getFinal_fila() {
return final_fila;
}
public void setFinal_fila(int final_fila) {
this.final_fila = final_fila;
}
public fila() {
tamanho = 0;
final_fila = -1;
vetor = null;
}
public boolean Vazia() {
if (vetor[0] == null) {
return true;
} else {
return false;
}
}
public boolean cheia() {
if (final_fila + 1 == tamanho) {
return true;
} else {
return false;
}
}
public boolean enfileirar(Pessoa pessoa) {
if (cheia()) {
return false;
} else {
final_fila++;
vetor[final_fila] = pessoa;
return true;
}
}
public Pessoa desenfileirar() {
if (Vazia()) {
return null;
} else {
Pessoa pessoa = vetor[0];
for (int i = 1; i <= final_fila; i++) {
vetor[i - 1] = vetor[i];
}
vetor[final_fila] = null;
final_fila--;
return pessoa;
}
}
}
| true
|
bca23b79d842c7b05892aff7c410794227f9ea0d
|
Java
|
haigopi/TestSamples
|
/javasessions/MyDynamicWebProject/src/nonaccessmodifiers/Parent.java
|
UTF-8
| 322
| 2.625
| 3
|
[] |
no_license
|
package nonaccessmodifiers;
public class Parent {
public String name= new String();
public String name1 = new String();
public String getName() {
System.out.println(name1.toString());
return name;
}
public void setName(String n) {
this.name = n;
System.out.println(this.name);
}
}
| true
|
6913ef8aa33f7df7b3a6e157b419f9857b978314
|
Java
|
bmiller4/fops
|
/fops/src/db/values/Rank.java
|
UTF-8
| 490
| 3.0625
| 3
|
[] |
no_license
|
package db.values;
/**
* Instructing rank.
*/
public enum Rank {
LECTURER("lecturer"),
SENIOR_LECTURER("senior lecturer"),
INSTRUCTOR("instructor"),
ASSISTANT_PROFESSOR("assistant professor"),
ASSOCIATE_PROFESSOR("associate professor"),
PROFESSOR("professor");
private final String humanReadable;
private Rank(String description) {
humanReadable = description;
}
public String getHumanReadable() {
return humanReadable;
}
}
| true
|
ea999480dfb1fe996e3212ae429f57fdd7b66646
|
Java
|
Exordian/qse-sepm-ss13-08
|
/src/main/java/at/ac/tuwien/sepm/DBHelper.java
|
UTF-8
| 927
| 2.359375
| 2
|
[] |
no_license
|
package at.ac.tuwien.sepm;
import org.hsqldb.persist.HsqlProperties;
import org.hsqldb.server.Server;
import org.hsqldb.server.ServerConfiguration;
public class DBHelper {
private static Server server;
public static void startDB() {
try {
String[] options = new String[] { "-database.0", "file:./.db", "-dbname.0", "xdb" };
HsqlProperties hsqlProperties = HsqlProperties.argArrayToProps(options, "server");
ServerConfiguration.translateDefaultDatabaseProperty(hsqlProperties);
ServerConfiguration.translateDefaultNoSystemExitProperty(hsqlProperties);
server = new Server();
server.setProperties(hsqlProperties);
server.start();
} catch (Exception e) {
System.err.println("DB Startup failure");
System.exit(0);
}
}
public static void stopDB() {
server.stop();
}
}
| true
|
0217d996dd555511ea0c5b08254202a8cd97fce9
|
Java
|
JetBrains/intellij-community
|
/java/java-tests/testData/ig/com/siyeh/igfixes/style/lambda2anonymous/QualifyThisAndSuperInside.after.java
|
UTF-8
| 529
| 2.796875
| 3
|
[
"Apache-2.0"
] |
permissive
|
class T {
static class A {
final String n;
A(String n) {
this.n = n;
}
void f(String s) {
System.out.println(s + " " + n);
}
}
static class B extends A {
B(String n) {
super(n);
}
void f2(String s) {
new Thread(new Runnable() {
@Override
public void run() {
B.this.f(s + " " + B.super.n);
}
}).start();
}
}
public static void main(String[] args) {
new A("a").f("run");
new B("b").f2("run");
}
}
| true
|
90a6f11956bcb974c5505c54ce1660d55e3848ab
|
Java
|
sangjiexun/lotos-project
|
/javacroe/src/main/java/javacore/stream/javacore/ZipTest.java
|
UTF-8
| 5,622
| 2.765625
| 3
|
[] |
no_license
|
package javacore.stream.javacore;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.Scanner;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingWorker;
public class ZipTest
{
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable() {
@Override
public void run()
{
ZipTestFrame frame = new ZipTestFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}
}
class ZipTestFrame extends JFrame
{
public static final int DEFAULT_HEIGHT = 300;
public static final int DEFAULT_WIDTH = 400;
private JComboBox fileCombo;
private JTextArea fileText;
private String zipname;
public ZipTestFrame()
{
this.setTitle("ZipTest");
this.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
// 创建目录
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
// 创建目录选项
JMenuItem openItem = new JMenuItem("Open");
menu.add(openItem);
openItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event)
{
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
int r = chooser.showOpenDialog(ZipTestFrame.this);
if (r == JFileChooser.APPROVE_OPTION)
{
ZipTestFrame.this.zipname = chooser.getSelectedFile().getPath();
ZipTestFrame.this.fileCombo.removeAllItems();
ZipTestFrame.this.scanZipFile();
}
}
});
JMenuItem exitItem = new JMenuItem("Exit");
menu.add(exitItem);
exitItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event)
{
System.exit(0);
}
});
menuBar.add(menu);
this.setJMenuBar(menuBar);
// 添加显示区域以及下拉框
this.fileText = new JTextArea();
this.fileCombo = new JComboBox();
this.fileCombo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event)
{
ZipTestFrame.this.loadZipFile((String) ZipTestFrame.this.fileCombo.getSelectedItem());
}
});
this.add(this.fileCombo, BorderLayout.SOUTH);
this.add(new JScrollPane(this.fileText), BorderLayout.CENTER);
}
public void loadZipFile(final String name)
{
this.fileCombo.setEnabled(false);
this.fileText.setText("");
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception
{
try
{
ZipInputStream zin = new ZipInputStream(new FileInputStream(ZipTestFrame.this.zipname));
ZipEntry entry;
while ((entry = zin.getNextEntry()) != null)
{
if (entry.getName().equals(name))
{
Scanner in = new Scanner(zin);
while (in.hasNextLine())
{
ZipTestFrame.this.fileText.append(in.nextLine());
ZipTestFrame.this.fileText.append("\n");
}
}
zin.closeEntry();
}
zin.close();
}
catch (IOException e)
{
e.printStackTrace();
}
return null;
}
@Override
protected void done()
{
ZipTestFrame.this.fileCombo.setEnabled(true);
}
}.execute();
}
public void scanZipFile()
{
new SwingWorker<Void, String>() {
@Override
protected Void doInBackground() throws Exception
{
ZipInputStream zin = new ZipInputStream(new FileInputStream(ZipTestFrame.this.zipname));
ZipEntry entry;
while ((entry = zin.getNextEntry()) != null)
{
this.publish(entry.getName());
zin.closeEntry();
}
zin.close();
return null;
}
@Override
protected void process(List<String> names)
{
for (String name : names)
{
ZipTestFrame.this.fileCombo.addItem(name);
}
}
}.execute();
}
}
| true
|
bd1810ff0d15227e1cebc5797e94658842ed71a0
|
Java
|
terminiter/SolrCloud-Simulator
|
/SolrCloudSimulator/src/edu/cmu/ece845/utility/LBConfiguration.java
|
UTF-8
| 1,169
| 2.453125
| 2
|
[] |
no_license
|
package edu.cmu.ece845.utility;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
import java.util.Properties;
/*
* This class offers the configuration parameters loaded from the configuration file.
*/
public class LBConfiguration extends ConfigurationBase implements Serializable{
/**
*
*/
private static final long serialVersionUID = 988346665358020534L;
public LBConfiguration(){
prop = new Properties();
try {
input = new FileInputStream("LBConfig.properties");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
prop.load(input);
} catch (IOException e) {
e.printStackTrace();
}
}
public int getNodeHiring_port() {
return Integer.valueOf(prop.getProperty("nodeHiringPort"));
}
public int getClientListeningPort(){
return Integer.valueOf(prop.getProperty("clientServingPort"));
}
public boolean getIsQuorum(){
return Boolean.valueOf(prop.getProperty("is_quorum"));
}
public Properties getProperties(){
return prop;
}
}
| true
|
0b477cb98c7ac357cfd8bc461b2043150329f7c7
|
Java
|
jlhuang9/openfre_dyrs
|
/openfire_src/src/java/org/jivesoftware/openfire/mysession/DyrsUtils.java
|
UTF-8
| 464
| 2.15625
| 2
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
package org.jivesoftware.openfire.mysession;
import org.xmpp.packet.JID;
public class DyrsUtils {
public static final String ONLINE_SERVICER = "online_servicer:";
public static String parseCustomerName(JID customerJID) {
return parseCustomerName(customerJID.getNode());
}
public static String parseCustomerName(String customerNode) {
String[] split = customerNode.split("_");
return split[0] + ":" + split[1];
}
}
| true
|
b7572c755a27077e277d27a0de0b5833975ac979
|
Java
|
bilalbenma/AutoMap4OBDA
|
/src/edu/salleurl/arc/automap4obda/matcher/TableStructure.java
|
UTF-8
| 2,591
| 2.25
| 2
|
[] |
no_license
|
/*
* Copyright (C) 2016 ARC La Salle Barcelona Campus, Ramon Llull University.
*
* for comments please contact Alvaro Sicilia (ascilia@salleurl.edu)
*
* 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 edu.salleurl.arc.automap4obda.matcher;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashSet;
public class TableStructure {
public String name = "";
private HashMap<String, ColumnStructure> columns;
public LinkedHashSet<String> primarykeys;
public LinkedHashSet<String> foreignkeys;
public TableStructure(String sname){
name = sname;
columns = new HashMap<String, ColumnStructure>();
primarykeys = new LinkedHashSet<String>();
foreignkeys = new LinkedHashSet<String>();
}
public String getNormalizedName(){
return name;
//return DatabaseStructure.getNormalizedName(name);
}
public void addColumn(ColumnStructure col) {
if(!columns.containsKey(col.name))
columns.put(col.name, col);
if(col.isPrimarykey) {
if(!primarykeys.contains(col.name))
primarykeys.add(col.name);
}
if(col.isForeignkey) {
if(!foreignkeys.contains(col.name))
foreignkeys.add(col.name);
}
}
public void updateColumn(ColumnStructure col) {
columns.put(col.name, col);
if(col.isPrimarykey) {
if(!primarykeys.contains(col.name))
primarykeys.add(col.name);
}
if(col.isForeignkey) {
if(!foreignkeys.contains(col.name))
foreignkeys.add(col.name);
}
}
public boolean hasColumn(String sName){
return columns.containsKey(sName);
}
public Collection<ColumnStructure> getColumns(){
return columns.values();
}
public ColumnStructure getColumn(String sName) {
if(columns.containsKey(sName))
return columns.get(sName);
return null;
}
public String getOnePrimaryKey() {
if(primarykeys.isEmpty()) return columns.values().iterator().next().name;
return primarykeys.iterator().next();
}
public LinkedHashSet<String> getPrimaryKeys() {
return primarykeys;
}
public LinkedHashSet<String> getForeignKeys() {
return foreignkeys;
}
}
| true
|
54d93664136d32a00d2e17ac20abf4ead8228459
|
Java
|
Drucetination/java-school
|
/src/main/java/homework/labStream/WordsCountUtil.java
|
UTF-8
| 173
| 1.640625
| 2
|
[] |
no_license
|
//package homework.labStream;
//
//import java.io.File;
//
//public class WordsCountUtil {
//
// public static int wordsCount(File file) {
//// Str
// }
//
//}
| true
|
796e1ecb0f90d2bc61178eb9897b8c002cfc2d7e
|
Java
|
Sergey674/Java
|
/DownloadImages/src/DownloadImage/URLDownload.java
|
UTF-8
| 2,532
| 2.953125
| 3
|
[] |
no_license
|
package DownloadImage;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
public class URLDownload {
public static Runnable download(String url, String PathImages, String SavePath, int min) {
String nameImage = "";
if (!PathImages.matches(".*.(?:jpg|svg|gif|png)$")) {
nameImage = String.valueOf ((int) (Math.random() * 100000000)) + String.valueOf((int) (Math.random() * 100000000)) + ".png";
if (PathImages.startsWith("/")) {
URLDownload.downloadFile(url + PathImages, SavePath + nameImage, min);
if (PathImages.startsWith("//")) {
URLDownload.downloadFile("https:" + PathImages, SavePath + nameImage, min);
if (PathImages.startsWith("http")) {
URLDownload.downloadFile(PathImages, SavePath + nameImage, min);
}
}
}
}
return null;
}
// Сохраняет картинку, размером больше min КБ, по указанному url, в файл SavePath
public static Runnable downloadFile(String url, String SavePath, int min) {
try {
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("GET");
conn.connect();
if (conn.getContentLength() <= 1024 * min) {
System.out.println("Картинка с адресом: " + '\n' + url + '\n' + "не сохранена. Размер меньше " + min + " KБ" + '\n');
return null;
}
//System.out.println('\n' + SavePath + " !!! " + url);
InputStream in = new BufferedInputStream(conn.getInputStream());
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(SavePath));
byte buff[] = new byte[4096];
while (in.read(buff) > 0) {
out.write(buff, 0, 4096);
}
System.out.println("Картинка с адресом: " + '\n' + url + '\n' + " сохранена в " + SavePath + '\n');
Main.numImage.getAndIncrement();
in.close();
out.flush();
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| true
|
cc0dae769679b30d19e6d447fa5a1e0d80153500
|
Java
|
MartinWieczorek/CCD-Chess
|
/src/main/java/core/Settings.java
|
UTF-8
| 5,252
| 2.390625
| 2
|
[] |
no_license
|
/*
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Authors:
* Mateusz Sławomir Lach ( matlak, msl )
* Damian Marciniak
*/
package core;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/** Class representings game settings available for the current player
*/
public class Settings implements Serializable
{
private static final Logger logger = LogManager.getLogger(Settings.class);
private static ResourceBundle loc = null;
private int timeForGame;
private boolean runningChat;
private boolean runningGameClock;
private boolean timeLimitSet;//tell us if player choose time 4 game or it's infinity
private boolean upsideDown;
public enum gameModes
{
newGame, loadGame
}
public enum gameState
{
normal, chekmate, stalemate
}
private gameModes gameMode;
private Player playerWhite;
private Player playerBlack;
private Player playerRed;
private Player playerGreen;
private ArrayList<Player>activePlayers;
public enum gameTypes
{
local
}
private gameTypes gameType;
private boolean renderLabels = true;
/**
*
*/
public Settings()
{
//temporally
logger.info("Settings-constructor");
this.setPlayerWhite(new Player("", Player.colors.white));
this.setPlayerBlack(new Player("", Player.colors.black));
this.setPlayerRed(new Player("", Player.colors.red));
this.setPlayerGreen(new Player("", Player.colors.green));
this.setTimeLimitSet(false);
setGameMode(gameModes.newGame);
this.activePlayers = new ArrayList<>();
this.activePlayers.add(playerWhite);
this.activePlayers.add(playerRed);
this.activePlayers.add(playerBlack);
this.activePlayers.add(playerGreen);
}
/** Method to get game time set by player
* @return timeFofGame int with how long the game will leasts
*/
public int getTimeForGame()
{
return this.timeForGame;
}
/**
*
* @param key
* @return
*/
public static String lang(String key)
{
if (Settings.loc == null)
{
Settings.loc = PropertyResourceBundle.getBundle("ui.resources.i18n.main");
Locale.setDefault(Locale.ENGLISH);
}
String result = "";
try
{
result = Settings.loc.getString(key);
}
catch (java.util.MissingResourceException exc)
{
result = key;
}
logger.info(Settings.loc.getLocale().toString());
return result;
}
public Player getPlayerWhite() {
return playerWhite;
}
public void setPlayerWhite(Player playerWhite) {
this.playerWhite = playerWhite;
}
public Player getPlayerBlack() {
return playerBlack;
}
public void setPlayerBlack(Player playerBlack) {
this.playerBlack = playerBlack;
}
public Player getPlayerRed() {
return playerRed;
}
public void setPlayerRed(Player playerRed) {
this.playerRed = playerRed;
}
public Player getPlayerGreen() {
return playerGreen;
}
public void setPlayerGreen(Player playerGreen) {
this.playerGreen = playerGreen;
}
public boolean isTimeLimitSet() {
return timeLimitSet;
}
public void setTimeLimitSet(boolean timeLimitSet) {
this.timeLimitSet = timeLimitSet;
}
public boolean isUpsideDown() {
return upsideDown;
}
public void setUpsideDown(boolean upsideDown) {
this.upsideDown = upsideDown;
}
public void setTimeForGame(int timeForGame) {
this.timeForGame = timeForGame;
}
public gameModes getGameMode() {
return gameMode;
}
public void setGameMode(gameModes gameMode) {
this.gameMode = gameMode;
}
public gameTypes getGameType() {
return gameType;
}
public void setGameType(gameTypes gameType) {
this.gameType = gameType;
}
public boolean isRenderLabels() {
return renderLabels;
}
public void setRenderLabels(boolean renderLabels) {
this.renderLabels = renderLabels;
}
/**
*
* @param pl
*/
public void removeActivePlayer(Player pl){
for(int i = 0; i < getActivePlayers().size(); i++){
if(pl == getActivePlayers().get(i)){
getActivePlayers().remove(i);
}
}
}
public Boolean isPlayerActive(Player pl) {
for (Player player : activePlayers) {
if(player == pl)
return true;
}
return false;
}
public ArrayList<Player> getActivePlayers() {
return activePlayers;
}
}
| true
|
1dca8fa27ec3df2dfb31b88522dd4d8752889a95
|
Java
|
kosio197/IpscCompetitionsEJB
|
/ejbModule/bg/softuni/repository/UsersRepositoryImpl.java
|
UTF-8
| 9,584
| 2.390625
| 2
|
[] |
no_license
|
package bg.softuni.repository;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Singleton;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import bg.softuni.entity.CategoryModel;
import bg.softuni.entity.ClubModel;
import bg.softuni.entity.CountryModel;
import bg.softuni.entity.HandgunDivisionModel;
import bg.softuni.entity.RifleDivisionModel;
import bg.softuni.entity.RoleModel;
import bg.softuni.entity.ShotgunDivisionModel;
import bg.softuni.entity.UserModel;
import bg.softuni.model.competition.Competition;
import bg.softuni.model.enumeration.Category;
import bg.softuni.model.enumeration.HandgunDevision;
import bg.softuni.model.enumeration.PowerFactor;
import bg.softuni.model.enumeration.RifleDevision;
import bg.softuni.model.enumeration.Role;
import bg.softuni.model.enumeration.ShotgunDevision;
import bg.softuni.model.user.User;
@Singleton
public class UsersRepositoryImpl implements UsersRepository {
@PersistenceContext
private EntityManager em;
@Override
public void addUser(User user) {
UserModel userModel = userModelToEntity(user);
em.persist(userModel);
}
@Override
public User getUser(String username) {
return userEntityToModel(getUserModel(username));
}
@Override
public List<User> getAllUsers() {
Query q = em.createQuery("select u from UserModel u");
@SuppressWarnings("unchecked")
List<UserModel> models = q.getResultList();
List<User> users = new ArrayList<>();
for (UserModel userModel : models) {
users.add(userEntityToModel(userModel));
}
return users;
}
@Override
public void removeUser(String username) {
UserModel um = getUserModel(username);
em.remove(um);
em.flush();
}
@Override
public void editUser(User LogedUser, User user) {
UserModel um = getUserModel(LogedUser.getUsername());
um.setAlias(user.getAlias());
um.setEmail(user.getEmail());
um.setFirstName(user.getFirstName());
um.setLastName(user.getLastName());
um.setMidleName(user.getMiddleName());
um.setTelephone(user.getTelephone());
um.setUsername(user.getUsername());
if (user.getPassword() == null || !user.getPassword().equals("")) {
um.setPassword(user.getPassword());
}
try {
ClubModel club = em.createNamedQuery("clubByName", ClubModel.class)
.setParameter("clubName", user.getShootingClub()).getSingleResult();
um.setClubModel(club);
} catch (NoResultException e) {
um.getClubModel().setName(user.getShootingClub());
}
CountryModel country = em.createNamedQuery("countryByName", CountryModel.class)
.setParameter("countryName", user.getCountry()).getSingleResult();
um.setCountryModel(country);
CategoryModel cm = em.createNamedQuery("categoryByName", CategoryModel.class)
.setParameter("categoryName", user.getCategory().toString()).getSingleResult();
um.setCategoryModel(cm);
HandgunDivisionModel hdm = null;
if (user.getDefaultHandgunDevision() != null) {
hdm = em.createNamedQuery("hdmByNameAndPowerFactor", HandgunDivisionModel.class)
.setParameter("hdmName", user.getDefaultHandgunDevision().toString())
.setParameter("pfName", user.getDefaultHandgunPowerFactor().toString()).getSingleResult();
}
um.setHandgun(hdm);
RifleDivisionModel rdm = null;
if (user.getDefaultRifleDevision() != null) {
rdm = em.createNamedQuery("rdmByNameAndPowerFactor", RifleDivisionModel.class)
.setParameter("rdmName", user.getDefaultRifleDevision().toString())
.setParameter("pfName", user.getDefaultRiflePowerFactor().toString()).getSingleResult();
}
um.setRifle(rdm);
ShotgunDivisionModel sdm = null;
if (user.getDefaultShotgunDevision() != null) {
sdm = em.createNamedQuery("sdmByName", ShotgunDivisionModel.class)
.setParameter("sdmName", user.getDefaultShotgunDevision().toString()).getSingleResult();
}
um.setShotgun(sdm);
em.merge(um);
em.flush();
}
@Override
public void editUserRole(User user) {
UserModel um = getUserModel(user.getUsername());
Query q = em.createNamedQuery("roleByName", RoleModel.class).setParameter("roleName", user.getRole().name());
RoleModel rm = (RoleModel) q.getSingleResult();
um.setRole(rm);
em.merge(um);
em.flush();
}
@SuppressWarnings("unchecked")
@Override
public List<User> getRegisteredCompetitors(Competition competition) {
String query = "select u from UserModel as u, RegisteredUserModel as ru, CompetitionModel as c "
+ "where c.name = :cName and c.mainMathDate = :cMainMatch and ru.user.id = u.id and ru.competition.id = c.id";
Query q = em.createQuery(query);
q.setParameter("cName", competition.getName());
q.setParameter("cMainMatch", competition.getMatchDate());
List<UserModel> userModels = q.getResultList();
List<User> users = new ArrayList<>();
for (UserModel userModel : userModels) {
users.add(userEntityToModel(userModel));
}
return users;
}
private User userEntityToModel(UserModel um) {
User user = new User(um.getUsername(), um.getPassword(), um.getFirstName(), um.getMidleName(), um.getLastName(),
um.getAlias(), um.getClubModel().getName(), um.getEmail(), um.getCountryModel().getName(),
um.getTelephone(), Category.valueOf(um.getCategoryModel().getName()),
HandgunDevision.valueOf(um.getHandgun().getName()),
PowerFactor.valueOf(um.getHandgun().getPowerfactor().getName()),
RifleDevision.valueOf(um.getRifle().getName()),
PowerFactor.valueOf(um.getRifle().getPowerfactor().getName()),
ShotgunDevision.valueOf(um.getShotgun().getName()), Role.valueOf(um.getRole().getName()));
return user;
}
private UserModel userModelToEntity(User user) {
RoleModel roleModel = em.createNamedQuery("roleByName", RoleModel.class)
.setParameter("roleName", user.getRole().toString()).getSingleResult();
CategoryModel categoryModel = em.createNamedQuery("categoryByName", CategoryModel.class)
.setParameter("categoryName", user.getCategory().toString()).getSingleResult();
ClubModel clubModel = null;
try {
clubModel = em.createNamedQuery("clubByName", ClubModel.class)
.setParameter("clubName", user.getShootingClub()).getSingleResult();
} catch (NoResultException nre) {
clubModel = new ClubModel(user.getShootingClub());
}
CountryModel countryModel = em.createNamedQuery("countryByName", CountryModel.class)
.setParameter("countryName", user.getCountry()).getSingleResult();
HandgunDivisionModel hdm = em.createNamedQuery("hdmByNameAndPowerFactor", HandgunDivisionModel.class)
.setParameter("hdmName", user.getDefaultHandgunDevision().toString())
.setParameter("pfName", user.getDefaultHandgunPowerFactor().toString()).getSingleResult();
ShotgunDivisionModel sdm = null;
if (user.getDefaultShotgunDevision() != null) {
sdm = em.createNamedQuery("sdmByName", ShotgunDivisionModel.class)
.setParameter("sdmName", user.getDefaultShotgunDevision().toString()).getSingleResult();
}
RifleDivisionModel rdm = null;
if (user.getDefaultRifleDevision() != null) {
rdm = em.createNamedQuery("rdmByNameAndPowerFactor", RifleDivisionModel.class)
.setParameter("rdmName", user.getDefaultRifleDevision().toString())
.setParameter("pfName", user.getDefaultRiflePowerFactor().toString()).getSingleResult();
}
return new UserModel(user.getFirstName(), user.getMiddleName(), user.getLastName(), user.getUsername(),
user.getAlias(), user.getPassword(), user.getEmail(), user.getTelephone(), roleModel, clubModel,
countryModel, categoryModel, hdm, sdm, rdm);
}
private UserModel getUserModel(String username) {
Query q = em.createQuery("select model from UserModel model where model.username = :um ");
q.setParameter("um", username);
UserModel um = null;
try {
um = (UserModel) q.getSingleResult();
} catch (NoResultException e) {
System.out.println(e.toString());
}
return um;
}
@Override
public boolean usernameExists(String username) {
try {
em.createNamedQuery("userByUsername").setParameter("username", username).getSingleResult();
return true;
} catch (NoResultException e) {
return false;
}
}
@Override
public boolean emailExists(String email) {
try {
em.createNamedQuery("userByEmail").setParameter("email", email).getSingleResult();
return true;
} catch (NoResultException e) {
return false;
}
}
}
| true
|
ac18b8060b9a42556b0660c9d9da97eda63e887b
|
Java
|
shmayank25/dl
|
/DawaiLelo/app/src/main/java/com/dawailelo/SignUp.java
|
UTF-8
| 2,541
| 2.1875
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.dawailelo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.PopupMenu;
import android.widget.Toast;
import android.widget.PopupMenu.OnMenuItemClickListener;
public class SignUp extends Activity{
EditText name, city, phone, email, password;
Button okay;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.signup);
name = (EditText) findViewById(R.id.signupname);
city = (EditText) findViewById(R.id.signupcity);
phone = (EditText) findViewById(R.id.signupphone);
email = (EditText) findViewById(R.id.signupemail);
password = (EditText) findViewById(R.id.signuppassword);
Button bsupport = (Button) findViewById(R.id.support);
bsupport.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
View back = findViewById(R.id.support);
PopupMenu pop = new PopupMenu(SignUp.this, back);
MenuInflater inflate = pop.getMenuInflater();
inflate.inflate(R.menu.popup, pop.getMenu());
pop.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId())
{
case R.id.menu_call:
// Single menu item is selected do something
// Ex: launching new activity/screen or show alert message
Intent i = new Intent(SignUp.this, CallUs.class);
startActivity(i);
return true;
case R.id.menu_sms:
Toast.makeText(SignUp.this, "SMS", Toast.LENGTH_SHORT).show();
return true;
default:
return false;
}
}
});
pop.show();
}
});
okay = (Button) findViewById(R.id.signupbutton);
okay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// Toast.makeText(SignUp.this, "Done Sucessfully", Toast.LENGTH_SHORT).show();
Intent i = new Intent(SignUp.this, PostSplash.class);
startActivity(i);
SignUp.this.finish();
}
});
}
}
| true
|