blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b653b5c411639e03157f7cb24a511589b81364ee | 987117b2e49f327d5f60f258f1685c2c6cb38810 | /review-microservice/src/main/java/co/agileventure/cloud/review/ReviewMicroServiceApplication.java | 017dcabb0751832173f7764dd40a5d69f43ff472 | [] | no_license | ortizcarlos/cloud-microservices | a1b90a8d87040d53ff84a7c000107e2d64980829 | c675e1c1e57c79a08095f3fe390b35b21f4cabcc | refs/heads/master | 2021-01-21T04:51:00.346970 | 2016-05-30T14:29:21 | 2016-05-30T14:29:21 | 47,046,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | 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 co.agileventure.cloud.review;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
*
* @author Carlos
*/
@SpringBootApplication
@EnableDiscoveryClient
public class ReviewMicroServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ReviewMicroServiceApplication.class, args);
}
}
| [
"[email protected]"
] | |
ec3a00127cce3489332276b64110e308317a7232 | 907ba3c15c2483bbdc568d0d07b56b6c49bfd10e | /platform-shop/src/main/java/com/platform/service/impl/CategoryServiceImpl.java | d0562b1dba329b3ccf34d1947444a56ec9c8de3d | [
"Apache-2.0"
] | permissive | hxy00/platform | 2989fff0bae622f9c1c8a75a644e888f7d4afe48 | ad9c131dce168a220c367f278e31cb747b87db93 | refs/heads/master | 2023-05-31T19:05:37.514889 | 2021-06-21T07:53:18 | 2021-06-21T07:53:18 | 377,036,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | package com.platform.service.impl;
import com.platform.dao.CategoryDao;
import com.platform.entity.CategoryEntity;
import com.platform.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* Service实现类
*
* @author admin
* @email [email protected]
* @date 2017-08-21 15:32:31
*/
@Service("categoryService")
public class CategoryServiceImpl implements CategoryService {
@Autowired
private CategoryDao categoryDao;
@Override
public CategoryEntity queryObject(Integer id) {
return categoryDao.queryObject(id);
}
@Override
public List<CategoryEntity> queryList(Map<String, Object> map) {
return categoryDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return categoryDao.queryTotal(map);
}
@Override
public int save(CategoryEntity category) {
if ("L1".equals(category.getLevel())) {
category.setParentId(0);
}
return categoryDao.save(category);
}
@Override
public int update(CategoryEntity category) {
if ("L1".equals(category.getLevel())) {
category.setParentId(0);
}
return categoryDao.update(category);
}
@Override
public int delete(Integer id) {
return categoryDao.delete(id);
}
@Override
@Transactional
public int deleteBatch(Integer[] ids) {
categoryDao.deleteByParentBatch(ids);
return categoryDao.deleteBatch(ids);
}
}
| [
"[email protected]"
] | |
291aaa0d16f654774d4eb811607c1099f3e5d2f2 | 351c22f87b16400e000cff8f554feafa761136a4 | /app/src/main/java/example/fangsf/designpatterns/command/sample3/DrawCanvas.java | c7a6fa0deef00fecbb7b0001cf0e76b636a649bb | [] | no_license | midFang/DesignPatterns | 1fb32833824e32d29dc44081e98af8bc7a837fe1 | dcff077a26b458327a0d79bb4c9a85a32de0a7e7 | refs/heads/master | 2020-04-05T06:20:35.080523 | 2019-01-02T02:18:16 | 2019-01-02T02:18:16 | 156,634,577 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,125 | java | package example.fangsf.designpatterns.command.sample3;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* Created by fangsf on 2018/12/17.
* Useful: 真正的执行者画布
*/
public class DrawCanvas extends SurfaceView implements SurfaceHolder.Callback {
public boolean isDrawing, isRunning;
private Bitmap mBitmap; // 绘制到的位图对象
private DrawInvoker mInvoker; // 绘制命令的请求对象
private drawThread mThread; // 绘制线程
public DrawCanvas(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
mInvoker = new DrawInvoker();
mThread = new drawThread();
getHolder().addCallback(this);
}
/**
* 增加一条绘制路径
*/
public void add(DrawPath path) {
mInvoker.add(path);
}
/**
* 重做上一部的撤销绘制
*/
public void redo() {
isDrawing = true;
mInvoker.redo();
}
/**
* 撤销上一部的撤销绘制
*/
public void undo() {
isDrawing = true;
mInvoker.undo();
}
/**
* 是否可以撤销
*/
public boolean canUndo() {
return mInvoker.canUndo();
}
/**
* 是否可以重做
*/
public boolean canRedo() {
return mInvoker.canRedo();
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
isRunning = true;
mThread.start();
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
boolean retry = true;
isRunning = false;
while (retry) {
try {
mThread.join();
retry = false;
} catch (Exception e) {
e.printStackTrace();
}
}
}
private class drawThread extends Thread {
@Override
public void run() {
Canvas canvas = null;
while (isRunning) {
if (isDrawing) {
try {
canvas = getHolder().lockCanvas(null);
if (mBitmap == null) {
mBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
}
Canvas c = new Canvas(mBitmap);
c.drawColor(0, PorterDuff.Mode.CLEAR);
canvas.drawColor(0, PorterDuff.Mode.CLEAR);
mInvoker.execute(c);
canvas.drawBitmap(mBitmap, 0, 0, null);
} finally {
getHolder().unlockCanvasAndPost(canvas);
}
isDrawing = false;
}
}
}
}
}
| [
"[email protected]"
] | |
a8e4e67122a08ce868dde54912e21786ad2f0c4b | 9102ef6f56e5b7b8cad91b3f3edba5d8bc066e4c | /module-1/12_Polymorphism/student-exercise/src/main/java/com/techelevator/postageCalculator/PostalServiceSecondClass.java | 2565ae12a59860ffaa15437679c3188ee078c0f7 | [] | no_license | Womencancode/techelevator-cbus | 91897fc5c6018e9f248936e4287abbfd127f6f26 | 8fa14e3a75ed54e299a7e741437d9ddfb33ff2a9 | refs/heads/master | 2020-07-24T15:03:15.314088 | 2019-08-05T23:32:47 | 2019-08-05T23:32:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | package com.techelevator.postageCalculator;
public class PostalServiceSecondClass implements DeliveryDriver {
private String name = "Postal Service (2nd Class)";
@Override
public double calculateRate(int distance, double weight) {
if (weight >= 0 && weight <= 2) {
return 0.0035 * distance;
}
else if (weight >= 3 && weight <= 8) {
return 0.0040 * distance;
}
else if (weight >= 9 && weight <= 15) {
return 0.0047 * distance;
}
else if (weight >= 16 && weight <= 48) {
return 0.0195 * distance;
}
else if (weight >= 64 && weight <= 128) {
return 0.0450 * distance;
}
else {
return 0.0500 * distance;
}
}
@Override
public String getName() {
return name;
}
}
| [
"[email protected]"
] | |
953fdf0c479e1f70d3796f4c76d8e14bb6d64606 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/d4a0eb818e580ae6806cd0dacdf5545df1df11ac/after/TermsParametersParser.java | bea9f02936656f0d0361e3e97fdf0e8b9e4e5ec3 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,328 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.search.aggregations.bucket.terms;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchParseException;
import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException;
public class TermsParametersParser extends AbstractTermsParametersParser {
private static final TermsAggregator.BucketCountThresholds DEFAULT_BUCKET_COUNT_THRESHOLDS = new TermsAggregator.BucketCountThresholds(1, 0, 10, -1);
public String getOrderKey() {
return orderKey;
}
public boolean isOrderAsc() {
return orderAsc;
}
String orderKey = "_count";
boolean orderAsc = false;
@Override
public void parseSpecial(String aggregationName, XContentParser parser, SearchContext context, XContentParser.Token token, String currentFieldName) throws IOException {
if (token == XContentParser.Token.START_OBJECT) {
if ("order".equals(currentFieldName)) {
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
orderKey = parser.currentName();
} else if (token == XContentParser.Token.VALUE_STRING) {
String dir = parser.text();
if ("asc".equalsIgnoreCase(dir)) {
orderAsc = true;
} else if ("desc".equalsIgnoreCase(dir)) {
orderAsc = false;
} else {
throw new SearchParseException(context, "Unknown terms order direction [" + dir + "] in terms aggregation [" + aggregationName + "]");
}
} else {
throw new SearchParseException(context, "Unexpected token " + token + " for [order] in [" + aggregationName + "].");
}
}
} else {
throw new SearchParseException(context, "Unknown key for a " + token + " in [" + aggregationName + "]: [" + currentFieldName + "].");
}
} else {
throw new SearchParseException(context, "Unknown key for a " + token + " in [" + aggregationName + "]: [" + currentFieldName + "].");
}
}
@Override
public TermsAggregator.BucketCountThresholds getDefaultBucketCountThresholds() {
return new TermsAggregator.BucketCountThresholds(DEFAULT_BUCKET_COUNT_THRESHOLDS);
}
} | [
"[email protected]"
] | |
1c170885250a6b8b6a4b39f9fc1a08996542977d | 58d922083ce9037e78413762dec2a92b00858d7f | /server/src/main/java/com/squeed/attendit/server/rest/RegistrationServiceBean.java | 9a06304077e9a969ca7d055378b7d579d0d16ec4 | [] | no_license | redsolo/attend-it | 220b59c6c3655245e52dc0b4eeedf6c8c47af490 | 0cfb0c8a1b3d653ded967484ebcfe5ecaabcd1de | refs/heads/master | 2021-01-13T01:13:20.887138 | 2012-02-07T08:18:00 | 2012-02-07T08:18:00 | 2,898,596 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,195 | java | package com.squeed.attendit.server.rest;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.apache.log4j.Logger;
import com.squeed.attendit.api.PersonDTO;
import com.squeed.attendit.api.RegistrationDTO;
import com.squeed.attendit.server.dao.RegistrationDAO;
import com.squeed.attendit.server.dao.RegistrationDAOImpl;
import com.squeed.attendit.server.model.Person;
import com.squeed.attendit.server.model.Registration;
import com.squeed.attendit.server.model.RegistrationStatus;
//@Stateful
//@RequestScoped
@Path("registration")
//@Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8")
//@Consumes(MediaType.APPLICATION_JSON + "; charset=UTF-8")
public class RegistrationServiceBean {
private Logger log = Logger.getLogger(RegistrationServiceBean.class);
@Inject
private RegistrationDAO dao;
@POST
@Path("/register/attendant/{id}")
public void register(@PathParam("id") Long registrationId) {
Registration registration = dao.getRegistration(registrationId);
registration.setStatus(RegistrationStatus.ARRIVED);
dao.updateRegistration(registration);
}
@POST
@Path("/unregister/attendant/{id}")
public void unregister(@PathParam("id") Long registrationId) {
Registration registration = dao.getRegistration(registrationId);
registration.setStatus(RegistrationStatus.REGISTERED);
dao.updateRegistration(registration);
}
@POST
@Path("/person/{id}")
public void update(@PathParam("id") Long personId, PersonDTO person) {
Person dbPerson = dao.getPerson(personId);
dbPerson.mergeValuesFrom(person);
dao.updatePerson(dbPerson);
}
@Path("/event/{eventId}/attendants")
@GET
@Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8")
public List<RegistrationDTO> getRegistrations(@PathParam("eventId") Long eventId) {
log.info("ENTER - getRegistrations(" + eventId + ")");
List<Registration> registrations = dao.getRegistrations(eventId);
return Registration.toDtoList(registrations);
}
}
| [
"Erik@Erik-PC.(none)"
] | Erik@Erik-PC.(none) |
d947a068b1ee90a915e56f587292653c81beb514 | ea3ab9279456bdf1e7aa867e4af5dd7ae23e3298 | /src/com/delormeloic/generator/model/slides/SlideWithTitleWithSpeechWithMovie.java | 7b5c555fcc28e7b0fd754a4f6663dcf9d172523f | [
"MIT"
] | permissive | LoicDelorme/Polytech-Slides-Software | 96ca9dcbe8a1308c72c7631146e67b88dede13fe | fa302d71bc49329dbdaa34b2e89bbf1d55c4dc44 | refs/heads/master | 2016-08-12T18:25:32.998823 | 2016-04-27T09:15:06 | 2016-04-27T09:15:06 | 48,848,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,185 | java | package com.delormeloic.generator.model.slides;
import org.json.JSONObject;
/**
* This class represents a slide with a title with a speech with a movie.
*
* @author DELORME Loïc
* @since 1.0.0
*/
public class SlideWithTitleWithSpeechWithMovie extends SlideWithTitleWithSpeechWithContent
{
/**
* The class for name.
*/
public static final String CLASS_FOR_NAME = "SlideWithTitleWithSpeechWithMovie";
/**
* The movie attribute.
*/
public static final String MOVIE_ATTRIBUTE = "movie";
/**
* Create a slide with a title with a speech with a movie.
*
* @param name
* The name.
* @param data
* The data.
*/
public SlideWithTitleWithSpeechWithMovie(String name, JSONObject data)
{
super(CLASS_FOR_NAME, name, data);
}
/**
* Create a slide with a title with a speech with a movie.
*
* @param name
* The name.
*/
public SlideWithTitleWithSpeechWithMovie(String name)
{
super(CLASS_FOR_NAME, name);
}
/**
* @see com.delormeloic.generator.model.slides.SlideWithTitleWithSpeechWithContent#getContentAttribute()
*/
@Override
public String getContentAttribute()
{
return MOVIE_ATTRIBUTE;
}
} | [
"[email protected]"
] | |
4cd99a841cb90e96fa7294205fc0eb4f47e9d19c | dfb1419e7aeb9a61d7883f653a7c0ff2a203cdd9 | /Mehmet_Atakan_Kalkar_HW4/src/mehmet_atakan_kalkar_hw4/Song.java | b4bdda3911ee49c0319972f9ae3e8b53d81adbad | [] | no_license | atakankalkar/Java_Project4 | 69dbe93a09ea88e5f6e388ffe5b3925316b8bd0a | b9fd4fef6a6bd4599a56dc5ea9e71f07619f193c | refs/heads/master | 2020-12-11T08:41:18.621644 | 2020-01-27T12:54:43 | 2020-01-27T12:54:43 | 233,804,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 510 | 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 mehmet_atakan_kalkar_hw4;
/**
*
* @author ataka
*/
public class Song {
String SongName;
Song next;
@Override
public String toString() {
String a;
a=this.SongName;
return a; //To change body of generated methods, choose Tools | Templates.
}
} | [
"[email protected]"
] | |
af65241efaed384f0ec5c005dbc8eb7b186614d6 | 898d81ec379374968b3ded7b0ac5af668874ff74 | /src/Servlet/UpdateUser.java | ff97ae9adc095b14d8f6514bce1630195bed7ea0 | [
"MIT"
] | permissive | RMalsonR/Java_EE_Servlet_Education | 9d0ab655009fe3843d7c69d1ff31c952e731d0a7 | f1805b6674ccfc24a9f261765d196ef8fc0b7f66 | refs/heads/master | 2021-02-13T23:05:47.499717 | 2020-05-06T12:45:19 | 2020-05-06T12:45:19 | 244,743,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,472 | java | package Servlet;
import Repository.UserRepository;
import Configs.Config;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
@WebServlet("/update")
@MultipartConfig(fileSizeThreshold = 1024 * 1024,
maxFileSize = 1024 * 1024 * 5,
maxRequestSize = 1024 * 1024 * 5 * 5)
public class UpdateUser extends HttpServlet {
private UserRepository userRepository;
private static final String UPLOAD_DIR = "uploads";
@Override
public void init() throws ServletException {
userRepository = UserRepository.getRepository();
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("/update.jsp").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
String applicationPath = request.getServletContext().getRealPath("");
String uploadFilePath = applicationPath + UPLOAD_DIR;
File uploadFolder = new File(uploadFilePath);
if (!uploadFolder.exists()) {
uploadFolder.mkdirs();
}
PrintWriter writer = response.getWriter();
String name = (String) request.getSession().getAttribute(Config.USER_NAME);
int userId = (int) request.getSession().getAttribute(Config.USER_ID);
Map<String, Object> context = new HashMap<>();
context.put("name", name);
for (Part part : request.getParts()) {
if (part != null && part.getSize() > 0) {
String fileName = part.getSubmittedFileName();
part.write(uploadFilePath + File.separator + fileName);
String sPath =Config.URL_PATH + File.separator + UPLOAD_DIR + File.separator + fileName;
System.out.println(sPath);
context.put("avatar", sPath);
}
}
userRepository.updateStudentById(userId, context);
response.sendRedirect(Config.URL_PATH + "/base");
}
}
| [
"[email protected]"
] | |
f1b4e1dd574ad70a03725485ad67312caa855a27 | fd6b942326542e754dc3c9883862190e05283436 | /src/test/java/logging/extentreports/ExtentUtils.java | bb8efdb7d9eb51e75dea6c77dba7bca7afda8d3b | [] | no_license | eagleboyjr/selenium-helper-lib | 2ec29b42d24efb4994294ff5ee88537e72378048 | 8499f83304c3471f451f0f2a18cc62e42d50df8b | refs/heads/master | 2021-08-23T05:48:41.551554 | 2017-12-03T18:38:08 | 2017-12-03T18:38:08 | 107,167,058 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,217 | java | package logging.extentreports;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import static logging.extentreports.Constants.DOC_TITLE;
import static logging.extentreports.Constants.OUTPUT_HTML;
public class ExtentUtils {
private static ExtentReports extent;
public static ExtentReports getInstance(){
if(extent ==null)
createInstance(OUTPUT_HTML);
return extent;
}
public static ExtentReports createInstance(String fileName){
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(fileName);
htmlReporter.config().setChartVisibilityOnOpen(true);
htmlReporter.config().setEncoding("utf-8");
htmlReporter.config().setDocumentTitle(DOC_TITLE);
extent = new ExtentReports();
extent.setSystemInfo("OS : ", System.getProperty("os.name"));
extent.setSystemInfo("OS: ", System.getProperty("os.name"));
extent.setSystemInfo("Test Engineer: ", System.getProperty("user.name"));
extent.setSystemInfo("Java Version: ", System.getProperty("java.version"));
extent.attachReporter(htmlReporter);
return extent;
}
} | [
"[email protected]"
] | |
7f18da322d0601e9cb1a2cb542243480f2e2b595 | 4e8d52f594b89fa356e8278265b5c17f22db1210 | /WebServiceArtifacts/FlightBookingService/org/datacontract/schemas/_2004/_07/goquo_dp/PaymentMethodsEN.java | edfd2b1ae55ad12b005c5ac6fb5fc52596d82ed9 | [] | no_license | ouniali/WSantipatterns | dc2e5b653d943199872ea0e34bcc3be6ed74c82e | d406c67efd0baa95990d5ee6a6a9d48ef93c7d32 | refs/heads/master | 2021-01-10T05:22:19.631231 | 2015-05-26T06:27:52 | 2015-05-26T06:27:52 | 36,153,404 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,026 | java |
package org.datacontract.schemas._2004._07.goquo_dp;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PaymentMethodsEN complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PaymentMethodsEN">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Instructed" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="PaymentMethodID" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* <element name="ResultMsg" type="{http://schemas.datacontract.org/2004/07/GoQuo.DP.Entities}Result" minOccurs="0"/>
* <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PaymentMethodsEN", propOrder = {
"instructed",
"name",
"paymentMethodID",
"resultMsg",
"status"
})
@XmlSeeAlso({
CustomerUserPaymentMethodsEN.class
})
public class PaymentMethodsEN {
@XmlElement(name = "Instructed")
protected Boolean instructed;
@XmlElementRef(name = "Name", namespace = "http://schemas.datacontract.org/2004/07/GoQuo.DP.Entities", type = JAXBElement.class, required = false)
protected JAXBElement<String> name;
@XmlElement(name = "PaymentMethodID")
protected Integer paymentMethodID;
@XmlElementRef(name = "ResultMsg", namespace = "http://schemas.datacontract.org/2004/07/GoQuo.DP.Entities", type = JAXBElement.class, required = false)
protected JAXBElement<Result> resultMsg;
@XmlElementRef(name = "Status", namespace = "http://schemas.datacontract.org/2004/07/GoQuo.DP.Entities", type = JAXBElement.class, required = false)
protected JAXBElement<String> status;
/**
* Gets the value of the instructed property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isInstructed() {
return instructed;
}
/**
* Sets the value of the instructed property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setInstructed(Boolean value) {
this.instructed = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public void setName(JAXBElement<String> value) {
this.name = value;
}
/**
* Gets the value of the paymentMethodID property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getPaymentMethodID() {
return paymentMethodID;
}
/**
* Sets the value of the paymentMethodID property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setPaymentMethodID(Integer value) {
this.paymentMethodID = value;
}
/**
* Gets the value of the resultMsg property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link Result }{@code >}
*
*/
public JAXBElement<Result> getResultMsg() {
return resultMsg;
}
/**
* Sets the value of the resultMsg property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link Result }{@code >}
*
*/
public void setResultMsg(JAXBElement<Result> value) {
this.resultMsg = value;
}
/**
* Gets the value of the status property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public void setStatus(JAXBElement<String> value) {
this.status = value;
}
}
| [
"[email protected]"
] | |
251f9bf74f69bfa7a79b0feb1479f9632f0e14bf | 54521f2dcb1c50ed687a12725ce448119459f109 | /Selenium/SeleniumFw/src/test/java/test/Test1_GoogleSearch.java | d372a013ea1d01398104e41c8e03bef0eea86975 | [] | no_license | AHSaymon/Experiment | cf113b0483f6528924408bd99b3278f7fd1bd1cf | 38b826e540174da9bcc7397a7c67f8f9fc28f9c3 | refs/heads/main | 2023-04-28T12:26:10.048397 | 2021-05-21T17:36:55 | 2021-05-21T17:36:55 | 369,607,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | package test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Test1_GoogleSearch {
public static void main(String[] args) {
youtubeSearch();
}
public static void youtubeSearch(){
System.setProperty("webdriver.gecko.driver", "C:\\Users\\User\\Desktop\\Work\\New folder\\Selenium\\SeleniumFw\\drivers\\geckodriver\\geckodriver.exe");
WebDriver driver =new FirefoxDriver();
driver.get("https://youtube.com/");
driver.findElement(By.xpath("//input[@id='search']")).sendKeys("Wwe");
driver.findElement(By.id("search-icon-legacy")).sendKeys(Keys.RETURN);
}
}
| [
"[email protected]"
] | |
03a70fdc6ed3f94c56d5a4495998f965a68586fe | 1a3336f90d56c74ec9f64061f92ac7a2f583bfa5 | /src/com/javaex/ex18/Point.java | 0a3d4ff182f0ce9b5ac4646c28280402da723600 | [] | no_license | twosoull/chapter02 | 5a8f94277ba547e869544f78fc76e71c86e80b2c | b5edff43ee02730b4ffdae423837ec863b35735f | refs/heads/master | 2023-01-25T03:56:45.199976 | 2020-12-02T14:35:45 | 2020-12-02T14:35:45 | 315,261,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package com.javaex.ex18;
public class Point {
//필드
private int x;
private int y;
//생성자
public Point() {
}
public Point(int x, int y) {
this.x = x;
this.y = y;
//메소드 g/s
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
//메소드 일반
public void showInfo() {
System.out.println("x ="+ x + " y="+y);
}
@Override
public String toString() {
return "Point [x=" + x + ", y=" + y + "]";
}
}
| [
"[email protected]"
] | |
21f73860669c2d30b570905a3038e83ed6f304d3 | 01a6fd5ac643d9150ae8748d89e21da7965c8faa | /src/lesson03/Lesson03.java | 242eb308bb4d3ab1eecd37933d06505ddf0b4c5d | [] | no_license | dianatikhomirova/Java_Beginner | cdf92e8fe4f070b64b5afe18ede5ec796c056661 | 36ce92fce4800a767b68f4855ca0670e47a22ad3 | refs/heads/main | 2023-04-08T12:32:44.491146 | 2021-04-17T13:01:45 | 2021-04-17T13:01:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,689 | java | package lesson03;
import java.util.Random;
import java.util.Scanner;
public class Lesson03 {
public static char[][] field;
public static int fieldSize;
public static char human = 'X';
public static char ai = 'O';
public static char empty = '_';
public static Scanner scanner = new Scanner(System.in);
public static Random random = new Random();
public static void createField() {
fieldSize = 3;
field = new char[fieldSize][fieldSize];
for (int y = 0; y < fieldSize; y++) {
for (int x = 0; x < fieldSize; x++) {
field[y][x] = empty;
}
}
}
public static void viewField() {
for (int y = 0; y < fieldSize; y++) {
for (int x = 0; x < fieldSize; x++) {
System.out.print(field[y][x] + "|");
}
System.out.println();
}
System.out.println("---------------");
}
public static void turnHuman() {
int cellX;
int cellY;
do {
System.out.println("Введите координаты:");
cellX = scanner.nextInt() - 1;
cellY = scanner.nextInt() - 1;
} while (!validCell(cellY, cellX) || !emptyCell(cellY, cellX));
field[cellY][cellX] = human;
}
public static void turnAI() {
int cellX;
int cellY;
do {
cellX = random.nextInt(fieldSize);
cellY = random.nextInt(fieldSize);
} while (!emptyCell(cellY, cellX));
field[cellY][cellX] = ai;
}
public static boolean checkDiagonal(char player) {
boolean toRight = true;
boolean toLeft = true;
for (int i = 0; i < fieldSize; i++) {
toRight &= (field[i][i] == player);
toLeft &= (field[i][fieldSize - i - 1] == player);
}
return (toRight || toLeft);
}
public static boolean checkLines(char player) {
boolean cols, rows;
for (int y = 0; y < fieldSize; y++) {
rows = true;
cols = true;
for (int x = 0; x < fieldSize; x++) {
rows &= (field[x][y] == player);
cols &= (field[y][x] == player);
}
if (rows || cols) return true;
}
return false;
}
public static boolean winGame(char player) {
return (checkDiagonal(player) || checkLines(player));
}
public static boolean draw() {
for (int y = 0; y < fieldSize; y++) {
for (int x = 0; x < fieldSize; x++) {
if (field[y][x] == empty) return false;
}
}
return true;
}
public static boolean validCell(int cellY, int cellX) {
return cellX >= 0 && cellX < fieldSize && cellY >= 0 && cellY < fieldSize;
}
public static boolean emptyCell(int cellY, int cellX) {
return field[cellY][cellX] == empty;
}
public static void main(String[] args) {
createField();
viewField();
while (true) {
turnHuman();
viewField();
if (winGame(human)) {
System.out.println("Вы выиграли!");
break;
}
if (draw()) {
System.out.println("Ничья!");
break;
}
turnAI();
viewField();
if (winGame(ai)) {
System.out.println("Компьютер выиграл!");
break;
}
if (draw()) {
System.out.println("Ничья!");
break;
}
}
}
}
| [
"[email protected]"
] | |
ea09618e686205e17e3d3749ba1298c5bdba852a | 992c15265bd078c1b44affabe8dc1d068bedefb0 | /pet-clinic-web/src/main/java/guru/springframework/springpetclinic/SpringPetclinicApplication.java | db4f7f740c7e702c95ee4a77699266d842f2a686 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | KajcsaRenataGabriela/spring-petclinic | fcd39fbfcf6ecf6e9642b620fb2386234ac0b9ed | 63329d42034c6d6acb13c11bee7c2a9d3433187e | refs/heads/main | 2023-09-04T04:55:50.260842 | 2021-09-28T09:19:01 | 2021-09-28T09:19:01 | 407,080,707 | 0 | 0 | null | 2021-09-16T08:14:47 | 2021-09-16T08:14:47 | null | UTF-8 | Java | false | false | 348 | java | package guru.springframework.springpetclinic;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringPetclinicApplication {
public static void main(String[] args) {
SpringApplication.run(SpringPetclinicApplication.class, args);
}
}
| [
"[email protected]"
] | |
ddfe789199da61d746739f639fd8ca79a0ce505e | 2c23a89000d3a9499ea524618dab44446e0228c5 | /src/main/java/edu/princeton/cs/algs4/TestAlgs4.java | 8d38bb9eb5d705b91a8d598b84d7c36b1ff5ab72 | [] | no_license | changwenbiao/algs4 | ea40296dab72dca6356de050363d721fe83ed4a7 | 03aeb1f09351e0ad0201cd249907d502d1519312 | refs/heads/master | 2021-03-02T00:29:10.285513 | 2020-03-09T04:30:22 | 2020-03-09T04:30:22 | 245,823,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,222 | java | package edu.princeton.cs.algs4;
/******************************************************************************
* Compilation: javac-algs4 TestAlgs4.java
* Execution: java-algs4 TestAlgs4 n
*
* Simulates the motion of n hard disks, subject to the laws of elastic
* collisions. This program is intended to test that algs4.jar is properly
* installed.
*
******************************************************************************/
import edu.princeton.cs.algs4.CollisionSystem;
import edu.princeton.cs.algs4.Particle;
import edu.princeton.cs.algs4.StdDraw;
public class TestAlgs4 {
public static void main(String[] args) {
int n = 20; // number of particles (default 20)
if (args.length == 1) {
n = Integer.parseInt(args[0]);
}
// enable double buffering to support animations
StdDraw.enableDoubleBuffering();
// create the n particles
Particle[] particles = new Particle[n];
for (int i = 0; i < n; i++) {
particles[i] = new Particle();
}
// simulate the system
CollisionSystem system = new CollisionSystem(particles);
system.simulate(Double.POSITIVE_INFINITY);
}
}
| [
"[email protected]"
] | |
71ab5c18b0352380d53cbda43955dba99af38c0d | e978e5c8b877c251077b62432d08f76558e154d7 | /src/com/cita/wallet/app/network/LdapAuthRequest.java | c5721e75f7be35861d6228eea125205a6c29b654 | [] | no_license | cita-moviles/WUI-2.0 | 89dcd4ef202a4abc22cbcce4cbaa2dc2853f724b | 856148981f367f60d32e55ef11de91551fe5add3 | refs/heads/master | 2021-01-15T13:12:53.676295 | 2014-10-01T21:53:21 | 2014-10-01T21:53:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package com.cita.wallet.app.network;
import roboguice.util.temp.Ln;
import android.util.Base64;
import com.cita.wallet.app.models.LdapResponse;
import com.octo.android.robospice.request.retrofit.RetrofitSpiceRequest;
public class LdapAuthRequest extends
RetrofitSpiceRequest<LdapResponse, WalletApi> {
private String student_id;
private String student_password;
public LdapAuthRequest(String student_id, String student_password) {
super(LdapResponse.class, WalletApi.class);
this.student_id = student_id;
this.student_password = student_password;
}
@Override
public LdapResponse loadDataFromNetwork() throws Exception {
Ln.d("Authenticating ldap service for " + student_id + " " + " "
+ student_password);
String userPass = student_id + ":" + student_password;
final String basicAuth = "Basic "
+ Base64.encodeToString(userPass.getBytes(), Base64.NO_WRAP);
return getService().ldapResponse(basicAuth);
}
}
| [
"[email protected]"
] | |
96ef06a24d1daa1d355a6638ee0ad0247e69ab30 | 11abf91b59b345b451d8ea320d1de861c43ddad1 | /app/src/main/java/com/huashengmi/ui/android/ui/listview/view/RefreshListView.java | 9d1c87825a96e4009d358d28becbf4f904fde74f | [] | no_license | huangsanm/UISample | bb500bd7304c206439da062325d943adc1288804 | 0bd3273d3d48766c5bb45f7af20c589ae4c00a20 | refs/heads/master | 2016-09-06T17:58:37.423375 | 2015-04-15T06:43:24 | 2015-04-15T06:43:24 | 21,487,944 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,489 | java | package com.huashengmi.ui.android.ui.listview.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.huashengmi.ui.android.R;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by huangsm on 2014/9/9 0009.
* Email:[email protected]
*/
public class RefreshListView extends ListView implements AbsListView.OnScrollListener {
// 刷新的几个动作
// 释放
private final static int RELEASE_TO_REFRESH = 0;
// 拉
private final static int PULL_TO_REFRESH = RELEASE_TO_REFRESH + 1;
// 加载
private final static int LOADING = PULL_TO_REFRESH + 1;
// 刷新
private final static int REFRESHING = LOADING + 1;
// Nothing
private final static int DONE = REFRESHING + 1;
// 实际的padding的距离与界面上偏移距离的比例
private final static int RATIO = 2;
private Context mContext;
// 头部
private LinearLayout mHeaderViewLinearLayout;
private ImageView mHeaderImageView;
private ProgressBar mHeaderProgressBar;
private TextView mHeaderTipsTextView;
private TextView mHeaderUpdateTextView;
// 尾部
private LinearLayout mFooterViewLinearLayout;
private ImageView mFooterImageView;
private ProgressBar mFooterProgressBar;
private TextView mFooterTipsTextView;
private TextView mFooterUpdateTextView;
// 旋转动画
private RotateAnimation mUpAnimation;
private RotateAnimation mDownAnimation;
// 头部高度
private int mHeaderHeight;
// 尾部高度
private int mFooterHeight;
// 先缓存第一个item
private int mFirstItemIndex;
// 是否可以上拉,下拉刷新
private boolean isLastItem = false;
private boolean isFirstItem = false;
private int mStartY;
// 当前listview状态
private int mRefreshState = DONE;
// Touch事件完成之后刷新数据
private boolean isTouch;
// 拉动动作
private boolean isPullUp = false;
private boolean isPullDown = false;
// 控制动画
private boolean isRotate;
private onRefreshListener mOnRefreshListener;
// 第几个开始允许刷新
private static final int START_REFRESH_POSITION = 1;
public RefreshListView(Context context) {
super(context);
init(context);
}
public RefreshListView(Context context, AttributeSet attr) {
super(context, attr);
init(context);
}
private void init(Context context) {
mContext = context;
LayoutInflater inflater = LayoutInflater.from(mContext);
mHeaderViewLinearLayout = (LinearLayout) inflater.inflate(
R.layout.view_listview_header, null);
mFooterViewLinearLayout = (LinearLayout) inflater.inflate(
R.layout.view_listview_footer, null);
initHeader();
initFooter();
initAnimation();
setOnScrollListener(this);
}
/**
* 初始化header,测量高度
*/
private void initHeader() {
mHeaderImageView = (ImageView) mHeaderViewLinearLayout
.findViewById(R.id.head_refresh);
mHeaderProgressBar = (ProgressBar) mHeaderViewLinearLayout
.findViewById(R.id.head_progress);
mHeaderTipsTextView = (TextView) mHeaderViewLinearLayout
.findViewById(R.id.head_tips);
mHeaderUpdateTextView = (TextView) mHeaderViewLinearLayout
.findViewById(R.id.head_last_update);
mHeaderImageView.setMinimumWidth(70);
mHeaderImageView.setMinimumHeight(50);
// 测量高度
measureView(mHeaderViewLinearLayout);
// 获取测量之后的高度
mHeaderHeight = mHeaderViewLinearLayout.getMeasuredHeight();
mHeaderViewLinearLayout.setPadding(0, -1 * mHeaderHeight, 0, 0);
// 通知重新绘制
mHeaderViewLinearLayout.invalidate();
addHeaderView(mHeaderViewLinearLayout, null, false);
}
/**
* 初始化footer,测量高度
*/
private void initFooter() {
mFooterImageView = (ImageView) mFooterViewLinearLayout
.findViewById(R.id.foot_refresh);
mFooterProgressBar = (ProgressBar) mFooterViewLinearLayout
.findViewById(R.id.foot_progress);
mFooterTipsTextView = (TextView) mFooterViewLinearLayout
.findViewById(R.id.foot_tips);
mFooterUpdateTextView = (TextView) mFooterViewLinearLayout
.findViewById(R.id.foot_last_update);
mFooterImageView.setMinimumWidth(70);
mFooterImageView.setMinimumHeight(50);
measureView(mFooterViewLinearLayout);
mFooterHeight = mFooterViewLinearLayout.getMeasuredHeight();
mFooterViewLinearLayout.setPadding(0, 0, 0, -1 * mFooterHeight);
mFooterViewLinearLayout.invalidate();
addFooterView(mFooterViewLinearLayout, null, false);
}
/**
* 旋转箭头动画
*/
private void initAnimation() {
mUpAnimation = new RotateAnimation(0, -180,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mUpAnimation.setInterpolator(new LinearInterpolator());
mUpAnimation.setDuration(250);
mUpAnimation.setFillAfter(true);
mDownAnimation = new RotateAnimation(-180, 0,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mDownAnimation.setInterpolator(new LinearInterpolator());
mDownAnimation.setDuration(250);
mDownAnimation.setFillAfter(true);
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// 减"1"为footerview
if (view.getLastVisiblePosition() == view.getCount() - 1) {
isLastItem = true;
}
if (view.getFirstVisiblePosition() <= START_REFRESH_POSITION) {
isFirstItem = true;
}else{
isFirstItem = false;
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
mFirstItemIndex = firstVisibleItem;
// adapter为空
if (mFirstItemIndex == 0) {
isLastItem = false;
}
if (mFirstItemIndex == 0&&visibleItemCount <= 2) {
isFirstItem = true;
}
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (mOnRefreshListener == null)
return false;
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
if (!isTouch) {
isTouch = true;
mStartY = (int) ev.getY();
}
break;
case MotionEvent.ACTION_MOVE:
int tempY = (int) ev.getY();
// 往上拉 ,加载更多数据
if (tempY - mStartY <= 0) {
isPullUp = true;
isPullDown = false;
if (mRefreshState != REFRESHING && isTouch
&& mRefreshState != LOADING) {
if (mRefreshState == RELEASE_TO_REFRESH) {
// 正在拖动listview,需改变footerview状态
if ((mStartY - tempY) / RATIO < mFooterHeight
&& (mStartY - tempY) > 0) {
mRefreshState = PULL_TO_REFRESH;
changeFooterViewRefresh();
} else if (mStartY - tempY <= 0) {
mRefreshState = DONE;
changeFooterViewRefresh();
}
}
// 还没有到达显示松开刷新的时候,DONE或者是PULL_TO_REFRESH状态
if (mRefreshState == PULL_TO_REFRESH && isLastItem) {
if ((mStartY - tempY) / RATIO >= mFooterHeight) {
mRefreshState = RELEASE_TO_REFRESH;
isRotate = true;
changeFooterViewRefresh();
} else if (mStartY - tempY <= 0) {
mRefreshState = DONE;
changeFooterViewRefresh();
}
}
// done状态下
if (mRefreshState == DONE) {
if (mStartY - tempY > 0) {
mRefreshState = PULL_TO_REFRESH;
changeFooterViewRefresh();
}
}
if (isLastItem) {
// 更新footView的size
if (mRefreshState == PULL_TO_REFRESH) {
mFooterViewLinearLayout
.setPadding(0, 0, 0, -1 * mFooterHeight
+ (mStartY - tempY) / RATIO);
}
// 更新footView的paddingTop
if (mRefreshState == RELEASE_TO_REFRESH) {
mFooterViewLinearLayout.setPadding(0, 0, 0,
(mStartY - tempY) / RATIO - mFooterHeight);
}
}
}
} else if ((tempY - mStartY) >= 0) {
// 标识下拉刷新
isPullDown = true;
isPullUp = false;
if (mRefreshState != REFRESHING && isTouch
&& mRefreshState != LOADING) {
// 保证在设置padding的过程中,当前的位置一直是在head,否则如果当列表超出屏幕的话,当在上推的时候,列表会同时进行滚动
// 可以松手去刷新了
if (mRefreshState == RELEASE_TO_REFRESH) {
// 往上推了,推到了屏幕足够掩盖head的程度,但是还没有推到全部掩盖的地步
if (((tempY - mStartY) / RATIO < mHeaderHeight)
&& (tempY - mStartY) > 0) {
mRefreshState = PULL_TO_REFRESH;
changeHeaderViewRefresh();
}
// 一下子推到顶了
else if (tempY - mStartY <= 0) {
mRefreshState = DONE;
changeHeaderViewRefresh();
}
// 往下拉了,或者还没有上推到屏幕顶部掩盖head的地步
else {
// 不用进行特别的操作,只用更新paddingTop的值就行了
}
}
// 还没有到达显示松开刷新的时候,DONE或者是PULL_To_REFRESH状态
if (mRefreshState == PULL_TO_REFRESH && isFirstItem) {
// setSelection(0);
// 下拉到可以进入RELEASE_TO_REFRESH的状态
if ((tempY - mStartY) / RATIO >= mHeaderHeight) {
mRefreshState = RELEASE_TO_REFRESH;
isRotate = true;
changeHeaderViewRefresh();
}
// 上推到顶了
else if (tempY - mStartY <= 0) {
mRefreshState = DONE;
changeHeaderViewRefresh();
}
}
// done状态下
if (mRefreshState == DONE) {
if (tempY - mStartY > 0) {
mRefreshState = PULL_TO_REFRESH;
changeHeaderViewRefresh();
}
}
if (isFirstItem) {
// 更新headView的size
if (mRefreshState == PULL_TO_REFRESH) {
mHeaderViewLinearLayout.setPadding(0,
-1 * mHeaderHeight + (tempY - mStartY)
/ RATIO, 0, 0);
}
// 更新headView的paddingTop
if (mRefreshState == RELEASE_TO_REFRESH) {
mHeaderViewLinearLayout.setPadding(0,
(tempY - mStartY) / RATIO - mHeaderHeight,
0, 0);
}
}
}
}
break;
case MotionEvent.ACTION_CANCEL://失去焦点&取消动作
case MotionEvent.ACTION_UP:
if (mRefreshState != REFRESHING && mRefreshState != LOADING) {
if (mRefreshState == PULL_TO_REFRESH) {
mRefreshState = DONE;
if (isPullUp) {
changeFooterViewRefresh();
}
if (isPullDown) {
changeHeaderViewRefresh();
}
}
if (mRefreshState == RELEASE_TO_REFRESH) {
mRefreshState = REFRESHING;
if (isPullUp) {
changeFooterViewRefresh();
onPullUpRefresh();
}
if (isPullDown) {
changeHeaderViewRefresh();
onPullDownRefresh();
}
}
}
isTouch = false;
isRotate = false;
break;
}
return super.onTouchEvent(ev);
}
/**
* 刷新完成
*/
public void onRefreshComplete() {
mRefreshState = DONE;
if (isPullDown) {
mHeaderUpdateTextView.setText(mContext
.getString(R.string.recently_modified) + getLocalTime());
changeHeaderViewRefresh();
}
if (isPullUp) {
mFooterTipsTextView.setText(mContext
.getString(R.string.recently_modified) + getLocalTime());
changeFooterViewRefresh();
}
// 刷新完成后还原上拉下拉标识位以及是否是listview底部标识
isPullUp = false;
isPullDown = false;
isLastItem = false;
isFirstItem = false;
}
private void onPullUpRefresh() {
if (mOnRefreshListener != null) {
mOnRefreshListener.onPullUpRefresh();
}
}
private void onPullDownRefresh() {
if (mOnRefreshListener != null) {
mOnRefreshListener.onPullDownRefresh();
}
}
/**
* 设置数据源Adapter
*
* @param adapter
*/
public void setAdapter(BaseAdapter adapter) {
mHeaderUpdateTextView.setText(mContext
.getString(R.string.recently_modified) + getLocalTime());
mFooterUpdateTextView.setText(mContext
.getString(R.string.recently_modified) + getLocalTime());
super.setAdapter(adapter);
}
private String getLocalTime() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return sdf.format(new Date());
}
private void changeFooterViewRefresh() {
switch (mRefreshState) {
case RELEASE_TO_REFRESH:
mFooterImageView.setVisibility(View.VISIBLE);
mFooterProgressBar.setVisibility(View.GONE);
// 箭头旋转
mFooterImageView.clearAnimation();
mFooterImageView.startAnimation(mUpAnimation);
mFooterTipsTextView.setText(R.string.release_load);
break;
case PULL_TO_REFRESH:
mFooterImageView.setVisibility(View.VISIBLE);
mFooterProgressBar.setVisibility(View.GONE);
mFooterImageView.clearAnimation();
if (isRotate) {
isRotate = false;
mFooterImageView.startAnimation(mDownAnimation);
}
mFooterTipsTextView.setText(R.string.pullup_refresh);
break;
case REFRESHING:
mFooterViewLinearLayout.setPadding(0, 0, 0, 0);
mFooterImageView.clearAnimation();
mFooterImageView.setVisibility(View.GONE);
mFooterProgressBar.setVisibility(View.VISIBLE);
mFooterTipsTextView.setText(R.string.release_load);
break;
case DONE:
mFooterViewLinearLayout.setPadding(0, 0, 0, -1 * mFooterHeight);
mFooterProgressBar.setVisibility(View.GONE);
mFooterImageView.clearAnimation();
mFooterImageView.setImageResource(R.drawable.view_listview_footer_refresh);
mFooterTipsTextView.setText(mContext
.getString(R.string.pullup_refresh));
break;
}
mFooterUpdateTextView.setVisibility(View.VISIBLE);
}
private void changeHeaderViewRefresh() {
switch (mRefreshState) {
case RELEASE_TO_REFRESH:
mHeaderImageView.setVisibility(View.VISIBLE);
mHeaderProgressBar.setVisibility(View.GONE);
mHeaderImageView.clearAnimation();
mHeaderImageView.startAnimation(mUpAnimation);
mHeaderTipsTextView.setText(mContext
.getString(R.string.release_refresh));
break;
case PULL_TO_REFRESH:
mHeaderProgressBar.setVisibility(View.GONE);
mHeaderImageView.clearAnimation();
mHeaderImageView.setVisibility(View.VISIBLE);
if (isRotate) {
isRotate = false;
mHeaderImageView.clearAnimation();
mHeaderImageView.startAnimation(mDownAnimation);
mHeaderTipsTextView.setText(mContext
.getString(R.string.pulldown_refresh));
} else {
mHeaderTipsTextView.setText(mContext
.getString(R.string.pulldown_refresh));
}
break;
case REFRESHING:
mHeaderViewLinearLayout.setPadding(0, 0, 0, 0);
mHeaderProgressBar.setVisibility(View.VISIBLE);
mHeaderImageView.clearAnimation();
mHeaderImageView.setVisibility(View.GONE);
mHeaderTipsTextView
.setText(mContext.getString(R.string.refreshing));
break;
case DONE:
mHeaderViewLinearLayout.setPadding(0, -1 * mHeaderHeight, 0, 0);
mHeaderProgressBar.setVisibility(View.GONE);
mHeaderImageView.clearAnimation();
mHeaderImageView.setImageResource(R.drawable.view_listview_footer_refresh);
mHeaderTipsTextView.setText(mContext
.getString(R.string.pulldown_refresh));
break;
}
mHeaderUpdateTextView.setVisibility(View.VISIBLE);
}
/**
* 测量高度
*
* @param child
*/
private void measureView(View child) {
ViewGroup.LayoutParams p = child.getLayoutParams();
if (p == null) {
p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width);
int lpHeight = p.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight,
MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0,
MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
}
public void setonRefreshListener(onRefreshListener refreshListener) {
mOnRefreshListener = refreshListener;
}
public interface onRefreshListener {
void onPullUpRefresh();
void onPullDownRefresh();
}
}
| [
"huangsanm"
] | huangsanm |
63048c5bd07a940852e1b38009fa5b8a73f27632 | 7b48b1908f2e23b1d594c3fb0c175364cad8ac6d | /edu.pdx.svl.coDoc.cdt.core/src/edu/pdx/svl/coDoc/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java | 5b79771144f6d6f5c6961bc4439ea725f9882ee0 | [] | no_license | hellozt/coDoc | 89bd3928a289dc5a1a53ef81d8048c82eb0cdf46 | 7015c431c9b903a19c0785631c7eb76d857e23cf | refs/heads/master | 2021-01-17T18:23:57.253024 | 2013-05-04T16:09:52 | 2013-05-04T16:09:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,943 | java | /*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* /
*******************************************************************************/
/*
* Created on Apr 29, 2005
*/
package edu.pdx.svl.coDoc.cdt.internal.core.dom.parser.cpp;
import edu.pdx.svl.coDoc.cdt.core.dom.ast.DOMException;
import edu.pdx.svl.coDoc.cdt.core.dom.ast.IBinding;
import edu.pdx.svl.coDoc.cdt.core.dom.ast.cpp.ICPPClassType;
import edu.pdx.svl.coDoc.cdt.core.dom.ast.cpp.ICPPMethod;
import edu.pdx.svl.coDoc.cdt.core.dom.ast.cpp.ICPPScope;
import edu.pdx.svl.coDoc.cdt.core.parser.util.ObjectMap;
/**
* @author aniefer
*
*/
public class CPPMethodTemplateSpecialization extends
CPPFunctionTemplateSpecialization implements ICPPMethod {
/**
* @param specialized
* @param scope
* @param argumentMap
*/
public CPPMethodTemplateSpecialization(IBinding specialized,
ICPPScope scope, ObjectMap argumentMap) {
super(specialized, scope, argumentMap);
}
public boolean isVirtual() {
// TODO Auto-generated method stub
return false;
}
public int getVisibility() throws DOMException {
IBinding m = getSpecializedBinding();
if (m instanceof ICPPMethod)
return ((ICPPMethod) m).getVisibility();
return 0;
}
public ICPPClassType getClassOwner() throws DOMException {
IBinding m = getSpecializedBinding();
if (m instanceof ICPPMethod)
return ((ICPPMethod) m).getClassOwner();
return null;
}
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;
return false;
}
}
| [
"[email protected]"
] | |
7972e573cd9ee74f966963f03b5aad8f8f8c6a6a | 80a1301f4aef40e33c1498f0932bf8680c8869d5 | /app/src/main/java/jp/techacademy/hiromu/kikuchi/javalog/Human.java | bdee063b00be40651091cf7f693c2aa87ab00c17 | [] | no_license | adolf118/Lesson3kadai | e653a36c7e15bc543c62dd5169e07a0ec4fc305f | e142a1ec464a7593a632d54f9f7bf91af9306994 | refs/heads/master | 2020-03-19T08:02:50.835951 | 2018-06-05T13:46:14 | 2018-06-05T13:46:14 | 136,170,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package jp.techacademy.hiromu.kikuchi.javalog;
import android.util.Log;
class Human extends Animal {
//メンバ変数
String hobby;
//クラス関数
static String to_jp = "hobby";
//コンストラクタ
public Human(String name, int age, String hobby) {
this.name = name;
this.age = age;
this.hobby = hobby;
}
@Override
public void say() {
Log.d("homework", "私の名前は" + this.name + "です。" + "年は" + this.age + "です。");
}
public void think() {
Log.d("homework", "私は" + this.hobby + "について考える");
}
} | [
"[email protected]"
] | |
de2798c618197f397a3b365b18ff4fda91246553 | 551224fd63857b432d5e7d828dc1768e93ce209c | /m3-java-capstone/src/main/java/com/techelevator/npgeek/controller/ParkWeatherController.java | 81fbd200ccbdf37dfd4b06ae5d1b96f1fd449901 | [] | no_license | handoniumumumum/NationalParkGeek | 4e50d44b6e7e0917374178d8f27ab96892c48973 | b3d34fcd0fc041db52b3319c29697dc99d12fc85 | refs/heads/master | 2020-08-01T15:09:13.959644 | 2016-11-12T19:53:19 | 2016-11-12T19:53:19 | 73,574,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | java | package com.techelevator.npgeek.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.techelevator.npgeek.model.ParkDAO;
import com.techelevator.npgeek.model.WeatherDAO;
@Controller
@SessionAttributes("tempFormat")
public class ParkWeatherController {
private ParkDAO parkDao;
private WeatherDAO weatherDao;
@Autowired
public ParkWeatherController(ParkDAO parkDao, WeatherDAO weatherDao){
this.parkDao = parkDao;
this.weatherDao = weatherDao;
}
@RequestMapping("/parkWeather")
public String showParkWeather(@RequestParam String parkCode, @RequestParam String tempFormat, ModelMap map)
{
map.addAttribute("park", parkDao.getParkByCode(parkCode));
map.addAttribute("forecast", weatherDao.getFiveDayForecastByCode(parkCode));
map.addAttribute("tempFormat", tempFormat);
return "parkWeather";
}
}
| [
"[email protected]"
] | |
7afba28f1f191bd0ffa33bc2ce764b01a41d6d17 | 8492a6db024fc5e114b69fcd819636149a90728e | /src/main/java/ru/bellintegrator/practice/spring/random/RandomGreetingService.java | 5d8cb606d2f5a3b476bc4c926d6887646108a4b1 | [] | no_license | grid443/spring_learn | 7418afa2add383d9d4b2bf076657113aae1eb7d1 | a133b140111710a3fdf7b466e86d8e3ed88367c9 | refs/heads/master | 2022-12-29T14:23:50.732156 | 2020-03-24T13:31:21 | 2020-03-24T13:31:21 | 122,986,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package ru.bellintegrator.practice.spring.random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import ru.bellintegrator.practice.spring.GreetingService;
import ru.bellintegrator.practice.spring.Message;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
public abstract class RandomGreetingService implements GreetingService {
private final Log log = LogFactory.getLog(getClass());
@Override
public String hello() {
return randomMessage().value();
}
protected abstract Message randomMessage();
@PostConstruct
private void init() {
log.info("RandomGreetingService INIT");
}
@PreDestroy
private void destroy() {
log.info("RandomGreetingService DESTROY");
}
}
| [
"[email protected]"
] | |
2e80da2717ae3dee3992e68435b3e74dea1d1f48 | 2e6575e10dead5045c35d37ab3dc2663d4eb3d13 | /app/src/main/java/com/feedhub/app/dialog/ProfileBottomSheetDialog.java | cd6cf14d755237b95ba52c0d23bbe5506835eae7 | [] | no_license | feedhub-platform/feedhub-client-android | 84c8723de1bf8e9623c733b618dbb1ec487662f0 | 722270e7962fdb1d59e2ab13afee2a1cdcef0536 | refs/heads/master | 2021-05-24T14:31:05.222783 | 2020-06-02T23:05:51 | 2020-06-02T23:05:51 | 253,606,314 | 1 | 1 | null | 2020-06-02T23:05:52 | 2020-04-06T20:18:34 | Java | UTF-8 | Java | false | false | 3,562 | java | package com.feedhub.app.dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.feedhub.app.R;
import com.feedhub.app.activity.AboutActivity;
import com.feedhub.app.activity.SettingsActivity;
import com.feedhub.app.adapter.MainMenuAdapter;
import com.feedhub.app.current.BaseAdapter;
import com.feedhub.app.item.MainMenuItem;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ProfileBottomSheetDialog extends BottomSheetDialogFragment implements MainMenuAdapter.OnItemClickListener {
private static final String TAG = "ProfileDialog";
private static final String ID_SETTINGS = "_settings";
private static final String ID_ABOUT = "_about";
@BindView(R.id.bottomSheetItems)
RecyclerView recyclerView;
private BaseAdapter.OnItemClickListener listener;
private MainMenuAdapter adapter;
public static void show(FragmentManager fragmentManager) {
ProfileBottomSheetDialog dialog = new ProfileBottomSheetDialog();
dialog.show(fragmentManager, TAG);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.activity_main_bottom_sheet, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
ButterKnife.bind(this, view);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false));
ArrayList<MainMenuItem> items = new ArrayList<>();
items.add(new MainMenuItem(
ID_SETTINGS,
getString(R.string.navigation_settings),
ContextCompat.getDrawable(requireContext(), R.drawable.ic_settings_outline)
));
items.add(new MainMenuItem(
ID_ABOUT,
getString(R.string.preference_about),
ContextCompat.getDrawable(requireContext(), R.drawable.ic_outline_info)
));
adapter = new MainMenuAdapter(requireContext(), items);
adapter.setOnItemClickListener(this);
recyclerView.setAdapter(adapter);
}
@Override
public void onItemClick(int position) {
if (listener != null) {
listener.onItemClick(position);
return;
}
MainMenuItem item = adapter.getItem(position);
switch (item.id) {
case ID_SETTINGS:
openSettingsScreen();
break;
case ID_ABOUT:
openAboutScreen();
break;
}
dismiss();
}
private void openAboutScreen() {
startActivity(new Intent(requireContext(), AboutActivity.class));
}
private void openSettingsScreen() {
startActivity(new Intent(requireContext(), SettingsActivity.class));
}
public void setOnItemClickListener(BaseAdapter.OnItemClickListener listener) {
this.listener = listener;
}
}
| [
"[email protected]"
] | |
70f0acd276cc647740ad8e3b18ec4fc6fc9c7afa | 776d5e1ed7b987c878562f6d2d38b93764fc3e4b | /src/main/java/com/suri/leetcode/medium/PrintLeafNode.java | c6596df48c9f627d15b46162d3aa74c928f9df1d | [] | no_license | atendrasuri/JavaDSAlgo | cabf328bc819d7b604b43d8e7f3180f4f6e1c83b | 816875e457fff6ec870729d65474a7923ddcaece | refs/heads/master | 2022-07-09T18:20:14.460713 | 2022-07-04T03:44:38 | 2022-07-04T03:44:38 | 150,185,295 | 0 | 0 | null | 2020-10-13T10:28:52 | 2018-09-25T00:28:23 | Java | UTF-8 | Java | false | false | 805 | java | package com.suri.leetcode.medium;
public class PrintLeafNode {
TreeNode root;
public static void main(String[] args) {
PrintLeafNode obj = new PrintLeafNode();
obj.root = new TreeNode(0);
obj.root.left = new TreeNode(1);
obj.root.right = new TreeNode(2);
obj.root.left.left = new TreeNode(3);
obj.root.left.right = new TreeNode(4);
obj.root.right.left = new TreeNode(5);
obj.root.right.right = new TreeNode(6);
obj.printLeaf(obj.root);
}
public void printLeaf(TreeNode root){
if(root==null){
return;
}
printLeaf(root.left);
if(root.left==null && root.right==null){
System.out.print(root.val +" ");
}
printLeaf(root.right);
}
}
| [
"[email protected]"
] | |
838f1652d29e015002f13cb3818607ec8e973bfd | 27ce5d3be05bd893b03af2b72a7ca4a6f34346f7 | /src/main/java/Practice22020/Practice22020FRE3/Note.java | 800cfbf85e77cae717003947265d2ca76e9ab0f3 | [] | no_license | aarli421/APCSA | dc58ac65350a46b70a539f426266e6abf8ad1b56 | 444ab405bccbb6ed4e4e7e1402bf21c26f1165f8 | refs/heads/master | 2022-11-04T20:45:22.620299 | 2020-04-09T04:45:23 | 2020-04-09T04:45:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package Practice22020.Practice22020FRE3;
public class Note {
public String getNote() {
return "";
}
}
| [
"[email protected]"
] | |
0a8aa25dc375bab06e00282b887b6b077d6a4fb1 | 76fc8e56264139adc54370da56bb752a321c02ac | /src/main/java/com/common/system/controller/MenuController.java | 3dd95b317ce6f72483c5da2146078cdbe491caef | [
"Apache-2.0"
] | permissive | hugwh/common-admin | efceed0bb6267723d5082243dde821aa29e03ed2 | db70d74eaa5f15468354938f8ccc4af80a65c71a | refs/heads/master | 2020-04-06T10:39:50.009826 | 2018-11-13T13:49:37 | 2018-11-13T13:49:37 | 157,387,495 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,708 | java | package com.common.system.controller;
import com.common.system.entity.RcMenu;
import com.common.system.entity.TreeGridNode;
import com.common.system.entity.TreeGridWrapper;
import com.common.system.entity.ZTreeNode;
import com.common.system.service.MenuService;
import com.common.system.service.SequenceService;
import com.common.system.service.TreeGridService;
import com.common.system.service.ZTreeService;
import com.common.system.util.MsgCode;
import com.common.system.util.PageBean;
import com.common.system.util.Result;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.Date;
import java.util.List;
/**
* Created by Mr.Yangxiufeng on 2017/8/2.
* Time:15:00
* ProjectName:Common-admin
*/
@Controller
@RequestMapping("menu")
public class MenuController {
@Autowired
private MenuService menuService;
@Autowired
private SequenceService sequenceService;
@Autowired
private ZTreeService treeService;
@RequestMapping(value = "list",method = RequestMethod.GET)
public ModelAndView list(ModelAndView modelAndView){
// List<ZTreeNode> zTreeNodeList = treeService.getMenuZTreeNodes();
// String tree = treeService.buildZTree(zTreeNodeList);
// modelAndView.addObject("ListzTree",tree);
modelAndView.setViewName("/system/admin/menu/list");
return modelAndView;
}
@RequestMapping(value = "add",method = RequestMethod.GET)
public ModelAndView add(ModelAndView modelAndView){
modelAndView.setViewName("/system/admin/menu/add");
List<ZTreeNode> zTreeNodeList = treeService.getMenuZTreeNodes();
String treeStr = treeService.buildZTree(zTreeNodeList);
modelAndView.addObject("rcMenu",treeStr);
return modelAndView;
}
@RequestMapping(value = "save",method = RequestMethod.POST)
public @ResponseBody
Result save(RcMenu menu){
Result<Integer> result = new Result<>();
menu.setId(sequenceService.getSequenceId());
menu.setCreateTime(new Date());
menu.setStatus(1);
if (menu.getSort() == null){
menu.setSort(1);
}
if (StringUtils.isEmpty(menu.getCode())){
result.setMsg("菜单编号不能为空");
return result;
}
try {
menuService.insert(menu);
result.setStatus(true);
result.setMsg("OK");
result.setCode(MsgCode.SUCCESS);
} catch (Exception e) {
e.printStackTrace();
result.setMsg("菜单编码必须唯一");
}
return result;
}
@ResponseBody
@RequestMapping(value = "page")
public PageBean<RcMenu> queryForPage(@RequestParam(value = "start", defaultValue = "1") int start, @RequestParam(value = "length", defaultValue = "10") int pageSize, @RequestParam(value = "date", required = false) String date, @RequestParam(value = "search", required = false) String search) {
PageInfo<RcMenu> pageInfo = menuService.listForPage((start / pageSize) + 1, pageSize);
return new PageBean<RcMenu>(pageInfo);
}
@Autowired
private TreeGridService treeGridService;
@RequestMapping(value = "getTreeGridMenu",method = RequestMethod.GET)
public @ResponseBody
TreeGridWrapper getTreeGridMenu(){
List<TreeGridNode> list = treeGridService.getMenuTreeGridNodes();
TreeGridWrapper wrapper = new TreeGridWrapper();
wrapper.setRows(list);
wrapper.setTotal(list.size());
return wrapper;
}
@RequestMapping(value = "edit/{id}",method = RequestMethod.GET)
public ModelAndView edit(@PathVariable String id, ModelAndView modelAndView){
RcMenu menu = menuService.selectByPrimaryKey(id);
modelAndView.addObject("menu",menu);
List<ZTreeNode> zTreeNodeList = treeService.getMenuZTreeNodes();
for (ZTreeNode node:zTreeNodeList
) {
if (node.getCode().equals(menu.getpCode())){
modelAndView.addObject("pName",node.getName());
node.setChecked(true);
}
}
String tree = treeService.buildZTree(zTreeNodeList);
modelAndView.addObject("zTree",tree);
modelAndView.setViewName("/system/admin/menu/edit");
return modelAndView;
}
@RequestMapping(value = "update")
public @ResponseBody
Result update(RcMenu menu,String oldCode){
Result<Integer> result = new Result<>();
menu.setUpdateTime(new Date());
if (StringUtils.isEmpty(menu.getCode())){
result.setMsg("菜单编号不能为空");
return result;
}
RcMenu temp = menuService.selectCode(menu.getCode());
if (temp != null && !temp.getId().equals(menu.getId())){
result.setMsg("菜单编号必须唯一");
return result;
}
int flag = menuService.update(menu);
if (flag > 0){
menuService.updatePcode(oldCode,menu.getCode());
}
result.setStatus(true);
result.setMsg("OK");
result.setCode(MsgCode.SUCCESS);
return result;
}
@RequestMapping(value = "delete/{id}")
public @ResponseBody
Result delete(@PathVariable String id){
Result<Integer> result = new Result<>();
menuService.deleteByPrimaryKey(id);
result.setStatus(true);
result.setMsg("OK");
result.setCode(MsgCode.SUCCESS);
return result;
}
}
| [
"[email protected]"
] | |
97d3c41e35a6ec8091a3d1e188b5b3b31c575132 | 133d5ade3f7351f8b1adc588f5277937149e642e | /app/src/main/java/tn/creativeteam/votingapp/ProfileAct.java | 1cd0ead578370e4468a307883c23d09deaab9499 | [] | no_license | mohamedbelhassen/VotingApp | 7f7050b5d6cc705898210824df1d1f1807050aea | 76c4a0d351e177e5f2535027916c8cefee7995f7 | refs/heads/master | 2020-03-22T10:30:13.629695 | 2018-07-07T21:06:48 | 2018-07-07T21:06:48 | 139,907,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | package tn.creativeteam.votingapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class ProfileAct extends AppCompatActivity {
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
tv=(TextView)findViewById(R.id.tvWelcome);
tv.setText("Welcome "+ MyDb.username);
}
public void goToAct(View v) {
if(v.getId()==R.id.button2){
Intent i= new Intent(this,ChangePasswordAct.class);
startActivity(i);
}
if(v.getId()==R.id.button4){
Intent i= new Intent(this,VotingRate.class);
startActivity(i);
}
if(v.getId()==R.id.button5){
Intent i= new Intent(this,ResultAct.class);
startActivity(i);
}
}
}
| [
"[email protected]"
] | |
6f10307aeb28d4fbe6ae763c11c95e24add3d12d | 0b4a14a2faa8fd03e8f8710c7f31747c15e9b4f4 | /src/main/java/com/volmit/combattant/services/WindSVC.java | 8998a715b48fa4dac1115c6ff564a14922f51aab | [] | no_license | CyberFlameGO/DirePlugin | 79693024064861d4d6fc8a33c8a1a360986a72fa | 99cc7a70863ed007a914b9f6100925a0c951658c | refs/heads/master | 2022-04-09T14:06:45.199900 | 2018-07-26T23:40:37 | 2018-07-26T23:40:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | package com.volmit.combattant.services;
import org.bukkit.util.Vector;
import com.volmit.volume.bukkit.pawn.Tick;
import com.volmit.volume.bukkit.service.IService;
import com.volmit.volume.math.M;
public class WindSVC implements IService
{
private Vector wind = new Vector();
private double speed = 0.1;
@Tick
public void tick()
{
wind.add(Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(0.05));
wind.setY(0);
if(wind.length() > Math.abs(speed))
{
wind.multiply(0.9);
}
else
{
wind.multiply(1.1);
}
if(speed > 3)
{
speed = 3;
}
if(speed < 0)
{
speed = 0;
}
if(M.r(0.05))
{
speed += (((Math.random() * 2) - 1) * 0.3);
}
}
public Vector getWindDirection()
{
return wind.clone();
}
public double getWindSpeed()
{
return getWindDirection().length();
}
}
| [
"[email protected]"
] | |
882d3a9e8bfd658a1ccf1cbacb4c143f2387047b | 7d411c84b9a50e8a2d2ad8dd769af758c0b77f7c | /src/lab/WaveAlgorithm.java | dabcf40d954cc96a03370fbd24e494737fe9203e | [] | no_license | copchenka/Labyrinth | 88a6acffa73311a1990b3ec6c04ac49d55614f41 | c303fe1fa185a09182a9c8848c4ed83572ae7e01 | refs/heads/master | 2021-09-05T05:45:40.215379 | 2018-01-24T14:50:36 | 2018-01-24T14:50:36 | 115,077,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,157 | java | package lab;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class WaveAlgorithm {
static int x2 = 0;
static int y2 = 0;
static int t = 0;
int[][] map;
int[][] labyrinth;
List res = new ArrayList();
WaveAlgorithm(int[][] labyrinth) {
this.labyrinth = labyrinth;
map = new int[labyrinth[0].length][labyrinth.length];
}
int[][] Map() {
return map;
}
List find(Point start, Point end) {
Point p;
try {
for (int i = 0; i < map[0].length; i++) {
for (int j = 0; j < map.length; j++) {
map[i][j] = Integer.MAX_VALUE;
}
}
} catch (ArrayIndexOutOfBoundsException ex) {
System.out.println("количество строк должно быть другим");
System.exit(1);
}
map[start.getY()][start.getX()] = 0;
res.add(start);
int n = 0;
while (!res.isEmpty()) {
p = (Point) res.remove(0);
n++;
nextPoint(p, n);
}
System.out.println("Кратчайший путь обознаен звездочками(*)");
List path = new ArrayList(); // теперь мы должны из конечной точки придти в начальную
path.add(end);
int x = end.getX();
int y = end.getY();
n = Integer.MAX_VALUE;
while ((x != start.getX()) || (y != start.getY())) {// находим меньшего соседа
if ((y - 1 >= 0) && map[y - 1][x] < n) {
prev(y - 1, x);
}
if ((y + 1 < map.length) && map[y + 1][x] < n) {
prev(y + 1, x);
}
if ((x - 1 >= 0) && map[y][x - 1] < n) {
prev(y, x - 1);
}
if ((x + 1 < map.length) && map[y][x + 1] < n) {
prev(y, x + 1);
}
x = x2;
y = y2;
n = t;
path.add(new Point(x, y));
}
Collections.reverse(path);
return path;
}
private void prev(int i, int j) {//метод для перехода в соседнюю клетку с меньшим значением
x2 = j;
y2 = i;
t = map[i][j];
}
private void nextPoint(Point point, int n) {
//поиск наименьшего пути до финиша
//проверяем выходит ли точка за пределы матрицы
//и не является ли она барьером.
//в спомогат. матрице присваиваем значение и добавляем точку в очередь
Point p;
if ((point.getY() + 1 < labyrinth.length) && labyrinth[point.getY() + 1][point.getX()] != 0) {
if (map[point.getY() + 1][point.getX()] > n) {
p = new Point(point.getX(), point.getY() + 1);
map[point.getY() + 1][point.getX()] = n;
res.add(p);
}
}
if ((point.getY() - 1 >= 0) && (labyrinth[point.getY() - 1][point.getX()] != 0)) {
if (map[point.getY() - 1][point.getX()] > n) {
p = new Point(point.getX(), point.getY() - 1);
map[point.getY() - 1][point.getX()] = n;
res.add(p);
}
}
if ((point.getX() + 1 < labyrinth[point.getY()].length) && (labyrinth[point.getY()][point.getX() + 1] != 0)) {
if (map[point.getY()][point.getX() + 1] > n) {
p = new Point(point.getX() + 1, point.getY());
map[point.getY()][point.getX() + 1] = n;
res.add(p);
}
}
if ((point.getX() - 1 >= 0) && (labyrinth[point.getY()][point.getX() - 1] != 0)) {
if (map[point.getY()][point.getX() - 1] > n) {
p = new Point(point.getX() - 1, point.getY());
map[point.getY()][point.getX() - 1] = n;
res.add(p);
}
}
}
}
| [
"[email protected]"
] | |
01068ec12c46667910906d5e305bcf6887181bc5 | c97d170fb41892289e640e9d28086492767e6d3b | /src/Replace/ExemploReplace.java | b9315b855418bd9db74e80f8b429a5d2453e09e7 | [] | no_license | Rafaelre7/EstudosJava | 76f56122eed8eb01fc1697e03185f6faa4f2177d | 34c41535170d145daad31b58b2ed9a68b861e8e7 | refs/heads/master | 2020-06-13T13:12:57.121592 | 2019-07-01T12:21:11 | 2019-07-01T12:21:11 | 194,666,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package Replace;
public class ExemploReplace {
public static void main(String[] args) {
String a = "portaljva.htm";
a = a.replaceAll("htm", "jsp");
System.out.print(a);
}
}
| [
"[email protected]"
] | |
75d681be0eba9ecf1f437ab8d76426237bb9d08c | 9b58fe34b77af57d9de722c73e7bccc0eec94967 | /src/BufferedImageLoader.java | 7be2ddeb6be4436ceadbd3798fe5613629225b75 | [] | no_license | clarket33/rpg-povy | 0ee838bd71bdc0e0918ff45d7a50de840f4b519d | 85790ffd525d7d4b0fa1c59e3e86c70e853d98fd | refs/heads/master | 2021-07-19T00:40:13.243598 | 2020-04-30T17:46:56 | 2020-04-30T17:46:56 | 148,378,269 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java |
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
*
* @author clarkt5
* aids in the loading in of images
*/
public class BufferedImageLoader {
BufferedImage image;
public BufferedImage loadImage(String path) {
try {
image = ImageIO.read(getClass().getResource(path));
} catch (IOException e) {
e.printStackTrace();
}
return image;
}
}
| [
"[email protected]"
] | |
cafadcdd867436e9834fa84518422989cfce42f4 | e04167201bab2642595328a75478bb6850a29144 | /src/uristqwerty/gui/texture/TextureClip.java | dd206aba9ff48f4f955182229e2c90326f4dff96 | [] | no_license | Ujimar/CraftGuide | 9c79b4e5d7c159dd840f914716358f94f238c1ec | ebe5c367b6a35f70f4c7ab47ad5a514eb1c2cc8d | refs/heads/master | 2021-01-18T07:30:19.837727 | 2013-01-31T02:34:10 | 2013-01-31T02:34:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package uristqwerty.gui.texture;
import uristqwerty.gui.Rect;
import uristqwerty.gui.editor.TextureMeta;
import uristqwerty.gui.editor.TextureMeta.TextureParameter;
import uristqwerty.gui.rendering.RendererBase;
/**
* Represents a subsection of a larger texture, shifted so that
* the sections's top left corner is at (0, 0). When drawn, only
* draws the portion, if any, of the drawn area that overlaps with
* the subsection.
*/
@TextureMeta(name = "clip")
public class TextureClip implements Texture
{
@TextureParameter
public Texture source;
@TextureParameter
public Rect rect;
public TextureClip(Texture source, int u, int v, int width, int height)
{
this.source = source;
rect = new Rect(u, v, width, height);
}
public TextureClip(Texture source, Rect rect)
{
this.source = source;
this.rect = rect;
}
public TextureClip()
{
}
@Override
public void renderRect(RendererBase renderer, int x, int y, int width, int height, int u, int v)
{
if(u < 0)
{
width += u;
u = 0;
}
if(u + width > rect.width)
{
width = rect.width - u;
}
if(v < 0)
{
height += v;
v = 0;
}
if(v + height > rect.height)
{
height = rect.height - v;
}
if(width > 0 && height > 0)
{
source.renderRect(renderer, x, y, width, height, u + rect.x, v + rect.y);
}
}
}
| [
"[email protected]"
] | |
a9f6bd5f75198106503f8e8d2159e4b422fd58c1 | 07949856a625a307309effb2326f6f5c6fdf2416 | /Regular_Expressions/XML_Parser/Solution.java | 2df72f8633f48d1a14d1c46965e16158e6ffbe2f | [] | no_license | jl-1992/Amusing-lil-code-bits | 4016cc7c0b404d3baf2c702f0ed2744813841796 | 580ef429d9b96af396f3b78c76dbd6b37c6b0d96 | refs/heads/master | 2022-02-10T09:20:19.282398 | 2021-12-31T19:12:58 | 2021-12-31T19:12:58 | 98,205,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | import java.util.*;
import java.util.regex.*;
public class Solution{
public static ArrayList<Integer> getIdsByMessage(String xml, String message){
Pattern p = Pattern.compile("\\d");
Pattern q = Pattern.compile("[a-zA-Z]{11}\\s[a-z]{3}\\s[a-z]{5}");
Matcher m = p.matcher(xml);
Matcher n = q.matcher(xml);
ArrayList<Integer> ans = new ArrayList<Integer>();
HashMap<Integer, String> h = new HashMap<Integer,String>();
while(m.find() && n.find()){
h.put(Integer.parseInt(m.group()),n.group());
}
for(Integer i : h.keySet()){
if(h.get(i).equals(message))
ans.add(i);
}
return ans;
}
public static void main(String[] args){
String str = "<log> <entry id=\"1\"> <message>Application has" +
" started</message></entry>" +
"<entry id=\"2\"> <message>Application has" +
" ended</message></entry></log>";
ArrayList<Integer> res = getIdsByMessage(str, "Application has ended");
System.out.println(res);
}
} | [
"[email protected]"
] | |
c9a60cdc7561396c8fa8143c3dfc00b7a72ba911 | 46ad3556913a53bcee812a85da01b72595b55e33 | /src/main/java/com/ogdencity/wmnsfconfidentialfunds/WmnsfConfidentialFundsApplication.java | 99ae7f3fafb593eca4d29d0338b107ba95ec47eb | [] | no_license | ferrinsp/WMNSF | 54a22ddad69e6b16394157925e06f1afa00200e8 | 39b5df8769c72bd0681da65c177a9f00aa37d55f | refs/heads/master | 2021-01-20T20:53:14.058291 | 2016-02-11T21:45:16 | 2016-02-11T21:45:16 | 61,177,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | package com.ogdencity.wmnsfconfidentialfunds;
import com.ogdencity.wmnsfconfidentialfunds.model.User;
import com.ogdencity.wmnsfconfidentialfunds.repo.UserRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ViewResolver;
@SpringBootApplication
public class WmnsfConfidentialFundsApplication {
public static void main(String[] args) {
SpringApplication.run(WmnsfConfidentialFundsApplication.class, args);
}
} | [
"[email protected]"
] | |
5e41c032d7d00889ab6311f2448241083c7b9bb5 | 7a15996bc427ccdf63f750dae0b4db4004ee36ec | /src/main/java/com/saaolheart/mumbai/store/stock/StockHistoryRepo.java | c5f582773e92e4f531d889c1fae15e24d9b1f1a4 | [] | no_license | mohitnbansal/saaolheartmumbai | 7e89d90e105b26b89c166a6043c5466978b680ea | c4f90338609235ebffe21f6a1c4040e12e81ae7f | refs/heads/master | 2021-06-09T19:15:51.574957 | 2019-06-04T09:03:58 | 2019-06-04T09:03:58 | 162,652,117 | 0 | 0 | null | 2021-06-04T01:46:47 | 2018-12-21T01:54:29 | Java | UTF-8 | Java | false | false | 263 | java | package com.saaolheart.mumbai.store.stock;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface StockHistoryRepo extends JpaRepository<StockHistoryDetailsDomain, Long> {
}
| [
"[email protected]"
] | |
9e39097db68fd489fc8eee1b4905955721a16be2 | 9d8d9e394bec2ec8486b692fe85214e9adfc5f06 | /etl/src/main/java/com/cezarykluczynski/stapi/etl/mediawiki/cache/PageCacheStorage.java | 4ae57aa5723e427cdf38469f343b6f8119d2756c | [
"MIT"
] | permissive | cezarykluczynski/stapi | a343e688c7e8ce86601c9c0a71e2445cfbd9b0b9 | 1729aae76ae161b0dff50d9124e337b67c934da0 | refs/heads/master | 2023-06-09T16:18:03.000465 | 2023-06-08T19:11:30 | 2023-06-08T19:11:30 | 70,270,193 | 128 | 17 | MIT | 2023-02-04T21:35:35 | 2016-10-07T17:55:21 | Groovy | UTF-8 | Java | false | false | 1,296 | java | package com.cezarykluczynski.stapi.etl.mediawiki.cache;
import com.cezarykluczynski.stapi.etl.mediawiki.api.enums.MediaWikiSource;
import com.cezarykluczynski.stapi.etl.mediawiki.dto.Page;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class PageCacheStorage {
private final Map<Key, Page> storage = Maps.newHashMap();
public synchronized void put(Page page) {
Preconditions.checkNotNull(page, "Page stored in PageCacheStorage cannot be null");
Preconditions.checkArgument(page.getRedirectPath().isEmpty(), String.format("Page %s that is an effect of redirect cannot be stored "
+ "in PageCacheStorage", page.getTitle()));
storage.put(createKey(page.getTitle(), page.getMediaWikiSource()), page);
}
public Page get(String title, MediaWikiSource mediaWikiSource) {
return storage.get(createKey(title, mediaWikiSource));
}
private static Key createKey(String title, MediaWikiSource mediaWikiSource) {
return Key.of(title, mediaWikiSource);
}
@AllArgsConstructor(staticName = "of")
@Data
private static class Key {
private String title;
private MediaWikiSource mediaWikiSource;
}
}
| [
"[email protected]"
] | |
50ef1685bd064eba4ab1613f30b074b98251f273 | 0529524c95045b3232f6553d18a7fef5a059545e | /app/src/androidTest/java/TestCase_59876DC2D3B07D3028163B47E91743FB5CD3B52CBF433AAA718B44F1F7E958B9__911802922.java | cdc5bb0d74966e5065d3c6f20966330a3ba170f2 | [] | no_license | sunxiaobiu/BasicUnitAndroidTest | 432aa3e10f6a1ef5d674f269db50e2f1faad2096 | fed24f163d21408ef88588b8eaf7ce60d1809931 | refs/heads/main | 2023-02-11T21:02:03.784493 | 2021-01-03T10:07:07 | 2021-01-03T10:07:07 | 322,577,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class TestCase_59876DC2D3B07D3028163B47E91743FB5CD3B52CBF433AAA718B44F1F7E958B9__911802922 {
@Test
public void testCase() throws Exception {
Context var1 = InstrumentationRegistry.getTargetContext();
String[] var2 = var1.databaseList();
}
}
| [
"[email protected]"
] | |
ae5a0f537c99cbf10ac966ca51100ed40d86f9db | f4b6422703af7534867f90f2902aa3baa7b72416 | /2018/hackover/sources/kotlin/text/Charsets.java | 8cf1429e2ae436e90bff96b9fdf37c9da1462536 | [] | no_license | b04902036/ctf | d1eac85b915057e0961ad862d7bf2da106515321 | fac16cd79440a9c0fc870578d5c80b1491bb8eae | refs/heads/master | 2020-03-18T16:23:02.321424 | 2019-11-22T03:34:25 | 2019-11-22T03:34:25 | 134,962,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,607 | java | package kotlin.text;
import java.nio.charset.Charset;
import kotlin.Metadata;
import kotlin.jvm.JvmField;
import kotlin.jvm.JvmName;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
@Metadata(bv = {1, 0, 2}, d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0010\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0010\u0010\u0003\u001a\u00020\u00048\u0006X\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u00020\u00048\u0006X\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u00020\u00048\u0006X\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0007\u001a\u00020\u00048\u0006X\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\b\u001a\u00020\u00048\u0006X\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\t\u001a\u00020\u00048G¢\u0006\u0006\u001a\u0004\b\n\u0010\u000bR\u0011\u0010\f\u001a\u00020\u00048G¢\u0006\u0006\u001a\u0004\b\r\u0010\u000bR\u0011\u0010\u000e\u001a\u00020\u00048G¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u000bR\u0010\u0010\u0010\u001a\u00020\u00048\u0006X\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0011\u001a\u0004\u0018\u00010\u0004X\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0012\u001a\u0004\u0018\u00010\u0004X\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0013\u001a\u0004\u0018\u00010\u0004X\u000e¢\u0006\u0002\n\u0000¨\u0006\u0014"}, d2 = {"Lkotlin/text/Charsets;", "", "()V", "ISO_8859_1", "Ljava/nio/charset/Charset;", "US_ASCII", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF32", "()Ljava/nio/charset/Charset;", "UTF_32BE", "UTF32_BE", "UTF_32LE", "UTF32_LE", "UTF_8", "utf_32", "utf_32be", "utf_32le", "kotlin-stdlib"}, k = 1, mv = {1, 1, 10})
/* compiled from: Charsets.kt */
public final class Charsets {
public static final Charsets INSTANCE = new Charsets();
@NotNull
@JvmField
public static final Charset ISO_8859_1;
@NotNull
@JvmField
public static final Charset US_ASCII;
@NotNull
@JvmField
public static final Charset UTF_16;
@NotNull
@JvmField
public static final Charset UTF_16BE;
@NotNull
@JvmField
public static final Charset UTF_16LE;
@NotNull
@JvmField
public static final Charset UTF_8;
private static Charset utf_32;
private static Charset utf_32be;
private static Charset utf_32le;
static {
Charset forName = Charset.forName("UTF-8");
Intrinsics.checkExpressionValueIsNotNull(forName, "Charset.forName(\"UTF-8\")");
UTF_8 = forName;
forName = Charset.forName("UTF-16");
Intrinsics.checkExpressionValueIsNotNull(forName, "Charset.forName(\"UTF-16\")");
UTF_16 = forName;
forName = Charset.forName("UTF-16BE");
Intrinsics.checkExpressionValueIsNotNull(forName, "Charset.forName(\"UTF-16BE\")");
UTF_16BE = forName;
forName = Charset.forName("UTF-16LE");
Intrinsics.checkExpressionValueIsNotNull(forName, "Charset.forName(\"UTF-16LE\")");
UTF_16LE = forName;
forName = Charset.forName("US-ASCII");
Intrinsics.checkExpressionValueIsNotNull(forName, "Charset.forName(\"US-ASCII\")");
US_ASCII = forName;
forName = Charset.forName("ISO-8859-1");
Intrinsics.checkExpressionValueIsNotNull(forName, "Charset.forName(\"ISO-8859-1\")");
ISO_8859_1 = forName;
}
private Charsets() {
}
@NotNull
@JvmName(name = "UTF32")
public final Charset UTF32() {
Charset charset = utf_32;
if (charset != null) {
return charset;
}
this = this;
charset = Charset.forName("UTF-32");
Intrinsics.checkExpressionValueIsNotNull(charset, "Charset.forName(\"UTF-32\")");
utf_32 = charset;
return charset;
}
@NotNull
@JvmName(name = "UTF32_LE")
public final Charset UTF32_LE() {
Charset charset = utf_32le;
if (charset != null) {
return charset;
}
this = this;
charset = Charset.forName("UTF-32LE");
Intrinsics.checkExpressionValueIsNotNull(charset, "Charset.forName(\"UTF-32LE\")");
utf_32le = charset;
return charset;
}
@NotNull
@JvmName(name = "UTF32_BE")
public final Charset UTF32_BE() {
Charset charset = utf_32be;
if (charset != null) {
return charset;
}
this = this;
charset = Charset.forName("UTF-32BE");
Intrinsics.checkExpressionValueIsNotNull(charset, "Charset.forName(\"UTF-32BE\")");
utf_32be = charset;
return charset;
}
}
| [
"[email protected]"
] | |
9d99d3c79b3669c108ee3d174efa70ce96c52d33 | 1bd4ea7646a5856418a6d096368f43538a61bf28 | /file-upload-and-download/src/main/java/com/comac/fileuploadanddownload/dao/IFilePathDao.java | c66600371090e27dffcb9881bad9ca35bf820d58 | [] | no_license | tjdxmwy/upload | 770877734a34532a0c769204aad52f998ceb767d | 4a31d1b4583ed20d8cf2202bb8bf322043a24f09 | refs/heads/master | 2023-01-13T19:23:58.857421 | 2020-11-13T07:42:56 | 2020-11-13T07:42:56 | 312,504,650 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package com.comac.fileuploadanddownload.dao;
import com.comac.fileuploadanddownload.entity.FileInfo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @Description
* @Author Mr.Horse
* @Version v1.0.0
* @Since 1.0
* @Date 2020/11/12
*/
@Repository
public interface IFilePathDao {
/**
* 查询所有路径数据
* @return
*/
List<FileInfo> findAll();
/**
* 保存上传路径
*/
void savePath(FileInfo filePath);
}
| [
"[email protected]"
] | |
8012cc592977b38ae0138e6cf54b1f4fb28868a7 | 55915d73c5bf8e824bf32280734e11889d82aef3 | /Program/SmartOrder/src/test/SalesOrderTest.java | 77aa1221813f59bd60b5d957ea3134736038e03d | [] | no_license | CasperFAndersen/Semester_2_Projekt | 890a57134e129a664e36a0044bc567a5a79d047d | 45f2d3bbd912d7a99dc1c640a7a814e0c656039a | refs/heads/master | 2020-03-14T11:56:33.275237 | 2018-04-30T13:35:33 | 2018-04-30T13:35:33 | null | 0 | 0 | null | null | null | null | ISO-8859-15 | Java | false | false | 3,450 | java | package test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import java.time.LocalDate;
import org.junit.Before;
import org.junit.Test;
import model.Customer;
import model.DeliveredType;
import model.OfferType;
import model.OrderCondition;
import model.OrderType;
import model.Product;
import model.ProductPrice;
import model.SalesOrder;
import model.Supplier;
/**
* SmartOrder
* SalesOrderTest.java
* Purpose:
* @author Gruppe 1
* @version 1.0
*/
public class SalesOrderTest {
private ProductPrice price1, price2 , price3, price4;
private Product p1, p2, p3, p4;
private OrderCondition order, delivered;
private Customer c1, c2;
private SalesOrder o1, o2, o3;
private Supplier supplier;
@Before
public void setUp() throws Exception {
price1 = new ProductPrice(3000, 5000, LocalDate.now());
price2 = new ProductPrice(1000, 3000, LocalDate.now());
price3 = new ProductPrice(100, 300, LocalDate.now());
price4 = new ProductPrice(5000, 8000, LocalDate.now());
p1 = new Product(1, "Sofa", "Hvid Sofa", "500x500", price1, supplier, null);
p2 = new Product(2, "Sofa - bord", "Hvidt Sofa - bord", "100x80", price2, supplier, null);
p3 = new Product(3, "Gardin", "Mørklægsning Gardiner", "180x90", price3, supplier, null);
p4 = new Product(4, "SpiseBord", "Hvid Sofa", "600x200", price4, supplier, null);
order = new OrderType(LocalDate.now());
delivered = new DeliveredType(LocalDate.now());
c1 = new Customer(1, "Istvan Knoll", "Istvanvej 25", "9000", "Aalborg", "12345678","[email protected]", "Privat");
o1 = new SalesOrder();
o2 = new SalesOrder();
o3 = new SalesOrder();
o1.addSalesOrderLineToSalesOrder(p1, 1);
o1.addSalesOrderLineToSalesOrder(p2, 2);
o2.addSalesOrderLineToSalesOrder(p4, 1);
o2.addSalesOrderLineToSalesOrder(p3, 3);
o2.addSalesOrderLineToSalesOrder(p1, 1);
o3.addSalesOrderLineToSalesOrder(p3, 3);
o3.addSalesOrderLineToSalesOrder(p1, 2);
}
/**
* Testing ability to discount by integer and/or by percent.
*/
@Test
public void getTotalPriceTest() {
try {
assertEquals(11000, o1.getTotalPrice(), 0);
assertEquals(13900, o2.getTotalPrice(), 0);
assertEquals(10900, o3.getTotalPrice(), 0);
o2.getSalesOrderLines().get(0).setDiscount("1000");
//o2.setTotalPrice();
assertEquals(12900, o2.getTotalPrice(), 0);
o3.getSalesOrderLines().get(1).setDiscount("10%");
//o3.setTotalPrice();
assertEquals(9900, o3.getTotalPrice(), 0);
} catch(Exception e) {
e.getMessage();
}
}
/**
* Testing ability to change customer from "Istvan" to "Lise".
*/
@Test
public void addCustomerToOrderTest() {
try {
Customer newCustomer = new Customer(0, "Lise", "Lisevej 25", "9000", "Aalborg", "88888888", "[email protected]", "privat");
assertEquals(o1.getCustomer().getName(), "Istvan");
o1.addCustomerToSalesOrder(newCustomer);
assertEquals(o1.getCustomer().getName(), "Lise");
assertNotEquals("Istvan", o1.getCustomer().getName());
} catch(Exception e) {
e.getMessage();
}
}
/**
* Testing ability to change orderstatus from "order" to "delivered".
*/
@Test
public void setOrderConditionTest() {
try {
assertTrue(o1.getOrderCondition().equals(order));
o1.setOrderCondition(delivered);
assertTrue(o1.getOrderCondition().equals(delivered));
} catch (Exception e) {
e.getMessage();
}
}
}
| [
"[email protected]"
] | |
2461fa8275f49a2e25db85d8f12f3ed488f17e41 | 7f2ffdc05bb6103aeb893a237aefa5086933799f | /src/main/java/com/google/cloud/teleport/mappers/BigQueryMapper.java | 54e75646bf2a874f6f5b0e27c174433ca37188a6 | [
"Apache-2.0"
] | permissive | forthedeal/DataflowTemplates | 12e8c282986a8c14c5ac26979810ca03bb1d230a | 596b5739ce8de51b7c5a124f704a77280ec0b7d1 | refs/heads/master | 2021-01-06T12:35:55.393608 | 2020-02-17T20:52:29 | 2020-02-17T20:52:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,867 | java | /*
* Copyright (C) 2018 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.cloud.teleport.mappers;
import com.google.api.services.bigquery.model.TableRow;
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;
import com.google.cloud.bigquery.Field;
import com.google.cloud.bigquery.FieldList;
import com.google.cloud.bigquery.LegacySQLTypeName;
import com.google.cloud.bigquery.Schema;
import com.google.cloud.bigquery.StandardTableDefinition;
import com.google.cloud.bigquery.Table;
import com.google.cloud.bigquery.TableDefinition;
import com.google.cloud.bigquery.TableId;
import com.google.cloud.bigquery.TableInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.avro.generic.GenericRecord;
// import org.apache.avro.Schema; // if needed we need to figure out the duplicate here
import org.apache.beam.sdk.options.ValueProvider;
import org.apache.beam.sdk.transforms.MapElements;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.transforms.SimpleFunction;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO: Class comments are required
/*
*
* BigQueryMapper is intended to be easily extensible to enable BigQuery schema management
* during pipeline execution. New fields and tables will be automatically added to BigQuery
* when they are detected and before data causes BQ load failures.
*
* The BigQueryMapper can be easily extended by overriding:
* - public TableId getTableId(InputT input)
* - public TableRow getTableRow(InputT input)
* - public OutputT getOutputObject(InputT input)
* - public Map<String, LegacySQLTypeName> getInputSchema(InputT input)
*
*/
public class BigQueryMapper<InputT, OutputT>
extends PTransform<PCollection<InputT>, PCollection<OutputT>> {
private static final Logger LOG = LoggerFactory.getLogger(BigQueryMapper.class);
private BigQuery bigquery;
private Map<String, Table> tables = new HashMap<String, Table>();
private Map<String, LegacySQLTypeName> defaultSchema;
private final String projectId;
public BigQueryMapper(String projectId) {
this.projectId = projectId;
}
public TableId getTableId(InputT input) {return null;}
public TableRow getTableRow(InputT input) {return null;}
public OutputT getOutputObject(InputT input) {return null;}
/* Return a HashMap with the Column->Column Type Mapping required from the source
Implementing getInputSchema will allow the mapper class to support your desired format
*/
public Map<String, LegacySQLTypeName> getInputSchema(InputT input) {
return new HashMap<String, LegacySQLTypeName>();
}
public String getProjectId() {
return this.projectId;
}
public void withDefaultSchema(Map<String, LegacySQLTypeName> defaultSchema) {
this.defaultSchema = defaultSchema;
}
/* Return the combination of any schema returned via
implementing getInputSchema (for complex and dynamic cases)
and submitting a static default schema.
*/
private Map<String, LegacySQLTypeName> getObjectSchema(InputT input) {
Map<String, LegacySQLTypeName> inputSchema = getInputSchema(input);
if (this.defaultSchema != null) {
inputSchema.putAll(this.defaultSchema);
}
return inputSchema;
}
@Override
public PCollection<OutputT> expand(PCollection<InputT> tableKVPCollection) {
return tableKVPCollection.apply(
"TableRowExtractDestination",
MapElements.via(
new SimpleFunction<InputT, OutputT>() {
@Override
public OutputT apply(InputT input) {
/*
We run validation against every event to ensure all columns
exist in source.
If a column is in the event and not in BigQuery,
the column is added to the table before the event can continue.
*/
TableId tableId = getTableId(input);
TableRow row = getTableRow(input);
Map<String, LegacySQLTypeName> inputSchema = getObjectSchema(input);
// TODO the Dynamic converter needs to use the tableId object rather than a string
updateTableIfRequired(tableId, row, inputSchema);
return getOutputObject(input);
// return KV.of(tableId, row);
}
}));
}
private void updateTableIfRequired(TableId tableId, TableRow row, Map<String, LegacySQLTypeName> inputSchema) {
// Ensure Instance of BigQuery Exists
if (this.bigquery == null) {
this.bigquery =
BigQueryOptions.newBuilder()
.setProjectId(projectId)
.build()
.getService();
}
// Get BigQuery Table for Given Row
Table table = getBigQueryTable(tableId);
// Validate Table Schema
FieldList tableFields = table.getDefinition().getSchema().getFields();
Set<String> rowKeys = row.keySet();
Boolean tableWasUpdated = false;
List<Field> newFieldList = new ArrayList<Field>();
for (String rowKey : rowKeys) {
// Check if rowKey (column from data) is in the BQ Table
try {
Field tableField = tableFields.get(rowKey);
} catch (IllegalArgumentException e) {
tableWasUpdated = addNewTableField(tableId, row, rowKey, newFieldList, inputSchema);
}
}
if (tableWasUpdated) {
LOG.info("Updating Table");
updateBigQueryTable(tableId, table, tableFields, newFieldList);
}
}
private Table getBigQueryTable(TableId tableId) {
String tableName = tableId.toString();
Table table = tables.get(tableName);
// Checks that table existed in tables map
// If not pull table from API
// TODO we need logic to invalidate table caches
if (table == null) {
LOG.info("Pulling Table from API");
table = bigquery.getTable(tableId);
}
// Check that table exists, if not create empty table
// the empty table will have columns automapped during updateBigQueryTable()
if (table == null) {
table = createBigQueryTable(tableId);
}
tables.put(tableName, table);
return table;
}
private Table createBigQueryTable(TableId tableId) {
// Create Blank BigQuery Table
LOG.info(String.format("Creating Table: %s", tableId.toString()));
List<Field> fieldList = new ArrayList<Field>();
Schema schema = Schema.of(fieldList);
TableDefinition tableDefinition = StandardTableDefinition.of(schema);
TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build();
Table table = bigquery.create(tableInfo);
return table;
}
/* Update BigQuery Table Object Supplied */
private void updateBigQueryTable(
TableId tableId, Table table, FieldList tableFields, List<Field> newFieldList) {
// Table Name to Use for Cache
String tableName = tableId.toString();
// Add all current columns to the list
List<Field> fieldList = new ArrayList<Field>();
for (Field field : tableFields) {
fieldList.add(field);
}
// Add all new columns to the list
// TODO use guava to use joiner on multi-thread multi line logging
LOG.info(tableName);
LOG.info("Mapping New Columns:");
for (Field field : newFieldList) {
fieldList.add(field);
LOG.info(field.toString());
}
Schema newSchema = Schema.of(fieldList);
Table updatedTable =
table.toBuilder().setDefinition(StandardTableDefinition.of(newSchema)).build().update();
tables.put(tableName, updatedTable);
}
private Boolean addNewTableField(TableId tableId, TableRow row, String rowKey,
List<Field> newFieldList, Map<String, LegacySQLTypeName> inputSchema) {
// Call Get Schema and Extract New Field Type
Field newField;
if (inputSchema.containsKey(rowKey)) {
newField = Field.of(rowKey, inputSchema.get(rowKey));
} else {
newField = Field.of(rowKey, LegacySQLTypeName.STRING);
}
newFieldList.add(newField);
// Currently we always add new fields for each call
// TODO: add an option to ignore new field and why boolean?
return true;
}
}
| [
"[email protected]"
] | |
1a847004b6e37d8160a3bd1eb7c3ea1a029627d9 | e3d87609111b2a170d4baeb5f6febb8a227ed829 | /AutoTest_Shell_Android/app/src/androidTest/java/com/xxxman/autotest/shell/HJTest1.java | e9ea864021ac2f8b336b26f850a5c99529fe00a3 | [] | no_license | vbcc2001/AutoTest | abf22f4f2d691587ee2c110a87a2c4e9b36bce82 | a56f74f4a72633adc7b780ca2346ff09b13e88f6 | refs/heads/master | 2020-12-02T07:50:29.496624 | 2017-11-13T14:40:15 | 2017-11-13T14:40:15 | 96,730,477 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 31,213 | java | package com.xxxman.autotest.shell;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Environment;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.UiWatcher;
import android.util.Log;
import android.view.KeyEvent;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(AndroidJUnit4.class)
public class HJTest1 {
UiDevice mUIDevice = null;
Context mContext = null;
String TAG = "HJTest1";
String APP = "com.huajiao";
int log_count = 0;
int count_get_sun = 0;
SQLUtil sqlUtil = new SQLUtil();
MyConnection my = new MyConnection();
String url = Constant.URL();
String phone= "";
boolean is_colse_ad = true;
boolean is4X=Constant.IS_4X();
@Before
public void setUp() throws RemoteException {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
mUIDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); //获得device对象
mUIDevice.registerWatcher("notifation", new UiWatcher() {
@Override
public boolean checkForCondition() {
// just press back
Log.d(TAG,":进入Watcher");
try {
closeAd();
} catch (Exception e) {
e.printStackTrace();
}
//mUIDevice.pressKeyCode(KeyEvent.KEYCODE_VOLUME_DOWN);
return false;
}
});
//mUIDevice.waitForIdle(3000); //设置等待时间
mContext = InstrumentationRegistry.getContext();
if(!mUIDevice.isScreenOn()){ //唤醒屏幕
mUIDevice.wakeUp();
}
//mUIDevice.pressHome(); //按home键
}
@Test
public void test_test() {
UiObject2 qiandao = mUIDevice.findObject(By.res("com.huajiao:id/checkin_btn"));
if(qiandao!=null){
qiandao.click();
}
UiObject2 qiandao2 = mUIDevice.findObject(By.res("com.huajiao:id/checkin_btn"));
if(qiandao2!=null){
qiandao2.click();
}
}
@Test
public void test_for() throws Exception {
List<User> list = sqlUtil.selectUser();
boot();
for(User user:list) {
Log.d(TAG,user.pwd+"---");
try {
//执行任务
sqlUtil.updateTaskCount(user);
//分享3次阳光
//test1(user) ;
//录像阳光
//test2(user) ;
//新版录像阳光
test3(user) ;
//完成任务
sqlUtil.updateEndCount(user);
} catch (Exception e) {
e.printStackTrace();
try {
reboot();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
list = sqlUtil.selectFailCount();
for(User user:list) {
Log.d(TAG,user.pwd+"---");
try {
//执行任务
sqlUtil.updateTaskCount(user);
//分享3次阳光
//test1(user) ;
//录像阳光
//test2(user) ;
//新版录像阳光
test3(user) ;
//完成任务
sqlUtil.updateEndCount(user);
} catch (Exception e) {
e.printStackTrace();
try {
reboot();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
String path = null;
try {
path = Environment.getExternalStorageDirectory().getCanonicalPath();
list = sqlUtil.selectFailCount();
FileUtil.writeTxtFile(list,path,"fail_"+sqlUtil.dateString+".txt");
} catch (IOException e) {
e.printStackTrace();
}
}
public void test1(User user) throws Exception {
int count_share = 0;
//boot(); //0.启动
//closeAd(); //尝试关广告
login(user); //1.登录
//closeAd(); //尝试关广告
goGuangChang(); //3.进入广场
goZhiBo(); //4.进入直播
//5.分享3次
for(int i = 0 ; i < 3 ; i++) {
share();
count_share++;
}
getSunshine(user); //6.领取阳光
closeZhiBo(); //7.关直播
//closeAd(); //尝试关广告
quit(); //8.退出
}
//启动流程
public void boot() throws Exception {
Intent myIntent = mContext.getPackageManager().getLaunchIntentForPackage(APP); //启动app
mContext.startActivity(myIntent);
mUIDevice.waitForWindowUpdate(APP, 5 * 2000);
}
public void reboot() throws Exception {
Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(APP);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
mContext.startActivity(intent);
mUIDevice.waitForWindowUpdate(APP, 5 * 2000);
}
//登录流程
public void login(User user) throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject my = mUIDevice.findObject(new UiSelector().text("我的"));
my.click();
UiObject2 login = mUIDevice.findObject(By.text("使用手机号登录"));
if(login==null){
quit();
my = mUIDevice.findObject(new UiSelector().text("我的"));
my.click();
UiObject2 login1 = mUIDevice.findObject(By.text("使用手机号登录"));
login1.click();
}else {
login.click();
}
//提醒
Intent intent = new Intent();
intent.setAction("com.xxxman.autotest.shell.MyBroadCastReceiver");
intent.putExtra("name", "当前正在登录第 "+user.number+" 个账户");
mContext.sendBroadcast(intent);
UiObject phone = mUIDevice.findObject(new UiSelector().text("请输入您的手机号"));
phone.setText(user.phone);
//UiObject password = mUIDevice.findObject(new UiSelector().text("请输入密码"));
UiObject password = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/pwd_et"));
password.setText(user.pwd);
UiObject logining = mUIDevice.findObject(new UiSelector().text("登录"));
logining.click();
//Thread.sleep(2000);
}
//退出流程
public void quit() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject my = mUIDevice.findObject(new UiSelector().text("我的"));
my.click();
//UiObject my_page = mUIDevice.findObject(new UiSelector().text("我的主页"));
//my_page.click();
UiScrollable home = new UiScrollable(new UiSelector().resourceId("com.huajiao:id/swipeLayout"));
home.flingForward();
//mUIDevice.swipe(100, 1676, 100, 600, 20);
UiObject setting = mUIDevice.findObject(new UiSelector().text("设置"));
setting.click();
UiObject2 set = mUIDevice.findObject(By.res("android:id/content")).getChildren().get(0).getChildren().get(1);
set.scroll(Direction.DOWN, 0.8f);
//mUIDevice.swipe(100, 1676, 100, 600, 20);
UiObject quit = mUIDevice.findObject(new UiSelector().text("退出登录"));
quit.click();
UiObject quit_ok = mUIDevice.findObject(new UiSelector().text("退出"));
quit_ok.click(); //点击按键
//Thread.sleep(1000);
}
//关闭弹窗广告
public void closeAd() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
if(is_colse_ad){
UiObject2 close = mUIDevice.findObject(By.res("com.huajiao:id/img_close"));
if(close!=null){
Log.d(TAG,"有广告");
close.click();
}
}
}
//进入广场
public void goGuangChang() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject guangchang = mUIDevice.findObject(new UiSelector().text("广场"));
guangchang.click();
}
//进入直播
public void goZhiBo() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject zhibozhong = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/icon_view"));
zhibozhong.click();
}
//退出直播
public void closeZhiBo() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject close = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/btn_live_close"));
//close.click(); //点击按键
Thread.sleep(1000);
if(is4X){
mUIDevice.click(990,1842);
}else{
mUIDevice.click(660,1228);
}
}
//分享
public void share() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject share = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/btn_share"));
//share.click();
Thread.sleep(1000);
mUIDevice.click(2,2);
Thread.sleep(1000);
if(is4X){
mUIDevice.click(840,1842);
}else{
mUIDevice.click(560,1228);
}
UiObject share_qq = mUIDevice.findObject(new UiSelector().text("发给QQ好友"));
share_qq.click();
UiObject my_compa = mUIDevice.findObject(new UiSelector().text("我的电脑"));
my_compa.click(); //点击按键
UiObject qq_sent = mUIDevice.findObject(new UiSelector().text("发送"));
qq_sent.click(); //点击按键
UiObject qq_back = mUIDevice.findObject(new UiSelector().text("返回花椒直播"));
qq_back.click(); //点击按键
}
public void getSunshine(User user) throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject sun =mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/sun_task_tip"));
//sun.click();
Thread.sleep(1000);
if(is4X){
mUIDevice.click(976,390);
}else{
mUIDevice.click(651,268);
}
UiObject2 get = mUIDevice.findObject(By.text("分享直播(3/3)"));
if(get!=null){
UiObject2 get_ = get.getParent().findObject(By.text("领取"));
get_.click();
sqlUtil.updateSuccessCount(user);
Log.i(TAG,"count_get_sun:"+count_get_sun);
}else{
UiObject2 list = mUIDevice.findObject(By.res("com.huajiao:id/list_view"));
list.scroll(Direction.DOWN, 0.8f);
UiObject2 get1 = mUIDevice.findObject(By.text("分享直播(3/3)"));
UiObject2 end = get1.getParent().findObject(By.text("已完成"));
if(end != null){
sqlUtil.updateSuccessCount(user);
Log.i(TAG,"count_get_sun:"+count_get_sun);
}
}
mUIDevice.pressBack();
}
public void getSunshine2(User user) throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject sun =mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/sun_task_tip"));
//sun.click();
Thread.sleep(1000);
if(is4X){
mUIDevice.click(976,390);
}else{
mUIDevice.click(651,268);
}
UiObject2 get = mUIDevice.findObject(By.text("录制视频(1/1)"));
if (get!=null){
Thread.sleep(1500);
get = mUIDevice.findObject(By.text("录制视频(1/1)"));
}
if(get!=null){
UiObject2 get_ = get.getParent().findObject(By.text("领取"));
get_.click();
sqlUtil.updateSuccessCount(user);
Log.i(TAG,"count_get_sun:"+count_get_sun);
}else{
UiObject2 list = mUIDevice.findObject(By.res("com.huajiao:id/list_view"));
list.scroll(Direction.DOWN, 0.8f);
UiObject2 get1 = mUIDevice.findObject(By.text("录制视频(1/1)"));
UiObject2 end = get1.getParent().findObject(By.text("已完成"));
if(end != null){
sqlUtil.updateSuccessCount(user);
Log.i(TAG,"count_get_sun:"+count_get_sun);
}
}
//记录阳光数
UiObject2 sun_count = mUIDevice.findObject(By.res("com.huajiao:id/right_tv"));
if (sun_count != null){
Log.d(TAG,"---当前阳光数为--"+sun_count.getText()+"---------");
user.sun = Integer.valueOf(sun_count.getText());
}
//完成任务
String dou = "\"{\\\"phone\\\":\\\""+phone+"\\\",\\\"account\\\":\\\""+user.phone+"\\\",\\\"pwd\\\":\\\"*\\\",\\\"state\\\":\\\"1\\\",\\\"sun\\\":"+user.sun+"}\"";
String context = "{\"function\":\"F100004\",\"user\":{\"id\":\"1\",\"session\":\"123\"},\"content\":{\"count\":"+dou+"}}";
Map<String,String> parms = new HashMap<>();
parms.put("jsonContent",context);
String rs = my.getContextByHttp(url,parms);
Log.d(TAG,"http请求结果"+rs);
mUIDevice.pressBack();
}
//分享
public void recordVideo() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
//UiObject share = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/btn_share"));
//share.click();
if(is4X){
Thread.sleep(1000);
}else{
Thread.sleep(3000);
}
mUIDevice.click(2,2);
Thread.sleep(1000);
if(is4X){
mUIDevice.click(680,1842);
}else{
mUIDevice.click(460,1228);
}
if(is4X){
Thread.sleep(200);
}else{
Thread.sleep(1000);
}
if(is4X){
mUIDevice.click(540,1700);
}else{
mUIDevice.click(360,1228);
}
Thread.sleep(8000);
if(is4X){
mUIDevice.click(540,1700);
}else{
mUIDevice.click(360,1228);
}
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
UiObject end = mUIDevice.findObject(new UiSelector().text("完成"));
end.click();
}catch (Exception e){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
UiObject end = mUIDevice.findObject(new UiSelector().text("完成"));
end.click();
}catch (Exception e1){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
UiObject end = mUIDevice.findObject(new UiSelector().text("完成"));
end.click();
}catch (Exception e2){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
UiObject end = mUIDevice.findObject(new UiSelector().text("完成"));
end.click();
}catch (Exception e3){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
UiObject end = mUIDevice.findObject(new UiSelector().text("完成"));
end.click();
}catch (Exception e4){
Thread.sleep(5000);
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
UiObject end = mUIDevice.findObject(new UiSelector().text("完成"));
end.click();
}
}
}
}
}
}
//进入直播
public void goZhiBo2() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject new_list = mUIDevice.findObject(new UiSelector().text("频道"));
new_list.click();
UiObject zhibozhong = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/type_icon"));
zhibozhong.click();
}
public void test2(User user) throws Exception {
phone = sqlUtil.selectCode();
if (phone.length()==13){
phone = phone.substring(1);
}
login(user); //1.登录
goGuangChang(); //3.进入广场
goZhiBo2(); //4.进入直播
recordVideo();
getSunshine2(user); //6.领取阳光
closeZhiBo(); //7.关直播
quit(); //8.退出
}
public void test3(User user) throws Exception {
phone = sqlUtil.selectCode();
if (phone.length()==13){
phone = phone.substring(1);
}
login3(user); //1.登录
for(int i=0; i<3;i++){
UiObject2 qiandao = mUIDevice.findObject(By.res("com.huajiao:id/checkin_btn"));
if(qiandao!=null){
qiandao.click();
}
Thread.sleep(1000);
UiObject2 qiandao2 = mUIDevice.findObject(By.res("com.huajiao:id/checkin_btn"));
if(qiandao2!=null){
qiandao2.click();
}
}
goGuangChang3(); //3.进入广场
goZhiBo3(); //4.进入直播
recordVideo3();
Thread.sleep(1000);
getSunshine3(user); //6.领取阳光
closeZhiBo(); //7.关直播
quit3(); //8.退出
}
//登录流程
public void login3(User user) throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject my = mUIDevice.findObject(new UiSelector().text("我的"));
my.click();
UiObject2 login = mUIDevice.findObject(By.text("手机号登录"));
if(login==null){
quit3();
my = mUIDevice.findObject(new UiSelector().text("我的"));
my.click();
UiObject2 login1 = mUIDevice.findObject(By.text("手机号登录"));
login1.click();
}else {
login.click();
}
//提醒
Intent intent = new Intent();
intent.setAction("com.xxxman.autotest.shell.MyBroadCastReceiver");
intent.putExtra("name", "当前正在登录第 "+user.number+" 个账户");
mContext.sendBroadcast(intent);
UiObject phone = mUIDevice.findObject(new UiSelector().text("请输入手机号"));
phone.setText(user.phone);
//UiObject password = mUIDevice.findObject(new UiSelector().text("请输入密码"));
UiObject password = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/pwd_et"));
password.setText(user.pwd);
UiObject logining = mUIDevice.findObject(new UiSelector().text("登录"));
logining.click();
}
//退出流程
public void quit3() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject my = mUIDevice.findObject(new UiSelector().text("我的"));
my.click();
//UiObject my_page = mUIDevice.findObject(new UiSelector().text("我的主页"));
//my_page.click();
UiScrollable home = new UiScrollable(new UiSelector().resourceId("com.huajiao:id/swipe_target"));
home.flingForward();
//mUIDevice.swipe(100, 1676, 100, 600, 20);
UiObject setting = mUIDevice.findObject(new UiSelector().text("设置"));
setting.click();
UiObject2 set = mUIDevice.findObject(By.res("android:id/content")).getChildren().get(1).getChildren().get(1);
set.scroll(Direction.DOWN, 0.8f);
//mUIDevice.swipe(100, 1676, 100, 600, 20);
UiObject quit = mUIDevice.findObject(new UiSelector().text("退出登录"));
quit.click();
UiObject quit_ok = mUIDevice.findObject(new UiSelector().text("退出"));
quit_ok.click(); //点击按键
//Thread.sleep(1000);
}
//进入直播
public void goZhiBo3() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject new_list = mUIDevice.findObject(new UiSelector().text("热门"));
new_list.click();
UiObject zhibozhong = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/hot_new_grid_icon_view"));
zhibozhong.click();
}
//分享
public void recordVideo3() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
//UiObject share = mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/btn_share"));
//share.click();
if(is4X){
Thread.sleep(1000);
}else{
Thread.sleep(3000);
}
mUIDevice.click(2,2);
Thread.sleep(1000);
if(is4X){
mUIDevice.click(680,1842);
}else{
mUIDevice.click(460,1228);
}
if(is4X){
Thread.sleep(200);
}else{
Thread.sleep(1000);
}
if(is4X){
mUIDevice.click(540,1700);
}else{
mUIDevice.click(360,1228);
}
Thread.sleep(8000);
if(is4X){
mUIDevice.click(540,1700);
}else{
mUIDevice.click(360,1228);
}
Thread.sleep(5000);
//关闭广告监控
is_colse_ad = false;
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
shareQQ();
}catch (Exception e){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
shareQQ();
}catch (Exception e1){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
shareQQ();
}catch (Exception e2){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
shareQQ();
}catch (Exception e3){
Thread.sleep(5000);
try{
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
shareQQ();
}catch (Exception e4){
Thread.sleep(5000);
UiObject send = mUIDevice.findObject(new UiSelector().text("发布"));
send.click();
shareQQ();
}
}
}
}
}finally {
is_colse_ad = true;
}
}
public void shareQQ() throws Exception {
UiObject my_compa = mUIDevice.findObject(new UiSelector().text("我的电脑"));
my_compa.click(); //点击按键
UiObject qq_sent = mUIDevice.findObject(new UiSelector().text("发送"));
qq_sent.click(); //点击按键
UiObject qq_back = mUIDevice.findObject(new UiSelector().text("返回花椒直播"));
qq_back.click(); //点击按键
}
public void getSunshine3(User user) throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject sun =mUIDevice.findObject(new UiSelector().resourceId("com.huajiao:id/sun_task_tip"));
//sun.click();
Thread.sleep(2000);
if(is4X){
mUIDevice.click(976,390);
}else{
mUIDevice.click(651,268);
}
UiObject2 get = mUIDevice.findObject(By.text("录制并分享小视频(1/1)"));
if (get!=null){
Thread.sleep(1500);
get = mUIDevice.findObject(By.text("录制并分享小视频(1/1)"));
}
if(get!=null){
UiObject2 get_ = get.getParent().findObject(By.text("领取"));
if(get_!=null){
get_.click();
}
sqlUtil.updateSuccessCount(user);
Log.i(TAG,"count_get_sun:"+count_get_sun);
}else{
UiObject2 list = mUIDevice.findObject(By.res("com.huajiao:id/list_view"));
list.scroll(Direction.DOWN, 0.8f);
UiObject2 get1 = mUIDevice.findObject(By.text("录制并分享小视频(1/1)"));
UiObject2 end = get1.getParent().findObject(By.text("已完成"));
if(end != null){
sqlUtil.updateSuccessCount(user);
Log.i(TAG,"count_get_sun:"+count_get_sun);
}
}
//记录阳光数
UiObject2 sun_count = mUIDevice.findObject(By.res("com.huajiao:id/right_tv"));
if (sun_count != null){
Log.d(TAG,"---当前阳光数为--"+sun_count.getText()+"---------");
user.sun = Integer.valueOf(sun_count.getText());
}
//完成任务
String dou = "\"{\\\"phone\\\":\\\""+phone+"\\\",\\\"account\\\":\\\""+user.phone+"\\\",\\\"pwd\\\":\\\"*\\\",\\\"state\\\":\\\"1\\\",\\\"sun\\\":"+user.sun+"}\"";
String context = "{\"function\":\"F100004\",\"user\":{\"id\":\"1\",\"session\":\"123\"},\"content\":{\"count\":"+dou+"}}";
Map<String,String> parms = new HashMap<>();
parms.put("jsonContent",context);
String rs = my.getContextByHttp(url,parms);
Log.d(TAG,"http请求结果"+rs);
mUIDevice.pressBack();
}
//关闭弹窗广告
public void closeQiandao() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
UiObject2 close = mUIDevice.findObject(By.text("每日签到"));
if(close!=null){
Log.d(TAG,"有签到");
//close.click();
mUIDevice.pressBack();
}
// UiObject2 finsh = mUIDevice.findObject(By.text("完成"));
// if(finsh!=null){
// Log.d(TAG,"有签到");
// finsh.click();
// }
}
//进入广场
public void goGuangChang3() throws Exception {
Log.d(TAG,(log_count++)+":开始方法:"+new Exception().getStackTrace()[0].getMethodName()
+"@上级方法:"+new Exception().getStackTrace()[1].getMethodName());
try{
UiObject guangchang = mUIDevice.findObject(new UiSelector().text("广场"));
guangchang.click();
}catch(Exception e) {
reboot();
UiObject guangchang = mUIDevice.findObject(new UiSelector().text("广场"));
guangchang.click();
}
// UiObject2 guangchang = mUIDevice.findObject(By.text("广场"));
// if (guangchang==null){
// mUIDevice.pressBack();
// guangchang = mUIDevice.findObject(By.text("广场"));
//
// }
// guangchang.click();
// Thread.sleep(2000);
// mUIDevice.pressBack();
// UiObject2 close = mUIDevice.findObject(By.text("每日签到"));
// if(close!=null){
// Log.d(TAG,"有签到");
// //close.click();
// mUIDevice.pressBack();
// }
}
} | [
"[email protected]"
] | |
f1b029a93b72d798bfdeff3633ef406cd4e27132 | 93cd697e32b1e2d55dd068fe6c55345bfc3d5e44 | /src/main/com/ppe/PerfumeBottle.java | 0ea5df92e46518fbea7c57cb33cd199d050c75c5 | [] | no_license | vinayrg78/ProductPriceEvaluator | 6de2d6f8784049c9ad879065a034c328ae4faccb | 48cd2d1c89eeb44b803cfd5cdc18dbcf6fc17c54 | refs/heads/master | 2021-01-18T13:33:19.700069 | 2013-10-15T19:48:04 | 2013-10-15T19:48:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package com.ppe;
import java.math.BigDecimal;
import com.ppe.service.NonExemptTaxableServiceImpl;
public class PerfumeBottle extends Product {
public static final String PROD_DESC = "bottle of perfume ";
public PerfumeBottle(String basePrice){
super(basePrice);
}
public PerfumeBottle(boolean isImported, BigDecimal basePrice) {
super(isImported, basePrice);
}
@Override
public String getDescription(){
return PROD_DESC;
}
@Override
protected void setTaxable() {
this.taxable = NonExemptTaxableServiceImpl.getInstance();
}
}
| [
"[email protected]"
] | |
57b9228c6d74156162130fc3fef423c710530ff0 | e5d630c3e48cea327c435b5782cc554c182edd40 | /Curso Java - Básico Códigos Eclipse/src/aula18/BreakContinue.java | da95df763ac5375393d8d3228072afe57d73edb2 | [] | no_license | islanes/java-basico-exercicios | f170e39d64424d45d54712462c8a5db5899827ee | ce5af63038f393866fc1e0d86b9b086c91403381 | refs/heads/master | 2020-04-19T00:54:50.606535 | 2019-04-03T21:46:39 | 2019-04-03T21:46:39 | 167,859,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 783 | java |
package aula18;
import java.util.Scanner;
/**
*
* @author Islane dos S. Silva
*/
public class BreakContinue {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Entre com um numero: ");
int num = scan.nextInt();
System.out.println("Entre com um limite ");
int max = scan.nextInt();
for (int i = num; i <= max; i++) {
System.out.println(i);
if (i%7 ==0){
System.out.println("Divisivel por 7:");
System.out.println(i);
break;//demosntrando o fim da cadeia do for no limite especificado
//saindo do for, mais utilizado...
}
}
}
}
| [
"[email protected]"
] | |
452f0d5583ece3fd228f76b899db08964603ff1b | ffd4b02df59529386316fcb3e2d522300e3df632 | /src/main/java/br/com/cursomc/config/SecurityConfig.java | 71ab609fb3eb4efc823709d82c7b9d9e0bcdc37e | [] | no_license | Renatogsilva/cursomc | 78c055cb05e47306c2f7e9d80987c0d3173d7fef | d47ea072e8ed8a7b573a6192c6a70ecf43fc4ae7 | refs/heads/master | 2021-07-06T22:58:04.491361 | 2020-02-24T18:33:31 | 2020-02-24T18:33:31 | 239,346,598 | 0 | 0 | null | 2021-04-26T19:59:21 | 2020-02-09T17:44:07 | Java | UTF-8 | Java | false | false | 3,280 | java | package br.com.cursomc.config;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import br.com.cursomc.security.JWTAuthenticationFilter;
import br.com.cursomc.security.JWTAuthorizationFilter;
import br.com.cursomc.security.JWTUtil;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private Environment env;
@Autowired
private UserDetailsService userDetailsService;
@Autowired
private JWTUtil jwtUtil;
private static final String[] PUBLIC_MATCHERS = {
"/h2-console/**"
};
private static final String[] PUBLIC_MATCHERS_GET = {
"/produtos/**",
"/categorias/**"
};
private static final String[] PUBLIC_MATCHERS_POST = {
"/clientes/**",
"/auth/forgot/**"
};
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration().applyPermitDefaultValues();
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
if(Arrays.asList(env.getActiveProfiles()).contains("test")) {
http.headers().frameOptions().disable();
}
http.cors().and().csrf().disable();
http.authorizeRequests()
.antMatchers(HttpMethod.POST, PUBLIC_MATCHERS_POST).permitAll()
.antMatchers(HttpMethod.GET, PUBLIC_MATCHERS_GET).permitAll()
.antMatchers(PUBLIC_MATCHERS).permitAll()
.anyRequest().authenticated();
http.addFilter(new JWTAuthenticationFilter(jwtUtil, authenticationManager()));
http.addFilter(new JWTAuthorizationFilter(authenticationManager(), jwtUtil, userDetailsService));
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
} | [
"[email protected]"
] | |
c89b4abd2628c0af774cadea751f47f8fed45a71 | df2a10fa8003ce786291a4e2a9dc1e9a1812e25c | /src/prob3.java | 7b0e855c228b9247af358bc5cffbdee207776df3 | [] | no_license | AfraZhang410/practice | 28f419d5c93c80f4803d803e90e9aabfe4ffe51f | 2464c1660424f995b0582fba406362174fb43800 | refs/heads/master | 2020-03-22T17:02:37.071259 | 2018-07-12T10:09:48 | 2018-07-12T10:09:48 | 140,368,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,634 | java | /*
PROG: ride
ID: afrazha2
LANG: JAVA
TASK: test
*/
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
class gift1 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new File("gift1.in"));
PrintWriter pw = new PrintWriter(new File("gift1.out"));
int np = sc.nextInt();
List<String> people = new ArrayList<String>();
for (int i = 0; i < np; i++) {
people.add(sc.next());
}
Map<String, Integer> received = new HashMap<String, Integer>();
for (String person : people) {
received.put(person, 0);
}
Map<String, Integer> initial = new HashMap<String, Integer>();
for (int i = 0; i < np; i++) {
String person = sc.next();
int amount = sc.nextInt();
int recipients = sc.nextInt();
initial.put(person, amount);
int giftAmount = 0;
if (recipients > 0) {
giftAmount = amount / recipients;
received.put(person, received.get(person) + amount % recipients);
}
for (int j = 0; j < recipients; j++) {
String recipient = sc.next();
received.put(recipient, received.get(recipient) + giftAmount);
}
}
for (String person : people) {
pw.println(person + " " + (received.get(person) - initial.get(person)));
}
pw.close();
}
} | [
"[email protected]"
] | |
a6d9814b3decc65b57f0ed6e037ef73617849b0c | e002f1beaa7efa1e766af5894026621adf44a702 | /app/src/main/java/ui/xe/com/xe_okhttp/MainActivity.java | c8fddde8ffdb5805f1e662f6420707f1616de21d | [] | no_license | Zhongzien/xe_okhttp | a7c2ec31dd58dfd2fe4f43283b0a680679e0b71e | dfae0c42c4803b9c4a4c24ba6d5e2477fb9b79c3 | refs/heads/master | 2021-01-20T00:53:33.149901 | 2017-06-19T09:58:50 | 2017-06-19T09:58:50 | 89,208,568 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,085 | java | package ui.xe.com.xe_okhttp;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.Window;
import com.okhttplib.HttpInfo;
import com.okhttplib.OkHttpInvoker;
import com.okhttplib.callback.OnResultCallBack;
import java.util.HashMap;
public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
}
public void doPostAsync(View v) {
startActivity(new Intent(this, NetWorkActivity.class));
}
public void doGetAsync(View v) {
startActivity(new Intent(this, UploadActivity.class));
}
public void doPostSync(View v) {
startActivity(new Intent(this, DownLoadActivity.class));
}
public void doGetSync(View v) {
}
}
| [
"[email protected]"
] | |
c2a3a0406e99a81886c5d1a181b5135358d6dafc | 2121a342d0617ac79b4a2b9c95b9182e46bf2e69 | /app/src/main/java/com/ali/mvpdemo/utils/RetrofitManager.java | fdba987f45ffb4bc2adb6a7d779b4a7b56f428bc | [] | no_license | YangmengqiCrazy/MvpRxjavaRetofitLatest | 86398e8515e97cc45689f7e60df5f02455f0886e | 62ff0662bbb9d94ef5f0fa54fd749373356afd60 | refs/heads/master | 2020-07-03T23:31:46.904327 | 2018-07-11T04:14:49 | 2018-07-11T04:14:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,282 | java | package com.ali.mvpdemo.utils;
import com.ali.mvpdemo.constant.ConstantApi;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by mumu on 2018/7/9.
*/
public class RetrofitManager {
private static String BASE_URL = ConstantApi.BASE_URL;
private Retrofit mRetrofit;
private static class SingleHolder {
private static final RetrofitManager _INSTANT = new RetrofitManager(BASE_URL);
}
public static RetrofitManager getDefault() {
return SingleHolder._INSTANT;
}
private RetrofitManager(String baseUrl) {
mRetrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.client(buildOkhttpClinet())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
}
private OkHttpClient buildOkhttpClinet() {
return new OkHttpClient.Builder()
.readTimeout(5, TimeUnit.SECONDS)
.build();
}
public <T> T create(Class<T> Clazz) {
return mRetrofit.create(Clazz);
}
}
| [
"[email protected]"
] | |
d7b08e23a4ad1bda3341a24f7bbe4cd00dfcf0f3 | e50cd14db1873e3da8ba731804c53f619a8997a1 | /examples/cxf/jaxrs-advanced/service/src/main/java/service/advanced/PersonExceptionMapper.java | d6c1654015e47893a5cea0ebc2e9ead490dca8a2 | [
"Apache-2.0",
"CC-BY-3.0",
"EPL-1.0",
"BSD-3-Clause",
"W3C",
"CDDL-1.0",
"CPL-1.0",
"MIT",
"MPL-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause",
"CC0-1.0",
"MPL-1.1"
] | permissive | deshankoswatte/tesb-rt-se | 25f94a37e230bfb5c476085c4c5f526038949d06 | 7ba058bc45fa75bd790559a80a5d025ae624dc1a | refs/heads/master | 2022-07-21T05:11:39.351434 | 2020-05-20T11:48:45 | 2020-05-20T11:48:53 | 265,540,421 | 0 | 0 | Apache-2.0 | 2020-05-20T11:12:51 | 2020-05-20T11:12:50 | null | UTF-8 | Java | false | false | 580 | java | /**
* Copyright (C) 2010 Talend Inc. - www.talend.com
*/
package service.advanced;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import common.advanced.PersonUpdateException;
/**
* JAX-RS ExceptionMapper which transforms PersonUpdateExceptions into HTTP 400
* response codes.
*/
@Provider
public class PersonExceptionMapper implements ExceptionMapper<PersonUpdateException> {
@Override
public Response toResponse(PersonUpdateException exception) {
return Response.status(400).build();
}
}
| [
"[email protected]"
] | |
97270652239aac95147c4259d0145cc7cdb94aba | 2cb5a5ca2a74d574a4e4ed47d03dc187de98dff9 | /PBO_GUI_D/src/Tugas4/LuasPermukaanBalok.java | 1146073dbf6d43c49057865ff20c37d06be06304 | [] | no_license | samuelsonher/PBO_GUI_D | 1a7887b1bfc22eaf001ce3a36e03db050ecb32de | 68b75858c5b7d7f614e92833af5b13655de30994 | refs/heads/master | 2021-03-08T08:54:38.025846 | 2020-03-10T15:31:39 | 2020-03-10T15:31:39 | 246,336,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,130 | java | package Tugas4;
import javax.swing.*;
import java.awt.event.*;
public class LuasPermukaanBalok {
public static void main(String[] args){
new LpBalok();
}
}
class LpBalok extends JFrame implements ActionListener{
JLabel p = new JLabel(" Panjang: ");
JLabel l = new JLabel(" Lebar: ");
JLabel t = new JLabel(" Tinggi: ");
JLabel hasil = new JLabel("Hasil = ");
JTextField fpanjang = new JTextField(10);
JTextField flebar = new JTextField(10);
JTextField ftinggi = new JTextField(10);
private JButton btnHasil = new JButton(" Hasil ");
private JButton btnBack = new JButton(" Kembali ");
public LpBalok(){
setTitle("Luas Permukaan Balok");
setSize(350,300);
btnHasil.addActionListener(this);
btnBack.addActionListener(this);
setLayout(null);
add(p);
add(fpanjang);
add(l);
add(flebar);
add(t);
add(ftinggi);
add(btnHasil);
add(hasil);
add(btnBack);
// setBounds(m,n,o,p)
// m = posisi x; n = posisi n
// o = panjang komponen; p = tinggi komponen
p.setBounds(10,10,120,20);
fpanjang.setBounds(130,10,120,20);
l.setBounds(10,30,120,20);
flebar.setBounds(130,30,120,20);
t.setBounds(10,50,120,20);
ftinggi.setBounds(130,50,120,20);
btnHasil.setBounds(10,80,100,20);
hasil.setBounds(10,100,200,20);
btnBack.setBounds(200,130,100,20);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==btnHasil){
double p = Double.parseDouble(fpanjang.getText());
double l = Double.parseDouble(flebar.getText());
double t = Double.parseDouble(ftinggi.getText());
double output;
output = 2 * ((p*l)+(p*t)+(l*t));
hasil.setText("Hasil = "+output);
}
if(e.getSource()==btnBack){
new GUI();
}
}
}
| [
"[email protected]"
] | |
a1ac3992f08d7c40d6a6d85430a2384e433564d1 | 43e2ed1afe8fcc9355db34df39bd7299b7b1a9ff | /src/main/java/com/ets/dao/rangeOfOcurence/RangeOfOcurenceDAO.java | 4758b62362da349e5f2efec16585b6ea9fbfeb58 | [] | no_license | topdeveloper424/EHR-JAVA | 0b420d75d6e6adafdebc3c91610fbed90d388d01 | 61c7ee66fa844fc5dd65a3a145405489088559ff | refs/heads/master | 2022-12-09T21:30:44.241621 | 2019-10-11T05:28:49 | 2019-10-11T05:28:49 | 209,291,391 | 1 | 0 | null | 2022-11-24T05:49:09 | 2019-09-18T11:27:06 | Java | UTF-8 | Java | false | false | 903 | java | package com.ets.dao.rangeOfOcurence;
import java.util.List;
import com.ets.model.RangeOfOcurence;
/**
*Original Author: Sumanta Deyahi on Behalf of ETS for Client Company
*File Creation Date: 22-02-2016
*Initial Version: 0.01
*Module Name:
*Parameter Definition: Type object of RangeOfOcurenceDAO Interface
*Description: RangeOfOcurence Entity DAO Interface
*Copyright 2016 @Eclipse Technoconsulting Global Pvt. Ltd.
*Modification:
*Owner:
*Date:
*Version:
*Description:
*Backup Location for Previous Version:
*
*Copyright 2016 @Eclipse Technoconsulting Global Pvt. Ltd.
*/
public interface RangeOfOcurenceDAO {
public void add(RangeOfOcurence rangeOfOcurence);
public List<RangeOfOcurence> list();
public void update(RangeOfOcurence rangeOfOcurence);
public RangeOfOcurence getByID(Integer id);
public void delete(Integer id);
}
| [
"[email protected]"
] | |
87b7ed1e0044571e39f2596bc10be10d10f014af | 85ebc06850b02b60cca5c86f41bf62a572eda2af | /src-java/flow-topology/flow-messaging/src/main/java/org/openkilda/messaging/command/flow/DeallocateFlowResourcesRequest.java | 810b10b71f820a5fdaaeb5c0fc59b91a2440192e | [
"Apache-2.0"
] | permissive | neeraj890kumar/open-kilda | 05ed78a2d597cc4ff5c448bf8ac40ebfe8f051ae | f595733582407679fb3734230e4f5f1588da9bde | refs/heads/develop | 2023-08-24T07:42:17.836847 | 2020-03-05T04:38:54 | 2020-03-05T04:38:54 | 139,416,881 | 0 | 0 | Apache-2.0 | 2023-09-09T02:20:03 | 2018-07-02T08:53:43 | Java | UTF-8 | Java | false | false | 1,850 | java | /* Copyright 2019 Telstra Open Source
*
* 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.openkilda.messaging.command.flow;
import org.openkilda.messaging.command.CommandData;
import org.openkilda.model.FlowEncapsulationType;
import org.openkilda.model.PathId;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Value;
@Value
@EqualsAndHashCode(callSuper = false)
public class DeallocateFlowResourcesRequest extends CommandData {
@JsonProperty("flow_id")
private String flowId;
@JsonProperty("unmasked_cookie")
private long unmaskedCookie;
@JsonProperty("path_id")
private PathId pathId;
@JsonProperty("encapsulation_type")
private FlowEncapsulationType encapsulationType;
public DeallocateFlowResourcesRequest(@JsonProperty("flow_id") String flowId,
@JsonProperty("unmasked_cookie") long unmaskedCookie,
@JsonProperty("path_id") PathId pathId,
@JsonProperty("encapsulation_type") FlowEncapsulationType encapsulationType) {
this.flowId = flowId;
this.unmaskedCookie = unmaskedCookie;
this.pathId = pathId;
this.encapsulationType = encapsulationType;
}
}
| [
"[email protected]"
] | |
cb5565d9dce8d1d1c19a33fce266ca4e03cbb4e2 | 3fe8603e9699193bbd4aaf734c9b53705a659415 | /src/main/java/com/blair/blairspring/model/rowmappers/EmployeeMapper.java | 2381a05d4936cabeb4bc14c6866b0cd6c290df5b | [] | no_license | ZackTheRed/blairspring | edede4df2b54ba4b967b77153a6b3f58001b27a8 | cc868d213365a4e97a93fc63aaba5463cd742036 | refs/heads/master | 2023-04-14T17:34:47.925201 | 2021-04-24T17:00:40 | 2021-04-24T17:00:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 855 | java | package com.blair.blairspring.model.rowmappers;
import com.blair.blairspring.model.ibatisschema.Employee;
import com.blair.blairspring.model.ibatisschema.Job;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
public class EmployeeMapper implements RowMapper<Employee> {
@Override
public Employee mapRow(ResultSet resultSet, int i) throws SQLException {
Employee employee = new Employee();
employee.setId(resultSet.getLong(1));
employee.setFirstName(resultSet.getString(2));
employee.setLastName(resultSet.getString(3));
employee.setSalary(resultSet.getLong(4));
Job job = new Job();
job.setId(resultSet.getLong(6));
job.setDescription(resultSet.getString(7));
employee.setJob(job);
return employee;
}
}
| [
"[email protected]"
] | |
15711e0376a8e1d0732a6889be58a48e99087f46 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/30/30_72a559d1801261960780d6ce02de4929ca214772/NotifyPanel/30_72a559d1801261960780d6ce02de4929ca214772_NotifyPanel_s.java | 9ffa26d1233cdefc2eb53c6bb922a39a9342e37c | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,797 | java | package org.soluvas.web.jquerynotify;
import org.apache.wicket.Session;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.event.IEvent;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.FeedbackMessages;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.soluvas.json.JsonUtils;
import com.google.common.base.Optional;
/**
* For Ajax behavior explanation, see:
*
* http://www.wexoo.net/20110831/building-a-custom-feedbackpanel-in-wicket-with-js
* http://javathoughts.capesugarbird.com/2009/06/replacing-wickets-feedbackpanel-with.html
*
* See also jGrowl behavior in https://github.com/wicketstuff/core
*
* We might just move to that.
*
* @author ceefour
*/
@SuppressWarnings("serial")
public class NotifyPanel extends Panel {
private static Logger log = LoggerFactory.getLogger(NotifyPanel.class);
public NotifyPanel(String id) {
this(id, null);
}
/**
* @param id
* @param model
*/
public NotifyPanel(String id, IModel<?> model) {
super(id, model);
setRenderBodyOnly(true);
}
@Override
public void onEvent(IEvent<?> event) {
super.onEvent(event);
if (event.getPayload() instanceof AjaxRequestTarget) {
createNotify((AjaxRequestTarget) event.getPayload());
}
}
protected void createNotify(AjaxRequestTarget target) {
final FeedbackMessages feedbackMessages = Session.get().getFeedbackMessages();
if (!feedbackMessages.isEmpty()) {
log.debug("{} got {} feedback messages", Session.get(), feedbackMessages.size());
for (final FeedbackMessage msg : feedbackMessages) {
// FeedbackMessage.getMessage() can return:
// 1. String
// 2. something else: e.g.
// {
// "error" : {
// "keys" : [ "Required" ]^,
// "message" : null,
// "variables" : { }
// },
// "message" : "Field 'password' is required."
// }
// target.appendJavaScript("require('jquery', new function(jQuery) {\n" +
// " jQuery('#notify-container').notify('create', {text: \"" +
// JavaScriptUtils.escapeQuotes(msg.getMessage().toString()) + "\"}); });");
// Wicket's JavaScriptUtils.escapeQuotes() does not escape \n :-(
String icon = "";
if (msg.isInfo()) {
icon = "icon";
} else if (msg.isError()) {
} else if (msg.isWarning()) {
} else if (msg.isDebug()) {
}
final String messageText = Optional.fromNullable(msg.getMessage()).or("").toString();
target.appendJavaScript("jQuery('#notify-container').notify('create', {text: " +
JsonUtils.asJson(messageText) + "});");
}
}
}
}
| [
"[email protected]"
] | |
fc4398e7e408f02dfdba25dff1a886f60628b915 | 2a6777d2950c122344691ae682dc9df22100b1cf | /SpringApp1/src/main/java/jbr/mvc/dao/UserDao.java | 63089c8eb2c9202617a6c711fd05a7452b2cfe56 | [] | no_license | Jairamjavv/SpringApps | 13d21f0d3cb9b48e4da024b974bdbbb6aa91152a | efb0fcded492e8a5788d023fd3d499691c902938 | refs/heads/master | 2022-12-21T13:38:25.161277 | 2019-09-14T08:05:35 | 2019-09-14T08:05:35 | 208,374,893 | 0 | 0 | null | 2022-12-16T09:51:16 | 2019-09-14T01:55:43 | Java | UTF-8 | Java | false | false | 178 | java | package jbr.mvc.dao;
import jbr.mvc.model.Login;
import jbr.mvc.model.User;
public interface UserDao {
void register(User user);
User validateUser(Login login);
}
| [
"[email protected]"
] | |
080be957dae6afbf8f42789c6469d2c8679c22d1 | 56e6a8b2368b9fbabc9c164649f8b2d78b717efd | /app/src/main/java/com/example/webview/HandheldscaleActivity.java | a59d9f45cce40e09384e3c1d49ec6af2f7a84fc3 | [] | no_license | silversand623/AndroidStudio_HandScore | 6b3ba1a11ead7e008ef25634401fad2ab2f87c4f | f1d54224f0c82e14a7dd4552eaec4e16917d932a | refs/heads/master | 2020-05-21T12:32:49.763287 | 2017-03-23T01:08:09 | 2017-03-23T01:08:09 | 54,610,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,396 | java | package com.example.webview;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.TextPaint;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.webview.tools.CustomDialog;
import com.example.webview.tools.CustomProgressDialog;
import com.example.webview.tools.DialogListener;
import com.example.webview.tools.ResizeLayout;
import com.example.webview.tools.ResizeLayout.OnResizeListener;
import com.example.webview.tools.SelectScoreAdapter;
public class HandheldscaleActivity extends Activity{
private TextView txvshowname,txvlogout,txvresulttablename,txvoperationmethod,txvoperationcontent,txvallotedscore,txvthisscore,txvshowstudentid,txvresulttable,txvstudentid,txvfontsize,txvthiscontext,txvstudentexamname,txvstudentshowexamname,txvstudentexamnumname,txvstudentshowexamnumname;
private ListView listView;
//private AutoCompleteTextView custormAutoCompleteTextView;
private Button btnsmallfont,btnmiddlefont,btnlargefont,btnpreview,btnback;
private String name;
private String resulttablename;
SelectScoreAdapter adapter;
private ArrayList<HashMap<String, Object>> listItem;
private boolean notscoreflag=false;
public static CustomProgressDialog dialog;
int num=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scoring);
//SeclectTableActivity.dialog.dismiss();
// ResizeLayout relativeLayout = (ResizeLayout) findViewById(R.id.relative2);
// relativeLayout.setOnResizeListener(this);
// custormAutoCompleteTextView=(AutoCompleteTextView)findViewById(R.id.actv_selectid);
// custormAutoCompleteTextView.setOnTouchListener(new OnTouchListener() {
//
// @Override
// public boolean onTouch(View v, MotionEvent event) {
//
// custormAutoCompleteTextView.setFocusableInTouchMode(true); // 设置模式,以便获取焦点
// custormAutoCompleteTextView.requestFocus();
// return false;
// }
// });
if(PreviewActivity.dialog!=null){
PreviewActivity.dialog.dismiss();
}
txvfontsize=(TextView)findViewById(R.id.txvfontsize);
txvshowname=(TextView)findViewById(R.id.txvshowspname);
txvlogout=(TextView)findViewById(R.id.txvlogout);
txvresulttable=(TextView)findViewById(R.id.txvresulttable);
txvresulttablename=(TextView)findViewById(R.id.txvresulttablename);
txvstudentid=(TextView)findViewById(R.id.txvstudentid);
txvoperationmethod=(TextView)findViewById(R.id.txvoperationmethod);
txvoperationcontent=(TextView)findViewById(R.id.txvoperationcontent);
txvallotedscore=(TextView)findViewById(R.id.txvallotedscore);
txvthisscore=(TextView)findViewById(R.id.txvthisscore);
txvthiscontext=(TextView)findViewById(R.id.txvthiscontext);
//txvscoreoperation=(TextView)findViewById(R.id.txvscoreoperation);
txvshowstudentid=(TextView)findViewById(R.id.txvshowstudentid);
txvstudentexamname=(TextView)findViewById(R.id.txvstudentexamname);
txvstudentshowexamname=(TextView)findViewById(R.id.txvstudentshowexamname);
txvstudentexamnumname=(TextView)findViewById(R.id.txvstudentexamnumname);
txvstudentshowexamnumname=(TextView)findViewById(R.id.txvstudentshowexamnumname);
// Intent intent=getIntent();
// name=intent.getStringExtra("name");
SharedPreferences userInfo = getSharedPreferences("user_info", 0);
txvstudentshowexamname.setText(userInfo.getString("examname", ""));
txvstudentshowexamnumname.setText(userInfo.getString("ES_NAME", ""));
//resulttablename=intent.getStringExtra("num");
txvshowname.setText("欢迎,"+userInfo.getString("truename", ""));
TextPaint tp = txvshowname.getPaint();
tp.setFakeBoldText(true);
txvlogout.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
txvresulttablename.setText(userInfo.getString("tablenum",""));
txvshowstudentid.setText(userInfo.getString("studentnum", ""));
txvlogout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent=new Intent();
intent.setClass(HandheldscaleActivity.this, LoginActivity.class);
startActivity(intent);
}
});
listView=(ListView)findViewById(R.id.mylist);
Intent intent=getIntent();
if(intent.getSerializableExtra("returnlist")!=null){
listItem=(ArrayList<HashMap<String, Object>>) intent.getSerializableExtra("returnlist");
}else{
listItem = new ArrayList<HashMap<String, Object>>();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("1", 1);//图像资源的ID
map.put("2", "步骤1");
map.put("3", "5");
HashMap<String, Object> map1 = new HashMap<String, Object>();
map1.put("1", 2);//图像资源的ID
map1.put("2", "步骤2");
map1.put("3", "10");
HashMap<String, Object> map2 = new HashMap<String, Object>();
map2.put("1", 3);//图像资源的ID
map2.put("2", "步骤3");
map2.put("3", "12");
listItem.add(map);
listItem.add(map1);
listItem.add(map2);
}
final Typeface face = Typeface.createFromAsset (getAssets() , "MSYH.zip" );
Log.i("UIOIHNIBHOUOIHIOUOPUOPI", listItem.toString());
if(listItem.get(0).containsKey("6")&&listItem.get(0).containsKey ("7")){
}else{
for(int i=0;i<listItem.size();i++){
listItem.get(i).put("6", "false");
listItem.get(i).put("7", "false");
}
}
adapter=new SelectScoreAdapter(HandheldscaleActivity.this, listItem,10,face,HandheldscaleActivity.this);
listView.setAdapter(adapter);
listView.clearFocus();
btnsmallfont=(Button)findViewById(R.id.btn_smallfont);
for(int i=0;i<listItem.size();i++){
List<String>list=(List<String>) listItem.get(i).get("3");
num+=list.size();
}
btnsmallfont.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
setfont(6);
adapter=new SelectScoreAdapter(HandheldscaleActivity.this, listItem,6,face,HandheldscaleActivity.this);
btnsmallfont.setBackgroundResource(R.drawable.fontbtnb);
RelativeLayout.LayoutParams btParams1 = new RelativeLayout.LayoutParams
(45,45);
btParams1.setMargins(1204, 70, 0, 0);
btnsmallfont.setLayoutParams(btParams1);
btnmiddlefont.setBackgroundResource(R.drawable.fontbtna);
RelativeLayout.LayoutParams btParams2 = new RelativeLayout.LayoutParams
(40,40);
btParams2.setMargins(1139, 72, 0, 0);
btnmiddlefont.setLayoutParams(btParams2);
btnlargefont.setBackgroundResource(R.drawable.fontbtna);
RelativeLayout.LayoutParams btParams3 = new RelativeLayout.LayoutParams
(40,40);
btParams3.setMargins(1074, 72, 0, 0);
btnlargefont.setLayoutParams(btParams3);
listView.setAdapter(adapter);
// adapter.showoperationcontent.setTextSize(14);
// adapter.showoperationmethod.setTextSize(14);
// adapter.showallotedscore.setTextSize(14);
// adapter.notifyDataSetInvalidated();
// adapter.small();
//adapter.notifyDataSetInvalidated();
}
});
btnmiddlefont=(Button)findViewById(R.id.btn_middlefont);
btnmiddlefont.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setfont(8);
btnsmallfont.setBackgroundResource(R.drawable.fontbtna);
btnmiddlefont.setBackgroundResource(R.drawable.fontbtnb);
RelativeLayout.LayoutParams btParams2 = new RelativeLayout.LayoutParams
(45,45);
btParams2.setMargins(1139, 70, 0, 0);
btnmiddlefont.setLayoutParams(btParams2);
btnlargefont.setBackgroundResource(R.drawable.fontbtna);
RelativeLayout.LayoutParams btParams1 = new RelativeLayout.LayoutParams
(40,40);
btParams1.setMargins(1204, 72, 0, 0);
btnsmallfont.setLayoutParams(btParams1);
RelativeLayout.LayoutParams btParams3 = new RelativeLayout.LayoutParams
(40,40);
btParams3.setMargins(1074, 72, 0, 0);
btnlargefont.setLayoutParams(btParams3);
adapter=new SelectScoreAdapter(HandheldscaleActivity.this, listItem,8,face,HandheldscaleActivity.this);
// adapter.showoperationcontent.setTextSize(20);
// adapter.showoperationmethod.setTextSize(20);
// adapter.showallotedscore.setTextSize(20);
listView.setAdapter(adapter);
// adapter.notifyDataSetInvalidated();
// adapter.middle();
}
});
btnlargefont=(Button)findViewById(R.id.btn_largefont);
btnlargefont.setBackgroundResource(R.drawable.fontbtnb);
btnlargefont.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setfont(10);
adapter=new SelectScoreAdapter(HandheldscaleActivity.this, listItem,10,face,HandheldscaleActivity.this);
btnsmallfont.setBackgroundResource(R.drawable.fontbtna);
btnmiddlefont.setBackgroundResource(R.drawable.fontbtna);
btnlargefont.setBackgroundResource(R.drawable.fontbtnb);
RelativeLayout.LayoutParams btParams3 = new RelativeLayout.LayoutParams
(45,45);
btParams3.setMargins(1074, 70, 0, 0);
RelativeLayout.LayoutParams btParams2 = new RelativeLayout.LayoutParams
(40,40);
btParams2.setMargins(1139, 72, 0, 0);
RelativeLayout.LayoutParams btParams1 = new RelativeLayout.LayoutParams
(40,40);
btParams1.setMargins(1204, 72, 0, 0);
btnsmallfont.setLayoutParams(btParams1);
btnmiddlefont.setLayoutParams(btParams2);
btnlargefont.setLayoutParams(btParams3);
// adapter.showoperationcontent.setTextSize(26);
// adapter.showoperationmethod.setTextSize(26);
// adapter.showallotedscore.setTextSize(26);
listView.setAdapter(adapter);
// adapter.notifyDataSetInvalidated();
// adapter.large();
//adapter.notifyDataSetInvalidated();
}
});
btnpreview=(Button)findViewById(R.id.btn_preview);
btnpreview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
int n=0;
if(!listItem.get(0).containsKey("4")){
CustomDialog customDialog=new CustomDialog(HandheldscaleActivity.this,R.style.MyDialog,new DialogListener() {
@Override
public void refreshActivity(Object object) {
}
}, "请打分在预览",false);
customDialog.show();
}else{
for(int i=0;i<listItem.size();i++){
HashMap<String,Object> map=(HashMap<String, Object>) listItem.get(i).get("4");
//num+=map.size();
if(map!=null){
for(int j=0;j<map.size();j++){
if(listItem.get(i).containsKey("4")&& map.containsKey(String.valueOf(j))){
n+=1;
}else {
notscoreflag=true;
}
}
}
}
if(n!=num){
CustomDialog customDialog=new CustomDialog(HandheldscaleActivity.this,R.style.MyDialog,new DialogListener() {
@Override
public void refreshActivity(Object object) {
}
}, "请打分在预览",false);
customDialog.show();
}else{
dialog=new CustomProgressDialog(HandheldscaleActivity.this,"正在进入预览页面");
dialog.setTitle("稍等片刻");// 设置标题
dialog.setMessage("正在加载,请稍候");
dialog.setIndeterminate(false);// 设置进度条是否为不明确
dialog.setCancelable(false);// 设置进度条是否可以按退回键取消
if(dialog!=null){
dialog.show();
}
Intent intent=new Intent();
intent.setClass(HandheldscaleActivity.this, PreviewActivity.class);
intent.putExtra("jump", "ok");
//intent.putExtra("name", name);
//intent.putExtra("num", resulttablename);
intent.putExtra("list", listItem);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
}
}
});
btnback=(Button)findViewById(R.id.btn_scoreback);
btnback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent=new Intent();
intent.setClass(HandheldscaleActivity.this, SeclectTableActivity.class);
dialog=new CustomProgressDialog(HandheldscaleActivity.this,"正在返回评分表页");
dialog.setTitle("稍等片刻");// 设置标题
dialog.setMessage("正在加载,请稍候");
dialog.setIndeterminate(false);// 设置进度条是否为不明确
dialog.setCancelable(false);// 设置进度条是否可以按退回键取消
if(dialog!=null){
dialog.show();
}
intent.putExtra("back", "back");
intent.putExtra("jump", "ok");
//intent.putExtra("num", resulttablename);
intent.putExtra("list", listItem);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
});
setfontsize();
}
@Override
public void onBackPressed() {
Intent intent=new Intent();
Intent intentrerurnIntent=getIntent();
// if(intentrerurnIntent.getStringExtra("jump")!=null){
//
// }else{
dialog=new CustomProgressDialog(HandheldscaleActivity.this,"正在返回评分表页");
dialog.setTitle("稍等片刻");// 设置标题
dialog.setMessage("正在加载,请稍候");
dialog.setIndeterminate(false);// 设置进度条是否为不明确
dialog.setCancelable(false);// 设置进度条是否可以按退回键取消
if(dialog!=null){
dialog.show();
}
intent.setClass(HandheldscaleActivity.this, SeclectTableActivity.class);
intent.putExtra("back", "back");
//intent.putExtra("num", resulttablename);
intent.putExtra("list", listItem);
startActivity(intent);
HandheldscaleActivity.this.finish();
super.onBackPressed();
//}
}
private void setfont(float a){
//txvresulttable.setTextSize(a);
//txvresulttablename.setTextSize(a);
//txvstudentid.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
//txvresulttable.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
txvoperationmethod.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
txvoperationcontent.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
txvallotedscore.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
txvthisscore.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
txvthiscontext.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
//txvfontsize.setTextSize(TypedValue.COMPLEX_UNIT_PT, a);
//txvscoreoperation.setTextSize(a);
}
private void setfontsize(){
Typeface face = Typeface.createFromAsset (getAssets() , "MSYH.zip" );
txvstudentid.setTypeface(face);
txvfontsize.setTypeface(face);
txvresulttable.setTypeface(face);
txvshowname.setTypeface(face);
txvlogout.setTypeface(face);
txvresulttablename.setTypeface(face);
txvoperationmethod.setTypeface(face);
txvoperationcontent.setTypeface(face);
txvallotedscore.setTypeface(face);
txvthisscore.setTypeface(face);
txvshowstudentid.setTypeface(face);
btnsmallfont.setTypeface(face);
btnmiddlefont.setTypeface(face);
btnlargefont.setTypeface(face);
btnpreview.setTypeface(face);
btnback.setTypeface(face);
txvthiscontext.setTypeface(face);
txvstudentexamname.setTypeface(face);
txvstudentshowexamname.setTypeface(face);
txvstudentexamnumname.setTypeface(face);
txvstudentshowexamnumname.setTypeface(face);
TextPaint tp = txvstudentid.getPaint();
tp.setFakeBoldText(true);
TextPaint tp1 = txvfontsize.getPaint();
tp1.setFakeBoldText(true);
TextPaint tp2 = txvresulttable.getPaint();
tp2.setFakeBoldText(true);
TextPaint tp3 = txvresulttablename.getPaint();
tp3.setFakeBoldText(true);
TextPaint tp4 = txvshowstudentid.getPaint();
tp4.setFakeBoldText(true);
TextPaint tp5 = txvstudentexamname.getPaint();
tp5.setFakeBoldText(true);
TextPaint tp6 = txvstudentshowexamname.getPaint();
tp6.setFakeBoldText(true);
TextPaint tp7 = txvstudentexamnumname.getPaint();
tp7.setFakeBoldText(true);
TextPaint tp8 = txvstudentshowexamnumname.getPaint();
tp8.setFakeBoldText(true);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
System.out.println("down" );
// if (HandheldscaleActivity. this .getCurrentFocus() != null ) {
// if (HandheldscaleActivity. this .getCurrentFocus().getWindowToken() != null ) {
// InputMethodManager imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// imm.hideSoftInputFromWindow(HandheldscaleActivity.this .getCurrentFocus().getWindowToken(),
// InputMethodManager.HIDE_NOT_ALWAYS);
// }
// }
InputMethodManager m=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
boolean isOpen=m.isActive();
if(isOpen==true){
System.out.println("haha" );
View view = getWindow().peekDecorView();
SelectScoreAdapter.editText1.clearFocus();
m.hideSoftInputFromWindow(view.getWindowToken(), 0);
// m.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
}
}
return super .onTouchEvent(event);
}
}
| [
"[email protected]"
] | |
7ac1ce390cf693a8cc4a353e49af290c8f0c50fb | 56e54b5863a9c3c4f5a72e4530dd278044617a2a | /bytebank-herdado-conta/src/br/com/bytebank/banco/modelo/Conta.java | 6e26dccafe7f7311821ca92ebfc5779fa94f51a5 | [] | no_license | SilvaBarrence/JavaParte5 | b395028e8504b722db7c331014647b92caa48d90 | bb7aa6143deca354134eddbe1f6518e27506ed67 | refs/heads/master | 2022-12-11T06:02:39.990914 | 2020-09-05T18:57:52 | 2020-09-05T18:57:52 | 291,549,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,295 | java | package br.com.bytebank.banco.modelo;
/**
* Classe modelo para criar uma conta no bytebank
*
* @author Gabriel de S. Silva Barrence
* @version 0.1
*/
public abstract class Conta {
protected double saldo;
private int agencia;
private int numero;
private Cliente titular;
private static int total = 0;
/**
* Contrutor para inicializar o objeto Conto a partir da agencia e numero
* @param agencia
* @param numero
*/
public Conta(int agencia, int numero) {
Conta.total++;
//System.out.println("O total de contas é " + Conta.total);
this.agencia = agencia;
this.numero = numero;
//this.saldo = 100;
//System.out.println("Estou criando uma conta " + this.numero);
}
public abstract void deposita(double valor);
/**
* Valor precisa ser maior que o saldo
* @param valor
* @throws SaldoInsulficienteException
*/
public void saca(double valor) throws SaldoInsulficienteException{
if (this.saldo < valor){
throw new SaldoInsulficienteException("Saldo " + this.saldo + ", valor: " + valor);
}
this.saldo -= valor;
}
public void transfere(double valor, Conta destino) throws SaldoInsulficienteException{
this.saca(valor);
destino.deposita(valor);
}
public double getSaldo() {
return this.saldo;
}
public int getNumero() {
return this.numero;
}
public void setNumero(int numero) {
if (numero <= 0) {
System.out.println("Nao pode valor menor igual a 0");
return;
}
this.numero = numero;
}
public int getAgencia() {
return this.agencia;
}
public void setAgencia(int agencia) {
if (agencia <= 0) {
System.out.println("Nao pode valor menor igual a 0");
return;
}
this.agencia = agencia;
}
public void setTitular(Cliente titular) {
this.titular = titular;
}
public Cliente getTitular() {
return this.titular;
}
public static int getTotal() {
return Conta.total;
}
@Override
public String toString() {
return "Número "+ this.numero+", Agencia: "+ this.agencia;
}
}
| [
"[email protected]"
] | |
e156d2247d0682ae3f3cc2f16a3fa23180f93cfb | f97ead3ce69ba363e7808aa558abeca987fffc9f | /first/src/main/java/ck/tyut/first/packages/Test2Children.java | 297efb078a97ceab200b212479ad4fc170953f4d | [] | no_license | tyutck/first | 695becc5d4959b6083de57d5c28ad8fe4e3187f6 | b170013b691044c29c732337ec4e95aa613302e2 | refs/heads/master | 2022-11-01T17:09:28.477618 | 2022-10-01T11:31:30 | 2022-10-01T11:31:30 | 164,049,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package ck.tyut.first.packages;
public class Test2Children extends Test2{
public static void main(String[] args){
Test2 test2 = new Test2();
test2.method_public();
test2.method_protected();
test2.method_friendly();
}
}
| [
"[email protected]"
] | |
0ffa4cf9d4c4fd32b5915b9637f83e95f8ff58a5 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/validation/org/drools/compiler/integrationtests/incrementalcompilation/AddRuleTest.java | a9501719f9ea21712d7e7e312ad82ed0a1bb169e | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 7,446 | java | /**
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* 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.drools.compiler.integrationtests.incrementalcompilation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import org.drools.core.impl.InternalKnowledgeBase;
import org.drools.testcoverage.common.model.Person;
import org.drools.testcoverage.common.util.KieBaseTestConfiguration;
import org.drools.testcoverage.common.util.KieUtil;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.definition.KiePackage;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
@RunWith(Parameterized.class)
public class AddRuleTest {
private final KieBaseTestConfiguration kieBaseTestConfiguration;
public AddRuleTest(final KieBaseTestConfiguration kieBaseTestConfiguration) {
this.kieBaseTestConfiguration = kieBaseTestConfiguration;
}
@Test
public void testMemoriesCCEWhenAddRemoveAddRule() {
// JBRULES-3656
final String rule1 = ((((((((((("import " + (AddRuleTest.class.getCanonicalName())) + ".*\n") + "import java.util.Date\n") + "rule \"RTR - 28717 retract\"\n") + "when\n") + " $listMembership0 : SimpleMembership( $listMembershipPatientSpaceIdRoot : patientSpaceId,\n") + " ( listId != null && listId == \"28717\" ) ) and not ($patient0 : SimplePatient( $patientSpaceIdRoot : spaceId, spaceId != null &&\n") + " spaceId == $listMembershipPatientSpaceIdRoot ) and\n") + " (($ruleTime0 : RuleTime( $ruleTimeStartOfDay4_1 : startOfDay, $ruleTimeTime4_1 : time ) and $patient1 :\n") + " SimplePatient( spaceId != null && spaceId == $patientSpaceIdRoot, birthDate != null && (birthDate after[0s,1d] $ruleTimeStartOfDay4_1) ) ) ) )\n") + "then\n") + "end";
final String rule2 = ((((((((("import " + (AddRuleTest.class.getCanonicalName())) + ".*\n") + "import java.util.Date\n") + "rule \"RTR - 28717 retract\"\n") + "when $listMembership0 : SimpleMembership( $listMembershipPatientSpaceIdRoot : patientSpaceId, ( listId != null && listId == \"28717\" ) )\n") + " and not ($patient0 : SimplePatient( $patientSpaceIdRoot : spaceId, spaceId != null && spaceId == $listMembershipPatientSpaceIdRoot )\n") + " and ( ($ruleTime0 : RuleTime( $ruleTimeStartOfDay4_1 : startOfDay, $ruleTimeTime4_1 : time )\n") + " and $patient1 : SimplePatient( spaceId != null && spaceId == $patientSpaceIdRoot, birthDate != null && (birthDate not after[0s,1d] $ruleTimeStartOfDay4_1) ) ) ) )\n") + "then\n") + "end";
final KieServices kieServices = KieServices.get();
final ReleaseId releaseId = kieServices.newReleaseId("org.kie", "test-memories-cce-when-add-remove-rule", "1.0");
KieUtil.getKieModuleFromDrls(releaseId, kieBaseTestConfiguration);
final KieContainer kieContainer = kieServices.newKieContainer(releaseId);
final InternalKnowledgeBase kbase = ((InternalKnowledgeBase) (kieContainer.getKieBase()));
kbase.newKieSession();
kbase.addPackages(TestUtil.createKnowledgeBuilder(null, rule1).getKnowledgePackages());
kbase.addPackages(TestUtil.createKnowledgeBuilder(null, rule2).getKnowledgePackages());
}
@Test
public void testAddRuleWithFrom() {
// JBRULES-3499
final String str1 = "global java.util.List names;\n" + "global java.util.List list;\n";
final String str2 = ((((((((("import " + (Person.class.getCanonicalName())) + ";\n") + "global java.util.List names;\n") + "global java.util.List list;\n") + "rule R1 when\n") + " $p : Person( )\n") + " String( this == $p.name ) from names\n") + "then\n") + " list.add( $p );\n") + "end";
final KieServices kieServices = KieServices.get();
final ReleaseId releaseId = kieServices.newReleaseId("org.kie", "test-add-rule-with-from", "1.0");
KieUtil.getKieModuleFromDrls(releaseId, kieBaseTestConfiguration, str1);
final KieContainer kieContainer = kieServices.newKieContainer(releaseId);
final InternalKnowledgeBase kbase = ((InternalKnowledgeBase) (kieContainer.getKieBase()));
final KieSession ksession = kbase.newKieSession();
final List<String> names = new ArrayList<>();
names.add("Mark");
ksession.setGlobal("names", names);
final List<String> list = new ArrayList<>();
ksession.setGlobal("list", list);
final Person p = new Person("Mark");
ksession.insert(p);
ksession.fireAllRules();
kbase.addPackages(TestUtil.createKnowledgeBuilder(null, str2).getKnowledgePackages());
ksession.fireAllRules();
Assert.assertEquals(1, list.size());
Assert.assertSame(p, list.get(0));
ksession.dispose();
}
@Test
public void testDynamicallyAddInitialFactRule() {
String rule = "package org.drools.compiler.test\n" + ((((("global java.util.List list\n" + "rule xxx when\n") + " i:Integer()\n") + "then\n") + " list.add(i);\n") + "end");
final KieServices kieServices = KieServices.get();
final ReleaseId releaseId = kieServices.newReleaseId("org.kie", "test-add-dynamically-init-fact-rule", "1.0");
KieUtil.getKieModuleFromDrls(releaseId, kieBaseTestConfiguration, rule);
final KieContainer kieContainer = kieServices.newKieContainer(releaseId);
final InternalKnowledgeBase kbase = ((InternalKnowledgeBase) (kieContainer.getKieBase()));
final KieSession session = kbase.newKieSession();
final List list = new ArrayList();
session.setGlobal("list", list);
session.insert(5);
session.fireAllRules();
Assert.assertEquals(5, list.get(0));
rule = "package org.drools.compiler.test\n" + (((("global java.util.List list\n" + "rule xxx when\n") + "then\n") + " list.add(\"x\");\n") + "end");
final Collection<KiePackage> kpkgs = TestUtil.createKnowledgeBuilder(null, rule).getKnowledgePackages();
kbase.addPackages(kpkgs);
session.fireAllRules();
Assert.assertEquals("x", list.get(1));
}
public static class RuleTime {
public Date getTime() {
return new Date();
}
public Date getStartOfDay() {
return new Date();
}
}
public static class SimpleMembership {
public String getListId() {
return "";
}
public String getPatientSpaceId() {
return "";
}
}
public class SimplePatient {
public String getSpaceId() {
return "";
}
public String getFactHandleString() {
return "";
}
public Date getBirthDate() {
return new Date();
}
}
}
| [
"[email protected]"
] | |
ad075bc95115403ca0cb01a72504ea2ac7bc6f22 | a1774e15804fe5c21d12aecbc3721b9d7a8e435b | /panda-admin/src/main/java/com/panda/web/controller/BaseController.java | e8516d4bcd05ab4fa67224f5550f48ed9b337f90 | [] | no_license | yiqianga/CinemaBookingSystem | ae44b5e3f326e308f9e54e83da130ab806d62ec6 | fdf33860be0b3576f7b02dd2108578e8e0a03945 | refs/heads/master | 2023-05-06T23:00:47.631251 | 2021-06-03T23:23:32 | 2021-06-03T23:23:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,615 | java | package com.panda.web.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.panda.common.page.Page;
import com.panda.common.page.PageBuilder;
import com.panda.common.response.ResponseResult;
import java.util.List;
import static com.panda.common.page.PageBuilder.*;
/**
* 抽取重复功能为基类
*/
public class BaseController {
/**
* 开启分页
*/
public void startPage() {
Page page = PageBuilder.buildPage();
Integer pageNum = page.getPageNum();
Integer pageSize = page.getPageSize();
if (pageNum != null && pageSize != null) {
PageHelper.startPage(pageNum, pageSize, page.getOrderByColumn());
}
}
/**
* 根据修改行数返回响应消息
* @param rows
* @return
*/
public ResponseResult getResult(int rows) {
return rows == 0 ? ResponseResult.error() : ResponseResult.success();
}
/**
* 分页响应消息
* @param data
* @return
*/
public ResponseResult getResult(List<?> data) {
PageInfo pageInfo = new PageInfo(data);
ResponseResult responseResult = ResponseResult.success(data);
responseResult.put(PAGE_NUM, pageInfo.getPageNum());
responseResult.put(PAGE_SIZE, pageInfo.getPageSize());
responseResult.put(TOTAL, pageInfo.getTotal());
return responseResult;
}
/**
* 对象类型响应消息
* @param data
* @return
*/
public ResponseResult getResult(Object data) {
return ResponseResult.success(data);
}
}
| [
"[email protected]"
] | |
91854f4d724e54255bcc576d8a13ad5a13f2ac82 | a6003881eec8dffa202a93e54bea98ffb129252b | /Library Assistant/src/library/assistant/util/LibraryAssistantUtil.java | d57664d7e50d4008dd84088f7fa51b04d868367c | [] | no_license | clemesu1/LibraryManagementSystem | 4a09ecba643fd13b23da319799fa922a4a3856f1 | 53a3b2417348611659aa44a0b0eaaf13a7ca8ed7 | refs/heads/master | 2020-04-08T13:30:36.123286 | 2018-12-05T20:16:49 | 2018-12-05T20:16:49 | 159,394,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package library.assistant.util;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class LibraryAssistantUtil {
public static final String IMAGE_LOC = "/resources/LibraryAssistantIcon.png";
public static void setStageIcon(Stage stage) {
stage.getIcons().add(new Image(IMAGE_LOC));
}
} | [
"[email protected]"
] | |
b9d8e2770b920e5e2e05c14009950cf08361f915 | 62fe85ca61459aecf2f96fba314d6ec0f70271a3 | /src/main/java/net/xdclass/online_xdclass/intercepter/LoginInterceptor.java | 14d385f70b628f8043b1352a24be057415db17f6 | [] | no_license | zxc948406613/online_xdclass | 9c04d4aca41fd2d94434c8e356f882de9245ecad | adf99acdef0c0b383ed1e9b8a417d78773471ae5 | refs/heads/main | 2023-01-12T03:22:54.752355 | 2020-11-12T09:40:20 | 2020-11-12T09:40:20 | 312,230,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,998 | java | package net.xdclass.online_xdclass.intercepter;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.jsonwebtoken.Claims;
import net.xdclass.online_xdclass.utils.JsonData;
import net.xdclass.online_xdclass.utils.JwtUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
* @author suning
*/
public class LoginInterceptor implements HandlerInterceptor {
/**
* 进到controller前的拦截
*
* @param request
* @param response
* @param handler
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
try {
String accessToken = request.getHeader("token");
if (StringUtils.isEmpty(accessToken)) {
accessToken = request.getParameter("token");
}
if (StringUtils.isNotBlank(accessToken)) {
Claims claims = JwtUtils.checkJwt(accessToken);
if (claims == null) {
sendJsonMessage(response, JsonData.buildError("登录失败,重新登录"));
return false;
//登录失败,重新登录(解密失败,可能是过期)
}
Integer id = (Integer) claims.get("id");
String name = (String) claims.get("name");
request.setAttribute("user_id", id);
request.setAttribute("name", name);
return true;
}
} catch (Exception e) {
e.printStackTrace();
//登录失败
sendJsonMessage(response, JsonData.buildError("登录失败,重新登录"));
}
sendJsonMessage(response, JsonData.buildError("登录失败,重新登录"));
return false;
}
/**
* 相应JSON数据给前端
*
* @param response
* @param obj
*/
public static void sendJsonMessage(HttpServletResponse response, Object obj) {
try {
ObjectMapper objectMapper = new ObjectMapper();
response.setContentType("application/json; charset=UTF-8");
PrintWriter writer = response.getWriter();
writer.print(objectMapper.writeValueAsString(obj));
writer.close();
response.flushBuffer();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}
| [
"[email protected]"
] | |
ce3c02b15a902a789d4621a5219acdb9fd6703be | 35f343b8eb4f3c5c12f896a5a3a4556aca184fef | /app/src/androidTest/java/com/raj/fraction/ExampleInstrumentedTest.java | 60e217e4ff7887958c5bcfc63b37401bffc916c8 | [] | no_license | rajkonkret/Fraction2 | 4c7a096834ae52d14bc1a86300d0b9466b743a79 | 76b3cb7872ad9b3bea06d9dc8daff8ac9f863412 | refs/heads/master | 2020-11-24T09:41:08.698782 | 2019-12-31T17:21:08 | 2019-12-31T17:21:08 | 228,086,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package com.raj.fraction;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.raj.fraction", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
82cb8c4bb4773f82676db3cf87a69a58437d2fba | e5d0bb8e1af75645564b0982fde6b448acbb58bc | /BestGameEver/src/specialattacks/Splash.java | 41a26175f08c16bf292580917068939438c00118 | [] | no_license | GaryBlueOak/BestGameEver | 4b0fb4861524b0bc4e8b0d70331915ff111eb6d0 | 95d32f822dcfdb1a5443db927042c1c37b7a049d | refs/heads/master | 2016-09-06T10:30:04.095818 | 2015-01-18T04:20:21 | 2015-01-18T04:20:21 | 28,570,892 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package specialattacks;
import main.Character;
import main.Enemies;
public class Splash extends SpecialAttack {
public Splash(){
super();
}
@Override
public String getName() {
return "Splash";
}
@Override
public int getCost() {
// TODO Auto-generated method stub
return 0;
}
@Override
public String getInfo() {
// TODO Auto-generated method stub
return null;
}
@Override
public void use(Character c, Enemies e) {
System.out.println(c.getName() + " used Splash... but nothing happened.");
}
}
| [
"[email protected]"
] | |
d2239c67a360611812db9555c9b48b9ba2d52f25 | fb36b5cdc10ac8108a805655ebfce17d6db653ed | /Practice/src/VideoGameTD.java | 571feb66f7bcd59f0870f3bee53a7f6d89ec1744 | [] | no_license | Pranitha23-eng/java-learning-with-saketh | 768322a8244615b3699add6e6290a9c1d99d5db8 | 8ae6222c4eca334e9e0e96c8b90c59b21de35e17 | refs/heads/master | 2021-05-17T06:32:48.340064 | 2020-06-22T21:46:24 | 2020-06-22T21:46:24 | 250,675,030 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | public class VideoGameTD {
public static void main(String[] args) {
// TODO Auto-generated method stub
VideoGame v = new VideoGame();
VideoGame red = new RedBudHead();
red.addGame("redBudhead");
VideoGame candy = new CandyCrush();
candy.addGame("candyCrush");
red.printGame();
candy.printGame();
}
}
| [
"[email protected]"
] | |
6d3ec2a1062841b3803bcc415b4126a1dbf7976b | 582c65e8ecb313631c2287beac261b636432b3cb | /Java Project/WEB-INF/classes/fr/eni/encheres/bo/Article.java | 1a0e3a8f4ac8d6181c7f76b39dd497184f91a165 | [] | no_license | c1-ra/encheres | 118aac987c9a1d28ad33792d474a66404c7db2d8 | 6dc7f598a1921bdee81de3f83b93006eb700f019 | refs/heads/main | 2023-04-12T08:07:46.186337 | 2021-05-23T16:17:13 | 2021-05-23T16:17:13 | 363,438,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,828 | java | package fr.eni.encheres.bo;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
public class Article implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
private String nom;
private String description;
private LocalDate dateDebut;
private LocalDate dateFin;
private int prixInitial;
private int prixVente;
private Categorie categorie;
private Retrait retrait;
private Utilisateur utilisateur;
private List<Enchere> listeEncheres;
private int idEtatVente; //1 : non commencé, 2 : en cours, 3 : terminée
public Article() {
super();
categorie = new Categorie();
retrait = new Retrait();
utilisateur = new Utilisateur();
listeEncheres = new ArrayList<>();
}
// Avec tous les champs obligatoires pour insertion en bdd
// sans id, prixVente ((prix en cours)) est initialisé au prixInitial. Pour savoir si une enchère a été faite ou si la vente est terminée,
// se reporter à la date et à l'idEtatVente
public Article(String nom, String description, LocalDate dateDebut, LocalDate dateFin, int prixInitial,
int idCategorie, Retrait retrait, int idUtilisateur) {
this();
this.nom = nom;
this.description = description;
this.setDateDebut(dateDebut);
this.setDateFin(dateFin);
this.prixInitial = prixInitial;
this.prixVente = prixInitial;
this.categorie.setId(idCategorie);
this.retrait = retrait;
this.utilisateur.setId(idUtilisateur);
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the nom
*/
public String getNom() {
return nom;
}
/**
* @param nom the nom to set
*/
public void setNom(String nom) {
this.nom = nom;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the dateDebut
*/
public LocalDate getDateDebut() {
return dateDebut;
}
/**
* @param dateDebut the dateDebut to set
*/
public void setDateDebut(LocalDate dateDebut) {
this.dateDebut = dateDebut;
}
/**
* @return the dateFin
*/
public LocalDate getDateFin() {
return dateFin;
}
/**
* @param dateFin the dateFin to set
*/
public void setDateFin(LocalDate dateFin) {
this.dateFin = dateFin;
}
/**
* @return the prixInitial
*/
public int getPrixInitial() {
return prixInitial;
}
/**
* @param prixInitial the prixInitial to set
*/
public void setPrixInitial(int prixInitial) {
this.prixInitial = prixInitial;
}
/**
* @return the prixVente
*/
public int getPrixVente() {
return prixVente;
}
/**
* @param prixVente the prixVente to set
*/
public void setPrixVente(int prixVente) {
this.prixVente = prixVente;
}
/**
* @return the categorie
*/
public Categorie getCategorie() {
return categorie;
}
/**
* @param categorie the categorie to set
*/
public void setCategorie(Categorie categorie) {
this.categorie = categorie;
}
/**
* @return the categorie
*/
public Retrait getRetrait() {
return retrait;
}
/**
* @param categorie the categorie to set
*/
public void setRetrait(Retrait retrait) {
this.retrait = retrait;
}
/**
* @return the utilisateur
*/
public Utilisateur getUtilisateur() {
return utilisateur;
}
/**
* @param idUtilisateur the idUtilisateur to set
*/
public void setUtilisateur(Utilisateur utilisateur) {
this.utilisateur = utilisateur;
}
/**
* @return the listeEncheres
*/
public List<Enchere> getListeEncheres() {
return listeEncheres;
}
/**
* @param listeEncheres the listeEncheres to set
*/
public void setListeEncheres(List<Enchere> listeEncheres) {
this.listeEncheres = listeEncheres;
}
/**
* @return the etatVente
*/
public int getIdEtatVente() {
return idEtatVente;
}
/**
* @param etatVente the etatVente to set
*/
public void setIdEtatVente(int idEtatVente) {
this.idEtatVente = idEtatVente;
}
@Override
public String toString() {
String str = "Article [id=" + id + ", nom=" + nom + ", description=" + description + ", dateDebut=" + dateDebut + ", dateFin=" + dateFin +
", prixInitial=" + prixInitial + "prixVente=" + prixVente + ", categorie=" + categorie.getId() + ", retrait=" + retrait.toString() + ", idUtilisateur=" + utilisateur.getId() + ", pseudoUtilisateur=" + utilisateur.getPseudo() + "]";
return str;
}
}
| [
"[email protected]"
] | |
f9ef8f9a0f734bee7d9dbb04d044d380eee6626d | 6b721c2f337978b8a346d4f8e57eb4ad12730a0c | /src/main/java/com/yiban/erp/exception/GlobalExceptionHandler.java | cdf062f1b20549ba6739e506dfa683d12d3fe6cf | [] | no_license | qintian95/newyb | f3534ac6326d3560d41828290480b1aae295feab | 5e264dd30f06fe2c1bacc7e91aeb0c75dd1ecc7e | refs/heads/master | 2020-06-20T02:14:42.973618 | 2018-09-11T09:43:40 | 2018-09-11T09:43:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,151 | java | package com.yiban.erp.exception;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.tomcat.util.http.fileupload.FileUploadBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartException;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
@ControllerAdvice
public class GlobalExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
private static final Integer DEFAULT_CODE = 9999;
private static final String DEFAULT_MESSAGE = "系统异常,请稍后再试";
private static final Integer DEFAULT_DISPLAY = ErrorDisplay.MESSAGE.getCode();
@ExceptionHandler(BizException.class)
@ResponseBody
public ResponseEntity<JSON> handleBizException(HttpServletRequest request, BizException e) {
String url = request.getRequestURL().toString();
logger.warn("Request action url:{} have an BizException:", url, e.getErrorCode());
ErrorInfo errorInfo = getErrorInfo(e.getErrorCode(), url, getExtraJson(e.getExtra()));
return ResponseEntity.badRequest().body((JSON) JSON.toJSON(errorInfo));
}
@ExceptionHandler(BizRuntimeException.class)
@ResponseBody
public ResponseEntity<JSON> handleBizRuntimeException(HttpServletRequest request, BizRuntimeException e) {
String url = request.getRequestURL().toString();
logger.error("Request action url:{} have an BizRuntimeException:", url, e);
ErrorInfo errorInfo = getErrorInfo(e.getErrorCode(), url, getExtraJson(e.getExtra()));
return ResponseEntity.badRequest().body((JSON) JSON.toJSON(errorInfo));
}
/**
* 访问权限异常
* HttpStatus 403
*/
@ExceptionHandler(PermissionException.class)
@ResponseBody
public ResponseEntity<JSON> handlePermissionException(HttpServletRequest request, PermissionException e) {
String url = request.getRequestURL().toString();
logger.warn("Request action url:{} have an BizRuntimeException:", url, e.getErrorCode());
ErrorInfo errorInfo = getErrorInfo(e.getErrorCode(), url, getExtraJson(e.getExtra()));
return new ResponseEntity((JSON) JSON.toJSON(errorInfo), HttpStatus.FORBIDDEN);
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ResponseBody
@ExceptionHandler(MultipartException.class)
public ResponseEntity<JSON> handleMultipartException(HttpServletRequest request, MultipartException exception) {
if (exception == null) {
return ResponseEntity.badRequest().build();
}
String url = request.getRequestURL().toString();
logger.error("update file fail. ", exception);
if (exception.getCause() != null && exception.getCause().getCause() != null &&
exception.getCause().getCause() instanceof FileUploadBase.SizeLimitExceededException) {
ErrorInfo errorInfo = getErrorInfo(ErrorCode.FILE_UPLOAD_SIZE_ERROR, url, null);
return ResponseEntity.badRequest().body((JSON) JSON.toJSON(errorInfo));
}else {
ErrorInfo errorInfo = getErrorInfo(ErrorCode.FILE_UPLOAD_FAIL, url, null);
return ResponseEntity.badRequest().body((JSON) JSON.toJSON(errorInfo));
}
}
/**
* 未定义异常
* HttpStatus 500
*/
@ExceptionHandler(Exception.class)
@ResponseBody
public ResponseEntity<JSON> handleDefaultException(HttpServletRequest request, Exception e) {
String url = request.getRequestURL().toString();
logger.error("Request action url:{} have an Exception:", url, e);
ErrorInfo errorInfo = getErrorInfo(null, url, getExtraJson(e.toString()));
return new ResponseEntity((JSON) JSON.toJSON(errorInfo), HttpStatus.INTERNAL_SERVER_ERROR);
}
private ErrorInfo getErrorInfo(ErrorCode errorCode, String url, JSON extra) {
return errorCode == null ? getDefaultErrorInfo(url, extra) :
getByErrorCode(errorCode, url, extra);
}
private ErrorInfo getByErrorCode(ErrorCode errorCode, String url, JSON extra) {
ErrorInfo errorInfo = new ErrorInfo();
errorInfo.setCode(errorCode.getCode());
errorInfo.setMessage(errorCode.getMessage());
errorInfo.setDisplay(errorCode.getDisplay() == null ? DEFAULT_DISPLAY : errorCode.getDisplay().getCode());
errorInfo.setUrl(url);
errorInfo.setTimestamp(new Date());
errorInfo.setData(extra);
return errorInfo;
}
private ErrorInfo getDefaultErrorInfo(String url, JSON extra) {
ErrorInfo errorInfo = new ErrorInfo();
errorInfo.setCode(DEFAULT_CODE);
errorInfo.setMessage(DEFAULT_MESSAGE);
errorInfo.setDisplay(DEFAULT_DISPLAY);
errorInfo.setTimestamp(new Date());
errorInfo.setData(extra);
errorInfo.setUrl(url);
return errorInfo;
}
private JSON getExtraJson(Object extra) {
if (extra == null) {
return null;
}
JSON result = null;
if (extra instanceof String) {
JSONObject extraInfo = new JSONObject();
extraInfo.put("message", extra);
result = extraInfo;
}else {
try{
result = (JSON) JSON.toJSON(extra);
}catch (Exception e) {
logger.error("extra parse to json fail, extra:{}", extra.toString());
JSONObject extraInfo = new JSONObject();
extraInfo.put("message", extra);
result = extraInfo;
}
}
return result;
}
}
| [
"[email protected]"
] | |
bbf290bb9d4ea91506881cbdffe693c7500ed940 | 11000ba0797e9add6d116d1a176613d9a8df1302 | /src/com/web/servlet/GetNotice.java | 4aa26f30c70fea7055037e9caeb90216e41acf90 | [] | no_license | NieZhenZ/Question-Bank-Management-System | 0069f0af8ceded4ae9ecf400169c4c45f76bcb78 | edda3762e8bc2c99b5d6dff223b122fb50b0d8c3 | refs/heads/master | 2022-11-11T14:29:52.083781 | 2020-06-21T03:00:57 | 2020-06-21T03:00:57 | 273,821,762 | 1 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,024 | java | package com.web.servlet;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.service.NoticeBiz;
public class GetNotice extends HttpServlet {
private static final long serialVersionUID = 1L;
public GetNotice() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String information = "ÔÝÎÞй«¸æ";
NoticeBiz nb = new NoticeBiz();
try {
information = nb.select();
} catch (SQLException e) {
e.printStackTrace();
}
OutputStream os = response.getOutputStream();
os.write(information.getBytes());
os.flush();
os.close();
}
} | [
"[email protected]"
] | |
ab4cd4b90052893ffa0614d71d785f9a5e5699fb | b4353989ba428da3d32da678af41585ee9239fd3 | /src/algorithm/genetic/GeneticAlgorithm.java | bf9c119cd13f1637b5da15ad303a73383d1ca84c | [] | no_license | rafaeltoyo/ag-si-2018-1 | 73f2f4838a7942215dad07286cd5670a19140469 | bda6ab24decc022f021b11bfa38c2a74e1130c9e | refs/heads/master | 2020-03-24T21:45:06.531664 | 2018-05-08T03:09:50 | 2018-05-08T03:09:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,148 | java | package algorithm.genetic;
import controller.OutputController;
public class GeneticAlgorithm
{
private GaPopulation population;
private int generation = 0;
private int maxGen = -1;
public GeneticAlgorithm(GaPopulation population) {
this.population = population;
}
public GeneticAlgorithm(GaPopulation population, int maxGen) {
this(population);
this.maxGen = maxGen;
}
public Chromosome run() throws CloneNotSupportedException
{
// População 'D'
GaPopulation children;
// Calcula Fitness
this.population.eval();
do {
// Seleciona para reprodução
children = this.population.children();
// Reprodução: Cruzamento (crossover simples) e mutação uniforme
(new Crossover(children)).exec();
// Calcula Fitness
children.eval();
// Nova População = melhores entre pais e filhos
this.population.evolve(children);
// Incrementa Geração
this.generation++;
// PRINT @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if (OutputController.getInstance().useControle()) {
System.out.println("Generation: " + this.generation);
this.population.print();
System.out.println("");
}
OutputController.getInstance().print(this.generation + "\t" + Float.toString(this.population.getBest().fitness()));
// Atingiu condição de Parada?
} while (!this.stop());
// Retorna melhor cromossomo
return this.population.getBest().clone();
}
/**
* todo indicar se a execução do algoritmo deverá parar
* @return Stop condition
*/
protected boolean stop()
{
return (this.getMaxGen() >= 0 && this.getMaxGen() <= this.getGeneration());
}
public int getGeneration() { return generation; }
public int getMaxGen() { return maxGen; }
public void setMaxGen(int maxGen) { this.maxGen = maxGen; }
}
| [
"[email protected]"
] | |
8bc158c06f2193732d7dec892b5deeaaf8cf6799 | f4f109de7f3dcbc5d56804a81043a9eaa818eefe | /app/src/main/java/com/example/facefun/ui/main/PlaceholderFragment.java | 628a9c41380dd7a44e37abfde5edb3f852039127 | [] | no_license | Umar-Awan/facefun2 | 604e1ce8f06a6044f4a881ba16e7ea7aac1fd972 | 2d04a7f122abfd36801d4ffc107de395c8b6bfd5 | refs/heads/master | 2022-12-05T13:53:46.671911 | 2020-08-22T16:07:16 | 2020-08-22T16:07:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,846 | java | package com.example.facefun.ui.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.facefun.R;
/**
* A placeholder fragment containing a simple view.
*/
public class PlaceholderFragment extends Fragment {
private static final String ARG_SECTION_NUMBER = "section_number";
private PageViewModel pageViewModel;
public static PlaceholderFragment newInstance(int index) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle bundle = new Bundle();
bundle.putInt(ARG_SECTION_NUMBER, index);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageViewModel = ViewModelProviders.of(this).get(PageViewModel.class);
int index = 1;
if (getArguments() != null) {
index = getArguments().getInt(ARG_SECTION_NUMBER);
}
pageViewModel.setIndex(index);
}
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_main, container, false);
final TextView textView = root.findViewById(R.id.section_label);
pageViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"[email protected]"
] | |
0edbdab6d470a3bfa99e4d1746404ea4407baa94 | 6705717315a9303d06d41f22c8cbb783aa77f8a1 | /exercise32/src/main/java/baseline/Solution32.java | 7e4379eb3d28fb21b727fdea810a699a9110234f | [] | no_license | Cod1nglsH6rd/tran-a03 | e4ef505506e6d230831aa84261a0719ae4cc7b0e | 2eaf68ef8db68d9d95ce240d80add0586f8a66d3 | refs/heads/main | 2023-08-15T22:33:32.478215 | 2021-10-04T00:12:07 | 2021-10-04T00:12:07 | 408,944,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,885 | java | /*
* UCF COP3330 Fall 2021 Assignment 3 Solution
* Copyright 2021 Gialam Tran
*/
package baseline;
/*
Ask for the level of difficulty
Level 1 = 1-10
Level 2 = 1-100
Level 3 = 1-1000
Randomize the number that is being guessed
Ask for their guess
Compare the guess and their guess
If too low
Output their guess is too low
If too high
Output their guess is too high
If correct
Output the number of guesses they took and that they got it right.
*/
public class Solution32
{
public static void main(String[] args)
{
// initalize variables
int difficulty, randNum, guess;
// set status to playing
boolean isPlaying = true;
while(isPlaying)
{
// prompt user for difficulty
System.out.println("Let's play guess the number!");
System.out.println("Enter the difficulty level (1, 2, 3): ");
difficulty = guessingGame.getDifficulty();
// generate random number according to difficulty
randNum = guessingGame.getRandNum(difficulty);
System.out.print("I have my number. What's your guess? ");
guess = guessingGame.getGuess();
int guessCount = 1;
// re-prompt user if guess is incorrect
while(!guessingGame.checkGuess(guess, randNum).equals("You got it "))
{
System.out.print(guessingGame.checkGuess(guess, randNum));
guess = guessingGame.getGuess();
guessCount += 1;
}
System.out.print(guessingGame.checkGuess(guess, randNum));
// ask user for replay
System.out.print("do you want to play again? (y/n) ");
char choice= guessingGame.getChoice();
if(choice == 'n')
{
isPlaying = false;
}
}
}
} | [
"Cod1nglsH6rd"
] | Cod1nglsH6rd |
62f8627f7a624104f89a5d9020cbcd22288a4917 | 83fd1ffa643ade1e352d667f80c1922888a0daa7 | /pfl-dynamic/src/main/java/org/glassfish/pfl/dynamic/copyobject/spi/Copy.java | 1fe33f49e3cf7fe080e78b3c4208fdb9f61c1dfc | [
"Classpath-exception-2.0",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-generic-export-compliance",
"BSD-3-Clause",
"EPL-2.0"
] | permissive | eclipse-ee4j/orb-gmbal-pfl | 33262720a79318130506bb6cb8385adaba37e7b2 | e7abc1da6b7f7c3f125de6b6fc3e13d322f7aa6f | refs/heads/master | 2023-08-15T09:03:27.806611 | 2022-12-19T14:06:49 | 2022-12-19T14:06:49 | 147,513,231 | 3 | 15 | BSD-3-Clause | 2022-12-19T14:08:32 | 2018-09-05T12:20:18 | Java | UTF-8 | Java | false | false | 859 | java | /*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.glassfish.pfl.dynamic.copyobject.spi ;
import java.lang.annotation.Documented ;
import java.lang.annotation.ElementType ;
import java.lang.annotation.Target ;
import java.lang.annotation.Retention ;
import java.lang.annotation.RetentionPolicy ;
/** Annotation used on fields to indicate how they should be copied,
* according to the value of CopyType.
*/
@Documented
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Copy {
CopyType value() default CopyType.RECURSE ;
}
| [
"[email protected]"
] | |
5a3b0d6310a4551588429f4ab804067e0c169cba | c952de8a5530777456666b04103a5b1accb9178e | /SalaireBrutNet.java | 7b4beec56a6da724770a5b776d9d9409210d1b1e | [] | no_license | JR-2897/ProjetCalculatrice | 351bfd384ff4e5e54b7c9a881fc90c708131be96 | 6d1cc9234f160f8ecf2e0d202abd36b915d9c3e4 | refs/heads/master | 2021-05-11T18:04:03.349605 | 2018-01-19T10:33:38 | 2018-01-19T10:33:38 | 117,811,283 | 0 | 0 | null | 2018-01-18T12:44:22 | 2018-01-17T09:01:43 | Java | UTF-8 | Java | false | false | 1,136 | java | import java.util.Scanner;
public class SalaireBrutNet {
/*@SuppressWarnings("resource")
public static void main(String[] args) {
double SalaireAnnuel, SalaireMensuel, SalaireJournalier, SalaireHeure, Salaire;
Scanner Saisie = new Scanner(System.in);
System.out.println("Tapez votre salaire annuel brut");
Salaire = Saisie.nextInt();
System.out.println("Pour un salaire annuel brut de: " + Salaire + "\n");
SalaireAnnuel = Salaire / 1.23;
SalaireMensuel = SalaireAnnuel / 12;
SalaireJournalier = SalaireMensuel / 20;
SalaireHeure = SalaireJournalier / 7;
System.out.println("Salaire Annuel: " + SalaireAnnuel + "\n");
System.out.println("Salaire Mensuel: " + SalaireMensuel + "\n");
System.out.println("Salaire Journalier: " + SalaireJournalier + "\n");
System.out.println("Salaire Heure: " + SalaireHeure);
}*/
public int Annee(int Salaire){
return Salaire / 1.23;
}
public int Mois(int Salaire){
return Annee(Salaire) / 12;
}
public int Journee(int Salaire){
return Mois(Salaire)/20;
}
public int Heure(int Salaire){
return Journee(Salaire)/7;
}
}
| [
"[email protected]"
] | |
09b9f34534bdc6230e4af7d4191be889c34181b2 | 989163b3c5f670c2b54f402913092096ade6078f | /src/com/samik/searchController/GeneralDataMapper.java | 9140de94f01f2691f4539166442529a0d57bc1f8 | [] | no_license | samik007/SpringProjectHersley | dad2bd8148315cafff8b9e003587cc6083e33ae5 | d6757c2ae00109caafeddee3f19a61e64bf65f13 | refs/heads/master | 2020-04-15T06:40:26.843480 | 2019-01-07T17:48:17 | 2019-01-07T17:48:17 | 164,468,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | package com.samik.searchController;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
public class GeneralDataMapper implements RowMapper<General>{
@Override
public General mapRow(ResultSet rs, int rowNum) throws SQLException {
General general = new General();
general.setUnit_type(rs.getString("unit_type"));
general.setBuilt_new(rs.getString("built_new"));
general.setMac_id(rs.getString("mac_id"));
general.setBuilder(rs.getString("builder"));
general.setAei_tag(rs.getString("aei_tag"));
general.setOwner(rs.getString("owner"));
general.setEqp_id(rs.getString("eqp_id"));
general.setMin_curve(rs.getString("min_curve"));
general.setSpeed(rs.getString("speed"));
return general;
}
}
| [
"[email protected]"
] | |
61c2e859b4e6d93dc066ec72c96645a2ad099d6c | 5e75d49f6d6ebdd5089c8c4aa8178d9f50402473 | /Programming_and_Basics_JAVA/Loops_While_Lab/Sequence2K.java | 2fd33ae5c0b11d98dc3b479ca199e566ef1bf460 | [] | no_license | mbojidarov/SoftwareUniversity | 3bf4a73b033cb1642c5170bff3a4d12830d2c971 | ec2bb9412c15356dd320af2ae4a65f4f859165b8 | refs/heads/main | 2023-02-11T11:21:28.128095 | 2021-01-07T15:12:48 | 2021-01-07T15:12:48 | 300,281,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | import java.util.Scanner;
public class Sequence2K {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int input = Integer.parseInt(scanner.nextLine());
int output = 1;
while (output <= input){
System.out.println(output);
output = output * 2 + 1;
}
}
}
| [
"[email protected]"
] | |
dea3b3466af591343fa81ba79a8cd3444725a3ed | 33c5bcab5318075196a0ae1cc59e687fdcb95c15 | /src/main/java/adrestia/dao/service/ServiceManager.java | 675c6aa6c71cb8c02a2ad5c7a77de72463f82a83 | [
"Apache-2.0"
] | permissive | Areed24/Adrestia | f4d84585900c624a5787389e748741a688c94c30 | 44bc6a1c84c6a67369f51b9dcd106577516ca37f | refs/heads/master | 2021-05-11T02:32:11.737175 | 2018-01-05T18:42:39 | 2018-01-05T18:42:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,808 | java | /*
Apache2 License Notice
Copyright 2017 Alex Barry
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 adrestia;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.PreDestroy;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.zeromq.ZContext;
import org.zeromq.ZMQ.PollItem;
import org.zeromq.ZMQ.Poller;
import org.zeromq.ZMQ.Socket;
import org.zeromq.ZMQ;
import org.zeromq.ZPoller;
/**
* Uses the Consul Discovery Client to find Service Instances.
*/
@Component
public class ServiceManager implements ServiceManagerInterface {
// How long should entries stay in the redlist
@Value("${server.zmq.redlist.duration}")
private int redlistDuration;
// How long should entries stay in the greylist
@Value("${server.zmq.greylist.duration}")
private int greylistDuration;
// How long should entries stay in the blacklist
@Value("${server.zmq.blacklist.duration}")
private int blacklistDuration;
// Consul Client for executing Service Discovery
@Autowired
DiscoveryClient consulClient;
// Utility Provider, providing us with basic utility methods
@Autowired
UtilityProviderInterface utils;
// Service Manager Logger
private final Logger logger = LogManager.getLogger("adrestia.ServiceManager");
// cache to hold blacklisted CLyman hosts
// Keys will expire after 5 minutes, at which point Consul should be able
// to determine if the service is active or inactive.
Cache<String, String> blacklist = null;
// Cache to hold greylisted CLyman hosts
// Keys will expire after 30 seconds, if we report another failure in this
// time then the service will be blacklisted
Cache<String, String> greylist = null;
// Cache to hold redlisted CLyman hosts
// Keys will expire after 5 seconds, if we report another failure in this
// time then the service will be blacklisted
Cache<String, String> redlist = null;
/**
* Default empty ServiceManager constructor.
*/
public ServiceManager() {
super();
logger.debug("RedList Duration: " + redlistDuration);
logger.debug("GreyList Duration: " + greylistDuration);
logger.debug("BlackList Duration: " + blacklistDuration);
}
private void initializeCaches() {
blacklist = CacheBuilder.newBuilder()
.expireAfterWrite(blacklistDuration, TimeUnit.SECONDS)
.maximumSize(60)
.build();
greylist = CacheBuilder.newBuilder()
.expireAfterWrite(greylistDuration, TimeUnit.SECONDS)
.maximumSize(50)
.build();
redlist = CacheBuilder.newBuilder()
.expireAfterWrite(redlistDuration, TimeUnit.SECONDS)
.maximumSize(40)
.build();
}
// Setup method to find and connect to an instance of a specified service name
private ServiceInstance findService(String serviceName) {
if (redlist == null) {
initializeCaches();
}
ServiceInstance returnService = null;
logger.info("Finding a new Service instance");
logger.debug("RedList Size: " + redlist.size());
logger.debug("GreyList Size: " + greylist.size());
logger.debug("BlackList Size: " + blacklist.size());
// Find an instance of CrazyIvan
List<ServiceInstance> serviceInstances =
consulClient.getInstances(serviceName);
if (serviceInstances != null) {
//Log if we find no service instances
if (serviceInstances.size() == 0) {
logger.error("No Service instances found");
}
// Find a service Instance
// Start by getting a random start index
int startIndex = utils.getRandomInt(serviceInstances.size());
for (int i = 0; i < serviceInstances.size(); i++) {
// Correct our compare index for the start index
int currentIndex = i + startIndex;
if (currentIndex >= serviceInstances.size()) {
currentIndex = currentIndex - serviceInstances.size();
}
// Pull the service instance, and the value from the blacklist
returnService = serviceInstances.get(currentIndex);
String instanceString = returnService.getUri().toString().trim();
logger.debug("Found Service Instance: " + instanceString);
logger.debug("Blacklist: " + blacklist.asMap().keySet().toString());
logger.debug("Redlist: " + redlist.asMap().keySet().toString());
// We can go ahead and connect to the instance as long as it isn't
// on the blacklist
if (blacklist.asMap().containsKey(instanceString)
|| redlist.asMap().containsKey(instanceString)) {
logger.error("Invalid host found");
returnService = null;
} else {
return returnService;
}
}
} else {
logger.error("Unable to find Service instance");
}
return returnService;
}
/**
* Report a Service Failure.
* @param connectedInstance A ServiceInstance object with failed instance info
*/
@Override
public void reportFailure(ServiceInstance connectedInstance) {
logger.info("Reporting Service Instance Failure");
// Is the current host already on the greylist?
try {
String instanceString = connectedInstance.getUri().toString().trim();
if (greylist.asMap().containsKey(instanceString)) {
// We have found an entry in the greylist, add the host to the blacklist
blacklist.put(instanceString, instanceString);
} else {
// We have no entry in the greylist, add the hostname to the greylist and redlist
greylist.put(instanceString, instanceString);
redlist.put(instanceString, instanceString);
}
} catch (Exception e) {
logger.error("Error reporting service failure");
logger.error(e.getMessage());
}
logger.debug("RedList Size: " + redlist.size());
logger.debug("GreyList Size: " + greylist.size());
logger.debug("BlackList Size: " + blacklist.size());
}
/**
* Find an instance of Crazy Ivan.
* @return A ServiceInstance object with the instance details found
*/
@Override
public ServiceInstance findCrazyIvan() {
// Actually try to send the message
try {
return findService("Ivan");
} catch (Exception e) {
logger.error("Error retrieving service: ", e);
}
return null;
}
/**
* Find an instance of CLyman.
* @return A ServiceInstance object with the instance details found
*/
@Override
public ServiceInstance findClyman() {
// Actually try to send the message
try {
return findService("Clyman");
} catch (Exception e) {
logger.error("Error retrieving service: ", e);
}
return null;
}
}
| [
"[email protected]"
] | |
382dc864338cae13a8efdb7198758a4df6dab2ba | 7876577730cb92b0ea54f4cec9f0419a40016768 | /PERSPECTIVE/src/component/nc/uap/lfw/form/FormElementObjFigure.java | e7974bdc705c980687fc6fc3402dab274d3e8ba5 | [] | no_license | thimda/rsd_tools | 7cd5dbdfec6d813c186033e3f7e8f775d1fddd58 | e0826ab7b353b8e6dbc565da0e94e831dc5ae2bd | refs/heads/master | 2021-01-19T10:12:20.371157 | 2012-03-25T08:45:19 | 2012-03-25T08:45:19 | 3,823,190 | 1 | 2 | null | null | null | null | GB18030 | Java | false | false | 991 | java | package nc.uap.lfw.form;
import nc.lfw.editor.common.LFWBaseRectangleFigure;
import nc.lfw.editor.common.LfwElementObjWithGraph;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;
/**
* form组件图
* @author zhangxya
*
*/
public class FormElementObjFigure extends LFWBaseRectangleFigure{
private static Color bgColor = new Color(null, 233, 176, 66);
public FormElementObjFigure(LfwElementObjWithGraph ele){
super(ele);
setTypeLabText("<<表单>>");
setBackgroundColor(bgColor);
FormElementObj formobj = (FormElementObj) ele;
setTitleText(formobj.getFormComp().getId(), formobj.getFormComp().getId());
markError(formobj.validate());
Point point = formobj.getLocation();
int x, y;
if(point != null){
x = point.x;
y = point.y;
}else{
x = 100;
y = 100;
}
setBounds(new Rectangle(x, y, 150, 150));
}
protected String getTypeText() {
return "<<表单>>";
}
}
| [
"[email protected]"
] | |
e7f1a3be529880e7f3801669da04a1a95b103534 | 53a068761cdbe0c3c27f00ac7a0e4ae599db9f18 | /src/main/java/projectI/AST/Expressions/AdditionOperator.java | bce067fef4164c5724a1fd564c8605bf1033f95f | [] | no_license | Dantara/project-I | a7ad7262ace3fd9504b9537494fc824b971314c7 | a09111f59ab47c2b8b2eb149362d3dfe2675eeea | refs/heads/master | 2022-12-26T21:50:40.133960 | 2020-10-14T06:23:13 | 2020-10-14T06:23:13 | 289,045,352 | 1 | 1 | null | 2020-10-14T06:23:14 | 2020-08-20T15:41:48 | Java | UTF-8 | Java | false | false | 84 | java | package projectI.AST.Expressions;
public enum AdditionOperator {
PLUS, MINUS
}
| [
"[email protected]"
] | |
8fafe9424a51e25b63e7b7dac59dabfb78b115f9 | 39519eda77d3c76674993709959671e612d4c1a6 | /service-user/src/main/java/com/mengchao/user/controller/UserController.java | 5339d1e2eda3535df5aa3c697ce41bedf6427bc1 | [] | no_license | mengchao1996/springcloud | 2cd7abb758fe344136e6cc3e61adcca5568ce401 | 3dd9c3f5fdca479efa9efc90034b9ae9af796681 | refs/heads/master | 2022-06-26T06:40:24.306605 | 2020-04-26T13:43:13 | 2020-04-26T13:43:13 | 259,038,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package com.mengchao.user.controller;
import com.mengchao.user.pojo.User;
import com.mengchao.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/*
* @ClassName UserController
* @Author MengChao
* @Date 2020/4/21 14:44
**/
@RestController
@RequestMapping("/user/")
@Slf4j
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/getUserNameById")
public String getUserNameById(@RequestParam("id") Integer id){
return userService.getUserNameById(id);
}
@RequestMapping("/getUserById")
public User getUserById(@RequestParam("id") Integer id){
log.info("userId:{}",id);
return userService.getUserById(id);
}
@RequestMapping("/getUserByUser")
public String getUserByUser(@RequestBody User user){
log.info("userId:{}",user.getId());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return userService.getUserNameById(user.getId());
}
}
| [
"[email protected]"
] | |
0a7a0577e99cac2c694ae17e28f6f1f8a6d10437 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Chart-9/org.jfree.data.time.TimeSeries/BBC-F0-opt-90/28/org/jfree/data/time/TimeSeries_ESTest.java | fa4295a66525fbb22a406eda9160e5104148e527 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 107,606 | java | /*
* This file was automatically generated by EvoSuite
* Fri Oct 22 23:50:03 GMT 2021
*/
package org.jfree.data.time;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.awt.MultipleGradientPaint;
import java.math.BigInteger;
import java.time.Instant;
import java.time.chrono.ChronoLocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.SimpleTimeZone;
import java.util.Stack;
import java.util.TimeZone;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLayeredPane;
import javax.swing.JList;
import javax.swing.JTextPane;
import javax.swing.plaf.metal.MetalComboBoxEditor;
import javax.swing.table.DefaultTableModel;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.mock.java.time.MockInstant;
import org.evosuite.runtime.mock.java.util.MockDate;
import org.evosuite.runtime.mock.java.util.MockGregorianCalendar;
import org.jfree.data.statistics.SimpleHistogramBin;
import org.jfree.data.time.Day;
import org.jfree.data.time.FixedMillisecond;
import org.jfree.data.time.Hour;
import org.jfree.data.time.Millisecond;
import org.jfree.data.time.Minute;
import org.jfree.data.time.Month;
import org.jfree.data.time.Quarter;
import org.jfree.data.time.RegularTimePeriod;
import org.jfree.data.time.Second;
import org.jfree.data.time.SimpleTimePeriod;
import org.jfree.data.time.SpreadsheetDate;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesDataItem;
import org.jfree.data.time.Week;
import org.jfree.data.xy.XYDataItem;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class TimeSeries_ESTest extends TimeSeries_ESTest_scaffolding {
@Test(timeout = 4000)
public void test000() throws Throwable {
MockDate mockDate0 = new MockDate(0L);
TimeZone timeZone0 = TimeZone.getTimeZone("");
Day day0 = new Day(mockDate0, timeZone0);
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, "", "", class0);
timeSeries0.hashCode();
assertEquals("", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test001() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond((-604L));
Class<ChronoLocalDate> class0 = ChronoLocalDate.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
timeSeries0.setMaximumItemCount(1);
TimeSeries timeSeries1 = (TimeSeries)timeSeries0.clone();
timeSeries1.setMaximumItemCount(2);
boolean boolean0 = timeSeries0.equals(timeSeries1);
assertEquals(2, timeSeries1.getMaximumItemCount());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test002() throws Throwable {
TimeSeries timeSeries0 = new TimeSeries("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
TimeSeries timeSeries1 = new TimeSeries("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
timeSeries1.setMaximumItemAge(1133L);
boolean boolean0 = timeSeries1.equals(timeSeries0);
assertEquals(1133L, timeSeries1.getMaximumItemAge());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test003() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add((RegularTimePeriod) day0, (Number) 53, true);
TimeSeries timeSeries1 = timeSeries0.createCopy(regularTimePeriod0, regularTimePeriod0);
assertEquals(0, timeSeries1.getItemCount());
assertEquals(Integer.MAX_VALUE, timeSeries1.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries1.getMaximumItemAge());
assertEquals("Time", timeSeries1.getDomainDescription());
assertEquals("Value", timeSeries1.getRangeDescription());
}
@Test(timeout = 4000)
public void test004() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 53);
assertNull(timeSeriesDataItem0);
TimeSeries timeSeries1 = timeSeries0.createCopy(regularTimePeriod0, regularTimePeriod0);
assertEquals(1, timeSeries1.getItemCount());
assertEquals(9223372036854775807L, timeSeries1.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test005() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (-4140.86));
timeSeries0.delete(regularTimePeriod0);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test006() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
Locale locale0 = Locale.FRENCH;
MockGregorianCalendar mockGregorianCalendar0 = new MockGregorianCalendar(locale0);
Date date0 = mockGregorianCalendar0.getGregorianChange();
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(date0);
RegularTimePeriod regularTimePeriod0 = fixedMillisecond0.next();
timeSeries0.addOrUpdate(regularTimePeriod0, 4176.0);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) fixedMillisecond0, (-1.7976931348623157E308));
assertNull(timeSeriesDataItem0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test007() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add((RegularTimePeriod) day0, (Number) 53, false);
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
timeSeries0.addOrUpdate(regularTimePeriod0, (Number) 53);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test008() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
timeSeries0.add((RegularTimePeriod) day0, (Number) 1, false);
timeSeries0.update(regularTimePeriod0, (Number) 53);
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test009() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 53);
assertNull(timeSeriesDataItem0);
Number number0 = timeSeries0.getValue(regularTimePeriod0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(53, number0);
assertNotNull(number0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test010() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 1, true);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 1);
assertNull(timeSeriesDataItem0);
timeSeries0.getTimePeriodsUniqueToOtherSeries(timeSeries0);
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test011() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem(day0, (Number) null);
timeSeries0.add(timeSeriesDataItem0, true);
TimeSeriesDataItem timeSeriesDataItem1 = timeSeries0.getDataItem(regularTimePeriod0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertNotSame(timeSeriesDataItem1, timeSeriesDataItem0);
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertNotNull(timeSeriesDataItem1);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test012() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add((RegularTimePeriod) day0, (Number) 53, false);
timeSeries0.addOrUpdate(regularTimePeriod0, (double) 1);
timeSeries0.setMaximumItemCount(0);
assertEquals(0, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test013() throws Throwable {
Week week0 = new Week();
Class<FixedMillisecond> class0 = FixedMillisecond.class;
TimeSeries timeSeries0 = new TimeSeries(week0, "=^K~v\"<=9", "", class0);
timeSeries0.setRangeDescription("");
assertEquals("=^K~v\"<=9", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test014() throws Throwable {
MockDate mockDate0 = new MockDate(333L);
Minute minute0 = new Minute(mockDate0);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) minute0, (double) 0);
TimeSeries timeSeries0 = new TimeSeries(timeSeriesDataItem0);
timeSeries0.setDomainDescription((String) null);
timeSeries0.setDomainDescription("8BWSC{!T@sZ");
assertEquals("8BWSC{!T@sZ", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test015() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem(day0, (Number) null);
timeSeries0.add(timeSeriesDataItem0, true);
timeSeries0.update(1, (Number) 1);
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Value", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test016() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
BigInteger bigInteger0 = BigInteger.ZERO;
timeSeries0.add((RegularTimePeriod) day0, (Number) bigInteger0, false);
Number number0 = timeSeries0.getValue((RegularTimePeriod) day0);
assertNotNull(number0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Time", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test017() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
byte[] byteArray0 = new byte[4];
byteArray0[3] = (byte) (-1);
BigInteger bigInteger0 = new BigInteger(byteArray0);
timeSeries0.add((RegularTimePeriod) day0, (Number) bigInteger0, false);
Number number0 = timeSeries0.getValue((RegularTimePeriod) day0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertNotNull(number0);
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test018() throws Throwable {
Week week0 = new Week();
Class<Object> class0 = Object.class;
TimeSeries timeSeries0 = new TimeSeries(week0, "PCI0|bmW3q[^{6S", "", class0);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) week0, (Number) null);
assertNull(timeSeriesDataItem0);
timeSeries0.getValue(0);
assertEquals("PCI0|bmW3q[^{6S", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test019() throws Throwable {
MockDate mockDate0 = new MockDate(3L);
Class<ChronoLocalDate> class0 = ChronoLocalDate.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, class0);
timeSeries0.getTimePeriodClass();
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Value", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test020() throws Throwable {
MockDate mockDate0 = new MockDate();
Month month0 = new Month(mockDate0);
Class<MultipleGradientPaint.CycleMethod> class0 = MultipleGradientPaint.CycleMethod.class;
TimeSeries timeSeries0 = new TimeSeries(month0, class0);
timeSeries0.getTimePeriodClass();
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test021() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (-4140.862760798256));
assertEquals(2, timeSeries0.getItemCount());
timeSeries0.getTimePeriod(1);
assertEquals("Time", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test022() throws Throwable {
Class<TimeSeries> class0 = TimeSeries.class;
TimeSeries timeSeries0 = new TimeSeries("java.util.TimeZone", "java.util.TimeZone", (String) null, class0);
String string0 = timeSeries0.getRangeDescription();
assertNull(string0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("java.util.TimeZone", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test023() throws Throwable {
Day day0 = new Day();
Class<Integer> class0 = Integer.class;
TimeSeries timeSeries0 = new TimeSeries(day0, "", "", class0);
String string0 = timeSeries0.getRangeDescription();
assertEquals("", string0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test024() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0, false);
timeSeries0.getNextTimePeriod();
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test025() throws Throwable {
MockDate mockDate0 = new MockDate(0, 0, 0);
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, "P{'s7 c?", "P{'s7 c?", class0);
timeSeries0.setMaximumItemCount(0);
int int0 = timeSeries0.getMaximumItemCount();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test026() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
timeSeries0.setMaximumItemAge(0);
timeSeries0.getMaximumItemAge();
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test027() throws Throwable {
MockDate mockDate0 = new MockDate(3L);
Month month0 = new Month();
Class<RegularTimePeriod> class0 = RegularTimePeriod.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, class0);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) month0, (double) 3L);
assertNull(timeSeriesDataItem0);
timeSeries0.getItemCount();
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test028() throws Throwable {
MockDate mockDate0 = new MockDate(0, 1924, 59);
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(mockDate0);
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) fixedMillisecond0, (double) 1924);
assertNull(timeSeriesDataItem0);
Millisecond millisecond0 = new Millisecond();
timeSeries0.getIndex(millisecond0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("G@/", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("G@/", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test029() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 1, false);
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 1);
int int0 = timeSeries0.getIndex(regularTimePeriod0);
assertEquals(2, timeSeries0.getItemCount());
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test030() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
assertEquals("Time", timeSeries0.getDomainDescription());
timeSeries0.setDomainDescription((String) null);
String string0 = timeSeries0.getDomainDescription();
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertNull(string0);
}
@Test(timeout = 4000)
public void test031() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
String string0 = timeSeries0.getDomainDescription();
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", string0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Value", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test032() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
TimeSeriesDataItem timeSeriesDataItem0 = timeSeries0.addOrUpdate((RegularTimePeriod) fixedMillisecond0, (double) 1952);
assertNull(timeSeriesDataItem0);
timeSeries0.getDataItem(0);
assertEquals("G@/", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("G@/", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test033() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0);
timeSeries0.setNotify(false);
TimeSeries timeSeries1 = timeSeries0.createCopy((RegularTimePeriod) fixedMillisecond0, (RegularTimePeriod) fixedMillisecond0);
assertEquals(9223372036854775807L, timeSeries1.getMaximumItemAge());
assertEquals("Time", timeSeries1.getDomainDescription());
assertEquals("Value", timeSeries1.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries1.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test034() throws Throwable {
MockDate mockDate0 = new MockDate(0, 0, 0);
Class<String> class0 = String.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, class0);
timeSeries0.setMaximumItemCount(0);
Day day0 = new Day();
timeSeries0.createCopy((RegularTimePeriod) day0, (RegularTimePeriod) day0);
assertEquals(0, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test035() throws Throwable {
Week week0 = new Week();
Class<Week> class0 = Week.class;
TimeSeries timeSeries0 = new TimeSeries(week0, class0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
timeSeries0.setMaximumItemAge(0L);
Day day0 = new Day();
timeSeries0.createCopy((RegularTimePeriod) week0, (RegularTimePeriod) day0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test036() throws Throwable {
Integer integer0 = JLayeredPane.POPUP_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
timeSeries0.setNotify(false);
TimeSeries timeSeries1 = timeSeries0.createCopy(951, 951);
assertNotSame(timeSeries1, timeSeries0);
assertEquals(9223372036854775807L, timeSeries1.getMaximumItemAge());
assertEquals("Value", timeSeries1.getRangeDescription());
assertEquals("Time", timeSeries1.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries1.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test037() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "[@/", "[@/", class0);
timeSeries0.setMaximumItemCount(0);
timeSeries0.createCopy(0, 29);
assertEquals(0, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test038() throws Throwable {
Integer integer0 = JLayeredPane.MODAL_LAYER;
Class<FixedMillisecond> class0 = FixedMillisecond.class;
TimeSeries timeSeries0 = new TimeSeries(integer0, class0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
timeSeries0.setMaximumItemAge(0L);
timeSeries0.createCopy(76, 76);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test039() throws Throwable {
Day day0 = new Day();
TimeSeries timeSeries0 = new TimeSeries(day0);
timeSeries0.add((RegularTimePeriod) day0, 1.0);
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (-884.1924072712741));
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test040() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) 53, false);
TimeSeries timeSeries1 = timeSeries0.addAndOrUpdate(timeSeries0);
assertEquals(1, timeSeries1.getItemCount());
assertNotSame(timeSeries1, timeSeries0);
assertEquals(Integer.MAX_VALUE, timeSeries1.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries1.getMaximumItemAge());
assertEquals("Time", timeSeries1.getDomainDescription());
assertEquals("Value", timeSeries1.getRangeDescription());
}
@Test(timeout = 4000)
public void test041() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.update((RegularTimePeriod) week0, (Number) 1);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test042() throws Throwable {
MockDate mockDate0 = new MockDate(479, 1121, 2436, 2436, 2436);
Class<RegularTimePeriod> class0 = RegularTimePeriod.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, "`.pFN?f", "x>%cmn3Db", class0);
// Undeclared exception!
// try {
timeSeries0.update((RegularTimePeriod) null, (Number) 23);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeriesDataItem", e);
// }
}
@Test(timeout = 4000)
public void test043() throws Throwable {
Short short0 = new Short((short)0);
Class<Hour> class0 = Hour.class;
TimeSeries timeSeries0 = new TimeSeries("DefaultIntervalCategoryDataset.setCategoryKeys(): null category not permitted.", "", "W", class0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.update((-2140325368), (Number) short0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test044() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
// Undeclared exception!
// try {
timeSeries0.update(2339, (Number) 53);
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: 2339, Size: 0
// //
// verifyException("java.util.ArrayList", e);
// }
}
@Test(timeout = 4000)
public void test045() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.setMaximumItemCount(3123);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test046() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.setMaximumItemAge(1);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test047() throws Throwable {
Day day0 = new Day();
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(day0, class0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.removeAgedItems(true);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test048() throws Throwable {
Week week0 = new Week(1811, 0);
Class<FixedMillisecond> class0 = FixedMillisecond.class;
TimeSeries timeSeries0 = new TimeSeries(week0, class0);
// Undeclared exception!
// try {
timeSeries0.removeAgedItems((long) 0, true);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test049() throws Throwable {
Day day0 = new Day();
TimeSeries timeSeries0 = new TimeSeries(day0);
LinkedList<DefaultTableModel> linkedList0 = new LinkedList<DefaultTableModel>();
timeSeries0.data = (List) linkedList0;
linkedList0.add((DefaultTableModel) null);
// Undeclared exception!
// try {
timeSeries0.hashCode();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test050() throws Throwable {
Day day0 = new Day();
TimeSeries timeSeries0 = new TimeSeries(day0);
LinkedList<DefaultTableModel> linkedList0 = new LinkedList<DefaultTableModel>();
timeSeries0.data = (List) linkedList0;
Object[][] objectArray0 = new Object[7][1];
Object[] objectArray1 = new Object[5];
DefaultTableModel defaultTableModel0 = new DefaultTableModel(objectArray0, objectArray1);
linkedList0.add(defaultTableModel0);
// Undeclared exception!
// try {
timeSeries0.hashCode();
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test051() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getValue((RegularTimePeriod) week0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.util.Collections", e);
// }
}
@Test(timeout = 4000)
public void test052() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
// Undeclared exception!
// try {
timeSeries0.getValue((RegularTimePeriod) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test053() throws Throwable {
MockDate mockDate0 = new MockDate(0, 1952, 59);
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(mockDate0);
Class<Second> class0 = Second.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
// Undeclared exception!
// try {
timeSeries0.getValue((-91));
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test054() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
// Undeclared exception!
// try {
timeSeries0.getTimePeriodsUniqueToOtherSeries((TimeSeries) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test055() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getTimePeriods();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test056() throws Throwable {
Day day0 = new Day();
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, class0);
// Undeclared exception!
// try {
timeSeries0.getTimePeriod((-1069));
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test057() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getNextTimePeriod();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test058() throws Throwable {
SpreadsheetDate spreadsheetDate0 = new SpreadsheetDate(953);
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(spreadsheetDate0, class0);
LinkedList<Object> linkedList0 = new LinkedList<Object>();
timeSeries0.data = (List) linkedList0;
// Undeclared exception!
// try {
timeSeries0.getNextTimePeriod();
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: -1, Size: 0
// //
// verifyException("java.util.LinkedList", e);
// }
}
@Test(timeout = 4000)
public void test059() throws Throwable {
SpreadsheetDate spreadsheetDate0 = new SpreadsheetDate(953);
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(spreadsheetDate0, class0);
LinkedList<Object> linkedList0 = new LinkedList<Object>();
linkedList0.add((Object) class0);
timeSeries0.data = (List) linkedList0;
// Undeclared exception!
// try {
timeSeries0.getNextTimePeriod();
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test060() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getItems();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.util.Collections$UnmodifiableCollection", e);
// }
}
@Test(timeout = 4000)
public void test061() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getItemCount();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test062() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getIndex(week0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.util.Collections", e);
// }
}
@Test(timeout = 4000)
public void test063() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getDataItem((RegularTimePeriod) week0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.util.Collections", e);
// }
}
@Test(timeout = 4000)
public void test064() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.getDataItem(56);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test065() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
// Undeclared exception!
// try {
timeSeries0.getDataItem(53);
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: 53, Size: 0
// //
// verifyException("java.util.ArrayList", e);
// }
}
@Test(timeout = 4000)
public void test066() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
TimeSeries timeSeries1 = timeSeries0.createCopy(1, 1);
timeSeries1.data = null;
// Undeclared exception!
// try {
timeSeries1.equals(timeSeries0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test067() throws Throwable {
TimeSeries timeSeries0 = new TimeSeries("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
// Undeclared exception!
// try {
timeSeries0.delete((RegularTimePeriod) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test068() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Object[] objectArray0 = new Object[4];
DefaultComboBoxModel<Object> defaultComboBoxModel0 = new DefaultComboBoxModel<Object>(objectArray0);
JList<Object> jList0 = new JList<Object>(defaultComboBoxModel0);
List<Object> list0 = jList0.getSelectedValuesList();
timeSeries0.data = list0;
// Undeclared exception!
// try {
timeSeries0.delete(1, 1);
// fail("Expecting exception: UnsupportedOperationException");
// } catch(UnsupportedOperationException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.util.AbstractList", e);
// }
}
@Test(timeout = 4000)
public void test069() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.delete(398, 398);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test070() throws Throwable {
Day day0 = new Day();
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, class0);
// Undeclared exception!
// try {
timeSeries0.delete((-1487), 2696);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test071() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.createCopy((RegularTimePeriod) week0, (RegularTimePeriod) week0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.util.Collections", e);
// }
}
@Test(timeout = 4000)
public void test072() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.createCopy(1800, Integer.MAX_VALUE);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test073() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
timeSeries0.addOrUpdate((RegularTimePeriod) fixedMillisecond0, (double) 3737);
// Undeclared exception!
// try {
timeSeries0.createCopy(0, 3075);
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: 1, Size: 1
// //
// verifyException("java.util.ArrayList", e);
// }
}
@Test(timeout = 4000)
public void test074() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
Stack<MetalComboBoxEditor> stack0 = new Stack<MetalComboBoxEditor>();
timeSeries0.data = (List) stack0;
timeSeries0.add((RegularTimePeriod) day0, (Number) 53, true);
// Undeclared exception!
// try {
timeSeries0.createCopy(53, 53);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // Array index out of range: 53
// //
// verifyException("java.util.Vector", e);
// }
}
@Test(timeout = 4000)
public void test075() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.clone();
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'collection' argument.
// //
// verifyException("org.jfree.chart.util.ObjectUtilities", e);
// }
}
@Test(timeout = 4000)
public void test076() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.clear();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test077() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.addOrUpdate((RegularTimePeriod) week0, (Number) 1);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test078() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Object[] objectArray0 = new Object[4];
DefaultComboBoxModel<Object> defaultComboBoxModel0 = new DefaultComboBoxModel<Object>(objectArray0);
JList<Object> jList0 = new JList<Object>(defaultComboBoxModel0);
List<Object> list0 = jList0.getSelectedValuesList();
timeSeries0.data = list0;
// Undeclared exception!
// try {
timeSeries0.addOrUpdate((RegularTimePeriod) week0, 0.0);
// fail("Expecting exception: UnsupportedOperationException");
// } catch(UnsupportedOperationException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.util.AbstractList", e);
// }
}
@Test(timeout = 4000)
public void test079() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.addOrUpdate((RegularTimePeriod) week0, (double) 53);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test080() throws Throwable {
SimpleHistogramBin simpleHistogramBin0 = new SimpleHistogramBin(0.0, 1.0, false, false);
Class<Millisecond> class0 = Millisecond.class;
TimeSeries timeSeries0 = new TimeSeries(simpleHistogramBin0, "WzhY!I6+7<[Ll)G", "WzhY!I6+7<[Ll)G", class0);
// Undeclared exception!
// try {
timeSeries0.addOrUpdate((RegularTimePeriod) null, 0.0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test081() throws Throwable {
Day day0 = new Day();
TimeSeries timeSeries0 = new TimeSeries(day0);
Stack<Day> stack0 = new Stack<Day>();
stack0.add(day0);
timeSeries0.data = (List) stack0;
// Undeclared exception!
// try {
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 1);
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test082() throws Throwable {
Quarter quarter0 = new Quarter();
TimeSeries timeSeries0 = new TimeSeries(quarter0);
// Undeclared exception!
// try {
timeSeries0.addAndOrUpdate((TimeSeries) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test083() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Week week1 = new Week(2187, 1);
timeSeries0.addOrUpdate((RegularTimePeriod) week1, Double.POSITIVE_INFINITY);
// Undeclared exception!
// try {
timeSeries0.addAndOrUpdate(timeSeries0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Year constructor: year (1) outside valid range.
// //
// verifyException("org.jfree.data.time.Year", e);
// }
}
@Test(timeout = 4000)
public void test084() throws Throwable {
Day day0 = new Day();
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(day0, class0);
timeSeries0.data = null;
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) day0, 0.0);
// Undeclared exception!
// try {
timeSeries0.add(timeSeriesDataItem0, true);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test085() throws Throwable {
MockDate mockDate0 = new MockDate(479, 1121, 2436, 2436, (-2217));
Day day0 = new Day(mockDate0);
Hour hour0 = new Hour(479, day0);
Class<FixedMillisecond> class0 = FixedMillisecond.class;
TimeSeries timeSeries0 = new TimeSeries(hour0, "LQY`(", "X@Uu>4rW2ZP", class0);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) day0, (Number) 23);
// Undeclared exception!
// try {
timeSeries0.add(timeSeriesDataItem0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are trying to add data where the time period class is org.jfree.data.time.Day, but the TimeSeries is expecting an instance of org.jfree.data.time.FixedMillisecond.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test086() throws Throwable {
MockDate mockDate0 = new MockDate(0, 1952, 59);
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(mockDate0);
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
Float float0 = new Float((float) 59);
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) fixedMillisecond0, (Number) float0, false);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are trying to add data where the time period class is org.jfree.data.time.FixedMillisecond, but the TimeSeries is expecting an instance of javax.swing.JTextPane.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test087() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) day0, (Number) 1, false);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test088() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Byte byte0 = new Byte((byte)58);
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) null, (Number) byte0, true);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeriesDataItem", e);
// }
}
@Test(timeout = 4000)
public void test089() throws Throwable {
MockDate mockDate0 = new MockDate(0L);
TimeZone timeZone0 = TimeZone.getTimeZone("");
Day day0 = new Day(mockDate0, timeZone0);
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, "", "", class0);
Integer integer0 = JLayeredPane.DRAG_LAYER;
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are trying to add data where the time period class is org.jfree.data.time.Day, but the TimeSeries is expecting an instance of org.jfree.data.time.Month.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test090() throws Throwable {
TimeSeries timeSeries0 = new TimeSeries("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) null, (Number) 0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeriesDataItem", e);
// }
}
@Test(timeout = 4000)
public void test091() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) week0, 0.0, true);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are trying to add data where the time period class is org.jfree.data.time.Week, but the TimeSeries is expecting an instance of org.jfree.data.time.Day.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test092() throws Throwable {
Day day0 = new Day();
TimeSeries timeSeries0 = new TimeSeries(day0);
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) day0, (-1.7976931348623157E308), false);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test093() throws Throwable {
Class<TimeSeries> class0 = TimeSeries.class;
TimeSeries timeSeries0 = new TimeSeries("Requires start >= 0.", class0);
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) null, (-1577.12965682294), false);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeriesDataItem", e);
// }
}
@Test(timeout = 4000)
public void test094() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
timeSeries0.data = null;
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) day0, (double) 53);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test095() throws Throwable {
SimpleTimePeriod simpleTimePeriod0 = new SimpleTimePeriod(1000L, 1000L);
TimeSeries timeSeries0 = new TimeSeries(simpleTimePeriod0);
// Undeclared exception!
// try {
timeSeries0.add((RegularTimePeriod) null, (-97.6218877068983));
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeriesDataItem", e);
// }
}
@Test(timeout = 4000)
public void test096() throws Throwable {
Class<Second> class0 = Second.class;
TimeSeries timeSeries0 = null;
// try {
timeSeries0 = new TimeSeries((Comparable) null, "G@/", "1 BQKrvG+Z}", class0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'key' argument.
// //
// verifyException("org.jfree.data.general.Series", e);
// }
}
@Test(timeout = 4000)
public void test097() throws Throwable {
Class<Second> class0 = Second.class;
TimeSeries timeSeries0 = null;
// try {
timeSeries0 = new TimeSeries((Comparable) null, class0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'key' argument.
// //
// verifyException("org.jfree.data.general.Series", e);
// }
}
@Test(timeout = 4000)
public void test098() throws Throwable {
TimeSeries timeSeries0 = null;
// try {
timeSeries0 = new TimeSeries((Comparable) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'key' argument.
// //
// verifyException("org.jfree.data.general.Series", e);
// }
}
@Test(timeout = 4000)
public void test099() throws Throwable {
MockDate mockDate0 = new MockDate(0, 2932, 2932);
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, "Null 'task' argument.", 2932, 0, 592, 2932, 0, 0, 2932, (-1131), 2932);
Day day0 = new Day(mockDate0, simpleTimeZone0);
TimeSeries timeSeries0 = new TimeSeries(day0);
Integer integer0 = JLayeredPane.DRAG_LAYER;
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0, true);
timeSeries0.delete(0, 0);
assertEquals(0, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test100() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0);
// Undeclared exception!
// try {
timeSeries0.delete(398, 398);
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: 398, Size: 0
// //
// verifyException("java.util.ArrayList", e);
// }
}
@Test(timeout = 4000)
public void test101() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add((RegularTimePeriod) day0, (Number) 53, false);
timeSeries0.addOrUpdate(regularTimePeriod0, (double) 1);
timeSeries0.removeAgedItems(false);
assertEquals(2, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test102() throws Throwable {
MockDate mockDate0 = new MockDate();
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(mockDate0);
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, (String) null, (String) null, class0);
timeSeries0.removeAgedItems(false);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test103() throws Throwable {
Week week0 = new Week();
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(week0, "Requires start <= end.", "", class0);
timeSeries0.setMaximumItemCount(0);
timeSeries0.addOrUpdate((RegularTimePeriod) fixedMillisecond0, (Number) 1);
assertEquals(0, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test104() throws Throwable {
Integer integer0 = JLayeredPane.POPUP_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
timeSeries0.setMaximumItemCount(1);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) integer0, true);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) day0, (Number) integer0);
timeSeries0.add(timeSeriesDataItem0, true);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test105() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
Day day0 = new Day();
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) day0, (Number) integer0);
timeSeries0.add(timeSeriesDataItem0, true);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test106() throws Throwable {
MockDate mockDate0 = new MockDate(0, 0, 0);
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, "P{'s7 c?", "P{'s7 c?", class0);
Day day0 = new Day();
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem(day0, (Number) null);
// Undeclared exception!
// try {
timeSeries0.add(timeSeriesDataItem0, false);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are trying to add data where the time period class is org.jfree.data.time.Day, but the TimeSeries is expecting an instance of org.jfree.data.time.Month.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test107() throws Throwable {
MockDate mockDate0 = new MockDate(0, 1952, 59);
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(mockDate0);
Class<MultipleGradientPaint.CycleMethod> class0 = MultipleGradientPaint.CycleMethod.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, class0);
// Undeclared exception!
// try {
timeSeries0.add((TimeSeriesDataItem) null, false);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'item' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test108() throws Throwable {
XYDataItem xYDataItem0 = new XYDataItem(0.0, 0.0);
Class<TimeSeries> class0 = TimeSeries.class;
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0, class0);
// Undeclared exception!
// try {
timeSeries0.getIndex((RegularTimePeriod) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test109() throws Throwable {
MockDate mockDate0 = new MockDate();
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(mockDate0);
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, (String) null, (String) null, class0);
timeSeries0.getIndex(fixedMillisecond0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test110() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
long long0 = timeSeries0.getMaximumItemAge();
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, long0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test111() throws Throwable {
Day day0 = new Day();
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, class0);
String string0 = timeSeries0.getRangeDescription();
assertEquals("Value", string0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test112() throws Throwable {
Instant instant0 = MockInstant.now();
Date date0 = Date.from(instant0);
Day day0 = new Day(date0);
Class<String> class0 = String.class;
TimeSeries timeSeries0 = new TimeSeries(day0, class0);
// Undeclared exception!
// try {
timeSeries0.getValue(828);
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: 828, Size: 0
// //
// verifyException("java.util.ArrayList", e);
// }
}
@Test(timeout = 4000)
public void test113() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
// Undeclared exception!
// try {
timeSeries0.getTimePeriod(1);
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: 1, Size: 0
// //
// verifyException("java.util.ArrayList", e);
// }
}
@Test(timeout = 4000)
public void test114() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0);
// Undeclared exception!
// try {
timeSeries0.getDataItem((-1762));
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test115() throws Throwable {
Class<TimeSeries> class0 = TimeSeries.class;
TimeSeries timeSeries0 = new TimeSeries("G@/", class0);
timeSeries0.getItemCount();
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test116() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, true);
RegularTimePeriod regularTimePeriod1 = regularTimePeriod0.next();
timeSeries0.add(regularTimePeriod1, 2171.57597705, false);
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 1);
timeSeries0.hashCode();
assertEquals(3, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test117() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add((RegularTimePeriod) day0, (Number) 1, false);
timeSeries0.addOrUpdate(regularTimePeriod0, 0.0);
timeSeries0.hashCode();
assertEquals("Time", timeSeries0.getDomainDescription());
}
@Test(timeout = 4000)
public void test118() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0, (Class) null);
timeSeries0.hashCode();
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test119() throws Throwable {
MockDate mockDate0 = new MockDate(0, 0, 0);
Week week0 = new Week(mockDate0);
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(week0, class0);
assertEquals("Value", timeSeries0.getRangeDescription());
timeSeries0.setRangeDescription((String) null);
timeSeries0.hashCode();
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test120() throws Throwable {
Class<TimeSeries> class0 = TimeSeries.class;
TimeSeries timeSeries0 = new TimeSeries("DefaultIntervalCategoryDataset.setCategoryKeys(): null category not permitted.", (String) null, "", class0);
timeSeries0.hashCode();
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test121() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.addOrUpdate((RegularTimePeriod) week0, (double) 1);
Object object0 = timeSeries0.clone();
assertEquals(1, timeSeries0.getItemCount());
timeSeries0.update((RegularTimePeriod) week0, (Number) 1);
boolean boolean0 = timeSeries0.equals(object0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test122() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.addOrUpdate((RegularTimePeriod) week0, (double) 1);
Object object0 = timeSeries0.clone();
boolean boolean0 = timeSeries0.equals(object0);
assertEquals(1, timeSeries0.getItemCount());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test123() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 53);
Class<Object> class0 = Object.class;
TimeSeries timeSeries1 = new TimeSeries(week0, class0);
boolean boolean0 = timeSeries0.equals(timeSeries1);
assertEquals(1, timeSeries0.getItemCount());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test124() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
TimeSeries timeSeries1 = timeSeries0.createCopy(1, 53);
timeSeries1.setMaximumItemCount(2);
boolean boolean0 = timeSeries0.equals(timeSeries1);
assertEquals(2, timeSeries1.getMaximumItemCount());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test125() throws Throwable {
TimeSeries timeSeries0 = new TimeSeries("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
timeSeries0.setRangeDescription("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
TimeSeries timeSeries1 = new TimeSeries("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
boolean boolean0 = timeSeries1.equals(timeSeries0);
assertEquals("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.", timeSeries0.getRangeDescription());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test126() throws Throwable {
MockDate mockDate0 = new MockDate(333L);
Minute minute0 = new Minute(mockDate0);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) minute0, (double) 0);
TimeSeries timeSeries0 = new TimeSeries(timeSeriesDataItem0);
assertEquals("Time", timeSeries0.getDomainDescription());
timeSeries0.setDomainDescription((String) null);
TimeSeries timeSeries1 = new TimeSeries(timeSeriesDataItem0);
boolean boolean0 = timeSeries0.equals(timeSeries1);
assertEquals(9223372036854775807L, timeSeries1.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries1.getMaximumItemCount());
assertFalse(boolean0);
assertEquals("Value", timeSeries1.getRangeDescription());
}
@Test(timeout = 4000)
public void test127() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
Class<RegularTimePeriod> class0 = RegularTimePeriod.class;
TimeSeries timeSeries1 = new TimeSeries(integer0, "T gX0$%C", ".;]NnQ,;'?", class0);
boolean boolean0 = timeSeries0.equals(timeSeries1);
assertFalse(boolean0);
assertEquals("T gX0$%C", timeSeries1.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries1.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries1.getMaximumItemAge());
assertEquals(".;]NnQ,;'?", timeSeries1.getRangeDescription());
}
@Test(timeout = 4000)
public void test128() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Month month0 = new Month();
boolean boolean0 = timeSeries0.equals(month0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertFalse(boolean0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test129() throws Throwable {
TimeSeries timeSeries0 = new TimeSeries("DefaultIntevalCategoryDataset.setCategoryKeys(): nullcategory not permitted.");
boolean boolean0 = timeSeries0.equals(timeSeries0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertTrue(boolean0);
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test130() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) integer0, false);
timeSeries0.createCopy((RegularTimePeriod) day0, regularTimePeriod0);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test131() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
// Undeclared exception!
// try {
timeSeries0.createCopy(regularTimePeriod0, (RegularTimePeriod) day0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Requires start on or before end.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test132() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
// Undeclared exception!
// try {
timeSeries0.createCopy((RegularTimePeriod) day0, (RegularTimePeriod) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'end' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test133() throws Throwable {
MockDate mockDate0 = new MockDate(0L);
TimeZone timeZone0 = TimeZone.getTimeZone("");
Day day0 = new Day(mockDate0, timeZone0);
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, "", "", class0);
// Undeclared exception!
// try {
timeSeries0.createCopy((RegularTimePeriod) null, (RegularTimePeriod) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'start' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test134() throws Throwable {
MockDate mockDate0 = new MockDate(333L);
Minute minute0 = new Minute(mockDate0);
TimeSeries timeSeries0 = new TimeSeries(minute0);
// Undeclared exception!
// try {
timeSeries0.createCopy(197, 0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Requires start <= end.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test135() throws Throwable {
MockDate mockDate0 = new MockDate(333L);
Minute minute0 = new Minute(mockDate0);
TimeSeries timeSeries0 = new TimeSeries(minute0);
// Undeclared exception!
// try {
timeSeries0.createCopy((-168), (-1775));
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Requires start >= 0.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test136() throws Throwable {
MockDate mockDate0 = new MockDate();
FixedMillisecond fixedMillisecond0 = new FixedMillisecond(mockDate0);
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, (String) null, (String) null, class0);
// Undeclared exception!
// try {
timeSeries0.delete(2696, 0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Requires start <= end.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test137() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) 53, false);
assertEquals(1, timeSeries0.getItemCount());
timeSeries0.delete((RegularTimePeriod) day0);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test138() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.delete((RegularTimePeriod) week0);
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test139() throws Throwable {
Integer integer0 = JLayeredPane.MODAL_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0, true);
assertEquals(1, timeSeries0.getItemCount());
timeSeries0.clear();
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test140() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.clear();
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("Value", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test141() throws Throwable {
Week week0 = new Week();
Class<Week> class0 = Week.class;
TimeSeries timeSeries0 = new TimeSeries(week0, class0);
timeSeries0.setMaximumItemAge(0L);
timeSeries0.add((RegularTimePeriod) week0, (Number) 1, false);
Class<Hour> class1 = Hour.class;
timeSeries0.timePeriodClass = class1;
assertEquals(1, timeSeries0.getItemCount());
timeSeries0.removeAgedItems((long) Integer.MAX_VALUE, false);
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test142() throws Throwable {
Week week0 = new Week();
Class<Week> class0 = Week.class;
TimeSeries timeSeries0 = new TimeSeries(week0, class0);
timeSeries0.setMaximumItemAge(0L);
timeSeries0.add((RegularTimePeriod) week0, (Number) 1, true);
Class<Hour> class1 = Hour.class;
timeSeries0.timePeriodClass = class1;
assertEquals(1, timeSeries0.getItemCount());
timeSeries0.removeAgedItems((long) Integer.MAX_VALUE, true);
assertEquals("Value", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test143() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) 1, false);
timeSeries0.removeAgedItems(1545L, true);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test144() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
timeSeries0.removeAgedItems((long) Integer.MAX_VALUE, true);
timeSeries0.removeAgedItems((long) Integer.MAX_VALUE, true);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test145() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
timeSeries0.setMaximumItemAge(0L);
timeSeries0.add((RegularTimePeriod) day0, 1005.738903);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test146() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 53, false);
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 53);
timeSeries0.setMaximumItemAge(0L);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test147() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
// Undeclared exception!
// try {
timeSeries0.addOrUpdate((RegularTimePeriod) null, (Number) integer0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test148() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond((-604L));
Class<ChronoLocalDate> class0 = ChronoLocalDate.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
Quarter quarter0 = new Quarter();
timeSeries0.addOrUpdate((RegularTimePeriod) quarter0, 0.2534352042564744);
// Undeclared exception!
// try {
timeSeries0.addAndOrUpdate(timeSeries0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are trying to add data where the time period class is org.jfree.data.time.Quarter, but the TimeSeries is expecting an instance of java.time.chrono.ChronoLocalDate.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test149() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0, false);
Class<String> class0 = String.class;
TimeSeries timeSeries1 = new TimeSeries(integer0, "", "", class0);
timeSeries1.addAndOrUpdate(timeSeries0);
assertEquals(1, timeSeries0.getItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test150() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Stack<Week> stack0 = new Stack<Week>();
stack0.add(week0);
timeSeries0.data = (List) stack0;
// Undeclared exception!
// try {
timeSeries0.addAndOrUpdate(timeSeries0);
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test151() throws Throwable {
MockDate mockDate0 = new MockDate(0L);
TimeZone timeZone0 = TimeZone.getTimeZone("");
Day day0 = new Day(mockDate0, timeZone0);
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, "", "", class0);
// Undeclared exception!
// try {
timeSeries0.update((RegularTimePeriod) day0, (Number) 53);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // TimeSeries.update(TimePeriod, Number): period does not exist.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test152() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add((RegularTimePeriod) day0, (Number) 1, false);
timeSeries0.addOrUpdate(regularTimePeriod0, 0.0);
TimeSeries timeSeries1 = timeSeries0.createCopy(1, 1);
timeSeries1.add((RegularTimePeriod) day0, (Number) week0.FIRST_WEEK_IN_YEAR);
// Undeclared exception!
// try {
timeSeries1.add((RegularTimePeriod) day0, 2383.673891473);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are attempting to add an observation for the time period 14-February-2014 but the series already contains an observation for that time period. Duplicates are not permitted. Try using the addOrUpdate() method.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test153() throws Throwable {
Integer integer0 = JLayeredPane.MODAL_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0, true);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem(regularTimePeriod0, (Number) integer0);
timeSeries0.add(timeSeriesDataItem0, false);
assertEquals(2, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test154() throws Throwable {
Integer integer0 = JLayeredPane.MODAL_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0, true);
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) day0, (Number) integer0);
// Undeclared exception!
// try {
timeSeries0.add(timeSeriesDataItem0, false);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // You are attempting to add an observation for the time period 14-February-2014 but the series already contains an observation for that time period. Duplicates are not permitted. Try using the addOrUpdate() method.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test155() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0);
timeSeries0.addOrUpdate((RegularTimePeriod) fixedMillisecond0, 1210.451803);
timeSeries0.createCopy((RegularTimePeriod) fixedMillisecond0, (RegularTimePeriod) fixedMillisecond0);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test156() throws Throwable {
MockDate mockDate0 = new MockDate(3L);
Class<RegularTimePeriod> class0 = RegularTimePeriod.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, class0);
// Undeclared exception!
// try {
timeSeries0.add((TimeSeriesDataItem) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'item' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test157() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.getValue((RegularTimePeriod) week0);
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test158() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
Class<Day> class0 = Day.class;
TimeSeries timeSeries0 = new TimeSeries(integer0, class0);
// Undeclared exception!
// try {
timeSeries0.getDataItem((RegularTimePeriod) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Null 'period' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test159() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
XYDataItem xYDataItem0 = new XYDataItem((Number) integer0, (Number) integer0);
TimeSeries timeSeries0 = new TimeSeries(xYDataItem0);
Day day0 = new Day();
timeSeries0.add((RegularTimePeriod) day0, (Number) integer0, false);
TimeSeries timeSeries1 = new TimeSeries(day0);
timeSeries1.getTimePeriodsUniqueToOtherSeries(timeSeries0);
assertEquals(1, timeSeries0.getItemCount());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test160() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
ArrayList<Month> arrayList0 = new ArrayList<Month>();
timeSeries0.data = (List) arrayList0;
Month month0 = new Month(1, 1);
arrayList0.add(month0);
// Undeclared exception!
// try {
timeSeries0.getTimePeriods();
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test161() throws Throwable {
Millisecond millisecond0 = new Millisecond();
Class<TimeSeries> class0 = TimeSeries.class;
TimeSeries timeSeries0 = new TimeSeries(millisecond0, "", "", class0);
timeSeries0.getTimePeriods();
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("", timeSeries0.getRangeDescription());
}
@Test(timeout = 4000)
public void test162() throws Throwable {
FixedMillisecond fixedMillisecond0 = new FixedMillisecond();
Class<JTextPane> class0 = JTextPane.class;
TimeSeries timeSeries0 = new TimeSeries(fixedMillisecond0, "G@/", "G@/", class0);
timeSeries0.addOrUpdate((RegularTimePeriod) fixedMillisecond0, (double) 1952);
timeSeries0.getDataItem((RegularTimePeriod) fixedMillisecond0);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test163() throws Throwable {
MockDate mockDate0 = new MockDate(3L);
Month month0 = new Month(mockDate0);
Class<RegularTimePeriod> class0 = RegularTimePeriod.class;
TimeSeries timeSeries0 = new TimeSeries(mockDate0, class0);
timeSeries0.getDataItem((RegularTimePeriod) month0);
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test164() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
// Undeclared exception!
// try {
timeSeries0.setMaximumItemAge((-209L));
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Negative 'periods' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test165() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
Day day0 = new Day();
RegularTimePeriod regularTimePeriod0 = day0.next();
timeSeries0.add(regularTimePeriod0, (Number) 1, false);
timeSeries0.addOrUpdate((RegularTimePeriod) day0, (double) 53);
timeSeries0.setMaximumItemCount(1);
assertEquals(1, timeSeries0.getMaximumItemCount());
}
@Test(timeout = 4000)
public void test166() throws Throwable {
Quarter quarter0 = new Quarter();
TimeSeries timeSeries0 = new TimeSeries(quarter0);
// Undeclared exception!
// try {
timeSeries0.setMaximumItemCount((-923));
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Negative 'maximum' argument.
// //
// verifyException("org.jfree.data.time.TimeSeries", e);
// }
}
@Test(timeout = 4000)
public void test167() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.setMaximumItemCount(1);
Day day0 = new Day();
timeSeries0.addOrUpdate((RegularTimePeriod) day0, 3343.594163505092);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test168() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
TimeSeries timeSeries1 = (TimeSeries)timeSeries0.clone();
timeSeries1.setMaximumItemAge(1);
boolean boolean0 = timeSeries0.equals(timeSeries1);
assertEquals(1L, timeSeries1.getMaximumItemAge());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test169() throws Throwable {
Integer integer0 = JLayeredPane.FRAME_CONTENT_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
BigInteger bigInteger0 = BigInteger.ONE;
timeSeries0.add((RegularTimePeriod) day0, (Number) bigInteger0, false);
timeSeries0.getValue((RegularTimePeriod) day0);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test170() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
// Undeclared exception!
// try {
timeSeries0.getNextTimePeriod();
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test171() throws Throwable {
Day day0 = new Day();
Class<Month> class0 = Month.class;
TimeSeries timeSeries0 = new TimeSeries(day0, class0);
timeSeries0.getItems();
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
}
@Test(timeout = 4000)
public void test172() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
timeSeries0.addOrUpdate((RegularTimePeriod) week0, (double) 53);
Class<Day> class0 = Day.class;
TimeSeries timeSeries1 = new TimeSeries(week0, class0);
boolean boolean0 = timeSeries1.equals(timeSeries0);
assertEquals(1, timeSeries0.getItemCount());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test173() throws Throwable {
Week week0 = new Week();
TimeSeries timeSeries0 = new TimeSeries(week0);
int int0 = timeSeries0.getMaximumItemCount();
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals("Value", timeSeries0.getRangeDescription());
assertEquals("Time", timeSeries0.getDomainDescription());
assertEquals(Integer.MAX_VALUE, int0);
}
@Test(timeout = 4000)
public void test174() throws Throwable {
Short short0 = new Short((short)0);
Class<Hour> class0 = Hour.class;
TimeSeries timeSeries0 = new TimeSeries("DefaultIntervalCategoryDataset.setCategoryKeys(): null category not permitted.", "", "W", class0);
// Undeclared exception!
// try {
timeSeries0.update((-2140325368), (Number) short0);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test175() throws Throwable {
Integer integer0 = JLayeredPane.POPUP_LAYER;
TimeSeries timeSeries0 = new TimeSeries(integer0);
Day day0 = new Day();
TimeSeriesDataItem timeSeriesDataItem0 = new TimeSeriesDataItem((RegularTimePeriod) day0, 0.0);
timeSeries0.add(timeSeriesDataItem0);
assertEquals(1, timeSeries0.getItemCount());
}
@Test(timeout = 4000)
public void test176() throws Throwable {
Millisecond millisecond0 = new Millisecond();
Class<TimeSeries> class0 = TimeSeries.class;
TimeSeries timeSeries0 = new TimeSeries(millisecond0, "", "", class0);
String string0 = timeSeries0.getDomainDescription();
assertEquals(9223372036854775807L, timeSeries0.getMaximumItemAge());
assertEquals(Integer.MAX_VALUE, timeSeries0.getMaximumItemCount());
assertEquals("", timeSeries0.getRangeDescription());
assertEquals("", string0);
}
}
| [
"[email protected]"
] | |
760bff4b2c6b18dadfd86502ac3f14ef0505a7a8 | 1d2ef076c2d7b127d162240526e5e9ecdfc7778d | /app/src/main/java/si/levacic/gasper/uvnaloga5/DatePickerFragment.java | 81bb99dd90d7be9cacbbffc66bb46c14a3149b57 | [] | no_license | gapizaver/android-UX-airline-tickets | 2c8a4e5278476a8f82b88f6f71a068c27f68ee9f | fe8bca27532dbbac8a1ca17492714b2338c27902 | refs/heads/master | 2023-05-12T20:39:30.779594 | 2021-05-31T16:26:26 | 2021-05-31T16:26:26 | 372,565,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,360 | java | package si.levacic.gasper.uvnaloga5;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.widget.DatePicker;
import androidx.fragment.app.DialogFragment;
import java.util.Calendar;
public class DatePickerFragment extends DialogFragment
{
private onDateClickListener onDateClickListener;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
onDateClickListener.onDateSet(datePicker,i, i1, i2);
}
}, year, month, day);
}
public void setOnDateClickListener(onDateClickListener onDateClickListener){
if(onDateClickListener != null){
this.onDateClickListener = onDateClickListener;
}
}
}
interface onDateClickListener {
void onDateSet(DatePicker datePicker, int i, int i1, int i2);
}
| [
"[email protected]"
] | |
7724183e3af6b10564d305126a6916365d112742 | 9bcf69a234e61d2f077486aac58ece9a9f123ffe | /src/main/java/com/mezjh/blog/spring/transaction/propagationbehavior/Pb2SupportsA.java | 76de03ac0272d4cd717dce8b494674bc36baa3ab | [] | no_license | LHaon/mezjh-blog | d81e6af31622a3f605417b8b777996ee82254ac3 | 4b134485d2c884cc55179dcde4e73b98bf03be4e | refs/heads/master | 2023-07-12T21:05:21.545352 | 2021-08-23T09:22:01 | 2021-08-23T09:22:01 | 295,944,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,122 | java | package com.mezjh.blog.spring.transaction.propagationbehavior;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* Spring事务传播行为二:Supports 支持当前事务,若当前没有事务,则以非事务的方式运行
* @author ZJH
* @date 2021/7/6 17:54
*/
@Service
public class Pb2SupportsA {
@Resource
private PbUserMapper pbUserMapper;
@Resource
private Pb2SupportsB pb2SupportsB;
/**
* 若当前没有事务,则以非事务的方法运行
* 结论:
* 1.A1非事务方法,B1以非事务方法运行
* 2.无论在A1还是B1中发生异常,A1和B1的操作都不会回滚
*/
public void methodA1() {
List<PbUser> allUser = pbUserMapper.getAllUser();
allUser.forEach(x -> pbUserMapper.workAdd(x.getId()));
pb2SupportsB.methodB1();
// throw new RuntimeException();
}
/**
* 若当前存在事务,则支持该事务
* 结论:
* 1.A2和B1都是事务方法,A2中调用B1,B1加入到A2并一起提交
* 2.无论在A2还是B1中发生异常,A2和B1都会被回滚
*/
@Transactional(rollbackFor = Exception.class)
public void methodA2() {
List<PbUser> allUser = pbUserMapper.getAllUser();
pbUserMapper.id1Add();
try {
pb2SupportsB.methodB1();
} catch (Exception e) {
}
List<PbUser> allUser2 = pbUserMapper.getAllUser();
throw new RuntimeException();
}
@Service
public class Pb2SupportsB {
@Resource
private PbUserMapper pbUserMapper;
@Transactional(rollbackFor = Exception.class, propagation = Propagation.SUPPORTS)
public void methodB1() {
List<PbUser> allUser = pbUserMapper.getAllUser();
pbUserMapper.id2Add();
List<PbUser> allUser2 = pbUserMapper.getAllUser();
// throw new RuntimeException();
}
}
}
| [
"[email protected]"
] | |
80aa447a37aa94b2701f8e33251ce159e61e3116 | 1ae104865fd37371647652487ae1218fc9e316be | /app/src/androidTest/java/mustwakeup/galaxyvs/com/mustwakeup/ApplicationTest.java | 445d73b4567ccee5a0997bdc2796dfc33f498d2f | [] | no_license | vasuthakker/MustWakeup | 447c1bcdb5bb96073ab61a3dd7f4b30d6bccf32d | fe9be3436bd9a11bff369868920ad161ac5fb28a | refs/heads/master | 2020-05-30T03:22:09.225054 | 2015-05-08T09:13:53 | 2015-05-08T09:13:53 | 35,017,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package mustwakeup.galaxyvs.com.mustwakeup;
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);
}
} | [
"[email protected]"
] | |
c492d60599ef5de939778f67698b0433bc44a641 | 4ad79176eb9260cc071c0761d95f80a87d8c1fe7 | /template-common/src/main/java/com/tonytaotao/springboot/dubbo/common/handler/GlobalExceptionHandler.java | 5f2aaa371aafdbe3ee6fdf96e3f8ce41b537645a | [
"Apache-2.0"
] | permissive | wujintao630/springboot-platform | 24ab316c2cca59d5d51d0c5fa17ae000a316824f | b851191b1fd14eedab6b962b9a79fe32de65b6dc | refs/heads/main | 2023-03-18T12:04:44.535106 | 2021-03-18T05:43:47 | 2021-03-18T05:43:47 | 348,640,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,548 | java | package com.tonytaotao.springboot.dubbo.common.handler;
import com.tonytaotao.springboot.dubbo.common.base.GlobalResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolationException;
import java.util.List;
import java.util.stream.Collectors;
/**
* 处理全局异常(controller层抛出)
* @author tonytaotao
*
* ControllerAdvice 和 RestControllerAdvice 区别:
* ControllerAdvice注解后,方法上要同时存在 ExceptionHandler 和 ResponseBody 注解
* RestControllerAdvice注解后,方法上只需要存在 ExceptionHandler 注解
*/
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
@InitBinder
public void initBinder(WebDataBinder binder) {
GlobalIDHandler.setId();
}
/**
* 参数校验异常
* @param e
* @return
*/
@ExceptionHandler(value = MethodArgumentNotValidException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public GlobalResult handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
log.error(GlobalIDHandler.getId(), e);
StringBuilder errorMsg = new StringBuilder("请求参数校验异常:");
List<ObjectError> allErrors = e.getBindingResult().getAllErrors();
String msg = allErrors.stream().map(objectError -> {
return objectError instanceof FieldError ? "参数[" + ((FieldError)objectError).getField() + "] -> " + objectError.getDefaultMessage() : objectError.getDefaultMessage();
}).collect(Collectors.joining(", "));
errorMsg.append(msg).append(".");
GlobalResult result = GlobalResult.DefaultFailure("500", errorMsg.toString());
result.setRequestId(GlobalIDHandler.getId());
return result;
}
/**
* 参数校验异常
* @param e
* @return
*/
@ExceptionHandler(value = ConstraintViolationException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public GlobalResult handleConstraintViolationException(ConstraintViolationException e) {
log.error(GlobalIDHandler.getId(), e);
StringBuilder errorMsg = new StringBuilder("请求参数校验异常:");
String msg = e.getConstraintViolations().stream().map(constraintViolation -> {
return constraintViolation.getPropertyPath() + " -> " + constraintViolation.getMessage();
}).collect(Collectors.joining(", "));
errorMsg.append(msg).append(".");
GlobalResult result = GlobalResult.DefaultFailure("500", errorMsg.toString());
result.setRequestId(GlobalIDHandler.getId());
return result;
}
/**
* 默认异常处理
* @param request
* @param e
* @return
*/
@ExceptionHandler(value = Exception.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public GlobalResult defaultErrorHandler(HttpServletRequest request, Exception e) {
log.error(GlobalIDHandler.getId(), e);
String errorMsg = "系统异常:" + e.getMessage();
GlobalResult result = GlobalResult.DefaultFailure("500", errorMsg);
result.setRequestId(GlobalIDHandler.getId());
return result;
}
}
| [
"[email protected]"
] | |
b19bd589c73db76ee84154ca06d36afe2bbf4141 | 366cf78764913aeea49a1f9178ec85ffcecae3d2 | /app/src/main/java/com/hg39/helleng/Models/RegUser.java | 63582509e8cb159a35da83b7c6f35da3d42b83d1 | [] | no_license | HellGuy39/HellEng | 7c2506f6e407798c26bf53b63789974ee98c404e | 1048c7fa8ca6fb31ca332de8722b86fd62755b3b | refs/heads/master | 2023-05-30T09:44:45.486539 | 2021-06-11T12:28:05 | 2021-06-11T12:28:05 | 345,015,557 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,866 | java | package com.hg39.helleng.Models;
public class RegUser {
private String FirstName;
private String LastName;
private String FullName;
private String Email;
private String Password;
private String profileImage;
private String registerDate;
public RegUser() {}
public RegUser(String firstName, String lastName, String fullName,
String email, String password,
String profileImage, String registerDate) {
this.registerDate = registerDate;
this.FirstName = firstName;
this.LastName = lastName;
this.FullName = fullName;
this.Email = email;
this.Password = password;
this.profileImage = profileImage;
}
public String getFullName() {
return FullName;
}
public void setFullName(String fullName) {
this.FullName = fullName;
}
public String getRegisterDate() {
return registerDate;
}
public void setRegisterDate(String registerDate) {
this.registerDate = registerDate;
}
public String getFirstName() {
return FirstName;
}
public void setFirstName(String firstName) {
this.FirstName = firstName;
}
public String getLastName() {
return LastName;
}
public void setLastName(String lastName) {
this.LastName = lastName;
}
public String getEmail() {
return Email;
}
public void setEmail(String emailName) {
this.Email = emailName;
}
public String getPassword() {
return Password;
}
public void setPassword(String passwordName) {
this.Password = passwordName;
}
public String getProfileImage() {
return profileImage;
}
public void setProfileImage(String profileImage) {
this.profileImage = profileImage;
}
}
| [
"[email protected]"
] | |
93e755711c16d08f9dfdfa717700ae5294e2e756 | f1ccf596c7a8c66f6b3405909f35d2d751bed6ee | /app/src/test/java/com/nochita/charging/ExampleUnitTest.java | 1bd5967473971407b515b45876496441171cae0d | [] | no_license | nochita/charging | 1441ae57208626ae62acdbeef810e903c4280fae | beebee55e40200d0e38a819696eb78474de8971a | refs/heads/master | 2020-12-24T07:20:52.578354 | 2016-05-30T19:26:49 | 2016-05-30T19:26:49 | 60,032,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.nochita.charging;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
42672dad7c1f6d38908cd632425360eef8014b40 | f87904b0d14bc865b174c21b9c6e8406ccccf6d1 | /final-keyword/app1/src/V.java | f96bdc160c537f41ebf3cf99a0b445968e814c10 | [] | no_license | nextuser88/lara_java_code | f7c90e662b4d25cfb9a572f68a8ab86773febb92 | f53349afa87aa5a8fa475b29ccf0c5ea903dcc74 | refs/heads/master | 2021-05-15T20:19:00.931695 | 2017-10-22T06:28:48 | 2017-10-22T06:28:48 | 107,842,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45 | java | class V
{
final int i;
V()
{
i = 0;
}
} | [
"[email protected]"
] | |
0cd04e82125f14542e7e80f052238fbed0c3316c | 8b9965fe274c00c41b32b796e152720e1c024a25 | /src/main/java/by/epam/khlopava/hotel/command/ToLoginCommand.java | 10a4775a5b0c14caad64658566bf556fb0e4be24 | [] | no_license | verooonnika/Hotel | 1c45f4cf98a9982f8f41d49dc8a86257a75f9816 | 1e009ee50cc2364ef1e32b9114a688af5aaa7220 | refs/heads/master | 2022-07-04T17:08:02.999035 | 2019-08-26T10:25:48 | 2019-08-26T10:25:48 | 199,921,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package by.epam.khlopava.hotel.command;
import by.epam.khlopava.hotel.constant.PageConstant;
public class ToLoginCommand implements Command {
@Override
public CommandResult execute(RequestContent requestContent) {
return new CommandResult(CommandResult.ResponseType.FORWARD, PageConstant.LOGIN_PAGE);
}
}
| [
"[email protected]"
] | |
0779d751b881c10d7495888f69ea8890367eb6ad | 694c87438bf04eb75fde5d6a6e5110cbac1b1e1d | /MarketPymes-old/app/src/main/java/com/example/sleyterangulo/marketpymes/model/ItemSlideMenu.java | d9ce760ec97de38a839eb48e130d08b86b7c760d | [] | no_license | Sleyter28/MP-Mobile-Android | d8ab60c1e69ef90bb83962eca89b4e46abae65a4 | 478df385a0222614e96a89ccd2cb9c25ce5bb09b | refs/heads/develop | 2021-06-10T23:15:19.172188 | 2017-01-30T13:15:31 | 2017-01-30T13:15:31 | 73,929,474 | 0 | 0 | null | 2016-12-14T16:39:02 | 2016-11-16T14:43:32 | Java | UTF-8 | Java | false | false | 564 | java | package com.example.sleyterangulo.marketpymes.model;
/**
* Created by sleyterangulo on 11/9/16.
*/
public class ItemSlideMenu {
private int imgId;
private String title;
public ItemSlideMenu(int imgId, String title) {
this.imgId = imgId;
this.title = title;
}
public int getImgId() {
return imgId;
}
public void setImgId(int imgId) {
this.imgId = imgId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
| [
"[email protected]"
] | |
3c338f1aa115c259bb08e41c49f4212f4d260cdf | 54a3898d24026cb2004c4fc4cb02289e295900ec | /Lab10/ServerApplication/src/ro/uaic/info/GameServer.java | 102eb79dd62c30ad767bb5faa535667c830f015a | [] | no_license | Endi0n/LabAP | 2a95c60b015f0e703a13bacc4c7f445c10d74e13 | 33194baead7cf15a6f613c33c4340b5a0d0c65ac | refs/heads/master | 2021-04-04T17:31:02.260059 | 2020-05-21T06:56:38 | 2020-05-21T06:56:38 | 248,474,839 | 0 | 0 | null | 2020-10-13T21:03:17 | 2020-03-19T10:33:30 | Java | UTF-8 | Java | false | false | 1,618 | java | package ro.uaic.info;
import ro.uaic.info.rmi.IHello;
import ro.uaic.info.rmi.Hello;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.SocketTimeoutException;
import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;
public class GameServer {
static private boolean keepAlive = true;
public static void start(int rmiServerPort, int tcpServerPort) throws RemoteException, AlreadyBoundException {
startRMIServer(rmiServerPort);
startTCPServer(tcpServerPort);
}
private static void startRMIServer(int port) throws RemoteException, AlreadyBoundException {
var helloEndpoint = new Hello();
var helloStub = (IHello) UnicastRemoteObject.exportObject(helloEndpoint, 0);
var registry = LocateRegistry.createRegistry(port);
registry.bind("Hello", helloStub);
}
private static void startTCPServer(int port) {
try (ServerSocket serverSocket = new ServerSocket(port)) {
serverSocket.setSoTimeout(1000);
while (GameServer.keepAlive) {
try {
var socket = serverSocket.accept();
new ClientThread(socket).start();
} catch (SocketTimeoutException e) {}
}
} catch (IOException e) {
System.err.println(e.toString());
}
}
public static void stop() {
GameServer.keepAlive = false;
}
public static boolean getKeepAlive() {
return GameServer.keepAlive;
}
}
| [
"[email protected]"
] | |
e41c9a7cb8359f8fff8d345b163bd1bd6c9a8817 | 8bd893854690a8d93848a2e2ea35d39d5209b71c | /src/main/java/com/example/demo/utils/JwtUtils.java | 6703dd4fdf94561c58fe35e1a0ae8e9ac586dea4 | [] | no_license | nobitaphung/spring-boot-demo | 1b45494f3ad1fb3963cf3403cdca0ae42d9bc53c | af8d0ae7268c6759b2070079d0f2b0722e0353e7 | refs/heads/master | 2023-08-06T05:34:46.029837 | 2021-10-02T08:41:00 | 2021-10-02T08:41:00 | 412,519,703 | 0 | 0 | null | 2021-10-02T14:12:18 | 2021-10-01T15:24:52 | Java | UTF-8 | Java | false | false | 1,882 | java | package com.example.demo.utils;
import com.example.demo.model.UserDetailsImpl;
import io.jsonwebtoken.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
public class JwtUtils {
private String jwtSecret = "bezKoderSecretKey";
private int jwtExpirationMs = 8640000;
public String generateJwtToken(Authentication authentication) {
UserDetailsImpl userPrincipal = (UserDetailsImpl) authentication.getPrincipal();
return Jwts.builder()
.setSubject((userPrincipal.getUsername()))
.setIssuedAt(new Date())
.setExpiration(new Date((new Date()).getTime() + jwtExpirationMs))
.signWith(SignatureAlgorithm.HS256, jwtSecret)
.compact();
}
public String getUserNameFromJwtToken(String token) {
return Jwts.parser().setSigningKey(jwtSecret).parseClaimsJws(token).getBody().getSubject();
}
public boolean validateJwtToken(String authToken) {
try {
Jwts.parser().setSigningKey(jwtSecret).parseClaimsJws(authToken);
return true;
} catch (SignatureException e) {
System.out.println("Invalid JWT signature: " + e.getMessage());
} catch (MalformedJwtException e) {
System.out.println("Invalid JWT token: " + e.getMessage());
} catch (ExpiredJwtException e) {
System.out.println("JWT token is expired: " + e.getMessage());
} catch (UnsupportedJwtException e) {
System.out.println("JWT token is unsupported: " + e.getMessage());
} catch (IllegalArgumentException e) {
System.out.println("JWT claims string is empty: " + e.getMessage());
}
return false;
}
}
| [
"[email protected]"
] | |
2a78179147026b27200b078958848c7f58d64a55 | ba26af1bfe70673303f39fb34bf83f5c08ed5905 | /analysis/src/main/java/org/apache/calcite/sql/type/CursorReturnTypeInference.java | e943af8fb089f517f174f26646a22aa63ef24e16 | [
"MIT"
] | permissive | GinPonson/Quicksql | 5a4a6671e87b3278e2d77eee497a4910ac340617 | e31f65fb96ea2f2c373ba3acc43473a48dca10d1 | refs/heads/master | 2020-07-30T06:23:41.805009 | 2019-09-22T08:50:18 | 2019-09-22T08:50:18 | 210,116,844 | 0 | 0 | MIT | 2019-09-22T08:48:23 | 2019-09-22T08:48:23 | null | UTF-8 | Java | false | false | 1,720 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.calcite.sql.type;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.sql.SqlOperatorBinding;
/**
* Returns the rowtype of a cursor of the operand at a particular 0-based
* ordinal position.
*
* @see OrdinalReturnTypeInference
*/
public class CursorReturnTypeInference implements SqlReturnTypeInference {
//~ Instance fields --------------------------------------------------------
private final int ordinal;
//~ Constructors -----------------------------------------------------------
public CursorReturnTypeInference(int ordinal) {
this.ordinal = ordinal;
}
//~ Methods ----------------------------------------------------------------
public RelDataType inferReturnType(
SqlOperatorBinding opBinding) {
return opBinding.getCursorOperand(ordinal);
}
}
// End CursorReturnTypeInference.java
| [
"[email protected]"
] | |
5f4d4b09d0c5f4d4549c37728e2511bde2a9a6fc | d027b9c5d4a31d52af44cce3a9dd1c2b3a37bb08 | /src/main/java/com/garman/ofx/objectgraph/response/StatementResponse.java | fe82c434de98e98d89e123e9c583e0a7bdf08f51 | [] | no_license | lucasgarman/life | 9638acf17a306305e74fcfd46af94ec136b0fd96 | 1474437a5397e3eb905e9067b6025fcb997216ab | refs/heads/master | 2021-01-25T12:30:44.050800 | 2015-05-15T14:12:26 | 2015-05-15T14:12:26 | 35,697,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | package com.garman.ofx.objectgraph.response;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.garman.ofx.objectgraph.shared.BankAccount;
@XmlType(name="StatementResponse", propOrder={"curDef", "bankAcctFrom", "bankTranList", "ledgerBal", "availBal"})
public class StatementResponse {
private String curDef;
private BankAccount bankAcctFrom;
private BankTransactionList bankTranList;
private LedgerBalance ledgerBal;
private AvailableBalance availBal;
@XmlElement(name="CURDEF")
public String getCurDef() {
return curDef;
}
public void setCurDef(String curDef) {
this.curDef = curDef;
}
@XmlElement(name="BANKACCTFROM")
public BankAccount getBankAcctFrom() {
return bankAcctFrom;
}
public void setBankAcctFrom(BankAccount bankAcctFrom) {
this.bankAcctFrom = bankAcctFrom;
}
@XmlElement(name="BANKTRANLIST")
public BankTransactionList getBankTranList() {
return bankTranList;
}
public void setBankTranList(BankTransactionList bankTranList) {
this.bankTranList = bankTranList;
}
@XmlElement(name="LEDGERBAL")
public LedgerBalance getLedgerBal() {
return ledgerBal;
}
public void setLedgerBal(LedgerBalance ledgerBal) {
this.ledgerBal = ledgerBal;
}
@XmlElement(name="AVAILBAL")
public AvailableBalance getAvailBal() {
return availBal;
}
public void setAvailBal(AvailableBalance availBal) {
this.availBal = availBal;
}
}
| [
"[email protected]"
] | |
4fd8843ed8f931f3edd02c68127ffacedaf4d32b | 25f0c077efa9be37aad6277994dcd8d775390856 | /JAVA_PROJECT_HYR/src/_5_Input/testQuize2.java | 8c730ed34871d9a37572db0a8a6d844b2b4ab3c7 | [] | no_license | sooingkr/JAVA_STUDY | 422365499fe02e623637bbb377ab0637935b8b3b | d6782a670d16ae01c06ab784c75c495c595f97c4 | refs/heads/master | 2021-01-19T06:59:02.193290 | 2017-04-07T06:15:14 | 2017-04-07T06:15:14 | 87,492,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package _5_Input;
import java.util.Scanner;
public class testQuize2 {
public static void calculatorMethod(){
//계산기
// 숫자, 연산자, 숫자 순서로 입력받는다. (+ - * /)
Scanner sc = new Scanner(System.in);
int num1 = Integer.parseInt(sc.next()); // 화이트 스페이스(엔터, 공백) 전까지 문자열을 가져감.
String op = sc.next();
int num2 = Integer.parseInt(sc.next());;
double result = 0.0;
boolean flag = false;
switch (op) {
case "+":
result = (double)(num1 + num2);
break;
case "-":
result = (double)(num1 - num2);
break;
case "*":
result = (double)(num1 * num2);
break;
case "/":
if( num2 == 0 || num1 == 0){
flag = true;
}else{
result = ((double)num1 / num2);
}
break;
}
if(flag){
System.out.println("0으로 나눌 수 없습니다.");
}else if(flag == false){
System.out.println(num1 + " " + op + " " + num2 + " = " + result + " 입니다.");
}
}
public static void main(String[] args) {
calculatorMethod();
}
}
| [
"[email protected]"
] | |
1132245a824bde92fcb29474a958493c6f8073f4 | cdc5285da59ed1c812b9027e95a3e4a32a7655f6 | /app/src/main/java/com/hst/osa_lilamore/bean/support/CartItemList.java | 730915ff5c191a914f4b6b5d0fccb785e7116415 | [] | no_license | ProjectsHTinc/HSTAndroid11 | 470cd4dbb1f87a2b4a902462ba25e2332885929f | 49a1d7098b9086dd2d0d74c2e7bec6cd8ef6d269 | refs/heads/master | 2023-08-05T17:22:09.576513 | 2021-09-23T11:11:41 | 2021-09-23T11:11:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package com.hst.osa_lilamore.bean.support;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
public class CartItemList {
@SerializedName("count")
@Expose
private int count;
@SerializedName("view_cart_items")
@Expose
private ArrayList<CartItem> cartItemArrayList = new ArrayList<>();
/**
* @return The count
*/
public int getCount() {
return count;
}
/**
* @param count The count
*/
public void setCount(int count) {
this.count = count;
}
/**
* @return The cartItemArrayList
*/
public ArrayList<CartItem> getCartItemArrayList() {
return cartItemArrayList;
}
/**
* @param cartItemArrayList The cartItemArrayList
*/
public void setCartItemArrayList(ArrayList<CartItem> cartItemArrayList) {
this.cartItemArrayList = cartItemArrayList;
}
}
| [
"[email protected]"
] | |
4f758082e0084a7f69a9c0128ab48feec5cd07c8 | 1fc0664075db8b7ebe6d253140ef6e0025031b6f | /module4/task1/src/main/java/com/epam/adapter/SystemCompositionAdapter.java | 2ad6aff41564e112f80c2ea9f95c2336dd6d6b83 | [] | no_license | marikloster94/JMP-2015-2016-Valiantsin_Charkashyn-Group-2 | 73e2237d9f632983a5d3c001f988574ea240cb54 | 44dced6144a9f9f130cb15246937477f1429a5ad | refs/heads/master | 2021-01-10T07:13:54.236019 | 2016-04-15T13:13:05 | 2016-04-15T13:13:05 | 46,707,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | package com.epam.adapter;
import java.io.PrintStream;
import java.util.List;
import com.epam.model.Car;
public class SystemCompositionAdapter {
private PrintStream out;
public SystemCompositionAdapter() {
this.out = new PrintStream(System.out);
}
public PrintStream getOut() {
return out;
}
public void setOut(PrintStream out) {
this.out = out;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public void printList(List list) {
out.println("Composition adapter:");
if (list.get(0) instanceof Car) {
out.format("%8s%16s%10s", "Car type", "Mark", "Age");
out.println();
for (Car obj : (List<Car>) list) {
out.format("%8s%16s%10d", obj.getCarType(), obj.getMark(),
obj.getAge());
out.println();
}
} else {
out.println(list);
}
}
}
| [
"[email protected]"
] | |
9e90e063061450598c1d7e32d3e9a8587feb40ac | cc768d8bda69e2fad8f790b07832950bc16122a4 | /src/com/sanggoe/chap7_inheritance/tire/CarExample.java | 16030c47ac06c95491a32a0464a5b7b79c1eddc3 | [] | no_license | Sanggoe/ThisIsJava | b08ecb33d4e76438d2abcb06be27b3c07bb0f142 | 51c27dac0338a28ec6212082aca1185aa429861a | refs/heads/master | 2021-02-15T18:40:43.441991 | 2020-12-24T02:11:24 | 2020-12-24T02:11:24 | 244,921,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package com.sanggoe.chap7_inheritance.tire;
public class CarExample {
public static void main(String[] args) {
Car car = new Car();
for (int i = 1; i <= 5; i++) {
int problemLocation = car.run();
switch (problemLocation) {
case 1:
System.out.println("FrontLeft change HankookTire");
car.frontLeftTire = new HankookTire("FrontLeft", 15);
break;
case 2:
System.out.println("FrontRight change KumhoTire");
car.frontRightTire = new KumhoTire("FrontRight", 13);
break;
case 3:
System.out.println("BackLeft change HankookTire");
car.backLeftTire = new HankookTire("BackLeft", 14);
break;
case 4:
System.out.println("BackRight change KumhoTire");
car.backRightTire = new KumhoTire("BackRight", 17);
break;
}
System.out.println("----------------------- add 1time -----------------------");
}
}
}
| [
"[email protected]"
] | |
706d8c0878cf3080c832b0ff16be4c3caac08f1d | 85f9f340e8db102c6f4922f825bd6504686f7edf | /log-indexer-searcher-core/src/test/java/net/tworks/logapps/LogPatternLayoutParserTest.java | 83b453c51b8964918a62a706c7131ccd7f14dce5 | [] | no_license | asgs/log-searcher-indexer | 291b8ba9af921f48b96a57a9dbd0118537b69a1c | 21e89b9094c7366c4ab5ecd46e07314b05a7c71f | refs/heads/master | 2016-08-04T12:13:43.357742 | 2015-06-17T20:51:24 | 2015-06-17T20:51:24 | 37,155,209 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,929 | java | /**
*
*/
package net.tworks.logapps;
import static org.junit.Assert.*;
import net.tworks.logapps.admin.parser.LogPatternLayoutParser;
import org.junit.Test;
/**
* @author asgs
*
*/
public class LogPatternLayoutParserTest {
private LogPatternLayoutParser logPatternLayoutParser;
/**
*
*/
public LogPatternLayoutParserTest() {
logPatternLayoutParser = new LogPatternLayoutParser(
"%X{IP} %X{field1} %X{field2} [%date{dd/MMM/yyyy:HH:mm:ssZ} %msg%n");
}
/**
* Test method for
* {@link net.tworks.logapps.admin.parser.LogPatternLayoutParser#LogPatternLayoutParser(java.lang.String)}
* .
*/
@Test
public final void testLogPatternLayoutParser() {
new LogPatternLayoutParserTest();
}
/**
* Test method for
* {@link net.tworks.logapps.admin.parser.LogPatternLayoutParser#generateKeyValueTokenNames()}
* .
*/
@Test
public final void testGenerateKeyValueTokenNames() {
if (!logPatternLayoutParser.generateKeyValueTokenNames().isEmpty()) {
fail("Failed! Unable to generate tokens.");
}
}
/**
* Test method for
* {@link net.tworks.logapps.admin.parser.LogPatternLayoutParser#parseTimeStampFormat()}
* .
*/
@Test
public final void testParseTimeStampFormat() {
if (logPatternLayoutParser.parseTimeStampFormat() == null) {
fail("Couldn't retrieve the TS format.");
}
}
/**
* Test method for
* {@link net.tworks.logapps.admin.parser.LogPatternLayoutParser#hasTimeStampField()}
* .
*/
@Test
public final void testHasTimeStampField() {
if (!logPatternLayoutParser.hasTimeStampField()) {
fail("Couldn't find TS field.");
}
}
/**
* Test method for
* {@link net.tworks.logapps.admin.parser.LogPatternLayoutParser#findPositionOfTimeStampField()}
* .
*/
@Test
public final void testFindPositionOfTimeStampField() {
if (logPatternLayoutParser.findPositionOfTimeStampField() == -1) {
fail("Position of TS Field is invalid.");
}
}
}
| [
"[email protected]"
] | |
90e00f9fbd8128c4bd1d4a3a9684642404a793b8 | 96f8609edbb2beb6a60e549f14c14bd977465ba8 | /src/main/java/com/daxiang/websocket/IosWsServer.java | d96b56de836fe0ac300ad3fe2cb83ecff2bf6b6f | [
"MIT"
] | permissive | opendx/agent | 88d3ccad7750d1708a7666a42e1e4d362a5ea47e | bf0c7a56533e8765a318c074c133ac9ebec92809 | refs/heads/master | 2021-06-14T06:29:31.715158 | 2021-03-04T12:31:13 | 2021-03-04T12:31:13 | 148,047,741 | 70 | 73 | MIT | 2021-02-17T08:46:17 | 2018-09-09T17:12:19 | Java | UTF-8 | Java | false | false | 5,288 | java | package com.daxiang.websocket;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.daxiang.core.mobile.ios.IosDevice;
import com.daxiang.core.mobile.ios.IosUtil;
import com.daxiang.core.mobile.ios.WdaMjpegInputStream;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.TouchAction;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.PointOption;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.time.Duration;
/**
* Created by jiangyitao.
*/
@Slf4j
@Component
@ServerEndpoint(value = "/ios/{mobileId}/user/{username}/project/{projectId}")
public class IosWsServer extends DeviceWsServer {
private IosDevice iosDevice;
private int mobileWidth;
private int mobileHeigth;
private PointOption downPointOption;
private PointOption moveToPointOption;
private long pressStartTime;
@OnOpen
public void onOpen(@PathParam("mobileId") String mobileId, @PathParam("username") String username,
@PathParam("projectId") Integer projectId, Session session) throws Exception {
onWebsocketOpenStart(mobileId, username, session);
iosDevice = (IosDevice) device;
mobileWidth = iosDevice.getMobile().getScreenWidth();
mobileHeigth = iosDevice.getMobile().getScreenHeight();
freshDriver(projectId);
// 转发本地端口到wdaMjpegServer,这样可以通过localhost访问到wdaMjpegServer屏幕数据
long mjpegServerPort = iosDevice.startMjpegServerIproxy();
String mjpegServerUrl = "http://localhost:" + mjpegServerPort;
URL url = new URL(mjpegServerUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(30000); // ms
conn.setReadTimeout(30000); // ms
// 连接wdaMjpegServer
sender.sendText("连接wdaMjpegServer...");
long startTime = System.currentTimeMillis();
while (true) {
try {
conn.connect();
break;
} catch (Exception e) {
Thread.sleep(1000);
}
if (System.currentTimeMillis() - startTime > 15000) {
throw new RuntimeException(String.format("[%s]连接%s失败", mobileId, mjpegServerUrl));
}
}
new Thread(() -> {
try (InputStream in = conn.getInputStream();
WdaMjpegInputStream wdaIn = new WdaMjpegInputStream(in)) {
while (true) {
sender.sendBinary(wdaIn.readImg());
}
} catch (Exception e) {
log.info("[{}]{}", mobileId, e.getMessage());
}
log.info("[{}]停止发送图片数据", mobileId);
conn.disconnect();
}).start();
onWebsocketOpenFinish();
}
@OnClose
public void onClose() {
if (iosDevice != null) {
iosDevice.stopMjpegServerIproxy();
onWebSocketClose();
}
}
@OnError
public void onError(Throwable t) {
log.error("[{}]onError", deviceId, t);
}
@OnMessage
public void onMessage(String msg) {
JSONObject message = JSON.parseObject(msg);
String operation = message.getString("operation");
switch (operation) {
case "m":
moveToPointOption = createPointOption(message.getInteger("x"), message.getInteger("y"), message.getInteger("width"), message.getInteger("height"));
break;
case "d":
downPointOption = createPointOption(message.getInteger("x"), message.getInteger("y"), message.getInteger("width"), message.getInteger("height"));
moveToPointOption = null;
pressStartTime = System.currentTimeMillis();
break;
case "u":
long pressDurationInMs = System.currentTimeMillis() - pressStartTime;
TouchAction touchAction = new TouchAction((AppiumDriver) iosDevice.getDriver());
touchAction.press(downPointOption).waitAction(WaitOptions.waitOptions(Duration.ofMillis(pressDurationInMs)));
if (moveToPointOption != null) { // 移动过
// 前端每移动一点距离都会调用"m",导致moveTo非常多,wda执行很慢。目前的处理只保留移动最后的坐标,这样会导致只能画直线,后续考虑优化
touchAction.moveTo(moveToPointOption);
}
touchAction.release();
touchAction.perform();
break;
case "home":
IosUtil.pressHome(iosDevice.getDriver());
break;
}
}
private PointOption createPointOption(int x, int y, int screenWidth, int screenHeight) {
x = (int) (((float) x) / screenWidth * mobileWidth);
y = (int) (((float) y) / screenHeight * mobileHeigth);
return PointOption.point(x, y);
}
}
| [
"[email protected]"
] | |
47089b4c488d72566803537a6feebf972c482e3a | e543b89a172d55bb81bdd8f2da79d3e3702a0260 | /aCis_gameserver/java/net/sf/l2j/gameserver/scripting/quest/Q419_GetAPet.java | b2516430ff2f5b5530a9a17dfd2f7c46b01fe091 | [] | no_license | nick1pas/acis_rusacis-folk | 72afb2d529c7762c22f9ee97d7763abecf0dff33 | 9e96774f73b7d4def1bc472043adeba0fb99986e | refs/heads/main | 2023-08-23T17:38:16.496608 | 2021-10-16T00:51:24 | 2021-10-16T00:51:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,835 | java | package net.sf.l2j.gameserver.scripting.quest;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import net.sf.l2j.commons.random.Rnd;
import net.sf.l2j.gameserver.enums.QuestStatus;
import net.sf.l2j.gameserver.model.actor.Creature;
import net.sf.l2j.gameserver.model.actor.Npc;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.scripting.Quest;
import net.sf.l2j.gameserver.scripting.QuestState;
public class Q419_GetAPet extends Quest
{
private static final String QUEST_NAME = "Q419_GetAPet";
// Items
private static final int ANIMAL_LOVER_LIST = 3417;
private static final int ANIMAL_SLAYER_LIST_1 = 3418;
private static final int ANIMAL_SLAYER_LIST_2 = 3419;
private static final int ANIMAL_SLAYER_LIST_3 = 3420;
private static final int ANIMAL_SLAYER_LIST_4 = 3421;
private static final int ANIMAL_SLAYER_LIST_5 = 3422;
private static final int BLOODY_FANG = 3423;
private static final int BLOODY_CLAW = 3424;
private static final int BLOODY_NAIL = 3425;
private static final int BLOODY_KASHA_FANG = 3426;
private static final int BLOODY_TARANTULA_NAIL = 3427;
// Reward
private static final int WOLF_COLLAR = 2375;
// NPCs
private static final int MARTIN = 30731;
private static final int BELLA = 30256;
private static final int METTY = 30072;
private static final int ELLIE = 30091;
// Droplist
private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
{
DROPLIST.put(20103, new int[]
{
BLOODY_FANG,
600000
});
DROPLIST.put(20106, new int[]
{
BLOODY_FANG,
750000
});
DROPLIST.put(20108, new int[]
{
BLOODY_FANG,
1000000
});
DROPLIST.put(20460, new int[]
{
BLOODY_CLAW,
600000
});
DROPLIST.put(20308, new int[]
{
BLOODY_CLAW,
750000
});
DROPLIST.put(20466, new int[]
{
BLOODY_CLAW,
1000000
});
DROPLIST.put(20025, new int[]
{
BLOODY_NAIL,
600000
});
DROPLIST.put(20105, new int[]
{
BLOODY_NAIL,
750000
});
DROPLIST.put(20034, new int[]
{
BLOODY_NAIL,
1000000
});
DROPLIST.put(20474, new int[]
{
BLOODY_KASHA_FANG,
600000
});
DROPLIST.put(20476, new int[]
{
BLOODY_KASHA_FANG,
750000
});
DROPLIST.put(20478, new int[]
{
BLOODY_KASHA_FANG,
1000000
});
DROPLIST.put(20403, new int[]
{
BLOODY_TARANTULA_NAIL,
750000
});
DROPLIST.put(20508, new int[]
{
BLOODY_TARANTULA_NAIL,
1000000
});
}
public Q419_GetAPet()
{
super(419, "Get a Pet");
setItemsIds(ANIMAL_LOVER_LIST, ANIMAL_SLAYER_LIST_1, ANIMAL_SLAYER_LIST_2, ANIMAL_SLAYER_LIST_3, ANIMAL_SLAYER_LIST_4, ANIMAL_SLAYER_LIST_5, BLOODY_FANG, BLOODY_CLAW, BLOODY_NAIL, BLOODY_KASHA_FANG, BLOODY_TARANTULA_NAIL);
addStartNpc(MARTIN);
addTalkId(MARTIN, BELLA, ELLIE, METTY);
for (int npcId : DROPLIST.keySet())
addKillId(npcId);
}
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
String htmltext = event;
QuestState st = player.getQuestList().getQuestState(QUEST_NAME);
if (st == null)
return htmltext;
if (event.equalsIgnoreCase("task"))
{
final int race = player.getRace().ordinal();
htmltext = "30731-0" + (race + 4) + ".htm";
st.setState(QuestStatus.STARTED);
st.setCond(1);
playSound(player, SOUND_ACCEPT);
giveItems(player, ANIMAL_SLAYER_LIST_1 + race, 1);
}
else if (event.equalsIgnoreCase("30731-12.htm"))
{
playSound(player, SOUND_MIDDLE);
takeItems(player, ANIMAL_SLAYER_LIST_1, 1);
takeItems(player, ANIMAL_SLAYER_LIST_2, 1);
takeItems(player, ANIMAL_SLAYER_LIST_3, 1);
takeItems(player, ANIMAL_SLAYER_LIST_4, 1);
takeItems(player, ANIMAL_SLAYER_LIST_5, 1);
takeItems(player, BLOODY_FANG, -1);
takeItems(player, BLOODY_CLAW, -1);
takeItems(player, BLOODY_NAIL, -1);
takeItems(player, BLOODY_KASHA_FANG, -1);
takeItems(player, BLOODY_TARANTULA_NAIL, -1);
giveItems(player, ANIMAL_LOVER_LIST, 1);
}
else if (event.equalsIgnoreCase("30256-03.htm"))
{
final int progress = st.getInteger("progress") | 1;
st.set("progress", progress);
if (progress == 7)
playSound(player, SOUND_MIDDLE);
}
else if (event.equalsIgnoreCase("30072-02.htm"))
{
final int progress = st.getInteger("progress") | 2;
st.set("progress", progress);
if (progress == 7)
playSound(player, SOUND_MIDDLE);
}
else if (event.equalsIgnoreCase("30091-02.htm"))
{
final int progress = st.getInteger("progress") | 4;
st.set("progress", progress);
if (progress == 7)
playSound(player, SOUND_MIDDLE);
}
else if (event.equalsIgnoreCase("test"))
{
st.set("answers", "0");
st.set("quiz", "20 21 22 23 24 25 26 27 28 29 30 31 32 33");
return checkQuestions(player, st);
}
else if (event.equalsIgnoreCase("wrong"))
{
st.set("wrong", st.getInteger("wrong") + 1);
return checkQuestions(player, st);
}
else if (event.equalsIgnoreCase("right"))
{
st.set("correct", st.getInteger("correct") + 1);
return checkQuestions(player, st);
}
return htmltext;
}
@Override
public String onTalk(Npc npc, Player player)
{
String htmltext = getNoQuestMsg();
QuestState st = player.getQuestList().getQuestState(QUEST_NAME);
if (st == null)
return htmltext;
switch (st.getState())
{
case CREATED:
htmltext = (player.getStatus().getLevel() < 15) ? "30731-01.htm" : "30731-02.htm";
break;
case STARTED:
switch (npc.getNpcId())
{
case MARTIN:
if (player.getInventory().hasAtLeastOneItem(ANIMAL_SLAYER_LIST_1, ANIMAL_SLAYER_LIST_2, ANIMAL_SLAYER_LIST_3, ANIMAL_SLAYER_LIST_4, ANIMAL_SLAYER_LIST_5))
{
final int proofs = player.getInventory().getItemCount(BLOODY_FANG) + player.getInventory().getItemCount(BLOODY_CLAW) + player.getInventory().getItemCount(BLOODY_NAIL) + player.getInventory().getItemCount(BLOODY_KASHA_FANG) + player.getInventory().getItemCount(BLOODY_TARANTULA_NAIL);
if (proofs == 0)
htmltext = "30731-09.htm";
else if (proofs < 50)
htmltext = "30731-10.htm";
else
htmltext = "30731-11.htm";
}
else if (st.getInteger("progress") == 7)
htmltext = "30731-13.htm";
else
htmltext = "30731-16.htm";
break;
case BELLA:
htmltext = "30256-01.htm";
break;
case METTY:
htmltext = "30072-01.htm";
break;
case ELLIE:
htmltext = "30091-01.htm";
break;
}
break;
}
return htmltext;
}
@Override
public String onKill(Npc npc, Creature killer)
{
final Player player = killer.getActingPlayer();
final QuestState st = checkPlayerState(player, npc, QuestStatus.STARTED);
if (st == null)
return null;
final int[] drop = DROPLIST.get(npc.getNpcId());
if (player.getInventory().hasItems(drop[0] - 5))
dropItems(player, drop[0], 1, 50, drop[1]);
return null;
}
private static String checkQuestions(Player player, QuestState st)
{
final int answers = st.getInteger("correct") + st.getInteger("wrong");
if (answers < 10)
{
String[] questions = st.get("quiz").split(" ");
int index = Rnd.get(questions.length - 1);
String question = questions[index];
if (questions.length > 10 - answers)
{
questions[index] = questions[questions.length - 1];
st.set("quiz", String.join(" ", Arrays.copyOf(questions, questions.length - 1)));
}
return "30731-" + question + ".htm";
}
if (st.getInteger("wrong") > 0)
{
st.unset("progress");
st.unset("answers");
st.unset("quiz");
st.unset("wrong");
st.unset("correct");
return "30731-14.htm";
}
takeItems(player, ANIMAL_LOVER_LIST, 1);
giveItems(player, WOLF_COLLAR, 1);
playSound(player, SOUND_FINISH);
st.exitQuest(true);
return "30731-15.htm";
}
} | [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.