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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ea58a745a30888d9d4a9234c5d529f95c223fcc5 | 7c9a80b86ec3cfa0015d29b4e44cb2ce807e2c74 | /server/src/parsing/customer/bootstrapper/LoaferLoader.java | b61e6445c7976719d40b575bad177b128f961e88 | [] | no_license | Leargy/open_rmt_managedb | 52cfd738616eec47d7545a99aa45dc925eccd587 | 5ac7d24ddeb84cc160e273b36d59c3dcb53e1f63 | refs/heads/master | 2022-09-15T08:23:29.110041 | 2020-05-16T12:00:11 | 2020-05-16T12:00:11 | 267,753,834 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,958 | java | package parsing.customer.bootstrapper;
import entities.Mappable;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* Скелет подгрузчика коллекции и этим все сказано
* @param <V> тип элементов подгружаемой коллекции
*/
public interface LoaferLoader<V extends Mappable> {
List<V> load();
void unload(List<V> elements);
/**
* Метод выполняющий проверку на правильное заполнение файла или наличие кошачьего наполнителя в файле.
* Если не будут заполнены обязательные поля, метод заполняет их значениями по умолчанию.
* @param foil я задолбался опечатываться, так что оставлю с таким названием, так смешнее
* @return true/false
* @throws IOException типичное исключение системы ввода/выводы, которое, как неприступная дева, никогда ничего о себе не расскажет
*/
boolean checkFile(File foil) throws IOException;
/**
* Свойство записи названия
* переменной окружения в поле
* @param varName название переменной окружения
*/
void Environment(String varName);
/**
* Свойство получения,
* признака того, что коллекция
* уже подгружена
* @return признак загрузки коллекции
*/
boolean Loaded();
/**
* Свойство для получения даты создания файла
* @return строковое представление даты создания файла или загрузчика
*/
String Birth();
}
| [
"rayveleaveme34@inbox.ru"
] | rayveleaveme34@inbox.ru |
acbe4e342011f123a4bcf3bde5ea0cf3246d9abb | b791cbad3be7d50067697bcd7bd3da956849f849 | /src/com/ccsi/leetcode3/LC384ShuffleAnArray.java | a6a2ba2a6947e3016dea336aad08fa601001ec1d | [] | no_license | liugxiami/Leetcode2017 | 999e7ebb78fcb94bcf38273d2ef2cd80247684cf | 029326163564ec4ced4263dc085d2c1247a4a296 | refs/heads/master | 2021-01-01T16:44:25.617019 | 2019-03-13T03:27:45 | 2019-03-13T03:27:45 | 97,907,256 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | package com.ccsi.leetcode3;
import java.util.*;
/**
* Created by gxliu on 2018/4/16.
*/
public class LC384ShuffleAnArray {
private int[] array=null;
private Random random=null;
public LC384ShuffleAnArray(int[] nums){
this.array=nums;
this.random=new Random();
}
public int[] reset(){
return array;
}
public int[] shuffle(){
if(array==null)return array;
int[] a=(int[])array.clone();
for (int i = 1; i < array.length; i++) {
int ran=random.nextInt(i+1);
swap(a,i,ran);
}
return a;
}
private void swap(int[] a,int p,int q){
int temp=a[p];
a[p]=a[q];
a[q]=temp;
}
public static void main(String[] args) {
int[] nums={1,2,3,4};
LC384ShuffleAnArray shuffle=new LC384ShuffleAnArray(nums);
int[] result=shuffle.shuffle();
for (int i = 0; i < nums.length; i++) {
System.out.println(result[i]);
}
int[] res=shuffle.reset();
for (int i = 0; i < nums.length; i++) {
System.out.println(res[i]);
}
}
}
| [
"xiamiliu@gmail.com"
] | xiamiliu@gmail.com |
698d932b19cb93953568462406dfd6dac444c287 | f0500a1a1522d5bca897ff61450dd3dfabd82b35 | /shopElectro/src/models/Basket.java | 1413416c1992f909cc4d1d70829b98976b446a14 | [] | no_license | GusevVrn/Presentation | 04efe1dec854040c85f5b6a6a63518b340895fe4 | 5c28fe890b1d2ece2ee55a26734a5416565354a9 | refs/heads/main | 2023-06-25T05:57:08.570109 | 2021-07-27T14:06:02 | 2021-07-27T14:06:02 | 387,728,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package models;
public class Basket {
private int id;
private String title;
private int price;
private String user;
private String phone;
private String status;
Basket(int id, String title, int price, String user, String phone, String status){
this.id = id;
this.title = title;
this.price = price;
this.user = user;
this.phone = phone;
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
} | [
"noreply@github.com"
] | noreply@github.com |
743973fe89cbc27a8e9882ddeaa1f8f7f9b3a12f | 39aa0314588ed265a50e9db08ea5d92f3cb223c7 | /StdAudio.java | 6b966fe2a0bf8d30750c86abb73a3f88e1754d4d | [] | no_license | dinesh-krishnan-balakrishnan/Keyboard-Piano | 7763ac610ca6b07683f347a9fbc6c34fcd128db3 | 59a85a35462c0565d7fd4848f3053ad5ad63d9a7 | refs/heads/main | 2023-02-02T03:56:13.870030 | 2020-12-21T20:03:13 | 2020-12-21T20:03:13 | 323,435,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,244 | java | /******************************************************************************
* Compilation: javac StdAudio.java
* Execution: java StdAudio
* Dependencies: none
*
* Simple library for reading, writing, and manipulating .wav files.
*
*
* Limitations
* -----------
* - Assumes the audio is monaural, little endian, with sampling rate
* of 44,100
* - check when reading .wav files from a .jar file ?
*
******************************************************************************/
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;
/**
* <i>Standard audio</i>. This class provides a basic capability for
* creating, reading, and saving audio.
* <p>
* The audio format uses a sampling rate of 44,100 Hz, 16-bit, monaural.
*
* <p>
* For additional documentation, see <a href="https://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
* <i>Computer Science: An Interdisciplinary Approach</i> by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public final class StdAudio {
/**
* The sample rate: 44,100 Hz for CD quality audio.
*/
public static final int SAMPLE_RATE = 44100;
private static final int BYTES_PER_SAMPLE = 2; // 16-bit audio
private static final int BITS_PER_SAMPLE = 16; // 16-bit audio
private static final double MAX_16_BIT = 32768;
private static final int SAMPLE_BUFFER_SIZE = 4096;
private static final int MONO = 1;
private static final int STEREO = 2;
private static final boolean LITTLE_ENDIAN = false;
private static final boolean BIG_ENDIAN = true;
private static final boolean SIGNED = true;
private static final boolean UNSIGNED = false;
private static SourceDataLine line; // to play the sound
private static byte[] buffer; // our internal buffer
private static int bufferSize = 0; // number of samples currently in internal buffer
private StdAudio() {
// can not instantiate
}
// static initializer
static {
init();
}
// open up an audio stream
private static void init() {
try {
// 44,100 Hz, 16-bit audio, mono, signed PCM, little endian
AudioFormat format = new AudioFormat((float) SAMPLE_RATE, BITS_PER_SAMPLE, MONO, SIGNED, LITTLE_ENDIAN);
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
line = (SourceDataLine) AudioSystem.getLine(info);
line.open(format, SAMPLE_BUFFER_SIZE * BYTES_PER_SAMPLE);
// the internal buffer is a fraction of the actual buffer size, this choice is arbitrary
// it gets divided because we can't expect the buffered data to line up exactly with when
// the sound card decides to push out its samples.
buffer = new byte[SAMPLE_BUFFER_SIZE * BYTES_PER_SAMPLE/3];
}
catch (LineUnavailableException e) {
System.out.println(e.getMessage());
}
// no sound gets made before this call
line.start();
}
// get an AudioInputStream object from a file
private static AudioInputStream getAudioInputStreamFromFile(String filename) {
if (filename == null) {
throw new IllegalArgumentException("filename is null");
}
try {
// first try to read file from local file system
File file = new File(filename);
if (file.exists()) {
return AudioSystem.getAudioInputStream(file);
}
// resource relative to .class file
InputStream is1 = StdAudio.class.getResourceAsStream(filename);
if (is1 != null) {
return AudioSystem.getAudioInputStream(is1);
}
// resource relative to classloader root
InputStream is2 = StdAudio.class.getClassLoader().getResourceAsStream(filename);
if (is2 != null) {
return AudioSystem.getAudioInputStream(is2);
}
// give up
else {
throw new IllegalArgumentException("could not read '" + filename + "'");
}
}
catch (IOException e) {
throw new IllegalArgumentException("could not read '" + filename + "'", e);
}
catch (UnsupportedAudioFileException e) {
throw new IllegalArgumentException("file of unsupported audio format: '" + filename + "'", e);
}
}
/**
* Closes standard audio.
*/
public static void close() {
line.drain();
line.stop();
}
/**
* Writes one sample (between -1.0 and +1.0) to standard audio.
* If the sample is outside the range, it will be clipped.
*
* @param sample the sample to play
* @throws IllegalArgumentException if the sample is {@code Double.NaN}
*/
public static void play(double sample) {
if (Double.isNaN(sample)) throw new IllegalArgumentException("sample is NaN");
// clip if outside [-1, +1]
if (sample < -1.0) sample = -1.0;
if (sample > +1.0) sample = +1.0;
// convert to bytes
short s = (short) (MAX_16_BIT * sample);
if (sample == 1.0) s = Short.MAX_VALUE; // special case since 32768 not a short
buffer[bufferSize++] = (byte) s;
buffer[bufferSize++] = (byte) (s >> 8); // little endian
// send to sound card if buffer is full
if (bufferSize >= buffer.length) {
line.write(buffer, 0, buffer.length);
bufferSize = 0;
}
}
/**
* Writes the array of samples (between -1.0 and +1.0) to standard audio.
* If a sample is outside the range, it will be clipped.
*
* @param samples the array of samples to play
* @throws IllegalArgumentException if any sample is {@code Double.NaN}
* @throws IllegalArgumentException if {@code samples} is {@code null}
*/
public static void play(double[] samples) {
if (samples == null) throw new IllegalArgumentException("argument to play() is null");
for (int i = 0; i < samples.length; i++) {
play(samples[i]);
}
}
/**
* Reads audio samples from a file (in .wav or .au format) and returns
* them as a double array with values between -1.0 and +1.0.
* The audio file must be 16-bit with a sampling rate of 44,100.
* It can be mono or stereo.
*
* @param filename the name of the audio file
* @return the array of samples
*/
public static double[] read(String filename) {
// make sure that AudioFormat is 16-bit, 44,100 Hz, little endian
final AudioInputStream ais = getAudioInputStreamFromFile(filename);
AudioFormat audioFormat = ais.getFormat();
// require sampling rate = 44,100 Hz
if (audioFormat.getSampleRate() != SAMPLE_RATE) {
throw new IllegalArgumentException("StdAudio.read() currently supports only a sample rate of " + SAMPLE_RATE + " Hz\n"
+ "audio format: " + audioFormat);
}
// require 16-bit audio
if (audioFormat.getSampleSizeInBits() != BITS_PER_SAMPLE) {
throw new IllegalArgumentException("StdAudio.read() currently supports only " + BITS_PER_SAMPLE + "-bit audio\n"
+ "audio format: " + audioFormat);
}
// require little endian
if (audioFormat.isBigEndian()) {
throw new IllegalArgumentException("StdAudio.read() currently supports only audio stored using little endian\n"
+ "audio format: " + audioFormat);
}
byte[] bytes = null;
try {
int bytesToRead = ais.available();
bytes = new byte[bytesToRead];
int bytesRead = ais.read(bytes);
if (bytesToRead != bytesRead) {
throw new IllegalStateException("read only " + bytesRead + " of " + bytesToRead + " bytes");
}
}
catch (IOException ioe) {
throw new IllegalArgumentException("could not read '" + filename + "'", ioe);
}
int n = bytes.length;
// little endian, mono
if (audioFormat.getChannels() == MONO) {
double[] data = new double[n/2];
for (int i = 0; i < n/2; i++) {
// little endian, mono
data[i] = ((short) (((bytes[2*i+1] & 0xFF) << 8) | (bytes[2*i] & 0xFF))) / MAX_16_BIT;
}
return data;
}
// little endian, stereo
else if (audioFormat.getChannels() == STEREO) {
double[] data = new double[n/4];
for (int i = 0; i < n/4; i++) {
double left = ((short) (((bytes[4*i+1] & 0xFF) << 8) | (bytes[4*i + 0] & 0xFF))) / MAX_16_BIT;
double right = ((short) (((bytes[4*i+3] & 0xFF) << 8) | (bytes[4*i + 2] & 0xFF))) / MAX_16_BIT;
data[i] = (left + right) / 2.0;
}
return data;
}
// TODO: handle big endian (or other formats)
else throw new IllegalStateException("audio format is neither mono or stereo");
}
/**
* Saves the double array as an audio file (using .wav or .au format).
*
* @param filename the name of the audio file
* @param samples the array of samples
* @throws IllegalArgumentException if unable to save {@code filename}
* @throws IllegalArgumentException if {@code samples} is {@code null}
* @throws IllegalArgumentException if {@code filename} is {@code null}
* @throws IllegalArgumentException if {@code filename} extension is not {@code .wav}
* or {@code .au}
*/
public static void save(String filename, double[] samples) {
if (filename == null) {
throw new IllegalArgumentException("filenameis null");
}
if (samples == null) {
throw new IllegalArgumentException("samples[] is null");
}
// assumes 16-bit samples with sample rate = 44,100 Hz
// use 16-bit audio, mono, signed PCM, little Endian
AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, MONO, SIGNED, LITTLE_ENDIAN);
byte[] data = new byte[2 * samples.length];
for (int i = 0; i < samples.length; i++) {
int temp = (short) (samples[i] * MAX_16_BIT);
if (samples[i] == 1.0) temp = Short.MAX_VALUE; // special case since 32768 not a short
data[2*i + 0] = (byte) temp;
data[2*i + 1] = (byte) (temp >> 8); // little endian
}
// now save the file
try {
ByteArrayInputStream bais = new ByteArrayInputStream(data);
AudioInputStream ais = new AudioInputStream(bais, format, samples.length);
if (filename.endsWith(".wav") || filename.endsWith(".WAV")) {
AudioSystem.write(ais, AudioFileFormat.Type.WAVE, new File(filename));
}
else if (filename.endsWith(".au") || filename.endsWith(".AU")) {
AudioSystem.write(ais, AudioFileFormat.Type.AU, new File(filename));
}
else {
throw new IllegalArgumentException("file type for saving must be .wav or .au");
}
}
catch (IOException ioe) {
throw new IllegalArgumentException("unable to save file '" + filename + "'", ioe);
}
}
/**
* Plays an audio file (in .wav, .mid, or .au format) in a background thread.
*
* @param filename the name of the audio file
* @throws IllegalArgumentException if unable to play {@code filename}
* @throws IllegalArgumentException if {@code filename} is {@code null}
*/
public static synchronized void play(final String filename) {
new Thread(new Runnable() {
public void run() {
AudioInputStream ais = getAudioInputStreamFromFile(filename);
stream(ais);
}
}).start();
}
// https://www3.ntu.edu.sg/home/ehchua/programming/java/J8c_PlayingSound.html
// play a wav or aif file
// javax.sound.sampled.Clip fails for long clips (on some systems), perhaps because
// JVM closes (see remedy in loop)
private static void stream(AudioInputStream ais) {
SourceDataLine line = null;
int BUFFER_SIZE = 4096; // 4K buffer
try {
AudioFormat audioFormat = ais.getFormat();
DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
line = (SourceDataLine) AudioSystem.getLine(info);
line.open(audioFormat);
line.start();
byte[] samples = new byte[BUFFER_SIZE];
int count = 0;
while ((count = ais.read(samples, 0, BUFFER_SIZE)) != -1) {
line.write(samples, 0, count);
}
}
catch (IOException e) {
e.printStackTrace();
}
catch (LineUnavailableException e) {
e.printStackTrace();
}
finally {
if (line != null) {
line.drain();
line.close();
}
}
}
/**
* Loops an audio file (in .wav, .mid, or .au format) in a background thread.
*
* @param filename the name of the audio file
* @throws IllegalArgumentException if {@code filename} is {@code null}
*/
public static synchronized void loop(String filename) {
if (filename == null) throw new IllegalArgumentException();
final AudioInputStream ais = getAudioInputStreamFromFile(filename);
try {
Clip clip = AudioSystem.getClip();
// Clip clip = (Clip) AudioSystem.getLine(new Line.Info(Clip.class));
clip.open(ais);
clip.loop(Clip.LOOP_CONTINUOUSLY);
}
catch (LineUnavailableException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
// keep JVM open
new Thread(new Runnable() {
public void run() {
while (true) {
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
/***************************************************************************
* Unit tests {@code StdAudio}.
***************************************************************************/
// create a note (sine wave) of the given frequency (Hz), for the given
// duration (seconds) scaled to the given volume (amplitude)
private static double[] note(double hz, double duration, double amplitude) {
int n = (int) (StdAudio.SAMPLE_RATE * duration);
double[] a = new double[n+1];
for (int i = 0; i <= n; i++)
a[i] = amplitude * Math.sin(2 * Math.PI * i * hz / StdAudio.SAMPLE_RATE);
return a;
}
/**
* Test client - play an A major scale to standard audio.
*
* @param args the command-line arguments
*/
/**
* Test client - play an A major scale to standard audio.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
// 440 Hz for 1 sec
double freq = 440.0;
for (int i = 0; i <= StdAudio.SAMPLE_RATE; i++) {
StdAudio.play(0.5 * Math.sin(2*Math.PI * freq * i / StdAudio.SAMPLE_RATE));
}
// scale increments
int[] steps = { 0, 2, 4, 5, 7, 9, 11, 12 };
for (int i = 0; i < steps.length; i++) {
double hz = 440.0 * Math.pow(2, steps[i] / 12.0);
StdAudio.play(note(hz, 1.0, 0.5));
}
// need to call this in non-interactive stuff so the program doesn't terminate
// until all the sound leaves the speaker.
StdAudio.close();
}
}
//Copyright 2000 - 2017, Robert Sedgewick and Kevin Wayne.
//Last updated: Wed Jul 31 15:09:28 EDT 2019. | [
"noreply@github.com"
] | noreply@github.com |
106214b1b6a24a5a49ddb3056ad6cf2d112c955e | e66439311f0326bea95daaf4a252d84f734606f8 | /src/tests/scenarios/GenerationGnuplotFiles.java | 1b14d0750f2fb9c8fb51246a742dbcef765f850f | [] | no_license | fabe85/Alevin2 | 79d6d08666db04493eb3edfa3e22772f7135e2d5 | 5290a57f6cd310a11fd4a9eb51964157be4bd75e | refs/heads/master | 2021-01-02T09:02:43.846365 | 2014-10-23T12:45:16 | 2014-10-23T12:45:16 | 25,636,568 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 9,519 | java | /* ***** BEGIN LICENSE BLOCK *****
* Copyright (C) 2010-2011, The VNREAL Project Team.
*
* This work has been funded by the European FP7
* Network of Excellence "Euro-NF" (grant agreement no. 216366)
* through the Specific Joint Developments and Experiments Project
* "Virtual Network Resource Embedding Algorithms" (VNREAL).
*
* The VNREAL Project Team consists of members from:
* - University of Wuerzburg, Germany
* - Universitat Politecnica de Catalunya, Spain
* - University of Passau, Germany
* See the file AUTHORS for details and contact information.
*
* This file is part of ALEVIN (ALgorithms for Embedding VIrtual Networks).
*
* ALEVIN is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License Version 3 or later
* (the "GPL"), or the GNU Lesser General Public License Version 3 or later
* (the "LGPL") as published by the Free Software Foundation.
*
* ALEVIN is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* or the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License and
* GNU Lesser General Public License along with ALEVIN; see the file
* COPYING. If not, see <http://www.gnu.org/licenses/>.
*
* ***** END LICENSE BLOCK ***** */
package tests.scenarios;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;
public class GenerationGnuplotFiles {
boolean hiddenHops, pathSplitting;
String filePath = "/media/09A6-55A7/Evaluations/toPlot";
String readPath = "/media/09A6-55A7/Evaluations/";
int nodesPerVN;
int numVNs;
private File fFile;
public GenerationGnuplotFiles(boolean hH, boolean isPs, int nodesPerVN,
int numVNs) {
this.hiddenHops = hH;
this.pathSplitting = isPs;
this.nodesPerVN = nodesPerVN;
this.numVNs = numVNs;
fFile = null;
if (isPs) {
if (hH) {
filePath += "/PSAlgorithms/HiddenHopsAlgorithms/"
+ Integer.toString(nodesPerVN) + "nodesPerVNet-"
+ Integer.toString(numVNs) + "VNets/";
} else {
filePath += "/ResultsAllAlgorithms/"
+ Integer.toString(nodesPerVN) + "nodesPerVNet-"
+ Integer.toString(numVNs) + "VNets/";
}
} else {
if (hH) {
filePath += "/SPAlgorithms/HiddenHopsAlgorithms/"
+ Integer.toString(nodesPerVN) + "nodesPerVNet-"
+ Integer.toString(numVNs) + "VNets/";
} else {
filePath += "/ResultsAllAlgorithms/"
+ Integer.toString(nodesPerVN) + "nodesPerVNet-"
+ Integer.toString(numVNs) + "VNets/";
}
}
}
public void generateFiles(LinkedList<String> algorithms) throws IOException {
Scanner scanner;
int i;
LinkedList<String> readPaths = new LinkedList<String>();
String currAlgorithm;
String[] metricValues;
LinkedList<Double> costRev = new LinkedList<Double>();
LinkedList<Double> cost = new LinkedList<Double>();
LinkedList<Double> mappedRev = new LinkedList<Double>();
LinkedList<Double> linkUti = new LinkedList<Double>();
LinkedList<Double> nodeUti = new LinkedList<Double>();
LinkedList<Double> maxLinkSt = new LinkedList<Double>();
LinkedList<Double> maxNodeSt = new LinkedList<Double>();
LinkedList<Double> VNaccepRatio = new LinkedList<Double>();
LinkedList<Double> revRatio = new LinkedList<Double>();
LinkedList<Double> remaLinkRes = new LinkedList<Double>();
LinkedList<Double> avLinkCost = new LinkedList<Double>();
LinkedList<Double> costRevTiMapRev = new LinkedList<Double>();
for (i = 0; i < algorithms.size(); i++) {
readPaths.add(readPath + algorithms.get(i) + "/toGraph/"
+ "resultToDraw_" + Integer.toString(numVNs) + "_"
+ Integer.toString(nodesPerVN) + ".dat");
}
Iterator<String> currAlgo = readPaths.iterator();
while (currAlgo.hasNext()) {
currAlgorithm = currAlgo.next().toString();
fFile = new File(currAlgorithm);
scanner = new Scanner(fFile);
String nextLine;
scanner.nextLine();
scanner.nextLine();
while (scanner.hasNextLine()) {
nextLine = scanner.nextLine();
metricValues = nextLine.split(" ");
for (i = 0; i < 10; i++) {
costRev.add(Double.parseDouble(metricValues[1]));
cost.add(Double.parseDouble(metricValues[2]));
mappedRev.add(Double.parseDouble(metricValues[3]));
linkUti.add(Double.parseDouble(metricValues[4]));
nodeUti.add(Double.parseDouble(metricValues[5]));
maxLinkSt.add(Double.parseDouble(metricValues[6]));
maxNodeSt.add(Double.parseDouble(metricValues[7]));
VNaccepRatio.add(Double.parseDouble(metricValues[8]));
revRatio.add(Double.parseDouble(metricValues[9]));
remaLinkRes.add(Double.parseDouble(metricValues[10]));
avLinkCost.add(Double.parseDouble(metricValues[11]));
costRevTiMapRev.add(Double.parseDouble(metricValues[12]));
}
}
}
writeFile("CostComparation", (minValue(cost) - minValue(cost) * 0.1),
(maxValue(cost) + maxValue(cost) * 0.05), readPaths,
algorithms, 3, "Cost");
writeFile("CostRevenueComparation",
(minValue(costRev) - minValue(costRev) * 0.1),
(maxValue(costRev) + maxValue(costRev) * 0.05), readPaths,
algorithms, 2, "C/R");
writeFile("LinkUtilizationComparation",
(minValue(linkUti) - minValue(linkUti) * 0.1),
(maxValue(linkUti) + maxValue(linkUti) * 0.05), readPaths,
algorithms, 5, "Link Utilization");
writeFile("MappedRevenueComparation",
(minValue(mappedRev) - minValue(mappedRev) * 0.1),
(maxValue(mappedRev) + maxValue(mappedRev) * 0.05), readPaths,
algorithms, 4, "Mapped Revenue");
writeFile("MaxLinkStress",
(minValue(maxLinkSt) - minValue(maxLinkSt) * 0.1),
(maxValue(maxLinkSt) + maxValue(maxLinkSt) * 0.05), readPaths,
algorithms, 7, "Max Link Stress");
writeFile("MaxNodeStress",
(minValue(maxNodeSt) - minValue(maxNodeSt) * 0.1),
(maxValue(maxNodeSt) + maxValue(maxNodeSt) * 0.05), readPaths,
algorithms, 8, "Max Node Stress");
writeFile("NodeUtilizationComparation",
(minValue(nodeUti) - minValue(nodeUti) * 0.1),
(maxValue(nodeUti) + maxValue(nodeUti) * 0.05), readPaths,
algorithms, 6, "Max Node Stress");
writeFile("RevenueRatio",
(minValue(revRatio) - minValue(revRatio) * 0.1),
(maxValue(revRatio) + maxValue(revRatio) * 0.05), readPaths,
algorithms, 10, "Percentage Accepted Revenue");
writeFile("VNAcceptanceRatio",
(minValue(VNaccepRatio) - minValue(VNaccepRatio) * 0.1),
(maxValue(VNaccepRatio) + maxValue(VNaccepRatio) * 0.05),
readPaths, algorithms, 9, "VNs Acceptance Ratio");
writeFile("AvailableLinkResource",
(minValue(remaLinkRes) - minValue(remaLinkRes) * 0.1),
(maxValue(remaLinkRes) + maxValue(remaLinkRes) * 0.05),
readPaths, algorithms, 11, "Remaining Link Resource");
writeFile("LinkCostPerMappedVNR",
(minValue(avLinkCost) - minValue(avLinkCost) * 0.1),
(maxValue(avLinkCost) + maxValue(avLinkCost) * 0.05),
readPaths, algorithms, 12, "Average Link Cost per Mapped VNR");
writeFile("CostRevTiMapRev",
(minValue(costRevTiMapRev) - minValue(costRevTiMapRev) * 0.1),
(maxValue(costRevTiMapRev) + maxValue(costRevTiMapRev) * 0.05),
readPaths, algorithms, 13, "Cost REvenue times MappeRev Ratio");
}
private void writeFile(String file, double minValue, double maxValue,
LinkedList<String> readPa, LinkedList<String> algo, int column,
String name) throws IOException {
FileWriter fstream;
fstream = new FileWriter(filePath + file + ".gnuplot");
BufferedWriter output = new BufferedWriter(fstream);
output.write("set term postscript eps enhanced color\n");
output.write("set output '" + file + ".eps'\n");
output.write("set boxwidth 0.2 absolute\n");
output.write("set title \"" + file + "\"\n");
output.write("set xlabel 'rho'\n");
output.write("set ylabel '" + name + "'\n");
output.write("set xrange [ 0.1 : 0.9 ] noreverse nowriteback\n");
output.write("set yrange [" + Double.toString(minValue) + " : "
+ Double.toString(maxValue) + " ] noreverse nowriteback\n");
output.write("plot '" + readPa.get(0) + "' using 1:"
+ Integer.toString(column) + " title \"" + algo.get(0)
+ "\" with linespoint, \\\n");
for (int i = 1; i < algo.size() - 1; i++) {
output.write(" '" + readPa.get(i) + "' using 1:"
+ Integer.toString(column) + " title \"" + algo.get(i)
+ "\" with linespoint, \\\n");
}
output.write(" '" + readPa.get(algo.size() - 1) + "' using 1:"
+ Integer.toString(column) + " title \""
+ algo.get(algo.size() - 1) + "\" with linespoint \n");
output.write("set output\n");
output.write("quit");
output.close();
}
private double maxValue(LinkedList<Double> list) {
double max = 0.0;
double currValue;
int i = 0;
Iterator<Double> ite = list.iterator();
while (ite.hasNext()) {
ite.next();
currValue = list.get(i);
i++;
if (currValue > max)
max = currValue;
}
return max;
}
private double minValue(LinkedList<Double> list) {
double min = 0.0;
double currValue;
int i = 0;
boolean flag = true;
Iterator<Double> ite = list.iterator();
while (ite.hasNext()) {
ite.next();
if (flag) {
flag = false;
min = list.get(i);
}
currValue = list.get(i);
i++;
if (currValue < min)
min = currValue;
}
return min;
}
}
| [
"baskefab@fim.uni-passau.de"
] | baskefab@fim.uni-passau.de |
0c26f96ca89841d1e8d41915583e4903e20c244c | a4f057f8b1911153e4240eb2abd5e7ba5fe028e0 | /casestudy/src/main/java/dev/squaremile/transport/casestudy/marketmaking/schema/ExecutionReportDecoder.java | b56ee2777c11c73e195d840acf93a28e7efd47f4 | [] | no_license | squaremiledev/asynctransport-samples | e0a746666d1ad3cec3f2cea8ce52e187540f0f67 | c4ebb2e7267762d7273ec99c0c0ce7ac00b983f1 | refs/heads/master | 2023-06-02T06:31:51.784082 | 2021-06-19T13:48:45 | 2021-06-19T14:04:21 | 291,296,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,541 | java | /* Generated SBE (Simple Binary Encoding) message codec */
package dev.squaremile.transport.casestudy.marketmaking.schema;
import org.agrona.MutableDirectBuffer;
import org.agrona.DirectBuffer;
@SuppressWarnings("all")
public class ExecutionReportDecoder
{
public static final int BLOCK_LENGTH = 56;
public static final int TEMPLATE_ID = 4;
public static final int SCHEMA_ID = 1;
public static final int SCHEMA_VERSION = 0;
public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN;
private final ExecutionReportDecoder parentMessage = this;
private DirectBuffer buffer;
protected int offset;
protected int limit;
protected int actingBlockLength;
protected int actingVersion;
public int sbeBlockLength()
{
return BLOCK_LENGTH;
}
public int sbeTemplateId()
{
return TEMPLATE_ID;
}
public int sbeSchemaId()
{
return SCHEMA_ID;
}
public int sbeSchemaVersion()
{
return SCHEMA_VERSION;
}
public String sbeSemanticType()
{
return "";
}
public DirectBuffer buffer()
{
return buffer;
}
public int offset()
{
return offset;
}
public ExecutionReportDecoder wrap(
final DirectBuffer buffer,
final int offset,
final int actingBlockLength,
final int actingVersion)
{
if (buffer != this.buffer)
{
this.buffer = buffer;
}
this.offset = offset;
this.actingBlockLength = actingBlockLength;
this.actingVersion = actingVersion;
limit(offset + actingBlockLength);
return this;
}
public int encodedLength()
{
return limit - offset;
}
public int limit()
{
return limit;
}
public void limit(final int limit)
{
this.limit = limit;
}
public static int passiveMarketParticipantIdId()
{
return 1;
}
public static int passiveMarketParticipantIdSinceVersion()
{
return 0;
}
public static int passiveMarketParticipantIdEncodingOffset()
{
return 0;
}
public static int passiveMarketParticipantIdEncodingLength()
{
return 4;
}
public static String passiveMarketParticipantIdMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static int passiveMarketParticipantIdNullValue()
{
return -2147483648;
}
public static int passiveMarketParticipantIdMinValue()
{
return -2147483647;
}
public static int passiveMarketParticipantIdMaxValue()
{
return 2147483647;
}
public int passiveMarketParticipantId()
{
return buffer.getInt(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int aggressiveMarketParticipantIdId()
{
return 2;
}
public static int aggressiveMarketParticipantIdSinceVersion()
{
return 0;
}
public static int aggressiveMarketParticipantIdEncodingOffset()
{
return 4;
}
public static int aggressiveMarketParticipantIdEncodingLength()
{
return 4;
}
public static String aggressiveMarketParticipantIdMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static int aggressiveMarketParticipantIdNullValue()
{
return -2147483648;
}
public static int aggressiveMarketParticipantIdMinValue()
{
return -2147483647;
}
public static int aggressiveMarketParticipantIdMaxValue()
{
return 2147483647;
}
public int aggressiveMarketParticipantId()
{
return buffer.getInt(offset + 4, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int midPriceId()
{
return 3;
}
public static int midPriceSinceVersion()
{
return 0;
}
public static int midPriceEncodingOffset()
{
return 8;
}
public static int midPriceEncodingLength()
{
return 8;
}
public static String midPriceMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static long midPriceNullValue()
{
return -9223372036854775808L;
}
public static long midPriceMinValue()
{
return -9223372036854775807L;
}
public static long midPriceMaxValue()
{
return 9223372036854775807L;
}
public long midPrice()
{
return buffer.getLong(offset + 8, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int lastUpdateTimeId()
{
return 4;
}
public static int lastUpdateTimeSinceVersion()
{
return 0;
}
public static int lastUpdateTimeEncodingOffset()
{
return 16;
}
public static int lastUpdateTimeEncodingLength()
{
return 8;
}
public static String lastUpdateTimeMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static long lastUpdateTimeNullValue()
{
return -9223372036854775808L;
}
public static long lastUpdateTimeMinValue()
{
return -9223372036854775807L;
}
public static long lastUpdateTimeMaxValue()
{
return 9223372036854775807L;
}
public long lastUpdateTime()
{
return buffer.getLong(offset + 16, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int lastPriceChangeId()
{
return 5;
}
public static int lastPriceChangeSinceVersion()
{
return 0;
}
public static int lastPriceChangeEncodingOffset()
{
return 24;
}
public static int lastPriceChangeEncodingLength()
{
return 8;
}
public static String lastPriceChangeMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static long lastPriceChangeNullValue()
{
return -9223372036854775808L;
}
public static long lastPriceChangeMinValue()
{
return -9223372036854775807L;
}
public static long lastPriceChangeMaxValue()
{
return 9223372036854775807L;
}
public long lastPriceChange()
{
return buffer.getLong(offset + 24, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int bidPriceId()
{
return 6;
}
public static int bidPriceSinceVersion()
{
return 0;
}
public static int bidPriceEncodingOffset()
{
return 32;
}
public static int bidPriceEncodingLength()
{
return 8;
}
public static String bidPriceMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static long bidPriceNullValue()
{
return -9223372036854775808L;
}
public static long bidPriceMinValue()
{
return -9223372036854775807L;
}
public static long bidPriceMaxValue()
{
return 9223372036854775807L;
}
public long bidPrice()
{
return buffer.getLong(offset + 32, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int bidQuantityId()
{
return 7;
}
public static int bidQuantitySinceVersion()
{
return 0;
}
public static int bidQuantityEncodingOffset()
{
return 40;
}
public static int bidQuantityEncodingLength()
{
return 4;
}
public static String bidQuantityMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static int bidQuantityNullValue()
{
return -2147483648;
}
public static int bidQuantityMinValue()
{
return -2147483647;
}
public static int bidQuantityMaxValue()
{
return 2147483647;
}
public int bidQuantity()
{
return buffer.getInt(offset + 40, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int askPriceId()
{
return 8;
}
public static int askPriceSinceVersion()
{
return 0;
}
public static int askPriceEncodingOffset()
{
return 44;
}
public static int askPriceEncodingLength()
{
return 8;
}
public static String askPriceMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static long askPriceNullValue()
{
return -9223372036854775808L;
}
public static long askPriceMinValue()
{
return -9223372036854775807L;
}
public static long askPriceMaxValue()
{
return 9223372036854775807L;
}
public long askPrice()
{
return buffer.getLong(offset + 44, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int askQuantityId()
{
return 9;
}
public static int askQuantitySinceVersion()
{
return 0;
}
public static int askQuantityEncodingOffset()
{
return 52;
}
public static int askQuantityEncodingLength()
{
return 4;
}
public static String askQuantityMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "";
case TIME_UNIT: return "";
case SEMANTIC_TYPE: return "";
case PRESENCE: return "required";
}
return "";
}
public static int askQuantityNullValue()
{
return -2147483648;
}
public static int askQuantityMinValue()
{
return -2147483647;
}
public static int askQuantityMaxValue()
{
return 2147483647;
}
public int askQuantity()
{
return buffer.getInt(offset + 52, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public String toString()
{
return appendTo(new StringBuilder(100)).toString();
}
public StringBuilder appendTo(final StringBuilder builder)
{
final int originalLimit = limit();
limit(offset + actingBlockLength);
builder.append("[ExecutionReport](sbeTemplateId=");
builder.append(TEMPLATE_ID);
builder.append("|sbeSchemaId=");
builder.append(SCHEMA_ID);
builder.append("|sbeSchemaVersion=");
if (parentMessage.actingVersion != SCHEMA_VERSION)
{
builder.append(parentMessage.actingVersion);
builder.append('/');
}
builder.append(SCHEMA_VERSION);
builder.append("|sbeBlockLength=");
if (actingBlockLength != BLOCK_LENGTH)
{
builder.append(actingBlockLength);
builder.append('/');
}
builder.append(BLOCK_LENGTH);
builder.append("):");
builder.append("passiveMarketParticipantId=");
builder.append(passiveMarketParticipantId());
builder.append('|');
builder.append("aggressiveMarketParticipantId=");
builder.append(aggressiveMarketParticipantId());
builder.append('|');
builder.append("midPrice=");
builder.append(midPrice());
builder.append('|');
builder.append("lastUpdateTime=");
builder.append(lastUpdateTime());
builder.append('|');
builder.append("lastPriceChange=");
builder.append(lastPriceChange());
builder.append('|');
builder.append("bidPrice=");
builder.append(bidPrice());
builder.append('|');
builder.append("bidQuantity=");
builder.append(bidQuantity());
builder.append('|');
builder.append("askPrice=");
builder.append(askPrice());
builder.append('|');
builder.append("askQuantity=");
builder.append(askQuantity());
limit(originalLimit);
return builder;
}
}
| [
"contact@michaelszymczak.com"
] | contact@michaelszymczak.com |
12e61e3f191b050ca791b5d35062f42cfc37b8f6 | 2c6e877c43e8db95546125bb7198dd17e54eaf9a | /app/src/main/java/com/graduate/seoil/sg_projdct/GStartActivity.java | 431f7616fa692ebf13a34c122e5d36be46c1cf4b | [] | no_license | dbals904/SG_Project | 0b30bd300595f2e4434fb8a5ea6bb2159ca0b303 | 1f2cdc1e62582d4971c252d8d5731c1ce586f502 | refs/heads/master | 2020-05-04T20:32:57.106798 | 2019-05-22T07:52:11 | 2019-05-22T07:52:11 | 165,332,431 | 1 | 0 | null | 2019-01-12T01:17:53 | 2019-01-12T01:17:53 | null | UTF-8 | Java | false | false | 1,624 | java | package com.graduate.seoil.sg_projdct;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.snapshot.Index;
public class GStartActivity extends AppCompatActivity {
Button login, register;
FirebaseUser firebaseUser;
@Override
protected void onStart() {
super.onStart();
// FirebaseAuth.getInstance().signOut();
firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
// Check if user is null
if (firebaseUser != null) {
Intent intent = new Intent(GStartActivity.this, IndexActivity.class);
startActivity(intent);
finish();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gstart);
login = findViewById(R.id.login);
register = findViewById(R.id.register);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(GStartActivity.this, LoginActivity.class));
}
});
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(GStartActivity.this, RegisterActivity.class));
}
});
}
}
| [
"pain3992@naver.com"
] | pain3992@naver.com |
e74a54e09646865d37de4f6831aa2ce2d3ed2d89 | d83ac271c01cd3c7bb5d253685042c692ac51afa | /endless-auth-web/src/main/java/org/endless/auth/web/shiro/spring/TestCache.java | 303ef280dc7cb8e68711bd4859ee3f9616809aaa | [] | no_license | hewe1995/endless | 726ee9aedb869069eb0741ac1df7b213386c9ee9 | 9e759e4e9da66bc83bca43a4d95c813cb7e12c21 | refs/heads/master | 2021-01-23T04:13:43.706639 | 2017-06-16T05:58:30 | 2017-06-16T05:58:30 | 92,920,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package org.endless.auth.web.shiro.spring;
import java.util.Collection;
import java.util.Set;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.cache.CacheManager;
public class TestCache implements CacheManager {
@Override
public <K, V> Cache<K, V> getCache(String name) throws CacheException {
// TODO Auto-generated method stub
return null;
}
static class SpringCacheWrapper implements Cache {
@Override
public Object get(Object key) throws CacheException {
// TODO Auto-generated method stub
return null;
}
@Override
public Object put(Object key, Object value) throws CacheException {
// TODO Auto-generated method stub
return null;
}
@Override
public Object remove(Object key) throws CacheException {
// TODO Auto-generated method stub
return null;
}
@Override
public void clear() throws CacheException {
// TODO Auto-generated method stub
}
@Override
public int size() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Set keys() {
// TODO Auto-generated method stub
return null;
}
@Override
public Collection values() {
// TODO Auto-generated method stub
return null;
}
}
}
| [
"hewe@USER-20170408DV"
] | hewe@USER-20170408DV |
252c5a26c65b9cd80a2f1b013afc8c2c1b6354e8 | 142e7baea802130a218511b3bb1f5b7ff49fe8d1 | /src/main/java/MainClass.java | f0f01b936f57efa0d9563238170238baca9e2198 | [] | no_license | markporoshin/TestServer | 623ccc7cdd5d2c0579ec27aff1242c6ef52bbd5e | a88e93f21441194921bf042b554c5aa52720310c | refs/heads/master | 2021-01-01T06:16:07.945864 | 2017-07-10T23:21:46 | 2017-07-10T23:21:46 | 97,398,779 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | import server.ServerProcessor;
import server.servlets.AuthoServlet;
import units.user.UserManagerImpl;
/**
* Created by Mark on 08.07.2017.
*/
public class MainClass {
private static final String USERNAME = "root";
private static final String PASSWORD = "PoroshinMM";
private static final String URL = "jdbc:mysql://localhost:3306/mysql?useSSL=false";
public static void main(String[] argv) throws Exception {
UserManagerImpl um = new UserManagerImpl(URL, USERNAME, PASSWORD);
ServerProcessor sp = new ServerProcessor();
sp.addServlet(new AuthoServlet(um), "/autho");
sp.setContext();
sp.start();
}
}
| [
"mark.poroshin@yandex.ru"
] | mark.poroshin@yandex.ru |
d37ae07683f9c70c134bb44b2b56b3809632fbf0 | 0bb900ca589f1d175fdf6c0a993be81ce7bfc1c1 | /SH_CAMERA/app/src/main/java/org/push/push/AudioDecoder.java | c9ff1cc01f333544276f4f8a846cf832c97fa7b7 | [] | no_license | liuJian1988/Car-eye-device | a16097867afdc943138d04f38cee3ef498c0d340 | ee756bebc082a1f4798d6e862b52bff516b16647 | refs/heads/master | 2020-05-19T11:42:53.170848 | 2019-04-30T13:58:36 | 2019-04-30T13:58:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,862 | java | package org.push.push;
import android.content.Context;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioTrack;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.os.Process;
import android.util.Log;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
/**
* @author lavender
* @createtime 2018/5/24
* @desc
*/
public class AudioDecoder {
private MediaCodec audioDecoder;//音频解码器
private static final String TAG = "AACDecoderUtil";
//声道数
private static final int KEY_CHANNEL_COUNT = 1;
//采样率
private static final int KEY_SAMPLE_RATE = 16000;
private final Object obj = new Object();
private Thread audioThread;
private long prevPresentationTimes;
private InputStream inputStream;
private Context context;
private MediaCodec.BufferInfo encodeBufferInfo;
private ByteBuffer[] encodeInputBuffers;
private ByteBuffer[] encodeOutputBuffers;
public boolean isStop = false;
public AudioDecoder(Context context) {
this.context = context;
}
/**
* 获取当前的时间戳
*
* @return
*/
private long getPTSUs() {
long result = System.nanoTime() / 1000;
if (result < prevPresentationTimes) {
result = (prevPresentationTimes - result) + result;
}
return result;
}
/**
* 开启解码播放
*/
public void startPlay() {
isStop = false;
prevPresentationTimes = 0;
prepare();
audioThread = new Thread(new AudioThread(),
"Audio Thread");
Log.d(TAG, " startPlay");
audioThread.start();
/* try {
audioThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
return;
}*/
}
/**
* 停止并且重启解码器以便下次使用
*/
public void stop() throws InterruptedException {
isStop = true;
Thread t = audioThread;
if (audioThread != null) {
audioThread.interrupt();
audioThread = null;
t.join();
}
}
public class AudioThread implements Runnable {
int SAMPLE_RATE = 8000; //采样率8K或16k
private AudioTrack audioTrack;
private int buffSize = 0;
private int bufferSizeInBytes = 0;
int size = 0;
public AudioThread() {
bufferSizeInBytes = AudioTrack.getMinBufferSize(SAMPLE_RATE, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT);
audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,//播放途径 外放
SAMPLE_RATE,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_16BIT,
bufferSizeInBytes * 4,
AudioTrack.MODE_STREAM);
//启动AudioTrack
audioTrack.play();
}
@Override
public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_AUDIO);
MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
do {
encodeOutputBuffers = audioDecoder.getOutputBuffers();
int outputBufferIndex = audioDecoder.dequeueOutputBuffer(bufferInfo, 300000);
Log.i("outputBufferIndex**", "\n" + outputBufferIndex + "\n");
if (outputBufferIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
// no output available yet
} else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
// not expected for an encoder
} else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
/* EasyMuxer muxer = mMuxer;
if (muxer != null) {
// should happen before receiving buffers, and should only happen once
MediaFormat newFormat = mMediaCodec.getOutputFormat();
muxer.addTrack(newFormat, true);
}*/
} else if (outputBufferIndex < 0) {
// let's ignore it
} else {
ByteBuffer outputBuffer;
//获取解码后的ByteBuffer
outputBuffer = encodeOutputBuffers[outputBufferIndex];
//用来保存解码后的数据
byte[] outData = new byte[bufferInfo.size];
outputBuffer.get(outData);
//清空缓存
outputBuffer.clear();
//播放解码后的数据
if(outData.length>0) {
audioTrack.write(outData, 0, outData.length);
}
//释放已经解码的buffer
audioDecoder.releaseOutputBuffer(outputBufferIndex, false);
}
}while(!isStop);
if(audioDecoder!=null) {
audioDecoder.stop();
audioDecoder.release();
audioDecoder = null;
}
if (audioTrack != null) {
audioTrack.stop();
audioTrack.release();
audioTrack = null;
}
}
}
/**
* 初始化音频解码器
*
* @return 初始化失败返回false,成功返回true
*/
public boolean prepare() {
// 初始化AudioTrack
try {
//需要解码数据的类型
String mine = "audio/mp4a-latm";
//初始化解码器
audioDecoder = MediaCodec.createDecoderByType(mine);
//MediaFormat用于描述音视频数据的相关参数
MediaFormat mediaFormat = MediaFormat.createAudioFormat(MediaFormat.MIMETYPE_AUDIO_AAC, 8000, 1);
//数据类型
mediaFormat.setString(MediaFormat.KEY_MIME, mine);
//采样率
mediaFormat.setInteger(MediaFormat.KEY_SAMPLE_RATE, KEY_SAMPLE_RATE);//16k
//声道个数
mediaFormat.setInteger(MediaFormat.KEY_CHANNEL_COUNT, KEY_CHANNEL_COUNT);//单声道
mediaFormat.setInteger(MediaFormat.KEY_CHANNEL_MASK, AudioFormat.CHANNEL_IN_MONO);
mediaFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, 1024);//作用于inputBuffer的大小
//比特率
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 64000);
//用来标记AAC是否有adts头,1->有
mediaFormat.setInteger(MediaFormat.KEY_IS_ADTS, 1);
mediaFormat.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectLC);
//ByteBuffer key(参数代表 单声道,16000采样率,AAC LC数据)
// *******************根据自己的音频数据修改data参数*************************************************
//AAC Profile 5bits | 采样率 4bits | 声道数 4bits | 其他 3bits |
byte[] data = new byte[]{(byte) 0x15, (byte) 0x88};
ByteBuffer csd_0 = ByteBuffer.wrap(data);
mediaFormat.setByteBuffer("csd-0", csd_0);
//解码器配置
audioDecoder.configure(mediaFormat, null, null, 0);
} catch (IOException e) {
e.printStackTrace();
return false;
}
if (audioDecoder == null) {
return false;
}
audioDecoder.start();
encodeInputBuffers = audioDecoder.getInputBuffers();
encodeOutputBuffers = audioDecoder.getOutputBuffers();
encodeBufferInfo = new MediaCodec.BufferInfo();
return true;
}
/**
* aac音频解码+播放
*/
public void decode(byte[] buf, int offset, int length) {
//等待时间,0->不等待,-1->一直等待
long kTimeOutUs = 1000;
try {
//返回一个包含有效数据的input buffer的index,-1->不存在
int inputBufIndex = audioDecoder.dequeueInputBuffer(0);
Log.i("inputBufIndex**", "\n"+inputBufIndex + "\n");
if (inputBufIndex >= 0) {
//获取当前的ByteBuffer
ByteBuffer dstBuf = encodeInputBuffers[inputBufIndex];
//清空ByteBuffer
dstBuf.clear();
//填充数据
dstBuf.put(buf, 0, length);
//将指定index的input buffer提交给解码器
audioDecoder.queueInputBuffer(inputBufIndex, 0, length, getPTSUs(), 0);
// fout.write(buf);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"dengtieshan@shenghong-technology.com"
] | dengtieshan@shenghong-technology.com |
136f9af5350dbbe673c64692005278fbd7102106 | a19b1bfcadb58238abb8c0fab9c52d9c2d5884a5 | /PPP/PPP/Old_Code/version0_91/Pair.java | 8cda97d4aeaeb077d32f2588a0f36a127bf3e702 | [] | no_license | slw546/ppp | 33ac9cc84eacf921ce9944215319c97d13f7fa75 | 2dd3b94b306f2bdaa36c93e97354506db9b8bb4d | refs/heads/master | 2021-01-21T13:17:43.687004 | 2016-04-28T11:23:37 | 2016-04-28T11:23:37 | 49,325,783 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | package version0_91;
/*
* Author: Hao Wei
* Time: 25/05/2013
* Purpose: To represent a (x,y)
*/
public class Pair {
private short x;
private short y;
/*
* Constructor for Pair
*/
public Pair(short x, short y){
this.x = x;
this.y = y;
}
/*
* return the value of x
*/
public short getX(){
return x;
}
/*
* return the value of y
*/
public short getY(){
return y;
}
/*
* return true if x is the same as the given number
*/
public boolean contain(short n){
return n==x;
}
/*
* toString
*/
public String toString(){
String result;
result = "(" + x + ", " + y + ")";
return result;
}
}
| [
"slw546@york.ac.uk"
] | slw546@york.ac.uk |
2eb7f70026ad86faa71179359b3c48ea4184f86f | ccaadef788afd715245f733dd2d0d22da84d52c7 | /spring-boot-jpa/src/test/java/cn/tycoding/dao/UserDaoTest.java | a9763ec1e550c28fd2aef73b7165cf0a1fde93e0 | [] | no_license | gengpinjie/spring-boot-learn | 3c1b7078d8c07a5119e7da0561e3b91ca9025b9f | 3f95b9607bb54146d478642389861e4873ceb410 | refs/heads/master | 2020-04-27T16:14:12.648479 | 2019-03-06T10:44:18 | 2019-03-06T10:44:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,106 | java | package cn.tycoding.dao;
import cn.tycoding.entity.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.*;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
/**
* @author tycoding
* @date 2019-02-18
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class UserDaoTest {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private UserDao userDao;
//查询所有
@Test
public void testFindAll() {
List<User> list = userDao.findAll();
list.forEach(user -> {
logger.info("user={}", user);
});
}
//根据ID查询
@Test
public void testFindById() {
// User user = userDao.getOne(1L); //Error: org.hibernate.LazyInitializationException - no Session
User user = userDao.findById(1L).get();
logger.info("user={}", user);
}
//动态查询。根据某个字段查询
@Test
public void testFindByExample() {
User user = new User();
Example<User> example = Example.of(user);
user.setUsername("tycoding");
List<User> list = userDao.findAll(example);
list.forEach(u -> {
logger.info("user={}", u);
});
}
//新增
@Test
public void testSave() {
User user = new User();
user.setUsername("测试");
user.setPassword("测试");
userDao.save(user);
List<User> list = userDao.findAll();
list.forEach(u -> {
logger.info("user={}", u);
});
}
//更新
@Test
public void testUpdate() {
User user = new User();
user.setId(1L);
user.setUsername("涂陌呀");
userDao.save(user);
logger.info("user={}", userDao.findById(user.getId()).get());
}
//删除
@Test
public void testDelete() {
User user = new User();
user.setId(4L);
userDao.delete(user);
// userDao.deleteById(4L);
}
//分页查询
@Test
public void testFindByPage() {
int pageCode = 0; //当前页,从0开始
int pageSize = 3; //每页显示10条记录
Sort sort = new Sort(Sort.Direction.ASC, "id");
Pageable pageable = new PageRequest(pageCode, pageSize, sort);
Page<User> page = userDao.findAll(pageable);
logger.info("总记录数={}", page.getTotalElements());
logger.info("总页数={}", page.getTotalPages());
logger.info("记录={}", page.getContent());
}
//自定义SQL
@Test
public void testFindByPassword() {
User user = userDao.findByPassword("123");
logger.info("user={}", user);
}
@Test
public void testDeleteByPassword() {
userDao.deleteByPassword("123");
User user = userDao.findByPassword("123");
logger.info("user={}", user);
}
} | [
"2557988481@qq.com"
] | 2557988481@qq.com |
ac39371e9b9fbaecc98b6ed681bf71ff4626e735 | eaea399ac53ed4abcc86df99a28867f458681bb4 | /src/main/java/com/deofis/tiendaapirest/autenticacion/dto/CambiarPasswordRequest.java | e93b3f1c2bfb06f8a9d288e729f34ed52fde6d88 | [] | no_license | deofis/cursos-online-apirest | 4f63060fe5ec5f2c1d1f45f3f1c0538011ec6ace | 37ab12b1cd21097178c1a1dc55eb0ae7ec633ded | refs/heads/master | 2023-03-16T11:02:30.899998 | 2021-02-23T18:58:23 | 2021-02-23T18:58:23 | 341,244,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.deofis.tiendaapirest.autenticacion.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CambiarPasswordRequest {
@NotNull
private String password;
}
| [
"ezegavilan95@gmail.com"
] | ezegavilan95@gmail.com |
61d4e380e8a2220787a5b4c2c153a87f25bfb95a | e0e03617899d509e5c61062b8d643d7e970b67bc | /src/main/java/com/proenca/domain/Estado.java | d902207ae7b8841c66d8065fa3fc3a7228d44536 | [] | no_license | tonyproenca/springsample | 0d1936a5e2063650b1fdb3e7a91c5c48f4d1ff70 | 17af56262656fb3e02a6034e02a9094542fbfc7e | refs/heads/master | 2020-03-31T23:45:25.252127 | 2018-10-20T15:46:31 | 2018-10-20T15:46:31 | 152,668,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,636 | java | package com.proenca.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Estado implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
private String nome;
@OneToMany(mappedBy="estado")
@JsonIgnore
private List<Cidade> cidades = new ArrayList<>();
public Estado() {}
public Estado(Integer id, String nome) {
super();
this.id = id;
this.nome = nome;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@OneToMany(mappedBy="estado")
public List<Cidade> getCidades() {
return cidades;
}
public void setCidades(List<Cidade> cidades) {
this.cidades = cidades;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Estado other = (Estado) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"antproenca92@gmail.com"
] | antproenca92@gmail.com |
363d0d6989e08c378492a511e426dc9641a5d505 | 6c4e3fbb7355cdca8381e200347709d62c82b7ad | /app/src/main/java/com/example/guilherme/jumper/elements/GameOver.java | 5c67ada7a58bdf5032da4225c35cb11c24812866 | [] | no_license | guireino/jumper | 7217504ff4429616287d3649a58b29e91e8cd1c3 | aa322ed506f501c0d3109d06bc4ca563cb9f6190 | refs/heads/master | 2021-08-31T00:00:20.412844 | 2017-12-19T22:17:11 | 2017-12-19T22:17:11 | 114,282,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | package com.example.guilherme.jumper.elements;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import com.example.guilherme.jumper.graphic.Cores;
import com.example.guilherme.jumper.graphic.Tela;
/**
* Created by guilherme on 18/12/17.
*/
public class GameOver {
private static final Paint paintRed = Cores.getCorGameOver();
private final Tela tela;
private int centroHorizontal;
private int centrolizaTexto;
private int centralizaTexto(String texto) {
Rect limiteTexto = new Rect();
paintRed.getTextBounds(texto, 0, texto.length(), limiteTexto);
centrolizaTexto = (limiteTexto.right - limiteTexto.left) / 2;
centroHorizontal = tela.getLargura() / 2 - (limiteTexto.right - limiteTexto.left) / 2;
return centroHorizontal;
}
public GameOver(Tela tela) {
this.tela = tela;
}
public void desenhoNo(Canvas canvas) {
String gamerOver = "Game Over";
centroHorizontal = centralizaTexto(gamerOver);
canvas.drawText(gamerOver, centroHorizontal, tela.getAltura() / 2, paintRed);
}
}
| [
"guiabucarma@hotmail.com"
] | guiabucarma@hotmail.com |
17e96a849f4022687cdc29e6af83ca9be70e597b | 9f92b7291429bde9c0c17503084a7e0a81842964 | /mvc-eclipse-workspace/SpringRESTFulExample/src/main/java/com/javacollector/iterfaceacct.java | 204e4cf82248bfa78a014738e64f3710934c4f89 | [] | no_license | ramkumarc313/eclipse-workspace | d49beea06c5175153de59f5910a8e3aca19740b0 | aed0748d30038b25656097d79a19b430e584b890 | refs/heads/master | 2020-08-26T12:19:46.839390 | 2019-10-25T07:50:51 | 2019-10-25T07:50:51 | 217,007,495 | 0 | 0 | null | 2019-10-23T08:41:18 | 2019-10-23T08:31:39 | Java | UTF-8 | Java | false | false | 419 | java | package com.javacollector;
public class iterfaceacct {
public static void main(String[] args) {
// TODO Auto-generated method stub
demo d=new demoImplement();
d.show();
}
}
interface demo
{
public void show();
}
interface demo2
{
public void show();
}
class demoImplement implements demo
{
@Override
public void show() {
// TODO Auto-generated method stub
System.out.println("ram");
}
} | [
"ramkumarfstpl@gmail.com"
] | ramkumarfstpl@gmail.com |
c8e8cae11b94fd1a70ea41ffc5dc13018e7cb7ed | c4d1992bbfe4552ad16ff35e0355b08c9e4998d6 | /releases/2.0.0/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java | 5539c2d8d4e7c7fdb4d2773632cdb2016a534ccb | [] | no_license | BGCX261/zkpoi-svn-to-git | 36f2a50d2618c73e40f24ddc2d3df5aadc8eca30 | 81a63fb1c06a2dccff20cab1291c7284f1687508 | refs/heads/master | 2016-08-04T08:42:59.622864 | 2015-08-25T15:19:51 | 2015-08-25T15:19:51 | 41,594,557 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,240 | java | /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hwpf.usermodel;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFTestCase;
import org.apache.poi.hwpf.HWPFTestDataSamples;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.hwpf.model.StyleSheet;
/**
* Test various problem documents
*
* @author Nick Burch (nick at torchbox dot com)
*/
public final class TestProblems extends HWPFTestCase {
/**
* ListEntry passed no ListTable
*/
public void testListEntryNoListTable() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("ListEntryNoListTable.doc");
Range r = doc.getRange();
StyleSheet styleSheet = doc.getStyleSheet();
for (int x = 0; x < r.numSections(); x++) {
Section s = r.getSection(x);
for (int y = 0; y < s.numParagraphs(); y++) {
Paragraph paragraph = s.getParagraph(y);
// System.out.println(paragraph.getCharacterRun(0).text());
}
}
}
/**
* AIOOB for TableSprmUncompressor.unCompressTAPOperation
*/
public void testSprmAIOOB() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("AIOOB-Tap.doc");
Range r = doc.getRange();
StyleSheet styleSheet = doc.getStyleSheet();
for (int x = 0; x < r.numSections(); x++) {
Section s = r.getSection(x);
for (int y = 0; y < s.numParagraphs(); y++) {
Paragraph paragraph = s.getParagraph(y);
// System.out.println(paragraph.getCharacterRun(0).text());
}
}
}
/**
* Test for TableCell not skipping the last paragraph. Bugs #45062 and
* #44292
*/
public void testTableCellLastParagraph() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug44292.doc");
Range r = doc.getRange();
assertEquals(6, r.numParagraphs());
assertEquals(0, r.getStartOffset());
assertEquals(87, r.getEndOffset());
// Paragraph with table
Paragraph p = r.getParagraph(0);
assertEquals(0, p.getStartOffset());
assertEquals(20, p.getEndOffset());
// Check a few bits of the table directly
assertEquals("One paragraph is ok\7", r.getParagraph(0).text());
assertEquals("First para is ok\r", r.getParagraph(1).text());
assertEquals("Second paragraph is skipped\7", r.getParagraph(2).text());
assertEquals("One paragraph is ok\7", r.getParagraph(3).text());
assertEquals("\7", r.getParagraph(4).text());
assertEquals("\r", r.getParagraph(5).text());
for(int i=0; i<=5; i++) {
assertFalse(r.getParagraph(i).usesUnicode());
}
// Get the table
Table t = r.getTable(p);
// get the only row
assertEquals(1, t.numRows());
TableRow row = t.getRow(0);
// sanity check our row
assertEquals(5, row.numParagraphs());
assertEquals(0, row._parStart);
assertEquals(5, row._parEnd);
assertEquals(0, row.getStartOffset());
assertEquals(87, row.getEndOffset());
// get the first cell
TableCell cell = row.getCell(0);
// First cell should have one paragraph
assertEquals(1, cell.numParagraphs());
assertEquals("One paragraph is ok\7", cell.getParagraph(0).text());
assertEquals(0, cell._parStart);
assertEquals(1, cell._parEnd);
assertEquals(0, cell.getStartOffset());
assertEquals(20, cell.getEndOffset());
// get the second
cell = row.getCell(1);
// Second cell should be detected as having two paragraphs
assertEquals(2, cell.numParagraphs());
assertEquals("First para is ok\r", cell.getParagraph(0).text());
assertEquals("Second paragraph is skipped\7", cell.getParagraph(1).text());
assertEquals(1, cell._parStart);
assertEquals(3, cell._parEnd);
assertEquals(20, cell.getStartOffset());
assertEquals(65, cell.getEndOffset());
// get the last cell
cell = row.getCell(2);
// Last cell should have one paragraph
assertEquals(1, cell.numParagraphs());
assertEquals("One paragraph is ok\7", cell.getParagraph(0).text());
assertEquals(3, cell._parStart);
assertEquals(4, cell._parEnd);
assertEquals(65, cell.getStartOffset());
assertEquals(85, cell.getEndOffset());
}
public void testRangeDelete() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug28627.doc");
Range range = doc.getRange();
int numParagraphs = range.numParagraphs();
int totalLength = 0, deletedLength = 0;
for (int i = 0; i < numParagraphs; i++) {
Paragraph para = range.getParagraph(i);
String text = para.text();
totalLength += text.length();
if (text.indexOf("{delete me}") > -1) {
para.delete();
deletedLength = text.length();
}
}
// check the text length after deletion
int newLength = 0;
range = doc.getRange();
numParagraphs = range.numParagraphs();
for (int i = 0; i < numParagraphs; i++) {
Paragraph para = range.getParagraph(i);
String text = para.text();
newLength += text.length();
}
assertEquals(newLength, totalLength - deletedLength);
}
/**
* With an encrypted file, we should give a suitable exception, and not OOM
*/
public void testEncryptedFile() {
try {
HWPFTestDataSamples.openSampleFile("PasswordProtected.doc");
fail();
} catch (EncryptedDocumentException e) {
// Good
}
}
public void testWriteProperties() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("SampleDoc.doc");
assertEquals("Nick Burch", doc.getSummaryInformation().getAuthor());
// Write and read
HWPFDocument doc2 = writeOutAndRead(doc);
assertEquals("Nick Burch", doc2.getSummaryInformation().getAuthor());
}
/**
* Test for reading paragraphs from Range after replacing some
* text in this Range.
* Bug #45269
*/
public void testReadParagraphsAfterReplaceText()throws Exception{
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug45269.doc");
Range range = doc.getRange();
String toFind = "campo1";
String longer = " foi porraaaaa ";
String shorter = " foi ";
//check replace with longer text
for (int x = 0; x < range.numParagraphs(); x++) {
Paragraph para = range.getParagraph(x);
int offset = para.text().indexOf(toFind);
if (offset >= 0) {
para.replaceText(toFind, longer, offset);
assertEquals(offset, para.text().indexOf(longer));
}
}
doc = HWPFTestDataSamples.openSampleFile("Bug45269.doc");
range = doc.getRange();
//check replace with shorter text
for (int x = 0; x < range.numParagraphs(); x++) {
Paragraph para = range.getParagraph(x);
int offset = para.text().indexOf(toFind);
if (offset >= 0) {
para.replaceText(toFind, shorter, offset);
assertEquals(offset, para.text().indexOf(shorter));
}
}
}
/**
* Bug #49936 - Problems with reading the header out of
* the Header Stories
*/
public void testProblemHeaderStories49936() throws Exception {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("HeaderFooterProblematic.doc");
HeaderStories hs = new HeaderStories(doc);
assertEquals("", hs.getFirstHeader());
assertEquals("\r", hs.getEvenHeader());
assertEquals("", hs.getOddHeader());
assertEquals("", hs.getFirstFooter());
assertEquals("", hs.getEvenFooter());
assertEquals("", hs.getOddFooter());
WordExtractor ext = new WordExtractor(doc);
assertEquals("\n", ext.getHeaderText());
assertEquals("", ext.getFooterText());
}
/**
* Bug #45877 - problematic PAPX with no parent set
*/
public void testParagraphPAPXNoParent45877() throws Exception {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug45877.doc");
assertEquals(17, doc.getRange().numParagraphs());
assertEquals("First paragraph\r", doc.getRange().getParagraph(0).text());
assertEquals("After Crashing Part\r", doc.getRange().getParagraph(13).text());
}
/**
* Bug #48245 - don't include the text from the
* next cell in the current one
*/
public void testTableIterator() throws Exception {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("simple-table2.doc");
Range r = doc.getRange();
// Check the text is as we'd expect
assertEquals(13, r.numParagraphs());
assertEquals("Row 1/Cell 1\u0007", r.getParagraph(0).text());
assertEquals("Row 1/Cell 2\u0007", r.getParagraph(1).text());
assertEquals("Row 1/Cell 3\u0007", r.getParagraph(2).text());
assertEquals("\u0007", r.getParagraph(3).text());
assertEquals("Row 2/Cell 1\u0007", r.getParagraph(4).text());
assertEquals("Row 2/Cell 2\u0007", r.getParagraph(5).text());
assertEquals("Row 2/Cell 3\u0007", r.getParagraph(6).text());
assertEquals("\u0007", r.getParagraph(7).text());
assertEquals("Row 3/Cell 1\u0007", r.getParagraph(8).text());
assertEquals("Row 3/Cell 2\u0007", r.getParagraph(9).text());
assertEquals("Row 3/Cell 3\u0007", r.getParagraph(10).text());
assertEquals("\u0007", r.getParagraph(11).text());
assertEquals("\r", r.getParagraph(12).text());
for(int i=0; i<=12; i++) {
assertFalse(r.getParagraph(i).usesUnicode());
}
Paragraph p;
// Take a look in detail at the first couple of
// paragraphs
p = r.getParagraph(0);
assertEquals(1, p.numParagraphs());
assertEquals(0, p.getStartOffset());
assertEquals(13, p.getEndOffset());
assertEquals(0, p._parStart);
assertEquals(1, p._parEnd);
p = r.getParagraph(1);
assertEquals(1, p.numParagraphs());
assertEquals(13, p.getStartOffset());
assertEquals(26, p.getEndOffset());
assertEquals(1, p._parStart);
assertEquals(2, p._parEnd);
p = r.getParagraph(2);
assertEquals(1, p.numParagraphs());
assertEquals(26, p.getStartOffset());
assertEquals(39, p.getEndOffset());
assertEquals(2, p._parStart);
assertEquals(3, p._parEnd);
// Now look at the table
Table table = r.getTable(r.getParagraph(0));
assertEquals(3, table.numRows());
TableRow row;
TableCell cell;
row = table.getRow(0);
assertEquals(0, row._parStart);
assertEquals(4, row._parEnd);
cell = row.getCell(0);
assertEquals(1, cell.numParagraphs());
assertEquals(0, cell._parStart);
assertEquals(1, cell._parEnd);
assertEquals(0, cell.getStartOffset());
assertEquals(13, cell.getEndOffset());
assertEquals("Row 1/Cell 1\u0007", cell.text());
assertEquals("Row 1/Cell 1\u0007", cell.getParagraph(0).text());
cell = row.getCell(1);
assertEquals(1, cell.numParagraphs());
assertEquals(1, cell._parStart);
assertEquals(2, cell._parEnd);
assertEquals(13, cell.getStartOffset());
assertEquals(26, cell.getEndOffset());
assertEquals("Row 1/Cell 2\u0007", cell.text());
assertEquals("Row 1/Cell 2\u0007", cell.getParagraph(0).text());
cell = row.getCell(2);
assertEquals(1, cell.numParagraphs());
assertEquals(2, cell._parStart);
assertEquals(3, cell._parEnd);
assertEquals(26, cell.getStartOffset());
assertEquals(39, cell.getEndOffset());
assertEquals("Row 1/Cell 3\u0007", cell.text());
assertEquals("Row 1/Cell 3\u0007", cell.getParagraph(0).text());
// Onto row #2
row = table.getRow(1);
assertEquals(4, row._parStart);
assertEquals(8, row._parEnd);
cell = row.getCell(0);
assertEquals(1, cell.numParagraphs());
assertEquals(4, cell._parStart);
assertEquals(5, cell._parEnd);
assertEquals(40, cell.getStartOffset());
assertEquals(53, cell.getEndOffset());
assertEquals("Row 2/Cell 1\u0007", cell.text());
cell = row.getCell(1);
assertEquals(1, cell.numParagraphs());
assertEquals(5, cell._parStart);
assertEquals(6, cell._parEnd);
assertEquals(53, cell.getStartOffset());
assertEquals(66, cell.getEndOffset());
assertEquals("Row 2/Cell 2\u0007", cell.text());
cell = row.getCell(2);
assertEquals(1, cell.numParagraphs());
assertEquals(6, cell._parStart);
assertEquals(7, cell._parEnd);
assertEquals(66, cell.getStartOffset());
assertEquals(79, cell.getEndOffset());
assertEquals("Row 2/Cell 3\u0007", cell.text());
// Finally row 3
row = table.getRow(2);
assertEquals(8, row._parStart);
assertEquals(12, row._parEnd);
cell = row.getCell(0);
assertEquals(1, cell.numParagraphs());
assertEquals(8, cell._parStart);
assertEquals(9, cell._parEnd);
assertEquals(80, cell.getStartOffset());
assertEquals(93, cell.getEndOffset());
assertEquals("Row 3/Cell 1\u0007", cell.text());
cell = row.getCell(1);
assertEquals(1, cell.numParagraphs());
assertEquals(9, cell._parStart);
assertEquals(10, cell._parEnd);
assertEquals(93, cell.getStartOffset());
assertEquals(106, cell.getEndOffset());
assertEquals("Row 3/Cell 2\u0007", cell.text());
cell = row.getCell(2);
assertEquals(1, cell.numParagraphs());
assertEquals(10, cell._parStart);
assertEquals(11, cell._parEnd);
assertEquals(106, cell.getStartOffset());
assertEquals(119, cell.getEndOffset());
assertEquals("Row 3/Cell 3\u0007", cell.text());
}
}
| [
"you@example.com"
] | you@example.com |
23af1ce5cc9f41a2a8b359a1099e5a3ceffb2e78 | ed9567e570dc7e6b15915e435ed5c5ebf45d736d | /Task25/src/main/java/core/EmailsSteps.java | b850d66c96009693077230d72db459e812dfeeca | [] | no_license | MarinaParfeevets/pvtCourse | 52772cce1915d803c211aa93ae674ca6b309d88e | 32260b67b8269fc3bd4c30096758810071ffd0b0 | refs/heads/master | 2022-06-29T06:40:08.798707 | 2019-08-14T14:35:45 | 2019-08-14T14:43:48 | 168,002,630 | 0 | 0 | null | 2022-06-21T01:01:07 | 2019-01-28T17:15:07 | Java | UTF-8 | Java | false | false | 1,176 | java | package core;
import org.junit.Assert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import cucumber.api.java.After;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class EmailsSteps {
private static final String MAIN_URL = "http://mail.ru";
private LoginPage loginPage;
private UserDataTable userDataTable;
private WebDriver webDriver;
public EmailsSteps() {
webDriver = new ChromeDriver();
loginPage = new LoginPage(webDriver);
loginPage.setInitialProperty();
userDataTable = new UserDataTable();
userDataTable.setUserLoginPasswordFromDB();
}
@Given("^Main application page is opened$")
public void loadMainPage() {
webDriver.get(MAIN_URL);
}
@When("^Enter correct user login and password$")
public void loginAsCorrectUser() {
loginPage.enterLoginAndPass(userDataTable.getUserLogin(), userDataTable.getUserPassword());
loginPage.clickEnterButton();
}
@Then("^Logout link is displayed$")
public void seeLogoutLink() {
Assert.assertTrue(loginPage.logoutLinkPresents());
}
@After
public void afterClass() {
webDriver.quit();
}
}
| [
"47116839+MarinaParfeevets@users.noreply.github.com"
] | 47116839+MarinaParfeevets@users.noreply.github.com |
9f3314c49890d028ca4ddd22f3f17085de8752ca | 6587340860c63f28fb3df36f6b81c2aab032285d | /src/main/java/com/CrawlerApplication.java | 80de54b46101406cacf6c0931385025c65e5cdc8 | [] | no_license | qiyuanzhao/dashboard | ed15b56d3c383e719ae032cfa649843679eecff5 | 67f76b77da3fb49ecc3e89dd1d94b8f183936a6a | refs/heads/master | 2023-01-10T09:49:30.715636 | 2020-11-12T01:04:34 | 2020-11-12T01:04:34 | 296,571,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package com;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @ClassName CrawlerApplication
* @Description TODO
* @Author qiyuanzhao
* @Date 2020-09-18
* @Version 1.0
**/
@SpringBootApplication
public class CrawlerApplication {
public static void main(String[] args) {
SpringApplication.run(CrawlerApplication.class, args);
}
}
| [
"qyzemail@126.com"
] | qyzemail@126.com |
4774f7d0d9a178e7d5f09ad5861da0230367c78a | 8b0c15d386cdcf130b4c1f2924773bbda778b952 | /src/main/java/pepUpInput/CheckboxContent.java | b37b4f19ea90e6c0df8e79803c2ae7cc984663d4 | [] | no_license | shima-218/pep-up-input-gui | 7fa215a6865c70ea6237c6de954c571fff7dfd24 | 3e72660c8004865d2a5e90b30a195757ac4eae38 | refs/heads/master | 2022-12-29T00:16:31.231500 | 2020-10-15T14:12:07 | 2020-10-15T14:12:07 | 219,467,587 | 0 | 0 | null | 2020-10-15T14:12:08 | 2019-11-04T09:48:43 | Java | UTF-8 | Java | false | false | 479 | java | package pepUpInput;
import org.openqa.selenium.*;
import common.*;
public abstract class CheckboxContent extends Content {
@Override
public void dayInput(WebDriver driver) {
WebElement question = driver.findElement(By.xpath(Values.TAGPATH_INPUT_CHECKBOX));
if(!question.isSelected()) {
question.click();
}
}
@Override
public void popUpClose(WebDriver driver) {
driver.findElement(By.xpath(Values.TAGPATH_CLOSE_CHECKBOX)).click();
}
}
| [
"shima.island.218@gmail.com"
] | shima.island.218@gmail.com |
a687d981d0bf37934732cdf8559cd2fb48ed6bf4 | bd4c17e6e3b1013177255f8d5233992c7f7b32b2 | /app/src/main/java/com/meizitu/utils/AESUtil.java | 7825b9def45e6f66fd09a771bc1a7f7ad7852976 | [] | no_license | cgpllx/MeiZi_Android | 3a3dcaf23cec1e9992ebcd2440a13f760b1f94fe | 711216b8cf9b54d7cfd66b97fb691c537f67b32d | refs/heads/master | 2021-01-24T11:08:25.975554 | 2017-08-12T04:58:35 | 2017-08-12T04:58:35 | 70,251,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,899 | java | package com.meizitu.utils;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
public class AESUtil {
static final String algorithmStr = "AES/ECB/PKCS5Padding";
// static final String algorithmStr = "AES/CFB/NoPadding";
private static final Object TAG = "AES";
static private KeyGenerator keyGen;
static private Cipher cipher;
static boolean isInited = false;
private static void init() {
try {
/**为指定算法生成一个 KeyGenerator 对象。
*此类提供(对称)密钥生成器的功能。
*密钥生成器是使用此类的某个 getInstance 类方法构造的。
*KeyGenerator 对象可重复使用,也就是说,在生成密钥后,
*可以重复使用同一 KeyGenerator 对象来生成进一步的密钥。
*生成密钥的方式有两种:与算法无关的方式,以及特定于算法的方式。
*两者之间的惟一不同是对象的初始化:
*与算法无关的初始化
*所有密钥生成器都具有密钥长度 和随机源 的概念。
*此 KeyGenerator 类中有一个 init 方法,它可采用这两个通用概念的参数。
*还有一个只带 keysize 参数的 init 方法,
*它使用具有最高优先级的提供程序的 SecureRandom 实现作为随机源
*(如果安装的提供程序都不提供 SecureRandom 实现,则使用系统提供的随机源)。
*此 KeyGenerator 类还提供一个只带随机源参数的 inti 方法。
*因为调用上述与算法无关的 init 方法时未指定其他参数,
*所以由提供程序决定如何处理将与每个密钥相关的特定于算法的参数(如果有)。
*特定于算法的初始化
*在已经存在特定于算法的参数集的情况下,
*有两个具有 AlgorithmParameterSpec 参数的 init 方法。
*其中一个方法还有一个 SecureRandom 参数,
*而另一个方法将已安装的高优先级提供程序的 SecureRandom 实现用作随机源
*(或者作为系统提供的随机源,如果安装的提供程序都不提供 SecureRandom 实现)。
*如果客户端没有显式地初始化 KeyGenerator(通过调用 init 方法),
*每个提供程序必须提供(和记录)默认初始化。
*/
keyGen = KeyGenerator.getInstance("AES");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
// 初始化此密钥生成器,使其具有确定的密钥长度。
keyGen.init(256); //256位的AES加密
try {
// 生成一个实现指定转换的 Cipher 对象。
cipher = Cipher.getInstance(algorithmStr);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
}
//标识已经初始化过了的字段
isInited = true;
}
private static byte[] genKey() {
if (!isInited) {
init();
}
//首先 生成一个密钥(SecretKey),
//然后,通过这个秘钥,返回基本编码格式的密钥,如果此密钥不支持编码,则返回 null。
return keyGen.generateKey().getEncoded();
}
private static byte[] encrypt(byte[] content, byte[] keyBytes) {
byte[] encryptedText = null;
if (!isInited) {
init();
}
/**
*类 SecretKeySpec
*可以使用此类来根据一个字节数组构造一个 SecretKey,
*而无须通过一个(基于 provider 的)SecretKeyFactory。
*此类仅对能表示为一个字节数组并且没有任何与之相关联的钥参数的原始密钥有用
*构造方法根据给定的字节数组构造一个密钥。
*此构造方法不检查给定的字节数组是否指定了一个算法的密钥。
*/
Key key = new SecretKeySpec(keyBytes, "AES");
try {
// 用密钥初始化此 cipher。
cipher.init(Cipher.ENCRYPT_MODE, key);
} catch (InvalidKeyException e) {
e.printStackTrace();
}
try {
//按单部分操作加密或解密数据,或者结束一个多部分操作。(不知道神马意思)
encryptedText = cipher.doFinal(content);
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
return encryptedText;
}
private static byte[] encrypt(String content, String password) {
try {
byte[] keyStr = getKey(password);
SecretKeySpec key = new SecretKeySpec(keyStr, "AES");
Cipher cipher = Cipher.getInstance(algorithmStr);//algorithmStr
byte[] byteContent = content.getBytes("utf-8");
cipher.init(Cipher.ENCRYPT_MODE, key);// ʼ
byte[] result = cipher.doFinal(byteContent);
return result; //
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
return null;
}
private static byte[] decrypt(byte[] content, String password) {
try {
byte[] keyStr = getKey(password);
SecretKeySpec key = new SecretKeySpec(keyStr, "AES");
Cipher cipher = Cipher.getInstance(algorithmStr);//algorithmStr
cipher.init(Cipher.DECRYPT_MODE, key);// ʼ
byte[] result = cipher.doFinal(content);
return result; //
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
return null;
}
private static byte[] getKey(String password) {
byte[] rByte = null;
if (password!=null) {
rByte = password.getBytes();
}else{
rByte = new byte[24];
}
return rByte;
}
/**
* 将二进制转换成16进制
* @param buf
* @return
*/
public static String parseByte2HexStr(byte buf[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
/**
* 将16进制转换为二进制
* @param hexStr
* @return
*/
public static byte[] parseHexStr2Byte(String hexStr) {
if (hexStr.length() < 1)
return null;
byte[] result = new byte[hexStr.length() / 2];
for (int i = 0; i < hexStr.length() / 2; i++) {
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2),
16);
result[i] = (byte) (high * 16 + low);
}
return result;
}
//注意: 这里的password(秘钥必须是16位的)
private static final String keyBytes = "abcdefgabcdefg12";
/**
*加密
*/
public static String encode(String content){
//加密之后的字节数组,转成16进制的字符串形式输出
return parseByte2HexStr(encrypt(content, keyBytes));
}
/**
*解密
*/
public static String decode(String content){
//解密之前,先将输入的字符串按照16进制转成二进制的字节数组,作为待解密的内容输入
byte[] b = decrypt(parseHexStr2Byte(content), keyBytes);
return new String(b);
}
}
| [
"cgpllx1@qq.com"
] | cgpllx1@qq.com |
28abf0acb5de7ed9ba32316707bd61f11e0945aa | 78319dd4b0238e8b03f3e954b59bfbc8d4583cd5 | /asciipic/src/main/java/com/asciipic/commands/LoginCommand.java | 5f75cd8851560b55a93038188aeded919eda7648 | [
"MIT"
] | permissive | AlexandruTudose/asciipic | b919b4cd6e39acf051cf274d09dc728e01f38b01 | d8488c22645d8d63ed0a1c465ba6e53c54301d35 | refs/heads/master | 2021-01-20T00:33:43.242630 | 2017-06-17T06:03:33 | 2017-06-17T06:03:33 | 89,149,715 | 0 | 0 | null | 2017-06-17T06:03:34 | 2017-04-23T14:54:49 | Java | UTF-8 | Java | false | false | 1,578 | java | package com.asciipic.commands;
import com.asciipic.commands.basic.CommandError;
import com.asciipic.commands.basic.OutCommand;
import com.asciipic.dtos.ResponseDTO;
import com.asciipic.dtos.UserLoginDTO;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
public class LoginCommand implements OutCommand {
private static String LOGIN_URL = "http://localhost:9991/login/";
private UserLoginDTO userLoginDTO;
public LoginCommand() {
this.userLoginDTO = new UserLoginDTO();
}
public LoginCommand(String args) throws CommandError {
this.userLoginDTO = new UserLoginDTO();
for (String arg : args.substring(3).split(" --")) {
if (arg.matches("email=.+")) {
this.userLoginDTO.setEmail(arg.substring(6));
} else if (arg.matches("password=.+")) {
this.userLoginDTO.setPassword(arg.substring(9));
} else {
throw new CommandError("Invalid credentials!");
}
}
}
@Override
public ResponseDTO execute() throws CommandError {
ResponseEntity<ResponseDTO> responseEntity = new RestTemplate().postForEntity(LOGIN_URL, this.userLoginDTO, ResponseDTO.class);
System.out.println(responseEntity.getHeaders().get("Authorization"));
if (responseEntity.getHeaders().get("Authorization") == null) {
return responseEntity.getBody();
} else {
return new ResponseDTO(responseEntity.getHeaders().get("Authorization"));
}
}
}
| [
"alexandru.tudose@info.uaic.ro"
] | alexandru.tudose@info.uaic.ro |
c7a1321579133ce1185f90115376b640bae1e05a | ea3e8629ad97468d40a4fc91f226ae2980b23945 | /app/src/main/java/in/focusminds/diceroll/DiceConstants.java | 54e30880481568c08792b6e2fbac3156b8aed8b1 | [] | no_license | ElangoOm/DiceRoll | f0f3d8d87e35c9dda1b179494185eb601a8623db | 22ffa9ff0a97eb424c2c2dc6648357f23c5f9649 | refs/heads/master | 2023-01-19T02:39:27.174815 | 2020-11-24T09:25:35 | 2020-11-24T09:25:35 | 276,382,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package in.focusminds.diceroll;
public class DiceConstants {
public int NUMDICE = 3;
public int getNUMDICE() {
return NUMDICE;
}
public void setNUMDICE(int NUM_DICE) {
this.NUMDICE = NUM_DICE;
}
}
| [
"elango.om@gmail.com"
] | elango.om@gmail.com |
6cbdfd10e03712d1284fe50b40e6849bc98d3edd | b017819511d82fc708afb7625c5fee679d1e07f3 | /app/src/main/java/com/example/rideshare/TimePickerFragment.java | fbf0e62cd9f13eaf5e97826f3b5b7d433559d483 | [] | no_license | Anmolk7/Wuber | d3dfa7db8522c241cab27220f8f71e9b410ffc55 | 3ad03cfc955a8bb5c3e668dfe91a1de59add69f8 | refs/heads/master | 2021-01-26T06:54:44.198975 | 2020-05-03T19:59:37 | 2020-05-03T19:59:37 | 243,354,624 | 0 | 3 | null | 2020-03-26T23:32:24 | 2020-02-26T20:05:04 | Java | UTF-8 | Java | false | false | 793 | java | package com.example.rideshare;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.text.format.DateFormat;
import java.util.Calendar;
public class TimePickerFragment extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
Calendar calendar= Calendar.getInstance();
int hour=calendar.get(Calendar.HOUR_OF_DAY);
int min=calendar.get(Calendar.MINUTE);
return new TimePickerDialog(getActivity(),(TimePickerDialog.OnTimeSetListener) getActivity(),hour,min, DateFormat.is24HourFormat(getActivity()));
}
}
| [
"anmolkarkik7@gmail.com"
] | anmolkarkik7@gmail.com |
959c92e9d91c9cf132c804c684af37362af05594 | 781a9911da16d1f3112a3f736fe135f8e92e29c1 | /src/test/java/testRunner/basicAuth_testRunner.java | 95038d2c861b0719b145db18f762473b9e3da880 | [] | no_license | OluJS/QA_Practices | c5f5a377985366ea1d8261b4c26cc5fb65080d91 | 5a265bc30eb8f00b5a15647ee11e6138e7ac9bc2 | refs/heads/master | 2023-01-13T10:35:30.935618 | 2020-11-21T22:13:24 | 2020-11-21T22:13:24 | 276,203,404 | 0 | 0 | null | 2020-11-21T22:13:25 | 2020-06-30T20:37:25 | Java | UTF-8 | Java | false | false | 374 | java | package testRunner;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "/Users/olu/IdeaProjects/QA_Practices/src/test/resources/features/basicAuth.feature",
glue = "stepDefinitions/basic_auth_login_Demo"
)
public class basicAuth_testRunner {
}
| [
"olujs1999@gmail.com"
] | olujs1999@gmail.com |
618569cdbe7e0974d7147ad5c4348253e0842fe9 | 898350ee1da7147d7708c26ddeed254c2adb76ed | /Adding and Multiplying/src/com/danielchen/Main.java | 0c88a8b0a10ea378f9f42025cb754f187aebec10 | [] | no_license | DanielChen1009/AlgPractice | f86c4bb9da50865f3c748e06cedd6e6563b1b173 | a511e0ed51006981205c2ce56bf0656f7dd0efbf | refs/heads/master | 2023-01-20T21:46:02.763048 | 2020-02-16T20:35:10 | 2020-02-16T20:35:10 | 240,961,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package com.danielchen;
import java.util.*;
public class Main {
public static void main(String[] args) {
String in = "1 + 2 + 4 + (10 + 16) * 2";
Stack<String> numbers = new Stack<>();
for(int i = 0; i < in.length(); ++i) {
char character = in.charAt(i);
if(Character.isWhitespace(character)) {
continue;
}
numbers.push(Character.toString(character));
if(Character.isDigit(character) && ) {
}
}
}
}
| [
"duhe.chen1009@gmail.com"
] | duhe.chen1009@gmail.com |
bede8e5bc17e8a5303560198ee981acbd16c997b | 1a15abc46af7ec7c96fcefc02f7f6f7b6e8b42ed | /otlob/src/otlob/cart.java | 136a45e862e18eecc4f0859eeebaf9ef9374db13 | [] | no_license | markMichail/otlob-oop-project | aaea2b932df509e3f7cb5fb01e7fc44720213972 | 68ff4dae07317748a070afcae21ded48b58f2ca3 | refs/heads/master | 2023-01-24T15:27:37.474963 | 2020-06-17T01:18:07 | 2020-06-17T01:18:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package otlob;
import java.io.Serializable;
import java.util.ArrayList;
public class cart implements Serializable
{
public ArrayList<item> itemsOfCart;
public float totalPrice;
public String comment;
public String voucher;
public cart() {
voucher = new String();
comment = new String();
itemsOfCart=new ArrayList<item>();
totalPrice = 0;
comment = "";
}
public float addtaxesAndDel(int delFees) {
return (float) (totalPrice + (totalPrice * 0.14) + delFees);
}
public float addtaxes() {
return (float) (totalPrice + (totalPrice * 0.14));
}
}
| [
"mark.refaat.ramzy@gmail.com"
] | mark.refaat.ramzy@gmail.com |
d7f94820bfd2f1d3b77ead5b8642b050af902a8a | 86a645445ffad9895d73369a5b742493aa955f33 | /englishconverter/src/main/java/com/example/EnglishConverter.java | 8292ad184b5d24117c149fa94e5565312ae8228a | [] | no_license | felixMCC/MetricToEnglishConverterFelixS-Android | f2bd79cb0e5c5a558f71ca99f7a175ebbc3120ae | 3070f241d9614e4b810f17483dc54ed71e60abf2 | refs/heads/master | 2016-09-05T10:12:51.848370 | 2015-09-17T18:24:46 | 2015-09-17T18:24:46 | 42,673,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | /**
* Metric to English Converter
* Created by nsotres on 9/17/15.
*
* This project takes a few given values in metric and converts them into the English system.
*/
package com.example;
public class EnglishConverter {
public static void main(String [] args){
System.out.println("Metric to English Converter\nFelix Sotres\nPRG130- Java for Android");
System.out.println("This program will take a few values given in Metric and convert them to the English system.\n");
Conversions runConversions = new Conversions();
//print given values
runConversions.printGivenValues();
//run conversions and print results
runConversions.runConversions();
}
}
| [
"nsotres@e104-m-20.mchenry.edu"
] | nsotres@e104-m-20.mchenry.edu |
edef1c8bd980303e8c71b5f88a390695831fa647 | f14f2861ee7e97cb37f69216b207bf431873cfb5 | /Eclipse/Programacion_Sudoku_Estudiantes/src/poligran/SudokuMain.java | 8d3f5716be4d2f0b92d532144c0f12a98023dca5 | [] | no_license | osfprieto/Personal | f97307f1014569baa9a10865c255072b8b949c11 | f0353c25718f29feebfb26da2003408e448a0aeb | refs/heads/master | 2022-09-20T13:11:19.242327 | 2022-09-12T19:53:37 | 2022-09-12T19:53:37 | 14,189,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,370 | java | package poligran;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
public class SudokuMain
{
public static int TAMANOTABLERO = 9;
public static int [][] tablero= new int [TAMANOTABLERO][TAMANOTABLERO];
public static int NUMTABLEROSINICIALES = 10000;
public static String[] tablerosIniciales = new String[NUMTABLEROSINICIALES];
public static int MAXOPCIONES = 3;
public static int TAMANOZONA = 3;
private static void jugarCasilla()
{
//Primera parte: Solicitud de datos al usuario
System.out.println("Ingrese fila (entre 1 y 9)");
int fila = new Scanner(System.in).nextInt() -1;
System.out.println("Ingrese columna (entre 1 y 9)");
int columna = new Scanner(System.in).nextInt() -1;
System.out.println("Ingrese valor (entre 1 y 9) o cero para borrar");
int valor = new Scanner(System.in).nextInt();
//Segunda parte: Asignar el valor al tablero
tablero[fila][columna] = valor;
//Tercera parte: Revision de errores
boolean hayErrores = hayErroresFilaColumnaZona(fila, columna);
if(hayErrores)
{
System.out.println("Hay errores en su juego, revise que no haya repetido digitos en alguna fila, columna o zona");
}
//Cuarta parte: Revision de ganador
boolean hayGanador = validarGanador();
if(hayGanador)
{
System.out.println("Ha ganado!");
}
}
public static void seleccionarTablero()
{
//INICIO CODIGO ESTUDIANTE PUNTO 1
int n=SudokuMain.NUMTABLEROSINICIALES, i, j, cont=0;
Scanner sc = new Scanner(System.in);
while(n>SudokuMain.NUMTABLEROSINICIALES-1 || n<0){
System.out.println("Ingrese el número del tablero");
n = sc.nextInt()-1;
}
for(i=0;i<SudokuMain.TAMANOTABLERO;i++)
for(j=0;j<SudokuMain.TAMANOTABLERO;j++)
tablero[i][j] = (int)(tablerosIniciales[n].charAt(cont++)-'0');
//FIN CODIGO ESTUDIANTE PUNTO 1
}
private static boolean validarGanador()
{
//INICIO CODIGO ESTUDIANTE PUNTO 2
if(contarCasillasLlenas()==81){
boolean hayErrores = false;
for(int i=0;i<SudokuMain.TAMANOTABLERO && !hayErrores;i++){
for(int j=0;j<SudokuMain.TAMANOTABLERO && !hayErrores;j++){
hayErrores = hayErroresFilaColumnaZona(i, j);
}
}
boolean gana = !hayErrores;
return gana;
}
return false;
//FIN CODIGO ESTUDIANTE PUNTO 2
}
private static boolean hayErroresFilaColumnaZona(int fila, int columna)
{
//revisar fila
boolean erroresfila = hayErrorFila( fila);
//revisar columna
boolean errorescolumna = hayErrorColumna( columna);
//revisar zona
boolean erroreszona = hayErrorZona(fila, columna);
if(erroresfila || errorescolumna || erroreszona)
{
return true;// esto implica que hay algun error
}
return false;// esto implica que no hay ningun error
}
private static boolean hayErrorZona(int fila, int columna)
{
//inicio de zona: 0, 3, 6
//tamano de zona 3
//declaracion de los indices que recorreran la submatriz de la zona
int filainicial = 3*fila;
int columnainicial =3*columna;
//ubicar los indices en los puntos iniciales de la zona a evaluar
//INICIO CODIGO ESTUDIANTE PUNTO 3
boolean []ocurrencias = new boolean[10];
for(int i =0 ; i< TAMANOZONA ; i++)
{
for(int j=0;j<TAMANOZONA;j++){
int valorActual = tablero[filainicial+i][columnainicial+j];
if(valorActual !=0)
{
if(ocurrencias[valorActual] == false)
{
ocurrencias[valorActual]=true;
}
else
{
System.out.println("Error revisando zonas: Valor repetido en la coordenada [fila:"+(filainicial+i)+",columna:"+(columnainicial+j)+"]");
return true;
}
}
}
}
return false;
//FIN INICIO CODIGO ESTUDIANTE PUNTO 3
}
private static boolean hayErrorColumna(int columna)
{
//INICIO CODIGO ESTUDIANTE PUNTO 4
boolean []ocurrencias = new boolean[10];
for(int filaActual =0 ; filaActual< TAMANOTABLERO ; filaActual++)
{
int valorActual = tablero[filaActual][columna];
if(valorActual !=0)
{
if(ocurrencias[valorActual] == false)
{
ocurrencias[valorActual]=true;
}
else
{
System.out.println("Error revisando columnas: Valor repetido en la coordenada [fila:"+filaActual+",columna:"+columna+"]");
return true;
}
}
}
return false;
//FIN CODIGO ESTUDIANTE PUNTO 4
}
private static boolean hayErrorFila(int fila)
{
boolean []ocurrencias = new boolean[10];
for(int columnaActual =0 ; columnaActual< TAMANOTABLERO ; columnaActual++)
{
int valorActual = tablero[fila][columnaActual];
if(valorActual !=0)
{
if(ocurrencias[valorActual] == false)
{
ocurrencias[valorActual]=true;
}
else
{
System.out.println("Error revisando filas: Valor repetido en la coordenada [fila:"+fila+",columna:"+columnaActual+"]");
return true;
}
}
}
return false;
}
public static void imprimirTablero ()
{
System.out.println("Impresion del tablero: Hay "+contarCasillasLlenas()+" casillas llenas");
System.out.println(" "+" C1 "+" C2 "+" C3 "+" C4 "+" C5 "+" C6 "+" C7 "+" C8 "+" C9 ");
for (int i = 0; i < TAMANOTABLERO; i++)
{
System.out.print("F"+(i+1)+" ");
for (int j = 0; j < TAMANOTABLERO; j++)
{
if(tablero[i][j]!=0)
{
System.out.print("| " +tablero[i][j]+" |");
}
else
{
System.out.print("| " +" "+" |");
}
}
System.out.println();
System.out.println(" ---------------------------------------------");
}
}
public static void main(String[] args)
{
reiniciar();
menu();
}
public static void reiniciar()
{
cargarNivel();
seleccionarTablero();
}
public static void cargarNivel()
{
try
{
BufferedReader lector = new BufferedReader(new FileReader("./data/"+"boards.sdk"));
String linea = "";
int contadorLineas = 0;
while (( linea = lector.readLine()) != null && contadorLineas < NUMTABLEROSINICIALES)
{
tablerosIniciales[contadorLineas]= linea;
contadorLineas++;
}
}
catch (FileNotFoundException e)
{
System.out.println("Archivo no encontrado");
}
catch (IOException e)
{
System.out.println("Error de lectura");
}
System.out.println("Carga del archivo exitosa!");
}
public static void menu()
{
System.out.println("Sudoku!");
int opcion = -1;
while(opcion < MAXOPCIONES)
{
imprimirTablero();
System.out.println("Ingrese opcion");
System.out.println("1. Jugar una casilla");
System.out.println("2. Reiniciar Juego - Seleccionar Tablero");
System.out.println("3. Salir");
opcion = new Scanner(System.in).nextInt();
if(opcion == 2)
{
seleccionarTablero();
}
else if (opcion == 1)
{
jugarCasilla();
}
}
}
public static int contarCasillasLlenas()
{
//INICIO CODIGO ESTUDIANTE PUNTO 5 (BONO)
int casillasLlenas=0;
for(int i=0;i<TAMANOTABLERO;i++)
for(int j=0;j<TAMANOTABLERO;j++)
if(tablero[i][j]>0)
casillasLlenas++;
return casillasLlenas;
//FIN CODIGO ESTUDIANTE PUNTO 5 (BONO)
}
}
| [
"osfprieto@gmail.com"
] | osfprieto@gmail.com |
813e862206ef8cb08a4bba087274ec03a0f3b776 | 3f605d058523f0b1e51f6557ed3c7663d5fa31d6 | /extmod/org.ebayopensource.vjet.extmod.jsdt/src/org/eclipse/mod/wst/jsdt/internal/core/interpret/Interpreter.java | 292093f67451a60b49a135e256f01ff385ca1a3e | [] | no_license | vjetteam/vjet | 47e21a13978cd860f1faf5b0c2379e321a9b688c | ba90843b89dc40d7a7eb289cdf64e127ec548d1d | refs/heads/master | 2020-12-25T11:05:55.420303 | 2012-08-07T21:56:30 | 2012-08-07T21:56:30 | 3,181,492 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,673 | java | /*******************************************************************************
* Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.mod.wst.jsdt.internal.core.interpret;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Map;
import org.eclipse.mod.wst.jsdt.internal.compiler.CompilationResult;
import org.eclipse.mod.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies;
import org.eclipse.mod.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.mod.wst.jsdt.internal.compiler.batch.CompilationUnit;
import org.eclipse.mod.wst.jsdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.mod.wst.jsdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.mod.wst.jsdt.internal.compiler.parser.Parser;
import org.eclipse.mod.wst.jsdt.internal.compiler.problem.DefaultProblemFactory;
import org.eclipse.mod.wst.jsdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.mod.wst.jsdt.internal.compiler.util.Util;
public class Interpreter {
public static InterpreterResult interpet(String code, InterpreterContext context)
{
InterpretedScript parsedUnit = parseString(code);
InterpreterResult result = interpret(parsedUnit.compilationUnit, context);
parsedUnit.compilationUnit.cleanUp();
return result;
}
public static InterpretedScript parseFile(String fileName) {
File file = new File(fileName);
InterpretedScript unit=null;
if (file.exists())
{
try {
byte[] fileByteContent = Util.getFileByteContent(file);
char[] chars = Util.bytesToChar(fileByteContent, Util.UTF_8);
unit=parse(chars);
} catch (IOException e) {
}
}
return unit;
}
public static InterpretedScript parseString(String code) {
char[] source = code.toCharArray();
return parse(source);
}
private static InterpretedScript parse(char[] source) {
Map options =new CompilerOptions().getMap();
options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.IGNORE);
options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3);
options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
CompilerOptions compilerOptions =new CompilerOptions(options);
Parser parser =
new Parser(
new ProblemReporter(
DefaultErrorHandlingPolicies.exitAfterAllProblems(),
compilerOptions,
new DefaultProblemFactory(Locale.getDefault())),
true);
ICompilationUnit sourceUnit = new CompilationUnit(source, "interpreted", null); //$NON-NLS-1$
CompilationResult compilationUnitResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
CompilationUnitDeclaration parsedUnit = parser.parse(sourceUnit, compilationUnitResult);
int[] lineEnds = parser.scanner.lineEnds;
return new InterpretedScript(parsedUnit,lineEnds,parser.scanner.linePtr);
}
public static InterpreterResult interpret(CompilationUnitDeclaration ast, InterpreterContext context)
{
InterpreterEngine engine = new InterpreterEngine(context);
return engine.interpret(ast);
}
}
| [
"pwang@27f4aac7-f869-4a38-a8c2-f1a995e726e6"
] | pwang@27f4aac7-f869-4a38-a8c2-f1a995e726e6 |
5b8dbaed3a556bc735be835bcdeb2ab47960568f | 054f6dde0b86da5b25970adcbcc22be457b0894d | /src/main/java/cn/edu/bjtu/weibo/controller/SearchController.java | 50ce25fbc9c133c82e7abc279ee3276f3a213283 | [] | no_license | jibenben/wb | a9dd05378ea8fa45ef9ccd8dc6d63f7bdbae468e | fd777c8082377ec0464adbd2d0848e9f924cf6ff | refs/heads/master | 2021-01-13T15:17:52.760434 | 2017-01-03T03:49:10 | 2017-01-03T03:49:10 | 76,451,076 | 1 | 16 | null | 2016-12-15T07:48:36 | 2016-12-14T10:51:15 | Java | UTF-8 | Java | false | false | 249 | java | package cn.edu.bjtu.weibo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/s")
public class SearchController {
}
| [
"njusunrise@163.com"
] | njusunrise@163.com |
2957f0988c5ad345171bd33ffc7aae63b59e12cc | c41033e465861f6a97db7ecd77cb8fec6d3aa797 | /src/main/java/com/promineotech/socialmediaapi/controller/PostController.java | b6c5b029b34bd1f682c4999f908d2dcb4ab5801e | [] | no_license | jraba/socialmediaapi | af05c4735f852f48e364b9298a73f224fcc411ec | 9ffdcdd7e841f6dc42f269100684f442cbc0f555 | refs/heads/master | 2022-12-17T08:40:08.715125 | 2020-09-11T22:40:19 | 2020-09-11T22:40:19 | 294,825,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,866 | java | package com.promineotech.socialmediaapi.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.promineotech.socialmediaapi.entity.Post;
import com.promineotech.socialmediaapi.service.PostService;
@RestController
@RequestMapping("/users/{userId}/posts")
public class PostController {
@Autowired
private PostService service;
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Object> getAllPosts() {
return new ResponseEntity<Object>(service.getAllPosts(), HttpStatus.OK);
}
@RequestMapping(value = "/{postId}", method = RequestMethod.GET)
public ResponseEntity<Object> getPost(@PathVariable Long postId) {
return new ResponseEntity<Object>(service.getPost(postId), HttpStatus.OK);
}
@RequestMapping(value = "/{postId}", method = RequestMethod.PUT)
public ResponseEntity<Object> updatePost(@RequestBody Post post, @PathVariable Long postId) {
try {
return new ResponseEntity<Object>(service.createPost(post, postId), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<Object>(e.getMessage(), HttpStatus.BAD_REQUEST);
}
}
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Object> createPost(@RequestBody Post post, @PathVariable Long userId) {
try {
return new ResponseEntity<Object>(service.createPost(post, userId), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<Object>(e.getMessage(), HttpStatus.BAD_REQUEST);
}
}
}
| [
"jraban91@gmail.com"
] | jraban91@gmail.com |
9377f25d349f7a02b8965e4494a8a4a1456015e3 | ec7aefe5209b7b0d808ace32c5ae13f3188944e7 | /src/models/Maze.java | efb760cc9c67b84b2b8d7c9676e725bd25c4cb94 | [] | no_license | Mazsamsokoban/sokoban | b96b1ea7e1c5918d4b719c74b278214ab62a6799 | 0ba589a3ed98dc51249a738b796e8928c8b3d4b8 | refs/heads/master | 2021-04-26T22:17:18.169733 | 2018-05-14T21:17:56 | 2018-05-14T21:17:56 | 124,063,038 | 0 | 1 | null | 2018-05-14T21:17:57 | 2018-03-06T10:39:19 | Java | ISO-8859-2 | Java | false | false | 7,410 | java | package models;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.Timer;
import components.GamePanel;
import views.BoxView;
import views.ChangingFieldView;
import views.FieldView;
import views.WorkerView;
/**
* A raktárépületet képviselő osztály
*/
public class Maze {
//public Tester tester;
private List<FieldBase> fields;
private List<Box> boxes;
private List<Worker> workers;
private Timer timer;
private GamePanel gamePanel;
/**
* Létrehozza az elemeknek a tárolókat
*/
public Maze(GamePanel panel) {
gamePanel = panel;
fields = new ArrayList<FieldBase>();
boxes = new ArrayList<Box>();
workers = new ArrayList<Worker>();
init();
}
/**
* Inicializál egy pályát
*/
public void init() {
BufferedImage floorImg = null;
BufferedImage wallImg = null;
BufferedImage columnImg = null;
BufferedImage holeImg = null;
BufferedImage switchImg = null;
BufferedImage boxImg = null;
BufferedImage w1boxImg = null;
BufferedImage w2boxImg = null;
BufferedImage bfImg = null;
BufferedImage oilImg = null;
BufferedImage honeyImg = null;
try {
floorImg = ImageIO.read(new File("floor.png"));
wallImg = ImageIO.read(new File("wall.png"));
columnImg = ImageIO.read(new File("column.png"));
holeImg = ImageIO.read(new File("hole.png"));
switchImg = ImageIO.read(new File("button.png"));
boxImg = ImageIO.read(new File("box.png"));
w1boxImg = ImageIO.read(new File("cyanbox.png"));
w2boxImg = ImageIO.read(new File("yellowbox.png"));
bfImg = ImageIO.read(new File("boxfield.png"));
honeyImg = ImageIO.read(new File("honey.jpg"));
oilImg = ImageIO.read(new File("oil.png"));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//inicializálás soronként
SwitchableHole shole;
Switch sw;
/*1.sor*/
for(int i = 0, x = 0; i < 8; x += 100, ++i) {
fields.add(new Obstacle(new FieldView(x, 0, wallImg)));
}
/*2.sor*/
fields.add(new Obstacle(new FieldView(0, 100, wallImg)));
fields.add(new Field(new FieldView(100,100, floorImg)));
fields.add(new Field(new FieldView(200,100, floorImg)));
fields.add(new Obstacle(new FieldView(300, 100, wallImg)));
fields.add(new Field(new FieldView(400,100, floorImg)));
fields.add(new Field(new FieldView(500,100, floorImg)));
fields.add(new BoxField(new FieldView(600,100, bfImg)));
fields.add(new Obstacle(new FieldView(700, 100, wallImg)));
/*3.sor*/
fields.add(new Obstacle(new FieldView(0, 200, wallImg)));
fields.add(new Field(new FieldView(100,200, floorImg)));
fields.add(new Field(new FieldView(200,200, floorImg)));
fields.add(new Obstacle(new FieldView(300, 200, wallImg)));
fields.add(new BoxField(new FieldView(400,200, bfImg)));
fields.add(new Field(new FieldView(500,200, floorImg)));
fields.add(new Field(new FieldView(600,200, floorImg)));
fields.add(new Obstacle(new FieldView(700, 200, wallImg)));
/*4.sor*/
fields.add(new Obstacle(new FieldView(0, 300, wallImg)));
fields.add(new Field(new FieldView(100,300, floorImg)));
fields.add(new Field(new FieldView(200,300, floorImg)));
fields.add(new Obstacle(new FieldView(300, 300, columnImg)));
fields.add(new Field(new FieldView(400, 300, floorImg)));
fields.add(shole = new SwitchableHole(new ChangingFieldView(500, 300, floorImg, holeImg)));
fields.add(new Field(new FieldView(600,300, floorImg)));
fields.add(new Obstacle(new FieldView(700, 300, wallImg)));
/*5.sor*/
fields.add(new Obstacle(new FieldView(0, 400, wallImg)));
fields.add(new Field(new FieldView(100,400, floorImg)));
fields.add(new Field(new FieldView(200,400, floorImg)));
fields.add(new BoxField(new FieldView(300, 400, bfImg)));
fields.add(sw = new Switch(new FieldView(400, 400, switchImg)));
fields.add(new Field(new FieldView(500, 400, floorImg)));
fields.add(new Field(new FieldView(600,400, floorImg)));
fields.add(new Obstacle(new FieldView(700, 400, wallImg)));
/*6.sor*/
fields.add(new Obstacle(new FieldView(0, 500, wallImg)));
fields.add(new Hole(new FieldView(100, 500, holeImg)));
for(int i = 0, x = 200; i < 4; x += 100, ++i) {
fields.add(new Field(new FieldView(x, 500, floorImg)));
}
fields.add(new BoxField(new FieldView(600, 500, bfImg)));
fields.add(new Obstacle(new FieldView(700, 500, wallImg)));
/*7.sor*/
for(int i = 0, x = 0; i < 8; x += 100, ++i) {
fields.add(new Obstacle(new FieldView(x, 600, wallImg)));
}
//szomszédságok
for(int i = 0; i< fields.size()-1; ++i) {
fields.get(i).setNeighbor(Direction.Right, fields.get(i+1));
}
for(int i = 0; i < fields.size() - 8; ++i) {
fields.get(i).setNeighbor(Direction.Down, fields.get(i+8));
}
//munkások és ládák
Worker worker1 = new Worker(new WorkerView(0, 0, Color.CYAN));
Worker worker2 = new Worker(new WorkerView(0, 0, new Color(244, 178, 26)));
workers.add(worker1);
workers.add(worker2);
Box box1 = new Box(new BoxView(0, 0, boxImg, w1boxImg, w2boxImg));
Box box2 = new Box(new BoxView(0, 0, boxImg, w1boxImg, w2boxImg));
Box box3 = new Box(new BoxView(0, 0, boxImg, w1boxImg, w2boxImg));
Box box4 = new Box(new BoxView(0, 0, boxImg, w1boxImg, w2boxImg));
boxes.add(box1);
boxes.add(box2);
boxes.add(box3);
boxes.add(box4);
fields.get(7+5).setThing(worker1);
fields.get(7+6).setThing(worker2);
fields.get(7+8+3).setThing(box1);
fields.get(7+8*2+3).setThing(box2);
fields.get(7+8*3+6).setThing(box3);
fields.get(7+8*4+4).setThing(box4);
sw.SetSh(shole);
showMaze();
timer = new Timer(100, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
updateAll();
try {
if(CheckEndOfGame() || gamePanel.isEnded()) {
gamePanel.endGame();
timer.stop();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
timer.setRepeats(true);
timer.start();
}
/**
* megjeleníti a pályát
*/
private void showMaze() {
for(Worker w : workers)
gamePanel.add(w.getView());
for(Box b : boxes){
gamePanel.add(b.getView());
}
for(FieldBase f : fields) {
gamePanel.add(f.getView());
}
}
public void updateAll() {
for(FieldBase f : fields) {
f.update();
}
gamePanel.repaint();
gamePanel.invalidate();
}
/**
* ellenőrzi, hogy teljesülnek-e a játék befejezésének feltételei, és ez alapján tér vissza
* @return vége van.e a játéknak
*/
public boolean CheckEndOfGame() throws IOException
{
if (CheckBoxes()) //minden doboz helyre került-e
return true;
else {
int n = 0;
for(Worker w : workers)
if(w.getField() == null)
++n;
if(n == workers.size() - 1)
return true;
}
return false;
}
/**
* Leellenőrzi, hogy minden láda kijelölt helyen van-e
* @return minden láda beért-e
*/
public boolean CheckBoxes() throws IOException
{
for (Box b : boxes)
{
if (!b.isOnBoxField() && b.getField() != null) {
return false;
}
}
return true;
}
public List<Worker> getWorkers() {
return workers;
}
}
| [
"matusekma@gmail.com"
] | matusekma@gmail.com |
2a69616e9ae25b923a5e2a21f8f11f643a9154a0 | b9648eb0f0475e4a234e5d956925ff9aa8c34552 | /google-ads-stubs-v10/src/main/java/com/google/ads/googleads/v10/resources/CampaignCustomizer.java | 767889d5c49557a240ca5b416fd06315cd4f5fa5 | [
"Apache-2.0"
] | permissive | wfansh/google-ads-java | ce977abd611d1ee6d6a38b7b3032646d5ffb0b12 | 7dda56bed67a9e47391e199940bb8e1568844875 | refs/heads/main | 2022-05-22T23:45:55.238928 | 2022-03-03T14:23:07 | 2022-03-03T14:23:07 | 460,746,933 | 0 | 0 | Apache-2.0 | 2022-02-18T07:08:46 | 2022-02-18T07:08:45 | null | UTF-8 | Java | false | true | 48,023 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/ads/googleads/v10/resources/campaign_customizer.proto
package com.google.ads.googleads.v10.resources;
/**
* <pre>
* A customizer value for the associated CustomizerAttribute at the Campaign
* level.
* </pre>
*
* Protobuf type {@code google.ads.googleads.v10.resources.CampaignCustomizer}
*/
public final class CampaignCustomizer extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.ads.googleads.v10.resources.CampaignCustomizer)
CampaignCustomizerOrBuilder {
private static final long serialVersionUID = 0L;
// Use CampaignCustomizer.newBuilder() to construct.
private CampaignCustomizer(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private CampaignCustomizer() {
resourceName_ = "";
campaign_ = "";
customizerAttribute_ = "";
status_ = 0;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new CampaignCustomizer();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private CampaignCustomizer(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
resourceName_ = s;
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
campaign_ = s;
break;
}
case 26: {
java.lang.String s = input.readStringRequireUtf8();
customizerAttribute_ = s;
break;
}
case 32: {
int rawValue = input.readEnum();
status_ = rawValue;
break;
}
case 42: {
com.google.ads.googleads.v10.common.CustomizerValue.Builder subBuilder = null;
if (value_ != null) {
subBuilder = value_.toBuilder();
}
value_ = input.readMessage(com.google.ads.googleads.v10.common.CustomizerValue.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(value_);
value_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ads.googleads.v10.resources.CampaignCustomizerProto.internal_static_google_ads_googleads_v10_resources_CampaignCustomizer_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ads.googleads.v10.resources.CampaignCustomizerProto.internal_static_google_ads_googleads_v10_resources_CampaignCustomizer_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ads.googleads.v10.resources.CampaignCustomizer.class, com.google.ads.googleads.v10.resources.CampaignCustomizer.Builder.class);
}
public static final int RESOURCE_NAME_FIELD_NUMBER = 1;
private volatile java.lang.Object resourceName_;
/**
* <pre>
* Immutable. The resource name of the campaign customizer.
* Campaign customizer resource names have the form:
* `customers/{customer_id}/campaignCustomizers/{campaign_id}~{customizer_attribute_id}`
* </pre>
*
* <code>string resource_name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The resourceName.
*/
@java.lang.Override
public java.lang.String getResourceName() {
java.lang.Object ref = resourceName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
resourceName_ = s;
return s;
}
}
/**
* <pre>
* Immutable. The resource name of the campaign customizer.
* Campaign customizer resource names have the form:
* `customers/{customer_id}/campaignCustomizers/{campaign_id}~{customizer_attribute_id}`
* </pre>
*
* <code>string resource_name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for resourceName.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getResourceNameBytes() {
java.lang.Object ref = resourceName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
resourceName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int CAMPAIGN_FIELD_NUMBER = 2;
private volatile java.lang.Object campaign_;
/**
* <pre>
* Immutable. The campaign to which the customizer attribute is linked.
* </pre>
*
* <code>string campaign = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The campaign.
*/
@java.lang.Override
public java.lang.String getCampaign() {
java.lang.Object ref = campaign_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
campaign_ = s;
return s;
}
}
/**
* <pre>
* Immutable. The campaign to which the customizer attribute is linked.
* </pre>
*
* <code>string campaign = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for campaign.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getCampaignBytes() {
java.lang.Object ref = campaign_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
campaign_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int CUSTOMIZER_ATTRIBUTE_FIELD_NUMBER = 3;
private volatile java.lang.Object customizerAttribute_;
/**
* <pre>
* Required. Immutable. The customizer attribute which is linked to the campaign.
* </pre>
*
* <code>string customizer_attribute = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The customizerAttribute.
*/
@java.lang.Override
public java.lang.String getCustomizerAttribute() {
java.lang.Object ref = customizerAttribute_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
customizerAttribute_ = s;
return s;
}
}
/**
* <pre>
* Required. Immutable. The customizer attribute which is linked to the campaign.
* </pre>
*
* <code>string customizer_attribute = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for customizerAttribute.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getCustomizerAttributeBytes() {
java.lang.Object ref = customizerAttribute_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
customizerAttribute_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int STATUS_FIELD_NUMBER = 4;
private int status_;
/**
* <pre>
* Output only. The status of the campaign customizer.
* </pre>
*
* <code>.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The enum numeric value on the wire for status.
*/
@java.lang.Override public int getStatusValue() {
return status_;
}
/**
* <pre>
* Output only. The status of the campaign customizer.
* </pre>
*
* <code>.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The status.
*/
@java.lang.Override public com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus getStatus() {
@SuppressWarnings("deprecation")
com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus result = com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus.valueOf(status_);
return result == null ? com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus.UNRECOGNIZED : result;
}
public static final int VALUE_FIELD_NUMBER = 5;
private com.google.ads.googleads.v10.common.CustomizerValue value_;
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
* @return Whether the value field is set.
*/
@java.lang.Override
public boolean hasValue() {
return value_ != null;
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The value.
*/
@java.lang.Override
public com.google.ads.googleads.v10.common.CustomizerValue getValue() {
return value_ == null ? com.google.ads.googleads.v10.common.CustomizerValue.getDefaultInstance() : value_;
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
@java.lang.Override
public com.google.ads.googleads.v10.common.CustomizerValueOrBuilder getValueOrBuilder() {
return getValue();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resourceName_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, resourceName_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(campaign_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, campaign_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(customizerAttribute_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, customizerAttribute_);
}
if (status_ != com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus.UNSPECIFIED.getNumber()) {
output.writeEnum(4, status_);
}
if (value_ != null) {
output.writeMessage(5, getValue());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resourceName_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, resourceName_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(campaign_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, campaign_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(customizerAttribute_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, customizerAttribute_);
}
if (status_ != com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus.UNSPECIFIED.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(4, status_);
}
if (value_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(5, getValue());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.ads.googleads.v10.resources.CampaignCustomizer)) {
return super.equals(obj);
}
com.google.ads.googleads.v10.resources.CampaignCustomizer other = (com.google.ads.googleads.v10.resources.CampaignCustomizer) obj;
if (!getResourceName()
.equals(other.getResourceName())) return false;
if (!getCampaign()
.equals(other.getCampaign())) return false;
if (!getCustomizerAttribute()
.equals(other.getCustomizerAttribute())) return false;
if (status_ != other.status_) return false;
if (hasValue() != other.hasValue()) return false;
if (hasValue()) {
if (!getValue()
.equals(other.getValue())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + RESOURCE_NAME_FIELD_NUMBER;
hash = (53 * hash) + getResourceName().hashCode();
hash = (37 * hash) + CAMPAIGN_FIELD_NUMBER;
hash = (53 * hash) + getCampaign().hashCode();
hash = (37 * hash) + CUSTOMIZER_ATTRIBUTE_FIELD_NUMBER;
hash = (53 * hash) + getCustomizerAttribute().hashCode();
hash = (37 * hash) + STATUS_FIELD_NUMBER;
hash = (53 * hash) + status_;
if (hasValue()) {
hash = (37 * hash) + VALUE_FIELD_NUMBER;
hash = (53 * hash) + getValue().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.ads.googleads.v10.resources.CampaignCustomizer prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* A customizer value for the associated CustomizerAttribute at the Campaign
* level.
* </pre>
*
* Protobuf type {@code google.ads.googleads.v10.resources.CampaignCustomizer}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:google.ads.googleads.v10.resources.CampaignCustomizer)
com.google.ads.googleads.v10.resources.CampaignCustomizerOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ads.googleads.v10.resources.CampaignCustomizerProto.internal_static_google_ads_googleads_v10_resources_CampaignCustomizer_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ads.googleads.v10.resources.CampaignCustomizerProto.internal_static_google_ads_googleads_v10_resources_CampaignCustomizer_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ads.googleads.v10.resources.CampaignCustomizer.class, com.google.ads.googleads.v10.resources.CampaignCustomizer.Builder.class);
}
// Construct using com.google.ads.googleads.v10.resources.CampaignCustomizer.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
resourceName_ = "";
campaign_ = "";
customizerAttribute_ = "";
status_ = 0;
if (valueBuilder_ == null) {
value_ = null;
} else {
value_ = null;
valueBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.ads.googleads.v10.resources.CampaignCustomizerProto.internal_static_google_ads_googleads_v10_resources_CampaignCustomizer_descriptor;
}
@java.lang.Override
public com.google.ads.googleads.v10.resources.CampaignCustomizer getDefaultInstanceForType() {
return com.google.ads.googleads.v10.resources.CampaignCustomizer.getDefaultInstance();
}
@java.lang.Override
public com.google.ads.googleads.v10.resources.CampaignCustomizer build() {
com.google.ads.googleads.v10.resources.CampaignCustomizer result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.ads.googleads.v10.resources.CampaignCustomizer buildPartial() {
com.google.ads.googleads.v10.resources.CampaignCustomizer result = new com.google.ads.googleads.v10.resources.CampaignCustomizer(this);
result.resourceName_ = resourceName_;
result.campaign_ = campaign_;
result.customizerAttribute_ = customizerAttribute_;
result.status_ = status_;
if (valueBuilder_ == null) {
result.value_ = value_;
} else {
result.value_ = valueBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.ads.googleads.v10.resources.CampaignCustomizer) {
return mergeFrom((com.google.ads.googleads.v10.resources.CampaignCustomizer)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.ads.googleads.v10.resources.CampaignCustomizer other) {
if (other == com.google.ads.googleads.v10.resources.CampaignCustomizer.getDefaultInstance()) return this;
if (!other.getResourceName().isEmpty()) {
resourceName_ = other.resourceName_;
onChanged();
}
if (!other.getCampaign().isEmpty()) {
campaign_ = other.campaign_;
onChanged();
}
if (!other.getCustomizerAttribute().isEmpty()) {
customizerAttribute_ = other.customizerAttribute_;
onChanged();
}
if (other.status_ != 0) {
setStatusValue(other.getStatusValue());
}
if (other.hasValue()) {
mergeValue(other.getValue());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.ads.googleads.v10.resources.CampaignCustomizer parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.ads.googleads.v10.resources.CampaignCustomizer) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object resourceName_ = "";
/**
* <pre>
* Immutable. The resource name of the campaign customizer.
* Campaign customizer resource names have the form:
* `customers/{customer_id}/campaignCustomizers/{campaign_id}~{customizer_attribute_id}`
* </pre>
*
* <code>string resource_name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The resourceName.
*/
public java.lang.String getResourceName() {
java.lang.Object ref = resourceName_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
resourceName_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* Immutable. The resource name of the campaign customizer.
* Campaign customizer resource names have the form:
* `customers/{customer_id}/campaignCustomizers/{campaign_id}~{customizer_attribute_id}`
* </pre>
*
* <code>string resource_name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for resourceName.
*/
public com.google.protobuf.ByteString
getResourceNameBytes() {
java.lang.Object ref = resourceName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
resourceName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* Immutable. The resource name of the campaign customizer.
* Campaign customizer resource names have the form:
* `customers/{customer_id}/campaignCustomizers/{campaign_id}~{customizer_attribute_id}`
* </pre>
*
* <code>string resource_name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @param value The resourceName to set.
* @return This builder for chaining.
*/
public Builder setResourceName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
resourceName_ = value;
onChanged();
return this;
}
/**
* <pre>
* Immutable. The resource name of the campaign customizer.
* Campaign customizer resource names have the form:
* `customers/{customer_id}/campaignCustomizers/{campaign_id}~{customizer_attribute_id}`
* </pre>
*
* <code>string resource_name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return This builder for chaining.
*/
public Builder clearResourceName() {
resourceName_ = getDefaultInstance().getResourceName();
onChanged();
return this;
}
/**
* <pre>
* Immutable. The resource name of the campaign customizer.
* Campaign customizer resource names have the form:
* `customers/{customer_id}/campaignCustomizers/{campaign_id}~{customizer_attribute_id}`
* </pre>
*
* <code>string resource_name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @param value The bytes for resourceName to set.
* @return This builder for chaining.
*/
public Builder setResourceNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
resourceName_ = value;
onChanged();
return this;
}
private java.lang.Object campaign_ = "";
/**
* <pre>
* Immutable. The campaign to which the customizer attribute is linked.
* </pre>
*
* <code>string campaign = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The campaign.
*/
public java.lang.String getCampaign() {
java.lang.Object ref = campaign_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
campaign_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* Immutable. The campaign to which the customizer attribute is linked.
* </pre>
*
* <code>string campaign = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for campaign.
*/
public com.google.protobuf.ByteString
getCampaignBytes() {
java.lang.Object ref = campaign_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
campaign_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* Immutable. The campaign to which the customizer attribute is linked.
* </pre>
*
* <code>string campaign = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @param value The campaign to set.
* @return This builder for chaining.
*/
public Builder setCampaign(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
campaign_ = value;
onChanged();
return this;
}
/**
* <pre>
* Immutable. The campaign to which the customizer attribute is linked.
* </pre>
*
* <code>string campaign = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return This builder for chaining.
*/
public Builder clearCampaign() {
campaign_ = getDefaultInstance().getCampaign();
onChanged();
return this;
}
/**
* <pre>
* Immutable. The campaign to which the customizer attribute is linked.
* </pre>
*
* <code>string campaign = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @param value The bytes for campaign to set.
* @return This builder for chaining.
*/
public Builder setCampaignBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
campaign_ = value;
onChanged();
return this;
}
private java.lang.Object customizerAttribute_ = "";
/**
* <pre>
* Required. Immutable. The customizer attribute which is linked to the campaign.
* </pre>
*
* <code>string customizer_attribute = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The customizerAttribute.
*/
public java.lang.String getCustomizerAttribute() {
java.lang.Object ref = customizerAttribute_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
customizerAttribute_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* Required. Immutable. The customizer attribute which is linked to the campaign.
* </pre>
*
* <code>string customizer_attribute = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for customizerAttribute.
*/
public com.google.protobuf.ByteString
getCustomizerAttributeBytes() {
java.lang.Object ref = customizerAttribute_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
customizerAttribute_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* Required. Immutable. The customizer attribute which is linked to the campaign.
* </pre>
*
* <code>string customizer_attribute = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @param value The customizerAttribute to set.
* @return This builder for chaining.
*/
public Builder setCustomizerAttribute(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
customizerAttribute_ = value;
onChanged();
return this;
}
/**
* <pre>
* Required. Immutable. The customizer attribute which is linked to the campaign.
* </pre>
*
* <code>string customizer_attribute = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @return This builder for chaining.
*/
public Builder clearCustomizerAttribute() {
customizerAttribute_ = getDefaultInstance().getCustomizerAttribute();
onChanged();
return this;
}
/**
* <pre>
* Required. Immutable. The customizer attribute which is linked to the campaign.
* </pre>
*
* <code>string customizer_attribute = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }</code>
* @param value The bytes for customizerAttribute to set.
* @return This builder for chaining.
*/
public Builder setCustomizerAttributeBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
customizerAttribute_ = value;
onChanged();
return this;
}
private int status_ = 0;
/**
* <pre>
* Output only. The status of the campaign customizer.
* </pre>
*
* <code>.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The enum numeric value on the wire for status.
*/
@java.lang.Override public int getStatusValue() {
return status_;
}
/**
* <pre>
* Output only. The status of the campaign customizer.
* </pre>
*
* <code>.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @param value The enum numeric value on the wire for status to set.
* @return This builder for chaining.
*/
public Builder setStatusValue(int value) {
status_ = value;
onChanged();
return this;
}
/**
* <pre>
* Output only. The status of the campaign customizer.
* </pre>
*
* <code>.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The status.
*/
@java.lang.Override
public com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus getStatus() {
@SuppressWarnings("deprecation")
com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus result = com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus.valueOf(status_);
return result == null ? com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus.UNRECOGNIZED : result;
}
/**
* <pre>
* Output only. The status of the campaign customizer.
* </pre>
*
* <code>.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @param value The status to set.
* @return This builder for chaining.
*/
public Builder setStatus(com.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus value) {
if (value == null) {
throw new NullPointerException();
}
status_ = value.getNumber();
onChanged();
return this;
}
/**
* <pre>
* Output only. The status of the campaign customizer.
* </pre>
*
* <code>.google.ads.googleads.v10.enums.CustomizerValueStatusEnum.CustomizerValueStatus status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return This builder for chaining.
*/
public Builder clearStatus() {
status_ = 0;
onChanged();
return this;
}
private com.google.ads.googleads.v10.common.CustomizerValue value_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.ads.googleads.v10.common.CustomizerValue, com.google.ads.googleads.v10.common.CustomizerValue.Builder, com.google.ads.googleads.v10.common.CustomizerValueOrBuilder> valueBuilder_;
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
* @return Whether the value field is set.
*/
public boolean hasValue() {
return valueBuilder_ != null || value_ != null;
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The value.
*/
public com.google.ads.googleads.v10.common.CustomizerValue getValue() {
if (valueBuilder_ == null) {
return value_ == null ? com.google.ads.googleads.v10.common.CustomizerValue.getDefaultInstance() : value_;
} else {
return valueBuilder_.getMessage();
}
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder setValue(com.google.ads.googleads.v10.common.CustomizerValue value) {
if (valueBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
value_ = value;
onChanged();
} else {
valueBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder setValue(
com.google.ads.googleads.v10.common.CustomizerValue.Builder builderForValue) {
if (valueBuilder_ == null) {
value_ = builderForValue.build();
onChanged();
} else {
valueBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder mergeValue(com.google.ads.googleads.v10.common.CustomizerValue value) {
if (valueBuilder_ == null) {
if (value_ != null) {
value_ =
com.google.ads.googleads.v10.common.CustomizerValue.newBuilder(value_).mergeFrom(value).buildPartial();
} else {
value_ = value;
}
onChanged();
} else {
valueBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder clearValue() {
if (valueBuilder_ == null) {
value_ = null;
onChanged();
} else {
value_ = null;
valueBuilder_ = null;
}
return this;
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public com.google.ads.googleads.v10.common.CustomizerValue.Builder getValueBuilder() {
onChanged();
return getValueFieldBuilder().getBuilder();
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public com.google.ads.googleads.v10.common.CustomizerValueOrBuilder getValueOrBuilder() {
if (valueBuilder_ != null) {
return valueBuilder_.getMessageOrBuilder();
} else {
return value_ == null ?
com.google.ads.googleads.v10.common.CustomizerValue.getDefaultInstance() : value_;
}
}
/**
* <pre>
* Required. The value to associate with the customizer attribute at this level. The
* value must be of the type specified for the CustomizerAttribute.
* </pre>
*
* <code>.google.ads.googleads.v10.common.CustomizerValue value = 5 [(.google.api.field_behavior) = REQUIRED];</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.ads.googleads.v10.common.CustomizerValue, com.google.ads.googleads.v10.common.CustomizerValue.Builder, com.google.ads.googleads.v10.common.CustomizerValueOrBuilder>
getValueFieldBuilder() {
if (valueBuilder_ == null) {
valueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.ads.googleads.v10.common.CustomizerValue, com.google.ads.googleads.v10.common.CustomizerValue.Builder, com.google.ads.googleads.v10.common.CustomizerValueOrBuilder>(
getValue(),
getParentForChildren(),
isClean());
value_ = null;
}
return valueBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.ads.googleads.v10.resources.CampaignCustomizer)
}
// @@protoc_insertion_point(class_scope:google.ads.googleads.v10.resources.CampaignCustomizer)
private static final com.google.ads.googleads.v10.resources.CampaignCustomizer DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.ads.googleads.v10.resources.CampaignCustomizer();
}
public static com.google.ads.googleads.v10.resources.CampaignCustomizer getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<CampaignCustomizer>
PARSER = new com.google.protobuf.AbstractParser<CampaignCustomizer>() {
@java.lang.Override
public CampaignCustomizer parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new CampaignCustomizer(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<CampaignCustomizer> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<CampaignCustomizer> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.ads.googleads.v10.resources.CampaignCustomizer getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0db307df13b69ae839c29522f4e4b3298aa9d858 | e210ce1a7d8f213f77ba6bc783a6140401947e79 | /springboot-demos-shiro-demo/src/main/java/com/example/shirodemo1/config/ShiroConfiguration.java | 8608dd197cdfedf377249c0acb55d2a027e6ff0a | [] | no_license | ReExia/java-demos | 2439e3184288f724dc42a39e4509028532c4234e | 85252aa4bb1e71d357edeba6dc3c631077bcf214 | refs/heads/master | 2020-03-26T05:31:59.474894 | 2018-08-30T05:05:15 | 2018-08-30T05:05:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,319 | java | package com.example.shirodemo1.config;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import javax.servlet.Filter;
import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
import com.google.code.kaptcha.Producer;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.cache.ehcache.EhCacheManager;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.CookieRememberMeManager;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 1.配置 ShiroFilterFactory : ShiroFilterFactoryBean
* 2.配置SecurityManager
*/
@Configuration
public class ShiroConfiguration {
@Bean
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
/**
* 1.定义 ShiroFactoryBean
* 2.设置 SecurityManager
* 3.配置拦截器 + 配置登录和登录成功得地址
* 4.返回 ShiroFactoryBean
*/
//1. 定义 ShiroFactoryBean
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
//2. 设置SecurityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
/* Map<String, Filter> filters = new HashMap<String, Filter>();
CustomFormAuthticationFilter customFormAuthticationFilter = new CustomFormAuthticationFilter();
filters.put("authc", customFormAuthticationFilter);
shiroFilterFactoryBean.setFilters(filters);*/
//3. 配置拦截的url
Map<String, String> filterChainMap = new LinkedHashMap<>();
// 配置退出url,这个由shiro进行实现的
filterChainMap.put("/logout", "logout");
//设置favicon.ico:匿名访问anon
filterChainMap.put("/favicon.ico", "anon");
//可匿名访问到js文件
filterChainMap.put("/js/**", "anon");
filterChainMap.put("/css/**", "anon");
filterChainMap.put("/img/**", "anon");
//authc : 所有url都必须通过认证才能访问
filterChainMap.put("/**", "authc");
//设置默认登录的url
shiroFilterFactoryBean.setLoginUrl("/login");
//设置登录成功跳转的url
shiroFilterFactoryBean.setSuccessUrl("/index");
//设置未授权url
shiroFilterFactoryBean.setUnauthorizedUrl("/403");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainMap);
//返回 ShiroFilterFactoryBean
return shiroFilterFactoryBean;
}
/**
* 开启Shiro aop注解支持.
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor attributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
attributeSourceAdvisor.setSecurityManager(securityManager);
return attributeSourceAdvisor;
}
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
//注入授权认证
securityManager.setRealm(myShiroRealm());
//注入缓存管理器
securityManager.setCacheManager(ehCacheManager());
//设置rememberMe
securityManager.setRememberMeManager(rememberMeManager());
return securityManager;
}
/**
* 自定义认证,授权器
*
* @return
*/
@Bean
public MyShiroRealm myShiroRealm() {
MyShiroRealm myShiroRealm = new MyShiroRealm();
myShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher());
return myShiroRealm;
}
/**
* 密码加密算法.
*
* @return
*/
@Bean
public HashedCredentialsMatcher hashedCredentialsMatcher() {
//HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
MyHashedCredentialsMatcher hashedCredentialsMatcher = new MyHashedCredentialsMatcher(ehCacheManager());
//加密算法 todo 加密算法 后面可以写到配置文件里
hashedCredentialsMatcher.setHashAlgorithmName("md5");
//散列的次数 todo 加密次数 后面可以写到配置文件里
hashedCredentialsMatcher.setHashIterations(2);
return hashedCredentialsMatcher;
}
/**
* 注入Ehcache缓存.
*/
@Bean
public EhCacheManager ehCacheManager() {
EhCacheManager ehCacheManager = new EhCacheManager();
//配置缓存文件.
ehCacheManager.setCacheManagerConfigFile("classpath:ehcache-shiro.xml");
return ehCacheManager;
}
/**
* cookie对象;
*
* @return
*/
@Bean
public SimpleCookie rememberMeCookie() {
System.out.println("ShiroConfiguration.rememberMeCookie()");
//这个参数是cookie的名称,对应前端的checkbox 的name = rememberMe
SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
//<!-- 记住我cookie生效时间30天 ,单位秒;-->
simpleCookie.setMaxAge(259200);
return simpleCookie;
}
/**
* cookie管理对象;
*
* @return
*/
@Bean
public CookieRememberMeManager rememberMeManager() {
System.out.println("ShiroConfiguration.rememberMeManager()");
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie());
return cookieRememberMeManager;
}
/**
* 是shiro - thymeleaf 解析.
*
* @return
*/
@Bean
public ShiroDialect shiroDialect() {
return new ShiroDialect();
}
/**
* 验证码生成器
* @return
*/
@Bean
public Producer producer() {
System.out.println("ShiroConfiguration.captchaProducer()");
DefaultKaptcha producer = new DefaultKaptcha();
Properties properties = new Properties();
/*kaptcha.border 是否有边框 默认为true 我们可以自己设置yes,no
kaptcha.border.color 边框颜色 默认为Color.BLACK
kaptcha.border.thickness 边框粗细度 默认为1
kaptcha.producer.impl 验证码生成器 默认为DefaultKaptcha
kaptcha.textproducer.impl 验证码文本生成器 默认为DefaultTextCreator
kaptcha.textproducer.char.string 验证码文本字符内容范围 默认为abcde2345678gfynmnpwx
kaptcha.textproducer.char.length 验证码文本字符长度 默认为5
kaptcha.textproducer.font.names 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
kaptcha.textproducer.font.size 验证码文本字符大小 默认为40
kaptcha.textproducer.font.color 验证码文本字符颜色 默认为Color.BLACK
kaptcha.textproducer.char.space 验证码文本字符间距 默认为2
kaptcha.noise.impl 验证码噪点生成对象 默认为DefaultNoise
kaptcha.noise.color 验证码噪点颜色 默认为Color.BLACK
kaptcha.obscurificator.impl 验证码样式引擎 默认为WaterRipple
kaptcha.word.impl 验证码文本字符渲染 默认为DefaultWordRenderer
kaptcha.background.impl 验证码背景生成器 默认为DefaultBackground
kaptcha.background.clear.from 验证码背景颜色渐进 默认为Color.LIGHT_GRAY
kaptcha.background.clear.to 验证码背景颜色渐进 默认为Color.WHITE
kaptcha.image.width 验证码图片宽度 默认为200
kaptcha.image.height 验证码图片高度 默认为50*/
// 是否有边框 默认为true 我们可以自己设置yes,no
properties.put("kaptcha.border", "yes");
//边框颜色 默认为Color.BLACK
properties.put("kaptcha.border.color", "105,179,90");
//字体颜色;
properties.put("kaptcha.textproducer.font.color", "blue");
//验证码样式引擎 默认为WaterRipple
properties.put("kaptcha.obscurificator.impl", "com.google.code.kaptcha.impl.ShadowGimpy");
// 验证码图片宽度 默认为200
properties.put("kaptcha.image.width", "145");
//验证码图片高度 默认为50
properties.put("kaptcha.image.height", "45");
//验证码文本字符大小 默认为40
properties.put("kaptcha.textproducer.font.size", "45");
//存放在session中的key;
properties.put("kaptcha.session.key", "code");
//产生字符的长度
properties.put("kaptcha.textproducer.char.length", "4");
//文本字符字体
properties.put("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
Config config = new Config(properties);
producer.setConfig(config);
return producer;
}
}
| [
"liu1023434681@qq.com"
] | liu1023434681@qq.com |
2569f1aa00ab75155a86747b974009d50a343b46 | 41780b2bdd7a6adf0aaa58f8ba526ace0f0761ea | /src/main/java/ma/isga/gesimmob/entities/Document.java | 37e1690642b13fa9333e0a536f1f4a90e71990f2 | [] | no_license | mousciss2020/gesimmob_v1 | fa71bfe22f85e4188a1abfe1f3be9f04ec1b5e94 | 98dac2e9dd7a21a855ec0d4cc771d4168ec9e5c8 | refs/heads/master | 2021-05-17T16:54:35.377654 | 2020-03-28T20:06:24 | 2020-03-28T20:06:24 | 250,882,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | package ma.isga.gesimmob.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
@Entity
public class Document {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long idDoc;
String Type;
@JoinColumn(referencedColumnName = "IdBien")
Long IdBien;
String Description;
String url; // url de document
/**
* Les constructeurs;
*/
public Document() {
super();
// TODO Auto-generated constructor stub
}
public Document(String type, String description, String url, Long idBien) {
super();
Type = type;
Description = description;
this.url = url;
IdBien = idBien;
}
/**
* Les methodes getter and setter
*/
public Long getIdDoc() {
return idDoc;
}
public void setIdDoc(Long idDoc) {
this.idDoc = idDoc;
}
public String getType() {
return Type;
}
public void setType(String type) {
Type = type;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Long getIdBien() {
return IdBien;
}
public void setIdBien(Long idBien) {
IdBien = idBien;
}
}
| [
"mousciss@hotmail.com"
] | mousciss@hotmail.com |
c548aa32cca295062e8dda173145880b2ba637c4 | efa1d7f894c31d91f9e2bf7b6318bb10e693d9a1 | /Ferretera/src/Client.java | 673f0f0e40b622413b1bc73d22a3acf74066cd7b | [] | no_license | OmarOchoaL/POO | 56af89454a03466684216a1a317308025c757333 | ee920b1c99593e3917507f8f4c599c8513842794 | refs/heads/main | 2023-06-06T07:19:21.969855 | 2021-06-26T04:19:06 | 2021-06-26T04:19:06 | 345,797,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | public class Client extends Person{
private double credit;
private double max_credit;
public Client(String nombre, String adress, String phone, double credit,double max_credit) {
super(nombre, adress, phone);
this.credit=credit;
this.max_credit=max_credit;
}
public void setCredit(double credit) { this.credit = credit; }
public double getCredit() { return credit; }
public void setMax_credit(double max_credit) { this.max_credit = max_credit; }
public double getMax_credit() { return max_credit; }
}
| [
"noreply@github.com"
] | noreply@github.com |
3d17e7c293ea77d10ef671c0514f26033ab010e0 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/TIME-20b-1-11-Single_Objective_GGA-WeightedSum-BasicBlockCoverage-opt/org/joda/time/format/DateTimeFormatter_ESTest_scaffolding.java | f8c2573c0970a667757c2a7eb1ed4d857a0e40cb | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,311 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Wed Oct 27 00:42:04 UTC 2021
*/
package org.joda.time.format;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class DateTimeFormatter_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.joda.time.format.DateTimeFormatter";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DateTimeFormatter_ESTest_scaffolding.class.getClassLoader() ,
"org.joda.time.DateTimeZone",
"org.joda.time.field.TestBaseDateTimeField$MockStandardBaseDateTimeField",
"org.joda.time.TestAbstractPartial$MockProperty0Field",
"org.joda.time.field.TestOffsetDateTimeField$MockStandardDateTimeField",
"org.joda.time.field.AbstractPartialFieldProperty",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.field.TestPreciseDateTimeField$MockPreciseDateTimeField",
"org.joda.time.TestMutableInterval_Basics",
"org.joda.time.TestDateMidnight_Basics",
"org.joda.time.MockZone",
"org.joda.time.TestMutableInterval_Constructors$MockInterval",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.TestPeriod_Basics",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.format.DateTimeFormatterBuilder$TwoDigitYear",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.LocalDate$Property",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.DateMidnight$Property",
"org.joda.time.format.PeriodFormatterBuilder$CompositeAffix",
"org.joda.time.ReadWritableInterval",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.DateTimePrinter",
"org.joda.time.TestDateTimeZone$MockDateTimeZone",
"org.joda.time.base.BaseLocal",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.TestBasePartial$MockPartial",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.TestMutableInterval_Updates$MockBadInterval",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.field.TestPreciseDurationDateTimeField$MockPreciseDurationDateTimeField",
"org.joda.time.base.BaseInterval",
"org.joda.time.Duration",
"org.joda.time.format.FormatUtils",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.TestLocalDateTime_Basics$MockInstant",
"org.joda.time.Interval",
"org.joda.time.base.AbstractInstant",
"org.joda.time.field.TestOffsetDateTimeField",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.ReadWritablePeriod",
"org.joda.time.LocalDateTime",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.TestMutableDateTime_Basics$MockEqualsChronology",
"org.joda.time.format.PeriodPrinter",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.field.TestPreciseDurationDateTimeField",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.base.BaseDuration",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.Months",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneId",
"org.joda.time.TestDateTime_Basics$MockEqualsChronology",
"org.joda.time.YearMonthDay",
"org.joda.time.format.DateTimeParser",
"org.joda.time.TestSerialization$MockDelegatedDurationField",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.YearMonth",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.LocalTime$Property",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.DateTime$Property",
"org.joda.time.Years",
"org.joda.time.DateTimeField",
"org.joda.time.TestInstant_Basics",
"org.joda.time.field.FieldUtils",
"org.joda.time.Partial",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.field.TestPreciseDurationDateTimeField$MockCountingDurationField",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.field.TestBaseDateTimeField",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.format.DateTimeFormat$StyleFormatter",
"org.joda.time.TestDateMidnight_Basics$MockInstant",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.ReadablePeriod",
"org.joda.time.TestAbstractPartial$MockProperty0",
"org.joda.time.TestAbstractPartial$MockProperty1",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.TestMutablePeriod_Basics",
"org.joda.time.TestMutableInterval_Updates",
"org.joda.time.field.TestPreciseDurationDateTimeField$MockStandardBaseDateTimeField",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.Minutes",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.base.AbstractPartial",
"org.joda.time.base.BasePartial",
"org.joda.time.base.BaseDateTime",
"org.joda.time.DateTimeUtils",
"org.joda.time.base.AbstractDuration",
"org.joda.time.LocalTime",
"org.joda.time.Hours",
"org.joda.time.base.AbstractInterval",
"org.joda.time.TestMonthDay_Basics",
"org.joda.time.TestMonthDay_Basics$MockMD",
"org.joda.time.base.BasePeriod",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.field.TestPreciseDateTimeField$MockCountingDurationField",
"org.joda.time.TestDuration_Basics$MockMutableDuration",
"org.joda.time.TimeOfDay",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.Partial$Property",
"org.joda.time.chrono.CopticChronology",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.TestInstant_Basics$MockInstant",
"org.joda.time.DateTimeUtils$FixedMillisProvider",
"org.joda.time.ReadableDuration",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.convert.ToString",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.DurationField",
"org.joda.convert.FromString",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneName",
"org.joda.time.chrono.IslamicChronology$LeapYearPatternType",
"org.joda.time.DateTime",
"org.joda.time.field.DelegatedDurationField",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.ReadWritableDateTime",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.Instant",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.TestDateTimeZone",
"org.joda.time.TestBaseSingleFieldPeriod$Single",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.TestMutableDateTime_Basics",
"org.joda.time.chrono.BuddhistChronology",
"org.joda.time.TestLocalTime_Basics$MockInstant",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.field.TestPreciseDurationDateTimeField$MockZeroDurationField",
"org.joda.time.DateTimeUtils$MillisProvider",
"org.joda.time.DateTimeUtils$OffsetMillisProvider",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.Seconds",
"org.joda.time.TestDateTime_Basics",
"org.joda.time.TestTimeOfDay_Basics$MockInstant",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.JodaTimePermission",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.DateTimeFieldType",
"org.joda.time.convert.MockBadChronology",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.format.DateTimeFormatterBuilder$FixedNumber",
"org.joda.time.MutableDateTime$Property",
"org.joda.time.TestMutablePeriod_Basics$MockMutablePeriod",
"org.joda.time.TestAbstractPartial$MockProperty0Chrono",
"org.joda.time.ReadableInterval",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.field.TestBaseDateTimeField$MockBaseDateTimeField",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.TestTimeOfDay_Basics",
"org.joda.time.TestAbstractPartial$MockPartial",
"org.joda.time.field.TestBaseDateTimeField$MockCountingDurationField",
"org.joda.time.TestMutableInterval_Constructors",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.chrono.EthiopicChronology",
"org.joda.time.PeriodType",
"org.joda.time.field.MillisDurationField",
"org.joda.time.MockNullZoneChronology",
"org.joda.time.chrono.GJChronology",
"org.joda.time.TestYearMonthDay_Basics$MockInstant",
"org.joda.time.chrono.IslamicChronology",
"org.joda.time.format.DateTimeFormatterBuilder$TextField",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.chrono.BasicFixedMonthChronology",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.TestAbstractPartial$MockProperty0Val",
"org.joda.time.TestMutableDateTime_Basics$MockInstant",
"org.joda.time.MonthDay",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.MutablePeriod",
"org.joda.time.TestInterval_Constructors$MockInterval",
"org.joda.time.MutableDateTime",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.TestBaseSingleFieldPeriod",
"org.joda.time.ReadableDateTime",
"org.joda.time.TestLocalTime_Basics",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.field.TestPreciseDateTimeField$MockStandardDateTimeField",
"org.joda.time.format.PeriodParser",
"org.joda.time.format.PeriodFormatterBuilder$PluralAffix",
"org.joda.time.TestInterval_Basics",
"org.joda.time.DateMidnight",
"org.joda.time.TestYearMonth_Basics$MockYM",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.format.DateTimeParserBucket$SavedState",
"org.joda.time.TestYearMonth_Basics",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.Days",
"org.joda.time.field.TestPreciseDurationDateTimeField$MockImpreciseDurationField",
"org.joda.time.field.TestPreciseDateTimeField",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.TestDuration_Basics",
"org.joda.time.field.TestPreciseDateTimeField$MockImpreciseDurationField",
"org.joda.time.YearMonth$Property",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.tz.UTCProvider",
"org.joda.time.ReadableInstant",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.TestDateTime_Basics$MockInstant",
"org.joda.time.TestLocalDate_Basics",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.tz.Provider",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.field.TestBaseDateTimeField$MockPartial",
"org.joda.time.DurationFieldType",
"org.joda.time.ReadWritableInstant",
"org.joda.time.MutableInterval",
"org.joda.time.tz.NameProvider",
"org.joda.time.TestLocalDateTime_Basics",
"org.joda.time.TestMutableInterval_Basics$MockInterval",
"org.joda.time.TestBasePartial",
"org.joda.time.field.TestOffsetDateTimeField$MockOffsetDateTimeField",
"org.joda.time.TestAbstractPartial",
"org.joda.time.TestYearMonthDay_Basics",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.TestInterval_Constructors",
"org.joda.time.chrono.StrictChronology",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.DateTimeZone$1",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.Period",
"org.joda.time.Weeks",
"org.joda.time.Chronology",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.field.TestPreciseDateTimeField$MockZeroDurationField",
"org.joda.time.format.PeriodFormatterBuilder$PeriodFieldAffix",
"org.joda.time.TestPeriod_Basics$MockPeriod",
"org.joda.time.TestInterval_Basics$MockInterval",
"org.joda.time.LocalDate",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.MockPartial",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.MonthDay$Property",
"org.joda.time.TestLocalDate_Basics$MockInstant",
"org.joda.time.ReadablePartial",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.field.BaseDurationField",
"org.joda.time.TestDuration_Basics$MockDuration"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("org.joda.time.format.DateTimeParser", false, DateTimeFormatter_ESTest_scaffolding.class.getClassLoader()));
mock(Class.forName("org.joda.time.format.DateTimePrinter", false, DateTimeFormatter_ESTest_scaffolding.class.getClassLoader()));
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
6797026933cae29236709f5b95f1a745ce9ef4bd | 34fb95b16ccefbde3a1899334ba5815a8f7c8383 | /mwfj_Servlet_06/work/org/apache/jsp/index_jsp.java | 1dcf952955a0294c91320df7ed8760f6e2fc4bc5 | [] | no_license | mwfj/Java_Basic_Practice | 80b7fce6e2f164494e3811dc3a9ae7ffda1acbce | 6067e2703cd8693d081bdcf666728640586f6abf | refs/heads/master | 2021-03-31T03:42:01.873622 | 2021-01-18T20:40:37 | 2021-01-18T20:40:37 | 248,072,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,481 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.42
* Generated at: 2015-06-15 08:14:38 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fif_0026_005ftest;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fredirect_0026_005furl_005fnobody;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fc_005fredirect_0026_005furl_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.release();
_005fjspx_005ftagPool_005fc_005fredirect_0026_005furl_005fnobody.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
if (_jspx_meth_c_005fif_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
out.write("<title>Index</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t<center>\r\n");
out.write("\t\t<h3>Hello, ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.user.loginName}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write(", welcome.</h3>\r\n");
out.write("\t\t\r\n");
out.write("\t\t<a href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("/logout.action\">安全退出</a>\r\n");
out.write("\t</center>\r\n");
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_005fif_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:if
org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
_jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fif_005f0.setParent(null);
// /index.jsp(6,0) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fif_005f0.setTest(((java.lang.Boolean) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.user == null}", java.lang.Boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)).booleanValue());
int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag();
if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write('\r');
out.write('\n');
out.write(' ');
if (_jspx_meth_c_005fredirect_005f0(_jspx_th_c_005fif_005f0, _jspx_page_context))
return true;
out.write('\r');
out.write('\n');
int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
return true;
}
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
return false;
}
private boolean _jspx_meth_c_005fredirect_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:redirect
org.apache.taglibs.standard.tag.rt.core.RedirectTag _jspx_th_c_005fredirect_005f0 = (org.apache.taglibs.standard.tag.rt.core.RedirectTag) _005fjspx_005ftagPool_005fc_005fredirect_0026_005furl_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.RedirectTag.class);
_jspx_th_c_005fredirect_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fredirect_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f0);
// /index.jsp(7,1) name = url type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fredirect_005f0.setUrl("login.jsp");
int _jspx_eval_c_005fredirect_005f0 = _jspx_th_c_005fredirect_005f0.doStartTag();
if (_jspx_th_c_005fredirect_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fredirect_0026_005furl_005fnobody.reuse(_jspx_th_c_005fredirect_005f0);
return true;
}
_005fjspx_005ftagPool_005fc_005fredirect_0026_005furl_005fnobody.reuse(_jspx_th_c_005fredirect_005f0);
return false;
}
}
| [
"wufangm@clemson.edu"
] | wufangm@clemson.edu |
260fe625cc1178cf97e174f592a51e8e40c4752e | 6bcf80c59fb576d03bd88799a8ba8dc5fc2faf61 | /src/main/java/road/Road.java | b58f922bae2a6088c5be58027a43485b6bc1dd3e | [] | no_license | cllorca1/svg | 7f92ac2864af5aba0a03ed43cca2933e36b231c4 | 269eab29c4b934f084a58819ab587110aa43ce4c | refs/heads/master | 2020-04-28T19:16:36.146827 | 2019-11-28T22:43:06 | 2019-11-28T22:43:06 | 175,506,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package road;
import java.util.HashMap;
import java.util.Map;
public class Road {
final int lanes;
final double laneWidth;
final Map<Integer, RoadElement> elements;
public Road(int lanes, double laneWidth) {
this.lanes = lanes;
this.laneWidth = laneWidth;
this.elements = new HashMap<>();
}
public int getLanes() {
return lanes;
}
public Map<Integer, RoadElement> getElements() {
return elements;
}
}
| [
"carlos.llorca@tum.de"
] | carlos.llorca@tum.de |
8d39ec7051de1f2eaf55ad60783082c5a996c2e2 | 098e177a23ef88b3c5cd5d9989e4ff49df781065 | /spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexResolver.java | 6f3deca745b8b5c6eab63309db30e508a4fd2c1e | [] | no_license | goodfriend2ks/star | c5b8cade7d34ba7e6799142bf8a701027e2d6aa3 | 420df91e3f7a8a108ccf8fb039c30dfad4704e3b | refs/heads/master | 2020-04-01T16:51:06.077235 | 2014-09-14T13:33:42 | 2014-09-14T13:33:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,199 | java | /*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.mongodb.core.index;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.persistence.Table;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.domain.Sort;
import org.springframework.data.mapping.PropertyHandler;
import org.springframework.data.mongodb.core.index.Index.Duplicates;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import com.mongodb.BasicDBObject;
import com.mongodb.BasicDBObjectBuilder;
import com.mongodb.DBObject;
import com.mongodb.util.JSON;
/**
* {@link IndexResolver} implementation inspecting {@link MongoPersistentEntity} for {@link MongoPersistentEntity} to be
* indexed. <br />
* All {@link MongoPersistentProperty} of the {@link MongoPersistentEntity} are inspected for potential indexes by
* scanning related annotations.
*
* @author Christoph Strobl
* @since 1.5
*/
public class MongoPersistentEntityIndexResolver implements IndexResolver {
private static final Logger LOGGER = LoggerFactory.getLogger(MongoPersistentEntityIndexResolver.class);
private final MongoMappingContext mappingContext;
/**
* Create new {@link MongoPersistentEntityIndexResolver}.
*
* @param mappingContext must not be {@literal null}.
*/
public MongoPersistentEntityIndexResolver(MongoMappingContext mappingContext) {
Assert.notNull(mappingContext, "Mapping context must not be null in order to resolve index definitions");
this.mappingContext = mappingContext;
}
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.index.IndexResolver#resolveIndexForClass(java.lang.Class)
*/
@Override
public List<IndexDefinitionHolder> resolveIndexForClass(Class<?> type) {
return resolveIndexForEntity(mappingContext.getPersistentEntity(type));
}
/**
* Resolve the {@link IndexDefinition}s for given {@literal root} entity by traversing {@link MongoPersistentProperty}
* scanning for index annotations {@link Indexed}, {@link CompoundIndex} and {@link GeospatialIndex}. The given
* {@literal root} has therefore to be annotated with {@link Table}.
*
* @param root must not be null.
* @return List of {@link IndexDefinitionHolder}. Will never be {@code null}.
* @throws IllegalArgumentException in case of missing {@link Table} annotation marking root entities.
*/
public List<IndexDefinitionHolder> resolveIndexForEntity(final MongoPersistentEntity<?> root) {
// Assert.notNull(root, "Index cannot be resolved for given 'null' entity.");
// Table table = root.findAnnotation(Table.class);
// Assert.notNull(table, "Given entity is not collection root.");
final List<IndexDefinitionHolder> indexInformation = new ArrayList<MongoPersistentEntityIndexResolver.IndexDefinitionHolder>();
indexInformation.addAll(potentiallyCreateCompoundIndexDefinitions("", root.getCollection(), root.getType()));
final CycleGuard guard = new CycleGuard();
root.doWithProperties(new PropertyHandler<MongoPersistentProperty>() {
@Override
public void doWithPersistentProperty(MongoPersistentProperty persistentProperty) {
try {
if (persistentProperty.isEntity()) {
indexInformation.addAll(resolveIndexForClass(persistentProperty.getActualType(),
persistentProperty.getFieldName(), root.getCollection(), guard));
}
IndexDefinitionHolder indexDefinitionHolder = createIndexDefinitionHolderForProperty(
persistentProperty.getFieldName(), root.getCollection(), persistentProperty);
if (indexDefinitionHolder != null) {
indexInformation.add(indexDefinitionHolder);
}
} catch (CyclicPropertyReferenceException e) {
LOGGER.warn(e.getMessage());
}
}
});
return indexInformation;
}
/**
* Recursively resolve and inspect properties of given {@literal type} for indexes to be created.
*
* @param type
* @param path The {@literal "dot} path.
* @param collection
* @return List of {@link IndexDefinitionHolder} representing indexes for given type and its referenced property
* types. Will never be {@code null}.
*/
private List<IndexDefinitionHolder> resolveIndexForClass(final Class<?> type, final String path,
final String collection, final CycleGuard guard) {
final List<IndexDefinitionHolder> indexInformation = new ArrayList<MongoPersistentEntityIndexResolver.IndexDefinitionHolder>();
indexInformation.addAll(potentiallyCreateCompoundIndexDefinitions(path, collection, type));
MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(type);
entity.doWithProperties(new PropertyHandler<MongoPersistentProperty>() {
@Override
public void doWithPersistentProperty(MongoPersistentProperty persistentProperty) {
String propertyDotPath = (StringUtils.hasText(path) ? path + "." : "") + persistentProperty.getFieldName();
guard.protect(persistentProperty, path);
if (persistentProperty.isEntity()) {
try {
indexInformation.addAll(resolveIndexForClass(persistentProperty.getActualType(), propertyDotPath,
collection, guard));
} catch (CyclicPropertyReferenceException e) {
LOGGER.warn(e.getMessage());
}
}
IndexDefinitionHolder indexDefinitionHolder = createIndexDefinitionHolderForProperty(propertyDotPath,
collection, persistentProperty);
if (indexDefinitionHolder != null) {
indexInformation.add(indexDefinitionHolder);
}
}
});
return indexInformation;
}
private IndexDefinitionHolder createIndexDefinitionHolderForProperty(String dotPath, String collection,
MongoPersistentProperty persistentProperty) {
if (persistentProperty.isAnnotationPresent(javax.persistence.Index.class)) {
return createIndexDefinition(dotPath, collection, persistentProperty);
} else if (persistentProperty.isAnnotationPresent(GeoSpatialIndexed.class)) {
return createGeoSpatialIndexDefinition(dotPath, collection, persistentProperty);
}
return null;
}
private List<IndexDefinitionHolder> potentiallyCreateCompoundIndexDefinitions(String dotPath, String collection,
Class<?> type) {
if (AnnotationUtils.findAnnotation(type, CompoundIndexes.class) == null
&& AnnotationUtils.findAnnotation(type, CompoundIndex.class) == null) {
return Collections.emptyList();
}
return createCompoundIndexDefinitions(dotPath, collection, type);
}
/**
* Create {@link IndexDefinition} wrapped in {@link IndexDefinitionHolder} for {@link CompoundIndexes} of given type.
*
* @param dotPath The properties {@literal "dot"} path representation from its document root.
* @param fallbackCollection
* @param type
* @return
*/
protected List<IndexDefinitionHolder> createCompoundIndexDefinitions(String dotPath, String fallbackCollection,
Class<?> type) {
List<IndexDefinitionHolder> indexDefinitions = new ArrayList<MongoPersistentEntityIndexResolver.IndexDefinitionHolder>();
CompoundIndexes indexes = AnnotationUtils.findAnnotation(type, CompoundIndexes.class);
if (indexes != null) {
for (CompoundIndex index : indexes.value()) {
indexDefinitions.add(createCompoundIndexDefinition(dotPath, fallbackCollection, index));
}
}
CompoundIndex index = AnnotationUtils.findAnnotation(type, CompoundIndex.class);
if (index != null) {
indexDefinitions.add(createCompoundIndexDefinition(dotPath, fallbackCollection, index));
}
return indexDefinitions;
}
@SuppressWarnings("deprecation")
protected IndexDefinitionHolder createCompoundIndexDefinition(String dotPath, String fallbackCollection,
CompoundIndex index) {
CompoundIndexDefinition indexDefinition = new CompoundIndexDefinition(resolveCompoundIndexKeyFromStringDefinition(
dotPath, index.def()));
if (!index.useGeneratedName()) {
indexDefinition.named(index.name());
}
if (index.unique()) {
indexDefinition.unique(index.dropDups() ? Duplicates.DROP : Duplicates.RETAIN);
}
if (index.sparse()) {
indexDefinition.sparse();
}
if (index.background()) {
indexDefinition.background();
}
int ttl = index.expireAfterSeconds();
if (ttl >= 0) {
if (indexDefinition.getIndexKeys().keySet().size() > 1) {
LOGGER.warn("TTL is not supported for compound index with more than one key. TTL={} will be ignored.", ttl);
} else {
indexDefinition.expire(ttl, TimeUnit.SECONDS);
}
}
String collection = StringUtils.hasText(index.collection()) ? index.collection() : fallbackCollection;
return new IndexDefinitionHolder(dotPath, indexDefinition, collection);
}
private DBObject resolveCompoundIndexKeyFromStringDefinition(String dotPath, String keyDefinitionString) {
if (!StringUtils.hasText(dotPath) && !StringUtils.hasText(keyDefinitionString)) {
throw new InvalidDataAccessApiUsageException("Cannot create index on root level for empty keys.");
}
if (!StringUtils.hasText(keyDefinitionString)) {
return new BasicDBObject(dotPath, 1);
}
DBObject dbo = (DBObject) JSON.parse(keyDefinitionString);
if (!StringUtils.hasText(dotPath)) {
return dbo;
}
BasicDBObjectBuilder dboBuilder = new BasicDBObjectBuilder();
for (String key : dbo.keySet()) {
dboBuilder.add(dotPath + "." + key, dbo.get(key));
}
return dboBuilder.get();
}
/**
* Creates {@link IndexDefinition} wrapped in {@link IndexDefinitionHolder} out of {@link Indexed} for given
* {@link MongoPersistentProperty}.
*
* @param dotPath The properties {@literal "dot"} path representation from its document root.
* @param collection
* @param persitentProperty
* @return
*/
protected IndexDefinitionHolder createIndexDefinition(String dotPath, String fallbackCollection,
MongoPersistentProperty persitentProperty) {
javax.persistence.Index index = persitentProperty.findAnnotation(javax.persistence.Index.class);
String collection = StringUtils.hasText(index.schema()) ? index.schema() : fallbackCollection;
Index indexDefinition = new Index().on(dotPath,
IndexDirection.ASCENDING.equals(index.direction()) ? Sort.Direction.ASC : Sort.Direction.DESC);
if (!index.useGeneratedName()) {
indexDefinition.named(StringUtils.hasText(index.name()) ? index.name() : dotPath);
}
if (index.unique()) {
indexDefinition.unique(index.dropDups() ? Duplicates.DROP : Duplicates.RETAIN);
}
if (index.sparse()) {
indexDefinition.sparse();
}
if (index.background()) {
indexDefinition.background();
}
if (index.expireAfterSeconds() >= 0) {
indexDefinition.expire(index.expireAfterSeconds(), TimeUnit.SECONDS);
}
return new IndexDefinitionHolder(dotPath, indexDefinition, collection);
}
/**
* Creates {@link IndexDefinition} wrapped in {@link IndexDefinitionHolder} out of {@link GeoSpatialIndexed} for
* {@link MongoPersistentProperty}.
*
* @param dotPath The properties {@literal "dot"} path representation from its document root.
* @param collection
* @param persistentProperty
* @return
*/
protected IndexDefinitionHolder createGeoSpatialIndexDefinition(String dotPath, String fallbackCollection,
MongoPersistentProperty persistentProperty) {
GeoSpatialIndexed index = persistentProperty.findAnnotation(GeoSpatialIndexed.class);
String collection = StringUtils.hasText(index.collection()) ? index.collection() : fallbackCollection;
GeospatialIndex indexDefinition = new GeospatialIndex(dotPath);
indexDefinition.withBits(index.bits());
indexDefinition.withMin(index.min()).withMax(index.max());
if (!index.useGeneratedName()) {
indexDefinition.named(StringUtils.hasText(index.name()) ? index.name() : persistentProperty.getName());
}
indexDefinition.typed(index.type()).withBucketSize(index.bucketSize()).withAdditionalField(index.additionalField());
return new IndexDefinitionHolder(dotPath, indexDefinition, collection);
}
/**
* {@link CycleGuard} holds information about properties and the paths for accessing those. This information is used
* to detect potential cycles within the references.
*
* @author Christoph Strobl
*/
static class CycleGuard {
private final Map<String, List<Path>> propertyTypeMap;
CycleGuard() {
this.propertyTypeMap = new LinkedHashMap<String, List<Path>>();
}
/**
* @param property The property to inspect
* @param path The path under which the property can be reached.
* @throws CyclicPropertyReferenceException in case a potential cycle is detected.
* @see Path#cycles(MongoPersistentProperty, String)
*/
void protect(MongoPersistentProperty property, String path) throws CyclicPropertyReferenceException {
String propertyTypeKey = createMapKey(property);
if (propertyTypeMap.containsKey(propertyTypeKey)) {
List<Path> paths = propertyTypeMap.get(propertyTypeKey);
for (Path existingPath : paths) {
if (existingPath.cycles(property, path)) {
paths.add(new Path(property, path));
throw new CyclicPropertyReferenceException(property.getFieldName(), property.getOwner().getType(),
existingPath.getPath());
}
}
paths.add(new Path(property, path));
} else {
ArrayList<Path> paths = new ArrayList<Path>();
paths.add(new Path(property, path));
propertyTypeMap.put(propertyTypeKey, paths);
}
}
private String createMapKey(MongoPersistentProperty property) {
return property.getOwner().getType().getSimpleName() + ":" + property.getFieldName();
}
/**
* Path defines the property and its full path from the document root. <br />
* A {@link Path} with {@literal spring.data.mongodb} would be created for the property {@code Three.mongodb}.
*
* <pre>
* <code>
* @Document
* class One {
* Two spring;
* }
*
* class Two {
* Three data;
* }
*
* class Three {
* String mongodb;
* }
* </code>
* </pre>
*
* @author Christoph Strobl
*/
static class Path {
private final MongoPersistentProperty property;
private final String path;
Path(MongoPersistentProperty property, String path) {
this.property = property;
this.path = path;
}
public String getPath() {
return path;
}
/**
* Checks whether the given property is owned by the same entity and if it has been already visited by a subset of
* the current path. Given {@literal foo.bar.bar} cycles if {@literal foo.bar} has already been visited and
* {@code class Bar} contains a property of type {@code Bar}. The previously mentioned path would not cycle if
* {@code class Bar} contained a property of type {@code SomeEntity} named {@literal bar}.
*
* @param property
* @param path
* @return
*/
boolean cycles(MongoPersistentProperty property, String path) {
if (!property.getOwner().equals(this.property.getOwner())) {
return false;
}
return path.contains(this.path);
}
}
}
/**
* @author Christoph Strobl
* @since 1.5
*/
public static class CyclicPropertyReferenceException extends RuntimeException {
private static final long serialVersionUID = -3762979307658772277L;
private final String propertyName;
private final Class<?> type;
private final String dotPath;
public CyclicPropertyReferenceException(String propertyName, Class<?> type, String dotPath) {
this.propertyName = propertyName;
this.type = type;
this.dotPath = dotPath;
}
/*
* (non-Javadoc)
* @see java.lang.Throwable#getMessage()
*/
@Override
public String getMessage() {
return String.format("Found cycle for field '%s' in type '%s' for path '%s'", propertyName,
type != null ? type.getSimpleName() : "unknown", dotPath);
}
}
/**
* Implementation of {@link IndexDefinition} holding additional (property)path information used for creating the
* index. The path itself is the properties {@literal "dot"} path representation from its root document.
*
* @author Christoph Strobl
* @since 1.5
*/
public static class IndexDefinitionHolder implements IndexDefinition {
private final String path;
private final IndexDefinition indexDefinition;
private final String collection;
/**
* Create
*
* @param path
*/
public IndexDefinitionHolder(String path, IndexDefinition definition, String collection) {
this.path = path;
this.indexDefinition = definition;
this.collection = collection;
}
public String getCollection() {
return collection;
}
/**
* Get the {@literal "dot"} path used to create the index.
*
* @return
*/
public String getPath() {
return path;
}
/**
* Get the {@literal raw} {@link IndexDefinition}.
*
* @return
*/
public IndexDefinition getIndexDefinition() {
return indexDefinition;
}
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.index.IndexDefinition#getIndexKeys()
*/
@Override
public DBObject getIndexKeys() {
return indexDefinition.getIndexKeys();
}
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.index.IndexDefinition#getIndexOptions()
*/
@Override
public DBObject getIndexOptions() {
return indexDefinition.getIndexOptions();
}
}
}
| [
"atoz.net@gmail.com"
] | atoz.net@gmail.com |
d999600743a19650e05ffee4bd3c502412a383a1 | b161650af919d20ccb88959209cdd52e3619384f | /hospitalcare/src/test/java/com/nuist/hospitalcare/service/CustomerServiceTest.java | 6f372042ef967e16bb4a6e46683c7d4290ce9302 | [] | no_license | Zee-He/HospitalCare | 7da6cdaf18a6db6ebee3ca7c46289f054ccfa9c7 | 8989c29364bc1a4c7d400bd36ef528635625f8c7 | refs/heads/master | 2022-12-29T15:48:39.721721 | 2020-09-29T05:32:22 | 2020-09-29T05:32:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,550 | java | package com.nuist.hospitalcare.service;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import com.nuist.hospitalcare.entity.Customer;
import lombok.extern.slf4j.Slf4j;
/**
* 客户信息服务类测试
*/
@SpringBootTest
@Slf4j
public class CustomerServiceTest {
@Autowired
private CustomerService customerService;
/**
* 测试分页查询所有
*/
@Test
public void test_findAll() {
List<Customer> customers = customerService.selectAllInPage(PageRequest.of(0, 5)).getContent();
System.out.println(customers);
assertEquals(customers.size(), 5);
log.info("测试通过");
}
/**
* 测试分页条件查询
*/
@Test
public void test_findByName() {
Page<Customer> customers = customerService.findByNameInPage("U7DPMAUVFDJS3", PageRequest.of(0, 5));
System.out.println(customers.getTotalPages());
System.out.println(customers.getNumber());
System.out.println(customers.getSize());
System.out.println(customers.getContent());
log.info("测试通过");
}
/**
* 测试非法插入
*/
@Test
public void test_errorInsert() {
boolean flag = customerService.insert(new Customer(1, "tt", 50, "男", "123123123412341234", "12312312345", "cesvs"));
assertEquals(flag, false);
log.info("测试通过");
}
}
| [
"BLGY2000@outlook.com"
] | BLGY2000@outlook.com |
3c0288efefcf2e0eee04d6be1fd70b221673b8d5 | 15c8de2cf6c9b757219b9da79aaf518d7bd48f14 | /src/main/java/loanapp/SpringBootWebRun.java | 81ed32e46732664a57f86aba8daf36b114ab0314 | [] | no_license | NazarMykhailechko/loanapp | a27e8cb028ca8a49e9679dc34df100577ec7cda1 | 0d6f1334879c835ca146d748c18d0517f06eb617 | refs/heads/master | 2023-08-01T12:30:25.485649 | 2021-09-22T11:48:36 | 2021-09-22T11:48:36 | 408,453,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package loanapp;
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.context.annotation.Configuration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
//implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory>
public class SpringBootWebRun {
public static void main(String[] args) {
SpringApplication.run(loanapp.SpringBootWebRun.class, args);
}
} | [
"mykhailechko@accordbank.com.ua"
] | mykhailechko@accordbank.com.ua |
80b2b41ffaf8df04a70a71a70884d8d75f5602a6 | 5182a3902f461cc27cac9bf04e581ec9dc7cdb7b | /src/main/java/org/test/ssl/sample1/Client.java | 4fd4468c4d2bad93c97f25c251aa72218dd8ad3b | [] | no_license | frankies/SslTest | dcb05753b2c6b9d0d2d805dc8940d09cf0cdd3d3 | 9c00af3fbf159501acf3eb51033ce2df849e419f | refs/heads/master | 2020-04-10T20:11:42.324119 | 2016-09-14T01:45:00 | 2016-09-14T01:45:00 | 68,093,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | /******************************************************************************/
/* SYSTEM : IM Step2 */
/* */
/* SUBSYSTEM : */
/******************************************************************************/
package org.test.ssl.sample1;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
//客户端也非常简单:向服务端发起请求,发送一个”hello”字串,然后获得服务端的返回。把服务端运行起来后,执行客户端,我们将得到”hello”的返回
public class Client {
public static void main(String[] args) throws Exception {
Socket s = new Socket("localhost", 8080);
PrintWriter writer = new PrintWriter(s.getOutputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
writer.println("hello");
writer.flush();
System.out.println(reader.readLine());
s.close();
}
} | [
"lin_zhanwang@ymsl.com.cn"
] | lin_zhanwang@ymsl.com.cn |
f1ec7727d967b1de0b1975f557fe439d7f0d59c0 | c6f8a9ae7ffc4e24c133fe8a695f0b9347922a80 | /src/com/ashok/friends/ankitSoni/EthanAndImpossibleMission.java | b5e6488855cdc95a2bf3094bd7ee32657d596834 | [] | no_license | AshokRajpurohit/karani | 6c7d42946a56bf6cd18dc83635d130d34d814e89 | 9c80302d7857f7ecc369f358b85e072650beb088 | refs/heads/master | 2021-08-22T05:36:28.909089 | 2021-06-28T12:39:49 | 2021-06-28T12:39:49 | 61,425,311 | 4 | 7 | null | null | null | null | UTF-8 | Java | false | false | 3,623 | java | /*
* Copyright (c) 2015, 2099, Ashok and/or its affiliates. All rights reserved.
* ASHOK PROPRIETARY/CONFIDENTIAL. Use is subject to license terms, But you are free to use it :).
*
*/
package com.ashok.friends.ankitSoni;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
/**
* Problem Name:
* Link:
*
* For full implementation please see {@link https://github.com/AshokRajpurohit/karani/tree/master/src/com/ashok/}
* @author Ashok Rajpurohit (ashok1113@gmail.com)
*/
public class EthanAndImpossibleMission {
private static PrintWriter out = new PrintWriter(System.out);
private static InputReader in = new InputReader();
private static long[] left, right;
private static int mod;
public static void main(String[] args) throws IOException {
solve();
in.close();
out.close();
}
private static void solve() throws IOException {
int n = in.readInt(), q = in.readInt();
mod = in.readInt();
int[] ar = in.readIntArray(n);
populate(ar);
StringBuilder sb = new StringBuilder(q << 3);
while (q > 0) {
q--;
sb.append(query(in.readInt() - 1)).append('\n');
}
out.print(sb);
}
private static long query(int index) {
return queryLeft(index - 1) * queryRight(index + 1) % mod;
}
private static void populate(int[] ar) {
left = new long[ar.length];
right = new long[ar.length];
left[0] = ar[0] % mod;
for (int i = 1; i < ar.length; i++)
left[i] = left[i - 1] * ar[i] % mod;
right[ar.length - 1] = ar[ar.length - 1] % mod;
for (int i = ar.length - 2; i >= 0; i--)
right[i] = right[i + 1] * ar[i] % mod;
}
private static long queryLeft(int index) {
if (index < 0)
return 1;
return left[index];
}
private static long queryRight(int index) {
if (index >= right.length)
return 1;
return right[index];
}
final static class InputReader {
InputStream in;
protected byte[] buffer = new byte[8192];
protected int offset = 0;
protected int bufferSize = 0;
public InputReader() {
in = System.in;
}
public void close() throws IOException {
in.close();
}
public int readInt() throws IOException {
int number = 0;
int s = 1;
if (offset == bufferSize) {
offset = 0;
bufferSize = in.read(buffer);
}
if (bufferSize == -1)
throw new IOException("No new bytes");
for (; buffer[offset] < 0x30 || buffer[offset] == '-'; ++offset) {
if (buffer[offset] == '-')
s = -1;
if (offset == bufferSize - 1) {
offset = -1;
bufferSize = in.read(buffer);
}
}
for (; offset < bufferSize && buffer[offset] > 0x2f; ++offset) {
number = (number << 3) + (number << 1) + buffer[offset] - 0x30;
if (offset == bufferSize - 1) {
offset = -1;
bufferSize = in.read(buffer);
}
}
++offset;
return number * s;
}
public int[] readIntArray(int n) throws IOException {
int[] ar = new int[n];
for (int i = 0; i < n; i++)
ar[i] = readInt();
return ar;
}
}
}
| [
"ashok1113@hotmail.com"
] | ashok1113@hotmail.com |
cf7c3491e2a40cee2bf40e82c3632f780aad6c5d | 86ed96d0ebfbaa400c5def63f9c81d10878de820 | /src/padcms/magazine/controls/imagecontroller/threadExecutor.java | 9ca8c547c09aaed4a4a4add32f4b8eaac784c0a1 | [] | no_license | aalishanmatrix/PadCMS-android | 1ef031bd5332ef085691c26fc28594dfa619ae30 | 50d120ad162ae6c82ee478b057672e487937dc20 | refs/heads/master | 2021-01-18T05:59:03.019744 | 2012-08-27T09:31:48 | 2012-08-27T09:31:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package padcms.magazine.controls.imagecontroller;
public class threadExecutor {
}
| [
"pavel.viktorovich@gmail.com"
] | pavel.viktorovich@gmail.com |
c4e1025075f5311ff3ba8127a22a7b48e8fefcc4 | 1c11144d26ba5199c86b29e1ad5adc60a8135838 | /src/main/java/dao/RatesDAO.java | f907986308d8b2f3db09076b77aa321e5bf378ed | [] | no_license | dmytro8909/DeliveryServiceIDEA | 10b33973dc6b96341a99fc04502b775c6a071068 | 3595fd0d7bce2ab0797fc166bc0db5d86e4b3519 | refs/heads/master | 2023-01-03T06:16:00.914080 | 2020-10-27T08:10:25 | 2020-10-27T08:10:25 | 303,342,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,738 | java | package dao;
import db.SQLConstants;
import entities.Order;
import entities.Rate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import static exception.Messages.*;
import java.math.BigDecimal;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import db.DBManager;
import static db.ConnectionPool.getConnection;
/**
* Class for realizing a part of DAO-pattern.
* Special for Rate entity.
*/
public class RatesDAO implements AbstractDAO<Rate>{
DBManager dbManager = new DBManager();
private static final Logger LOGGER = LogManager.getLogger(RatesDAO.class);
/**
* Method for getting list of all
* rates from the database.
* @return list of rates.
*/
@Override
public List<Rate> getAll() {
List<Rate> rates = new ArrayList<>();
ResultSet rs = null;
try (Connection connection = getConnection();
Statement stmt = connection.createStatement()) {
rs = stmt.executeQuery(SQLConstants.GET_ALL_RATES);
while (rs.next()) {
Rate rate = new Rate();
rate.setId(rs.getInt("rates_id"));
rate.setName(rs.getString("name"));
rate.setRate(rs.getBigDecimal("rate"));
rates.add(rate);
}
} catch (SQLException ex) {
LOGGER.error(ERR_CANNOT_GET_LIST_OF_RATES);
} finally {
dbManager.close(rs);
}
return rates;
}
/**
* Method for getting rate by id.
* @param id - rate's id.
* @return object of rate.
*/
@Override
public Rate get(int id) {
Rate rate = null;
ResultSet rs = null;
try (Connection connection = getConnection();
PreparedStatement pstmt =
connection.prepareStatement(SQLConstants.GET_RATE_BY_ID)) {
pstmt.setInt(1, id);
rs = pstmt.executeQuery();
if (rs.next()) {
rate = new Rate();
rate.setId(rs.getInt("rates_id"));
rate.setName(rs.getString("name"));
rate.setRate(rs.getBigDecimal("rate"));
}
} catch (SQLException ex) {
LOGGER.error(ERR_CANNOT_GET_RATE);
} finally {
dbManager.close(rs);
}
return rate;
}
/**
* Method for getting rate by name.
* @param name - rate's name.
* @return rate.
*/
public BigDecimal getRateByName(String name) {
ResultSet rs = null;
Rate rate = new Rate();
try (Connection connection = getConnection();
PreparedStatement pstmt =
connection.prepareStatement(SQLConstants.GET_RATE_BY_NAME)) {
pstmt.setString(1, name);
rs = pstmt.executeQuery();
if (rs.next()) {
rate.setId(rs.getInt("rates_id"));
rate.setName(rs.getString("name"));
rate.setRate(rs.getBigDecimal("rate"));
}
} catch (SQLException ex) {
LOGGER.error(ERR_CANNOT_GET_RATE);
} finally {
dbManager.close(rs);
}
return rate.getRate();
}
/**
* Method for deleting rate from the database.
* @param id - rate's id.
*/
@Override
public void delete(int id) {
try (Connection connection = getConnection();
PreparedStatement pstmt =
connection.prepareStatement(SQLConstants.GET_RATE_BY_ID)) {
pstmt.setInt(1, id);
pstmt.executeUpdate();
} catch (SQLException ex) {
LOGGER.error(ERR_CANNOT_DELETE_RATE, ex);
}
}
}
| [
"dmitriy8909@gmail.com"
] | dmitriy8909@gmail.com |
a68f5fa2496c9a1e64d881a776da091f7fb68390 | a5a2bd2b2a88a7aeabeea3381b0edbbeaa322b1a | /src/main/java/com/github/tristandupont/auction_center/controller/BiddingInfo.java | 54bfa90bd4209ac9e9c02e2a02a4663f366a683d | [] | no_license | tristandupont/auction_center | 90ce094d62e4d7b6421e089eb833b8cc6bd38d04 | 1836907fcb7676b435adb21c996b4131f49504d0 | refs/heads/master | 2022-12-29T13:27:36.994684 | 2020-10-18T19:46:08 | 2020-10-18T19:46:08 | 305,183,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.github.tristandupont.auction_center.controller;
import com.fasterxml.jackson.annotation.JsonProperty;
class BiddingInfo {
private final String userName;
private final long amount;
BiddingInfo(final String userName,
final long amount) {
this.userName = userName;
this.amount = amount;
}
@JsonProperty("userName")
String userName() {
return userName;
}
@JsonProperty("amount")
long amount() {
return amount;
}
}
| [
"tristan.dupont@gmail.com"
] | tristan.dupont@gmail.com |
16444909c0b8ea050de5c20853d29afcc806c90f | ddc3711a9d1113a38f13bae1694b851c9d29ecd5 | /app/src/test/java/com/example/simonecianni/myfirstapp/ExampleUnitTest.java | 6d980ab6ca6ea173278b6ed46ea9c87787b0d334 | [] | no_license | simocn77/MyFirstApp_windows | e3c90d07be647e380040af7d16a1e508070a23f3 | c0f2fb70eddb750a39adf57ae8f514ac346a7b3d | refs/heads/master | 2021-01-16T19:22:54.232074 | 2016-04-15T10:13:42 | 2016-04-15T10:13:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.example.simonecianni.myfirstapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"Simone Cianni"
] | Simone Cianni |
f573d765c7a171f24b1f80b0b39b46f4f7e3eb76 | c9dfd369a0b48dc6dbf9fb143ab002f5f6c14d80 | /src/main/java/java_exam/一般/quickSort3.java | 32597f661c34580ddc6d58cfe965190eb6c54cb1 | [] | no_license | hdc520/spark | 8991f67e1d30cb165f865f775d516ad5dd02280b | f6dda101b290f65d59ca2bf660ac96c3aadd383b | refs/heads/master | 2022-03-29T09:08:28.248443 | 2019-12-18T13:34:16 | 2019-12-18T13:34:16 | 199,359,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,145 | java | package java_exam.一般;
import java.util.Arrays;
public class quickSort3 {
public static void main(String[] args) {
int[] arr = {4,5,7,8,1,2,9,6,3};
quickSort(arr, 0, arr.length - 1);
System.out.println("排序结果:" + Arrays.toString(arr));
}
/**
* @param arr
* @param left 左指针
* @param right 右指针
*/
public static void quickSort(int[] arr, int left, int right) {
if (left < right) {
//获取枢纽值,并将其放在当前待处理序列末尾
dealPivot(arr, left, right);
System.out.println("排序结果:" + Arrays.toString(arr)+" left="+left+" right="+right);
//枢纽值被放在序列末尾
int pivot = right - 1;
//左指针
int low = left;
//右指针
int high = right - 1;
while (true) {
while (arr[++low] < arr[pivot]) {
}
while (low < high && arr[--high] > arr[pivot]) {
}
if (low< high) {
swap(arr, low, high);
} else {
break;
}
}
if (low < right) {
swap(arr,low, right - 1);
}
quickSort(arr, left, low - 1);
quickSort(arr, low + 1, right);
}
}
/**
* 处理枢纽值
*
* @param arr
* @param left
* @param right
*/
public static void dealPivot(int[] arr, int left, int right) {
int mid = (left + right) / 2;
if (arr[left] > arr[mid]) {
swap(arr, left, mid);
}
if (arr[left] > arr[right]) {
swap(arr, left, right);
}
if (arr[right] < arr[mid]) {
swap(arr, right, mid);
}
swap(arr, right - 1, mid);
}
/**
* 交换元素通用处理
* @param arr
* @param a
* @param b
*/
private static void swap(int[] arr, int a, int b) {
int temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
}
| [
"1712861889@qq.com"
] | 1712861889@qq.com |
83a39c15784b21d4482da54c0fe6896dcd7b173f | a140fe9b466ab3d00f662efe3dd912acbb342e2c | /securedfilemanager/src/main/java/com/csc/sfm/client/beans/WelcomeBean.java | fb7a031a0c7b40ede021d0b1cfd81afdecaf3d26 | [] | no_license | than-tryf/securedfilemanager | b5a6bb2e44c50a94e8edc9ba579fc2e8ea1c64a8 | 32cefbc4f05947baf29b2c36c127aaf4c3d80434 | refs/heads/master | 2021-01-10T03:00:43.082605 | 2012-01-05T23:30:10 | 2012-01-05T23:30:10 | 51,065,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.csc.sfm.client.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name="welcomeBean", eager=true)
@SessionScoped
public class WelcomeBean {
public WelcomeBean() {
System.out.println("WelcomeBean instantiated");
}
public String getMessage() {
return "I'm alive!";
}
}
| [
"jbuget@gmail.com"
] | jbuget@gmail.com |
7a59fc89474e231281f089727cd097b1edf5e101 | 244c36a6f2bf0db386b987d282157ff0ec5ab990 | /src/main/java/com/fh/controller/system/report/ReportController.java | f2fd699da75a7ac5239680e2322392b09102e39f | [] | no_license | javausermiss/hxzww | dd9d61bd3056babc441d0b1c84bb4a30d1a02931 | e6c95f0de81ec02cae0ab810503b25a899605d6f | refs/heads/master | 2020-04-16T17:15:54.693869 | 2019-02-21T04:14:46 | 2019-02-21T04:14:46 | 165,769,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,947 | java | package com.fh.controller.system.report;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.fh.controller.base.BaseController;
import com.fh.entity.Page;
import com.fh.service.system.ordertest.impl.OrderService;
import com.fh.service.system.payment.PaymentManager;
import com.fh.util.DateUtil;
import com.fh.util.Jurisdiction;
import com.fh.util.PageData;
/**
* 类名称:报表
* 创建人:FH Q313596790
* 修改时间:2014年11月17日
* @version
*/
@Controller
@RequestMapping(value="/report")
public class ReportController extends BaseController {
@Resource(name="paymentService")
private PaymentManager paymentService;
@Resource(name="orderService")
private OrderService orderService;
/**显示APP_USER 充值统计
* @param page
* @return
*/
@RequestMapping(value="/rechargeCount")
public ModelAndView rechargeCount(HttpServletRequest request){
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
try{
pd = this.getPageData();
mv.setViewName("system/report/recharge_count");
if(pd.get("lastStart") ==null || "".equals(pd.get("lastStart"))){
pd.put("lastStart", DateUtil.getCalendarByMonths(-1)); //获取当前日期的字符
}
if(pd.get("lastEnd") ==null || "".equals(pd.get("lastEnd"))){
pd.put("lastEnd", DateUtil.getDay()); //获取一个月之前的时间字符串
}
List<PageData> varlist=paymentService.getRechargeCount(pd);
mv.addObject("varlist", varlist);
mv.addObject("pd", pd);
mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
} catch(Exception e){
logger.error(e.toString(), e);
}
return mv;
}
/**显示APP_USER 单日留存用户
* @param page
* @return
*/
@RequestMapping(value="/remainCountByDate")
public ModelAndView remainCountByDate(HttpServletRequest request){
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
try{
pd = this.getPageData();
mv.setViewName("system/report/remain_count");
if(pd.get("lastStart") ==null || "".equals(pd.get("lastStart"))){
pd.put("lastStart", DateUtil.getCalendarByMonths(-1)); //获取当前日期的字符
}
if(pd.get("lastEnd") ==null || "".equals(pd.get("lastEnd"))){
pd.put("lastEnd", DateUtil.getDay()); //获取一个月之前的时间字符串
}
List<PageData> varlist=paymentService.getRemainCount(pd);
mv.addObject("varlist", varlist);
mv.addObject("pd", pd);
mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
} catch(Exception e){
logger.error(e.toString(), e);
}
return mv;
}
/**用户充值明细
* @param page
* @return
*/
@RequestMapping(value="/userRegDetailList")
public ModelAndView userRegDetailList(HttpServletRequest request,Page page){
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
try{
pd = this.getPageData();
mv.setViewName("system/report/user_reg_detail_list");
if(pd.get("lastStart") ==null || "".equals(pd.get("lastStart"))){
pd.put("lastStart", DateUtil.getCalendarByMonths(-1)); //获取当前日期的字符
}
if(pd.get("lastEnd") ==null || "".equals(pd.get("lastEnd"))){
pd.put("lastEnd", DateUtil.getDay()); //获取一个月之前的时间字符串
}
String keywords = pd.getString("keywords"); //关键词检索条件
if(null != keywords && !"".equals(keywords)){
pd.put("keywords", keywords.trim());
}
page.setPd(pd);
List<PageData> varlist=orderService.getUserRegDetailList(page);
mv.addObject("varlist", varlist);
mv.addObject("pd", pd);
mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
} catch(Exception e){
logger.error(e.toString(), e);
}
return mv;
}
}
| [
"zhuqiuyou_zqy@163.com"
] | zhuqiuyou_zqy@163.com |
dd8719277bb38cddf59048fbe3fa42a7b44588c6 | c22648590e51a0bb5be68a600d4b26e65174cbe5 | /src/main/java/comp110/Schedule.java | 7a1b79e1e79c3f27387b2a9ce961f0976a012ba7 | [] | no_license | comp110/web-scheduling | 637b118662d3d6661b6a53b62bc22172c3875e4b | cbc53714d5609d319493f6410edcab5d88fdad71 | refs/heads/master | 2021-01-12T12:22:20.562583 | 2016-12-11T21:38:48 | 2016-12-11T21:38:48 | 72,465,653 | 0 | 10 | null | 2016-11-16T20:26:35 | 2016-10-31T18:23:02 | JavaScript | UTF-8 | Java | false | false | 482 | java | package comp110;
public class Schedule {
private Staff _staff;
private Week _week;
public Schedule(Staff staff, Week week) {
_staff = staff;
_week = week;
}
public Staff getStaff() {
return _staff;
}
public Week getWeek() {
return _week;
}
public boolean equals(Schedule other) {
return _staff.equals(other._staff) && _week.equals(other._week);
}
public Schedule copy() {
return new Schedule(_staff.copy(), _week.copy());
}
}
| [
"ecwu@live.unc.edu"
] | ecwu@live.unc.edu |
cc123b43726ccf7f46ff47d57ad7212ff46270ad | d353433382fd6cc6f586e377701ba22eb3cbbb69 | /src/com/aseassignment/isbntools/ExternalISBNDataService.java | c46655da413377acff297eb6cc4f7db0915808b4 | [] | no_license | Ankita-P/TestDrivenDevelopment | 656902608f1bbeb25f2f277cdb7f9363f62e52f2 | ba690e652ee87e0631332a148af6208b39c028b8 | refs/heads/master | 2020-08-22T16:38:19.989665 | 2019-10-20T23:02:40 | 2019-10-20T23:02:40 | 216,438,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package com.aseassignment.isbntools;
public interface ExternalISBNDataService {
public Book lookup(String isbn);
}
| [
"ankita.patil9@gmail.com"
] | ankita.patil9@gmail.com |
94f035d7443fa952ecf274129ea2f35e01baf1bb | f8b755646b28a0e2c0740c5d5241bcae913ff832 | /api/src/main/java/org/hyperledger/connector/GRPCClient.java | 27bbaee5649f9f909d2d014afe4633e97425622e | [
"MIT",
"Apache-2.0"
] | permissive | bizdev1/fabric-api | b308b8cca5ea708d61498c4f511100cd21a5b5a2 | 17a3946b2fe6d8370195ef9bc35fe2e4ba1b3b37 | refs/heads/master | 2021-01-22T15:50:44.412592 | 2016-05-06T16:58:36 | 2016-05-06T16:58:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,798 | java | /**
* 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.hyperledger.connector;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import io.grpc.ManagedChannel;
import io.grpc.netty.NegotiationType;
import io.grpc.netty.NettyChannelBuilder;
import org.hyperledger.api.*;
import org.hyperledger.common.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import protos.Chaincode;
import protos.Chaincode.ChaincodeID;
import protos.Chaincode.ChaincodeInput;
import protos.Chaincode.ChaincodeInvocationSpec;
import protos.Chaincode.ChaincodeSpec;
import protos.DevopsGrpc;
import protos.DevopsGrpc.DevopsBlockingStub;
import protos.Openchain;
import protos.OpenchainGrpc;
import protos.OpenchainGrpc.OpenchainBlockingStub;
import protos.Api.BlockCount;
import javax.xml.bind.DatatypeConverter;
public class GRPCClient implements BCSAPI {
private static final Logger log = LoggerFactory.getLogger(GRPCClient.class);
final String chaincodeName = "utxo";
private DevopsBlockingStub dbs;
private OpenchainBlockingStub obs;
private final GRPCObserver observer;
public GRPCClient(String host, int port, int observerPort) {
log.debug("Trying to connect to GRPC host:port={}:{}, host:observerPort={}:{}, ", host, port, observerPort);
ManagedChannel channel = NettyChannelBuilder.forAddress(host, port).negotiationType(NegotiationType.PLAINTEXT).build();
ManagedChannel observerChannel = NettyChannelBuilder.forAddress(host, observerPort).negotiationType(NegotiationType.PLAINTEXT).build();
dbs = DevopsGrpc.newBlockingStub(channel);
obs = OpenchainGrpc.newBlockingStub(channel);
observer = new GRPCObserver(observerChannel);
observer.connect();
}
public void invoke(String chaincodeName, byte[] transaction) {
String encodedTransaction = Base64.getEncoder().encodeToString(transaction);
ChaincodeID.Builder chaincodeId = ChaincodeID.newBuilder();
chaincodeId.setName(chaincodeName);
ChaincodeInput.Builder chaincodeInput = ChaincodeInput.newBuilder();
chaincodeInput.setFunction("execute");
chaincodeInput.addArgs(encodedTransaction);
ChaincodeSpec.Builder chaincodeSpec = ChaincodeSpec.newBuilder();
chaincodeSpec.setChaincodeID(chaincodeId);
chaincodeSpec.setCtorMsg(chaincodeInput);
ChaincodeInvocationSpec.Builder chaincodeInvocationSpec = ChaincodeInvocationSpec.newBuilder();
chaincodeInvocationSpec.setChaincodeSpec(chaincodeSpec);
dbs.invoke(chaincodeInvocationSpec.build());
}
private ByteString query(String functionName, Iterable<String> args) {
Chaincode.ChaincodeID chainCodeId = Chaincode.ChaincodeID.newBuilder()
.setName("utxo")
.build();
Chaincode.ChaincodeInput chainCodeInput = Chaincode.ChaincodeInput.newBuilder()
.setFunction(functionName)
.addAllArgs(args)
.build();
Chaincode.ChaincodeSpec chaincodeSpec = Chaincode.ChaincodeSpec.newBuilder()
.setChaincodeID(chainCodeId)
.setCtorMsg(chainCodeInput)
.build();
Chaincode.ChaincodeInvocationSpec chaincodeInvocationSpec = Chaincode.ChaincodeInvocationSpec.newBuilder()
.setChaincodeSpec(chaincodeSpec)
.build();
Openchain.Response response = dbs.query(chaincodeInvocationSpec);
return response.getMsg();
}
@Override
public String getClientVersion() throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public String getServerVersion() throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public long ping(long nonce) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public void addAlertListener(AlertListener listener) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public void removeAlertListener(AlertListener listener) {
throw new UnsupportedOperationException();
}
@Override
public int getChainHeight() throws BCSAPIException {
BlockCount height = obs.getBlockCount(com.google.protobuf.Empty.getDefaultInstance());
return (int) height.getCount();
}
@Override
public APIBlockIdList getBlockIds(BID blockId, int count) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public APIHeader getBlockHeader(BID hash) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public APIBlock getBlock(BID hash) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public APITransaction getTransaction(TID hash) throws BCSAPIException {
try {
String hexedHash = ByteUtils.toHex(hash.toByteArray());
ByteString result = query("getTran", Collections.singletonList(hexedHash));
byte[] resultStr = result.toByteArray();
if (resultStr.length == 0) return null;
return new APITransaction(new WireFormatter().fromWire(resultStr), BID.INVALID);
} catch (IOException e) {
throw new BCSAPIException (e);
}
}
@Override
public List<APITransaction> getInputTransactions(TID txId) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public void sendTransaction(Transaction transaction) throws BCSAPIException {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
WireFormat.Writer w = new WireFormat.Writer(os);
new WireFormatter().toWire(transaction, w);
invoke(chaincodeName, os.toByteArray());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public void registerRejectListener(RejectListener rejectListener) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public void removeRejectListener(RejectListener rejectListener) {
throw new UnsupportedOperationException();
}
@Override
public APIHeader mine(Address address) throws BCSAPIException {
log.info("mine discarded for {}", address);
return null;
}
@Override
public void sendBlock(Block block) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public void registerTransactionListener(TransactionListener listener) throws BCSAPIException {
observer.subscribe(listener);
}
@Override
public void removeTransactionListener(TransactionListener listener) {
observer.unsubscribe(listener);
}
@Override
public void registerTrunkListener(TrunkListener listener) throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public void removeTrunkListener(TrunkListener listener) {
throw new UnsupportedOperationException();
}
@Override
public void scanTransactionsForAddresses(Set<Address> addresses, TransactionListener listener)
throws BCSAPIException {
throw new UnsupportedOperationException();
}
@Override
public void scanTransactions(MasterPublicKey master, int lookAhead, TransactionListener listener)
throws BCSAPIException {
// TODO we will need this
throw new UnsupportedOperationException();
}
@Override
public void catchUp(List<BID> inventory, int limit, boolean headers, TrunkListener listener)
throws BCSAPIException {
// TODO we will need this
throw new UnsupportedOperationException();
}
@Override
public void spendingTransactions(List<TID> tids, TransactionListener listener) throws BCSAPIException {
throw new UnsupportedOperationException();
}
}
| [
"tamas.blummer@digitalasset.com"
] | tamas.blummer@digitalasset.com |
639b25bd2cc4261d9ac9af4c11d49e424fb2bd80 | 0677b1de88d8699bbd5721aa36eacfc3597c4230 | /tx-components/tx-component-starter-report/src/main/java/com.tx.component/statistical/mybatismapping/StatisticalMapperAssistantRepository.java | b543ed829da87bd6d1e94cbdf8cf9f939af949c7 | [] | no_license | txteam/tx-parent | 06e100d1e19bb40e2d000701468b6e72cf8b6de4 | d408e33c3febbec48ebc582e2168c0783318e66f | refs/heads/master | 2022-09-13T01:53:29.979037 | 2021-01-13T02:31:56 | 2021-01-13T02:31:56 | 6,153,500 | 11 | 12 | null | 2022-09-01T22:34:20 | 2012-10-10T07:13:14 | Java | UTF-8 | Java | false | false | 3,832 | java | package com.tx.component.statistical.mybatismapping;
import com.tx.component.statistical.mapping.SqlMapperItem;
import com.tx.core.util.MessageUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.ibatis.session.Configuration;
import java.util.List;
import java.util.Map;
/**
* <br/>
*
* @author XRX
* @version [版本号, 2017/11/22]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class StatisticalMapperAssistantRepository {
public final String countSuffix = "Count";
public String statisticalSuffix = "Statistical";
private static String COUNT_SCRIPT_FORMATTER = "<script> SELECT COUNT(1) AS CNT FROM ({}) TB </script>";
private static String STATISTICAL_SCRIPT_FORMATTER = "<script> SELECT ${statisticalColumn} FROM ( \n {} " +
" <if test=\"@com.tx.core.util.OgnlUtils@isNotEmpty(limitStart)\"> \n" +
" <![CDATA[ LIMIT #{limitStart} , #{limitSize} ]]> \n" +
" </if> \n" +
" ) TB </script>";
private static final String SCRIPT_FORMATTER = "<script>{}</script>";
private Configuration configuration;
private Map<String, StatisticalMapperAssistant> assistantMap = new HashedMap();
public StatisticalMapperAssistantRepository(Configuration configuration) {
this.configuration = configuration;
}
public StatisticalMapperAssistant doBuilderAssistant(String namespace) {
StatisticalMapperAssistant statisticalMapperAssistant = new StatisticalMapperAssistant(configuration, namespace);
return statisticalMapperAssistant;
}
public void assistant(List<SqlMapperItem> srSqlItems) {
for (SqlMapperItem temp : srSqlItems) {
assistant(temp);
}
}
public StatisticalMapperAssistant assistant(SqlMapperItem srSqlItem) {
String namespace = srSqlItem.getNamespace();
StatisticalMapperAssistant assistant = assistantMap.get(namespace);
if (assistant == null) {
assistant = doBuilderAssistant(namespace);
assistantMap.put(namespace, assistant);
}
synchronized (assistantMap) {
assistant = doBuilderAssistant(namespace);
assistant.publishMapperStatement(srSqlItem.getSqlCommandType(),
srSqlItem.getId(),
srSqlItem.getSqlScript(),
srSqlItem.getParameterType(),
srSqlItem.getReturnType());
if (srSqlItem.isNeedStatisticalScript()) {
String countSql = MessageUtils.format(COUNT_SCRIPT_FORMATTER, srSqlItem.getSqlScript());
assistant.publishMapperStatement(srSqlItem.getSqlCommandType(),
srSqlItem.getId() + "Count",
countSql,
srSqlItem.getParameterType(),
Integer.class);
String statistical = MessageUtils.format(STATISTICAL_SCRIPT_FORMATTER, srSqlItem.getSqlScript());
assistant.publishMapperStatement(srSqlItem.getSqlCommandType(),
srSqlItem.getId() + "Statistical",
statistical,
srSqlItem.getParameterType(),
srSqlItem.getReturnType());
}
assistantMap.put(namespace, assistant);
}
return assistant;
}
public Configuration getConfiguration() {
return configuration;
}
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
public Map<String, StatisticalMapperAssistant> getAssistantMap() {
return assistantMap;
}
public void setAssistantMap(Map<String, StatisticalMapperAssistant> assistantMap) {
this.assistantMap = assistantMap;
}
}
| [
"Administrator@USER-20150902AZ"
] | Administrator@USER-20150902AZ |
f65dfcd686a2c362e1395c1c8bf7bc82d321550e | 278a38e8dcb03cdb24ef158769dc59693a8c6e72 | /wave/src/main/java/org/swellrt/beta/client/GroupsFrontend.java | 28fb5c77d87ebcfbb7bcf5b7d77a9f3658a07b2e | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-generic-export-compliance"
] | permissive | SwellRT/swellrt | b592f6486bd18cd54cc0b12563ad440399eec861 | 0b33f6d7fa933f2e180dc80d2beb6f6f2ff6eb54 | refs/heads/master | 2021-11-24T08:53:29.924111 | 2018-12-25T19:53:28 | 2018-12-25T19:53:28 | 15,933,766 | 89 | 11 | Apache-2.0 | 2021-11-12T01:36:54 | 2014-01-15T11:52:21 | Java | UTF-8 | Java | false | false | 1,286 | java | package org.swellrt.beta.client;
import org.swellrt.beta.client.ServiceFrontend.AsyncResponse;
import org.swellrt.beta.common.SException;
import org.waveprotocol.wave.model.account.group.Group;
import org.waveprotocol.wave.model.account.group.ReadableGroup;
import org.waveprotocol.wave.model.wave.ParticipantId;
import jsinterop.annotations.JsType;
@JsType(namespace = "swell", name = "GroupsFrontend")
public interface GroupsFrontend {
/**
* Open a group to perform live updates. Returns null if it doesn't exist.
* Throw exception if participant doesn't have enough permissions.
*
* @throws SException
*/
void open(ParticipantId groupId, AsyncResponse<Group> callback) throws SException;
/**
* Create a group. Returns null if it already exists.
*/
void create(ParticipantId groupId, AsyncResponse<Group> callback) throws SException;
/**
* Query groups of the current participant
*/
void get(AsyncResponse<ReadableGroup[]> groupIds) throws SException;
/**
* Delete a group if current participant has enough permissions.
* <p>
* This operation must ensure that group id is removed from all
* objects/wavelets where it is a participant.
*
* @param groupId
*/
void delete(ParticipantId groupId) throws SException;
}
| [
"pablojan@gmail.com"
] | pablojan@gmail.com |
6ebe1f7d1a838a2267369336ce17d17d69528659 | 12fba6710530b95732324be4320e56b9a56a0539 | /src/com/company/Rooms.java | 2e4ec1b47618c1d5abf92702b2bf1825b3e7df3b | [] | no_license | gsmithwasalreadytaken/gsmithfwissehFinalProject | 9eaaa4e1803fbdbd41f8f94c31489c9b553ee8dd | cc5b7f9f41d3cc112f6a5cd569511ad067e43ba5 | refs/heads/master | 2021-08-30T05:24:08.688894 | 2017-12-16T06:17:23 | 2017-12-16T06:17:23 | 114,438,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,659 | java | package com.company;
import java.util.*;
public class Rooms extends GamePiece {
HashMap<String,Rooms> connected_rooms= new HashMap<String,Rooms>();
HashMap<String,Weapons> contained_weapons= new HashMap<String,Weapons>();
HashMap<String,Player> contained_players=new HashMap<String,Player>();
public Rooms(String name, Boolean isbad)
{
super(name.toLowerCase(),isbad);
}
public void addonewaypath(Rooms room)
{
connected_rooms.put(room.getName(),room);
}
public void adddoublePath(Rooms room)
{
connected_rooms.put(room.getName(),room);
room.addonewaypath(this);
}
public void place_player(Player player)
{
contained_players.put(player.getName(),player);
}
public void remove_player(Player player)
{
contained_players.remove(player.getName());
}
public void place_weapon(Weapons weapon)
{
contained_weapons.put(weapon.getName(),weapon);
}
public Set<String> get_contained_weapons_string()
{
return contained_weapons.keySet();
}
public Set<String> get_connected_rooms_string()
{
return connected_rooms.keySet();
}
public Set<String> get_contained_players_string()
{
return contained_players.keySet();
}
public HashMap<String,Rooms> get_connected_rooms() {
return connected_rooms;
}
public HashMap<String,Player> get_contained_players() {
return contained_players;
}
public HashMap<String,Weapons> get_contained_weapons() {
return contained_weapons;
}
}
| [
"smith9327@yahoo.com"
] | smith9327@yahoo.com |
0bc08aa0b5d20297739b8714736994db97ea75a7 | e7e7b6050a5e5bbc8e2a75aa9ee33cd2890dc9eb | /src/main/java/fun/lula/flomo/model/entity/Memo.java | 2eed297585be52e89e208d70a0cf738e804ea638 | [] | no_license | devourbots/note-api | 135ded5889c0030ff02009e91083a3d66fcf159a | 83a8175bf85618c681033289bb23f9e807729cf1 | refs/heads/master | 2023-06-13T03:49:37.490921 | 2021-07-08T06:37:20 | 2021-07-08T06:37:20 | 384,022,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package fun.lula.flomo.model.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import java.util.List;
@Data
@TableName(value = "memo")
@ToString
public class Memo {
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String content;
private String parentId;
private String device;
private String createTime;
private String userId;
@TableField(exist = false)
private List<MemoFiles> files;
}
| [
"lula@Yujies-MacBook-Air.local"
] | lula@Yujies-MacBook-Air.local |
98cb6425092b483f19ca99c673f7f9fbb3052e0a | c68aa3b6e30b2219f3365c14db8757d389aa9242 | /src/main/java/TemplateCategories/KitchenAndHousewareTemplate.java | 0af461b936337acf2c33b378dc79b138d93412d9 | [] | no_license | Swethapa1/ShopmaticUIAutomation | d6281e30b827e004ce980b2833031fa7ba5acb4a | cb80a23c722b177e28e583fa90337b492787f2ad | refs/heads/master | 2020-03-24T06:22:38.631397 | 2018-07-27T04:02:39 | 2018-07-27T04:02:39 | 142,525,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package TemplateCategories;
import org.openqa.selenium.WebDriver;
import TemplateActions.TemplateActions;
public class KitchenAndHousewareTemplate {
private String kitchen_houseware_template = "//div[contains(@data-name,'Kitchen - ')]";
TemplateActions templateactions;
public KitchenAndHousewareTemplate(WebDriver driver) {
templateactions = new TemplateActions(driver);
}
public void clickEditTemplate(int template_no)
{
templateactions.clickEditTemplate(kitchen_houseware_template, template_no);
}
public void clickPreview(int template_no)
{
templateactions.clickPreview(kitchen_houseware_template, template_no);
}
}
| [
"swetha@Swethas-MacBook-Pro.local"
] | swetha@Swethas-MacBook-Pro.local |
53f9e7acdc6e68be0f5004261176319295aff1b2 | 4240afbd90b435a4ad9f33ff77610bdcead6e5b9 | /src/main/java/com/br/filereader/infra/converter/FileConverter.java | fc0da4f3d7bdfafcde656bd0b41a9645db9bc6fd | [] | no_license | andrefilth/leitura-arquivo-api | 3b4e118cfcdeb6b1520c53ffbd59b70336173fa1 | d43744ab798f2dabe0e9f3359a6276991666116a | refs/heads/master | 2022-11-19T12:24:08.361856 | 2020-07-17T02:57:36 | 2020-07-17T02:57:36 | 278,966,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,021 | java | package com.br.filereader.infra.converter;
import com.br.filereader.infra.exception.FileInvalidException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Class comments go here...
*
* @author André Franco
* @version 1.0 11/07/2020
*/
@Slf4j
@Component
public class FileConverter implements Converter<MultipartFile, File> {
@Override
public File convert(final MultipartFile multipartFile){
File convFile = new File( multipartFile.getOriginalFilename() );
try {
FileOutputStream fos = new FileOutputStream( convFile );
fos.write( multipartFile.getBytes() );
fos.close();
return convFile;
}catch (IOException e){
log.error("Error ao gerar o arquivo ");
throw new FileInvalidException("Erro ao gerar o arquivo");
}
}
}
| [
"andrelgfranco@gmail.com"
] | andrelgfranco@gmail.com |
4aee3aed27bf0449bfc7d87bd4229f2d01f6db2f | b3a25518eadd220dcca49d25a289cbce2599fa3f | /app/src/main/java/com/example/yamadashougo/schejule_app/ActivityScoped.java | 473390ad91eca16db00b96853a02c8ed554e2594 | [] | no_license | yshogo/jetpack-sample | 440116f28a9cb80117e0597ccf816baee697038a | 6f175c2df076e362a2067ba9eff5a75f325e25f8 | refs/heads/master | 2020-03-28T06:21:42.134168 | 2018-10-22T11:56:35 | 2018-10-22T11:56:35 | 147,830,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.example.yamadashougo.schejule_app;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;
@Documented
@Scope
@Retention(RetentionPolicy.RUNTIME)
public @interface ActivityScoped {
}
| [
"superman199323@gmail.com"
] | superman199323@gmail.com |
461aec48ba0361ca5035c898b17ca386c751a022 | 56ff8fd44407fe7fd239f0cfb194c8c14e8dfad0 | /ExamPreparation/Club.java | c15c0cac7e0fafc0e7d90f532c2dc941489d74fe | [] | no_license | ausendzhikova/Programming-Basics-with-Java | 352bffbb33e27ab0fa6d3051509f89a7407f5451 | 2ee063c9b84dc5dceffd5dcfc81de64db518352a | refs/heads/main | 2023-07-15T06:47:17.710729 | 2021-08-26T10:47:48 | 2021-08-26T10:47:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,080 | java | import java.util.Scanner;
public class Club {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
double wishMoney=Double.parseDouble(scanner.nextLine());
int coctailsPrice=0;
String coctails=scanner.nextLine();
double sumMoney=0;
double totalSum=0;
boolean isParty=false;
while(!coctails.equals("Party!")){
int coctailsCount=Integer.parseInt(scanner.nextLine());
coctailsPrice = coctails.length();
sumMoney=coctailsPrice*coctailsCount;
if(sumMoney%2!=0){
sumMoney*=0.75;
}
totalSum+=sumMoney;
if(totalSum>=wishMoney) {
break;
}
coctails=scanner.nextLine();
}
if (coctails.equals("Party!")){
System.out.printf("We need %.2f leva more.%n", wishMoney-totalSum);
} else {
System.out.println("Target acquired.");
}
System.out.printf("Club income - %.2f leva.",totalSum);
}
}
| [
"73290490+ausendzhikova@users.noreply.github.com"
] | 73290490+ausendzhikova@users.noreply.github.com |
3df3b4b7d5cc4b675c832a6272e945b34f6e2fbc | 40665051fadf3fb75e5a8f655362126c1a2a3af6 | /ibinti-bugvm/14b0440913e7c183d29e98663a4f91b59c17c914/4830/IndefiniteLengthInputStream.java | 78dfeeb32dc7272797ea2346f57309ec54179a61 | [] | no_license | fermadeiral/StyleErrors | 6f44379207e8490ba618365c54bdfef554fc4fde | d1a6149d9526eb757cf053bc971dbd92b2bfcdf1 | refs/heads/master | 2020-07-15T12:55:10.564494 | 2019-10-24T02:30:45 | 2019-10-24T02:30:45 | 205,546,543 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,090 | java | package com.bugvm.bouncycastle.asn1;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
class IndefiniteLengthInputStream
extends LimitedInputStream
{
private int _b1;
private int _b2;
private boolean _eofReached = false;
private boolean _eofOn00 = true;
IndefiniteLengthInputStream(
InputStream in,
int limit)
throws IOException
{
super(in, limit);
_b1 = in.read();
_b2 = in.read();
if (_b2 < 0)
{
// Corrupted stream
throw new EOFException();
}
checkForEof();
}
void setEofOn00(
boolean eofOn00)
{
_eofOn00 = eofOn00;
checkForEof();
}
private boolean checkForEof()
{
if (!_eofReached && _eofOn00 && (_b1 == 0x00 && _b2 == 0x00))
{
_eofReached = true;
setParentEofDetect(true);
}
return _eofReached;
}
public int read(byte[] b, int off, int len)
throws IOException
{
// Only use this optimisation if we aren't checking for 00
if (_eofOn00 || len < 3)
{
return super.read(b, off, len);
}
if (_eofReached)
{
return -1;
}
int numRead = _in.read(b, off + 2, len - 2);
if (numRead < 0)
{
// Corrupted stream
throw new EOFException();
}
b[off] = (byte)_b1;
b[off + 1] = (byte)_b2;
_b1 = _in.read();
_b2 = _in.read();
if (_b2 < 0)
{
// Corrupted stream
throw new EOFException();
}
return numRead + 2;
}
public int read()
throws IOException
{
if (checkForEof())
{
return -1;
}
int b = _in.read();
if (b < 0)
{
// Corrupted stream
throw new EOFException();
}
int v = _b1;
_b1 = _b2;
_b2 = b;
return v;
}
}
| [
"fer.madeiral@gmail.com"
] | fer.madeiral@gmail.com |
e2d0ffa0724171a78bcc59058afb39fbdde542f1 | 8d5ba85f8d2bc9b78014ae71c3804e8504e67026 | /shared/src/main/java/messages/FileMessage.java | 5746c3a8702407e824c88a899cef59fea5adfdf4 | [] | no_license | MaratRZ/GB-CloudStorage | ba88ea80b72b226d419d14db7799a8ab4255b6a7 | c3c77c8e5b9e4f8d081e30bb8c3a274ba22c6a53 | refs/heads/master | 2022-12-04T04:55:47.341940 | 2020-08-13T09:45:22 | 2020-08-13T09:45:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,774 | java | package messages;
import utils.Item;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* A Class of message objects for a files of a size less than
* CONST_FRAG_SIZE in the FileFragmentMessage class.
*/
public class FileMessage extends AbstractMessage {
//объявляем переменную размера файла(в байтах)
private long fileSize;
//объявляем байтовый массив с данными из файла
private byte[] data;
//принимаем объект родительской директории элемента в клиенте
private Item clientDirectoryItem;
//принимаем объект родительской директории элемента в сетевом хранилище
private Item storageDirectoryItem;
//принимаем объект элемента
private Item item;
//принимаем переменную нового имени файла
private String newName;
//объявляем переменную контрольной суммы целого файла
private String fileChecksum;
//this constructor is for uploadEntireFile operation
public FileMessage(Item storageDirectoryItem, Item item, long fileSize) {
this.storageDirectoryItem = storageDirectoryItem;
this.item = item;
this.fileSize = fileSize;
}
//this constructor is for downloadEntireFile demanding operation
public FileMessage(Item storageDirectoryItem, Item clientDirectoryItem, Item item) {
this.storageDirectoryItem = storageDirectoryItem;
this.clientDirectoryItem = clientDirectoryItem;
this.item = item;
}
//this constructor is for downloadEntireFile receiving operation
public FileMessage(Item storageDirectoryItem, Item clientDirectoryItem, Item item, long fileSize) {
this.storageDirectoryItem = storageDirectoryItem;
this.clientDirectoryItem = clientDirectoryItem;
this.item = item;
this.fileSize = fileSize;
}
//для операции переименования
public FileMessage(Item storageDirectoryItem, Item item, String newName) {
this.storageDirectoryItem = storageDirectoryItem;
this.item = item;
this.newName = newName;
}
//для операции удаления
public FileMessage(Item storageDirectoryItem, Item item) {
this.storageDirectoryItem = storageDirectoryItem;
this.item = item;
}
/**
* Метод заполняет массив байтами, считанными из файла
* @param itemPathname - строка имени пути к объекту
* @throws IOException - исключение ввода вывода
*/
public void readFileData(String itemPathname) throws IOException {
//читаем все данные из файла побайтно в байтовый массив
this.data = Files.readAllBytes(Paths.get(itemPathname));
}
public Item getClientDirectoryItem() {
return clientDirectoryItem;
}
public Item getStorageDirectoryItem() {
return storageDirectoryItem;
}
public Item getItem() {
return item;
}
public String getNewName() {
return newName;
}
public long getFileSize() {
return fileSize;
}
public void setFileSize(long fileSize) {
this.fileSize = fileSize;
}
public byte[] getData() {
return data;
}
public String getFileChecksum() {
return fileChecksum;
}
public void setFileChecksum(String fileChecksum) {
this.fileChecksum = fileChecksum;
}
}
| [
"iourilitv1965@gmail.com"
] | iourilitv1965@gmail.com |
8a300d42ea3a38f78f6e3c7ae7b1b08b2348ecd6 | c4228f4313f33658ea0a227134f771456c27c660 | /Android-App/CanteenApp/app/src/main/java/com/example/canteenapp/BottomSheetFragment.java | 64870106c5cdc71e6703fbd0a409d7dedd383ba1 | [] | no_license | SudhanshuBhoi/Automated-System-for-Canteen | 39d76dd4bd4467667a85b0ffa1f2d8e676c3734e | a94f79d4fb0356017d964b0d32aa996c041df2ee | refs/heads/master | 2021-01-09T18:15:16.994978 | 2020-05-14T07:24:54 | 2020-05-14T07:24:54 | 242,404,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,908 | java | package com.example.canteenapp;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.zxing.WriterException;
import androidmads.library.qrgenearator.QRGContents;
import androidmads.library.qrgenearator.QRGEncoder;
/**
* A simple {@link Fragment} subclass.
*/
public class BottomSheetFragment extends BottomSheetDialogFragment {
int preparationTime;
double total;
TextView prepText;
ImageView qrImage;
TextView orderNoText;
TextView totalText;
public BottomSheetFragment() {
// Required empty public constructor
preparationTime = 0;
total = 0.0;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_bottom_sheet, container, false);
prepText = (TextView) view.findViewById(R.id.prepTimeTextView);
qrImage = (ImageView) view.findViewById(R.id.qrImage);
orderNoText = (TextView) view.findViewById(R.id.orderNoText);
totalText = (TextView) view.findViewById(R.id.totalAmtText);
prepText.setText("Thank you for your order! Your wait time is approximately " + preparationTime + " minutes");
QRGEncoder qrgEncoder = new QRGEncoder(String.valueOf(total), null, QRGContents.Type.TEXT, 200);
try {
qrImage.setImageBitmap(qrgEncoder.encodeAsBitmap());
} catch (WriterException e) {
e.printStackTrace();
}
totalText.setText(String.format("Total: Rs.%.2f/-", total));
return view;
}
}
| [
"sudh.bhoi.30@gmail.com"
] | sudh.bhoi.30@gmail.com |
3c370af95cfe98f630c3dcf7be0f4d4633ceb00f | 462116dfbfcecf04a2e200cb1a6a9f5a24de92f8 | /MarsRoverMeta/mars.ru.des.robot.tasks/src-gen/mars/ru/des/robot/taskDSL/impl/TurnRightImpl.java | 4ed3159344056ec93b5e056782f2ee39f017cb48 | [] | no_license | Samskip16/MarsRover | 1a7f758b61a981f4135a3061f2aced77a8143e7f | 4a6d66d7c8b7a1c03746abe28f3e0200e43c011c | refs/heads/master | 2020-04-08T16:12:46.700953 | 2018-12-17T15:24:45 | 2018-12-17T15:24:45 | 159,509,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,671 | java | /**
* generated by Xtext 2.15.0
*/
package mars.ru.des.robot.taskDSL.impl;
import mars.ru.des.robot.taskDSL.TaskDSLPackage;
import mars.ru.des.robot.taskDSL.TurnRight;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Turn Right</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link mars.ru.des.robot.taskDSL.impl.TurnRightImpl#getDegrees <em>Degrees</em>}</li>
* </ul>
*
* @generated
*/
public class TurnRightImpl extends DriveActionImpl implements TurnRight
{
/**
* The default value of the '{@link #getDegrees() <em>Degrees</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDegrees()
* @generated
* @ordered
*/
protected static final int DEGREES_EDEFAULT = 0;
/**
* The cached value of the '{@link #getDegrees() <em>Degrees</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDegrees()
* @generated
* @ordered
*/
protected int degrees = DEGREES_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TurnRightImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return TaskDSLPackage.Literals.TURN_RIGHT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getDegrees()
{
return degrees;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDegrees(int newDegrees)
{
int oldDegrees = degrees;
degrees = newDegrees;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TaskDSLPackage.TURN_RIGHT__DEGREES, oldDegrees, degrees));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case TaskDSLPackage.TURN_RIGHT__DEGREES:
return getDegrees();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case TaskDSLPackage.TURN_RIGHT__DEGREES:
setDegrees((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case TaskDSLPackage.TURN_RIGHT__DEGREES:
setDegrees(DEGREES_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TaskDSLPackage.TURN_RIGHT__DEGREES:
return degrees != DEGREES_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (degrees: ");
result.append(degrees);
result.append(')');
return result.toString();
}
} //TurnRightImpl
| [
"samjansen16@gmail.com"
] | samjansen16@gmail.com |
fad4e4f837422090e978b5bccb67b2f3dbe80eb5 | 0e13d9eff33362f1f3bc8549309bbc00ff265679 | /FooBar/src/FooBar.java | cc851f6f60e4c1a97b73f0f89dc5a05879d96a1c | [] | no_license | DakaraiWillis9/Shellebration | 0f6f49d566894b36eab203e17a81fee10cce3e33 | ed68c21adbf545e451c7ed66b7904d8083032d00 | refs/heads/main | 2023-05-27T11:30:30.118733 | 2021-06-10T20:28:31 | 2021-06-10T20:28:31 | 375,450,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java |
public class FooBar {
public static void main(String[] args) {
int x = 1;
while (x <= 100) {
System.out.println(x);
if (x % 3 == 0) {
System.out.println("Bar");
};
if (x % 5 == 0) {
System.out.println("Foo");
};
x++;
}
}
}
| [
"i.cynthiagarcia@gmail.com"
] | i.cynthiagarcia@gmail.com |
76acb6a402763f67b620657d1b347cdea2230ad8 | 7059867c8ebd7078987a1beecf4e32056331dcf8 | /Ivan ramis/Clase25/src/clase25/IAritmetica.java | c7c2f7d2b05fdce7305a0ec7f632706a100d0c98 | [] | no_license | codo-a-codo-amet/trello_projects | e6ab549ce0e9140a1190204718508d813a3e3d9d | a8d9e65adedcfc4b0fd0bb249d52a87c3470e3ca | refs/heads/master | 2021-01-21T19:05:44.597162 | 2017-12-12T00:03:07 | 2017-12-12T00:03:07 | 92,111,321 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 621 | 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 clase25;
/**
*
* @author alumno
*/
public interface IAritmetica<Tipo> {
public void Sumar(IAritmetica<Tipo> aSumar);
public void Restar(IAritmetica<Tipo> aRestar);
public void Multiplicar(IAritmetica<Tipo> aMultiplicar);
public void Dividir(IAritmetica<Tipo> aDividir);
public Boolean EsIgualA(IAritmetica<Tipo> aObjeto);
public String descripcion();
public Tipo obtenerValor ();
}
| [
"ivanra48@gmail.com"
] | ivanra48@gmail.com |
bbd693b4a2adaf24e3ba02de779878d67dd30f9f | 917b577fbd4ffce828c35f57a6ceedc844557187 | /src/main/java/marco/miranda/repo/ISupervisorRepo.java | cb6072c7877a7c2db4276a161e1e8186ed4e61c5 | [] | no_license | MarcoStraw/Tarea2-SpringBoot | 7b8347ebae0515a7e8c4402c8e9251b2cdcb6215 | 7919de36dbfdd269e889fe1686d516eb486ecf69 | refs/heads/main | 2023-01-06T18:58:26.051411 | 2020-10-25T23:49:54 | 2020-10-25T23:49:54 | 307,216,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | package marco.miranda.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import marco.miranda.model.Supervisor;
public interface ISupervisorRepo extends JpaRepository<Supervisor, Integer> {
}
| [
"stratopajavarius@gmail.com"
] | stratopajavarius@gmail.com |
94c9b422ef60eb511c50f3d50a9f8463ec5c77c7 | c4802c887d2ece27a2ee99675163f5dff774d3ae | /MÓDULO 1 PROGRAMACIÓN BÁSICA EN JAVA/Unidad 9 - Metodos constructores/Evidencia Dia 4 semana 6 - 3 de junio/Código/src/View/Usuario/ViewUsuario.java | 2141084842e795d8ecf994c88a8d09983b214a37 | [] | no_license | YorchXD/Curso-de-Desarrollo-de-aplicaciones-moviles-Android-Trainee | 83238d2938dd9877cb150fd12f8b0af92bb7a485 | d2f79c2fad5f3b3251c8ecccbf196707ca570e37 | refs/heads/master | 2023-07-28T04:10:05.138527 | 2021-09-11T12:55:35 | 2021-09-11T12:55:35 | 362,313,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,050 | java | package View.Usuario;
import Utilidades.Utilidades;
import Controller.CursoController;
import Controller.AlumnoController;
import Controller.ApoderadoController;
import Controller.AsignaturaController;
import Controller.ProfesorController;
import Controller.UnidadController;
public class ViewUsuario
{
/*Opciones administrador*/
public static void menuAdministrador()
{
System.out.println("\n********************************************************");
System.out.println("* Menu Administrador *");
System.out.println("********************************************************\n");
System.out.println("1. Crear Curso");
System.out.println("2. Ver cursos registrados con su estado");
System.out.println("3. Ver curso");
System.out.println("4. Habilitar o deshabiliatar curso");
System.out.println("5. Crear asignatura");
System.out.println("6. Ver asignaturas registradas");
System.out.println("7. Modificar asignatura");
System.out.println("8. Asociar asignatura a curso");
System.out.println("9. Ver asignaturas asociadas a un curso");
System.out.println("10. Habilitar o deshabiliatar asignatura de un curso");
System.out.println("11. Quitar asignatura de un curso");
System.out.println("12. Crear unidad");
System.out.println("13. Ver unidades de una asignatura de un curso");
System.out.println("14. Modificar unidad");
System.out.println("15. Habilitar o deshabiliatar unidad");
System.out.println("16. Crear Alumno");
System.out.println("17. Ver Alumno");
System.out.println("18. Modificar Alumno");
System.out.println("19. Habilitar o deshabiliatar Alumno");
System.out.println("20. Crear Profesor");
System.out.println("21. Ver Profesor");
System.out.println("22. Modificar Profesor");
System.out.println("23. Habilitar o deshabiliatar Profesor");
System.out.println("24. Crear Apoderado");
System.out.println("25. Ver Apoderado");
System.out.println("26. Modificar Apoderado");
System.out.println("27. Habilitar o deshabiliatar Apoderado");
System.out.println("28. Cerrar sesion");
System.out.println("********************************************************\n");
System.out.print("Ingrese su opcion: ");
}
public static int accionEjecucionAdministrador()
{
boolean validar = false;
String opcion;
do
{
menuAdministrador();
opcion = Utilidades.extracted().nextLine();
validar = Utilidades.esNumero(opcion);
if(!validar )
{
System.out.println("Ha ingresado un parametro incorrecto. Por favor, ingrese una opcion valida..\n\n");
opcion="-1";
}
else if(Integer.parseInt(opcion)<1 || Integer.parseInt(opcion)>28)
{
System.out.println("La opcion ingresada no es valida. Favor ingrese una opcion segun las opciones que muestra el menu.\n\n");
}
}
while(Integer.parseInt(opcion)<1 || Integer.parseInt(opcion)>28);
return Integer.parseInt(opcion);
}
public static void seleccionarOpcionAdministrador()
{
int opcion;
do
{
opcion = accionEjecucionAdministrador();
switch(opcion)
{
case 1:
CursoController.crear();
break;
case 2:
CursoController.verCursosRegistrados();
break;
case 3:
CursoController.ver();
break;
case 4:
CursoController.modificar();
break;
case 5:
AsignaturaController.crear();
break;
case 6:
AsignaturaController.verAsignaturasRegistradas();
break;
case 7:
AsignaturaController.modificar();
break;
case 8:
CursoController.asociarAsignatura();
break;
case 9:
CursoController.verListadoAsignaturasCurso();
break;
case 10:
CursoController.cambiarEstadoAsignatura();
break;
case 11:
System.out.println("Quitar asignatura de curso");
break;
case 12:
UnidadController.crear();
break;
case 13:
UnidadController.verListadoUnidades();
break;
case 14:
UnidadController.modificar();
break;
case 15:
UnidadController.cambiarEstadoUnidad();
break;
case 16:
AlumnoController.crear();
break;
case 17:
AlumnoController.ver();
break;
case 18:
AlumnoController.modificar();
break;
case 19:
AlumnoController.cambiarEstado();
break;
case 20:
ProfesorController.crear();
break;
case 21:
ProfesorController.ver();
break;
case 22:
ProfesorController.modificar();
break;
case 23:
ProfesorController.cambiarEstado();
break;
case 24:
ApoderadoController.crear();
break;
case 25:
ApoderadoController.ver();
break;
case 26:
ApoderadoController.modificar();
break;
case 27:
ApoderadoController.cambiarEstado();
break;
default:
System.out.println("Sesion cerrada...\n\n");
break;
}
}
while(opcion!=28);
}
/*Fin opciones administrador*/
/*Opciones profesor*/
/*Fin opciones profesor*/
/*Opciones apoderado*/
/*Fin opciones apoderado*/
} | [
"yorch5.77@gmail.com"
] | yorch5.77@gmail.com |
8a4fd03bbbaaa2075114f1b05aa22a1d051ca87f | 4e98aa4e435605173b80c63bc109ef9a63ed2d3e | /tij4/src/main/java/generics/GenericVarargs.java | 63f71cfaf53e46c121c7030e5ca388d91c9956e6 | [] | no_license | wuliendan/Java-learning | 0f6b2c5df7beceeef829fbde5f103caee12ca045 | 4c012f4573063631e4a9ea49a8cbd72e3d4be7bc | refs/heads/master | 2022-12-30T01:40:50.113700 | 2020-08-06T09:32:31 | 2020-08-06T09:32:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package generics;
// generics/GenericVarargs.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
import com.google.common.collect.Lists;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
public class GenericVarargs {
@SafeVarargs
public static <T> List<T> makeList(T... args) {
List<T> result = new ArrayList<>();
for (T item : args)
result.add(item);
return result;
}
public static void main(String[] args) {
List<String> ls = makeList("A");
System.out.println(ls);
ls = makeList("A", "B", "C");
System.out.println(ls);
ls = makeList(
"ABCDEFFHIJKLMNOPQRSTUVWXYZ".split(""));
System.out.println(ls);
}
}
/* Output:
[A]
[A, B, C]
[A, B, C, D, E, F, F, H, I, J, K, L, M, N, O, P, Q, R,
S, T, U, V, W, X, Y, Z]
*/
| [
"w7years@gmail.com"
] | w7years@gmail.com |
c27f36b849032614f8723bc09b13ffa2acaef826 | dd8c184ea23a0ce8d5e7a9d2ed7e53418b0732ef | /src/main/java/mod/milkeyyy/milkeysdecoration/procedures/AlphabetblockguiGblockProcedure.java | 04af284f0e85bf2811860d1e4e443283826d2c50 | [] | no_license | Milkeyyy/Milkeys-Decoration | 35dbd54f3bacd6d1e57e578e1f71b63531e2c8a9 | 93d6873553e87973c37491b7852eee77c02f8f59 | refs/heads/master | 2023-04-26T03:11:50.008812 | 2021-05-13T23:54:54 | 2021-05-13T23:54:54 | 367,201,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,478 | java | package mod.milkeyyy.milkeysdecoration.procedures;
import net.minecraft.world.IWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.Entity;
import mod.milkeyyy.milkeysdecoration.block.GBlockBlock;
import mod.milkeyyy.milkeysdecoration.MilkeysdecorationModElements;
import mod.milkeyyy.milkeysdecoration.MilkeysdecorationMod;
import java.util.Map;
@MilkeysdecorationModElements.ModElement.Tag
public class AlphabetblockguiGblockProcedure extends MilkeysdecorationModElements.ModElement {
public AlphabetblockguiGblockProcedure(MilkeysdecorationModElements instance) {
super(instance, 113);
}
public static void executeProcedure(Map<String, Object> dependencies) {
if (dependencies.get("entity") == null) {
if (!dependencies.containsKey("entity"))
MilkeysdecorationMod.LOGGER.warn("Failed to load dependency entity for procedure AlphabetblockguiGblock!");
return;
}
if (dependencies.get("x") == null) {
if (!dependencies.containsKey("x"))
MilkeysdecorationMod.LOGGER.warn("Failed to load dependency x for procedure AlphabetblockguiGblock!");
return;
}
if (dependencies.get("y") == null) {
if (!dependencies.containsKey("y"))
MilkeysdecorationMod.LOGGER.warn("Failed to load dependency y for procedure AlphabetblockguiGblock!");
return;
}
if (dependencies.get("z") == null) {
if (!dependencies.containsKey("z"))
MilkeysdecorationMod.LOGGER.warn("Failed to load dependency z for procedure AlphabetblockguiGblock!");
return;
}
if (dependencies.get("world") == null) {
if (!dependencies.containsKey("world"))
MilkeysdecorationMod.LOGGER.warn("Failed to load dependency world for procedure AlphabetblockguiGblock!");
return;
}
Entity entity = (Entity) dependencies.get("entity");
double x = dependencies.get("x") instanceof Integer ? (int) dependencies.get("x") : (double) dependencies.get("x");
double y = dependencies.get("y") instanceof Integer ? (int) dependencies.get("y") : (double) dependencies.get("y");
double z = dependencies.get("z") instanceof Integer ? (int) dependencies.get("z") : (double) dependencies.get("z");
IWorld world = (IWorld) dependencies.get("world");
world.setBlockState(new BlockPos((int) x, (int) y, (int) z), GBlockBlock.block.getDefaultState(), 3);
if (entity instanceof PlayerEntity)
((PlayerEntity) entity).closeScreen();
}
}
| [
"59532514+Milkeyyy@users.noreply.github.com"
] | 59532514+Milkeyyy@users.noreply.github.com |
fd3cc35a9472d939f7a76bacba4192a136e3762f | a180c05345ba06c335844f5291771e56e5324b35 | /homework/src/CrossZero.java | 280a4d16f810df30c281c83849c5072dcbf93ddd | [] | no_license | RomashkaStepanov/dz | 782a05d409fa64eacd436a30e6655deacf854c9d | 904a7653f5574b6216bcdff2f8e9337ef1879a80 | refs/heads/master | 2023-01-05T22:53:32.915202 | 2020-10-28T17:58:30 | 2020-10-28T17:58:30 | 306,710,328 | 0 | 0 | null | 2020-11-05T12:54:06 | 2020-10-23T17:58:59 | Java | UTF-8 | Java | false | false | 48 | java | package PACKAGE_NAME;public class CrossZero {
}
| [
"by.chamomilla@gmail.com"
] | by.chamomilla@gmail.com |
dfc0688a51389c7f0d48e95ccd194f6723312798 | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/GetDeviceInstanceRequest.java | 0ea297a117c4751cdd0e05144691aec80b7da90d | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 3,760 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.devicefarm.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/devicefarm-2015-06-23/GetDeviceInstance" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetDeviceInstanceRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The Amazon Resource Name (ARN) of the instance you're requesting information about.
* </p>
*/
private String arn;
/**
* <p>
* The Amazon Resource Name (ARN) of the instance you're requesting information about.
* </p>
*
* @param arn
* The Amazon Resource Name (ARN) of the instance you're requesting information about.
*/
public void setArn(String arn) {
this.arn = arn;
}
/**
* <p>
* The Amazon Resource Name (ARN) of the instance you're requesting information about.
* </p>
*
* @return The Amazon Resource Name (ARN) of the instance you're requesting information about.
*/
public String getArn() {
return this.arn;
}
/**
* <p>
* The Amazon Resource Name (ARN) of the instance you're requesting information about.
* </p>
*
* @param arn
* The Amazon Resource Name (ARN) of the instance you're requesting information about.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDeviceInstanceRequest withArn(String arn) {
setArn(arn);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getArn() != null)
sb.append("Arn: ").append(getArn());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetDeviceInstanceRequest == false)
return false;
GetDeviceInstanceRequest other = (GetDeviceInstanceRequest) obj;
if (other.getArn() == null ^ this.getArn() == null)
return false;
if (other.getArn() != null && other.getArn().equals(this.getArn()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
return hashCode;
}
@Override
public GetDeviceInstanceRequest clone() {
return (GetDeviceInstanceRequest) super.clone();
}
}
| [
""
] | |
364d01204fe21e2f5490ddf618330f1d9fd198fa | a034a7e08ec23b83f4572b81cb49a1196a189358 | /impl/src/main/java/org/jboss/cdi/tck/tests/alternative/resolution/qualifier/Larch.java | cf51a1245b8e6950f3a2af9176f303d8cefa600e | [] | no_license | scottmarlow/cdi-tck | a8ec72eae1d656870cab94bf8f5c37401d3af953 | 7f7e86f71ed4e8875c8bf236bf45e46b031cb30b | refs/heads/master | 2022-07-23T17:10:14.409176 | 2020-02-17T15:16:35 | 2020-02-17T16:03:02 | 243,301,425 | 0 | 0 | null | 2020-02-26T15:49:34 | 2020-02-26T15:49:33 | null | UTF-8 | Java | false | false | 988 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2012, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* 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.jboss.cdi.tck.tests.alternative.resolution.qualifier;
import javax.enterprise.inject.Alternative;
@Alternative
public class Larch extends Tree {
public int ping() {
return 0;
}
}
| [
"mkouba@redhat.com"
] | mkouba@redhat.com |
0ec6a63203055181dde076f3ba9bcb19082678d1 | 42fb7b22efb28473aa7853952175d5cc87cba4a3 | /cloud-provider-hygtrix-payment8001/src/main/java/com/xionghl/PaymentHystrixMain8001.java | cd9c8b2813a84f615459fe3821472e17d2c8e61c | [] | no_license | xionghaolin23/LearnCloud | e34d724db774c8803a901853dd9ebfbf168fa2d1 | 5cfde562b45fa8759c8d66c608820a52d8a6f0ae | refs/heads/master | 2023-08-11T19:36:02.347795 | 2021-10-01T05:03:40 | 2021-10-01T05:03:40 | 409,990,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package com.xionghl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
/**
* @Author:xionghl
* @Date:2021/9/26 8:26 下午
*/
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
public class PaymentHystrixMain8001
{
public static void main(String[] args) {
SpringApplication.run(PaymentHystrixMain8001.class, args);
}
}
| [
"1445695649@qq.com"
] | 1445695649@qq.com |
87edb86a934eaf9886cb948b7c9cca47155457bb | 9667eeb9db9d2196809d5dc031c2e9a7fd14c967 | /LAMSTAR/src/lamstar/RandomGenerator.java | 9221ec761833f9cdd2a0331913cd7c23ddab931c | [] | no_license | umbertoDifa/protein-family-classification-ann | fa42bdf15181960b81a7b9d43a2adb76239e9706 | 9913c8b432200b98fd18edeaa3c89186ef6cbc76 | refs/heads/master | 2021-01-17T10:05:14.439318 | 2020-11-11T12:55:49 | 2020-11-11T12:55:49 | 45,364,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | 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 lamstar;
import java.util.Random;
/**
*
* @author Umberto
*/
public class RandomGenerator {
private static Random random = new Random();
public static int randomInRange(int min, int max) {
int randomNum = random.nextInt((max - min)) + min;
return randomNum;
}
}
| [
"umberto.difabrizio@mail.polimi.it"
] | umberto.difabrizio@mail.polimi.it |
02701cd12d90dd4a2f388cb42fd5800ffa65cc78 | 4a081c60cbf69c27bce6340c98848d4fde9fb03d | /app/src/main/java/com/example/adapter/SanPhamAdapter.java | 7c5311a92ad4c61e4e5a7a8b3ef724c267a34d8f | [] | no_license | dungtran2909/UiMiHnManagement | 5995562bcfce20469fa275fcc7f173a35a9c82c4 | fd9a57496de7c43d96c3b6d39a4446efb9f0e471 | refs/heads/master | 2020-09-15T20:24:39.610786 | 2019-11-23T07:38:16 | 2019-11-23T07:38:16 | 223,550,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,964 | java | package com.example.adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.example.model.ItemNhap;
import com.example.uimihnmanagement.R;
import java.util.ArrayList;
import java.util.List;
public class SanPhamAdapter extends ArrayAdapter<ItemNhap> {
Activity context = null;
List<ItemNhap> objects;
int resource;
public SanPhamAdapter(Context context, int resource, ArrayList<ItemNhap> objects) {
super(context, resource, objects);
this.context = (Activity) context;
this.resource = resource;
this.objects = objects;
}
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
LayoutInflater layoutInflater = this.context.getLayoutInflater();
if(convertView==null){
convertView=layoutInflater.inflate(this.resource,null);
viewHolder=new ViewHolder();
viewHolder.txtTen=convertView.findViewById(R.id.txtTenSanPham);
viewHolder.txtSoLuong=convertView.findViewById(R.id.txtSoLuong);
viewHolder.txtNgayNhap=convertView.findViewById(R.id.txtNgayNhap);
viewHolder.position=position;
convertView.setTag(viewHolder);
}
else {
viewHolder= (ViewHolder) convertView.getTag();
}
ItemNhap itemNhap = objects.get(position);
viewHolder.txtTen.setText(itemNhap.getSanPham().getTenSP());
viewHolder.txtSoLuong.setText(itemNhap.getSanPham().getSoLuongTon() + "");
viewHolder.txtNgayNhap.setText(itemNhap.getNgayNhap());
return convertView;
}
public static class ViewHolder{
TextView txtTen;
TextView txtSoLuong;
TextView txtNgayNhap;
int position;
}
}
| [
"quoccuong151197@gmail.com"
] | quoccuong151197@gmail.com |
f331a3ed696ddccb9ccd4d5d0426591a54ec58e2 | d69d251b8d2a570cde11e4d921a13d4765afef88 | /Taga/src/algorithms/Dijkstra.java | 0be42f4aabe026ac91be065467927099f4479f29 | [] | no_license | wsgan001/communityDetection-3 | 215f03629c87bf24c6812a165fbfcc1e42364f5b | c1e05cea6e63618525766b70da3d0372187f8aae | refs/heads/master | 2020-03-30T08:43:24.842857 | 2017-07-09T01:13:06 | 2017-07-09T01:13:06 | 151,034,670 | 1 | 0 | null | 2018-10-01T04:03:26 | 2018-10-01T04:03:26 | null | UTF-8 | Java | false | false | 1,625 | java | package algorithms;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import structure.Graph;
import structure.Node;
public class Dijkstra {
Graph g = new Graph();
public Dijkstra(Graph g) {
this.g = g;
}
public HashMap<String, Double> dijkstra(String nodoPartenza) {
int n = g.getN();
// System.out.println("N=" + n);
HashMap<String, Double> dist = new HashMap<>();
for (Node node : g.getNodes().values())
dist.put(node.getId(), Double.POSITIVE_INFINITY);
// System.out.println("\nsize=" + dist.size());
HashSet<String> ragg = new HashSet<>();
dist.put(nodoPartenza, 0.0);
String nodoCorrente = nodoPartenza;
while (nodoCorrente != null) {
ragg.add(nodoCorrente);
Iterator<String> adnn = g.getNode(nodoCorrente).getNeighbors().iterator();
//System.out.println("vicini di " + nodoCorrente+"\n");
while (adnn.hasNext()) {
String a = adnn.next();
// System.out.println(a);
if (!ragg.contains(a)) {
double nuovaDist = dist.get(nodoCorrente) + 1;
if (nuovaDist < dist.get(a)) {
dist.put(a, nuovaDist);
}
}
}
nodoCorrente = null;
double minPeso = Double.POSITIVE_INFINITY;
for (String s : dist.keySet())
if (!ragg.contains(s) && dist.get(s) < minPeso) {
nodoCorrente = s;
minPeso = dist.get(s);
}
}
return dist;
}
public double getLongestDistance(String s) {
HashMap<String, Double> map = dijkstra(s);
double max = 0;
for (Double n : map.values()) {
if (n > max)
max = n;
}
return max;
}
}
| [
"fabrizio@pc-fabry"
] | fabrizio@pc-fabry |
0526e44ee47f97962a3d5380e67249b7a298cd78 | 67c8f7f5acd3af3ec5967d85777b66ff4dbef7bb | /src/com/pipi/study/net/chapter6/mimetype/SupposeMimeType.java | 3c1e41da53237c954fd09d5515c8f927b9f1cdf3 | [] | no_license | hycho/NetWork2 | be3233d43872365108056af236e2d2a9d9eeec0f | 8d07b9780b36b3781b7db9fc54593082874126c2 | refs/heads/master | 2021-01-10T10:15:35.013940 | 2015-11-16T09:01:26 | 2015-11-16T09:01:26 | 44,313,327 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,237 | java | package com.pipi.study.net.chapter6.mimetype;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class SupposeMimeType {
public static void main(String[] args) {
/**
* guessContentTypeFromName(String name) : name의 확장자 부분을 기반으로 객체의 컨텐츠 타입을 추측하고 반환한다..
* guessContentTypeFromStream(InputStream is) : stream의 몇개의 시작 바이트를 읽고 타입을 식별한다. guessContentTypeFromName보다 신뢰하기 어려우며 예를 들어 XML파일 위에 XML이 아닌 주석값을 놓았을 경우 HTML파일로 잘못 분류를 할 수 있다.
*/
try {
URL u = new URL("http://naver.com");
URLConnection conn = u.openConnection();
System.out.println(conn.guessContentTypeFromName("D:/Chrysanthemum.jpg"));
InputStream is = new FileInputStream(new File("D:/Chrysanthemum.jpg"));
BufferedInputStream bis = new BufferedInputStream(is);
System.out.println(conn.guessContentTypeFromStream(bis));
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"yjpc999@yjpc999-PC"
] | yjpc999@yjpc999-PC |
a0c60320bc39885883d7cc83192734f572bf620e | 5166c2c60c2e90a721d96811d1bbb5a4d356dda2 | /src/s02traycatch/ManyCatchTest.java | 18cb2e8b6cc6d94e16220319ef14a97d4531b5d0 | [] | no_license | tanya-nikolaienko/lesson-8 | 288ec24628d4cffdb699453c34b9f1e2d32a2c2a | 5879d08413514c255a31a276eb6d4d1c81781c8a | refs/heads/master | 2023-09-03T10:48:34.933835 | 2021-11-16T13:50:48 | 2021-11-16T13:50:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 701 | java | package s02traycatch;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class ManyCatchTest {
public static void main(String[] args) {
FileInputStream file;
String fileName = "test.txt";
byte x;
try {
file = new FileInputStream(fileName);
x = (byte) file.read();
System.out.println("Данные: " + x);
} catch (FileNotFoundException e2) {
System.out.println("Блок e2");
e2.printStackTrace();
} catch (IOException e1) {
System.out.println("Блок e1");
e1.printStackTrace();
}
}
}
| [
"anatoliy.shkabara@gmail.com"
] | anatoliy.shkabara@gmail.com |
48835565ff84b24a5311b1c9a22b1f631b140d2d | 7c388364ee92ba4c4167d6fbf321ed7cbb3ebd67 | /src/main/java/com/shwe/faketube/controller/UserController.java | b509a267099ae3cec3593acdeb25e718ad938b2e | [] | no_license | shweaye810/FakeTube-Service | f1d362ca473e6c2e01c31225815ab23c0a7f324a | 9c899dc14d8d9437c4160218a8f5838a04f2f577 | refs/heads/master | 2020-06-04T10:53:11.399583 | 2019-06-14T19:13:11 | 2019-06-14T19:13:11 | 191,991,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package com.shwe.faketube.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(path = "users")
public class UserController {
// @GetMapping("/hello/{name}")
// public ResponseEntity<Resource> hello(@PathVariable String name)
// throws URISyntaxException, MalformedURLException {
// // URI
// Resource uri = new UrlResource(
// "file:///Volumes/MY_PASSPORT/Video/Watch Captain Fantastic Online Watch Full Captain Fantastic .mp4");
// return ResponseEntity.status(HttpStatus.OK)
// .contentType(MediaTypeFactory
// .getMediaType(uri)
// .orElse(MediaType.APPLICATION_OCTET_STREAM)
// )
// .body(uri);
// // return ServerResponse.ok().contentType(MediaType.TEXT_PLAIN)
// // .body(BodyInserters.fromObject("Hello, Spring!"));
//// return Mono.just(uri).map(p -> ResponseEntity.ok()
//// .contentType(MediaTypeFactory.getMediaType(uri).orElse(MediaType.APPLICATION_OCTET_STREAM))
//// .body(uri));
// }
}
| [
"shweaye810@gmail.com"
] | shweaye810@gmail.com |
6e5d5de3bf1354c262e7bf8450fe0ddf54a1484f | c0232c2656e00c0970c4f4ef1c006d33b5852c9e | /PCComponentShop/src/hr/vjezbe/tecajnica/TecajnicaNit.java | b9f9fa0da2415c03682d782807b32e69a4d3fec6 | [] | no_license | mstuban/PC-component-shop | 38f6bfe84ba5817d76bc0e871b283b1130a44181 | 07ddf3afcd3fffb8322dfaa07f8938d04f0340e2 | refs/heads/master | 2020-04-15T11:47:49.284517 | 2018-09-25T06:52:22 | 2018-09-25T06:52:22 | 61,192,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,096 | java | package hr.vjezbe.tecajnica;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import hr.java.vjezbe.javafx.PocetniEkranController;
public class TecajnicaNit implements Runnable {
private Thread nit;
public TecajnicaNit(String nazivPrograma) {
nit = new Thread(this, nazivPrograma);
}
public void start() {
nit.start();
}
@Override
public void run() {
boolean flag = true;
while (flag) {
LocalDate localDate = PocetniEkranController.datum;
String oznakaValute = PocetniEkranController.valuta;
if(Tecajnica.dohvatiTecaj(oznakaValute, localDate) == null){
break;
}
String formatiraniDatum = localDate.format(DateTimeFormatter.ofPattern("dd.MM.yyyy"));
System.out.print(formatiraniDatum + " ");
System.out.print(nit.getName());
System.out.print("za " + oznakaValute + " je: ");
System.out.println(Tecajnica.dohvatiTecaj(oznakaValute, localDate));
System.out.println();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| [
"stuban.marko@gmail.com"
] | stuban.marko@gmail.com |
f4fbda63ceb59c3925a9254ea5d3ccdc30669914 | 0df3b7512ca516ebe2e79091689623afaed61c20 | /src/helloworldmvc/controller/package-info.java | 80e6e7a44ce47824f1b67a8c25b99700a5df7365 | [] | no_license | UnaiUrti/Reto0DIN | bb3da9fc184c0b0eb9658d01d910236f334533ba | 0e311a8c2c02ec2cd4e93816c025942f9d133e10 | refs/heads/master | 2023-08-18T14:51:42.242362 | 2021-09-30T07:24:08 | 2021-09-30T07:24:08 | 407,517,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | /**
* This is the package for the controller
*/
package helloworldmvc.controller;
| [
"penemax572@gmail.com"
] | penemax572@gmail.com |
29bcc706937f454b4a22e1cacf9249fa9d33756f | 40bdd458ac637a0801c0ccf8044629b3486b431d | /app/src/main/java/com/marklordan/brewski/Labels.java | 3d8a1b4db5acb991f8f0f545efdec5c592265afa | [] | no_license | DarkNormal/Brewski | eb8920b1ee52c7459da920ab01c05c4046308123 | 0b6af502f414b539187dcb01cc7683ebd4b877e2 | refs/heads/master | 2020-12-03T04:10:15.330325 | 2017-07-02T21:53:49 | 2017-07-02T21:53:49 | 95,824,135 | 0 | 0 | null | 2017-07-01T13:15:50 | 2017-06-29T22:09:58 | Java | UTF-8 | Java | false | false | 869 | java | package com.marklordan.brewski;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/**
* Created by Mark on 01/07/2017.
*/
class Labels implements Serializable {
@SerializedName("icon")
private String mIcon;
@SerializedName("medium")
private String mMediumLabel;
@SerializedName("large")
private String mLargeIcon;
@SerializedName("squareMedium")
private String mSquareMedium;
@SerializedName("squareLarge")
private String mSquareLarge;
public String getmIcon() {
return mIcon;
}
public String getmMediumLabel() {
return mMediumLabel;
}
public String getmLargeIcon() {
return mLargeIcon;
}
public String getmSquareMedium() {
return mSquareMedium;
}
public String getmSquareLarge() {
return mSquareLarge;
}
} | [
"mark.lordan@me.com"
] | mark.lordan@me.com |
781b7575ceaf01115da5e6c127246434d01fc7ef | 30077453fa7d1070e0dc1784ead3c7cdc2e5373c | /app/src/main/java/org/blayboy/newpipe/player/playback/MediaSourceManager.java | 83d4014bb27e6e4469e0748a143f0abc9e9f3cc8 | [
"MIT"
] | permissive | JayeshDankhara/BlayTube | fc2d24df04672e58921534a6f71ff0a37b57a2cb | 2a7c4ac6ed7992a36312057fbf567bb4a7447daf | refs/heads/master | 2023-06-05T09:53:00.768546 | 2021-06-26T03:08:57 | 2021-06-26T03:08:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,967 | java | package org.blayboy.newpipe.player.playback;
import android.os.Handler;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.ArraySet;
import com.google.android.exoplayer2.source.MediaSource;
import org.blayboy.newpipe.util.ServiceHelper;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.blayboy.newpipe.player.mediasource.FailedMediaSource;
import org.blayboy.newpipe.player.mediasource.LoadedMediaSource;
import org.blayboy.newpipe.player.mediasource.ManagedMediaSource;
import org.blayboy.newpipe.player.mediasource.ManagedMediaSourcePlaylist;
import org.blayboy.newpipe.player.mediasource.PlaceholderMediaSource;
import org.blayboy.newpipe.player.playqueue.PlayQueue;
import org.blayboy.newpipe.player.playqueue.PlayQueueItem;
import org.blayboy.newpipe.player.playqueue.events.MoveEvent;
import org.blayboy.newpipe.player.playqueue.events.PlayQueueEvent;
import org.blayboy.newpipe.player.playqueue.events.RemoveEvent;
import org.blayboy.newpipe.player.playqueue.events.ReorderEvent;
import org.blayboy.newpipe.util.ServiceHelper;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.subjects.PublishSubject;
import static org.blayboy.newpipe.player.mediasource.FailedMediaSource.MediaSourceResolutionException;
import static org.blayboy.newpipe.player.mediasource.FailedMediaSource.StreamInfoLoadException;
import static org.blayboy.newpipe.player.playqueue.PlayQueue.DEBUG;
public class MediaSourceManager {
@NonNull
private final String TAG = "MediaSourceManager@" + hashCode();
/**
* Determines how many streams before and after the current stream should be loaded.
* The default value (1) ensures seamless playback under typical network settings.
* <p>
* The streams after the current will be loaded into the playlist timeline while the
* streams before will only be cached for future usage.
* </p>
*
* @see #onMediaSourceReceived(PlayQueueItem, ManagedMediaSource)
*/
private static final int WINDOW_SIZE = 1;
/**
* Determines the maximum number of disposables allowed in the {@link #loaderReactor}.
* Once exceeded, new calls to {@link #loadImmediate()} will evict all disposables in the
* {@link #loaderReactor} in order to load a new set of items.
*
* @see #loadImmediate()
* @see #maybeLoadItem(PlayQueueItem)
*/
private static final int MAXIMUM_LOADER_SIZE = WINDOW_SIZE * 2 + 1;
@NonNull
private final PlaybackListener playbackListener;
@NonNull
private final PlayQueue playQueue;
/**
* Determines the gap time between the playback position and the playback duration which
* the {@link #getEdgeIntervalSignal()} begins to request loading.
*
* @see #progressUpdateIntervalMillis
*/
private final long playbackNearEndGapMillis;
/**
* Determines the interval which the {@link #getEdgeIntervalSignal()} waits for between
* each request for loading, once {@link #playbackNearEndGapMillis} has reached.
*/
private final long progressUpdateIntervalMillis;
@NonNull
private final Observable<Long> nearEndIntervalSignal;
/**
* Process only the last load order when receiving a stream of load orders (lessens I/O).
* <p>
* The higher it is, the less loading occurs during rapid noncritical timeline changes.
* </p>
* <p>
* Not recommended to go below 100ms.
* </p>
*
* @see #loadDebounced()
*/
private final long loadDebounceMillis;
@NonNull
private final Disposable debouncedLoader;
@NonNull
private final PublishSubject<Long> debouncedSignal;
@NonNull
private Subscription playQueueReactor;
@NonNull
private final CompositeDisposable loaderReactor;
@NonNull
private final Set<PlayQueueItem> loadingItems;
@NonNull
private final AtomicBoolean isBlocked;
@NonNull
private ManagedMediaSourcePlaylist playlist;
private final Handler removeMediaSourceHandler = new Handler();
public MediaSourceManager(@NonNull final PlaybackListener listener,
@NonNull final PlayQueue playQueue) {
this(listener, playQueue, 400L,
/*playbackNearEndGapMillis=*/TimeUnit.MILLISECONDS.convert(30, TimeUnit.SECONDS),
/*progressUpdateIntervalMillis*/TimeUnit.MILLISECONDS.convert(2, TimeUnit.SECONDS));
}
private MediaSourceManager(@NonNull final PlaybackListener listener,
@NonNull final PlayQueue playQueue,
final long loadDebounceMillis,
final long playbackNearEndGapMillis,
final long progressUpdateIntervalMillis) {
if (playQueue.getBroadcastReceiver() == null) {
throw new IllegalArgumentException("Play Queue has not been initialized.");
}
if (playbackNearEndGapMillis < progressUpdateIntervalMillis) {
throw new IllegalArgumentException("Playback end gap=[" + playbackNearEndGapMillis
+ " ms] must be longer than update interval=[ " + progressUpdateIntervalMillis
+ " ms] for them to be useful.");
}
this.playbackListener = listener;
this.playQueue = playQueue;
this.playbackNearEndGapMillis = playbackNearEndGapMillis;
this.progressUpdateIntervalMillis = progressUpdateIntervalMillis;
this.nearEndIntervalSignal = getEdgeIntervalSignal();
this.loadDebounceMillis = loadDebounceMillis;
this.debouncedSignal = PublishSubject.create();
this.debouncedLoader = getDebouncedLoader();
this.playQueueReactor = EmptySubscription.INSTANCE;
this.loaderReactor = new CompositeDisposable();
this.isBlocked = new AtomicBoolean(false);
this.playlist = new ManagedMediaSourcePlaylist();
this.loadingItems = Collections.synchronizedSet(new ArraySet<>());
playQueue.getBroadcastReceiver()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getReactor());
}
/*//////////////////////////////////////////////////////////////////////////
// Exposed Methods
//////////////////////////////////////////////////////////////////////////*/
/**
* Dispose the manager and releases all message buses and loaders.
*/
public void dispose() {
if (DEBUG) {
Log.d(TAG, "close() called.");
}
debouncedSignal.onComplete();
debouncedLoader.dispose();
playQueueReactor.cancel();
loaderReactor.dispose();
}
/*//////////////////////////////////////////////////////////////////////////
// Event Reactor
//////////////////////////////////////////////////////////////////////////*/
private Subscriber<PlayQueueEvent> getReactor() {
return new Subscriber<PlayQueueEvent>() {
@Override
public void onSubscribe(@NonNull final Subscription d) {
playQueueReactor.cancel();
playQueueReactor = d;
playQueueReactor.request(1);
}
@Override
public void onNext(@NonNull final PlayQueueEvent playQueueMessage) {
onPlayQueueChanged(playQueueMessage);
}
@Override
public void onError(@NonNull final Throwable e) { }
@Override
public void onComplete() { }
};
}
private void onPlayQueueChanged(final PlayQueueEvent event) {
if (playQueue.isEmpty() && playQueue.isComplete()) {
playbackListener.onPlaybackShutdown();
return;
}
// Event specific action
switch (event.type()) {
case INIT:
case ERROR:
maybeBlock();
case APPEND:
populateSources();
break;
case SELECT:
maybeRenewCurrentIndex();
break;
case REMOVE:
final RemoveEvent removeEvent = (RemoveEvent) event;
playlist.remove(removeEvent.getRemoveIndex());
break;
case MOVE:
final MoveEvent moveEvent = (MoveEvent) event;
playlist.move(moveEvent.getFromIndex(), moveEvent.getToIndex());
break;
case REORDER:
// Need to move to ensure the playing index from play queue matches that of
// the source timeline, and then window correction can take care of the rest
final ReorderEvent reorderEvent = (ReorderEvent) event;
playlist.move(reorderEvent.getFromSelectedIndex(),
reorderEvent.getToSelectedIndex());
break;
case RECOVERY:
default:
break;
}
// Loading and Syncing
switch (event.type()) {
case INIT: case REORDER: case ERROR: case SELECT:
loadImmediate(); // low frequency, critical events
break;
case APPEND: case REMOVE: case MOVE: case RECOVERY:
default:
loadDebounced(); // high frequency or noncritical events
break;
}
// update ui and notification
switch (event.type()) {
case APPEND: case REMOVE: case MOVE: case REORDER:
playbackListener.onPlayQueueEdited();
}
if (!isPlayQueueReady()) {
maybeBlock();
playQueue.fetch();
}
playQueueReactor.request(1);
}
/*//////////////////////////////////////////////////////////////////////////
// Playback Locking
//////////////////////////////////////////////////////////////////////////*/
private boolean isPlayQueueReady() {
final boolean isWindowLoaded = playQueue.size() - playQueue.getIndex() > WINDOW_SIZE;
return playQueue.isComplete() || isWindowLoaded;
}
private boolean isPlaybackReady() {
if (playlist.size() != playQueue.size()) {
return false;
}
final ManagedMediaSource mediaSource = playlist.get(playQueue.getIndex());
if (mediaSource == null) {
return false;
}
final PlayQueueItem playQueueItem = playQueue.getItem();
return mediaSource.isStreamEqual(playQueueItem);
}
private void maybeBlock() {
if (DEBUG) {
Log.d(TAG, "maybeBlock() called.");
}
if (isBlocked.get()) {
return;
}
playbackListener.onPlaybackBlock();
resetSources();
isBlocked.set(true);
}
private void maybeUnblock() {
if (DEBUG) {
Log.d(TAG, "maybeUnblock() called.");
}
if (isBlocked.get()) {
isBlocked.set(false);
playbackListener.onPlaybackUnblock(playlist.getParentMediaSource());
}
}
/*//////////////////////////////////////////////////////////////////////////
// Metadata Synchronization
//////////////////////////////////////////////////////////////////////////*/
private void maybeSync() {
if (DEBUG) {
Log.d(TAG, "maybeSync() called.");
}
final PlayQueueItem currentItem = playQueue.getItem();
if (isBlocked.get() || currentItem == null) {
return;
}
playbackListener.onPlaybackSynchronize(currentItem);
}
private synchronized void maybeSynchronizePlayer() {
if (isPlayQueueReady() && isPlaybackReady()) {
maybeUnblock();
maybeSync();
}
}
/*//////////////////////////////////////////////////////////////////////////
// MediaSource Loading
//////////////////////////////////////////////////////////////////////////*/
private Observable<Long> getEdgeIntervalSignal() {
return Observable.interval(progressUpdateIntervalMillis,
TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
.filter(ignored ->
playbackListener.isApproachingPlaybackEdge(playbackNearEndGapMillis));
}
private Disposable getDebouncedLoader() {
return debouncedSignal.mergeWith(nearEndIntervalSignal)
.debounce(loadDebounceMillis, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.single())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(timestamp -> loadImmediate());
}
private void loadDebounced() {
debouncedSignal.onNext(System.currentTimeMillis());
}
private void loadImmediate() {
if (DEBUG) {
Log.d(TAG, "MediaSource - loadImmediate() called");
}
final ItemsToLoad itemsToLoad = getItemsToLoad(playQueue);
if (itemsToLoad == null) {
return;
}
// Evict the previous items being loaded to free up memory, before start loading new ones
maybeClearLoaders();
maybeLoadItem(itemsToLoad.center);
for (final PlayQueueItem item : itemsToLoad.neighbors) {
maybeLoadItem(item);
}
}
private void maybeLoadItem(@NonNull final PlayQueueItem item) {
if (DEBUG) {
Log.d(TAG, "maybeLoadItem() called.");
}
if (playQueue.indexOf(item) >= playlist.size()) {
return;
}
if (!loadingItems.contains(item) && isCorrectionNeeded(item)) {
if (DEBUG) {
Log.d(TAG, "MediaSource - Loading=[" + item.getTitle() + "] "
+ "with url=[" + item.getUrl() + "]");
}
loadingItems.add(item);
final Disposable loader = getLoadedMediaSource(item)
.observeOn(AndroidSchedulers.mainThread())
/* No exception handling since getLoadedMediaSource guarantees nonnull return */
.subscribe(mediaSource -> onMediaSourceReceived(item, mediaSource));
loaderReactor.add(loader);
}
}
private Single<ManagedMediaSource> getLoadedMediaSource(@NonNull final PlayQueueItem stream) {
return stream.getStream().map(streamInfo -> {
final MediaSource source = playbackListener.sourceOf(stream, streamInfo);
if (source == null) {
final String message = "Unable to resolve source from stream info. "
+ "URL: " + stream.getUrl() + ", "
+ "audio count: " + streamInfo.getAudioStreams().size() + ", "
+ "video count: " + streamInfo.getVideoOnlyStreams().size() + ", "
+ streamInfo.getVideoStreams().size();
return new FailedMediaSource(stream, new MediaSourceResolutionException(message));
}
final long expiration = System.currentTimeMillis()
+ ServiceHelper.getCacheExpirationMillis(streamInfo.getServiceId());
return new LoadedMediaSource(source, stream, expiration);
}).onErrorReturn(throwable -> new FailedMediaSource(stream,
new StreamInfoLoadException(throwable)));
}
private void onMediaSourceReceived(@NonNull final PlayQueueItem item,
@NonNull final ManagedMediaSource mediaSource) {
if (DEBUG) {
Log.d(TAG, "MediaSource - Loaded=[" + item.getTitle()
+ "] with url=[" + item.getUrl() + "]");
}
loadingItems.remove(item);
final int itemIndex = playQueue.indexOf(item);
// Only update the playlist timeline for items at the current index or after.
if (isCorrectionNeeded(item)) {
if (DEBUG) {
Log.d(TAG, "MediaSource - Updating index=[" + itemIndex + "] with "
+ "title=[" + item.getTitle() + "] at url=[" + item.getUrl() + "]");
}
playlist.update(itemIndex, mediaSource, removeMediaSourceHandler,
this::maybeSynchronizePlayer);
}
}
/**
* Checks if the corresponding MediaSource in
* {@link com.google.android.exoplayer2.source.ConcatenatingMediaSource}
* for a given {@link PlayQueueItem} needs replacement, either due to gapless playback
* readiness or playlist desynchronization.
* <p>
* If the given {@link PlayQueueItem} is currently being played and is already loaded,
* then correction is not only needed if the playlist is desynchronized. Otherwise, the
* check depends on the status (e.g. expiration or placeholder) of the
* {@link ManagedMediaSource}.
* </p>
*
* @param item {@link PlayQueueItem} to check
* @return whether a correction is needed
*/
private boolean isCorrectionNeeded(@NonNull final PlayQueueItem item) {
final int index = playQueue.indexOf(item);
final ManagedMediaSource mediaSource = playlist.get(index);
return mediaSource != null && mediaSource.shouldBeReplacedWith(item,
index != playQueue.getIndex());
}
/**
* Checks if the current playing index contains an expired {@link ManagedMediaSource}.
* If so, the expired source is replaced by a {@link PlaceholderMediaSource} and
* {@link #loadImmediate()} is called to reload the current item.
* <br><br>
* If not, then the media source at the current index is ready for playback, and
* {@link #maybeSynchronizePlayer()} is called.
* <br><br>
* Under both cases, {@link #maybeSync()} will be called to ensure the listener
* is up-to-date.
*/
private void maybeRenewCurrentIndex() {
final int currentIndex = playQueue.getIndex();
final ManagedMediaSource currentSource = playlist.get(currentIndex);
if (currentSource == null) {
return;
}
final PlayQueueItem currentItem = playQueue.getItem();
if (!currentSource.shouldBeReplacedWith(currentItem, true)) {
maybeSynchronizePlayer();
return;
}
if (DEBUG) {
Log.d(TAG, "MediaSource - Reloading currently playing, "
+ "index=[" + currentIndex + "], item=[" + currentItem.getTitle() + "]");
}
playlist.invalidate(currentIndex, removeMediaSourceHandler, this::loadImmediate);
}
private void maybeClearLoaders() {
if (DEBUG) {
Log.d(TAG, "MediaSource - maybeClearLoaders() called.");
}
if (!loadingItems.contains(playQueue.getItem())
&& loaderReactor.size() > MAXIMUM_LOADER_SIZE) {
loaderReactor.clear();
loadingItems.clear();
}
}
/*//////////////////////////////////////////////////////////////////////////
// MediaSource Playlist Helpers
//////////////////////////////////////////////////////////////////////////*/
private void resetSources() {
if (DEBUG) {
Log.d(TAG, "resetSources() called.");
}
playlist = new ManagedMediaSourcePlaylist();
}
private void populateSources() {
if (DEBUG) {
Log.d(TAG, "populateSources() called.");
}
while (playlist.size() < playQueue.size()) {
playlist.expand();
}
}
/*//////////////////////////////////////////////////////////////////////////
// Manager Helpers
//////////////////////////////////////////////////////////////////////////*/
@Nullable
private static ItemsToLoad getItemsToLoad(@NonNull final PlayQueue playQueue) {
// The current item has higher priority
final int currentIndex = playQueue.getIndex();
final PlayQueueItem currentItem = playQueue.getItem(currentIndex);
if (currentItem == null) {
return null;
}
// The rest are just for seamless playback
// Although timeline is not updated prior to the current index, these sources are still
// loaded into the cache for faster retrieval at a potentially later time.
final int leftBound = Math.max(0, currentIndex - MediaSourceManager.WINDOW_SIZE);
final int rightLimit = currentIndex + MediaSourceManager.WINDOW_SIZE + 1;
final int rightBound = Math.min(playQueue.size(), rightLimit);
final Set<PlayQueueItem> neighbors = new ArraySet<>(
playQueue.getStreams().subList(leftBound, rightBound));
// Do a round robin
final int excess = rightLimit - playQueue.size();
if (excess >= 0) {
neighbors.addAll(playQueue.getStreams()
.subList(0, Math.min(playQueue.size(), excess)));
}
neighbors.remove(currentItem);
return new ItemsToLoad(currentItem, neighbors);
}
private static class ItemsToLoad {
@NonNull
private final PlayQueueItem center;
@NonNull
private final Collection<PlayQueueItem> neighbors;
ItemsToLoad(@NonNull final PlayQueueItem center,
@NonNull final Collection<PlayQueueItem> neighbors) {
this.center = center;
this.neighbors = neighbors;
}
}
}
| [
"caucahotran@gmail.com"
] | caucahotran@gmail.com |
aa5002fd35cdb78a4ee8ca4b9733a9cbd5fbfa54 | 8a38bc7a1061cfb01cd581da9958033ccbdee654 | /dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsAction.java | 5b05dc7141d1785e2b02b08360ebd30c42a332ce | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | abyot/eotcnor | e4432448c91ca8a761fcb3088ecb52d97d0931e5 | 7220fd9f830a7a718c1231aa383589986f6ac5b9 | refs/heads/main | 2022-11-05T14:48:38.028658 | 2022-10-28T10:07:33 | 2022-10-28T10:07:33 | 120,287,850 | 0 | 0 | null | 2018-02-05T11:02:05 | 2018-02-05T10:10:22 | null | UTF-8 | Java | false | false | 3,857 | java | /*
* Copyright (c) 2004-2021, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.commons.action;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.paging.ActionPagingSupport;
/**
* @author Tran Thanh Tri
* @author mortenoh
*/
public class GetOrganisationUnitGroupsAction
extends ActionPagingSupport<OrganisationUnitGroup>
{
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
private OrganisationUnitGroupService organisationUnitGroupService;
public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
{
this.organisationUnitGroupService = organisationUnitGroupService;
}
// -------------------------------------------------------------------------
// Input & output
// -------------------------------------------------------------------------
private String key;
public void setKey( String key )
{
this.key = key;
}
private List<OrganisationUnitGroup> organisationUnitGroups;
public List<OrganisationUnitGroup> getOrganisationUnitGroups()
{
return organisationUnitGroups;
}
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute()
throws Exception
{
organisationUnitGroups = new ArrayList<>(
organisationUnitGroupService.getAllOrganisationUnitGroups() );
if ( key != null )
{
organisationUnitGroups = IdentifiableObjectUtils.filterNameByKey( organisationUnitGroups, key, true );
}
Collections.sort( organisationUnitGroups );
if ( usePaging )
{
this.paging = createPaging( organisationUnitGroups.size() );
organisationUnitGroups = organisationUnitGroups.subList( paging.getStartPos(), paging.getEndPos() );
}
return SUCCESS;
}
}
| [
"abyota@gmail.com"
] | abyota@gmail.com |
2c3231abfc1e9d94b4b7ac8497f85b8469ec0c62 | 1eb5a884ea15cba0c19537092759c6c2b0f6ca87 | /javastudy/src/main/java/dynamicproxy/Person.java | 3568c31f8a72be4106efc4519ac90f75860a1afd | [
"MIT"
] | permissive | gaoweigithub/aboutJava | b6d63096c2730334098725555eed89a478e45183 | 48bc69d21a90e9712244ea6bf4b8ed5be6d3ecaf | refs/heads/master | 2021-07-16T00:26:12.698821 | 2019-02-11T06:40:07 | 2019-02-11T06:40:07 | 129,116,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | /**
* @(#)Person.java Created by gw33973 on 2018/4/11 23:58
* <p>
* Copyrights (C) 2018保留所有权利
*/
package dynamicproxy;
/**
* (类型功能说明描述)
*
* <p>
* 修改历史: <br>
* 修改日期 修改人员 版本 修改内容<br>
* -------------------------------------------------<br>
* 2018/4/11 23:58 gw33973 1.0 初始化创建<br>
* </p>
*
* @author gw33973
* @version 1.0
* @since JDK1.7
*/
public interface Person {
/**
* 唱歌
* @param name
* @return
*/
String sing(String name);
/**
* 跳舞
* @param name
* @return
*/
String dance(String name);
}
| [
"gw33973@ly.com"
] | gw33973@ly.com |
c96f07c93799f3e81c5b917ad3e49207fdd95b91 | bb065ef0c0afa8c9adde9fbc03accc40a702cecf | /app/src/main/java/com/example/yotis/omdb/repository/Repository.java | 4650af8d50105b97388c984b741aa0378643bd9e | [] | no_license | l3nny/omdb | 230833fce7ba84c679de6854629dc522846db6d2 | 15b030ff97d09d7835a4c5ed574e4d78aaa5bdf1 | refs/heads/master | 2020-03-16T20:43:36.710733 | 2018-05-11T16:08:46 | 2018-05-11T16:08:46 | 132,967,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package com.example.yotis.omdb.repository;
import android.content.Context;
public abstract class Repository {
private BaseRepository repository;
public Repository() {
this.repository = new RepositoryHttp();
}
public void get( Promise p, String url, Context ctx) {
this.repository.get( p, this, url, ctx);
}
public void getlist( Promise p, String url, Context ctx) {
this.repository.getlist( p, this, url, ctx);
}
public void post(Promise p, Context ctx, String url) {
this.repository.post(p, this, ctx, url);
}
public void postall(Promise p, Context ctx, String url) {
this.repository.postall(p, this, ctx, url);
}
public void put(Promise p, Context ctx, String url) {
this.repository.put(p, this, ctx, url);
}
public void putall(Promise p, Context ctx, String id) {
this.repository.putall(p, this, ctx, id);
}
public void getAll(Promise p, String url, Context ctx) {
this.repository.getAll(p, this, url, ctx);
}
public void getAlllist(Promise p, String url, Context ctx) {
this.repository.getAlllist(p, this, url, ctx);
}
public BaseRepository getRepository() {
return repository;
}
public void setRepository(BaseRepository repository) {
this.repository = repository;
}
}
| [
"yulieth@gmail.com"
] | yulieth@gmail.com |
d8eec0a5348a95371514d869a0bdcd88fe2d4280 | 608b2e9673332e417f378dcab857923cb5f66d11 | /src/vetorDeClasses/Product.java | 0fc6ed41b58ed6d1e8ff0d60421e2e983bf8c712 | [] | no_license | Tettsuriam/Exercicios-do-curso | 4fe6e8a7e4758a3f3b69d4d18cf101078e288024 | a4b2206ff7d32b211db3577d81c8d1d59d70c3a2 | refs/heads/master | 2022-11-15T19:35:51.296110 | 2020-07-05T19:45:17 | 2020-07-05T19:45:17 | 277,370,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package vetorDeClasses;
public class Product {
private String name;
private double price;
public Product(String name, double price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
| [
"joao2012pedro2012@gmail.com"
] | joao2012pedro2012@gmail.com |
0944c3203e658e41fdff2b01164cde7e16cfaa77 | 556cf4dbdb5ab514359efdb1febfb4ee913112a2 | /Android/app/src/main/java/com/example/android/Faxian/SpacesItemDecoration.java | a2ba70bdd99cd7a5cbec7b1e2ed10fc0095a0018 | [] | no_license | Auligal/Android | 6ab6cf24020e860673dfb52b4511ec9c341cef18 | fcc713ac8c3f878f077fddd72639684a5b914c6a | refs/heads/master | 2020-11-24T18:24:40.528289 | 2020-01-02T08:26:50 | 2020-01-02T08:26:50 | 228,290,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.example.android.Faxian;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
private int space;
public SpacesItemDecoration(int space) {
this.space = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.left = space;
outRect.right = space;
outRect.bottom = space;
outRect.top = space;
}
}
| [
""
] | |
efc8f32bf104ebf3ac8e97c5196e36863d5d78eb | 33a990f9e6cb0f54dab85618aa00fd1ec3be2534 | /day11-Book/src/book/dao/SetBookShelf.java | 6fc811ed4a0a43b3a79215428643fa02113dd29e | [] | no_license | seungyukim/academy_java_basic | 7b70fa0301d566400036e5a9b8c2493795ca8b9a | 3fcd038471fb5162ec65e5e5de5c9f9726a2e961 | refs/heads/master | 2020-03-22T06:39:53.644116 | 2018-07-20T08:47:38 | 2018-07-20T08:47:38 | 139,649,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,498 | java | package book.dao;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import book.vo.Book;
public class SetBookShelf implements BookShelf {
// 1. 멤버변수 : 도서를 저장할 자료구조로 set 선택
private Set<Book> books;
// 2. 생성자
public SetBookShelf() {
books = new HashSet<Book>();
}
public SetBookShelf(Set<Book> book) {
super();
this.books = books;
}
// 3. 메소드
@Override
public int insert(Book book) {
boolean success = ((Set<Book>) book).add(book);
return success ? 1 : 0;
}
@Override
public Book select(Book book) {
return findBook(book);
}
@Override
public int update(Book book) {
// Set 은 수정기능의 api 가 없으므로
// 기존 것 remove 후 add
boolean rmSuccess = ((Set<Book>) book).remove(book);
boolean addSuccess = false;
if (rmSuccess) {
books.add(book);
addSuccess = true;
}
return addSuccess ? 1 : 0 ;
}
@Override
public int delete(Book book) {
boolean success = books.remove(book);
return success ? 1 : 0;
}
@Override
public List<Book> select() {
List<Book> books = new ArrayList<Book>();
for (Book book: this.books) {
books.add(book);
}
return books;
}
private Book findBook(Book book) {
Book found = null;
for (Book bk: books) {
if (bk.equals(book)) {
found = bk;
break;
}
}
return found;
}
}
| [
"huntkiller77@naver.com"
] | huntkiller77@naver.com |
61176d14578b149099ed72d4a8c27b5b1cc2552c | f31bff50c02847a728c4e562078e83575d0990cd | /src/main/java/cn/learn/dao/CommentsMapper.java | 820b8c09c0f7b265d17d8233e8fee58034f1ac30 | [] | no_license | mygithub-m/wangyi | f3a95ffb03f0fcc4bfa8732d3c9cca7c35268e1c | a489acbf89f9afb150f3057174bfaadfceb1bcf7 | refs/heads/master | 2023-01-19T18:34:38.740534 | 2020-11-28T09:54:18 | 2020-11-28T09:54:18 | 316,699,538 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package cn.learn.dao;
import cn.learn.pojo.Comments;
import java.util.List;
/**
* 评论dao
*/
public interface CommentsMapper {
/**
* 添加评论
* @return
*/
public Integer save(Comments comments);
/**
* 通过歌曲id获取歌曲评论
* @param id
* @return
*/
public List<Comments> findBySingId(int id);
/**
* 更新评论获赞数
* @param comments
* @return
*/
public Integer updateSupport(Comments comments);
/**
* 通过评论id获取评论信息
* @param id
* @return
*/
public Comments findById(int id);
}
| [
"mayu@learn.cn"
] | mayu@learn.cn |
34562733cc8717f93d3a1a231095e5c42c3d9c76 | 21ea191329dda6115aa2850d1fc71d20a17bcf81 | /LOGICA/src/uyTubePersistencia/PersistenciaCtrl.java | 1a79c54382e066829735b816077a3d1cc489ebfd | [] | no_license | marcobaldi97/tprogproyect | 2fd9c896df8c38c179300ec2ffd088059308f823 | d110c5ce38ad5d286013654634e4b8622b602048 | refs/heads/branch_marco_viernes | 2020-12-27T10:16:26.361666 | 2020-02-04T00:45:01 | 2020-02-04T00:45:01 | 237,861,971 | 0 | 0 | null | 2020-02-04T00:45:03 | 2020-02-03T01:10:11 | Java | UTF-8 | Java | false | false | 1,447 | java | package uyTubePersistencia;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.swing.event.ListSelectionEvent;
public class PersistenciaCtrl {
public Usuario[] getUsuariosPersistidos() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("UyTubeJPA");
EntityManager em = emf.createEntityManager();
List<Usuario> usuarios= em.createQuery("Select u from Usuario u").getResultList();
return usuarios.toArray(new Usuario[0]);
}
public Map<Integer,String> listarUsuariosPersistidos() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("UyTubeJPA");
EntityManager em = emf.createEntityManager();
List<Usuario> usuarios= em.createQuery("Select u from Usuario u").getResultList();
Map<Integer,String> pares = new HashMap<Integer,String>();
for(Usuario usuarioParticular:usuarios) {
pares.put(usuarioParticular.getIdUsuario(), usuarioParticular.getNickname());
}
return pares;
}
public Usuario getInfoUsuario(Integer idVid) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("UyTubeJPA");
EntityManager em = emf.createEntityManager();
Usuario found = em.find(Usuario.class, idVid);
return found;
}
}
| [
"Nacho@Ching"
] | Nacho@Ching |
9e510b044be345cf10c84b17ca9b707d24ea06f6 | 1ce428247c7d8c520b5b70cae59ea0351176bcce | /src/main/java/org/seckill/dao/cache/RedisDao.java | c4f1ce2a58c60e764a870289e799ec7e54360009 | [] | no_license | william1638/seckill | 1cc9fa27526c987840756de21aa1fec2ea23b2df | 0aa09b9a699528dc7c36002b6bd9ef54b87c33aa | refs/heads/master | 2021-01-21T07:03:58.151296 | 2017-03-01T07:26:12 | 2017-03-01T07:26:12 | 83,309,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,330 | java | package org.seckill.dao.cache;
import io.protostuff.LinkedBuffer;
import io.protostuff.ProtostuffIOUtil;
import io.protostuff.runtime.RuntimeSchema;
import org.seckill.entity.Seckill;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
/**
* Created by William on 2017/2/28.
*/
public class RedisDao {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final JedisPool jedisPool ;
private static RuntimeSchema<Seckill> schema = RuntimeSchema.createFrom(Seckill.class);
public RedisDao(String host, int port) {
jedisPool = new JedisPool( host, port);
}
public Seckill getSeckill(long seckillId ){
// redis操作逻辑
try {
Jedis jedis = jedisPool.getResource();
try {
String key = "seckill:"+seckillId;
// 并没有实现内部序列化操作
// get->byte[]->反序列化->Object(Seckill)
// 采用自定义序列化
// protostuff:pojo
byte[] bytes = jedis.get(key.getBytes());
if(bytes!=null){
// 反序列化
Seckill seckill = schema.newMessage();
ProtostuffIOUtil.mergeFrom(bytes,seckill,schema);
return seckill ;
}
} finally {
jedis.close();
}
} catch (Exception e) {
logger.info(e.getMessage());
}
return null ;
}
public String putSeckill(Seckill seckill){
// set Object(Seckill) -> 序列化 ->byte[]
try {
Jedis jedis = jedisPool.getResource();
try {
String key = "seckill:"+seckill.getSeckillId();
byte[] bytes = ProtostuffIOUtil.toByteArray(seckill, schema, LinkedBuffer.allocate(LinkedBuffer.DEFAULT_BUFFER_SIZE));
// 超时缓存
int timeout = 60 * 60 ;//1小时
String result = jedis.setex(key.getBytes(), timeout, bytes);
return result ;
}finally {
jedis.close();
}
}catch (Exception e) {
logger.error(e.getMessage());
}
return null ;
}
}
| [
"yzw1638@outlook.com"
] | yzw1638@outlook.com |
7312066b6b2fa0c9ef60e7584656a8f5c6cfe7ce | f766baf255197dd4c1561ae6858a67ad23dcda68 | /app/src/main/java/com/tencent/wecall/talkroom/a/m.java | 2e35a0045de575b9489aec67d96e801fe475a97f | [] | no_license | jianghan200/wxsrc6.6.7 | d83f3fbbb77235c7f2c8bc945fa3f09d9bac3849 | eb6c56587cfca596f8c7095b0854cbbc78254178 | refs/heads/master | 2020-03-19T23:40:49.532494 | 2018-06-12T06:00:50 | 2018-06-12T06:00:50 | 137,015,278 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,959 | java | package com.tencent.wecall.talkroom.a;
import com.google.a.a.e;
import com.tencent.pb.common.b.a.a.ak;
import com.tencent.pb.common.b.a.a.l;
import com.tencent.pb.common.b.d;
public final class m
extends d
{
public String jTX;
public int kvL;
public long vxz;
public m(String paramString, int paramInt1, long paramLong, int paramInt2, int paramInt3)
{
com.tencent.pb.common.c.c.d("MicroMsg.Voip", new Object[] { this.TAG2, "hello", paramString, Integer.valueOf(paramInt1), Long.valueOf(paramLong) });
a.l locall = new a.l();
locall.vcZ = paramInt3;
locall.oLB = paramInt1;
this.kvL = paramInt1;
locall.oLC = paramLong;
this.vxz = paramLong;
locall.groupId = paramString;
this.jTX = paramString;
locall.kpU = paramInt2;
this.jIm = 3;
try
{
this.vcc = com.tencent.wecall.talkroom.model.c.cHG().adi(paramString);
c(147, locall);
return;
}
catch (Exception paramString)
{
for (;;)
{
com.tencent.pb.common.c.c.x(this.TAG2, new Object[] { "NetSceneVoiceRoomHello constructor", paramString });
}
}
}
protected final Object bI(byte[] paramArrayOfByte)
{
if (paramArrayOfByte != null) {
try
{
paramArrayOfByte = (a.ak)e.a(new a.ak(), paramArrayOfByte, paramArrayOfByte.length);
return paramArrayOfByte;
}
catch (Exception paramArrayOfByte)
{
com.tencent.pb.common.c.c.x(this.TAG2, new Object[] { "data2Resp", paramArrayOfByte.getMessage() });
return null;
}
}
return null;
}
protected final String cEm()
{
return "CsCmd.Cmd_V_CSVoiceRoomHelloReq";
}
public final int getType()
{
return 205;
}
}
/* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes5-dex2jar.jar!/com/tencent/wecall/talkroom/a/m.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"526687570@qq.com"
] | 526687570@qq.com |
8a62a5ef7425cfdcc6c4dcb1ffda9ceee278d10f | f648226bee08e17ce3f877cf3344d00643b85465 | /src/main/java/br/com/pillwatcher/api/gateway/dto/WrapperListResponse.java | 6eb01cbb8ff1602a1a36c2b6ecdfadd19cf1a41b | [
"MIT"
] | permissive | PillWatcher/pillwatcher-api-gateway | b33e7c1ef245119b85d90732cb9d53f761e49262 | 6ce93896400cc819c72fceb456ee27dde3f00efd | refs/heads/master | 2023-01-08T11:00:02.012478 | 2020-11-13T02:14:12 | 2020-11-13T02:14:12 | 302,977,662 | 0 | 0 | MIT | 2020-11-13T02:14:13 | 2020-10-10T19:43:27 | Java | UTF-8 | Java | false | false | 2,221 | java | package br.com.pillwatcher.api.gateway.dto;
import br.com.pillwatcher.api.gateway.dto.nurse.NurseDTOForResponse;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* WrapperListResponse
*/
@Validated
public class WrapperListResponse {
@JsonProperty("data")
@Valid
private List<NurseDTOForResponse> data = null;
public WrapperListResponse data(List<NurseDTOForResponse> data) {
this.data = data;
return this;
}
public WrapperListResponse addDataItem(NurseDTOForResponse dataItem) {
if (this.data == null) {
this.data = new ArrayList<>();
}
this.data.add(dataItem);
return this;
}
/**
* List nurse response
*
* @return data
**/
@ApiModelProperty(value = "List nurse response")
@Valid
public List<NurseDTOForResponse> getData() {
return data;
}
public void setData(List<NurseDTOForResponse> data) {
this.data = data;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
WrapperListResponse wrapperListResponse = (WrapperListResponse) o;
return Objects.equals(this.data, wrapperListResponse.data);
}
@Override
public int hashCode() {
return Objects.hash(data);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WrapperListResponse {\n");
sb.append(" data: ").append(toIndentedString(data)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"lipao.dias@hotmail.com"
] | lipao.dias@hotmail.com |
25466306ce7ef88e6dd5b0bbb94513823f5a3d76 | 58a9369bcaef1562d4ba57b97703a40a207959d7 | /CollectionProj/src/com/java/ItemNameComparator.java | b83a358e99b635789ed73217fd8929fae166563a | [] | no_license | rudransh111213/Collections | 345732f68de3b11535fe121a10e53d0a4fd81b8a | c323e96b2b05b6057c9d2aaea79d6d557e4fc9b3 | refs/heads/master | 2020-03-25T22:21:22.292198 | 2018-08-12T01:00:04 | 2018-08-12T01:00:04 | 144,218,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package com.java;
import java.util.Comparator;
public class ItemNameComparator implements Comparator<Item>{
@Override
public int compare(Item i1, Item i2) {
return i1.getName().compareTo(i2.getName());
}
}
| [
"patluri.mahesh@gmail.com"
] | patluri.mahesh@gmail.com |
9ec83cf9f3d59997f9b088c2cdb59d74a9d74626 | dbede791f1e99371dcf2701c49698dc69ca40f63 | /ogham-core/src/main/java/fr/sii/ogham/core/message/capability/HasRecipientsFluent.java | 40a08a333d52e553f4fcf1dc158596aa717ac4fb | [
"Apache-2.0"
] | permissive | iberrada/ogham | 076ca8f4b88b9e31f1d32a080586fee4ffcbdfeb | 7d10b571c4ae589fd97b3b58362977daa5fe5685 | refs/heads/master | 2021-01-19T07:33:56.849773 | 2017-03-19T21:20:12 | 2017-03-19T21:20:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package fr.sii.ogham.core.message.capability;
import java.util.List;
import fr.sii.ogham.core.message.recipient.Addressee;
/**
* Interface to mark a message that has recipient capability using fluent API.
*
* @author Aurélien Baudet
*
* @param <R>
* the type of recipient managed by the implementation
* @param <F>
* the fluent type
*/
public interface HasRecipientsFluent<F, R extends Addressee> {
/**
* Set the list of recipients of the message
*
* @param recipients
* the list of recipients of the message to set
* @return this instance for fluent use
*/
public F recipients(List<R> recipients);
/**
* Add a recipient for the message
*
* @param recipient
* the recipient to add to the message
* @return this instance for fluent use
*/
public F recipient(R recipient);
} | [
"abaudet@sii.fr"
] | abaudet@sii.fr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.