blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
32a08103f72f67a3536899760974b50d0d2e0c9a | d983bba0d6f6c645e6b1ef69dff43debf2c0dfd4 | /Semester I/other/Factorial.java | a64dcc1282d5571845f460f42f14414e37223b82 | [] | no_license | jdoiron94/Portfolio | 063e60d90b30d72f8e98abb44e417329959c8b51 | 081dca7955f23637a679a3ae2ee70d192c637d46 | refs/heads/master | 2016-09-06T21:46:05.558832 | 2016-01-06T01:02:10 | 2016-01-06T01:02:10 | 22,968,657 | 0 | 0 | null | 2015-11-07T13:54:50 | 2014-08-14T21:05:38 | Java | UTF-8 | Java | false | false | 894 | java | package semester_i.other;
import java.util.Scanner;
public class Factorial {
private static int getFactorial(int number) {
if (number == 0) {
return 0;
} else if (number < 0) {
return -1;
}
int sum = 1;
for (int i = number; i > 1; i--) {
sum *= i;
}
return sum;
}
public static void main(String... args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter 1337 as the sentinel value\n");
int n = 5;
while (n != 1337) {
System.out.print("Enter the 'n' number: ");
n = scanner.nextInt();
int factorial = getFactorial(n);
System.out.println(factorial == -1 ? "Enter valid numbers only (0+)\n" : "The factorial of " + n + " is " + factorial + "\n");
}
scanner.close();
}
} | [
"[email protected]"
] | |
b8a4b285fa12e44a7a302a8318cab862429d3426 | f264a51cb395e5134b55723f15850ba7a1ad359b | /playstore/User.java | 58f413c08a7893e2519679b95bd052f9313af057 | [
"Apache-2.0"
] | permissive | PF-ASS2/PS-final | dddf7d56a0d6470ebdae7247550aae4b1209bb61 | 3e6fe061f0094eaa93e780917b9ae696268316d3 | refs/heads/master | 2020-03-17T20:06:00.530274 | 2018-05-18T02:39:38 | 2018-05-18T02:39:38 | 133,893,135 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,529 | java | package playstore;
import java.util.ArrayList;
//make return objects immutable --- look into this
public class User {
//variables
private String Id;
private String Name;
private String Phone_Number;
private int Balance = 0;
private OS o;
private boolean Ispremium = false;
private ArrayList<Content> ContentBought = new ArrayList<Content>();
// private User [] usrDetails = new User [3];
//constructors
public User(String id, String name, String phone_Number, int balance, OS o) {
super();
Id = id;
Name = name;
Phone_Number = phone_Number;
Balance = balance;
this.o = o;
};
public User(String id, String name, String phone_Number, OS o) {
super();
Id = id;
Name = name;
Phone_Number = phone_Number;
this.o = o;
};
public String getUsr() {
String usrDetails = "User " + "(" + this.Id + "), " + this.Name + "; ";
return usrDetails;
}
public String getUsrName() {
return Name.toString();
}
//become premium method
public void becomePremium() {
try {
//check balance
int balance = this.Balance - 100;
if (balance < 0) {
throw new BalanceInsufficientException(this.Name + " can't become premium due to insufficient balance");
} else {
this.Ispremium = true;
this.Balance = balance;
System.out.println(this.Name + " You are Premium now");
}
} catch (BalanceInsufficientException e) {
System.out.println(e.getMessage());
return;
}
}
public void buyContent(Content c) {
try {
//check if user is premium, and premium have 20% discount
double realprice;
if (this.Ispremium == true) {
realprice = 0.8 * c.getPrice();
} else {
realprice = c.getPrice();
}
;
// if it's a game, check os version and type
if (c instanceof Game) {
if (!this.o.getType().equals(((Game) c).getO().getType())) {
throw new OsIncompatibleException(
this.Name + " can't buy "+((Game) c).returnnameandos()+ " :your OS is not compatible with the game required OS\n");
} else if (this.o.getVersion() < ((Game) c).getO().getVersion())
{
throw new OsVersionIncompatibleException(
this.Name + " can't buy "+((Game) c).returnnameandos()+" :Your OS Version is not compatible with game required OS Version\n");
}
}
// check if balance is enough to buy content
if (this.Balance - realprice < 0) {
throw new BalanceInsufficientException("You don't have enough balance\n");
} else {
// check balance
this.Balance -= realprice;
ContentBought.add(c);
c.Increase_NoD_by1();
if (c instanceof Game) {System.out.println( this.Name + " just bought " + ((Game) c).returnnameandos() + "\n");}
else System.out.println( this.Name + " just bought " + c.getApplication_Name() + "\n");
}
} catch (BalanceInsufficientException f) {
System.out.println(f.getMessage());
return;
} catch (OsIncompatibleException e) {
System.out.println(e.getMessage());
return;
} catch (OsVersionIncompatibleException e) {
System.out.println(e.getMessage());
return;
}
}
// output everything in arraylist
public void AllContentsBought() {
System.out.println(this.Name + " total purchase history.");
for (Content c : ContentBought) {
if (c instanceof Game) {System.out.println( ((Game) c).returnnameandos());}
else
System.out.println(c.getApplication_Name());
}
System.out.println();
}
}
| [
"[email protected]"
] | |
e109c10c6171882ffb9728d775372222dc39ba00 | dcdfca0ebdf906192c81d56e04a7019bff441d83 | /app/src/main/java/net/xxhong/rosclient/ui/VideoActivity.java | 3b45b20e5387233dd12ffb44fe27962e0d0dac4d | [] | no_license | garciaraul85/jrosbridge | 046b4482c900a8a7c8a450f770d212fe13793f32 | edb99e3f5b6e7c7ebf8e0bc2ecbf5c886688a57c | refs/heads/master | 2020-03-29T17:44:35.722013 | 2018-09-24T22:54:57 | 2018-09-24T22:54:57 | 150,178,369 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,680 | java | package net.xxhong.rosclient.ui;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import com.android.hp.ros.MessageHandler;
import com.android.hp.ros.message.BitmapFromCompressedImage;
import com.android.hp.ros.message.CompressedImage;
import com.android.hp.ros.rosbridge.ROSBridgeClient;
import net.xxhong.rosclient.R;
import net.xxhong.rosclient.RCApplication;
public class VideoActivity extends Activity {
private ROSBridgeClient client;
private com.android.hp.ros.Topic<CompressedImage> messageTopic;
private Panel panel;
private BitmapFromCompressedImage bmp = new BitmapFromCompressedImage();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
panel = findViewById(R.id.surfaceView);
}
@Override
protected void onResume() {
super.onResume();
bmp = new BitmapFromCompressedImage();
client = ((RCApplication)getApplication()).getRosClient();
messageTopic = new com.android.hp.ros.Topic<>("/usb_cam/image_raw/compressed", CompressedImage.class, client);
messageTopic.queue_length = 1;
messageTopic.subscribe(new MessageHandler<CompressedImage>() {
@Override
public void onMessage(CompressedImage message) {
Bitmap bitmap = bmp.call(message);
if (bitmap != null) {
panel.bmpIcon = bitmap;
}
}
});
}
@Override
protected void onStop() {
super.onStop();
messageTopic.unsubscribe();
}
} | [
"[email protected]"
] | |
517235e5add4374e4fb7c7c45e0ec8f5a6a850bd | 1126abf20821964d5637affa4e1accabbd29d073 | /trendly/src/backend/TrendsCallable.java | 7df927d0c16f4e647613f34756d35f515d4b046c | [
"Apache-2.0"
] | permissive | googleinterns/Trendly | f8ee2839302a49f45b9429dcdd7a14277929faee | ae69ecab1e95032f98f0f15f80b90b81329085f9 | refs/heads/master | 2023-02-15T09:08:22.903680 | 2021-01-11T06:22:08 | 2021-01-11T06:22:08 | 289,083,077 | 0 | 2 | NOASSERTION | 2021-01-11T06:22:09 | 2020-08-20T18:43:03 | TypeScript | UTF-8 | Java | false | false | 1,062 | java | import java.io.IOException;
import java.util.concurrent.Callable;
/**
* For using TrendsAPIWrapper with threads (each TrendsCallable instance represents an asynchronous
* task which can be executed by a separate thread).
*/
public class TrendsCallable implements Callable<TrendsResult> {
String trendsFunction;
String term;
String location;
String startDate;
String endDate;
String category;
public TrendsCallable(
String trendsFunction,
String term,
String location,
String startDate,
String endDate,
String category) {
this.trendsFunction = trendsFunction;
this.term = term;
this.location = location;
this.startDate = startDate;
this.endDate = endDate;
this.category = category;
}
/** Calls TrendsAPIWrapper with the restriction given in the constructor. */
@Override
public TrendsResult call() throws IOException {
return TrendsAPIWrapper.fetchDataFromTrends(
this.trendsFunction, this.term, this.location, this.startDate, this.endDate, this.category);
}
}
| [
"[email protected]"
] | |
7aa0aca81d5cc99fa4411f1713462c1d3cc86358 | 99993cee373542810763c6a037db527b86b0d4ac | /fluent/src/main/java/io/kubernetes/client/openapi/models/V1beta1EventFluent.java | 669fa92ef2c423a0a0a609fd50aca0088a04e002 | [
"Apache-2.0"
] | permissive | saparaj/java | b54c355f2276ac7ac2cd09f2f0cf3212f7c41b2d | a7266c798f16ab01e9ceac441de199bd8a5a839a | refs/heads/master | 2023-08-15T19:35:11.163843 | 2021-10-13T16:53:49 | 2021-10-13T16:53:49 | 269,235,029 | 0 | 0 | Apache-2.0 | 2020-06-04T01:46:44 | 2020-06-04T01:46:43 | null | UTF-8 | Java | false | false | 10,896 | java | package io.kubernetes.client.openapi.models;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.lang.String;
import java.lang.Deprecated;
import java.lang.Boolean;
import io.kubernetes.client.fluent.Fluent;
import java.lang.Integer;
import java.time.OffsetDateTime;
public interface V1beta1EventFluent<A extends io.kubernetes.client.openapi.models.V1beta1EventFluent<A>> extends io.kubernetes.client.fluent.Fluent<A> {
public java.lang.String getAction();
public A withAction(java.lang.String action);
public java.lang.Boolean hasAction();
@java.lang.Deprecated
/**
* Method is deprecated. use withAction instead.
*/
public A withNewAction(java.lang.String original);
public java.lang.String getApiVersion();
public A withApiVersion(java.lang.String apiVersion);
public java.lang.Boolean hasApiVersion();
@java.lang.Deprecated
/**
* Method is deprecated. use withApiVersion instead.
*/
public A withNewApiVersion(java.lang.String original);
public java.lang.Integer getDeprecatedCount();
public A withDeprecatedCount(java.lang.Integer deprecatedCount);
public java.lang.Boolean hasDeprecatedCount();
public java.time.OffsetDateTime getDeprecatedFirstTimestamp();
public A withDeprecatedFirstTimestamp(java.time.OffsetDateTime deprecatedFirstTimestamp);
public java.lang.Boolean hasDeprecatedFirstTimestamp();
public java.time.OffsetDateTime getDeprecatedLastTimestamp();
public A withDeprecatedLastTimestamp(java.time.OffsetDateTime deprecatedLastTimestamp);
public java.lang.Boolean hasDeprecatedLastTimestamp();
@java.lang.Deprecated
/**
* This method has been deprecated, please use method buildDeprecatedSource instead.
* @return The buildable object.
*/
public io.kubernetes.client.openapi.models.V1EventSource getDeprecatedSource();
public io.kubernetes.client.openapi.models.V1EventSource buildDeprecatedSource();
public A withDeprecatedSource(io.kubernetes.client.openapi.models.V1EventSource deprecatedSource);
public java.lang.Boolean hasDeprecatedSource();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.DeprecatedSourceNested<A> withNewDeprecatedSource();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.DeprecatedSourceNested<A> withNewDeprecatedSourceLike(io.kubernetes.client.openapi.models.V1EventSource item);
public io.kubernetes.client.openapi.models.V1beta1EventFluent.DeprecatedSourceNested<A> editDeprecatedSource();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.DeprecatedSourceNested<A> editOrNewDeprecatedSource();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.DeprecatedSourceNested<A> editOrNewDeprecatedSourceLike(io.kubernetes.client.openapi.models.V1EventSource item);
public java.time.OffsetDateTime getEventTime();
public A withEventTime(java.time.OffsetDateTime eventTime);
public java.lang.Boolean hasEventTime();
public java.lang.String getKind();
public A withKind(java.lang.String kind);
public java.lang.Boolean hasKind();
@java.lang.Deprecated
/**
* Method is deprecated. use withKind instead.
*/
public A withNewKind(java.lang.String original);
@java.lang.Deprecated
/**
* This method has been deprecated, please use method buildMetadata instead.
* @return The buildable object.
*/
public io.kubernetes.client.openapi.models.V1ObjectMeta getMetadata();
public io.kubernetes.client.openapi.models.V1ObjectMeta buildMetadata();
public A withMetadata(io.kubernetes.client.openapi.models.V1ObjectMeta metadata);
public java.lang.Boolean hasMetadata();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.MetadataNested<A> withNewMetadata();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.MetadataNested<A> withNewMetadataLike(io.kubernetes.client.openapi.models.V1ObjectMeta item);
public io.kubernetes.client.openapi.models.V1beta1EventFluent.MetadataNested<A> editMetadata();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.MetadataNested<A> editOrNewMetadata();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.MetadataNested<A> editOrNewMetadataLike(io.kubernetes.client.openapi.models.V1ObjectMeta item);
public java.lang.String getNote();
public A withNote(java.lang.String note);
public java.lang.Boolean hasNote();
@java.lang.Deprecated
/**
* Method is deprecated. use withNote instead.
*/
public A withNewNote(java.lang.String original);
public java.lang.String getReason();
public A withReason(java.lang.String reason);
public java.lang.Boolean hasReason();
@java.lang.Deprecated
/**
* Method is deprecated. use withReason instead.
*/
public A withNewReason(java.lang.String original);
@java.lang.Deprecated
/**
* This method has been deprecated, please use method buildRegarding instead.
* @return The buildable object.
*/
public io.kubernetes.client.openapi.models.V1ObjectReference getRegarding();
public io.kubernetes.client.openapi.models.V1ObjectReference buildRegarding();
public A withRegarding(io.kubernetes.client.openapi.models.V1ObjectReference regarding);
public java.lang.Boolean hasRegarding();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RegardingNested<A> withNewRegarding();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RegardingNested<A> withNewRegardingLike(io.kubernetes.client.openapi.models.V1ObjectReference item);
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RegardingNested<A> editRegarding();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RegardingNested<A> editOrNewRegarding();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RegardingNested<A> editOrNewRegardingLike(io.kubernetes.client.openapi.models.V1ObjectReference item);
@java.lang.Deprecated
/**
* This method has been deprecated, please use method buildRelated instead.
* @return The buildable object.
*/
public io.kubernetes.client.openapi.models.V1ObjectReference getRelated();
public io.kubernetes.client.openapi.models.V1ObjectReference buildRelated();
public A withRelated(io.kubernetes.client.openapi.models.V1ObjectReference related);
public java.lang.Boolean hasRelated();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RelatedNested<A> withNewRelated();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RelatedNested<A> withNewRelatedLike(io.kubernetes.client.openapi.models.V1ObjectReference item);
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RelatedNested<A> editRelated();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RelatedNested<A> editOrNewRelated();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.RelatedNested<A> editOrNewRelatedLike(io.kubernetes.client.openapi.models.V1ObjectReference item);
public java.lang.String getReportingController();
public A withReportingController(java.lang.String reportingController);
public java.lang.Boolean hasReportingController();
@java.lang.Deprecated
/**
* Method is deprecated. use withReportingController instead.
*/
public A withNewReportingController(java.lang.String original);
public java.lang.String getReportingInstance();
public A withReportingInstance(java.lang.String reportingInstance);
public java.lang.Boolean hasReportingInstance();
@java.lang.Deprecated
/**
* Method is deprecated. use withReportingInstance instead.
*/
public A withNewReportingInstance(java.lang.String original);
@java.lang.Deprecated
/**
* This method has been deprecated, please use method buildSeries instead.
* @return The buildable object.
*/
public io.kubernetes.client.openapi.models.V1beta1EventSeries getSeries();
public io.kubernetes.client.openapi.models.V1beta1EventSeries buildSeries();
public A withSeries(io.kubernetes.client.openapi.models.V1beta1EventSeries series);
public java.lang.Boolean hasSeries();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.SeriesNested<A> withNewSeries();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.SeriesNested<A> withNewSeriesLike(io.kubernetes.client.openapi.models.V1beta1EventSeries item);
public io.kubernetes.client.openapi.models.V1beta1EventFluent.SeriesNested<A> editSeries();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.SeriesNested<A> editOrNewSeries();
public io.kubernetes.client.openapi.models.V1beta1EventFluent.SeriesNested<A> editOrNewSeriesLike(io.kubernetes.client.openapi.models.V1beta1EventSeries item);
public java.lang.String getType();
public A withType(java.lang.String type);
public java.lang.Boolean hasType();
@java.lang.Deprecated
/**
* Method is deprecated. use withType instead.
*/
public A withNewType(java.lang.String original);
public interface DeprecatedSourceNested<N> extends io.kubernetes.client.fluent.Nested<N>,io.kubernetes.client.openapi.models.V1EventSourceFluent<io.kubernetes.client.openapi.models.V1beta1EventFluent.DeprecatedSourceNested<N>> {
public N and();
public N endDeprecatedSource(); }
public interface MetadataNested<N> extends io.kubernetes.client.fluent.Nested<N>,io.kubernetes.client.openapi.models.V1ObjectMetaFluent<io.kubernetes.client.openapi.models.V1beta1EventFluent.MetadataNested<N>> {
public N and();
public N endMetadata(); }
public interface RegardingNested<N> extends io.kubernetes.client.fluent.Nested<N>,io.kubernetes.client.openapi.models.V1ObjectReferenceFluent<io.kubernetes.client.openapi.models.V1beta1EventFluent.RegardingNested<N>> {
public N and();
public N endRegarding(); }
public interface RelatedNested<N> extends io.kubernetes.client.fluent.Nested<N>,io.kubernetes.client.openapi.models.V1ObjectReferenceFluent<io.kubernetes.client.openapi.models.V1beta1EventFluent.RelatedNested<N>> {
public N and();
public N endRelated(); }
public interface SeriesNested<N> extends io.kubernetes.client.fluent.Nested<N>,io.kubernetes.client.openapi.models.V1beta1EventSeriesFluent<io.kubernetes.client.openapi.models.V1beta1EventFluent.SeriesNested<N>> {
public N and();
public N endSeries(); }
}
| [
"[email protected]"
] | |
c24dba1f31c8a5dbf55593de7db1a5c171367054 | 8330c94ad8ad5a654ce7222b7b45c431080f55de | /forkify-api-master/src/main/java/org/simran/resources/DishResource.java | 730c74dfcf4479d4f557ef0d8e4ea92cac759cad | [] | no_license | Deyashinidb/Forkify | ab1facc1d84915065a09f03bd6d4c2b0d90b37e5 | 0620048c8ac4c72ed6931150a8d7002b84ed8981 | refs/heads/master | 2023-01-19T02:30:12.671162 | 2020-11-20T03:10:02 | 2020-11-20T03:10:02 | 314,423,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package org.simran.resources;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.simran.model.Restaurant;
import org.simran.services.RestaurantService;
import java.util.List;
import javax.ws.rs.GET;
@Path("/dishes")
public class DishResource {
RestaurantService restaurantService = new RestaurantService();
@GET
@Path("/{dishName}")
@Produces(MediaType.APPLICATION_JSON)
public List<Restaurant> getRestaurantByDish(@PathParam("dishName") String dish) {
return restaurantService.getRestaurantByDish(dish);
}
}
| [
"[email protected]"
] | |
b835c425c6c940fdc53918ed8d78434e11567ab8 | 6cd0a049b8cd98c28c57d76f3571cbdd29603544 | /src/main/java/com/go2/classes/business/service/mapping/ClassesCategoryServiceMapper.java | 27860d2c1ebb453cb96514d96f90b8937775bf7d | [] | no_license | nobun-com/tgc-server | 7e1fe6ad9079843e096194ed0d71098d93b46f8a | 2844d8bc7f951e370f999cc2402c3cb02dada860 | refs/heads/master | 2020-07-22T04:54:05.915319 | 2017-10-25T05:44:15 | 2017-10-25T05:44:15 | 94,343,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package com.go2.classes.business.service.mapping;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.stereotype.Component;
import com.go2.classes.models.ClassesCategory;
import com.go2.classes.models.jpa.ClassesCategoryEntity;
@Component
public class ClassesCategoryServiceMapper extends AbstractServiceMapper {
private ModelMapper modelMapper;
public ClassesCategoryServiceMapper() {
modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
}
public ClassesCategory mapClassesCategoryEntityToClassesCategory(ClassesCategoryEntity classesCategoryEntity) {
if(classesCategoryEntity == null) {
return null;
}
ClassesCategory classesCategory = map(classesCategoryEntity, ClassesCategory.class);
return classesCategory;
}
public void mapClassesCategoryToClassesCategoryEntity(ClassesCategory classesCategory, ClassesCategoryEntity classesCategoryEntity) {
if(classesCategory == null) {
return;
}
map(classesCategory, classesCategoryEntity);
}
@Override
protected ModelMapper getModelMapper() {
return modelMapper;
}
protected void setModelMapper(ModelMapper modelMapper) {
this.modelMapper = modelMapper;
}
} | [
"[email protected]"
] | |
1c9ff467278b9e6890fc0685d9c6600807c3b64a | 7831a13f5f04f8e5fbd48ed0ccc3c8f2735bac58 | /library/templates/mochafaces/src/main/java/org/mochafaces/taglib/resource/MetaResourceTag.java | 6569613d0a794c886c4b8aa401bcf3a4e1939cb8 | [] | no_license | nubiofs/mapfaces | 7a609ecc645b96d17e0ccefa23c0e91b8a94c400 | b546a3e3d61acd59b78f1611173a20fa2c9ec2e6 | refs/heads/master | 2020-05-25T19:23:39.658730 | 2010-01-08T16:20:43 | 2010-01-08T16:20:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,543 | java | /*
* MDweb - Open Source tool for cataloging and locating environmental resources
* http://mdweb.codehaus.org
*
* Copyright (c) 2007-2009, Institut de Recherche pour le Développement (IRD)
* Copyright (c) 2009, Geomatys
*
* This file is part of MDweb.
*
* MDweb is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 3.0 of the License.
*
* MDweb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details:
* http://www.gnu.org/licenses/lgpl-3.0.html
*
*/
package org.mochafaces.taglib.resource;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import org.mochafaces.taglib.BaseELTag;
/**
*
* @author kevindelfour
*/
public class MetaResourceTag extends BaseELTag {
/* Fields */
private static final String COMP_TYPE = "org.mochafaces.MetaResourceLoader";
private static final String RENDERER_TYPE = "org.mochafaces.renderkit.HTMLMetaResourceLoader";
private ValueExpression httpEquiv = null;
private ValueExpression content = null;
private ValueExpression name = null;
private ValueExpression lang = null;
/* Methods*/
/**
* @see getComponentType in class UITreeTableELTag
* @return component type
*/
@Override
public String getComponentType() {
return COMP_TYPE;
}
/**
* @see getComponentType in class UITreeTableELTag
* @return component type
*/
@Override
public String getRendererType() {
return RENDERER_TYPE;
}
/**
* @override setProperties in class UITreeTableELTag
* @param component
*/
@Override
public void setProperties(UIComponent component) {
super.setProperties(component);
component.setValueExpression("httpEquiv", getHttpEquiv());
component.setValueExpression("content", getContent());
component.setValueExpression("name", getName());
component.setValueExpression("lang", getLang());
}
/**
* @override release in class UITreeTableELTag
*/
@Override
public void release() {
super.release();
setHttpEquiv(null);
setContent(null);
setName(null);
setLang(null);
}
/**
* @return the httpEquiv
*/
public ValueExpression getHttpEquiv() {
return httpEquiv;
}
/**
* @param httpEquiv the httpEquiv to set
*/
public void setHttpEquiv(ValueExpression httpEquiv) {
this.httpEquiv = httpEquiv;
}
/**
* @return the content
*/
public ValueExpression getContent() {
return content;
}
/**
* @param content the content to set
*/
public void setContent(ValueExpression content) {
this.content = content;
}
/**
* @return the name
*/
public ValueExpression getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(ValueExpression name) {
this.name = name;
}
/**
* @return the lang
*/
public ValueExpression getLang() {
return lang;
}
/**
* @param lang the lang to set
*/
public void setLang(ValueExpression lang) {
this.lang = lang;
}
} | [
"kdelfour@435c697f-6949-0410-9f2e-81b55f2b53f5"
] | kdelfour@435c697f-6949-0410-9f2e-81b55f2b53f5 |
b234e2a07ed94b285d3b76ccdf42e30060e2c41e | 4d0f2d62d1c156d936d028482561585207fb1e49 | /Ma nguon/zcs-8.0.2_GA_5570-src/ZimbraServer/src/java/com/zimbra/cs/index/ProxiedContactHit.java | 07d2caf6be4152ac9afe973e14e0d9074e3b47c8 | [] | no_license | vuhung/06-email-captinh | e3f0ff2e84f1c2bc6bdd6e4167cd7107ec42c0bd | af828ac73fc8096a3cc096806c8080e54d41251f | refs/heads/master | 2020-07-08T09:09:19.146159 | 2013-05-18T12:57:24 | 2013-05-18T12:57:24 | 32,319,083 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2012
*
* The contents of this file are subject to the Zimbra Public License
* Version 1.3 ("License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.zimbra.com/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
* ***** END LICENSE BLOCK *****
*/
package com.zimbra.cs.index;
import com.zimbra.common.service.ServiceException;
import com.zimbra.common.soap.MailConstants;
import com.zimbra.common.soap.Element;
import com.zimbra.common.util.ZimbraLog;
/**
* A {@link ZimbraHit} which is being proxied from another server: i.e. we did a SOAP request somewhere else and are now
* wrapping results we got from request.
*/
public final class ProxiedContactHit extends ProxiedHit {
/**
* @param sortValue - typically A_FILE_AS_STR rather than A_SORT_FIELD (the value for general ProxiedHits)
*/
public ProxiedContactHit(ZimbraQueryResultsImpl results, Element elt, String sortValue) {
super(results, elt, sortValue);
}
@Override
String getName() throws ServiceException {
return super.getElement().getAttribute(MailConstants.A_FILE_AS_STR);
}
}
| [
"[email protected]@ec614674-f94a-24a8-de76-55dc00f2b931"
] | [email protected]@ec614674-f94a-24a8-de76-55dc00f2b931 |
b7d561ae26acacc8d05148c514af5cedf8eea13c | afba7955718844d9a74515168f8bd8e728ec27ba | /src/main/java/eu/matejkormuth/starving/physical/mapped/MappedSetter.java | f3f515846b539951caad9b3919dd5c4ba89c2e9e | [
"BSD-2-Clause"
] | permissive | dobrakmato/starving3 | 5af7dcc0d7391938c4b28e0ac72a78e88a3454b0 | fda627c56c657be25ee8c675aabf6bdd4079dab7 | refs/heads/master | 2022-06-21T21:05:09.492105 | 2020-10-13T09:01:09 | 2020-10-13T09:01:09 | 39,527,933 | 0 | 1 | NOASSERTION | 2022-06-21T00:46:52 | 2015-07-22T20:11:50 | Java | UTF-8 | Java | false | false | 1,584 | java | /**
* Starving - Bukkit API server mod with Zombies.
* Copyright (c) 2015, Matej Kormuth <http://www.github.com/dobrakmato>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package eu.matejkormuth.starving.physical.mapped;
@FunctionalInterface
public interface MappedSetter<T> {
void apply(T value);
}
| [
"[email protected]"
] | |
649222976a7cbe2bab1840b8527479b497b9c04c | 8b6b025408deed1d067ff8bd4ef3c536f9c79543 | /testkit-utilities/src/main/java/gov/nist/toolkit/testkitutilities/TestEnvConfig.java | 6a966f805e74e0b18b32deed569fceb09c2cdad8 | [] | no_license | usnistgov/iheos-toolkit2 | 96847a78a05ff4e86fb9ed78ab67db9851170f9d | 61b612a7378e1df32f8685ac13f1a14b1bf69002 | refs/heads/master | 2023-08-17T07:16:34.206995 | 2023-06-21T17:02:37 | 2023-06-21T17:02:37 | 61,730,404 | 48 | 29 | null | 2023-07-13T23:54:57 | 2016-06-22T15:32:13 | Java | UTF-8 | Java | false | false | 902 | java | package gov.nist.toolkit.testkitutilities;
import java.util.ArrayList;
import java.util.List;
public class TestEnvConfig {
static List<String> configOptions;
static List<String> logDirOptions;
static public String testkit = "/Users/bill/dev/testkit";
static {
configOptions = new ArrayList<String>();
configOptions.add("--testkit");
configOptions.add(testkit);
configOptions.add("--toolkit");
configOptions.add("/Users/bill/exp/xdstoolkit");
logDirOptions = new ArrayList<String>();
logDirOptions.add("--logdir");
logDirOptions.add("/Users/bill/tmp/xdstest");
}
static public List<String> getConfigOptions() {
List<String> a = new ArrayList<String>();
a.addAll(configOptions);
a.addAll(logDirOptions);
return a;
}
static protected List<String> getConfigOptionsNoLogDir() {
List<String> a = new ArrayList<String>();
a.addAll(configOptions);
return a;
}
}
| [
"[email protected]"
] | |
943149e9cc14d18384d80b34cb8416889451b4b8 | 79be998ccbe8eeec356e719bd5a32cace8444c46 | /persistence/src/main/java/today/smarthealthcare/ppv1/persistence/model/selfHealthCheck/SelfHealthCheck.java | 178c07e9cd8e75d584853935797dfc2f862ff635 | [] | no_license | smarthealthcaretoday/personal-portal-prototype-v1 | 8e837f76d57b18c9c097096727f12f6098f31028 | fd6e283e7ff41e323944b44ca7178de989d0b775 | refs/heads/master | 2021-09-03T10:20:52.229037 | 2018-01-08T10:34:00 | 2018-01-08T10:34:00 | 116,662,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,637 | java | package today.smarthealthcare.ppv1.persistence.model.selfHealthCheck;
import javax.persistence.*;
import java.util.Date;
/**
* @author: Vadim Nesmashnov
*/
@Entity
@Table(name = "SELFHEALTHCHECK")
public class SelfHealthCheck {
@Id
@GeneratedValue
private Long id;
@Column(name = "PATIENT_ID")
private Long patientId;
private boolean headache;
private boolean painInBones;
private boolean painInRespiratoryTract;
private boolean stomachacheTop;
private boolean stomachacheMiddle;
private boolean stomachacheBottom;
private boolean rheum;
private boolean cough;
private boolean painInThroat;
private boolean painInLungs;
private boolean rheumAndThroat;
private boolean stitchesInHeartZone;
private boolean stitchesInOtherBodyParts;
private boolean cardiacRhythmDisorders;
private boolean fever;
private boolean vomiting;
private boolean diarrhea;
private boolean injury;
private boolean inflammationVisible;
private boolean inflammationNotVisible;
private boolean urination;
private boolean anxiety;
@Temporal(TemporalType.TIMESTAMP)
private Date date;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPatientId() {
return patientId;
}
public void setPatientId(Long patientId) {
this.patientId = patientId;
}
public boolean isHeadache() {
return headache;
}
public void setHeadache(boolean headache) {
this.headache = headache;
}
public boolean isPainInBones() {
return painInBones;
}
public void setPainInBones(boolean painInBones) {
this.painInBones = painInBones;
}
public boolean isPainInRespiratoryTract() {
return painInRespiratoryTract;
}
public void setPainInRespiratoryTract(boolean painInRespiratoryTract) {
this.painInRespiratoryTract = painInRespiratoryTract;
}
public boolean isStomachacheTop() {
return stomachacheTop;
}
public void setStomachacheTop(boolean stomachacheTop) {
this.stomachacheTop = stomachacheTop;
}
public boolean isStomachacheMiddle() {
return stomachacheMiddle;
}
public void setStomachacheMiddle(boolean stomachacheMiddle) {
this.stomachacheMiddle = stomachacheMiddle;
}
public boolean isStomachacheBottom() {
return stomachacheBottom;
}
public void setStomachacheBottom(boolean stomachacheBottom) {
this.stomachacheBottom = stomachacheBottom;
}
public boolean isRheum() {
return rheum;
}
public void setRheum(boolean rheum) {
this.rheum = rheum;
}
public boolean isCough() {
return cough;
}
public void setCough(boolean cough) {
this.cough = cough;
}
public boolean isPainInThroat() {
return painInThroat;
}
public void setPainInThroat(boolean painInThroat) {
this.painInThroat = painInThroat;
}
public boolean isPainInLungs() {
return painInLungs;
}
public void setPainInLungs(boolean painInLungs) {
this.painInLungs = painInLungs;
}
public boolean isRheumAndThroat() {
return rheumAndThroat;
}
public void setRheumAndThroat(boolean rheumAndThroat) {
this.rheumAndThroat = rheumAndThroat;
}
public boolean isStitchesInHeartZone() {
return stitchesInHeartZone;
}
public void setStitchesInHeartZone(boolean stitchesInHeartZone) {
this.stitchesInHeartZone = stitchesInHeartZone;
}
public boolean isStitchesInOtherBodyParts() {
return stitchesInOtherBodyParts;
}
public void setStitchesInOtherBodyParts(boolean stitchesInOtherBodyParts) {
this.stitchesInOtherBodyParts = stitchesInOtherBodyParts;
}
public boolean isCardiacRhythmDisorders() {
return cardiacRhythmDisorders;
}
public void setCardiacRhythmDisorders(boolean cardiacRhythmDisorders) {
this.cardiacRhythmDisorders = cardiacRhythmDisorders;
}
public boolean isFever() {
return fever;
}
public void setFever(boolean fever) {
this.fever = fever;
}
public boolean isVomiting() {
return vomiting;
}
public void setVomiting(boolean vomiting) {
this.vomiting = vomiting;
}
public boolean isDiarrhea() {
return diarrhea;
}
public void setDiarrhea(boolean diarrhea) {
this.diarrhea = diarrhea;
}
public boolean isInjury() {
return injury;
}
public void setInjury(boolean injury) {
this.injury = injury;
}
public boolean isInflammationVisible() {
return inflammationVisible;
}
public void setInflammationVisible(boolean inflammationVisible) {
this.inflammationVisible = inflammationVisible;
}
public boolean isInflammationNotVisible() {
return inflammationNotVisible;
}
public void setInflammationNotVisible(boolean inflammationNotVisible) {
this.inflammationNotVisible = inflammationNotVisible;
}
public boolean isUrination() {
return urination;
}
public void setUrination(boolean urination) {
this.urination = urination;
}
public boolean isAnxiety() {
return anxiety;
}
public void setAnxiety(boolean anxiety) {
this.anxiety = anxiety;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
| [
"[email protected]"
] | |
ca613ff24b46e565178fdbd999fdad4daaeaf607 | f20e12a8ed114eee984888cda0a01f43c52cb3a5 | /openfab-isa95-mesa-model/src/main/java/org/mesa/xml/b2mml_v0600/PersonNameType.java | b296d0264f40d3b03584be6f16c90f4a57fb9c6b | [] | no_license | skioppetto/openfab | 25f4dfd8a06d9fe6a087ca371c1cd13761f1a94b | a58e8a5cf48822be384f6db1139dedd917a4baa0 | refs/heads/master | 2021-09-14T22:59:31.944689 | 2018-05-21T16:32:34 | 2018-05-21T16:33:12 | 109,605,827 | 1 | 0 | null | 2018-05-06T08:39:36 | 2017-11-05T18:41:46 | Java | IBM852 | Java | false | false | 1,094 | java | //
// Questo file Ŕ stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Qualsiasi modifica a questo file andrÓ persa durante la ricompilazione dello schema di origine.
// Generato il: 2017.11.12 alle 03:08:18 PM CET
//
package org.mesa.xml.b2mml_v0600;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java per PersonNameType complex type.
*
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
*
* <pre>
* <complexType name="PersonNameType">
* <simpleContent>
* <restriction base="<http://www.mesa.org/xml/B2MML-V0600>IdentifierType">
* </restriction>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PersonNameType")
public class PersonNameType
extends IdentifierType
{
}
| [
"skioppetto@HOME-VAIO"
] | skioppetto@HOME-VAIO |
c663595d1b5279d5b2de7d64c7f879de84033c8b | a6518a7a2cb8bfdd8bf6028c670dbdefd2cca508 | /mhvp-integrated-ptr/src/main/java/com/culiu/mhvp/integrated/ptr/pulltorefresh/PullToRefreshAdapterViewBase.java | 2d36b05279bf871107fca1b637ee4cac8615ba57 | [
"Apache-2.0"
] | permissive | XAVlER-S/MagicHeaderViewPager | 9609a0c99e4db09ea642f6184e71b842a36e2888 | 790213fbc796e3a8d7ec97b55217e40172ebae54 | refs/heads/master | 2022-04-06T10:33:14.730891 | 2020-02-26T18:59:13 | 2020-02-26T18:59:13 | 48,333,260 | 19 | 4 | null | null | null | null | UTF-8 | Java | false | false | 18,038 | java | /*******************************************************************************
* Copyright 2011, 2012 Chris Banes. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
* required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*******************************************************************************/
package com.culiu.mhvp.integrated.ptr.pulltorefresh;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.culiu.mhvp.integrated.ptr.pulltorefresh.internal.EmptyViewMethodAccessor;
import com.culiu.mhvp.integrated.ptr.R;
public abstract class PullToRefreshAdapterViewBase<T extends AbsListView> extends PullToRefreshBase<T> implements OnScrollListener {
private static FrameLayout.LayoutParams convertEmptyViewLayoutParams(ViewGroup.LayoutParams lp) {
FrameLayout.LayoutParams newLp = null;
if(null != lp) {
newLp = new FrameLayout.LayoutParams(lp);
if(lp instanceof LayoutParams) {
newLp.gravity = ((LayoutParams)lp).gravity;
} else {
newLp.gravity = Gravity.CENTER;
}
}
return newLp;
}
private boolean mLastItemVisible;
private OnScrollListener mOnScrollListener;
private OnLastItemVisibleListener mOnLastItemVisibleListener;
private View mEmptyView;
// private IndicatorLayout mIndicatorIvTop;
// private IndicatorLayout mIndicatorIvBottom;
private boolean mShowIndicator;
private boolean mScrollEmptyView = true;
private OnBackWardPositionVisibleListener mOnBackWardPositionVisibleListener;
public PullToRefreshAdapterViewBase(Context context) {
super(context);
mRefreshableView.setOnScrollListener(this);
}
public PullToRefreshAdapterViewBase(Context context, AttributeSet attrs) {
super(context, attrs);
mRefreshableView.setOnScrollListener(this);
}
public PullToRefreshAdapterViewBase(Context context, Mode mode) {
super(context, mode);
mRefreshableView.setOnScrollListener(this);
}
public PullToRefreshAdapterViewBase(Context context, Mode mode, AnimationStyle animStyle) {
super(context, mode, animStyle);
mRefreshableView.setOnScrollListener(this);
}
/**
* Gets whether an indicator graphic should be displayed when the View is in a state where a Pull-to-Refresh can happen. An
* example of this state is when the Adapter View is scrolled to the top and the mode is set to {@link Mode#PULL_FROM_START}.
* The default value is <var>true</var> if {@link PullToRefreshBase#isPullToRefreshOverScrollEnabled()
* isPullToRefreshOverScrollEnabled()} returns false.
* @return true if the indicators will be shown
*/
public boolean getShowIndicator() {
return mShowIndicator;
}
/** 上一个可见的Item的索引 **/
private int mPreviousItem = 0;
private boolean canInvoke = true;
public final void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount,
final int totalItemCount) {
/**
* Set whether the Last Item is Visible. lastVisibleItemIndex is a zero-based index, so we minus one totalItemCount to check
*/
if(null != mOnLastItemVisibleListener) {
mLastItemVisible = (totalItemCount > 0) && (firstVisibleItem + visibleItemCount >= totalItemCount - 1);
}
int lastItem = firstVisibleItem + visibleItemCount;
if(null != mOnBackWardPositionVisibleListener) {
if(lastItem < totalItemCount - mBackWardPosition){
canInvoke = true;
}
if(lastItem > mPreviousItem && lastItem >= totalItemCount - mBackWardPosition && canInvoke) {
mOnBackWardPositionVisibleListener.onBackWardPositionVisible();
canInvoke = false;
}
}
// If we're showing the indicator, check positions...
if(getShowIndicatorInternal()) {
updateIndicatorViewsVisibility();
}
// Finally call OnScrollListener if we have one
if(null != mOnScrollListener) {
mOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
}
mPreviousItem = lastItem;
}
public final void onScrollStateChanged(final AbsListView view, final int state) {
/**
* Check that the scrolling has stopped, and that the last item is visible.
*/
if(state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) {
mOnLastItemVisibleListener.onLastItemVisible();
}
if(null != mOnScrollListener) {
mOnScrollListener.onScrollStateChanged(view, state);
}
canInvoke = true;
}
/**
* Pass-through method for {@link PullToRefreshBase#getRefreshableView() getRefreshableView()}.
* {@link AdapterView#setAdapter(Adapter)} setAdapter(adapter)}. This is just for convenience!
* @param adapter - Adapter to set
*/
public void setAdapter(ListAdapter adapter) {
((AdapterView<ListAdapter>)mRefreshableView).setAdapter(adapter);
}
/**
* Sets the Empty View to be used by the Adapter View.
* <p/>
* We need it handle it ourselves so that we can Pull-to-Refresh when the Empty View is shown.
* <p/>
* Please note, you do <strong>not</strong> usually need to call this method yourself. Calling setEmptyView on the AdapterView
* will automatically call this method and set everything up. This includes when the Android Framework automatically sets the
* Empty View based on it's ID.
* @param newEmptyView - Empty View to be used
*/
public final void setEmptyView(View newEmptyView) {
FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
if(null != newEmptyView) {
// New view needs to be clickable so that Android recognizes it as a
// target for Touch Events
newEmptyView.setClickable(true);
ViewParent newEmptyViewParent = newEmptyView.getParent();
if(null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
((ViewGroup)newEmptyViewParent).removeView(newEmptyView);
}
// We need to convert any LayoutParams so that it works in our
// FrameLayout
FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
if(null != lp) {
refreshableViewWrapper.addView(newEmptyView, lp);
} else {
refreshableViewWrapper.addView(newEmptyView);
}
}
if(mRefreshableView instanceof EmptyViewMethodAccessor) {
((EmptyViewMethodAccessor)mRefreshableView).setEmptyViewInternal(newEmptyView);
} else {
mRefreshableView.setEmptyView(newEmptyView);
}
mEmptyView = newEmptyView;
}
/**
* Pass-through method for {@link PullToRefreshBase#getRefreshableView() getRefreshableView()}.
* {@link AdapterView#setOnItemClickListener(OnItemClickListener) setOnItemClickListener(listener)}. This is just for
* convenience!
* @param listener - OnItemClickListener to use
*/
public void setOnItemClickListener(OnItemClickListener listener) {
mRefreshableView.setOnItemClickListener(listener);
}
public final void setOnLastItemVisibleListener(OnLastItemVisibleListener listener) {
mOnLastItemVisibleListener = listener;
}
public final void setOnBackWardPositionVisibleListener(OnBackWardPositionVisibleListener listener) {
mOnBackWardPositionVisibleListener = listener;
}
public final void setOnScrollListener(OnScrollListener listener) {
mOnScrollListener = listener;
}
public final void setScrollEmptyView(boolean doScroll) {
mScrollEmptyView = doScroll;
}
/**
* Sets whether an indicator graphic should be displayed when the View is in a state where a Pull-to-Refresh can happen. An
* example of this state is when the Adapter View is scrolled to the top and the mode is set to {@link Mode#PULL_FROM_START}
* @param showIndicator - true if the indicators should be shown.
*/
public void setShowIndicator(boolean showIndicator) {
mShowIndicator = showIndicator;
if(getShowIndicatorInternal()) {
// If we're set to Show Indicator, add/update them
addIndicatorViews();
} else {
// If not, then remove then
removeIndicatorViews();
}
}
;
@Override
protected void onPullToRefresh() {
super.onPullToRefresh();
if(getShowIndicatorInternal()) {
switch(getCurrentMode()) {
case PULL_FROM_END:
// mIndicatorIvBottom.pullToRefresh();
break;
case PULL_FROM_START:
// mIndicatorIvTop.pullToRefresh();
break;
default:
// NO-OP
break;
}
}
}
protected void onRefreshing(boolean doScroll) {
super.onRefreshing(doScroll);
if(getShowIndicatorInternal()) {
updateIndicatorViewsVisibility();
}
}
@Override
protected void onReleaseToRefresh() {
super.onReleaseToRefresh();
if(getShowIndicatorInternal()) {
switch(getCurrentMode()) {
case PULL_FROM_END:
// mIndicatorIvBottom.releaseToRefresh();
break;
case PULL_FROM_START:
// mIndicatorIvTop.releaseToRefresh();
break;
default:
// NO-OP
break;
}
}
}
@Override
protected void onReset() {
super.onReset();
if(getShowIndicatorInternal()) {
updateIndicatorViewsVisibility();
}
}
@Override
protected void handleStyledAttributes(TypedArray a) {
// Set Show Indicator to the XML value, or default value
mShowIndicator = a.getBoolean(R.styleable.PullToRefresh_ptrShowIndicator, ! isPullToRefreshOverScrollEnabled());
}
protected boolean isReadyForPullStart() {
return isFirstItemVisible() && isHeaderViewAtTop();
}
/**
* @return
*/
private boolean isHeaderViewAtTop() {
if(mRefreshableView instanceof ListView){
if(mRefreshableView.getFirstVisiblePosition() > 1) {
return false;
}
ListView listView = (ListView)mRefreshableView;
if(listView != null && listView.getChildCount() > 0){
View view = listView.getChildAt(0);
if(view != null){
return view.getTop() == 0;
}
}
}
return true;
}
protected boolean isReadyForPullEnd() {
return isLastItemVisible();
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if(null != mEmptyView && ! mScrollEmptyView) {
mEmptyView.scrollTo( - l, - t);
}
}
@Override
protected void updateUIForMode() {
super.updateUIForMode();
// Check Indicator Views consistent with new Mode
if(getShowIndicatorInternal()) {
addIndicatorViews();
} else {
removeIndicatorViews();
}
}
private void addIndicatorViews() {
// Mode mode = getMode();
// FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
//
// if(mode.showHeaderLoadingLayout() && null == mIndicatorIvTop) {
// // If the mode can pull down, and we don't have one set already
//// mIndicatorIvTop = new IndicatorLayout(getContext(), Mode.PULL_FROM_START);
//// FrameLayout.LayoutParams params =
//// new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//// params.rightMargin = getResources().getDimensionPixelSize(R.dimen.indicator_right_padding);
//// params.gravity = Gravity.TOP | Gravity.RIGHT;
//// refreshableViewWrapper.addView(mIndicatorIvTop, params);
//
// } else if( ! mode.showHeaderLoadingLayout() && null != mIndicatorIvTop) {
// // If we can't pull down, but have a View then remove it
// refreshableViewWrapper.removeView(mIndicatorIvTop);
// mIndicatorIvTop = null;
// }
//
// if(mode.showFooterLoadingLayout() && null == mIndicatorIvBottom) {
// // If the mode can pull down, and we don't have one set already
// mIndicatorIvBottom = new IndicatorLayout(getContext(), Mode.PULL_FROM_END);
// FrameLayout.LayoutParams params =
// new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
// params.rightMargin = getResources().getDimensionPixelSize(R.dimen.indicator_right_padding);
// params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
// refreshableViewWrapper.addView(mIndicatorIvBottom, params);
//
// } else if( ! mode.showFooterLoadingLayout() && null != mIndicatorIvBottom) {
// // If we can't pull down, but have a View then remove it
// refreshableViewWrapper.removeView(mIndicatorIvBottom);
// mIndicatorIvBottom = null;
// }
}
private boolean getShowIndicatorInternal() {
return mShowIndicator && isPullToRefreshEnabled();
}
private boolean isFirstItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if(null == adapter || adapter.isEmpty()) {
return true;
} else {
/**
* This check should really just be: mRefreshableView.getFirstVisiblePosition() == 0, but PtRListView internally use a
* HeaderView which messes the positions up. For now we'll just add one to account for it and rely on the inner
* condition which checks getTop().
*/
if(mRefreshableView.getFirstVisiblePosition() <= 1) {
final View firstVisibleChild = mRefreshableView.getChildAt(0);
if(firstVisibleChild != null) {
return firstVisibleChild.getTop() >= mRefreshableView.getTop();
}
}
}
return false;
}
private boolean isLastItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if(null == adapter || adapter.isEmpty()) {
return true;
} else {
final int lastItemPosition = mRefreshableView.getCount() - 1;
final int lastVisiblePosition = mRefreshableView.getLastVisiblePosition();
/**
* This check should really just be: lastVisiblePosition == lastItemPosition, but PtRListView internally uses a
* FooterView which messes the positions up. For me we'll just subtract one to account for it and rely on the inner
* condition which checks getBottom().
*/
if(lastVisiblePosition >= lastItemPosition - 1) {
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
if(lastVisibleChild != null) {
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
}
}
}
return false;
}
private void removeIndicatorViews() {
// if(null != mIndicatorIvTop) {
// getRefreshableViewWrapper().removeView(mIndicatorIvTop);
// mIndicatorIvTop = null;
// }
//
// if(null != mIndicatorIvBottom) {
// getRefreshableViewWrapper().removeView(mIndicatorIvBottom);
// mIndicatorIvBottom = null;
// }
}
private void updateIndicatorViewsVisibility() {
// if(null != mIndicatorIvTop) {
// if( ! isRefreshing() && isReadyForPullStart()) {
// if( ! mIndicatorIvTop.isVisible()) {
// mIndicatorIvTop.show();
// }
// } else {
// if(mIndicatorIvTop.isVisible()) {
// mIndicatorIvTop.hide();
// }
// }
// }
//
// if(null != mIndicatorIvBottom) {
// if( ! isRefreshing() && isReadyForPullEnd()) {
// if( ! mIndicatorIvBottom.isVisible()) {
// mIndicatorIvBottom.show();
// }
// } else {
// if(mIndicatorIvBottom.isVisible()) {
// mIndicatorIvBottom.hide();
// }
// }
// }
}
}
| [
"[email protected]"
] | |
fda2fde6ef3eab9fda4142fcae93ffdf37dc8c73 | 9c4dd2c2e5255ac9a355aec335fbc914ee1e39c2 | /Testing/Junit5/src/test/java/by/pva/testing/testExamples/TestThirdPartyAssertion.java | bedcb0e4bc7f291e0219c3f66e93d2042164687c | [] | no_license | VAPortyanko/Learning | a8a79bc10b2eeb12c81f10198a0923e72d8002d4 | 23664bfe45eb12f717e3585eb7f84b729fa6397c | refs/heads/master | 2022-07-16T10:45:39.259839 | 2021-11-28T17:56:17 | 2021-11-28T17:56:17 | 88,914,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package by.pva.testing.testExamples;
import org.junit.jupiter.api.Test;
import by.pva.testing.classesForTesting.Calculator;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class TestThirdPartyAssertion {
private final Calculator calculator = new Calculator();
@Test
void assertWithHamcrestMatcher() {
assertThat(calculator.subtract(4, 1), is(equalTo(3)));
}
}
| [
"[email protected]"
] | |
ce80a8480ceb56b1f8ce5aed4679544f7d8b567a | ee5855f849236715af65a631d4faffa1632148a7 | /src/main/java/com/wayne/bean/cycle/Main.java | 0618a71b0e8b5c710b97b33f0f3b2adc0773cacf | [] | no_license | WayneDiao/wayne-spring | c4d18db59f8424034b94d4f731ad052431b1d44f | 7eb227fe7bb6a12c65666d0fe6922886cde19b45 | refs/heads/master | 2020-03-27T09:09:01.052604 | 2018-09-11T14:38:32 | 2018-09-11T14:38:32 | 146,317,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | package com.wayne.bean.cycle;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @Author: wayne
* @Date: 2018/8/29
* @Description:
*/
public class Main {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:bean/beans-cycle.xml");
Car car = context.getBean("car",Car.class);
System.out.println(car);
/*关闭容器*/
((ClassPathXmlApplicationContext) context).close();
}
}
| [
"[email protected]"
] | |
3b67bff8d0351089e368d72e63a7885e73c5f4e4 | d6a1df43bc5aaadb10d831215b6110320d14af74 | /app01/src/main/java/com/tampro/app/service/ProjectManagerService.java | 4172658a24985493c9eb97ee4948cac054e46d26 | [] | no_license | xomrayno1/project-management | 399a5d277253fab023880bc59fde0b6e870806aa | 5b84387f449e0d5539fe6d7b909146d29042831a | refs/heads/main | 2023-01-23T00:17:57.310061 | 2020-12-11T18:33:17 | 2020-12-11T18:33:17 | 314,780,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | package com.tampro.app.service;
import java.util.List;
import com.tampro.app.entity.ProjectManager;
public interface ProjectManagerService {
public void saveProjectManager(ProjectManager projectManager) throws Exception;
public void deleteProjectManager(ProjectManager projectManager) throws Exception;
List<ProjectManager> getProjectByProjectId(long projectId);
ProjectManager getByProjectAndAccount(long projectId, long accountId);
}
| [
"xomrayno5"
] | xomrayno5 |
67435077ccb251f230722a477de64514d6a008c3 | 8671eed16381452da0066fb4640dadd6b06f74c9 | /src/main/java/com/vzs/reactive/reactive/controller/HelloController.java | 52f9a0d2c3cc02989f521fb2ca71954ea0795707 | [] | no_license | vzsEdu/ReactorTest | 9e7f3f4dd47755e3dc46378a82343915d79f82e2 | 8231fcf479eb21d232f76e38ddafef09a9a3cc25 | refs/heads/master | 2020-04-15T01:40:50.371130 | 2019-01-09T03:01:46 | 2019-01-09T03:01:46 | 164,286,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | package com.vzs.reactive.reactive.controller;
import com.google.common.collect.Lists;
import com.vzs.reactive.reactive.config.interceptor.CustomInterceptors;
import com.vzs.reactive.reactive.config.interceptor.MyInterceptor;
import com.vzs.reactive.reactive.controller.vo.MyResponse;
import com.vzs.reactive.reactive.jpa.entity.ReactorTestTableEntity;
import com.vzs.reactive.reactive.jpa.respository.ReactorTestTableEntityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/hello/")
public class HelloController {
@Autowired
private ReactorTestTableEntityRepository reactorTestTableEntityRepository;
@GetMapping("jpa")
public List<String> helloJpa() {
List<ReactorTestTableEntity> all = Lists.newArrayList(reactorTestTableEntityRepository.findAll());
return all.stream().map(ReactorTestTableEntity::getName).collect(Collectors.toList());
}
@GetMapping("customer-interceptor")
@CustomInterceptors(value = {MyInterceptor.class})
public MyResponse<String> helloCustomerInterceptor(@RequestParam(required = false, defaultValue = "0") Long number) {
MyResponse<String> response = new MyResponse<>();
if (number == 0) {
response.setData("Success");
} else {
response.setError("Fail");
}
return response;
}
}
| [
"[email protected]"
] | |
ea498ac347a61a6eb9c8e9ea84a7352e900850d5 | 477c2fac82ad7eabd1f4581cf6feba21083e6c00 | /app/src/main/java/com/khames/stickynotes/SignUpFragment.java | 4463617714963299a3c7e020bc30e50ae7b8f3ee | [] | no_license | AhmedKhames/StickyNotes | 6e7af96bc041078659cab78459fcee6fcd539050 | 91a0d1067362fb0706f525af1edb626c8a07a9c0 | refs/heads/master | 2020-05-17T02:23:04.087916 | 2019-04-25T14:35:22 | 2019-04-25T14:35:22 | 183,452,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,165 | java | package com.khames.stickynotes;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.w3c.dom.Text;
/**
* A simple {@link Fragment} subclass.
*/
public class SignUpFragment extends Fragment {
private EditText password,username,confirmPassword;
private Button signUpButton;
private DatabaseHelper databaseHelper;
private Users user;
public SignUpFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View signUpView = inflater.inflate(R.layout.fragment_sign_up, container, false);
username = (EditText)signUpView.findViewById(R.id.input_username);
password = (EditText)signUpView.findViewById(R.id.input_password);
confirmPassword = (EditText)signUpView.findViewById(R.id.input_password_confirm);
signUpButton = (Button)signUpView.findViewById(R.id.sign_up);
user = new Users();
databaseHelper = new DatabaseHelper(getContext());
signUpButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
validateAndRegister();
}
});
return signUpView;
}
private void validateAndRegister() {
String usernameText = username.getText().toString();
String passText = password.getText().toString();
String confirmText = confirmPassword.getText().toString();
if (TextUtils.isEmpty(usernameText) || TextUtils.isEmpty(passText) || TextUtils.isEmpty(confirmText)){
Toast.makeText(getContext(),"This Field is required",Toast.LENGTH_SHORT).show();
}else if(!passText.equals(confirmText)) {
Toast.makeText(getContext(), "The password dose not match confirmation", Toast.LENGTH_SHORT).show();
}else if (databaseHelper.checkUser(usernameText)){
Toast.makeText(getContext(), "This Username is already registered", Toast.LENGTH_SHORT).show();
}else {
try {
user.setName(usernameText);
user.setPassword(passText);
databaseHelper.addUser(user);
Toast.makeText(getContext(),"Welcome",Toast.LENGTH_SHORT).show();
emptyInputEditText();
sendUserToHomeActivity();
}catch (Exception e){
Log.e("Error", e.getMessage());
}
}
}
private void emptyInputEditText() {
username.setText(null);
password.setText(null);
confirmPassword.setText(null);
}
private void sendUserToHomeActivity() {
Intent homeIntent = new Intent(getContext(),HomeActivity.class);
startActivity(homeIntent);
}
}
| [
"[email protected]"
] | |
2110c073b09f4c86eb68aa0d12869e49b060bfe5 | d019383372b7abb9f78e4088afc19607bb64b220 | /app/src/main/java/com/linsr/wanandroid/biz/register/RegisterContact.java | cd9e3327eea3f524513c15b41b7b2d7821cc2204 | [] | no_license | linsenrong666/TransportPlatform | 4ca1c6c268e2636af9f529af4716696333a73c16 | 8dc8586589cefbf724b5a3d55a855d717ac07908 | refs/heads/master | 2020-03-10T12:20:51.751631 | 2018-04-13T08:55:50 | 2018-04-13T08:55:50 | 129,375,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package com.linsr.wanandroid.biz.register;
/**
* Description
@author Linsr
*/
public interface RegisterContact {
interface View {
void setCode(String phone);
void setCodeBtn(boolean canClick,String text);
}
interface Presenter {
boolean paramsValid(String phone, String pwd1, String pwd2);
void doRegister(String phone, String password, String code);
void identifyingCode(String phone);
}
}
| [
"[email protected]"
] | |
db417e2ac6ef4688e2406b8f8dfeced85867e1b5 | 83b71168879c34ae05f0aa2862a256f09310e885 | /src/main/java/Method/Client/utils/Patcher/Events/EntityPlayerJumpEvent.java | 555ab53f2274f0206588bdbc9d92e9bebbb07917 | [
"WTFPL"
] | permissive | RaptorClientDevelopment/futrexclientsource | a31fe2b3870b69005e246c7fc593adf9af3d054b | 496f882911c7584fd93012862ad243008cd80bd5 | refs/heads/master | 2023-05-10T02:10:41.903094 | 2021-06-10T06:36:17 | 2021-06-10T06:36:17 | 372,707,546 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package Method.Client.utils.Patcher.Events;
import net.minecraftforge.fml.common.eventhandler.*;
import net.minecraft.entity.player.*;
@Cancelable
public final class EntityPlayerJumpEvent extends Event
{
private float jumpHeight;
private final EntityPlayer player;
public EntityPlayerJumpEvent(final EntityPlayer player) {
this.player = player;
}
public EntityPlayer getPlayer() {
return this.player;
}
public void setJumpHeight(final float jumpHeight) {
this.jumpHeight = jumpHeight;
}
}
| [
"[email protected]"
] | |
3d921140ed3fc58545ec89d9951cc202fb5990b0 | a1ed915f1b20e282c390faf592360e5bf0eceaf6 | /app/src/main/java/com/example/user/myapplication/ItemsAdapters/Sevasa_cam4.java | 162e74d2f920f55d5e47ff7bc33f7db44a59c44b | [] | no_license | EdwinRos96/proyectofinal_moviles1 | cb13212bd2f56c5b790625e573e4d459526e342d | 191275e4d1ff01633f618f91ed9fb088bdc689c1 | refs/heads/master | 2020-06-23T18:27:13.467048 | 2016-12-12T05:43:31 | 2016-12-12T05:43:31 | 73,583,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.example.user.myapplication.ItemsAdapters;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.user.myapplication.R;
public class Sevasa_cam4 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sevasa_cam4);
}
}
| [
"[email protected]"
] | |
2617003de056f9475d41effac9173e7d637a8037 | 8c15bbfde823138ddb8917aa1720889043f629b5 | /app/src/test/java/com/activity/devibar/cartogo/ExampleUnitTest.java | 150c8849a5ea21e008e03bf791accef5ae791826 | [] | no_license | namaedevibar/CarToGo | e9a93141ee6cab3578d414bf89e7c0dc5f66f18d | 99b5fda36bdc8c722411b554bbfb30e5d894e4a3 | refs/heads/master | 2020-09-20T13:59:21.752964 | 2016-09-06T05:05:01 | 2016-09-06T05:05:01 | 67,474,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.activity.devibar.cartogo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
655a2e30577123dcb53386d59d9cd5a0e08b8f8f | c3fd811aff9e80eb46e5f87771a3ce714f2ddb17 | /src/test/java/com/mycompany/myapp/web/rest/errors/ExceptionTranslatorIntTest.java | ec360d782d954e89216acd5931ee279027154edc | [] | no_license | danielzhangcs/course-registration-sys | 78c47bd127b5b240438a466bf9a07bcfe0b91227 | 4174ea80f1685da95a134acc4a2005300be6c308 | refs/heads/master | 2023-01-20T13:06:38.403700 | 2019-09-26T04:50:51 | 2019-09-26T04:50:51 | 211,000,140 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,519 | java | package com.mycompany.myapp.web.rest.errors;
import com.mycompany.myapp.JiuzhangquanzhankeApp;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.zalando.problem.spring.web.advice.MediaTypes;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Test class for the ExceptionTranslator controller advice.
*
* @see ExceptionTranslator
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = JiuzhangquanzhankeApp.class)
public class ExceptionTranslatorIntTest {
@Autowired
private ExceptionTranslatorTestController controller;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
private MockMvc mockMvc;
@Before
public void setup() {
mockMvc = MockMvcBuilders.standaloneSetup(controller)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
@Test
public void testConcurrencyFailure() throws Exception {
mockMvc.perform(get("/test/concurrency-failure"))
.andExpect(status().isConflict())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE));
}
@Test
public void testMethodArgumentNotValid() throws Exception {
mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION))
.andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO"))
.andExpect(jsonPath("$.fieldErrors.[0].field").value("test"))
.andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull"));
}
@Test
public void testParameterizedError() throws Exception {
mockMvc.perform(get("/test/parameterized-error"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.param0").value("param0_value"))
.andExpect(jsonPath("$.params.param1").value("param1_value"));
}
@Test
public void testParameterizedError2() throws Exception {
mockMvc.perform(get("/test/parameterized-error2"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.foo").value("foo_value"))
.andExpect(jsonPath("$.params.bar").value("bar_value"));
}
@Test
public void testMissingServletRequestPartException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-part"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testMissingServletRequestParameterException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-parameter"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testAccessDenied() throws Exception {
mockMvc.perform(get("/test/access-denied"))
.andExpect(status().isForbidden())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.403"))
.andExpect(jsonPath("$.detail").value("test access denied!"));
}
@Test
public void testUnauthorized() throws Exception {
mockMvc.perform(get("/test/unauthorized"))
.andExpect(status().isUnauthorized())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.401"))
.andExpect(jsonPath("$.path").value("/test/unauthorized"))
.andExpect(jsonPath("$.detail").value("test authentication failed!"));
}
@Test
public void testMethodNotSupported() throws Exception {
mockMvc.perform(post("/test/access-denied"))
.andExpect(status().isMethodNotAllowed())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.405"))
.andExpect(jsonPath("$.detail").value("Request method 'POST' not supported"));
}
@Test
public void testExceptionWithResponseStatus() throws Exception {
mockMvc.perform(get("/test/response-status"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"))
.andExpect(jsonPath("$.title").value("test response status"));
}
@Test
public void testInternalServerError() throws Exception {
mockMvc.perform(get("/test/internal-server-error"))
.andExpect(status().isInternalServerError())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.500"))
.andExpect(jsonPath("$.title").value("Internal Server Error"));
}
}
| [
"[email protected]"
] | |
2e71683290a4570162e57dcf9712b131f4f559c8 | 51160e23c9b9dde5dbd18df9c4cafc8509ef30e5 | /app/src/main/java/com/sunmoon/helper/modules/search/SearchActivity.java | 5de00714f8a1971b875904202b36cb9fdaf76410 | [] | no_license | ChenSunMoon/SunMoonHelper | 9cbc5b6549408be556fde1c3baa84e33ccb4b972 | a2246e558d8ffe3119d8daa54c8ba63578c9be2f | refs/heads/master | 2020-12-24T06:19:02.533809 | 2020-07-31T03:02:33 | 2020-07-31T03:02:33 | 73,478,600 | 11 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,280 | java | package com.sunmoon.helper.modules.search;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.sunmoon.helper.R;
import com.sunmoon.helper.base.BaseActivity;
import com.sunmoon.helper.databinding.ActivitySearchBinding;
import com.sunmoon.helper.modules.browser.BrowserActivity;
import com.sunmoon.helper.modules.search.SearchViewModel;
/**
* Created by SunMoon on 2017/5/4.
*/
public class SearchActivity extends BaseActivity{
private ActivitySearchBinding b;
private SearchViewModel vm;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
vm = new SearchViewModel(getIntent().getStringExtra("keyword"));
b = DataBindingUtil.setContentView(this,R.layout.activity_search);
setSupportActionBar(b.toolBar);
b.toolBar.setTitle(vm.getKeyword());
b.toolBar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
initWebSetting();
b.wb.setWebChromeClient(new WebChromeClient(){
});
b.wb.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent =new Intent(SearchActivity.this, BrowserActivity.class);
intent.putExtra("url",url );
startActivity(intent);
return true;
}
});
b.setVm(vm);
}
private void initWebSetting() {
WebSettings settings = b.wb.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setUseWideViewPort(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(true);
settings.setAllowFileAccess(true);
}
}
| [
"[email protected]"
] | |
7fa2ee306fb3eb7784922f0e481b8781fd2f2a44 | c8a9c55376b2b3fb49ed9f7c4122e4384d6ae5ae | /sample/src/main/java/com/example/robospock/tasks/StringAsycTask.java | 1be268f1bec1cafe8e16e973f580fafd329f2750 | [
"MIT"
] | permissive | nolia/RoboSpock | 0661f782a9dac5aa289ba4fc2f8c3780541c7ad3 | 3dd654a93f88de34cf434ce6bd39412d0786723e | refs/heads/master | 2020-04-06T06:24:00.638352 | 2016-05-05T15:56:51 | 2016-05-05T15:59:59 | 58,141,172 | 1 | 0 | null | 2016-05-05T15:29:17 | 2016-05-05T15:29:16 | Java | UTF-8 | Java | false | false | 655 | java | package com.example.robospock.tasks;
import android.content.Context;
import com.example.robospock.activity.TaskActivity;
public class StringAsycTask extends MyRoboAsycTask<String> {
/**
*
*/
private final TaskActivity taskActivity;
public StringAsycTask(final TaskActivity taskActivity, final Context context) {
super(context);
this.taskActivity = taskActivity;
}
@Override
public String call() throws Exception {
return "WebText";
}
@Override
public void onSuccess(final String t) throws Exception {
super.onSuccess(t);
this.taskActivity.setAsyncTest(t);
}
} | [
"[email protected]"
] | |
71832c0dfbdf8306c2eae4fa136dda98577b7f66 | 03661000a84081a63c34c3172ab9d396c58cffef | /Problems/Squirrels and nuts/src/Main.java | 7faaeeecd226127ad8d06a54e6068aae301b6856 | [] | no_license | NC-O3/Simple-Chatty-Bot | b374c97986dcf6c6d7fd5d9a68ea98c03899457c | bda6296a35f682a19ee3178892459ec7d9b4808d | refs/heads/main | 2023-02-04T06:14:47.345261 | 2020-12-18T18:01:55 | 2020-12-18T18:01:55 | 322,669,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numberOfSquirrels = scanner.nextInt();
int numberOfNuts = scanner.nextInt();
int divide = (numberOfNuts / numberOfSquirrels) * numberOfSquirrels;
System.out.println(numberOfNuts - divide);
}
} | [
"[email protected]"
] | |
3839d2112d2c56e0a320f4c908a9bac7cd0ff935 | 27c4df9bf9b34b3a1b3eeb9b9cde2c598ac1d645 | /app/src/main/java/com/example/skaic20200210/MainActivity.java | d7513202b12dab9481e41e2f33487d98307db9b0 | [] | no_license | kkmmrt/skaic20200210 | b6503e4359cccf2af4843628bc852b3471d3f0a7 | c4aab3783628fb182d2228b940edbd73fdc3bf3e | refs/heads/master | 2021-01-02T11:20:23.261583 | 2020-02-10T19:49:46 | 2020-02-10T19:49:46 | 239,599,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.example.skaic20200210;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
] | |
78fbeffb6feb1f1569599d9007f7cb9ae0347203 | ced8e69415b6988b9e3543f1a6280bac626fef0b | /src/main/java/com/example/game/resource/DemoClass.java | af4c8ffe960fb20ab8088cda0686693a7d74d01d | [] | no_license | Jubin9877/Game | 0c7def8d61bd2cda13987b04be7dbf00fb81ed14 | a82a8482ab6aa6f0866166cc57942b37f2933135 | refs/heads/master | 2021-01-23T16:05:21.216662 | 2017-09-08T12:58:24 | 2017-09-08T12:58:24 | 102,721,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package com.example.game.resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class DemoClass {
public static void main(String args[]) throws Exception {
// int values[] = new int[4];
// Object values1[] = new Object[4];
// values1[0] = "Jubin";
// values1[1] = 7;
List<Integer> values = new ArrayList<Integer>();
values.add(3);
values.add(9877);
values.add(1234);
Collections.sort(values);
values.forEach(System.out::println);//Stream API .. Lambda Expression
//values.remove(3);
// Iterator i = values.iterator();
//
// while(i.hasNext())
// {
// System.out.println(i.next());
// }
// for(Integer i : values)
// {
// System.out.println(i);
// }
}
}
| [
"[email protected]"
] | |
2a804e04bbca6664316f17681c5640162e960dee | db6ee2560283cbfb14ed278848f0564d9eb7e785 | /src/main/java/io/vertx/ext/hawkular/impl/DataPoint.java | b60f1e672990fcd439c7e979d69e5511ca5b91a7 | [
"Apache-2.0"
] | permissive | vert-x3/vertx-hawkular-metrics | 7dfcd1effd1be76b3ca86655eed488011a47aafe | 790cd7ca144eedc988f2788d126faea1cf9e7a13 | refs/heads/master | 2023-08-18T20:40:00.056075 | 2018-08-01T22:01:35 | 2018-08-01T22:01:35 | 46,127,760 | 11 | 12 | Apache-2.0 | 2018-07-04T16:09:29 | 2015-11-13T14:50:55 | Java | UTF-8 | Java | false | false | 1,112 | java | /*
* Copyright 2015 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.vertx.ext.hawkular.impl;
import java.util.Objects;
/**
* Base class for metric data points. Defines the metric name and timestamp of the point.
*
* @author Thomas Segismont
*/
public abstract class DataPoint {
private final String name;
private final long timestamp;
public DataPoint(String name, long timestamp) {
Objects.requireNonNull(name, "name");
this.name = name;
this.timestamp = timestamp;
}
public String getName() {
return name;
}
public long getTimestamp() {
return timestamp;
}
public abstract Object getValue();
}
| [
"[email protected]"
] | |
4bfe877a77960274a5813872f26b5f6c21c092f8 | a4e1c05ad6e84ea98cc7ed210912c5f7037c8a04 | /Homework5-master/src/main/java/ua/servlets/controller/product/AddProductServlet.java | 9989b06afde672ad823ae6a8755d3009886a60a4 | [] | no_license | Mykola-L/JavaDeveloper7 | 247f41e8adae18bedc7ca2ad56cea85ed67f35d6 | 6a80ff3307b6b3637cfaaa0d6073bb9ad0acb28b | refs/heads/master | 2021-08-30T08:10:28.220890 | 2017-12-16T23:50:02 | 2017-12-16T23:50:02 | 114,495,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,770 | java | package ua.servlets.controller.product;
import ua.servlets.DaoSingleton;
import ua.servlets.model.Product;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
public class AddProductServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("/jsp/add_product.jsp").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html; charset=utf-8");
try {
String name = req.getParameter("name");
BigDecimal price = new BigDecimal(Integer.valueOf(req.getParameter("price")));
String manufacturerName = req.getParameter("manufacturer");
Product product = new Product();
product.setName(name);
product.setPrice(price);
product.setManufacturer(DaoSingleton.getINSTANCE().getManufacturerDAO().getByName(manufacturerName));
DaoSingleton.getINSTANCE().getProductDAO().save(product);
resp.getWriter().println("product added!<br><br>");
resp.getWriter().println("<br>");
String link = "<form action=\"listProduct\">\n" +
"<p><input type=\"submit\" value=\"Read all product\"></p>\n" +
"</form>";
resp.getWriter().println(link);
} catch (Exception e) {
resp.getWriter().println("Error in adding Product");
}
}
}
| [
"[email protected]"
] | |
4d62522afd6a92f411db68d66aa42cd0ed830016 | 73f4a8470cf3e8f59419f67efe5459f439aa8976 | /superfly-web/src/main/java/com/payneteasy/superfly/web/wicket/page/BasePage.java | f3b8ee54211c919ebb783538028fb4831df6d255 | [
"Apache-2.0"
] | permissive | payneteasy/superfly | 23bea3cba13002271e332e4e2fc741f95318d155 | 91a4f5162cff84b904f5d7365f8cb83291b188e8 | refs/heads/master | 2023-08-17T08:27:24.809496 | 2023-08-07T19:46:52 | 2023-08-07T19:46:52 | 32,253,082 | 4 | 11 | Apache-2.0 | 2023-07-13T12:37:49 | 2015-03-15T09:35:38 | Java | UTF-8 | Java | false | false | 3,956 | java | package com.payneteasy.superfly.web.wicket.page;
import com.payneteasy.superfly.service.SettingsService;
import com.payneteasy.superfly.web.security.SecurityUtils;
import com.payneteasy.superfly.web.wicket.page.action.ListActionsPage;
import com.payneteasy.superfly.web.wicket.page.group.ListGroupsPage;
import com.payneteasy.superfly.web.wicket.page.role.ListRolesPage;
import com.payneteasy.superfly.web.wicket.page.session.ListSessionsPage;
import com.payneteasy.superfly.web.wicket.page.smtp_server.ListSmtpServersPage;
import com.payneteasy.superfly.web.wicket.page.subsystem.ListSubsystemsPage;
import com.payneteasy.superfly.web.wicket.page.user.ListUsersPage;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
/**
* Base page which defines a common page template and some common page elements.
*/
public abstract class BasePage extends SessionAccessorPage {
@SpringBean
private SettingsService settingsService;
private Class<? extends Page> pageClass;
private FeedbackPanel feedbackPanel;
public BasePage(Class<? extends Page> pageClass) {
super();
this.pageClass = pageClass;
init();
}
public BasePage(Class<? extends Page> pageClass, PageParameters params) {
super(params);
this.pageClass = pageClass;
init();
}
private void init() {
add(userContainer("user-container"));
add(new BookmarkablePageLink<Void>("self-link", getApplication().getHomePage()));
add(new Label("page-title", getTitle()));
add(new Label("page-head-title", getHeadTitle()));
add(new Label("superfly-version", settingsService.getSuperflyVersion()));
feedbackPanel = new FeedbackPanel("feedback");
feedbackPanel.setOutputMarkupId(true);
add(feedbackPanel);
addNavBarItem("subsystems", ListSubsystemsPage.class);
addNavBarItem("actions", ListActionsPage.class);
addNavBarItem("groups", ListGroupsPage.class);
addNavBarItem("users", ListUsersPage.class);
addNavBarItem("roles", ListRolesPage.class);
addNavBarItem("sessions", ListSessionsPage.class);
addNavBarItem("smtp", ListSmtpServersPage.class);
}
protected abstract String getTitle();
protected String getHeadTitle() {
return "Superfly service web ~ " + getHeadTitlePostfix();
}
protected String getHeadTitlePostfix() {
return getTitle();
}
private WebMarkupContainer userContainer(String containerId){
WebMarkupContainer webMarkupContainer = new WebMarkupContainer(containerId);
webMarkupContainer.add(new Label("user-name", SecurityUtils.getUsername()));
return webMarkupContainer;
}
private void addNavBarItem(String id, Class<? extends Page> aPageClass) {
WebMarkupContainer listItemContainer = new WebMarkupContainer("list-item-"+id);
add(listItemContainer);
BookmarkablePageLink<? extends Page> link = new BookmarkablePageLink<Page>(id, aPageClass);
listItemContainer.add(link);
if (pageClass != null) {
if (pageClass.equals(aPageClass)) {
listItemContainer.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return "active";
}
}));
}
}
}
protected FeedbackPanel getFeedbackPanel() {
return feedbackPanel;
}
}
| [
"[email protected]"
] | |
df921aad6f88df9c20c1b38ef82404e82692b5fe | d8ac43342e133a3c68aecc6f4cc7ed0ed737a01f | /com/file/client/ClientAction.java | 1ad855d30db2810cdc5d13f0c256996fef601291 | [] | no_license | time881/breakpoint-resume-Client | 4d2ff7adafeb3e363f04d030ffb1d72c5113035c | 2fba93672d29533610103cbdb73bea57f58a5005 | refs/heads/master | 2021-03-27T20:12:02.943606 | 2017-09-29T14:35:14 | 2017-09-29T14:35:14 | 105,280,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,185 | java | package com.file.client;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import com.block.client.ClientBlock;
public class ClientAction extends Thread {
private long length = 0;
private String FileName = null;
private String FileID = "C:/Temp/Server/";
private Object O;
private String Path;
private ClientBlock clientBlock;
public ClientAction(String p, Object o) {
this.Path = p;
this.O = o;
}
public String getPath() {
return Path;
}
public void setPath(String path) {
Path = path;
}
public Object getO() {
return O;
}
public void setO(Object o) {
O = o;
}
@Override
public void run() {
super.run();
try {
Socket socket = new Socket("127.0.0.1", 5209);
this.Send(Path, this.O, socket);
} catch (Exception e) {
e.printStackTrace();
}
}
public void Notify(Object o) {
synchronized (o) {
o.notify();
}
}
private void Send(String Path, Object o, Socket socket) throws Exception {
byte[] SendByte = new byte[ClientBlock.getBlockLength()];
int flag = 0;
int complete = 0;
File file = new File(Path);
System.out.println("Client Run..");
// PrintWriter write = new PrintWriter(socket.getOutputStream());
ObjectOutputStream objectStream = new ObjectOutputStream(socket
.getOutputStream());
FileInputStream fis = new FileInputStream(file);
while ((length = fis.read(SendByte, 0, SendByte.length)) > 0) {
synchronized (o) {
complete = (flag++ * SendByte.length);
clientBlock = new ClientBlock(SendByte, FileID, file.getName(),
complete, (int) length, false);
objectStream.writeObject(clientBlock);
objectStream.reset();
if (this.currentThread().interrupted()) {
System.out.println("Have completed: "
+ (complete + length + 0.0) * 100 / file.length()
+ "%");
o.wait();
}
}
}
// sent complete flag to Server to stop accept
objectStream.writeObject(new ClientBlock(null, null, null, 0, 0, true));
System.out.print("complete");
fis.close();
socket.close();
objectStream.close();
}
}
| [
"[email protected]"
] | |
c0500299e80e0875a755e74004831a59af6e8948 | d1748ebe600206abe263a721e5ba94bfcf87b0ae | /src/test/java/com/example/demo/PersonControllerTest.java | e1d050e17611d11738e0a7239ed0944154889293 | [] | no_license | Sofka-XT/workshop-reactor-core | 0b5ce0bbfc20eb040c917af6fa5e1d533728d152 | b2f50165bed4c57a511851f6d9df688ee9eac838 | refs/heads/main | 2023-04-23T20:25:59.440397 | 2021-05-10T20:05:31 | 2021-05-10T20:05:31 | 366,162,206 | 1 | 37 | null | null | null | null | UTF-8 | Java | false | false | 3,625 | java | package com.example.demo;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.reactive.server.WebTestClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
@ExtendWith(SpringExtension.class)
@WebFluxTest(controllers = PersonController.class)
public class PersonControllerTest {
@Autowired
private WebTestClient webTestClient;
@SpyBean
private PersonService personService;
@Captor
private ArgumentCaptor<Mono<Person>> argumentCaptor;
@MockBean
private PersonRepository repository;
@ParameterizedTest
@CsvSource({"Raul Alzate,0", "Raul Alzate,1"})
void post(String name, Integer times) {
if(times == 0) {
when(repository.findByName(name)).thenReturn(Mono.just(new Person()));
}
if(times == 1) {
when(repository.findByName(name)).thenReturn(Mono.empty());
}
var request = Mono.just(new Person(name));
webTestClient.post()
.uri("/person")
.body(request, Person.class)
.exchange()
.expectStatus().isOk()
.expectBody().isEmpty();
verify(personService).insert(argumentCaptor.capture());
verify(repository, times(times)).save(any());
var person = argumentCaptor.getValue().block();
Assertions.assertEquals(name, person.getName());
}
@Test
void get() {
webTestClient.get()
.uri("/person/1")
.exchange()
.expectStatus().isOk()
.expectBody(Person.class)
.consumeWith(personEntityExchangeResult -> {
var person = personEntityExchangeResult.getResponseBody();
assert person != null;
});
}
@Test
void update() {
var request = Mono.just(new Person());
webTestClient.put()
.uri("/person")
.body(request, Person.class)
.exchange()
.expectStatus().isOk()
.expectBody().isEmpty();
}
@Test
void delete() {
webTestClient.delete()
.uri("/person/1")
.exchange()
.expectStatus().isOk()
.expectBody().isEmpty();
}
@Test
void list() {
var list = Flux.just(
new Person("Raul Alzate"),
new Person("Pedro" )
);
when(repository.findAll()).thenReturn(list);
webTestClient.get()
.uri("/person")
.exchange()
.expectStatus().isOk()
.expectBody()
.jsonPath("$[0].name").isEqualTo("Raul Alzate")
.jsonPath("$[1].name").isEqualTo("Pedro");
verify(personService).listAll();
verify(repository).findAll();
}
}
| [
"[email protected]"
] | |
7efe08a232dd151be9a9c1476165faac150da1c7 | dae9637952ad9626b873b85101b5b2fb53b061e1 | /src/test/java/StepDefinition/Steps.java | c528c32b6135aa5097a280e443b17376ba32b095 | [] | no_license | taydin-ra/CucumberMentoring | 6e526edaefae5a67c7b05ba1b9c8f5d34cbfeeea | d1d30f54acc1e1d6eb42f85a5384fa478b5658d9 | refs/heads/master | 2022-12-18T16:46:48.066801 | 2020-09-08T22:50:27 | 2020-09-08T22:50:27 | 285,067,813 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package StepDefinition;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import org.openqa.selenium.WebDriver;
import pomClasses.BasePom;
import utilities.BaseDriver;
import pomClasses.accountPage;
import java.util.concurrent.TimeUnit;
public class Steps extends BasePom {
private WebDriver driver;
accountPage ap = new accountPage();
@Given("^Go to the website$")
public void go_to_the_website() throws Throwable {
driver = BaseDriver.getDriver();
driver.manage().window().maximize();
driver.get("http://automationpractice.com/index.php");
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
@Given("^Click on Sign In Tab$")
public void click_on_Sign_In_Tab() throws Throwable {
ap.clickOnSignInTab();
waitMethod();
// scrollDown();
}
@Given("^type to \"([^\"]*)\" and \"([^\"]*)\"$")
public void type_to_and(String arg1, String arg2) {
ap.typeTheEmail(arg1);
ap.typeThePassword(arg2);
}
@Given("^Click on Sign In Button$")
public void click_on_Sign_In_Button() throws Throwable {
ap.clickOnSignInButton();
}
@Then("^Verify I am in the product page$")
public void verify_I_am_in_the_product_page() throws Throwable {
ap.verifyURL("controller=my-account");
}
}
| [
"[email protected]"
] | |
6909cd48346d54cac1ef475d3c93f6c569a9622c | 71eca7b97d21afaea53f779dd2c94760d7d443b4 | /PatternCollection/FixRuleMiner/src/main/java/com/apimisuse/rule/node/NodeType.java | 9fa246f96669123ff663b8f1aff2404f5d2b6307 | [] | no_license | bd2019us/APIMisuse | 19d80d788cce24cae45a521bd1dfa24f92c9810f | 00312d711e576ad6d0f93960838d09d591d84f93 | refs/heads/master | 2022-12-28T12:56:30.705193 | 2020-10-19T01:13:48 | 2020-10-19T01:13:48 | 304,938,165 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,157 | java | package com.apimisuse.rule.node;
public class NodeType {
public final static String Invocation = "Invocation";
public final static String ConstructorCall = "ConstructorCall";
public final static String BinaryOperator = "BinaryOperator";
public final static String UnaryOperator = "UnaryOperator";
public final static String VariableRead = "VariableRead";
public final static String VariableWrite = "VariableWrite";
public final static String VariableAccess = "VariableAccess";
public final static String Literal = "Literal";
public final static String NullLiteral = "NullLiteral";
public final static String Return = "Return";
public final static String Assignment = "Assignment";
public final static String If = "If";
public final static String TRY = "Try";
public final static String CATCH = "Catch";
public final static String FINALLY = "Finally";
public final static String SYNC = "Synchronized";
public final static String FieldRead = "FieldRead";
public final static String FieldWrite = "FieldWrite";
public final static String FieldAccess = "FieldAccess";
public final static String MethodName = "MethodName";
public final static String MethodArg = "MethodArgument";
public final static String Field = "Field";
public final static String LocalVariable = "LocalVariable";
public final static String ConditionalOp = "ConditionalOp";
public final static String ArithmeticOp = "ArithmeticOp";
public final static String Method = "Method";
public final static String Constructor = "Constructor";
public final static String ConstructorName = "ConstructorName";
public final static String ConstructorArg = "ConstructorArg";
public final static String IncrementOp = "IncrementOp";
public final static String NegPosOp = "NegPosOp";
public final static String NotOp = "NotOp";
public final static String Constants = "Constants";
public final static String Conditional = "Conditional";
public final static String IF = "If";
public final static String RETURN = "Return";
public final static String BREAK = "Break";
public final static String UNKNOWN = "UNKNOWN";
}
| [
"[email protected]"
] | |
a18fbba256d9d470b4d3e7db242f25c18481c2b1 | f9fea63091ff06e210ade68df3b6c0db33fcb6dc | /src/main/java/com/adu21/ddd/policy/domain/model/HomePolicy.java | 4993353c642d1b24655e2deac2a216d245a3c21e | [] | no_license | raymondzhaoy/ddd_demo | b8530490665bd9d546c31c15523d29d62e8c35ff | b62325cf05e7f7374ab69f5774763ffdfd2d56f8 | refs/heads/master | 2020-04-22T13:42:13.477237 | 2018-04-25T08:19:23 | 2018-04-25T08:19:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.adu21.ddd.policy.domain.model;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Entity;
import javax.persistence.Table;
@Getter
@Setter
@Entity
@Table(name = "HOME_POLICY")
public class HomePolicy extends Policy {
private String buildingMaterial;
private String buildingType;
private String numberOfRooms;
}
| [
"[email protected]"
] | |
3dc9f39e2370d16e0519bdfd2f37ddb013ac005b | 3cd63aba77b753d85414b29279a77c0bc251cea9 | /main/plugins/org.talend.sdk.component.studio-integration/src/main/java/org/talend/sdk/component/studio/model/connector/ConnectorCreatorFactory.java | 9996af6a0543734cf04757d5eb7d3cd8836225dc | [
"Apache-2.0"
] | permissive | 195858/tdi-studio-se | 249bcebb9700c6bbc8905ccef73032942827390d | 4fdb5cfb3aeee621eacfaef17882d92d65db42c3 | refs/heads/master | 2021-04-06T08:56:14.666143 | 2018-10-01T14:11:28 | 2018-10-01T14:11:28 | 124,540,962 | 1 | 0 | null | 2018-10-01T14:11:29 | 2018-03-09T12:59:25 | Java | UTF-8 | Java | false | false | 4,027 | java | /**
* Copyright (C) 2006-2018 Talend Inc. - www.talend.com
*
* 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.talend.sdk.component.studio.model.connector;
import static org.talend.core.model.process.EConnectionType.FLOW_MAIN;
import static org.talend.sdk.component.studio.model.connector.AbstractConnectorCreator.getType;
import java.util.Objects;
import org.talend.core.model.process.INode;
import org.talend.sdk.component.server.front.model.ComponentDetail;
/**
* Creates appropriate {@link ConnectorCreator} according component meta
*/
public final class ConnectorCreatorFactory {
private ConnectorCreatorFactory() {
new AssertionError();
}
public static ConnectorCreator create(final ComponentDetail component, final INode node) {
if (isStandAlone(component)) {
return new StandAloneConnectorCreator(component, node);
}
if (isInput(component)) {
return new PartitionMapperConnectorCreator(component, node);
}
if (isOutput(component)) {
return new OutputConnectorCreator(component, node);
}
if (isProcessor(component)) {
return new ProcessorConnectorCreator(component, node);
}
throw new AssertionError();
}
/**
* Checks whether the component is StandAlone component.
* StandAlone component is a component, which has no input and output connections.
*
* @param detail ComponentDetail - a description of a component
* @return true, it the component is StandAlone
*/
public static boolean isStandAlone(final ComponentDetail detail) {
Objects.requireNonNull(detail);
return !hasInputs(detail) && !hasOutputs(detail);
}
/**
* Checks whether the component is an Input component.
* Input component is a component, which has only input connections.
*
* @param detail ComponentDetail - a description of a component
* @return true, it the component is an Input
*/
public static boolean isInput(final ComponentDetail detail) {
Objects.requireNonNull(detail);
return !hasInputs(detail) && hasOutputs(detail);
}
/**
* Checks whether the component is an Output component.
* Output component is a component, which has only output connections.
*
* @param detail ComponentDetail - a description of a component
* @return true, it the component is an Output
*/
public static boolean isOutput(final ComponentDetail detail) {
Objects.requireNonNull(detail);
return hasInputs(detail) && !hasOutputs(detail);
}
/**
* Checks whether the component is a Processor component.
* Processor component is a component, which has both input and output connections.
*
* @param detail ComponentDetail - a description of a component
* @return true, it the component is a Processor
*/
public static boolean isProcessor(final ComponentDetail detail) {
Objects.requireNonNull(detail);
return hasInputs(detail) && hasOutputs(detail);
}
private static boolean hasInputs(final ComponentDetail component) {
return //
component.getInputFlows().stream().anyMatch(input -> FLOW_MAIN.equals(getType(input)));
}
private static boolean hasOutputs(final ComponentDetail component) {
return //
component.getOutputFlows().stream().anyMatch(output -> FLOW_MAIN.equals(getType(output)));
}
}
| [
"[email protected]"
] | |
84ab9802a78a2507955b92cec3b391eba97cab46 | 0c34efda42ba64baa02b4ede1b874ff4359d168a | /CS 548/Clinic_Application/ClinicResearchService/ejbModule/edu/stevens/cs548/clinic/research/domain/IResearchDAO.java | 33468f22b854e42431cc03fd387b538a1d94de4b | [] | no_license | Devanshu8195/ClinicApp | a2948f66c0b0876325e2b9f82a9d5ea95b0da211 | bb35f00782881591be4cdaa7e96d36dcf2794aa2 | refs/heads/master | 2020-03-25T00:51:05.150691 | 2018-08-01T21:40:25 | 2018-08-01T21:40:25 | 116,200,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package edu.stevens.cs548.clinic.research.domain;
import java.util.List;
import edu.stevens.cs548.clinic.domain.research.DrugTreatmentRecord;
import edu.stevens.cs548.clinic.domain.research.Subject;
public interface IResearchDAO {
public static class ResearchExn extends Exception {
private static final long serialVersionUID = 1L;
public ResearchExn (String msg) {
super(msg);
}
}
public List<DrugTreatmentRecord> getDrugTreatmentRecords();
public DrugTreatmentRecord getDrugTreatmentRecord (long id) throws ResearchExn;
public void addDrugTreatmentRecord (DrugTreatmentRecord t);
public void deleteDrugTreatmentRecord (long id);
public void deleteDrugTreatmentRecords ();
public Subject getSubject(long id) throws ResearchExn;
public void addSubject(Subject s);
}
| [
"[email protected]"
] | |
d6799b99975093aaa1f57dbba44d88214df369cb | 9fe49bf7832aba9292ddfcb88fa5e1a53c13a5a4 | /src/main/java/ec/com/redepronik/negosys/dao/FacturaDaoImpl.java | 69119035b54fb3467aafb22350e38fe0de2def04 | [] | no_license | Idonius/NegosysSpark | 87c4c5bb560c54f519a8e54b2130557bc091eb63 | c9ea96d2565500a806749ec4326e2bd3ac649b11 | refs/heads/master | 2022-03-07T14:31:01.583523 | 2015-08-27T04:34:55 | 2015-08-27T04:34:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package ec.com.redepronik.negosys.dao;
import org.springframework.stereotype.Repository;
import ec.com.redepronik.negosys.entity.Factura;
@Repository
public class FacturaDaoImpl extends GenericDaoImpl<Factura, Integer> implements
FacturaDao {
} | [
"[email protected]"
] | |
5564752e3590257272524aac85476634d7f0ceea | 182d6f40c2a97abad22f3939df6e5fb547e5744d | /sdk/office365-mail-calendar-contact-sdk/odata/engine/src/main/java/com/msopentech/odatajclient/engine/data/LinkCollectionResource.java | 785f9e61cf4c7999b0524c6aad24e082aa583a46 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | ashank/Office-365-SDK-for-Android | 6488d4dc41759661601394fb1842c41b6ae63076 | 935a58a66f23e80f237224b2b3dad92b5b1419ad | refs/heads/master | 2021-01-13T14:04:58.224879 | 2014-03-05T12:22:40 | 2014-03-05T12:22:40 | 17,461,088 | 3 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,425 | java | /**
* Copyright © Microsoft Open Technologies, Inc.
*
* All Rights Reserved
*
* 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
*
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
* ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
* PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
*
* See the Apache License, Version 2.0 for the specific language
* governing permissions and limitations under the License.
*/
package com.msopentech.odatajclient.engine.data;
import java.net.URI;
import java.util.List;
/**
* REST resource for an <tt>ODataLinkCollection</tt>.
*
* @see ODataLinkCollection
*/
public interface LinkCollectionResource {
/**
* Smart management of different JSON format produced by OData services when
* <tt>$links</tt> is a single or a collection property.
*
* @return list of URIs for <tt>$links</tt>
*/
List<URI> getLinks();
/**
* Sets next link.
*
* @param next next link.
*/
void setNext(final URI next);
/**
* Gets next link if exists.
*
* @return next link if exists; null otherwise.
*/
URI getNext();
}
| [
"[email protected]"
] | |
9e0a8979cf3f1f6c512c25c18b801b4ba3149363 | b028d4a2582041d5ae025089aa87b381819c672e | /app/src/main/java/com/example/pdftospeech/MainActivity.java | 03da12f66ad2eebe7174cd5232c6fcfb167c29aa | [] | no_license | allandrakeprojects/PDF-to-Speech | 948f1eb5687fdb82736f02e99aa35f0c7f80c1a7 | 1bf0a5c6e278c5636bcf6a70ddfe0df1c97a4984 | refs/heads/master | 2022-03-03T14:39:31.507250 | 2019-09-16T04:39:24 | 2019-09-16T04:39:24 | 202,726,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,298 | java | package com.example.pdftospeech;
import android.Manifest;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.preference.PreferenceManager;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
import android.support.v4.view.MenuCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.util.FitPolicy;
import com.guna.ocrlibrary.OCRCapture;
import com.itextpdf.text.pdf.PdfReader;
import com.karumi.dexter.Dexter;
import com.karumi.dexter.MultiplePermissionsReport;
import com.karumi.dexter.PermissionToken;
import com.karumi.dexter.listener.DexterError;
import com.karumi.dexter.listener.PermissionRequest;
import com.karumi.dexter.listener.PermissionRequestErrorListener;
import com.karumi.dexter.listener.multi.MultiplePermissionsListener;
import com.nbsp.materialfilepicker.MaterialFilePicker;
import com.nbsp.materialfilepicker.ui.FilePickerActivity;
import com.shockwave.pdfium.PdfiumCore;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.regex.Pattern;
public class MainActivity extends AppCompatActivity implements View.OnClickListener, TextToSpeech.OnInitListener {
// Button
private ImageButton buttonAddPDF;
// ImageView
private ImageView buttonPlay, buttonPause, buttonStop, buttonNext, buttonPrevious;
// LinearLayout
private LinearLayout linearLayoutButtons;
// PDFView
private PDFView pdfView;
// TTS
private TextToSpeech textToSpeech;
// MediaPlayer
private MediaPlayer mediaPlayer;
// ProgressDialog
ProgressDialog progressDialog;
// Variables
private boolean IsPDFView;
private boolean IsPause;
private final String SOUND_PATH_TEMP = Environment.getExternalStorageDirectory().getPath() + "/pdf_tts_temp.mp3";
private String FilePath;
private String PageContent;
private int PageCount;
private int CurrentPage = 1;
private int CurrentWord = 0;
/**
* Create the Activity
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RequestMultiplePermission();
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
INITIALIZE();
}
/**
* Initialize Widgets
*/
private void INITIALIZE() {
// Button
buttonAddPDF = findViewById(R.id.buttonAddPDF);
// ImageView
buttonPlay = findViewById(R.id.buttonPlay);
buttonPause = findViewById(R.id.buttonPause);
buttonStop = findViewById(R.id.buttonStop);
buttonNext = findViewById(R.id.buttonNext);
buttonPrevious = findViewById(R.id.buttonPrevious);
// Listener
buttonPlay.setOnClickListener(this);
buttonPause.setOnClickListener(this);
buttonStop.setOnClickListener(this);
buttonNext.setOnClickListener(this);
buttonPrevious.setOnClickListener(this);
buttonAddPDF.setOnClickListener(this);
// LinearLayout
linearLayoutButtons = findViewById(R.id.linearLayoutButtons);
// PDFView
pdfView = findViewById(R.id.pdfView);
// ProgressDialog
progressDialog = new ProgressDialog(MainActivity.this);
// TTS
textToSpeech = new TextToSpeech(this, this);
textToSpeech.setOnUtteranceProgressListener(mProgressListener);
}
/**
* Handle Button Listener
*/
@Override
public void onClick(View view) {
// Button Add PDF
if (view.getId() == R.id.buttonAddPDF) {
new MaterialFilePicker()
.withActivity(this)
.withRequestCode(1000)
.withFilter(Pattern.compile(".*\\.pdf$"))
.withFilterDirectories(false)
.withHiddenFiles(true)
.start();
}
// Button Play
else if (view.getId() == R.id.buttonPlay) {
ButtonPlay();
}
// Button Pause
else if (view.getId() == R.id.buttonPause) {
ButtonPause();
}
// Button Stop
else if (view.getId() == R.id.buttonStop) {
ButtonStop();
}
// Button Previous
else if (view.getId() == R.id.buttonPrevious) {
ButtonPrevious();
}
// Button Next
else if (view.getId() == R.id.buttonNext) {
ButtonNext(false);
}
}
/**
* Button Play
*/
private void ButtonPlay() {
GetTTSSettings();
if(!IsPause){
// ProgressDialog
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setCancelable(false);
progressDialog.setMessage("Generating speech, please wait...");
progressDialog.show();
DetailsPDF();
GetPDFBitmap();
if (PageContent != null && PageContent.length() > 0) {
Speak();
} else {
Toast.makeText(this, "Make sure PDF have text on it.", Toast.LENGTH_SHORT).show();
}
} else{
buttonPlay.setVisibility(View.GONE);
buttonPause.setVisibility(View.VISIBLE);
mediaPlayer.seekTo(CurrentWord);
mediaPlayer.start();
}
}
/**
* Get PDF Bitmap
*/
private void GetPDFBitmap(){
PdfiumCore pdfiumCore = new PdfiumCore(getApplicationContext());
File file = new File(FilePath);
int indexCurrentPage = CurrentPage - 1;
try {
com.shockwave.pdfium.PdfDocument pdf = pdfiumCore.newDocument(ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE));
pdfiumCore.openPage(pdf, indexCurrentPage);
int width = pdfiumCore.getPageWidth(pdf, indexCurrentPage);
int height = pdfiumCore.getPageHeight(pdf, indexCurrentPage);
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
pdfiumCore.renderPageBitmap(pdf, bitmap, indexCurrentPage, 0, 0, width, height);
pdfiumCore.closeDocument(pdf);
new File(Environment.getExternalStorageDirectory()+"/PDF Reader").mkdirs();
File outputFile = new File(Environment.getExternalStorageDirectory()+"/PDF Reader", "temp_img.jpg");
FileOutputStream outputStream = new FileOutputStream(outputFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, outputStream);
PageContent = OCRCapture.Builder(this).getTextFromBitmap(bitmap).replace("iyaaave", "").replace("Please sign here:", "");
} catch(IOException ex) {
ex.printStackTrace();
}
}
/**
* Button Pause
*/
private void ButtonPause() {
buttonPlay.setVisibility(View.VISIBLE);
buttonPause.setVisibility(View.GONE);
mediaPlayer.pause();
IsPause = true;
CurrentWord = mediaPlayer.getCurrentPosition();
}
/**
* Button Stop
*/
private void ButtonStop() {
buttonPlay.setVisibility(View.VISIBLE);
buttonPause.setVisibility(View.GONE);
mediaPlayer.stop();
IsPause = false;
CurrentWord = 0;
}
/**
* Button Previous
*/
private void ButtonPrevious() {
if (CurrentPage != 1) {
CurrentPage--;
pdfView.jumpTo(CurrentPage - 1);
}
}
/**
* Button Next
*/
private void ButtonNext(boolean IsAuto) {
if (CurrentPage < PageCount) {
CurrentPage++;
pdfView.jumpTo(CurrentPage - 1);
if (IsAuto) {
ButtonPlay();
}
}
}
/**
* Handle File Path of Selected PDF
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1000 && resultCode == RESULT_OK) {
FilePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH);
File file = new File(FilePath);
PDFView pdfView = findViewById(R.id.pdfView);
pdfView.fromFile(file)
.enableSwipe(false)
.swipeHorizontal(false)
.enableDoubletap(true)
.defaultPage(0)
.enableAnnotationRendering(false)
.password(null)
.scrollHandle(null)
.enableAntialiasing(true)
.spacing(0)
.pageFitPolicy(FitPolicy.WIDTH)
.load();
// String filename = file.getName();
// Toast.makeText(this, filename, Toast.LENGTH_SHORT).show();
pdfView.setVisibility(View.VISIBLE);
linearLayoutButtons.setVisibility(View.VISIBLE);
buttonAddPDF.setVisibility(View.GONE);
IsPDFView = true;
DetailsPDF();
}
}
/**
* Get Details of PDF
*/
private void DetailsPDF() {
try {
// String parsedText = "";
PdfReader reader = new PdfReader(FilePath);
PageCount = reader.getNumberOfPages();
// PageContent = parsedText + PdfTextExtractor.getTextFromPage(reader, CurrentPage).trim(); //Extracting the content from the different page
reader.close();
} catch (Exception e) {
Toast.makeText(this, "Error:" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
/**
* Initialize Settings Menu
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
MenuCompat.setGroupDividerEnabled(menu, true);
return true;
}
/**
* Handle Menu Listener
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
// GOTO Settings
case R.id.action_settings:
Intent intent_settings = new Intent(this, SettingsActivity.class);
startActivity(intent_settings);
return true;
// Refresh
case R.id.action_refresh:
if (IsPDFView) {
ButtonStop();
pdfView.setVisibility(View.GONE);
linearLayoutButtons.setVisibility(View.GONE);
buttonAddPDF.setVisibility(View.VISIBLE);
pdfView.invalidate();
IsPDFView = false;
CurrentPage = 1;
} else {
Toast.makeText(this, "You must select PDF first.", Toast.LENGTH_SHORT).show();
}
break;
// GOTO About
case R.id.action_about:
Intent intent_about = new Intent(this, AboutActivity.class);
startActivity(intent_about);
return true;
// GOTO Contact Us
case R.id.action_contact:
Intent intent_contact = new Intent(this, ContactUsActivity.class);
startActivity(intent_contact);
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* Initialize TTS
*/
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = textToSpeech.setLanguage(Locale.US);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
// Toast.makeText(getApplicationContext(), "Language is not supported on this device.", Toast.LENGTH_SHORT).show();
}
} else {
// Toast.makeText(getApplicationContext(), "Language is not supported on this device.", Toast.LENGTH_SHORT).show();
}
}
/**
* Function Speak
*/
private void Speak() {
HashMap<String, String> hashMapAlarm = new HashMap<>();
hashMapAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
hashMapAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "-");
// Handle Media Player
File soundFile = new File(SOUND_PATH_TEMP);
if (soundFile.exists())
soundFile.delete();
textToSpeech.synthesizeToFile(PageContent, hashMapAlarm, SOUND_PATH_TEMP);
}
/**
* Get Speed, Pitch Settings
*/
private void GetTTSSettings(){
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
// Speed
Float speed = settings.getFloat("TTS_SPEED", 20);
if (!speed.toString().contains("20")) {
textToSpeech.setSpeechRate(speed);
}
// Pitch
Float pitch = settings.getFloat("TTS_PITCH", 20);
if (!pitch.toString().contains("20")) {
textToSpeech.setPitch(pitch);
}
}
/**
* Override TTS
*/
private UtteranceProgressListener mProgressListener = new UtteranceProgressListener() {
@Override
public void onStart(String utteranceId) {
}
@Override
public void onError(String utteranceId) {
}
@Override
public void onDone(String utteranceId) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// Handle Media Player
// ProgressDialog
progressDialog.dismiss();
buttonPlay.setVisibility(View.GONE);
buttonPause.setVisibility(View.VISIBLE);
mediaPlayer = MediaPlayer.create(MainActivity.this, Uri.parse(SOUND_PATH_TEMP));
mediaPlayer.start();
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
File soundFile = new File(SOUND_PATH_TEMP);
if (soundFile.exists())
soundFile.delete();
ButtonStop();
ButtonNext(true);
}
});
mediaPlayer.start();
}
});
}
};
/**
* Destroy TTS
*/
@Override
public void onDestroy() {
if (textToSpeech != null) {
textToSpeech.stop();
textToSpeech.shutdown();
}
super.onDestroy();
}
/**
* Initialize Multiple Permission
*/
private void RequestMultiplePermission() {
Dexter.withActivity(this)
.withPermissions(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE)
.withListener(new MultiplePermissionsListener() {
@Override
public void onPermissionsChecked(MultiplePermissionsReport report) {
if (report.areAllPermissionsGranted()) {
}
if (report.isAnyPermissionPermanentlyDenied()) {
Toast.makeText(MainActivity.this, "To able to access the file on your phone. Allow the permission.", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
token.continuePermissionRequest();
}
}).
withErrorListener(new PermissionRequestErrorListener() {
@Override
public void onError(DexterError error) {
Toast.makeText(getApplicationContext(), "Some Error! ", Toast.LENGTH_SHORT).show();
}
})
.onSameThread()
.check();
}
} | [
"[email protected]"
] | |
2063f18634c6a211470031637684782e31e6eb3f | b25898993f8646c8517d93662cbe9ae33cf51095 | /o2xfs-xfs3/src/test/java/at/o2xfs/xfs/cim/v3_20/Present3_20Test.java | 3870c6f379a2faa7e696c0895bf4d0fb9db62241 | [
"BSD-2-Clause"
] | permissive | dotfeng/O2Xfs | 5e4a16cd11305d4476ce28fb15887d6393ca90cd | 27e9b09fc8f5a8f4b0c6d9a5d1746cadb61b121d | refs/heads/master | 2021-01-24T20:25:10.044447 | 2017-03-08T22:07:02 | 2017-03-08T22:07:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,942 | java | /*
* Copyright (c) 2017, Andreas Fagschlunger. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package at.o2xfs.xfs.cim.v3_20;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import at.o2xfs.win32.Buffer;
import at.o2xfs.xfs.v3_20.BaseXfs3_20Test;
public class Present3_20Test extends BaseXfs3_20Test {
@Test
public final void test() {
Present3_20 expected = new Present3_20(buildPresent3_20().getPointer());
Present3_20 actual = new Present3_20(expected);
System.out.println(actual);
assertEquals(expected, actual);
}
private native Buffer buildPresent3_20();
} | [
"[email protected]"
] | |
07fabf0d9df5c6a87a2d9a1ca8e85d0b4f27bcee | bb45ca5f028b841ca0a08ffef60cedc40090f2c1 | /app/src/main/java/io/netty/channel/ChannelOutboundHandler.java | 748d82b867275db0d78bd60103f3ad330b60833d | [] | no_license | tik5213/myWorldBox | 0d248bcc13e23de5a58efd5c10abca4596f4e442 | b0bde3017211cc10584b93e81cf8d3f929bc0a45 | refs/heads/master | 2020-04-12T19:52:17.559775 | 2017-08-14T05:49:03 | 2017-08-14T05:49:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package io.netty.channel;
import java.net.SocketAddress;
public interface ChannelOutboundHandler extends ChannelHandler {
void bind(ChannelHandlerContext channelHandlerContext, SocketAddress socketAddress, ChannelPromise channelPromise) throws Exception;
void close(ChannelHandlerContext channelHandlerContext, ChannelPromise channelPromise) throws Exception;
void connect(ChannelHandlerContext channelHandlerContext, SocketAddress socketAddress, SocketAddress socketAddress2, ChannelPromise channelPromise) throws Exception;
void deregister(ChannelHandlerContext channelHandlerContext, ChannelPromise channelPromise) throws Exception;
void disconnect(ChannelHandlerContext channelHandlerContext, ChannelPromise channelPromise) throws Exception;
void flush(ChannelHandlerContext channelHandlerContext) throws Exception;
void read(ChannelHandlerContext channelHandlerContext) throws Exception;
void write(ChannelHandlerContext channelHandlerContext, Object obj, ChannelPromise channelPromise) throws Exception;
}
| [
"[email protected]"
] | |
e2656d168fd556e707e872a0ba393f4ef273cc41 | 4d4086b690fbc9b9903038329f1a2cbe2ef9fba8 | /app/src/main/java/ua/com/anyapps/easyads/easyads/CreateNewAd/LoadCategoriesLv3Completed.java | 81bb37eba6c27df80c0e5123ebab9ec2f9e164e2 | [] | no_license | anyappscompany/easyads | 8056d8eec617ab4b62c15b81c67849078720a5d5 | 4945477f0a9ecac352aa0f5c477a7995851bf0ef | refs/heads/master | 2022-03-29T02:53:45.616764 | 2020-01-04T22:53:06 | 2020-01-04T22:53:06 | 231,839,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package ua.com.anyapps.easyads.easyads.CreateNewAd;
public interface LoadCategoriesLv3Completed {
void LoadCategoriesLv3Completed(String response);
}
| [
"[email protected]"
] | |
a50220a37d88df1bff27b9b155587c06a72897e2 | 2266b09f5673391a50417a03f3c0580cb71e4a13 | /src/main/java/com/denizenscript/denizencore/scripts/commands/queue/RateLimitCommand.java | 04d83c5f18b1562c02be268a548e98184bc1a33f | [
"MIT"
] | permissive | Ph4i1ur3/Denizen-Core | 84d47fbe41bcf5724c062a28c69ce24dfa7a270d | c392128a1bf4d828debd0ad3af9dc233133a34f6 | refs/heads/master | 2020-09-28T10:21:48.996186 | 2019-12-08T20:23:08 | 2019-12-08T20:23:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,543 | java | package com.denizenscript.denizencore.scripts.commands.queue;
import com.denizenscript.denizencore.DenizenCore;
import com.denizenscript.denizencore.exceptions.InvalidArgumentsException;
import com.denizenscript.denizencore.objects.Argument;
import com.denizenscript.denizencore.objects.core.DurationTag;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.scripts.commands.AbstractCommand;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import java.util.HashMap;
public class RateLimitCommand extends AbstractCommand {
// <--[command]
// @Name RateLimit
// @Syntax ratelimit [<object>] [<duration>]
// @Required 2
// @Short Limits the rate that queues may process a script at.
// @Group queue
//
// @Description
// Limits the rate that queues may process a script at.
// If another queue tries to run the same script faster than the duration, that second queue will be stopped.
//
// Note that the rate limiting is tracked based on two unique factors: the object input, and the specific script line.
// That is to say: if you have a 'ratelimit <player> 10s', and then a few lines down a 'ratelimit <player> 10s',
// those are two separate rate limiters.
// Additionally, if you have a 'ratelimit <player> 10s' and two different players run it, they each have a separate rate limit applied.
//
// @Tags
// None.
//
// @Usage
// Use to show a message to a player no faster than once every ten seconds.
// - ratelimit <player> 10s
// - narrate "Wow!"
// -->
@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
for (Argument arg : scriptEntry.getProcessedArgs()) {
if (arg.matchesArgumentType(DurationTag.class)
&& !scriptEntry.hasObject("duration")) {
scriptEntry.addObject("duration", arg.asType(DurationTag.class));
}
else if (!scriptEntry.hasObject("object")) {
scriptEntry.addObject("object", new ElementTag(arg.raw_value));
}
else {
arg.reportUnhandled();
}
}
}
@Override
public void execute(ScriptEntry scriptEntry) {
DurationTag duration = scriptEntry.getObjectTag("duration");
ElementTag object = scriptEntry.getElement("object");
if (scriptEntry.dbCallShouldDebug()) {
Debug.report(scriptEntry, getName(), duration.debug() + object.debug());
}
if (scriptEntry.internal.specialProcessedData == null) {
scriptEntry.internal.specialProcessedData = new HashMap<>();
}
HashMap<String, Long> map = (HashMap<String, Long>) scriptEntry.internal.specialProcessedData;
String key = CoreUtilities.toLowerCase(object.asString());
Long endTime = map.get(key);
long curTime = DenizenCore.serverTimeMillis;
if (endTime != null && curTime < endTime) {
Debug.echoDebug(scriptEntry, "Rate limit applied with " + (endTime - curTime) + "ms left.");
scriptEntry.getResidingQueue().clear();
scriptEntry.getResidingQueue().stop();
return;
}
map.put(key, curTime + duration.getMillis());
}
}
| [
"[email protected]"
] | |
e5ea8abcf055751318e3fae7e7854e1479e19a47 | 1316af113627b7282dc488c8618a06cab2df4d52 | /app/src/main/java/com/example/teste/ui/main/PageViewModel.java | 513670b4f6198ccedb7b91d59bd96571debc09a5 | [] | no_license | victorbeleza-dev/whatsAppCopy | 8d1879361b5c3e2ec5bfaa1274439e3d26ae0d39 | 37242e8d08b01783fa0420a1eb1e9ca9cf7fabec | refs/heads/master | 2020-09-21T06:00:16.011130 | 2019-12-18T17:44:57 | 2019-12-18T17:44:57 | 224,702,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 725 | java | package com.example.teste.ui.main;
import androidx.arch.core.util.Function;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Transformations;
import androidx.lifecycle.ViewModel;
public class PageViewModel extends ViewModel {
private MutableLiveData<Integer> mIndex = new MutableLiveData<>();
private LiveData<String> mText = Transformations.map(mIndex, new Function<Integer, String>() {
@Override
public String apply(Integer input) {
return "Teste tela " + input;
}
});
public void setIndex(int index) {
mIndex.setValue(index);
}
public LiveData<String> getText() {
return mText;
}
} | [
"[email protected]"
] | |
c6a7b90191464a03dc65b44d97d9ead0aafb71da | 11f847820bfa605b5045aada622d95ea3dff4ac9 | /src/main/java/com/service/registration/RegistrationServiceImpl.java | c51069266d640b2776ff9cf452ce54dc2779ffe6 | [] | no_license | ArtorNado/USTAL | ad858e029a47e3a940d092bc58f8a5598b5a5eb2 | 080c17a1facca14159421a68cbfb9322aae35550 | refs/heads/master | 2021-05-17T03:33:25.220258 | 2020-06-14T12:02:03 | 2020-06-14T12:02:03 | 250,600,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,606 | java | package com.service.registration;
import com.aspect.LogExecutionTime;
import com.models.Role;
import com.models.User;
import com.models.UserData;
import com.repository.UserDataRepository;
import com.repository.UserRepository;
import com.dto.UserDto;
import com.dto.MessageDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
@Scope(scopeName = "tenant")
public class RegistrationServiceImpl implements RegistrationService {
@Autowired
private UserRepository userRepository;
@Autowired
private UserDataRepository userDataRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Override
@LogExecutionTime
public MessageDto registr(UserDto u) {
Optional<List<User>> userFromDb = userRepository.getUserByUserLogin(u.getUserLogin());
if (userFromDb.isPresent()) {
throw new IllegalArgumentException("Этот логин уже существует");
} else {
User newUser = new User(u.getUserLogin(), u.getUserPassword(), Role.USER);
userRepository.save(newUser);
UserData newUserData = new UserData(newUser.getUserId(), u.getUserFirstName(), u.getUserSecondName(),
u.getUserGender(), u.getUserCity(), null);
userDataRepository.save(newUserData);
return new MessageDto("success");
}
}
}
| [
"[email protected]"
] | |
fb460980147ca79782f7322ae24cb66a547e38cb | 4688d19282b2b3b46fc7911d5d67eac0e87bbe24 | /aws-java-sdk-shield/src/main/java/com/amazonaws/services/shield/model/DescribeProtectionRequest.java | 7b65b303f81615a33748f87845dde63bc7498539 | [
"Apache-2.0"
] | permissive | emilva/aws-sdk-java | c123009b816963a8dc86469405b7e687602579ba | 8fdbdbacdb289fdc0ede057015722b8f7a0d89dc | refs/heads/master | 2021-05-13T17:39:35.101322 | 2018-12-12T13:11:42 | 2018-12-12T13:11:42 | 116,821,450 | 1 | 0 | Apache-2.0 | 2018-09-19T04:17:41 | 2018-01-09T13:45:39 | Java | UTF-8 | Java | false | false | 3,841 | java | /*
* Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.shield.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/shield-2016-06-02/DescribeProtection" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeProtectionRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The unique identifier (ID) for the <a>Protection</a> object that is described.
* </p>
*/
private String protectionId;
/**
* <p>
* The unique identifier (ID) for the <a>Protection</a> object that is described.
* </p>
*
* @param protectionId
* The unique identifier (ID) for the <a>Protection</a> object that is described.
*/
public void setProtectionId(String protectionId) {
this.protectionId = protectionId;
}
/**
* <p>
* The unique identifier (ID) for the <a>Protection</a> object that is described.
* </p>
*
* @return The unique identifier (ID) for the <a>Protection</a> object that is described.
*/
public String getProtectionId() {
return this.protectionId;
}
/**
* <p>
* The unique identifier (ID) for the <a>Protection</a> object that is described.
* </p>
*
* @param protectionId
* The unique identifier (ID) for the <a>Protection</a> object that is described.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DescribeProtectionRequest withProtectionId(String protectionId) {
setProtectionId(protectionId);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getProtectionId() != null)
sb.append("ProtectionId: ").append(getProtectionId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DescribeProtectionRequest == false)
return false;
DescribeProtectionRequest other = (DescribeProtectionRequest) obj;
if (other.getProtectionId() == null ^ this.getProtectionId() == null)
return false;
if (other.getProtectionId() != null && other.getProtectionId().equals(this.getProtectionId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getProtectionId() == null) ? 0 : getProtectionId().hashCode());
return hashCode;
}
@Override
public DescribeProtectionRequest clone() {
return (DescribeProtectionRequest) super.clone();
}
}
| [
""
] | |
e95dffc799b83bbc5ab730c08f0c6d250c297a78 | b947fd4011169e7987bb6537c8af781e072ec24c | /book/Solution_소금쟁이.java | 2b7dd7ea6ee11aed2195d055350054b514a3adfe | [] | no_license | gahu/ssafy.algo | 7d8a3996336ae07eb75ab6fc5486bdb640fa0320 | 0ce569a09c762c7020684f72a337c3d8b8daddf4 | refs/heads/master | 2020-06-23T10:49:09.791976 | 2019-07-25T11:03:38 | 2019-07-25T11:03:38 | 198,600,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,585 | java | package book;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Solution_소금쟁이 {
static int[][] map;
static int[][] salt;
static int N, su;
static boolean[][] check;
static int[] dx = {0, 1, 0}; // 0 하 우
static int[] dy = {0, 0, 1};
static int move() {
int number = 0;
for (int i = 0; i < su; i++) { // 소금쟁이 번호
int nx = salt[i][0];
int ny = salt[i][1];
int rot = salt[i][2];
// 시작 위치가 이미 뛰었던 자리라면 출력
if(map[nx][ny] == 1) {
return i + 1;
}
saltfor:
for (int j = 3; j > 0; j--) { // 3 2 1 칸 뛰기
nx = nx + dx[rot] * j;
ny = ny + dy[rot] * j;
if(nx >= 0 && nx < N && ny >= 0 && ny < N) {
// 이미 뛰었던 자리면 해당 소금쟁이 출력
if(map[nx][ny] == 1) return i + 1;
else { // 아니면 뛰었던 자리 표시
map[nx][ny] = 1;
}
} else break saltfor; // 연못을 나가면 끝
}
}
return number;
}
public static void main(String[] args) throws FileNotFoundException {
System.setIn(new FileInputStream("input2.txt"));
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 1; t <= T; t++) {
N = sc.nextInt();
map = new int[N][N];
su = sc.nextInt();
salt = new int[su][3];
for (int i = 0; i < su; i++) {
salt[i][0] = sc.nextInt();
salt[i][1] = sc.nextInt();
salt[i][2] = sc.nextInt();
}
System.out.println("#" + t + " " + move());
}
}
}
| [
"[email protected]"
] | |
8aa70810a70501edfbfb78fa93f32bdeaf55c6a1 | e21adc5801d85baf20b3388e4f1a281af3a5c786 | /src/main/java/com/demonblog/controller/UserController.java | aae4562e100c93b158bbcf87a4e32841b676fcb8 | [] | no_license | KelechiDivine/Blog | 24f4bfad50140f34f2d9a66c190b9ea09ff0e37a | 2876ea33aac63fdb415793e48eecfb572e7f2dea | refs/heads/main | 2023-07-08T14:55:59.258175 | 2021-08-23T16:38:56 | 2021-08-23T16:38:56 | 393,033,432 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package com.demonblog.controller;
import com.demonblog.exceptions.General_IdAlreadyExists;
import com.demonblog.exceptions.General_UserAlreadyExists;
import com.demonblog.model.User;
import com.demonblog.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequestMapping(path = "/userControllers")
@AllArgsConstructor
@RestController
public class UserController {
@Autowired
private final UserService userService;
@GetMapping("/getUser")
public List<User> getAllUsers() {
return userService.getAllUser();
}
@PostMapping("/postUser")
public void registerUser(@RequestBody User user) throws General_UserAlreadyExists {
userService.createUser(user);
}
@DeleteMapping(path = "/deleteUser{username}")
public void deleteUser(@PathVariable("username") String username) throws General_UserAlreadyExists {
userService.deleteUser(username);
}
@PutMapping(path = "/putUser")
public void updateUser(
@PathVariable("username") String usernameField,
@RequestParam(required = false) Integer userId,
// @RequestParam(required = false) String comments,
@RequestParam(required = false) String userEmail) throws General_IdAlreadyExists {
userService.updateUser(usernameField, userId, userEmail);
}
}
| [
"[email protected]"
] | |
bca5be3fa912705a744b4c435e333489afaea451 | a8ec6b88bfb9ccefdb218b7fb0c00a41b40049c0 | /Dashi/build/classes/api/RecommendRestaurants.java | 79ece2d4cd49bd17116326cdfca307e45bde0e56 | [
"MIT"
] | permissive | Yifeiww/Restaurant-Recommendation-web | 03119d78f8f70148c29506a3bb689483ee669b19 | 513448778252d4553c87a3b9deb1d067702d63f0 | refs/heads/master | 2021-07-07T04:36:05.796988 | 2017-10-01T17:57:54 | 2017-10-01T17:57:54 | 82,724,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,617 | java | package api;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import db.DBConnection;
import db.MongoDBConnection;
import db.MySQLDBConnection;
/**
* Servlet implementation class RecommendRestaurants
*/
@WebServlet("/recommendation")
public class RecommendRestaurants extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public RecommendRestaurants() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
private static DBConnection connection = new MySQLDBConnection();
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
JSONArray array = null;
if (request.getParameterMap().containsKey("user_id")) {
String userId = request.getParameter("user_id");
array = connection.recommendRestaurants(userId);
}
RpcParser.writeOutput(response, array);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
d4a6480c74ce0d41ddf78a920c54ad16269415fc | 86bc52e8e94712aa77ea94f4ce240f0b00ccc5ef | /ZSSW_INNER/src/com/zrsf/forclient/vo/bbcx/YqsbcflVo.java | c1693ae6040d15c7046788dc466f9a2dece68048 | [] | no_license | xuxj2/zssw | 491ee164d2f22af635eb916421f667b053ede50d | d2ae02430c37695bf83f835f211f8ac33df0b611 | refs/heads/master | 2020-06-12T04:45:58.071898 | 2016-12-05T08:43:57 | 2016-12-05T08:43:57 | 75,605,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package com.zrsf.forclient.vo.bbcx;
import java.io.Serializable;
public class YqsbcflVo implements Serializable {
private static final long serialVersionUID = 1L;
private String swjgdm;
private String swjgmc;
private int yqsbhs;
private int cfhs;
private double yqsbcfl;
public YqsbcflVo(){
}
public String getSwjgdm() {
return swjgdm;
}
public void setSwjgdm(String swjgdm) {
this.swjgdm = swjgdm;
}
public String getSwjgmc() {
return swjgmc;
}
public void setSwjgmc(String swjgmc) {
this.swjgmc = swjgmc;
}
public int getYqsbhs() {
return yqsbhs;
}
public void setYqsbhs(int yqsbhs) {
this.yqsbhs = yqsbhs;
}
public int getCfhs() {
return cfhs;
}
public void setCfhs(int cfhs) {
this.cfhs = cfhs;
}
public void setYqsbcfl(double yqsbcfl) {
this.yqsbcfl = yqsbcfl;
}
public String getYqsbcfl() {
return String.format("%.2f",yqsbcfl);
}
}
| [
"[email protected]"
] | |
570451641fa37d78180fea0de46d136a9c62562f | a09571b04c2fa30e3cf554b493d0df56c74ebf14 | /app/src/test/java/dogvsmeteorites/lebasoft/dogvsmeteorites/ExampleUnitTest.java | 0a722e8ec20c7f9797064b2342fc743781c2b1fc | [] | no_license | violehtone/DogVsMeteorites | c0aba409cdcdf50ddbe89a6b103ea73cedc468ef | e3195598d5332d9855139253d77e6ec686d09e6b | refs/heads/master | 2020-03-11T12:59:45.808733 | 2018-04-18T06:14:16 | 2018-04-18T06:14:16 | 130,012,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package dogvsmeteorites.lebasoft.dogvsmeteorites;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
e3917639966062e6888707ba2d0a743639ae7b1c | a2f355c935b1893e70fca9e6f71f5f48b3b80e60 | /src/main/java/com/it/fleetapp/models/EmployeeType.java | 2fbfe5f2bbdb18fdd12e600d82ce73d5f995c0e2 | [] | no_license | thirtsoft/fleetapp | 9ba0a507600dffe41482b573e0426733aaf38a7f | 83bc7c77424697f7b475608d8cce390abeddeb71 | refs/heads/master | 2021-03-20T06:30:27.883983 | 2020-03-15T02:38:12 | 2020-03-15T02:38:12 | 247,185,391 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.it.fleetapp.models;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.Entity;
@Entity
@Data
@EqualsAndHashCode(callSuper = false)
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,property = "id")
public class EmployeeType extends CommonObject {
}
| [
"[email protected]"
] | |
22ef86d6326c4235e4b8a879a3878f1f790e47e1 | e9fe8dd99f6b5d322880b0224f26282624dedb44 | /websocketlib/src/main/java/com/gps/ros/rosbridge/indication/Base64Encoded.java | c1989ed3c75ab450d21d9efc87352230ff5aa711 | [
"Apache-2.0"
] | permissive | ZhouKanZ/SweepRobot | 9afd86c15d98d035e3b8e73fc853deb3cd577eaa | 9fdc2698c01a99d10f0b6a4a4d4c3422be75af36 | refs/heads/master | 2020-06-27T17:59:10.410803 | 2017-07-24T02:31:18 | 2017-07-24T02:31:18 | 97,067,167 | 3 | 1 | null | 2017-08-30T06:25:09 | 2017-07-13T01:35:38 | Java | UTF-8 | Java | false | false | 1,098 | java | /**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client 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.
*
* The Java ROSBridge Client 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 the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.gps.ros.rosbridge.indication;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Base64Encoded {
}
| [
"[email protected]"
] | |
00eca36b7fa831d7043cd7ab15f1d2abda594a52 | 6ae0c4604e2cd5cc768852017b293799a8cede33 | /src/main/java/net/canadensys/dataportal/occurrence/dao/PublisherDAO.java | 60060e6405dda76040e02c2c8ce7e2a0c420af3f | [
"MIT"
] | permissive | maduhu/liger-data-access | c707331bdcaa85ee35c12f45be7c6b8be062c1d4 | 3a84e62b71266bd1cdfd889ebba2d401fdc9cfe0 | refs/heads/master | 2021-01-18T10:52:15.182233 | 2016-01-06T18:08:23 | 2016-01-06T18:08:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | package net.canadensys.dataportal.occurrence.dao;
import java.util.List;
import net.canadensys.dataportal.occurrence.model.PublisherModel;
/**
* Interface for accessing publisher information data.
*
* @author Pedro Guimarães
*/
public interface PublisherDAO {
/**
* Save a publisherModel
*
* @param publisherModel
* @return success or not
*/
public boolean save(PublisherModel publisherModel);
/**
* Load a publisherModel from an id
*
* @param id
* @return publisherModel or null if nothing is found
*/
public PublisherModel load(Integer auto_id);
/**
* Return all available publisher information records
* @return
*/
public List<PublisherModel> loadPublishers();
/**
* Drop a publisher record from the table and all its associated publisherContacts
*
* @param publisherModel
*/
public boolean delete(PublisherModel publisherModel);
}
| [
"[email protected]"
] | |
6732c59f95988392f6070b10e044289232795d80 | 6fe869f2d744ab792e227d28d7f47adf1ec0046c | /seckill1/src/main/java/com/seckill/util/DBUtil.java | 33ccf3b52ccd94409750e552c6590bbb3914cc59 | [
"Apache-2.0"
] | permissive | da2win/Seckill | dca135094b5c073a54f1b05040866144ad5b0598 | a820c79a30a8a4d6f8e7e3ce66762492ef17e9fb | refs/heads/master | 2020-03-17T06:00:01.289589 | 2018-05-23T09:30:45 | 2018-05-23T09:30:45 | 133,337,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package com.seckill.util;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;
/**
*
* @author Darwin
* @date 2018/5/15
*/
public class DBUtil {
private static Properties props;
static {
try {
InputStream in = DBUtil.class.getClassLoader().getResourceAsStream("application.properties");
props = new Properties();
props.load(in);
in.close();
}catch(Exception e) {
e.printStackTrace();
}
}
public static Connection getConn() throws Exception{
String url = props.getProperty("spring.datasource.url");
String username = props.getProperty("spring.datasource.username");
String password = props.getProperty("spring.datasource.password");
String driver = props.getProperty("spring.datasource.driver-class-name");
Class.forName(driver);
return DriverManager.getConnection(url,username, password);
}
}
| [
"[email protected]"
] | |
8338ee565a4fa647e3618cc674262bf0583a8bde | 349c632d9fedfb7c38203b09f87025182786eb8d | /actionlibrary/src/main/java/cn/andthink/actionlibrary/activity/BaseMediaActivity.java | 74c75839d52db8df41f299f7db6617c930e81785 | [] | no_license | wuhaiyang/actionLib | a9c3b776665f33a25a0be96bfb5cf95d92de7c3b | 124235dba3ad4f7296c175acd004890f96939478 | refs/heads/master | 2021-01-10T01:53:00.904991 | 2015-10-18T06:32:51 | 2015-10-18T06:32:51 | 44,465,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,159 | java | package cn.andthink.actionlibrary.activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import cn.andthink.actionlibrary.utils.FileUtil;
import cn.andthink.actionlibrary.utils.chooseImage.MultiImageSelectorActivity;
/**
* Created by wuhaiyang on 2015/7/18.
*/
public abstract class BaseMediaActivity extends BaseActionbarActivity {
private static final int REQUEST_MUILTE_IMAGE = 4;
protected static final int CODE_CROP_REQUEST = 3;
public static final int REQUEST_CODE_LOCAL = 2;
public static final int REQUEST_CODE_CAMERA = 1;
protected List<String> mSelectImgPath = new ArrayList<>();
private static int output_X = 250;
private static int output_Y = 250;
protected boolean isCrop = false;
protected File tmpFile; //临时存储牌照后的图片路径
/**
* 调用相机拍摄
*
* @param isResize 拍完照后是否 裁剪图片
*/
protected void callCameraTakePhoto(boolean isResize) {
isCrop = isResize;
tmpFile = FileUtil.getCameraPicFile();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tmpFile));
startActivityForResult(intent,REQUEST_CODE_CAMERA);
}
/**
* 选取本地图库 单张模式
* @param isResize 是否裁剪图片
*/
protected void callGalleryTakeSinglePhoto(boolean isResize) {
isCrop = isResize;
Intent intent;
if (Build.VERSION.SDK_INT < 19) {
intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
} else {
intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
}
startActivityForResult(intent, REQUEST_CODE_LOCAL);
}
/**
* 选取本地图库 多张模式
*
* @param count 最多允许选取几张
*/
protected void callGallerTakeMuiltePhoto(int count, boolean isShowCamera) {
Intent intent = new Intent(this, MultiImageSelectorActivity.class);
// 是否显示调用相机拍照
intent.putExtra(MultiImageSelectorActivity.EXTRA_SHOW_CAMERA, isShowCamera);
// 最大图片选择数量
intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_COUNT, count);
// 设置模式 (支持 单选/MultiImageSelectorActivity.MODE_SINGLE 或者 多选/MultiImageSelectorActivity.MODE_MULTI)
intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_MODE, MultiImageSelectorActivity.MODE_MULTI);
startActivityForResult(intent, REQUEST_MUILTE_IMAGE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
/*if(requestCode == REQUEST_IMAGE){
if(resultCode == RESULT_OK){
// 获取返回的图片列表
List<String> path = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
// 处理你自己的逻辑 ....
}
}*/ //上面是实例参考代码
}
protected abstract void onHandleResult(int requestCode, int resultCode, Intent data);
/**
* 裁剪图片
*
* @param uri
*/
protected void cropRawPhoto(Uri uri) {
//裁剪图片意图
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
intent.putExtra("crop", "true");
//裁剪框的比例,1:1
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
//裁剪后输出图片的尺寸大小
intent.putExtra("outputX", output_X);
intent.putExtra("outputY", output_Y);
//图片格式
intent.putExtra("outputFormat", "JPEG");
intent.putExtra("noFaceDetection", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, CODE_CROP_REQUEST);
}
}
| [
"[email protected]"
] | |
4bea985301d318ccf8ca9c6152431d167f36299e | 6b64d276c6d588cb01f8efa9c0918047b9eb5b0a | /Pharmacy_Management_System/src/pharmacyControlar/Spals.java | 334736989b37a412393acd3f6920f9260316a39e | [] | no_license | Azam4/Pharmacy_Management_System | e22cb31c365e226d1cc4bf10f46eb2e378296a4d | 41c59ee887ea237ed2cfd98d7d51cb1efda41394 | refs/heads/main | 2023-08-15T21:04:13.833314 | 2021-10-02T05:41:01 | 2021-10-02T05:41:01 | 412,688,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,464 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pharmacyControlar;
/**
*
* @author A
*/
public class Spals extends javax.swing.JFrame {
/**
* Creates new form Spals
*/
public Spals() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jProgressBar1 = new javax.swing.JProgressBar();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(0, 255, 0));
jLabel1.setText("PHARMACY MANAGEMENT SYSTEM");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel3.setForeground(new java.awt.Color(0, 255, 0));
jLabel3.setText("X");
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Com/Icon/pharmacy.jpg"))); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(674, 674, 674)
.addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(106, 106, 106)
.addComponent(jLabel3)
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(274, 274, 274)
.addComponent(jLabel2)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel3))
.addGap(35, 35, 35)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE)
.addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 36, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
/**
* @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(Spals.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Spals.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Spals.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Spals.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 Spals().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JProgressBar jProgressBar1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
d5a0c47df4e477a5f1fe44adfb79c6c0f23b7816 | 315bedd6900d70c43ae331949786610de306f1ec | /app/src/main/java/com/xapptree/ginger/OfferScreen.java | bfdffea24916a3cf4212ee5f40c5a8f50d2cdb7c | [] | no_license | xapptree/Ginger | 04ca5f8aa9e6c0b8ffc8e28a2ec7d25370a529a1 | 1b0145e9ef4206d84e5d28aa38d541e13a0b76ac | refs/heads/master | 2021-04-30T05:10:08.863020 | 2018-11-28T18:43:41 | 2018-11-28T18:43:41 | 121,409,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,793 | java | package com.xapptree.ginger;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SnapHelper;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;
import com.github.rubensousa.gravitysnaphelper.GravitySnapHelper;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QuerySnapshot;
import com.xapptree.ginger.adapters.CouponAdapter;
import com.xapptree.ginger.interfaces.GingerInterface;
import com.xapptree.ginger.model.Coupons;
import com.xapptree.ginger.utilities.AppConstants;
import java.util.Vector;
public class OfferScreen extends GingerBaseActivity implements GingerInterface {
private String cUID;
private RecyclerView couponRecycler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_offer_screen);
ImageButton mMenu = findViewById(R.id.menu);
TextView tHeader = findViewById(R.id.header);
couponRecycler = findViewById(R.id.coupon_recycler);
/*Setting Fonts*/
final AssetManager am = this.getApplicationContext().getAssets();
Typeface customFont = Typeface.createFromAsset(am, "Raleway-Bold.ttf");
tHeader.setTypeface(customFont);
/*Customer UID from sp*/
SharedPreferences sp = getSharedPreferences("UserCreds", MODE_PRIVATE);
cUID = sp.getString("Uid", "");
/*RecyclerView options*/
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
couponRecycler.setLayoutManager(mLayoutManager);
SnapHelper snapHelperTop = new GravitySnapHelper(Gravity.START);
snapHelperTop.attachToRecyclerView(couponRecycler);
mMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(OfferScreen.this, MainActivity.class);
startActivity(i);
overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
finish();
}
});
}
@Override
public void onConnectivityChanged(boolean isConnected) {
super.onConnectivityChanged(isConnected);
if (!isConnected) {
showNetworkPopUp();
} else {
hideNetorkPopUp();
getDataFireStore();
}
}
@Override
public void getDataFireStore() {
FirebaseFirestore db = FirebaseFirestore.getInstance();
CollectionReference couponRef = db.collection("Coupons");
AppConstants.arrCoupons = new Vector<>();
Query query = couponRef.whereEqualTo("Type", 2).whereEqualTo("Active", true);
Query querySelf = couponRef.whereEqualTo("ReferBy", cUID).whereEqualTo("Active", true);
query.get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot documentSnapshots) {
for (DocumentSnapshot document : documentSnapshots.getDocuments()) {
Coupons mCoupon = document.toObject(Coupons.class);
AppConstants.arrCoupons.add(mCoupon);
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i("Print coupons", "Failed");
}
});
querySelf.get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot documentSnapshots) {
for (DocumentSnapshot document : documentSnapshots.getDocuments()) {
Coupons mCoupon = document.toObject(Coupons.class);
AppConstants.arrCoupons.add(mCoupon);
}
setupData();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i("Print coupons", "Failed");
setupData();
}
});
}
private void setupData() {
CouponAdapter couponAdapter = new CouponAdapter(OfferScreen.this,AppConstants.arrCoupons);
couponRecycler.setAdapter(couponAdapter);
couponAdapter.notifyDataSetChanged();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
Intent i = new Intent(OfferScreen.this, MainActivity.class);
startActivity(i);
overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
| [
"[email protected]"
] | |
a49fd20eacc7f43b13036811d01839a0f3521ede | c4fc44747591d09c91870f6547b4258d4a73cdf2 | /src/lanterna/com/googlecode/lanterna/graphics/AbstractTheme.java | 15b950453a5f5dbee295923e3ff24975e669f4c1 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | wknishio/variable-terminal | 2c3aa7a182662df5c13e026471338d43142690a7 | 83eedc7ed37fed6859a5ed3355aa3685ed589f1a | refs/heads/master | 2023-09-03T11:11:24.946980 | 2023-09-02T15:29:05 | 2023-09-02T15:29:05 | 37,862,908 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,165 | java | /*
* This file is part of lanterna (https://github.com/mabe02/lanterna).
*
* lanterna is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2010-2020 Martin Berglund
*/
package com.googlecode.lanterna.graphics;
import com.googlecode.lanterna.SGR;
import com.googlecode.lanterna.TextColor;
import com.googlecode.lanterna.gui2.Component;
import com.googlecode.lanterna.gui2.ComponentRenderer;
import com.googlecode.lanterna.gui2.WindowDecorationRenderer;
import com.googlecode.lanterna.gui2.WindowPostRenderer;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Abstract {@link Theme} implementation that manages a hierarchical tree of theme nodes ties to Class objects.
* Sub-classes will inherit their theme properties from super-class definitions, the java.lang.Object class is
* considered the root of the tree and as such is the fallback for all other classes.
* <p>
* You normally use this class through {@link PropertyTheme}, which is the default implementation bundled with Lanterna.
* @author Martin
*/
public abstract class AbstractTheme implements Theme {
private static final String STYLE_NORMAL = "";
private static final String STYLE_PRELIGHT = "PRELIGHT";
private static final String STYLE_SELECTED = "SELECTED";
private static final String STYLE_ACTIVE = "ACTIVE";
private static final String STYLE_INSENSITIVE = "INSENSITIVE";
private static final Pattern STYLE_FORMAT = Pattern.compile("([a-zA-Z]+)(\\[([a-zA-Z0-9-_]+)])?");
private final ThemeTreeNode rootNode;
private final WindowPostRenderer windowPostRenderer;
private final WindowDecorationRenderer windowDecorationRenderer;
protected AbstractTheme(WindowPostRenderer postRenderer,
WindowDecorationRenderer decorationRenderer) {
this.rootNode = new ThemeTreeNode(Object.class, null);
this.windowPostRenderer = postRenderer;
this.windowDecorationRenderer = decorationRenderer;
rootNode.foregroundMap.put(STYLE_NORMAL, TextColor.ANSI.WHITE);
rootNode.backgroundMap.put(STYLE_NORMAL, TextColor.ANSI.BLACK);
}
protected boolean addStyle(String definition, String style, String value) {
ThemeTreeNode node = getNode(definition);
if(node == null) {
return false;
}
node.apply(style, value);
return true;
}
private ThemeTreeNode getNode(String definition) {
try {
if(definition == null || definition.trim().length() == 0) {
return getNode(Object.class);
}
else {
return getNode(Class.forName(definition));
}
}
catch(ClassNotFoundException e) {
return null;
}
}
private ThemeTreeNode getNode(Class<?> definition) {
if(definition == Object.class) {
return rootNode;
}
ThemeTreeNode parent = getNode(definition.getSuperclass());
if(parent.childMap.containsKey(definition)) {
return parent.childMap.get(definition);
}
ThemeTreeNode node = new ThemeTreeNode(definition, parent);
parent.childMap.put(definition, node);
return node;
}
public ThemeDefinition getDefaultDefinition() {
return new DefinitionImpl(rootNode);
}
public ThemeDefinition getDefinition(Class<?> clazz) {
LinkedList<Class<?>> hierarchy = new LinkedList<Class<?>>();
while(clazz != null && clazz != Object.class) {
hierarchy.addFirst(clazz);
clazz = clazz.getSuperclass();
}
ThemeTreeNode node = rootNode;
for(Class<?> aClass : hierarchy) {
if(node.childMap.containsKey(aClass)) {
node = node.childMap.get(aClass);
}
else {
break;
}
}
return new DefinitionImpl(node);
}
public WindowPostRenderer getWindowPostRenderer() {
return windowPostRenderer;
}
public WindowDecorationRenderer getWindowDecorationRenderer() {
return windowDecorationRenderer;
}
protected static Object instanceByClassName(String className) {
if(className == null || className.trim().length() == 0) {
return null;
}
try {
return Class.forName(className).newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
/**
* Returns a list of redundant theme entries in this theme. A redundant entry means that it doesn't need to be
* specified because there is a parent node in the hierarchy which has the same property so if the redundant entry
* wasn't there, the parent node would be picked up and the end result would be the same.
* @return List of redundant theme entries
*/
public List<String> findRedundantDeclarations() {
List<String> result = new ArrayList<String>();
for(ThemeTreeNode node: rootNode.childMap.values()) {
findRedundantDeclarations(result, node);
}
Collections.sort(result);
return result;
}
private void findRedundantDeclarations(List<String> result, ThemeTreeNode node) {
for(String style: node.foregroundMap.keySet()) {
String formattedStyle = "[" + style + "]";
if(formattedStyle.length() == 2) {
formattedStyle = "";
}
TextColor color = node.foregroundMap.get(style);
TextColor colorFromParent = new StyleImpl(node.parent, style).getForeground();
if(color.equals(colorFromParent)) {
result.add(node.clazz.getName() + ".foreground" + formattedStyle);
}
}
for(String style: node.backgroundMap.keySet()) {
String formattedStyle = "[" + style + "]";
if(formattedStyle.length() == 2) {
formattedStyle = "";
}
TextColor color = node.backgroundMap.get(style);
TextColor colorFromParent = new StyleImpl(node.parent, style).getBackground();
if(color.equals(colorFromParent)) {
result.add(node.clazz.getName() + ".background" + formattedStyle);
}
}
for(String style: node.sgrMap.keySet()) {
String formattedStyle = "[" + style + "]";
if(formattedStyle.length() == 2) {
formattedStyle = "";
}
EnumSet<SGR> sgrs = node.sgrMap.get(style);
EnumSet<SGR> sgrsFromParent = new StyleImpl(node.parent, style).getSGRs();
if(sgrs.equals(sgrsFromParent)) {
result.add(node.clazz.getName() + ".sgr" + formattedStyle);
}
}
for(ThemeTreeNode childNode: node.childMap.values()) {
findRedundantDeclarations(result, childNode);
}
}
private class DefinitionImpl implements ThemeDefinition {
final ThemeTreeNode node;
public DefinitionImpl(ThemeTreeNode node) {
this.node = node;
}
public ThemeStyle getNormal() {
return new StyleImpl(node, STYLE_NORMAL);
}
public ThemeStyle getPreLight() {
return new StyleImpl(node, STYLE_PRELIGHT);
}
public ThemeStyle getSelected() {
return new StyleImpl(node, STYLE_SELECTED);
}
public ThemeStyle getActive() {
return new StyleImpl(node, STYLE_ACTIVE);
}
public ThemeStyle getInsensitive() {
return new StyleImpl(node, STYLE_INSENSITIVE);
}
public ThemeStyle getCustom(String name) {
return new StyleImpl(node, name);
}
public ThemeStyle getCustom(String name, ThemeStyle defaultValue) {
ThemeStyle customStyle = getCustom(name);
if(customStyle == null) {
customStyle = defaultValue;
}
return customStyle;
}
public char getCharacter(String name, char fallback) {
Character character = node.characterMap.get(name);
if(character == null) {
if(node == rootNode) {
return fallback;
}
else {
return new DefinitionImpl(node.parent).getCharacter(name, fallback);
}
}
return character;
}
public boolean isCursorVisible() {
Boolean cursorVisible = node.cursorVisible;
if(cursorVisible == null) {
if(node == rootNode) {
return true;
}
else {
return new DefinitionImpl(node.parent).isCursorVisible();
}
}
return cursorVisible;
}
public boolean getBooleanProperty(String name, boolean defaultValue) {
String propertyValue = node.propertyMap.get(name);
if(propertyValue == null) {
if(node == rootNode) {
return defaultValue;
}
else {
return new DefinitionImpl(node.parent).getBooleanProperty(name, defaultValue);
}
}
return Boolean.parseBoolean(propertyValue);
}
@SuppressWarnings("unchecked")
public <T extends Component> ComponentRenderer<T> getRenderer(Class<T> type) {
String rendererClass = node.renderer;
if(rendererClass == null) {
if(node == rootNode) {
return null;
}
else {
return new DefinitionImpl(node.parent).getRenderer(type);
}
}
return (ComponentRenderer<T>)instanceByClassName(rendererClass);
}
}
private class StyleImpl implements ThemeStyle {
private final ThemeTreeNode styleNode;
private final String name;
private StyleImpl(ThemeTreeNode node, String name) {
this.styleNode = node;
this.name = name;
}
public TextColor getForeground() {
ThemeTreeNode node = styleNode;
while(node != null) {
if(node.foregroundMap.containsKey(name)) {
return node.foregroundMap.get(name);
}
node = node.parent;
}
TextColor fallback = rootNode.foregroundMap.get(STYLE_NORMAL);
if(fallback == null) {
fallback = TextColor.ANSI.WHITE;
}
return fallback;
}
public TextColor getBackground() {
ThemeTreeNode node = styleNode;
while(node != null) {
if(node.backgroundMap.containsKey(name)) {
return node.backgroundMap.get(name);
}
node = node.parent;
}
TextColor fallback = rootNode.backgroundMap.get(STYLE_NORMAL);
if(fallback == null) {
fallback = TextColor.ANSI.BLACK;
}
return fallback;
}
public EnumSet<SGR> getSGRs() {
ThemeTreeNode node = styleNode;
while(node != null) {
if(node.sgrMap.containsKey(name)) {
return EnumSet.copyOf(node.sgrMap.get(name));
}
node = node.parent;
}
EnumSet<SGR> fallback = rootNode.sgrMap.get(STYLE_NORMAL);
if(fallback == null) {
fallback = EnumSet.noneOf(SGR.class);
}
return EnumSet.copyOf(fallback);
}
}
private static class ThemeTreeNode {
private final Class<?> clazz;
private final ThemeTreeNode parent;
private final Map<Class<?>, ThemeTreeNode> childMap;
private final Map<String, TextColor> foregroundMap;
private final Map<String, TextColor> backgroundMap;
private final Map<String, EnumSet<SGR>> sgrMap;
private final Map<String, Character> characterMap;
private final Map<String, String> propertyMap;
private Boolean cursorVisible;
private String renderer;
private ThemeTreeNode(Class<?> clazz, ThemeTreeNode parent) {
this.clazz = clazz;
this.parent = parent;
this.childMap = new HashMap<Class<?>, ThemeTreeNode>();
this.foregroundMap = new HashMap<String, TextColor>();
this.backgroundMap = new HashMap<String, TextColor>();
this.sgrMap = new HashMap<String, EnumSet<SGR>>();
this.characterMap = new HashMap<String, Character>();
this.propertyMap = new HashMap<String, String>();
this.cursorVisible = true;
this.renderer = null;
}
private void apply(String style, String value) {
value = value.trim();
Matcher matcher = STYLE_FORMAT.matcher(style);
if(!matcher.matches()) {
throw new IllegalArgumentException("Unknown style declaration: " + style);
}
String styleComponent = matcher.group(1);
String group = matcher.groupCount() > 2 ? matcher.group(3) : null;
if(styleComponent.toLowerCase().trim().equals("foreground")) {
foregroundMap.put(getCategory(group), parseValue(value));
}
else if(styleComponent.toLowerCase().trim().equals("background")) {
backgroundMap.put(getCategory(group), parseValue(value));
}
else if(styleComponent.toLowerCase().trim().equals("sgr")) {
sgrMap.put(getCategory(group), parseSGR(value));
}
else if(styleComponent.toLowerCase().trim().equals("char")) {
characterMap.put(getCategory(group), value.length() == 0 ? ' ' : value.charAt(0));
}
else if(styleComponent.toLowerCase().trim().equals("cursor")) {
cursorVisible = Boolean.parseBoolean(value);
}
else if(styleComponent.toLowerCase().trim().equals("property")) {
propertyMap.put(getCategory(group), value.length() == 0 ? null : value.trim());
}
else if(styleComponent.toLowerCase().trim().equals("renderer")) {
renderer = value.trim().length() == 0 ? null : value.trim();
}
else if(styleComponent.toLowerCase().trim().equals("postrenderer") ||
styleComponent.toLowerCase().trim().equals("windowdecoration")) {
// Don't do anything with this now, we might use it later
}
else {
throw new IllegalArgumentException("Unknown style component \"" + styleComponent + "\" in style \"" + style + "\"");
}
}
private TextColor parseValue(String value) {
return TextColor.Factory.fromString(value);
}
private EnumSet<SGR> parseSGR(String value) {
value = value.trim();
String[] sgrEntries = value.split(",");
EnumSet<SGR> sgrSet = EnumSet.noneOf(SGR.class);
for(String entry: sgrEntries) {
entry = entry.trim().toUpperCase();
if(!(entry.length() == 0)) {
try {
sgrSet.add(SGR.valueOf(entry));
}
catch(IllegalArgumentException e) {
throw new IllegalArgumentException("Unknown SGR code \"" + entry + "\"", e);
}
}
}
return sgrSet;
}
private String getCategory(String group) {
if(group == null) {
return STYLE_NORMAL;
}
for(String style: Arrays.asList(STYLE_ACTIVE, STYLE_INSENSITIVE, STYLE_PRELIGHT, STYLE_NORMAL, STYLE_SELECTED)) {
if(group.toUpperCase().equals(style)) {
return style;
}
}
return group;
}
}
}
| [
"[email protected]"
] | |
5a877eeed5010e2bfcfe6e6c1c730750a8e567c6 | da812c45ab5bf8840dbe7acd556a7f01fc3c59e9 | /SuperchargeHomework/test/hu/anitak/superchargehomework/DepositTest.java | 1e0da5519e141efba1f483d28abcf31eccf25e08 | [] | no_license | AnitaKaracs/SuperchargeHomework | 4b709ae0fd953c9424d70087c8dac2d3dfc34c78 | 5de5522cbb938ee9c519c8b5bc39b8337d1e2cf9 | refs/heads/master | 2021-08-09T00:10:34.296514 | 2017-11-11T17:06:59 | 2017-11-11T17:06:59 | 110,342,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,836 | java | package hu.anitak.superchargehomework;
import hu.anitak.superchargehomework.businesslogic.DepositBusinessLogic;
import hu.anitak.superchargehomework.businesslogic.exception.InvalidCustomerException;
import hu.anitak.superchargehomework.businesslogic.object.DepositRequest;
import hu.anitak.superchargehomework.businesslogic.object.DepositResponse;
import hu.anitak.superchargehomework.businesslogic.object.OperationResult;
import hu.anitak.superchargehomework.model.Account;
import hu.anitak.superchargehomework.model.Customer;
import org.junit.Assert;
import org.junit.Test;
public class DepositTest {
private DepositBusinessLogic businessLogic = new DepositBusinessLogic();
@Test
public void testSuccessfulDeposit() {
Double defaultBalance = 300000d;
Customer testCustomer = new Customer();
Account testAccount = new Account(testCustomer, defaultBalance);
Double depositAmount = 100000d;
DepositRequest depositRequest = new DepositRequest();
depositRequest.setDepositAmount(depositAmount);
depositRequest.setAccount(testAccount);
depositRequest.setCustomer(testCustomer);
Double expectedBalanceAfterDeposit = defaultBalance + depositAmount;
DepositResponse response = (DepositResponse) businessLogic.doOperation(depositRequest);
Assert.assertEquals("Deposit was unsuccessful.", expectedBalanceAfterDeposit, testAccount.getCurrentBalance());
Assert.assertEquals("Deposit failed.", OperationResult.SUCCESS, response.getOperationResult());
Assert.assertNull("Exception during deposit: " + response.getException(), response.getException());
}
@Test
public void testFailedDepositWrongCustomer() {
Double defaultBalance = 300000d;
Customer testCustomer = new Customer();
Customer otherCustomer = new Customer();
Account testAccount = new Account(testCustomer, defaultBalance);
Double testDepositAmount = 100000d;
DepositRequest depositRequest = new DepositRequest();
depositRequest.setDepositAmount(testDepositAmount);
depositRequest.setAccount(testAccount);
depositRequest.setCustomer(otherCustomer);
DepositResponse response = (DepositResponse) businessLogic.doOperation(depositRequest);
Assert.assertNotEquals("Customer is not wrong but should be.", otherCustomer, testAccount.getCustomer());
Assert.assertEquals("Account balance should be the original because of wrong customer.", defaultBalance, testAccount.getCurrentBalance());
Assert.assertEquals("Deposit was not failed, but customer should be wrong.", OperationResult.FAILED, response.getOperationResult());
Assert.assertNotNull("Exception was not thrown, but customer should be wrong.", response.getException());
Assert.assertEquals("Exception type is wrong.", InvalidCustomerException.class, response.getException().getClass());
}
}
| [
"[email protected]"
] | |
a013d3d5f30aaf44928a4d51857fdbc35d880071 | 2dbc2d7a2a42030d7f6acc577cd914da4357079e | /TSMS/src/Funtion/UserMessage_Controller.java | 8b468a91106ac7edece78d889410b30ecca3ddb2 | [] | no_license | BreezeWL/learngit | a5311a9d2cbd880317024bd0d1c27a5c8608ec0d | 593a1f422b140b7fe33bd23656ec41cb8ffec698 | refs/heads/master | 2022-02-17T00:47:33.140486 | 2019-08-28T13:50:00 | 2019-08-28T13:50:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,645 | java | package Funtion;
import java.util.ArrayList;
import INTERFACE.UserFunction;
import Message.StudentMessage;
import Message.TeacherMessage;
public class UserMessage_Controller implements UserFunction
{
ArrayList<StudentMessage> std=new ArrayList<>();
ArrayList<TeacherMessage> tea=new ArrayList<>();
public boolean StudentMessage_enter(String ID,String name,String sex,String college,String grade)
{
StudentMessage student=new StudentMessage();
student.setCollege(college);
student.setGrade(grade);
student.setID(ID);
student.setName(name);
student.setSex(sex);
std.add(student);
return true;
}
public boolean TeacherMessage_enter(String ID,String name,String sex,String college,String jurisdiction)
{
TeacherMessage teacher=new TeacherMessage();
teacher.setCollege(college);
teacher.setID(ID);
teacher.setJurisdiction(jurisdiction);
teacher.setName(name);
teacher.setSex(sex);
tea.add(teacher);
return true;
}
public String StudentMessage_inquire(String name) {
for(int i=0;i<std.size();i++)
{
if(std.get(i).getName().equals(name))
return std.get(i).getCollege()+"/t"
+std.get(i).getGrade()+"/t"
+std.get(i).getID()+"/t"
+std.get(i).getName()+"/t"
+std.get(i).getSex()+"/t"
+std.get(i).getClass();
}
return null;
}
public String TeacherMessage_inquire(String name)
{
for(int i=0;i<std.size();i++)
{
if(tea.get(i).getName().equals(name))
return tea.get(i).getCollege()+"/t"
+tea.get(i).getID()+"/t"
+tea.get(i).getName()+"/t"
+tea.get(i).getJurisdiction()+"/t"
+tea.get(i).getClass();
}
return null;
}
}
| [
"[email protected]"
] | |
107a5c07b8acd1c06835dcfad18a45cd2033fd4a | e7b85db3e27410b4eda82a5da8e234f0a2bd390e | /ApiTest01/src/mini/service/ApiServieimpl.java | 8b343cb4c621ad3d2844e92ddc8273bc4488b39a | [] | no_license | dhkdwns93/Bit | ecb979a3938c60971ea62b1b4cfd9771a201f8d5 | cba02b73140bb68888c5af3e49d13de60948f60a | refs/heads/master | 2021-05-09T21:02:16.732344 | 2018-02-01T12:06:23 | 2018-02-01T12:06:23 | 118,718,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package mini.service;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import mini.aao.ApiAO;
import mini.aao.ApiAOimpl;
public class ApiServieimpl implements ApiService {
ApiAO aao = new ApiAOimpl();
@Override
public JSONObject detailView(String movieCode) throws Exception {
if (movieCode == "" || movieCode.isEmpty()) {
throw new Exception("검색할 내용이 없습니다.");
}
return aao.detailView(movieCode);
}
@Override
public JSONArray listView() throws Exception {
JSONArray jArr = aao.listView();
if (jArr.isEmpty() || jArr == null) {
throw new Exception("검색 결과가 없습니다.");
}
return jArr;
}
@Override
public JSONObject searchView(String movieName) throws Exception {
if (movieName == "" || movieName == null) {
throw new Exception("입력후 검색해주세요.");
}
return aao.searchView(movieName);
}
}
| [
"[email protected]"
] | |
81ad03d94c4aa322ff6a76b45b4d52e25fa1f614 | 7f7bbb43d682ba601d9bd6a3cc63ec9400c720f2 | /src/main/java/leet/maze/BMaze.java | 04e8a17ae7348769a5c66fc54a62796346010747 | [] | no_license | JamesDansie/ProjectEuler | 167f9c03d0c875ab36da4ab52ea531928bb5a480 | ba4d85dce302a8ca261556093cd5c6b1abb858a7 | refs/heads/master | 2020-09-23T11:10:10.205565 | 2020-04-29T23:03:06 | 2020-04-29T23:03:06 | 225,485,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,728 | java | package leet.maze;
import java.util.Arrays;
import java.util.List;
//from; https: www.baeldung.com/java-solve-maze
//from; https: github.com/eugenp/tutorials/blob/master/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/Maze.java
public class BMaze {
private static final int ROAD = 0;
private static final int WALL = 1;
private static final int START = 2;
private static final int EXIT = 3;
private static final int PATH = 4;
private int[][] maze;
private boolean[][] visited;
private Coordinate start;
private Coordinate end;
public BMaze(int[][] maze){
this.maze = maze;
this.visited = new boolean[maze.length][maze.length];
for(int i = 0; i < maze.length; i++){
for(int j = 0; j < maze[i].length; j++){
if(maze[i][j] == BMaze.START){
this.start = new Coordinate(i, j);
}
if(maze[i][j] == BMaze.EXIT){
this.end = new Coordinate(i, j);
}
}
}
}
public Coordinate getStart(){
return start;
}
public Coordinate getEnd(){
return end;
}
public boolean isExit(int x, int y){
return x == end.getX() && y == end.getY();
}
public boolean isExplored(int x, int y){
return visited[x][y];
}
public boolean isWall(int x, int y){
return maze[x][y] == WALL;
}
public void setVisited(int x, int y, boolean visit){
visited[x][y] = visit;
}
public boolean isValidLocation(int x, int y){
if(x < 0 || x >= maze.length || y < 0 || y >= maze[0].length){
return false;
}
return true;
}
public String stringPath(List<Coordinate> path){
int[][] tempMaze = Arrays.stream(maze)
.map(int[]::clone)
.toArray(int[][]::new);
for(Coordinate pCoord : path){
tempMaze[pCoord.getX()][ pCoord.getY()] = PATH;
}
StringBuilder sb = new StringBuilder();
for(int i = 0; i < tempMaze.length; i++){
for(int j=0; j < tempMaze[i].length; j++){
if(tempMaze[i][j] == ROAD){
sb.append(" ");
} else if (tempMaze[i][j] == WALL){
sb.append("#");
} else if (tempMaze[i][j] == START){
sb.append("S");
} else if (tempMaze[i][j] == EXIT){
sb.append("E");
} else if (tempMaze[i][j] == PATH){
sb.append(".");
}
}
sb.append("\n");
}
return sb.toString();
}
}
| [
"[email protected]"
] | |
3d19be374bc6f801ec048b302c0587c7cfdebd32 | 148ff9d4b36282acd199f87e58428d60335185f5 | /higgs-data-web/src/main/java/io/vilada/higgs/data/web/service/bo/in/v2/topology/TopologyInBO.java | a4e53fab6d42278a43195b0b589341193560e7e9 | [
"Apache-2.0"
] | permissive | gitter-badger/higgs | 3f60a68d8ab62b476a57e0790659c4bdbc1b11f8 | 7b2c8e9e90e231455e53232d9ad148d319ead10b | refs/heads/master | 2020-04-01T08:52:51.106664 | 2018-10-12T05:51:08 | 2018-10-12T05:51:08 | 153,050,668 | 1 | 1 | Apache-2.0 | 2018-10-15T03:56:25 | 2018-10-15T03:56:25 | null | UTF-8 | Java | false | false | 1,230 | java | /*
* Copyright 2018 The Higgs 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.vilada.higgs.data.web.service.bo.in.v2.topology;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;
import java.util.List;
/**
* @author yawei
* @date 2017-11-25.
*/
@Data
public class TopologyInBO {
private Long startTime;
private Long endTime;
private String appId;
@NotEmpty(message = "transName can not be empty")
private String transName;
private String tierId;
private String instanceId;
private Integer minResponseTime;
private List<String> instanceArray;
private List<String> transTypeArray;
private List<String> errorTypeArray;
}
| [
"[email protected]"
] | |
c780b8d21dcba9375568753a5c131536169bfa71 | 38bb080841fe88cfb6079cb6b38a6e5b9c2411a8 | /Java Day Day Up/手撕代码/src/main/java/stack/StackArray.java | 3fd8c05b53e77b5a1e6a6e1a2de5416efa9f58c3 | [
"MIT"
] | permissive | Brickea/Brickea-learning-records | 88c947d8105a076324c920fe3d800fed6edd2408 | 649f74e770106893101e120f2557eb15d23fc91d | refs/heads/master | 2023-02-01T20:20:20.277363 | 2020-12-18T16:03:43 | 2020-12-18T16:03:43 | 269,197,203 | 2 | 2 | MIT | 2020-11-06T01:44:53 | 2020-06-03T21:21:16 | Java | UTF-8 | Java | false | false | 3,178 | java | package stack;
import java.util.Iterator;
/**
* @Author: Zixiao Wang
* @Version: 1.0.0
* @Description:
* 基于数组的不定长栈
**/
public class StackArray<Item> implements Iterable<Item> {
private int size;
private Item[] storage;
private int N;
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param:
* @return:
* @description:
* 构造函数
* 初始size为10
**/
public StackArray(){
this.size = 10;
this.N = 0;
this.storage = (Item[]) new Object[this.size];
}
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param:
* @return: java.util.Iterator<Item>
* @description:
* 重写迭代器
* 从栈顶向下遍历
**/
@Override
public Iterator<Item> iterator() {
return new StackArrayIterator();
}
private class StackArrayIterator implements Iterator<Item>{
int i = StackArray.this.N;
@Override
public boolean hasNext() {
return i!=0;
}
@Override
public Item next() {
return StackArray.this.storage[--i];
}
}
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param: newSize
* @return: void
* @description:
* 重新调整存储数组的大小
**/
private void resize(int newSize){
Item[] temp = this.storage;
this.size = newSize;
this.storage = (Item[]) new Object[this.size];
for(int i=0;i<this.N;i++){
this.storage[i] = temp[i];
}
}
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param: item
* @return: void
* @description:
* 添加元素到栈顶
**/
public void push(Item item){
if(this.N==this.size){
// 需要扩容
this.resize(this.size*2);
}
this.storage[this.N++] = item;
}
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param:
* @return: Item
* @description:
* 查看栈顶元素
**/
public Item peek(){
return this.storage[this.N-1];
}
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param:
* @return: Item
* @description:
* 取出栈顶元素并返回
**/
public Item pop() throws Exception{
if(this.isEmpty()){
throw new Exception("The stack is empty!");
}
this.N--;
int popIndex = this.N;
Item popItem = this.storage[popIndex];
this.storage[popIndex]=null; // 防止元素游离
if(this.N>0&&this.N==this.size/4){
// 需要缩小容量
this.resize(this.size/2);
}
return popItem;
}
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param:
* @return: int
* @description:
* 返回当前大小
**/
public int size(){
return this.N;
}
/**
* @author: Zixiao Wang
* @date: 10/10/2020
* @param:
* @return: boolean
* @description:
* 判断栈是否为空
**/
public boolean isEmpty(){
return this.N==0;
}
}
| [
"[email protected]"
] | |
f5da1b5a7bc061ffa3dcf4ad3e7c5e70c953a261 | 3b6a37e4ce71f79ae44d4b141764138604a0f2b9 | /phloc-schematron/jing/src/main/java/com/thaiopensource/relaxng/output/xsd/basic/GroupRef.java | 7fdf67a9aeb995ae4b99a8486ec240f03da4f9b2 | [
"Apache-2.0"
] | permissive | lsimons/phloc-schematron-standalone | b787367085c32e40d9a4bc314ac9d7927a5b83f1 | c52cb04109bdeba5f1e10913aede7a855c2e9453 | refs/heads/master | 2021-01-10T21:26:13.317628 | 2013-09-13T12:18:02 | 2013-09-13T12:18:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.thaiopensource.relaxng.output.xsd.basic;
import com.thaiopensource.relaxng.edit.SourceLocation;
public class GroupRef extends Particle
{
private final String name;
public GroupRef (final SourceLocation location, final Annotation annotation, final String name)
{
super (location, annotation);
this.name = name;
}
public String getName ()
{
return name;
}
@Override
public <T> T accept (final ParticleVisitor <T> visitor)
{
return visitor.visitGroupRef (this);
}
@Override
public boolean equals (final Object obj)
{
return super.equals (obj) && name.equals (((GroupRef) obj).name);
}
@Override
public int hashCode ()
{
return super.hashCode () ^ name.hashCode ();
}
}
| [
"[email protected]"
] | |
e52754beccb37770940a242ca547714559a7a071 | db580518c8c415425d4ee5d3d3cfcf7a2e7f4ec6 | /backend/src/main/java/com/financialhouse/dto/form/response/CustomerInfo.java | 067bab70b088ba867fc7c83cd225c888354072cc | [] | no_license | snncskn/reporting-api | ff1ce93f0b0ea698c73cae59516a14e75dd8dd54 | 78ae9b1217efd43dade5a19d6a2d547c0c4d29b2 | refs/heads/master | 2022-12-13T10:20:42.301082 | 2020-02-20T14:22:55 | 2020-02-20T14:22:55 | 240,084,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,893 | java | package com.financialhouse.dto.form.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* {
* "customerInfo": {
* "id": 706020,
* "created_at": "2018-09-20 09:09:04",
* "updated_at": "2018-09-20 09:09:04",
* "deleted_at": null,
* "number": "510139XXXXXX8174",
* "expiryMonth": "1",
* "expiryYear": "2020",
* "startMonth": null,
* "startYear": null,
* "issueNumber": null,
* "email": "[email protected]",
* "birthday": "1971-11-11 09:09:04",
* "gender": null,
* "billingTitle": "Mr.",
* "billingFirstName": "Foo",
* "billingLastName": "Bar",
* "billingCompany": "Test",
* "billingAddress1": "test",
* "billingAddress2": null,
* "billingCity": "ANTALYA",
* "billingPostcode": "07070",
* "billingState": "ANTALYA",
* "billingCountry": "TR",
* "billingPhone": "05554443322",
* "billingFax": null,
* "shippingTitle": "Mr.",
* "shippingFirstName": "Foo",
* "shippingLastName": "Bar",
* "shippingCompany": "Test",
* "shippingAddress1": "test",
* "shippingAddress2": null,
* "shippingCity": "ANTALYA",
* "shippingPostcode": "07070",
* "shippingState": "ANTALYA",
* "shippingCountry": "TR",
* "shippingPhone": "05554443322",
* "shippingFax": null,
* "token": null
* },
* "fx": {
* "merchant": {
* "originalAmount": 150,
* "originalCurrency": "TRY"
* }
* },
* "transaction": {
* "merchant": {
* "referenceNo": "trn-test-seck-1",
* "merchantId": 1293,
* "status": "ERROR",
* "channel": "API",
* "customData": null,
* "chainId": "5ba363b03bbe6",
* "type": "AUTH",
* "agentInfoId": 21897,
* "operation": "DIRECT",
* "updated_at": "2018-09-20 09:09:04",
* "created_at": "2018-09-20 09:09:04",
* "id": 1009728,
* "fxTransactionId": 1386823,
* "acquirerTransactionId": 1012191,
* "code": 150,
* "message": "Unable to connect to acquirer",
* "transactionId": "1009728-1537434544-1293",
* "agent": {
* "id": 21897,
* "customerIp": "37.155.25.89",
* "customerUserAgent": "PostmanRuntime/7.3.0",
* "merchantIp": "37.155.25.89",
* "merchantUserAgent": "PostmanRuntime/7.3.0",
* "created_at": "2018-09-20 09:09:04",
* "updated_at": "2018-09-20 09:09:04",
* "deleted_at": null
* }
* }
* },
* "merchant": {
* "name": "Seckin Merchant"
* }
* }
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class CustomerInfo {
private Integer id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonProperty("created_at")
private Date createdAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonProperty("updated_at")
private Date updatedAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonProperty("deleted_at")
private Date deletedAt;
private String number;
private String expiryMonth;
private String expiryYear;
private String startMonth;
private String startYear;
private String issueNumber;
private String email;
private String birthday;
private String gender;
private String billingTitle;
private String billingFirstName;
private String billingLastName;
private String billingCompany;
private String billingAddress1;
private String billingAddress2;
private String billingCity;
private String billingPostcode;
private String billingState;
private String billingCountry;
private String billingPhone;
private String billingFax;
private String shippingTitle;
private String shippingFirstName;
private String shippingLastName;
private String shippingCompany;
private String shippingAddress1;
private String shippingAddress2;
private String shippingCity;
private String shippingPostcode;
private String shippingState;
private String shippingCountry;
private String shippingPhone;
private String shippingFax;
}
| [
"Cskn6396993"
] | Cskn6396993 |
1861fb53f7848b358ed231f58b6e2a7562c6d32f | a274ee699fdba39b24aa38121b6bad1188e7765c | /app/src/test/java/com/mfh/rxjava/ExampleUnitTest.java | 09f65e641997fa3ac9521d1a20396fdac9b515a9 | [] | no_license | fuhaoma/RXJava | d65e41223aa29b19cb75739ca70eb9e2974e16a5 | af9ec1f023b87b93da1efe32a25ec475afb5da49 | refs/heads/master | 2021-01-25T09:32:06.706447 | 2017-07-04T08:04:25 | 2017-07-04T08:04:25 | 93,847,464 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.mfh.rxjava;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
1590f44d14e3b522edb1298dccc5da8b52e8c8c3 | 21a375ba03c203717e3e8d516dbd416aea8926d2 | /microservice-circuitbreaker/src/main/java/com/ibm/microservice/cb/MainVerticle.java | 18390da23d2d057241ea5205b661faf5e4a82ced | [] | no_license | GreenwaysTechnology/IBM-Vertx-Sep-21 | 5df63b1bd5af91d18adee1753e3c5884b5575a87 | af7c503583db5caced352c61a0e1ff9a5ac71206 | refs/heads/main | 2023-08-19T03:17:19.268079 | 2021-09-24T11:29:23 | 2021-09-24T11:29:23 | 408,347,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.ibm.microservice.cb;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Promise;
public class MainVerticle extends AbstractVerticle {
@Override
public void start(Promise<Void> startPromise) throws Exception {
vertx.deployVerticle(new HelloService());
vertx.deployVerticle(new GreeterService());
}
}
| [
"[email protected]"
] | |
3421e01148ab74e8a792f9b9fb1fb5cc0a6f8f8c | 3b345b7cb4a1d81eb000e83762555ecc43d4a05a | /src/test/java/Pages/FrontPages/HomePage.java | 40f83de1bdbc7030f2c9730380f9143d8b290cf8 | [] | no_license | andjsxbp85/fliptest | 3c468a3426c67a0689bd0ea2c76d2712b8363716 | 7a6287730246732f27d62dde42c237dcd7d2b042 | refs/heads/master | 2022-12-12T02:59:30.482612 | 2020-09-19T09:04:47 | 2020-09-19T09:04:47 | 294,261,539 | 1 | 1 | null | 2020-09-13T22:02:31 | 2020-09-10T00:32:08 | Java | UTF-8 | Java | false | false | 10,121 | java | package Pages.FrontPages;
import Utils.WebExe;
import Utils.database;
import net.serenitybdd.core.annotations.findby.FindBy;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
public class HomePage extends WebExe implements database {
public void gotoFlipUrl(String url){
getDriver().get(url);
int i = 0;
while (i<10 && !(getDriver().getCurrentUrl().equals(url) || getDriver().getCurrentUrl().equals(url.substring(0,url.length()-1)))){
try{Thread.sleep(400);} catch (InterruptedException e){}
i++;
}
//url.length()-1 untuk karakte / di akhir url
Assert.assertTrue(getDriver().getCurrentUrl().equals(url) || getDriver().getCurrentUrl().equals(url.substring(0,url.length()-1)));
}
@FindBy(css="div.company-logo img[src='/aset_gambar/logo.png']") WebElement iconFlip;
@FindBy(css="div.navbar-header a[href='https://flipid.zendesk.com']") WebElement buttonBantuan;
@FindBy(css="div.navbar-header a[href='https://flip.id/karir']") WebElement buttonKarir;
@FindBy(css="div.navbar-header a[href='/site/biaya']") WebElement buttonBiaya;
@FindBy(css="a.btn-register-daftar[href*='site/login']") WebElement buttonMasuk;
public void menekanButtonMasuk(){
waitingForPresenceOfElement(buttonMasuk,5000,100);
click(buttonMasuk,5);
}
//=============================================== ASSERTION FUNCTION ===============================================
public void assertionUserOnHomePageFlipID(){
int i = 0;
while (i<10 && !getDriver().getCurrentUrl().equals(_mainURL)){
try{Thread.sleep(600);} catch (InterruptedException e){}
i++;
}
Assert.assertTrue(getDriver().getCurrentUrl().equals(_mainURL));
}
//======================================== SPECIAL CHATBOX >> IN MANY PAGES ========================================
@FindBy(css="iframe#fc_widget") WebElement hotlineChatIcon;
public void terdapatWidgetFloatingChatBox(){
waitingForPresenceOfElement(hotlineChatIcon,6000,100);
Assert.assertTrue(hotlineChatIcon.isDisplayed());
}
public void klikButtonFloatingChatBox(){
waitingForPresenceOfElement(hotlineChatIcon,6000,100);
click(hotlineChatIcon,5); int i = 0;
getDriver().switchTo().frame(getDriver().findElement(By.cssSelector("iframe#fc_widget")));
while (i<10 && !waitingForPresenceOfElement(buttonClose,1500,100)){
try{Thread.sleep(250);} catch (InterruptedException e){}
click(hotlineChatIcon,5);
i++;
}
Assert.assertTrue(buttonClose.isDisplayed());
}
@FindBy(css="div.minimize") WebElement buttonClose;
public void menekanButtonXUntukFloatingChatBox(){
//getDriver().switchTo().frame(getDriver().findElement(By.tagName("iframe"))); //karena masih fokus di iframe dari fungsi klikButtonFloatingChatBox();
waitingForPresenceOfElement(buttonClose,3000,100);
click(buttonClose,5);
try{Thread.sleep(1000);}catch (InterruptedException e){}
Assert.assertTrue(!waitingForPresenceOfElement(buttonClose,1000, 100));
getDriver().switchTo().defaultContent();
}
String cssOfficerName = "div.home-content ul.channel-list li h1.channel-name";
public void memilihCustomerServiceOfficer(String officerName){
waitingForPresenceOfElement(channelListChatBox,3000,100);
List<WebElement> officers = getDriver().findElements(By.cssSelector(cssOfficerName));
for(WebElement officer : officers){
if(getText(officer,5).equals(officerName)){ click(officer,5); break;}
}
}
@FindBy(css="div.fc-conversation-view input[placeholder='Your email']") WebElement inputMailChatBpx;
@FindBy(css="div.fc-conversation-view textarea") WebElement inputFieldChat;
@FindBy(css="div.fc-conversation-view button.send-message") WebElement buttonSendChatBox;
public void mengirimkanPesanDiChatBox(String mail, String chat){
waitingForPresenceOfElement(inputMailChatBpx,1500,100);
waitingForPresenceOfElement(inputFieldChat,1500,100);
waitingForPresenceOfElement(buttonSendChatBox,1500,100);
clear(inputMailChatBpx,4);
sendKeys(inputMailChatBpx,mail,4);
sendKeys(inputFieldChat,chat,4);
click(buttonSendChatBox,4);
}
@FindBy(css="div.h-reply div#app-conversation-editor>p") WebElement inputFieldReply;
@FindBy(css="a.h-reply-smiley") WebElement buttonIconSmiley;
@FindBy(css="input[placeholder='Search Emoji']") WebElement searchEmojiInputField;
@FindBy(css="div#emojis-search div.fc-emoji-picker-emojis__list") WebElement searchEmojiBoxResult;
String cssEmojiSearchResult = "div#emojis-search div.fc-emoji-picker-emojis__list>button>span";
public void mengirimkanPesnDiChatBoxMelauiReplyInputFieldDenganEmoji(String chat, String emojiname){
waitingForPresenceOfElement(inputFieldReply,3000,100);
waitingForPresenceOfElement(buttonIconSmiley,1000,100);
click(inputFieldReply,5);
//sendKeys(inputFieldReply,chat+" ",5); //di komen karena error di webexe, di fieldnya gk ada balikan value sedang di fungsi webexe ada cek value
//fungsi jaga jaga klo error sendkeys
int i = 0;
while (i<5){
try{inputFieldReply.sendKeys(chat+" "); break;}catch (Exception e){ try{Thread.sleep(600);}catch (Exception e2){} i++;}
}
click(buttonIconSmiley,4);
waitingForPresenceOfElement(searchEmojiInputField,2000,100);
sendKeys(searchEmojiInputField,emojiname,4);
waitingForPresenceOfElement(searchEmojiBoxResult,2000,100);
List<WebElement> emojis = getDriver().findElements(By.cssSelector(cssEmojiSearchResult));
click(emojis.get(0),5);
try{Thread.sleep(500);}catch (InterruptedException e){}
click(inputFieldReply,5);
//sendKeys(inputFieldReply,"\n",4);
i = 0;
while (i<5){
try{inputFieldReply.sendKeys("\n"); break;}catch (Exception e){ try{Thread.sleep(600);}catch (Exception e2){} i++;}
}
}
public void mengirimkanPesnDiChatBoxMelauiReplyInputField(String chat){
waitingForPresenceOfElement(inputFieldReply,3000,100);
waitingForPresenceOfElement(buttonIconSmiley,1000,100);
click(inputFieldReply,5);
int i = 0;
while (i<5){
try{inputFieldReply.sendKeys(chat); break;}catch (Exception e){ try{Thread.sleep(600);}catch (Exception e2){} i++;}
}
}
//=================================== SPECIAL ASSERTION CHATBOX >> IN MANY PAGES ===================================
@FindBy(css="div.home-content") WebElement boxDialogChatBox;
@FindBy(css="div.home-content div.logo>img") WebElement logoFlipChatDiBox;
@FindBy(css="div.home-content div.list-sub-title") WebElement chatBoxTitle;
@FindBy(css="div.home-content ul.channel-list") WebElement channelListChatBox;
@FindBy(css="div.hotline-launcher div.footer-note") WebElement footerNote;
public void assertionSeluruhElementPadaChatBoxDitampilkanSesuaiDenganDeskripsiPO(){
waitingForPresenceOfElement(buttonClose,3000,100);
waitingForPresenceOfElement(boxDialogChatBox,3000,100);
waitingForPresenceOfElement(logoFlipChatDiBox,3000,100);
waitingForPresenceOfElement(chatBoxTitle,3000,100);
waitingForPresenceOfElement(channelListChatBox,3000,100);
waitingForPresenceOfElement(footerNote,3000,100);
Assert.assertTrue(buttonClose.isDisplayed());
Assert.assertTrue(boxDialogChatBox.isDisplayed());
Assert.assertTrue(logoFlipChatDiBox.isDisplayed());
Assert.assertTrue(chatBoxTitle.isDisplayed());
Assert.assertTrue(channelListChatBox.isDisplayed());
Assert.assertTrue(footerNote.isDisplayed());
Assert.assertTrue(getText(chatBoxTitle,5).equals("Message Us"));
Assert.assertTrue(getText(footerNote,5).contains("Powered by"));
Assert.assertTrue(getText(footerNote,5).contains("Freshworks"));
}
@FindBy(css="div.fc-conversation-view h1.channel-title") WebElement csOfficerNameTitle;
public void assertionCustomerServiceOfficerNameYangTerpilihAdalah(String officerName){
waitingForPresenceOfElement(csOfficerNameTitle,4000,100);
Assert.assertTrue(csOfficerNameTitle.isDisplayed());
Assert.assertTrue(getText(csOfficerNameTitle,5).equals(officerName));
}
String cssOurOwnChatAndMail = "div.fc-conversation-view div.h-conv-chat div.odd div.h-chat";
public void assertionPesanChatDanEmailTerteraDiChatBoxDialog(String mail, String chat){
try{Thread.sleep(1200);}catch (InterruptedException e){}
List<WebElement> ourChats = getDriver().findElements(By.cssSelector(cssOurOwnChatAndMail));
String ourLastChat = getText(ourChats.get(ourChats.size()-1),5);
Assert.assertTrue(ourLastChat.contains(mail));
Assert.assertTrue(ourLastChat.contains(chat));
}
String cssLastOurChatWithEmoji = "div.fc-conversation-view div.h-conv-chat div.odd div.h-chat div.h-message-text";
public void assertionPesanChatDanEmojiTerteraDiChatBoxDialog(String chat){
try{Thread.sleep(1000);}catch (InterruptedException e){}
List<WebElement> ourChats = getDriver().findElements(By.cssSelector(cssLastOurChatWithEmoji));
String ourLastChat = getText(ourChats.get(ourChats.size()-1),5);
Assert.assertTrue(ourLastChat.contains(chat));
Assert.assertTrue(ourLastChat.contains("\uD83D\uDE3AT"));
}
@FindBy(css="div.size-exceed-msg.position-message-over") WebElement warMsgChatBox;
public void assertionMunculWarningErrorMessageChatBox(String notif){
waitingForPresenceOfElement(warMsgChatBox,5000,100);
Assert.assertTrue(warMsgChatBox.isDisplayed());
System.out.println("warMsgChatBox ="+getText(warMsgChatBox,5));
Assert.assertTrue(getText(warMsgChatBox,5).equals(notif));
}
}
| [
"[email protected]"
] | |
1ac6f158f8ae2a75776dab58321d028fa39ac0c3 | 97fd02f71b45aa235f917e79dd68b61c62b56c1c | /src/main/java/com/tencentcloudapi/lighthouse/v20200324/models/DescribeDockerActivitiesResponse.java | 06ca7ce7b5fe5c329534d87d929a07b75f4d9b22 | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-java | 7df922f7c5826732e35edeab3320035e0cdfba05 | 09fa672d75e5ca33319a23fcd8b9ca3d2afab1ec | refs/heads/master | 2023-09-04T10:51:57.854153 | 2023-09-01T03:21:09 | 2023-09-01T03:21:09 | 129,837,505 | 537 | 317 | Apache-2.0 | 2023-09-13T02:42:03 | 2018-04-17T02:58:16 | Java | UTF-8 | Java | false | false | 4,125 | java | /*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.lighthouse.v20200324.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class DescribeDockerActivitiesResponse extends AbstractModel{
/**
* 总数量。
*/
@SerializedName("TotalCount")
@Expose
private Long TotalCount;
/**
* Docker活动列表。
*/
@SerializedName("DockerActivitySet")
@Expose
private DockerActivity [] DockerActivitySet;
/**
* 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
@SerializedName("RequestId")
@Expose
private String RequestId;
/**
* Get 总数量。
* @return TotalCount 总数量。
*/
public Long getTotalCount() {
return this.TotalCount;
}
/**
* Set 总数量。
* @param TotalCount 总数量。
*/
public void setTotalCount(Long TotalCount) {
this.TotalCount = TotalCount;
}
/**
* Get Docker活动列表。
* @return DockerActivitySet Docker活动列表。
*/
public DockerActivity [] getDockerActivitySet() {
return this.DockerActivitySet;
}
/**
* Set Docker活动列表。
* @param DockerActivitySet Docker活动列表。
*/
public void setDockerActivitySet(DockerActivity [] DockerActivitySet) {
this.DockerActivitySet = DockerActivitySet;
}
/**
* Get 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @return RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public String getRequestId() {
return this.RequestId;
}
/**
* Set 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @param RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public void setRequestId(String RequestId) {
this.RequestId = RequestId;
}
public DescribeDockerActivitiesResponse() {
}
/**
* NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy,
* and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy.
*/
public DescribeDockerActivitiesResponse(DescribeDockerActivitiesResponse source) {
if (source.TotalCount != null) {
this.TotalCount = new Long(source.TotalCount);
}
if (source.DockerActivitySet != null) {
this.DockerActivitySet = new DockerActivity[source.DockerActivitySet.length];
for (int i = 0; i < source.DockerActivitySet.length; i++) {
this.DockerActivitySet[i] = new DockerActivity(source.DockerActivitySet[i]);
}
}
if (source.RequestId != null) {
this.RequestId = new String(source.RequestId);
}
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "TotalCount", this.TotalCount);
this.setParamArrayObj(map, prefix + "DockerActivitySet.", this.DockerActivitySet);
this.setParamSimple(map, prefix + "RequestId", this.RequestId);
}
}
| [
"[email protected]"
] | |
03694a71d20ddda7a5f187d08f31c57a0fa6eff0 | 956cfa7826cd2a561972632b776d9988b06bd72f | /src/main/java/com/mycompany/webprodezy/plantmaster/PlantMaster.java | 64abb3409ef857823923e7a50d858927e9ac445a | [] | no_license | hackersAssassin/webprodezy | 818ed70df8d679b9354d8b6d9bf507a5fbc01ec1 | 99abb6feaefb7940f19565450cb323e25d10f420 | refs/heads/master | 2022-12-08T21:55:30.009738 | 2019-10-12T13:03:19 | 2019-10-12T13:03:19 | 227,739,144 | 0 | 0 | null | 2022-11-23T05:25:18 | 2019-12-13T02:32:10 | Java | UTF-8 | Java | false | false | 4,053 | java | package com.prodezy.plantmaster;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class PlantMaster
*/
@WebServlet("/PlantMaster")
public class PlantMaster extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public PlantMaster() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String selectedID="";
String company_name=request.getParameter("company_name");
String plant_code=request.getParameter("plant_code");
String gst_no=request.getParameter("gst_no");
String plt_cont_no=request.getParameter("plt_cont_no");
String plt_email_addr=request.getParameter("plt_email_addr");
String weekly_off=request.getParameter("weekly_off");
String plt_name=request.getParameter("plt_name");
String cont_person_nm=request.getParameter("cont_person_nm");
String cont_no=request.getParameter("cont_no");
String email_addr=request.getParameter("email_addr");
String plt_addr=request.getParameter("plt_addr");
String shift1=request.getParameter("shift1");
String shift2=request.getParameter("shift2");
String shift3=request.getParameter("shift3");
String shift4=request.getParameter("shift4");
String frmhrtime1=request.getParameter("frmhrtime1");
String frmhrtime2=request.getParameter("frmhrtime2");
String frmhrtime3=request.getParameter("frmhrtime3");
String frmhrtime4=request.getParameter("frmhrtime4");
String frmmintime1=request.getParameter("frmmintime1");
String frmmintime2=request.getParameter("frmmintime2");
String frmmintime3=request.getParameter("frmmintime3");
String frmmintime4=request.getParameter("frmmintime4");
String frm_ampm1=request.getParameter("frm_ampm1");
String frm_ampm2=request.getParameter("frm_ampm2");
String frm_ampm3=request.getParameter("frm_ampm3");
String frm_ampm4=request.getParameter("frm_ampm4");
String tohrtime1=request.getParameter("tohrtime1");
String tohrtime2=request.getParameter("tohrtime2");
String tohrtime3=request.getParameter("tohrtime3");
String tohrtime4=request.getParameter("tohrtime4");
String tomintime1=request.getParameter("tomintime1");
String tomintime2=request.getParameter("tomintime2");
String tomintime3=request.getParameter("tomintime3");
String tomintime4=request.getParameter("tomintime4");
String to_ampm1=request.getParameter("to_ampm1");
String to_ampm2=request.getParameter("to_ampm2");
String to_ampm3=request.getParameter("to_ampm3");
String to_ampm4=request.getParameter("to_ampm4");
String brk_time1=request.getParameter("brk_time1");
String brk_time2=request.getParameter("brk_time2");
String brk_time3=request.getParameter("brk_time3");
String brk_time4=request.getParameter("brk_time4");
selectedID=request.getParameter("thisFieldID");
if(request.getParameter("Add_to_Machine_Master")!=null)
{
}
}
}
| [
"[email protected]"
] | |
f2e72f994f02fde384424ef45936bb5ef324b6f4 | faa3daced29d57d783595704d5ae8a745aeb271e | /app/src/main/java/com/a1000geeks/test/data/RepositoryManagerImpl.java | 3c7f25033240111ef170cbc88bf35cdcddca9b5b | [] | no_license | erizoo/Test1000Geeks | 898b120296198e3c7189e4079e0e2eaad5a624a6 | 6c1c93a1fae4cd8dd415010ee6f5f5915d6e4a02 | refs/heads/master | 2020-04-17T06:59:20.955976 | 2019-01-18T05:26:48 | 2019-01-18T05:26:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package com.a1000geeks.test.data;
import com.a1000geeks.test.data.network.ServiceNetwork;
import javax.inject.Inject;
public class RepositoryManagerImpl implements RepositoryManager {
private ServiceNetwork serviceNetwork;
@Inject
RepositoryManagerImpl(ServiceNetwork serviceNetwork) {
this.serviceNetwork = serviceNetwork;
}
@Override
public ServiceNetwork getServiceNetwork() {
return serviceNetwork;
}
}
| [
"Alex20968"
] | Alex20968 |
53c067f12f7bc231da3fbc979d709eeb182a0c1d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/22/22_55751c4671f4f2fcc7b5d99e830fddb8dc279e9e/TestXWPFFootnotes/22_55751c4671f4f2fcc7b5d99e830fddb8dc279e9e_TestXWPFFootnotes_s.java | 778325a28c87d04e64dd222f7b1b215364f38baa | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,920 | java | /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import java.io.IOException;
import java.math.BigInteger;
import junit.framework.TestCase;
import org.apache.poi.xwpf.XWPFTestDataSamples;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFtnEdn;
public class TestXWPFFootnotes extends TestCase {
public void testAddFootnotesToDocument() throws IOException{
XWPFDocument docOut = new XWPFDocument();
BigInteger noteId = BigInteger.valueOf(1);
XWPFFootnotes footnotes = docOut.createFootnotes();
CTFtnEdn ctNote = CTFtnEdn.Factory.newInstance();
ctNote.setId(noteId);
ctNote.setType(STFtnEdn.NORMAL);
footnotes.addFootnote(ctNote);
XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
XWPFFootnote note = docIn.getFootnoteByID(noteId.intValue());
assertEquals(note.getCTFtnEdn().getType(), STFtnEdn.NORMAL);
}
}
| [
"[email protected]"
] | |
cfae48065906bc10c1f638d77421ee07586a4053 | 19f029c2451e06bab12ae750715e67c7ae3172c1 | /AapWebTools/src/main/java/com/next/aap/web/jsf/beans/AdminSearchMemberBean.java | 72f9e879744c80efda573e1aebb88fc284d8ccfc | [] | no_license | AamAadmiParty/aap-backend | cd5d2c2063311bc03b125d22df23cc4c3268cae0 | 305c7d3fddef86b9ca3c485e4f62e5c7e3ba39ed | refs/heads/master | 2021-07-12T02:38:14.902840 | 2019-07-28T16:16:29 | 2019-07-28T16:16:29 | 46,349,900 | 1 | 1 | null | 2021-07-06T23:14:46 | 2015-11-17T13:48:04 | Java | UTF-8 | Java | false | false | 27,754 | java | package com.next.aap.web.jsf.beans;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ActionEvent;
import javax.faces.event.AjaxBehaviorEvent;
import org.primefaces.context.RequestContext;
import org.springframework.beans.BeanUtils;
import com.google.gdata.util.common.base.StringUtil;
import com.next.aap.core.service.AapService;
import com.next.aap.core.util.DataUtil;
import com.next.aap.web.dto.AppPermission;
import com.next.aap.web.dto.AssemblyConstituencyDto;
import com.next.aap.web.dto.CountryDto;
import com.next.aap.web.dto.DistrictDto;
import com.next.aap.web.dto.ParliamentConstituencyDto;
import com.next.aap.web.dto.PostLocationType;
import com.next.aap.web.dto.SearchMemberResultDto;
import com.next.aap.web.dto.StateDto;
import com.next.aap.web.dto.UserDto;
import com.next.aap.web.dto.UserRolePermissionDto;
import com.next.aap.web.util.ClientPermissionUtil;
import com.ocpsoft.pretty.faces.annotation.URLAction;
import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;
@ManagedBean
@ViewScoped
@URLMapping(id = "adminSearchMemberBean", beanName = "adminSearchMemberBean", pattern = "/admin/search", viewId = "/WEB-INF/jsf/admin_searchmember.xhtml")
@URLBeanName("adminSearchMemberBean")
public class AdminSearchMemberBean extends BaseMultiPermissionAdminJsfBean {
private static final long serialVersionUID = 1L;
private UserDto selectedUserForEditing;
private UserDto searchedUser;
private SearchMemberResultDto searchMemberResult;
private List<StateDto> stateList;
private List<DistrictDto> districtList;
private List<AssemblyConstituencyDto> assemblyConstituencyList;
private List<ParliamentConstituencyDto> parliamentConstituencyList;
private boolean enableDistrictCombo = false;
private boolean enableAssemblyConstituencyCombo = false;
private boolean enableParliamentConstituencyCombo = false;
private List<StateDto> livingStateList;
private List<DistrictDto> livingDistrictList;
private List<AssemblyConstituencyDto> livingAssemblyConstituencyList;
private List<ParliamentConstituencyDto> livingParliamentConstituencyList;
private boolean enableLivingDistrictCombo = false;
private boolean enableLivingAssemblyConstituencyCombo = false;
private boolean enableLivingParliamentConstituencyCombo = false;
private boolean sameAsLiving;
private boolean showVolunteerPanel = false;
private boolean showSearchVolunteerPanel = false;
private boolean disableMemberCheckForSelectedUserEditing = false;
private boolean disableVolunteerCheckForSelectedUserEditing = false;
private List<CountryDto> countries;
private boolean showResult;
private boolean showSearchPanel;
private double fee = DataUtil.MEMBERSHIP_FEE;
@ManagedProperty("#{volunteerBean}")
private VolunteerBean volunteerBean;
@ManagedProperty("#{volunteerBean}")
private VolunteerBean searchVolunteerBean;
public AdminSearchMemberBean(){
super("/admin/search", AppPermission.ADD_MEMBER, AppPermission.VIEW_MEMBER, AppPermission.UPDATE_GLOBAL_MEMBER, AppPermission.UPDATE_MEMBER);
}
@URLAction(onPostback = false)
public void init() throws Exception {
if(!checkUserAccess()){
return;
}
volunteerBean.init(null);
searchVolunteerBean.init(null);
searchMemberResult = new SearchMemberResultDto();
showResult = false;
showSearchPanel = true;
UserDto loggedInAdminUser = getLoggedInUser(true, buildLoginUrl("/admin/register"));
if (stateList == null || stateList.isEmpty()) {
livingStateList = stateList = aapService.getAllStates();
}
if (countries == null || countries.isEmpty()) {
countries = aapService.getAllCountries();
}
if (loggedInAdminUser == null) {
return;
}
searchedUser = new UserDto();
/*
searchedUser.setStateLivingId(loggedInAdminUser.getStateLivingId());
searchedUser.setDistrictLivingId(loggedInAdminUser.getDistrictLivingId());
searchedUser.setAssemblyConstituencyLivingId(loggedInAdminUser.getAssemblyConstituencyLivingId());
searchedUser.setParliamentConstituencyLivingId(loggedInAdminUser.getParliamentConstituencyLivingId());
searchedUser.setStateVotingId(loggedInAdminUser.getStateVotingId());
searchedUser.setDistrictVotingId(loggedInAdminUser.getDistrictVotingId());
searchedUser.setAssemblyConstituencyVotingId(loggedInAdminUser.getAssemblyConstituencyVotingId());
searchedUser.setParliamentConstituencyVotingId(loggedInAdminUser.getParliamentConstituencyVotingId());
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 1981);
searchedUser.setDateOfBirth(cal.getTime());
*/
//Copy Logged In user to selectedUserForEditing
selectedUserForEditing = new UserDto();
// selectedUserForEditing.setDateOfBirth(cal.getTime());
if (searchedUser.getStateVotingId() != null) {
enableDistrictCombo = true;
enableParliamentConstituencyCombo = true;
parliamentConstituencyList = aapService.getAllParliamentConstituenciesOfState(searchedUser.getStateVotingId());
districtList = aapService.getAllDistrictOfState(searchedUser.getStateVotingId());
if (searchedUser.getDistrictVotingId() != null) {
enableAssemblyConstituencyCombo = true;
assemblyConstituencyList = aapService.getAllAssemblyConstituenciesOfDistrict(searchedUser.getDistrictVotingId());
}
}
if (searchedUser.getStateLivingId() != null) {
enableLivingDistrictCombo = true;
enableLivingParliamentConstituencyCombo = true;
livingParliamentConstituencyList = aapService.getAllParliamentConstituenciesOfState(searchedUser.getStateLivingId());
livingDistrictList = aapService.getAllDistrictOfState(searchedUser.getStateLivingId());
if (searchedUser.getDistrictLivingId() != null) {
enableLivingAssemblyConstituencyCombo = true;
livingAssemblyConstituencyList = aapService.getAllAssemblyConstituenciesOfDistrict(searchedUser.getDistrictLivingId());
}
}
}
public void createNewMember(){
showSearchPanel = false;
selectedUserForEditing = new UserDto();
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 1981);
selectedUserForEditing.setDateOfBirth(cal.getTime());
BeanUtils.copyProperties(searchedUser, selectedUserForEditing);
disableVolunteerCheckForSelectedUserEditing = false;
disableMemberCheckForSelectedUserEditing = false;
try {
volunteerBean.init(null);
} catch (Exception e) {
e.printStackTrace();
}
}
public void onClickVolunteer(){
showVolunteerPanel = selectedUserForEditing.isVolunteer();
}
public void onClickSearchVolunteer() {
showSearchVolunteerPanel = searchedUser.isVolunteer();
}
public void cancelSaveMember(){
showSearchPanel = true;
}
public boolean isMemberUpdateAllowed(){
UserRolePermissionDto userRolePermissionDto = getUserRolePermissionInSesion();
return ClientPermissionUtil.isAllowed(AppPermission.UPDATE_GLOBAL_MEMBER, userRolePermissionDto, null, PostLocationType.Global)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, menuBean.getAdminSelectedLocationId(), menuBean.getLocationType());
}
public boolean isMemberUpdateAllowed(UserDto userDto){
UserRolePermissionDto userRolePermissionDto = getUserRolePermissionInSesion();
return ClientPermissionUtil.isAllowed(AppPermission.UPDATE_GLOBAL_MEMBER, userRolePermissionDto, null, PostLocationType.Global)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getAssemblyConstituencyLivingId(), PostLocationType.AC)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getParliamentConstituencyLivingId(), PostLocationType.PC)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getDistrictLivingId(), PostLocationType.DISTRICT)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getStateLivingId(), PostLocationType.STATE)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getAssemblyConstituencyVotingId(), PostLocationType.AC)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getParliamentConstituencyVotingId(), PostLocationType.PC)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getDistrictVotingId(), PostLocationType.DISTRICT)
||ClientPermissionUtil.isAllowed(AppPermission.UPDATE_MEMBER, userRolePermissionDto, userDto.getStateVotingId(), PostLocationType.STATE);
}
public void saveProfile(ActionEvent event) {
if (sameAsLiving) {
selectedUserForEditing.setStateVotingId(selectedUserForEditing.getStateLivingId());
selectedUserForEditing.setDistrictVotingId(selectedUserForEditing.getDistrictLivingId());
selectedUserForEditing.setAssemblyConstituencyVotingId(selectedUserForEditing.getAssemblyConstituencyLivingId());
selectedUserForEditing.setParliamentConstituencyVotingId(selectedUserForEditing.getParliamentConstituencyLivingId());
}
if (selectedUserForEditing.getStateLivingId() == null || selectedUserForEditing.getStateLivingId() == 0) {
sendErrorMessageToJsfScreen("Please select State where new Member is living currently");
}
if (selectedUserForEditing.getDistrictLivingId() == null || selectedUserForEditing.getDistrictLivingId() == 0) {
sendErrorMessageToJsfScreen("Please select District where new Member is living currently");
}
if (selectedUserForEditing.getAssemblyConstituencyLivingId() == null || selectedUserForEditing.getAssemblyConstituencyLivingId() == 0) {
sendErrorMessageToJsfScreen("Please select Assembly Constituency where new Member is living currently");
}
if (selectedUserForEditing.getParliamentConstituencyLivingId() == null || selectedUserForEditing.getParliamentConstituencyLivingId() == 0) {
sendErrorMessageToJsfScreen("Please select Parliament Constituency where new Member is living currently");
}
if (selectedUserForEditing.getStateVotingId() == null || selectedUserForEditing.getStateVotingId() == 0) {
sendErrorMessageToJsfScreen("Please select State where new Member is registered as Voter");
}
if (selectedUserForEditing.getDistrictVotingId() == null || selectedUserForEditing.getDistrictVotingId() == 0) {
sendErrorMessageToJsfScreen("Please select District where new Member is registered as Voter");
}
if (selectedUserForEditing.getAssemblyConstituencyVotingId() == null || selectedUserForEditing.getAssemblyConstituencyVotingId() == 0) {
sendErrorMessageToJsfScreen("Please select Assembly Constituency where new Member is registered as Voter");
}
if (selectedUserForEditing.getParliamentConstituencyVotingId() == null || selectedUserForEditing.getParliamentConstituencyVotingId() == 0) {
sendErrorMessageToJsfScreen("Please select Parliament Constituency where new Member is registered as Voter");
}
/*
if (selectedUserForEditing.isNri() ){
if((selectedUserForEditing.getNriCountryId() == null || selectedUserForEditing.getNriCountryId() == 0)) {
sendErrorMessageToJsfScreen("Please select Country where you Live");
}
if(selectedUserForEditing.isMember() && StringUtil.isEmpty(selectedUserForEditing.getPassportNumber())){
sendErrorMessageToJsfScreen("Please enter passport number. Its Required for NRIs to become member.");
}
}
*/
if (selectedUserForEditing.getDateOfBirth() == null) {
sendErrorMessageToJsfScreen("Please enter Date of Birth of Member");
}
if(StringUtil.isEmpty(selectedUserForEditing.getEmail()) && StringUtil.isEmpty(selectedUserForEditing.getMobileNumber())){
sendErrorMessageToJsfScreen("Please enter either Email or Mobile or Both");
}
/*
* else{ Calendar todayCalendar = Calendar.getInstance();
* todayCalendar.add(Calendar.YEAR, -18);
* if(dobCalendar.after(todayCalendar)){
* sendErrorMessageToJsfScreen("You must be 18 to be eligible for vote"
* ); } }
*/
if (StringUtil.isEmptyOrWhitespace(selectedUserForEditing.getName())) {
sendErrorMessageToJsfScreen("Please enter Member full name");
}
if(!selectedUserForEditing.isMember() && !selectedUserForEditing.isVolunteer()){
sendErrorMessageToJsfScreen("Please select if you are registering user as Member or Volunteer or both");
}
if (isValidInput()) {
try{
boolean isNew = (selectedUserForEditing.getId() == null || selectedUserForEditing.getId() <= 0);
selectedUserForEditing = aapService.saveUserFromAdmiPanel(selectedUserForEditing, volunteerBean.getSelectedVolunteer(), volunteerBean.getSelectedInterestIds());
ssaveLoggedInUserInSession(selectedUserForEditing);
sendInfoMessageToJsfScreen("Profile saved succesfully.");
if(isNew){
searchMemberResult.getUsers().add(0, selectedUserForEditing);
}else{
searchMemberResult = aapService.searchMembers(searchedUser);
}
if(selectedUserForEditing.getMembershipStatus().equals("Payment Await")){
//Show the Payment Dialoge
RequestContext.getCurrentInstance().execute("paymentDialog.show()");
}
showSearchPanel = true;
disableVolunteerCheckForSelectedUserEditing = selectedUserForEditing.isVolunteer();
disableMemberCheckForSelectedUserEditing = selectedUserForEditing.isMember();
}catch(Exception ex){
sendErrorMessageToJsfScreen(ex);
}
}
}
public void searchMember(){
logger.info("Search Member Clicked");
searchedUser.setVolunteerDto(volunteerBean.getSelectedVolunteer());
searchMemberResult = aapService.searchMemberVolunteers(searchedUser, searchVolunteerBean.getSelectedInterestIds());
showResult = true;
}
public void receiveMembershipPayment(){
if(fee < DataUtil.MEMBERSHIP_FEE){
sendErrorMessageToJsfScreen("Payment must be more then or equal to "+DataUtil.MEMBERSHIP_FEE+" Rs");
}
if(isValidInput()){
try{
UserDto loggedInAdmin = getLoggedInUser();
selectedUserForEditing = aapService.receiveMembershipFee(selectedUserForEditing.getId(), fee, loggedInAdmin.getId());
if(fee > DataUtil.MEMBERSHIP_FEE){
sendInfoMessageToJsfScreen("Membership is confirmed and donation of Rs " + (fee - DataUtil.MEMBERSHIP_FEE)+" has been received");
}else{
sendInfoMessageToJsfScreen("Membership is confirmed");
}
searchMemberResult = aapService.searchMembers(searchedUser);
RequestContext.getCurrentInstance().execute("paymentDialog.hide()");
fee = DataUtil.MEMBERSHIP_FEE;
}catch(Exception ex){
ex.printStackTrace();
sendErrorMessageToJsfScreen(ex.getMessage(), ex);
}
}
}
public boolean isDisablePaymentReceiveButton(){
if(selectedUserForEditing.getMembershipStatus() == null){
return true;
}
return !selectedUserForEditing.getMembershipStatus().equals("Payment Await");
}
public void handleStateChange(AjaxBehaviorEvent event) {
try {
if (searchedUser.getStateVotingId() == 0 || searchedUser.getStateVotingId() == null) {
enableDistrictCombo = false;
enableParliamentConstituencyCombo = false;
districtList = new ArrayList<>();
parliamentConstituencyList = new ArrayList<>();
} else {
districtList = aapService.getAllDistrictOfState(searchedUser.getStateVotingId());
parliamentConstituencyList = aapService.getAllParliamentConstituenciesOfState(searchedUser.getStateVotingId());
enableDistrictCombo = true;
enableParliamentConstituencyCombo = true;
enableAssemblyConstituencyCombo = false;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void handleUserVotingStateChange(AjaxBehaviorEvent event) {
try {
if (searchedUser.getStateVotingId() == 0 || searchedUser.getStateVotingId() == null) {
enableDistrictCombo = false;
enableParliamentConstituencyCombo = false;
enableAssemblyConstituencyCombo = false;
districtList = new ArrayList<>();
parliamentConstituencyList = new ArrayList<>();
searchedUser.setAssemblyConstituencyVotingId(0L);
searchedUser.setDistrictVotingId(0L);
} else {
districtList = aapService.getAllDistrictOfState(searchedUser.getStateVotingId());
parliamentConstituencyList = aapService.getAllParliamentConstituenciesOfState(searchedUser.getStateVotingId());
searchedUser.setAssemblyConstituencyVotingId(0L);
searchedUser.setDistrictVotingId(0L);
enableDistrictCombo = true;
enableParliamentConstituencyCombo = true;
enableAssemblyConstituencyCombo = false;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void handleLivingStateChange(AjaxBehaviorEvent event) {
try {
if (searchedUser.getStateLivingId() == 0 || searchedUser.getStateLivingId() == null) {
enableLivingDistrictCombo = false;
enableLivingParliamentConstituencyCombo = false;
enableLivingAssemblyConstituencyCombo = false;
livingDistrictList = new ArrayList<>();
searchedUser.setAssemblyConstituencyLivingId(0L);
searchedUser.setDistrictLivingId(0L);
} else {
livingParliamentConstituencyList = aapService.getAllParliamentConstituenciesOfState(searchedUser.getStateLivingId());
livingDistrictList = aapService.getAllDistrictOfState(searchedUser.getStateLivingId());
searchedUser.setAssemblyConstituencyLivingId(0L);
searchedUser.setDistrictLivingId(0L);
enableLivingParliamentConstituencyCombo = true;
enableLivingDistrictCombo = true;
enableLivingAssemblyConstituencyCombo = false;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void handleUserLivingStateChange(AjaxBehaviorEvent event) {
try {
if (selectedUserForEditing.getStateLivingId() == 0 || selectedUserForEditing.getStateLivingId() == null) {
enableLivingDistrictCombo = false;
enableLivingParliamentConstituencyCombo = false;
livingDistrictList = new ArrayList<>();
} else {
livingParliamentConstituencyList = aapService.getAllParliamentConstituenciesOfState(selectedUserForEditing.getStateLivingId());
livingDistrictList = aapService.getAllDistrictOfState(selectedUserForEditing.getStateLivingId());
enableLivingParliamentConstituencyCombo = true;
enableLivingDistrictCombo = true;
enableLivingAssemblyConstituencyCombo = false;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void handleDistrictChange(AjaxBehaviorEvent event) {
try {
if (searchedUser.getDistrictVotingId() == 0 || searchedUser.getDistrictVotingId() == null) {
enableAssemblyConstituencyCombo = false;
assemblyConstituencyList = new ArrayList<>();
} else {
enableAssemblyConstituencyCombo = true;
assemblyConstituencyList = aapService.getAllAssemblyConstituenciesOfDistrict(searchedUser.getDistrictVotingId());
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void handleLivingDistrictChange(AjaxBehaviorEvent event) {
try {
if (searchedUser.getDistrictLivingId() == 0 || searchedUser.getDistrictLivingId() == null) {
enableLivingAssemblyConstituencyCombo = false;
livingAssemblyConstituencyList = new ArrayList<>();
} else {
enableLivingAssemblyConstituencyCombo = true;
livingAssemblyConstituencyList = aapService.getAllAssemblyConstituenciesOfDistrict(searchedUser.getDistrictLivingId());
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void handleUserVotingDistrictChange(AjaxBehaviorEvent event) {
try {
if (selectedUserForEditing.getDistrictVotingId() == 0 || selectedUserForEditing.getDistrictVotingId() == null) {
enableAssemblyConstituencyCombo = false;
assemblyConstituencyList = new ArrayList<>();
} else {
enableAssemblyConstituencyCombo = true;
assemblyConstituencyList = aapService.getAllAssemblyConstituenciesOfDistrict(selectedUserForEditing.getDistrictVotingId());
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void handleUserLivingDistrictChange(AjaxBehaviorEvent event) {
try {
if (selectedUserForEditing.getDistrictLivingId() == 0 || selectedUserForEditing.getDistrictLivingId() == null) {
enableLivingAssemblyConstituencyCombo = false;
livingAssemblyConstituencyList = new ArrayList<>();
} else {
enableLivingAssemblyConstituencyCombo = true;
livingAssemblyConstituencyList = aapService.getAllAssemblyConstituenciesOfDistrict(selectedUserForEditing.getDistrictLivingId());
}
} catch (Exception e) {
e.printStackTrace();
}
}
public boolean isShowMemberPanel(){
return StringUtil.isEmpty(selectedUserForEditing.getMembershipNumber());
}
public void onClickNri() {
}
public void onClickMember() {
}
public void onClickSameAsLiving() {
}
public List<StateDto> getStateList() {
return stateList;
}
public void setStateList(List<StateDto> stateList) {
this.stateList = stateList;
}
public List<AssemblyConstituencyDto> getAssemblyConstituencyList() {
return assemblyConstituencyList;
}
public void setAssemblyConstituencyList(List<AssemblyConstituencyDto> assemblyConstituencyList) {
this.assemblyConstituencyList = assemblyConstituencyList;
}
public boolean isEnableAssemblyConstituencyCombo() {
return enableAssemblyConstituencyCombo;
}
public void setEnableAssemblyConstituencyCombo(boolean enableAssemblyConstituencyCombo) {
this.enableAssemblyConstituencyCombo = enableAssemblyConstituencyCombo;
}
public List<DistrictDto> getDistrictList() {
return districtList;
}
public void setDistrictList(List<DistrictDto> districtList) {
this.districtList = districtList;
}
public boolean isEnableDistrictCombo() {
return enableDistrictCombo;
}
public void setEnableDistrictCombo(boolean enableDistrictCombo) {
this.enableDistrictCombo = enableDistrictCombo;
}
public List<StateDto> getLivingStateList() {
return livingStateList;
}
public void setLivingStateList(List<StateDto> livingStateList) {
this.livingStateList = livingStateList;
}
public List<DistrictDto> getLivingDistrictList() {
return livingDistrictList;
}
public void setLivingDistrictList(List<DistrictDto> livingDistrictList) {
this.livingDistrictList = livingDistrictList;
}
public List<AssemblyConstituencyDto> getLivingAssemblyConstituencyList() {
return livingAssemblyConstituencyList;
}
public void setLivingAssemblyConstituencyList(List<AssemblyConstituencyDto> livingAssemblyConstituencyList) {
this.livingAssemblyConstituencyList = livingAssemblyConstituencyList;
}
public boolean isEnableLivingDistrictCombo() {
return enableLivingDistrictCombo;
}
public void setEnableLivingDistrictCombo(boolean enableLivingDistrictCombo) {
this.enableLivingDistrictCombo = enableLivingDistrictCombo;
}
public boolean isEnableLivingAssemblyConstituencyCombo() {
return enableLivingAssemblyConstituencyCombo;
}
public void setEnableLivingAssemblyConstituencyCombo(boolean enableLivingAssemblyConstituencyCombo) {
this.enableLivingAssemblyConstituencyCombo = enableLivingAssemblyConstituencyCombo;
}
public boolean isSameAsLiving() {
return sameAsLiving;
}
public void setSameAsLiving(boolean sameAsLiving) {
this.sameAsLiving = sameAsLiving;
}
public List<ParliamentConstituencyDto> getParliamentConstituencyList() {
return parliamentConstituencyList;
}
public void setParliamentConstituencyList(List<ParliamentConstituencyDto> parliamentConstituencyList) {
this.parliamentConstituencyList = parliamentConstituencyList;
}
public List<ParliamentConstituencyDto> getLivingParliamentConstituencyList() {
return livingParliamentConstituencyList;
}
public void setLivingParliamentConstituencyList(List<ParliamentConstituencyDto> livingParliamentConstituencyList) {
this.livingParliamentConstituencyList = livingParliamentConstituencyList;
}
public boolean isEnableLivingParliamentConstituencyCombo() {
return enableLivingParliamentConstituencyCombo;
}
public void setEnableLivingParliamentConstituencyCombo(boolean enableLivingParliamentConstituencyCombo) {
this.enableLivingParliamentConstituencyCombo = enableLivingParliamentConstituencyCombo;
}
@Override
public AapService getAapService() {
return aapService;
}
@Override
public void setAapService(AapService aapService) {
this.aapService = aapService;
}
public boolean isEnableParliamentConstituencyCombo() {
return enableParliamentConstituencyCombo;
}
public void setEnableParliamentConstituencyCombo(boolean enableParliamentConstituencyCombo) {
this.enableParliamentConstituencyCombo = enableParliamentConstituencyCombo;
}
public List<CountryDto> getCountries() {
return countries;
}
public void setCountries(List<CountryDto> countries) {
this.countries = countries;
}
public UserDto getSelectedUserForEditing() {
return selectedUserForEditing;
}
public void setSelectedUserForEditing(UserDto selectedUserForEditing) {
this.selectedUserForEditing = selectedUserForEditing;
disableVolunteerCheckForSelectedUserEditing = selectedUserForEditing.isVolunteer();
disableMemberCheckForSelectedUserEditing = selectedUserForEditing.isMember();
showVolunteerPanel = selectedUserForEditing.isVolunteer();
try {
volunteerBean.init(selectedUserForEditing);
} catch (Exception e) {
e.printStackTrace();
}
showSearchPanel = false;
}
public UserDto getSearchedUser() {
return searchedUser;
}
public void setSearchedUser(UserDto searchedUser) {
this.searchedUser = searchedUser;
}
public SearchMemberResultDto getSearchMemberResult() {
return searchMemberResult;
}
public void setSearchMemberResult(SearchMemberResultDto searchMemberResult) {
this.searchMemberResult = searchMemberResult;
}
public boolean isShowResult() {
return showResult;
}
public void setShowResult(boolean showResult) {
this.showResult = showResult;
}
public boolean isShowSearchPanel() {
return showSearchPanel;
}
public void setShowSearchPanel(boolean showSearchPanel) {
this.showSearchPanel = showSearchPanel;
}
public double getFee() {
return fee;
}
public void setFee(double fee) {
this.fee = fee;
}
public VolunteerBean getVolunteerBean() {
return volunteerBean;
}
public void setVolunteerBean(VolunteerBean volunteerBean) {
this.volunteerBean = volunteerBean;
}
public boolean isShowVolunteerPanel() {
return showVolunteerPanel;
}
public void setShowVolunteerPanel(boolean showVolunteerPanel) {
this.showVolunteerPanel = showVolunteerPanel;
}
public boolean isDisableMemberCheckForSelectedUserEditing() {
return disableMemberCheckForSelectedUserEditing;
}
public void setDisableMemberCheckForSelectedUserEditing(boolean disableMemberCheckForSelectedUserEditing) {
this.disableMemberCheckForSelectedUserEditing = disableMemberCheckForSelectedUserEditing;
}
public boolean isDisableVolunteerCheckForSelectedUserEditing() {
return disableVolunteerCheckForSelectedUserEditing;
}
public void setDisableVolunteerCheckForSelectedUserEditing(boolean disableVolunteerCheckForSelectedUserEditing) {
this.disableVolunteerCheckForSelectedUserEditing = disableVolunteerCheckForSelectedUserEditing;
}
public VolunteerBean getSearchVolunteerBean() {
return searchVolunteerBean;
}
public void setSearchVolunteerBean(VolunteerBean searchVolunteerBean) {
this.searchVolunteerBean = searchVolunteerBean;
}
public boolean isShowSearchVolunteerPanel() {
return showSearchVolunteerPanel;
}
public void setShowSearchVolunteerPanel(boolean showSearchVolunteerPanel) {
this.showSearchVolunteerPanel = showSearchVolunteerPanel;
}
}
| [
"[email protected]"
] | |
51896b15fe05444f978eb1d36c7d7ae696db8bde | feec96e9d0732be1bb01caaa173410e9bc4eb85b | /apis/managerApi/src/main/java/zbl/fly/models/PermGroup.java | a13cd75a63ce7180d2bb349adb5518bc10e36836 | [] | no_license | zblfendou/fly | 8731e2577e421b9f3c8c801fef6303b757d4c3f9 | e6b9fe7775fc4b15a5c083a82cbb1d461c04e5a9 | refs/heads/master | 2022-07-06T05:48:58.670698 | 2019-11-25T06:10:03 | 2019-11-25T06:10:03 | 162,548,898 | 1 | 0 | null | 2022-06-24T02:24:54 | 2018-12-20T08:24:11 | Java | UTF-8 | Java | false | false | 2,659 | java | package zbl.fly.models;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Entity
@Setter
@Getter
@Cacheable
public class PermGroup implements Serializable {
@Id
@Column(columnDefinition = "varchar(191) not null")
private String groupName;
private String groupText;
@ManyToOne
@JoinColumn(name = "parent", foreignKey = @ForeignKey(name = "FK_PERMGROUP_PARENT"))
@JsonIgnore
private PermGroup parent;
@OneToMany(mappedBy = "parent", fetch = FetchType.EAGER)
@OrderBy("order asc ")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<PermGroup> subGroups = new ArrayList<>();
@OneToMany(mappedBy = "permGroup", fetch = FetchType.EAGER)
@OrderBy("order asc ")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<Permission> permissions = new ArrayList<>();
@JsonIgnore
@Column(name = "o")
private int order;
public PermGroup(String groupName, String groupText, int order) {
this.groupName = groupName;
this.groupText = groupText;
this.order = order;
}
public PermGroup() {
}
public PermGroup(String groupName, String groupText, PermGroup parent, int order) {
this.groupName = groupName;
this.groupText = groupText;
this.parent = parent;
this.order = order;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getGroupText() {
return groupText;
}
public void setGroupText(String groupText) {
this.groupText = groupText;
}
public PermGroup getParent() {
return parent;
}
public void setParent(PermGroup parent) {
this.parent = parent;
}
public List<PermGroup> getSubGroups() {
return subGroups;
}
public void setSubGroups(List<PermGroup> subGroups) {
this.subGroups = subGroups;
}
public List<Permission> getPermissions() {
return permissions;
}
public void setPermissions(List<Permission> permissions) {
this.permissions = permissions;
}
@Transient
@JsonIgnore
public String getFullName() {
return (parent == null ? "" : parent.getFullName() + ":") + groupName;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
}
| [
"[email protected]"
] | |
a6017b24c6e79720e29e5dfc986386b39fe9a757 | 042ce19874b1b3148e461ab92e11df431b2947ea | /shoppingmall/src/main/java/com/dsshop/member/model/dao/MemberDaoImpl.java | 9e2903d3a979d88a4ac20be2b5b840946450f205 | [] | no_license | Rkato1/Spring | 1f80cedbaedb81a33d6436b46857732497ceed2f | a12b1568bdb8a58e974a2d5b31a86713f45095d2 | refs/heads/main | 2023-04-21T08:25:15.590241 | 2021-05-20T06:22:24 | 2021-05-20T06:22:24 | 320,176,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package com.dsshop.member.model.dao;
import org.springframework.stereotype.Repository;
//Imple은 implements의 약자
//unique조건 때문에 두개는 안됨
//동시에 하나도 없으면 autowired 써진곳에서 에러
@Repository("dao1")
public class MemberDaoImpl implements MemberDao {
}
| [
"[email protected]"
] | |
744c60d77406ecdba1a5f640a89dab7ecf640778 | cfc784409e7c8f720f357b109c9658a1553aa479 | /geetha/src/main/java/mainmethod/Mainrunner.java | fda10c78071d17ba617f5229d3d4922164924817 | [] | no_license | Geetha86-git/APITesting | 161188bfdb8925d3502e937275242a8fdb41242a | c6ed3bfd3e6965f670fc72d8d3663f9472a79746 | refs/heads/master | 2023-06-21T02:13:36.898022 | 2021-07-23T02:31:45 | 2021-07-23T02:31:45 | 373,558,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package mainmethod;
import org.openqa.selenium.WebDriver;
import com.businesscomponents.Selectoperations;
import com.drivermethod.Driverobjects;
public class Mainrunner {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
Driverobjects dos = new Driverobjects();
WebDriver driver = dos.initializeDriver();
Selectoperations so = new Selectoperations();
so.bookTicket(driver);
}
}
| [
"[email protected]"
] | |
f17f5dcfd70e3ddd8724f17c549f81931a30fc7d | ce23bb1ac62ff3ee167f62a4d3870892cb999b5c | /src/org/jcrontab/data/ProcessFactory.java | ccc90e816171aa28178ffc186f03e92291962d72 | [] | no_license | Glacierli/tkli | 36c8d83651df5df0ce2dad8ecb7e065622a55fba | 23167c56b0078dd9286ad5a7c34c32c31ddda463 | refs/heads/master | 2020-09-04T23:11:47.393951 | 2019-11-06T06:16:08 | 2019-11-06T06:16:08 | 219,920,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,225 | java | /**
* This file is part of the jcrontab package
* Copyright (C) 2001-2003 Israel Olalla
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA
*
* For questions, suggestions:
*
* [email protected]
*
*/
package org.jcrontab.data;
import org.jcrontab.Crontab;
import org.jcrontab.log.Log;
/**
* This Factory builds a dao using teh given information.
* Initializes the system with the given properties or
* loads the default config
* @author $Author: iolalla $
* @version $Revision: 1.1 $
*/
public class ProcessFactory {
private static ProcessFactory instance;
private static ProcessSource dao = null;
/**
* Default Constructor private
*/
private ProcessFactory() {
if ( dao == null) {
try {
dao = ((ProcessSource)Class.forName(Crontab.getInstance()
.getProperty("org.jcrontab.data.processsource"))
.newInstance())
.getInstance();
} catch (Exception e) {
Log.error(e.toString(), e);
}
}
}
/**
* This method returns the DataFactory of the System This method
* grants the Singleton pattern
* @return DataSource
*/
public synchronized static ProcessFactory getInstance() {
if (instance == null) {
instance = new ProcessFactory();
}
return instance;
}
/**
* This method returns the ProcessSource of the System
* @return ProcessSource
*/
public static ProcessSource getDAO() {
return dao;
}
}
| [
"[email protected]"
] | |
3f081efafe69e355b80e1638688bab118c8cc103 | e14bdeb92eab65e8bae00f3b29dfb9afac7c2ac2 | /src/main/java/zxc/person/design_pattern/pattern/structural/adapter/classadapter/Target.java | d0417f9b2daa08825fe23782f64db9af9fbcb8da | [] | no_license | zxccong/design_pattern | 153a64f0fbd2efc93242d62a4312469161563ff6 | 085339a640d11b15fdebc5996fd2c9d367ec0682 | refs/heads/master | 2022-06-28T18:01:51.809822 | 2019-08-08T14:48:14 | 2019-08-08T14:48:14 | 199,156,475 | 0 | 0 | null | 2022-06-21T01:37:28 | 2019-07-27T11:31:27 | Java | UTF-8 | Java | false | false | 171 | java | package zxc.person.design_pattern.pattern.structural.adapter.classadapter;
/**
* Created by geely
*
* 目标类
*
*/
public interface Target {
void request();
}
| [
"[email protected]"
] | |
457be064b356975d3fe0f0ec174e6eade4fc1506 | 995a77b13b5a29e8964e0ba97216c96dbd166e85 | /Mail_Simulation/src/com/mail/simulation/service/MyService.java | 2b32a99d84ef02cd65133c0825a1c9e31b07f8a1 | [] | no_license | miraz184/Java-Projects | 7ce7d14fbe3995b02cddc32a77f0138454f02acb | d6d19d6a3395d52423b317ec1bb5cb9c1308675b | refs/heads/master | 2020-12-29T13:25:47.819908 | 2020-02-06T06:35:40 | 2020-02-06T06:35:40 | 238,621,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | package com.mail.simulation.service;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.mail.simulation.model.Mail_Info;
import com.mail.simulation.model.User_Info;
public interface MyService {
public String register(User_Info ui);
public User_Info login(User_Info ui);
public boolean compose(HttpServletRequest req);
List<Mail_Info> getdraft(HttpServletRequest req);
List<Mail_Info> sentmail(HttpServletRequest req);
List<Mail_Info> getinbox(HttpServletRequest req);
public boolean forgetpass(HttpServletRequest req);
public boolean delete(int id);
public boolean delete_sent(int id);
public boolean delete_draft(int id);
List<Mail_Info> deletedMail();
List<Mail_Info> deletedsent();
List<Mail_Info> deleteddraft();
public Mail_Info inboxfeth(int did);
public Mail_Info sentfetch(int did);
public Mail_Info draftfetch(int did);
public User_Info mailcompose(String mailby,String to,String sub,String msg);
public boolean forgetpassword2(String password1, String password2);
public boolean forgetpassword(String email, String scrqn, String scrans);
public User_Info home();
}
| [
"[email protected]"
] | |
62b04a4d2631c57167f7061403b80d8b4cb8178a | a24dd1e6f3818772a8d7a69f222e1ace90e31745 | /SalaArcoIris/src/Filter/ServletFilter.java | 5836b5ad520b0883bf4079536c4f78399c6fd41d | [] | no_license | yuriandreisilva/projeto-individual-senai | 6f4b3c0ec884c0c3cf4a70714ed9c79f9556a96f | 258f0c08a58e9c122003b20a07f8b1788e30fc4d | refs/heads/master | 2023-07-24T04:45:16.736068 | 2021-09-10T02:01:37 | 2021-09-10T02:01:37 | 320,822,459 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,347 | java | package Filter;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class ServletFilter
*/
//@WebServlet("/ServletFilter")
public class ServletFilter implements Filter {
/**
* @see HttpServlet#HttpServlet()
*/
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
String context = request.getServletContext().getContextPath();
try {
HttpSession session = ((HttpServletRequest) request).getSession();
String usuario = null;
if (session != null) {
usuario = (String) session.getAttribute("login");
}
if (usuario == null)
{
((HttpServletResponse) response).sendRedirect("http://localhost:8080/SalaArcoIris/index.html");
} else {
filterChain.doFilter(request, response);
}
} catch (Exception e) {
e.printStackTrace();
}
} // Fechando o bloco do doFilter()
// Executa a destruição do Filtro.
public void destroy() {
}
}
| [
"[email protected]"
] | |
1c9b6f64728d0af3ff2b0214118f0bb9bae753ba | 3530da7ce8b9b19ca83c9186dcc2b59ffe802348 | /src/main/java/com/m1zark/casino/utils/Voltorb/VoltorbBoard.java | 428aa41a1373dfbbe771c019a45f8914483f95e9 | [] | no_license | m1zark/casino | 1e9cc2ea0b6ea17c39795cfba7da345bebbc16ef | ed5b3f356453eb04b320e91365195e7b536afb42 | refs/heads/master | 2023-05-02T21:46:50.784748 | 2021-05-29T14:44:41 | 2021-05-29T14:44:41 | 371,992,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,867 | java | /*
* Decompiled with CFR 0.151.
*/
package com.m1zark.casino.utils.Voltorb;
import com.m1zark.casino.config.VoltorbFlipConfig;
import com.m1zark.casino.utils.Voltorb.Card;
import com.m1zark.casino.utils.Voltorb.SumCard;
import java.util.HashMap;
import java.util.Random;
public class VoltorbBoard {
Random random = new Random();
private HashMap<Integer, Integer> board = new HashMap();
private Card[][] cards = new Card[5][5];
private SumCard[][] sumCards = new SumCard[2][5];
private int level;
private int cardsLeft = 0;
private int cardsFlipped = 0;
private int score = 1;
private boolean gameOver = false;
public VoltorbBoard(int level) {
int j;
int i;
this.level = level;
for (i = 0; i < this.cards.length; ++i) {
for (j = 0; j < this.cards[i].length; ++j) {
this.cards[i][j] = new Card();
}
}
for (i = 0; i < this.sumCards.length; ++i) {
for (j = 0; j < this.sumCards[i].length; ++j) {
this.sumCards[i][j] = new SumCard();
}
}
}
public void initBoard() {
this.initCards();
this.initsumCards();
for (int y = 0; y < 5; ++y) {
for (int x = 0; x < 5; ++x) {
this.board.put(x + 9 * y, this.cards[x][y].getValue());
}
}
if (VoltorbFlipConfig.debug) {
System.out.println(this.board);
}
}
private int[][] possibleSums(int n) {
int start = (int)Math.ceil((double)n / -2.0);
int end = (int)Math.floor((double)n / -3.0);
int length = Math.abs(start - end) + 1;
int[][] sums = new int[length][2];
int j = 0;
for (int i = start; i <= end; ++i) {
sums[j][0] = -n - 3 * i;
sums[j][1] = n + 2 * i;
++j;
}
return sums;
}
private void initCards() {
int[] multiplierCards = new int[3];
multiplierCards[0] = this.level * 3 / 2 + 5;
if (multiplierCards[0] > 13) {
multiplierCards[0] = 13;
}
int[][] sums = this.possibleSums(this.level * 2 + 8);
int r = this.random.nextInt(sums.length);
multiplierCards[1] = sums[r][0];
multiplierCards[2] = sums[r][1];
this.cardsLeft = multiplierCards[1] + multiplierCards[2];
for (int i = 0; i < multiplierCards.length; ++i) {
int j = 0;
while (j < multiplierCards[i]) {
int b;
int a = this.random.nextInt(5);
if (this.cards[a][b = this.random.nextInt(5)].getValue() != 1) continue;
if (i == 0) {
this.cards[a][b].setValue(i);
} else {
this.cards[a][b].setValue(i + 1);
}
++j;
}
}
}
private void initsumCards() {
Card[] column = new Card[5];
for (int i = 0; i < this.cards.length; ++i) {
this.sumCards[0][i].setTotals(this.cards[i]);
for (int j = 0; j < this.cards[i].length; ++j) {
column[j] = this.cards[j][i];
}
this.sumCards[1][i].setTotals(column);
}
}
public boolean checkBoard() {
return this.cardsFlipped == this.cardsLeft;
}
public void setScore(int s) {
this.score = s == 0 ? 1 : this.score * s;
}
public void setCardsFlipped() {
++this.cardsFlipped;
}
public Random getRandom() {
return this.random;
}
public HashMap<Integer, Integer> getBoard() {
return this.board;
}
public Card[][] getCards() {
return this.cards;
}
public SumCard[][] getSumCards() {
return this.sumCards;
}
public int getLevel() {
return this.level;
}
public int getCardsLeft() {
return this.cardsLeft;
}
public int getCardsFlipped() {
return this.cardsFlipped;
}
public int getScore() {
return this.score;
}
public boolean isGameOver() {
return this.gameOver;
}
public void setRandom(Random random) {
this.random = random;
}
public void setBoard(HashMap<Integer, Integer> board) {
this.board = board;
}
public void setCards(Card[][] cards) {
this.cards = cards;
}
public void setSumCards(SumCard[][] sumCards) {
this.sumCards = sumCards;
}
public void setLevel(int level) {
this.level = level;
}
public void setCardsLeft(int cardsLeft) {
this.cardsLeft = cardsLeft;
}
public void setCardsFlipped(int cardsFlipped) {
this.cardsFlipped = cardsFlipped;
}
public void setGameOver(boolean gameOver) {
this.gameOver = gameOver;
}
}
| [
"[email protected]"
] | |
bdeca41fc572ed1c558a762bc4f1659f87a99b7f | fb23b2bd49636b981228a0edfc56e5975edbaa02 | /src/test/java/com/wu/blog/BlogApplicationTests.java | 30d4352cf09d8136935d8eef0bb7debc9554644c | [] | no_license | 1138080709/blog | 2d7138449a955ef4b4b031a1531b7c02236d9482 | 241b3abd87cb309249635262af4539e5ec175772 | refs/heads/master | 2022-03-03T09:38:10.765347 | 2020-02-27T09:22:29 | 2020-02-27T09:22:29 | 243,512,953 | 0 | 0 | null | 2022-02-09T22:22:35 | 2020-02-27T12:22:58 | HTML | UTF-8 | Java | false | false | 198 | java | package com.wu.blog;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BlogApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
925a8b80ae535e2dddc3b6ab40a0dc2a76e591a0 | a444d8e36b22d2c88a12f43c9669f31d279af159 | /ScriptCompressor1.0/src/dk/brics/tajs/analysis/dom/html/HTMLMenuElement.java | fbb1007717420557254fa7b1e43b5f4d688c6d23 | [
"Apache-2.0"
] | permissive | cursem/ScriptCompressor | 77c61ec710fd9e1aaedfc305bac9e089a4dadb44 | 4d0e37b92023e00fa2468940149220eed9fc30ac | refs/heads/master | 2016-09-05T11:07:22.774298 | 2014-09-17T12:29:11 | 2014-09-17T12:29:11 | 24,143,533 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,784 | java | /*
* Copyright 2009-2013 Aarhus University
*
* 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 dk.brics.tajs.analysis.dom.html;
import dk.brics.tajs.analysis.InitialStateBuilder;
import dk.brics.tajs.analysis.State;
import dk.brics.tajs.analysis.dom.DOMObjects;
import dk.brics.tajs.analysis.dom.DOMWindow;
import dk.brics.tajs.lattice.ObjectLabel;
import dk.brics.tajs.lattice.Value;
import static dk.brics.tajs.analysis.dom.DOMFunctions.createDOMProperty;
/**
* Menu list. See the MENU element definition in HTML 4.01. This element is
* deprecated in HTML 4.01.
*/
public class HTMLMenuElement {
public static ObjectLabel CONSTRUCTOR;
public static ObjectLabel PROTOTYPE;
public static ObjectLabel INSTANCES;
public static void build(State s) {
CONSTRUCTOR = new ObjectLabel(DOMObjects.HTMLMENUELEMENT_CONSTRUCTOR, ObjectLabel.Kind.FUNCTION);
PROTOTYPE = new ObjectLabel(DOMObjects.HTMLMENUELEMENT_PROTOTYPE, ObjectLabel.Kind.OBJECT);
INSTANCES = new ObjectLabel(DOMObjects.HTMLMENUELEMENT_INSTANCES, ObjectLabel.Kind.OBJECT);
// Constructor Object
s.newObject(CONSTRUCTOR);
s.writePropertyWithAttributes(CONSTRUCTOR, "length", Value.makeNum(0).setAttributes(true, true, true));
s.writePropertyWithAttributes(CONSTRUCTOR, "prototype", Value.makeObject(PROTOTYPE).setAttributes(true, true, true));
s.writeInternalPrototype(CONSTRUCTOR, Value.makeObject(InitialStateBuilder.FUNCTION_PROTOTYPE));
s.writeProperty(DOMWindow.WINDOW, "HTMLMenuElement", Value.makeObject(CONSTRUCTOR));
// Prototype Object
s.newObject(PROTOTYPE);
s.writeInternalPrototype(PROTOTYPE, Value.makeObject(HTMLElement.ELEMENT_PROTOTYPE));
// Multiplied Object
s.newObject(INSTANCES);
s.writeInternalPrototype(INSTANCES, Value.makeObject(PROTOTYPE));
/*
* Properties.
*/
// DOM Level 1
createDOMProperty(s, INSTANCES, "compact", Value.makeAnyBool());
s.writeInternalPrototype(INSTANCES, Value.makeObject(PROTOTYPE));
s.multiplyObject(INSTANCES);
INSTANCES = INSTANCES.makeSingleton().makeSummary();
/*
* Functions.
*/
// No functions
}
}
| [
"[email protected]"
] | |
b3765aa7164191a27f534c9230ccee2ee3228e8d | 7779ea3a37189bfb8dcf8f30bf522bf5a4d762ec | /ReservationSystem/src/main/java/com/reserve/Dao/GuestDaoImpl.java | 0e2aff412c395f4659b38c172eca67fc88d01f85 | [] | no_license | ShruthiRGit/Spring | 950314f595ba8a6841ea555b7c5219ed6615662d | fe26479573614d3d299b9c49c104cfb352533221 | refs/heads/master | 2020-03-22T10:52:57.112627 | 2018-07-31T07:30:55 | 2018-07-31T07:30:55 | 139,933,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,597 | java | package com.reserve.Dao;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.reserve.bean.DiningReservation;
import com.reserve.bean.ResortReservation;
import com.reserve.mapper.DiningRowMapper;
import com.reserve.mapper.ResortRowMapper;
import com.reserve.store.GuestException;
@Transactional
@Repository
public class GuestDaoImpl implements GuestDao {
@Autowired
private JdbcTemplate jdbcTemplate;
Date date = new Date();
java.sql.Date sqlDate = new java.sql.Date(date.getTime());
int resortNumber = 0;
int diningNumber = 0;
public DiningReservation getBookingDetails(int guestId) throws GuestException {
DiningReservation diningReservation = null;
RowMapper<DiningReservation> rowMapper = new DiningRowMapper();
try {
diningReservation = jdbcTemplate.queryForObject("SELECT * FROM dining WHERE guest_id = ?",
new Object[] { guestId }, rowMapper);
} catch (DataAccessException e) {
throw new GuestException("Dining booking is not present for given guest" + guestId);
}
return diningReservation;
}
@Override
public ResortReservation getResortDetails(int guestId) throws GuestException {
ResortReservation resortReservation = null;
RowMapper<ResortReservation> rowmapper = new ResortRowMapper();
try {
resortReservation = jdbcTemplate.queryForObject("SELECT * FROM resort WHERE guest_id = ?",
new Object[] { guestId }, rowmapper);
} catch (DataAccessException e) {
throw new GuestException("Resort booking is not present for given guest" + guestId);
}
return resortReservation;
}
@Override
public DiningReservation cancelDining(int diningReservationNum) throws GuestException {
DiningReservation diningReservation = null;
RowMapper<DiningReservation> rowMapper = new DiningRowMapper();
int count = 0;
try {
count = jdbcTemplate.update("UPDATE dining set status = ? where d_reservation_number = ?",
new Object[] { "CANCELED", diningReservationNum });
if (count != 0) {
diningReservation = jdbcTemplate.queryForObject("SELECT * FROM dining WHERE d_reservation_number = ?",
new Object[] { diningReservationNum }, rowMapper);
}
} catch (Exception e) {
throw new GuestException("Could not cancel booking");
}
return diningReservation;
}
@Override
public ResortReservation cancelResort(int resortReservationNum) throws GuestException {
ResortReservation resortReservation = null;
RowMapper<ResortReservation> rowMapper = new ResortRowMapper();
int count = 0;
try {
count = jdbcTemplate.update("UPDATE resort set status = ? where r_reservation_number = ?",
new Object[] { "CANCELED", resortReservationNum });
if (count != 0) {
resortReservation = jdbcTemplate.queryForObject("SELECT * FROM resort WHERE r_reservation_number = ?",
new Object[] { resortReservationNum }, rowMapper);
}
} catch (Exception e) {
throw new GuestException("Could not cancel booking");
}
return resortReservation;
}
@Override
public int bookResort(ResortReservation resortReservation, int guestId) throws GuestException{
int count = 0;
int resortReservationNumber = 0;
String status = "BOOKED";
try {
count = jdbcTemplate.update(
"insert into resort (r_reservation_number,guest_id,room_type,arrival_date,departure_date,no_of_people,status,created_date,updated_date) VALUES(?,?,?,?,?,?,?,?,?)",
new Object[] { ++resortNumber, guestId, resortReservation.getRoomType(),
resortReservation.getArrivalDate(), resortReservation.getDepartureDate(),
resortReservation.getNoOfPeople(), status, sqlDate, sqlDate });
if (count != 0) {
ResortReservation resortReservation1 = null;
RowMapper<ResortReservation> rowmapper = new ResortRowMapper();
resortReservation1 = jdbcTemplate.queryForObject("SELECT * FROM resort WHERE guest_id = ?",
new Object[] { guestId }, rowmapper);
resortReservationNumber = resortReservation1.getReservationNumber();
}
} catch (Exception e) {
throw new GuestException("Information provided are incorrect");
}
return resortReservationNumber;
}
@Override
public int bookDining(DiningReservation diningReservation, int guestId) throws GuestException {
int count = 0;
int diningReservationNumber = 0;
String status = "BOOKED";
try {
count = jdbcTemplate.update(
"insert into dining (d_reservation_number,guest_id,dining_type,arrival_date,no_of_people,status,created_date,updated_date) VALUES(?,?,?,?,?,?,?,?)",
new Object[] { ++diningNumber, guestId, diningReservation.getDiningType(),
diningReservation.getArrivalDate(), diningReservation.getNoOfPeople(), status, sqlDate,
sqlDate });
if (count != 0) {
DiningReservation diningReservation1 = null;
RowMapper<DiningReservation> rowmapper = new DiningRowMapper();
diningReservation1 = jdbcTemplate.queryForObject("SELECT * FROM dining WHERE guest_id = ?",
new Object[] { guestId }, rowmapper);
diningReservationNumber = diningReservation1.getDiningReservationNum();
}
} catch (Exception e) {
throw new GuestException("Information provided are incorrect");
}
return diningReservationNumber;
}
} | [
"[email protected]"
] | |
7224cf60fcf501dfa2c25e241a9fa09041b3e183 | 64da43bd78917f737e0bba183e2ff1e85715c98d | /splashcountview/build/generated/not_namespaced_r_class_sources/debug/generateDebugRFile/out/android/support/coreutils/R.java | e47b733f23da3e5d6635659bebc82493c6d65173 | [] | no_license | wangxy0916/MyBaseProject | cfdfe6ce433eda4a912f2758c5f5c001046483a0 | 176b7fadc66df5356ccf41f2dfe47169236b4b4b | refs/heads/master | 2021-07-12T10:19:55.422147 | 2019-05-11T11:01:05 | 2019-05-11T11:01:05 | 181,266,384 | 0 | 0 | null | 2019-05-09T10:56:06 | 2019-04-14T05:54:37 | Java | UTF-8 | Java | false | false | 9,670 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.coreutils;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static int alpha = 0x7f040028;
public static int font = 0x7f04007e;
public static int fontProviderAuthority = 0x7f040080;
public static int fontProviderCerts = 0x7f040081;
public static int fontProviderFetchStrategy = 0x7f040082;
public static int fontProviderFetchTimeout = 0x7f040083;
public static int fontProviderPackage = 0x7f040084;
public static int fontProviderQuery = 0x7f040085;
public static int fontStyle = 0x7f040086;
public static int fontVariationSettings = 0x7f040087;
public static int fontWeight = 0x7f040088;
public static int ttcIndex = 0x7f04010e;
}
public static final class color {
private color() {}
public static int notification_action_color_filter = 0x7f06003d;
public static int notification_icon_bg_color = 0x7f06003e;
public static int ripple_material_light = 0x7f060048;
public static int secondary_text_default_material_light = 0x7f06004a;
}
public static final class dimen {
private dimen() {}
public static int compat_button_inset_horizontal_material = 0x7f08004c;
public static int compat_button_inset_vertical_material = 0x7f08004d;
public static int compat_button_padding_horizontal_material = 0x7f08004e;
public static int compat_button_padding_vertical_material = 0x7f08004f;
public static int compat_control_corner_material = 0x7f080050;
public static int compat_notification_large_icon_max_height = 0x7f080051;
public static int compat_notification_large_icon_max_width = 0x7f080052;
public static int notification_action_icon_size = 0x7f08005c;
public static int notification_action_text_size = 0x7f08005d;
public static int notification_big_circle_margin = 0x7f08005e;
public static int notification_content_margin_start = 0x7f08005f;
public static int notification_large_icon_height = 0x7f080060;
public static int notification_large_icon_width = 0x7f080061;
public static int notification_main_column_padding_top = 0x7f080062;
public static int notification_media_narrow_margin = 0x7f080063;
public static int notification_right_icon_size = 0x7f080064;
public static int notification_right_side_padding_top = 0x7f080065;
public static int notification_small_icon_background_padding = 0x7f080066;
public static int notification_small_icon_size_as_large = 0x7f080067;
public static int notification_subtext_size = 0x7f080068;
public static int notification_top_pad = 0x7f080069;
public static int notification_top_pad_large_text = 0x7f08006a;
}
public static final class drawable {
private drawable() {}
public static int notification_action_background = 0x7f090055;
public static int notification_bg = 0x7f090056;
public static int notification_bg_low = 0x7f090057;
public static int notification_bg_low_normal = 0x7f090058;
public static int notification_bg_low_pressed = 0x7f090059;
public static int notification_bg_normal = 0x7f09005a;
public static int notification_bg_normal_pressed = 0x7f09005b;
public static int notification_icon_background = 0x7f09005c;
public static int notification_template_icon_bg = 0x7f09005d;
public static int notification_template_icon_low_bg = 0x7f09005e;
public static int notification_tile_bg = 0x7f09005f;
public static int notify_panel_notification_icon_bg = 0x7f090060;
}
public static final class id {
private id() {}
public static int action_container = 0x7f0c0008;
public static int action_divider = 0x7f0c000a;
public static int action_image = 0x7f0c000b;
public static int action_text = 0x7f0c0011;
public static int actions = 0x7f0c0012;
public static int async = 0x7f0c0016;
public static int blocking = 0x7f0c0018;
public static int chronometer = 0x7f0c001c;
public static int forever = 0x7f0c0027;
public static int icon = 0x7f0c002b;
public static int icon_group = 0x7f0c002c;
public static int info = 0x7f0c002e;
public static int italic = 0x7f0c002f;
public static int line1 = 0x7f0c0031;
public static int line3 = 0x7f0c0032;
public static int normal = 0x7f0c0038;
public static int notification_background = 0x7f0c0039;
public static int notification_main_column = 0x7f0c003a;
public static int notification_main_column_container = 0x7f0c003b;
public static int right_icon = 0x7f0c0041;
public static int right_side = 0x7f0c0042;
public static int tag_transition_group = 0x7f0c005c;
public static int tag_unhandled_key_event_manager = 0x7f0c005d;
public static int tag_unhandled_key_listeners = 0x7f0c005e;
public static int text = 0x7f0c005f;
public static int text2 = 0x7f0c0060;
public static int time = 0x7f0c0063;
public static int title = 0x7f0c0064;
}
public static final class integer {
private integer() {}
public static int status_bar_notification_info_maxnum = 0x7f0d0005;
}
public static final class layout {
private layout() {}
public static int notification_action = 0x7f0f001d;
public static int notification_action_tombstone = 0x7f0f001e;
public static int notification_template_custom_big = 0x7f0f001f;
public static int notification_template_icon_group = 0x7f0f0020;
public static int notification_template_part_chronometer = 0x7f0f0021;
public static int notification_template_part_time = 0x7f0f0022;
}
public static final class string {
private string() {}
public static int status_bar_notification_info_overflow = 0x7f15002a;
}
public static final class style {
private style() {}
public static int TextAppearance_Compat_Notification = 0x7f1600ec;
public static int TextAppearance_Compat_Notification_Info = 0x7f1600ed;
public static int TextAppearance_Compat_Notification_Line2 = 0x7f1600ee;
public static int TextAppearance_Compat_Notification_Time = 0x7f1600ef;
public static int TextAppearance_Compat_Notification_Title = 0x7f1600f0;
public static int Widget_Compat_NotificationActionContainer = 0x7f160158;
public static int Widget_Compat_NotificationActionText = 0x7f160159;
}
public static final class styleable {
private styleable() {}
public static int[] ColorStateListItem = { 0x7f040028, 0x101031f, 0x10101a5 };
public static int ColorStateListItem_alpha = 0;
public static int ColorStateListItem_android_alpha = 1;
public static int ColorStateListItem_android_color = 2;
public static int[] FontFamily = { 0x7f040080, 0x7f040081, 0x7f040082, 0x7f040083, 0x7f040084, 0x7f040085 };
public static int FontFamily_fontProviderAuthority = 0;
public static int FontFamily_fontProviderCerts = 1;
public static int FontFamily_fontProviderFetchStrategy = 2;
public static int FontFamily_fontProviderFetchTimeout = 3;
public static int FontFamily_fontProviderPackage = 4;
public static int FontFamily_fontProviderQuery = 5;
public static int[] FontFamilyFont = { 0x1010532, 0x101053f, 0x1010570, 0x1010533, 0x101056f, 0x7f04007e, 0x7f040086, 0x7f040087, 0x7f040088, 0x7f04010e };
public static int FontFamilyFont_android_font = 0;
public static int FontFamilyFont_android_fontStyle = 1;
public static int FontFamilyFont_android_fontVariationSettings = 2;
public static int FontFamilyFont_android_fontWeight = 3;
public static int FontFamilyFont_android_ttcIndex = 4;
public static int FontFamilyFont_font = 5;
public static int FontFamilyFont_fontStyle = 6;
public static int FontFamilyFont_fontVariationSettings = 7;
public static int FontFamilyFont_fontWeight = 8;
public static int FontFamilyFont_ttcIndex = 9;
public static int[] GradientColor = { 0x101020b, 0x10101a2, 0x10101a3, 0x101019e, 0x1010512, 0x1010513, 0x10101a4, 0x101019d, 0x1010510, 0x1010511, 0x1010201, 0x10101a1 };
public static int GradientColor_android_centerColor = 0;
public static int GradientColor_android_centerX = 1;
public static int GradientColor_android_centerY = 2;
public static int GradientColor_android_endColor = 3;
public static int GradientColor_android_endX = 4;
public static int GradientColor_android_endY = 5;
public static int GradientColor_android_gradientRadius = 6;
public static int GradientColor_android_startColor = 7;
public static int GradientColor_android_startX = 8;
public static int GradientColor_android_startY = 9;
public static int GradientColor_android_tileMode = 10;
public static int GradientColor_android_type = 11;
public static int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static int GradientColorItem_android_color = 0;
public static int GradientColorItem_android_offset = 1;
}
}
| [
"[email protected]"
] | |
c328317cb03dce46056bd15396369cd7f70a25a3 | b6bcd40c31881ae4b6d922ab1228028640714a60 | /GalleryManagement/src/com/gm/model/verify.java | 9d9132449f543768f740ddc4f602f0e6f21e14f7 | [] | no_license | Nakib1996/CSE470-Project | 5b58aec681dee535917a62cbf1eecc0fb52f36d3 | f1428ff936864c1a5f0317c91b42359b27c2beca | refs/heads/main | 2023-02-08T02:48:42.130570 | 2021-01-02T16:23:52 | 2021-01-02T16:23:52 | 321,412,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48 | java | package com.gm.model;
public class verify {
}
| [
"[email protected]"
] | |
81f40fc341b33b2d7bd69eb579700f2e8c09d313 | 9b8d07e9682e61aab853dc6ebfc0c2e673033e9d | /proyecto Android Studio/app/src/test/java/com/example/virtualcoach/database/data/source/FakeImportableActivityDataSource.java | ea3dfa654f322ca8448d9f01619d28ccd97a5c03 | [] | no_license | Daniel-maralb/tfg_virtualcoach | 5f982cdfb8ff9b3b7c5d6310b43aa7347f44c56f | ec62ffff3792af2bd0ed025cabdbdcb160026b45 | refs/heads/main | 2023-05-11T15:14:32.508815 | 2021-06-03T15:58:42 | 2021-06-03T15:58:42 | 373,480,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package com.example.virtualcoach.database.data.source;
import com.example.virtualcoach.database.data.model.ActivityData;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
public class FakeImportableActivityDataSource implements ImportableActivityDataSource {
private static final int DEFAULT_LIMIT = 100;
private final List<ActivityData> data;
int limit;
int progress;
public FakeImportableActivityDataSource(@NotNull List<ActivityData> data) {
this(DEFAULT_LIMIT, data);
}
public FakeImportableActivityDataSource(int limit, @NotNull List<ActivityData> data) {
this.data = data;
this.limit = limit;
}
@NotNull
@Override
public List<ActivityData> readNextActivityData() {
if (progress >= data.size()) {
progress = 0;
return Collections.emptyList();
}
List<ActivityData> result = data.subList(progress, progress + limit);
progress += limit;
return result;
}
}
| [
"[email protected]"
] | |
6441c64dd5f1ab7fd0eb1b8f2daeba6bd4a2fc2b | df29c8d5c795bb72c4689228e8c9ce396728eda1 | /flight/flight-api/src/main/java/org/airsim/api/flight/command/CreateFlightCommand.java | a370a8b3d0504613bcc0a8383e40621f2adb5a38 | [
"MIT"
] | permissive | stoerti/airline-simulator | b85a368852298da9ff309e85d531066d7719bf92 | 65974086724b1973fd190616cdce4a9d3e0737e6 | refs/heads/master | 2022-12-07T01:16:27.628570 | 2022-03-10T21:53:56 | 2022-03-10T21:53:56 | 222,807,849 | 1 | 1 | MIT | 2022-11-14T16:26:11 | 2019-11-19T23:12:04 | Java | UTF-8 | Java | false | false | 692 | java | package org.airsim.api.flight.command;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.UUID;
import org.axonframework.modelling.command.TargetAggregateIdentifier;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Data
@Setter(AccessLevel.NONE)
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CreateFlightCommand {
@TargetAggregateIdentifier
private UUID id;
private UUID flightplanId;
private LocalDateTime takeoffTime;
private Duration duration;
private int seatsAvailable;
}
| [
"[email protected]"
] | |
db834bfd99dfc647265ebce9afe78315ff6be1da | c26dfc0549eb73cf81abaa32bf0d913764768de0 | /3B/app/src/androidTest/java/tago/a3b/ExampleInstrumentedTest.java | acae72f4cdea5ee154d83c5427393044ff23fdb8 | [] | no_license | tago-SE/mobapps | b8bff67db6cb790383f45d437d3df5c34fbe3d22 | 9d006afa99e54107a6c0bc838aadb0ade982748b | refs/heads/master | 2020-03-20T02:42:01.549839 | 2018-12-09T21:28:46 | 2018-12-09T21:28:46 | 137,121,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package tago.a3b;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
//@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
// @Test
public void useAppContext() {
}
}
| [
"[email protected]"
] | |
0e31b34762dd725bb555621d0a50f81b6505ac07 | 26954b7fb43e96db0fdefeff9d8b9538ae7cd37a | /src/main/java/spring/guru/springWeb/model/Book.java | 69fc2aa3125558fb011b1fd02a38f1a49090a41e | [] | no_license | mercanil/spring5 | ec51a514b91290ad9c15a99b6bcd7a3b66d0a46d | 0d69ab1c8673b3a9227b6f95f6a5f67207fe0192 | refs/heads/master | 2021-05-15T06:54:07.938322 | 2019-03-25T00:01:12 | 2019-03-25T00:01:12 | 112,095,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,474 | java | package spring.guru.springWeb.model;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@Entity
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title;
private String isbn;
private String name;
@OneToOne
private Publisher publisher;
@ManyToMany
@JoinTable(name = "author_book" , joinColumns = @JoinColumn(name = "book_id") ,
inverseJoinColumns = @JoinColumn(name = "author_id"))
private Set<Author> authors = new HashSet<Author>();
public Book() {
}
public Book(String title, String isbn, Publisher publisher) {
this.title = title;
this.isbn = isbn;
this.publisher = publisher;
}
public Book(String title, String isbn, Publisher publisher, Set<Author> authors) {
this.title = title;
this.isbn = isbn;
this.publisher = publisher;
this.authors = authors;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public Publisher getPublisher() {
return publisher;
}
public void setPublisher(Publisher publisher) {
this.publisher = publisher;
}
public Set<Author> getAuthors() {
return authors;
}
public void setAuthors(Set<Author> authors) {
this.authors = authors;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Book book = (Book) o;
return Objects.equals(id, book.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public String toString() {
return "Book{" +
"id=" + id +
", title='" + title + '\'' +
", isbn='" + isbn + '\'' +
", publisher='" + publisher + '\'' +
", authors=" + authors +
'}';
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
bb1ee3444f28149b07e7c0df0dcd60e34138b6c6 | bc19dcb57d41c1d67dbd2ac57ff37b0a895b6ee4 | /Texto/src/com/ucsal/atividade/EntradaTextoVector.java | 0510b1d813138320af397cc373c04cd16a033392 | [] | no_license | JessPergentino/atividadesPooAvancado | df0dbbb617bddde6ad4cce3f4a485e527343cbf5 | 84348d70793e1cd1073263c67f80dd550b90d19f | refs/heads/master | 2021-04-06T02:36:08.787394 | 2018-05-12T15:08:24 | 2018-05-12T15:08:24 | 124,539,156 | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 1,342 | java | package com.ucsal.atividade;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Vector;
public class EntradaTextoVector {
public static void main(String[] args) throws IOException {
InputStream is = new FileInputStream("resouser/results.csv");
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String s = br.readLine(); // primeira linha
List<String> lista = new Vector<>();
int tamanho = 23778;
long inicio = System.currentTimeMillis();
for (int i = 0; i < tamanho; i++) {
lista.add(0, s);
s = br.readLine();
}
long fim = System.currentTimeMillis();
System.out.println("Vector adiciona no comešo: " + (fim - inicio) / 1000.0);
inicio = System.currentTimeMillis();
for (int i = 0; i < tamanho; i++) {
lista.get(i);
}
fim = System.currentTimeMillis();
System.out.println("Vector percorrendo: " + (fim - inicio) / 1000.0);
inicio = System.currentTimeMillis();
for (int i = 0; i < tamanho; i++) {
lista.remove(0);
}
fim = System.currentTimeMillis();
System.out.println("Vector remove do comešo: " + (fim - inicio) / 1000.0);
br.close();
}
}
| [
"[email protected]"
] | |
9b60131e449c22c4b1bcc652844b0222ace57331 | c11fd6cf3f0c45fa2c07490cb333f9094f181555 | /CabBuddies-Library/src/com/cabbuddieslib/managers/auth/JWTManager.java | 32af01b8e3ec98a61d105d9d7fd32ced8f7ae1ad | [] | no_license | nihalkondasjsu/CabBuddies-Library | 6fe7589ef926d79f9559dbf215ec8cf997e2a511 | 9f2481a27eebb718ec7dbaa1f7f73714e85e5f26 | refs/heads/master | 2022-12-23T01:38:11.179421 | 2020-03-20T22:09:29 | 2020-03-20T22:09:29 | 247,213,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,461 | java | package com.cabbuddieslib.managers.auth;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.cabbuddieslib.dao.auth.JWTJPA;
import com.cabbuddieslib.data.auth.JWT;
import com.cabbuddieslib.discover.MicroServicesDiscovery;
import com.cabbuddieslib.utils.AESCrypto;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
@Component
public class JWTManager {
@Autowired(required=true)
JWTJPA jwtJpa;
public static boolean isJWTAuthority=false;
public JWT createJWT(String ip,Long userId,String name) {
JWT jwt=new JWT();
jwt.setIp(ip);
jwt.setUserId(userId);
jwt.setName(name);
jwt.setValidTill(System.currentTimeMillis()+JWT.STANDARD_VALIDITY);
jwt.setPwd(UUID.randomUUID().toString());
jwtJpa.deleteAllJWTByUserId(userId);
return jwtJpa.save(jwt);
}
public JWT renewJWT(JWT jwt,String ip) {
if(jwt.getIp().equals(ip)==false)
return null;
JWT jwtRes = null;
jwtRes = jwtJpa.findJWTByIdAndPwd(jwt.getId(), jwt.getPwd());
if(jwtRes==null)
return null;
if(jwtRes.isUntampered(jwt) && jwtRes.isRenewable())
return createJWT(ip,jwtRes.getUserId(),jwtRes.getName());
return null;
}
public void flushNonRenewableJWT() {
jwtJpa.deleteAllJWTExpiringBy(System.currentTimeMillis()-JWT.STANDARD_RENEWAL_VALIDITY);
}
public void flushInValidJWT() {
jwtJpa.deleteAllJWTExpiringBy(System.currentTimeMillis());
}
public void saveJWT(JWT jwt) {
jwtJpa.deleteAllJWTByUserId(jwt.getUserId());
jwtJpa.save(jwt);
}
public JWT validateJWT(JWT jwtInp) {
JWT jwtRes = null;
jwtRes = jwtJpa.findJWTByIdAndPwd(jwtInp.getId(), jwtInp.getPwd());
if(jwtRes==null) {
if(isJWTAuthority)
return null;
jwtRes = fetchJWT(jwtInp);
if(jwtRes == null)
return null;
saveJWT(jwtRes);
}
if(jwtRes.isValid(jwtInp))
return jwtRes;
return null;
}
private JWT fetchJWT(JWT jwtInp) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.header("authorization", "Bearer "+transferVersion(jwtInp))
.url(MicroServicesDiscovery.USER_MANAGEMENT_SERVICE+"/validateJWT")
.build();
try {
String response = client.newCall(request).execute().body().string();
System.out.println(response);
return new Gson().fromJson(response, JWT.class);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public String clientVersion(JWT jwt) {
jwt.setUserId(-1l);
return transferVersion(jwt);
}
public String transferVersion(JWT jwt) {
ObjectMapper mapper = new ObjectMapper();
String jsonString="";
try {
jsonString = mapper.writeValueAsString(jwt);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(jsonString);
return AESCrypto.encrypt(jsonString, true);
}
public JWT parseJWT(String text) {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readValue(AESCrypto.decrypt(text, true), JWT.class);
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
] | |
3ef3837f61da7ca6cb68cbd13ab26faafe7df6cf | 9105f94c5dad90c0b35198685a03608631e6b4e6 | /src/main/java/org/elu/spring/boot/cloud/heroku/CloudHerokuApplication.java | b7be1c7153795df12793eeb39a491a6057aaf3db | [] | no_license | luhtonen/spring-boot-cloud-heroku | 5220a50ccf53426db511a23d183fbfcfa51ca923 | 1e53a010657ebc4da5857c0bbabbb63669342bba | refs/heads/master | 2021-01-10T07:37:05.423257 | 2016-04-08T12:56:08 | 2016-04-08T12:56:08 | 55,778,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package org.elu.spring.boot.cloud.heroku;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CloudHerokuApplication {
public static void main(String[] args) {
SpringApplication.run(CloudHerokuApplication.class, args);
}
}
| [
"[email protected]"
] | |
b7272033056d3e3853214d2255581a71278f7ea9 | b7bdbbe71e0cf693afb9d44f513869feb302d03b | /Lab7FX/sample/compulsory/Token.java | b44577319f08efc557089ed603db2fe8e119780d | [] | no_license | stefanrzv2000/PA2020 | d06e070e2b33d4cd610edf059ce8f8d1723eabbe | 78bddd71ab57ca73a7c0f90c4e13b3f92f8035d2 | refs/heads/master | 2021-03-18T15:39:15.549190 | 2020-05-19T11:37:06 | 2020-05-19T11:37:06 | 247,080,674 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package sample.compulsory;
import sample.Figure;
public class Token {
int value;
Player owner;
Figure figure;
public Token(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public Player getOwner() {
return owner;
}
public void setOwner(Player owner) {
this.owner = owner;
}
@Override
public String toString() {
return String.valueOf(value);
}
public Figure getFigure() {
return figure;
}
public void setFigure(Figure figure) {
this.figure = figure;
}
}
| [
"[email protected]"
] | |
5aa9dc643382a8f8140932d4eb1ebcd43ef4a04b | cad75a693350ce02691000822cc6bc9ee378ef84 | /atf-eplug/src/eu/atac/atf/test/metadata/SParameter.java | e04d3a1736edeaacce839b0f339a593af2850913 | [
"BSD-3-Clause"
] | permissive | ryselis/atf | d9a360bf3850f2af3dd1000a44fef1703185de8a | 861d700df973f6e01169a7ab53f9a3a19d0bee54 | refs/heads/master | 2020-12-28T21:17:44.768018 | 2015-02-25T20:51:16 | 2015-02-25T20:51:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package eu.atac.atf.test.metadata;
public class SParameter extends SBase {
private SDeclaration declaration;
private SVariable variable;
private SValue value;
public SParameter(SDeclaration declaration, SVariable variable,SValue value) {
super();
this.declaration = declaration;
this.variable = variable;
this.value = value;
}
@Override
protected void printElement(StringBuilder s) {
s.append(declaration.getType()).append(' ').append(variable.getName()).append(" = ").append(value.getValue());
}
public String getName(){
return variable.getName();
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.