blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b5442a6ca24fbcb87bcad644e6eb7b05aa9dfc5f | 7d7734103e946730f14275c7ebbfe742d233844d | /src/main/java/name/bluesman80/Main.java | e5247fcb850d14b122c8804ce0f3097fd01d2dbf | [] | no_license | bluesman80/FileRenameAndTransfer | 201b65e85db905283d02840298de2babc8c5dfe0 | 36a66fb244da1cca12271eff15057fe8d4cfad1f | refs/heads/master | 2020-12-30T14:00:26.121580 | 2017-05-31T06:51:37 | 2017-05-31T06:51:37 | 91,273,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,952 | java | package name.bluesman80;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.stream.Stream;
public class Main
{
private static final List<String> IMAGE_EXTENSIONS = Arrays.asList("jpg", "png");
private static final List<String> VIDEO_EXTENSIONS = Arrays.asList("mpg", "mp4", "mpeg");
public static void main(String[] args)
{
if (args.length < 2)
{
System.out.println("Usage: frt <source path> <target path>");
return;
}
String sourcePath = args[0];
String targetFilePath = args[1];
boolean getNameFromCreationDate = true;
if (args.length == 3)
{
getNameFromCreationDate = Boolean.valueOf(args[2]);
}
if (!Files.exists(Paths.get(sourcePath)))
{
System.err.println("Source path does not exist: " + sourcePath);
}
Path targetPathForFiles = createPathIfNotExists(targetFilePath);
if (targetPathForFiles == null)
{
return;
}
try (Stream<Path> paths = Files.walk(Paths.get(sourcePath)).sorted())
{
Map<String, Integer> fileNameCountMap = new HashMap<>();
int fileCount = 1;
for (Iterator<Path> pathIterator = paths.iterator(); pathIterator.hasNext(); )
{
Path file = pathIterator.next();
if (file.toFile().isFile())
{
final String fileName = file.getFileName().toString();
final String fileExtension = fileName.substring(fileName.indexOf('.') + 1, fileName.length()).toLowerCase();
final boolean isImage = IMAGE_EXTENSIONS.contains(fileExtension);
final boolean isVideo = !isImage && VIDEO_EXTENSIONS.contains(fileExtension);
if (isImage || isVideo)
{
System.out.println(String.format("Found (%s): %s", fileCount++, fileName));
try
{
String formattedFileCreationTime = getFormattedFileCreationTime(fileName);
if (formattedFileCreationTime == null || getNameFromCreationDate)
{
formattedFileCreationTime = getFormattedFileCreationTime(file);
}
if (formattedFileCreationTime == null)
{
System.err.println("\n\n***** SKIPPED A FILE: " + fileName);
return;
}
if (!fileNameCountMap.containsKey(formattedFileCreationTime))
{
fileNameCountMap.put(formattedFileCreationTime, 0);
}
final Integer currentCount = fileNameCountMap.get(formattedFileCreationTime);
final int nextCount = currentCount + 1;
fileNameCountMap.replace(formattedFileCreationTime, nextCount);
String newName =
formattedFileCreationTime + "_" + String.format("%03d", nextCount) + "." + fileExtension;
final String targetSubPath = formattedFileCreationTime.substring(0, 6);
targetPathForFiles = createPathIfNotExists(targetFilePath + "/" + targetSubPath);
if (targetPathForFiles != null)
{
final Path finalTargetPath = Paths.get(targetPathForFiles + "/" + newName);
if (Files.exists(finalTargetPath))
{
// FIXME Change the hard coded extension
//@formatter:off
newName = newName.substring(0, newName.indexOf('.'))
+ "-"
+ String.valueOf(System.currentTimeMillis()).substring(8, 13)
+ ".jpg";
//@formatter:on
}
Files.copy(file, targetPathForFiles.resolve(newName));
System.out.println(String.format("\t\tCopied file to: %s as %s", targetSubPath, newName));
}
else
{
System.err.println("Error creating target sub-directory: " + targetSubPath);
}
}
catch (final IOException e)
{
e.printStackTrace();
}
}
}
}
}
catch (final IOException e)
{
e.printStackTrace();
}
}
private static Path createPathIfNotExists(String path)
{
final Path targetPath = Paths.get(path);
if (!Files.exists(targetPath))
{
try
{
Files.createDirectory(targetPath);
System.out.println("\nTarget path is created: " + path);
System.out.println("\n\n");
}
catch (final IOException e)
{
System.err.println("Error creating the target directory: " + path);
e.printStackTrace();
return null;
}
}
return targetPath;
}
private static String getFormattedFileCreationTime(final String fileName)
{
String result = null;
try
{
final int beginIndex = fileName.indexOf("20");
result = fileName.substring(beginIndex, beginIndex + 8);
}
catch (StringIndexOutOfBoundsException e)
{
// do nothing
}
return result;
}
private static String getFormattedFileCreationTime(final Path file)
{
String result = null;
try
{
final BasicFileAttributes fileAttributes = Files.readAttributes(file, BasicFileAttributes.class);
final String fileTimeString = fileAttributes.creationTime().toString();
result = fileTimeString.substring(0, 10).replace("-", "");
}
catch (IOException e)
{
e.printStackTrace();
}
return result;
}
}
| [
"bluesman80@gmail.com"
] | bluesman80@gmail.com |
643617af3df2ec8207a3643e844ffc5a206a99c8 | e6608016c6256250baee02b9eecfa2d7065fee00 | /app/src/main/java/com/example/tavio_syrus_gblokpo/iai_vote/Adapter/EtudiantListeView.java | fb092675dda9646433e3189a98f641add7790ed7 | [] | no_license | taviosyrus/IAIVote | dcf62be2ebf73756b6f3dc55e4682fda3205d4a4 | 67e378041c8af09f1cd49395b342343e74887da7 | refs/heads/master | 2020-05-02T12:06:42.653601 | 2019-03-27T08:21:41 | 2019-03-27T08:21:41 | 177,949,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,176 | java | package com.example.tavio_syrus_gblokpo.iai_vote.Adapter;
import android.app.Activity;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.SearchView;
import android.widget.TextView;
import com.example.tavio_syrus_gblokpo.iai_vote.InfoEtudiant;
import com.example.tavio_syrus_gblokpo.iai_vote.R;
import com.example.tavio_syrus_gblokpo.iai_vote.Traitement.CircleImageView;
import com.squareup.picasso.Picasso;
public class EtudiantListeView extends ArrayAdapter<String> {
private String[] idEt;
private String[] NomEt;
private String[] photo_util;
private Activity context;
public EtudiantListeView(Activity context, String[] idEt, String [] NomEt, String[] photo_util){
super(context, R.layout.activity_list_etud,idEt);
this.context = context;
this.idEt = idEt;
this.NomEt = NomEt;
this.photo_util = photo_util;
}
@NonNull
@Override
public View getView(final int position, @Nullable View convertView,@NonNull ViewGroup parent) {
View r = convertView;
EtudiantListeView.ViewHolder viewHolder = null;
if(r==null){
LayoutInflater layoutInflater = context.getLayoutInflater();
r = layoutInflater.inflate(R.layout.activity_list_etud,null,false);
viewHolder = new EtudiantListeView.ViewHolder(r);
r.setTag(viewHolder);
}else{
viewHolder =(EtudiantListeView.ViewHolder) r.getTag();
}
viewHolder.idEt.setText(idEt[position]);
viewHolder.NomEt.setText(NomEt[position]);
viewHolder.photo=(photo_util[position]);
Picasso.with(getContext()).load("http://192.168.43.12/image/"+viewHolder.photo)
.placeholder(R.mipmap.ic_picasso_erreur_round)
.error(R.mipmap.ic_picasso_erreur_round)
.into(viewHolder.photo_util);
return r;
}
class ViewHolder{
CardView cardView;
TextView NomEt;
TextView idEt;
SearchView rech;
TextView id;
String photo;
CircleImageView photo_util;
ViewHolder(View v){
idEt =(TextView) v.findViewById(R.id.idEt);
NomEt =(TextView) v.findViewById(R.id.nomEt);
rech = (SearchView) v.findViewById(R.id.rech);
id =(TextView) v.findViewById(R.id.idEt);
cardView=(CardView) v.findViewById(R.id.cardView);
photo_util = (CircleImageView)v.findViewById(R.id.photo_util);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String ir = id.getText().toString();
Intent intent=new Intent(v.getContext(),InfoEtudiant.class);
v.getContext().startActivity(intent.putExtra("toto",""+ir));
}
});
}
}
}
| [
"octaviogblokpo@gmail.com"
] | octaviogblokpo@gmail.com |
65efc987de505a4ccaed8bdeb90c85749af0ccfb | 5fbd39a0ab153bb69b4bb5030693e4e9f8e1fe08 | /Rent/src/com/babel/rent/SaveRent.java | a4cc169ac50795f553b028f7b173b3ce4af9d9c8 | [] | no_license | lucyos/Rent | 1f8a7205a2df0c151eb062d185e003ff0248bd9b | 1b98d447df9a2b363f872073c072b2d742e05d6b | refs/heads/master | 2016-09-15T15:25:23.993218 | 2014-10-30T18:12:54 | 2014-10-30T18:12:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | package com.babel.rent;
import com.babel.core.function.crud.Update;
public interface SaveRent extends Update {
/**
*
* @param p
*/
public Rent saveRent(Rent p);
} | [
"las.lucian@gmail.com"
] | las.lucian@gmail.com |
70b56b5822a23494a38dfe5340ebe6a42be2d7bf | 7e4d5f697ae65f7200970838e8c0b89fcdc3557e | /src/t08_ExamPreparations/e17_6_March_2016/p06_StupidPasswordGenerator.java | fc4aad89650a094304a4373c45f6af6534fc472d | [
"MIT"
] | permissive | Packo0/SoftUniProgrammingBasics | bfa9ec503e6d3e748dcffe5c5abd95415c5a9658 | cca6d3691623d709668affe8f6916eb5f3ec66ae | refs/heads/master | 2021-08-23T02:49:11.452302 | 2017-12-02T17:36:20 | 2017-12-02T17:36:20 | 107,976,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,107 | java | package t08_ExamPreparations.e17_6_March_2016;
import java.util.Scanner;
public class p06_StupidPasswordGenerator {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.nextLine());
int l = Integer.parseInt(scan.nextLine());
for (int symbol1 = 1; symbol1 <= n; symbol1++) {
for (int symbol2 = 1; symbol2 <= n; symbol2++) {
for (char symbol3 = 'a'; symbol3 < 'a' + l; symbol3++) {
for (char symbol4 = 'a'; symbol4 < 'a' + l; symbol4++) {
for (int symbol5 = Math.max(symbol1, symbol2) + 1; symbol5 <= n; symbol5++) {
System.out.print(symbol1);
System.out.print(symbol2);
System.out.print(symbol3);
System.out.print(symbol4);
System.out.print(symbol5);
System.out.print(" ");
}
}
}
}
}
}
}
| [
"pdimitrov1389@gmail.com"
] | pdimitrov1389@gmail.com |
e421f99e66c931b65e7c68badf5f84c631a42647 | 3c94b8c233741ecd8026acdf74965f43fbb792be | /Camera_source_code/sources/android/support/p000v4/media/session/MediaSessionCompatApi22.java | 74a8a4e6276b7bcb1a04d14fd70a7fac2980da04 | [] | no_license | parimalingle1805/hackathon_4.0_15 | 80d096cfd0f872e7e9395954fd9368d73ec593f8 | f6cb57ade27dc9660263ecbdcb2f0844281fd227 | refs/heads/master | 2023-03-28T12:58:22.283335 | 2021-03-31T10:53:06 | 2021-03-31T10:53:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package android.support.p000v4.media.session;
import android.media.session.MediaSession;
/* renamed from: android.support.v4.media.session.MediaSessionCompatApi22 */
class MediaSessionCompatApi22 {
public static void setRatingType(Object obj, int i) {
((MediaSession) obj).setRatingType(i);
}
private MediaSessionCompatApi22() {
}
}
| [
"parimal.ingle18@gmail.com"
] | parimal.ingle18@gmail.com |
28ad6481e2779ad9b718cb4fc55a4bac02483b3e | 8272d419fc67aa349ed896958f4169428f59cfb0 | /src/main/java/net/segoia/util/calculator/CalculatorSymbols.java | 0b96ecaaf50235f03ffbe99a7190579c868e9e5a | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | acionescu/commons | 0819407135bee9397acc9762622bf5006b30f83a | f089dc73b38e35ff2aa0228657ac798e5672ef01 | refs/heads/master | 2022-12-10T21:26:57.295690 | 2020-11-18T08:55:46 | 2020-11-18T08:55:46 | 1,415,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | /**
* commons - Various Java Utils
* Copyright (C) 2009 Adrian Cristian Ionescu - https://github.com/acionescu
*
* 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 net.segoia.util.calculator;
public class CalculatorSymbols {
public static final String OPEN_GROUP= "(";
public static final String CLOSE_GROUP =")";
}
| [
"adrian.ionescu.consulting@gmail.com"
] | adrian.ionescu.consulting@gmail.com |
4a7370c59d1d5bfcb264a68195f31b8d1216fea3 | 4d00d30fd40b9cdd588c65c5ce245845e607946f | /src/main/java/me/itzdabbzz/siege/database/MySQL.java | 85794926cee33a807bf20f9a08d4a163a48b30a0 | [] | no_license | ItzDabbzz/MinigameR6Siege | 3c26c55d9340564c85938f0e2fd71b12cb28b852 | 24acb5ac62f5d1f25e88d756c0f96d13ad468f4f | refs/heads/main | 2023-02-25T12:32:22.780158 | 2021-01-28T07:14:17 | 2021-01-28T07:14:17 | 333,676,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,958 | java | package me.itzdabbzz.siege.database;
import me.itzdabbzz.siege.Objects.User;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.UUID;
public class MySQL {
protected final Connection connection;
private MySQL(Connection connection) {
this.connection = connection;
}
public void createTables() throws SQLException {
connection.createStatement().execute(
"CREATE TABLE `playerData` (\n" +
"\t`playerId` INT NOT NULL AUTO_INCREMENT,\n" +
"\t`uuid` VARCHAR(42) unique,\n" +
"\t`name` VARCHAR(32),\n" +
"\t`lastIp` VARCHAR(40),\n" +
"\t`lastLogin` DATETIME,\n" +
"\t`onlineTime` BIGINT,\n" +
"\t`firstLogin` DATETIME,\n" +
"\t`KD` INT DEFAULT '0',\n" +
"\t`Kills` INT DEFAULT '0',\n" +
"\t`Deaths` INT DEFAULT '0',\n" +
"\t`Wins` INT DEFAULT '0',\n" +
"\t`Losses` INT DEFAULT '0',\n" +
"\t`Revives` INT DEFAULT '0',\n" +
"\t`attack` TEXT DEFAULT 'No Op',\n" +
"\t`defense` TEXT DEFAULT 'No Op',\n" +
"\tPRIMARY KEY (`playerId`)\n" +
");"
);
ResultSet rs = connection.createStatement().executeQuery("SELECT COUNT(*) as counter FROM player_data");
rs.next();
if (rs.getInt("counter") == 0) {
// Console is UUID 00000000-0000-0000-0000-000000000000
connection.createStatement().execute("INSERT INTO player_data(uuid, last_name, last_ip) VALUES ('00000000-0000-0000-0000-000000000000', '*Console*', '127.0.0.1');");
}
}
public void updatePlayer(UUID player, String lastName, String ip) throws SQLException {
PreparedStatement ps = connection.prepareStatement("SELECT COUNT(*) as count FROM player_data WHERE uuid = ?");
ps.setString(1, player.toString());
int count;
try (ResultSet set = ps.executeQuery()) {
set.next();
count = set.getInt("count");
}
if (count == 0) {
// Insert.
ps = connection.prepareStatement("insert into player_data(uuid, last_name, last_seen, last_ip) VALUES (?, ?, ? ,?);");
ps.setString(1, player.toString());
ps.setString(2, lastName);
ps.setTimestamp(3, new java.sql.Timestamp(new Date().getTime()));
ps.setString(4, ip);
ps.executeUpdate();
} else {
// Update.
ps = connection.prepareStatement("update player_data set last_name = ?, last_seen = ?, last_ip = ? where uuid = ?;");
ps.setString(4, player.toString());
ps.setString(1, lastName);
ps.setTimestamp(2, new java.sql.Timestamp(new Date().getTime()));
ps.setString(3, ip);
ps.executeUpdate();
}
}
public User getPlayerInfo(UUID uuid) throws SQLException {
PreparedStatement ps = connection.prepareStatement("SELECT uuid, last_name, last_ip, last_seen FROM player_data WHERE uuid = ?");
ps.setString(1, uuid.toString());
try (ResultSet rs = ps.executeQuery()) {
if (rs.next()) {
return new User(uuid, rs.getString("last_name"), rs.getString("last_ip"), new Date(rs.getTimestamp("last_seen").getTime()));
}
return null;
}
}
private Integer getIdForPlayerFromUUID(UUID uuid) throws Exception {
PreparedStatement ps = connection.prepareStatement("SELECT player_id FROM player_data WHERE uuid = ?");
ps.setString(1, uuid.toString());
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("player_id");
}
throw new Exception("No player with that UUID exists.");
}
/**
* Closes the connection. Implements java.lang.AutoClosable.
* @throws Exception
*/
public void close() throws Exception {
if (!connection.isClosed()) {
if (!connection.getAutoCommit()) {
this.rollbackTransaction();
}
connection.close();
}
}
private java.sql.Timestamp getCurrentDate() {
return new java.sql.Timestamp(new Date().getTime());
}
public void startTransaction() throws SQLException {
connection.setAutoCommit(false);
}
public void commitTransaction() throws SQLException {
connection.commit();
connection.setAutoCommit(true);
}
public void rollbackTransaction() throws SQLException {
connection.rollback();
connection.setAutoCommit(true);
}
}
| [
"ItzDabbzz@gmail.com"
] | ItzDabbzz@gmail.com |
0379a7d5b92e7ba9a95f9f5536687cf2997dd04b | 0e30f234a830c8e1ba78687d36eab01ab81f492b | /org.jpat.scuba.external.slf4j/logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java | 933273ac61c2e6fd42afc65fe490a278f7959b32 | [
"MIT",
"EPL-1.0",
"LGPL-2.1-only"
] | permissive | JPAT-ROSEMARY/SCUBA | 6b724d070b12f70cf68386c3f830448435714af1 | 0d7dcee9e62e724af8dc006e1399d5c3e7b77dd1 | refs/heads/master | 2022-07-23T05:06:54.121412 | 2021-04-04T21:14:29 | 2021-04-04T21:14:29 | 39,628,474 | 2 | 1 | MIT | 2022-06-29T18:54:38 | 2015-07-24T11:13:38 | HTML | UTF-8 | Java | false | false | 6,394 | java | /**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2015, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package ch.qos.logback.core.rolling;
import static ch.qos.logback.core.CoreConstants.MANUAL_URL_PREFIX;
import java.io.File;
import java.util.Date;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.joran.spi.NoAutoStart;
import ch.qos.logback.core.rolling.helper.ArchiveRemover;
import ch.qos.logback.core.rolling.helper.CompressionMode;
import ch.qos.logback.core.rolling.helper.FileFilterUtil;
import ch.qos.logback.core.rolling.helper.SizeAndTimeBasedArchiveRemover;
import ch.qos.logback.core.util.FileSize;
import ch.qos.logback.core.util.DefaultInvocationGate;
import ch.qos.logback.core.util.InvocationGate;
@NoAutoStart
public class SizeAndTimeBasedFNATP<E> extends TimeBasedFileNamingAndTriggeringPolicyBase<E> {
enum Usage {EMBEDDED, DIRECT};
int currentPeriodsCounter = 0;
FileSize maxFileSize;
// String maxFileSizeAsString;
long nextSizeCheck = 0;
static String MISSING_INT_TOKEN = "Missing integer token, that is %i, in FileNamePattern [";
static String MISSING_DATE_TOKEN = "Missing date token, that is %d, in FileNamePattern [";
private final Usage usage;
public SizeAndTimeBasedFNATP() {
this(Usage.DIRECT);
}
public SizeAndTimeBasedFNATP(Usage usage) {
this.usage = usage;
}
@Override
public void start() {
// we depend on certain fields having been initialized in super class
super.start();
if(usage == Usage.DIRECT) {
addWarn(CoreConstants.SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED);
addWarn("For more information see "+MANUAL_URL_PREFIX+"appenders.html#SizeAndTimeBasedRollingPolicy");
}
if (!super.isErrorFree())
return;
if (maxFileSize == null) {
addError("maxFileSize property is mandatory.");
withErrors();
}
if (!validateDateAndIntegerTokens()) {
withErrors();
return;
}
archiveRemover = createArchiveRemover();
archiveRemover.setContext(context);
// we need to get the correct value of currentPeriodsCounter.
// usually the value is 0, unless the appender or the application
// is stopped and restarted within the same period
String regex = tbrp.fileNamePattern.toRegexForFixedDate(dateInCurrentPeriod);
String stemRegex = FileFilterUtil.afterLastSlash(regex);
computeCurrentPeriodsHighestCounterValue(stemRegex);
if (isErrorFree()) {
started = true;
}
}
private boolean validateDateAndIntegerTokens() {
boolean inError = false;
if (tbrp.fileNamePattern.getIntegerTokenConverter() == null) {
inError = true;
addError(MISSING_INT_TOKEN + tbrp.fileNamePatternStr + "]");
addError(CoreConstants.SEE_MISSING_INTEGER_TOKEN);
}
if (tbrp.fileNamePattern.getPrimaryDateTokenConverter() == null) {
inError = true;
addError(MISSING_DATE_TOKEN + tbrp.fileNamePatternStr + "]");
}
return !inError;
}
protected ArchiveRemover createArchiveRemover() {
return new SizeAndTimeBasedArchiveRemover(tbrp.fileNamePattern, rc);
}
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) {
File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix());
File parentDir = file.getParentFile();
File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex);
if (matchingFileArray == null || matchingFileArray.length == 0) {
currentPeriodsCounter = 0;
return;
}
currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex);
// if parent raw file property is not null, then the next
// counter is max found counter+1
if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) {
// TODO test me
currentPeriodsCounter++;
}
}
InvocationGate invocationGate = new DefaultInvocationGate();
@Override
public boolean isTriggeringEvent(File activeFile, final E event) {
long time = getCurrentTime();
// first check for roll-over based on time
if (time >= nextCheck) {
Date dateInElapsedPeriod = dateInCurrentPeriod;
elapsedPeriodsFileName = tbrp.fileNamePatternWithoutCompSuffix.convertMultipleArguments(dateInElapsedPeriod, currentPeriodsCounter);
currentPeriodsCounter = 0;
setDateInCurrentPeriod(time);
computeNextCheck();
return true;
}
// next check for roll-over based on size
if (invocationGate.isTooSoon(time)) {
return false;
}
if (activeFile == null) {
addWarn("activeFile == null");
return false;
}
if (maxFileSize == null) {
addWarn("maxFileSize = null");
return false;
}
if (activeFile.length() >= maxFileSize.getSize()) {
elapsedPeriodsFileName = tbrp.fileNamePatternWithoutCompSuffix.convertMultipleArguments(dateInCurrentPeriod, currentPeriodsCounter);
currentPeriodsCounter++;
return true;
}
return false;
}
@Override
public String getCurrentPeriodsFileNameWithoutCompressionSuffix() {
return tbrp.fileNamePatternWithoutCompSuffix.convertMultipleArguments(dateInCurrentPeriod, currentPeriodsCounter);
}
public void setMaxFileSize(FileSize aMaxFileSize) {
this.maxFileSize = aMaxFileSize;
}
}
| [
"ahmadelghafari@gmail.com"
] | ahmadelghafari@gmail.com |
08d21f00fea097162423439d49bedd1fcabd4995 | 7bda7971c5953d65e33bdf054360bdf4488aa7eb | /src/com/arcsoft/office/fc/hssf/formula/eval/NameXEval.java | b9503ac02d5f8948c410dbeb5fa19abb9ee0e33b | [
"Apache-2.0"
] | permissive | daddybh/iOffice | ee5dd5938f258d7dcfc0757b1809d31662dd07ef | d1d6b57fb0d496db5c5649f5bc3751b2a1539f83 | refs/heads/master | 2021-12-10T20:47:15.238083 | 2016-09-20T12:14:17 | 2016-09-20T12:14:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | 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 com.arcsoft.office.fc.hssf.formula.eval;
import com.arcsoft.office.fc.hssf.formula.ptg.NameXPtg;
/**
* @author Josh Micich
*/
public final class NameXEval implements ValueEval {
private final NameXPtg _ptg;
public NameXEval(NameXPtg ptg) {
_ptg = ptg;
}
public NameXPtg getPtg() {
return _ptg;
}
public String toString() {
StringBuffer sb = new StringBuffer(64);
sb.append(getClass().getName()).append(" [");
sb.append(_ptg.getSheetRefIndex()).append(", ").append(_ptg.getNameIndex());
sb.append("]");
return sb.toString();
}
}
| [
"ljj@xinlonghang.cn"
] | ljj@xinlonghang.cn |
3710eb84ece889691ca27e76949aba75dd8e1184 | 68a19507f18acff18aa4fa67d6611f5b8ac8913c | /hg-standard/hg-system/src/main/java/hg/system/dto/album/AlbumDTO.java | a0bd5c71262c7278fb399cf423593e7e72e6d31a | [] | no_license | ksksks2222/pl-workspace | cf0d0be2dfeaa62c0d4d5437f85401f60be0eadd | 6146e3e3c2384c91cac459d25b27ffeb4f970dcd | refs/heads/master | 2021-09-13T08:59:17.177105 | 2018-04-27T09:46:42 | 2018-04-27T09:46:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,720 | java | package hg.system.dto.album;
import hg.system.dto.EmbeddDTO;
/**
* @类功能说明:
* @类修改者:
* @修改日期:
* @修改说明:
* @公司名称:浙江汇购科技有限公司
* @部门:技术部
* @作者:yuxx
* @创建时间:2014年9月1日下午2:44:35
*/
@SuppressWarnings("serial")
public class AlbumDTO extends EmbeddDTO {
/**
* 相册id
*/
private String id;
/**
* 相册标题
*/
private String title;
/**
* 相册备注
*/
private String remark;
/**
* 所有者id
*/
private String ownerId;
/**
* 例 景区联盟:JQLM
*/
private String projectId;
/**
* 例 联盟主站相册:001 景点专属相册:002
*/
private Integer useType;
/**
* 上级节点
*/
private AlbumDTO parent;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public Integer getUseType() {
return useType;
}
public void setUseType(Integer useType) {
this.useType = useType;
}
public AlbumDTO getParent() {
return parent;
}
public void setParent(AlbumDTO parent) {
this.parent = parent;
}
}
| [
"cangsong6908@gmail.com"
] | cangsong6908@gmail.com |
072235fec1edef0af9a74165a3050387126a9fac | 10c66f6c3b41c7aca028a5502abf202324b2043c | /src/Controlador/CpfBrasileros.java | 9ee5336198c7fbe803215f42761c9182e4afc1aa | [] | no_license | pildoraselectricas/cedulas-JAVA | b29e67fe0bee9ac0332854460d4e91201b725694 | f74a24058e50c6d24c9c7f6d4a35095b0c0ede30 | refs/heads/main | 2023-01-28T21:07:59.228987 | 2020-12-06T19:11:36 | 2020-12-06T19:11:36 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 18,091 | java | package Controlador;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.io.*;
import sun.audio.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import java.awt.Font;
import java.awt.Image;
import javax.swing.JTabbedPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Scanner;
import java.awt.event.ActionEvent;
import javax.swing.JTextArea;
public class CpfBrasileros extends JFrame {
Codigo codigo = new Codigo();
private JPanel contentPane;
private JTextField textFieldNumero3;
private JTextField textFieldNumero2;
private JTextField textFieldNumero1;
private JTextField textFieldNumero6;
private JTextField textFieldNumero5;
private JTextField textFieldNumero4;
private JTextField textFieldNumero7;
private JButton btnNewButton;
private JButton btnCerrar;
private JPanel panel_3;
private JTextArea textAreaResumen;
private int limite = 1;
private JButton btnInfo;
Icon imgBr = new ImageIcon(getClass().getResource("/Img/br2.png"));
private JButton button;
private JTextField textFieldNumero9;
private JTextField textFieldNumero8;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CpfBrasileros frame = new CpfBrasileros();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public CpfBrasileros() {
setBackground(Color.PINK);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(400, 300, 640, 354);
contentPane = new JPanel();
contentPane.setBackground(new Color(255, 204, 51));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
textAreaResumen = new JTextArea();
textAreaResumen.setFont(new Font("Monospaced", Font.BOLD, 20));
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBounds(20, 11, 596, 280);
contentPane.add(tabbedPane);
JPanel panel = new JPanel();
panel.setForeground(new Color(0, 102, 0));
panel.setBackground(new Color(51, 204, 102));
panel.setToolTipText("");
tabbedPane.addTab("Cadastro de Pessoa Fisica", null, panel, null);
panel.setLayout(null);
JLabel lblCodigoVerificador = new JLabel("");
textFieldNumero1 = new JTextField(limite);
textFieldNumero1.setBounds(21, 25, 53, 50);
panel.add(textFieldNumero1);
textFieldNumero1.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero1.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero1.setColumns(10);
// genero que sólo pueda haber numero
textFieldNumero1.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if (c<'0'|| c>'9') event.consume();
}});
textFieldNumero2 = new JTextField();
textFieldNumero2.setBounds(84, 25, 53, 50);
panel.add(textFieldNumero2);
textFieldNumero2.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero2.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero2.setColumns(10);
textFieldNumero3 = new JTextField();
textFieldNumero3.setBounds(147, 25, 53, 50);
panel.add(textFieldNumero3);
textFieldNumero3.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero3.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero3.setColumns(10);
textFieldNumero6 = new JTextField();
textFieldNumero6.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero6.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero6.setColumns(10);
textFieldNumero6.setBounds(336, 25, 53, 50);
panel.add(textFieldNumero6);
textFieldNumero5 = new JTextField();
textFieldNumero5.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero5.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero5.setColumns(10);
textFieldNumero5.setBounds(273, 25, 53, 50);
panel.add(textFieldNumero5);
textFieldNumero4 = new JTextField();
textFieldNumero4.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero4.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero4.setColumns(10);
textFieldNumero4.setBounds(210, 25, 53, 50);
panel.add(textFieldNumero4);
textFieldNumero7 = new JTextField();
textFieldNumero7.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero7.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero7.setColumns(10);
textFieldNumero7.setBounds(399, 25, 53, 50);
panel.add(textFieldNumero7);
JLabel lblCodigoVerificador2 = new JLabel("");
lblCodigoVerificador2.setHorizontalAlignment(SwingConstants.CENTER);
lblCodigoVerificador2.setForeground(new Color(0, 0, 0));
lblCodigoVerificador2.setFont(new Font("Tahoma", Font.BOLD, 30));
lblCodigoVerificador2.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
lblCodigoVerificador2.setBounds(336, 136, 118, 94);
panel.add(lblCodigoVerificador2);
JButton btnGenerarCdigo = new JButton("Generar C\u00F3digo");
btnGenerarCdigo.setForeground(Color.WHITE);
btnGenerarCdigo.setBackground(new Color(0, 0, 0));
btnGenerarCdigo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
codigo.sonidos();
try{
String n1= textFieldNumero1.getText();
double num1 = Double.parseDouble(n1);
String n2= textFieldNumero2.getText();
double num2 = Double.parseDouble(n2);
String n3= textFieldNumero3.getText();
double num3 = Double.parseDouble(n3);
String n4= textFieldNumero4.getText();
double num4 = Double.parseDouble(n4);
String n5= textFieldNumero5.getText();
double num5 = Double.parseDouble(n5);
String n6= textFieldNumero6.getText();
double num6 = Double.parseDouble(n6);
String n7= textFieldNumero7.getText();
double num7 = Double.parseDouble(n7);
String n8= textFieldNumero8.getText();
double num8 = Double.parseDouble(n8);
String n9= textFieldNumero9.getText();
double num9 = Double.parseDouble(n9);
// ----------------- APLICO LOS MÉTODOS PARA EL PRIMER CÓDIGO VERIFICADOR ---------------
double resultado = codigo.multiplicacionPrimeraBr(num1, num2, num3, num4, num5, num6, num7, num8, num9);
double codigoVerificador = codigo.sacarCodigoVerificadorPrimeroBr(resultado);
int codigoVerificador2 = (int) Math.ceil(codigoVerificador);
// ----------------- APLICO LOS MÉTODOS PARA EL SEGUNDO CÓDIGO VERIFICADOR ---------------
double resultadoMultiplicoCodigoVerif = codigoVerificador2 *2;
double sumar = codigo.multiplicacionSegundaBr(num1, num2, num3, num4, num5, num6, num7, num8, num9);
int sumarInt = (int) Math.ceil(sumar);
double sumaTotal = resultadoMultiplicoCodigoVerif+sumar;
double resultadoCodigoVerifSegundo = codigo.sacarCodigoVerificadorSegundoBr(sumaTotal);
int codigoVerificador3 = (int) Math.ceil(resultadoCodigoVerifSegundo);
// ---------------------- CODIGO VERIFICADOR ----------------
String codVerif = String.valueOf(codigoVerificador2);
lblCodigoVerificador.setText(codVerif);
String codVerifSegundo = String.valueOf(codigoVerificador3);
lblCodigoVerificador2.setText(codVerifSegundo);
}catch (Exception error){
JOptionPane.showMessageDialog(null, "Debes ingresar todos los numeros, gracias","Deberías prestar más atención",JOptionPane.ERROR_MESSAGE, imgBr);
}
}
});
btnGenerarCdigo.setBounds(21, 102, 556, 23);
panel.add(btnGenerarCdigo);
btnNewButton = new JButton("Resumen");
btnNewButton.setForeground(Color.WHITE);
btnNewButton.setBackground(new Color(0, 0, 0));
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
codigo.sonidoPasar();
try{
textAreaResumen.setText("\tRESUMEN DE CPF:\n\n"
+"\t"+textFieldNumero1.getText()+textFieldNumero2.getText()+textFieldNumero3.getText()+
textFieldNumero4.getText()+textFieldNumero5.getText()+textFieldNumero6.getText()+
textFieldNumero7.getText()+
textFieldNumero8.getText()+textFieldNumero9.getText()+"-"+lblCodigoVerificador.getText()+lblCodigoVerificador2.getText()
);
}catch(Exception error){
JOptionPane.showMessageDialog(null, "Debes ingresar todos los numeros y crear el verificador primero, gracias");
}
}
});
btnNewButton.setBounds(464, 136, 113, 23);
panel.add(btnNewButton);
btnCerrar = new JButton("Cerrar");
btnCerrar.setForeground(Color.WHITE);
btnCerrar.setBackground(new Color(0, 0, 0));
btnCerrar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
codigo.sonidoCerrar();
CpfBrasileros.this.dispose();
}
});
btnCerrar.setBounds(464, 207, 113, 23);
panel.add(btnCerrar);
JButton btnResetear = new JButton("Resetear");
btnResetear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
codigo.sonidoLimpiar();
textFieldNumero1.setText(null);
textFieldNumero2.setText(null);
textFieldNumero3.setText(null);
textFieldNumero4.setText(null);
textFieldNumero5.setText(null);
textFieldNumero6.setText(null);
textFieldNumero7.setText(null);
textFieldNumero8.setText(null);
textFieldNumero9.setText(null);
lblCodigoVerificador.setText(null);
lblCodigoVerificador2.setText(null);
}
});
btnResetear.setForeground(Color.WHITE);
btnResetear.setBackground(new Color(0, 0, 0));
btnResetear.setBounds(464, 173, 113, 23);
panel.add(btnResetear);
JLabel lblImagen = new JLabel("");
lblImagen.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
lblImagen.setBounds(21, 136, 179, 94);
// ------------------ AGREGO IMAGEN AL JLABEL ------------------------
ImageIcon imagen2 = new ImageIcon(CpfBrasileros.class.getResource("/Img/br.png"));
Image imag2 = imagen2.getImage().getScaledInstance(lblImagen.getWidth(), lblImagen.getHeight(), Image.SCALE_SMOOTH);
lblImagen.setIcon(new ImageIcon(imag2));
panel.add(lblImagen);
lblCodigoVerificador.setHorizontalAlignment(SwingConstants.CENTER);
lblCodigoVerificador.setForeground(Color.BLACK);
lblCodigoVerificador.setFont(new Font("Tahoma", Font.BOLD, 30));
lblCodigoVerificador.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
lblCodigoVerificador.setBounds(210, 136, 118, 94);
panel.add(lblCodigoVerificador);
textFieldNumero9 = new JTextField();
textFieldNumero9.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero9.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero9.setColumns(10);
textFieldNumero9.setBounds(525, 25, 53, 50);
panel.add(textFieldNumero9);
textFieldNumero8 = new JTextField();
textFieldNumero8.setHorizontalAlignment(SwingConstants.CENTER);
textFieldNumero8.setFont(new Font("Tahoma", Font.BOLD, 17));
textFieldNumero8.setColumns(10);
textFieldNumero8.setBounds(462, 25, 53, 50);
panel.add(textFieldNumero8);
panel_3 = new JPanel();
tabbedPane.addTab("Resumen", null, panel_3, null);
panel_3.setLayout(null);
textAreaResumen.setBounds(10, 5, 465, 247);
panel_3.add(textAreaResumen);
btnInfo = new JButton("");
btnInfo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, "Creado el 08/11/2016","Información developer",JOptionPane.ERROR_MESSAGE, imgBr);
}
});
btnInfo.setBounds(603, 293, 13, 11);
contentPane.add(btnInfo);
button = new JButton("");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, "Estamos buscando trabajo, \nen todas partes del Mundo. \n\nSi buscas developers, agradezco nos tenga presente\n\nCel: +598 091074131 - 095036103","Información importante",JOptionPane.ERROR_MESSAGE, imgBr);
}
});
button.setBounds(580, 293, 13, 11);
contentPane.add(button);
// -------------------- LIMITO LA ENTRADA DE LOS TEXT-FIELD A NUMERICO -----------------------
// genero que sólo pueda haber numero
textFieldNumero2.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if (c<'0'|| c>'9') event.consume();
}});
// genero que sólo pueda haber numero
textFieldNumero3.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if (c<'0'|| c>'9') event.consume();
}});
// genero que sólo pueda haber numero
textFieldNumero4.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if (c<'0'|| c>'9') event.consume();
}});
// genero que sólo pueda haber numero
textFieldNumero5.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if (c<'0'|| c>'9') event.consume();
}});
// genero que sólo pueda haber numero
textFieldNumero6.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if (c<'0'|| c>'9') event.consume();
}});
// genero que sólo pueda haber numero
textFieldNumero7.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if ((c<'0'|| c>'9')) event.consume();
}});
// genero que sólo pueda haber numero
textFieldNumero8.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if (c<'0'|| c>'9') event.consume();
}});
// genero que sólo pueda haber numero
textFieldNumero9.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
if ((c<'0'|| c>'9')) event.consume();
}});
// --------------------- BLOQUEA LA CANTIDAD DE NUMEROS A INGRESAR
// limito cantidad de ingresos por textfield
textFieldNumero1.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero1.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero2.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero2.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero3.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero3.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero4.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero4.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero5.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero5.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero6.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero6.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero7.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero7.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero8.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero8.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
// limito cantidad de ingresos por textfield
textFieldNumero9.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e)
{if (textFieldNumero9.getText().length()== limite)
e.consume(); }
public void keyPressed(KeyEvent arg0) {
}
public void keyReleased(KeyEvent arg0) {
}
});
}
}
| [
"me.webs.design@gmail.com"
] | me.webs.design@gmail.com |
51c9bf5a4e7b9cb9022f73bd9222e095bd299dda | b8eb41324819f04078607f92f57856b4fe096731 | /src/main/java/com/pescaria/course/repositories/OrderItemRepository.java | 6d7a1d9772e22770de773b32532523ba6aae1843 | [] | no_license | crisaoo/course-springboot-2-java-11 | 8e00a0484ed6405c660982f810f44aaee5ff08cf | daabbba674db79d291ff8357d0732e36bb9fa336 | refs/heads/master | 2022-11-26T16:25:44.228347 | 2020-08-11T20:00:25 | 2020-08-11T20:00:25 | 284,148,402 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.pescaria.course.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import com.pescaria.course.entities.OrderItem;
import com.pescaria.course.entities.pk.OrderItemPK;
public interface OrderItemRepository extends JpaRepository<OrderItem, OrderItemPK> {}
| [
"Cristianocosta2019@outlook.com"
] | Cristianocosta2019@outlook.com |
6f2a87c09431cf27de7f5b865b99e5580b6db58a | d87d35482bfc70a1ab5c32946ad5e50515c734ce | /src/test/java/com/imooc/o2o/service/ProductServiceTest.java | 31a36264614496e6ac2166c1b9451201acf1d0db | [] | no_license | JiaHui-Chen1/Jia | e651db5f2fcaff344cfd2de3d696e9b9015b0e61 | 6c59f772f41081b1786fd8fd73e62bae0b39c2e8 | refs/heads/master | 2023-06-10T08:18:15.509491 | 2021-06-26T18:50:12 | 2021-06-26T18:50:12 | 316,759,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,825 | java | package com.imooc.o2o.service;
import com.imooc.o2o.BaseTest;
import com.imooc.o2o.dto.ImageHolder;
import com.imooc.o2o.dto.ProductExecution;
import com.imooc.o2o.entity.Product;
import com.imooc.o2o.entity.ProductCategory;
import com.imooc.o2o.entity.Shop;
import com.imooc.o2o.enums.ProductStateEnum;
import com.imooc.o2o.exceptions.ShopOperationException;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class ProductServiceTest extends BaseTest {
@Autowired
private ProductService productService;
@Test
/*@Ignore*/
public void testAddProduct() throws ShopOperationException, FileNotFoundException {
// 创建shopId为1且productCategoryId为1的商品实例并给其成员变量赋值
Product product = new Product();
Shop shop = new Shop();
shop.setShopId(1L);
ProductCategory pc = new ProductCategory();
pc.setProductCategoryId(1L);
product.setShop(shop);
product.setProductCategory(pc);
product.setProductName("测试商品1");
product.setProductDesc("测试商品1");
product.setPriority(20);
product.setCreateTime(new Date());
product.setEnableStatus(ProductStateEnum.SUCCESS.getState());
// 创建缩略图文件流
File thumbnailFile = new File("/Users/baidu/work/image/wen.jpg");
InputStream is = new FileInputStream(thumbnailFile);
ImageHolder thumbnail = new ImageHolder(thumbnailFile.getName(), is);
// 创建两个商品详情图文件流并将他们添加到详情图列表中
File productImg1 = new File("/Users/baidu/work/image/wen.jpg");
InputStream is1 = new FileInputStream(productImg1);
File productImg2 = new File("/Users/baidu/work/image/dabai.jpg");
InputStream is2 = new FileInputStream(productImg2);
List<ImageHolder> productImgList = new ArrayList<ImageHolder>();
productImgList.add(new ImageHolder(productImg1.getName(), is1));
productImgList.add(new ImageHolder(productImg2.getName(), is2));
// 添加商品并验证
ProductExecution pe = productService.addProduct(product, thumbnail, productImgList);
assertEquals(ProductStateEnum.SUCCESS.getState(), pe.getState());
}
@Test
public void testModifyProduct() throws ShopOperationException, FileNotFoundException {
// 创建shopId为1且productCategoryId为1的商品实例并给其成员变量赋值
Product product = new Product();
Shop shop = new Shop();
shop.setShopId(1L);
ProductCategory pc = new ProductCategory();
pc.setProductCategoryId(1L);
product.setProductId(1L);
product.setShop(shop);
product.setProductCategory(pc);
product.setProductName("正式的商品");
product.setProductDesc("正式的商品");
// 创建缩略图文件流
File thumbnailFile = new File("/Users/baidu/work/image/ercode.jpg");
InputStream is = new FileInputStream(thumbnailFile);
ImageHolder thumbnail = new ImageHolder(thumbnailFile.getName(), is);
// 创建两个商品详情图文件流并将他们添加到详情图列表中
File productImg1 = new File("/Users/baidu/work/image/xiaohuangren.jpg");
InputStream is1 = new FileInputStream(productImg1);
File productImg2 = new File("/Users/baidu/work/image/dabai.jpg");
InputStream is2 = new FileInputStream(productImg2);
List<ImageHolder> productImgList = new ArrayList<ImageHolder>();
productImgList.add(new ImageHolder(productImg1.getName(), is1));
productImgList.add(new ImageHolder(productImg2.getName(), is2));
// 添加商品并验证
ProductExecution pe = productService.modifyProduct(product, thumbnail, productImgList);
assertEquals(ProductStateEnum.SUCCESS.getState(), pe.getState());
}
}
| [
"“你"
] | “你 |
371aff9a439e7195053a4708ede0113470714114 | d95426b581f1c381c71eea00753b76b4bd2fd8f2 | /winterface-core/src/main/java/com/github/snoblind/winterface/util/NodeListIterator.java | 322e469ecf07b2bd6d3a2eb583f6a6dad618bbbf | [] | no_license | snoblind/winterface | 69bb1240e1bbb7dc42069f671119659fafb57f7e | e80f2919460c5bd7212b3b25212cbbf57703f832 | refs/heads/master | 2021-01-10T20:13:32.380309 | 2014-05-20T12:40:23 | 2014-05-20T12:40:23 | 9,152,092 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 721 | java | package com.github.snoblind.winterface.util;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import static org.apache.commons.lang.Validate.notNull;
public class NodeListIterator implements Iterator<Node> {
private final NodeList nodeList;
private int index = 0;
public NodeListIterator(NodeList nodeList) {
notNull(nodeList);
this.nodeList = nodeList;
}
public boolean hasNext() {
return index < nodeList.getLength();
}
public Node next() {
if (hasNext()) {
return nodeList.item(index++);
}
else {
throw new NoSuchElementException();
}
}
public void remove() {
throw new UnsupportedOperationException();
}
} | [
"mattmannnyc@gmail.com"
] | mattmannnyc@gmail.com |
79c9ae53bff17c3d9450a1d873804bb8baa6dcea | f4c7bdc5d38b4cded19e97a369b977fd7007791e | /src/com/spimax/back/entity/VideoType.java | e743486b686f4cfb823f1c0a8b23074dcf474aaf | [] | no_license | jerhe/WebVideoProject | 182fb983b1a45ceafc06856a3cd9b8feb26062b5 | b1dfd45cc39e00f4ffaf0751251f7a1ede94ac4e | refs/heads/master | 2021-08-31T12:20:53.945279 | 2017-12-21T08:26:16 | 2017-12-21T08:26:16 | 108,146,714 | 3 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,139 | java | package com.spimax.back.entity;
/**
* 视频类型的实体类
* @author zhuzhen
*
*/
public class VideoType {
private int VIDEOTYPEID;
private String VIDEOTYPENAME;
private int VIDEOTYPEPARENT;
public VideoType() {
// TODO Auto-generated constructor stub
}
public int getVIDEOTYPEID() {
return VIDEOTYPEID;
}
public void setVIDEOTYPEID(int vIDEOTYPEID) {
VIDEOTYPEID = vIDEOTYPEID;
}
public String getVIDEOTYPENAME() {
return VIDEOTYPENAME;
}
public void setVIDEOTYPENAME(String vIDEOTYPENAME) {
VIDEOTYPENAME = vIDEOTYPENAME;
}
public int getVIDEOTYPEPARENT() {
return VIDEOTYPEPARENT;
}
public void setVIDEOTYPEPARENT(int vIDEOTYPEPARENT) {
VIDEOTYPEPARENT = vIDEOTYPEPARENT;
}
@Override
public String toString() {
return "VideoType [VIDEOTYPEID=" + VIDEOTYPEID + ", VIDEOTYPENAME=" + VIDEOTYPENAME + ", VIDEOTYPEPARENT="
+ VIDEOTYPEPARENT + "]";
}
public VideoType(int vIDEOTYPEID, String vIDEOTYPENAME, int vIDEOTYPEPARENT) {
super();
VIDEOTYPEID = vIDEOTYPEID;
VIDEOTYPENAME = vIDEOTYPENAME;
VIDEOTYPEPARENT = vIDEOTYPEPARENT;
}
}
| [
"zhuzhen@DESKTOP-RR83RV9"
] | zhuzhen@DESKTOP-RR83RV9 |
a8362b5797c83f1679be2cab5bc7c4e70b721205 | 2945f71ee097c46e5b6f0ce8c59e7de627bfac08 | /src/main/java/cn/n3ro/ghostclient/module/modules/RENDER/ESP.java | 9aebebcc59e677bda59ddf7b79e47853b29beaaa | [] | no_license | optimize-2/N3ro | a7118ebf179aa33ee90424a00ca4c92bfe7d10bc | d0068823311dae61acaf542699472ee54fdf6b4d | refs/heads/master | 2023-07-09T04:55:02.423024 | 2021-08-20T14:40:01 | 2021-08-20T14:40:01 | 356,775,980 | 6 | 1 | null | 2021-08-20T14:40:01 | 2021-04-11T05:32:12 | null | UTF-8 | Java | false | false | 416 | java | package cn.n3ro.ghostclient.module.modules.RENDER;
import cn.n3ro.ghostclient.events.EventRender3D;
import cn.n3ro.ghostclient.module.Category;
import cn.n3ro.ghostclient.module.Module;
import com.darkmagician6.eventapi.EventTarget;
public class ESP extends Module {
public ESP() {
super("ESP", Category.RENDER);
}
@EventTarget
public void onScreen(EventRender3D event) {
}
}
| [
"1076833325@qq.com"
] | 1076833325@qq.com |
55a1761c40fe4bb256e21ba0d90bb4b20bc4d802 | 92237641f61e9b35ff6af6294153a75074757bec | /SPRING/SpringMVC_Basic03_Annotation/src/com/controller/HelloController.java | 3ba6a11bfe44672f3b9654937f65b0d5eb46dc31 | [] | no_license | taepd/study | 8ded115765c4f804813e255d9272b727bf41ec80 | 846d3f2a5a4100225b750f00f992a640e9287d9c | refs/heads/master | 2023-03-08T13:56:57.366577 | 2022-05-08T15:24:35 | 2022-05-08T15:24:35 | 245,838,600 | 0 | 1 | null | 2023-03-05T23:54:41 | 2020-03-08T15:25:15 | JavaScript | UTF-8 | Java | false | false | 1,782 | java | package com.controller;
import java.util.Calendar;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/*
public class HelloController implements Controller {
@Override
public ModelAndView handleRequest(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
// TODO Auto-generated method stub
return null;
}
1. implements Controller 단점 : 10개의 요청이 오면 .... Controller 10개 생성
ex) ListController , DeleteController .....
2. @Controller 사용하면 method 단위로 매핑을 할 수 있다
@Controller 함수 단위 매핑
하나의 컨트롤러가 여러개의 요청을 처리 할 수 있다
*/
@Controller
public class HelloController {
public HelloController() {
System.out.println("HelloController 생성자");
}
@RequestMapping("/hello.do") //<a href="hello.do">hello.do</a>
public ModelAndView hello() {
System.out.println("[hello.do method call]");
ModelAndView mv = new ModelAndView();
mv.addObject("greeting", getGreeting());
mv.setViewName("Hello");
return mv;
}
//@RequestMapping 를 가지지 않는 별도의 함수는 필요시 생성해서 사용
private String getGreeting() {
int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
String data="";
if(hour >= 6 && hour <= 10) {
data="학습시간";
}else if(hour >= 11 && hour <= 13) {
data="배고픈 시간";
}else if(hour >= 14 && hour <= 18) {
data="졸려운 시간";
}else {
data = "go home";
}
return data;
}
@RequestMapping("/hello2.do")
public ModelAndView hello2() {
return null;
}
}
| [
"taepd1@gmail.com"
] | taepd1@gmail.com |
85187dd02039e630c51188743d6715a826c5caf6 | 939f625eb2947103432c628282cccb970264657d | /BirthdayTrackerFunction/src/test/java/com/birthdaytracker/functions/InsertBirthdayDateTest.java | a1f0d13a9f0e84fd256394cd614aec4f99d29972 | [] | no_license | shalakars4u/BirthdayTracker | 7c7ea1bcb579c1a77f2e4a7a6355df9dd75ba633 | 11b4857cc482917ef8e8cd87a8da65d8c1a2cdfa | refs/heads/master | 2023-02-17T22:43:23.822298 | 2021-01-18T07:25:48 | 2021-01-18T07:25:48 | 321,019,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,754 | java | package com.birthdaytracker.functions;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
import com.birthdaytracker.ddb.model.BirthdayTracker;
import com.birthdaytracker.module.TestModule;
import com.google.inject.Guice;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.*;
import static org.mockito.MockitoAnnotations.initMocks;
public class InsertBirthdayDateTest {
@Mock
private APIGatewayProxyRequestEvent input;
@Mock
private BirthdayTracker birthdayTracker;
private Context context;
private TestModule di;
private InsertBirthdayDateLambda sut;
@BeforeEach
public void setup() {
initMocks(this);
di = new TestModule();
when(di.dbModelFactory.create(input)).thenReturn(birthdayTracker);
when(di.response.create("SUCCESS", 200)).thenReturn(new APIGatewayProxyResponseEvent().withBody("SUCCESS").withStatusCode(200));
when(di.response.create("FAILURE", 500)).thenReturn(new APIGatewayProxyResponseEvent().withStatusCode(500).withBody("FAILURE"));
context = null;
InsertBirthdayDateLambda.setInjector(Guice.createInjector(di));
sut = new InsertBirthdayDateLambda();
}
@Test
public void constructor_AnyArgsNull_ThrowsIllegalArgumentException() {
assertThrows(IllegalArgumentException.class, () -> new InsertBirthdayDateLambda(null, di.birthdayTrackerClient,null));
assertThrows(IllegalArgumentException.class, () -> new InsertBirthdayDateLambda(di.dbModelFactory, null,null));
assertThrows(IllegalArgumentException.class, () -> new InsertBirthdayDateLambda(null, null,di.response));
}
@Test
public void handleRequest_AnyThrows_DoesNotCatch() {
doThrow(new NullPointerException("Exception")).when(di.dbModelFactory).create(input);
APIGatewayProxyResponseEvent result = sut.handleRequest(input,context);
assertEquals(500, result.getStatusCode());
assertEquals("FAILURE", result.getBody());
}
@Test
public void handleRequest_NoThrow_ReturnGeneratedResponse() throws Exception {
APIGatewayProxyResponseEvent result = sut.handleRequest(input, context);
verify(di.birthdayTrackerClient,times(1)).saveNameDateRequestMapping(birthdayTracker);
assertEquals(200, result.getStatusCode());
assertEquals("SUCCESS", result.getBody().toString());
}
}
| [
"shalakars4u@gmail.com"
] | shalakars4u@gmail.com |
6f9b9a79ed5d218220031e38201cfa5638132339 | 247329be417b5428582f40e8725855242721350e | /app/src/main/java/com/example/jian6768/team8androidca/MainActivity.java | 8e6882f8e52bf83414b40be7723bcd40091df083 | [] | no_license | jian6768/Team8AndroidCA | fa0a761e6d76cb3bf9a2dc92bac51d0ec2155cb3 | 98db64c582c5e44c50e542fd38c7cdd1e0d2983d | refs/heads/master | 2021-01-12T07:57:07.342873 | 2016-12-21T14:19:21 | 2016-12-21T14:19:21 | 77,057,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,205 | java | package com.example.jian6768.team8androidca;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button);
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String hostname = pref.getString("hostname","localhost");
button.setOnClickListener(this);
}
@Override
public void onClick(View v) {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = pref.edit();
editor.putString("hostname","myorg.net");
editor.commit();
Intent i = new Intent(this,CategoryActivity.class);
startActivity(i);
}
}
| [
"Khiong Jian Chua"
] | Khiong Jian Chua |
2aea5d1a07e4887d96b8a333ce7015d4972855bb | 8903afdfb10ec0ec1bafd7c672a1d8bb334d0f17 | /src/server/TCPServer.java | 30f3a18a2a662866b2afa60a21ab8f1935c76297 | [] | no_license | Montivs/TCPsendMessage | 6c7ade18ce229caafcbc8ff1f5da3fc34a22811f | fd209c4bd903ad5fbf8477bac4ce748d627a2a49 | refs/heads/master | 2023-02-22T01:16:11.718174 | 2021-01-22T18:00:09 | 2021-01-22T18:00:09 | 332,023,749 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package server;
import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class TCPServer {
private final int port;
public final static int PORTNUMBER = 4444;
public final String message = "Message from Server!";
public TCPServer(int port) {
this.port = port;
}
public static void main(String[]args) throws IOException, InterruptedException {
TCPServer tcpServer = new TCPServer(PORTNUMBER);
tcpServer.sendMessage();
}
private void sendMessage() throws IOException, InterruptedException {
ServerSocket srvSocket = new ServerSocket(this.port);
System.out.println("server socket created");
Socket socket = srvSocket.accept();
System.out.println("client connection accpted");
socket.getInputStream().read();
System.out.println("read something");
OutputStream os = socket.getOutputStream();
os.write(message.getBytes());
System.out.println("write something");
Thread.sleep(5000);
System.out.println("sleep");
os.close();
System.out.println("server closed");
}
}
| [
"montiversus@gmail.com"
] | montiversus@gmail.com |
e5e7d6d3f999c903da7254481eab159867ffbed6 | efceccd784003d47d022c48338d836fe39f9136c | /thinking-in-java/src/main/java/chapter22/gui/MonitoredLongRunningCallable.java | 7ca9c24fba23e18b603795abc9399883ecbfe47d | [] | no_license | jackode/most-java | 2be3f3a43c7b5f993c2d2eb5137ff1cf04134b2f | b4c4117a75a1829f076771b0a9e86ed4b3baf06f | refs/heads/master | 2021-01-10T10:27:36.638351 | 2015-09-23T15:10:09 | 2015-09-23T15:10:09 | 43,008,509 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,874 | java | //: chapter22.gui/MonitoredLongRunningCallable.java
// Displaying task progress with ProgressMonitors.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.concurrent.*;
import chapter07.net.mindview.util.*;
import static chapter07.net.mindview.util.SwingConsole.*;
class MonitoredCallable implements Callable<String> {
private static int counter = 0;
private final int id = counter++;
private final ProgressMonitor monitor;
private final static int MAX = 8;
public MonitoredCallable(ProgressMonitor monitor) {
this.monitor = monitor;
monitor.setNote(toString());
monitor.setMaximum(MAX - 1);
monitor.setMillisToPopup(500);
}
public String call() {
System.out.println(this + " started");
try {
for(int i = 0; i < MAX; i++) {
TimeUnit.MILLISECONDS.sleep(500);
if(monitor.isCanceled())
Thread.currentThread().interrupt();
final int progress = i;
SwingUtilities.invokeLater(
new Runnable() {
public void run() {
monitor.setProgress(progress);
}
}
);
}
} catch(InterruptedException e) {
monitor.close();
System.out.println(this + " interrupted");
return "Result: " + this + " interrupted";
}
System.out.println(this + " completed");
return "Result: " + this + " completed";
}
public String toString() { return "Task " + id; }
};
public class MonitoredLongRunningCallable extends JFrame {
private JButton
b1 = new JButton("Start Long Running Task"),
b2 = new JButton("End Long Running Task"),
b3 = new JButton("Get results");
private TaskManager<String,MonitoredCallable> manager =
new TaskManager<String,MonitoredCallable>();
public MonitoredLongRunningCallable() {
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MonitoredCallable task = new MonitoredCallable(
new ProgressMonitor(
MonitoredLongRunningCallable.this,
"Long-Running Task", "", 0, 0)
);
manager.add(task);
System.out.println(task + " added to the queue");
}
});
b2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for(String result : manager.purge())
System.out.println(result);
}
});
b3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for(String result : manager.getResults())
System.out.println(result);
}
});
setLayout(new FlowLayout());
add(b1);
add(b2);
add(b3);
}
public static void main(String[] args) {
run(new MonitoredLongRunningCallable(), 200, 500);
}
} ///:~
| [
"jiankliu@ebay.com"
] | jiankliu@ebay.com |
a6e97216840ff3d9e31890feb02fe557080d9c68 | ebbeb39a795010a72a70bc75d784b551f949fa38 | /src/com/gft/ItemPedido.java | 10a62b3997ac1ef24b997516c0b002bed6e93f85 | [] | no_license | RenanBezerra/TDD-Essencial-PedidoVendas | 08c57cd33c35ba6201d444939e182fbc06cb86cb | 52950ba1daa051632d3a194303bfe77fda6dc546 | refs/heads/master | 2021-05-17T04:20:15.081001 | 2020-03-30T17:11:32 | 2020-03-30T17:11:32 | 250,620,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 714 | java | package com.gft;
public class ItemPedido {
private String string;
private double valorUnitario;
private int quantidade;
public ItemPedido(String string, double valorUnitario, int quantidade) {
this.string = string;
this.valorUnitario = valorUnitario;
this.quantidade = quantidade;
}
public String getString() {
return string;
}
public void setString(String string) {
this.string = string;
}
public double getValorUnitario() {
return valorUnitario;
}
public void setValorUnitario(double valorUnitario) {
this.valorUnitario = valorUnitario;
}
public double getQuantidade() {
return quantidade;
}
public void setQuantidade(int quantidade) {
this.quantidade = quantidade;
}
} | [
"renanbg90@gmail.com"
] | renanbg90@gmail.com |
a72f9c32f9dba171bccd37ebff02ac2b686b97fb | da1788418627790658f64d108f2b56efc893c603 | /Hua/src/main/java/com/example/hua/huachuang/fragment/FragmentSetting.java | ea045eb8a0727d58943532af2589d9ab5d24f9dc | [] | no_license | huafresh/HuaMusic-Java | 00b9276a71f5bb561aed5bd2c6e639fe7e20c624 | 8ef6d30d82a2a4a6ebf36182b29f62e6ceee3af0 | refs/heads/master | 2021-08-31T22:45:38.271723 | 2017-12-23T06:47:45 | 2017-12-23T06:47:45 | 115,007,520 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,754 | java | package com.example.hua.huachuang.fragment;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.example.hua.huachuang.R;
import com.example.hua.huachuang.bean.music.SettingInfo;
import com.example.hua.huachuang.databinding.FragmentSettingBinding;
import com.example.hua.huachuang.utils.CommonUtil;
import com.example.hua.huachuang.utils.DensityUtil;
import com.example.hua.huachuang.zhy.CommonAdapter;
import com.example.hua.huachuang.zhy.ViewHolder;
import java.util.List;
/**
* Created by hua on 2017/3/9.
*/
public class FragmentSetting extends Fragment{
private ListView mListView;
private FragmentSettingBinding mContentView;
private CommonAdapter adapter;
private List<SettingInfo> mListDates;
private TextView mTitleTextView;
private String mTitle;
private SwitchCompat switchCompat;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mContentView = DataBindingUtil.inflate(LayoutInflater.from(getActivity()),R.layout.fragment_setting,null,false);
initViews();
initListView();
return mContentView.getRoot();
}
private void initViews() {
mListView = mContentView.settingList;
mTitleTextView = mContentView.settingTitle;
}
private int dip2px(float value) {
return DensityUtil.dip2px(getActivity(),value);
}
private float getDimen(int resId) {
return getActivity().getResources().getDimension(resId);
}
private void initListView() {
if(mTitle!=null)
mTitleTextView.setText(mTitle);
else mTitleTextView.setText("无标题");
if(mListDates==null)
throw new NullPointerException("必须调用setListDates设置数据源");
adapter = new CommonAdapter<SettingInfo>(getActivity(), R.layout.fragment_setting_item, mListDates) {
@Override
protected void convert(ViewHolder viewHolder, SettingInfo item, int position) {
doConvert(viewHolder,item,position);
}
};
mListView.setAdapter(adapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CommonUtil.toast("item");
}
});
}
public void add(FragmentManager fm, @IdRes int idRes) {
FragmentTransaction ft = fm.beginTransaction();
ft.add(idRes,this);
ft.commit();
}
public void setTitle(String title) {
mTitle = title;
}
public void setListDates(List<SettingInfo> listDates) {
mListDates = listDates;
}
private void doConvert(ViewHolder viewHolder, SettingInfo item, int position) {
viewHolder.setText(R.id.setting_text,item.getText());
if(item.getSubText()!=null) {
viewHolder.setVisible(R.id.setting_sub_text,true);
viewHolder.setText(R.id.setting_sub_text,item.getSubText());
}
if(item.isSelect()) {
viewHolder.setChecked2(R.id.switch_compat,true);
} else viewHolder.setChecked2(R.id.switch_compat,false);
if(item.isNoDivider())
viewHolder.setVisible(R.id.setting_divider,false);
}
private void doSelectClick(View v) {
SettingInfo info = (SettingInfo) v.getTag();
SwitchCompat compat = (SwitchCompat) v.findViewById(R.id.switch_compat);
if(!info.isSelect()) {
compat.setChecked(true);
info.setSelect(true);
} else {
compat.setChecked(false);
info.setSelect(false);
}
//网络设置第一个设置项
// if(info.getFlag().equals(SettingInfo.flags.NET_FIRST)) {
// SettingInfo info2 = mListDates.get(1);
// SettingInfo info3 = mListDates.get(2);
// if(info.isSelect()) {
// info2.setCanClick(false);
// info3.setCanClick(false);
// } else {
// info2.setCanClick(true);
// info3.setCanClick(true);
// }
// adapter.notifyDataSetChanged();
// }
}
}
| [
"2587168099@qq.com"
] | 2587168099@qq.com |
53c54572667ca87b273b9701b3d604821535fc1b | e8aca36eee6e35f90d221c830c4dff30277c6a47 | /src/main/java/com/warehouse/data/MathTest.java | 2cd80579352a87a28a09a95e50e89416b7c1bc8b | [] | no_license | strawhat925/trans-data | 9e0c950efe959d3674f67028e4060a28e8bac229 | 66a47039d2cb427b1e0400de024bd0476029061a | refs/heads/master | 2022-07-02T11:47:35.271560 | 2019-06-17T02:50:24 | 2019-06-17T02:50:24 | 87,403,928 | 0 | 0 | null | 2022-06-21T00:03:11 | 2017-04-06T08:13:43 | Java | UTF-8 | Java | false | false | 1,937 | java | package com.warehouse.data;
/**
* ${DESCRIPTION}
*
* @author zli
* @create 2019-06-01 11:28
**/
public class MathTest {
public static void main(String[] args) {
/**
* Math.sqrt() 计算平方根 如果一个数的平方等于a,那么这个数就是a的平方根,也叫做a的二次方根 例如:5X5=25, 5就是25的平方根
* Math.cbrt() 计算立方根 x³=a x为a的立方根
* Math.pow(a,b) 计算a的b次方
* Math.max() 计算最大值
* Math.min() 计算最小值
*/
System.out.println(Math.sqrt(16)); //4.0
System.out.println(Math.cbrt(8)); //2.0
System.out.println(Math.pow(3, 2)); //9.0
System.out.println(Math.max(2, 3)); //3
System.out.println(Math.min(2, 3)); //2
/**
* Math.abs() 求绝对值
*/
System.out.println(Math.abs(-10.6)); //10.6
System.out.println(Math.abs(10.1)); //10.1
/**
* ceil天花板的意思,返回最大值
*/
System.out.println(Math.ceil(-10.1)); //-10.0
System.out.println(Math.ceil(10.7)); //11.0
/**
* floor地板的意思,返回最小值
*/
System.out.println(Math.floor(-10.1)); //-11.0
System.out.println(Math.floor(10.7)); //10.0
/**
* Math.random() 取得一个大于或者等于0.0小于不等于1.0的随机数
*/
System.out.println(Math.random());
/**
* Math.rint() 四舍五入
* .5只有基数时,四舍五入
*/
System.out.println(Math.rint(10.1)); //10.0
System.out.println(Math.rint(11.5)); //12.0
System.out.println(Math.rint(12.5)); //12.0
/**
* Math.round() 四舍五入
*/
System.out.println(Math.round(10.1)); //10
System.out.println(Math.round(10.5)); //11
}
}
| [
"strawhat925@163.com"
] | strawhat925@163.com |
cec5e19819a6d4087772c1eab992824fbafbd764 | 73106e02bc7a076c55a33bcdf41cd362b885f179 | /src/ua/Nazar/Rep/filter/CriteriaFemale.java | d780969a581baff00eeb2e83f06bcdb3675dd404 | [] | no_license | RepNazar/Patterns | 342ae796e42fb432b8352ab651c0b16ccf9e86e8 | fd10ca7b347af95ff4f24fe78da9959c1c4fc829 | refs/heads/master | 2022-11-26T09:06:54.576623 | 2020-07-16T16:43:51 | 2020-07-16T16:43:51 | 280,105,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | package ua.Nazar.Rep.filter;
import java.util.ArrayList;
import java.util.List;
public class CriteriaFemale implements Criteria {
@Override
public List<Person> meetCriteria(List<Person> persons) {
List<Person> femalePersons = new ArrayList<Person>();
for (Person person:persons) {
if(person.getGender().equalsIgnoreCase("female")){
femalePersons.add(person);
}
}
return femalePersons;
}
}
| [
"Repyanski@mail.ru"
] | Repyanski@mail.ru |
2260df43a66b789b578f0b833c218c51a07004b9 | 1a51c2b3efe80ebb96d82332b436f0fb2018e7b3 | /Spring/spring_mybatis/src/main/java/kr/or/iei/notice/controller/NoticeController.java | faeb0e880ae17aa0dabc202b2b7357f8686354a9 | [] | no_license | Orcablast/StudyJava | a045f12b1c9dea8df86b422bd8ef407b9c6335f1 | 7ce5a6917cb14039493b291341949fbc0523fccd | refs/heads/master | 2022-12-26T00:16:18.169579 | 2020-07-14T09:28:35 | 2020-07-14T09:28:35 | 236,952,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,853 | java | package kr.or.iei.notice.controller;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import kr.or.iei.notice.model.service.NoticeService;
import kr.or.iei.notice.model.vo.Notice;
import kr.or.iei.notice.model.vo.NoticePageData;
@Controller
public class NoticeController {
@Autowired
@Qualifier("noticeService")
private NoticeService service;
@RequestMapping(value = "/modifyNotice.do")
public String modifyNotice(Notice n, HttpServletRequest request, Model m, MultipartFile file) {
File f = null;
if(file != null && !file.isEmpty()) {
// 저장 경로
String savePath = request.getSession().getServletContext().getRealPath("/resources/upload/notice/");
// 저장한 실제 파일명
String originFileName = file.getOriginalFilename();
// 확장자를 제외한 파일명
String onlyFileName = originFileName.substring(0,originFileName.lastIndexOf("."));
// 파일의 확장자
String extension = originFileName.substring(originFileName.lastIndexOf("."));
String filepath = onlyFileName+"_"+getCurrentTime()+extension;
String fullpath = savePath+filepath;
try {
byte[] bytes = file.getBytes();
} catch (IOException e) {
}
}
return null;
}
@RequestMapping(value = "/modifyNoticeFrm.do")
public String modifyNoticeFrm(Notice n, Model m) {
Notice selectNotice = service.selectOneNotice(n);
m.addAttribute("n", selectNotice);
return "notice/modifyNotice";
}
@RequestMapping(value = "/deleteNotice.do")
public String deleteNotice(Notice n, Model m) {
int result = service.deleteNotice(n);
if(result>0) {
m.addAttribute("msg","게시글 삭제 성공");
m.addAttribute("loc","/noticeList.do?reqPage=1");
} else {
m.addAttribute("msg","게시글 삭제 실패");
m.addAttribute("loc","/noticeView.do?noticeNo="+n.getNoticeNo());
}
return "common/msg";
}
@RequestMapping(value = "/noticeView.do")
public String noticeView(Notice n, Model m) {
Notice selectNotice = service.selectOneNotice(n);
m.addAttribute("n",selectNotice);
return "notice/noticeView";
}
@RequestMapping(value = "/noticeList.do")
public String noticeList(String reqPage, Model m) {
NoticePageData pd = service.noticeList(Integer.parseInt(reqPage));
m.addAttribute("list", pd.getList());
m.addAttribute("pageNavi",pd.getPageNavi());
return "notice/noticeList";
}
@RequestMapping(value="/noticeWriteFrm.do")
public String noticeWriteFrm() {
return "notice/noticeFrm";
}
@RequestMapping(value = "/noticeWrite.do")
public String noticeWrite(HttpServletRequest request, MultipartFile file, Notice n, Model m) {
System.out.println(n.getNoticeTitle());
System.out.println(n.getNoticeWriter());
System.out.println(n.getNoticeContent());
File f = null;
if(!file.isEmpty()) {
// 저장 경로
String savePath = request.getSession().getServletContext().getRealPath("/resources/upload/notice/");
// 업로드한 파일의 실제 파일명
String originFileName = file.getOriginalFilename();
// 확장자를 제외한 파일명
String onlyFilename = originFileName.substring(0,originFileName.lastIndexOf("."));
// 확장자 -> .txt
String extension = originFileName.substring(originFileName.lastIndexOf("."));
String filepath = onlyFilename+"_"+getCurrentTime()+extension;
String fullpath = savePath+filepath;
try {
byte[] bytes = file.getBytes();
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(fullpath)));
bos.write(bytes);
bos.close();
System.out.println("파일 업로드 완료");
} catch (IOException e) {
e.printStackTrace();
}
n.setFilename(originFileName);
n.setFilepath(filepath);
f = new File(fullpath);
}
int result = service.insertNotice(n);
if(result>0) {
m.addAttribute("msg", "등록 성공");
m.addAttribute("loc","/");
} else {
if(f != null && f.exists()) {
f.delete();
System.out.println("파일 삭제됨");
}
m.addAttribute("msg", "등록 실패");
m.addAttribute("loc","/");
}
return "common/msg";
}
public long getCurrentTime() {
Calendar today = Calendar.getInstance();
return today.getTimeInMillis();
}
}
| [
"59005472+Orcablast@users.noreply.github.com"
] | 59005472+Orcablast@users.noreply.github.com |
367edac3ca59f1932895f4719cccc58481c33645 | 8191bea395f0e97835735d1ab6e859db3a7f8a99 | /com.miui.calculator_source_from_JADX/com/miui/support/preference/VolumePreference.java | 313d29f2996f9ba9a134329fd964fc482655fd3a | [] | no_license | msmtmsmt123/jadx-1 | 5e5aea319e094b5d09c66e0fdb31f10a3238346c | b9458bb1a49a8a7fba8b9f9a6fb6f54438ce03a2 | refs/heads/master | 2021-05-08T19:21:27.870459 | 2017-01-28T04:19:54 | 2017-01-28T04:19:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,567 | java | package com.miui.support.preference;
import android.app.Dialog;
import android.content.Context;
import android.database.ContentObserver;
import android.media.AudioManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.HandlerThread;
import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.preference.Preference.BaseSavedState;
import android.preference.PreferenceManager;
import android.preference.PreferenceManager.OnActivityStopListener;
import android.provider.Settings.System;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import com.miui.support.internal.C0264R;
import com.miui.support.internal.variable.Android_Graphics_Drawable_Drawable_class;
import com.miui.support.reflect.Field;
import com.miui.support.reflect.Method;
public class VolumePreference extends SeekBarDialogPreference implements OnActivityStopListener, OnKeyListener {
private static final Method f3535a;
private static final Method f3536b;
private static final int f3537c;
private int f3538d;
private SeekBarVolumizer f3539e;
private static class SavedState extends BaseSavedState {
public static final Creator<SavedState> CREATOR;
VolumeStore f3520a;
/* renamed from: com.miui.support.preference.VolumePreference.SavedState.1 */
final class C04141 implements Creator<SavedState> {
C04141() {
}
public /* synthetic */ Object createFromParcel(Parcel parcel) {
return m5209a(parcel);
}
public /* synthetic */ Object[] newArray(int i) {
return m5210a(i);
}
public SavedState m5209a(Parcel parcel) {
return new SavedState(parcel);
}
public SavedState[] m5210a(int i) {
return new SavedState[i];
}
}
public SavedState(Parcel parcel) {
super(parcel);
this.f3520a = new VolumeStore();
this.f3520a.f3533a = parcel.readInt();
this.f3520a.f3534b = parcel.readInt();
}
public void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(this.f3520a.f3533a);
parcel.writeInt(this.f3520a.f3534b);
}
VolumeStore m5211a() {
return this.f3520a;
}
public SavedState(Parcelable parcelable) {
super(parcelable);
this.f3520a = new VolumeStore();
}
static {
CREATOR = new C04141();
}
}
public class SeekBarVolumizer implements Callback, OnSeekBarChangeListener {
final /* synthetic */ VolumePreference f3522a;
private Context f3523b;
private Handler f3524c;
private AudioManager f3525d;
private int f3526e;
private int f3527f;
private Ringtone f3528g;
private int f3529h;
private SeekBar f3530i;
private int f3531j;
private ContentObserver f3532k;
/* renamed from: com.miui.support.preference.VolumePreference.SeekBarVolumizer.1 */
class C04151 extends ContentObserver {
final /* synthetic */ SeekBarVolumizer f3521a;
C04151(SeekBarVolumizer seekBarVolumizer, Handler handler) {
this.f3521a = seekBarVolumizer;
super(handler);
}
public void onChange(boolean z) {
super.onChange(z);
if (this.f3521a.f3530i != null && this.f3521a.f3525d != null) {
this.f3521a.f3530i.setProgress(this.f3521a.f3525d.getStreamVolume(this.f3521a.f3526e));
}
}
}
public SeekBarVolumizer(VolumePreference volumePreference, Context context, SeekBar seekBar, int i) {
this(volumePreference, context, seekBar, i, null);
}
public SeekBarVolumizer(VolumePreference volumePreference, Context context, SeekBar seekBar, int i, Uri uri) {
this.f3522a = volumePreference;
this.f3529h = -1;
this.f3531j = -1;
this.f3532k = new C04151(this, this.f3524c);
this.f3523b = context;
this.f3525d = (AudioManager) context.getSystemService("audio");
this.f3526e = i;
this.f3530i = seekBar;
HandlerThread handlerThread = new HandlerThread("VolumePreference.CallbackHandler");
handlerThread.start();
this.f3524c = new Handler(handlerThread.getLooper(), this);
m5212a(seekBar, uri);
}
private void m5212a(SeekBar seekBar, Uri uri) {
seekBar.setMax(this.f3525d.getStreamMaxVolume(this.f3526e));
this.f3527f = this.f3525d.getStreamVolume(this.f3526e);
seekBar.setProgress(this.f3527f);
seekBar.setOnSeekBarChangeListener(this);
this.f3523b.getContentResolver().registerContentObserver(System.getUriFor(System.VOLUME_SETTINGS[this.f3526e]), false, this.f3532k);
if (uri == null) {
if (this.f3526e == 2) {
uri = System.DEFAULT_RINGTONE_URI;
} else if (this.f3526e == 5) {
uri = System.DEFAULT_NOTIFICATION_URI;
} else {
uri = System.DEFAULT_ALARM_ALERT_URI;
}
}
this.f3528g = RingtoneManager.getRingtone(this.f3523b, uri);
if (this.f3528g != null) {
this.f3528g.setStreamType(this.f3526e);
}
}
public boolean handleMessage(Message message) {
switch (message.what) {
case Android_Graphics_Drawable_Drawable_class.LAYOUT_DIRECTION_LTR /*0*/:
this.f3525d.setStreamVolume(this.f3526e, this.f3529h, 0);
break;
case Android_Graphics_Drawable_Drawable_class.LAYOUT_DIRECTION_RTL /*1*/:
m5218g();
break;
case C0264R.styleable.Window_windowSplitActionBar /*2*/:
m5220i();
break;
default:
Log.e("VolumePreference", "invalid SeekBarVolumizer message: " + message.what);
break;
}
return true;
}
private void m5217f() {
this.f3524c.removeMessages(1);
this.f3524c.sendMessageDelayed(this.f3524c.obtainMessage(1), m5227c() ? 1000 : 0);
}
private void m5218g() {
if (!m5227c()) {
this.f3522a.m5232a(this);
if (this.f3528g != null) {
this.f3528g.play();
}
}
}
private void m5219h() {
this.f3524c.removeMessages(1);
this.f3524c.removeMessages(2);
this.f3524c.sendMessage(this.f3524c.obtainMessage(2));
}
private void m5220i() {
if (this.f3528g != null) {
this.f3528g.stop();
}
}
public void m5221a() {
m5219h();
this.f3523b.getContentResolver().unregisterContentObserver(this.f3532k);
this.f3530i.setOnSeekBarChangeListener(null);
}
public void m5224b() {
this.f3525d.setStreamVolume(this.f3526e, this.f3527f, 0);
}
public void onProgressChanged(SeekBar seekBar, int i, boolean z) {
if (z) {
m5222a(i);
}
}
void m5222a(int i) {
this.f3529h = i;
this.f3524c.removeMessages(0);
this.f3524c.sendMessage(this.f3524c.obtainMessage(0));
}
public void onStartTrackingTouch(SeekBar seekBar) {
}
public void onStopTrackingTouch(SeekBar seekBar) {
m5217f();
}
public boolean m5227c() {
return this.f3528g != null && this.f3528g.isPlaying();
}
public void m5228d() {
m5219h();
}
public void m5225b(int i) {
this.f3530i.incrementProgressBy(i);
m5222a(this.f3530i.getProgress());
m5217f();
this.f3531j = -1;
}
public void m5229e() {
if (this.f3531j != -1) {
this.f3530i.setProgress(this.f3531j);
m5222a(this.f3531j);
m5217f();
this.f3531j = -1;
return;
}
this.f3531j = this.f3530i.getProgress();
this.f3530i.setProgress(0);
m5219h();
m5222a(0);
}
public void m5223a(VolumeStore volumeStore) {
if (this.f3529h >= 0) {
volumeStore.f3533a = this.f3529h;
volumeStore.f3534b = this.f3527f;
}
}
public void m5226b(VolumeStore volumeStore) {
if (volumeStore.f3533a != -1) {
this.f3527f = volumeStore.f3534b;
this.f3529h = volumeStore.f3533a;
m5222a(this.f3529h);
}
}
}
public static class VolumeStore {
public int f3533a;
public int f3534b;
public VolumeStore() {
this.f3533a = -1;
this.f3534b = -1;
}
}
static {
f3535a = Method.of(PreferenceManager.class, "registerOnActivityStopListener", "(Landroid/preference/PreferenceManager$OnActivityStopListener;)V");
f3536b = Method.of(PreferenceManager.class, "unregisterOnActivityStopListener", "(Landroid/preference/PreferenceManager$OnActivityStopListener;)V");
f3537c = m5230a();
}
private static int m5230a() {
try {
return Field.of("android.R.styleable", "VolumePreference_streamType", Field.INT_SIGNATURE_PRIMITIVE).getInt(null);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
this.f3539e = new SeekBarVolumizer(this, getContext(), (SeekBar) view.findViewById(C0264R.id.seekbar), this.f3538d);
f3535a.invoke(PreferenceManager.class, getPreferenceManager(), this);
view.setOnKeyListener(this);
view.setFocusableInTouchMode(true);
view.requestFocus();
}
public boolean onKey(View view, int i, KeyEvent keyEvent) {
if (this.f3539e == null) {
return true;
}
boolean z = keyEvent.getAction() == 0;
switch (i) {
case C0264R.styleable.Window_immersionViewItemBackground /*24*/:
if (!z) {
return true;
}
this.f3539e.m5225b(1);
return true;
case C0264R.styleable.Window_immersionTextColor /*25*/:
if (!z) {
return true;
}
this.f3539e.m5225b(-1);
return true;
case 164:
if (!z) {
return true;
}
this.f3539e.m5229e();
return true;
default:
return false;
}
}
protected void onDialogClosed(boolean z) {
super.onDialogClosed(z);
if (!(z || this.f3539e == null)) {
this.f3539e.m5224b();
}
m5231b();
}
public void onActivityStop() {
if (this.f3539e != null) {
this.f3539e.m5219h();
}
}
private void m5231b() {
f3536b.invoke(PreferenceManager.class, getPreferenceManager(), this);
if (this.f3539e != null) {
Dialog dialog = getDialog();
if (dialog != null && dialog.isShowing()) {
View findViewById = dialog.getWindow().getDecorView().findViewById(C0264R.id.seekbar);
if (findViewById != null) {
findViewById.setOnKeyListener(null);
}
this.f3539e.m5224b();
}
this.f3539e.m5221a();
this.f3539e = null;
}
}
protected void m5232a(SeekBarVolumizer seekBarVolumizer) {
if (this.f3539e != null && seekBarVolumizer != this.f3539e) {
this.f3539e.m5228d();
}
}
protected Parcelable onSaveInstanceState() {
Parcelable onSaveInstanceState = super.onSaveInstanceState();
if (isPersistent()) {
return onSaveInstanceState;
}
SavedState savedState = new SavedState(onSaveInstanceState);
if (this.f3539e != null) {
this.f3539e.m5223a(savedState.m5211a());
}
return savedState;
}
protected void onRestoreInstanceState(Parcelable parcelable) {
if (parcelable == null || !parcelable.getClass().equals(SavedState.class)) {
super.onRestoreInstanceState(parcelable);
return;
}
SavedState savedState = (SavedState) parcelable;
super.onRestoreInstanceState(savedState.getSuperState());
if (this.f3539e != null) {
this.f3539e.m5226b(savedState.m5211a());
}
}
}
| [
"eggfly@qq.com"
] | eggfly@qq.com |
3ca012b8e12e47e1f876ab2e677c1ec89a9bb168 | b0852d4f7953362ac46e7af3e30d27a80f12e37f | /src/com/neusoft/util/CommonUtil.java | face2e54d1ac18a860f0332de479f93258ca790f | [] | no_license | xiongshx/javaLearn | d388ff9ea56c05db708d393812038994457da363 | e48f5d5f52dcb424b34d976dbee03e5df76170c0 | refs/heads/master | 2021-01-13T09:29:14.396054 | 2020-05-19T06:52:19 | 2020-05-19T06:52:19 | 72,087,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 607 | java | package com.neusoft.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class CommonUtil {
public static String randomUUID(){
String uuid = java.util.UUID.randomUUID().toString();
uuid = uuid.replaceAll("-", "");
return uuid;
}
public static long convertStrToDate(String dateStr,String dateFormat){
java.util.Date date = new java.util.Date();
try {
DateFormat format = new SimpleDateFormat(dateFormat);
date = format.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
return date.getTime();
}
}
| [
"554199013@"
] | 554199013@ |
99ce3e6e6696e5339a2ea19cf14c73f76c2c534a | 2239a0e767fc5eec75a0f5e174b136c40dc4c5df | /hb1product/src/hb1product/Product.java | 066eff722825e51f9a9a608feb6d898297797b0d | [] | no_license | ramyakayyam/SPDemo8 | 21544bf69924aa0af997d487062f2f76a6becceb | a9d6c09efb6d4a5b731141a5a20dc9d2f4b7fcff | refs/heads/master | 2020-04-28T08:56:35.895867 | 2019-03-12T06:29:13 | 2019-03-12T06:29:13 | 175,148,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package hb1product;
public class Product
{
private int pid;
private String pname;
private double pcost;
public int getPid()
{
return pid;
}
public String getPname()
{
return pname;
}
public void setPname(String pname)
{
this.pname = pname;
}
public double getPcost()
{
return pcost;
}
public void setPcost(double pcost)
{
this.pcost = pcost;
}
public void setPid(int pid)
{
this.pid = pid;
}
}
| [
"ramyakayyam@gmail.com"
] | ramyakayyam@gmail.com |
7fc89c8ea9887b2b411645125e824594910a80e0 | 124cc785ec08bc8814bddf39b1f1b6a3f478aebc | /vue_StudentManager/src/com/itheima/filter/LoginFilter.java | 8b940797b0bf56faec5f1163083985808578007e | [] | no_license | deadpool-fy/Java-yyds | 48a3ce5427217a24fc6dedd3ff9c47496b2df5c3 | 0c017872a65e81d8c5b4755868fe4bd0dd921952 | refs/heads/master | 2023-06-22T02:06:26.920484 | 2021-07-24T09:48:08 | 2021-07-24T09:48:08 | 376,682,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | package com.itheima.filter;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
检查登录
*/
@WebFilter(value = {"/index.html"})
public class LoginFilter implements Filter{
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) {
try{
//1.将请求和响应对象转换为和HTTP协议相关
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
//2.获取会话域对象中数据
Object username = request.getSession().getAttribute("username");
//3.判断用户名
if(username == null || "".equals(username)) {
//重定向到登录页面
response.sendRedirect(request.getContextPath() + "/login.html");
return;
}
//4.放行
filterChain.doFilter(request,response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"heimaTest@itcast.cn"
] | heimaTest@itcast.cn |
5940f8785745f90bcb31b7a0bb1836b1175b369c | 521a84d7db50771080dda0a2247cb335da97312b | /src/main/java/org/semanticweb/HermiT/model/DataRange.java | 3ecf941178e90a29eb8cfc404ce2d02916b0b590 | [] | no_license | brunodibello/Hermit_143456_metamodelado | 59d7eb80f7653c3b09fca87cfe5fc7718a26fe16 | c310f4a8fa9a7f427464672e46d36cc37673f460 | refs/heads/master | 2023-05-29T04:14:53.782465 | 2021-02-26T02:23:44 | 2021-06-13T23:23:19 | 184,952,085 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package org.semanticweb.HermiT.model;
import java.io.Serializable;
import org.semanticweb.HermiT.Prefixes;
public abstract class DataRange
implements Serializable {
private static final long serialVersionUID = 352467050584766830L;
public abstract boolean isAlwaysTrue();
public abstract boolean isAlwaysFalse();
public int getArity() {
return 1;
}
public abstract String toString(Prefixes var1);
public String toString() {
return this.toString(Prefixes.STANDARD_PREFIXES);
}
}
| [
"brunodibello@hotmail.com"
] | brunodibello@hotmail.com |
6faf01531a1e7b2bd4200b6a97919cc96e9ffceb | 5673fb2156ca4c4caac23c9235f84ba954fc9b62 | /xingsi/src/main/java/hpu/edu/xingsi/config/SwaggerConfig.java | 7519d75df7d926d83a9f475c65c19044c9c975bd | [] | no_license | zhouenxian/learn | cb39572524ac50ce6b09fd0ed2dc0922c66668b9 | d4aee879c3dd1ff83ff61ec5da4cba698703e17b | refs/heads/master | 2022-12-31T03:57:58.315345 | 2020-10-19T12:12:24 | 2020-10-19T12:12:24 | 305,377,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,328 | java | package hpu.edu.xingsi.config;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @author zhou'en'xian
* @date 2020/10/11 18:25
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {
@Bean
public Docket createApi(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("xingsi")
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.build();
}
private ApiInfo apiInfo(){
Contact contact=new Contact("zhou en xian","","2681621305@qq.com");
return new ApiInfoBuilder()
.title("行思工作室后台接口文档")
.description("行思工作室后台管理接口详解")
.termsOfServiceUrl("http:39.101.140.225:8080")
.contact(contact)
.version("0.1")
.build();
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
// 解决swagger无法访问
registry.addResourceHandler("/**")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
// 解决swagger的js文件无法访问
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
| [
"2681621305@qq.com"
] | 2681621305@qq.com |
cbe23416ef863fd72e26d142c736011bb5091dc0 | 3def5abb81134334f7c4ba1dd37a26705590f72a | /Calculator/src/Tree.java | 8ebd8a55bf626ec85a634477ba237a2f7a4e26b3 | [] | no_license | andryush/java | 8b3424e5e7c4a099326cfdae84354a984a6b8280 | 348a2ccc57aee85859f6db5c2f99f5dca213fd35 | refs/heads/master | 2020-03-28T12:25:25.074180 | 2018-10-21T16:44:34 | 2018-10-21T16:44:34 | 148,295,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | import java.applet.Applet;
import java.awt.*;
public class Tree extends Applet {
int h;
public void init() {
h = 50;
setBackground(Color.BLACK);
setSize(700,500);
}
public void paint(Graphics g) {
drawTree(g, 350, 400, -90, 7);
drawTree(g, 450, 400, -90, 5);
}
public void drawTree(Graphics gx, int x1, int y1, int alpha,int n) {
if (n == 0) return;
//int x2 = x1 + alpha;
//int y2 = y1 - h;
int x2 = x1 + (int)((n * 10) * (Math.cos(Math.toRadians(alpha))));
int y2 = y1 + (int)((n * 10) * (Math.sin(Math.toRadians(alpha))));
gx.setColor(new Color(0,n*30,0));
gx.drawLine(x1,y1,x2,y2);
gx.setColor(Color.YELLOW);
gx.drawString("*",x1,y1);
//gx.setColor(Color.GREEN);
drawTree(gx, x2, y2, alpha - 30, n-1);
drawTree(gx, x2, y2, alpha + 30, n-1);
//drawTree(gx, x2, y2, alpha + 10, n-1);
}
}
| [
"andryush333@gmail.com"
] | andryush333@gmail.com |
d3d656876018adc26c019b8235ff82476c266c92 | 7fddef3ee3e3b4dfbf21be4f8a3030d2bac9b0f2 | /src/chat7jdbc/Sender.java | bf91d930532443bc2242ccf6305bbd0f3e092bf9 | [] | no_license | zzo2741/MultiChat | 12b2b77b457214b774799a2141c7eb4f08c12717 | b9c4ec2169f41b7fdf6d09a9eee8e96d33b4ee00 | refs/heads/master | 2022-07-26T23:56:24.536363 | 2020-05-18T08:50:06 | 2020-05-18T08:50:06 | 254,581,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,304 | java | package chat7jdbc;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
// 클라이언트가 입력한 메세지를 서버로 전송해주는 쓰레드 클래스
public class Sender extends Thread
{
Socket socket;
PrintWriter out = null;
String name;
// 생성자에서 OutputStream을 생성한다.
public Sender(Socket socket, String name)
{
this.socket = socket;
try
{
out = new PrintWriter(this.socket.getOutputStream(), true);
this.name = name;
} catch (Exception e)
{
System.out.println("예외>Sender>생성자 : " + e);
}
}
@Override
public void run()
{
Scanner s = new Scanner(System.in);
try
{
// 클라이언트가 입력한 "대화명"을 서버로 전송한다.
out.println(name);
// Q를 입력하기 전까지의 메세지를 서버로 전송한다.
while (out != null)
{
try
{
String s2 = s.nextLine();
if (s2.equalsIgnoreCase("Q"))
{
break;
} else
{
out.println(s2);
}
} catch (Exception e)
{
System.out.println("예외>Sender>run1 : " + e);
}
}
out.close();
socket.close();
} catch (Exception e)
{
System.out.println("예외>Sender>run2 : " + e);
}
}
}
| [
"dlwnstmd@gmail.com"
] | dlwnstmd@gmail.com |
1261ff815d17f0299b2f08279fe83ad272ff11e1 | 85c7d74a116fd9128657035b77a11472f7795518 | /Javaee-tutorial/src/main/java/com/giit/www/entity/custom/ReviewedBookVo.java | 3893c22647c97ac99e86a0a6798caa643e4af166 | [
"Apache-2.0"
] | permissive | oniubi/github-repositories | 3773b96a38720b33f085a759dcad81a2236f6168 | 5c8e58ce2da7e2d8c38683f06cdbcb150422d896 | refs/heads/master | 2023-03-16T07:59:59.466661 | 2019-03-02T09:55:04 | 2019-03-02T09:55:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | package com.giit.www.entity.custom;
/**
* Created by c0de8ug on 16-2-16.
*/
public class ReviewedBookVo {
String bookTitle;
String isbn;
String dateOfPrinting;
String author;
String press;
int count;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getBookTitle() {
return bookTitle;
}
public void setBookTitle(String bookTitle) {
this.bookTitle = bookTitle;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getDateOfPrinting() {
return dateOfPrinting;
}
public void setDateOfPrinting(String dateOfPrinting) {
this.dateOfPrinting = dateOfPrinting;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getPress() {
return press;
}
public void setPress(String press) {
this.press = press;
}
}
| [
"evangel_a@sina.com"
] | evangel_a@sina.com |
479e31240f5b84494a7f10b2c6ff3a93d50ba870 | e77a541a6e5d48f830d48a7338ff4aceef8d15f6 | /core/src/main/java/org/kuali/kra/committee/bo/businessLogic/impl/IrbCommitteeBusinessLogicImpl.java | cf77d1d150f8b129b96b050ec0c5fa7ef4ce9e3f | [] | no_license | r351574nc3/kc-release | a9c4f78b922005ecbfbc9aba36366e0c90f72857 | d5b9ad58e906dbafa553de777207ef5cd4addc54 | refs/heads/master | 2021-01-02T15:33:46.583309 | 2012-03-17T05:38:02 | 2012-03-17T05:38:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,685 | java | /*
* Copyright 2005-2010 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
*
* 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.kuali.kra.committee.bo.businessLogic.impl;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.kuali.kra.committee.bo.Committee;
import org.kuali.kra.committee.bo.CommitteeResearchArea;
import org.kuali.kra.committee.bo.businessLogic.CommitteeCollaboratorBusinessLogicFactoryGroup;
import org.kuali.kra.committee.bo.businessLogic.CommitteeResearchAreaBusinessLogic;
import org.kuali.kra.infrastructure.KeyConstants;
import org.kuali.kra.rules.ErrorReporter;
public class IrbCommitteeBusinessLogicImpl extends CommitteeBusinessLogicImpl {
private static final String SEPERATOR = ".";
private static final String INACTIVE_RESEARCH_AREAS_PREFIX = "document.committeeList[0].committeeResearchAreas.inactive";
public IrbCommitteeBusinessLogicImpl(Committee businessObject, CommitteeCollaboratorBusinessLogicFactoryGroup committeeCollaborators) {
super(businessObject, committeeCollaborators);
}
/**
* This method will check if all the research areas that have been added to the committee are indeed active.
* It is declared public because it will be invoked from the action class for committee as well.
* @param document
* @return
*/
@Override
public boolean validateCommitteeResearchAreas() {
boolean inactiveFound = false;
StringBuffer inactiveResearchAreaIndices = new StringBuffer();
// iterate over all the research areas for the committee BO looking for inactive research areas
List<CommitteeResearchArea> cras = this.getCommitteeBusinessObject().getCommitteeResearchAreas();
if(CollectionUtils.isNotEmpty(cras)) {
int raIndex = 0;
for (CommitteeResearchArea cra : cras) {
// get collaborator for the CommitteeResearchArea BO
CommitteeResearchAreaBusinessLogic craLogic = getCommitteeCollaboratorBusinessLogicFactoryGroup().getCommitteeReserachAreaBusinessLogic(cra);
if(!(craLogic.isEnclosedResearchAreaActive())) {
inactiveFound = true;
inactiveResearchAreaIndices.append(raIndex).append(SEPERATOR);
}
raIndex++;
}
}
// if we found any inactive research areas in the above loop, report as a single error key suffixed by the list of indices of the inactive areas
if(inactiveFound) {
String committeeResearchAreaInactiveErrorPropertyKey = INACTIVE_RESEARCH_AREAS_PREFIX + SEPERATOR + inactiveResearchAreaIndices.toString();
new ErrorReporter().reportError(committeeResearchAreaInactiveErrorPropertyKey, KeyConstants.ERROR_COMMITTEE_RESEARCH_AREA_INACTIVE);
}
return !inactiveFound;
}
@Override
public boolean checkReviewType() {
return !StringUtils.isBlank(getCommitteeBusinessObject().getReviewTypeCode());
}
} | [
"r351574nc3@gmail.com"
] | r351574nc3@gmail.com |
f9b4ef07c5910d601d32bfd1dc1c972347d5e85e | 52d9d04c639e8b70b8e4ca45a19f933a29888792 | /navpage-api/src/main/java/top/twhuang/navpage/config/exception/CommonException.java | 89ff23148f5f7fd061424b6ab66c3f33e31d7d49 | [] | no_license | tw-huang/navpage | 6a165887e7c6e237f2d60cf9fcc46a648c617eba | 2a5797f201796a4dd94b4b0aac6ca3c9dacf893b | refs/heads/main | 2023-08-12T06:04:18.481860 | 2021-09-28T15:40:08 | 2021-09-28T15:40:08 | 388,747,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 237 | java | package top.twhuang.navpage.config.exception;
public class CommonException extends RuntimeException {
private static final long serialVersionUID = 1L;
public CommonException(String message) {
super(message);
}
}
| [
"tw.huang@foxmail.com"
] | tw.huang@foxmail.com |
48c52964a3463b184b7c7dac3ee905cec6cb36d2 | 08e198c0677662c2c179032dfa427925313641e9 | /pet-clinic-web/src/main/java/io/artur/spring/sfgpetclinic/controllers/IndexController.java | e2a5c278de2004cdff7af5d43574c639ed2f410c | [] | no_license | arturP/sfg-pet-clinic | 91f9383a1be4acb8a2420c5604a0c47f4e686a6a | b1f762410646413972534a818b5050a3da7110af | refs/heads/main | 2023-08-22T09:57:03.649787 | 2021-10-11T09:58:36 | 2021-10-11T09:58:36 | 413,517,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package io.artur.spring.sfgpetclinic.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
*
*/
@Controller
public class IndexController {
// method for thymelife template to find proper template file (index.html)
@RequestMapping({"", "/", "index", "index.html"})
public String index() {
return "index";
}
@RequestMapping({"/oups"})
public String errors() {
return "notimplemented";
}
}
| [
"artur2p@gmail.com"
] | artur2p@gmail.com |
1a85b6d9694e096d3a0e0e4bc71f15845c71da88 | c92d53fb801b6c9ba721f8380320f6e609f496bc | /Ranger/src/mass/Ranger/Util/WifiBriefInfo.java | 9644d2a24c0f8408aba90518750437dc937748e7 | [] | no_license | SilunWang/Ranger | 0d6977d787413a69928186c9a8ac67c2989fd889 | d0e9decf828afded57f41f648258182c48af0b00 | refs/heads/master | 2021-01-10T15:39:48.031282 | 2015-06-10T05:51:11 | 2015-06-10T05:51:11 | 36,784,591 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package mass.Ranger.Util;
public class WifiBriefInfo {
public long timestamp;
public String bssid;
public int rssi;
public int freq;
public WifiBriefInfo(long timestamp, String bssid, int rssi, int freq) {
this.timestamp = timestamp;
this.bssid = bssid;
this.rssi = rssi;
this.freq = freq;
}
}
| [
"wangsl11@mails.tsinghua.edu.cn"
] | wangsl11@mails.tsinghua.edu.cn |
a408ad137243d38e22f1b03a79926da5a342234d | aa67a76e48983c88225bcfec23547b2c1a1d3046 | /src/main/java/person/liuxx/demo/login/service/LoginService.java | 7a696736f24ae857364d1a084b7571e818854690 | [] | no_license | dark-slayers/login-demo | 340ca8d989b146de461706d8036aac71f78ee7a4 | 4ade7701a7faa694d4242dad36d5462c3496b977 | refs/heads/master | 2021-09-08T07:16:05.628371 | 2018-03-08T09:23:08 | 2018-03-08T09:23:08 | 115,705,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package person.liuxx.demo.login.service;
import java.util.Optional;
import javax.servlet.http.HttpSession;
import person.liuxx.demo.login.dto.UserDTO;
import person.liuxx.demo.login.vo.TestVO;
/**
* @author 刘湘湘
* @version 1.0.0<br>
* 创建时间:2018年1月3日 下午4:04:30
* @since 1.0.0
*/
public interface LoginService
{
String LOGIN_USER_NAME = "user";
String ADDRESS = "address";
Optional<TestVO> loginSession(HttpSession session, UserDTO user);
/**
* @author 刘湘湘
* @version 1.0.0<br>创建时间:2018年1月30日 下午4:11:13
* @since 1.0.0
* @param user
* @return
*/
Optional<TestVO> loginToken(UserDTO user);
}
| [
"23534878@qq.com"
] | 23534878@qq.com |
c26ce25e42acff66c8a2b6087883c6f208f33979 | f5abdd25405ae175a67f5a36c73bb043cd6ce48e | /app/src/main/java/com/telran/ticketsapp/data/tickets/dto/LockedSeats.java | 7351ad2ee64ccbdee0e4484ae77a46e92896690a | [] | no_license | IsLery/ticketsProjectMVP | f6fb2c70df2bd7775c72f0c403e1d9a849d3845c | d4d9051da62c01a81c6e6019f7b7aadeb6ed31a8 | refs/heads/master | 2022-11-12T05:06:46.459083 | 2020-07-06T14:34:33 | 2020-07-06T14:34:33 | 250,660,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package com.telran.ticketsapp.data.tickets.dto;
import java.util.List;
public class LockedSeats {
String row;
List<String> seats;
public LockedSeats(String row, List<String> seats) {
this.row = row;
this.seats = seats;
}
public LockedSeats() {
}
public String getRow() {
return row;
}
public void setRow(String row) {
this.row = row;
}
public List<String> getSeats() {
return seats;
}
public void setSeats(List<String> seats) {
this.seats = seats;
}
}
| [
"lereenne@gmail.com"
] | lereenne@gmail.com |
c5e9dcce8948d2ac66f4a1f6267137a1c28a602a | 02b51e62b333afb43f065813b28bec0e61d3a448 | /src/com/example/lab/s/Main.java | d7fbbc3a5bf0396e2823dcd1c5728b04e5c237ea | [] | no_license | wanilly/SQLiteProject | e6cf3d9b141f2fd01736c79b49177936d9ab9fa8 | a3332f19bca9836a9085113b04c0bc25b7311bf5 | refs/heads/master | 2023-09-01T11:49:20.055961 | 2021-10-02T01:07:57 | 2021-10-02T01:07:57 | 412,541,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,643 | java | package com.example.lab.s;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class Main {
public static void main(String [] args) {
//System.out.println("hello");
Connection con = null;
try {
//SQlite JDBC check
Class.forName("org.sqlite.JDBC");
// file connect
String dbFile = "myfirst.db";
con = DriverManager.getConnection("jdbc:sqlite:" + dbFile);
// data find
System.out.println("\n*** 데이터 조회 ***");
Statement st = con.createStatement();
String sql = "select * from g_artists";
ResultSet r = st.executeQuery(sql);
while (r.next()) {
String id = r.getString("id");
String name = r.getString("name");
String a_type = r.getString("a_type");
String a_year = r.getString("a_year");
String debut = r.getString("debut");
String regdate = r.getString("regdate");
System.out.println(id + "|" + name + "|" + a_type + "|" + a_year + "|" + debut + "|" + regdate);
// 내용 추가 가능...
}
st.close();
// 데이터 추가하기
System.out.println("\n*** 새 데이터 추가 ***");
Statement st1 = con.createStatement();
String sql1 = "insert into g_artists (name, a_type, a_year, debut, regdate)"
+ " values ('예수전도단', '혼성', '1980년대', '1980년', datetime('now', 'localtime'));";
int cnt = st1.executeUpdate(sql1);
if (cnt > 0) {
System.out.println("새로운 데이터가 추가되었습니다.");
}
else {
System.out.println("[Error] 데이터 추가 오류!");
}
st1.close();
// 데이터 수정
System.out.println("\n*** 데이터 수정 ***");
Statement st2 = con.createStatement();
String sql2 = "update g_artists set a_year = '2000년대', '2010년대', '2020년' "
+ "where id = 1;";
int cnt2 = st2.executeUpdate(sql2);
if (cnt2 >0) {
System.out.println("데이터가 수정되었습니다!");
}
else {
System.out.println("[Error] 데이터 수정 오류!");
}
st2.close();
// 데이터 삭제
System.out.println("\n*** Data Delete ***");
Statement st3 = con.createStatement();
String sql3 = "delete from g_artists where id = 10;";
int cnt3 = st3.executeUpdate(sql3);
if (cnt3 > 0) {
System.out.println("데이터가 삭제되었습니다.");
}
else {
System.out.println("[Error] 데이터 삭제 오류!");
}
st3.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (con != null) {
try {
con.close();
} catch (Exception e) {
}
}
}
}
}
| [
"wanimagic@gmail.com"
] | wanimagic@gmail.com |
a59afb8fcb1d8c37dd6e6aab5994ce1ff246b5ef | 05bb1934200ab0c3167e1609cf49db7b51b5d5f8 | /app/src/main/java/com/nsystem/ntheatre/view/activity/PopularMovieListActivity.java | 6e5177981ed21af226998ec91539d75dff317af2 | [
"Apache-2.0"
] | permissive | putragraha/MovieApps | d928d25e16de8e94b674ec6cc1b7ffa91de1d2d4 | 89dad3446c35f8c6f2fbe2d94b767526a74b1c48 | refs/heads/master | 2020-06-21T12:57:03.438635 | 2019-07-20T12:42:13 | 2019-07-20T12:42:13 | 197,457,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,750 | java | package com.nsystem.ntheatre.view.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import com.nsystem.ntheatre.R;
import com.nsystem.ntheatre.internal.di.HasComponent;
import com.nsystem.ntheatre.internal.di.components.DaggerMovieComponent;
import com.nsystem.ntheatre.internal.di.components.MovieComponent;
import com.nsystem.ntheatre.model.MovieModel;
import com.nsystem.ntheatre.view.fragment.PopularMovieListFragment;
public class PopularMovieListActivity extends BaseActivity implements
HasComponent<MovieComponent>, PopularMovieListFragment.MovieListListener {
public static Intent getCallingIntent(Context context) {
return new Intent(context, PopularMovieListActivity.class);
}
private MovieComponent movieComponent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_layout);
this.initializeInjector();
if (savedInstanceState == null) {
addFragment(R.id.fragmentContainer, new PopularMovieListFragment());
}
}
private void initializeInjector() {
this.movieComponent = DaggerMovieComponent.builder()
.applicationComponent(getApplicationComponent())
.activityModule(getActivityModule())
.build();
}
@Override
public MovieComponent getComponent() {
return movieComponent;
}
@Override
public void onMovieClicked(MovieModel movieModel) {
this.navigator.navigateToMovieDetails(this, movieModel.getMovieId());
}
}
| [
"putra.nugraha@dana.id"
] | putra.nugraha@dana.id |
ea95c159e3b8da11fcd05618167534cce848a9fc | 9ab5c7eb500d22a6c8378d47c0fca34ad980c9e5 | /api-manager/src/main/java/com/example/vo/AddApiHeadersVo.java | b701afdd1b6d030de37a504da4e2a2053115f6a4 | [] | no_license | turanorbob/communicat_tt | 60f550c6089a889efb9f553d8f416e717a52e8ef | b810de55978f594954f049e54523ab502b572566 | refs/heads/master | 2023-01-07T19:13:34.858113 | 2019-09-10T05:49:49 | 2019-09-10T05:49:49 | 149,596,119 | 0 | 0 | null | 2023-01-07T05:40:29 | 2018-09-20T11:04:42 | JavaScript | UTF-8 | Java | false | false | 533 | java | package com.example.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
/**
* @Description
* @Version v1.0.0
* @Since 1.0
* @Date 2019/5/27
*/
@Data
@ApiModel
public class AddApiHeadersVo {
@ApiModelProperty("所属API")
private String apiId;
@ApiModelProperty("key")
private String key;
@ApiModelProperty("value")
private String value;
@ApiModelProperty("description")
private String description;
}
| [
"liaojian.2008.ok@163.com"
] | liaojian.2008.ok@163.com |
c87d1c532d07a9960e60cc1ef35a5376fee4e6be | b444412ba1d6ae87c920cbd6c5cdb016f5e9500b | /burgershop/burgershop-spring-stripped/src/main/java/org/moskito/demo/burgershop/burgershopstripped/ui/ShopItemBean.java | 5f31df13c4879b588904a2eae43f8e13c603607f | [
"MIT"
] | permissive | anotheria/moskito-demo | 722aea4764144e6661f34af2bddbaeae12f4ac8d | 932d94ca5b5a218477127ec28031834544a83561 | refs/heads/master | 2023-07-21T04:43:16.126560 | 2023-01-05T23:18:25 | 2023-01-05T23:18:25 | 6,827,663 | 4 | 15 | null | 2023-07-07T21:18:04 | 2012-11-23T13:19:48 | Java | UTF-8 | Java | false | false | 594 | java | package org.moskito.demo.burgershop.burgershopstripped.ui;
/**
* TODO comment this class
*
* @author lrosenberg
* @since 16.11.13 22:28
*/
public class ShopItemBean {
private int price;
private String item;
private String nicePrice;
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getNicePrice() {
return nicePrice;
}
public void setNicePrice(String nicePrice) {
this.nicePrice = nicePrice;
}
}
| [
"esmakula@anotheria.net"
] | esmakula@anotheria.net |
37a337c71a5f27c2ad008e1bb70e944ca04915fd | 9f65517dde49c3475235b15bc01735dd34511b4f | /1126/src/service/IdolsServiceImpl.java | e27587f444c1a8be774961e523bafeb35d98486a | [] | no_license | Pakrjihoon/Spring-Study | 3903483830097b6b382571264f1ba01b58d7ec8d | 7943765eef86112d01b631180dea8f7b166d6bcb | refs/heads/master | 2020-04-18T02:55:59.628732 | 2019-01-23T12:43:46 | 2019-01-23T12:43:46 | 167,181,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package service;
import java.util.List;
import dao.IdolsDAO;
import vo.Idol;
public class IdolsServiceImpl implements IdolsService{
private IdolsDAO idolDAO;
public void setIdolDAO(IdolsDAO idolDAO) {
this.idolDAO = idolDAO;
}
@Override
public List<Idol> IdolList() {
// TODO Auto-generated method stub
return idolDAO.selectList();
}
@Override
public Idol IdolDetail(int idolId) {
// TODO Auto-generated method stub
return idolDAO.selectOne(idolId);
}
}
| [
"wlgns8852@naver.com"
] | wlgns8852@naver.com |
1e012ac9eabd4819dbcd920d3fbdb1954a721e86 | f8e300aa04370f8836393455b8a10da6ca1837e5 | /CounselorAPP/app/src/main/java/com/cesaas/android/counselor/order/label/net/GetAllTagListNet.java | b6b2931797c8d804fd2ae9bfc56d8184258c6f88 | [] | no_license | FlyBiao/CounselorAPP | d36f56ee1d5989c279167064442d9ea3e0c3a3ae | b724c1457d7544844ea8b4f6f5a9205021c33ae3 | refs/heads/master | 2020-03-22T21:30:14.904322 | 2018-07-12T12:21:37 | 2018-07-12T12:21:37 | 140,691,614 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,700 | java | package com.cesaas.android.counselor.order.label.net;
import io.rong.eventbus.EventBus;
import android.content.Context;
import android.util.Log;
import com.cesaas.android.counselor.order.global.BaseNet;
import com.cesaas.android.counselor.order.global.Constant;
import com.cesaas.android.counselor.order.label.bean.ResultGetAllTagListBean;
import com.cesaas.android.counselor.order.utils.AbPrefsUtil;
import com.google.gson.Gson;
import com.lidroid.xutils.exception.HttpException;
/**
* 获取当前店家所有标签
* @author FGB
*
*/
public class GetAllTagListNet extends BaseNet{
public GetAllTagListNet(Context context) {
super(context, true);
this.uri="User/Sw/Tag/GetAllTagList";
}
public void setData(){
try {
data.put("UserTicket",AbPrefsUtil.getInstance().getString(Constant.SPF_TOKEN));
} catch (Exception e) {
e.printStackTrace();
}
//开始请求网络
mPostNet();
}
public void setData(int PageSize,int PageIndex){
try {
data.put("PageSize",PageSize);
data.put("PageIndex",PageIndex);
data.put("UserTicket",AbPrefsUtil.getInstance().getString(Constant.SPF_TOKEN));
} catch (Exception e) {
e.printStackTrace();
}
//开始请求网络
mPostNet();
}
@Override
protected void mSuccess(String rJson) {
super.mSuccess(rJson);
Log.i(Constant.TAG, "label===" + rJson);
Gson gson=new Gson();
ResultGetAllTagListBean bean=gson.fromJson(rJson, ResultGetAllTagListBean.class);
//通过EventBus发送消息事件
EventBus.getDefault().post(bean);
}
@Override
protected void mFail(HttpException e, String err) {
super.mFail(e, err);
Log.i(Constant.TAG, "Fans===" + e + "********=err==" + err);
}
}
| [
"fengguangbiao@163.com"
] | fengguangbiao@163.com |
a896b1608f00656c14ad19ebaecf65f291169548 | e176fb0fce69fdc0c1a7caae935586d001e9a832 | /src/main/java/HexHelper.java | 24682463547269fd8f365ea7473ad19dfbe38cc1 | [] | no_license | teuber789/CS465-Project01-REV00 | 157dfc5ecb1745b59418208924cf9247ab1dfd12 | 55cc681b3faf283ce74f77635a337e7f4e875070 | refs/heads/master | 2021-06-10T14:34:50.846419 | 2017-01-15T02:08:45 | 2017-01-15T02:08:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,200 | java | public class HexHelper {
public static int getDecimalValueFromHex(char c) {
if(Character.isDigit(c))
return Character.getNumericValue(c);
switch (c) {
case 'a':
return 10;
case 'b':
return 11;
case 'c':
return 12;
case 'd':
return 13;
case 'e':
return 14;
case 'f':
return 15;
default:
throw new IllegalArgumentException("Cannot get hex value of char " + c);
}
}
public static char getHexValueFromDecimal(int i) {
if(i < 10)
return (char) (i + 48); // See ASCII character codes
switch(i) {
case 10:
return 'a';
case 11:
return 'b';
case 12:
return 'c';
case 13:
return 'd';
case 14:
return 'e';
case 15:
return 'f';
default:
throw new IllegalArgumentException("Cannot convert the following int to char: " +i);
}
}
}
| [
"jtcotton63@gmail.com"
] | jtcotton63@gmail.com |
d71282cfd6be548d77129d170598905aec0f3eaa | 71eadc17f6e024b14fd70ba9d3fa6fa08f90de0d | /Review-Service/src/main/java/com/cts/review/service/ReviewService.java | f6abb7aab0af50921abfd3a20ef0c705f607c5cf | [] | no_license | UdayasreeEdiga/Review-Management-System | c1bbd5df3ba468da19400c3b5c781f3b45f706e9 | ac5025eb08d5fd9fa0d50b440e6d0f10d98ee686 | refs/heads/master | 2022-06-09T12:18:26.594153 | 2020-05-09T06:13:06 | 2020-05-09T06:13:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java | package com.cts.review.service;
import com.cts.review.entity.Product;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class ReviewService {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Autowired
private RestTemplate restTemplate;
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
public Product getReviews(int productId){
log.info("To get all the reviews from product-service{}");
Product result= restTemplate.getForObject("http://localhost:8965/reviews/products/{p_id}",Product.class,productId);
return result;
}
public void deleteReviews(int productId){
log.info("To get all the reviews from product-service{}");
restTemplate.getForObject("http://localhost:8965/reviews/delete/products/{p_id}",Product.class,productId);
}
public void addReviews(Product product){
log.info("Adding the product into product-service");
restTemplate.getForObject("http://localhost:8965/reviews/products",Product.class,product);
}
} | [
"TarimalaKanchiReddy.YaswanthReddy@cognizant.com"
] | TarimalaKanchiReddy.YaswanthReddy@cognizant.com |
50d0e806d17262595e819b85a6de46df1f4fcdc0 | 2327263347ef9eb3dc980a4c0ed2d80edf2a823d | /Lecture_11/TwelveClass/src/string/TestImmutableString.java | de27f6b98dcaf722ed2560d364ae03cc1fa66269 | [] | no_license | AbuMaruf/OCP_JAVA_SE8 | 384069ecf4088a642f0eeb7983fb30e9317c3923 | 5de67a751f34f6e3c39a8eb643b0789ffabb48d3 | refs/heads/master | 2020-03-31T16:21:13.634356 | 2018-11-04T23:08:39 | 2018-11-04T23:08:39 | 152,371,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | 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 string;
/**
*
* @author HP
*/
public class TestImmutableString {
public static void main(String[] args) {
String s = "Abu Maruf";
s.concat("Md Shaifullah"); //concat() method adds the string at the end
System.out.println(s); // will print only Abu Maruf because string is immutable objects
}
}
| [
"maruf.35.uap@gmail.com"
] | maruf.35.uap@gmail.com |
3fdea65f8b945d51ff2d062963b5c33be41d0d77 | e731abdcba524f6b18d9a430ab9237e609c2e6b8 | /app/src/main/java/com/android/www/baking/Adapters/StepAdapter.java | b14080c4701a33486f0df0fffed08eb319b24432 | [] | no_license | Ghon4/Baking-App | 84d97855e85c9a919dd72c2ff888fbdce7dc530e | 96ef3518aada69c76d8dc03992da46175ab5fae3 | refs/heads/master | 2023-05-01T21:10:46.367597 | 2021-05-18T18:27:14 | 2021-05-18T18:27:14 | 368,630,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | package com.android.www.baking.Adapters;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.www.baking.model.Step;
import com.android.www.bakingapp.R;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class StepAdapter extends RecyclerView.Adapter<StepAdapter.StepListViewHolder> {
private List<Step> mStep;
private OnStepItemClickListener mOnStepItemClickListener;
public interface OnStepItemClickListener {
void onStepItemClicked(int itemPosition);
}
public StepAdapter(OnStepItemClickListener stepItemClickListener) {
this.mOnStepItemClickListener = stepItemClickListener;
}
@NonNull
@Override
public StepListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.step_list_item, parent, false);
return new StepListViewHolder(itemView);
}
@Override
public void onBindViewHolder(@NonNull StepListViewHolder holder, int position) {
Step step = mStep.get(position);
holder.tvShortDescription.setText(step.getShortDescription());
}
@Override
public int getItemCount() {
if (mStep == null){
return 0;
}
return mStep.size();
}
public void setSteps(List<Step> steps) {
this.mStep = steps;
if (mStep != null) {
notifyDataSetChanged();
}
}
public class StepListViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.tv_step_short_description)
TextView tvShortDescription;
public StepListViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int itemPosition = getAdapterPosition();
mOnStepItemClickListener.onStepItemClicked(itemPosition);
}
}
}
| [
"m.ghoniem97@gmail.com"
] | m.ghoniem97@gmail.com |
9a854eca90485928e088d83f41698f6636a6faf0 | 6578a8b112a6b09b1894944320b8f893fda26a31 | /src/test/java/com/pest/demo/GameTest.java | 96329b9ae3245dfbb5fcbdc83c645bfea79949a4 | [] | no_license | ccutmt/SoftwareEngineering | 45a24e713111d73fd56c7ffa5b5afbc39df98497 | 604c973d37964ae58cea21727c8fa779fdd939c7 | refs/heads/master | 2016-09-06T19:22:32.384889 | 2014-05-28T09:10:50 | 2014-05-28T09:10:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,593 | java | package com.pest.demo;
import static org.junit.Assert.*;
import org.junit.Test;
public class GameTest {
@Test
public void testTwoPlayersAllowed() {
Game mygame = new Game(new Creator().createMap(1));
assertTrue(mygame.setNumPlayers(2));
assertEquals(2, mygame.getNumPlayers());
}
@Test
public void testLessThanTwoPlayersNotAllowed() {
Game mygame = new Game(new Creator().createMap(1));
assertFalse(mygame.setNumPlayers(1));
}
@Test
public void testMoreThanEightPlayersNotAllowed() {
Game mygame = new Game(new Creator().createMap(1));
assertFalse(mygame.setNumPlayers(9));
}
@Test
public void testEightPlayersAllowed() {
Game mygame = new Game(new Creator().createMap(1));
assertTrue(mygame.setNumPlayers(8));
assertEquals(8, mygame.getNumPlayers());
}
@Test
public void testPlayerHTMLMapIsCorrect() {
Terrain[][] tiles = {
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.TREASURE, Terrain.LAND, Terrain.WATER},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
};
Player p = new Player(1, 0, 4);
p.setMapSeen(1, 0); p.setMapSeen(2, 0); p.setMapSeen(3, 0);
p.setMapSeen(1, 1); p.setMapSeen(2, 1); p.setMapSeen(3, 1);
p.setMapSeen(1, 2); p.setMapSeen(2, 2); p.setMapSeen(3, 2);
p.setMapSeen(1, 3); p.setMapSeen(2, 3); p.setMapSeen(3, 3);
Game mygame = new Game(new MapMock(tiles));
String expectedOutput =
"<table>"
+ "<tr><td bgcolor='#AAAAAA' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'><img src='player.png' width='50' height='50'/></td><td bgcolor='#00FF00' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td></tr>"
+ "<tr><td bgcolor='#AAAAAA' width='50' height='50'></td><td bgcolor='#FFFF00' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td><td bgcolor='#0000FF' width='50' height='50'></td></tr>"
+ "<tr><td bgcolor='#AAAAAA' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td></tr>"
+ "<tr><td bgcolor='#AAAAAA' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td><td bgcolor='#00FF00' width='50' height='50'></td></tr>"
+ "</table>";
assertEquals(expectedOutput, mygame.generatePlayerHTMLMap(p));
}
@Test
public void testSetMapSizeIsPropogatedToMap() {
Map m = new MapMock();
Game mygame = new Game(m);
mygame.setNumPlayers(5);
mygame.setMapSize(10);
assertEquals(10, m.getSize());
}
@Test
public void testTurnChangesAfterMove() {
Terrain[][] tiles = {
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.TREASURE, Terrain.LAND, Terrain.WATER},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
};
Player player1 = new Player(1, 0, 4);
Player player2 = new Player(0,0,4);
player1.setTeam(new Team());
player2.setTeam(new Team());
Player[] players = { player1, player2 };
Game mygame = new Game(new MapMock(tiles), players);
assertEquals(0, mygame.getCurrentTurn());
mygame.setNextMove('d');
assertEquals(1, mygame.getCurrentTurn());
}
@Test
public void testGameEndsAfterPlayer1FindsTreasureAndRoundComplete() {
Terrain[][] tiles = {
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.TREASURE, Terrain.LAND, Terrain.WATER},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
};
Player player1 = new Player(1, 0, 4);
Player player2 = new Player(0,0,4);
player1.setTeam(new Team());
player2.setTeam(new Team());
Player[] players = { player1, player2 };
Game mygame = new Game(new MapMock(tiles), players);
mygame.setNextMove('d');
mygame.setNextMove('d');
assertTrue(mygame.isEndGame());
}
@Test
public void testGameEndsAfterPlayer1FindsTreasureAndRoundNotComplete() {
Terrain[][] tiles = {
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.TREASURE, Terrain.LAND, Terrain.WATER},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
};
Player player1 = new Player(1, 0, 4);
Player player2 = new Player(0,0,4);
player1.setTeam(new Team());
player2.setTeam(new Team());
Player[] players = { player1, player2 };
Game mygame = new Game(new MapMock(tiles), players);
mygame.setNextMove('d');
assertFalse(mygame.isEndGame());
}
@Test
public void testGameDoesNotEndAfterOneMove() {
Terrain[][] tiles = {
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.TREASURE, Terrain.LAND, Terrain.WATER},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
};
Player player1 = new Player(1, 0, 4);
Player player2 = new Player(0,0,4);
player1.setTeam(new Team());
player2.setTeam(new Team());
Player[] players = { player1, player2 };
Game mygame = new Game(new MapMock(tiles), players);
mygame.setNextMove('l');
assertFalse(mygame.isEndGame());
}
@Test
public void testPlayerPositionResetAfterFindingWater() {
Terrain[][] tiles = {
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.TREASURE, Terrain.LAND, Terrain.WATER},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
};
Player player1 = new Player(1, 0, 4);
Player player2 = new Player(3,0,4);
Player[] players = { player1, player2 };
player1.setTeam(new Team());
player2.setTeam(new Team());
Game mygame = new Game(new MapMock(tiles), players);
mygame.setNextMove('d');
mygame.setNextMove('d');
assertEquals(3, player2.getPos().getX());
assertEquals(0, player2.getPos().getY());
}
@Test
public void testPlayerPositionDoesNotChangeAfterIllegalMove() {
Terrain[][] tiles = {
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.TREASURE, Terrain.LAND, Terrain.WATER},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
{ Terrain.LAND, Terrain.LAND, Terrain.LAND, Terrain.LAND},
};
Player player1 = new Player(1, 0, 4);
Player player2 = new Player(3,0,4);
Player[] players = { player1, player2 };
Game mygame = new Game(new MapMock(tiles), players);
mygame.setNextMove('u');
assertEquals(1, player1.getPos().getX());
assertEquals(0, player1.getPos().getY());
}
@Test
public void testTeamCreation(){
Game mygame = new Game(new Creator().createMap(1));
mygame.setNumPlayers(5);
mygame.setNumTeams(2);
assertEquals(2, mygame.getNumTeams());
}
@Test
public void testSetTeamGreaterThanPlayers(){
Game mygame = new Game(new Creator().createMap(1));
mygame.setNumPlayers(2);
assertFalse(mygame.setNumTeams(5));
}
@Test
public void testEveryPlayerHasTeam(){
Game mygame = new Game(new Creator().createMap(1));
mygame.setNumPlayers(4);
mygame.setMapSize(5);
mygame.setNumTeams(4);
mygame.init();
Player[] players = mygame.getPlayers();
for(int i = 0; i < players.length; i++){
assertNotNull(players[i].getTeam());
}
}
}
| [
"borgmb@gmail.com"
] | borgmb@gmail.com |
dbcc090436dcbad944fef3042ced4b576ca8b9c0 | d560f0c81d0286f04242e2862e04828afe31943c | /src/net/minecraft/server/class_so.java | aab275b39f2b66f582573b481efa8acab8c2a94f | [] | no_license | Aust1n46/MinecraftServerDec19 | 133fad79a68bc11392b35b67b1b178f88aaaa555 | 15dfa7c50a158c3f91add8276c9abbd6887925e0 | refs/heads/master | 2020-12-25T09:27:25.516834 | 2015-08-04T23:34:32 | 2015-08-04T23:34:32 | 40,213,641 | 0 | 0 | null | 2015-08-04T23:15:54 | 2015-08-04T23:15:54 | null | UTF-8 | Java | false | false | 883 | java | package net.minecraft.server;
import net.minecraft.server.EntityLiving;
import net.minecraft.server.class_qj;
import net.minecraft.server.class_rm;
public class class_so extends class_rm {
private class_qj a;
private boolean b;
public class_so(class_qj var1) {
this.a = var1;
this.a(5);
}
public boolean a() {
if(!this.a.cA()) {
return false;
} else if(this.a.V()) {
return false;
} else if(!this.a.C) {
return false;
} else {
EntityLiving var1 = this.a.cD();
return var1 == null?true:(this.a.h(var1) < 144.0D && var1.be() != null?false:this.b);
}
}
public void c() {
this.a.u().n();
this.a.o(true);
}
public void d() {
this.a.o(false);
}
public void a(boolean var1) {
this.b = var1;
}
}
| [
"Shev4ik.den@gmail.com"
] | Shev4ik.den@gmail.com |
d2a9886a137304e1197bd6b2fc444d5c0f937c9a | 4c1f4cb5e454b2d7b9bd6c006c2b4475a1e00e6b | /Fund/fundimpl/src/main/java/nivance/fundimpl/enums/CommandType.java | c3124c5d171e286fdb68b17729dbdb5ed63bccf8 | [] | no_license | nivance/OSGi_Project | cabfa6ed4b73481a64a6e2bd30d205ead86b0318 | 57347607207461a3c1cfd36ac87ab7acdab38ed1 | refs/heads/master | 2020-07-04T03:02:58.766971 | 2015-01-16T13:01:11 | 2015-01-16T13:01:11 | 29,348,180 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package nivance.fundimpl.enums;
public enum CommandType {
CREDITADJUSTCOMMAND,
RETRIVEFUNDFLOW,
OPENACCOUNTCOMMAND,
RECHARGECOMMAND,
RETRIVEBALANCECOMMAND,
REWARDCOMMAND,
SELLAMOUNTADJUSTCOMMAND,
WAGERCOMMAND,
WITHDRAWCOMMAND,
}
| [
"limingjian@joyveb.com"
] | limingjian@joyveb.com |
f450d799ccb4f0a7f60cadd98462392d72aac71c | bb31abd2a7f8b0f58a117d68bb9595f18d0ab620 | /MyJavaWorkShop6/src/com/test4/Sample11.java | 1fee9ff4bfa3dde1e2984b22966c0c14b43c9d68 | [] | no_license | doyongsung/Java | d17fda36e9c3b45d25cdfd43ac13db2d9be3f418 | 22efff99b4d40d056767662c7d47eed158a02248 | refs/heads/master | 2023-05-07T15:05:57.230557 | 2021-05-21T10:47:58 | 2021-05-21T10:47:58 | 366,378,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package com.test4;
class Animal {
void breathing() {
System.out.println("Animal breathing");
}
}
class Dog extends Animal {
void breathing() {
System.out.println("Dog Breathing");
}
}
class Cat extends Animal {
void breathing() {
System.out.println("Cat breathing");
}
}
public class Sample11 {
public static void main(String[] args) {
Animal[] animals = new Animal[3];
animals[0] = new Animal();
animals[1] = new Dog();
animals[2] = new Cat();
for(Animal a : animals) {
a.breathing();
}
}
}
| [
"ppelpp@naver.com"
] | ppelpp@naver.com |
f3442c0e1a3c6bffdd82391797cd8365df213407 | 7ad54455ccfdd0c2fa6c060b345488ec8ebb1cf4 | /com/ibm/icu/impl/data/LocaleElements_kn.java | d0270fcceaded2f5bf5b1317a6b4afff33c4ca70 | [] | no_license | chetanreddym/segmentation-correction-tool | afdbdaa4642fcb79a21969346420dd09eea72f8c | 7ca3b116c3ecf0de3a689724e12477a187962876 | refs/heads/master | 2021-05-13T20:09:00.245175 | 2018-01-10T04:42:03 | 2018-01-10T04:42:03 | 116,817,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,674 | java | package com.ibm.icu.impl.data;
import com.ibm.icu.impl.ICUListResourceBundle;
public class LocaleElements_kn
extends ICUListResourceBundle
{
public LocaleElements_kn() { contents = data; }
static final Object[][] data = { { "AmPmMarkers", { "ಪೂರ್ವಾಹ್ನ", "ಅಪರಾಹ್ನ" } }, { "CollationElements", { { "%%CollationBin", new com.ibm.icu.impl.ICUListResourceBundle.ResourceBinary("CollationElements_kn.col") }, { "Sequence", "[normalization on]" }, { "Version", "1.0" } } }, { "Countries", { { "IN", "ಭಾರತ" } } }, { "Currencies", { { "INR", { "रु", "INR" } } } }, { "DayAbbreviations", { "ರ.", "ಸೋ.", "ಮಂ.", "ಬು.", "ಗು.", "ಶು.", "ಶನಿ." } }, { "DayNames", { "ರವಿವಾರ", "ಸೋಮವಾರ", "ಮಂಗಳವಾರ", "ಬುಧವಾರ", "ಗುರುವಾರ", "ಶುಕ್ರವಾರ", "ಶನಿವಾರ" } }, { "ExemplarCharacters", "[:Knda:]" }, { "Languages", { { "kn", "ಕನ್ನಡ" } } }, { "LocaleID", new Integer(75) }, { "LocaleScript", { "Knda" } }, { "MonthAbbreviations", { "ಜನವರೀ", "ಫೆಬ್ರವರೀ", "ಮಾರ್ಚ್", "ಎಪ್ರಿಲ್", "ಮೆ", "ಜೂನ್", "ಜುಲೈ", "ಆಗಸ್ಟ್", "ಸಪ್ಟೆಂಬರ್", "ಅಕ್ಟೋಬರ್", "ನವೆಂಬರ್", "ಡಿಸೆಂಬರ್" } }, { "MonthNames", { "ಜನವರೀ", "ಫೆಬ್ರವರೀ", "ಮಾರ್ಚ್", "ಎಪ್ರಿಲ್", "ಮೆ", "ಜೂನ್", "ಜುಲೈ", "ಆಗಸ್ಟ್", "ಸಪ್ಟೆಂಬರ್", "ಅಕ್ಟೋಬರ್", "ನವೆಂಬರ್", "ಡಿಸೆಂಬರ್" } }, { "Version", "2.0" } };
}
| [
"chetanb4u2009@outlook.com"
] | chetanb4u2009@outlook.com |
7894f2b5e79eb2d733d831db764906baf664916a | 0ff4d61163199fbf31245ce9f8dc0e6378b16bf3 | /src/main/java/com/lotus/smallroutine/address/service/IAddressService.java | 39785cfe8c426da850954d5e13f4e167db90d2e4 | [] | no_license | TianqiHo/lotus | f8b1e0240a814dca8634cf3fdf7e827a9e5283c7 | 81e47b2d983b5029c97c0fc4c845f4b21f05c2c7 | refs/heads/master | 2022-06-30T13:15:19.632486 | 2019-10-10T05:39:39 | 2019-10-10T05:39:39 | 210,498,399 | 2 | 0 | null | 2022-06-21T01:55:55 | 2019-09-24T02:54:25 | JavaScript | UTF-8 | Java | false | false | 563 | java | package com.lotus.smallroutine.address.service;
import com.lotus.core.base.returnmessage.Message;
import com.lotus.smallroutine.address.model.Address;
public interface IAddressService {
public Message saveOrUpdateAddress(Address address)throws Exception;
public Message selectAddress(Address address)throws Exception;
public Message selectAddresss(Address address)throws Exception;
public Message selectClientAddresss(Address address)throws Exception;
public Message deleteAddresss(Address address)throws Exception;
}
| [
"Tianqi.He@Mine"
] | Tianqi.He@Mine |
57cfa18e53ccf2a4b51ce32e6497a71d9147075d | fb65750123d6d793b9ce80f0d4f8da8cdf9dd711 | /app/src/main/java/com/vivaclub/ffzandbetterttv/LoginActivity.java | cf82ba1e2d56f1814a2a57fec5ba84fa441e0450 | [] | no_license | Viva3k/TwitchApiTest | 7617f353b5291be94aa1c851a0aa93d3e79c8433 | 0ed564dbefc3fec6907e1bec91e338819eadf108 | refs/heads/master | 2020-04-15T06:45:17.237965 | 2019-01-07T18:14:10 | 2019-01-07T18:14:10 | 164,472,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,297 | java | package com.vivaclub.ffzandbetterttv;
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
WebView webView = findViewById(R.id.loginWebView);
webView.setWebViewClient(new MyWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(Constant.GET_TOKEN_TWITCH_URL); // load the url on the web view
}
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url); // load the url
if(url.contains("http://localhost/#access_token")){
User user = new User(url,LoginActivity.this);
Intent refresh = new Intent(LoginActivity.this, MainActivity.class);
startActivity(refresh);
finish();
return false;
}
return true;
}
}
}
| [
"viva3k@yandex.ua"
] | viva3k@yandex.ua |
5960f2375d4f553f5d969ce25bd2f77c6b25eb97 | 611310d738f0ef3ee74bf278105a2bb78b3f7cc7 | /thread/MatrixMultiplier/src/mastering/parallel/individual/ParallelIndividualMultiplier.java | 6ab9cece14f872bcf0b7be4583bb8aba7a24a9d6 | [] | no_license | fullSecKil/java- | 3230ff0ffd829f4652eac7f3a3a17bf5464321fb | 32d244f722a68f12019e9ab291a5f40c72c2e282 | refs/heads/master | 2020-05-18T13:19:08.690903 | 2019-06-02T08:42:28 | 2019-06-02T08:42:28 | 184,435,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,781 | java | package mastering.parallel.individual;
import java.util.ArrayList;
import java.util.List;
/**
* 并行个人乘数
* <p>
* ParallelIndividualMultiplier类将创建所有
* 必要的执行县城计算结果矩阵
*/
public class ParallelIndividualMultiplier {
/**
* 接受两个将要相乘的矩阵,和用于存放结果的矩阵
* 将处理结果矩阵所有元素,并创建一个单独的individualMultiplierTask类计算每一个元素
* 按照10个一组的方式启动线程
* 启动10个线程后,可使用waitForThreads辅助方法等待这10个线程最终完成
*
* @param matrix1
* @param matrix2
* @param result
*/
public static void multipy(double[][] matrix1, double[][] matrix2, double[][] result) {
List<Thread> threadList = new ArrayList<>();
int rows1 = matrix1.length;
int rows2 = matrix2.length;
int columns2 = matrix2[0].length;
for (int i = 0; i < rows1; i++) {
for (int j = 0; j < columns2; j++) {
IndividualMultiplierTask task = new IndividualMultiplierTask(matrix1, matrix2, result, i, j);
Thread thread = new Thread(task);
thread.start();
threadList.add(thread);
if (threadList.size() % 10 == 0) {
waitForThreads(threadList);
}
}
}
}
// 主线程阻塞等待,10个线程矩阵数值
private static void waitForThreads(List<Thread> threadList) {
for (Thread thread : threadList) {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
threadList.clear();
}
} | [
"en2213@163.com"
] | en2213@163.com |
580154f6d94d8602eec7ee1b1cf8a6411ae6944c | e6e0010a9a9dbeed606964e0be0219353584fefd | /Day11/src/test01/Test.java | 4028f1e325cb9c7088b4456ad7aa883965f32cf3 | [] | no_license | hongjunwan/junwan | f8ba13874d5ca668a82c2673af545b9eb14029f6 | 5f3133c313ed8d50064916a2d1f4a51456ce7c16 | refs/heads/master | 2021-06-27T00:00:55.382069 | 2017-09-15T08:53:30 | 2017-09-15T08:53:30 | 103,635,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package test01;
public class Test {
public static void main(String[] args) {
SportsCar myCar = new SportsCar();
myCar.setColor("RED");
myCar.setModel("SONATA");
myCar.setTurbo(true);
myCar.speedUp();
myCar.speedUp();
myCar.speedUp();
myCar.printCarInfo();
}
}
| [
"dhks223@naver.com"
] | dhks223@naver.com |
8f70c76ac11c45afe5e36d6b6247c34c7f45006b | 2d0a29e9b0a4b1d9f00ed51258e597b8d052e933 | /src/test/java/test/HttpClientAndWireMockTestBase.java | 269bc983d7be9365ef6e40982c8e88dbbcd7a6c4 | [
"Apache-2.0"
] | permissive | jekutzsche/httpclient-wiremock-test | 06ba3f07119dac63fb8156fb749ef986707e9b76 | 6c3ca87a3d0ad4fd22dfa79e0219d8479e9c8994 | refs/heads/master | 2022-12-30T01:13:45.430251 | 2020-10-13T22:01:20 | 2020-10-14T07:41:49 | 263,954,504 | 0 | 0 | Apache-2.0 | 2023-09-08T12:21:24 | 2020-05-14T15:35:27 | Java | UTF-8 | Java | false | false | 5,922 | java | package test;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import java.io.IOException;
import java.net.Authenticator;
import java.net.CookieHandler;
import java.net.PasswordAuthentication;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublishers;
import java.time.Duration;
import java.util.Base64;
import java.util.List;
import java.util.Map;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.junit.BeforeClass;
import org.junit.ClassRule;
public class HttpClientAndWireMockTestBase {
@ClassRule
public static final WireMockRule wireMockRule = new WireMockRule();
protected static final String USERNAME = "username";
protected static final String PASSWORD = "password";
protected static final URI uri = URI.create("http://localhost:8080/test?queryParam=value");
protected static final URI uriAuth = URI.create("http://localhost:8080/auth");
private static Authenticator myAuthenticator = new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("Authenticator was invoked");
return new PasswordAuthentication(USERNAME, PASSWORD.toCharArray());
}
};
private static CookieHandler myCookiHandler = new CookieHandler() {
@Override
public void put(URI uri, Map<String, List<String>> responseHeaders) throws IOException {
}
@Override
public Map<String, List<String>> get(URI uri, Map<String, List<String>> requestHeaders) throws IOException {
System.out.println("CookieHandler was invoked");
return Map.of("Cookie", List.of("cookie=0123456"));
}
};
/**
* Der Client sollte wiederverwendet werden, da bei seiner Erzeugung ein
* Connectionpool erzeugt wird und so auch Verbindungen wiederverwendet werden.
*/
protected static HttpClient httpClient;
@BeforeClass
public static void beforeClass() throws URISyntaxException {
httpClient = HttpClient.newBuilder().authenticator(myAuthenticator).cookieHandler(myCookiHandler)
// .connectTimeout(Duration.ofMillis(500))
// .followRedirects(HttpClient.Redirect.NORMAL)
// .version(Version.HTTP_2)
.build();
}
protected HttpRequest createSimpleRequest() {
return HttpRequest.newBuilder().uri(uri).header("header", "header_value").timeout(Duration.ofMillis(500)).GET()
.build();
}
protected HttpRequest createPostRequest() {
return HttpRequest.newBuilder().uri(uri).header("header", "post").timeout(Duration.ofMillis(500)).POST(BodyPublishers.ofString("body")).build();
}
protected HttpRequest createAuthenticationRequest() {
return HttpRequest.newBuilder().uri(uriAuth)
/*
* Die Authentifizierung wird durch WireMock nicht vom Authenticator
* angefordert. Daher muss sie hier als Header direkt hinzugefügt werden.
*
* gefundener Hinweis dazu
* (https://stackoverflow.com/questions/54208945/java-11-httpclient-not-sending-
* basic-authentication): As of the current JDK 11, HttpClient does not send
* Basic credentials until challenged for them with a WWW-Authenticate header
* from the server. Further, the only type of challenge it understands is for
* Basic authentication. The relevant JDK code is here (complete with TODO for
* supporting more than Basic auth) if you'd like to take a look.
*
* In the meantime, my remedy has been to bypass HttpClient's authentication API
* and to create and send the Basic Authorization header myself:
*/
.header("Authorization", basicAuth(USERNAME, PASSWORD)).timeout(Duration.ofMillis(500)).GET().build();
}
private static String basicAuth(String username, String password) {
return "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes());
}
protected void configWireMockForOkResponse() {
/*
* Muss hier urlPathEqualTo statt urlEqualTo sein, da sonst der QueryParam der URL mit geprüft wird und enthalten sein muss.
*/
stubFor(get(urlPathEqualTo("/test")).withHeader("header", containing("value"))
.withCookie("cookie", matching(".*12345.*")).withQueryParam("queryParam", equalTo("value"))
.willReturn(ok("Hahaha").withHeader("header", "return")));
}
protected void configWireMockForPost() {
stubFor(post(urlPathEqualTo("/test")).withRequestBody(equalTo("body")).withHeader("header", containing("post"))
.willReturn(ok("ok").withHeader("header", "ok")));
}
protected void configWireMockForAuthenticationAndOkResponse() {
stubFor(get(urlEqualTo("/auth")).withBasicAuth(USERNAME, PASSWORD).willReturn(ok("Hahaha")));
}
protected void configWireMockForErrorResponse() {
stubFor(get(urlPathEqualTo("/test")).willReturn(serverError()));
}
protected void configWireMockForLongOperation() {
stubFor(get(urlPathEqualTo("/test")).willReturn(aResponse().withStatus(200).withFixedDelay(1000)));
}
protected void configWireMockForOkPost() {
stubFor(post(urlPathEqualTo("/test")).willReturn(serverError()));
}
protected void configWireMockForCascade() {
stubFor(get(urlPathEqualTo("/a")).willReturn(ok("Hello")));
stubFor(get(urlPathEqualTo("/b")).willReturn(ok("World").withFixedDelay(2000)));
stubFor(get(urlPathEqualTo("/c")).willReturn(ok("WireMock")));
}
}
| [
"jens.kutzsche@gebea.de"
] | jens.kutzsche@gebea.de |
918dd636b1f9e886e110867bd0c0984a15844139 | cd63c0052642caacae87fc8e986a6bb287b30308 | /hp-client/src/main/java/sk/eea/td/hp_client/api/Pin.java | 878ecf1382dbfabab9e88371e34c1db5895fae5e | [] | no_license | Historypin/hp-orchestrator | 8902415f8267a07b94642ca88eb14fb0bda6b6a2 | bd7ddecba2e7e431e6ccd163090d96d89cd059b9 | refs/heads/master | 2020-12-21T07:48:34.854009 | 2016-08-16T08:05:39 | 2016-08-16T08:05:39 | 56,689,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,434 | java | package sk.eea.td.hp_client.api;
public class Pin {
private PinnerType pinnerType;
private String caption;
private String description;
private String date;
private String license;
private Location location;
private String link;
private String content;
private String tags;
private String remoteId;
private String remoteProviderId;
public Pin() {
}
public Pin(PinnerType pinnerType,
String caption,
String description,
String date,
String license,
Location location,
String link,
String content,
String tags,
String remoteId, String remoteProviderId) {
this.pinnerType = pinnerType;
this.caption = caption;
this.description = description;
this.date = date;
this.license = license;
this.location = location;
this.link = link;
this.content = content;
this.tags = tags;
this.remoteId = remoteId;
this.remoteProviderId = remoteProviderId;
}
public PinnerType getPinnerType() {
return pinnerType;
}
public void setPinnerType(PinnerType pinnerType) {
this.pinnerType = pinnerType;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getRemoteId() {
return remoteId;
}
public void setRemoteId(String remoteId) {
this.remoteId = remoteId;
}
public String getRemoteProviderId() {
return remoteProviderId;
}
public void setRemoteProviderId(String remoteProviderId) {
this.remoteProviderId = remoteProviderId;
}
@Override public String toString() {
return "Pin{" +
"pinnerType=" + pinnerType +
", caption='" + caption + '\'' +
", description='" + description + '\'' +
", date='" + date + '\'' +
", license='" + license + '\'' +
", location=" + location +
", link='" + link + '\'' +
", content='" + content + '\'' +
", tags='" + tags + '\'' +
", remoteId='" + remoteId + '\'' +
", remoteProviderId='" + remoteProviderId + '\'' +
'}';
}
}
| [
"miroslav.valus@eea.sk"
] | miroslav.valus@eea.sk |
02a00d6f8d7cf083a4fcfff84e9a386912786267 | 891ef47263309b1d1fabedd17ba9f5f67e3cccd1 | /src/main/java/edu/uga/ovpr/aam/contacts/ControlNewContactManagerDAO.java | 6c5d62cf0836948c53df2f18ae542c22f3807d51 | [] | no_license | banutsav/AAM-Maven | 120949bf1f13d6f209b68365f7b0c892944fb616 | 1523a88a960e0838a131100909809e6c15ef8042 | refs/heads/master | 2020-03-21T04:38:32.026661 | 2018-06-21T05:42:16 | 2018-06-21T05:42:16 | 138,119,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,099 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.uga.ovpr.aam.contacts;
import edu.uga.ovpr.aam.superuser.*;
import edu.uga.ovpr.aam.Constants;
import edu.uga.ovpr.aam.Static;
import edu.uga.ovpr.aam.information.GeneralDAO;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
/**
*
* @author submyers
*/
public class ControlNewContactManagerDAO {
public static HashMap<String, Object> SearchPaula(ControlNewContactManagerForm controlNewContactManagerForm) throws Exception {
HashMap<String, Object> results = new HashMap<String, Object>();
ArrayList<Object> people = new ArrayList<Object>();
Connection conn = null;
try {
conn = Static.getConnection("jdbc/paul");
Statement searchPaulaStat = conn.createStatement();
Statement searchPaulaCountStat = conn.createStatement();
String whereClause = "";
if (!controlNewContactManagerForm.getLastName().isEmpty()) {
if (controlNewContactManagerForm.getLastNameOpt().equalsIgnoreCase("Begins")) {
whereClause += " AND `p`.`LASTNAME` LIKE '" + GeneralDAO.CleanMySQLStringForLike(controlNewContactManagerForm.getLastName()) + "%'";
} else if (controlNewContactManagerForm.getLastNameOpt().equalsIgnoreCase("Contains")) {
whereClause += " AND `p`.`LASTNAME` LIKE '%" + GeneralDAO.CleanMySQLStringForLike(controlNewContactManagerForm.getLastName()) + "%'";
} else if (controlNewContactManagerForm.getLastNameOpt().equalsIgnoreCase("Exact")) {
whereClause += " AND `p`.`LASTNAME`='" + GeneralDAO.CleanMySQLString(controlNewContactManagerForm.getLastName()) + "'";
}
}
if (!controlNewContactManagerForm.getFirstName().isEmpty()) {
if (controlNewContactManagerForm.getFirstNameOpt().equalsIgnoreCase("Begins")) {
whereClause += " AND `p`.`FIRSTNAME` LIKE '" + GeneralDAO.CleanMySQLStringForLike(controlNewContactManagerForm.getFirstName()) + "%'";
} else if (controlNewContactManagerForm.getFirstNameOpt().equalsIgnoreCase("Contains")) {
whereClause += " AND `p`.`FIRSTNAME` LIKE '%" + GeneralDAO.CleanMySQLStringForLike(controlNewContactManagerForm.getFirstName()) + "%'";
} else if (controlNewContactManagerForm.getFirstNameOpt().equalsIgnoreCase("Exact")) {
whereClause += " AND `p`.`FIRSTNAME`='" + GeneralDAO.CleanMySQLString(controlNewContactManagerForm.getFirstName()) + "'";
}
}
if (!controlNewContactManagerForm.getMyId().isEmpty()) {
if (controlNewContactManagerForm.getMyIdOpt().equalsIgnoreCase("Begins")) {
whereClause += " AND `p`.`MYID` LIKE '" + GeneralDAO.CleanMySQLStringForLike(controlNewContactManagerForm.getMyId()) + "%'";
} else if (controlNewContactManagerForm.getMyIdOpt().equalsIgnoreCase("Contains")) {
whereClause += " AND `p`.`MYID` LIKE '%" + GeneralDAO.CleanMySQLStringForLike(controlNewContactManagerForm.getMyId()) + "%'";
} else if (controlNewContactManagerForm.getMyIdOpt().equalsIgnoreCase("Exact")) {
whereClause += " AND `p`.`MYID`='" + GeneralDAO.CleanMySQLString(controlNewContactManagerForm.getMyId()) + "'";
}
}
if (!controlNewContactManagerForm.getCannum().isEmpty()) {
whereClause += " AND `p`.`CANNUM`='" + GeneralDAO.CleanMySQLString(controlNewContactManagerForm.getCannum()) + "'";
}
if (controlNewContactManagerForm.getIncInactive().equals("No")) {
whereClause += " AND `p`.`active`='1'";
}
whereClause = " WHERE `p`.`CANNUM` NOT LIKE '999%'" + whereClause;
final String searchPaulaCountQuery = "SELECT"
+ " COUNT(DISTINCT `p`.`ID`) AS `COUNT`"
+ " FROM"
+ " `" + Constants.DB_PAUL + "`.`PERSON` `p`"
+ whereClause + " AND `p`.`CANNUM` NOT IN (SELECT `aa`.`CANNUM` FROM `" + Constants.DB_PAUL + "`.`CONTACT_ADMIN` `aa`)";
//System.out.println("DEBUG: Search For New Manager Count:\n" + searchPaulaCountQuery + "\n");
ResultSet searchPaulaCountRs = searchPaulaCountStat.executeQuery(searchPaulaCountQuery);
Integer searchPaulaCount = 0;
if (searchPaulaCountRs.next()) {
searchPaulaCount = searchPaulaCountRs.getInt("COUNT");
}
results.put("COUNT", searchPaulaCount);
String orderByClause = " ORDER BY `LASTNAME`,`FIRSTNAME`, `MYID`";
Integer start = controlNewContactManagerForm.getPageNum() * 100;
String limitClause = " LIMIT " + start + ", 100";
final String searchPaulaQuery = "SELECT DISTINCT"
+ " `p`.`ID`"
+ ", `p`.`ACTIVE` AS `ACTIVE`"
+ ", `p`.`FIRSTNAME` AS `FIRSTNAME`"
+ ", `p`.`LASTNAME` AS `LASTNAME`"
+ ", `p`.`MYID` AS `MYID`"
+ ", `p`.`CANNUM` AS `CANNUM`"
+ ", `p`.`TITLE` AS `TITLE`"
+ ", `p`.`EMAIL` AS `EMAIL`"
+ ", `p`.`PHONE` AS `PHONE`"
+ ", `d`.`DEPTNAME` AS `DEPTNAME`"
+ ", `d`.`DEPTNUM` AS `DEPTNUM`"
+ " FROM"
+ " `" + Constants.DB_PAUL + "`.`PERSON` `p`"
+ " LEFT JOIN `" + Constants.DB_PAUL + "`.`DEPT` `d`"
+ " ON `p`.`HOMEDEPT_ID`=`d`.`ID`"
+ whereClause + " AND `p`.`CANNUM` NOT IN (SELECT `aa`.`CANNUM` FROM `" + Constants.DB_PAUL + "`.`CONTACT_ADMIN` `aa`) "
+ orderByClause
+ limitClause;
//System.out.println("DEBUG: Search for new manager:\n" + searchPaulaQuery + "\n");
final ResultSet searchPaulaRs = searchPaulaStat.executeQuery(searchPaulaQuery);
while (searchPaulaRs.next()) {
HashMap<String, String> entry = new HashMap<String, String>();
entry.put("ID", searchPaulaRs.getString("ID"));
entry.put("ACTIVE", searchPaulaRs.getString("ACTIVE"));
entry.put("FIRSTNAME", searchPaulaRs.getString("FIRSTNAME"));
entry.put("LASTNAME", searchPaulaRs.getString("LASTNAME"));
entry.put("MYID", searchPaulaRs.getString("MYID"));
entry.put("CANNUM", searchPaulaRs.getString("CANNUM"));
entry.put("TITLE", searchPaulaRs.getString("TITLE"));
entry.put("EMAIL", searchPaulaRs.getString("EMAIL"));
entry.put("PHONE", searchPaulaRs.getString("PHONE"));
entry.put("DEPTNAME", searchPaulaRs.getString("DEPTNAME"));
entry.put("DEPTNUM", searchPaulaRs.getString("DEPTNUM"));
people.add(entry);
}
results.put("people", people);
return results;
} catch (Exception ex) {
throw ex;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception ex) {
throw ex;
}
}
}
}
public static void AddNewManager(ControlNewContactManagerForm controlNewContactManagerForm, String cannum) throws Exception {
Connection conn = null;
Statement commitStat = null;
try {
conn = Static.getConnection("jdbc/paul");
commitStat = conn.createStatement();
final Statement doesAdminExistStat = conn.createStatement();
final Statement updateAdminStat = conn.createStatement();
final Statement insertAdminStat = conn.createStatement();
commitStat.execute("START TRANSACTION");
final String doesAdminExistQuery = "SELECT"
+ " '1'"
+ " FROM"
+ " `" + Constants.DB_PAUL + "`.`CONTACT_ADMIN` `aa`"
+ " WHERE"
+ " `aa`.`CANNUM`='" + controlNewContactManagerForm.getTargPersonCannum() + "'";
final ResultSet doesAdminExistRs = doesAdminExistStat.executeQuery(doesAdminExistQuery);
if (doesAdminExistRs.next())
{
/*final String updateAdminCmd = "UPDATE"
+ " `" + Constants.DB_PAUL + "`.`CONTACT_ADMIN`"
+ " SET"
+ " `ACTIVE`='1'"
+ " WHERE"
+ " `CANNUM`='" + controlNewContactManagerForm.getTargPersonCannum() + "'";
//System.out.println("Update admin:\n" + updateAdminCmd + "\n");
updateAdminStat.executeUpdate(updateAdminCmd);*/
}
else {
final String insertAdminCmd = "INSERT INTO"
+ " `" + Constants.DB_PAUL + "`.`CONTACT_ADMIN`"
+ " SET"
+ " `ACTIVE`='1'"
+ ", `CANNUM`='" + controlNewContactManagerForm.getTargPersonCannum() + "'"
+ ", `CREATED_BY_CANNUM`='" + cannum + "'";
//System.out.println("Insert new Admin:\n" + insertAdminCmd + "\n");
insertAdminStat.executeUpdate(insertAdminCmd);
}
commitStat.execute("COMMIT");
} catch (Exception ex) {
commitStat.execute("ROLLBACK");
throw ex;
} finally {
if (conn != null) {
conn.close();
}
}
}
}
| [
"utsavb7@gmail.com"
] | utsavb7@gmail.com |
e238a7433ca0bde07b22f0238b2bfe3046d3566b | 7861b724f65311d2d849c91e9af01907e80e9b5e | /order-producer/src/test/java/com/aditya/OrderProducerApplicationTests.java | 24ec68d398c17deeb9ef83567d37627b88906263 | [] | no_license | aditya-delite/spring-cloud-stream-rabbitmq | 7f478bf2a3eee77e3bae88d5e2c79ae8453f06d9 | 1bc3bf055d109a29f93a60aab202335416ea7863 | refs/heads/master | 2023-01-04T23:24:59.566223 | 2020-11-05T12:42:37 | 2020-11-05T12:42:37 | 310,289,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 209 | java | package com.aditya;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class OrderProducerApplicationTests {
@Test
void contextLoads() {
}
}
| [
"aditya.delite@gmail.com"
] | aditya.delite@gmail.com |
f875db18f6c19f8ee3c925c3f9bdadab334e74c1 | bf68764c72f644e011495d2bb0b10fe186dc749b | /java/PesqOrd/src/classes/LSE.java | 166be3f49ce1e8f9232b1bb887525b08039e6259 | [
"MIT"
] | permissive | abrantesasf/pesqOrd | 1692f225990ffe1c1e5bc6f2b25ae860522e63db | 01a2a05207a6a4f8d372924a4fb966bb61973946 | refs/heads/master | 2020-08-07T08:24:49.932418 | 2020-02-12T20:16:30 | 2020-02-12T20:16:30 | 213,370,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,836 | java | package classes;
/**
* <p>A classe <code><b>LSE</b></code> implementa uma lista simplesmente
* encadeada (LSE). Esta classe será utilizada
* no trabalho final da disciplina de Pesquisa e Ordenação,
* do curso de Ciência da Computação, da FAESA.</p>
*
* @author Abrantes Araújo Silva Filho (<a href="mailto:abrantesasf@gmail.com">abrantesasf@gmail.com)
*/
public class LSE {
///////////////////////////////////////////////////
// Atributos
///////////////////////////////////////////////////
/** Ponteiro para o primeiro nó da lista */
private NoLSE prim;
/** Ponteiro para o último nó da lista */
private NoLSE ult;
/** Quantidade de nós na lista */
private int quantNos;
///////////////////////////////////////////////////
// Construtor(es)
///////////////////////////////////////////////////
/**
* Construtor padrão para a classe LSE. Não recebe
* nenhum parâmetro e inicializa os ponteiros como null
* e a quantidade de nós como zero.
*/
public LSE() {
this.prim = null;
this.ult = null;
this.quantNos = 0;
}
///////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////
/** Retorna o primeiro nó da lista */
public NoLSE getPrim() {
return this.prim;
}
/** Retorna o último nó da lista */
public NoLSE getUlt() {
return this.ult;
}
/** Retorna a quantidade de nós na lista */
public int getQuantNos() {
return this.quantNos;
}
///////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////
/**
* Aponta o primeiro nó na lista para o nó passado como
* parâmetro.
*
* @param prim
* (NoLSE)
*/
public void setPrim(NoLSE prim) {
this.prim = prim;
}
/** Aponta o último nó na lista para o nó passado como
* parâmetro.
*
* @param ult
* (NoLSE)
*/
public void setUlt(NoLSE ult) {
this.ult = ult;
}
/** Ajusta a quantidade de nós */
public void setQuantNos(int quantNos) {
this.quantNos = quantNos;
}
///////////////////////////////////////////////////
// Verifica se a LSE está vazia
///////////////////////////////////////////////////
/**
* Verifica se a lista está vazia.
*
* @return TRUE se a lista estiver vazia<br />
* FALSE se a lista não estiver vazia
*/
public boolean eVazia() {
return (this.prim == null);
}
///////////////////////////////////////////////////
// Insere de modo ordenado na LSE
// Obs.: é necessário que o elemente implemente
// a interface Comparator
///////////////////////////////////////////////////
/**
* Insere uma nova conta bancária de modo ordenado na lista,
* tomando como parâmetro de ordenação o resultado de um
* método comparator implementado na classe ContaBancaria.
*
* @param novaConta
* (ContaBancaria)
*/
public void inserirOrdenado(ContaBancaria novaConta) {
NoLSE novoNoLSE = new NoLSE(novaConta);
// Se a lista está vazia, insere o primeiro nó
if (this.eVazia()) {
setPrim(novoNoLSE);
setUlt(novoNoLSE);
} else {
// Se a lista não está vazia:
NoLSE atual = getPrim();
NoLSE anterior = null;
// Percorre a lista até o último nó, verificando se a conta bancária passada
// como parâmetro é maior do que a conta do nó atual (a comparação é feita
// através de um comparator implementado na classe ContaBancaria):
while (atual.getProx() != null && novoNoLSE.getConta().compareTo(atual.getConta()) > 0) {
System.out.println(novoNoLSE.getConta().toString());
System.out.println(atual.getConta().toString());
System.out.println("Comp: " + novoNoLSE.getConta().compareTo(atual.getConta()));
anterior = atual;
atual = atual.getProx();
}
// Se o while parar no primeiro e o novo nó for MENOR do que o primeiro,
// a nova conta deve ser inserida ANTES do primeiro nó:
if (atual == getPrim() && novoNoLSE.getConta().compareTo(atual.getConta()) < 0) {
novoNoLSE.setProx(getPrim());
setPrim(novoNoLSE);
}
// Se o while parar no primeiro e o novo nó for MAIOR do que o primeiro,
// a nova conta deve ser inserida APÓS o primeiro nó:
else if (atual == getPrim() && novoNoLSE.getConta().compareTo(atual.getConta()) > 0) {
novoNoLSE.setProx(atual.getProx());
atual.setProx(novoNoLSE);
}
// Se o while parar no último e o novo nó for MAIOR do que o último,
// a nova conta deve ser inserida APÓS o último nó:
else if (atual == getUlt() && novoNoLSE.getConta().compareTo(atual.getConta()) > 0) {
atual.setProx(novoNoLSE);
setUlt(novoNoLSE);
}
// Se o while parar no último e o novo nó for MENOR do que o último,
// a nova conta deve ser insediro ANTES do último nó:
else if (atual == getUlt() && novoNoLSE.getConta().compareTo(atual.getConta()) < 0) {
novoNoLSE.setProx(getUlt());
anterior.setProx(novoNoLSE);
}
// Se o while parar em algum lugar ENTRE o primeiro e o último nó, o novo nó deve ser
// inserido ANTES desse nó:
else {
novoNoLSE.setProx(atual);
anterior.setProx(novoNoLSE);
}
}
setQuantNos(getQuantNos()+1);
}
public void inserirOrdenado2(ContaBancaria novaConta) {
NoLSE novoNoLSE = new NoLSE(novaConta);
//int status = 0;
// Se a lista está vazia, insere o primeiro nó
if (this.eVazia()) {
this.setPrim(novoNoLSE);
this.setUlt(novoNoLSE);
//System.out.println(">>0" + " " +getPrim().getConta().getCPF() + " " +getPrim().getConta().getConta());
//System.out.println("Prim:");
//System.out.println(this.getPrim().getConta().toString());
} else {
// Se a lista não está vazia:
NoLSE atual = this.getPrim();
NoLSE anterior = null;
// Percorre a lista até o último nó, verificando se a conta bancária passada
// como parâmetro é maior do que a conta do nó atual (a comparação é feita
// através de um comparator implementado na classe ContaBancaria):
while (atual.getProx() != null && novoNoLSE.getConta().compareTo(atual.getConta()) > 0) {
//status = novoNoLSE.getConta().compareTo(atual.getConta());
anterior = atual;
atual = atual.getProx();
}
if (atual == getPrim() && atual.getProx() == null) {
if (novoNoLSE.getConta().compareTo(atual.getConta()) > 0) {
atual.setProx(novoNoLSE);
setUlt(novoNoLSE);
//System.out.println(status);
//System.out.println(">>1");
}
else if (novoNoLSE.getConta().compareTo(atual.getConta()) < 0) {
novoNoLSE.setProx(atual);
setPrim(novoNoLSE);
//System.out.println(status);
//System.out.println(">>2");
}
}
else if (atual == getPrim() && atual.getProx() != null) {
if (novoNoLSE.getConta().compareTo(atual.getConta()) > 0) {
novoNoLSE.setProx(atual.getProx());
atual.setProx(novoNoLSE);
//System.out.println(status);
//System.out.println(">>3");
}
else if (novoNoLSE.getConta().compareTo(atual.getConta()) < 0) {
novoNoLSE.setProx(atual);
setPrim(novoNoLSE);
//System.out.println(status);
//System.out.println(">>4");
}
} else if (atual == getUlt()) {
if (novoNoLSE.getConta().compareTo(atual.getConta()) > 0) {
atual.setProx(novoNoLSE);
setUlt(novoNoLSE);
//System.out.println(status);
//System.out.println(">>5");
}
else if (novoNoLSE.getConta().compareTo(atual.getConta()) < 0) {
novoNoLSE.setProx(atual);
anterior.setProx(novoNoLSE);
//System.out.println(status);
//System.out.println(">>6");
}
}
else {
novoNoLSE.setProx(atual);
anterior.setProx(novoNoLSE);
//System.out.println(status);
//System.out.println(">>7");
}
}
setQuantNos(getQuantNos()+1);
}
} | [
"abrantesasf@gmail.com"
] | abrantesasf@gmail.com |
4655b71c85282001c34cadd75399c88901b3b56c | ec0e392e06179acdf79286e8a03e9f9e6d90ec5a | /src/main/java/ru/coutvv/oop/samples/state/states/HasQuarterState.java | 717f9c64a854eff12407edce64cba11fc883eac0 | [] | no_license | coutvv/oop-samples | ebfbbebc7566003625a92d3c934c7c63969f6933 | 531270e910b78f7d418bc631dd9b9b57709210f4 | refs/heads/master | 2021-01-11T01:42:39.464965 | 2016-11-20T19:59:17 | 2016-11-20T19:59:17 | 70,678,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package ru.coutvv.oop.samples.state.states;
import java.util.Random;
import ru.coutvv.oop.samples.state.GumballMachine;
public class HasQuarterState extends State {
Random randomWinner = new Random(System.currentTimeMillis());
public HasQuarterState(GumballMachine gm) {
super(gm);
// TODO Auto-generated constructor stub
}
@Override
public void ejectQuarter() {
System.out.println("quarter is back!");
}
@Override
public void turnCrank() {
int winner = randomWinner.nextInt(10);//10% chance
if((winner == 0) && gm.hasWinBalls()) {
gm.setState(gm.getWinnerState());
} else {
gm.setState(gm.getSoldState());
}
}
}
| [
"coutvv@gmail.com"
] | coutvv@gmail.com |
f1131e9ab5ab85e805aec07b17ebe6e93e74ed18 | be10283a1f17b5ebd995f23b9b7e5ae43e3040b3 | /src/Serialization/Serialization.java | c88d1030563697803738f55d1b97f73189f2743f | [] | no_license | Follo01/ProjetSmartphone | 3bca35f22d68642d3b028c8c2efa74fb82c42d37 | fe13b1b26559ab2567e839ca2adad464d42c3c21 | refs/heads/master | 2020-05-22T14:24:23.254563 | 2019-06-09T19:22:11 | 2019-06-09T19:22:11 | 186,382,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,567 | java | package Serialization;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;
import Contact.ListeContact;
public abstract class Serialization {
//Création de la serialisation
public static boolean serialisation(Object object, String path){
try{
FileOutputStream fos = new FileOutputStream(path);
BufferedOutputStream bfos = new BufferedOutputStream(fos);
ObjectOutputStream oos= new ObjectOutputStream(fos);
oos.writeObject(object);
oos.close();
return true;
}
catch(IOException ioe){
ioe.printStackTrace();
return false;
}
}
//creation de la déserialisation
public static Object deseralisation(String path){
try
{
FileInputStream fis = new FileInputStream(path);
BufferedInputStream bfis = new BufferedInputStream(fis);
ObjectInputStream obfis = new ObjectInputStream(bfis);
Object object = obfis.readObject();
obfis.close();
return object ;
}
catch(IOException ioe){
ioe.printStackTrace();
return null;
}catch(ClassNotFoundException c){
System.out.println("Class pas trouver");
c.printStackTrace();
return null;
}
}
}
| [
"follonier743@gmail.com"
] | follonier743@gmail.com |
0d6f4f0f3f008849905d0e2a78441500c42b5c62 | 644223527aa0c01b6ce4d49093b81b59ce106121 | /src/main/java/com/gjy/zxks/util/TokenUtil.java | 3607911527bd0836d33bd91f543a1385160462b5 | [] | no_license | gj-y/zxks | b3a52093d99d6c57e042fabddb8ed7e9861aebe0 | 847a83467a7383ecdc0a1b0ff6592ec597e6ec71 | refs/heads/master | 2021-01-19T04:55:21.740639 | 2017-08-17T16:28:49 | 2017-08-17T16:28:49 | 81,523,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116 | java | package com.gjy.zxks.util;
/**
* @author jiayao gao
* @create 2017-04-04 1:00
**/
public class TokenUtil {
}
| [
"565404164@qq.com"
] | 565404164@qq.com |
83dde3d6b3d0c25cf4f112dfb1816f50cb50b136 | b51f017685d4582361172fefa8b1a07414a8dce2 | /trunk/Java/PopulateFactData/UtilityFunctions.java | ed64cc87977eedfbbfc398e5dfd9ae45ed07b12c | [] | no_license | hastapasta/financereport | 5cb48993c5923af3eddb08605d0b06bfe84ddfa5 | 853a8b8d42563d8c9d44693cda9b8fb79aa61508 | refs/heads/master | 2021-01-10T11:38:03.548297 | 2015-12-27T17:18:18 | 2015-12-27T17:18:18 | 48,634,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,092 | java |
import java.sql.*;
import java.util.ArrayList;
import java.util.Properties;
//import java.util.Calendar;
import java.io.*;
//import java.util.StringTokenizer;
import java.util.regex.*;
import pikefin.log4jWrapper.Logs;
import pikefin.log4jWrapper.MainWrapper;
/*import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;*/
public class UtilityFunctions
{
public static Connection con;
static public boolean bCalledByJsp;
String strCapturedOutput;
//static public CustomBufferedWriter stdoutwriter;
static MainWrapper stdoutwriter;
public Connection getConnection()
{
return(UtilityFunctions.con);
}
public UtilityFunctions()
{
//try
//{
try
{
/*Class.forName("com.mysql.jdbc.Driver");
//String url = "jdbc:mysql://localhost:3306/" + strDatabase;
String url = "jdbc:mysql://" + strDBHost + ":" + strDBPort + "/" + strDatabase;
UtilityFunctions.con = DriverManager.getConnection(url,strUser, strPass);*/
//this.bCalledByJsp = bCalled;
//UtilityFunctions.stdoutwriter = new CustomBufferedWriter();
UtilityFunctions.stdoutwriter = new MainWrapper();
}
catch (Exception e)
{
System.out.println("UtilityFunctions constructor failed.");
e.printStackTrace();
}
}
/*public void setCustomBufferedWriter(CustomBufferedWriter inputCBW) {
stdoutwriter = inputCBW;
}*/
/*public static void db_update_query(String strUpdateStmt) throws SQLException
{
//try
//{
stdoutwriter.writeln("Executing SQL: " + strUpdateStmt,Logs.SQL,"UF1");
stdoutwriter.writeln(strUpdateStmt,Logs.SQL,"UF2");
Statement stmt = con.createStatement();
stmt.execute(strUpdateStmt);
if (strUpdateStmt.substring(0,6).equals("update") && stmt.getUpdateCount() == 0)
stdoutwriter.writeln("No rows were updated",Logs.ERROR,"UF2.5");
///}
//catch (SQLException sqle)
//{
// stdoutwriter.writeln("1 SQL statement failed: " + strUpdateStmt);
// stdoutwriter.writeln(sqle);
//
//}
}*/
/*public static ResultSet db_run_query(String query) throws SQLException
{
ResultSet rs =null;
//try
//{
stdoutwriter.writeln("Executing query: " + query, Logs.SQL,"UF3");
Statement stmt = con.createStatement();
stdoutwriter.writeln(query, Logs.SQL,"UF4");
rs = stmt.executeQuery(query);
}
return(rs);
//Not going to worry about closing the connection, we'll let it be garbage collected.
}*/
/*public void importTableIntoDB(ArrayList<String[]> tabledata, String tablename, Integer nBatch)
{
#* This function expects an arraylist with 2X of the number of values to be inserted with each value
preceeded by the datatype with the current 3 datatypes being VARCHAR, FUNCTIONS, INT *#
#*OFP 9/28/2010 - I believe passing in the datatypes with the table data is redundant since the types
* are retrieved from the database meta data.
*#
String[] rowdata;
String query ="";
//String columns= "";
String values = "";
if (tabledata.size() < 2)
{
stdoutwriter.writeln("Not enough rows of data passed into importTableIntoDB\nThis may be a custom import and the flag needs to be set",Logs.ERROR,"UF4.5");
return;
}
String[] columnnames = tabledata.get(0);
tabledata.remove(0);
if (tablename.equals("fact_data_stage") || tablename.equals("fact_data"))
{
columnnames = extendArray(columnnames);
columnnames[columnnames.length - 1] = "batch";
}
String[] datatypes = new String[columnnames.length];
try
{
ResultSet rsColumns = null;
DatabaseMetaData meta = con.getMetaData();
int nCount=0;
for (int j=0;j<columnnames.length;j++)
{
rsColumns = meta.getColumns(null, null, tablename, null);
nCount=0;
while (rsColumns.next())
{
#*System.out.println(rsColumns.getString("COLUMN_NAME"));
System.out.println(rsColumns.getString("TYPE_NAME"));*#
//stdoutwriter.writeln(columnnames[j],Logs.STATUS2,"UF5");
if (columnnames[j].compareTo(rsColumns.getString("COLUMN_NAME")) == 0)
{
datatypes[j] = rsColumns.getString("TYPE_NAME");
stdoutwriter.writeln(datatypes[j],Logs.STATUS2,"UF6");
break;
}
nCount++;
}
}
}
catch (SQLException sqle)
{
stdoutwriter.writeln("Problem retrieving column data types",Logs.ERROR,"UF7");
stdoutwriter.writeln(sqle);
}
stdoutwriter.writeln("Finished retrieving column data types",Logs.STATUS2,"UF8");
String strColumns;
int nInsertCount=0;
for (int x=0;x<tabledata.size();x++)
{
//for debugging purposes
//if (x!= 5052)
//continue;
rowdata = tabledata.get(x);
//query = "INSERT INTO fact_data_stage (data_set,value,quarter,ticker,date_collected) VALUES ('" + strCurDataSe
values ="";
strColumns="";
if (tablename.equals("fact_data_stage") || tablename.equals("fact_data"))
{
rowdata = extendArray(rowdata);
//using columnnames here since that is guaranteed to be the correct length
rowdata[columnnames.length - 1] = Integer.toString(nBatch);
}
for (int y=0;y<columnnames.length;y++)
{
if (y!=0)
{
values = values + ",";
strColumns = strColumns + ",";
}
//System.out.println("{" + rowdata[y] + "} " + rowdata[y].length() + " " + datatypes[y]);
if (datatypes[y].compareTo("VARCHAR") == 0)
{
values = values + "'" + rowdata[y].replace("'","\\'") + "'";
}
else if (((datatypes[y].compareTo("INT") == 0) || (datatypes[y].compareTo("BIGINT") == 0)) && ((rowdata[y].length() == 0)))
{
values = values + "'0'";
}
else
values = values + rowdata[y];
strColumns = strColumns + columnnames[y];
}
query = "insert into " + tablename + " (" + strColumns + ") values (" + values + ")";
//System.out.println("insert row: " + query);
try
{
db_update_query(query);
nInsertCount++;
}
catch (SQLException sqle)
{
stdoutwriter.writeln("SQLException failed at row " + (x+1) + " " + query,Logs.ERROR,"UF9");
stdoutwriter.writeln(sqle);
}
}
stdoutwriter.writeln(nInsertCount + " records inserted in db.",Logs.STATUS2,"UF10");
}*/
/*public void updateTableIntoDB(ArrayList<String[]> tabledata, String tablename)
{
#*OFP 9/28/2010 - I believe passing in the datatypes with the table data is redundant since the types
* are retrieved from the database meta data.
*#
String[] rowdata;
String query ="";
//String columns= "";
//String values = "";
String[] columnnames = tabledata.get(0);
tabledata.remove(0);
String[] datatypes = new String[columnnames.length];
try
{
ResultSet rsColumns = null;
DatabaseMetaData meta = con.getMetaData();
int nCount=0;
for (int j=0;j<columnnames.length;j++)
{
rsColumns = meta.getColumns(null, null, tablename, null);
nCount=0;
while (rsColumns.next())
{
#*System.out.println(rsColumns.getString("COLUMN_NAME"));
System.out.println(rsColumns.getString("TYPE_NAME"));*#
stdoutwriter.writeln(columnnames[j],Logs.STATUS2,"UF11");
if (columnnames[j].compareTo(rsColumns.getString("COLUMN_NAME")) == 0)
{
datatypes[j] = rsColumns.getString("TYPE_NAME");
stdoutwriter.writeln(datatypes[j],Logs.STATUS2,"UF12");
break;
}
nCount++;
}
}
}
catch (SQLException sqle)
{
stdoutwriter.writeln("Problem retrieving column data types",Logs.ERROR,"UF13");
stdoutwriter.writeln(sqle);
}
stdoutwriter.writeln("Finished retrieving column data types",Logs.STATUS2,"UF14");
//String strColumns;
int nInsertCount=0;
for (int x=0;x<tabledata.size();x++)
{
//for debugging purposes
//if (x!= 5052)
//continue;
rowdata = tabledata.get(x);
//values ="";
//strColumns="";
query = "update " + tablename + " set " + columnnames[1] + "='" + rowdata[1] + "' where " + columnnames[0] + "='" + rowdata[0] + "'";
try
{
db_update_query(query);
nInsertCount++;
}
catch (SQLException sqle)
{
stdoutwriter.writeln("SQLException failed at row " + (x+1) + " " + query,Logs.ERROR,"UF15");
stdoutwriter.writeln(sqle);
}
}
stdoutwriter.writeln("Updated " + nInsertCount + " records.",Logs.STATUS2,"UF16");
}*/
/*public void customDataCheck(ArrayList<String[]> tabledata, String strTicker)
{
#*This is a custom function to compare the begin_fiscal_calendar from the nasdaq and the sec
* websites.
*#
try
{
String query = "select begin_fiscal_calendar from company where ticker='" + strTicker + "'";
ResultSet rs = db_run_query(query);
rs.next();
String strNasdaqValue = rs.getString("begin_fiscal_calendar");
if (strNasdaqValue.compareTo(tabledata.get(1)[1]) != 0)
System.out.println("VALUES DO NOT MATCH. Nasdaq: " + strNasdaqValue + ". SEC: " + tabledata.get(1)[1]);
}
catch (SQLException sqle)
{
stdoutwriter.writeln("SQL statement failed.",Logs.ERROR,"UF17");
stdoutwriter.writeln(sqle);
}
}*/
public static void createCSV(ArrayList<String[]> tabledata,String filename,boolean append)
{
try
{
BufferedWriter writer = new BufferedWriter(new FileWriter(filename,append));
String strLine="";
String[] rowdata;
for (int x=0;x<tabledata.size();x++)
{
rowdata = tabledata.get(x);
strLine="";
for (int y=0;y<rowdata.length;y++)
{
if (y !=0)
strLine = strLine +",";
strLine = strLine + "\"" + rowdata[y] + "\"";
}
writer.write(strLine);
writer.newLine();
}
writer.close(); // Close to unlock and flush to disk.
}
catch (IOException ioe)
{
stdoutwriter.writeln("Problem writing CSV file",Logs.ERROR,"UF18");
stdoutwriter.writeln(ioe);
}
}
public static void loadCSV(String filename)
//not quite functional yet
{
filename = filename.replace("\\","\\\\");
//String query = "LOAD DATA INFILE '" + filename + "' REPLACE INTO TABLE 'fact_data_stage' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n'('ticker','data_set','value')";
//db_update_query(query);
}
public static ArrayList<String[]> readInCSV(String strFilename, String strDelimiter, String strEncloseString)
{
/*This code will not correctly handle the delimiter character (e.g. ",") being inside a quoted
string (e.g. "5,600,000"). One way to handle this is to do the following:
1) Replace ,,, with |||
2) Replace ,, with ||
3) Replace "," with "|"
4) Replace , with <blank>
5) Replace | with ,
You may optionally need to do:
6) Replace ,, with ,"", (2 X)
*/
int nLineCount=0;
String nTmp="";
try
{
String strCurToken;
//StringTokenizer st;
int nTokenCount;
ArrayList<String[]> arraylist = new ArrayList<String[]>();
ArrayList<String> rowarraylist;
boolean bEncloseBefore = false;
boolean bEncloseAfter = false;
BufferedReader in = new BufferedReader(new FileReader(strFilename));
while ((nTmp = in.readLine()) != null)
{
/*if ((nLineCount < 70) || (nLineCount > 80))
continue;*/
rowarraylist = new ArrayList<String>();
/*was using string tokenizer, switch to split() since it returns tokens for adjacent delimiters*/
//st = new StringTokenizer(nTmp, strDelimiter);
String[] tokens = nTmp.split(strDelimiter);
nTokenCount = 0;
for (int z=0;z<tokens.length;z++)
{
//strCurToken = st.nextToken();
strCurToken = tokens[z];
bEncloseBefore = false;
bEncloseAfter = false;
if (strCurToken.length() > 2)
{
if (strCurToken.substring(0,1).compareTo(strEncloseString) == 0)
bEncloseBefore = true;
if (strCurToken.substring(strCurToken.length() -1,strCurToken.length()).compareTo(strEncloseString) == 0)
bEncloseAfter = true;
if (((bEncloseBefore == true) && (bEncloseAfter != true)) ||
((bEncloseBefore != true) && (bEncloseAfter == true)))
/* there's an issue with the formatting where there's only one enclosure character*/
{
stdoutwriter.writeln("Problem with enclosure characters @ line " + nLineCount,Logs.ERROR,"UF19");
return(null);
}
if ((bEncloseBefore == true) && (bEncloseAfter == true))
/* Strip out the enclosure characters */
{
strCurToken = strCurToken.substring(1,strCurToken.length() - 1);
}
}
rowarraylist.add(strCurToken);
nTokenCount++;
}
String[] strArray = new String[rowarraylist.size()];
for (int i =0;i<rowarraylist.size();i++)
{
strArray[i] = rowarraylist.get(i);
if (i==0)
stdoutwriter.writeln(strArray[i],Logs.STATUS2,"UF20");
else
stdoutwriter.writeln("," + strArray[i],Logs.STATUS2,"UF21");
}
arraylist.add(strArray);
nLineCount++;
}
stdoutwriter.writeln(nLineCount + " lines processed.",Logs.STATUS2,"UF22");
return(arraylist);
}
catch (Exception e)
{
stdoutwriter.writeln("Problem reading CSV @ line " + nLineCount,Logs.ERROR,"UF23");
stdoutwriter.writeln(e);
return(null);
}
}
public static void scrubCSV(String strFilename, String strDelimiter, String strEnclosure, String strOutFilename)
{
String strCurLine;
String strNewLine = "";
BufferedReader in = null;
BufferedWriter out = null;
try
{
in = new BufferedReader(new FileReader(strFilename));
out = new BufferedWriter(new FileWriter(strOutFilename));
Matcher matcher;
String strRegex = "(" + strEnclosure + ")";
Pattern pattern = Pattern.compile(strRegex);
//int nOpenEnclosure, nCloseEnclosure;
int nCurOffset=0;
int nLineCount =0;
while((strCurLine = in.readLine()) != null)
{
strNewLine = "";
matcher = pattern.matcher(strCurLine);
stdoutwriter.writeln(strCurLine,Logs.STATUS2,"UF25");
//nOpenEnclosure = 0;
//nCloseEnclosure = 0;
nCurOffset=0;
while (true)
{
//search for opening enclosure
//System.out.println("1 curOffset: " + nCurOffset);
if (matcher.find(nCurOffset) == false)
break;
//else
//nOpenEnclosure = matcher.end();
strNewLine = strNewLine + strCurLine.substring(nCurOffset,matcher.end());
nCurOffset = matcher.end();
//System.out.println(strNewLine);
//search for ending enclosure
if (matcher.find(nCurOffset) == false)
{
stdoutwriter.writeln("Invalid syntax for enclosure characters at line " + nLineCount,Logs.ERROR,"UF26");
break;
}
//else
//nCloseEnclosure = matcher.end();
strNewLine = strNewLine + strCurLine.substring(nCurOffset,matcher.end()).replace(strDelimiter,"");
//System.out.println(strNewLine);
//System.out.println(strCurLine.length());
if (strCurLine.length() == matcher.end())
break;
else
nCurOffset = matcher.end();
}
out.write(strNewLine);
out.newLine();
stdoutwriter.writeln(strNewLine,Logs.STATUS2,"UF27");
nLineCount++;
}
out.close();
in.close();
}
catch(Exception e)
{
stdoutwriter.writeln("Problem Scrubbing csv file",Logs.ERROR,"UF28");
stdoutwriter.writeln(e);
}
}
public static String getElapsedTimeHoursMinutesSecondsString(Long elapsedTime)
{
String format = String.format("%%0%dd", 2);
elapsedTime = elapsedTime / 1000;
String seconds = String.format(format, elapsedTime % 60);
String minutes = String.format(format, (elapsedTime % 3600) / 60);
String hours = String.format(format, elapsedTime / 3600);
String time = hours + ":" + minutes + ":" + seconds;
return time;
}
public static String[] extendArray(String[] inputArray)
{
String[] tmpArray = new String[inputArray.length + 1];
for (int i=0; i<inputArray.length;i++)
{
tmpArray[i] = inputArray[i];
}
return(tmpArray);
}
/* public static void mail(String strEmail, String strMessage, String strSubject, String strFromAddy)
{
//String host = "smtp.gmail.com";
//int port = 587;
String username = "hastapasta99";
String password = "madmax1.";
Properties props = new Properties();
props.put("mail.smtp.port","587");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "false");
//Session session = Session.getInstance(props);
Session session = Session.getInstance(props,new MyPasswordAuthenticator(username, password));
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(strFromAddy));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(strEmail));
message.setSubject(strSubject);
message.setText(strMessage);
//Transport transport = session.getTransport("smtp");
//transport.connect(host, port, username, password);
//transport.connect(host,username,password);
Transport.send(message);
} catch (MessagingException e) {
throw new RuntimeException(e);
}
}*/
}
class TestException extends Exception
{
/**
*
*/
private static final long serialVersionUID = 4426155592602941937L;
/*void TestException()
{
return;
}*/
}
class SkipLoadException extends Exception
{
/**
*
*/
private static final long serialVersionUID = -6553765592848567969L;
}
/*class MyPasswordAuthenticator extends Authenticator
{
String user;
String pw;
public MyPasswordAuthenticator (String username, String password)
{
super();
this.user = username;
this.pw = password;
}
public PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(user, pw);
}
}*/
| [
"hastapasta99@d2ea8a1b-09b1-a710-b10d-4e27fa839f9d"
] | hastapasta99@d2ea8a1b-09b1-a710-b10d-4e27fa839f9d |
a5204bce6326fc0cb447204186d85a7dbbe30f79 | e233f636be09891e79b303f5b3ab19b4e68f1209 | /imperial_parent/imperial_core/src/main/java/com/project/tool/gen/util/VelocityInitializer.java | a155c20b75880bc4feda49d8e59901aeff7ce391 | [] | no_license | hyw1297414117/2020-09-04 | 8bbd2bd077a424ba00362ba0d265dd38bc32e19f | e0002b45d33d5fe05d0f4ab18b4c96c17b413373 | refs/heads/master | 2022-12-15T18:25:16.257247 | 2020-09-04T06:13:12 | 2020-09-04T06:13:12 | 293,968,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package com.project.tool.gen.util;
import java.util.Properties;
import org.apache.velocity.app.Velocity;
import com.common.constant.Constants;
/**
* VelocityEngine工厂
*
* @author RuoYi
*/
public class VelocityInitializer
{
/**
* 初始化vm方法
*/
public static void initVelocity()
{
Properties p = new Properties();
try
{
// 加载classpath目录下的vm文件
p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
// 定义字符集
p.setProperty(Velocity.ENCODING_DEFAULT, Constants.UTF8);
p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8);
// 初始化Velocity引擎,指定配置Properties
Velocity.init(p);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
| [
"462799794@qq.com"
] | 462799794@qq.com |
7885d2abfe0da97aa28ee9b726b51b39998bd988 | c59c1bacea0fe9538a73fbae60536d1cb3bdc8dc | /possys/src/main/java/kr/or/possys/Staff_service/Staff_interceptor.java | 5e97a657327baa35d1d311c0d65580ec46f6b140 | [] | no_license | jinetinbsw/possys | bfeac72269c9e0ed8993cf8e14099592fdc61376 | a6aa9f74ab54a341dd4bfa9dda730cc452cb8ff7 | refs/heads/master | 2021-01-20T07:13:08.539160 | 2017-05-05T00:23:00 | 2017-05-05T00:23:00 | 89,908,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package kr.or.possys.Staff_service;
public class Staff_interceptor {
}
| [
"OWNER@192.168.52.128"
] | OWNER@192.168.52.128 |
633c267224672cca18f7f5fb19afe6eeb99fdaa8 | d1c35b77ced39d225473d6737f27699b3e7d8db1 | /springboot/springboot-dubbo-client/src/main/java/com/springboot/yzhao/springbootdubboclient/SpringbootDubboClientApplication.java | 477858998a5d76f71a56a42341355ef9ae441d77 | [] | no_license | kenzhaoyihui/javase_L | f5ec3635f99a41c75da9d6a89299507f03df65b6 | 1dd7dee3486c0cb9dadd41ae6f2e178848bb69a3 | refs/heads/master | 2020-03-16T00:27:24.139875 | 2018-07-30T17:04:12 | 2018-07-30T17:04:12 | 132,417,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.springboot.yzhao.springbootdubboclient;
import com.springboot.yzhao.springbootdubboclient.dubbo.CityDubboConsumerService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
@SpringBootApplication
public class SpringbootDubboClientApplication {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(SpringbootDubboClientApplication.class, args);
CityDubboConsumerService cityDubboConsumerService = context.getBean(CityDubboConsumerService.class);
cityDubboConsumerService.printCity("Nanjing");
//SpringApplication.run(SpringbootDubboClientApplication.class, args);
}
}
| [
"yzhao@redhat.com"
] | yzhao@redhat.com |
4d2af4dd53a80cc4b897a2cd7154c6ac85c14e13 | a60d1b37434b83957b5f4e36cf97b52238519e50 | /Homework23/cucumberproj/src/test/java/cucumber/MoveEmailToSpamSteps.java | 0a0377d92d7f34466d3de0e97a7e7682797a4a7b | [] | no_license | AnastassiaGS/works | 1db1ee8bf2d0053bfe94d90aa240a5db4e07b39e | e890aebff6951dbc12a8033b021e6b8cb406b11e | refs/heads/master | 2020-03-28T18:58:52.044867 | 2018-11-30T16:16:18 | 2018-11-30T16:16:18 | 148,932,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,152 | java | package cucumber;
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.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class MoveEmailToSpamSteps {
private static final String MAIN_URL = "http://mail.ru";
private static final String CHROMEDRIVER_EXE = "e:\\Java\\progi\\chromedriver_win32 (1)\\chromedriver.exe";
private static final String LOGIN = "vasus82";
private static final String PASSWORD = "82vfhfljyf30";
private MoveEmailToSpam moveEmailToSpam;
private WebDriver webDriver;
public MoveEmailToSpamSteps()
{
String exePath = CHROMEDRIVER_EXE;
System.setProperty("webdriver.chrome.driver", exePath);
webDriver = new ChromeDriver();
moveEmailToSpam = new MoveEmailToSpam(webDriver);
}
@Given("^I am on a page with \"([^\"]*)\")$")
public void loadMainPage()
{
webDriver.get(MAIN_URL);
}
@When("^I enter login \"([^\"]*)\")$")
public void enterLoginInField(String login)
{
moveEmailToSpam.enterLogin(LOGIN);
}
@And("^I enter password \"([^\"]*)\")$")
public void enterPasswordInField(String password)
{
moveEmailToSpam.enterPassword(PASSWORD);
}
@And("^I click on a button \"([^\"]*)\")$")
public void clickOnButtonEnter()
{
moveEmailToSpam.clickEnterButton();
}
@And("^ I mark a check box$")
public void markCheckBox()
{
moveEmailToSpam.clickButtonCheckBox();
}
@And("^I click on a button \"([^\"]*)\")$")
public void pressButtonSpam()
{
moveEmailToSpam.clickButtonMoveToSpam();
}
@Then("^I see a message \"([^\"]*)\")$")
public void seeMessageEmailMovedToSpam()
{
Assert.assertNotNull(moveEmailToSpam.messageEmailMovedToSpamAppears());
}
@After
public void afterClass()
{
webDriver.quit();
}
}
| [
"vasus82@mail.ru"
] | vasus82@mail.ru |
e0524beb5bb6d6494aef7d13e8ada032c7721fdd | 0af804bd60801bcd4d918db898a6e95e96771ed2 | /src/calculator/Calculator.java | 74297c91a87ebffad42c6c259ddb3d85d412ce28 | [] | no_license | mixedbystefan/TDD_Calculator | 91376c87f0fe8880989bbd1b6a4f983ddd31b464 | 6606342b99e6e6faa89af69a2f179e84e53c9b20 | refs/heads/master | 2020-04-28T21:50:11.625439 | 2019-03-15T14:05:31 | 2019-03-15T14:05:31 | 175,596,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,594 | java | package calculator;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Scanner;
import javax.annotation.processing.RoundEnvironment;
import javax.management.RuntimeErrorException;
import javax.xml.bind.ParseConversionEvent;
import org.junit.internal.builders.IgnoredBuilder;
import org.omg.CosNaming.NamingContextExtPackage.AddressHelper;
public class Calculator {
StringBuffer sBuffer;
StringBuffer sBuf;
Calculator check;
boolean memoryInUse=false;
String regex = "(?<=[\\(\\)\\+\\-*%√\\/\\^A-Za-z])|(?=[\\(\\)\\+\\-*%√\\/\\^A-Za-z])";
String updatedExpression="";
boolean isChar;
// main metod med konsol-gränssnitt
public static void main(String[] args)
{
System.out.println("Miniräknaren");
String loop = "calc";
while (loop.equalsIgnoreCase("calc"))
{
System.out.print(">");
Scanner scanner =new Scanner(System.in);
String input = scanner.nextLine();
// Om man trycker q + Enter avslutas appen
if(input.equalsIgnoreCase("q"))
{
loop="quit";
System.exit(0);
}
else
{
Calculator calculator = new Calculator();
String output = calculator.calculateExpression(input);
// Resultatet skrivs ut och en double med .0 visas utan decimaler
System.out.println("Resultat: " + round(output));}
}
}
// Metod som egentligen bara sköter paranteserna men som anropar "huvudmetoden" och bygger
// en ny sträng när paranteserna är utträknade. Returnerar också svaret.
public String calculateExpression(String s)
{
check = new Calculator();
checkForBracketsWithinBrackets(s);
while(s.contains(Character.toString('('))||s.contains(Character.toString(')')))
{
for(int o=0; o<s.length();o++)
{
try
{ //
if((s.charAt(o)==')' || Character.isDigit(s.charAt(o))) // Kollar om parentesen kan räknas ut och ersättas av *
&& s.charAt(o+1)=='(') // Beroende på index bredvid
{
s=s.substring(0,o+1)+"*"+(s.substring(o+1));
}
}
catch (Exception ignored){/* Används bara för att programmet inte ska crascha om ifsatsens innehåll inte funkar*/}
if(s.charAt(o)==')')
{
for(int i=o; i>=0;i--)
{
if(s.charAt(i)=='(') // Skickar in det som ligger mellan parentserna i uträkningsmetoden
{
String in = s.substring(i+1,o);
in = check.doMath(in);
s=s.substring(0,i)+in+s.substring(o+1); // Gör en ny sträng utifrån inputsträngen och uträknad parentes
i=o=0;
}
}
}
}
// Kollar så det inte finns parenteser som inte har någon motsvarande parantes
if(s.contains(Character.toString('('))||s.contains(Character.toString(')'))||
s.contains(Character.toString('('))||s.contains(Character.toString(')')))
{
throw new RuntimeErrorException(null, "Måste finnas öppnande och stängande parentes");
}
}
// Kontrollerar så
s=check.doMath(s);
return s;
}
// Huvudmetod som anropar metoder för beräkningar
// anropar en metod beroende på input och returnerar en summa till calculateExpression()
// For-loopar går igenom den Lista som skapas från inputsträngen och går igenom alla räknesätt
// I den ordning de är prioriterade. Beräkningar som är gjorda skriver över det som räknats ut med summan
// och mellan varje räknesätt så tas alla raderade(tomma) index bort.
// En variabeln för minne (mem och mem_2) används för att direkt kunna plocka in resultatet av
// tidigare uträkning under pågående for-loop.
public String doMath(String expression) {
double result = 0.0;
double mem = 0.0;
double mem_2 = 0.0;
// Ersätter -- med + osv
expression = adjustStackedOperands(expression);
// Delar upp input i en lista
String temp[] = expression.split(regex);
// Kollar så att input inte innehåller bokstäver mm
validateInput(temp);
if (temp.length >1)
{
for (int i=0; i<temp.length; i++)
{
if (temp[i].equals(("√")))
{
result = root(Double.parseDouble(temp[i+1]));
temp[i+1]=Double.toString(result);
mem=0.0;
try {
if (temp[i-1].equals("*"))
{
temp[i-1]="";
}
if (temp[i-1].equals("-"))
{
temp[i]="-";
temp[i-1]="";
}
else temp[i]="*";
} catch (Exception ignored) {
temp[i]="";
}
}
if (temp[i].equals(("^")))
{
double d1 = Double.parseDouble(temp[i-1]);
double d2 = Double.parseDouble(temp[i+1]);
result = exponent(d1, d2);
temp[i-1]="";
temp[i]="";
temp[i+1]=Double.toString(result);
mem=0.0;
}
if (temp[i].equals(("l")))
{
double d = Double.parseDouble(temp[i+1]);
result = logarithm(d);
temp[i]="*";
temp[i+1]=Double.toString(result);
mem=0.0;
}
}
// metod som tar bort tomma index
temp = refreshList(temp);
for (int i=0; i<temp.length; i++)
{
// Tar bort + om detta inleder ekvationen
if(temp[0].equalsIgnoreCase("+")) {temp[0]=""; continue;}
if(temp[temp.length-1].equalsIgnoreCase("+")) {temp[temp.length-1]="";}
// Om indexet håller + eller - så nollställs minnet
if (temp[i].equals(("+"))|| temp[i].equals(("-")))
{mem=0.0;}
if (temp[i].equals(("*"))|| temp[i].equals(("/"))|| temp[i].equals(("%")))
{
double d1 = Double.parseDouble(temp[i-1]);
double d2 = 0;
// Om ett tal ser ut som 4*-2 så skickas talet efter "-" in i metoden som ett negativt tal
if(isDouble(temp[i+1])) {d2 = Double.parseDouble(temp[i+1]);}
else d2 = -(Double.parseDouble(temp[i+2]));
if (temp[i].equals(("*")))
{
if (mem==0.0)
{
result = multiply(d1, d2); mem=result;
}
else
{
result = multiply(mem, d2); mem=result;
}
temp[i-1]="";
temp[i]="";
temp[i+1]=Double.toString(result);
}
if (temp[i].equals(("/")))
{
if (mem==0.0)
{
result = divide(d1, d2); mem=result;
}
else
{
result = divide(mem, d2); mem=result;
}
temp[i-1]="";
temp[i]="";
temp[i+1]=Double.toString(result);
}
if (temp[i].equals(("%")))
{
int res;
if (mem==0.0)
{
int _d1 = (int)d1;
int _d2 = (int)d2;
res = modulus(_d1, _d2);
}
else
{
int _d2 = (int)d2;
int _mem= (int) mem;
res = modulus(_mem, _d2);
}
temp[i]="";
temp[i-1]="";
temp[i+1]=Integer.toString(res);
}
}
}
// metod som tar bort tomma index
temp = refreshList(temp);
memoryInUse=false;
// For loop som går igenom + och -
for (int i=0; i<temp.length; i++)
{
if (temp[i].equals(("+"))|| temp[i].equals(("-")))
{
double d1 = 0;
if (i==0) {continue;}
else {d1 = Double.parseDouble(temp[i-1]);}
double d2 = Double.parseDouble(temp[i+1]);
if (temp[i].equals(("+")))
{
if (mem_2==0.0 && memoryInUse==false) {
result = add(d1, d2); mem_2=result; memoryInUse=true;
}
else
{
result = add(mem_2, d2); mem_2=result;
}
}
if (temp[i].equals(("-")))
{
if (mem_2==0.0 && memoryInUse==false)
{
result = subtract(d1, d2); mem_2=result; memoryInUse=true;
}
else
{
result = subtract(mem_2, d2); mem_2=result;
}
}
}
}
}
// Om input från användare bara är en siffra så returneras denna som svar
else return expression;
// Resultat returneras
String out = Double.toString(result);
return out;
}
// Om resultatet miniräknaren ger har en decimal men .0 så tas denna bort
private static String round(String result)
{
if(isInteger(Double.parseDouble(result)))
{
result=Integer.toString(checkDoubleAsInt(Double.parseDouble(result)));
}
return result;
}
// Korigerar strängen vid olika fall av inputs som ska fungera men måste korrigeras för
// att inte crascha programmet
private String adjustStackedOperands(String expression)
{
String plusMinusToMinus = expression.replace("+-", "-");
String ZeroTimesMinus = plusMinusToMinus.replace("0*-", "0*");
String MinusPlusToMinus = ZeroTimesMinus.replace("-+", "-");
String logTol = MinusPlusToMinus.replace("log", "l");
String logTol_2 = logTol.replace("Log", "l");
String logTol_3 = logTol_2.replace("LOG", "l");
String multiplyBeforeRoot = logTol_3.replace("*√", "√");
String twoMinusEqPlus =multiplyBeforeRoot.replace("--", "+");
// Om första tecknet är - så läggs en nolla till innan
if (twoMinusEqPlus.substring(0, 1).equalsIgnoreCase("-")){
String updatedInput= "0" + twoMinusEqPlus;
twoMinusEqPlus = updatedInput;
}
// Om första tecknet är * så skickas felmeddelande
if (expression.substring(0, 1).equalsIgnoreCase("*")|| expression.substring(0, 1).equalsIgnoreCase("/"))
{throw new ArrayIndexOutOfBoundsException("Första tecknet får inte vara * eller /!");}
return twoMinusEqPlus;
}
private void checkForBracketsWithinBrackets(String s)
{
String temp[] = s.split(regex);
int x =0;
for (String i : temp)
{
// Om två parenteser i rad är åt samma håll så kastas undantag
if (i.equals("(")) {x++;}
if (i.equals(")")) {x--;}
if (x>1) {throw new RuntimeErrorException(null, "Parantes inom Parentes är inte implementerad i miniräknaren");}
}
}
// Kontrollerar så inte bokstäver används samt att operander inte läggs efter varandra i otillåten ordning
private void validateInput(String[] temp) {
try
{
for (String o : temp)
{
isChar = o.matches("[a-öA-Ö]{1}");
if (isChar && !o.equals("^") && !o.equalsIgnoreCase("l"))
{
throw new NumberFormatException("Inga bokstäver");
}
for (int i=0; i<temp.length; i++)
{
if (temp[i].equals("*") && temp[i+1].equals("*"))
{
throw new NumberFormatException("** = Otillåten kombination av operander");
}
if (temp[i].equals("/") && temp[i+1].equals("/"))
{
throw new NumberFormatException("// = Otillåten kombination av operander");
}
if (temp[i].equals("*") && temp[i+1].equals("/"))
{
throw new NumberFormatException("*/ = Otillåten kombination av operander");
}
if (temp[i].equals("/") && temp[i+1].equals("*"))
{
throw new NumberFormatException("/* = Otillåten kombination av operander");
}
}
}
}
catch (InputMismatchException e)
{
e.printStackTrace();
System.err.println("Otillåten input");
}
}
// Kollar om strängen är en double
public boolean isDouble(String value) {
try {
Double.parseDouble(value);
return true;
} catch (NumberFormatException e) {
return false;
}
}
private static boolean isInteger(double d){
double dAbs = Math.abs(d);
int i = (int) dAbs;
double result = dAbs - (double) i;
if(result<0.00001){
return true;
}else{
return false;
}
}
private static int checkDoubleAsInt(double d){
double dAbs = Math.abs(d);
int i = (int) dAbs;
double result = dAbs - (double) i;
if(result<0.0001){
return d<0 ? -i : i;
}else{
return 998877665;
}
}
private boolean isNumberWithinRange(Double result)
{
try
{
if (result< Double.MAX_VALUE)
{
return true;
}
else return false;
}
catch (Exception Ignored) {
return false;
}
}
// Uppdaterar listan genom att ta bort tomma index
public String[] refreshList(String[] temp) {
StringBuffer sBuffer = new StringBuffer();
for (String i : temp)
{
sBuffer.append(i);
}
updatedExpression = sBuffer.toString();
temp = updatedExpression.split(regex);
return temp;
}
// Alla metoder för själva beräkningarna
//add
public double add(double d1, double d2)
{
if (isNumberWithinRange(d1+d2)) {return d1 + d2;}
else throw new InputMismatchException("För stort double-värde");
}
//subtract
public double subtract(double d1, double d2)
{
return d1 - d2;
}
//multiply
public double multiply(double d1, double d2)
{
// om d1*d2 är inom gränsen (<double_MAX) för en double returneras svaret
if (isNumberWithinRange(d1*d2)) {return d1 * d2;}
else throw new InputMismatchException("För stort double-värde");
}
//divide
public double divide(double d1, double d2)
{
if (isNumberWithinRange(d1/d2)) {return d1 / d2;}
if (d2==0) {throw new ArithmeticException("Du kan inte dela med 0!"); }
else throw new InputMismatchException("För stort double-värde");
}
// modulus %
public int modulus(int d1, int d2)
{
return Math.floorMod(d1, d2);
}
// root √
public double root(double d1)
{
return Math.sqrt(d1);
}
// exponent ^
public double exponent(double d1, double d2 )
{
return Math.pow(d1, d2);
}
// base 10 logarithm 10 - skrivs som "log" eller "l"
public double logarithm(double d1)
{
return Math.log10(d1);
}
} | [
"mixedbystefan@gmail.com"
] | mixedbystefan@gmail.com |
1f825b0ca2786073c889f7a027751e1c5e1055d4 | 16c86726627a0c2ab2ec803dba1deb6c88137a04 | /chapter_001/src/test/java/ru/job4j/max/package-info.java | 854b51ad63a7e331c79490cc7ac98154522c95f4 | [
"Apache-2.0"
] | permissive | nvladislavn/job4j | c4576b4bf403550f5e8ab40013b5d41581a4c808 | e0245dc749a15348d20ace229547d176e309772a | refs/heads/master | 2022-09-17T15:53:07.708553 | 2020-08-05T09:05:33 | 2020-08-14T07:45:19 | 151,955,530 | 0 | 0 | Apache-2.0 | 2022-09-01T23:21:49 | 2018-10-07T15:25:29 | Java | UTF-8 | Java | false | false | 114 | java | /**
*Package for MaxTest.
*@author Vladislav Nechaev
@since 15/10/2018
@version $Id$
*/
package ru.job4j.max; | [
"nvladislavn@gmail.com"
] | nvladislavn@gmail.com |
47ffa562d5f01dc360882aaf61f79405195a6f25 | 129f58086770fc74c171e9c1edfd63b4257210f3 | /src/testcases/CWE690_NULL_Deref_From_Return/CWE690_NULL_Deref_From_Return__getParameter_Servlet_equals_54b.java | 8892a6c03c02eeb630b833d99c2141bbfdcc28dc | [] | no_license | glopezGitHub/Android23 | 1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba | 6215d0684c4fbdc7217ccfbedfccfca69824cc5e | refs/heads/master | 2023-03-07T15:14:59.447795 | 2023-02-06T13:59:49 | 2023-02-06T13:59:49 | 6,856,387 | 0 | 3 | null | 2023-02-06T18:38:17 | 2012-11-25T22:04:23 | Java | UTF-8 | Java | false | false | 1,818 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE690_NULL_Deref_From_Return__getParameter_Servlet_equals_54b.java
Label Definition File: CWE690_NULL_Deref_From_Return.label.xml
Template File: sources-sinks-54b.tmpl.java
*/
/*
* @description
* CWE: 690 Unchecked return value is null, leading to a null pointer dereference.
* BadSource: getParameter_Servlet Set data to return of getParameter_Servlet
* GoodSource: Set data to fixed, non-null String
* Sinks: equals
* GoodSink: Call equals() on string literal (that is not null)
* BadSink : Call equals() on possibly null object
* Flow Variant: 54 Data flow: data passed as an argument from one method through three others to a fifth; all five functions are in different classes in the same package
*
* */
package testcases.CWE690_NULL_Deref_From_Return;
import testcasesupport.*;
import java.sql.*;
import javax.servlet.http.*;
public class CWE690_NULL_Deref_From_Return__getParameter_Servlet_equals_54b
{
public void bad_sink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
(new CWE690_NULL_Deref_From_Return__getParameter_Servlet_equals_54c()).bad_sink(data , request, response);
}
/* goodG2B() - use goodsource and badsink */
public void goodG2B_sink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
(new CWE690_NULL_Deref_From_Return__getParameter_Servlet_equals_54c()).goodG2B_sink(data , request, response);
}
/* goodB2G() - use badsource and goodsink */
public void goodB2G_sink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
(new CWE690_NULL_Deref_From_Return__getParameter_Servlet_equals_54c()).goodB2G_sink(data , request, response);
}
}
| [
"guillermo.pando@gmail.com"
] | guillermo.pando@gmail.com |
491626f6f0f2cc7d1d497ec91487ce2a037f9b05 | 1e109337f4a2de0d7f9a33f11f029552617e7d2e | /jcatapult-mvc/tags/1.0-RC7/src/java/main/org/jcatapult/mvc/result/message/control/FieldMessages.java | 17e3dbf68033dc3890b64abf4e1ac4dbe3fe8d3f | [] | no_license | Letractively/jcatapult | 54fb8acb193bc251e5984c80eba997793844059f | f903b78ce32cc5468e48cd7fde220185b2deecb6 | refs/heads/master | 2021-01-10T16:54:58.441959 | 2011-12-29T00:43:26 | 2011-12-29T00:43:26 | 45,956,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,214 | java | /*
* Copyright (c) 2001-2007, JCatapult.org, All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.jcatapult.mvc.result.message.control;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jcatapult.mvc.message.MessageStore;
import org.jcatapult.mvc.message.scope.MessageType;
import org.jcatapult.mvc.result.control.AbstractControl;
import org.jcatapult.mvc.result.control.annotation.ControlAttributes;
import com.google.inject.Inject;
/**
* <p>
* This class is the control that outputs the field messages.
* </p>
*
* @author Brian Pontarelli
*/
@ControlAttributes(
required = {"errors"}
)
public class FieldMessages extends AbstractControl {
private final MessageStore messageStore;
@Inject
public FieldMessages(MessageStore messageStore) {
this.messageStore = messageStore;
}
/**
* Adds the field messages.
*
* @param attributes The attributes.
* @param dynamicAttributes The dynamic attributes. Dynamic attributes start with underscores.
* @return The parameters.
*/
@Override
protected Map<String, Object> makeParameters(Map<String, Object> attributes, Map<String, String> dynamicAttributes) {
Map<String, Object> parameters = super.makeParameters(attributes, dynamicAttributes);
parameters.put("field_messages", trim(messageStore.getFieldMessages(MessageType.PLAIN), (String) attributes.get("fields")));
parameters.put("field_errors", trim(messageStore.getFieldMessages(MessageType.ERROR), (String) attributes.get("fields")));
return parameters;
}
/**
* If the fields parameter is null, this does not change the field messages map. If it is not null,
* this splits the fields by commas and removes all the fields that aren't in the list.
*
* @param fieldMessages The field messages to trim.
* @param fields The list of fields to display.
* @return The result.
*/
protected Map<String, List<String>> trim(Map<String, List<String>> fieldMessages, String fields) {
if (fields == null) {
return fieldMessages;
}
String[] names = fields.split(",");
Set<String> set = new HashSet<String>();
for (String name : names) {
set.add(name.trim());
}
fieldMessages.keySet().retainAll(set);
return fieldMessages;
}
/**
* @return Null.
*/
protected String startTemplateName() {
return null;
}
/**
* @return The actionmessages.ftl.
*/
protected String endTemplateName() {
return "field-messages.ftl";
}
} | [
"leafknode@b10e9645-db3f-0410-a6c5-e135923ffca7"
] | leafknode@b10e9645-db3f-0410-a6c5-e135923ffca7 |
4968fd4c4d0c6b22bc0eb8a779af76ee77c33d8a | f6a8263637ede8c4c458001b77fec4243163c85e | /Tercer Parcial/05AlumnosClasesGenericas/src/alumnosclasesgenericas/AlumnosClasesGenericas.java | 4efaa9b3e9ca53a568b856728604a3ebca82ec4d | [] | no_license | BernardoMB/NetBeans-Projects | 5911c577396b27be8680dbe43757bbb82788bf05 | ac375283a71951ae368a2b376a244d347792d0e1 | refs/heads/master | 2020-06-12T15:41:40.978051 | 2016-12-08T15:21:00 | 2016-12-08T15:21:00 | 75,798,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,293 | java | package alumnosclasesgenericas;
import java.io.File;
import java.util.Scanner;
public class AlumnosClasesGenericas {
// Cantidad de alumnos.
public static final int ALUMNOS = 50;
// Cantidad de tareas.
public static final int TAREAS = 20;
// Vector generico.
public static Vector<Alumno> grupo;
public static void leeInfo() {
File datos;
Scanner lee;
int cl, ct, i;
String nom;
double t[];
grupo = new Vector<Alumno>(ALUMNOS);
datos = new File("alumnos.txt");
try {
lee = new Scanner(datos);
} catch (Exception e) {
lee = null;
}
if (lee != null) {
// El While no necesita controlar que no se nos pase de DIM porque el metodo de la clase vector ya se fija en eso.
while (lee.hasNextInt()) {
cl = lee.nextInt();
lee.nextLine();
nom= lee.nextLine();
t = new double[TAREAS];
ct = lee.nextInt();
for (i = 0; i < ct; i++) {
if (i < TAREAS) {
t[i] = lee.nextDouble();
} else {
lee.nextDouble();
}
}
grupo.alta(new Alumno(cl, nom, ct, t));
}
lee.close();
}
}
// Metodo para mostrat el alumno que el usuario proporcione;
public static void muestraUno() {
Scanner lee;
int cl, loc;
lee = new Scanner(System.in);
System.out.print("\nClave para buscar: ");
cl = lee.nextInt();
loc = grupo.buscaSecuencial(new Alumno(cl));
if (loc == -1) {
System.out.println(" Se fue a la Ibero");
} else {
System.out.println("\n\t" + grupo.getElemento(loc));
}
}
public static void main(String[] args) {
leeInfo();
System.out.println("\n\t\tGRUPO DE SINFOROSA\n" + grupo);
muestraUno();
System.out.println("\nBaja de 4321:" + grupo.bajaSinOrden(new Alumno(4321)));
System.out.println("\n\t\tGRUPO DE SINFOROSA\n" + grupo);
}
}
| [
"BernardoMB"
] | BernardoMB |
241a905019b144639f35abd68ed637c51079ca37 | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/OpenWatch_OpenWatch-Android/app/OpenWatch/src/org/ale/openwatch/OWMissionAdapter.java | e3f6afab8338f34ca0a1fcbb3a36863ead26fbdb | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,752 | java | // isComment
package org.ale.openwatch;
import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.SimpleCursorAdapter;
import android.text.format.DateUtils;
import android.text.util.Linkify;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.nostra13.universalimageloader.core.ImageLoader;
import org.ale.openwatch.constants.Constants;
import org.ale.openwatch.constants.DBConstants;
import java.text.ParseException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class isClassOrIsInterface extends SimpleCursorAdapter {
// isComment
// isComment
Linkify.TransformFilter isVariable = new Linkify.TransformFilter() {
public final String isMethod(final Matcher isParameter, String isParameter) {
return isNameExpr.isMethod(isIntegerConstant);
}
};
// isComment
Pattern isVariable = isNameExpr.isMethod("isStringConstant");
String isVariable = "isStringConstant";
public isConstructor(Context isParameter, Cursor isParameter) {
super(isNameExpr, isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr, new String[] {}, new int[] {}, isIntegerConstant);
}
@Override
public void isMethod(View isParameter, Context isParameter, Cursor isParameter) {
// isComment
ViewCache isVariable = (ViewCache) isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr);
if (isNameExpr == null) {
isNameExpr = new ViewCache();
isNameExpr.isFieldAccessExpr = (TextView) isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = (ImageView) isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = (TextView) isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
if (isNameExpr.isMethod(isNameExpr.isFieldAccessExpr) == null || isNameExpr.isMethod(isNameExpr.isFieldAccessExpr).isMethod("isStringConstant") == isIntegerConstant)
isNameExpr.isFieldAccessExpr.isMethod(isNameExpr.isFieldAccessExpr);
else {
isNameExpr.isFieldAccessExpr.isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr));
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr, isNameExpr, null, isNameExpr);
isNameExpr.isFieldAccessExpr.isMethod(isNameExpr.isFieldAccessExpr);
// isComment
isNameExpr.isFieldAccessExpr.isMethod(null);
}
try {
isNameExpr.isFieldAccessExpr.isMethod("isStringConstant" + isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr)).isMethod()));
} catch (ParseException isParameter) {
isNameExpr.isMethod();
}
isNameExpr.isFieldAccessExpr.isMethod();
if (isNameExpr.isFieldAccessExpr != isNameExpr.isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr)) && isNameExpr.isMethod(isNameExpr.isFieldAccessExpr) != null && isNameExpr.isMethod(isNameExpr.isFieldAccessExpr).isMethod("isStringConstant") != isIntegerConstant) {
isNameExpr.isMethod().isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr), isNameExpr.isFieldAccessExpr);
} else if (isNameExpr.isMethod(isNameExpr.isFieldAccessExpr) == null || isNameExpr.isMethod(isNameExpr.isFieldAccessExpr).isMethod("isStringConstant") == isIntegerConstant) {
isNameExpr.isFieldAccessExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr);
}
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod(isNameExpr.isFieldAccessExpr));
isNameExpr.isFieldAccessExpr = isNameExpr.isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr));
}
// isComment
static class isClassOrIsInterface {
TextView isVariable;
TextView isVariable;
ImageView isVariable;
int isVariable;
int isVariable;
int isVariable;
int isVariable;
int isVariable;
int isVariable;
}
}
| [
"matheus@melsolucoes.net"
] | matheus@melsolucoes.net |
88e1423694dca42742c1260d0299e30fa1e70096 | 9aa5d43df8bdfece699b59c2575a30ed77ac94e3 | /src/com/lex/demo/Account.java | 1e5e8f1de10c0dcf74bdbca34b77a014923a0b35 | [] | no_license | singhabhi04/JavaBasics | 220961b9b76837607dbd4f57a668b776072d67f4 | 127ad5749bd750e3e9d00301013999a16d732bd7 | refs/heads/master | 2022-07-19T01:16:42.712624 | 2020-05-24T14:25:45 | 2020-05-24T14:25:45 | 266,481,750 | 0 | 0 | null | 2020-05-24T14:25:46 | 2020-05-24T06:14:33 | Java | UTF-8 | Java | false | false | 373 | java | package com.lex.demo;
public class Account {
double balance;
public static void main(String args[]) {
Account account1 = null; // Line1
Account account2 = null; // Line2
account1 = new Account(); // Line 3
account2 = new Account(); // Line 4
account2 = account1; // Line 5
account1 = new Account(); // Line 6
System.out.println(account1.balance);
}
}
| [
"Abhishek.topa@gmail.com"
] | Abhishek.topa@gmail.com |
0800528735c9303f4f16d782bfadaa12da206c68 | 840dca5777bc07f1d7e6e57c7f2ef8e3a6afbf72 | /graduation/src/com/mvc/service/TopicreportService.java | 9837ad63c63ce27e1aa7c4d61a9f38266c533ded | [] | no_license | huangzec/graduation | 587993b78d8dfad87db3f1b4223d91a83e213296 | 1f59af23929dbe77ad7c97377aab74840cf8a3e5 | refs/heads/master | 2016-09-05T16:40:43.380546 | 2015-01-27T12:41:47 | 2015-01-27T12:41:47 | 25,415,162 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,715 | java | package com.mvc.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mvc.common.Pagination;
import com.mvc.dao.TopicreportDao;
import com.mvc.entity.Topicreport;
import com.mvc.exception.VerifyException;
/**
* 开题报告书服务层
* @author huangzec@foxmail.com
*
*/
@Service
public class TopicreportService {
@Autowired
private TopicreportDao topicreportDao;
/**
* 添加
*
* @Description
* @author huangzec@foxmail.com
* @date 2014-09-14 16:12:54
* @return void
* @throws VerifyException
*/
public void addOne(Topicreport topicreport) throws VerifyException {
topicreportDao.save(topicreport);
}
/**
* 通过ID获取一条记录
*
* @Description
* @author huangzec@foxmail.com
* @date 2014-09-14 16:12:54
* @return Topicreport
*/
public Topicreport getOneRecordById(int id) {
return topicreportDao.getById(id);
}
/**
* 删除一条记录
*
* @Description
* @author huangzec@foxmail.com
* @date 2014-09-14 16:12:54
* @return void
* @throws VerifyException
*/
public void removeOneTopicreport(Topicreport topicreport) throws VerifyException {
topicreportDao.remove(topicreport);
}
/**
* 编辑
*
* @Description
* @author huangzec@foxmail.com
* @date 2014-09-14 16:12:54
* @return void
* @throws VerifyException
*/
public void editOneTopicreport(Topicreport topicreport) throws VerifyException {
topicreportDao.update(topicreport);
}
/**
* 获取所有记录
*
* @Description
* @author huangzec@foxmail.com
* @date 2014-09-14 16:12:54
* @return Object
* @throws VerifyException
*/
public Object getAllRowsByWhere(String where) throws VerifyException {
return topicreportDao.getAll(where);
}
/**
* 分页获取记录
*
* @Description
* @author huangzec@foxmail.com
* @date 2014-09-14 16:12:54
* @return List<Topicreport>
* @throws VerifyException
*/
public List<Topicreport> getAllRecordByPages(String where, Pagination pagination) throws VerifyException {
return topicreportDao.getAllRecordByPages(where, pagination);
}
/**
* 通过where条件获取一条记录
*
* @Description
* @author huangzec@foxmail.com
* @date 2014-10-2 下午03:26:37
* @return Topicreport
* @throws VerifyException
*/
public Topicreport getRecordByWhere(String where) throws VerifyException {
return topicreportDao.getOne(where);
}
/**
* 保存一条记录,返回ID
* @param topicreport
* @return int
*/
public int addOneReturn(Topicreport topicreport) {
return topicreportDao.addOneReturn(topicreport);
}
}
| [
"huangzec@foxmail.com"
] | huangzec@foxmail.com |
7702ed59956a7cc9ee70a97cb5f1d2d83d043abb | 201aea5c25f826bd3519610ed1d57f564f75c9ff | /BigBank/gen/com/org/lxh/BuildConfig.java | 1780f78bae645e87f727167706c3e19bdf02274e | [] | no_license | PandaChen/BigBank | 9412a99595214e6af4cbb862ff4a39c0e5c87dd5 | 7ec64e59f77a146ad7864570500deecfb73fc2c3 | refs/heads/master | 2021-01-22T23:43:21.950783 | 2014-06-26T11:01:03 | 2014-06-26T12:00:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | /** Automatically generated file. DO NOT MODIFY */
package com.org.lxh;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"Administrator@PC201404182156"
] | Administrator@PC201404182156 |
b2c01573e5e8cbc11c4dcb8e9f3ab07bcc92b868 | 43755082c9a4fd1d37fe4baa7c3a278a8090aa22 | /src/main/java/guru/springframework/spring5mongorecipeapp/converters/RecipeToRecipeCommand.java | 64383363bd27061e0b61f9dcbc3eb093ce7626b9 | [] | no_license | xuzishuo1996/spring5-mongo-recipe-app | 041448e8f94fc533c196711a5b710e0f2328229e | ca22ba163d811911112bee55743ca89477ca8e35 | refs/heads/master | 2022-12-09T01:17:55.482481 | 2020-09-10T06:03:19 | 2020-09-10T06:03:19 | 289,685,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,399 | java | package guru.springframework.spring5mongorecipeapp.converters;
import guru.springframework.spring5mongorecipeapp.commands.RecipeCommand;
import guru.springframework.spring5mongorecipeapp.domain.Category;
import guru.springframework.spring5mongorecipeapp.domain.Recipe;
import lombok.Synchronized;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
@Component
public class RecipeToRecipeCommand implements Converter<Recipe, RecipeCommand>{
private final CategoryToCategoryCommand categoryConverter;
private final IngredientToIngredientCommand ingredientConverter;
private final NotesToNotesCommand notesConverter;
public RecipeToRecipeCommand(CategoryToCategoryCommand categoryConverter, IngredientToIngredientCommand ingredientConverter,
NotesToNotesCommand notesConverter) {
this.categoryConverter = categoryConverter;
this.ingredientConverter = ingredientConverter;
this.notesConverter = notesConverter;
}
@Synchronized
@Nullable
@Override
public RecipeCommand convert(Recipe source) {
if (source == null) {
return null;
}
final RecipeCommand command = new RecipeCommand();
command.setId(source.getId());
command.setCookTime(source.getCookTime());
command.setPrepTime(source.getPrepTime());
command.setDescription(source.getDescription());
command.setDifficulty(source.getDifficulty());
command.setDirections(source.getDirections());
command.setServings(source.getServings());
command.setSource(source.getSource());
command.setUrl(source.getUrl());
command.setImage(source.getImage());
command.setNotes(notesConverter.convert(source.getNotes()));
if (source.getCategories() != null && source.getCategories().size() > 0){
source.getCategories()
.forEach((Category category) -> command.getCategories().add(categoryConverter.convert(category)));
}
if (source.getIngredients() != null && source.getIngredients().size() > 0){
source.getIngredients()
.forEach(ingredient -> command.getIngredients().add(ingredientConverter.convert(ingredient)));
}
return command;
}
}
| [
"xuzishuo1996@gmail.com"
] | xuzishuo1996@gmail.com |
e77470955860de6fba48adb17ba3efc9c72dd418 | 9282591635f3cf5a640800f2b643cd57048ed29f | /app/src/main/java/com/android/p2pflowernet/project/view/fragments/platformdata/rebatedata/DayAxisValueFormatter.java | 1316aa7582c44257167b153296e22897de16042b | [] | no_license | AHGZ/B2CFlowerNetProject | de5dcbf2cbb67809b00f86639d592309d84b3283 | b1556c4b633fa7c0c1463af94db9f91285070714 | refs/heads/master | 2020-03-09T17:27:14.889919 | 2018-04-10T09:36:33 | 2018-04-10T09:36:33 | 128,908,791 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 837 | java | package com.android.p2pflowernet.project.view.fragments.platformdata.rebatedata;
import com.github.mikephil.charting.charts.BarLineChartBase;
import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import java.util.List;
/**
* Created by philipp on 02/06/16.
*/
public class DayAxisValueFormatter implements IAxisValueFormatter {
private BarLineChartBase<?> chart;
private String flag;
private List<String> names;
public DayAxisValueFormatter(BarLineChartBase<?> chart, String flag, List<String> name) {
this.chart = chart;
this.flag = flag;
this.names = name;
}
@Override
public String getFormattedValue(float value, AxisBase axis) {
int index = (int) value;
return names.get(index);
}
}
| [
"18911005030@163.com"
] | 18911005030@163.com |
8862607ae82140273602bd9cfe36c66f69c8bc31 | 32ada64601dca2faf2ad0dae2dd5a080fd9ecc04 | /timesheet/src/test/java/com/fastcode/timesheet/restcontrollers/extended/RolepermissionControllerTestExtended.java | f1f96a5269dc564703d2c287c77d8dd48cbf0017 | [] | no_license | fastcoderepos/tbuchner-sampleApplication1 | d61cb323aeafd65e3cfc310c88fc371e2344847d | 0880d4ef63b6aeece6f4a715e24bfa94de178664 | refs/heads/master | 2023-07-09T02:59:47.254443 | 2021-08-11T16:48:27 | 2021-08-11T16:48:27 | 395,057,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package com.fastcode.timesheet.restcontrollers.extended;
import com.fastcode.timesheet.restcontrollers.core.RolepermissionControllerTest;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = "spring.profiles.active=test")
public class RolepermissionControllerTestExtended extends RolepermissionControllerTest {
//Add your custom code here
}
| [
"info@nfinityllc.com"
] | info@nfinityllc.com |
003e7c4886632a0107f7a6c3ee65de410f8c4662 | bd9b6d158ceb4fa6e5276defca37a46048163c85 | /jfcrawler/src/org/thuir/jfcrawler/framework/classifier/Classifier.java | 5f183797a9675252ab14cf8702dd04bbb221ada5 | [] | no_license | chinab/jfcrawler | 4b82d0acf5114f153e8bcec578d613cc0bf598af | ed5b6643661704496302c06a7968e718966d4620 | refs/heads/master | 2020-12-24T17:17:13.630434 | 2010-06-29T00:12:00 | 2010-06-29T00:12:00 | 34,577,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package org.thuir.jfcrawler.framework.classifier;
import org.thuir.jfcrawler.data.Url;
public abstract class Classifier {
public abstract void process(Url url);
}
| [
"ruKyzhc@c9c5b5aa-0367-836e-72da-8aa6a4002a05"
] | ruKyzhc@c9c5b5aa-0367-836e-72da-8aa6a4002a05 |
5a9f995eabc8eb19f200b39cd071423271d2e55b | 4bb3c9d5783e5325a574bde4900ed6cdfca95410 | /myTest/src/main/java/com/yyh/practice/func/command/Sequence.java | 3d7d59bc4255143364c8aa296ee19798e3d80d00 | [] | no_license | darkvelopoer/myTest | 037adb5442910949a541610788d6a9408c04b139 | 86b45cc8a0e3aad64f900c7015632fc7beca78c5 | refs/heads/master | 2022-11-29T15:07:19.225274 | 2020-05-23T16:03:54 | 2020-05-23T16:03:54 | 238,380,433 | 0 | 0 | null | 2022-11-15T23:55:22 | 2020-02-05T06:08:36 | Java | UTF-8 | Java | false | false | 413 | java | package com.yyh.practice.func.command;
import java.util.ArrayList;
import java.util.List;
public class Sequence {
private final List<Command> commands = new ArrayList<>();
public void recordSequence(Command cmd) {
commands.add(cmd);
}
public void runSequence() {
commands.forEach(Command::execute);
}
public void clearSequence() {
commands.clear();
}
}
| [
"darkveloper@gmail.com"
] | darkveloper@gmail.com |
046c812e2b3df7fa528e460119b45b72a9f1029e | 6d85b1319a227a2dc06944aac24ad23f7ff5216d | /app/src/androidTest/java/com/homework_android_storage/ApplicationTest.java | 0e6fbc2f2bef6da2d17dd8107a602a5044388b9b | [] | no_license | DavidSande/localStorageSQL | 6275382f7552302b3c9fab24611b92a0a4c2232e | accc1a389f3a71ec462cda6aff00fdae99577e98 | refs/heads/master | 2021-01-10T18:04:22.294788 | 2016-01-19T13:42:35 | 2016-01-19T13:42:35 | 49,955,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.homework_android_storage;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"david.sande.garcia@gmail.com"
] | david.sande.garcia@gmail.com |
dc622f6c739e678fe9a8b9bd55e8f8d423c52ae0 | de3e295b4430a4f49edbed938dcad22f445d2911 | /ResizableComponents/src/java/example/ResizeMouseListener.java | a5caa9c9ae5a94196843f0c2d7cd9975ffb56d43 | [
"MIT"
] | permissive | kansasSamurai/java-swing-tips | 5fd5e8dfada438e730ca4f440cc2c082b32cce56 | 649a738acf2a2560649ad8bd3634cb7042e1fa13 | refs/heads/master | 2022-11-17T14:44:13.562782 | 2022-10-30T15:05:02 | 2022-10-30T15:05:02 | 204,076,715 | 0 | 0 | null | 2019-08-23T22:15:06 | 2019-08-23T22:15:06 | null | UTF-8 | Java | false | false | 7,483 | java | // -*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
// @homepage@
package example;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.EnumSet;
import java.util.Optional;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
public final class ResizeMouseListener extends MouseInputAdapter {
private static final Dimension MIN = new Dimension(50, 50);
private static final Dimension MAX = new Dimension(500, 500);
private final Point startPos = new Point();
private final Rectangle startRect = new Rectangle();
private Cursor cursor;
@Override public void mouseMoved(MouseEvent e) {
JComponent c = (JComponent) e.getComponent();
ResizableBorder border = (ResizableBorder) c.getBorder();
c.setCursor(border.getResizeCursor(e));
}
@Override public void mouseExited(MouseEvent e) {
e.getComponent().setCursor(Cursor.getDefaultCursor());
}
@Override public void mousePressed(MouseEvent e) {
JComponent c = (JComponent) e.getComponent();
ResizableBorder border = (ResizableBorder) c.getBorder();
cursor = border.getResizeCursor(e);
startPos.setLocation(SwingUtilities.convertPoint(c, e.getX(), e.getY(), null));
startRect.setBounds(c.getBounds());
Container parent = SwingUtilities.getAncestorOfClass(JLayeredPane.class, c);
if (parent instanceof JLayeredPane) {
((JLayeredPane) parent).moveToFront(c);
}
}
@Override public void mouseReleased(MouseEvent e) {
startRect.setSize(0, 0);
}
// @see %JAVA_HOME%/src/javax/swing/plaf/basic/BasicInternalFrameUI.java
@Override public void mouseDragged(MouseEvent e) {
if (startRect.isEmpty()) {
return;
}
Component c = e.getComponent();
Point p = SwingUtilities.convertPoint(c, e.getX(), e.getY(), null);
int deltaX = startPos.x - p.x;
int deltaY = startPos.y - p.y;
Container parent = SwingUtilities.getUnwrappedParent(c);
int cursorType = Optional.ofNullable(cursor).map(Cursor::getType).orElse(Cursor.DEFAULT_CURSOR);
Directions.getByCursorType(cursorType).ifPresent(dir -> {
Point delta = getLimitedDelta(cursorType, parent.getBounds(), deltaX, deltaY);
c.setBounds(dir.getBounds(startRect, delta));
});
parent.revalidate();
}
private int getDeltaX(int dx) {
int left = Math.min(MAX.width - startRect.width, startRect.x);
return Math.max(Math.min(dx, left), MIN.width - startRect.width);
// int deltaX = dx;
// if (deltaX < MIN.width - startingBounds.width) {
// deltaX = MIN.width - startingBounds.width;
// } else if (deltaX > MAX.width - startingBounds.width) {
// deltaX = MAX.width - startingBounds.width;
// }
// if (startingBounds.x < deltaX) {
// deltaX = startingBounds.x;
// }
// return deltaX;
}
private int getDeltaX(int dx, Rectangle pr) {
int right = Math.max(startRect.width - MAX.width, startRect.x + startRect.width - pr.width);
return Math.min(Math.max(dx, right), startRect.width - MIN.width);
// int deltaX = dx;
// if (startingBounds.width - MIN.width < deltaX) {
// deltaX = startingBounds.width - MIN.width;
// } else if (startingBounds.width - MAX.width > deltaX) {
// deltaX = startingBounds.width - MAX.width;
// }
// if (startingBounds.x + startingBounds.width - pr.width > deltaX) {
// deltaX = startingBounds.x + startingBounds.width - pr.width;
// }
// return deltaX;
}
private int getDeltaY(int dy) {
int top = Math.min(MAX.height - startRect.height, startRect.y);
return Math.max(Math.min(dy, top), MIN.height - startRect.height);
// int deltaY = dy;
// if (deltaY < MIN.height - startingBounds.height) {
// deltaY = MIN.height - startingBounds.height;
// } else if (deltaY > MAX.height - startingBounds.height) {
// deltaY = MAX.height - startingBounds.height;
// }
// if (deltaY < startingBounds.y) {
// deltaY = startingBounds.y;
// }
// return deltaY;
}
private int getDeltaY(int dy, Rectangle pr) {
int maxHeight = startRect.height - MAX.height;
int bottom = Math.max(maxHeight, startRect.y + startRect.height - pr.height);
return Math.min(Math.max(dy, bottom), startRect.height - MIN.height);
// int deltaY = dy;
// if (startingBounds.height - MIN.height < deltaY) {
// deltaY = startingBounds.height - MIN.height;
// } else if (startingBounds.height - MAX.height > deltaY) {
// deltaY = startingBounds.height - MAX.height;
// }
// if (startingBounds.y + startingBounds.height - deltaY > pr.height) {
// deltaY = startingBounds.y + startingBounds.height - pr.height;
// }
// return deltaY;
}
private Point getLimitedDelta(int cursorType, Rectangle pr, int deltaX, int deltaY) {
switch (cursorType) {
case Cursor.N_RESIZE_CURSOR: return new Point(0, getDeltaY(deltaY));
case Cursor.S_RESIZE_CURSOR: return new Point(0, getDeltaY(deltaY, pr));
case Cursor.W_RESIZE_CURSOR: return new Point(getDeltaX(deltaX), 0);
case Cursor.E_RESIZE_CURSOR: return new Point(getDeltaX(deltaX, pr), 0);
case Cursor.NW_RESIZE_CURSOR: return new Point(getDeltaX(deltaX), getDeltaY(deltaY));
case Cursor.SW_RESIZE_CURSOR: return new Point(getDeltaX(deltaX), getDeltaY(deltaY, pr));
case Cursor.NE_RESIZE_CURSOR: return new Point(getDeltaX(deltaX, pr), getDeltaY(deltaY));
case Cursor.SE_RESIZE_CURSOR: return new Point(getDeltaX(deltaX, pr), getDeltaY(deltaY, pr));
default: return new Point(deltaX, deltaY);
}
}
}
enum Directions {
NORTH(Cursor.N_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x, r.y - d.y, r.width, r.height + d.y);
}
},
SOUTH(Cursor.S_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x, r.y, r.width, r.height - d.y);
}
},
WEST(Cursor.W_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x - d.x, r.y, r.width + d.x, r.height);
}
},
EAST(Cursor.E_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x, r.y, r.width - d.x, r.height);
}
},
NORTH_WEST(Cursor.NW_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x - d.x, r.y - d.y, r.width + d.x, r.height + d.y);
}
},
NORTH_EAST(Cursor.NE_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x, r.y - d.y, r.width - d.x, r.height + d.y);
}
},
SOUTH_WEST(Cursor.SW_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x, r.y, r.width, r.height);
}
},
SOUTH_EAST(Cursor.SE_RESIZE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x, r.y, r.width - d.x, r.height - d.y);
}
},
MOVE(Cursor.MOVE_CURSOR) {
@Override Rectangle getBounds(Rectangle r, Point d) {
return new Rectangle(r.x - d.x, r.y - d.y, r.width, r.height);
}
};
private final int cursor;
Directions(int cursor) {
this.cursor = cursor;
}
abstract Rectangle getBounds(Rectangle rect, Point delta);
public static Optional<Directions> getByCursorType(int cursor) {
return EnumSet.allOf(Directions.class).stream().filter(d -> d.cursor == cursor).findFirst();
}
}
| [
"aterai@outlook.com"
] | aterai@outlook.com |
2a7ee7351e231c6f2545a9e3b3d7f673ec36af0d | db22a3f5794985785a32e3d5f2aa317e028c2bff | /jgt-jgrassgears/src/main/java/org/jgrasstools/gears/JGrassGears.java | a366c114a41424903c66ec170ebb82c397af10fb | [] | no_license | wuletawu/UBN_Adige_Project | b5aabe6ef5223f84a342eaadbcad977d1afaa478 | 85a0c12a999591c0c6ab0e22fea01b520691f6a4 | refs/heads/master | 2021-01-10T01:52:45.754382 | 2015-10-03T16:59:35 | 2015-10-03T16:59:35 | 43,604,571 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 14,296 | java | /*
* This file is part of JGrasstools (http://www.jgrasstools.org)
* (C) HydroloGIS - www.hydrologis.com
*
* JGrasstools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.jgrasstools.gears;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import oms3.Access;
import oms3.ComponentAccess;
import oms3.annotations.Author;
import oms3.annotations.Description;
import oms3.annotations.Documentation;
import oms3.annotations.Execute;
import oms3.annotations.Keywords;
import oms3.annotations.Label;
import oms3.annotations.License;
import oms3.annotations.Name;
import oms3.annotations.Status;
import oms3.annotations.UI;
import org.jgrasstools.gears.libs.modules.ClassField;
import org.scannotation.AnnotationDB;
import org.scannotation.ClasspathUrlFinder;
/**
* Class presenting modules names and classes.
*
* @author Andrea Antonello (www.hydrologis.com)
* @since 0.7.0
*/
@SuppressWarnings("nls")
public class JGrassGears {
private static JGrassGears jgrassGears = null;
private URL baseclassUrl;
private JGrassGears( URL baseclassUrl ) {
this.baseclassUrl = baseclassUrl;
}
/**
* Retrieves the {@link JGrassGears}. If it exists, that instance is returned.
*
* @return the JGrassGears annotations class.
*/
public synchronized static JGrassGears getInstance() {
if (jgrassGears == null) {
jgrassGears = new JGrassGears(null);
jgrassGears.gatherInformations();
}
return jgrassGears;
}
/**
* Retrieves the {@link JGrassGears} for a particular url path.
*
* <p>
* <b>When this method is called, the {@link JGrassGears} instance is reset.</b>
* </p>
* <p>
* Be careful when you use this. This is a workaround needed for eclipse
* systems, where the url returned by the urlfinder is a bundleresource that
* would need to be resolved first with rcp tools we do not want to depend on.
* </p>
*
* @return the JGrassGears annotations class.
*/
public static JGrassGears getInstance( URL baseclassUrl ) {
jgrassGears = new JGrassGears(baseclassUrl);
jgrassGears.gatherInformations();
return jgrassGears;
}
/**
* A {@link LinkedHashMap map} of all the class names and the class itself.
*/
public final LinkedHashMap<String, Class< ? >> moduleName2Class = new LinkedHashMap<String, Class< ? >>();
/**
* A {@link LinkedHashMap map} of all the class names and their fields.
*/
public final LinkedHashMap<String, List<ClassField>> moduleName2Fields = new LinkedHashMap<String, List<ClassField>>();
/**
* An array of all the fields used in the modules.
*/
public String[] allFields = null;
/**
* An array of all the class names of the modules.
*/
public String[] allClasses = null;
private void gatherInformations() {
try {
if (baseclassUrl == null) {
baseclassUrl = ClasspathUrlFinder.findClassBase(JGrassGears.class);
}
AnnotationDB db = new AnnotationDB();
db.scanArchives(baseclassUrl);
Map<String, Set<String>> annotationIndex = db.getAnnotationIndex();
Set<String> simpleClasses = annotationIndex.get(Execute.class.getName());
for( String className : simpleClasses ) {
if (!className.startsWith("org.jgrasstools.gears")) {
continue;
}
int lastDot = className.lastIndexOf('.');
String name = className.substring(lastDot + 1);
Class< ? > clazz = null;
try {
clazz = Class.forName(className);
moduleName2Class.put(name, clazz);
} catch (Throwable e) {
e.printStackTrace();
}
}
/*
* extract all classes and fields
*/
List<String> classNames = new ArrayList<String>();
List<String> fieldNamesList = new ArrayList<String>();
Set<Entry<String, Class< ? >>> moduleName2ClassEntries = moduleName2Class.entrySet();
for( Entry<String, Class< ? >> moduleName2ClassEntry : moduleName2ClassEntries ) {
String moduleName = moduleName2ClassEntry.getKey();
Class< ? > moduleClass = moduleName2ClassEntry.getValue();
Status annotation = moduleClass.getAnnotation(Status.class);
if (annotation == null) {
System.out.println("Missing status: " + moduleClass.getCanonicalName());
continue;
}
String statusString = null;
int status = annotation.value();
switch( status ) {
case Status.CERTIFIED:
statusString = "CERTIFIED";
break;
case Status.DRAFT:
statusString = "DRAFT";
break;
case Status.TESTED:
statusString = "TESTED";
break;
default:
statusString = "UNKNOWN";
break;
}
classNames.add(moduleName);
List<ClassField> tmpfields = new ArrayList<ClassField>();
Object annotatedObject = moduleClass.newInstance();
ComponentAccess cA = new ComponentAccess(annotatedObject);
Collection<Access> inputs = cA.inputs();
for( Access access : inputs ) {
Field field = access.getField();
String name = field.getName();
Description descriptionAnnot = field.getAnnotation(Description.class);
String description = name;
if (descriptionAnnot != null) {
description = descriptionAnnot.value();
if (description == null) {
description = name;
}
}
Class< ? > fieldClass = field.getType();
ClassField cf = new ClassField();
cf.isIn = true;
cf.fieldName = name;
cf.fieldDescription = description;
cf.fieldClass = fieldClass;
cf.parentClass = moduleClass;
cf.parentClassStatus = statusString;
if (!fieldNamesList.contains(name)) {
fieldNamesList.add(name);
}
tmpfields.add(cf);
}
Collection<Access> outputs = cA.outputs();
for( Access access : outputs ) {
Field field = access.getField();
String name = field.getName();
Description descriptionAnnot = field.getAnnotation(Description.class);
String description = name;
if (descriptionAnnot != null) {
description = descriptionAnnot.value();
if (description == null) {
description = name;
}
}
Class< ? > fieldClass = field.getType();
ClassField cf = new ClassField();
cf.isOut = true;
cf.fieldName = name;
cf.fieldDescription = description;
cf.fieldClass = fieldClass;
cf.parentClass = moduleClass;
cf.parentClassStatus = statusString;
if (!fieldNamesList.contains(name)) {
fieldNamesList.add(name);
}
tmpfields.add(cf);
}
moduleName2Fields.put(moduleName, tmpfields);
}
Collections.sort(fieldNamesList);
allFields = (String[]) fieldNamesList.toArray(new String[fieldNamesList.size()]);
Collections.sort(classNames);
allClasses = (String[]) classNames.toArray(new String[classNames.size()]);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main( String[] args ) throws IOException {
JGrassGears jgr = getInstance();
Set<Entry<String, Class< ? >>> cls = jgr.moduleName2Class.entrySet();
for( Entry<String, Class< ? >> cl : cls ) {
System.out.println(cl.getValue().getCanonicalName());
}
if(true)return;
LinkedHashMap<String, List<ClassField>> moduleName2Fields = jgr.moduleName2Fields;
LinkedHashMap<String, Class< ? >> moduleName2Class = jgr.moduleName2Class;
Set<Entry<String, List<ClassField>>> entrySet = moduleName2Fields.entrySet();
for( Entry<String, List<ClassField>> entry : entrySet ) {
String moduleName = entry.getKey();
StringBuilder sb = new StringBuilder();
Class< ? > moduleClass = moduleName2Class.get(moduleName);
Description description = moduleClass.getAnnotation(Description.class);
sb.append("public static final String " + moduleName.toUpperCase() + "_DESCRIPTION = \"" + description.value()
+ "\";\n");
Documentation documentation = moduleClass.getAnnotation(Documentation.class);
String doc;
if (documentation == null) {
doc = "";
} else {
doc = documentation.value();
}
sb.append("public static final String " + moduleName.toUpperCase() + "_DOCUMENTATION = \"" + doc + "\";\n");
Keywords keywords = moduleClass.getAnnotation(Keywords.class);
String k;
if (keywords == null) {
k = "";
} else {
k = keywords.value();
}
sb.append("public static final String " + moduleName.toUpperCase() + "_KEYWORDS = \"" + k + "\";\n");
Label label = moduleClass.getAnnotation(Label.class);
String lab;
if (label == null) {
lab = "";
} else {
lab = label.value();
}
sb.append("public static final String " + moduleName.toUpperCase() + "_LABEL = \"" + lab + "\";\n");
Name name = moduleClass.getAnnotation(Name.class);
String n;
if (name == null) {
n = "";
} else {
n = name.value();
}
sb.append("public static final String " + moduleName.toUpperCase() + "_NAME = \"" + n + "\";\n");
Status status = moduleClass.getAnnotation(Status.class);
// String st = "";
// switch( status.value() ) {
// case 5:
// st = "EXPERIMENTAL";
// break;
// case 10:
// st = "DRAFT";
// break;
// case 20:
// st = "TESTED";
// break;
// case 30:
// st = "VALIDATED";
// break;
// case 40:
// st = "CERTIFIED";
// break;
// default:
// st = "DRAFT";
// break;
// }
sb.append("public static final int " + moduleName.toUpperCase() + "_STATUS = " + status.value() + ";\n");
License license = moduleClass.getAnnotation(License.class);
sb.append("public static final String " + moduleName.toUpperCase() + "_LICENSE = \"" + license.value() + "\";\n");
Author author = moduleClass.getAnnotation(Author.class);
String authorName = author.name();
sb.append("public static final String " + moduleName.toUpperCase() + "_AUTHORNAMES = \"" + authorName + "\";\n");
String authorContact = author.contact();
sb.append("public static final String " + moduleName.toUpperCase() + "_AUTHORCONTACTS = \"" + authorContact + "\";\n");
UI ui = moduleClass.getAnnotation(UI.class);
if (ui != null) {
sb.append("public static final String " + moduleName.toUpperCase() + "_UI = \"" + ui.value() + "\";\n");
}
List<ClassField> value = entry.getValue();
for( ClassField classField : value ) {
String fieldName = classField.fieldName;
if (fieldName.equals("pm")) {
continue;
}
String fieldDescription = classField.fieldDescription;
String str = "public static final String " + moduleName.toUpperCase() + "_" + fieldName + "_DESCRIPTION = \""
+ fieldDescription + "\";\n";
sb.append(str);
}
System.out.println(sb.toString());
System.out.println();
}
// for( String className : jgr.allClasses ) {
// System.out.println(className);
// }
// for( String fieldName : jgr.allFields ) {
// System.out.println(fieldName);
// }
}
}
| [
"wuletawu979@yahoo.com"
] | wuletawu979@yahoo.com |
025f3ee4393e248483f9410781e3821706c0e97b | 4165b5504e596ca7a93d8e9fe03d3e7b67c19701 | /app/src/main/java/com/example/christianescobar/myapplication/PDFCreator.java | e01f4ce5866e1fb979e8e8be444ac764665c95fd | [] | no_license | Cd246810/SAAndroid | 9af5c3a680067adef5e218e159e6995de200c21f | 0195e13c0d104b5d35c00eaca81ba23ba236bf9c | refs/heads/master | 2021-07-25T09:16:56.613617 | 2017-10-28T16:40:25 | 2017-10-28T16:40:25 | 106,592,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.example.christianescobar.myapplication;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by kevinj on 27/10/17.
*/
public class PDFCreator {
}
| [
"you@example.com"
] | you@example.com |
5fad02fd0b3af4c5245519735ec9b65f6079a88d | a287281cb528b17215e77fca31cb7ddcde26e625 | /genericCheckpointing/src/genericCheckpointing/util/FileDisplayInterface.java | 0f372955c5f3af722f94f918eeaa6dcbec2676be | [] | no_license | mmerali1/GenericCheckpointing | 577d35fc6c66609aae7538ba1c3890483f130a97 | c95b80157d2326433da8d0b1ab1b231b83831661 | refs/heads/master | 2021-05-03T23:56:47.214740 | 2017-12-12T04:18:25 | 2017-12-12T04:18:25 | 120,403,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package genericCheckpointing.util;
public interface FileDisplayInterface{
//method signatures
public void writeToFile(String fileName);
}
| [
"mmerali1@binghamton.edu"
] | mmerali1@binghamton.edu |
3cec69e9eeb0414730a041e839d65bd15d6e870d | 402581ebdaf81005ca7f188f42789553449bab66 | /GitProject1/src/TestJava.java | 017bcda6c0711ca5a7876c25f1a11010caa2f790 | [] | no_license | keerthanansk/NewProject1 | 0a0e5e871b88e0c079006908582650f75e8a4f5d | df929c6964b8ba84287ebd9f6cd04c0c827c600c | refs/heads/master | 2021-01-01T05:46:09.217697 | 2016-05-22T08:27:24 | 2016-05-22T08:30:15 | 59,397,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 113 | java |
public class TestJava {
public static void main(String[] args)
{
System.out.println("Hello");
}
}
| [
"kesarava@kesarava-THINK"
] | kesarava@kesarava-THINK |
f8fb3bac68f1aed32283e79b3e106a8aacce5e53 | 953129c30e0220925bdab24d899fe36cefb8ebaf | /RPS/src/rps/RPSGame.java | 5cd9bd07214215928a1bbff7f55ce6cc35bc5ae2 | [] | no_license | endoush/web_java_1 | 23c013e852a958f599463d72ea74a946327b27e2 | 17d8d69206e0ecc4cedec6203d6f7b6ef3baa391 | refs/heads/master | 2021-05-10T20:35:15.540849 | 2018-01-20T02:52:59 | 2018-01-20T02:52:59 | 118,196,486 | 0 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 5,951 | java | /**
*
*/
package rps;
import java.util.Date;
import java.util.Scanner;
/**
* @author systena
*
*/
public class RPSGame {
/**
* 生きてる限りスキャンは使いまわす。クローズはしない。.
*/
static Scanner scan = new Scanner(System.in);
/**
* @param args
*/
public static void main(String[] args) {
Date date = new Date();
String dateString = date.toString();
System.out.println("Today is " + dateString);
try {
// じゃんけんモード選択の開始
modeSelect();
} catch (Exception e) {
// 何が起きても生きる。アプリは絶対死なない。
System.out.println("バグが発生しました。 " + e);
}
}
/**
* @param args
*/
public static void modeSelect() {
// モード判定
System.out.println("じゃんけんのモードを選択してください。\n「m:マニュアル」\n「a:オート」\n「e:じゃんけんの終了」");
// 読み込み共通処理
String input = readLine();
if ("m".equals(input)) {
// 「m」マニュアルを入力された場合は終了する。
System.out.println("マニュアルじゃんけんモードを開始します。");
manual();
System.out.println("");
// 終わったら、もう一回メニューに戻る
modeSelect();
} else if ("a".equals(input)) {
// 「a」終了を入力された場合は終了する。
System.out.println("オートじゃんけんモードを開始します。");
System.out.println("オートじゃんけんモードは未実装です。");
System.out.println("");
// 終わったら、もう一回メニューに戻る
modeSelect();
} else if ("e".equals(input)) {
// 「e」終了を入力された場合は終了する。
System.out.println("じゃんけんを終了します。");
} else {
// 期待した文字列以外を入力された場合は、ワーニングメッセージを表示し、再度入力を求める
System.out.println("入力された文字列に誤りがあります。もう一度最初からやり直してください。");
System.out.println("");
// もう一回メニューに戻る
modeSelect();
}
}
/**
* @param args
*/
public static void manual() {
// マニュアルモードの処理
int num = 0;
// 読み込み共通処理
System.out.println("「1」:グー、「2」:チョキ、「3」:パーを入力してください。");
String input = readLine();
try {
// 読み込み文字列判定
num = Integer.parseInt(input);
switch (num) {
case 1: {
System.out.println("あなた:グー");
}
break;
case 2: {
System.out.println("あなた:チョキ");
break;
}
case 3: {
System.out.println("あなた:パー");
break;
}
default: {
// ワーニング応答
manual();
}
}
int aNum = new RpsPlayerA().go().getId();
switch (aNum) {
case 1: {
System.out.println("あいて:グー");
break;
}
case 2: {
System.out.println("あいて:チョキ");
break;
}
case 3: {
System.out.println("あいて:パー");
break;
}
default: {
// ワーニング応答
}
}
// 結果判定
result res = calcResult(num, aNum);
if (res == result.WIN) {
System.out.println("あなたの勝ちです!");
} else if (res == result.LOSE) {
System.out.println("残念。。。");
} else {
System.out.println("あいこなので、もう一回!");
manual();
}
} catch (NumberFormatException e) {
// 読み込み文字列不正
if (input.equals("e")) {
// 「e」終了を入力された場合
System.out.println("マニュアルモードでのじゃんけんを終了します。");
} else {
// 「e」終了以外だったら再入力させる。
manual();
}
}
}
/**
* @return 読み込み文字列
*/
private static String readLine() {
// スキャン開始
String input = scan.next();
// スキャン終了
// scan.close();
return input;
}
/**
* @return 読み込み文字列
*/
private static result calcResult(int num, int aite) {
// 結果の初期化
result res = result.DROW;
int resNum = num - aite;
// 勝った負けた
if (resNum < 0) {
res = result.LOSE;
} else if (resNum > 0) {
res = result.WIN;
} else {
// 困ったら、引き分け
res = result.DROW;
}
return res;
}
/**
* @param args とりあえず!!!!!!!!!!!!!!!!
*/
public static void test() {
Date date = new Date();
String dateString = date.toString();
System.out.println("Today is " + dateString);
// モード判定
int num = 0;
// 読み込み共通処理
String input = readLine();
try {
// 読み込み文字列判定
num = Integer.parseInt(input);
switch (num) {
case 0: {
System.out.println("到達しないはず");
break;
}
case 1: {
System.out.println("1通過");
}
break;
case 2: {
System.out.println("1から2に通過");
break;
}
}
} catch (NumberFormatException e) {
// 読み込み文字列不正
if (input.equals("e")) {
// e以外の文字列を入力された場合
System.out.println("数字以外を入力されました。「」");
}
System.out.println("数字以外を入力されました。 " + e);
}
}
}
| [
"endoush@systena.co.jp"
] | endoush@systena.co.jp |
97e25fea3df115901eab18779cdb5da3daf3bdea | 37a2c2c5b3d6252d490bfff692a4a5579bffb643 | /app/src/main/java/com/example/administrator/new_ptns/custom_item/CustomItemA1.java | 5404c58bcfee466e3e42a0da6437c00e80f5110f | [] | no_license | jiazeyu1987/newtoon | 223011ca8e080828c36bb6aca147ff15b7a3c0f6 | 71c8ee66907f7044ea29856d3450a52dd4eca628 | refs/heads/master | 2022-09-24T13:58:07.524202 | 2020-05-06T11:41:35 | 2020-05-06T11:41:35 | 261,738,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,773 | java | package com.example.administrator.new_ptns.custom_item;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.administrator.new_ptns.R;
/**
* Created by tianxiying on 2018/3/1.
*/
public class CustomItemA1 extends LinearLayout {
private Context mContext;
private View mView;
private ImageView icon;
private TextView txt;
private TextView txt2;
private OnClickListener onClickListener;
private String titleText;
private String titleText2;
private int iconImgId;
public static final int NO_LINE = 0;
public int getIconImgId() {
return iconImgId;
}
public void setIconImgId(int iconImgId) {
if (iconImgId != 10000) {
this.iconImgId = iconImgId;
icon.setImageResource(this.iconImgId);
}
}
public String getTitleText() {
return titleText;
}
public void setTitleText(String titleText) {
if (titleText != null) {
this.titleText = titleText;
txt.setText(titleText);
}
}
public void setTextMode(){
txt2.setEnabled(false);
}
public void setEditMode(){
txt2.setEnabled(true);
}
public void setTitleText2(String titleText) {
if (titleText != null) {
this.titleText2 = titleText;
txt2.setHint(titleText);
}
}
public CustomItemA1(Context context) {
this(context, null);
}
public CustomItemA1(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CustomItemA1(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
mContext = context;
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mView = inflater.inflate(R.layout.custom_item_a1, this, true);
txt = (TextView) mView.findViewById(R.id.textView27);
txt2 = (TextView) mView.findViewById(R.id.et_1);
TypedArray a = mContext.obtainStyledAttributes(attrs, R.styleable.CustomItem1Attr);
setTextMode();
setTitleText(a.getString(R.styleable.CustomItem1Attr_txt1));
setTitleText2(a.getString(R.styleable.CustomItem1Attr_txt2));
}
public void setViewOnlickListener(OnClickListener onlickListener) {
this.onClickListener = onlickListener;
mView.setOnClickListener(onlickListener);
}
}
| [
"252451895@qq.com"
] | 252451895@qq.com |
207dc22f5aaeb408056b79a8de2e324971dcc80f | afb0562b33c44d59118b3dfb2da0abe00821f1c1 | /app/src/main/java/br/maratonainterfatecs/fragments/IndisponivelFragment.java | ece51a0b0bce5e3293ce8759a09887a43e9886c1 | [] | no_license | LucasFalcaoSilva/MaratonaInterFatecs | 2d0889b0e2d99fca822b7c568dee4c4bbf93e726 | 5fbe861ed5532b7ad9b5ec292472c07bb92040eb | refs/heads/master | 2021-01-21T04:31:41.071211 | 2016-07-25T17:22:17 | 2016-07-25T17:22:17 | 45,548,735 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 817 | java | package br.maratonainterfatecs.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import br.maratonainterfatecs.R;
public class IndisponivelFragment extends Fragment {
public IndisponivelFragment() {
}
public static IndisponivelFragment newInstance() {
IndisponivelFragment fragment = new IndisponivelFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_indisponivel, container, false);
}
}
| [
"lucaslibra@gmail.com"
] | lucaslibra@gmail.com |
49229ee82767d208ee72176f0cb11b1464269115 | 8782e3179dcfc33ac92a071fd021ae42dbd522af | /offer/src/design_pattern/singleton_pattern/SingleObject.java | a2fd8a448627aa4cf1af1cdbf5e74c99a4799e43 | [] | no_license | zxhgood123321/Java | ee83dcee1a9592d0b6970115d19969deeeaf8d32 | 5d9835f759f370722671ef69d0e9a0148d5bafc0 | refs/heads/master | 2020-03-30T01:35:02.861329 | 2018-09-27T12:36:40 | 2018-09-27T12:36:40 | 150,583,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,866 | java | package design_pattern.singleton_pattern;
/**
* 单例模式
*/
/**
* 意图:保证一个类仅有一个实例,并提供一个访问它的全局访问点
* 主要解决:一个全局使用的类频繁地创建与销毁
* 何时使用:当您想控制实例数目,节省系统资源的时候
* 如何解决:判断系统是否已经有这个单例,如果有则返回,如果没有则创建
* 关键代码:构造函数是私有的
* 应用实例:windows是多进程多线程的,在操作一个文件的时候,就不可避免地出现多个进程或线程同事操作一个文件的现象,所以所有文件的处理必须通过唯一的实例
* 使用场景:1.要求生产唯一的序列号2.web中的计数器,不用每次刷新都加一次,先用单例缓存起来,3.创建的一个对象需要消耗的资源过多,如i/o与数据库的连接
* 优点:1.在内存里只有一个实例,减小了内存的开销,尤其是频繁地创建和销毁实例(比如管理学院页面缓存)2.避免对资源的多重占用(比如写文件操作)
* 缺点:没有接口,不能继承,与单一职责原则冲突,一个;类应该只关心内部逻辑,而不关心外面怎么样来实例化
*注意事项:getInstance() 方法中需要使用同步锁 synchronized (Singleton.class) 防止多线程同时进入造成 instance 被多次实例化。
*
*/
//创建一个singleton类
public class SingleObject
{
//创建SingleObject的一个对象
private static SingleObject instance=new SingleObject();
//让构造函数为private,这样该类就不会被实例化
private SingleObject(){
}
//获取唯一可用的对象
public static SingleObject getInstance(){
return instance;
}
public void showMessage(){
System.out.println("Hello World!");
}
}
| [
"30396822+zxhgood123321@users.noreply.github.com"
] | 30396822+zxhgood123321@users.noreply.github.com |
69aed5dfeda0125e9a3edcb4a23b164f81937f6f | 00b1bc61f7691f08e4dffab9f65bc1ea3edd1f20 | /src/main/java/com/cebi/dao/CreateExcelDaoImpl.java | 8d212ef08cafef7218e18ece5f3e230f1341ed17 | [] | no_license | Mahender1929/PowerEdgeMQ_Oracle | 993d88998efd7d67510d1e0130832aadce2a1009 | 232faadca1062abd480fe4c9742d5e8d1c381be5 | refs/heads/master | 2023-05-12T14:23:06.156914 | 2021-06-05T08:49:14 | 2021-06-05T08:49:14 | 327,814,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,672 | java | package com.cebi.dao;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.GeneralSecurityException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.poifs.crypt.EncryptionInfo;
import org.apache.poi.poifs.crypt.EncryptionMode;
import org.apache.poi.poifs.crypt.Encryptor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.hibernate.Session;
import org.hibernate.internal.SessionImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.cebi.entity.QueryData;
import com.cebi.utility.CebiConstant;
import com.cebi.utility.ConnectionException;
import com.cebi.utility.MappingConstant;
import com.cebi.utility.PdfUtils;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
@Repository
@Transactional
public class CreateExcelDaoImpl extends PdfUtils implements CreateExcelDao {
private static final Logger logger = Logger.getLogger(CreateExcelDaoImpl.class);
@Autowired
CebiConstant cebiConstant;
@Autowired
StaticReportDaoImpl staticReportDaoImpl;
@Override
public byte[] downloadExcel(QueryData queryData, String bank, String merchantId) {
String parameter = "";
String columns = "";
String criteria = "";
int colNum = 0;
int rowcnt = 1;
byte[] outArray = null;
Session session = cebiConstant.getCurrentSession(bank);
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement prepareStatement = null;
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
//SXSSFWorkbook wb = new SXSSFWorkbook();
//Sheet sheet = wb.createSheet();
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell(0);
HSSFFont font = wb.createFont();
font.setBold(true);
cellStyle.setFont(font);
ByteArrayOutputStream outByteStream = new ByteArrayOutputStream();
if ("INCT".equalsIgnoreCase(queryData.getTable())) {
String variable = "";
if (queryData.getParameter() != null && queryData.getParameter().length() > 0) {
variable = queryData.getParameter().substring(0, queryData.getParameter().length() - 1);
variable = variable.replace(",", "','");
List<String> data = null;
queryData.setParameter(data.stream().filter(data1 -> data1.trim().length() > 1).map(i -> i.toString()).collect(Collectors.joining(",")));
}
if (queryData.getQuery() != null && queryData.getQuery().length() > 0) {
String mandatory = "";
if (!queryData.getQuery().contains("INST_NO")) {
mandatory = " INST_NO ='003' AND ";
}
if (!queryData.getQuery().contains("TRAN_TYPE")) {
mandatory = " TRAN_TYPE IN (01, 20, 80) AND ";
}
queryData.setQuery(mandatory + queryData.getQuery());
} else {
String mandatory = " INST_NO ='003' AND TRAN_TYPE IN (01, 20, 80) ";
queryData.setQuery(mandatory);
}
parameter = queryData.getParameter().trim().length() > 0 ? queryData.getParameter() : "";
criteria = queryData.getQuery().trim().length() > 0 ? queryData.getQuery() : "";
columns = queryData.getColumnNames().trim().length() > 0 ? queryData.getColumnNames() : "";
} else {
parameter = queryData.getParameter().trim().length() > 0 ? queryData.getParameter() : "";
criteria = queryData.getQuery().trim().length() > 0 ? queryData.getQuery() : "";
columns = queryData.getColumnNames().trim().length() > 0 ? queryData.getColumnNames() : "";
}
String query = populateQuery(queryData, parameter, criteria, merchantId);
try {
connection = ((SessionImpl) session).connection();
prepareStatement = connection.prepareStatement(query);
resultSet = prepareStatement.executeQuery();
String lstparam = parameter.substring(0, (parameter.length() - 1));
List<String> dbColumns = Arrays.asList(lstparam.split(","));
List<String> columnLables = Arrays.asList(columns.split(","));
if ("INCT".equalsIgnoreCase(queryData.getTable())) {
ResultSetMetaData rsmd = resultSet.getMetaData();
int columnCount = rsmd.getColumnCount();
dbColumns=new ArrayList<String>();
for (int i = 1; i <= columnCount; i++) {
String labelName=rsmd.getColumnName(i);
cell = row.createCell(colNum);
cell.setCellStyle(cellStyle);
cell = row.createCell(colNum);
cell.setCellValue(labelName);
++colNum;
dbColumns.add(labelName);
}
} else
for (String lbl : columnLables) {
cell = row.createCell(colNum);
cell.setCellStyle(cellStyle);
cell = row.createCell(colNum);
cell.setCellValue(lbl);
++colNum;
}
while (resultSet.next()) {
colNum = 0;
row = sheet.createRow(rowcnt);
for (String label : dbColumns) {
label = label.contains("(") && label.contains(")") ? label.substring(label.indexOf('(') + 1, label.indexOf(')')) : label;
cell = row.createCell(colNum);
if (resultSet.getString(label) == null || resultSet.getString(label).isEmpty())
cell.setCellValue("");
else
cell.setCellValue(resultSet.getString(label));
++colNum;
}
++rowcnt;
}
wb.write(outByteStream);
} catch (Exception e) {
logger.info(e.getMessage());
} catch (OutOfMemoryError error) {
throw new ConnectionException("Failed to allocate Max memory...!");
} finally {
if (resultSet != null) {
try {
resultSet.close();
} catch (SQLException e) { /* ignored */
}
}
if (prepareStatement != null) {
try {
prepareStatement.close();
} catch (SQLException e) { /* ignored */
}
}
if (connection != null) {
try {
connection.close();
} catch (SQLException e) { /* ignored */
}
}
}
outArray = outByteStream.toByteArray();
return outArray;
}
}
| [
"mahenderkumar.g@01CEDHWLAP451.cedge.in"
] | mahenderkumar.g@01CEDHWLAP451.cedge.in |
b6cbd013d77e8dc89d2a42b33349fbb725cddf1e | 87d9687d1726c9210befb57f9373c44616abe6ee | /petshop-swagger-sdk-java/src/main/java/com/trestman/client/petshop/PetshopApiClient.java | 9362b78c81f44c4ea21af613404a8158d9f4ae9f | [] | no_license | atrestman/api-petshop-sample | b7c6f78d5ac1f04bbf23997a8c3bbc51b4c37a2b | c770531be02821ea41cc8e3a4bcfcaa9798aeb79 | refs/heads/master | 2021-05-08T11:39:55.995376 | 2018-02-02T00:28:36 | 2018-02-02T00:28:36 | 119,906,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package com.trestman.client.petshop;
import com.trestman.client.ApiClient;
import com.trestman.client.ApiException;
import com.trestman.client.Configuration;
import com.trestman.client.petshop.model.Address;
import com.trestman.client.petshop.model.Pet;
import com.trestman.client.petshop.model.Seller;
import java.util.List;
public class PetshopApiClient {
private final AddressApi addressApi = new AddressApi();
private final SellerApi sellerApi = new SellerApi();
private final PetApi petApi = new PetApi();
public PetshopApiClient() {
ApiClient apiClient = Configuration.getDefaultApiClient();
apiClient.setBasePath("http://localhost:8080/");
}
public List<Address> getAddresses() throws ApiException {
return addressApi.getAddress();
}
public List<Seller> getSellers() throws ApiException {
return sellerApi.getSellers();
}
public List<Pet> getPets() throws ApiException {
return petApi.getPets();
}
}
| [
"atrestman@sg-atrestman.local"
] | atrestman@sg-atrestman.local |
7d0a4dc90d191a685c72f434e80401eb52c5f5f2 | cd58a1acdd4761530e1cf5d8165f6f241fb45699 | /app/src/test/java/apk/win/first/secondgoogaut/ExampleUnitTest.java | 622d26e4e531c668be2e339fa5713db59874a848 | [] | no_license | BohdanLiush/SecondGoogAut | b8bebd7c6e57c80a13b56cd8e598eb232ef3f130 | f4140c5784a86cdb37a0f318066a8dfa17255f69 | refs/heads/master | 2020-04-08T13:00:36.258164 | 2018-11-27T17:06:35 | 2018-11-27T17:06:35 | 159,371,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package apk.win.first.secondgoogaut;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"marsnutscom@gmail.com"
] | marsnutscom@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.