blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b06c756c988e5bd43296579738f84e891a33f9c6 | 67db8c4a98b0379feebd2a06a607a85c41aa994d | /HomeCloud/src/MainMenu/MainMenuController.java | e10f2fc84fff346db4d5778e3eb4c32bad0aa3f2 | [] | no_license | novakmarkatti/Szakdolgozat | e2c367ccf77024a77e0b8d5e814f757d0ea145d5 | 20ab38d87d8778e7589837d5f9d1391e9a03cb9f | refs/heads/main | 2023-06-14T21:35:03.119579 | 2021-07-11T10:58:43 | 2021-07-11T10:58:43 | 384,922,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,430 | java | package MainMenu;
import FileTransfer.FileTransferUI;
import NetworkDiscovery.HomeCloudListener;
import NetworkDiscovery.HomeCloudNetworking;
import WatchDirectory.WatchDirectoryUI;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class MainMenuController {
@FXML private Label lblAppMode;
@FXML private Button exitBtn;
@FXML private Button startStopServer;
@FXML private Button startStopDiscovery;
@FXML private Text statusMessage = new Text();
@FXML private Button startWatchService;
@FXML private Button startFileTransfer;
private HomeCloudNetworking homeCloud = null;
private String addressDevice1 = null;
private String addressDevice2 = null;
/* A UI-t allitgatjuk vele a szerver es kliens oldalrol abban az esetben :
* - Ha a szerver elindult/megallt, kliens csatlakozott vagy letrejott a kapcsolat(eltarolta az IP cimet)
* - Ha a kliens elindult/megallt, felfedezte a szervert (eltarolta az IP cimet) */
private HomeCloudListener listener = new HomeCloudListener() {
// udp szerver
@Override public void serverStarted() {
UILogger("Server started");
}
@Override public void serverStopped() {
UILogger("Server stopped");
Platform.runLater(() -> {
startStopServer.setText("Start server");
if( "Server Mode".equals( lblAppMode.getText() ) ) {
startStopServer.setDisable(false);
}
});
}
@Override public void clientConnected() {
UILogger("Client connected");
}
@Override public void connectionEstablished( String address) {
UILogger("Connection established");
addressDevice2 = address;
startWatchService.setDisable(false);
startFileTransfer.setDisable(false);
}
// Udp kliens
@Override public void discoveryStarted() {
UILogger("Discovery started");
}
@Override public void discoveryStopped() {
UILogger("Discovery stopped");
Platform.runLater(() -> {
startStopDiscovery.setText("Start discovery");
if( "Client Mode".equals( lblAppMode.getText() ) ) {
startStopDiscovery.setDisable(false);
}
});
}
@Override public void discoveredServer(String address) {
UILogger("Server discovered");
addressDevice1 = address;
if( homeCloud.isDiscoveryRunning() ){
homeCloud.stopDiscovery();
}
startWatchService.setDisable(false);
startFileTransfer.setDisable(false);
}
};
/* Az alkalmazas szerver/kliens modban valo hasznalatat teszi lehetove.
* Erre azert van szukseg, mivel 2 eszkoz hasznalata eseten egyik szerver, masik
* kliens szerepet fog betolteni. Lenyegeben figyeljuk hogy milyen modban vagyunk, es ez
* alapjan aktivaljuk/deaktivaljuk a start-stop gombokat */
@FXML private void changeAppMode(){
if( "Server Mode".equals( lblAppMode.getText() ) ){
lblAppMode.setText("Client Mode");
startStopServer.setDisable(true);
startStopDiscovery.setDisable(false);
} else if( "Client Mode".equals( lblAppMode.getText() ) ){
lblAppMode.setText("Server Mode");
startStopServer.setDisable(false);
startStopDiscovery.setDisable(true);
}
}
/* A NetworkDiscovery UDP szerver elinditasaert es megallitasaert felel. Lenyegeben azt figyeljuk
* milyen szoveg szerepel a gombon. Ha "start" akkor eloszor megnezzuk hogy ha meg nem hoztunk letre
* szervert , akkor letrehozzuk, es elinditjuk. "Stop" eseten megallitjuk a szervert, es a gombot hogy
* ne lehessen sokszor nyomogatni ezert deaktivaljuk. Miutan a szerver veglegesen lealt, akkor
* lesz ujra elerheto es elindithato a gomb.*/
@FXML private void handleStartStopServer(){
try {
if( "Start server".equals( startStopServer.getText() ) ){
if (homeCloud == null){
homeCloud = new HomeCloudNetworking( "HomeCloud", "224.0.0.1", 4446, listener);
}
homeCloud.startServer();
startStopServer.setText("Stop server");
} else if( "Stop server".equals( startStopServer.getText() ) ){
homeCloud.stopServer();
startStopServer.setDisable(true);
}
} catch(Exception e){
System.err.println("ERROR: MainMenuController> handleStartStopServer");
e.printStackTrace();
}
}
/* A NetworkDiscovery UDP kliens elinditasaert es megallitasaert felel. Szerverhez hasonloan azt figyeljuk
* milyen szoveg szerepel a gombon. Ha "start" akkor eloszor megnezzuk hogy ha meg nem hoztunk letre
* kliensr , akkor letrehozzuk, es elinditjuk. "Stop" eseten megallitjuk
* a klienst, es a gombot hogy ne lehessen sokszor nyomogatni ezert deaktivaljuk.
* Miutan a kliens veglegesen lealt, akkor lesz ujra elerheto es elindithato a gomb.*/
@FXML private void handleStartStopDiscovery(){
try {
if( "Start discovery".equals( startStopDiscovery.getText() ) ){
if (homeCloud == null){
homeCloud = new HomeCloudNetworking( "HomeCloud","224.0.0.1", 4446, listener);
}
homeCloud.startDiscovery();
startStopDiscovery.setText("Stop discovery");
} else if( "Stop discovery".equals( startStopDiscovery.getText() ) ){
homeCloud.stopDiscovery();
startStopDiscovery.setDisable(true);
}
} catch(Exception e){
System.err.println("ERROR: MainMenuController> handleStartStopDiscovery");
e.printStackTrace();
}
}
/* A UILogger valositja meg , hogy a Statusban mindig latszodjon mi tortenik a programban */
private void UILogger(String msg){
Platform.runLater(() -> {
synchronized(statusMessage){
statusMessage.setText(msg);
System.out.println("UILogger> " + msg);
}
});
}
// Megjelenitjuk vele a Directory Watcher felugro ablakot
@FXML private void handleWatchDirectory(){
try {
WatchDirectoryUI watchDirectory = new WatchDirectoryUI();
watchDirectory.display( checkAddresses() );
} catch (Exception e) { e.printStackTrace(); }
}
// Megjelenitjuk vele a FileTransfer felugro ablakot
@FXML private void handleFileTransfer(){
try {
FileTransferUI fileTransferUI = new FileTransferUI();
fileTransferUI.display( checkAddresses() );
} catch (Exception e) { e.printStackTrace(); }
}
/* Itt ellenorizzuk le hogy a NetworkDiscovery soran melyik IP cim allitodott be.
* Mivel 2 eszkozunk van, igy 1 eszkozon csak a masik eszkoz IP cimet taroljuk el,
* igy egyik cim null marad. A tenyleges ip cimmel terunk vissza*/
private String checkAddresses(){
if( addressDevice1 == null ) return addressDevice2;
else if( addressDevice2 == null ) return addressDevice1;
else return addressDevice1;
}
// Megjelenitjuk vele a Help felugro ablakot
@FXML private void handleHelpBtn(){
try {
Help help = new Help();
help.display();
} catch (Exception e) { e.printStackTrace(); }
}
/* Ezzel zarjuk be az alkalmazast. Bezaras elott megnezzuk, hogy a NetworkDiscovery
* szerver es kliens letezik es fut-e, amennyiben igen, megallitjuk oket. */
@FXML private void handleExitBtn(){
try {
if(homeCloud != null) {
if (homeCloud.isServerRunning()) {
homeCloud.stopServer();
}
if (homeCloud.isDiscoveryRunning()) {
homeCloud.stopDiscovery();
}
}
} catch(Exception e) {e.printStackTrace(); }
Stage stage = (Stage) exitBtn.getScene().getWindow();
stage.close();
}
}
| [
"novakmarkatti@gmail.com"
] | novakmarkatti@gmail.com |
b0bbf56cf37062819be18b8713f60a87d5339bf0 | 190741019807740b60ec7a368acbc649ace80f8a | /src/main/java/com/animedetour/android/database/event/EventRepository.java | 7be5b6fe9a9eb6d9a8a19866e00b9be13d98d83b | [
"MIT",
"CC-BY-4.0",
"Apache-2.0"
] | permissive | Morrodin/anime-detour-android | 892af0a1addde05a6441ec1b06a0083d244ffb74 | 055a78c5e8cbd5427d9cfab9c193c81f7a85ff95 | refs/heads/master | 2021-01-23T01:41:27.328489 | 2015-12-26T22:13:58 | 2015-12-26T22:13:58 | 52,922,418 | 0 | 0 | null | 2016-03-02T01:06:07 | 2016-03-02T01:06:07 | null | UTF-8 | Java | false | false | 7,036 | java | /*
* This file is part of the Anime Detour Android application
*
* Copyright (c) 2014-2015 Anime Twin Cities, Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package com.animedetour.android.database.event;
import com.animedetour.api.sched.model.Event;
import com.inkapplications.groundcontrol.CriteriaWorkerFactory;
import com.inkapplications.groundcontrol.SubscriptionFactory;
import com.inkapplications.groundcontrol.Worker;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.stmt.PreparedQuery;
import com.j256.ormlite.stmt.QueryBuilder;
import org.joda.time.DateTime;
import rx.Observer;
import rx.Subscription;
import java.sql.SQLException;
import java.util.List;
/**
* Provides an API for querying Event entities.
*
* This repository creates new requests asynchronously where needed by
* delegating to several different worker services.
*
* @author Maxwell Vandervelde (Max@MaxVandervelde.com)
*/
public class EventRepository
{
/** Manage in-flight requests to async repos. */
final private SubscriptionFactory<Event> subscriptionFactory;
/** A local DAO for storing events. */
final private Dao<Event, String> localAccess;
/** Worker for looking up a list of all events. */
final private Worker<List<Event>> allEventsWorker;
/** Worker for looking up a list of events by their start time. */
final private CriteriaWorkerFactory<List<Event>, DateTime> allByDayFactory;
/** Worker for looking up a single event with a tag. */
final private CriteriaWorkerFactory<Event, TagCriteria> upcomingByTagFactory;
/** Worker for looking up a single event of a type. */
final private CriteriaWorkerFactory<Event, TypeCriteria> upcomingByTypeFactory;
final private CriteriaWorkerFactory<List<Event>, String> allMatchingFactory;
/**
* @param subscriptionFactory Manage in-flight requests to async repos.
* @param localAccess A local DAO for storing events.
* @param allEventsWorker Worker for looking up a list of all events.
* @param allByDayFactory Worker for looking up a list of events by their start time.
* @param upcomingByTagFactory Worker for looking up a single event with a tag.
* @param upcomingByTypeFactory Worker for looking up a single event of a type.
*/
public EventRepository(
SubscriptionFactory<Event> subscriptionFactory,
Dao<Event, String> localAccess,
AllEventsWorker allEventsWorker,
CriteriaWorkerFactory<List<Event>, DateTime> allByDayFactory,
CriteriaWorkerFactory<Event, TagCriteria> upcomingByTagFactory,
CriteriaWorkerFactory<Event, TypeCriteria> upcomingByTypeFactory,
CriteriaWorkerFactory<List<Event>, String> allMatchingFactory
) {
this.localAccess = localAccess;
this.allEventsWorker = allEventsWorker;
this.subscriptionFactory = subscriptionFactory;
this.allByDayFactory = allByDayFactory;
this.upcomingByTagFactory = upcomingByTagFactory;
this.upcomingByTypeFactory = upcomingByTypeFactory;
this.allMatchingFactory = allMatchingFactory;
}
/**
* Find All Events.
*
* @return an observable that will update with events data
*/
public Subscription findAll(Observer<List<Event>> observer)
{
return this.subscriptionFactory.createCollectionSubscription(
this.allEventsWorker,
observer,
"findAll"
);
}
/**
* Find All events for a specified day.
*
* This is run by the START time of the event
*
* @param day The day to lookup events for
* @return an observable that will update with events data
*/
public Subscription findAllOnDay(DateTime day, Observer<List<Event>> observer)
{
String key = "findAllOnDay:" + day.getDayOfYear();
return this.subscriptionFactory.createCollectionSubscription(
this.allByDayFactory.createWorker(day),
observer,
key
);
}
/**
* Find all of the "featured" events to suggest to the user.
*/
public Subscription findFeatured(Observer<Event> observer, long ordinal)
{
return this.findUpcomingByType(
"Anime Detour Panel",
ordinal,
observer
);
}
/**
* Finds a single event of a given type.
*/
public Subscription findUpcomingByType(String type, long ordinal, Observer<Event> observer)
{
String key = "findUpcomingByType:" + type + ":" + ordinal;
return this.subscriptionFactory.createSubscription(
this.upcomingByTypeFactory.createWorker(new TypeCriteria(type, ordinal)),
observer,
key
);
}
/**
* Finds a single event containing a specific tag.
*
* @param tag The tag to search for events containing.
*/
public Subscription findUpcomingByTag(String tag, long ordinal, Observer<Event> observer)
{
String key = "findUpcomingByTag:" + tag + ":" + ordinal;
return this.subscriptionFactory.createSubscription(
this.upcomingByTagFactory.createWorker(new TagCriteria(tag, ordinal)),
observer,
key
);
}
/**
* Finds events where the title matches a specified string.
*
* @param search The string to search in the title of events for.
*/
public Subscription findMatching(String search, Observer<List<Event>> observer)
{
String key = "findMatching:" + search;
return this.subscriptionFactory.createCollectionSubscription(
this.allMatchingFactory.createWorker(search),
observer,
key
);
}
/**
* Get All local events.
*
* @return A list of every event in the local data store
*/
public List<Event> getAll() throws SQLException
{
return this.allEventsWorker.lookupLocal();
}
/**
* Get All Events on a specific day.
*
* @return Events that occur on that day (by start time)
*/
public List<Event> getAllOnDay(DateTime day) throws SQLException
{
return this.allByDayFactory.createWorker(day).lookupLocal();
}
/**
* Get a specific event by its ID.
*/
public Event get(String id) throws SQLException
{
return this.localAccess.queryForId(id);
}
/**
* Fetches the most recently updated event according to fetch time.
*/
public Event getMostRecentUpdated() throws SQLException
{
QueryBuilder<Event, String> builder = this.localAccess.queryBuilder();
builder.orderBy("fetched", false);
PreparedQuery<Event> query = builder.prepare();
Event result = this.localAccess.queryForFirst(query);
return result;
}
public void persist(Event event) throws SQLException
{
this.localAccess.createOrUpdate(event);
}
}
| [
"Max@MaxVandervelde.com"
] | Max@MaxVandervelde.com |
6db28373df9c4f729b5e49142f8dcba46c7d7e57 | 49bcab04845d00982acd7feea34d3bb33bd4df8a | /at.usga/src-gen/at/usga/OsterhasenSchiessen.java | a1100b4eb0b061c2413f88929bea71605477eeae | [] | no_license | gkerbi/usga | 6011c3e34a07f44c8de1fd86c290f492969e6d73 | 6fc06845b272a15b705f75dec053e4e5b2d6f606 | refs/heads/master | 2021-01-19T07:30:13.535837 | 2017-04-07T13:34:49 | 2017-04-07T13:34:49 | 87,547,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,864 | java | /**
*/
package at.usga;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Osterhasen Schiessen</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link at.usga.OsterhasenSchiessen#getPreisjung <em>Preisjung</em>}</li>
* <li>{@link at.usga.OsterhasenSchiessen#getPreisalt <em>Preisalt</em>}</li>
* <li>{@link at.usga.OsterhasenSchiessen#getPreisnachkauf <em>Preisnachkauf</em>}</li>
* <li>{@link at.usga.OsterhasenSchiessen#getAltersgrenze <em>Altersgrenze</em>}</li>
* <li>{@link at.usga.OsterhasenSchiessen#getSchuetzen <em>Schuetzen</em>}</li>
* </ul>
* </p>
*
* @see at.usga.OsterhasePackage#getOsterhasenSchiessen()
* @model
* @generated
*/
public interface OsterhasenSchiessen extends EObject {
/**
* Returns the value of the '<em><b>Preisjung</b></em>' attribute list.
* The list contents are of type {@link java.lang.Double}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Preisjung</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Preisjung</em>' attribute list.
* @see at.usga.OsterhasePackage#getOsterhasenSchiessen_Preisjung()
* @model upper="10"
* @generated
*/
EList<Double> getPreisjung();
/**
* Returns the value of the '<em><b>Preisalt</b></em>' attribute list.
* The list contents are of type {@link java.lang.Double}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Preisalt</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Preisalt</em>' attribute list.
* @see at.usga.OsterhasePackage#getOsterhasenSchiessen_Preisalt()
* @model upper="10"
* @generated
*/
EList<Double> getPreisalt();
/**
* Returns the value of the '<em><b>Preisnachkauf</b></em>' attribute list.
* The list contents are of type {@link java.lang.Double}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Preisnachkauf</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Preisnachkauf</em>' attribute list.
* @see at.usga.OsterhasePackage#getOsterhasenSchiessen_Preisnachkauf()
* @model upper="10"
* @generated
*/
EList<Double> getPreisnachkauf();
/**
* Returns the value of the '<em><b>Altersgrenze</b></em>' attribute list.
* The list contents are of type {@link java.lang.Integer}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Altersgrenze</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Altersgrenze</em>' attribute list.
* @see at.usga.OsterhasePackage#getOsterhasenSchiessen_Altersgrenze()
* @model lower="1980" upper="2010"
* @generated
*/
EList<Integer> getAltersgrenze();
/**
* Returns the value of the '<em><b>Schuetzen</b></em>' containment reference list.
* The list contents are of type {@link at.usga.Schuetze}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Schuetzen</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Schuetzen</em>' containment reference list.
* @see at.usga.OsterhasePackage#getOsterhasenSchiessen_Schuetzen()
* @model containment="true"
* @generated
*/
EList<Schuetze> getSchuetzen();
} // OsterhasenSchiessen
| [
"gkerbi@gmail.com"
] | gkerbi@gmail.com |
76498a880e42c24b23a616277716cdd45c2c194c | 3557df96169ca4ba803111efe1898dbfa60d4de8 | /src/main/java/com/ahaxt/hanlp/model/perceptron/PerceptronTrainer.java | 87546f243835b518521ff6833f9fc96ee27ec1b4 | [] | no_license | hzming8713/ykthanlp | 93954843974bf6185f5e7203330c8c4cc8be1fe1 | 5d75dee33717edda7e907cc6ed70a9b434a9a5fc | refs/heads/master | 2022-07-03T04:07:49.330629 | 2019-05-22T08:45:55 | 2019-05-22T08:45:55 | 183,993,705 | 0 | 1 | null | 2022-06-17T02:09:27 | 2019-04-29T03:30:04 | Java | UTF-8 | Java | false | false | 12,882 | java | /*
* <author>Hankcs</author>
* <email>me@hankcs.com</email>
* <create-date>2017-10-26 下午5:51</create-date>
*
* <copyright file="PerceptronTrainer.java" company="码农场">
* Copyright (c) 2017, 码农场. All Right Reserved, http://www.hankcs.com/
* This source is subject to Hankcs. Please contact Hankcs to get more information.
* </copyright>
*/
package com.ahaxt.hanlp.model.perceptron;
import com.ahaxt.hanlp.HanLP;
import com.ahaxt.hanlp.classification.utilities.io.ConsoleLogger;
import com.ahaxt.hanlp.collection.trie.DoubleArrayTrie;
import com.ahaxt.hanlp.corpus.document.sentence.Sentence;
import com.ahaxt.hanlp.model.perceptron.feature.ImmutableFeatureMap;
import com.ahaxt.hanlp.model.perceptron.feature.MutableFeatureMap;
import com.ahaxt.hanlp.model.perceptron.instance.InstanceHandler;
import com.ahaxt.hanlp.model.perceptron.tagset.TagSet;
import com.ahaxt.hanlp.model.perceptron.utility.IOUtility;
import com.ahaxt.hanlp.model.perceptron.utility.Utility;
import com.ahaxt.hanlp.model.perceptron.instance.Instance;
import com.ahaxt.hanlp.model.perceptron.common.FrequencyMap;
import com.ahaxt.hanlp.model.perceptron.model.AveragedPerceptron;
import com.ahaxt.hanlp.model.perceptron.model.LinearModel;
import com.ahaxt.hanlp.model.perceptron.model.StructuredPerceptron;
import java.io.*;
import java.util.LinkedList;
import java.util.List;
import static java.lang.System.err;
import static java.lang.System.out;
/**
* 感知机训练基类
*
* @author hankcs
*/
public abstract class PerceptronTrainer extends InstanceConsumer
{
/**
* 训练结果
*/
public static class Result
{
/**
* 模型
*/
LinearModel model;
/**
* 精确率(Precision), 召回率(Recall)和F1-Measure<br>
* 中文参考:https://blog.argcv.com/articles/1036.c
*/
double prf[];
public Result(LinearModel model, double[] prf)
{
this.model = model;
this.prf = prf;
}
/**
* 获取准确率
*
* @return
*/
public double getAccuracy()
{
if (prf.length == 3)
{
return prf[2];
}
return prf[0];
}
/**
* 获取模型
*
* @return
*/
public LinearModel getModel()
{
return model;
}
}
/**
* 创建标注集
*
* @return
*/
protected abstract TagSet createTagSet();
/**
* 训练
*
* @param trainingFile 训练集
* @param developFile 开发集
* @param modelFile 模型保存路径
* @param compressRatio 压缩比
* @param maxIteration 最大迭代次数
* @param threadNum 线程数
* @return 一个包含模型和精度的结构
* @throws IOException
*/
public Result train(String trainingFile, String developFile,
String modelFile, final double compressRatio,
final int maxIteration, final int threadNum) throws IOException
{
if (developFile == null)
{
developFile = trainingFile;
}
// 加载训练语料
TagSet tagSet = createTagSet();
MutableFeatureMap mutableFeatureMap = new MutableFeatureMap(tagSet);
ConsoleLogger logger = new ConsoleLogger();
logger.start("开始加载训练集...\n");
Instance[] instances = loadTrainInstances(trainingFile, mutableFeatureMap);
tagSet.lock();
logger.finish("\n加载完毕,实例一共%d句,特征总数%d\n", instances.length, mutableFeatureMap.size() * tagSet.size());
// 开始训练
ImmutableFeatureMap immutableFeatureMap = new ImmutableFeatureMap(mutableFeatureMap.featureIdMap, tagSet);
mutableFeatureMap = null;
double[] accuracy = null;
if (threadNum == 1)
{
AveragedPerceptron model;
model = new AveragedPerceptron(immutableFeatureMap);
final double[] total = new double[model.parameter.length];
final int[] timestamp = new int[model.parameter.length];
int current = 0;
for (int iter = 1; iter <= maxIteration; iter++)
{
Utility.shuffleArray(instances);
for (Instance instance : instances)
{
++current;
int[] guessLabel = new int[instance.length()];
model.viterbiDecode(instance, guessLabel);
for (int i = 0; i < instance.length(); i++)
{
int[] featureVector = instance.getFeatureAt(i);
int[] goldFeature = new int[featureVector.length];
int[] predFeature = new int[featureVector.length];
for (int j = 0; j < featureVector.length - 1; j++)
{
goldFeature[j] = featureVector[j] * tagSet.size() + instance.tagArray[i];
predFeature[j] = featureVector[j] * tagSet.size() + guessLabel[i];
}
goldFeature[featureVector.length - 1] = (i == 0 ? tagSet.bosId() : instance.tagArray[i - 1]) * tagSet.size() + instance.tagArray[i];
predFeature[featureVector.length - 1] = (i == 0 ? tagSet.bosId() : guessLabel[i - 1]) * tagSet.size() + guessLabel[i];
model.update(goldFeature, predFeature, total, timestamp, current);
}
}
// 在开发集上校验
accuracy = trainingFile.equals(developFile) ? IOUtility.evaluate(instances, model) : evaluate(developFile, model);
out.printf("Iter#%d - ", iter);
printAccuracy(accuracy);
}
// 平均
model.average(total, timestamp, current);
accuracy = trainingFile.equals(developFile) ? IOUtility.evaluate(instances, model) : evaluate(developFile, model);
out.print("AP - ");
printAccuracy(accuracy);
logger.start("以压缩比 %.2f 保存模型到 %s ... ", compressRatio, modelFile);
model.save(modelFile, immutableFeatureMap.featureIdMap.entrySet(), compressRatio);
logger.finish(" 保存完毕\n");
if (compressRatio == 0) return new Result(model, accuracy);
}
else
{
// 多线程用Structure Perceptron
StructuredPerceptron[] models = new StructuredPerceptron[threadNum];
for (int i = 0; i < models.length; i++)
{
models[i] = new StructuredPerceptron(immutableFeatureMap);
}
TrainingWorker[] workers = new TrainingWorker[threadNum];
int job = instances.length / threadNum;
for (int iter = 1; iter <= maxIteration; iter++)
{
Utility.shuffleArray(instances);
try
{
for (int i = 0; i < workers.length; i++)
{
workers[i] = new TrainingWorker(instances, i * job,
i == workers.length - 1 ? instances.length : (i + 1) * job,
models[i]);
workers[i].start();
}
for (TrainingWorker worker : workers)
{
worker.join();
}
for (int j = 0; j < models[0].parameter.length; j++)
{
for (int i = 1; i < models.length; i++)
{
models[0].parameter[j] += models[i].parameter[j];
}
models[0].parameter[j] /= threadNum;
}
accuracy = trainingFile.equals(developFile) ? IOUtility.evaluate(instances, models[0]) : evaluate(developFile, models[0]);
out.printf("Iter#%d - ", iter);
printAccuracy(accuracy);
}
catch (InterruptedException e)
{
err.printf("线程同步异常,训练失败\n");
e.printStackTrace();
return null;
}
}
logger.start("以压缩比 %.2f 保存模型到 %s ... ", compressRatio, modelFile);
models[0].save(modelFile, immutableFeatureMap.featureIdMap.entrySet(), compressRatio, HanLP.Config.DEBUG);
logger.finish(" 保存完毕\n");
if (compressRatio == 0) return new Result(models[0], accuracy);
}
LinearModel model = new LinearModel(modelFile);
if (compressRatio > 0)
{
accuracy = evaluate(developFile, model);
out.printf("\n%.2f compressed model - ", compressRatio);
printAccuracy(accuracy);
}
return new Result(model, accuracy);
}
private void printAccuracy(double[] accuracy)
{
if (accuracy.length == 3)
{
out.printf("P:%.2f R:%.2f F:%.2f\n", accuracy[0], accuracy[1], accuracy[2]);
}
else
{
out.printf("P:%.2f\n", accuracy[0]);
}
}
private static class TrainingWorker extends Thread
{
private Instance[] instances;
private int start;
private int end;
private StructuredPerceptron model;
public TrainingWorker(Instance[] instances, int start, int end, StructuredPerceptron model)
{
this.instances = instances;
this.start = start;
this.end = end;
this.model = model;
}
@Override
public void run()
{
for (int s = start; s < end; ++s)
{
Instance instance = instances[s];
model.update(instance);
}
// out.printf("Finished [%d,%d)\n", start, end);
}
}
protected Instance[] loadTrainInstances(String trainingFile, final MutableFeatureMap mutableFeatureMap) throws IOException
{
final List<Instance> instanceList = new LinkedList<Instance>();
IOUtility.loadInstance(trainingFile, new InstanceHandler()
{
@Override
public boolean process(Sentence sentence)
{
Utility.normalize(sentence);
instanceList.add(PerceptronTrainer.this.createInstance(sentence, mutableFeatureMap));
return false;
}
});
Instance[] instances = new Instance[instanceList.size()];
instanceList.toArray(instances);
return instances;
}
private static DoubleArrayTrie<Integer> loadDictionary(String trainingFile, String dictionaryFile) throws IOException
{
FrequencyMap dictionaryMap = new FrequencyMap();
if (dictionaryFile == null)
{
out.printf("从训练文件%s中统计词库...\n", trainingFile);
loadWordFromFile(trainingFile, dictionaryMap, true);
}
else
{
out.printf("从外部词典%s中加载词库...\n", trainingFile);
loadWordFromFile(dictionaryFile, dictionaryMap, false);
}
DoubleArrayTrie<Integer> dat = new DoubleArrayTrie<Integer>();
dat.build(dictionaryMap);
out.printf("加载完毕,词库总词数:%d,总词频:%d\n", dictionaryMap.size(), dictionaryMap.totalFrequency);
return dat;
}
public Result train(String trainingFile, String modelFile) throws IOException
{
return train(trainingFile, trainingFile, modelFile);
}
public Result train(String trainingFile, String developFile, String modelFile) throws IOException
{
return train(trainingFile, developFile, modelFile, 0.1, 50, Runtime.getRuntime().availableProcessors());
}
private static void loadWordFromFile(String path, FrequencyMap storage, boolean segmented) throws IOException
{
BufferedReader br = IOUtility.newBufferedReader(path);
String line;
while ((line = br.readLine()) != null)
{
if (segmented)
{
for (String word : IOUtility.readLineToArray(line))
{
storage.add(word);
}
}
else
{
line = line.trim();
if (line.length() != 0)
{
storage.add(line);
}
}
}
br.close();
}
}
| [
"hzm_c@qq.com"
] | hzm_c@qq.com |
f76aada1b8f3cf3c029f70ed8e9df5b3c06ea901 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/4/4_973147afb0de924d600f7103d5c885baa8d18772/AdvisoryBroker/4_973147afb0de924d600f7103d5c885baa8d18772_AdvisoryBroker_s.java | e30c2ef8fc201f1d7123385dae965884dd0ee5e2 | [] | 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 | 12,446 | java | /**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.advisory;
import java.util.Iterator;
import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.BrokerFilter;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.broker.region.Subscription;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.ConnectionInfo;
import org.apache.activemq.command.ConsumerId;
import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.command.DestinationInfo;
import org.apache.activemq.command.MessageId;
import org.apache.activemq.command.ProducerId;
import org.apache.activemq.command.ProducerInfo;
import org.apache.activemq.util.IdGenerator;
import org.apache.activemq.util.LongSequenceGenerator;
import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
/**
* This broker filter handles tracking the state of the broker for purposes of publishing advisory messages
* to advisory consumers.
*
* @version $Revision$
*/
public class AdvisoryBroker extends BrokerFilter {
//private static final Log log = LogFactory.getLog(AdvisoryBroker.class);
protected final ConcurrentHashMap connections = new ConcurrentHashMap();
protected final ConcurrentHashMap consumers = new ConcurrentHashMap();
protected final ConcurrentHashMap producers = new ConcurrentHashMap();
protected final ConcurrentHashMap destinations = new ConcurrentHashMap();
static final private IdGenerator idGenerator = new IdGenerator();
protected final ProducerId advisoryProducerId = new ProducerId();
final private LongSequenceGenerator messageIdGenerator = new LongSequenceGenerator();
public AdvisoryBroker(Broker next) {
super(next);
advisoryProducerId.setConnectionId(idGenerator.generateId());
}
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
next.addConnection(context, info);
ActiveMQTopic topic = AdvisorySupport.getConnectionAdvisoryTopic();
fireAdvisory(context, topic, info);
connections.put(info.getConnectionId(), info);
}
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
Subscription answer = next.addConsumer(context, info);
// Don't advise advisory topics.
if( !AdvisorySupport.isAdvisoryTopic(info.getDestination()) ) {
ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(info.getDestination());
consumers.put(info.getConsumerId(), info);
fireConsumerAdvisory(context, topic, info);
} else {
// We need to replay all the previously collected state objects
// for this newly added consumer.
if( AdvisorySupport.isConnectionAdvisoryTopic(info.getDestination()) ) {
// Replay the connections.
for (Iterator iter = connections.values().iterator(); iter.hasNext();) {
ConnectionInfo value = (ConnectionInfo) iter.next();
ActiveMQTopic topic = AdvisorySupport.getConnectionAdvisoryTopic();
fireAdvisory(context, topic, value, info.getConsumerId());
}
}
// We need to replay all the previously collected destination objects
// for this newly added consumer.
if( AdvisorySupport.isDestinationAdvisoryTopic(info.getDestination()) ) {
// Replay the destinations.
for (Iterator iter = destinations.values().iterator(); iter.hasNext();) {
DestinationInfo value = (DestinationInfo) iter.next();
ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(value.getDestination());
fireAdvisory(context, topic, value, info.getConsumerId());
}
}
// Replay the producers.
if( AdvisorySupport.isProducerAdvisoryTopic(info.getDestination()) ) {
for (Iterator iter = producers.values().iterator(); iter.hasNext();) {
ProducerInfo value = (ProducerInfo) iter.next();
ActiveMQTopic topic = AdvisorySupport.getProducerAdvisoryTopic(value.getDestination());
fireProducerAdvisory(context, topic, value, info.getConsumerId());
}
}
// Replay the consumers.
if( AdvisorySupport.isConsumerAdvisoryTopic(info.getDestination()) ) {
for (Iterator iter = consumers.values().iterator(); iter.hasNext();) {
ConsumerInfo value = (ConsumerInfo) iter.next();
ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(value.getDestination());
fireConsumerAdvisory(context, topic, value, info.getConsumerId());
}
}
}
return answer;
}
public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
next.addProducer(context, info);
// Don't advise advisory topics.
if( info.getDestination()!=null && !AdvisorySupport.isAdvisoryTopic(info.getDestination()) ) {
ActiveMQTopic topic = AdvisorySupport.getProducerAdvisoryTopic(info.getDestination());
fireAdvisory(context, topic, info);
producers.put(info.getProducerId(), info);
}
}
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception {
Destination answer = next.addDestination(context, destination);
ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
DestinationInfo info = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, destination);
fireAdvisory(context, topic, info);
destinations.put(destination, info);
return answer;
}
public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
next.removeDestination(context, destination, timeout);
ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
DestinationInfo info = (DestinationInfo) destinations.remove(destination);
if( info !=null ) {
info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE);
fireAdvisory(context, topic, info);
}
}
public void addDestinationInfo(ConnectionContext context,DestinationInfo info) throws Exception{
ActiveMQDestination destination = info.getDestination();
next.addDestinationInfo(context, info);
ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
fireAdvisory(context, topic, info);
destinations.put(destination, info);
}
public void removeDestinationInfo(ConnectionContext context,DestinationInfo info) throws Exception{
next.removeDestinationInfo(context, info);
ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(info.getDestination());
fireAdvisory(context, topic, info);
}
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
next.removeConnection(context, info, error);
ActiveMQTopic topic = AdvisorySupport.getConnectionAdvisoryTopic();
fireAdvisory(context, topic, info.createRemoveCommand());
connections.remove(info.getConnectionId());
}
public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
next.removeConsumer(context, info);
// Don't advise advisory topics.
if( !AdvisorySupport.isAdvisoryTopic(info.getDestination()) ) {
ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(info.getDestination());
consumers.remove(info.getConsumerId());
fireConsumerAdvisory(context, topic, info.createRemoveCommand());
}
}
public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception {
next.removeProducer(context, info);
// Don't advise advisory topics.
if( info.getDestination()!=null && !AdvisorySupport.isAdvisoryTopic(info.getDestination()) ) {
ActiveMQTopic topic = AdvisorySupport.getProducerAdvisoryTopic(info.getDestination());
producers.remove(info.getProducerId());
fireProducerAdvisory(context, topic, info.createRemoveCommand());
}
}
protected void fireAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command) throws Exception {
fireAdvisory(context, topic, command, null);
}
protected void fireAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId) throws Exception {
ActiveMQMessage advisoryMessage = new ActiveMQMessage();
fireAdvisory(context, topic, command, targetConsumerId, advisoryMessage);
}
protected void fireConsumerAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command) throws Exception {
fireConsumerAdvisory(context, topic, command, null);
}
protected void fireConsumerAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId) throws Exception {
ActiveMQMessage advisoryMessage = new ActiveMQMessage();
advisoryMessage.setIntProperty("consumerCount", consumers.size());
fireAdvisory(context, topic, command, targetConsumerId, advisoryMessage);
}
protected void fireProducerAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command) throws Exception {
fireProducerAdvisory(context, topic, command, null);
}
protected void fireProducerAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId) throws Exception {
ActiveMQMessage advisoryMessage = new ActiveMQMessage();
advisoryMessage.setIntProperty("producerCount", producers.size());
fireAdvisory(context, topic, command, targetConsumerId, advisoryMessage);
}
protected void fireAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId, ActiveMQMessage advisoryMessage) throws Exception {
advisoryMessage.setDataStructure(command);
advisoryMessage.setPersistent(false);
advisoryMessage.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE);
advisoryMessage.setMessageId(new MessageId(advisoryProducerId, messageIdGenerator.getNextSequenceId()));
advisoryMessage.setTargetConsumerId(targetConsumerId);
advisoryMessage.setDestination(topic);
advisoryMessage.setResponseRequired(false);
advisoryMessage.setProducerId(advisoryProducerId);
boolean originalFlowControl = context.isProducerFlowControl();
try {
context.setProducerFlowControl(false);
next.send(context, advisoryMessage);
} finally {
context.setProducerFlowControl(originalFlowControl);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
142fbc4651faea430341ce33f7f4ba9d2c80ba7b | 51b90e6a68baee33e7c653d79b1c3e26ad71878c | /helianto-core/src/main/java/org/helianto/core/repository/PublicSequenceRepository.java | a8db61f0c188d32ddbf0872eb5fa4b6172aff25b | [
"Apache-2.0"
] | permissive | eldevanjr/helianto | 38a231abfe6fa8bc146e49b49959dc04f894a589 | 61c13ffeaa0d63bd243d9a4c00e01255f65baa40 | refs/heads/master | 2021-01-11T19:20:45.193650 | 2017-01-26T19:55:49 | 2017-01-26T19:55:49 | 79,360,379 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package org.helianto.core.repository;
import java.io.Serializable;
import org.helianto.core.domain.Operator;
import org.helianto.core.domain.PublicSequence;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Public sequence repository.
*
* @author mauriciofernandesdecastro
*/
public interface PublicSequenceRepository extends JpaRepository<PublicSequence, Serializable> {
/**
* Find by natural key.
*
* @param operator
* @param typeName
*/
PublicSequence findByOperatorAndTypeName(Operator operator, String typeName);
}
| [
"eldevanjr@iservport.com"
] | eldevanjr@iservport.com |
dfac4c8341f3528a64d50777f29a5bbfe8352407 | 76c2f397d5ae08052396d2beee3c93791d93b72f | /commander/src/main/java/com/ted/commander/common/model/history/HistoryBillingCycleKey.java | 2b42509869fe6a2dac481ca2ef88fa5970da31ea | [
"Apache-2.0"
] | permissive | gsiu-criobe/commander | debcbc63ab105bef58aa45f9e2d757eb39fa054d | ecb11b7bdf5cf8e1e9bf9dac0dd05291d8d004a0 | refs/heads/master | 2022-10-19T13:43:37.330520 | 2020-06-12T20:07:42 | 2020-06-12T20:07:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,554 | java | package com.ted.commander.common.model.history;
import com.ted.commander.common.model.CalendarKey;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* Created by pete on 1/15/2016.
*/
@Embeddable
public class HistoryBillingCycleKey implements Serializable {
@Column(name = "virtualECC_id")
Long virtualECCId;
Integer billingCycleMonth;
Integer billingCycleYear;
public HistoryBillingCycleKey() {
}
public HistoryBillingCycleKey(Long virtualECCId, CalendarKey calendarKey) {
this.virtualECCId = virtualECCId;
this.billingCycleMonth = calendarKey.getMonth();
this.billingCycleYear = calendarKey.getYear();
}
public Long getVirtualECCId() {
return virtualECCId;
}
public void setVirtualECCId(Long virtualECCId) {
this.virtualECCId = virtualECCId;
}
public Integer getBillingCycleMonth() {
return billingCycleMonth;
}
public void setBillingCycleMonth(Integer billingCycleMonth) {
this.billingCycleMonth = billingCycleMonth;
}
public Integer getBillingCycleYear() {
return billingCycleYear;
}
public void setBillingCycleYear(Integer billingCycleYear) {
this.billingCycleYear = billingCycleYear;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HistoryBillingCycleKey that = (HistoryBillingCycleKey) o;
if (virtualECCId != null ? !virtualECCId.equals(that.virtualECCId) : that.virtualECCId != null) return false;
if (billingCycleMonth != null ? !billingCycleMonth.equals(that.billingCycleMonth) : that.billingCycleMonth != null)
return false;
return billingCycleYear != null ? billingCycleYear.equals(that.billingCycleYear) : that.billingCycleYear == null;
}
@Override
public int hashCode() {
int result = virtualECCId != null ? virtualECCId.hashCode() : 0;
result = 31 * result + (billingCycleMonth != null ? billingCycleMonth.hashCode() : 0);
result = 31 * result + (billingCycleYear != null ? billingCycleYear.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "HistoryBillingCycleKey{" +
"virtualECCId=" + virtualECCId +
", billingCycleMonth=" + billingCycleMonth +
", billingCycleYear=" + billingCycleYear +
'}';
}
}
| [
"pete@petecode.com"
] | pete@petecode.com |
ebee2075b3423cbba33841f728297c620cb14258 | 78c2ed90bfd25cbe4366174dc3a24273ee0c98ca | /src/main/java/com/mtpt/dao/TBProdMapper.java | 181389ce073eb0c84dd96f940c5aaf4abacda15d | [] | no_license | mmlyf/nmmarketplatform | 22092a0ea3641151406d9d96e34e31b06b725198 | d11937f092dca5a1d4e07dd576976398b7c5b844 | refs/heads/master | 2020-04-22T09:28:30.320017 | 2019-02-12T06:48:17 | 2019-02-12T07:31:55 | 170,273,107 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.mtpt.dao;
import java.util.List;
import com.mtpt.bean.TBProd;
public interface TBProdMapper {
int deleteByPrimaryKey(Integer proid);
int insert(TBProd record);
int insertSelective(TBProd record);
TBProd selectByPrimaryKey(Integer proid);
int updateByPrimaryKeySelective(TBProd record);
int updateByPrimaryKey(TBProd record);
List<TBProd> selectByLxid(int lxid);
} | [
"1453806177@qq.com"
] | 1453806177@qq.com |
e01b30fb939c6f976b08ace173415e757c8a67b1 | 1fdfac56b6d1093ad03e0ea93be236acdd6d53cf | /app/src/main/java/com/adhdriver/work/method/impl/IMessageImpl.java | 665188ef999e1f0e65f25cbb4cb19dde5df64944 | [] | no_license | AliesYangpai/ADHDriverApp | b97a6f2a0db3f7c5ae63acb58f6f5b98f118ab60 | ab9d270034ed08f94c118f9e8d366a8308b78bf3 | refs/heads/master | 2020-03-29T22:42:37.545997 | 2019-08-07T12:34:11 | 2019-08-07T12:34:11 | 150,436,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,924 | java | package com.adhdriver.work.method.impl;
import com.adhdriver.work.R;
import com.adhdriver.work.http.CallServer;
import com.adhdriver.work.http.HttpConst;
import com.adhdriver.work.http.HttpSingleResponseListener;
import com.adhdriver.work.http.RequestPacking;
import com.adhdriver.work.listener.OnDataBackListener;
import com.adhdriver.work.method.IMessage;
import com.yanzhenjie.nohttp.RequestMethod;
import com.yanzhenjie.nohttp.rest.Request;
import com.yanzhenjie.nohttp.rest.Response;
/**
* Created by Administrator on 2017/11/27.
* 类描述
* 版本
*/
public class IMessageImpl implements IMessage {
@Override
public void doGetMessages(String url, int size, int index, final OnDataBackListener onDataBackListener) {
Request<String> request = RequestPacking.getInstance().getRequestParamForJson(url, RequestMethod.GET,null);
request.add("size",size);
request.add("index",index);
CallServer.getInstance().add(HttpConst.HTTP_WHAT, request, new HttpSingleResponseListener<String>() {
@Override
protected void OnHttpStart(int what) {
onDataBackListener.onStart();
}
@Override
protected void OnHttpSuccessed(int what, Response<String> response) {
onDataBackListener.onSuccess(response.get());
}
@Override
protected void onHttpFailed(int what, Response<String> response) {
onDataBackListener.onFail(response.responseCode(),response.get());
}
@Override
protected void OnHttpFinish(int what) {
onDataBackListener.onFinish();
}
});
}
@Override
public void doGetMessagesInFresh(String url, int size, int index, final OnDataBackListener onDataBackListener) {
Request<String> request = RequestPacking.getInstance().getRequestParamForJson(url, RequestMethod.GET,null);
request.add("size",size);
request.add("index",index);
CallServer.getInstance().add(HttpConst.HTTP_WHAT, request, new HttpSingleResponseListener<String>() {
@Override
protected void OnHttpStart(int what) {
onDataBackListener.onStart();
}
@Override
protected void OnHttpSuccessed(int what, Response<String> response) {
onDataBackListener.onSuccess(response.get());
}
@Override
protected void onHttpFailed(int what, Response<String> response) {
onDataBackListener.onFail(response.responseCode(),response.get());
}
@Override
protected void OnHttpFinish(int what) {
onDataBackListener.onFinish();
}
});
}
@Override
public void doGetMessagesInLoadMore(String url, int size, int index, final OnDataBackListener onDataBackListener) {
Request<String> request = RequestPacking.getInstance().getRequestParamForJson(url, RequestMethod.GET,null);
request.add("size",size);
request.add("index",index);
CallServer.getInstance().add(HttpConst.HTTP_WHAT, request, new HttpSingleResponseListener<String>() {
@Override
protected void OnHttpStart(int what) {
onDataBackListener.onStart();
}
@Override
protected void OnHttpSuccessed(int what, Response<String> response) {
onDataBackListener.onSuccess(response.get());
}
@Override
protected void onHttpFailed(int what, Response<String> response) {
onDataBackListener.onFail(response.responseCode(),response.get());
}
@Override
protected void OnHttpFinish(int what) {
onDataBackListener.onFinish();
}
});
}
}
| [
"yangpai_beibei@163.com"
] | yangpai_beibei@163.com |
ed6369d229043ecb081aea492067255ac095d0e4 | ce804faa5f0ea8f7e0b82d5a0b405b6d0775f15d | /MyViewHolder/app/src/main/java/com/example/myviewholder/MainViewModel.java | 41daca91d15d16c00e94ec8a36a86a742bb99523 | [] | no_license | syifamld/PemrogramanMobile | 47b4d1020dedf55f62c3b5f7381209a71f5202ce | 9b42e8f2ffd851150cc5d58cfedc985b32df8071 | refs/heads/master | 2020-07-23T15:28:32.418020 | 2020-01-25T15:23:05 | 2020-01-25T15:23:05 | 207,609,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,806 | java | package com.example.myviewholder;
import android.util.Log;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestHandle;
import org.json.JSONArray;
import org.json.JSONObject;
import java.text.DecimalFormat;
import java.util.ArrayList;
import cz.msebera.android.httpclient.entity.mime.Header;
public class MainViewModel extends ViewModel {
private static final String API_KEY = "6393040e75c38e2deaf018f4ead33680";
private MutableLiveData<ArrayList<WeatherItems>> listWeathers = new MutableLiveData<>();
public void setWeather(final String cities) {
AsyncHttpClient client = new AsyncHttpClient();
final ArrayList<WeatherItems> listItems = new ArrayList<>();
String url = "https://api.openweathermap.org/data/2.5/group?id=" + cities + "&units=metric&appid=" + API_KEY;
RequestHandle requestHandle = client.get(url, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
try {
String result = new String(responseBody);
JSONObject responseObject = new JSONObject(result);
JSONArray list = responseObject.getJSONArray("list");
for (int i = 0; i < list.length(); i++) {
JSONObject weather = list.getJSONObject(i);
WeatherItems weatherItems = new WeatherItems();
weatherItems.setId(weather.getInt("id"));
weatherItems.setName(weather.getString("name"));
weatherItems.setCurrentWeather(weather.getJSONArray("weather").getJSONObject(0).getString("main"));
weatherItems.setDescription(weather.getJSONArray("weather").getJSONObject(0).getString("description"));
double tempInCelcius = weather.getJSONObject("main").getDouble("temp");
weatherItems.setTemperature(new DecimalFormat("##.##").format(tempInCelcius));
listItems.add(weatherItems);
}
listWeathers.postValue(listItems);
} catch (Exception e) {
Log.d("Exception", e.getMessage());
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Log.d("onFailure", error.getMessage());
}
});
}
LiveData<ArrayList<WeatherItems>> getWeathers() {
return listWeathers;
}
}
| [
"ceefaaa.a@gmail.com"
] | ceefaaa.a@gmail.com |
be317919a5070f2f8d2c3cf8d9eeaf2e89d4f981 | 0361022381199727b923c8207aa4e30c32310a2f | /MyApplication/app/src/main/java/com/example/myapplication/example/adapter/CaloriesListAdapter.java | df1d9d23d8f3fb504e7ee615dcb1efc587466f6e | [] | no_license | aaachao/fitness-manager-android-app | f85f7988bcc943addf713ff8afc45307f3cce310 | a98aa90aa227bbc94dc874ffa60a6835ba877be3 | refs/heads/master | 2020-06-11T19:52:08.176383 | 2019-09-25T11:48:18 | 2019-09-25T11:48:18 | 194,066,566 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,730 | java | package com.example.myapplication.example.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.myapplication.R;
import com.example.myapplication.example.entity.Calories;
import java.util.List;
public class CaloriesListAdapter extends BaseAdapter {
private List<Calories>mlist;
private LayoutInflater inflater;
private Context mContext;
public CaloriesListAdapter(Context mContext, List<Calories> mlist){
this.inflater=LayoutInflater.from(mContext);
this.mContext=mContext;
this.mlist=mlist;
}
@Override
public int getCount(){
return mlist.size();
}
@Override
public Object getItem(int position){
return mlist.get(position);
}
@Override
public long getItemId(int position){
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent){
ViewHolder holder;
if (convertView==null){
convertView=inflater.inflate(R.layout.item_calories,null);
holder=new ViewHolder();
holder.bg=(ImageView)convertView.findViewById(R.id.found_list_icon3);
holder.title = (TextView) convertView.findViewById(R.id.found_list_item_title3);
holder.username = (TextView) convertView.findViewById(R.id.found_list_item_username3);
holder.time = (TextView) convertView.findViewById(R.id.found_list_item_time3);
convertView.setTag(holder);
}
else{
holder=(ViewHolder)convertView.getTag();
}
Calories news=mlist.get(position);
String strh=news.getTime()+"";
String strm =strh.substring(0,strh.length()-2);
holder.title.setText(news.getCoursename());
holder.username.setText("消耗 的卡路里:"+news.getCalories()+"");
holder.time.setText(strm);
/* if(position%5==0){
holder.bg.setImageResource(R.drawable.png1);
}
if(position%5==1){
holder.bg.setImageResource(R.drawable.png2);
}
if(position%5==2){
holder.bg.setImageResource(R.drawable.png3);
}
if(position%5==3){
holder.bg.setImageResource(R.drawable.png4);
}
if(position%5==4){
holder.bg.setImageResource(R.drawable.png5);
}*/
return convertView;
}
private class ViewHolder{
public ImageView bg;
public TextView title;
public TextView username;
private TextView time;
}
}
| [
"you@example.com"
] | you@example.com |
701a681bce7a8bba345bbaa29f4d71679c2bfbfe | dbd57c8a406256718b4b870d9d2ea33080a79f9f | /src/main/java/com/webessay/user/CustomerUserDetail.java | 77c228d73857a1b3bed415a40a0febb6ddbc4c4a | [] | no_license | mingxuts/webessay2 | 591fbb0e5d05f5e1f58eb9600d7ea4d1fe9849e1 | 7cde11d29603cf45a7f2b48af4c2ac421ce0a12f | refs/heads/master | 2021-01-10T06:42:39.181253 | 2015-06-14T04:26:03 | 2015-06-14T04:26:03 | 36,793,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,222 | java | package com.webessay.user;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import com.webessay.config.Config;
import com.webessay.model.Userinfo;
import com.webessay.model.UserinfoRepository;
import com.webessay.user.logic.CustomerProfile;
import com.webessay.user.logic.WriterProfile;
public class CustomerUserDetail implements UserDetailsService {
@Autowired
UserinfoRepository userinfoRepo;
@Autowired
private DeveUser deveuser;
@Autowired
private SuperUser superuser;
@Autowired
private Config config;
@Value("${privateuser.emailsuffix}")
private String emailsuffix;
@Value("${super.username}")
private String superusername;
@Value("${developer.username}")
private String developerusername;
@Override
public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException {
System.out.println("logging...");
class throwexception{
public void usernotfound(){
throw new UsernameNotFoundException("User Not Found");
}
}
RegisteredUser ret = null;
if (username.endsWith(emailsuffix)){
if (username.equalsIgnoreCase(developerusername + emailsuffix)){
ret = deveuser.fakeUser();
} else if (username.equalsIgnoreCase(superusername + emailsuffix)){
ret = superuser.fakeUser();
} else {
new throwexception().usernotfound();
}
} else {
System.out.println("finding user :" + username);
Userinfo loggedOne = userinfoRepo.findByEmail(username);
if (loggedOne == null ){
new throwexception().usernotfound();
}
ret = mapUser(loggedOne);
}
return ret;
}
private RegisteredUser mapUser(Userinfo userinfo){
System.out.println("password: " + userinfo.getLoginPassword());
String email = userinfo.getEmail();
String password = userinfo.getLoginPassword();
boolean enabled = userinfo.getHasVerified();
boolean accountNonExpired = userinfo.getPasswordNonExpired();
boolean credentialsNonExpired = true;
boolean accountNonLocked = true;
RegisteredUser user = new RegisteredUser(email,
password.toLowerCase(),
enabled,
accountNonExpired,
credentialsNonExpired,
accountNonLocked,
AuthorityUtils
.commaSeparatedStringToAuthorityList(userinfo.getGroupName()),
userinfo.getId());
System.out.println(user.getAuthorities().toArray()[0].toString());
if (user.getAuthorities().toArray()[0].toString().startsWith("ROLE_USER")){
System.out.println("bingo");
user.setProfile(new CustomerProfile(user));
}
if (user.getAuthorities().toArray()[0].toString().startsWith("ROLE_WRITER")){
user.setProfile(new WriterProfile(user));
}
return user;
}
}
| [
"davidxiem@gmail.com"
] | davidxiem@gmail.com |
9dec5c899abc7cf7d031fd58892733fade0ea923 | 4e17b9566b1206797d5db6c06a262a3e1c4eec26 | /ui-android-sample/src/main/java/com/xyfindables/ui/sample/XYFindablesUISampleActivity.java | d029df7370785dabe02d72c52f69a8197fa6c7a4 | [] | no_license | maryannxy/ui-android | e935e783b5f2d5297964bb12a959e2af3a2b2257 | a69a5664d0047945e60ce59144bd39a635cfec68 | refs/heads/master | 2020-04-09T09:41:04.320790 | 2018-02-16T17:52:00 | 2018-02-16T17:52:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | package com.xyfindables.ui.sample;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.xyfindables.ui.XYBaseActivity;
import com.xyfindables.ui.views.XYButton;
import com.xyfindables.ui.views.XYToolbar;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
public class XYFindablesUISampleActivity extends XYBaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_xyfindables_ui_sample);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
XYButton secondaryActivityButton = findViewById(R.id.secondaryActivityButton);
secondaryActivityButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(XYFindablesUISampleActivity.this, XYSecondaryActivity.class);
startActivity(intent);
}
});
}
}
| [
"arie.trouw@xyfindit.com"
] | arie.trouw@xyfindit.com |
7796e3e006d237bd9bd367da7516b182b79c3598 | 9f4480fd63dbaa794a11add6e29c3c996d02cb17 | /ArrayStack.java | 870a5f0f6da8948111c77c308ad1c49f9b05c0e5 | [] | no_license | USF-CS245-09-2017/practice-assignment-06-rjthompson2 | c4a893fbd8a66fd018d2305568bb6b8681869089 | fc41eb26ffed5ce409c04adf77dd976b6d006150 | refs/heads/master | 2020-04-30T19:02:38.695512 | 2019-03-22T03:41:06 | 2019-03-22T03:41:06 | 177,027,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | import java.util.ArrayList;
public class ArrayStack<T> implements Stack<T>{
int size = 0;
ArrayList<T> arr = new ArrayList<T>();
public void push(T item){
arr.add(item);
size++;
}
public T pop(){
T item = arr.get(size-1);
arr.remove(size-1);
size--;
return item;
}
public T peek(){
if(size == 0){
return null;
}
return arr.get(size-1);
}
public boolean empty(){
if(size == 0){
return true;
}
return false;
}
} | [
"rjthompson2@dons.usfca.edu"
] | rjthompson2@dons.usfca.edu |
e3bda0b0ac04b668e300f65bc7f32d5653930aaf | 7850db84c96caa499172194d36feed653894631b | /AndroidBasicsWorkshop/excercises/TodoApp/07_backend/src/main/java/de/openknowledge/todo/view/overview/TodoOverviewFragment.java | 66246f9e8a14cf3ac3e9b32cb886b46ab4f86fb2 | [] | no_license | smutterlose/MobileTechCon2019 | d971c0fda55d4ac02b1497350f50468e533e244f | c2c18c8b061de309d27e2208bb1f8bae663a5662 | refs/heads/master | 2020-05-02T18:47:25.676887 | 2019-03-28T08:15:52 | 2019-03-28T08:15:52 | 178,139,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,361 | java | /*
* Copyright 2019 open knowledge GmbH
*
* 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 de.openknowledge.todo.view.overview;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import de.openknowledge.todo.MainViewModel;
import de.openknowledge.todo.R;
import de.openknowledge.todo.domain.Todo;
/**
* View controller for the apps main screen, showing a list of to-do items
*/
public class TodoOverviewFragment extends Fragment implements TodoAdapter.TodoItemClickListener {
// access to shared view model (singleton of shared app data)
private MainViewModel sharedViewModel;
// access to global navigation controller
private NavController navController;
public TodoOverviewFragment() {
// Required empty public constructor
}
//---------- fragment callback methods
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
setHasOptionsMenu(true);
return inflater.inflate(R.layout.fragment_todo_overview, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// add floating action button and define its click listener for navigation purpose
FloatingActionButton fab = view.findViewById(R.id.floatingActionButton);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navController.navigate(TodoOverviewFragmentDirections.actionTodoOverviewFragmentToCreateEditTodoFragment(null));
}
});
// set navigation controller
navController = Navigation.findNavController(requireActivity(), R.id.main_host_fragment);
// access shared view model (singleton of shared app data)
sharedViewModel = ViewModelProviders.of(requireActivity()).get(MainViewModel.class);
/// initiate the custom list adapter
final TodoAdapter adapter = new TodoAdapter(this);
// assign custom list adapter to recycler view of the activities layout
RecyclerView todoOverview = view.findViewById(R.id.list_todo_overview);
todoOverview.setAdapter(adapter);
// access view model for overview view
TodoOverviewViewModel viewModel = ViewModelProviders.of(this).get(TodoOverviewViewModel.class);
// observe to-do list changes via view model and update adapter in case of change
viewModel.getTodoList().observe(getViewLifecycleOwner(), new Observer<List<Todo>>() {
@Override
public void onChanged(List<Todo> todos) {
adapter.setItemList(todos);
}
});
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_main, menu);
}
//------------- callback methods of TodoAdapter.TodoItemClickListener
@Override
public void onTodoItemClicked(Todo todo) {
sharedViewModel.setSelectedTodo(todo);
navController.navigate(TodoOverviewFragmentDirections.actionTodoOverviewFragmentToTodoDetailFragment());
}
}
| [
"smutterlose@googlemail.com"
] | smutterlose@googlemail.com |
6c27a58f322eff8dcbffa2f2404969e225aa9d2f | 33aca781966abebca2a691d79015ae13575f71ce | /1806101025黄晓锋JAVA/src/lab02/Test_27/Test_27.java | dc01f2e2386a58afff990d32fbd526597cf308e8 | [] | no_license | GuiJunz/sctu-java-2019 | 57085f90a4343c8299fbc083a7a49cbf397c57c1 | 3c6332925cf10d3f62b98e08cf13839258d87ed0 | refs/heads/master | 2021-06-28T10:05:43.781509 | 2021-05-19T12:34:53 | 2021-05-19T12:34:53 | 232,454,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package lab02.Test_27;
import java.util.Scanner;
public class Test_27 {
public static void main(String[] args) {
try {
Scanner scanner = new Scanner(System.in);
System.out.println("请输一个int类型的的数:");
int a = scanner.nextInt(); //输入一个int类型的数
System.out.println("这个数是:" + a);
}
catch (Exception e) {
System.out.println("输入数据类型错误!");
System.out.println(e.toString());
}
finally {
}
}
}
| [
"hxf08520215"
] | hxf08520215 |
c06b9bfc3a216f798c5b0df35234546695996360 | eb7876e810d32a72575119d1336d7d629b8e54dc | /app/src/main/java/com/cmb_collector/model/WCMemberProfileClass.java | 6fb66fd8abb269ba72f907d4e74fcc99ed10051c | [] | no_license | palsusmia68/Banking-App | 8b7e037666628f6bdd2612fc19be7ef3bc63a24c | fed9f53077769d21f55d5de8332a1d599ffd7bc0 | refs/heads/master | 2023-07-16T09:05:32.304357 | 2021-09-03T07:08:17 | 2021-09-03T07:08:17 | 402,675,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,700 | java | package com.cmb_collector.model;
import java.io.Serializable;
public class WCMemberProfileClass implements Serializable {
private Integer images;
private String memberNo = "";
private String name = "";
private String phone = "";
private String address = "";
private String email = "";
private String profPic = "";
public WCMemberProfileClass(Integer images, String memberNo, String name, String phone, String address, String email, String profPic) {
this.images = images;
this.memberNo = memberNo;
this.name = name;
this.phone = phone;
this.address = address;
this.email = email;
this.profPic = profPic;
}
public Integer getImages() {
return images;
}
public void setImages(Integer images) {
this.images = images;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getMemberNo() {
return memberNo;
}
public void setMemberNo(String memberNo) {
this.memberNo = memberNo;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getProfPic() {
return profPic;
}
public void setProfPic(String profPic) {
this.profPic = profPic;
}
}
| [
"palsarojesi@gmail.com"
] | palsarojesi@gmail.com |
3fc310ddb04e09cc36176be00e39472038cc6180 | 6f4718299d132af3b6ceac6b13631569fa52834f | /src/src/converter/CodeCalendrierConvertor.java | 1d936536cf2d782fe3571e28455ed2e11a376586 | [] | no_license | aymenlaadhari/GTA | e051b7b0589ea0a3747a82d1e5894d0ff15cb85c | aa5513d2632279b38acecee2febf126b75a313c0 | refs/heads/master | 2016-09-05T20:44:33.065861 | 2016-01-15T19:00:40 | 2016-01-15T19:00:40 | 37,158,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | package converter;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import com.yesserp.domain.gta.CodeCalendrier;
import com.yesserp.sessionbean.gta.gestioncodecalendrier.GestionCodeCalendrierLocal;
@ManagedBean
@RequestScoped
public class CodeCalendrierConvertor implements Converter {
@EJB
GestionCodeCalendrierLocal gestionCodeCalendrierLocal;
@Override
public Object getAsObject(FacesContext context, UIComponent component,
String arg2) {
CodeCalendrier codeCalendrier = null;
if (!arg2.trim().equals(""))
codeCalendrier = gestionCodeCalendrierLocal
.trouverCodeParCode(arg2);
return codeCalendrier;
}
@Override
public String getAsString(FacesContext context, UIComponent component,
Object value) {
if (value == null || value.equals(""))
return "";
else
return String.valueOf(((CodeCalendrier) value).getCode());
}
}
| [
"aymenlaadhari@gmail.com"
] | aymenlaadhari@gmail.com |
b3efef8b95b4fbf5f8b90f4104d6cfe467352681 | 27548bfd4f26f5d8b458b50e2914563d5ab99374 | /src/reo-core/org.ect.reo/src/org/ect/reo/ReconfAction.java | fd9111b960aee48413517919f937d9bea646aa82 | [] | no_license | behnaaz/extensible-coordination-tools | bafa0b2ba810bf6a9ac5478133330b430993c753 | 16d447a241ad87096d45f657b8efb832f133414a | refs/heads/master | 2021-01-17T04:45:53.202800 | 2016-05-20T14:55:53 | 2016-05-20T14:55:53 | 39,437,821 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,566 | java | /*******************************************************************************
* <copyright>
* This file is part of the Extensible Coordination Tools (ECT).
* Copyright (c) 2013 ECT developers.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* </copyright>
*******************************************************************************/
package org.ect.reo;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
/**
* @see org.ect.reo.ReoPackage#getReconfAction()
* @model kind="class"
* @generated
*/
public class ReconfAction extends MinimalEObjectImpl implements EObject {
/**
* @generated NOT
*/
public ReconfAction(ReconfRule rule, ReconfType type) {
super();
setRule(rule);
setType(type);
}
/**
* The cached value of the '{@link #getRule() <em>Rule</em>}' reference.
* @see #getRule()
* @generated
* @ordered
*/
protected ReconfRule rule;
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* @see #getType()
* @generated
* @ordered
*/
protected static final ReconfType TYPE_EDEFAULT = ReconfType.NONE;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* @see #getType()
* @generated
* @ordered
*/
protected ReconfType type = TYPE_EDEFAULT;
/**
* @generated
*/
public ReconfAction() {
super();
}
/**
* @generated
*/
@Override
protected EClass eStaticClass() {
return ReoPackage.Literals.RECONF_ACTION;
}
/**
* Returns the value of the '<em><b>Rule</b></em>' reference.
* @return the value of the '<em>Rule</em>' reference.
* @see #setRule(ReconfRule)
* @see org.ect.reo.ReoPackage#getReconfAction_Rule()
* @model
* @generated
*/
public ReconfRule getRule() {
if (rule != null && rule.eIsProxy()) {
InternalEObject oldRule = (InternalEObject)rule;
rule = (ReconfRule)eResolveProxy(oldRule);
if (rule != oldRule) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReoPackage.RECONF_ACTION__RULE, oldRule, rule));
}
}
return rule;
}
/**
* @generated
*/
public ReconfRule basicGetRule() {
return rule;
}
/**
* Sets the value of the '{@link org.ect.reo.ReconfAction#getRule <em>Rule</em>}' reference.
* @param value the new value of the '<em>Rule</em>' reference.
* @see #getRule()
* @generated
*/
public void setRule(ReconfRule newRule) {
ReconfRule oldRule = rule;
rule = newRule;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReoPackage.RECONF_ACTION__RULE, oldRule, rule));
}
/**
* Returns the value of the '<em><b>Type</b></em>' attribute.
* The literals are from the enumeration {@link org.ect.reo.ReconfType}.
* @return the value of the '<em>Type</em>' attribute.
* @see org.ect.reo.ReconfType
* @see #setType(ReconfType)
* @see org.ect.reo.ReoPackage#getReconfAction_Type()
* @model
* @generated
*/
public ReconfType getType() {
return type;
}
/**
* Sets the value of the '{@link org.ect.reo.ReconfAction#getType <em>Type</em>}' attribute.
* @param value the new value of the '<em>Type</em>' attribute.
* @see org.ect.reo.ReconfType
* @see #getType()
* @generated
*/
public void setType(ReconfType newType) {
ReconfType oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReoPackage.RECONF_ACTION__TYPE, oldType, type));
}
/**
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ReoPackage.RECONF_ACTION__RULE:
if (resolve) return getRule();
return basicGetRule();
case ReoPackage.RECONF_ACTION__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ReoPackage.RECONF_ACTION__RULE:
setRule((ReconfRule)newValue);
return;
case ReoPackage.RECONF_ACTION__TYPE:
setType((ReconfType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ReoPackage.RECONF_ACTION__RULE:
setRule((ReconfRule)null);
return;
case ReoPackage.RECONF_ACTION__TYPE:
setType(TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ReoPackage.RECONF_ACTION__RULE:
return rule != null;
case ReoPackage.RECONF_ACTION__TYPE:
return type != TYPE_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (type: ");
result.append(type);
result.append(')');
return result.toString();
}
}
| [
"henshin.ck@gmail.com"
] | henshin.ck@gmail.com |
56a4ee9dbbd7384e0926bfa94acf55a8980c7402 | 31e8be1679c1969881312dedde9ef8fc1700d2af | /algorithm/src/main/java/cn/zwuyang/patterns/bjsxt/singleton/SingletonDemo2.java | a01c33210ad1cda4b481b1172647281b3ed1f94a | [] | no_license | wuyangLife/some-blog-demos | 70d5e3c984d359eda6c3679faee08c70d0469ebe | 487287c76fd0ca2fb6bbc8f0eada8133066373cd | refs/heads/master | 2022-07-28T22:18:54.725704 | 2019-10-20T09:56:47 | 2019-10-20T09:56:47 | 186,324,885 | 0 | 0 | null | 2022-06-17T02:36:43 | 2019-05-13T01:26:41 | Java | UTF-8 | Java | false | false | 538 | java | package cn.zwuyang.patterns.bjsxt.singleton;
/**
* 测试懒汉式单例模式
* @author 尚学堂高淇 www.sxt.cn
*
*/
public class SingletonDemo2 {
//类初始化时,不初始化这个对象(延时加载,真正用的时候再创建)。
private static SingletonDemo2 instance;
private SingletonDemo2(){ //私有化构造器
}
//方法同步,调用效率低!
public static synchronized SingletonDemo2 getInstance(){
if(instance==null){
instance = new SingletonDemo2();
}
return instance;
}
}
| [
"657200906@qq.com"
] | 657200906@qq.com |
1b399ef593ae7d6deb2982188b1d0b7b406c5500 | 039c60333238e7714946054ec0a6f3c395671ad4 | /src/main/java/com/paradise/domain/Group.java | d546c90261f82ce256680d3a0410154ae0c78058 | [] | no_license | gmartinezminardi/eufrasia | 85be7ee018e07a4b07acfda82654feb6f016f5e0 | 57ae3affb52549bfc272df2c6d401f6b2d478a50 | refs/heads/master | 2021-01-23T15:42:31.067686 | 2013-02-21T18:38:38 | 2013-02-21T18:38:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package com.paradise.domain;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.springframework.security.core.GrantedAuthority;
import com.paradise.domain.User;
@Entity
@Table(name="Groups")
public class Group implements GrantedAuthority {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@Column
private String name;
@ManyToMany(mappedBy="groups")
private List<User> users;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthority() {
return name;
}
public void setUsers(List<User> users) {
this.users = users;
}
public List<User> getUsers() {
return users;
}
}
| [
"gmartinezminardi@gmail.com"
] | gmartinezminardi@gmail.com |
5d2ec7bd208ce465d6c43b7fab9263a9d7f9fa41 | ca7bc277816cfae25182b75916f733c740c629f5 | /Chap11Lab/src/sec13/exam01_math/CalendarExample.java | bc876c3f3ffb197f6062fcd2a760fe15d51dd0cf | [] | no_license | jupark1862/javaLab | 5f60834b7658a55b2eef86091002f249b86c2e0e | 6376402ad21ecfe836b4107560647b0ecd7a36e7 | refs/heads/master | 2023-04-10T05:12:37.251749 | 2021-04-29T04:17:56 | 2021-04-29T04:17:56 | 352,486,303 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,438 | java | package sec13.exam01_math;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class CalendarExample {
public static void main(String[] args) {
// TODO Auto-generated method stub
Calendar now = Calendar.getInstance();
Calendar now1 = new GregorianCalendar();
int year = now.get(Calendar.YEAR);
int month = now.get(Calendar.MONTH)+1;
int day = now.get(Calendar.DAY_OF_MONTH);
int week = now.get(Calendar.DAY_OF_WEEK);
String strWeek = null;
switch(week) {
case Calendar.MONDAY:
strWeek = "월";
break;
case Calendar.TUESDAY:
strWeek = "화";
break;
case Calendar.WEDNESDAY:
strWeek = "수";
break;
case Calendar.THURSDAY:
strWeek = "목";
break;
case Calendar.FRIDAY:
strWeek = "금";
break;
case Calendar.SATURDAY:
strWeek = "토";
break;
default:
strWeek = "일";
}
int amPm = now.get(Calendar.AM_PM);
String strAmPm;
if(amPm == Calendar.AM) {
strAmPm = "오전";
}else {
strAmPm= "오후";
}
int hour = now.get(Calendar.HOUR);
int minute = now.get(Calendar.MINUTE);
int second = now.get(Calendar.SECOND);
System.out.print(year+"년 ");
System.out.print(month+"월");
System.out.print(day+"일 ");
System.out.print(strWeek+"요일 ");
System.out.print(hour+"시");
System.out.print(minute+"분");
System.out.print(second+"초");
}
}
| [
"kolpks0@naver.com"
] | kolpks0@naver.com |
6a36a0a9ca31c2e4fc37dd51f9128ee6d0f60152 | ed9e9d0c0f973386c7347d6278f486ebb23de247 | /app/src/main/java/com/hfad/bountyhunter/BountyHunter.java | 71cfcbfeb5e26d5c09d4cd9c1b129cda58baa076 | [] | no_license | maziesmith/Bounty_Hunter | 2f0511e6e6683aeb93e1068258168e2ec7429399 | 20c52b66dd158fd122e505d1ed282b4640cdb1b9 | refs/heads/master | 2020-12-18T09:27:26.410572 | 2019-12-28T07:03:01 | 2019-12-28T07:03:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,799 | java | package com.hfad.bountyhunter;
import android.util.Log;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import swapi.models.People;
public class BountyHunter implements Serializable, ViewableCharacter {
public static BountyHunter ig88;
public static BountyHunter bobaFett;
public static BountyHunter bossk;
public static BountyHunter[] bountyHunters;
private People character;
private ArrayList<Bounty> bounties;
private int health;
private int imageResourceId;
public BountyHunter(People character) {
this.character = character;
this.bounties = new ArrayList<>();
this.health = 100;
if(this.character.name.equals("Boba Fett"))
this.imageResourceId = R.drawable.bobafett;
else if(this.character.name.equals("IG-88"))
this.imageResourceId = R.drawable.ig88;
else if(this.character.name.equals("Bossk"))
this.imageResourceId = R.drawable.bossk;
}
public static void generateBountyHunters(){
bountyHunters = new BountyHunter[3];
for(People bounty : BountyHunterApp.bountyTargets){
if(bounty.name.equals("IG-88"))
ig88 = new BountyHunter(bounty);
else if(bounty.name.equals("Boba Fett"))
bobaFett = new BountyHunter(bounty);
else if(bounty.name.equals("Bossk"))
bossk = new BountyHunter(bounty);
}
bountyHunters[0] = ig88;
bountyHunters[1] = bobaFett;
bountyHunters[2] = bossk;
for(int i = 0; i < 3; i++){
int bounty1 = (int)(Math.random() * 86.0);
int bounty2 = (int)(Math.random() * 86.0);
int bounty3 = (int)(Math.random() * 86.0);
bountyHunters[0].getBounties().add(new Bounty(BountyHunterApp.bountyTargets.get(bounty1)));
bountyHunters[1].getBounties().add(new Bounty(BountyHunterApp.bountyTargets.get(bounty2)));
bountyHunters[2].getBounties().add(new Bounty(BountyHunterApp.bountyTargets.get(bounty3)));
}
}
public void collectBounty(String bountyName){
Bounty bounty = null;
People toDelete = null;
for(People target : BountyHunterApp.bountyTargets){
if(target.name.equals(bountyName)){
bounty = new Bounty(target);
this.getCharacter().ownedStarships.addAll(target.ownedStarships);
this.getCharacter().ownedVehicles.addAll(target.ownedVehicles);
toDelete = target;
this.getBounties().add(bounty);
break;
}
}
BountyHunterApp.bountyTargets.remove(toDelete);
try {
int damage = (int) ( this.getMass() / bounty.getMass()) * 20;
this.health -= damage;
} catch (NullPointerException e){
Log.e("BountyHunter", "No such bounty target exits.");
}
}
public double getMass(){
return Double.parseDouble(this.character.mass);
}
public People getCharacter(){
return this.character;
}
public int getImageResourceId() { return this.imageResourceId; }
public ArrayList<Bounty> getBounties(){ return this.bounties; }
@Override
public String toString(){
return String.format("Name: %s\nBirth Year: %s\nMass: %s\nSkin Color: %s\nHealth: %d\nPrimary Starship: %s\n",
this.character.name,
this.character.birthYear,
this.character.mass,
this.character.skinColor,
this.health,
(this.getCharacter().ownedStarships == null || this.getCharacter().ownedStarships.size() == 0 ? "" : this.getCharacter().ownedStarships.get(0).name));
}
}
| [
"dgmcdona@uno.edu"
] | dgmcdona@uno.edu |
24c3d0820d43041fe5d9d2ca8cc021808468b13e | b89252a760d87fc4cb047033d81c92a9e41ffc36 | /src/comparison/Counter.java | 1ce2f26d771afef88ed0bc5ba3abf7ac1462636d | [] | no_license | sawyercade/Utilities | 2beec755eb357aa9948d4133da10ef9739ef8ac6 | e1c1642c3fed28d0369848de6ede1d0202a3c7d7 | refs/heads/master | 2020-05-18T11:32:34.751231 | 2013-12-07T22:03:20 | 2013-12-07T22:03:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package comparison;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class Counter<K> {
Map<K, Integer> map;
public Counter(){
map = new HashMap<K, Integer>();
}
public void zero(K key){
map.put(key, 0);
}
public Integer increment(K key){
if (map.containsKey(key)){
map.put(key, map.get(key)+1);
}
else {
map.put(key, 1);
}
return map.get(key);
}
public Integer decrement(K key){
if (map.containsKey(key)){
map.put(key, map.get(key)-1);
}
else {
map.put(key, 1);
}
return map.get(key);
}
public Integer get(K key){
return map.get(key);
}
public K getMax(){
K maxKey = null;
Integer maxValue = Integer.MIN_VALUE;
for (Map.Entry<K, Integer> entry : map.entrySet()){
if (entry.getValue() > maxValue){
maxKey = entry.getKey();
maxValue = entry.getValue();
}
}
return maxKey;
}
public K getMin(){
K minKey = null;
Integer minValue = Integer.MAX_VALUE;
for (Map.Entry<K, Integer> entry : map.entrySet()){
if (entry.getValue() < minValue){
minKey = entry.getKey();
minValue = entry.getValue();
}
}
return minKey;
}
public void remove (K key){
map.remove(key);
}
public Set<Map.Entry<K, Integer>> entries(){
return map.entrySet();
}
} | [
"sawyer.lemon@gmail.com"
] | sawyer.lemon@gmail.com |
9655370cf9a7db8ec50e9f3c77d443c9eccc0972 | 6e2bb9fc8443ab266ad1b90d6ae9cf884fe7016d | /src/main/java/com/example/appbiblioteca/controller/AutorController.java | 4d044e2f0be1165cc0cf5615777d906807c52f38 | [] | no_license | crisjo92/proyecto_escalab | 00678cf96c11a0e63540d2607cf10f8c41f181fd | cc5f8058bd2c75d4caa407e3cb8a841225adeecc | refs/heads/master | 2023-02-11T04:12:21.263874 | 2021-01-10T20:20:45 | 2021-01-10T20:20:45 | 328,470,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,953 | java | package com.example.appbiblioteca.controller;
import java.net.URI;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import com.example.appbiblioteca.model.Autor;
import com.example.appbiblioteca.service.IAutorService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@RestController
@RequestMapping("/autores")
public class AutorController {
@Autowired
private IAutorService autorService;
@ApiOperation(value = "Obtener todos los Autores",
notes = "No necesita parametros de entrada",
response = List.class,
responseContainer = "Autor")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Datos no enviados correctamente"),
@ApiResponse(code = 404, message = "No encontrado"),
@ApiResponse(code = 405, message = "No se encontraron pacientes en la BD"),
@ApiResponse(code = 200, message = "Peticón OK")})
@GetMapping("/listar")
public ResponseEntity<List<Autor>> listar(){
List<Autor> lista = autorService.listar();
return new ResponseEntity<List<Autor>>(lista, HttpStatus.OK);
}
@ApiOperation(value = "Busca Autor por ID",
notes = "Necesita Id de entrada",
response = Autor.class,
responseContainer = "Autor")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Datos no enviados correctamente"),
@ApiResponse(code = 404, message = "No encontrado"),
@ApiResponse(code = 405, message = "No se encontraron paciente en la BD"),
@ApiResponse(code = 200, message = "Peticón OK")})
@GetMapping("/buscar/{id}")
public ResponseEntity<Autor> listarPorId(@PathVariable("id") Integer id) {
Autor aut = autorService.burcarId(id);
if (aut.getIdAutor() == null) {
//throw new ModeloNotFoundException("ID NO ENCONTRADO " + id);
return new ResponseEntity<Autor>(aut, HttpStatus.NOT_FOUND);
}
return new ResponseEntity<Autor>(aut, HttpStatus.OK);
}
@ApiOperation(value = "Crea Autor",
notes = "Necesita Informacion de Autor",
response = Object.class,
responseContainer = "Autor")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Datos no enviados correctamente"),
@ApiResponse(code = 404, message = "No encontrado"),
@ApiResponse(code = 405, message = "No se encontraron paciente en la BD"),
@ApiResponse(code = 200, message = "Peticón OK")})
@PostMapping("/registrar")
public ResponseEntity<Object> registrar(@RequestBody Autor autor) {
Autor aut = autorService.crear(autor);
URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(autor.getIdAutor()).toUri();
return ResponseEntity.created(location).build();
}
@ApiOperation(value = "Modificar Autor",
notes = "Necesita ID de Autor como parametro de entrada",
response = Autor.class,
responseContainer = "Autor")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Datos no enviados correctamente"),
@ApiResponse(code = 200, message = "Peticón OK")})
@PutMapping("/modificar")
public ResponseEntity<Autor> modificar(@RequestBody Autor autor) {
Autor aut = autorService.modificar(autor);
return new ResponseEntity<Autor>(aut, HttpStatus.OK);
}
@ApiOperation(value = "Eliminar Autor",
notes = "Necesita ID de Autor como parametro de entrada",
response = Object.class,
responseContainer = "Autor")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Datos no enviados correctamente"),
@ApiResponse(code = 404, message = "No encontrado"),
@ApiResponse(code = 405, message = "No se encontraron datos en la BD"),
@ApiResponse(code = 200, message = "Peticón OK")})
@DeleteMapping("/delete/{id}")
public ResponseEntity<Object> eliminar(@PathVariable("id") Integer id) {
Autor aut = autorService.burcarId(id);
if (aut.getIdAutor() == null) {
//throw new ModeloNotFoundException("ID NO ENCONTRADO" + id);
return new ResponseEntity<Object>(aut, HttpStatus.NOT_FOUND);
}
autorService.eliminar(id);
return new ResponseEntity<Object>(HttpStatus.OK);
}
}
| [
"crist.jorna@gmail.com"
] | crist.jorna@gmail.com |
ff5b00a012cf9c9314a0f20eb454b7fbfb075d73 | a6397048e4e7eea3526be98d471b83f56c245448 | /src/test/java/lbs/leica/ExtentReport_UAT.java | 1b03e9b51c644d791d0a5ba3bcca4afa9c80d478 | [
"MIT"
] | permissive | Dnyaneshbedre/maven-simple | 6d6f2e268b31209ce44700a93f4e0bf914088998 | 72e73da8670969375d78cd3d22676fa790b38cfc | refs/heads/master | 2020-12-27T16:17:31.763101 | 2020-02-03T14:00:10 | 2020-02-03T14:00:10 | 237,967,728 | 0 | 0 | MIT | 2020-02-03T13:09:58 | 2020-02-03T13:09:57 | null | UTF-8 | Java | false | false | 2,577 | java | package lbs.leica;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.testng.ITestResult;
import org.testng.Reporter;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.ChartLocation;
import com.aventstack.extentreports.reporter.configuration.Theme;
public class ExtentReport_UAT
{
public static ExtentHtmlReporter htmlReporter;
public static ExtentReports extent;
public static ExtentTest test;
WebDriver driver;
@BeforeSuite
public void setUp()
{
htmlReporter = new ExtentHtmlReporter(System.getProperty("user.dir") + "/test-output/ZensarReport.html");
extent = new ExtentReports();
extent.attachReporter(htmlReporter);
extent.setSystemInfo("OS", "Windows");
extent.setSystemInfo("Host Name", "Leica");
extent.setSystemInfo("Environment", "UAT");
extent.setSystemInfo("User Name", "Dnyanesh");
htmlReporter.config().setChartVisibilityOnOpen(true);
htmlReporter.config().setDocumentTitle("Automation Test Report for Leica environment");
htmlReporter.config().setReportName("Automation Test Report for Leica environment");
htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
htmlReporter.config().setTheme(Theme.DARK);
//htmlReporter.config().setTheme(Theme.STANDARD);
}
@AfterMethod
public void getResult(ITestResult result) throws IOException
{
if (result.getStatus() == ITestResult.FAILURE)
{
test.log(Status.FAIL, MarkupHelper.createLabel(result.getName() + " Test case FAILED due to below issues:",ExtentColor.RED));
test.fail(result.getThrowable());
}
else if (result.getStatus() == ITestResult.SUCCESS)
{
test.log(Status.PASS, MarkupHelper.createLabel(result.getName() + " Test Case PASSED", ExtentColor.GREEN));
}
else
{
test.log(Status.SKIP,MarkupHelper.createLabel(result.getName() + " Test Case SKIPPED", ExtentColor.ORANGE));
test.skip(result.getThrowable());
}
}
@AfterSuite
public void tearDown()
{
extent.flush();
}
public void reportLog(String message)
{
test.log(Status.INFO, message);
Reporter.log(message);
}
} | [
"dbedre@DHRODCPCEXTS15.dhrodc.com"
] | dbedre@DHRODCPCEXTS15.dhrodc.com |
14263629cb8eaa5ee2c52c9d68cb46d64c24385d | 045cb211f10b0acfcd9dd62ca6422d936e2a0f74 | /paixu/TestDemo.java | 3e30baa6e000555911aa8c6e63258cab08b935e6 | [] | no_license | milandexiaohonghei/20210914 | 594510dcf74d62ef839f76ec75aed81443dda2c2 | ea636fcec63f04f1bdbf880a1314986f31249457 | refs/heads/main | 2023-07-29T03:57:56.849942 | 2021-09-14T13:26:42 | 2021-09-14T13:26:42 | 406,375,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package paixu;
public class TestDemo {
public static void main(String[] args) {
int sum = 0;
for(int i = 1; i <= 1000; i++){
if(num(i)){
sum++;
if(sum % 8 == 0){
System.out.println(i);
}else{
System.out.print(i +" ");
}
}
}
}
public static boolean num(int i) {
if(i == 1){
return false;
}
for (int j = 2; j <= i; j++) {
if (i % j == 0 && i != j) {
break;
}
if (j == i) {
return true;
}
}
return false;
}
}
| [
"duajiawei8@163.com"
] | duajiawei8@163.com |
8b8535ebf64774ce0cf3c339baae1c5a75df53ff | 0705b52a847619f4c0567f87b95671cd14b148d2 | /src/main/java/by/gov/dha/document/DocOrgs.java | 60b4bd4caa4a5ed916f9e1340940967db995f398 | [] | no_license | AlexseyBLR/DHADocumentLoader | d842ccd66562515a95cbca52c845458d9cdea459 | b74be683a6add3694478de72a6a1dff795c09c59 | refs/heads/master | 2020-03-28T14:05:32.905637 | 2018-10-07T11:30:31 | 2018-10-07T11:30:31 | 148,456,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,121 | java |
package by.gov.dha.document;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for DocOrgs complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="DocOrgs">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="refOrg" type="{http://document.dha.gov.by}RefOrg" maxOccurs="unbounded"/>
* </sequence>
* <attGroup ref="{http://document.dha.gov.by}SimpleAttrGroup"/>
* <attribute name="tableRef" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DocOrgs", namespace = "http://document.dha.gov.by", propOrder = {
"refOrg"
})
public class DocOrgs {
@XmlElement(namespace = "http://document.dha.gov.by", required = true)
protected List<RefOrg> refOrg;
@XmlAttribute(name = "tableRef")
protected String tableRef;
@XmlAttribute(name = "num")
protected Integer num;
@XmlAttribute(name = "type")
protected String type;
@XmlAttribute(name = "code")
protected String code;
@XmlAttribute(name = "footer")
protected String footer;
@XmlAttribute(name = "header")
protected String header;
@XmlAttribute(name = "prefix")
protected String prefix;
@XmlAttribute(name = "postfix")
protected String postfix;
@XmlAttribute(name = "visible")
protected Integer visible;
@XmlAttribute(name = "editable")
protected Integer editable;
@XmlAttribute(name = "required")
protected Integer required;
@XmlAttribute(name = "alignment")
protected String alignment;
/**
* Gets the value of the refOrg property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the refOrg property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRefOrg().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link RefOrg }
*
*
*/
public List<RefOrg> getRefOrg() {
if (refOrg == null) {
refOrg = new ArrayList<RefOrg>();
}
return this.refOrg;
}
/**
* Gets the value of the tableRef property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTableRef() {
return tableRef;
}
/**
* Sets the value of the tableRef property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTableRef(String value) {
this.tableRef = value;
}
/**
* Gets the value of the num property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getNum() {
return num;
}
/**
* Sets the value of the num property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setNum(Integer value) {
this.num = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
/**
* Gets the value of the code property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCode(String value) {
this.code = value;
}
/**
* Gets the value of the footer property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFooter() {
return footer;
}
/**
* Sets the value of the footer property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFooter(String value) {
this.footer = value;
}
/**
* Gets the value of the header property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHeader() {
return header;
}
/**
* Sets the value of the header property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHeader(String value) {
this.header = value;
}
/**
* Gets the value of the prefix property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPrefix() {
return prefix;
}
/**
* Sets the value of the prefix property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPrefix(String value) {
this.prefix = value;
}
/**
* Gets the value of the postfix property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPostfix() {
return postfix;
}
/**
* Sets the value of the postfix property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPostfix(String value) {
this.postfix = value;
}
/**
* Gets the value of the visible property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getVisible() {
return visible;
}
/**
* Sets the value of the visible property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setVisible(Integer value) {
this.visible = value;
}
/**
* Gets the value of the editable property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getEditable() {
return editable;
}
/**
* Sets the value of the editable property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setEditable(Integer value) {
this.editable = value;
}
/**
* Gets the value of the required property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getRequired() {
return required;
}
/**
* Sets the value of the required property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setRequired(Integer value) {
this.required = value;
}
/**
* Gets the value of the alignment property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAlignment() {
return alignment;
}
/**
* Sets the value of the alignment property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlignment(String value) {
this.alignment = value;
}
}
| [
"alexey.meleshchenya@compit.by"
] | alexey.meleshchenya@compit.by |
c6f39b5ecfa2a8e593fadacfc1555cd576455981 | 7f7bf4a5062bde5a2c9ab101046fb87ee6ba6ac1 | /NSL/NSL/app/src/main/java/com/nsl/app/FragmentPaymentCollections.java | 72f1f31441708adf921590474b7046f4ba89a292 | [] | no_license | srinivasp94/asserts | edceb84e799855456b0c0583b5d4f5067138c062 | 72f7e50af5d42d99d5ecf2a8da2c9c42868e0ff3 | refs/heads/master | 2020-03-13T13:15:34.997837 | 2018-09-28T10:26:51 | 2018-09-28T10:26:51 | 131,134,975 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,765 | java | package com.nsl.app;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
*/
public class FragmentPaymentCollections extends Fragment {
private static int currentPage = 0;
private static int NUM_PAGES = 0;
private static final String HOME_URL = "http://www.mehndiqueens.com/indianbeauty/api/user/images";
ViewPager mViewPager;
//private SliderLayout imageSlider;
SharedPreferences sharedpreferences;
public static final String mypreference = "mypref";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_paymentcollections, container, false);
final CoordinatorLayout coordinatorLayout = (CoordinatorLayout) view.findViewById(R.id
.coordinatorLayout);
return view;
}
/* public class AsyncHome extends AsyncTask<Void, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new ProgressDialog(getActivity());
dialog.setMessage("Please wait");
dialog.show();
}
protected String doInBackground(Void... arg0)
{ ImagesArray.clear();
try {
OkHttpClient client = new OkHttpClient();
RequestBody formBody = new FormEncodingBuilder()
.add("categoryId", "12")
.build();
*//*Request request = new Request.Builder()
.url(Singup_URL)
.build();*//*
Request request = new Request.Builder()
.url(HOME_URL)
.post(formBody)
.build();
Response responses = null;
try {
responses = client.newCall(request).execute();
jsonData = responses.body().string();
System.out.println("!!!!!!!1"+jsonData);
} catch (IOException e) {
e.printStackTrace();
}
}catch (Exception e)
{
e.printStackTrace();
}
return jsonData;
}
protected void onPostExecute(String result){
super.onPostExecute(result);
if (dialog.isShowing()) {
dialog.dismiss();
}
JSONArray array;
if (jsonData != null && jsonData.startsWith("["))
{
try
{
array = new JSONArray(jsonData);
//System.out.println("result"+result);
if (array != null && array.length() > 0) {
for (int i = 0; i < array.length(); i++) {
JSONObject obj = array.optJSONObject(i);
HashMap<String, String> map = new HashMap<String, String>();
// adding each child node to HashMap key => value
map.put("Image", obj.getString("image"));
ImagesArray.add(map);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
Toast.makeText(getActivity(),"No data found",Toast.LENGTH_LONG).show();
}
adapter.notifyDataSetChanged();
}
}
class ZoomAdapter extends PagerAdapter {
LayoutInflater inflator;
ImageView imgDisplay;
Context context;
// ArrayList<ZoomimageModel> slideShowImages;
// ArrayList<String> slideShowImages;
private ArrayList<HashMap<String, String>> slideShowImages;
String plotimages;
public ZoomAdapter(FragmentActivity context, ArrayList<HashMap<String, String>> slideShowImages) {
this.context = context;
this.slideShowImages = slideShowImages;
}
@Override
public int getCount() {
return slideShowImages.size();
}
public int getItemPosition(Object object) {
return POSITION_NONE;
}
// @Override
*//* public boolean isViewFromObject(View view, Object object) {
return view == ((ImageView) object);
}*//*
// @Override
public Object instantiateItem(ViewGroup container, final int position) {
inflator = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View viewLayout = inflator.inflate(R.layout.pager_item, container,
false);
imgDisplay = (ImageView) viewLayout.findViewById(R.id.imageView);
*//* for(int i=0;i<ImagesArray.size();i++)
NUM_PAGES =ImagesArray.size();
// Auto start of viewpager
final Handler handler = new Handler();
final Runnable Update = new Runnable() {
public void run() {
if (currentPage == NUM_PAGES) {
currentPage = 0;
}
mViewPager.setCurrentItem(currentPage++, true);
}
};
Timer swipeTimer = new Timer();
swipeTimer.schedule(new TimerTask() {
@Override
public void run() {
handler.post(Update);
}
}, 3000, 3000);*//*
Glide.with(context).load(slideShowImages.get(position).get("Image")).diskCacheStrategy(DiskCacheStrategy.ALL).into(imgDisplay);
//Glide.with(context).load(plotimages).diskCacheStrategy(DiskCacheStrategy.ALL).into(imgDisplay);
container.addView(viewLayout);
return viewLayout;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// ((ViewPager) container).removeView((ImageView) object);
(container).removeView((LinearLayout) object);
// container.removeView((View) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}*/
}
| [
"srinivas.pudi94@gmail.com"
] | srinivas.pudi94@gmail.com |
cf6d30464c1cd180a5c11f8ae02846bc64ae90bc | 96c9c5fa820bfe9811b27f9644fec7285b3e56dd | /src/com/negocio/servicio/general/sistema/AlbTipoVehiculoServicio.java | 5f8a5161d4a304915948d7f2a85923769188f5aa | [] | no_license | Azlimaico/Alb_Negocio | ce5c6e3f2d869c10b0befc4c4920714501ac7bf0 | 64dff96fd9800de1ea6bf2a36ef2ae5cf35eea09 | refs/heads/master | 2021-01-19T15:25:19.801856 | 2017-12-04T14:46:34 | 2017-12-04T14:46:34 | 100,968,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.negocio.servicio.general.sistema;
/**
*
* @author Zulay
*/
public interface AlbTipoVehiculoServicio {
}
| [
"Zulay@HP"
] | Zulay@HP |
3a13b4d8d6b303f242be4237bfa8602ce21c23dd | 633ad2d580248e34abb8e2e81da39416dbbca331 | /Javelin/src/main/java/jp/co/acroquest/endosnipe/javelin/spring/JavelinTraceInterceptor.java | 0b651015f4a8f93b1e58618c036c968ef5b9200b | [] | no_license | eripong/ENdoSnipe-1 | 4747420ec883717f6a38a96c981bef83897de553 | 0896d928a5b8126bc426426b6426a820c3b55892 | refs/heads/master | 2020-12-25T08:28:18.862293 | 2013-04-02T16:23:24 | 2013-04-02T16:23:24 | 9,339,890 | 1 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 18,331 | java | /*******************************************************************************
* ENdoSnipe 5.0 - (https://github.com/endosnipe)
*
* The MIT License (MIT)
*
* Copyright (c) 2012 Acroquest Technology Co.,Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package jp.co.acroquest.endosnipe.javelin.spring;
import java.io.PrintStream;
import java.lang.reflect.Modifier;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import jp.co.acroquest.endosnipe.common.config.JavelinConfig;
import jp.co.acroquest.endosnipe.javelin.util.HashMap;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.log4j.Logger;
/**
* Javelinログを出力するためのTraceInterceptor。
*
* @version 0.2
* @author On Eriguchi (Acroquest), Tetsu Hayakawa (Acroquest)
*/
public class JavelinTraceInterceptor implements MethodInterceptor
{
private static final long serialVersionUID = 6661781313519708185L;
/**
* メソッド呼び出し時にJavelinログの先頭に出力する識別子。
*/
private static final String CALL = "Call ";
/**
* メソッド戻り時にJavelinログの先頭に出力する識別子。
*/
private static final String RETURN = "Return";
/**
* 例外throw時にJavelinログの先頭に出力する識別子。
*/
private static final String THROW = "Throw ";
/**
* 例外catch時にJavelinログの先頭に出力する識別子。
*/
private static final String CATCH = "Catch ";
private static final int CALLER_STACKTRACE_INDEX = 3;
/**
* 改行文字。
*/
private static final String NEW_LINE = System.getProperty("line.separator");
/**
* ログの区切り文字。
*/
private static final String DELIM = ",";
/**
* スレッド情報の区切り文字
*/
private static final String THREAD_DELIM = "@";
/**
* ログ出力する時刻のフォーマット。
*/
private static final String TIME_FORMAT_STR = "yyyy/MM/dd HH:mm:ss.SSS";
/**
* Javelinログに出力する時刻データ整形用フォーマッタ。
*/
private final ThreadLocal<SimpleDateFormat> timeFormat_ = new ThreadLocal<SimpleDateFormat>() {
@Override
protected synchronized SimpleDateFormat initialValue()
{
return new SimpleDateFormat(TIME_FORMAT_STR);
}
};
/**
* メソッドの呼び出し元オブジェクトを表す文字列。
*/
private final ThreadLocal<String> callerLog_ = new ThreadLocal<String>() {
@Override
protected synchronized String initialValue()
{
return "<unknown>,<unknown>,0";
}
};
/**
* Javelinログ出力用ロガー。
*/
private static Logger logger__ = Logger.getLogger(JavelinTraceInterceptor.class);
/**
* 設定
*/
private final JavelinConfig config_ = new JavelinConfig();
/**
* 例外発生を記録するテーブル。 キーにスレッドの識別子、値に例外オブジェクトを入れる。 例外が発生したらこのマップにその例外を登録し、
* キャッチされた時点で削除する。
*/
private static Map<String, Throwable> exceptionMap__ =
Collections.synchronizedMap(new HashMap<String, Throwable>());
/** 設定値を標準出力に出力したらtrue */
private boolean isPrintConfig_ = false;
/**
* Javelinログ出力用のinvokeメソッド。
*
* 実際のメソッド呼び出しを実行する前後で、 呼び出しと返却の詳細ログを、Javelin形式で出力する。
*
* 実行時に例外が発生した場合は、その詳細もログ出力する。
*
* @param invocation
* インターセプタによって取得された、呼び出すメソッドの情報
* @return invocationを実行したときの戻り値
* @throws Throwable
* invocationを実行したときに発生した例外
*/
public Object invoke(final MethodInvocation invocation)
throws Throwable
{
// 設定値を出力していなければ出力する
synchronized (this)
{
if (this.isPrintConfig_ == false)
{
this.isPrintConfig_ = true;
printConfigValue();
}
}
StringBuffer methodCallBuff = new StringBuffer(256);
// 呼び出し先情報取得。
String calleeClassName = invocation.getMethod().getDeclaringClass().getName();
String calleeMethodName = invocation.getMethod().getName();
String objectID = Integer.toHexString(System.identityHashCode(invocation.getThis()));
String modifiers = Modifier.toString(invocation.getMethod().getModifiers());
// 呼び出し元情報取得。
String currentCallerLog = this.callerLog_.get();
Thread currentThread = Thread.currentThread();
String threadName = currentThread.getName();
String threadClassName = currentThread.getClass().getName();
String threadID = Integer.toHexString(System.identityHashCode(currentThread));
String threadInfo = threadName + THREAD_DELIM + threadClassName + THREAD_DELIM + threadID;
// メソッド呼び出し共通部分生成。
methodCallBuff.append(calleeMethodName);
methodCallBuff.append(DELIM);
methodCallBuff.append(calleeClassName);
methodCallBuff.append(DELIM);
methodCallBuff.append(objectID);
// 呼び出し先のログを、
// 次回ログ出力時の呼び出し元として使用するために保存する。
this.callerLog_.set(methodCallBuff.toString());
methodCallBuff.append(DELIM);
methodCallBuff.append(currentCallerLog);
methodCallBuff.append(DELIM);
methodCallBuff.append(modifiers);
methodCallBuff.append(DELIM);
methodCallBuff.append(threadInfo);
// methodCallBuff.append(NEW_LINE);
// Call 詳細ログ生成。
StringBuffer callDetailBuff = createCallDetail(methodCallBuff, invocation);
// Call ログ出力。
logger__.debug(callDetailBuff);
// 実際のメソッド呼び出しを実行する。
// 実行中に例外が発生したら、その詳細ログを出力する。
Object ret = null;
try
{
// メソッド呼び出し。
ret = invocation.proceed();
}
catch (Throwable cause)
{
// Throw詳細ログ生成。
StringBuffer throwBuff =
createThrowCatchDetail(THROW, calleeMethodName, calleeClassName, objectID,
threadInfo, cause);
// Throw ログ出力。
logger__.debug(throwBuff);
// 例外発生を記録する。
exceptionMap__.put(threadInfo, cause);
// 例外をスローし、終了する。
throw cause;
}
// このスレッドで、直前に例外が発生していたかを確認する。
// 発生していてここにたどり着いたのであれば、この時点で例外が
// catchされたということになるので、Catchログを出力する。
boolean isExceptionThrowd = exceptionMap__.containsKey(threadInfo);
if (isExceptionThrowd == true)
{
// 発生していた例外オブジェクトをマップから取り出す。(かつ削除する)
Throwable exception = exceptionMap__.remove(threadInfo);
// Catch詳細ログ生成。
StringBuffer throwBuff =
createThrowCatchDetail(CATCH, calleeMethodName, calleeClassName, objectID,
threadInfo, exception);
// Catch ログ出力。
logger__.debug(throwBuff);
}
// Return詳細ログ生成。
StringBuffer returnDetailBuff = createReturnDetail(methodCallBuff, ret);
// Returnログ出力。
logger__.debug(returnDetailBuff);
this.callerLog_.set(currentCallerLog);
// invocationを実行した際の戻り値を返す。
return ret;
}
/**
* メソッド呼び出し(識別子Call)の詳細なログを生成する。
*
* @param methodCallBuff
* メソッド呼び出しの文字列
* @param invocation
* メソッド呼び出しの情報
* @return メソッド呼び出しの詳細なログ
*/
private StringBuffer createCallDetail(final StringBuffer methodCallBuff,
final MethodInvocation invocation)
{
String timeStr = (this.timeFormat_.get()).format(new Date());
StringBuffer callDetailBuff = new StringBuffer(512);
callDetailBuff.append(CALL);
callDetailBuff.append(DELIM);
callDetailBuff.append(timeStr);
callDetailBuff.append(DELIM);
callDetailBuff.append(methodCallBuff);
callDetailBuff.append(NEW_LINE);
// 引数のログを生成する。
if (this.config_.isLogArgs() == true)
{
callDetailBuff.append("<<javelin.Args_START>>" + NEW_LINE);
Object[] args = invocation.getArguments();
if (args != null && args.length > 0)
{
for (int i = 0; i < args.length; ++i)
{
callDetailBuff.append(" args[");
callDetailBuff.append(i);
callDetailBuff.append("] = ");
callDetailBuff.append("[");
callDetailBuff.append(args[i].getClass().getName());
callDetailBuff.append("] ");
callDetailBuff.append(args[i]);
callDetailBuff.append(NEW_LINE);
}
}
callDetailBuff.append("<<javelin.Args_END>>" + NEW_LINE);
}
// スタックトレースのログを生成する。
if (this.config_.isLogStacktrace() == true)
{
callDetailBuff.append("<<javelin.StackTrace_START>>" + NEW_LINE);
Throwable th = new Throwable();
StackTraceElement[] stackTraceElements = th.getStackTrace();
for (int index = CALLER_STACKTRACE_INDEX; index < stackTraceElements.length; index++)
{
callDetailBuff.append(" at ");
callDetailBuff.append(stackTraceElements[index]);
callDetailBuff.append(NEW_LINE);
}
callDetailBuff.append("<<javelin.StackTrace_END>>" + NEW_LINE);
}
if (invocation.getThis() instanceof Throwable)
{
callDetailBuff.append("<<javelin.Exception>>" + NEW_LINE);
}
return callDetailBuff;
}
/**
* メソッドの戻り(識別子Return)の詳細なログを生成する。
*
* @param methodCallBuff
* メソッド呼び出しの文字列
* @param ret
* メソッドの戻り値
* @return メソッドの戻りの詳細なログ
*/
private StringBuffer createReturnDetail(final StringBuffer methodCallBuff, final Object ret)
{
StringBuffer returnDetailBuff = new StringBuffer(512);
String returnTimeStr = (this.timeFormat_.get()).format(new Date());
returnDetailBuff.append(RETURN);
returnDetailBuff.append(DELIM);
returnDetailBuff.append(returnTimeStr);
returnDetailBuff.append(DELIM);
returnDetailBuff.append(methodCallBuff);
// 戻り値のログを生成する。
if (this.config_.isLogReturn())
{
returnDetailBuff.append(NEW_LINE);
returnDetailBuff.append("<<javelin.Return_START>>" + NEW_LINE);
returnDetailBuff.append(" ");
returnDetailBuff.append(ret);
returnDetailBuff.append(NEW_LINE);
returnDetailBuff.append("<<javelin.Return_END>>" + NEW_LINE);
}
return returnDetailBuff;
}
/**
* 例外発生(識別子Throw)、または例外キャッチ(Catch)の詳細ログを生成する。
*
* @param id
* 識別子。ThrowまたはCatch
* @param calleeMethodName
* 呼び出し先メソッド名
* @param calleeClassName
* 呼び出し先クラス名
* @param objectID
* 呼び出し先クラスのオブジェクトID
* @param threadInfo
* スレッド情報
* @param cause
* 発生した例外
* @return 例外発生の詳細なログ
*/
private StringBuffer createThrowCatchDetail(final String id, final String calleeMethodName,
final String calleeClassName, final String objectID, final String threadInfo,
final Throwable cause)
{
String throwTimeStr = (this.timeFormat_.get()).format(new Date());
String throwableID = Integer.toHexString(System.identityHashCode(cause));
StringBuffer throwBuff = new StringBuffer(512);
throwBuff.append(id);
throwBuff.append(DELIM);
throwBuff.append(throwTimeStr);
throwBuff.append(DELIM);
throwBuff.append(cause.getClass().getName());
throwBuff.append(DELIM);
throwBuff.append(throwableID);
throwBuff.append(DELIM);
throwBuff.append(calleeMethodName);
throwBuff.append(DELIM);
throwBuff.append(calleeClassName);
throwBuff.append(DELIM);
throwBuff.append(objectID);
throwBuff.append(DELIM);
throwBuff.append(threadInfo);
return throwBuff;
}
/**
* 呼び出し情報を記録する最大件数をセットする。
*
* @param intervalMax 件数
*/
public void setIntervalMax(final int intervalMax)
{
if (this.config_.isSetIntervalMax() == false)
{
this.config_.setIntervalMax(intervalMax);
}
}
/**
* 例外の発生履歴を記録する最大件数をセットする。
*
* @param throwableMax 件数
*/
public void setThrowableMax(final int throwableMax)
{
if (this.config_.isSetThrowableMax() == false)
{
this.config_.setThrowableMax(throwableMax);
}
}
/**
* 呼び出し情報を発報する際の閾値をセットする。
*
* @param alarmThreshold 閾値(ミリ秒)
*/
public void setAlarmThreshold(final int alarmThreshold)
{
if (this.config_.isSetAlarmThreshold() == false)
{
this.config_.setAlarmThreshold(alarmThreshold);
}
}
/**
* 引数の内容をログ出力するかどうか設定する。
*
* @param isLogArgs
* 引数をログ出力するならtrue
*/
public void setLogArgs(final boolean isLogArgs)
{
if (this.config_.isSetLogArgs() == false)
{
this.config_.setLogArgs(isLogArgs);
}
}
/**
* 戻り値の内容をログ出力するかどうか設定する。
*
* @param isLogReturn
* 戻り値をログ出力するならtrue
*/
public void setLogReturn(final boolean isLogReturn)
{
if (this.config_.isSetLogReturn() == false)
{
this.config_.setLogReturn(isLogReturn);
}
}
/**
* メソッド呼び出しまでのスタックトレースをログ出力するか設定する。
*
* @param isLogStackTrace
* スタックトレースをログ出力するならtrue
*/
public void setLogStackTrace(final boolean isLogStackTrace)
{
if (this.config_.isSetLogStacktrace() == false)
{
this.config_.setLogStacktrace(isLogStackTrace);
}
}
/**
* 設定値を標準出力に出力する。
*/
private void printConfigValue()
{
PrintStream out = System.out;
out.println(">>>> Properties related with SpringJavelin");
out.println("\tjavelin.intervalMax : " + this.config_.getIntervalMax());
out.println("\tjavelin.throwableMax : " + this.config_.getThrowableMax());
out.println("\tjavelin.alarmThreshold : " + this.config_.getAlarmThreshold());
out.println("<<<<");
}
}
| [
"eripong@gmail.com"
] | eripong@gmail.com |
1fad3de49680d201f9fd576eed3b237bee3775fa | 555253623481cd75362d7a8845e64ac5879a7077 | /homework/src/by/epam/homework/arrays/Task01.java | 50cb1813e59876a96a175af25a436a8098b685e7 | [] | no_license | Aprotosevich/Unit02 | 764d93b44dd4defc2a6febd42217daa67c118517 | 4550cc9e843d599f1590bd37bb1965bba8be39c8 | refs/heads/master | 2020-08-04T11:01:03.499079 | 2019-10-01T14:24:16 | 2019-10-01T14:24:16 | 212,112,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,111 | java | package by.epam.homework.arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Task01 {
//В массив A[N] занесены натуральные числа. Найти сумму тех элементов, которые кратны данному K.
public static void main(String[] args) {
Task01 task01 = new Task01();
int n = 500;
int k = 25;
int[] taskArray = task01.createArray(n);
int getValidSum = task01.getSumFromArray(
task01.getValidElementArray(taskArray, k));
System.out.println("Sum : " + getValidSum);
}
private int getSumFromArray (int[] array) {
return Arrays.stream(array).sum();
}
private int[] getValidElementArray(int[] array, int k){
return Arrays.stream(array).
filter(n -> n % k == 0).
toArray();
}
private int[] createArray(int n) {
int[] array = new int[n];
for (int i = 0; i < array.length; i++) {
array[i] = i;
}
return array;
}
}
| [
"antony.protosevich@gmail.com"
] | antony.protosevich@gmail.com |
1a189e802d6f4c34bf9a5f6d6928392e9c90354c | cdf60e66d8cdda1a1bdc90b356bfe755dc0a37ff | /app/src/androidTest/java/com/example/android/notetakingapp/ExampleInstrumentedTest.java | a43c77e825bd082bdf5277f2d8d22f813d0c4fdc | [] | no_license | Rdy2code/ArchitectureDemo | 3aea7c46a67fc65cecee5cd7db7d0a54cd94865a | 346c1fe824af2262acb69ac18468fc4d3da221f0 | refs/heads/master | 2022-06-02T23:59:39.829119 | 2020-05-03T23:00:08 | 2020-05-03T23:00:08 | 261,037,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.example.android.notetakingapp;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.android.notetakingapp", appContext.getPackageName());
}
}
| [
"lvwmailbox@yahoo.com"
] | lvwmailbox@yahoo.com |
1a46bdb57a117c6b2c3a328a16ba3bb5d6b4e0b0 | 201987c3b4a6e77c2c11efe30ff5c3560802e7f7 | /test/automaton/instances/ABC.java | 0f7e8e9f0ebb84dfc1ff6e4ce13d17fcf88fa15d | [
"MIT"
] | permissive | yossigil/Automata | a6a4714201e75d803df82417783a24eace04f3b9 | c61f1dac1cbbace5e0452077cc6ea2acdb19ea0b | refs/heads/main | 2023-07-04T23:37:08.977011 | 2021-08-02T03:34:00 | 2021-08-02T03:34:00 | 382,044,473 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,843 | java | package automaton.instances;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import automaton.FSA;
import automaton.minimize.Sample;
public class ABC {
final Sample $ = Sample.abc;
{
$.show();
}
@Nested class NFSA {
FSA<Character> $ = ABC.this.$.NFSA();
@Test void ε() { assert !$.run(""); }
@Test void ab() { assert !$.run("ab"); }
@Test void abb() { assert !$.run("abb"); }
@Test void aba() { assert !$.run("aba"); }
@Test void abc() { assert $.run("abc"); }
@Test void a() { assert !$.run("a"); }
@Test void b() { assert !$.run("b"); }
@Test void aa() { assert !$.run("aa"); }
@Test void bb() { assert !$.run("bb"); }
@Test void ba() { assert !$.run("ba"); }
@Test void aab() { assert !$.run("aab"); }
@Test void bab() { assert !$.run("bab"); }
@Test void aaa() { assert !$.run("aaa"); }
@Test void bbb() { assert !$.run("bbb"); }
@Test void abababa() { assert !$.run("abababa"); }
@Test void ababab() { assert !$.run("ababab"); }
@Test void abababb() { assert !$.run("abababb"); }
}
@Nested class DFSA {
FSA<Character> $ = ABC.this.$.DFSA();
@Test void ε() { assert !$.run(""); }
@Test void ab() { assert !$.run("ab"); }
@Test void abb() { assert !$.run("abb"); }
@Test void aba() { assert !$.run("aba"); }
@Test void abc() { assert $.run("abc"); }
@Test void a() { assert !$.run("a"); }
@Test void b() { assert !$.run("b"); }
@Test void aa() { assert !$.run("aa"); }
@Test void bb() { assert !$.run("bb"); }
@Test void ba() { assert !$.run("ba"); }
@Test void aab() { assert !$.run("aab"); }
@Test void bab() { assert !$.run("bab"); }
@Test void aaa() { assert !$.run("aaa"); }
@Test void bbb() { assert !$.run("bbb"); }
@Test void abababa() { assert !$.run("abababa"); }
@Test void ababab() { assert !$.run("ababab"); }
@Test void abababb() { assert !$.run("abababb"); }
}
@Nested class MDFSA {
FSA<Character> $ = ABC.this.$.MDFSA();
@Test void ε() { assert !$.run(""); }
@Test void ab() { assert !$.run("ab"); }
@Test void abb() { assert !$.run("abb"); }
@Test void aba() { assert !$.run("aba"); }
@Test void abc() { assert $.run("abc"); }
@Test void a() { assert !$.run("a"); }
@Test void b() { assert !$.run("b"); }
@Test void aa() { assert !$.run("aa"); }
@Test void bb() { assert !$.run("bb"); }
@Test void ba() { assert !$.run("ba"); }
@Test void aab() { assert !$.run("aab"); }
@Test void bab() { assert !$.run("bab"); }
@Test void aaa() { assert !$.run("aaa"); }
@Test void bbb() { assert !$.run("bbb"); }
@Test void abababa() { assert !$.run("abababa"); }
@Test void ababab() { assert !$.run("ababab"); }
@Test void abababb() { assert !$.run("abababb"); }
}
}
| [
"yogi@cs.technion.ac.il"
] | yogi@cs.technion.ac.il |
d2edd9a1a89f82053b3d90864c04b9d2a82db49f | 18cea10a3359ed64661efb2aed9e08188b8d84c3 | /security-generator/src/main/java/com/gogbuy/security/generator/dao/SysGeneratorDao.java | 1ccc12aa4b670da13fa0fa6a68f179d59ec405bd | [] | no_license | zengchi/gogbuy-security | a276b95990e3a672f8a4a7fb45797158c0513df7 | 2c056fbb668dae1ef8df729eed35991bf7517d2d | refs/heads/master | 2020-12-05T21:12:34.469204 | 2018-03-23T02:58:12 | 2018-03-23T02:58:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package com.gogbuy.security.generator.dao;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 代码生成器
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2016年12月19日 下午3:32:04
*/
@Mapper
public interface SysGeneratorDao {
List<Map<String, Object>> queryList(Map<String, Object> map);
int queryTotal(Map<String, Object> map);
Map<String, String> queryTable(String tableName);
List<Map<String, String>> queryColumns(String tableName);
}
| [
"469863752@qq.com"
] | 469863752@qq.com |
7f5b5c3027533ec44c3c75f8039eb239f9551663 | 6c43b270850f0ab393ada177debaf3f55350a12a | /src/test/java/gps/SignUpPatient.java | 38eaa627a08294d6e6dbdc85e2ba8fc04bbb5c48 | [] | no_license | GPS-QA/DailyHealthCheckup | 05406ac35da27ab819675eb88c676f8edd6ba569 | bf4dd3416907bfa78fa234615e945b7283642d97 | refs/heads/master | 2023-06-16T03:08:17.372563 | 2021-06-28T14:45:04 | 2021-06-28T14:45:04 | 374,670,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,023 | java | package gps;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import prop.Properties;
public class SignUpPatient {
WebDriver driver;
JavascriptExecutor js;
String emailPatient = Properties.emailPatient_gps_web;
String passwordPatient = Properties.password;
String firstName = Properties.firstName;
String lastName = Properties.lastName_gps_web;
String phone = Properties.phone_gps_web;
//String time = Properties.time;
@BeforeClass
public void Setup() {
System.setProperty("webdriver.chrome.driver", "D:\\ChromeDriver\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.get("https://app.alt.thegpservice.com");
js = (JavascriptExecutor) driver;
}
@AfterClass
public void Teardown() {
driver.quit();
}
@Test(priority = 1)
public void SignUp_Patient() {
driver.findElement(By
.xpath("//a[@routerlink= '/faqs']//parent::li//following-sibling::li//following-sibling::li//following-sibling::li//child::a[@routerlink= '/register']"))
.click();
driver.findElement(By.id("email")).sendKeys(emailPatient);
driver.findElement(By.id("telnumber-field")).sendKeys(phone);
driver.findElement(By.id("rpassword")).sendKeys(passwordPatient);
driver.findElement(By.id("cpassword")).sendKeys(passwordPatient);
js.executeScript("window.scrollBy(0,500)");
driver.findElement(By.xpath("//button[contains(text(),'NEXT')]")).click();
try {
Thread.sleep(8000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By.id("firstName")).sendKeys(firstName);
driver.findElement(By.id("lastName")).sendKeys(lastName);
Select dropdown_day = new Select(driver.findElement(By.name("day")));
dropdown_day.selectByValue("1: 1");
Select dropdown_month = new Select(driver.findElement(By.name("month")));
dropdown_month.selectByValue("3: 3");
Select dropdown_year = new Select(driver.findElement(By.name("year")));
dropdown_year.selectByValue("91: 1990");
js.executeScript("window.scrollBy(0,1000)");
driver.findElement(By.xpath("//button[contains(text(),'Female')]")).click();
driver.findElement(By.name("patientPostcodeInput")).sendKeys("LE11AA");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By.name("patientPostcodeInput")).sendKeys(Keys.RETURN);
// driver.findElement(By.xpath("//span[contains(text(),'LE1
// 1AA')]")).click();
Select dropdown_addr = new Select(driver.findElement(By.id("userAddressInput")));
dropdown_addr.selectByValue("3: Object");
js.executeScript("window.scrollBy(0,500)");
driver.findElement(By.xpath("//button[contains(text(),'NEXT')]")).click();
driver.findElement(By.xpath("//button[contains(text(),'NO')]")).click();
driver.findElement(By.xpath("//button[contains(text(),'SIGN UP')]")).click();
try {
Thread.sleep(8000);
} catch (InterruptedException e) {
e.printStackTrace();
}
String current_url = driver.getCurrentUrl();
String expected_url = "https://app.alt.thegpservice.com/appointments";
Assert.assertEquals(current_url, expected_url);
}
@Test(priority = 2)
public void BookConsultation_Patient() {
//driver.findElement(By.xpath("//button[contains(text(),'" + time + "')]")).click();
driver.findElement(By.xpath("//div[contains(@class, 'slot-times')]//button[1]")).click();
driver.findElement(By.id("presentingComplaint")).sendKeys("Additional details for the doctor");
driver.findElement(By.name("postcode")).sendKeys("LE11AA");
driver.findElement(By.xpath("//button[contains(text(),'Find Pharmacies')]")).click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
js.executeScript("window.scrollBy(0,500)");
driver.findElement(By.xpath("//strong[contains(text(),'GPS QA Pharmacy')]")).click();
js.executeScript("window.scrollBy(0,500)");
driver.findElement(By.xpath("//button[contains(text(),'Confirm Appointment')]")).click();
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.switchTo().frame(1);
driver.findElement(By.xpath("//input[@name = 'cardnumber']")).sendKeys("4242424242424242");
driver.findElement(By.xpath("//input[@name = 'exp-date']")).sendKeys("1225");
driver.findElement(By.xpath("//input[@name = 'cvc']")).sendKeys("123");
driver.switchTo().defaultContent();
js.executeScript("window.scrollBy(0,200)");
driver.findElement(By.xpath("//label[@for = 'agreeMedication']")).click();
driver.findElement(By.xpath("//label[@for = 'personalUse']")).click();
driver.findElement(By.xpath("//label[@for = 'agreeFees']")).click();
js.executeScript("window.scrollBy(0,200)");
driver.findElement(By.xpath("//button[contains(text(),'Confirm Payment')]")).click();
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By
.xpath("//a[@routerlink= '/faqs']//parent::li//following-sibling::li//following-sibling::li//child::a[@routerlink= '/my-account']"))
.click();
boolean status = driver.findElement(By.xpath("//span[text() = 'Booked']")).isDisplayed();
Assert.assertTrue(status);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
/*String current_url = driver.getCurrentUrl();
String expected_url = "https://app.alt.thegpservice.com/order/thankyou";
Assert.assertEquals(current_url, expected_url);*/
}
}
| [
"thanuji.shashikala@gmail.com"
] | thanuji.shashikala@gmail.com |
ea78606d5c0d1be9b29185c73118e0bef3c0cd4c | 071445a30e1b5ef7a0250768adfc5196e4f186f0 | /src/bank/BaseAccount.java | 3216e5167acadea0e5a16fa34c567f764bd95881 | [] | no_license | harithasiripireddy/javabasics | 1f8633c0fdbf7604841f5a8fbc5592eaaff86f88 | ee2af2d0ec261a19a7161b3d3e91dee54ac93cbf | refs/heads/master | 2020-11-28T02:11:53.627710 | 2020-01-03T17:12:57 | 2020-01-03T17:12:57 | 229,677,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,498 | java | package bank;
import java.util.Scanner;
public class BaseAccount implements Account {
private String name;
private String phum;
private String accnum;
protected double balance;
private int pin;
public BaseAccount( String name,String phum,String accnum,double balance) {
this.name=name;
this.phum= phum;
this.accnum=accnum;
this.balance= balance;
}
public String getPhum() {
return phum;
}
public void setPhum(String phum) {
this.phum = phum;
}
public String getName() {
return name;
}
public String getAccnum() {
return accnum;
}
public void displayBalance() {
System.out.println( "balance in your account is" + this.balance);
}
//@override
public void setPin() {
Scanner sc = new Scanner(System.in);
if(this.pin==0) {
System.out.println(" please enter your pin");
int pin= sc.nextInt();
this.pin=pin;
}
else {
System.out.println("update your pin please enter your phone num starts with "+this.phum.substring(0,3) );
String phum= sc.next();
if ( this.phum==phum) {
System.out.println(" your pin num is" + this.pin);
}else {
System.out.println( "inavalid phum num");
}
}
}
// @ override
public boolean validate() {
if(this.pin!=0) {
Scanner sc = new Scanner (System.in);
System.out.println(" enter your pin");
int pin= sc.nextInt();
if(this.pin==pin) {
return true;
}else {
System.out.println("invalid pin");
}
}else {
System.out.println( "please set pin first");
}
return false;
}
// @override deposit
public void deposit( double amount) {
if (amount >= 0) {
System.out.println( "depositing");
this.balance=balance+amount;
System.out.println(" depositing successfull");
}else {
System.out.println("incorrect amount");
}
}
// @override withdraw
public double withdraw(double amount) {
if(validate()) {
System.out.println("please enter your amount");
if(this.balance>=amount) {
this.balance=balance-amount;
System.out.println("please collect your cash");
return amount;
}
else {
System.out.println(" insufficient bal");
}
}else {
System.out.println("inavalid amount");
}
return 0;
}
} | [
"harithasiripireddy@gmail.com"
] | harithasiripireddy@gmail.com |
c3e3bf6e200e105a386f984cfede47d94e71e2cc | bc745f88991a71a6c93d555ff5be1834f47fda9c | /src/test/java/org/datastructure/sort/quick/QuickSortTest.java | 956c1e1e9c79198c5429057127fbe89cf63c8a8c | [] | no_license | 7u4/datastructure | a93869c2628bba4ca5e5efa796af8523b508af60 | 5e017ba495139bafd2aaaa5459ec4dab0485f32f | refs/heads/master | 2020-03-31T20:13:26.520574 | 2018-10-10T23:20:12 | 2018-10-10T23:20:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package org.datastructure.sort.quick;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
public class QuickSortTest {
@Test
public void sort1() {
int[] elements = {1, 4, 6, 8, 2, 3, 5, 7};
QuickSort.sort(elements);
assertArrayEquals(new int[]{1, 2, 3, 4, 5, 6, 7, 8}, elements);
}
@Test
public void sort2() {
int[] elements = {1, 2};
QuickSort.sort(elements);
assertArrayEquals(new int[]{1, 2}, elements);
}
@Test
public void sort3() {
int[] elements = {2, 1};
QuickSort.sort(elements);
assertArrayEquals(new int[]{1, 2}, elements);
}
@Test
public void sort4() {
int[] elements = {3, 2, 1};
QuickSort.sort(elements);
assertArrayEquals(new int[]{1, 2, 3}, elements);
}
@Test
public void sort5() {
int[] elements = {4, 3, 2, 1};
QuickSort.sort(elements);
assertArrayEquals(new int[]{1, 2, 3, 4}, elements);
}
@Test
public void sort6() {
int[] elements = {6, 5, 8, 7, 3, 4, 2, 1};
QuickSort.sort(elements);
assertArrayEquals(new int[]{1, 2, 3, 4, 5, 6, 7, 8}, elements);
}
} | [
"mikematsumoto@gmail.com"
] | mikematsumoto@gmail.com |
89e1c81b540239ad47af9fef647dd584bccdf974 | 345fedb01a883c98a55fbd2d96cfc89db161318d | /bin/custom/keyruspoc/keyruspoccore/testsrc/br/com/keyrus/poc/core/job/TicketsRetentionCronJobIntegrationTest.java | b943594855ae72e307600d4bdc7d5cda78deb48e | [] | no_license | ironbats/keyrus-poc | 81d695be0fabfb3db28eb14100a37f8e0118eeca | 0f18b05c4c1aa02bb452e77ee7b366942058e9a9 | refs/heads/master | 2022-04-25T17:20:10.411146 | 2019-08-20T17:24:38 | 2019-08-20T17:24:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,857 | java | /*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*/
package br.com.keyrus.poc.core.job;
import de.hybris.bootstrap.annotations.IntegrationTest;
import de.hybris.platform.servicelayer.ServicelayerTest;
import de.hybris.platform.servicelayer.cronjob.CronJobService;
import de.hybris.platform.servicelayer.i18n.I18NService;
import de.hybris.platform.servicelayer.model.ModelService;
import de.hybris.platform.servicelayer.search.FlexibleSearchService;
import de.hybris.platform.site.BaseSiteService;
import de.hybris.platform.ticket.enums.CsTicketState;
import de.hybris.platform.ticket.model.CsTicketModel;
import org.junit.Before;
import org.junit.Test;
import javax.annotation.Resource;
import java.util.Locale;
import static org.junit.Assert.*;
@IntegrationTest
public class TicketsRetentionCronJobIntegrationTest extends ServicelayerTest
{
private static final String TEST_BASESITE_UID = "testSite";
@Resource
private BaseSiteService baseSiteService;
@Resource
private FlexibleSearchService flexibleSearchService;
@Resource
private I18NService i18NService;
@Resource
private CronJobService cronJobService;
@Resource
private ModelService modelService;
@Before
public void setup() throws Exception
{
createCoreData();
baseSiteService.setCurrentBaseSite(baseSiteService.getBaseSiteForUID(TEST_BASESITE_UID), false);
importCsv("/keyruspoccore/import/common/cronjobs.impex", "utf-8");
importCsv("/keyruspoccore/test/testTicketRetentionCronJob.impex", "utf-8");
i18NService.setCurrentLocale(Locale.ENGLISH);
}
@Test
public void testTicketsRetentionCronJob()
{
// order to be removed
final CsTicketModel ticketModelTemplate = new CsTicketModel();
ticketModelTemplate.setTicketID("test-ticket-7");
final CsTicketModel ticketModel = flexibleSearchService.getModelByExample(ticketModelTemplate);
assertNotNull("Comments", ticketModel.getComments());
assertEquals("State", CsTicketState.CLOSED, ticketModel.getState());
assertNotNull("RetentionDate", ticketModel.getRetentionDate());
cronJobService.performCronJob(cronJobService.getCronJob("ticketsRetentionCronJob"), true);
// ticket to be removed
assertTrue("test-ticket-7 removed", modelService.isRemoved(ticketModel));
// ticket not to be removed
final CsTicketModel ticketModelTemplate2 = new CsTicketModel();
ticketModelTemplate2.setTicketID("test-ticket-6");
final CsTicketModel ticketNotToBeRemoved = flexibleSearchService.getModelByExample(ticketModelTemplate2);
assertTrue("CsTicket not null", ticketNotToBeRemoved != null);
assertFalse("CsTicket not removed", modelService.isRemoved(ticketNotToBeRemoved));
}
}
| [
"felipe.rodrigues@keyrus.com.br"
] | felipe.rodrigues@keyrus.com.br |
2fddd1a39fe99ad86988ad2927715b24dc43d050 | 7abcc7b4262156b1d5e056fda22e2a764f104ac4 | /IM 91-2015 Bolesnikov Stefan/src/drawing/Point.java | 12783709ac839a9aa1c4ffbf4b56a1720aa1a06b | [] | no_license | Stele96/JavaPaintFinal | a6af28eaa36491d4564b674b323955ddbe24b783 | 1475fe5b23883e0319a24210d145693082d63cdb | refs/heads/master | 2020-06-03T01:23:24.413647 | 2019-06-11T13:24:13 | 2019-06-11T13:24:13 | 191,375,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,660 | java | package drawing;
import java.awt.Color;
import java.awt.Graphics;
public class Point extends Shapes {
//promenljive su private
//metode su public
private int x;
private int y;
private boolean selected;
//konstruktor je metoda koja sluzi za kreiranje objekata ona je public i ima isto ime kao i ime klase
//ne mozemo imati dva ista kontruktora sa istim parametrima i sluzi za postavljanje vrednosti
//ovo ispod je prazan konstruktor ako ne prosledis parametre nikakve
public Point () {
}
public Point (int x,int y) {
this.x = x; //desni x je ovaj u zagradi a levi je gore
this.y = y;
}
public Point (int x, int y, boolean selected) {
this(x,y); //ova linija mora da bude prva jer je kao ovo gore pa uzima od toga samo je dodato
this.selected = selected;
}
//get i set su public metode za pristup i postavljanje vrednosti
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
public String toString() {
return "Point [x= " + x + " , y= " + y + " , selected= " + selected + "]";
}
@Override
public int compareTo(Object o) { //od kordinatnog pocetka uporedjuje tacke
// TODO Auto-generated method stub
return 0;
}
@Override
public void draw(Graphics g) {
g.setColor(getOutline());
g.drawLine(this.getX()-2, this.getY(), this.getX()+2, this.getY());
g.drawLine(this.getX(), this.getY()-2, this.getX(), this.getY()+2);
if(isSelected()==true) {
g.setColor(Color.black);
g.drawRect(this.getX()-3, this.getY()-3, 6, 6);
}
}
@Override
public boolean contains(int x, int y) {
if(this.distance(x, y)<=3) {
return true;
} else {
return false;
}
}
public double distance(int x, int y) {
double dx = this.x - x;
double dy = this.y - y;
double d = Math.sqrt(dx*dx+dy*dy);
return d;
}
@Override
public void DialogEdit() {
DlgPoint dlgPoint = new DlgPoint();
for (Shapes shapes : PnlDrawing.shapesArrList) {
if (shapes.isSelected()) {
String[] split = shapes.toString().split(" ");
dlgPoint.getTxtXPoint().setText(split[2]);
dlgPoint.getTxtYPoint().setText(split[5]);
}
}
dlgPoint.setVisible(true);
}
@Override
public void move(int newX, int newY) {
this.x = newX;
this.y = newY;
}
@Override
public void AreaPainter(Graphics g) {
// TODO Auto-generated method stub
}
}
| [
"Stele@SteleWindows"
] | Stele@SteleWindows |
9ae2cd62b88de8f71f3330c56638cc6e8df89877 | 017a2b3b4d02e0758bdd2375beb8929e78c5d251 | /src/main/java/com/sec/admin/controller/RestBoardController.java | 9f0adc17ca5397c42338df5bbd68bb379ce1fbf3 | [] | no_license | parduck/springboot | 11d34c16ab2ead4c8cee0f7e9396d37a2f7673cb | d64512efbc5b834ca3bb64751f76a1da37002bfa | refs/heads/master | 2020-12-06T19:34:43.751767 | 2020-02-13T10:49:04 | 2020-02-13T10:49:04 | 232,534,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,894 | java | package com.sec.admin.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sec.domain.Board;
import com.sec.domain.BoardV;
import com.sec.repo.BoardRepository;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RestController
public class RestBoardController {
public RestBoardController() {
System.out.println("===>BoardController created..");
}
@GetMapping("/getRestBoard")
public BoardV getBoard() {
BoardV board = new BoardV();
board.setSeq(1);
board.setTitle("test");
board.setWriter("kim");
board.setContent("test contents123...");
board.setCreateDate(new Date());
board.setCnt(0);
return board;
}
@GetMapping("/getRestBoardList")
public List<BoardV> getBoardList() {
List<BoardV> boardList = new ArrayList<BoardV>();
for (int i=1;i<=10;i++) {
BoardV board = new BoardV();
board.setSeq(i);
board.setTitle("test"+i);
board.setWriter("kim");
board.setContent(i+ "번 test contents...");
board.setCreateDate(new Date());
board.setCnt(0);
boardList.add(board);
}
return boardList;
}
@Autowired
private BoardRepository boardRepo;
@GetMapping("/setBoardDB")
public List<Board> setBoardDB() {
Board board = new Board();
board.setSeq(1L);
board.setTitle("test");
//board.setId("kim");
board.setContent("test contents123...");
board.setCreateDate(new Date());
board.setCnt(0L);
boardRepo.save(board);
return boardRepo.findAll();
}
@GetMapping("/getBoardDB")
public List<Board> getBoardDB() {
return boardRepo.findAll();
}
}
| [
"videoal@gmail.com"
] | videoal@gmail.com |
3463f6fe1e53ed3b380c6bf0c2b5d70c09214c9c | 5b8a046511d4950d384c459367e7e64afb7d1b56 | /app/src/main/java/com/tdr/registration/update/Util.java | 2ed916b57ea2db8aa250efe6a58c7a87f84afcac | [] | no_license | KingJA/Registration | 4bd040ccddcbf3bd4242b85830ef8ed4b42e697a | d4d6a30597201f34d0efd8d9e946f339da464e2f | refs/heads/master | 2020-03-11T23:45:39.821158 | 2018-07-13T05:58:50 | 2018-07-13T05:58:50 | 130,331,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,874 | java | package com.tdr.registration.update;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.util.Log;
import com.tdr.registration.util.mLog;
import java.io.File;
import java.io.IOException;
import static android.os.Environment.MEDIA_MOUNTED;
/**
* 项目名称:物联网城市防控(警用版)
* 类描述:TODO
* 创建人:KingJA
* 创建时间:2016/4/1 14:56
* 修改备注:
*/
public class Util {
private static final String EXTERNAL_STORAGE_PERMISSION = "android.permission.WRITE_EXTERNAL_STORAGE";
private static PackageInfo getAppInfo(Context context) {
PackageInfo packageInfo = null;
try {
packageInfo = context.getPackageManager().getPackageInfo(
context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return packageInfo;
}
public static int getVersionCode(Context context) {
return getAppInfo(context).versionCode;
}
public static String getVersionName(Context context) {
return getAppInfo(context).versionName;
}
public static boolean ifNeedUpdate(int versionCode, Context context) {
mLog.e("versionCode="+versionCode+" getVersionCode="+getVersionCode(context));
return versionCode > getVersionCode(context);
}
public static File getCacheDirectory(Context context) {
File appCacheDir = null;
if (MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && hasExternalStoragePermission(context)) {
appCacheDir = getExternalCacheDir(context);
}
if (appCacheDir == null) {
appCacheDir = context.getCacheDir();
}
if (appCacheDir == null) {
Log.w("StorageUtils", "Can't define system cache directory! The app should be re-installed.");
}
return appCacheDir;
}
private static File getExternalCacheDir(Context context) {
File dataDir = new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data");
//File appCacheDir = new File(new File(dataDir, context.getPackageName()), "cache");
File appCacheDir = new File(dataDir, context.getPackageName());
if (!appCacheDir.exists()) {
if (!appCacheDir.mkdirs()) {
return null;
}
try {
new File(appCacheDir, ".nomedia").createNewFile();
} catch (IOException e) {
}
}
return appCacheDir;
}
private static boolean hasExternalStoragePermission(Context context) {
int perm = context.checkCallingOrSelfPermission(EXTERNAL_STORAGE_PERMISSION);
return perm == PackageManager.PERMISSION_GRANTED;
}
}
| [
"kingjavip@gmail.com"
] | kingjavip@gmail.com |
1ce9cd998fe82e1b2d6c91e712314eef60b0452a | 44686db49098018ee043b0c86b5aa26e7da3cd00 | /FactoryPattern/src/AmericanBurger.java | 37bf83205bd6fa1e3a55b18865e14f9a24bcf8a9 | [] | no_license | huanqwer/design-patterns | 006bf7ed5c278b8c0afa9fde5604e40167d41643 | dc83e09982cf90b144b3d2143806f8674c5c18fe | refs/heads/master | 2020-09-05T14:06:28.341173 | 2020-03-15T06:21:17 | 2020-03-15T06:21:17 | 220,128,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | // 美国汉堡
public class AmericanBurger implements Food{
@Override
public void printName() {
System.out.println("美国汉堡真香");
}
}
| [
"wx_00daa364b23d41758a0230342234419a@git.code.tencent.com"
] | wx_00daa364b23d41758a0230342234419a@git.code.tencent.com |
dc4eb9d4c13aa3f80ac5702a4e930f51d820c397 | c813c5a13d4c6e82247377021223f287fa7b328c | /src/GestionEntreeSortie/GestionAutorisationHelper.java | 4dbd80375a5f69e0c07dab207654117d0cbd1ee0 | [] | no_license | LeaMiage/GestionAcces | 92caa9ed81c4b5a518dac8ead96e3a45912e6a54 | 106eca1d995f4d9892ae2dfd9c129a7be6033a51 | refs/heads/master | 2021-01-17T13:01:38.117561 | 2016-06-24T13:41:21 | 2016-06-24T13:41:21 | 58,140,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,792 | java | package GestionEntreeSortie;
/**
* Helper class for : GestionAutorisation
*
* @author OpenORB Compiler
*/
public class GestionAutorisationHelper
{
/**
* Insert GestionAutorisation into an any
* @param a an any
* @param t GestionAutorisation value
*/
public static void insert(org.omg.CORBA.Any a, GestionEntreeSortie.GestionAutorisation t)
{
a.insert_Object(t , type());
}
/**
* Extract GestionAutorisation from an any
* @param a an any
* @return the extracted GestionAutorisation value
*/
public static GestionEntreeSortie.GestionAutorisation extract(org.omg.CORBA.Any a)
{
if (!a.type().equal(type()))
throw new org.omg.CORBA.MARSHAL();
try {
return GestionEntreeSortie.GestionAutorisationHelper.narrow(a.extract_Object());
} catch (final org.omg.CORBA.BAD_PARAM e) {
throw new org.omg.CORBA.MARSHAL(e.getMessage());
}
}
//
// Internal TypeCode value
//
private static org.omg.CORBA.TypeCode _tc = null;
/**
* Return the GestionAutorisation TypeCode
* @return a TypeCode
*/
public static org.omg.CORBA.TypeCode type()
{
if (_tc == null) {
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
_tc = orb.create_interface_tc(id(),"GestionAutorisation");
}
return _tc;
}
/**
* Return the GestionAutorisation IDL ID
* @return an ID
*/
public static String id()
{
return _id;
}
private final static String _id = "IDL:GestionEntreeSortie/GestionAutorisation:1.0";
/**
* Read GestionAutorisation from a marshalled stream
* @param istream the input stream
* @return the readed GestionAutorisation value
*/
public static GestionEntreeSortie.GestionAutorisation read(org.omg.CORBA.portable.InputStream istream)
{
return(GestionEntreeSortie.GestionAutorisation)istream.read_Object(GestionEntreeSortie._GestionAutorisationStub.class);
}
/**
* Write GestionAutorisation into a marshalled stream
* @param ostream the output stream
* @param value GestionAutorisation value
*/
public static void write(org.omg.CORBA.portable.OutputStream ostream, GestionEntreeSortie.GestionAutorisation value)
{
ostream.write_Object((org.omg.CORBA.portable.ObjectImpl)value);
}
/**
* Narrow CORBA::Object to GestionAutorisation
* @param obj the CORBA Object
* @return GestionAutorisation Object
*/
public static GestionAutorisation narrow(org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
if (obj instanceof GestionAutorisation)
return (GestionAutorisation)obj;
if (obj._is_a(id()))
{
_GestionAutorisationStub stub = new _GestionAutorisationStub();
stub._set_delegate(((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate());
return stub;
}
throw new org.omg.CORBA.BAD_PARAM();
}
/**
* Unchecked Narrow CORBA::Object to GestionAutorisation
* @param obj the CORBA Object
* @return GestionAutorisation Object
*/
public static GestionAutorisation unchecked_narrow(org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
if (obj instanceof GestionAutorisation)
return (GestionAutorisation)obj;
_GestionAutorisationStub stub = new _GestionAutorisationStub();
stub._set_delegate(((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate());
return stub;
}
}
| [
"lea.cheoux@gmail.com"
] | lea.cheoux@gmail.com |
c8d3294f7545391109a490ddb9e16a704c4b1b3e | 1143905c705d1a4dee9b3452c9eeca4c3b0dbf12 | /JwtSpringSecurity/src/main/java/com/example/JwtSpringSecurity/config/SecurityConfigurer.java | 27357820c671f7eec3ce477c067b53e99f432923 | [] | no_license | xebia-utkarsh/Covid-Complliance | 33986e5c58d67169fbca13d412f81da13c20987e | e1df315d9325de8627ef2e81613a0dfc6c9ee666 | refs/heads/master | 2022-11-11T06:25:42.137288 | 2020-06-30T13:46:39 | 2020-06-30T13:46:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,352 | java | package com.example.JwtSpringSecurity.config;
import com.example.JwtSpringSecurity.filters.JwtRequestFilter;
import com.example.JwtSpringSecurity.service.MyUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfigurer extends WebSecurityConfigurerAdapter {
@Autowired
private MyUserDetailsService myUserDetailsService;
@Autowired
private JwtRequestFilter jwtRequestFilter;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(myUserDetailsService);
}
protected void configure(HttpSecurity http) throws Exception{
http.csrf().disable()
.authorizeRequests().antMatchers("/password").permitAll()
.antMatchers("/username").permitAll()
.anyRequest().authenticated()
.and().sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public PasswordEncoder passwordEncoder(){
return NoOpPasswordEncoder.getInstance();
}
}
| [
"jhanak.bhargava@xebia.com"
] | jhanak.bhargava@xebia.com |
0130beee9e7b13b545cdbff55079c103ef4e904b | 7ad0e7a48f050397ff1d1612a1f8a61b9320f00c | /mywebstore/src/main/java/com/packt/webstore/domain/repository/ProductRepository.java | b407ae8de31bd49aa8ab63525a661f0574ff7d04 | [] | no_license | psycrosis/SWS801_Work | a6277139caf0ce887c27f49fa7e751cace2ebb70 | 35dbf74418bf004369929f809e0f257cc895e94b | refs/heads/master | 2021-01-01T05:39:18.736223 | 2015-04-21T00:42:43 | 2015-04-21T00:42:43 | 29,783,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.packt.webstore.domain.repository;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.packt.webstore.domain.Product;
public interface ProductRepository {
void addProduct(Product product);
List <Product> getAllProducts();
Product getProductById(String productID);
List<Product> getProductsByCategory(String category);
Set<Product> getProductsByFilter(Map<String, List<String>> filterParams);
void removeProduct(Product product);
}
| [
"spooner@outlook.com"
] | spooner@outlook.com |
045ae1944cf38fb513d668469923bc7de3446a50 | b315de266e7f6ab54567af1b24aae47606031fc3 | /Mentoring_11-27-18/src/com/peoplentech/SmartPhone.java | add06beff40954b0b122a48fa1dd8013c0d50d1c | [] | no_license | Mridue/Mentoring-Project | 879ed4a2eb96c13d58864b65d3b7892f32532181 | 5e4947530a43045b90b4f385a554f2ab1a70578a | refs/heads/master | 2020-04-08T13:57:48.233273 | 2018-11-27T23:58:26 | 2018-11-27T23:58:26 | 159,415,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package com.peoplentech;
public class SmartPhone {
// final String TYPE="Smart Phone";
String OS = "MicroSoft";
int imei = 1010101;
int displaySize = 4;
String brand = "Generic";
int memory;
String model;
public SmartPhone() {
}
public SmartPhone(String brand, int memory) {
this.brand = brand;
this.memory = memory;
}
public SmartPhone(String brand, int memory, String model) {
this.brand = brand;
this.memory = memory;
this.model = model;
}
// public void getType() {System.out.println(TYPE);}
public void getOs() {
System.out.println(OS);
}
public int getImei(int serialNumber) {
System.out.println(serialNumber);
return imei;
}
public void getDisplaySize() {
System.out.println(displaySize);
}
public void getBrand() {
System.out.println(brand);
}
public int getMemory() {
System.out.println(memory);
return memory;
}
public void getModel() {
System.out.println(model);
}
}
// public static void main(String [] args) {
// SmartPhone.getOs();
// System.out.println(OS);}}
// OS="google";
// System.out.println(OS);
// System.out.println(TYPE);
// TYPE="landphone";
| [
"Mridue"
] | Mridue |
9273c8770ef482df9b07d29336ab7edf82ace4ae | 4efec00239177eec2dd258530ed4c874529b350a | /src/com/thms/service/InvoiceServiceImpl.java | 8b626d09e4653aab7e369cd148aa8c5f90df052c | [] | no_license | pwt-team/thms | 1ef88b679ae10ed7bb26b11e3a555a64848ac5f9 | 245ba8e28f1133ad28de7470491420553033bc89 | refs/heads/master | 2016-09-15T22:42:18.908510 | 2015-06-25T16:17:45 | 2015-06-25T16:17:45 | 37,857,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.thms.service;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.thms.bean.Invoice;
import com.thms.dao.InvoiceDao;
@Service
public class InvoiceServiceImpl implements InvoiceService {
@Autowired
public InvoiceDao invoiceDao;
@Override
public Invoice findInvoice(Integer id) {
if(id==null) return null;
return invoiceDao.findInvoice(id);
}
@Override
public Invoice findInvoice(String name,Integer uid) {
if(StringUtils.isEmpty(name) && uid != null ) return null;
return invoiceDao.findInvoice(name,uid);
}
@Override
public Invoice create(Invoice invoice) {
if(invoice == null) return null;
return invoiceDao.save(invoice);
}
@Override
public Invoice update(Invoice invoice) {
if(invoice == null) return null;
return invoiceDao.update(invoice);
}
@Override
public List<Invoice> findInvoices(Integer uid) {
if(uid == null) return null;
return invoiceDao.findInvoices(uid);
}
}
| [
"yuanzhongc@126.com"
] | yuanzhongc@126.com |
e845ef5eb650327bc2f61e54b0229bf286b944db | 8d945f75af4302cd081b4edc46632e4d889ed116 | /app/src/test/java/in/sp/dialoganimation/ExampleUnitTest.java | 0297b4d1116e30d2d0774c1d3e32a0d0ed883da0 | [] | no_license | sunilparmar04/Dialoganimation | fe07252d82af0358142ecb182a6a79c0be03c003 | 636eff48049735d488c51f945b18f31b3f90447f | refs/heads/master | 2020-04-22T16:26:42.808943 | 2019-02-13T12:55:14 | 2019-02-13T12:55:14 | 170,507,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package in.sp.dialoganimation;
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() {
assertEquals(4, 2 + 2);
}
} | [
"parmarsunil09@gmail.com"
] | parmarsunil09@gmail.com |
99c16424dc630442ba615fa74135db0cac0cf4cf | e54b518540f11670a7e347a0c54ca6262596d80e | /app/src/main/java/com/example/w028006g/regnlogin/activity/SettingsActivity.java | 0067c1bf713e6e07379819e5d6fbeedb3f3bcaad | [] | no_license | GamesB2/StokeWayfinder | 7154ab57f9c8f599a480399a04c4e2a8bfb98777 | 6c49756625b23e282486b23f043620d50572b488 | refs/heads/master | 2021-06-20T03:41:09.170729 | 2017-07-26T16:01:12 | 2017-07-26T16:01:12 | 93,416,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,655 | java | package com.example.w028006g.regnlogin.activity;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.RingtonePreference;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.text.TextUtils;
import android.view.MenuItem;
import com.example.w028006g.regnlogin.AppCompatPreferenceActivity;
import com.example.w028006g.regnlogin.R;
import java.util.List;
/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
* <p>
* See <a href="http://developer.android.com/design/patterns/settings.html">
* Android Design: Settings</a> for design guidelines and the <a
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
* API Guide</a> for more information on developing a Settings UI.
*/
public class SettingsActivity extends AppCompatPreferenceActivity
{
/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(
index >= 0
? listPreference.getEntries()[index]
: null);
} else if (preference instanceof RingtonePreference) {
// For ringtone preferences, look up the correct display value
// using RingtoneManager.
if (TextUtils.isEmpty(stringValue)) {
// Empty values correspond to 'silent' (no ringtone).
preference.setSummary(R.string.pref_ringtone_silent);
} else {
Ringtone ringtone = RingtoneManager.getRingtone(
preference.getContext(), Uri.parse(stringValue));
if (ringtone == null) {
// Clear the summary if there was a lookup error.
preference.setSummary(null);
} else {
// Set the summary to reflect the new ringtone display
// name.
String name = ringtone.getTitle(preference.getContext());
preference.setSummary(name);
}
}
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
};
/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
// Trigger the listener immediately with the preference's
// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getString(preference.getKey(), ""));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
}
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
private void setupActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
// Show the Up button in the action bar.
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
if (!super.onMenuItemSelected(featureId, item)) {
NavUtils.navigateUpFromSameTask(this);
}
return true;
}
return super.onMenuItemSelected(featureId, item);
}
/**
* {@inheritDoc}
*/
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this);
}
/**
* {@inheritDoc}
*/
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<PreferenceActivity.Header> target) {
loadHeadersFromResource(R.xml.pref_headers, target);
}
/**
* This method stops fragment injection in malicious applications.
* Make sure to deny any unknown fragments here.
*/
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|| DataSyncPreferenceFragment.class.getName().equals(fragmentName)
|| NotificationPreferenceFragment.class.getName().equals(fragmentName);
}
/**
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class GeneralPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("example_text"));
bindPreferenceSummaryToValue(findPreference("example_list"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
/**
* This fragment shows notification preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class NotificationPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_notification);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
/**
* This fragment shows data and sync preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class DataSyncPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_data_sync);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
}
| [
"will.carnall@gmail.com"
] | will.carnall@gmail.com |
63cc83de56bef66a9ccc73033c78269102b976fa | 4763914624b154d61d3ea56f7b3ccf36c674a874 | /FlyWeight/src/FlyWeightExample/Letter.java | f1b7709703a21128bc405f7aec89615e77aadc00 | [] | no_license | khayrulislam/Design-Pattern | 6bfebf0ac5ebc740d9a0988f9d3e939c00a54056 | 8d01e5538edfaa453ea5ac957468bcce6ac9d294 | refs/heads/master | 2021-04-15T16:36:11.124851 | 2018-05-02T10:58:42 | 2018-05-02T10:58:42 | 126,529,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package FlyWeightExample;
import java.awt.Color;
public class Letter {
private String name;
private Color color;
private int size;
public Letter(String name) {
this.name = name;
}
public String getName() {
return name;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
}
| [
"khayrul.atiq@gmail.com"
] | khayrul.atiq@gmail.com |
b834e75c2e910ceeb50fa39817e0e4b8789051b8 | 76d0eb288d388b3d61f8b7f6d655f4b3ba58859a | /mejor-cocina-data/src/main/java/com/conexia/entities/WaiterEntity.java | c56a62d50090371aa363d0ab55ab063f0d63157d | [] | no_license | jalarconma/sbApplicationTest | d48ff148b96cb1bbbcf847c0190979f66683e510 | 83dd1b17b5defe0f7d0b77842e3fd6d507166826 | refs/heads/master | 2023-01-27T13:36:12.484291 | 2019-06-06T04:23:00 | 2019-06-06T04:23:00 | 190,511,124 | 0 | 0 | null | 2023-01-07T06:08:07 | 2019-06-06T03:58:38 | Java | UTF-8 | Java | false | false | 1,139 | java | package com.conexia.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name = "WAITER")
public class WaiterEntity extends BaseEntity {
private static final long serialVersionUID = 2493937053645232029L;
@Id
@GeneratedValue(generator = "waiter_generator")
@SequenceGenerator(name = "client_generator", sequenceName = "waiter_sequence")
private Integer id;
private String name;
private String firstLastName;
private String secondLastName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstLastName() {
return firstLastName;
}
public void setFirstLastName(String firstLastName) {
this.firstLastName = firstLastName;
}
public String getSecondLastName() {
return secondLastName;
}
public void setSecondLastName(String secondLastName) {
this.secondLastName = secondLastName;
}
}
| [
"jalarcon@bluesoft.com.co"
] | jalarcon@bluesoft.com.co |
75209ffdc503d71e49894b06b3aee73407647c17 | 3a06f0030a85559e72cfe7e27487de091a8d17df | /RemoteControl/src/lightsRControl/Command.java | b97e6a387f2a3c5230db2c6959305ab934b7efb7 | [] | no_license | edzzn/java-sandbox | ddb83c8cc02b7315f1b44f7c72a0fb9107104e11 | a482e43d980ce1cf90334b5e0acff9e2f9d6304d | refs/heads/master | 2021-01-18T15:39:27.432015 | 2017-11-14T20:51:59 | 2017-11-14T20:51:59 | 86,667,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | 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 lightsRControl;
/**
*
* @author Estudiante
*/
public interface Command {
public void execute();
}
| [
"noreply@github.com"
] | noreply@github.com |
060847035b162547071b4317805b4f1b6234986f | f42264e8b0ae13e6776f79caab99d51cdd6633d6 | /SmartContactManager/src/main/java/com/thymleaf/smartcontactmanager/config/MyConfig.java | a97d1fe76d5a405d2fea0ff2a745689fbf5d1591 | [] | no_license | Aptayu/Smart-Contact-Manager | 6ee185f779cc7a71c149c0977f600a78a344d727 | 7b38d3787d8e708e787ccb5487ccd1eee254f432 | refs/heads/main | 2023-07-05T19:17:21.847521 | 2021-08-22T11:52:22 | 2021-08-22T11:52:22 | 390,253,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,936 | java | package com.thymleaf.smartcontactmanager.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Configuration
@EnableWebSecurity
public class MyConfig extends WebSecurityConfigurerAdapter {
@Bean
public UserDetailsService getUserDetailsService() {
return new ContactUserDetailsServiceImpl();
}
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public DaoAuthenticationProvider authenticationProvider() {
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
daoAuthenticationProvider.setUserDetailsService(this.getUserDetailsService());
daoAuthenticationProvider.setPasswordEncoder(passwordEncoder());
return daoAuthenticationProvider;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authenticationProvider());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/admin/**").hasRole("ADMIN").antMatchers("/user/**").hasRole("USER")
.antMatchers("/**").permitAll().and().formLogin().loginPage("/signin").loginProcessingUrl("/dologin")
.defaultSuccessUrl("/user/index").and().csrf().disable();
}
}
| [
"arpitarga@gmail.com"
] | arpitarga@gmail.com |
46060e39c87a46230880f83a0d71f24ee9fcebe0 | 4124f0be276f3c1b5c2ae324f1aa66d5e866de64 | /app/src/main/java/edu/csuchico/facematchroster/util/GoogleLogin.java | 842179d296733fa871d711a09730eeb2bb79dc19 | [] | no_license | pedrosobral/face-match-roster | 8f51570c2c775462f83a0ca86023a0973e8c0d7b | 8d404b9cc02282f701dd837d51c83d464bb79a62 | refs/heads/master | 2020-07-03T05:23:22.237707 | 2015-05-13T06:06:00 | 2015-05-13T06:06:00 | 201,798,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,653 | java | package edu.csuchico.facematchroster.util;
import android.app.Activity;
import android.app.Dialog;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.model.people.Person;
import edu.csuchico.facematchroster.R;
import static edu.csuchico.facematchroster.util.LogUtils.LOGD;
import static edu.csuchico.facematchroster.util.LogUtils.LOGE;
import static edu.csuchico.facematchroster.util.LogUtils.LOGI;
import static edu.csuchico.facematchroster.util.LogUtils.LOGW;
/**
* Demonstrates Google+ Sign-In and usage of the Google+ APIs to retrieve a
* users profile information.
*/
public class GoogleLogin extends Activity implements
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
// Auth scopes we need
public static final String AUTH_SCOPES[] = {
"profile",
"email"};
static final String AUTH_TOKEN_TYPE;
private static final String TAG = LogUtils.makeLogTag(GoogleLogin.class);
private static final int STATE_DEFAULT = 0;
private static final int STATE_SIGN_IN = 1;
private static final int STATE_IN_PROGRESS = 2;
private static final int RC_SIGN_IN = 0;
private static final String SAVED_PROGRESS = "sign_in_progress";
static {
StringBuilder sb = new StringBuilder();
sb.append("oauth2:");
for (String scope : AUTH_SCOPES) {
sb.append(scope);
sb.append(" ");
}
AUTH_TOKEN_TYPE = sb.toString();
}
// Name of the account to log in as (e.g. "foo@example.com")
String mAccountName;
// GoogleApiClient wraps our service connection to Google Play services and
// provides access to the users sign in state and Google's APIs.
private GoogleApiClient mGoogleApiClient;
// We use mSignInProgress to track whether user has clicked sign in.
// mSignInProgress can be one of three values:
//
// STATE_DEFAULT: The default state of the application before the user
// has clicked 'sign in', or after they have clicked
// 'sign out'. In this state we will not attempt to
// resolve sign in errors and so will display our
// Activity in a signed out state.
// STATE_SIGN_IN: This state indicates that the user has clicked 'sign
// in', so resolve successive errors preventing sign in
// until the user has successfully authorized an account
// for our app.
// STATE_IN_PROGRESS: This state indicates that we have started an intent to
// resolve an error, and so we should not start further
// intents until the current intent completes.
private int mSignInProgress;
// Used to store the PendingIntent most recently returned by Google Play
// services until the user clicks 'sign in'.
private PendingIntent mSignInIntent;
// Used to store the error code most recently returned by Google Play services
// until the user clicks 'sign in'.
private int mSignInError;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LOGD(TAG, "onCreate()");
if (savedInstanceState != null) {
mSignInProgress = savedInstanceState
.getInt(SAVED_PROGRESS, STATE_DEFAULT);
}
mGoogleApiClient = buildGoogleApiClient();
}
private GoogleApiClient buildGoogleApiClient() {
// When we build the GoogleApiClient we specify where connected and
// connection failed callbacks should be returned, which Google APIs our
// app uses and which OAuth 2.0 scopes our app requests.
GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this);
for (String scope : AUTH_SCOPES) {
builder.addScope(new Scope(scope));
}
builder.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API);
return builder.build();
}
@Override
protected void onStart() {
super.onStart();
LOGD(TAG, "onStart");
mGoogleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
LOGD(TAG, "onStop");
if (mGoogleApiClient.isConnected()) {
mGoogleApiClient.disconnect();
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(SAVED_PROGRESS, mSignInProgress);
}
public void connect() {
if (!mGoogleApiClient.isConnecting()) {
mSignInProgress = STATE_SIGN_IN;
mGoogleApiClient.connect();
}
}
public void signOut() {
// We clear the default account on sign out so that Google Play
// services will not return an onConnected callback without user
// interaction.
if (mGoogleApiClient.isConnected()) {
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
mGoogleApiClient.disconnect();
}
}
public void revokeAccess() {
// After we revoke permissions for the user with a GoogleApiClient
// instance, we must discard it and create a new one.
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
// Our sample has caches no user data from Google+, however we
// would normally register a callback on revokeAccessAndDisconnect
// to delete user data so that we comply with Google developer
// policies.
Plus.AccountApi.revokeAccessAndDisconnect(mGoogleApiClient);
mGoogleApiClient = buildGoogleApiClient();
mGoogleApiClient.connect();
}
/* onConnected is called when our Activity successfully connects to Google
* Play services. onConnected indicates that an account was selected on the
* device, that the selected account has granted any requested permissions to
* our app and that we were able to establish a service connection to Google
* Play services.
*/
@Override
public void onConnected(Bundle connectionHint) {
// Reaching onConnected means we consider the user signed in.
LOGI(TAG, "onConnected");
mAccountName = Plus.AccountApi.getAccountName(mGoogleApiClient);
LOGD(TAG, "Default to: " + mAccountName);
AccountUtils.setActiveAccount(getApplicationContext(), mAccountName);
// load user's Name, if we don't have it yet
if (!AccountUtils.hasPlusInfo(getApplicationContext(), mAccountName)) {
// Retrieve some profile information to personalize our app for the user.
LOGD(TAG, "We don't have Google+ info for " + mAccountName + " yet, so loading.");
Person person = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
if (person != null) {
LOGD(TAG, "Saving plus display name: " + person.getDisplayName());
AccountUtils.setPlusName(getApplicationContext(), mAccountName, person.getDisplayName());
}
} else {
LOGD(TAG, "No need for Name info, we already have it.");
}
// Indicate that the sign in process is complete.
mSignInProgress = STATE_DEFAULT;
}
/* onConnectionFailed is called when our Activity could not connect to Google
* Play services. onConnectionFailed indicates that the user needs to select
* an account, grant permissions or resolve an error in order to sign in.
*/
@Override
public void onConnectionFailed(ConnectionResult result) {
// Refer to the javadoc for ConnectionResult to see what error codes might
// be returned in onConnectionFailed.
LOGI(TAG, "onConnectionFailed: ConnectionResult.getErrorCode() = "
+ result.getErrorCode());
if (result.getErrorCode() == ConnectionResult.API_UNAVAILABLE) {
// An API requested for GoogleApiClient is not available. The device's current
// configuration might not be supported with the requested API or a required component
// may not be installed, such as the Android Wear application. You may need to use a
// second GoogleApiClient to manage the application's optional APIs.
LOGW(TAG, "API Unavailable.");
} else if (mSignInProgress != STATE_IN_PROGRESS) {
LOGD(TAG, "OnConnectionFailed: mSignInProgress != STATE_IN_PROGRESS");
// We do not have an intent in progress so we should store the latest
// error resolution intent for use when the sign in button is clicked.
mSignInIntent = result.getResolution();
mSignInError = result.getErrorCode();
if (mSignInProgress == STATE_SIGN_IN) {
LOGD(TAG, "OnConnectionFailed: mSignInProgress == STATE_SIGN_IN");
// STATE_SIGN_IN indicates the user already clicked the sign in button
// so we should continue processing errors until the user is signed in
// or they click cancel.
resolveSignInError();
}
}
// In this sample we consider the user signed out whenever they do not have
// a connection to Google Play services.
onSignedOut();
}
/* Starts an appropriate intent or dialog for user interaction to resolve
* the current error preventing the user from being signed in. This could
* be a dialog allowing the user to select an account, an activity allowing
* the user to consent to the permissions being requested by your app, a
* setting to enable device networking, etc.
*/
private void resolveSignInError() {
if (mSignInIntent != null) {
LOGD(TAG, "resolveSignInError()");
// We have an intent which will allow our user to sign in or
// resolve an error. For example if the user needs to
// select an account to sign in with, or if they need to consent
// to the permissions your app is requesting.
try {
// Send the pending intent that we stored on the most recent
// OnConnectionFailed callback. This will allow the user to
// resolve the error currently preventing our connection to
// Google Play services.
mSignInProgress = STATE_IN_PROGRESS;
startIntentSenderForResult(mSignInIntent.getIntentSender(),
RC_SIGN_IN, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
LOGI(TAG, "Sign in intent could not be sent: "
+ e.getLocalizedMessage());
// The intent was canceled before it was sent. Attempt to connect to
// get an updated ConnectionResult.
mSignInProgress = STATE_SIGN_IN;
mGoogleApiClient.connect();
}
} else {
// Google Play services wasn't able to provide an intent for some
// error types, so we show the default Google Play services error
// dialog which may still start an intent on our behalf if the
// user can resolve the issue.
createErrorDialog().show();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
LOGD(TAG, "onActivityResult()");
switch (requestCode) {
case RC_SIGN_IN:
if (resultCode == RESULT_OK) {
// If the error resolution was successful we should continue
// processing errors.
mSignInProgress = STATE_SIGN_IN;
} else {
// If the error resolution was not successful or the user canceled,
// we should stop processing errors.
mSignInProgress = STATE_DEFAULT;
}
if (!mGoogleApiClient.isConnecting()) {
// If Google Play services resolved the issue with a dialog then
// onStart is not called so we need to re-attempt connection here.
mGoogleApiClient.connect();
}
break;
}
}
private void onSignedOut() {
}
@Override
public void onConnectionSuspended(int cause) {
// The connection to Google Play services was lost for some reason.
// We call connect() to attempt to re-establish the connection or get a
// ConnectionResult that we can attempt to resolve.
mGoogleApiClient.connect();
}
private Dialog createErrorDialog() {
if (GooglePlayServicesUtil.isUserRecoverableError(mSignInError)) {
return GooglePlayServicesUtil.getErrorDialog(
mSignInError,
this,
RC_SIGN_IN,
new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
LOGE(TAG, "Google Play services resolution cancelled");
mSignInProgress = STATE_DEFAULT;
}
});
} else {
return new AlertDialog.Builder(this)
.setMessage(R.string.play_services_error)
.setPositiveButton(R.string.close,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
LOGE(TAG, "Google Play services error could not be "
+ "resolved: " + mSignInError);
mSignInProgress = STATE_DEFAULT;
}
}).create();
}
}
} | [
"paraujosobral@mail.csuchico.edu"
] | paraujosobral@mail.csuchico.edu |
cffda4214fd0421557e3c88576377b0659688422 | f8db2b0d1ebee80081fc1dd9b7f3bd9f46631cd9 | /app/src/main/java/com/lathiya/allinonecode/SQLLIte/ContectDetail.java | 82e5ec8efa5725c6657b8a5cf835dc4a18ba09d0 | [] | no_license | AndroidRL/myallcode | 972fc86f3066a6be35f98ad0b84bd34337f66836 | d043abdf668ad40ed1e3a9874fb3b5034920366c | refs/heads/master | 2023-01-02T23:42:04.849329 | 2020-11-05T05:39:21 | 2020-11-05T05:39:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,866 | java | //package com.lathiya.allinonecode.SQLLIte;
//
//import androidx.appcompat.app.AppCompatActivity;
//
//import android.os.Bundle;
//import android.view.Window;
//import android.view.WindowManager;
//import android.widget.TextView;
//
//public class ContectDetail extends AppCompatActivity {
//
// String uid, uid1, uid2, uid3, uid4, uid5, uid6, uid7, uid8, uid9;
// TextView mnumber, hnumber,cnumber;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_contect_detail);
//
// mnumber = findViewById(R.id.mnumber);
// hnumber = findViewById(R.id.hnumber);
// cnumber = findViewById(R.id.cnumber);
//
//
// //status colour
// if (android.os.Build.VERSION.SDK_INT >= 21) {
// Window window = this.getWindow();
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// window.setStatusBarColor(this.getResources().getColor(R.color.black));
// }
//
// Bundle bundle = getIntent().getExtras();
// if (bundle != null) {
//
//// uid = bundle.getString("gender");
// uid1 = bundle.getString("fname");
// uid2 = bundle.getString("mname");
// uid3 = bundle.getString("sname");
// uid4 = bundle.getString("mnumber");
// uid5 = bundle.getString("hnumber");
// uid6 = bundle.getString("cnumber");
// uid7 = bundle.getString("haddress");
// uid8 = bundle.getString("caddress");
// uid9 = bundle.getString("email");
//
// }
//
// mnumber.setText(uid4);
// hnumber.setText(uid5);
// cnumber.setText(uid6);
//
//
// }
//}
| [
"ravilathiya@009gmail.com"
] | ravilathiya@009gmail.com |
17dc65f3286d041c569abe66ed9bfbf72730d8ee | 1488ccbb7febb4fc5b9e7207c4a2e049db834e88 | /이것이자바다/src/챕터11_기본API클래스/햐_java/time클래스/ㄷ_날짜와시간을조작하기/ㄱ_빼기와더하기사용.java | 9c20f9c8fc80812bb14f04c03d40727c9cd250c4 | [] | no_license | whdnjsdyd111/backup | 2f818ed3b46d21ec3e56b9aeddc3185891ee5f4e | 0b4543d0a06c09baa71e131ce5ae3c61261e9187 | refs/heads/master | 2022-12-28T03:26:29.908848 | 2020-10-14T06:02:00 | 2020-10-14T06:02:00 | 291,588,410 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 515 | java | package 챕터11_기본API클래스.햐_java.time클래스.ㄷ_날짜와시간을조작하기;
import java.time.LocalDateTime;
public class ㄱ_빼기와더하기사용 {
public static void main(String[] args) {
LocalDateTime now = LocalDateTime.now();
System.out.println("현재시:" + now);
LocalDateTime targetDateTime = now
.plusYears(1)
.minusMonths(2)
.plusDays(3)
.plusHours(4)
.minusMinutes(5)
.plusSeconds(6);
System.out.println("연산 후: " + targetDateTime);
}
}
| [
"66655578+whdnjsdyd111@users.noreply.github.com"
] | 66655578+whdnjsdyd111@users.noreply.github.com |
7742885380982c7fba0fe6758bb0c9c578d0a83e | 3a06f0030a85559e72cfe7e27487de091a8d17df | /Ex2/src/ex2/B2.java | 47d98244a6c4243d5c6924fbd4ddde3d3141d99e | [] | no_license | edzzn/java-sandbox | ddb83c8cc02b7315f1b44f7c72a0fb9107104e11 | a482e43d980ce1cf90334b5e0acff9e2f9d6304d | refs/heads/master | 2021-01-18T15:39:27.432015 | 2017-11-14T20:51:59 | 2017-11-14T20:51:59 | 86,667,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | 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 ex2;
/**
*
* @author Estudiante
*/
public class B2 implements B{
@Override
public void say() {
System.out.println("Soy B2");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
418d901fa15c6b26cc7cf5110348adf9240ec464 | d1a4e4d301c7cb4c9bcb15bc3ae947f3ce1a623a | /group14/1091149131/2017JavaPro/src/com/m0312/download/DownloadThread.java | 8ab66288b04913e5e8af983a7a7459e43845ba69 | [] | no_license | learnGithubChen/coding2017 | 5cb3c84273ea77e0dbdfb39c8a677bb3cc6eda98 | a9aec17ae6ac3aeab889e4bde4577dc98920b716 | refs/heads/master | 2021-01-19T13:19:29.196983 | 2017-05-05T08:50:48 | 2017-05-05T08:50:48 | 82,384,295 | 1 | 0 | null | 2017-02-18T12:13:15 | 2017-02-18T12:13:15 | null | UTF-8 | Java | false | false | 1,701 | java | package com.m0312.download;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import com.m0312.download.api.Connection;
import com.m0312.download.api.DownloadListener;
public class DownloadThread extends Thread{
Connection conn;
int startPos;
int endPos;
String descFilePath;
private CyclicBarrier cyclicBarrier;
public DownloadThread( Connection conn, int startPos, int endPos){
this.conn = conn;
this.startPos = startPos;
this.endPos = endPos;
}
public DownloadThread( Connection conn, int startPos, int endPos,
String descFilePath,CyclicBarrier cyclicBarrier){
this.conn = conn;
this.startPos = startPos;
this.endPos = endPos;
this.descFilePath=descFilePath;
this.cyclicBarrier=cyclicBarrier;
}
@Override
public void run(){
try {
/*byte[] bytes=conn.read(startPos, endPos);
os=new FileOutputStream(new File(descFilePath));
os.write(bytes, startPos, endPos-startPos+1);
cyclicBarrier.await();//等待其他线程
*/
byte[] buffer = conn.read(startPos , endPos);
RandomAccessFile file = new RandomAccessFile(descFilePath, "rw");
file.seek(startPos);
file.write(buffer, 0, buffer.length);
file.close();
cyclicBarrier.await();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
System.out.println("所有线程都下载完成");
//通知 FileDownloader ,自己已经做完
}
}
| [
"1091149131@qq.com"
] | 1091149131@qq.com |
9d9dbe4d56b000d94454024de646bea1241ac4ca | e378b659e28eddb749edee5a92e81d930d7e72b3 | /!listType/circleList/src/MyException.java | a45bc8ba9b3e1ad88908abe13d32c09ec2f04d5e | [] | no_license | SergRazumov/Project | b1f13e6b719192027e4dfb042493195a3fb36b70 | 260908cf3b2be5b55591621011c84221d75f211b | refs/heads/master | 2022-12-25T06:58:12.138065 | 2019-08-30T21:47:35 | 2019-08-30T21:47:35 | 188,905,224 | 0 | 0 | null | 2022-12-16T05:00:32 | 2019-05-27T20:27:10 | Java | UTF-8 | Java | false | false | 196 | java | public class MyException extends RuntimeException {
public MyException() {
super("Что-то произошло");
}
public MyException(String s) {
super(s);
}
}
| [
"sp-ign-dwa@nornik.ru"
] | sp-ign-dwa@nornik.ru |
fb4eddba32cb5d9018690c26913d282bff2897d5 | 03bb56d0d6e02032e6240a130da1bf275ec61703 | /Core java/MultipleOperation/src/MultipleOperation/Table.java | cc04a052deefd3cd2517189abb596e0606be082b | [] | no_license | min2kumar/github-Core-java-project | dfad5828d1393acf15196e0a17bcac9f0895f699 | 0bdad1716fca37ae50164c33298ca3b735af3b62 | refs/heads/master | 2020-03-20T19:54:51.083349 | 2018-07-29T05:48:43 | 2018-07-29T05:48:43 | 137,660,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,109 | java |
package MultipleOperation;
public class Table extends MultipleOperation
{
void tableprint()
{
long num,size;
String tabans;
do{
System.out.println(" enter the number to print the table of that number ");
num=s.nextLong();
System.out.println(" upto which time you want to print table");
System.out.println(" example-2*1-------2*10"+" here 2 table is upto 10 times ");
size=s.nextLong();
System.out.println(" the table is ");
for (int i=1;i<=size;i++)
{
System.out.println(num*i);
}
System.out.println(" do you want to print more table y/ n ");
tabans=s.next();
}while(tabans.equals("y")|| (tabans.equals("Y")));
System.out.println("===THANK YOU===");
confirm();
}
void confirm()
{
int main;
System.out.println(" 1)== go to main programme ");
System.out.println("2)exit from here ");
main=s.nextInt();
switch(main)
{
case 1:
choice();
break;
case 2:
System.out.println("== exiting......");
rating();
break;
default:
System.out.println("INVALID KEY TRY AGAIN ");
confirm();
break;
}
}
}
| [
"40337605+min2kumar@users.noreply.github.com"
] | 40337605+min2kumar@users.noreply.github.com |
54785fa8f3fa4154b5d0e447a557df74956d118d | 07a12d556a7670a85b3883e19e4b3e5803afbf45 | /lec7_string/substring1.java | 055c8c8753ba627a8034efe31b509667551502aa | [] | no_license | jyotik16/Crux8June2018 | d3dd33859c43937fad95829c55e625ebeaa512cc | 97cfa23f5fd4b753663d02b7ee0e4b91b50be8f9 | refs/heads/master | 2022-11-22T22:45:14.480042 | 2020-07-23T07:46:22 | 2020-07-23T07:46:22 | 281,890,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package lec7_string;
import java.util.Scanner;
public class substring1 {
static Scanner scn = new Scanner(System.in);
public static void main(String[] args) {
String str= scn.nextLine();
substring(str);
}
public static void substring (String str) {
for(int i=0;i<str.length();i++)
{
for(int j=i+1;j<=str.length();j++)
{
System.out.println(str.substring(i,j));
}
}
}
}
| [
"jyotik1608@gmail.com"
] | jyotik1608@gmail.com |
f03b11ad5eba38bd7e409094d423b45ca9c1c9f2 | 1843915a34574a9f1f0084027e48ee0ba411da84 | /src/main/java/org/techforumist/jwt/repository/ActivityRepository.java | d142c0858c6694ebaa1848ac92084c0f07642349 | [] | no_license | hbopereira/Prefeitura-Municipal-Godoy-Moreira | 52bef37bae73296d79d3d7165365e21ccad4f3f3 | 1080171db2dd4c254b7634cea03f2291ad7fdfa5 | refs/heads/master | 2021-04-28T13:33:11.767491 | 2018-02-21T15:04:18 | 2018-02-21T15:04:18 | 122,107,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package org.techforumist.jwt.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.techforumist.jwt.domain.Activity;
@Repository
public interface ActivityRepository extends JpaRepository<Activity,Long> {
public Activity findOneByDescription(String description);
}
| [
"hbopereira@gmail.com"
] | hbopereira@gmail.com |
c235c5f8ce75dd6c5fc4707e5c7698128b22aae9 | 6a290455405338c1a75b39221fbb0012733bea5a | /ortools/sat/samples/ReifiedSample.java | 9a825c028a8a0367926b60b05a424045bbfaec8c | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | S-shubham/or-tools | 5bfe43a689ef2f013159aa6bdef0c37d7d8ca8f1 | f4756e36c57f8c2269730a0158a896e7c90b3e6b | refs/heads/master | 2020-03-28T10:17:03.967179 | 2018-09-09T20:11:37 | 2018-09-09T20:11:37 | 148,097,133 | 2 | 0 | Apache-2.0 | 2018-09-10T04:02:24 | 2018-09-10T04:02:24 | null | UTF-8 | Java | false | false | 1,838 | java | // Copyright 2010-2017 Google
// 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.
import com.google.ortools.sat.CpModel;
import com.google.ortools.sat.ILiteral;
import com.google.ortools.sat.IntVar;
/**
* Reification is the action of associating a Boolean variable to a constraint. This boolean
* enforces or prohibits the constraint according to the value the Boolean variable is fixed to.
*
* <p>Half-reification is defined as a simple implication: If the Boolean variable is true, then the
* constraint holds, instead of an complete equivalence.
*
* <p>The SAT solver offers half-reification. To implement full reification, two half-reified
* constraints must be used.
*/
public class ReifiedSample {
static { System.loadLibrary("jniortools"); }
public static void main(String[] args) throws Exception {
CpModel model = new CpModel();
IntVar x = model.newBoolVar("x");
IntVar y = model.newBoolVar("y");
IntVar b = model.newBoolVar("b");
// Version 1: a half-reified boolean and.
model.addBoolAnd(new ILiteral[] {x, y.not()}).onlyEnforceIf(b);
// Version 2: implications.
model.addImplication(b, x);
model.addImplication(b, y.not());
// Version 3: boolean or.
model.addBoolOr(new ILiteral[] {b.not(), x});
model.addBoolOr(new ILiteral[] {b.not(), y.not()});
}
}
| [
"lperron@google.com"
] | lperron@google.com |
956f0b8f8f5ca6a04dbd2852b44591ad875cdd8f | a1f4a3b1dbfcaf1409d251c5dbb4fea1f7506fcb | /algorithm/src/algorithm_1_1/EX16.java | 502c899333640c8e7ba503dc4f1038b22fd58c88 | [] | no_license | baobaobaobaobao/Algorithms-4th-Edition- | 65ff3bcb9340db070e8149868a0b5a1ec04efa21 | 511c28850fd63e0d36da5a53930c580a7fcee412 | refs/heads/master | 2020-03-23T14:38:26.787871 | 2018-07-23T10:08:24 | 2018-07-23T10:08:24 | 141,689,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package algorithm_1_1;
public class EX16 {
public static String exR1(int n) {
if (n <= 0) {
return "";
}
return exR1(n - 3) + n + exR1(n - 2) + n;
}
public static void main(String[] args) {
System.out.println(exR1(6));
}
}
| [
"530420396@qq.com"
] | 530420396@qq.com |
b86b1101664234dec93029beaec95df141d9fbf0 | def387221512bd84f422866301b3f39a7574373b | /backend/src/main/java/com/ssafy/api/service/crimetime/CrimeTimeService.java | c5597a8435f8a3fd4ba2537379ee610b8187fec1 | [] | no_license | npnppn/Visualizing-crime-big-data | 07f83770c5dea92d905ac8aa8f54a7920010822d | 205963095085228cd5844579238d0b77f55a3a3f | refs/heads/master | 2023-08-19T05:05:03.346242 | 2021-10-11T16:52:12 | 2021-10-11T16:52:12 | 414,595,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.ssafy.api.service.crimetime;
import com.ssafy.db.mapping.CrimeTimeMapping;
import javassist.NotFoundException;
import java.util.List;
public interface CrimeTimeService {
List<CrimeTimeMapping> getCrimeTimeList(Long crimeId,int year) throws NotFoundException;
}
| [
"kwon32220@gmail.com"
] | kwon32220@gmail.com |
212d686efc9de813ad4059d537eb13f18636710d | 65d0b8bbb68a9fb6525507f2ac024440d748ccca | /src/main/java/com/mostafayehya/restfulvetclinicsystem/api/dto/ClinicDTO.java | bdf6405ecafcd4eecb033195e6af17be6d8acc72 | [] | no_license | Mostafayehya/restful-vet-clinic-system | fbf51bc6dc06bef9ef6f08e53a1e0b4af1c088fd | e761cd4fb925914a001072a11a1df09571d90c05 | refs/heads/master | 2022-12-28T04:38:32.380989 | 2020-10-05T16:54:01 | 2020-10-05T16:54:01 | 297,337,251 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package com.mostafayehya.restfulvetclinicsystem.api.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class ClinicDTO {
private Long id;
private String name;
private String address;
private String phone;
@JsonProperty("working_days_and_hours")
private String workingDaysAndHours;
private String email;
private String urls;
}
| [
"mostafayehyax23@gmail.com"
] | mostafayehyax23@gmail.com |
7c8f81cbda68f70be8b99c303a906fd07d384637 | 171fdb04a4897c660c0ea784e17429783a3c335e | /src/main/java/com/revature/dao/BankDbConnection.java | d7b3dc6d462bc69159ede1435393f23dc9af5997 | [] | no_license | KatiusciaNovaesdeSa/ProjectBankApp | 11b4c3d7c9b3c2806f2172ade07abfb983f695f7 | c5332e839cf2c58f893cfdd101a8243da0ae5e12 | refs/heads/master | 2023-04-21T06:20:18.910153 | 2021-05-03T17:09:30 | 2021-05-03T17:09:30 | 356,999,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package com.revature.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class BankDbConnection {
private final String URL = "jdbc:postgresql://rev-canada-training.cgz20kzsu2zt.us-east-2.rds.amazonaws.com:5432/bankdb";
private final String username = "bankuser";
private final String password = "password";
public Connection getConnection() throws SQLException{
return DriverManager.getConnection(URL, username, password);
}
}
| [
"katiuscia.novaesdesa@georgebrown.ca"
] | katiuscia.novaesdesa@georgebrown.ca |
33cb51f9b502777545c62fc1a28e63f913b8495d | fd0b45f1d49128a4827f1b619803aa0c16413360 | /Server.Java/v3/src/main/java/ownradio/util/IdOrGenerate.java | 8d17e5dddf889f2d5d01401541ed67c9c3774154 | [] | no_license | netvoxlab/ownradio | 766992153d2f0675f7f63b9fd09ad72053f64fc4 | 7c2f89b017030ab34dc733b10a4a90588e64bd5b | refs/heads/master | 2020-07-23T23:49:32.309893 | 2019-03-12T08:32:56 | 2019-03-12T08:32:56 | 67,021,975 | 5 | 17 | null | 2016-10-18T15:55:39 | 2016-08-31T09:08:41 | C# | UTF-8 | Java | false | false | 706 | java | package ownradio.util;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.id.UUIDGenerator;
import ownradio.domain.AbstractEntity;
import java.util.UUID;
/**
* Created by a.polunina on 17.04.2017.
*/
public class IdOrGenerate extends UUIDGenerator {
@Override
public UUID generate(SessionImplementor session, Object obj) throws HibernateException {
if (obj == null) throw new HibernateException(new NullPointerException());
if (((AbstractEntity) obj).getRecid() == null) {
UUID id = UUID.randomUUID(); // super.generate(session, obj);
return id;
} else {
return ((AbstractEntity) obj).getRecid();
}
}
} | [
"alex.polunina@gmail.com"
] | alex.polunina@gmail.com |
85ac8e6ef43ea3ce98a6b3aeb6c4a179357976f0 | f75ef8ee19846aa51c7431ee4b69461b8e7e3c18 | /src/main/java/com/sgaraba/blog/domain/package-info.java | 4287f3f2be39c1995ef4284333a559a1bc277e4f | [] | no_license | sgaraba/jhipster-blog | fe92316cadaeac887cca5eb5c2c3550b6a7fe951 | 377cac1fc338394920b6a12564f49d27a85f7cef | refs/heads/master | 2022-12-23T19:00:14.470044 | 2019-07-06T11:03:13 | 2019-07-06T11:03:13 | 195,530,443 | 0 | 0 | null | 2022-12-16T05:01:37 | 2019-07-06T11:10:37 | Java | UTF-8 | Java | false | false | 64 | java | /**
* JPA domain objects.
*/
package com.sgaraba.blog.domain;
| [
"sergiu.garaba@esempla.com"
] | sergiu.garaba@esempla.com |
ebbbec1145182165f93b1f57b1506e404731dd9c | a1e5376861dcae21ec9c5f24a6b82e52a8eccae5 | /Lab5/src/PassengerCarriage.java | bb11836e731ae3432ad91c5bf59285a8436d5df9 | [] | no_license | molotochok/Java_Labs | 3394f4056e3f7b18d3d684f7e43aea91b5db2656 | 3631d2e5ea6f793ade9afce16e606c7b7c1cc21e | refs/heads/master | 2020-03-17T22:26:12.745175 | 2018-05-19T10:34:53 | 2018-05-19T10:34:53 | 134,003,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | public class PassengerCarriage extends AbstractCarriage{
public PassengerCarriage(){
super();
}
public PassengerCarriage(int index, int passengerCount, int baggageCount,int levelOfComfort){
super(index, passengerCount, baggageCount,levelOfComfort);
}
}
| [
"markian98@gmail.com"
] | markian98@gmail.com |
cfe3b1cd48fafe13d8f3fa06bb8f94e4735b83b9 | 4df27efbbc244e90670d5972fa5cb3e2f6cfbf09 | /GeneralProject/src/UsingObjectsParameters/Factorial.java | dbfdc9a6aca7b6450f6101705379a7871f3b421e | [] | no_license | abdulhakimdesuki/HelloWorld | d6d218c0c9e9896fa96edbeb72741bb0780c7be1 | e341b4e013d7e79840ddd1485ba1f7b08849a9d3 | refs/heads/master | 2020-03-15T17:53:33.891474 | 2018-05-05T18:02:30 | 2018-05-05T18:02:30 | 132,271,734 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package UsingObjectsParameters;
//A simple example of recursion.
class Factorial {
//this is a recursive function
int fact(int n) {
int result;
if(n==1)
return 1;
result = fact(n-1) * n;
return result;
}
} | [
"noreply@github.com"
] | noreply@github.com |
46778070d94ad6df97d4d2c782043fb5e161eea0 | 20a98ed3dcd8ca6ac939688bcd508eb7d1464ce7 | /src/main/java/ru/easypeasy/model/MoneyTransfer.java | ec86e5e3d16b771db4e687022973e5c17579d25a | [] | no_license | olgakostyrnaya/easypeasy | 136586d9699b49a747a96d10c1d5068da5083ea1 | 2126349814d2519547ff84438f75f883d71292ee | refs/heads/master | 2021-05-18T03:36:27.845920 | 2020-03-29T17:06:04 | 2020-03-29T17:06:04 | 251,083,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package ru.easypeasy.model;
import java.math.BigDecimal;
import java.util.Date;
/**
* Перемещение доходов между истоничками денег
*/
public class MoneyTransfer {
/**
* Идентификатор операции перемещения
*/
private Long id;
/**
* Источник, из которого перемещают деньги
*/
private MoneySource sourceFrom;
/**
* Источник, в который перемещают деньги
*/
private MoneySource sourceTo;
/**
* Сумма
*/
private BigDecimal amount;
/**
* Дата операции
*/
private Date operationDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public MoneySource getSourceFrom() {
return sourceFrom;
}
public void setSourceFrom(MoneySource sourceFrom) {
this.sourceFrom = sourceFrom;
}
public MoneySource getSourceTo() {
return sourceTo;
}
public void setSourceTo(MoneySource sourceTo) {
this.sourceTo = sourceTo;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
}
| [
"olgakostyrnaya@mail.ru"
] | olgakostyrnaya@mail.ru |
9a45e38e2fdd2e2549c8ab5fc7b8d0b986369517 | 2a16b3be04e3b0ddb68a902b1c3bce5f98f1c035 | /src/main/java/be/multimedi/jammik/controllers/BestellingController.java | 7ce12d006cad315f28338f87b7bfe5ee6ab3163b | [] | no_license | MhmtDurmus/Jammik-BackEnd | 0fb4a2ebeab3aa4ccc31b8ecedb2b5975635ad5f | 9ae11405384e6dbdf8481bbcd4ca699fb8e6ea54 | refs/heads/master | 2023-06-12T23:44:10.103932 | 2020-11-10T11:37:40 | 2020-11-10T11:37:40 | 382,365,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | package be.multimedi.jammik.controllers;
import be.multimedi.jammik.entities.Bestelling;
import be.multimedi.jammik.exceptions.ExceptionHandling;
import be.multimedi.jammik.repositories.BestellingRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Gemaakt door Jan
*/
@RestController
@RequestMapping("/bestelling")
public class BestellingController extends ExceptionHandling {
private BestellingRepository br;
@Autowired
public BestellingController(BestellingRepository br) {
this.br = br;
}
@GetMapping(path="/{id:^\\d+$}", produces="application/json")
public ResponseEntity<Bestelling> getByIdHandler(@PathVariable("id") int id) {
if(id <= 0) return ResponseEntity.badRequest().build();
Bestelling bestelling = br.getBestellingById(id);
return bestelling != null ? ResponseEntity.ok(bestelling) : ResponseEntity.badRequest().build();
}
@GetMapping(produces="application/json")
public ResponseEntity<List<Bestelling>> getAllHandler() {
List<Bestelling> bestellingen = br.findAll();
return ResponseEntity.ok(bestellingen);
}
@PostMapping(consumes="application/json", produces="application/json")
public ResponseEntity<Bestelling> postHandler(@RequestBody Bestelling bestelling) {
if(bestelling == null || bestelling.getId() == 0)
return ResponseEntity.badRequest().build();
return ResponseEntity.ok(br.save(bestelling));
}
@DeleteMapping(path="/{id:^\\d+$}")
public ResponseEntity<?> deleteHandler(@PathVariable("id") int id) {
if(id <= 0) return ResponseEntity.badRequest().build();
br.deleteById(id);
return ResponseEntity.ok().build();
}
} | [
"jan.olaerts92@gmail.com"
] | jan.olaerts92@gmail.com |
522af7c1a92ecba3d1ae3c9aff9bad63e18f9e25 | 1c653b5ab8d054a1511866fa28b676e6f8cba05a | /cdk-oneclick-rest/cdk-src/src/main/java/com/tcg/stk/EcrStack.java | 6802b8152132c802ee3cc638addb6dad715e4a10 | [] | no_license | tridibbolar/cfn-cdk | dbf55f9daa521eb22f7074a772f444abef6df087 | e2279cc4406fa2f664a7292848027555fc2f242c | refs/heads/master | 2022-12-27T10:52:12.932837 | 2020-05-03T10:11:05 | 2020-05-03T10:11:05 | 57,367,466 | 0 | 0 | null | 2020-10-13T21:41:38 | 2016-04-29T08:11:04 | Java | UTF-8 | Java | false | false | 1,692 | java | package com.tcg.stk;
import software.amazon.awscdk.core.CfnOutput;
import software.amazon.awscdk.core.CfnParameter;
import software.amazon.awscdk.core.Construct;
import software.amazon.awscdk.core.Fn;
import software.amazon.awscdk.core.RemovalPolicy;
import software.amazon.awscdk.core.Stack;
import software.amazon.awscdk.core.StackProps;
import software.amazon.awscdk.services.ecr.Repository;
public class EcrStack extends Stack {
public EcrStack(final Construct scope, final String id) {
this(scope, id, null);
}
public EcrStack(final Construct scope, final String id, final StackProps props) {
super(scope, id, props);
CfnParameter ecrRepositoryName = CfnParameter.Builder.create(this, "ecrrepositoryname")
.description("Name of the ecr repository that can be passed in at deploy-time.")
.type("String").build();
Repository repo = Repository.Builder.create(this, "ecr-repository")
.repositoryName(ecrRepositoryName.getValueAsString())
.removalPolicy(RemovalPolicy.DESTROY).build();
CfnOutput.Builder
.create(this, "repository-name")
.value(repo.getRepositoryName())
.exportName("ecr-repository-name")
.build();
CfnOutput.Builder
.create(this, "repository-arn")
.value(repo.getRepositoryArn())
.exportName("ecr-repository-arn")
.build();
CfnOutput.Builder
.create(this, "repository-uri")
.value(repo.getRepositoryUri())
.exportName("ecr-repository-uri")
.build();
}
} | [
"tridib.bolar@gmail.com"
] | tridib.bolar@gmail.com |
3c9fefdd1d09dd8dc1668bc78b5108fba988b9c1 | 5598faaaaa6b3d1d8502cbdaca903f9037d99600 | /code_changes/Apache_projects/AMQ-3504/e7784672ac222a4cf1e27d33c3420a9f62278710/~HttpsTransportFactory.java | fa42a5c8653058eca044350d0b190a3115305409 | [] | no_license | SPEAR-SE/LogInBugReportsEmpirical_Data | 94d1178346b4624ebe90cf515702fac86f8e2672 | ab9603c66899b48b0b86bdf63ae7f7a604212b29 | refs/heads/master | 2022-12-18T02:07:18.084659 | 2020-09-09T16:49:34 | 2020-09-09T16:49:34 | 286,338,252 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,415 | 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.activemq.transport.https;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
import java.util.HashMap;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportServer;
import org.apache.activemq.transport.http.HttpTransportFactory;
import org.apache.activemq.util.IntrospectionSupport;
import org.apache.activemq.util.IOExceptionSupport;
import org.apache.activemq.util.URISupport;
import org.apache.activemq.wireformat.WireFormat;
/**
* Factory of HTTPS based transports
*
*
*/
public class HttpsTransportFactory extends HttpTransportFactory {
public TransportServer doBind(String brokerId, URI location) throws IOException {
return doBind(location);
}
public TransportServer doBind(URI location) throws IOException {
try {
Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));
HttpsTransportServer result = new HttpsTransportServer(location, this);
Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
result.setTransportOption(transportOptions);
return result;
} catch (URISyntaxException e) {
throw IOExceptionSupport.create(e);
}
}
protected Transport createTransport(URI location, WireFormat wf) throws MalformedURLException {
return new HttpsClientTransport(asTextWireFormat(wf), location);
}
}
| [
"archen94@gmail.com"
] | archen94@gmail.com |
cd1305b698e2b5ccc1b302f0a8c4a9119d47e27d | 70f9994d807f464792c7a05f4eeeb158aa694098 | /src/org/socionity/gps/marker/PhotoPreview.java | dedef7fc5a7d24e2b0771da1e1ee1a2447b5c778 | [] | no_license | roopgundeep/PugMarks-Socionity | a0bc431c42e5d86ffe172a70fd68c1e90d661ec4 | 49b828d36695c9f1f87842fef0fac3ee3f705705 | refs/heads/master | 2021-01-10T21:42:49.031139 | 2014-01-13T13:13:16 | 2014-01-13T13:13:16 | 15,779,198 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,523 | java | package org.socionity.gps.marker;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
public class PhotoPreview extends Activity{
//variable for selection intent
private final int PICKER = 1;
//variable to store the currently selected image
private int currentPic = 0;
//gallery object
private Gallery picGallery;
//image view for larger display
private ImageView picView;
//adapter for gallery view
private PicAdapter imgAdapt;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pic_select);
//get the large image view
picView = (ImageView) findViewById(R.id.picture);
//get the gallery view
picGallery = (Gallery) findViewById(R.id.gallery);
//create a new adapter
imgAdapt = new PicAdapter(this);
//set the gallery adapter
picGallery.setAdapter(imgAdapt);
//set the click listener for each item in the thumbnail gallery
picGallery.setOnItemClickListener(new OnItemClickListener() {
//handle clicks
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
//set the larger image view to display the chosen bitmap calling method of adapter class
picView.setImageBitmap(imgAdapt.getPic(position));
}
});
}
public class PicAdapter extends BaseAdapter {
//use the default gallery background image
int defaultItemBackground;
//gallery context
private Context galleryContext;
private Bitmap[] imageBitmaps ;
//array to store bitmaps to display
//placeholder bitmap for empty spaces in gallery
// galleryContext = c;
Bitmap placeholder;
public PicAdapter(Context c) {
//instantiate context
galleryContext = c;
//create bitmap array
imageBitmaps = new Bitmap[10];
//decode the placeholder image
placeholder = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
//more processing
//set placeholder as all thumbnail images in the gallery initially
for(int i=0; i<imageBitmaps.length; i++)
imageBitmaps[i]=placeholder;
//get the styling attributes - use default Andorid system resources
TypedArray styleAttrs = galleryContext.obtainStyledAttributes(R.styleable.PicGallery);
//get the background resource
defaultItemBackground = styleAttrs.getResourceId(
R.styleable.PicGallery_android_galleryItemBackground, 0);
//recycle attributes
styleAttrs.recycle();
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return imageBitmaps.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
//get view specifies layout and display options for each thumbnail in the gallery
public View getView(int position, View convertView, ViewGroup parent) {
//create the view
ImageView imageView = new ImageView(galleryContext);
//specify the bitmap at this position in the array
imageView.setImageBitmap(imageBitmaps[position]);
//set layout options
imageView.setLayoutParams(new Gallery.LayoutParams(300, 200));
//scale type within view area
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
//set default gallery item background
imageView.setBackgroundResource(defaultItemBackground);
//return the view
return imageView;
}
//helper method to add a bitmap to the gallery when the user chooses one
public void addPic(Bitmap newPic)
{
//set at currently selected index
imageBitmaps[currentPic] = newPic;
}
//return bitmap at specified position for larger display
public Bitmap getPic(int posn)
{
//return bitmap at posn index
return imageBitmaps[posn];
}
}
}
| [
"tejas.urwelcome@gmail.com"
] | tejas.urwelcome@gmail.com |
5d4059194893b4683abe53145fe39da63cdf5424 | 9652162a79a1bfded543b6de9d3446c9a3c26088 | /src/main/java/com/bixolabs/simpledb/SimpleDBTap.java | 978d821fae7b03e90e4f41c7828d2c9e407f4182 | [
"Apache-2.0"
] | permissive | carrot-garden/amazon_cascading.simpledb | a9ba3c7bf2dacc8e32019687acd961428ba6383a | 00dcf0c6fb1c3a0431e5e0f28434e93f543b1260 | refs/heads/master | 2021-01-18T18:29:53.072485 | 2011-06-23T15:10:38 | 2011-06-23T15:10:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,974 | java | /**
* Copyright 2010 TransPac Software, Inc.
*
* 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.
*
* Based on cascading.jdbc code released into the public domain by
* Concurrent, Inc.
*/
package com.bixolabs.simpledb;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.JobConf;
import org.apache.log4j.Logger;
import cascading.tap.SinkMode;
import cascading.tap.Tap;
import cascading.tap.TapException;
import cascading.tap.hadoop.TapCollector;
import cascading.tap.hadoop.TapIterator;
import cascading.tuple.TupleEntryCollector;
import cascading.tuple.TupleEntryIterator;
import com.bixolabs.aws.AWSException;
import com.bixolabs.aws.BackoffHttpHandler;
import com.bixolabs.aws.SimpleDB;
/**
* The SimpleDB class is a {@link Tap} subclass. It is used in conjunction with the {@SimpleDBScheme}
* to allow for the reading and writing of data to and from Amazon's SimpleDB service.
*/
@SuppressWarnings("serial")
public class SimpleDBTap extends Tap {
private static final Logger LOGGER = Logger.getLogger(SimpleDBTap.class);
public static final String SCHEME = "simpledb";
private String _accessKeyId;
private String _secretAccessKey;
private String _baseDomainName;
private int _numShards;
private SinkMode _sinkMode;
private int _maxThreads;
private String _sdbHost = SimpleDB.DEFAULT_HOST;
private long _closeTimeout = SimpleDBConfiguration.DEFAULT_CLOSE_TIMEOUT;
private transient SimpleDB _sdb;
public SimpleDBTap(SimpleDBScheme scheme, String accessKeyId, String secretAccessKey, String baseDomainName, int numShards) {
this(scheme, accessKeyId, secretAccessKey, baseDomainName, numShards, SinkMode.UPDATE);
}
public SimpleDBTap(SimpleDBScheme scheme, String accessKeyId, String secretAccessKey, String baseDomainName, int numShards, SinkMode sinkMode) {
super(scheme, sinkMode);
_accessKeyId = accessKeyId;
_secretAccessKey = secretAccessKey;
_baseDomainName = baseDomainName;
_numShards = numShards;
_sinkMode = sinkMode;
_maxThreads = numShards;
}
/**
* Set the max number of threads per record writer.
*
* This is an advanced feature that lets users constrain the number of threads hitting
* SimpleDB, in order to minimize 503/service unavailable errors. For this to have any
* real value, the caller should set this based on the max number of simultaneous tasks
* that use SimpleDB for input or output. Also, the max value for reading is much higher
* than the max for writing.
*
* @param maxThreads maximum number of simultaneous HTTP requests to SimpleDB, per record writer
*/
public void setMaxThreads(int maxThreads) {
_maxThreads = maxThreads;
}
public int getMaxThreads() {
return _maxThreads;
}
public void setCloseTimeout(long closeTimeout) {
_closeTimeout = closeTimeout;
}
public long getCloseTimeout() {
return _closeTimeout;
}
public void setSdbHost(String sdbHost) {
_sdbHost = sdbHost;
_sdb = null;
}
public String getSdbHost() {
return _sdbHost;
}
public Path getPath() {
return new Path(getURI().toString());
}
public TupleEntryIterator openForRead(JobConf conf) throws IOException {
return new TupleEntryIterator(getSourceFields(), new TapIterator(this, conf));
}
public TupleEntryCollector openForWrite(JobConf conf) throws IOException {
return new TapCollector(this, conf);
}
public boolean makeDirs(JobConf conf) throws IOException {
boolean cleanup = true;
try {
// FUTURE KKr - multi-thread this code.
List<String> shardNames = getShardNames();
for (String shardName : shardNames) {
getSimpleDB().createDomain(shardName);
}
// We created all of them, so we're all set.
cleanup = false;
} catch (AWSException e) {
throw new IOException("Error creating domain(s)", e);
} catch (InterruptedException e) {
throw new IOException("Interrupted while creating domain(s)");
} finally {
// TODO KKr - when does makeDirs get called? Do I need to delete
// all of the tables.
// delete these tables?
if (cleanup) {
try {
// deletePath(conf);
} catch (Exception e) {
// ignore
}
}
}
return true;
}
public boolean deletePath(JobConf conf) throws IOException {
try {
// FUTURE KKr - multi-thread this code.
List<String> domainNames = getSimpleDB().listDomains();
for (String domainName : domainNames) {
if (domainName.startsWith(_baseDomainName)) {
getSimpleDB().deleteDomain(domainName);
}
}
} catch (AWSException e) {
throw new IOException("Error deleting domain(s)", e);
} catch (InterruptedException e) {
throw new IOException("Interrupted while deleting domain(s)");
}
return true;
}
public boolean pathExists(JobConf conf) throws IOException {
List<String> existingDomains;
try {
existingDomains = getSimpleDB().listDomains();
} catch (AWSException e) {
throw new IOException("Error listing domains", e);
} catch (InterruptedException e) {
throw new IOException("Interrupted while listing domains");
}
Set<String> domainSet = new HashSet<String>(existingDomains);
List<String> shardNames = getShardNames();
for (String shardName : shardNames) {
if (!domainSet.contains(shardName)) {
return false;
}
}
return true;
}
public long getPathModified(JobConf conf) throws IOException {
long mostRecentTime = 0;
List<String> shards = getShardNames();
for (String shard : shards) {
// FUTURE KKr - multithread this.
long lastModTime = getLastModified(shard);
if (lastModTime > mostRecentTime) {
mostRecentTime = lastModTime;
}
}
return mostRecentTime;
}
@Override
public void sinkInit(JobConf conf) throws IOException {
LOGGER.debug("sinking to domain: " + _baseDomainName);
// do not delete if initialized from within a task
if (isReplace() && (conf.get("mapred.task.partition") == null)) {
deletePath(conf);
}
makeDirs(conf);
setConf(conf);
super.sinkInit(conf);
}
@Override
public void sourceInit(JobConf conf) throws IOException {
LOGGER.debug("sourcing from domain: " + _baseDomainName);
FileInputFormat.setInputPaths(conf, _baseDomainName);
setConf(conf);
super.sourceInit(conf);
}
private SimpleDB getSimpleDB() {
if (_sdb == null) {
// Use the number of shards as the count for number of threads, since at the tap level
// we can't parallelize more than that.
_sdb = new SimpleDB(_sdbHost, _accessKeyId, _secretAccessKey, new BackoffHttpHandler(_numShards));
}
return _sdb;
}
private void setConf(JobConf conf) {
SimpleDBConfiguration sdbConf = new SimpleDBConfiguration(conf);
sdbConf.setAccessKeyId(_accessKeyId);
sdbConf.setSecretAccessKey(_secretAccessKey);
sdbConf.setDomainName(_baseDomainName);
sdbConf.setNumShards(_numShards);
sdbConf.setMaxThreads(_maxThreads);
sdbConf.setSdbHost(_sdbHost);
sdbConf.setCloseTimeout(_closeTimeout);
}
private URI getURI() {
try {
return new URI(SCHEME, "//" + _accessKeyId + "/" + _baseDomainName, null);
} catch (URISyntaxException exception) {
throw new TapException("unable to create uri", exception);
}
}
private List<String> getShardNames() {
return SimpleDBUtils.getShardNames(_baseDomainName, _numShards);
}
private long getLastModified(String domainName) throws IOException {
Map<String, String> metadata;
try {
metadata = getSimpleDB().domainMetaData(domainName);
} catch (AWSException e) {
throw new IOException("Exception getting domain metadata", e);
} catch (InterruptedException e) {
throw new IOException("Interrupted while getting domain metadata");
}
String timestamp = metadata.get(SimpleDB.TIMESTAMP_METADATA);
if (timestamp != null) {
try {
return Long.parseLong(timestamp);
} catch (NumberFormatException e) {
LOGGER.error("SimpleDB metadata returned invalid timestamp for " + _baseDomainName + ": " + timestamp);
}
} else {
LOGGER.error("SimpleDB metadata doesn't contain timestamp " + _baseDomainName);
}
return System.currentTimeMillis();
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((_accessKeyId == null) ? 0 : _accessKeyId.hashCode());
result = prime * result + ((_baseDomainName == null) ? 0 : _baseDomainName.hashCode());
result = prime * result + ((_secretAccessKey == null) ? 0 : _secretAccessKey.hashCode());
result = prime * result + ((getScheme() == null) ? 0 : getScheme().hashCode());
result = prime * result + _sinkMode.hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
SimpleDBTap other = (SimpleDBTap) obj;
if (_accessKeyId == null) {
if (other._accessKeyId != null)
return false;
} else if (!_accessKeyId.equals(other._accessKeyId))
return false;
if (_baseDomainName == null) {
if (other._baseDomainName != null)
return false;
} else if (!_baseDomainName.equals(other._baseDomainName))
return false;
if (_secretAccessKey == null) {
if (other._secretAccessKey != null)
return false;
} else if (!_secretAccessKey.equals(other._secretAccessKey))
return false;
if (_sinkMode != other._sinkMode) {
return false;
}
if (getScheme() == null) {
if (other.getScheme() != null) {
return false;
}
} else if (!getScheme().equals(other.getScheme())) {
return false;
}
return true;
}
}
| [
"kkrugler@transpac.com"
] | kkrugler@transpac.com |
a30956e868a9d1dd99a287d6e1133709097cc53c | 77c442a61d5c85d0ccb1f38053b2eeecca366e79 | /ProjetoPessoa_02/src/projetopessoa_02/Bolsista.java | 349f38c05abe36dbf43130eb51a3a5e18bdae784 | [] | no_license | CelioRochadaSilva/Projetos-com-javaPOO | c1265648af7f066dcd8208bfef55715dafa9b52b | f56be236dc32630259d4f36837ee4a7df445f677 | refs/heads/master | 2023-01-31T09:57:13.953481 | 2020-12-18T01:43:11 | 2020-12-18T01:43:11 | 316,377,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java |
package projetopessoa_02;
/**
*
* @author Celio_pc
*/
public class Bolsista extends Aluno{
private float bolsa;
// metodo
public void RenovarBolsa(){
System.out.println("Renovando bolsa de " + this.nome);
}
//@Override
public void PagarMensalidade(){
System.out.println(this.nome + "é bolsita pagamento facilitado");
}
public float getBolsa() {
return bolsa;
}
public void setBolsa(float bolsa) {
this.bolsa = bolsa;
}
}
| [
"celioelea@hotmail.com"
] | celioelea@hotmail.com |
c1a75f3673bfededa246d4c42b049c1ca72e62fc | 194d248c7442f13e0e94229c74b3753ddfd11970 | /src/test/java/app/MainTest.java | 76d20889aad2b1e725f14e16651ad2947ef7f1c1 | [] | no_license | anagonousourou/javajeucalcul | 873700f8379b8a7e3e669cf9cfc048d046064499 | 080333522f8bc8921055e971118a8c4223a1f8bf | refs/heads/master | 2020-05-30T23:29:00.942294 | 2019-11-20T19:09:00 | 2019-11-20T19:09:00 | 190,017,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package app;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class MainTest {
String varToBeInitInSetup;
@BeforeEach
void setUp() {
varToBeInitInSetup = "Hello World!";
}
} | [
"anagonousourou@gmail.com"
] | anagonousourou@gmail.com |
b3f40538a2cdddac53a524af6f9496e9537b29a5 | 5b9197e123bbd78ea9983c6d8a3e0e6b0dee403a | /mobile/PartyTime/backend/src/main/java/com/example/fabriph/myapplication/backend/OfyService.java | 3ebfd6a297be439431c6c916a7d16fe87623c074 | [] | no_license | mariano90/PartyTime | 3d378b775053c78219c803e38495f84388d89be0 | be60527e4fbe7bec4754f880c2434b4fb258f53d | refs/heads/master | 2021-05-31T18:55:55.425882 | 2016-03-03T13:45:38 | 2016-03-03T13:45:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package com.example.fabriph.myapplication.backend;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyFactory;
import com.googlecode.objectify.ObjectifyService;
/**
* Objectify service wrapper so we can statically register our persistence classes
* More on Objectify here : https://code.google.com/p/objectify-appengine/
*/
public class OfyService {
static {
ObjectifyService.register(RegistrationRecord.class);
}
public static Objectify ofy() {
return ObjectifyService.ofy();
}
public static ObjectifyFactory factory() {
return ObjectifyService.factory();
}
}
| [
"fabriph@gmail.com"
] | fabriph@gmail.com |
c21f5fea3610369b8e4ebefdc20c9ddb6a07ee63 | 9e7ca92ae41854c779b91ffeae675d7640793521 | /app/src/main/java/com/example/resultmap/RoomAdapter.java | fbaba7dedb6ec00e614556f5685a327f8eb3b1bd | [] | no_license | Kassy729/TaJo-Project | a75e22d11148031904d3dafb3893af3132208caa | 5dd10395c8f6c5bb0d3e4ff2304d595cff0ccfa8 | refs/heads/main | 2023-05-30T23:52:32.005929 | 2021-06-21T07:02:49 | 2021-06-21T07:02:49 | 378,833,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,858 | java | package com.example.resultmap;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONException;
import org.json.simple.parser.JSONParser;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class RoomAdapter extends RecyclerView.Adapter<RoomAdapter.CustomViewHolder> {
private ArrayList<com.example.resultmap.RoomData> arrayList;
private Drawable drawable;
public RoomAdapter(ArrayList<com.example.resultmap.RoomData> arrayList,Drawable drawable)
{ this.drawable=drawable;
this.arrayList = arrayList;
}
@NonNull
@Override
public com.example.resultmap.RoomAdapter.CustomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.romm_list,parent,false);
CustomViewHolder holder = new CustomViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(@NonNull com.example.resultmap.RoomAdapter.CustomViewHolder holder, int position) {
if(holder.roomTitle != null)
holder.roomTitle.setText("방이름 : " + arrayList.get(position).getName());
System.out.println("DGDGDGD"+arrayList.get(position).getmyRoomCheck());
if (arrayList.get(position).getmyRoomCheck()!=null){
if (arrayList.get(position).getmyRoomCheck().equals(arrayList.get(position).getId())){
holder.roomTitle.append(" (내방)");
holder.roomList.setBackground(drawable);
}
}
if(holder.roomLeftUser != null)
holder.roomLeftUser.append(arrayList.get(position).getUseridx()+"/"+arrayList.get(position).getUserLimit());//현재 멤버 몆명인지 불러오기
if(holder.roomGender != null)
holder.roomGender.setText("성별 : " + arrayList.get(position).getGender());
if (holder.roomTime != null)
holder.roomTime.setText("시간 : " + arrayList.get(position).getStartAt());
if(holder.roomPlace != null)
holder.roomPlace.setText(arrayList.get(position).getPlace());
holder.roomList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
System.out.println("**************눌렸어******************"+arrayList.get(position).getId());
Intent intent=new Intent(arrayList.get(position).getContext(),Chatting.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("rommId",arrayList.get(position).getId());
arrayList.get(position).getContext().startActivities(new Intent[]{intent});
// 채팅방 누르면 반응하는곳
// 여기에 arrayList.get(position).getId() 로 방아이디를 불러옴
// intent 로 chatting.java 파일로 방 아이디를 넘겨주면서 넘어감
}
});
}
@Override
public int getItemCount() {
return (null != arrayList ? arrayList.size() : 0);
}
public class CustomViewHolder extends RecyclerView.ViewHolder {
protected TextView roomTitle;
protected TextView roomLeftUser;
protected TextView roomGender;
protected TextView roomTime;
protected TextView roomPlace;
protected LinearLayout roomList;
public CustomViewHolder(@NonNull View itemView) {
super(itemView);
this.roomTitle = (TextView) itemView.findViewById(R.id.roomTitle);
this.roomLeftUser = (TextView) itemView.findViewById(R.id.roomLeftUser);
this.roomGender = (TextView) itemView.findViewById(R.id.roomGender);
this.roomTime = (TextView) itemView.findViewById(R.id.roomTime);
this.roomPlace = (TextView) itemView.findViewById(R.id.roomPlace);
this.roomList = (LinearLayout) itemView.findViewById(R.id.roomList);
}
}
}
| [
"hamtol98@gmail.com"
] | hamtol98@gmail.com |
c6a239c665a76fb2527e01415048321de26f96ce | 1fea56d2dcb3b495f63c17ad1ebc61b81e44e7b6 | /uidemo/src/main/java/com/angcyo/uidemo/refresh/WebviewUIView.java | 7a8d6bfc51d484e4bf0807c322a6d727490f841d | [] | no_license | angcyo/UIView | 3ce12f69afdc636330ddd11f30dc093b370ea57d | dad0711554232380d72f326feb9c25cd05711a7f | refs/heads/master | 2022-06-30T15:27:10.313257 | 2022-06-19T12:08:09 | 2022-06-19T12:08:09 | 72,760,800 | 7 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,631 | java | package com.angcyo.uidemo.refresh;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.WebView;
import com.angcyo.uiview.base.UIContentView;
import com.angcyo.uiview.container.ContentLayout;
import com.angcyo.uiview.model.TitleBarPattern;
import com.angcyo.uiview.rsen.BasePointRefreshView;
import com.angcyo.uiview.rsen.RefreshLayout;
import com.angcyo.uiview.utils.Web;
/**
* Copyright (C) 2016,深圳市红鸟网络科技股份有限公司 All rights reserved.
* 项目名称:
* 类的描述:
* 创建人员:Robi
* 创建时间:2016/12/05 17:54
* 修改人员:Robi
* 修改时间:2016/12/05 17:54
* 修改备注:
* Version: 1.0.0
*/
public class WebviewUIView extends UIContentView {
private RefreshLayout mRefreshLayout;
@Override
protected void inflateContentLayout(ContentLayout baseContentLayout, LayoutInflater inflater) {
mRefreshLayout = new RefreshLayout(mActivity);
mRefreshLayout.setTag("refresh");
WebView webView = new WebView(mActivity);
Web.initWebView(webView, null);
webView.loadUrl("https://www.baidu.com/s?word=angcyo");
mRefreshLayout.addView(webView);
mRefreshLayout.setTopView(new BasePointRefreshView(mActivity));
mRefreshLayout.setBottomView(new BasePointRefreshView(mActivity));
baseContentLayout.addView(mRefreshLayout);
}
@Override
public void loadContentView(View rootView) {
super.loadContentView(rootView);
showContentLayout();
}
@Override
protected TitleBarPattern getTitleBar() {
return null;
}
}
| [
"angcyo@126.com"
] | angcyo@126.com |
c46965c762013eeb5722cd6d937682fe4dc35c20 | 05e5bee54209901d233f4bfa425eb6702970d6ab | /com/avaje/ebeaninternal/server/deploy/generatedproperty/GeneratedInsertDate.java | d6a9d96f579cd31fb35667e33d0b73aecd73a0d1 | [] | no_license | TheShermanTanker/PaperSpigot-1.7.10 | 23f51ff301e7eb05ef6a3d6999dd2c62175c270f | ea9d33bcd075e00db27b7f26450f9dc8e6d18262 | refs/heads/master | 2022-12-24T10:32:09.048106 | 2020-09-25T15:43:22 | 2020-09-25T15:43:22 | 298,614,646 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | /* */ package com.avaje.ebeaninternal.server.deploy.generatedproperty;
/* */
/* */ import com.avaje.ebeaninternal.server.deploy.BeanProperty;
/* */ import java.util.Date;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class GeneratedInsertDate
/* */ implements GeneratedProperty
/* */ {
/* */ public Object getInsertValue(BeanProperty prop, Object bean) {
/* 35 */ return new Date(System.currentTimeMillis());
/* */ }
/* */
/* */
/* */
/* */
/* */ public Object getUpdateValue(BeanProperty prop, Object bean) {
/* 42 */ return prop.getValue(bean);
/* */ }
/* */
/* */
/* */
/* */
/* */ public boolean includeInUpdate() {
/* 49 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */ public boolean includeInInsert() {
/* 56 */ return true;
/* */ }
/* */
/* */ public boolean isDDLNotNullable() {
/* 60 */ return true;
/* */ }
/* */ }
/* Location: D:\Paper-1.7.10\PaperSpigot-1.7.10-R0.1-SNAPSHOT-latest.jar!\com\avaje\ebeaninternal\server\deploy\generatedproperty\GeneratedInsertDate.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 1.1.3
*/ | [
"tanksherman27@gmail.com"
] | tanksherman27@gmail.com |
9611b250acf2c44d442ed4bdcaba604340380ca6 | 27f8111750750df155b4f2f38f46ce38d8975236 | /hb-02-one-to-one-bi/src/com/luv2code/hibernate/demo/entity/Instructor.java | 2f99ae74be5d8d79d68af6fbafc7ed387272829a | [] | no_license | avgasanov/Spring-Hibernate | 2cc522148b70461926a8aa44b00efbd511f586fa | 231984f93f4ed618f07833d84ea1fef77e359347 | refs/heads/master | 2020-04-18T22:34:21.362987 | 2019-02-15T19:30:19 | 2019-02-15T19:30:19 | 167,797,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,264 | java | package com.luv2code.hibernate.demo.entity;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name="instructor")
public class Instructor {
// annotate the class as an entity and map to db table
// define the fields
// annotate the fields with db column names
// ** set up mapping to InstructionDetail entity
// create constructors
// generate getter/setter methods
// generate toString() method
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="first_name")
private String firstName;
@Column(name="last_name")
private String lastName;
@Column(name="email")
private String email;
@OneToOne(cascade=CascadeType.ALL)
@JoinColumn(name="instructor_detail_id")
private InstructorDetail instructorDetail;
public Instructor() {}
public Instructor(String firstName, String lastName, String email) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public InstructorDetail getInstructorDetail() {
return instructorDetail;
}
public void setInstructorDetail(InstructorDetail instructorDetail) {
this.instructorDetail = instructorDetail;
}
@Override
public String toString() {
return "Instructor [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email
+ ", instructorDetail=" + instructorDetail + "]";
}
}
| [
"avgasanov@gmail.com"
] | avgasanov@gmail.com |
a52acaeda27d7e41ca591de84e8e1ddcb6eb55a2 | 406856cc4bddfe155163998b13abbe60c0691a4d | /trunk/demonstrate-project/common-project/uitag-project/uitag/src/main/java/org/iff/demo/common/uitag/util/ReflectHelper.java | 1c0bda9f71e3b94734a184a6e258149d8ae5cfc8 | [] | no_license | tylerchen/demonstrates | 15368098ad121ac292646ff389bc744685321e90 | 2c9cc9bc7c30455e328b2e4aaac8efae2b51fe56 | refs/heads/master | 2020-04-05T23:14:05.153233 | 2018-09-13T03:34:19 | 2018-09-13T03:34:19 | 2,938,431 | 10 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,694 | java | /*******************************************************************************
* Copyright (c) 2012-3-23 @author <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a>.
* All rights reserved.
*
* Contributors:
* <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a> - initial API and implementation
******************************************************************************/
package org.iff.demo.common.uitag.util;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
/**
* @author <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a>
* @since 2012-3-23
*/
public final class ReflectHelper {
private ReflectHelper() {
}
public static void main(String[] args) {
class A {
private String name;
private boolean sex;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isSex() {
return sex;
}
public void setSex(boolean sex) {
this.sex = sex;
}
}
class B extends A {
private int age;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
Map<String, Method> getters = getGetters(B.class);
for (Entry<String, Method> entry : getters.entrySet()) {
System.out.println(entry.getKey() + ":"
+ entry.getValue().toString());
}
}
public static Map<String, Method> getGetters(Class<?> clazz) {
Map<String, Method> map = new LinkedHashMap<String, Method>();
Class<?> searchType = clazz;
while (searchType != null && searchType != Object.class) {
Method[] methods = (searchType.isInterface()) ? new Method[0]
: searchType.getDeclaredMethods();
for (Method method : methods) {
String name = method.getName();
int modifiers = method.getModifiers();
if (modifiers - Modifier.PUBLIC == 0
&& method.getParameterTypes().length == 0) {
method.setAccessible(true);
if (name.length() > 3 && name.startsWith("get")) {
name = Character.toLowerCase(name.charAt(3))
+ name.substring(4, name.length());
map.put(name, method);
} else if (name.length() > 2 && name.startsWith("is")) {
name = Character.toLowerCase(name.charAt(2))
+ name.substring(3, name.length());
map.put(name, method);
}
}
}
searchType = searchType.getSuperclass();
}
return map;
}
public static Object getGetterValue(Method method, Object o) {
try {
return method.invoke(o, null);
} catch (Exception e) {
}
return null;
}
}
| [
"iffiff1@gmail.com"
] | iffiff1@gmail.com |
8d3ef04485ed4974ad3e5525dad53783fd3a9c2b | 9e8354a1084d4bcb7bbd2c8c1dbbd38c84e9b535 | /src/main/java/com/alexandriabms/dao/BookDAO.java | c9918554ccfcbe224536110157f2446da068a1d0 | [] | no_license | wasif/alexandriabms | c0dc1e05426c05643cccd85c89ef82b8dfffde9a | fe754a6948db50ad51d409b3818e5dae9f05b64c | refs/heads/master | 2021-01-22T02:53:09.835635 | 2014-05-21T23:02:31 | 2014-05-21T23:02:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | package com.alexandriabms.dao;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import com.alexandriabms.model.Book;
/**
* Book DAO class.
*
*/
@Repository
public class BookDAO implements IBookDAO {
private HibernateTemplate hibernateTemplate;
@Autowired
public void setSessionFactory(SessionFactory sessionFactory) {
hibernateTemplate = new HibernateTemplate(sessionFactory);
}
/**
* Get List of bookss from database
*
* @return list of all books
*/
@SuppressWarnings("unchecked")
@Override
public List<Book> getBooks() {
return hibernateTemplate.find("from Book");
}
/**
* Delete a book with the id passed as parameter
*
* @param id
*/
@Override
public void deleteBook(int id) {
Object record = hibernateTemplate.load(Book.class, id);
hibernateTemplate.delete(record);
}
/**
* Create a new Book on the database or Update book
*
* @param book
* @return book added or updated in DB
*/
@Override
public Book saveBook(Book book) {
hibernateTemplate.saveOrUpdate(book);
return book;
}
} | [
"wasif.shaikh@gmail.com"
] | wasif.shaikh@gmail.com |
2af33a2727810b7b9f136c49d3d0352894a736a9 | ff4e54610dd72ee7bf903af8cd755aa88a4e030c | /PGR/pgr/src/pgr/domain/util/util/UtilAdapterFactory.java | 680d5e22f68b0f9a3dbfef8048775843dd450a88 | [] | no_license | PlataformaGestionReportes/PGR | 9af475f92cf9a92477fbfa037842e8c17516c1ae | 4cd7c5d413a11ea177360e7516d9318513c7c1f1 | refs/heads/master | 2021-01-22T23:01:31.781244 | 2017-06-08T21:58:46 | 2017-06-08T21:58:46 | 92,796,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,846 | java | /**
*/
package pgr.domain.util.util;
import java.util.Comparator;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.ecore.EObject;
import pgr.domain.util.*;
/**
* <!-- begin-user-doc -->
* The <b>Adapter Factory</b> for the model.
* It provides an adapter <code>createXXX</code> method for each class of the model.
* <!-- end-user-doc -->
* @see pgr.domain.util.UtilPackage
* @generated
*/
public class UtilAdapterFactory extends AdapterFactoryImpl {
/**
* The cached model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static UtilPackage modelPackage;
/**
* Creates an instance of the adapter factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UtilAdapterFactory() {
if (modelPackage == null) {
modelPackage = UtilPackage.eINSTANCE;
}
}
/**
* Returns whether this factory is applicable for the type of the object.
* <!-- begin-user-doc -->
* This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
* <!-- end-user-doc -->
* @return whether this factory is applicable for the type of the object.
* @generated
*/
@Override
public boolean isFactoryForType(Object object) {
if (object == modelPackage) {
return true;
}
if (object instanceof EObject) {
return ((EObject)object).eClass().getEPackage() == modelPackage;
}
return false;
}
/**
* The switch that delegates to the <code>createXXX</code> methods.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UtilSwitch<Adapter> modelSwitch =
new UtilSwitch<Adapter>() {
@Override
public Adapter caseCoordinate(Comparable object) {
return createCoordinateAdapter();
}
@Override
public Adapter caseMergedRegion(MergedRegion object) {
return createMergedRegionAdapter();
}
@Override
public Adapter caseComparatorRange(Comparator object) {
return createComparatorRangeAdapter();
}
@Override
public Adapter caseUnzip(Unzip object) {
return createUnzipAdapter();
}
@Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
};
/**
* Creates an adapter for the <code>target</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param target the object to adapt.
* @return the adapter for the <code>target</code>.
* @generated
*/
@Override
public Adapter createAdapter(Notifier target) {
return modelSwitch.doSwitch((EObject)target);
}
/**
* Creates a new adapter for an object of class '{@link Comparable <em>Coordinate</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see Comparable
* @generated
*/
public Adapter createCoordinateAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link pgr.domain.util.MergedRegion <em>Merged Region</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see pgr.domain.util.MergedRegion
* @generated
*/
public Adapter createMergedRegionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link java.util.Comparator <em>Comparator Range</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see java.util.Comparator
* @generated
*/
public Adapter createComparatorRangeAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link pgr.domain.util.Unzip <em>Unzip</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see pgr.domain.util.Unzip
* @generated
*/
public Adapter createUnzipAdapter() {
return null;
}
/**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
* <!-- end-user-doc -->
* @return the new adapter.
* @generated
*/
public Adapter createEObjectAdapter() {
return null;
}
} //UtilAdapterFactory
| [
"crispale07@gmail.com"
] | crispale07@gmail.com |
ce29759a059ccdc609a03add1afd2ef0425d762e | 6dd4d6425fe484c60eb31c994ed155cd647fa371 | /plugins/org.w3c.css/cssvalidation-src/org/w3c/css/css/CssParser.java | 339390b7a1ccff67818e79a0235e8ae80b2539a9 | [] | no_license | anagovitsyn/oss.FCL.sftools.dev.eclipseenv.wrttools | 6206efe3c305b45b400e3a7359f16a166e8fea0e | 2b909321ef1e9c431d17ad0233746b717dcb5fc6 | refs/heads/master | 2021-12-11T08:59:54.238183 | 2010-11-04T22:22:02 | 2010-11-04T22:22:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,072 | java | //
// $Id: CssParser.java,v 1.6 2005-09-14 15:14:17 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.css;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.w3c.css.util.ApplContext;
/**
* This class describes how to implements your cascading
* style sheet parser.
*
* You must implements this interfaces if you want to have
* a backward compatibilitie with other CSS parser.
* <p>
* Typically, it is used like this :
* <p>
* <code>
* YourParser parser = new YourParser();<br>
* parser.parseURL(yourURLDocument, StyleSheetOrigin.USER);<br>
* StyleSheet style = parser.getStyleSheet();<br>
* // here, i want an HTML document to output<br>
* StyleSheetGenerator.setDocumentBase("html.properties");<br>
* StyleSheetGenerator generator = new StyleSheetGenerator("foo",
* style,
* "foo.css",
* 2);<br>
* generator.print(new PrintStream(System.out));<br>
* </code>
*
* @see org.w3c.css.css.StyleSheetParser
* @version $Revision: 1.6 $
*/
public interface CssParser {
/**
* Reinitialize this parser
*/
public abstract void reInit();
/**
* Get the style sheet after a parse.
*
* @return The resulted style sheet
*/
public abstract StyleSheet getStyleSheet();
/**
* @param url the URL containing the style sheet
* @param title the title of the stylesheet
* @param kind may be a stylesheet or an alternate stylesheet
* @param media the media to apply this
* @param origin the origin of the style sheet
* @exception IOException an IO error
*/
public void parseURL(ApplContext ac, URL url, String title, String kind,
String media, int origin);
/**
* Parse a STYLE element.
* The real difference between this method and the precedent
* is that this method can take a string. The URL is used
* to resolve import statement and URL statement in the style
* sheet.
* <p>
* For a backward compatibility, <code>parseStyleElement</code> and
* <code>parseStyleAttribute</code> use a string for the input.
*
* @param input the input string.
* @param url the URL where the input stream comes from.
* @param lineno The number line in the source document.
* It is used for error message
* @deprecated Replaced by parseStyleElement
* @see #parseStyleElement(InputStream, URL, int)
*/
public abstract void parseStyleElement(ApplContext ac, String input,
URL url, int lineno);
/**
* Parse a STYLE element.
* The real difference between this method and the precedent
* is that this method can take an InputStream. The URL is used
* to resolve import statement and URL statement in the style
* sheet.
*
* @param input the input stream.
* @param title the title of the style element
* @param media the media of the style element
* @param url the URL where the input stream comes from.
* @param lineno The number line in the source document. It is used for error message
*/
public abstract void parseStyleElement(ApplContext ac, InputStream input,
String title, String media, URL url,
int lineno);
/**
* Parser a STYLE attribute.
* Here, you must generate your own uniq id for the context.
* After, you can reference this style attribute by the id.
* <p>
* <strong>Be careful, the id must be uniq !</strong>
* <p>
* For a backward compatibility, <code>parseStyleElement</code> and
* <code>parseStyleAttribute</code> use a string for the input.
*
* @param input the input string.
* @param id your uniq id to reference this style attribute.
* @param url the URL where the input stream comes from.
* @param lineno The number line in the source document. It is used for error message.
* @deprecated Replaced by parseStyleAttribute
* @see #parseStyleAttribute(InputStream, String, URL, int)
*/
public abstract void parseStyleAttribute(ApplContext ac, String input, String id, URL url, int lineno);
/**
* Parser a STYLE attribute.
* Here, you must generate your own uniq id for the context.
* After, you can reference this style attribute by the id.
* <p>
* <strong>Be careful, the id must be uniq !</strong>
*
* @param input the input stream.
* @param id your uniq id to reference this style attribute.
* @param url the URL where the input stream comes from.
* @param lineno The number line in the source document. It is used for error message.
*/
public abstract void parseStyleAttribute(ApplContext ac, InputStream input,
String id, URL url, int lineno);
}
| [
"TasneemS@US-TASNEEMS"
] | TasneemS@US-TASNEEMS |
677bf527aec7c74fa00e208a119770b07510ec99 | bee6023e31c388fb00ce86a9d9258b17f49e0d68 | /main/java/com/problem14/MyBinaryTree.java | 0b577d2f6c3f18d0cb3ff0f8966723622dc8f6bb | [] | no_license | Sippora04/Binary-Search-Tree | 2dbcb545dfeea41a6969044b4118cba2b15bbc08 | 8bc244987b817086479277c2e0b0032cf1dab8a8 | refs/heads/master | 2023-01-09T11:16:32.520239 | 2020-11-05T20:53:22 | 2020-11-05T20:53:22 | 310,409,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package com.problem14;
public class MyBinaryTree<K extends Comparable<K>> {
private BinaryNode<K> root;
public void add(K key) {
this.root = this.addRecursively(root, key);
}
private BinaryNode<K> addRecursively(BinaryNode<K> current, K key) {
if (current == null)
return new BinaryNode<K>(key);
int compResult = key.compareTo(current.key);
if (compResult == 0)
return current;
if (compResult < 0) // if current>key -> left
current.left = addRecursively(current.left, key);
if (compResult > 0) // current<key ->right
current.right = addRecursively(current.right, key);
return current;
}
public int getSize() {
return this.getSizeRecursively(root);
}
private int getSizeRecursively(BinaryNode<K> current) {
return current == null ? 0 : 1 + this.getSizeRecursively(current.left) + this.getSizeRecursively(current.right);
}
public K search(K key) {
return key = this.searchRecursively(root, key);
}
private K searchRecursively(BinaryNode<K> current, K key) {
K searchKey = null;
if (current == null || current.key == key)
return current.key;
int compResult = key.compareTo(current.key);
if (compResult < 0)
searchKey = searchRecursively(current.left, key);
if (compResult > 0)
searchKey = searchRecursively(current.right, key);
return searchKey;
}
}
| [
"sippora.toppo95@gmail.com"
] | sippora.toppo95@gmail.com |
ebfd13e2de118dc480c0bb464b063afdff79a76a | 350184750d4e7afa18afe2a13608e68b8a3ef2f2 | /event/src/main/java/com/global/adk/event/EventSupport.java | 86c2cf44c7f51995473cd3ab2750b024722f57dd | [] | no_license | smallchen28/application-developer-kit | dbdef1fb6b4135a59f4b7a9ccf995d5314180dbe | f1e27c4d8adc28693bbb76f8c10eca725cb0c823 | refs/heads/master | 2021-04-08T00:43:09.395874 | 2018-05-09T07:24:18 | 2018-05-09T07:24:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package com.global.adk.event;
/**
* www.yiji.com Inc.
* Copyright (c) 2015 All Rights Reserved.
*/
import java.util.Map;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import com.yjf.common.util.StringUtils;
/**
*
* 修订记录: lingxu@yiji.com 2016/9/13 11:15 创建
*/
public class EventSupport implements ApplicationContextAware, InitializingBean {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Override
public void afterPropertiesSet() throws Exception {
Map<String, Object> listeners = applicationContext.getBeansWithAnnotation(Listener.class);
if (listeners != null && listeners.size() > 0) {
listeners.entrySet().stream().forEach(entry -> {
Listener listener = entry.getValue().getClass().getAnnotation(Listener.class);
Notifier notifier = applicationContext.getBean(
StringUtils.isBlank(listener.notifier()) ? "notifierBus" : listener.notifier(),
Notifier.class);
notifier.register(entry.getValue());
});
}
}
}
| [
"1052299159@qq.com"
] | 1052299159@qq.com |
009d5459cbbaa2751ee1571cc35f1b33a88ae5f1 | a476ea7edd55cb31238ebb23b76ed87661d1aa3e | /app/src/test/java/com/xb/xbassemblylibs/ExampleUnitTest.java | 546255f750f79d9d2356fa67579e6ac2d9a7349d | [] | no_license | gisbinbin/XbAssemblylibs | 1e0d6e18b2f364f7779bbfd999a54da416c315b2 | 6827a00f47f67b7e4b0265fc719d1981fc2cf3d9 | refs/heads/master | 2020-03-13T13:09:11.625715 | 2018-07-09T03:43:30 | 2018-07-09T03:43:30 | 131,133,214 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package com.xb.xbassemblylibs;
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);
}
} | [
"1058451049@qq.com"
] | 1058451049@qq.com |
37ac1c3a0923eb57283b2ab90ff7bba1c3716c0f | 8faad9530d7dbebd8d394c4bca7b77566f9b7e76 | /DailyTradeReport/src/main/java/logic/workingdays/UsualWorkingDays.java | 0cba6fa51f386e9815b4de2eb66501b145c0c0be | [] | no_license | SindhyaRathinasami/OnlineExcercise | f91d7fd59ab166736899208eb46588c9798053e1 | 48c5d08c634f7ab9744a59579235f31bf7510c5e | refs/heads/master | 2020-03-23T03:16:34.929099 | 2018-07-15T11:28:43 | 2018-07-15T11:28:43 | 141,021,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package main.java.logic.workingdays;
import java.time.DayOfWeek;
public class UsualWorkingDays extends WorkingDays {
private static UsualWorkingDays instance = null;
public static UsualWorkingDays getInstance() {
if (instance == null) {
instance = new UsualWorkingDays();
}
return instance;
}
private UsualWorkingDays() {
super();
}
@Override
protected void setupWorkingDays() {
this.isWorkingDayMap.put(DayOfWeek.MONDAY, true);
this.isWorkingDayMap.put(DayOfWeek.TUESDAY, true);
this.isWorkingDayMap.put(DayOfWeek.WEDNESDAY, true);
this.isWorkingDayMap.put(DayOfWeek.THURSDAY, true);
this.isWorkingDayMap.put(DayOfWeek.FRIDAY, true);
this.isWorkingDayMap.put(DayOfWeek.SATURDAY, false);
this.isWorkingDayMap.put(DayOfWeek.SUNDAY, false);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
1c2b4fdbc850a2289076298089b3405742790950 | 0655b7ce857ec85786b9bfd397f4b5a4a80a8e51 | /src/com/oldscape/client/Buffer.java | 7055db920998d31ffe8e0609ada5a713569273f6 | [] | no_license | 95thcobra/VirtueOS | dfa04a0b6b22adf28e27f7f8263ec71472f18eae | 8a3aba2be09cbe33dc2934421729751861fee201 | refs/heads/master | 2020-03-28T19:33:37.237506 | 2018-04-28T00:05:43 | 2018-04-28T00:05:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,048 | java | package com.oldscape.client;
import java.math.BigInteger;
public class Buffer extends Node {
static int[] crc32Table;
static long[] crc64Table;
public byte[] payload;
public int offset;
static {
crc32Table = new int[256];
int var2;
for (int var1 = 0; var1 < 256; ++var1) {
int var0 = var1;
for (var2 = 0; var2 < 8; ++var2) {
if ((var0 & 1) == 1) {
var0 = var0 >>> 1 ^ -306674912;
} else {
var0 >>>= 1;
}
}
crc32Table[var1] = var0;
}
crc64Table = new long[256];
for (var2 = 0; var2 < 256; ++var2) {
long var4 = var2;
for (int var3 = 0; var3 < 8; ++var3) {
if (1L == (var4 & 1L)) {
var4 = var4 >>> 1 ^ -3932672073523589310L;
} else {
var4 >>>= 1;
}
}
crc64Table[var2] = var4;
}
}
public Buffer(int var1) {
this.payload = GrandExchangeOffer.method127(var1);
this.offset = 0;
}
public Buffer(byte[] var1) {
this.payload = var1;
this.offset = 0;
}
public void method3500() {
if (this.payload != null) {
class150.method3110(this.payload);
}
this.payload = null;
}
public void putByte(int var1) {
this.payload[++this.offset - 1] = (byte) var1;
}
public void putShort(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
this.payload[++this.offset - 1] = (byte) var1;
}
public void put24bitInt(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 >> 16);
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
this.payload[++this.offset - 1] = (byte) var1;
}
public void putInt(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 >> 24);
this.payload[++this.offset - 1] = (byte) (var1 >> 16);
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
this.payload[++this.offset - 1] = (byte) var1;
}
public void method3671(long var1) {
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 40));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 32));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 24));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 16));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 8));
this.payload[++this.offset - 1] = (byte) ((int) var1);
}
public void putLong(long var1) {
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 56));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 48));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 40));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 32));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 24));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 16));
this.payload[++this.offset - 1] = (byte) ((int) (var1 >> 8));
this.payload[++this.offset - 1] = (byte) ((int) var1);
}
public void writeBooleanAsByte(boolean var1) {
this.putByte(var1 ? 1 : 0);
}
public void putString(String var1) {
int var2 = var1.indexOf(0);
if (var2 >= 0) {
throw new IllegalArgumentException("");
} else {
this.offset += class28.encodeStringCp1252(var1, 0, var1.length(), this.payload, this.offset);
this.payload[++this.offset - 1] = 0;
}
}
public void putJagString(String var1) {
int var2 = var1.indexOf(0);
if (var2 >= 0) {
throw new IllegalArgumentException("");
} else {
this.payload[++this.offset - 1] = 0;
this.offset += class28.encodeStringCp1252(var1, 0, var1.length(), this.payload, this.offset);
this.payload[++this.offset - 1] = 0;
}
}
public void putCESU8(CharSequence var1) {
int var3 = var1.length();
int var4 = 0;
int var5;
for (var5 = 0; var5 < var3; ++var5) {
char var6 = var1.charAt(var5);
if (var6 <= 127) {
++var4;
} else if (var6 <= 2047) {
var4 += 2;
} else {
var4 += 3;
}
}
this.payload[++this.offset - 1] = 0;
this.putVarInt(var4);
var4 = this.offset;
byte[] var12 = this.payload;
int var7 = this.offset;
int var8 = var1.length();
int var9 = var7;
for (int var10 = 0; var10 < var8; ++var10) {
char var11 = var1.charAt(var10);
if (var11 <= 127) {
var12[var9++] = (byte) var11;
} else if (var11 <= 2047) {
var12[var9++] = (byte) (192 | var11 >> 6);
var12[var9++] = (byte) (128 | var11 & '?');
} else {
var12[var9++] = (byte) (224 | var11 >> '\f');
var12[var9++] = (byte) (128 | var11 >> 6 & 63);
var12[var9++] = (byte) (128 | var11 & '?');
}
}
var5 = var9 - var7;
this.offset = var5 + var4;
}
public void putBytes(byte[] var1, int var2, int var3) {
for (int var4 = var2; var4 < var3 + var2; ++var4) {
this.payload[++this.offset - 1] = var1[var4];
}
}
public void putLengthInt(int var1) {
this.payload[this.offset - var1 - 4] = (byte) (var1 >> 24);
this.payload[this.offset - var1 - 3] = (byte) (var1 >> 16);
this.payload[this.offset - var1 - 2] = (byte) (var1 >> 8);
this.payload[this.offset - var1 - 1] = (byte) var1;
}
public void method3513(int var1) {
this.payload[this.offset - var1 - 2] = (byte) (var1 >> 8);
this.payload[this.offset - var1 - 1] = (byte) var1;
}
public void method3514(int var1) {
this.payload[this.offset - var1 - 1] = (byte) var1;
}
public void putShortSmart(int var1) {
if (var1 >= 0 && var1 < 128) {
this.putByte(var1);
} else if (var1 >= 0 && var1 < 32768) {
this.putShort(var1 + 32768);
} else {
throw new IllegalArgumentException();
}
}
public void putVarInt(int var1) {
if ((var1 & -128) != 0) {
if ((var1 & -16384) != 0) {
if ((var1 & -2097152) != 0) {
if ((var1 & -268435456) != 0) {
this.putByte(var1 >>> 28 | 128);
}
this.putByte(var1 >>> 21 | 128);
}
this.putByte(var1 >>> 14 | 128);
}
this.putByte(var1 >>> 7 | 128);
}
this.putByte(var1 & 127);
}
public int readUnsignedByte() {
return this.payload[++this.offset - 1] & 255;
}
public byte readByte() {
return this.payload[++this.offset - 1];
}
public int readUnsignedShort() {
this.offset += 2;
return (this.payload[this.offset - 1] & 255) + ((this.payload[this.offset - 2] & 255) << 8);
}
public int readShort() {
this.offset += 2;
int var1 = (this.payload[this.offset - 1] & 255) + ((this.payload[this.offset - 2] & 255) << 8);
if (var1 > 32767) {
var1 -= 65536;
}
return var1;
}
public int read24BitInt() {
this.offset += 3;
return ((this.payload[this.offset - 3] & 255) << 16) + (this.payload[this.offset - 1] & 255)
+ ((this.payload[this.offset - 2] & 255) << 8);
}
public int readInt() {
this.offset += 4;
return ((this.payload[this.offset - 3] & 255) << 16) + (this.payload[this.offset - 1] & 255)
+ ((this.payload[this.offset - 2] & 255) << 8) + ((this.payload[this.offset - 4] & 255) << 24);
}
public long readLong() {
long var1 = this.readInt() & 4294967295L;
long var3 = this.readInt() & 4294967295L;
return var3 + (var1 << 32);
}
public boolean method3524() {
return (this.readUnsignedByte() & 1) == 1;
}
public String getNullString() {
if (this.payload[this.offset] == 0) {
++this.offset;
return null;
} else {
return this.readString();
}
}
public String readString() {
int var1 = this.offset;
while (this.payload[++this.offset - 1] != 0) {
;
}
int var2 = this.offset - var1 - 1;
return var2 == 0 ? "" : ChatPlayer.getString(this.payload, var1, var2);
}
public String getJagString() {
byte var1 = this.payload[++this.offset - 1];
if (var1 != 0) {
throw new IllegalStateException("");
} else {
int var2 = this.offset;
while (this.payload[++this.offset - 1] != 0) {
;
}
int var3 = this.offset - var2 - 1;
return var3 == 0 ? "" : ChatPlayer.getString(this.payload, var2, var3);
}
}
public String getCESU8() {
byte var1 = this.payload[++this.offset - 1];
if (var1 != 0) {
throw new IllegalStateException("");
} else {
int var2 = this.readVarInt();
if (var2 + this.offset > this.payload.length) {
throw new IllegalStateException("");
} else {
byte[] var4 = this.payload;
int var5 = this.offset;
char[] var6 = new char[var2];
int var7 = 0;
int var8 = var5;
int var11;
for (int var9 = var2 + var5; var8 < var9; var6[var7++] = (char) var11) {
int var10 = var4[var8++] & 255;
if (var10 < 128) {
if (var10 == 0) {
var11 = 65533;
} else {
var11 = var10;
}
} else if (var10 < 192) {
var11 = 65533;
} else if (var10 < 224) {
if (var8 < var9 && (var4[var8] & 192) == 128) {
var11 = (var10 & 31) << 6 | var4[var8++] & 63;
if (var11 < 128) {
var11 = 65533;
}
} else {
var11 = 65533;
}
} else if (var10 < 240) {
if (var8 + 1 < var9 && (var4[var8] & 192) == 128 && (var4[var8 + 1] & 192) == 128) {
var11 = (var10 & 15) << 12 | (var4[var8++] & 63) << 6 | var4[var8++] & 63;
if (var11 < 2048) {
var11 = 65533;
}
} else {
var11 = 65533;
}
} else if (var10 < 248) {
if (var8 + 2 < var9 && (var4[var8] & 192) == 128 && (var4[var8 + 1] & 192) == 128
&& (var4[var8 + 2] & 192) == 128) {
var11 = (var10 & 7) << 18 | (var4[var8++] & 63) << 12 | (var4[var8++] & 63) << 6
| var4[var8++] & 63;
if (var11 >= 65536 && var11 <= 1114111) {
var11 = 65533;
} else {
var11 = 65533;
}
} else {
var11 = 65533;
}
} else {
var11 = 65533;
}
}
String var3 = new String(var6, 0, var7);
this.offset += var2;
return var3;
}
}
}
public void readBytes(byte[] var1, int var2, int var3) {
for (int var4 = var2; var4 < var3 + var2; ++var4) {
var1[var4] = this.payload[++this.offset - 1];
}
}
public int readShortSmart() {
int var1 = this.payload[this.offset] & 255;
return var1 < 128 ? this.readUnsignedByte() - 64 : this.readUnsignedShort() - 49152;
}
public int getUSmart() {
int var1 = this.payload[this.offset] & 255;
return var1 < 128 ? this.readUnsignedByte() : this.readUnsignedShort() - 32768;
}
public int getLargeSmart() {
return this.payload[this.offset] < 0 ? this.readInt() & Integer.MAX_VALUE : this.readUnsignedShort();
}
public int method3576() {
if (this.payload[this.offset] < 0) {
return this.readInt() & Integer.MAX_VALUE;
} else {
int var1 = this.readUnsignedShort();
return var1 == 32767 ? -1 : var1;
}
}
public int readVarInt() {
byte var1 = this.payload[++this.offset - 1];
int var2;
for (var2 = 0; var1 < 0; var1 = this.payload[++this.offset - 1]) {
var2 = (var2 | var1 & 127) << 7;
}
return var2 | var1;
}
public void encryptXtea2(int[] var1) {
int var2 = this.offset / 8;
this.offset = 0;
for (int var3 = 0; var3 < var2; ++var3) {
int var4 = this.readInt();
int var5 = this.readInt();
int var6 = 0;
int var7 = -1640531527;
for (int var8 = 32; var8-- > 0; var5 += var4 + (var4 << 4 ^ var4 >>> 5) ^ var1[var6 >>> 11 & 3] + var6) {
var4 += var5 + (var5 << 4 ^ var5 >>> 5) ^ var6 + var1[var6 & 3];
var6 += var7;
}
this.offset -= 8;
this.putInt(var4);
this.putInt(var5);
}
}
public void decryptXtea(int[] var1) {
int var2 = this.offset / 8;
this.offset = 0;
for (int var3 = 0; var3 < var2; ++var3) {
int var4 = this.readInt();
int var5 = this.readInt();
int var6 = -957401312;
int var7 = -1640531527;
for (int var8 = 32; var8-- > 0; var4 -= var5 + (var5 << 4 ^ var5 >>> 5) ^ var6 + var1[var6 & 3]) {
var5 -= var4 + (var4 << 4 ^ var4 >>> 5) ^ var1[var6 >>> 11 & 3] + var6;
var6 -= var7;
}
this.offset -= 8;
this.putInt(var4);
this.putInt(var5);
}
}
public void encryptXtea(int[] var1, int var2, int var3) {
int var4 = this.offset;
this.offset = var2;
int var5 = (var3 - var2) / 8;
for (int var6 = 0; var6 < var5; ++var6) {
int var7 = this.readInt();
int var8 = this.readInt();
int var9 = 0;
int var10 = -1640531527;
for (int var11 = 32; var11-- > 0; var8 += var7 + (var7 << 4 ^ var7 >>> 5) ^ var1[var9 >>> 11 & 3] + var9) {
var7 += var8 + (var8 << 4 ^ var8 >>> 5) ^ var9 + var1[var9 & 3];
var9 += var10;
}
this.offset -= 8;
this.putInt(var7);
this.putInt(var8);
}
this.offset = var4;
}
public void decryptXtea(int[] var1, int var2, int var3) {
int var4 = this.offset;
this.offset = var2;
int var5 = (var3 - var2) / 8;
for (int var6 = 0; var6 < var5; ++var6) {
int var7 = this.readInt();
int var8 = this.readInt();
int var9 = -957401312;
int var10 = -1640531527;
for (int var11 = 32; var11-- > 0; var7 -= var8 + (var8 << 4 ^ var8 >>> 5) ^ var9 + var1[var9 & 3]) {
var8 -= var7 + (var7 << 4 ^ var7 >>> 5) ^ var1[var9 >>> 11 & 3] + var9;
var9 -= var10;
}
this.offset -= 8;
this.putInt(var7);
this.putInt(var8);
}
this.offset = var4;
}
public void encryptRsa(BigInteger var1, BigInteger var2) {
int var3 = this.offset;
this.offset = 0;
byte[] var4 = new byte[var3];
this.readBytes(var4, 0, var3);
BigInteger var5 = new BigInteger(var4);
BigInteger var6 = var5.modPow(var1, var2);
byte[] var7 = var6.toByteArray();
this.offset = 0;
this.putShort(var7.length);
this.putBytes(var7, 0, var7.length);
}
public int putCrc(int var1) {
int var2 = ClanMember.method5252(this.payload, var1, this.offset);
this.putInt(var2);
return var2;
}
public boolean checkCrc() {
this.offset -= 4;
int var1 = ClanMember.method5252(this.payload, 0, this.offset);
int var2 = this.readInt();
return var1 == var2;
}
public void method3541(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 + 128);
}
public void method3542(int var1) {
this.payload[++this.offset - 1] = (byte) (0 - var1);
}
public void method3543(int var1) {
this.payload[++this.offset - 1] = (byte) (128 - var1);
}
public int method3636() {
return this.payload[++this.offset - 1] - 128 & 255;
}
public int method3538() {
return 0 - this.payload[++this.offset - 1] & 255;
}
public int readUnsignedShortOb1() {
return 128 - this.payload[++this.offset - 1] & 255;
}
public byte method3725() {
return (byte) (this.payload[++this.offset - 1] - 128);
}
public byte method3548() {
return (byte) (0 - this.payload[++this.offset - 1]);
}
public byte method3634() {
return (byte) (128 - this.payload[++this.offset - 1]);
}
public void method3550(int var1) {
this.payload[++this.offset - 1] = (byte) var1;
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
}
public void method3551(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
this.payload[++this.offset - 1] = (byte) (var1 + 128);
}
public void method3528(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 + 128);
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
}
public int method3553() {
this.offset += 2;
return ((this.payload[this.offset - 1] & 255) << 8) + (this.payload[this.offset - 2] & 255);
}
public int method3554() {
this.offset += 2;
return (this.payload[this.offset - 1] - 128 & 255) + ((this.payload[this.offset - 2] & 255) << 8);
}
public int method3555() {
this.offset += 2;
return ((this.payload[this.offset - 1] & 255) << 8) + (this.payload[this.offset - 2] - 128 & 255);
}
public int method3595() {
this.offset += 2;
int var1 = ((this.payload[this.offset - 1] & 255) << 8) + (this.payload[this.offset - 2] & 255);
if (var1 > 32767) {
var1 -= 65536;
}
return var1;
}
public int method3556() {
this.offset += 2;
int var1 = ((this.payload[this.offset - 1] & 255) << 8) + (this.payload[this.offset - 2] - 128 & 255);
if (var1 > 32767) {
var1 -= 65536;
}
return var1;
}
public void method3722(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
this.payload[++this.offset - 1] = (byte) (var1 >> 16);
this.payload[++this.offset - 1] = (byte) var1;
}
public int method3558() {
this.offset += 3;
return (this.payload[this.offset - 1] & 255) + ((this.payload[this.offset - 3] & 255) << 8)
+ ((this.payload[this.offset - 2] & 255) << 16);
}
public void method3559(int var1) {
this.payload[++this.offset - 1] = (byte) var1;
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
this.payload[++this.offset - 1] = (byte) (var1 >> 16);
this.payload[++this.offset - 1] = (byte) (var1 >> 24);
}
public void method3552(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
this.payload[++this.offset - 1] = (byte) var1;
this.payload[++this.offset - 1] = (byte) (var1 >> 24);
this.payload[++this.offset - 1] = (byte) (var1 >> 16);
}
public void method3561(int var1) {
this.payload[++this.offset - 1] = (byte) (var1 >> 16);
this.payload[++this.offset - 1] = (byte) (var1 >> 24);
this.payload[++this.offset - 1] = (byte) var1;
this.payload[++this.offset - 1] = (byte) (var1 >> 8);
}
public int method3562() {
this.offset += 4;
return (this.payload[this.offset - 4] & 255) + ((this.payload[this.offset - 3] & 255) << 8)
+ ((this.payload[this.offset - 2] & 255) << 16) + ((this.payload[this.offset - 1] & 255) << 24);
}
public int method3563() {
this.offset += 4;
return ((this.payload[this.offset - 2] & 255) << 24) + ((this.payload[this.offset - 4] & 255) << 8)
+ (this.payload[this.offset - 3] & 255) + ((this.payload[this.offset - 1] & 255) << 16);
}
public int method3564() {
this.offset += 4;
return ((this.payload[this.offset - 1] & 255) << 8) + ((this.payload[this.offset - 4] & 255) << 16)
+ (this.payload[this.offset - 2] & 255) + ((this.payload[this.offset - 3] & 255) << 24);
}
public void method3565(byte[] var1, int var2, int var3) {
for (int var4 = var3 + var2 - 1; var4 >= var2; --var4) {
var1[var4] = this.payload[++this.offset - 1];
}
}
public void method3661(byte[] var1, int var2, int var3) {
for (int var4 = var2; var4 < var3 + var2; ++var4) {
var1[var4] = (byte) (this.payload[++this.offset - 1] - 128);
}
}
public static boolean method3727(String var0, int var1) {
return CombatInfoListHolder.method1865(var0, var1, "openjs");
}
}
| [
"Ian@Rune-Status.net"
] | Ian@Rune-Status.net |
39c825479877d730de0eccac31fba39e050d2a84 | de9e6fd3751970ae783d11661537f995c0e1d59d | /boot_redis01/src/main/java/org/egbz/bootRedis01/controller/GoodsController.java | 6b56bcaebc861b5645220180914dff705bc6150b | [] | no_license | egbz/redisDemo | 4d0e7cd13a62b34b9a5af2fac27e97f53b53e010 | 498ddd325b9499c6b000f83d7f3a0057aceb62f3 | refs/heads/main | 2023-04-29T09:10:44.015135 | 2021-05-17T08:19:24 | 2021-05-17T08:19:24 | 367,580,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,695 | java | package org.egbz.bootRedis01.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* @author egbz
* @date 2021/5/15
*/
@RestController
public class GoodsController {
public static final String REDIS_LOCK = "sellLock";
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Value("${server.port}")
private String serverPort;
@GetMapping("/buyGoods")
public String buyGoods() {
String value = UUID.randomUUID() + Thread.currentThread().getName();
try {
// 加锁 加过期时间, 此操作具备原子性
Boolean flag = stringRedisTemplate.opsForValue().setIfAbsent(REDIS_LOCK, value, 10L, TimeUnit.SECONDS); //setNX
if (flag) {
// get key 看库存数量够不够
String res = stringRedisTemplate.opsForValue().get("goods:001");
int goodsNumber = res == null ? 0 : Integer.parseInt(res);
if (goodsNumber > 0) {
int remaining = goodsNumber - 1;
stringRedisTemplate.opsForValue().set("goods:001", String.valueOf(remaining));
System.out.println("成功买到商品, 库存剩余: " + remaining + " serverPort: " + serverPort);
return "成功买到商品, 库存剩余: " + remaining + " serverPort: " + serverPort;
}
System.out.println("------------------- [failed]");
return "failed";
} else {
System.out.println(serverPort + "抢锁失败");
return "抢锁失败";
}
} finally {
// 解锁. 使用redis事务的版本
for (;;) {
stringRedisTemplate.watch(REDIS_LOCK);
if (stringRedisTemplate.opsForValue().get(REDIS_LOCK).equalsIgnoreCase(value)) {
stringRedisTemplate.setEnableTransactionSupport(true);
stringRedisTemplate.multi();
stringRedisTemplate.delete(REDIS_LOCK);
List<Object> list = stringRedisTemplate.exec();
if (list == null) {
continue;
}
}
stringRedisTemplate.unwatch();
break;
}
}
}
}
| [
"1023271893@qq.com"
] | 1023271893@qq.com |
e915eced46885cf3c070b891bf51ff97295b43c0 | 13c16c9627ff6acaf09765572e0686de66862e57 | /BaseTool.java | 298e19fff2a3d8698df226cf715c869c3031ad9a | [] | no_license | timetraveler00/metricsmanagement | be126ee5e6a34574a430e4eb5c3b813247131228 | a61dacca686e855b1010f89ea79ed52df9833d5a | refs/heads/master | 2020-12-22T23:36:03.097637 | 2020-01-29T11:19:21 | 2020-01-29T11:19:21 | 236,965,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,205 | java | public abstract class BaseTool
{
private boolean[] measurementType = new boolean[4] ;
private String[] measurementTypeStr = {"GENELSATIR", "GENELKARMASIKLIK", "GENELNESNE", "GENELBAKIM"};
private String pcfPath;
private String projectPath;
private String projectName;
private String dateStr ;
private String language;
private String dialect;
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getDialect() {
return dialect;
}
public void setDialect(String dialect) {
this.dialect = dialect;
}
public boolean[] getMeasurementType() {
return measurementType;
}
public void setMeasurementType(boolean[] measurementType) {
this.measurementType = measurementType;
}
public String getDateStr() {
return dateStr;
}
public void setDateStr(String dateStr) {
this.dateStr = dateStr;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void CreateCSV()
{
DeleteFile();
WriteFile();
ExecuteFile();
}
public abstract void DeleteFile();
public abstract void ExecuteFile();
public abstract void WriteFile();
public boolean getMeasurementType(int index ) {
return measurementType[index];
}
public void setMeasurementType(boolean gs, boolean gk, boolean gn, boolean gb) {
measurementType [0] = gs ;
measurementType [1] = gk ;
measurementType [2] = gn ;
measurementType [3] = gb ;
}
public String getPcfPath() {
return pcfPath;
}
public void setPcfPath(String pcfPath) {
this.pcfPath = pcfPath;
}
public String getProjectPath() {
return projectPath;
}
public void setProjectPath(String projectPath) {
this.projectPath = projectPath;
}
public String echoString (boolean metricType)
{
String echo = " echo ";
if (metricType)
echo = "";
return echo;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
504d325f8ae5994c3e9b983e724eee4c3d2243b9 | aec062f8b9011f6f27a4e55320db1baee1548af3 | /src/main/java/com/project/learncode/repo/CRepo.java | fc1dfc086d1dfff72d603b07ff6f8ec8e1d6f584 | [] | no_license | Harsh-Kumar-web/learncode | 5bb0d990bff238203c889483fa1b425afb54011c | a4fd8131b696d2e16327e32bacc8e86981cfc86d | refs/heads/main | 2023-06-23T10:15:05.781744 | 2021-07-20T08:07:18 | 2021-07-20T08:07:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package com.project.learncode.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import com.project.learncode.entity.C;
public interface CRepo extends JpaRepository<C,Long> {
}
| [
"anandkmr782@gmail.com"
] | anandkmr782@gmail.com |
96af9d688cccc964a83633d1fa210580872f668f | 4be41e44503a6d512329809ffb2bdb8f891a5ec8 | /src/main/java/com/andrerego/cursomc/services/exceptions/DataIntegrityException.java | 4c603d2743fbcc064cb11105a7633a9f7c5002b2 | [] | no_license | AndreMRego/cursomc | 031e8ac7511e8d5442975c2d51f37eea01acc569 | 0b1b8e25ffffd6a0b9673a0957a51677ead5254c | refs/heads/master | 2020-03-08T21:31:02.747025 | 2018-04-16T14:49:47 | 2018-04-16T14:49:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.andrerego.cursomc.services.exceptions;
public class DataIntegrityException extends RuntimeException{
private static final long serialVersionUID = 1L;
public DataIntegrityException(String msg) {
super(msg);
}
public DataIntegrityException(String msg, Throwable cause) {
super(msg,cause);
}
}
| [
"andremarcelo129@gmail.com"
] | andremarcelo129@gmail.com |
6c15870a46ec5bef46f8967627670b57de9bce56 | c71744a6f786279be763e8d23572dcb75f67dda0 | /Adapter/if1.java | 88b93e723a1c5c8f910e7798a6a64eef09bc8185 | [] | no_license | rickiey/Design-Patterns | 0250d64530fbfcb8468e014b8466fc04f2a6357f | fb01974b142cc95827c695c42b93f649df35558f | refs/heads/master | 2020-04-05T15:53:28.363266 | 2018-11-10T14:21:45 | 2018-11-10T14:21:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 63 | java | package Adapter;
public interface if1 {
void method1();
}
| [
"ruiyr@outlook.com"
] | ruiyr@outlook.com |
81c5c68c906725e019d4d8cb13f4108daf09c684 | 186bb03777c7cae70483b25e07ba5f2534139d24 | /app/src/main/java/com/example/administrator/qingming/model/ModelSealImage.java | c42550187b06fb2bac46bab06d1a3a93b3cf0017 | [] | no_license | puzuhui/Qingming | 4c9d08833f7448e13e0b4c052c5461d81dced932 | fb52957f71f9637f84a969105d3c839ca61d15f1 | refs/heads/master | 2021-01-01T11:56:14.149274 | 2017-10-13T09:54:50 | 2017-10-13T09:54:50 | 97,575,101 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,578 | java | package com.example.administrator.qingming.model;
import java.util.List;
/**
* Created by Administrator on 2017/9/14 0014.
*/
public class ModelSealImage {
/**
* status : 200
* message : 获取成功
* result : [{"id":"17","dz":"0e4aee48ea7144938a85bc1d73268b6f/gz/20170728112707.png","gz_lx":"1"}]
*/
private int status;
private String message;
private List<ResultBean> result;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<ResultBean> getResult() {
return result;
}
public void setResult(List<ResultBean> result) {
this.result = result;
}
public static class ResultBean {
/**
* id : 17
* dz : 0e4aee48ea7144938a85bc1d73268b6f/gz/20170728112707.png
* gz_lx : 1
*/
private String id;
private String dz;
private String gz_lx;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDz() {
return dz;
}
public void setDz(String dz) {
this.dz = dz;
}
public String getGz_lx() {
return gz_lx;
}
public void setGz_lx(String gz_lx) {
this.gz_lx = gz_lx;
}
}
}
| [
"2753015604@qq.com"
] | 2753015604@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.