blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3a97e1a2fc4cae1fc19607248bd49eb5e5f4a877 | 043472b8681153ee6754b98449dd192703e0b8d2 | /future-common/src/main/java/com/github/peterchenhdu/future/common/constant/CommonConstants.java | 60dcaa83631244e45583377fbe890968da0bf87f | [
"Apache-2.0"
] | permissive | peterchenhdu/future-framework | 4f59c9b56a28a4e1a05bcccddc460dbcb47e5bd1 | e41555f876ffe18cf9b8aa5fee867165afc363d6 | refs/heads/master | 2018-10-25T20:02:09.896630 | 2018-08-24T14:34:55 | 2018-08-24T14:34:55 | 62,036,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | /*
* Copyright (c) 2011-2025 PiChen
*/
package com.github.peterchenhdu.future.common.constant;
/**
* @author PiChen
* @since 2018/8/18 18:38
*/
public class CommonConstants {
public static final String BLANK_STR = "";
}
| [
"cp_hdu@163.com"
] | cp_hdu@163.com |
1cc8b3f394078bb8472ea983305e59d829aa6499 | a136df4947eea3661b09559c45b8a52e7b103feb | /calendar_generator/src/com/tshevchuk/calendar_validation/command_line_tasks/GeneratePostyTask.java | 877113a763f92befb69d218eb79708fb8e162d5b | [] | no_license | tshevchuk/prayerbook | 70c2a6a0bdd4d7d4b82064e193f2140f94817ab6 | 74e290429ffe0f775b27cbd584e0ea17e30606e9 | refs/heads/develop | 2020-12-29T01:53:35.084148 | 2019-01-07T10:54:48 | 2019-01-07T10:54:48 | 38,866,512 | 4 | 1 | null | 2018-12-02T16:33:57 | 2015-07-10T07:10:39 | HTML | UTF-8 | Java | false | false | 2,299 | java | package com.tshevchuk.calendar_validation.command_line_tasks;
import com.google.gson.stream.JsonWriter;
import com.tshevchuk.calendar_validation.utils.DateUtils;
import com.tshevchuk.calendar_validation.utils.FileUtils;
import com.tshevchuk.calendar_validation.utils.JvmCalendarConfigReader;
import com.tshevchuk.prayer.data.church_calendar.CalendarDateInfo;
import com.tshevchuk.prayer.data.church_calendar.ChurchCalendar;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Map;
/**
* Created by taras on 26.05.16.
*/
public class GeneratePostyTask extends CommandLineTask {
@Override
public String getCommand() {
return "--gen-posty";
}
@Override
public String getDescription() {
return "--gen-posty" +
"\n Згенерувати і вивести пости церковного календаря";
}
@Override
public void execute(String[] args) throws IOException {
for (int year : new ChurchCalendar(new JvmCalendarConfigReader()).getCalendarYears()) {
StringWriter stringWriter = new StringWriter();
JsonWriter writer = new JsonWriter(stringWriter);
writer.setIndent(" ");
writer.beginObject();
Map<String, CalendarDateInfo> days = generateCalendar(year, year);
for (CalendarDateInfo dayInfo : days.values()) {
if (dayInfo.getPistType() != null || dayInfo.getPistName() != null) {
writer.name(DateUtils.dateToDateStr(dayInfo.getDate()));
writer.beginObject();
writer.name("type").value(dayInfo.getPistType());
writer.name("name").value(dayInfo.getPistName());
writer.name("dayOfWeek").value(DateUtils.getDayOfWeekStr(dayInfo.getDate()));
writer.name("shiftDaysFromEaster").value(dayInfo.getShiftDaysFromEaster());
writer.endObject();
}
}
writer.endObject();
writer.close();
String fileName = "files/generated/generated-posty-" + year + ".json";
FileUtils.writeFile(fileName, stringWriter.toString());
System.out.println("Generated " + fileName);
}
}
}
| [
"taras.shevchuk@gmail.com"
] | taras.shevchuk@gmail.com |
cebfc04fc7ce317689c9a2af8881e573cf9455df | c4c2aaae7d70815fdfbea468d2bb54cf754972b2 | /game-net/src/main/java/org/forfun/mmorpg/net/socket/SessionKeys.java | b3128a2ba98870fbbe7bd2708170ab5a0a859ad7 | [] | no_license | adocool/mmorpg-1 | abb79a1b4d78d208f95c203b2fdfa994a9fb1ca6 | 99fc6f32ab369e22cba7d29d56169b5cf7868543 | refs/heads/master | 2023-04-12T13:46:46.730466 | 2021-05-11T05:13:23 | 2021-05-11T05:13:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 65 | java | package org.forfun.mmorpg.net.socket;public enum SessionKeys {
}
| [
"475139136@qq.com"
] | 475139136@qq.com |
cc5bc1ad6f4102889723bc71ec62e9e265ca9a53 | f4a44df63034a314473766f57a56ae7ca07c9436 | /Workspace-trunk/Selenium-Tests/.svn/pristine/cc/cc5bc1ad6f4102889723bc71ec62e9e265ca9a53.svn-base | d1c10039b34432d30cdd2d12216814e3cc7bb237 | [] | no_license | skhanam/selenium | ed287bac8f9eb517dceae7398125740ece778943 | 2ac3c4fd232c99bdc9b3d4be7e5e2865b7f91076 | refs/heads/master | 2021-01-09T23:40:15.650402 | 2016-04-19T21:13:28 | 2016-04-19T21:13:28 | 56,629,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,786 | package uk.co.ratedpeople.test.functional.selenium.local;
import static org.testng.Assert.assertEquals;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import uk.co.ratedpeople.test.functional.selenium.TestScriptUtilities;
/**
* @author shabana.khanam
*
*/
public class JobDetailsPage {
public static Logger logger = Logger.getLogger("uk.co.ratedpeople.test.functional.selenium.JobDetailsPage");
private WebDriver driver;
private String testUrl;
private TestScriptUtilities scriptUtils;
public JobDetailsPage(WebDriver driver, String testUrl, TestScriptUtilities scriptUtils) {
this.driver = driver;
this.testUrl = testUrl;
this.scriptUtils = scriptUtils;
}
public void checkAllTabs(String photo, String desc, String tradesmen, String feedback, String stats) throws InterruptedException {
if (StringUtils.isNotBlank(photo)) {
scriptUtils.clickXpath(photo);
String getheaderText = driver.findElement(By.xpath(photo)).getText();
logger.info("Header Value : " + getheaderText);
assertEquals(getheaderText, LocalXpathLocators.assertLookup.get("PHOTOS"));
}
Thread.sleep(3000);
if (StringUtils.isNotBlank(desc)) {
scriptUtils.clickXpath(desc);
String getheaderText = driver.findElement(By.xpath(desc)).getText();
logger.info("Header Value : " + getheaderText);
assertEquals(getheaderText, LocalXpathLocators.assertLookup.get("DESCRIP"));
}
Thread.sleep(3000);
if (StringUtils.isNotBlank(tradesmen)) {
scriptUtils.clickXpath(tradesmen);
String getheaderText = driver.findElement(By.xpath(tradesmen)).getText();
logger.info("Header Value : " + getheaderText);
assertEquals(getheaderText, LocalXpathLocators.assertLookup.get("TRADESMN"));
}
Thread.sleep(3000);
if (StringUtils.isNotBlank(feedback)) {
scriptUtils.clickXpath(feedback);
String getheaderText = driver.findElement(By.xpath(feedback)).getText();
logger.info("Header Value : " + getheaderText);
assertEquals(getheaderText, LocalXpathLocators.assertLookup.get("FBACK"));
}
Thread.sleep(3000);
if (StringUtils.isNotBlank(stats)) {
scriptUtils.clickXpath(stats);
String getheaderText = driver.findElement(By.xpath(stats)).getText();
logger.info("Header Value : " + getheaderText);
assertEquals(getheaderText, LocalXpathLocators.assertLookup.get("STATUSHEADER"));
}
}
public void carousel(String carousalxpath) throws Exception {
if (StringUtils.isNotBlank(carousalxpath)) {
for (int i = 0; i <= 6; i++) {
scriptUtils.clickXpath(carousalxpath);
Thread.sleep(1000);
}
}
}
public String getTestUrl() {
return testUrl;
}
public void setTestUrl(String testUrl) {
this.testUrl = testUrl;
}
}
| [
"shabana.khanam@ratedpeople.com"
] | shabana.khanam@ratedpeople.com | |
f87bfa6378b8c133cf7c6485d37889069f0f61cf | e7e15cdf1572d071408209c24a9d47546c4b2bd7 | /design-patterns/src/com/example/abstractfactory/implementations/CarChassis.java | 2db3bbcd5f57846dcdef090234f99f629a360b95 | [] | no_license | dtom7/design-patterns | 517ae89d385488766d3e66a002de9d04da34798a | 55d4185de7e4864ddde82c66c09b00f75c1b6966 | refs/heads/master | 2018-12-29T01:05:08.976499 | 2015-01-02T03:50:20 | 2015-01-02T03:50:20 | 28,500,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package com.example.abstractfactory.implementations;
import com.example.abstractfactory.interfaces.Chassis;
public class CarChassis implements Chassis {
@Override
public String getChassisParts() {
return "Car chassis parts";
}
}
| [
"dony.thomas7@gmail.com"
] | dony.thomas7@gmail.com |
4f03d75039d04cff5b87c06d4cc77d9c8cc3913d | 67b6177903411c34e5f4ff3a5052b6fda415b104 | /src/main/java/com/raffamendes/cicdmetrics/operator/cr/ExampleResource.java | fd49e0afecb6b84d527b310cad2515f71e3dc559 | [] | no_license | raffamendes/example-operator | b339eabde5da3fd9825457956d9d053fcc4dded6 | 0b569f4973b432c95effdcc5c435cc09265805cd | refs/heads/master | 2020-12-21T22:06:55.729861 | 2020-02-06T20:34:46 | 2020-02-06T20:34:46 | 236,577,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package com.raffamendes.cicdmetrics.operator.cr;
import io.fabric8.kubernetes.client.CustomResource;
public class ExampleResource extends CustomResource{
private static final long serialVersionUID = -2908084230633655503L;
private ExampleResourceSpec spec;
public ExampleResourceSpec getSpec() {
return spec;
}
public void setSpec(ExampleResourceSpec spec) {
this.spec = spec;
}
@Override
public String toString() {
String name = getMetadata() != null ? getMetadata().getName() : "unknown";
String version = getMetadata() != null ? getMetadata().getResourceVersion() : "unknown";
return "name=" + name + " version=" + version + " value=" + spec;
}
}
| [
"rmendes@rmendes.remote.csb"
] | rmendes@rmendes.remote.csb |
0c65a3a95e9dcb4554f3d75c4c17bb6df5784e44 | c6992ce8db7e5aab6fd959c0c448659ab91b16ce | /sdk/synapse/azure-resourcemanager-synapse/src/samples/java/com/azure/resourcemanager/synapse/generated/OperationsGetLocationHeaderResultSamples.java | a616b4d350be928438a912e99464f334df843471 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later"
] | permissive | g2vinay/azure-sdk-for-java | ae6d94d583cc2983a5088ec8f6146744ee82cb55 | b88918a2ba0c3b3e88a36c985e6f83fc2bae2af2 | refs/heads/master | 2023-09-01T17:46:08.256214 | 2021-09-23T22:20:20 | 2021-09-23T22:20:20 | 161,234,198 | 3 | 1 | MIT | 2020-01-16T20:22:43 | 2018-12-10T20:44:41 | Java | UTF-8 | Java | false | false | 948 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.synapse.generated;
import com.azure.core.util.Context;
/** Samples for Operations GetLocationHeaderResult. */
public final class OperationsGetLocationHeaderResultSamples {
/*
* x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetLocationHeader.json
*/
/**
* Sample code: Get location header result.
*
* @param manager Entry point to SynapseManager.
*/
public static void getLocationHeaderResult(com.azure.resourcemanager.synapse.SynapseManager manager) {
manager
.operations()
.getLocationHeaderResultWithResponse(
"resourceGroup1", "workspace1", "01234567-89ab-4def-0123-456789abcdef", Context.NONE);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ab0ea511de1ea0a758833f480743318963916036 | a061eac0a02e0e323a462b9d44bd7f7b8106d7b7 | /portfolio/src/main/java/com/kodilla/rps/game/definitions/SCORE.java | 83fd70d1d9810b54a788dffae72343e58cd2ea42 | [] | no_license | RobertWojtaszczyk/robert-wojtaszczyk-kodilla-java | 68ebc0e8aef54ed0bac6d020a7dd4b20e035781f | 2f0aeb7535e8209a22b366867982eb8fcbf18dc1 | refs/heads/master | 2018-10-01T00:22:24.911214 | 2018-06-08T08:43:53 | 2018-06-08T08:43:53 | 119,090,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package com.kodilla.rps.game.definitions;
public enum SCORE {
PLAYER, COMPUTER, TIE
}
| [
"robert.wojtaszczyk@gmail.com"
] | robert.wojtaszczyk@gmail.com |
2a67e60bd9ef8cc9f5c11e8b3ac6335cb3a236d7 | 036df724710e8f063ded0ccda3624c81b9c21ac3 | /app/src/main/java/com/example/threads/MainActivity.java | 5a193768a672d8b7bb198fcb2a933e2842cb40fc | [] | no_license | ZiadAZ/Threads | 21bb10324b03b8ecce074a84bfd47c3d58ec1580 | 942ce383d5c5c4d39cf1bd0445abe8824a891c43 | refs/heads/master | 2021-01-05T15:42:06.285114 | 2020-02-17T09:16:29 | 2020-02-17T09:16:29 | 241,064,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,024 | java | package com.example.threads;
import android.os.Bundle;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.support.annotation.NonNull;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView mTextMessage;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
mTextMessage.setText(R.string.title_home);
return true;
case R.id.navigation_dashboard:
mTextMessage.setText(R.string.title_dashboard);
return true;
case R.id.navigation_notifications:
mTextMessage.setText(R.string.title_notifications);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BottomNavigationView navView = findViewById(R.id.nav_view);
mTextMessage = findViewById(R.id.message);
navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
run r=new run();
r.run();
}
});
}
class run implements Runnable{
@Override
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| [
"ZiadZayed7@gmail.com"
] | ZiadZayed7@gmail.com |
440fe6886effcfac9177eb97b05137dc3d2ba9bf | 053dd5018fde83cf4ed49b3d49c4c411a146b73f | /SocketClient/src/SocketClient.java | 13fad1ba6b330ae8b8959d8a150709305a4781c5 | [] | no_license | iTubeGamer/JavaSocketServer | ebb56e013dbada50e87e1ce7e90526fee72b176b | 132f89b12a0a42e1d769f825c64204294636606d | refs/heads/master | 2020-05-27T21:19:02.937305 | 2017-03-02T10:38:27 | 2017-03-02T10:38:27 | 83,659,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,231 | java | import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
public class SocketClient {
public static void main(String[] args) {
String serverPort = "2048";
String serverIP = "127.0.0.1";
String message = "Halli hallo Welt!";
// Sockets und Buffer
Socket socketClient;
BufferedReader bufferRead;
DataOutputStream bufferWrite;
System.out.println("*** Starting Java Socket Client ***");
try {
// Aufbau der Verbindung zum Server
System.out.println("Trying to connect to " + serverIP + ":" + serverPort);
socketClient = new Socket(serverIP, Integer.parseInt(serverPort));
// Datenausgabe
bufferWrite = new DataOutputStream(socketClient.getOutputStream());
bufferWrite.writeBytes(message + "\n");
System.out.println("Send: " + message);
// Einlesen der Antwort
bufferRead = new BufferedReader(new InputStreamReader(socketClient.getInputStream()));
message = bufferRead.readLine();
System.out.println("Received: " + message);
socketClient.close();
} catch (NumberFormatException | IOException e) {
e.printStackTrace();
}
}
}
| [
"max.kroner@nordakademie.de"
] | max.kroner@nordakademie.de |
9b2b6d16a0273d26d3af1c3957c7f9f6af98a3d1 | dbaa82f7ce9dd369bcdd8b1b59b5c0b07621d2ad | /packing/src/algorithm/parts/RoundingFunction.java | eede152b6addce945eb4125b0480346a944b644a | [] | no_license | kyldvs/packing | dfbc92ce13016890813eb476e9273ab27cd5872c | 742be37abbe2530524bc7f4afec9249e852e2695 | refs/heads/master | 2023-08-18T07:56:19.788610 | 2013-03-28T17:35:46 | 2013-03-28T17:35:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,205 | java | package algorithm.parts;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import functional.Function;
public abstract class RoundingFunction implements Function<Integer, Integer> {
public RoundingFunction() {
// Default Constructor
}
public abstract void init(int[] values);
@Override
public abstract Integer apply(Integer o);
public static RoundingFunction harmonic() {
return new RoundingFunction() {
protected int[] rounded;
@Override
public void init(int[] values) {
int min = values[0];
int max = values[0];
for (int i = 1; i < values.length; i++) {
min = Math.min(min, values[i]);
max = Math.max(max, values[i]);
}
LinkedList<Integer> r = new LinkedList<>();
int i = 1;
int diff = max - min;
while(1.0 / i * diff > 1.0) {
r.addFirst((int) (1.0 / i * diff + min));
i++;
}
r.addFirst(min - 1);
r.addLast(max + 1);
rounded = new int[r.size()];
int at = 0;
for (int x : r) {
rounded[at++] = x;
}
}
@Override
public Integer apply(Integer o) {
if (rounded == null) {
throw new NullPointerException("This rounding function was never intialized using init(int[] values)");
}
int x = Arrays.binarySearch(rounded, o);
if (x < 0) {
return rounded[-(x + 1)];
} else {
return rounded[x];
}
}
};
}
public static RoundingFunction clustering(final int k) {
return new RoundingFunction() {
private int[] round;
@Override
public void init(int[] values) {
if (k >= values.length) {
round = values.clone();
} else {
round = new int[k];
for (int i = 0; i < k; i++) {
round[i] = values[(int) (Math.random() * values.length)];
}
int[] b = new int[values.length];
boolean change = true;
while(change) {
change = false;
@SuppressWarnings("unchecked")
List<Integer>[] clusters = new List[k];
for (int i = 0; i < k; i++) {
clusters[i] = new ArrayList<>();
}
for (int i = 0; i < values.length; i++) {
for (int j = 1; j < k; j++) {
if (Math.abs(values[i] - round[j]) < Math.abs(values[i] - round[b[i]])) {
b[i] = j;
change = true;
}
}
clusters[b[i]].add(values[i]);
}
for (int i = 0; i < k; i++) {
int sum = 0;
for (int v : clusters[i]) {
sum += v;
}
int res = Math.round((float) sum / clusters[i].size());
if (res != round[i]) {
round[i] = res;
change = true;
}
}
if (!change) {
for (int i = 0; i < k; i++) {
int max = 0;
for (int v : clusters[i]) {
max = Math.max(max, v);
}
round[i] = max;
}
break;
}
}
}
Arrays.sort(round);
}
@Override
public Integer apply(Integer o) {
if (round == null) {
throw new NullPointerException("This rounding function was never intialized using init(int[] values)");
}
int x = Arrays.binarySearch(round, o);
if (x < 0) {
return round[-(x + 1)];
} else {
return round[x];
}
}
};
}
}
| [
"kyldvs@gmail.com"
] | kyldvs@gmail.com |
d75c00db27daf4424b47cef75c0a2aaeafc7f341 | 5c2302bb29b8c415ebfa5b566183d434d3775571 | /src/controllers/attendances/AttendancesNewServlet.java | 94e882e81dd5aae5da5523bdd25d7aeaed6b8b03 | [] | no_license | azuman11/daily_report_system | cdfbbd1c7260be4e7e9b4d5507c5c145de301307 | 1c463a62f591360e6911f30f18111a962f11f97a | refs/heads/master | 2022-12-04T22:37:06.179635 | 2019-11-03T05:48:54 | 2019-11-03T05:48:54 | 211,652,697 | 0 | 0 | null | 2022-11-24T08:18:58 | 2019-09-29T11:30:30 | Java | UTF-8 | Java | false | false | 1,433 | java | package controllers.attendances;
import java.io.IOException;
import java.sql.Date;
import java.sql.Timestamp;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import models.Attendance;
/**
* Servlet implementation class AttendancesNewServlet
*/
@WebServlet("/attendances/new")
public class AttendancesNewServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AttendancesNewServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("_token", request.getSession().getId());
Attendance a = new Attendance();
a.setAttendance_date(new Date(System.currentTimeMillis()));
a.setGoing_time(new Timestamp(System.currentTimeMillis()));
request.setAttribute("attendance", a);
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/attendances/new.jsp");
rd.forward(request, response);
}
} | [
"hazimetedesu@gmail.com"
] | hazimetedesu@gmail.com |
5e2cf9381c376a927dce908dda8213b3097b9f40 | df032493ce92455ad5f8b9596590d81fd2b005b4 | /CCSystem/src/main/java/com/team08/CCSystem/service/DoctorMarkService.java | 6d0b45594b18c151b8f685ce01af1f1de7fc6a14 | [] | no_license | Ivana98/MRS_ISA_2020_T8 | 0e622505b492747f01b8c864348dd36ea89c4f41 | 79fa0c0cefaa56f3c61b280d0386d7fcc27e1898 | refs/heads/master | 2021-12-25T12:43:32.785998 | 2021-08-31T14:47:23 | 2021-08-31T14:47:23 | 253,529,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 794 | java | /**
*
*/
package com.team08.CCSystem.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.team08.CCSystem.model.DoctorMark;
import com.team08.CCSystem.repository.DoctorMarkRepository;
/**
* @author Veljko
*
*/
@Service
public class DoctorMarkService {
@Autowired
private DoctorMarkRepository doctorMarkRepository;
public DoctorMark findOne(Long id) {
return doctorMarkRepository.findById(id).orElseGet(null);
}
public List<DoctorMark> findAll() {
return doctorMarkRepository.findAll();
}
public DoctorMark save(DoctorMark doctorMark) {
return doctorMarkRepository.save(doctorMark);
}
public void remove(Long id) {
doctorMarkRepository.deleteById(id);
}
}
| [
"51533885+Veljko998@users.noreply.github.com"
] | 51533885+Veljko998@users.noreply.github.com |
624ec94d7f5e9d2e45dbc1dcec92a45d8617158f | 173a7e3c1d4b34193aaee905beceee6e34450e35 | /kmzyc-cms/kmzyc-cms-web/src/main/java/com/pltfm/cms/service/CmsUserSiteService.java | 721b82e75471d7b22839ce6c1ddbee7d7937133a | [] | no_license | jjmnbv/km_dev | d4fc9ee59476248941a2bc99a42d57fe13ca1614 | f05f4a61326957decc2fc0b8e06e7b106efc96d4 | refs/heads/master | 2020-03-31T20:03:47.655507 | 2017-05-26T10:01:56 | 2017-05-26T10:01:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,647 | java | package com.pltfm.cms.service;
import com.kmzyc.commons.page.Page;
import com.pltfm.cms.vobject.CmsUserSite;
import com.pltfm.cms.vobject.CmsUserSiteShow;
import java.util.List;
/***
*
* CmsUserSiteService
* */
public interface CmsUserSiteService {
/**
* 分页查询用户与站点信息
*
* @param cmsUserSite 用户与站点信息实体
* @param page 分页实体
* @throws Exception 异常
* @return 返回值
*/
Page queryForPage(CmsUserSite cmsUserSite, Page page) throws Exception;
/**
* 跟据站点查询用户
*/
public List<CmsUserSite> selUse(Integer siteId) throws Exception;
/***
*
* 删除站点用户记录
* */
public Integer delete(List<Integer> siteIds) throws Exception;
/***
*
* 跟据用户Id查询用户所有的站点
* */
public List cmsUserSite(Integer id) throws Exception;
/***
*
* 添加站点用户记录
* */
public Integer insert(CmsUserSite cmsUserSite) throws Exception;
/***
*
* 跟据站点id查询是否关系到用户站点表
* */
public Integer checkUserSite(Integer siteId) throws Exception;
/***
*
* 保存用户选择站点记录
* */
public Integer insert(List<Integer> siteIds, int userid) throws Exception;
/***
*
* 保存站点选择用户记录
* userid 用户id集合
* siteId 站点id
* id 前当操作员id
* */
public Integer addUuseStie(List<Integer> userid, int siteId, int id) throws Exception;
/***
*
* 查询用户下站点
* */
public String selectStieName(Integer userid) throws Exception;
/***
*
* 修改站点用户记录
* */
public Integer update(CmsUserSite cmsUserSite) throws Exception;
/***
*
* 跟据id查询站点用户记录
* */
public CmsUserSite selectByPrimaryKey(Integer siteId) throws Exception;
/***
* 多条件查询站点记录
*
* @param 站点记录实体
* @return
* @throws Exception
* 异常
*/
public Page searchPageByVo(Page pageParam, CmsUserSite cmsUserSite)
throws Exception;
/**
* 查询用户所拥有的站点信息
*
* @param userSite 用户站点对应实体
* @return 所有用户所拥有的站点信息
* @throws Exception 异常信息
*/
public List<CmsUserSiteShow> queryUserSiteList(CmsUserSite userSite) throws Exception;
}
| [
"luoxinyu@km.com"
] | luoxinyu@km.com |
3dc2c87bcf3e39814cd40416847e5de58fcb9c1c | 94c9474f7a781b48bc2cc60879fcf66a910ecd47 | /app/src/main/java/com/myshopapp/lxc/util/ChannelData.java | 663ff020aa7076372daa224d9c4989e23084522b | [] | no_license | ytdxgdhhw/MyshopApp | 4710042cd896c43f7bb44e1c6b66a76ac889748c | 1e8565486ecffaed37f4776118836dd48e093e2c | refs/heads/master | 2021-01-10T01:09:21.413617 | 2015-11-12T07:17:27 | 2015-11-12T07:17:27 | 46,036,214 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | package com.myshopapp.lxc.util;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2015/10/16.
*/
public class ChannelData {
private List<ChannelCategory> list;
public ChannelData(){
super();
list=new ArrayList<>();
list.add(new ChannelCategory("推荐", 1));
list.add(new ChannelCategory("运动户外馆",2));
list.add(new ChannelCategory("鞋靴馆", 3));
list.add(new ChannelCategory("女装馆",4));
list.add(new ChannelCategory("男装馆",5));
list.add(new ChannelCategory("儿童馆",6));
list.add(new ChannelCategory("家品管",7));
list.add(new ChannelCategory("内衣馆",8));
list.add(new ChannelCategory("配饰",9));
list.add(new ChannelCategory("箱包馆",0));
}
public List<ChannelCategory> getChannel(){
return list;
}
}
| [
"303729942@qq.com"
] | 303729942@qq.com |
ffa2162c5ae44b2fa7c5f67d64f9a3b3ed1b37b3 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/58644/src_0.java | 6dbfcbf142bd1f210216a7661362643aacf7dad2 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 51,586 | java | /*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.dom;
import java.lang.reflect.Method;
import junit.framework.Test;
import org.eclipse.jdt.core.dom.*;
import org.eclipse.jdt.core.dom.ASTNode;
public class ASTVisitorTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase {
public static Test suite() {
junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTVisitorTest.class.getName());
Class c = ASTVisitorTest.class;
Method[] methods = c.getMethods();
for (int i = 0, max = methods.length; i < max; i++) {
if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
suite.addTest(new ASTVisitorTest(methods[i].getName()));
}
}
return suite;
}
AST ast;
SimpleName N1;
String N1S;
SimpleName N2;
String N2S;
SimpleName N3;
String N3S;
Expression E1;
String E1S;
Expression E2;
String E2S;
Type T1;
String T1S;
Statement S1;
String S1S;
Statement S2;
Block B1;
String B1S;
String S2S;
SingleVariableDeclaration V1;
String V1S;
SingleVariableDeclaration V2;
String V2S;
VariableDeclarationFragment W1;
String W1S;
VariableDeclarationFragment W2;
String W2S;
FieldDeclaration FD1;
String FD1S;
FieldDeclaration FD2;
String FD2S;
PackageDeclaration PD1;
String PD1S;
ImportDeclaration ID1;
String ID1S;
ImportDeclaration ID2;
String ID2S;
TypeDeclaration TD1;
String TD1S;
TypeDeclaration TD2;
String TD2S;
Javadoc JD1;
String JD1S;
TagElement TAG1;
String TAG1S;
TextElement TEXT1;
String TEXT1S;
MemberRef MBREF1;
String MBREF1S;
MethodRef MTHREF1;
String MTHREF1S;
MethodRefParameter MPARM1;
String MPARM1S;
LineComment LC1;
String LC1S;
BlockComment BC1;
String BC1S;
Javadoc JD2;
String JD2S;
AnonymousClassDeclaration ACD1;
String ACD1S;
final StringBuffer b = new StringBuffer();
public ASTVisitorTest(String name) {
super(name);
}
/**
* @deprecated (not really - just suppressing the warnings
* that come from testing Javadoc.getComment())
*
*/
protected void setUp() {
ast = new AST();
N1 = ast.newSimpleName("N"); //$NON-NLS-1$
N1S = "[(nSNNnS)]"; //$NON-NLS-1$
N2 = ast.newSimpleName("M"); //$NON-NLS-1$
N2S = "[(nSMMnS)]"; //$NON-NLS-1$
N3 = ast.newSimpleName("O"); //$NON-NLS-1$
N3S = "[(nSOOnS)]"; //$NON-NLS-1$
E1 = ast.newSimpleName("X"); //$NON-NLS-1$
E1S = "[(nSXXnS)]"; //$NON-NLS-1$
E2 = ast.newSimpleName("Y"); //$NON-NLS-1$
E2S = "[(nSYYnS)]"; //$NON-NLS-1$
T1 = ast.newSimpleType(ast.newSimpleName("Z")); //$NON-NLS-1$
T1S = "[(tS[(nSZZnS)]tS)]"; //$NON-NLS-1$
S1 = ast.newContinueStatement();
S1S = "[(sCNsCN)]"; //$NON-NLS-1$
S2 = ast.newBreakStatement();
S2S = "[(sBRsBR)]"; //$NON-NLS-1$
B1 = ast.newBlock();
B1S = "[(sBsB)]"; //$NON-NLS-1$
V1 = ast.newSingleVariableDeclaration();
V1.setType(ast.newPrimitiveType(PrimitiveType.INT));
V1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
V1S = "[(VD[(tPintinttP)][(nSaanS)]VD)]"; //$NON-NLS-1$
V2 = ast.newSingleVariableDeclaration();
V2.setType(ast.newPrimitiveType(PrimitiveType.BYTE));
V2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
V2S = "[(VD[(tPbytebytetP)][(nSbbnS)]VD)]"; //$NON-NLS-1$
W1 = ast.newVariableDeclarationFragment();
W1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
W1S = "[(VS[(nSaanS)]VS)]"; //$NON-NLS-1$
W2 = ast.newVariableDeclarationFragment();
W2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
W2S = "[(VS[(nSbbnS)]VS)]"; //$NON-NLS-1$
{
VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
temp.setName(ast.newSimpleName("f")); //$NON-NLS-1$
FD1 = ast.newFieldDeclaration(temp);
FD1.setType(ast.newPrimitiveType(PrimitiveType.INT));
FD1S = "[(FD[(tPintinttP)][(VS[(nSffnS)]VS)]FD)]"; //$NON-NLS-1$
}
{
VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
temp.setName(ast.newSimpleName("g")); //$NON-NLS-1$
FD2 = ast.newFieldDeclaration(temp);
FD2.setType(ast.newPrimitiveType(PrimitiveType.CHAR));
FD2S = "[(FD[(tPcharchartP)][(VS[(nSggnS)]VS)]FD)]"; //$NON-NLS-1$
}
PD1 = ast.newPackageDeclaration();
PD1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
PD1S = "[(PD[(nSppnS)]PD)]"; //$NON-NLS-1$
ID1 = ast.newImportDeclaration();
ID1.setName(ast.newSimpleName("i")); //$NON-NLS-1$
ID1S = "[(ID[(nSiinS)]ID)]"; //$NON-NLS-1$
ID2 = ast.newImportDeclaration();
ID2.setName(ast.newSimpleName("j")); //$NON-NLS-1$
ID2S = "[(ID[(nSjjnS)]ID)]"; //$NON-NLS-1$
TD1 = ast.newTypeDeclaration();
TD1.setName(ast.newSimpleName("c")); //$NON-NLS-1$
TD1S = "[(TD[(nSccnS)]TD)]"; //$NON-NLS-1$
TD2 = ast.newTypeDeclaration();
TD2.setName(ast.newSimpleName("d")); //$NON-NLS-1$
TD2S = "[(TD[(nSddnS)]TD)]"; //$NON-NLS-1$
ACD1 = ast.newAnonymousClassDeclaration();
ACD1S = "[(ACDACD)]"; //$NON-NLS-1$
JD1 = ast.newJavadoc();
JD1.setComment("/**X*/"); //$NON-NLS-1$
JD1S = "[(JD/**X*//**X*/JD)]"; //$NON-NLS-1$
JD2 = ast.newJavadoc();
JD2.setComment("/**Y*/"); //$NON-NLS-1$
JD2S = "[(JD/**Y*//**Y*/JD)]"; //$NON-NLS-1$
LC1 = ast.newLineComment();
LC1S = "[(//*//)]"; //$NON-NLS-1$
BC1 = ast.newBlockComment();
BC1S = "[(/**/)]"; //$NON-NLS-1$
TAG1 = ast.newTagElement();
TAG1.setTagName("@foo"); //$NON-NLS-1$
TAG1S = "[(TG@foo@fooTG)]"; //$NON-NLS-1$
TEXT1 = ast.newTextElement();
TEXT1.setText("foo"); //$NON-NLS-1$
TEXT1S = "[(TXfoofooTX)]"; //$NON-NLS-1$
MBREF1 = ast.newMemberRef();
MBREF1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
MBREF1S = "[(MBREF[(nSppnS)]MBREF)]"; //$NON-NLS-1$
MTHREF1 = ast.newMethodRef();
MTHREF1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
MTHREF1S = "[(MTHREF[(nSppnS)]MTHREF)]"; //$NON-NLS-1$
MPARM1 = ast.newMethodRefParameter();
MPARM1.setType(ast.newPrimitiveType(PrimitiveType.CHAR));
MPARM1S = "[(MPARM[(tPcharchartP)]MPARM)]"; //$NON-NLS-1$
}
protected void tearDown() {
ast = null;
}
class TestVisitor extends ASTVisitor {
boolean visitTheKids = true;
public boolean isVisitingChildren() {
return visitTheKids;
}
public void setVisitingChildren(boolean visitChildren) {
visitTheKids = visitChildren;
}
// NAMES
public boolean visit(SimpleName node) {
b.append("(nS"); //$NON-NLS-1$
b.append(node.getIdentifier());
return isVisitingChildren();
}
public void endVisit(SimpleName node) {
b.append(node.getIdentifier());
b.append("nS)"); //$NON-NLS-1$
}
public boolean visit(QualifiedName node) {
b.append("(nQ"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(QualifiedName node) {
b.append("nQ)"); //$NON-NLS-1$
}
// TYPES
public boolean visit(SimpleType node) {
b.append("(tS"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SimpleType node) {
b.append("tS)"); //$NON-NLS-1$
}
public boolean visit(ArrayType node) {
b.append("(tA"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ArrayType node) {
b.append("tA)"); //$NON-NLS-1$
}
public boolean visit(PrimitiveType node) {
b.append("(tP"); //$NON-NLS-1$
b.append(node.getPrimitiveTypeCode().toString());
return isVisitingChildren();
}
public void endVisit(PrimitiveType node) {
b.append(node.getPrimitiveTypeCode().toString());
b.append("tP)"); //$NON-NLS-1$
}
// EXPRESSIONS and STATEMENTS
public boolean visit(ArrayAccess node) {
b.append("(eAA"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ArrayAccess node) {
b.append("eAA)"); //$NON-NLS-1$
}
public boolean visit(ArrayCreation node) {
b.append("(eAC"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ArrayCreation node) {
b.append("eAC)"); //$NON-NLS-1$
}
public boolean visit(ArrayInitializer node) {
b.append("(eAI"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ArrayInitializer node) {
b.append("eAI)"); //$NON-NLS-1$
}
public boolean visit(AssertStatement node) {
b.append("(sAS"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(AssertStatement node) {
b.append("sAS)"); //$NON-NLS-1$
}
public boolean visit(Assignment node) {
b.append("("); //$NON-NLS-1$
b.append(node.getOperator().toString());
return isVisitingChildren();
}
public void endVisit(Assignment node) {
b.append(node.getOperator().toString());
b.append(")"); //$NON-NLS-1$
}
public boolean visit(Block node) {
b.append("(sB"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(Block node) {
b.append("sB)"); //$NON-NLS-1$
}
public boolean visit(BooleanLiteral node) {
b.append("(eBL"); //$NON-NLS-1$
b.append(node.booleanValue() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
return isVisitingChildren();
}
public void endVisit(BooleanLiteral node) {
b.append(node.booleanValue() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
b.append("eBL)"); //$NON-NLS-1$
}
public boolean visit(BreakStatement node) {
b.append("(sBR"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(BreakStatement node) {
b.append("sBR)"); //$NON-NLS-1$
}
public boolean visit(CastExpression node) {
b.append("(eCS"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(CastExpression node) {
b.append("eCS)"); //$NON-NLS-1$
}
public boolean visit(CatchClause node) {
b.append("(cc"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(CatchClause node) {
b.append("cc)"); //$NON-NLS-1$
}
public boolean visit(CharacterLiteral node) {
b.append("(eCL"); //$NON-NLS-1$
b.append(node.getEscapedValue());
return isVisitingChildren();
}
public void endVisit(CharacterLiteral node) {
b.append(node.getEscapedValue());
b.append("eCL)"); //$NON-NLS-1$
}
public boolean visit(ClassInstanceCreation node) {
b.append("(eCI"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ClassInstanceCreation node) {
b.append("eCI)"); //$NON-NLS-1$
}
public boolean visit(AnonymousClassDeclaration node) {
b.append("(ACD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(AnonymousClassDeclaration node) {
b.append("ACD)"); //$NON-NLS-1$
}
public boolean visit(CompilationUnit node) {
b.append("(CU"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(CompilationUnit node) {
b.append("CU)"); //$NON-NLS-1$
}
public boolean visit(ConditionalExpression node) {
b.append("(eCO"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ConditionalExpression node) {
b.append("eCO)"); //$NON-NLS-1$
}
public boolean visit(ConstructorInvocation node) {
b.append("(sCI"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ConstructorInvocation node) {
b.append("sCI)"); //$NON-NLS-1$
}
public boolean visit(ContinueStatement node) {
b.append("(sCN"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ContinueStatement node) {
b.append("sCN)"); //$NON-NLS-1$
}
public boolean visit(DoStatement node) {
b.append("(sDO"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(DoStatement node) {
b.append("sDO)"); //$NON-NLS-1$
}
public boolean visit(EmptyStatement node) {
b.append("(sEM"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(EmptyStatement node) {
b.append("sEM)"); //$NON-NLS-1$
}
public boolean visit(ExpressionStatement node) {
b.append("(sEX"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ExpressionStatement node) {
b.append("sEX)"); //$NON-NLS-1$
}
public boolean visit(FieldAccess node) {
b.append("(eFA"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(FieldAccess node) {
b.append("eFA)"); //$NON-NLS-1$
}
public boolean visit(FieldDeclaration node) {
b.append("(FD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(FieldDeclaration node) {
b.append("FD)"); //$NON-NLS-1$
}
public boolean visit(ForStatement node) {
b.append("(sFR"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ForStatement node) {
b.append("sFR)"); //$NON-NLS-1$
}
public boolean visit(IfStatement node) {
b.append("(sIF"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(IfStatement node) {
b.append("sIF)"); //$NON-NLS-1$
}
public boolean visit(ImportDeclaration node) {
b.append("(ID"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ImportDeclaration node) {
b.append("ID)"); //$NON-NLS-1$
}
public boolean visit(InfixExpression node) {
b.append("(eIN"); //$NON-NLS-1$
b.append(node.getOperator().toString());
return isVisitingChildren();
}
public void endVisit(InfixExpression node) {
b.append(node.getOperator().toString());
b.append("eIN)"); //$NON-NLS-1$
}
public boolean visit(InstanceofExpression node) {
b.append("(eIO"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(InstanceofExpression node) {
b.append("eIO)"); //$NON-NLS-1$
}
public boolean visit(Initializer node) {
b.append("(IN"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(Initializer node) {
b.append("IN)"); //$NON-NLS-1$
}
/**
* @deprecated (not really - just suppressing the warnings
* that come from testing Javadoc.getComment())
*
*/
public boolean visit(Javadoc node) {
b.append("(JD"); //$NON-NLS-1$
b.append(node.getComment());
// verify that children of Javadoc nodes are not visited automatically
assertTrue(super.visit(node) == false);
return isVisitingChildren();
}
/**
* @deprecated (not really - just suppressing the warnings
* that come from testing Javadoc.getComment())
*
*/
public void endVisit(Javadoc node) {
b.append(node.getComment());
b.append("JD)"); //$NON-NLS-1$
}
public boolean visit(BlockComment node) {
b.append("(/*"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(BlockComment node) {
b.append("*/)"); //$NON-NLS-1$
}
public boolean visit(LineComment node) {
b.append("(//"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(LineComment node) {
b.append("//)"); //$NON-NLS-1$
}
public boolean visit(TagElement node) {
b.append("(TG"); //$NON-NLS-1$
b.append(node.getTagName());
return isVisitingChildren();
}
public void endVisit(TagElement node) {
b.append(node.getTagName());
b.append("TG)"); //$NON-NLS-1$
}
public boolean visit(TextElement node) {
b.append("(TX"); //$NON-NLS-1$
b.append(node.getText());
return isVisitingChildren();
}
public void endVisit(TextElement node) {
b.append(node.getText());
b.append("TX)"); //$NON-NLS-1$
}
public boolean visit(MemberRef node) {
b.append("(MBREF"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(MemberRef node) {
b.append("MBREF)"); //$NON-NLS-1$
}
public boolean visit(MethodRef node) {
b.append("(MTHREF"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(MethodRef node) {
b.append("MTHREF)"); //$NON-NLS-1$
}
public boolean visit(MethodRefParameter node) {
b.append("(MPARM"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(MethodRefParameter node) {
b.append("MPARM)"); //$NON-NLS-1$
}
public boolean visit(LabeledStatement node) {
b.append("(sLA"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(LabeledStatement node) {
b.append("sLA)"); //$NON-NLS-1$
}
public boolean visit(MethodDeclaration node) {
b.append("(MD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(MethodDeclaration node) {
b.append("MD)"); //$NON-NLS-1$
}
public boolean visit(MethodInvocation node) {
b.append("(eMI"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(MethodInvocation node) {
b.append("eMI)"); //$NON-NLS-1$
}
public boolean visit(NullLiteral node) {
b.append("(eNL"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(NullLiteral node) {
b.append("eNL)"); //$NON-NLS-1$
}
public boolean visit(NumberLiteral node) {
b.append("(eNU"); //$NON-NLS-1$
b.append(node.getToken());
return isVisitingChildren();
}
public void endVisit(NumberLiteral node) {
b.append(node.getToken());
b.append("eNU)"); //$NON-NLS-1$
}
public boolean visit(PackageDeclaration node) {
b.append("(PD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(PackageDeclaration node) {
b.append("PD)"); //$NON-NLS-1$
}
public boolean visit(ParenthesizedExpression node) {
b.append("(ePA"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ParenthesizedExpression node) {
b.append("ePA)"); //$NON-NLS-1$
}
public boolean visit(PostfixExpression node) {
b.append("(ePO"); //$NON-NLS-1$
b.append(node.getOperator().toString());
return isVisitingChildren();
}
public void endVisit(PostfixExpression node) {
b.append(node.getOperator().toString());
b.append("ePO)"); //$NON-NLS-1$
}
public boolean visit(PrefixExpression node) {
b.append("(ePR"); //$NON-NLS-1$
b.append(node.getOperator().toString());
return isVisitingChildren();
}
public void endVisit(PrefixExpression node) {
b.append(node.getOperator().toString());
b.append("ePR)"); //$NON-NLS-1$
}
public boolean visit(ReturnStatement node) {
b.append("(sRT"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ReturnStatement node) {
b.append("sRT)"); //$NON-NLS-1$
}
public boolean visit(SingleVariableDeclaration node) {
b.append("(VD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SingleVariableDeclaration node) {
b.append("VD)"); //$NON-NLS-1$
}
public boolean visit(StringLiteral node) {
b.append("(eSL"); //$NON-NLS-1$
b.append(node.getLiteralValue());
return isVisitingChildren();
}
public void endVisit(StringLiteral node) {
b.append(node.getLiteralValue());
b.append("eSL)"); //$NON-NLS-1$
}
public boolean visit(SuperConstructorInvocation node) {
b.append("(sSC"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SuperConstructorInvocation node) {
b.append("sSC)"); //$NON-NLS-1$
}
public boolean visit(SuperFieldAccess node) {
b.append("(eSF"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SuperFieldAccess node) {
b.append("eSF)"); //$NON-NLS-1$
}
public boolean visit(SuperMethodInvocation node) {
b.append("(eSM"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SuperMethodInvocation node) {
b.append("eSM)"); //$NON-NLS-1$
}
public boolean visit(SwitchCase node) {
b.append("(sSC"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SwitchCase node) {
b.append("sSC)"); //$NON-NLS-1$
}
public boolean visit(SwitchStatement node) {
b.append("(sSW"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SwitchStatement node) {
b.append("sSW)"); //$NON-NLS-1$
}
public boolean visit(SynchronizedStatement node) {
b.append("(sSY"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(SynchronizedStatement node) {
b.append("sSY)"); //$NON-NLS-1$
}
public boolean visit(ThisExpression node) {
b.append("(eTH"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ThisExpression node) {
b.append("eTH)"); //$NON-NLS-1$
}
public boolean visit(ThrowStatement node) {
b.append("(sTR"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(ThrowStatement node) {
b.append("sTR)"); //$NON-NLS-1$
}
public boolean visit(TryStatement node) {
b.append("(sTY"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(TryStatement node) {
b.append("sTY)"); //$NON-NLS-1$
}
public boolean visit(TypeDeclaration node) {
b.append("(TD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(TypeDeclaration node) {
b.append("TD)"); //$NON-NLS-1$
}
public boolean visit(TypeDeclarationStatement node) {
b.append("(sTD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(TypeDeclarationStatement node) {
b.append("sTD)"); //$NON-NLS-1$
}
public boolean visit(TypeLiteral node) {
b.append("(eTL"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(TypeLiteral node) {
b.append("eTL)"); //$NON-NLS-1$
}
public boolean visit(VariableDeclarationExpression node) {
b.append("(eVD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(VariableDeclarationExpression node) {
b.append("eVD)"); //$NON-NLS-1$
}
public boolean visit(VariableDeclarationFragment node) {
b.append("(VS"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(VariableDeclarationFragment node) {
b.append("VS)"); //$NON-NLS-1$
}
public boolean visit(VariableDeclarationStatement node) {
b.append("(sVD"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(VariableDeclarationStatement node) {
b.append("sVD)"); //$NON-NLS-1$
}
public boolean visit(WhileStatement node) {
b.append("(sWH"); //$NON-NLS-1$
return isVisitingChildren();
}
public void endVisit(WhileStatement node) {
b.append("sWH)"); //$NON-NLS-1$
}
public void preVisit(ASTNode node) {
b.append("["); //$NON-NLS-1$
}
public void postVisit(ASTNode node) {
b.append("]"); //$NON-NLS-1$
}
}
// NAMES
public void testSimpleName() {
Name x1 = ast.newName(new String[]{"Z"}); //$NON-NLS-1$
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(nSZZnS)]".equals(result)); //$NON-NLS-1$
}
public void testQualifiedName() {
Name x1 = ast.newName(new String[]{"X", "Y"}); //$NON-NLS-1$ //$NON-NLS-2$
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(nQ[(nSXXnS)][(nSYYnS)]nQ)]".equals(result)); //$NON-NLS-1$
}
// TYPES
public void testPrimitiveType() {
Type x1 = ast.newPrimitiveType(PrimitiveType.CHAR);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(tPcharchartP)]".equals(result)); //$NON-NLS-1$
}
public void testSimpleType() {
Type x1 = ast.newSimpleType(ast.newName(new String[]{"Z"})); //$NON-NLS-1$
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(tS[(nSZZnS)]tS)]".equals(result)); //$NON-NLS-1$
}
public void testArrayType() {
Type x0 = ast.newPrimitiveType(PrimitiveType.CHAR);
Type x1 = ast.newArrayType(x0);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(tA[(tPcharchartP)]tA)]".equals(result)); //$NON-NLS-1$
}
// EXPRESSIONS and STATEMENTS
public void testArrayAccess() {
ArrayAccess x1 = ast.newArrayAccess();
x1.setArray(E1);
x1.setIndex(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eAA"+E1S+E2S+"eAA)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testArrayCreation() {
ArrayCreation x1 = ast.newArrayCreation();
x1.setType(ast.newArrayType(T1));
x1.dimensions().add(E1);
x1.dimensions().add(E2);
x1.setInitializer(ast.newArrayInitializer());
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eAC"+"[(tA"+T1S+"tA)]"+E1S+E2S+"[(eAIeAI)]eAC)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
public void testArrayInitializer() {
ArrayInitializer x1 = ast.newArrayInitializer();
x1.expressions().add(E1);
x1.expressions().add(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eAI"+E1S+E2S+"eAI)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testAssertStatement() {
AssertStatement x1 = ast.newAssertStatement();
x1.setExpression(E1);
x1.setMessage(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sAS"+E1S+E2S+"sAS)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testAssignment() {
Assignment x1 = ast.newAssignment();
x1.setLeftHandSide(E1);
x1.setRightHandSide(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(="+E1S+E2S+"=)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testBlock() {
Block x1 = ast.newBlock();
x1.statements().add(S1);
x1.statements().add(S2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sB"+S1S+S2S+"sB)]")); //$NON-NLS-1$ //$NON-NLS-2$
// check that visiting children can be cut off
v1.setVisitingChildren(false);
b.setLength(0);
x1.accept(v1);
result = b.toString();
assertTrue(result.equals("[(sBsB)]")); //$NON-NLS-1$
}
public void testBlockComment() {
BlockComment x1 = ast.newBlockComment();
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(/**/)]".equals(result)); //$NON-NLS-1$
}
public void testBooleanLiteral() {
BooleanLiteral x1 = ast.newBooleanLiteral(true);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eBLtruetrueeBL)]")); //$NON-NLS-1$
}
public void testBreakStatement() {
BreakStatement x1 = ast.newBreakStatement();
x1.setLabel(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sBR"+N1S+"sBR)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCastExpression() {
CastExpression x1 = ast.newCastExpression();
x1.setType(T1);
x1.setExpression(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eCS"+T1S+E1S+"eCS)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCatchClause() {
CatchClause x1 = ast.newCatchClause();
x1.setException(V1);
x1.setBody(B1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(cc"+V1S+B1S+"cc)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCharacterLiteral() {
CharacterLiteral x1 = ast.newCharacterLiteral();
x1.setCharValue('q');
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eCL'q''q'eCL)]")); //$NON-NLS-1$
}
public void testClassInstanceCreation() {
ClassInstanceCreation x1 = ast.newClassInstanceCreation();
x1.setExpression(E1);
x1.setName(N1);
x1.setAnonymousClassDeclaration(ACD1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eCI"+E1S+N1S+ACD1S+"eCI)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testAnonymousClassDeclaration() {
AnonymousClassDeclaration x1 = ast.newAnonymousClassDeclaration();
x1.bodyDeclarations().add(FD1);
x1.bodyDeclarations().add(FD2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(ACD"+FD1S+FD2S+"ACD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCompilationUnit() {
CompilationUnit x1 = ast.newCompilationUnit();
x1.setPackage(PD1);
x1.imports().add(ID1);
x1.imports().add(ID2);
x1.types().add(TD1);
x1.types().add(TD2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(CU"+PD1S+ID1S+ID2S+TD1S+TD2S+"CU)]")); //$NON-NLS-1$ //$NON-NLS-2$
// check that visiting children can be cut off
v1.setVisitingChildren(false);
b.setLength(0);
x1.accept(v1);
result = b.toString();
assertTrue(result.equals("[(CUCU)]")); //$NON-NLS-1$
}
public void testConditionalExpression() {
ConditionalExpression x1 = ast.newConditionalExpression();
x1.setExpression(E1);
x1.setThenExpression(E2);
x1.setElseExpression(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eCO"+E1S+E2S+N1S+"eCO)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testConstructorInvocation() {
ConstructorInvocation x1 = ast.newConstructorInvocation();
x1.arguments().add(E1);
x1.arguments().add(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sCI"+E1S+E2S+"sCI)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testContinueStatement() {
ContinueStatement x1 = ast.newContinueStatement();
x1.setLabel(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sCN"+N1S+"sCN)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDoStatement() {
DoStatement x1 = ast.newDoStatement();
x1.setExpression(E1);
x1.setBody(S1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sDO"+S1S+E1S+"sDO)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testEmptyStatement() {
EmptyStatement x1 = ast.newEmptyStatement();
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sEMsEM)]")); //$NON-NLS-1$
}
public void testExpressionStatement() {
ExpressionStatement x1 = ast.newExpressionStatement(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sEX"+E1S+"sEX)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testFieldAccess() {
FieldAccess x1 = ast.newFieldAccess();
x1.setExpression(E1);
x1.setName(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eFA"+E1S+N1S+"eFA)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testFieldDeclaration() {
FieldDeclaration x1 = ast.newFieldDeclaration(W1);
x1.setJavadoc(JD1);
x1.setType(T1);
x1.fragments().add(W2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(FD"+JD1S+T1S+W1S+W2S+"FD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testForStatement() {
ForStatement x1 = ast.newForStatement();
x1.initializers().add(E1);
x1.initializers().add(E2);
x1.setExpression(N1);
x1.updaters().add(N2);
x1.updaters().add(N3);
x1.setBody(S1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sFR"+E1S+E2S+N1S+N2S+N3S+S1S+"sFR)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testIfStatement() {
IfStatement x1 = ast.newIfStatement();
x1.setExpression(E1);
x1.setThenStatement(S1);
x1.setElseStatement(S2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sIF"+E1S+S1S+S2S+"sIF)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testImportDeclaration() {
ImportDeclaration x1 = ast.newImportDeclaration();
x1.setName(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(ID"+N1S+"ID)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testInfixExpression() {
InfixExpression x1 = ast.newInfixExpression();
x1.setOperator(InfixExpression.Operator.PLUS);
x1.setLeftOperand(E1);
x1.setRightOperand(E2);
x1.extendedOperands().add(N1);
x1.extendedOperands().add(N2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eIN+"+E1S+E2S+N1S+N2S+"+eIN)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testInstanceofExpression() {
InstanceofExpression x1 = ast.newInstanceofExpression();
x1.setLeftOperand(E1);
x1.setRightOperand(T1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eIO"+E1S+T1S+"eIO)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testInitializer() {
Initializer x1 = ast.newInitializer();
x1.setJavadoc(JD1);
x1.setBody(B1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(IN"+JD1S+B1S+"IN)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* @deprecated (not really - just suppressing the warnings
* that come from testing Javadoc.getComment())
*
*/
public void testJavadoc() {
Javadoc x1 = ast.newJavadoc();
x1.setComment("/**?*/"); //$NON-NLS-1$
x1.tags().add(TAG1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(("[(JD/**?*/"+TAG1S+"/**?*/JD)]").equals(result)); //$NON-NLS-1$
}
public void testLabeledStatement() {
LabeledStatement x1 = ast.newLabeledStatement();
x1.setLabel(N1);
x1.setBody(S1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sLA"+N1S+S1S+"sLA)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testLineComment() {
LineComment x1 = ast.newLineComment();
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(////)]".equals(result)); //$NON-NLS-1$
}
public void testMemberRef() {
MemberRef x1 = ast.newMemberRef();
x1.setQualifier(N1);
x1.setName(N2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(MBREF"+N1S+N2S+"MBREF)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testMethodDeclaration() {
MethodDeclaration x1 = ast.newMethodDeclaration();
x1.setJavadoc(JD1);
x1.setReturnType(T1);
x1.setName(N1);
x1.parameters().add(V1);
x1.parameters().add(V2);
x1.thrownExceptions().add(N2);
x1.thrownExceptions().add(N3);
x1.setBody(B1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(MD"+JD1S+T1S+N1S+V1S+V2S+N2S+N3S+B1S+"MD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testMethodInvocation() {
MethodInvocation x1 = ast.newMethodInvocation();
x1.setExpression(N1);
x1.setName(N2);
x1.arguments().add(E1);
x1.arguments().add(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eMI"+N1S+N2S+E1S+E2S+"eMI)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testMethodRef() {
MethodRef x1 = ast.newMethodRef();
x1.setQualifier(N1);
x1.setName(N2);
x1.parameters().add(MPARM1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(MTHREF"+N1S+N2S+MPARM1S+"MTHREF)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testMethodRefParameter() {
MethodRefParameter x1 = ast.newMethodRefParameter();
x1.setType(T1);
x1.setName(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(MPARM"+T1S+N1S+"MPARM)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testNullLiteral() {
NullLiteral x1 = ast.newNullLiteral();
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eNLeNL)]")); //$NON-NLS-1$
}
public void testNumberLiteral() {
NumberLiteral x1 = ast.newNumberLiteral("1.0"); //$NON-NLS-1$
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eNU1.01.0eNU)]")); //$NON-NLS-1$
}
public void testPackageDeclaration() {
PackageDeclaration x1 = ast.newPackageDeclaration();
x1.setName(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(PD"+N1S+"PD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testParenthesizedExpression() {
ParenthesizedExpression x1 = ast.newParenthesizedExpression();
x1.setExpression(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(ePA"+E1S+"ePA)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testPostfixExpression() {
PostfixExpression x1 = ast.newPostfixExpression();
x1.setOperand(E1);
x1.setOperator(PostfixExpression.Operator.INCREMENT);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(ePO++"+E1S+"++ePO)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testPrefixExpression() {
PrefixExpression x1 = ast.newPrefixExpression();
x1.setOperand(E1);
x1.setOperator(PrefixExpression.Operator.INCREMENT);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(ePR++"+E1S+"++ePR)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testReturnStatement() {
ReturnStatement x1 = ast.newReturnStatement();
x1.setExpression(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sRT"+E1S+"sRT)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testStringLiteral() {
StringLiteral x1 = ast.newStringLiteral();
x1.setLiteralValue("H"); //$NON-NLS-1$
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eSLHHeSL)]")); //$NON-NLS-1$
}
public void testSuperConstructorInvocation() {
SuperConstructorInvocation x1 = ast.newSuperConstructorInvocation();
x1.setExpression(N1);
x1.arguments().add(E1);
x1.arguments().add(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sSC"+N1S+E1S+E2S+"sSC)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSuperFieldAccess() {
SuperFieldAccess x1 = ast.newSuperFieldAccess();
x1.setQualifier(N1);
x1.setName(N2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eSF"+N1S+N2S+"eSF)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSuperMethodInvocation() {
SuperMethodInvocation x1 = ast.newSuperMethodInvocation();
x1.setQualifier(N1);
x1.setName(N2);
x1.arguments().add(E1);
x1.arguments().add(E2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eSM"+N1S+N2S+E1S+E2S+"eSM)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSwitchCase() {
SwitchCase x1 = ast.newSwitchCase();
x1.setExpression(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sSC"+E1S+"sSC)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSwitchStatement() {
SwitchStatement x1 = ast.newSwitchStatement();
x1.setExpression(E1);
x1.statements().add(S1);
x1.statements().add(S2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sSW"+E1S+S1S+S2S+"sSW)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSynchronizedStatement() {
SynchronizedStatement x1 = ast.newSynchronizedStatement();
x1.setExpression(E1);
x1.setBody(B1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sSY"+E1S+B1S+"sSY)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testTagElement() {
TagElement x1 = ast.newTagElement();
x1.setTagName("x"); //$NON-NLS-1$
x1.fragments().add(TAG1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(("[(TGx"+TAG1S+"xTG)]").equals(result)); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testTextElement() {
TextElement x1 = ast.newTextElement();
x1.setText("x"); //$NON-NLS-1$
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue("[(TXxxTX)]".equals(result)); //$NON-NLS-1$
}
public void testThisExpression() {
ThisExpression x1 = ast.newThisExpression();
x1.setQualifier(N1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eTH"+N1S+"eTH)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testThrowStatement() {
ThrowStatement x1 = ast.newThrowStatement();
x1.setExpression(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sTR"+E1S+"sTR)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testTryStatement() {
TryStatement x1 = ast.newTryStatement();
x1.setBody(B1);
CatchClause c1 = ast.newCatchClause();
c1.setException(V1);
c1.setBody(ast.newBlock());
x1.catchClauses().add(c1);
CatchClause c2 = ast.newCatchClause();
c2.setException(V2);
c2.setBody(ast.newBlock());
x1.catchClauses().add(c2);
x1.setFinally(ast.newBlock());
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sTY"+B1S+"[(cc"+V1S+"[(sBsB)]"+"cc)]"+"[(cc"+V2S+"[(sBsB)]"+"cc)]"+"[(sBsB)]"+"sTY)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
}
public void testTypeDeclaration() {
TypeDeclaration x1 = ast.newTypeDeclaration();
x1.setJavadoc(JD1);
x1.setName(N1);
x1.setSuperclass(N2);
x1.superInterfaces().add(N3);
x1.superInterfaces().add(ast.newSimpleName("J")); //$NON-NLS-1$
x1.bodyDeclarations().add(FD1);
x1.bodyDeclarations().add(FD2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(TD"+JD1S+N1S+N2S+N3S+"[(nSJJnS)]"+FD1S+FD2S+"TD)]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testTypeDeclarationStatement() {
TypeDeclarationStatement x1 = ast.newTypeDeclarationStatement(TD1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sTD"+TD1S+"sTD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testTypeLiteral() {
TypeLiteral x1 = ast.newTypeLiteral();
x1.setType(T1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eTL"+T1S+"eTL)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testVariableDeclaration() {
SingleVariableDeclaration x1 = ast.newSingleVariableDeclaration();
x1.setType(T1);
x1.setName(N1);
x1.setInitializer(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(VD"+T1S+N1S+E1S+"VD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testVariableSpecifier() {
VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment();
x1.setName(N1);
x1.setInitializer(E1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(VS"+N1S+E1S+"VS)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testVariableDeclarationExpression() {
VariableDeclarationExpression x1 = ast.newVariableDeclarationExpression(W1);
x1.setType(T1);
x1.fragments().add(W2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(eVD"+T1S+W1S+W2S+"eVD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testVariableDeclarationStatement() {
VariableDeclarationStatement x1 = ast.newVariableDeclarationStatement(W1);
x1.setType(T1);
x1.fragments().add(W2);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sVD"+T1S+W1S+W2S+"sVD)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testWhileStatement() {
WhileStatement x1 = ast.newWhileStatement();
x1.setExpression(E1);
x1.setBody(S1);
TestVisitor v1 = new TestVisitor();
b.setLength(0);
x1.accept(v1);
String result = b.toString();
assertTrue(result.equals("[(sWH"+E1S+S1S+"sWH)]")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testPrePost() {
SimpleName n1 = ast.newSimpleName("a"); //$NON-NLS-1$
SimpleName n2 = ast.newSimpleName("b"); //$NON-NLS-1$
QualifiedName q = ast.newQualifiedName(n1, n2);
TestVisitor v1 = new TestVisitor() {
public void preVisit(ASTNode node) {
b.append("["); //$NON-NLS-1$
switch (node.getNodeType()) {
case ASTNode.QUALIFIED_NAME :
b.append("q"); //$NON-NLS-1$
break;
case ASTNode.SIMPLE_NAME :
b.append(((SimpleName) node).getIdentifier());
break;
}
}
public void postVisit(ASTNode node) {
switch (node.getNodeType()) {
case ASTNode.QUALIFIED_NAME :
b.append("q"); //$NON-NLS-1$
break;
case ASTNode.SIMPLE_NAME :
b.append(((SimpleName) node).getIdentifier());
break;
}
b.append("]"); //$NON-NLS-1$
}
};
b.setLength(0);
q.accept(v1);
String result = b.toString();
assertTrue(result.equals("[q(nQ" + "[a(nSaanS)a]" + "[b(nSbbnS)b]" + "nQ)q]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
public void testTraverseAndModify() {
final TypeDeclaration typeDeclaration = ast.newTypeDeclaration();
typeDeclaration.setName(N1);
MethodDeclaration methodDeclaration = ast.newMethodDeclaration();
methodDeclaration.setName(ast.newSimpleName("M1")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(0, methodDeclaration);
final MethodDeclaration methodDeclaration2 = ast.newMethodDeclaration();
methodDeclaration2.setName(ast.newSimpleName("M2")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(1, methodDeclaration2);
MethodDeclaration methodDeclaration3 = ast.newMethodDeclaration();
methodDeclaration3.setName(ast.newSimpleName("M3")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(2, methodDeclaration3);
// insert a new before the current node during a traverse
TestVisitor v1 = new TestVisitor() {
public boolean visit(MethodDeclaration node) {
if (node == methodDeclaration2) {
MethodDeclaration methodDeclaration4 = ast.newMethodDeclaration();
methodDeclaration4.setName(ast.newSimpleName("M4")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(0, methodDeclaration4);
}
return super.visit(node);
}
};
b.setLength(0);
typeDeclaration.accept(v1);
assertEquals("wrong output", "[(TD[(nSNNnS)][(MD[(tPvoidvoidtP)][(nSM1M1nS)]MD)][(MD[(tPvoidvoidtP)][(nSM2M2nS)]MD)][(MD[(tPvoidvoidtP)][(nSM3M3nS)]MD)]TD)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testTraverseAndModify_2() {
final TypeDeclaration typeDeclaration = ast.newTypeDeclaration();
typeDeclaration.setName(N1);
MethodDeclaration methodDeclaration = ast.newMethodDeclaration();
methodDeclaration.setName(ast.newSimpleName("M1")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(0, methodDeclaration);
final MethodDeclaration methodDeclaration2 = ast.newMethodDeclaration();
methodDeclaration2.setName(ast.newSimpleName("M2")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(1, methodDeclaration2);
MethodDeclaration methodDeclaration3 = ast.newMethodDeclaration();
methodDeclaration3.setName(ast.newSimpleName("M3")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(2, methodDeclaration3);
// insert a new after the current node during a traverse
TestVisitor v1 = new TestVisitor() {
public boolean visit(MethodDeclaration node) {
if (node == methodDeclaration2) {
MethodDeclaration methodDeclaration4 = ast.newMethodDeclaration();
methodDeclaration4.setName(ast.newSimpleName("M4")); //$NON-NLS-1$
typeDeclaration.bodyDeclarations().add(3, methodDeclaration4);
}
return super.visit(node);
}
};
b.setLength(0);
typeDeclaration.accept(v1);
assertEquals("wrong output", "[(TD[(nSNNnS)][(MD[(tPvoidvoidtP)][(nSM1M1nS)]MD)][(MD[(tPvoidvoidtP)][(nSM2M2nS)]MD)][(MD[(tPvoidvoidtP)][(nSM3M3nS)]MD)][(MD[(tPvoidvoidtP)][(nSM4M4nS)]MD)]TD)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testTraverseAndModify_3() {
final InfixExpression infixExpression = ast.newInfixExpression();
infixExpression.setLeftOperand(ast.newSimpleName("i")); //$NON-NLS-1$
infixExpression.setRightOperand(ast.newNumberLiteral("10")); //$NON-NLS-1$
infixExpression.setOperator(InfixExpression.Operator.PLUS);
// insert a new after the current node during a traverse
TestVisitor v1 = new TestVisitor() {
public boolean visit(SimpleName node) {
infixExpression.setRightOperand(ast.newNumberLiteral("22")); //$NON-NLS-1$
return super.visit(node);
}
};
b.setLength(0);
infixExpression.accept(v1);
assertEquals("wrong output", "[(eIN+[(nSiinS)][(eNU2222eNU)]+eIN)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testTraverseAndModify_4() {
final InfixExpression infixExpression = ast.newInfixExpression();
infixExpression.setLeftOperand(ast.newSimpleName("i")); //$NON-NLS-1$
infixExpression.setRightOperand(ast.newNumberLiteral("10")); //$NON-NLS-1$
infixExpression.setOperator(InfixExpression.Operator.PLUS);
// insert a new before the current node during a traverse
TestVisitor v1 = new TestVisitor() {
public boolean visit(NumberLiteral node) {
infixExpression.setLeftOperand(ast.newSimpleName("j")); //$NON-NLS-1$
return super.visit(node);
}
};
b.setLength(0);
infixExpression.accept(v1);
assertEquals("wrong output", "[(eIN+[(nSiinS)][(eNU1010eNU)]+eIN)]", b.toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
73d7b0e191d5a6e8befa4cce670cedf5ed9c9e38 | 5e8c3d05922b8f437bd71cc8df2826aae0f004fa | /Spectacole_Hibernate/Server/src/main/java/spectacole/server/ServiceImpl.java | 89de9c689e3102740ca14bef9a19ceb399fc5ed7 | [] | no_license | AndreiPetrescu99/Spectacole | 4612ec49316c9681fdefcf0901984cd6a8175f51 | 43a6f11cb4b58166e3ee56f304276855d65cf29c | refs/heads/master | 2023-02-10T15:50:51.673449 | 2020-12-29T16:16:31 | 2020-12-29T16:16:31 | 325,331,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,765 | java | package spectacole.server;
import org.graalvm.compiler.lir.sparc.SPARCArithmetic;
import spectacole.model.SpectacoleEntity;
import spectacole.model.VanzareEntity;
import spectacole.model.VanzareLocEntity;
import spectacole.model.VerificareEntity;
import spectacole.repo.IRepoSpectacole;
import spectacole.repo.IRepoVanzare;
import spectacole.repo.IRepoVanzareLoc;
import spectacole.repo.IRepoVerificare;
import spectacole.services.IServices;
import java.rmi.RemoteException;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ServiceImpl implements IServices {
private IRepoSpectacole repoSpectacole;
private IRepoVanzare repoVanzare;
private IRepoVanzareLoc repoVanzareLoc;
private IRepoVerificare repoVerificare;
private int cap = 100;
private boolean serverOn = true;
private final int defaultThreadCount = 5;
private ExecutorService executor = Executors.newFixedThreadPool(defaultThreadCount);
public ServiceImpl(IRepoSpectacole repoSpectacole, IRepoVanzare repoVanzare, IRepoVanzareLoc repoVanzareLoc, IRepoVerificare repoVerificare) {
this.repoSpectacole = repoSpectacole;
this.repoVanzare = repoVanzare;
this.repoVanzareLoc = repoVanzareLoc;
this.repoVerificare = repoVerificare;
try {
serverCounter();
verify();
} catch (InterruptedException e) {
e.printStackTrace();
}
// List<Integer> locuri = new ArrayList<>();
// for(int i=2; i<=66; i++){
// locuri.add(i);
// }
// try {
// String message = buyTickets(locuri, getSpectacole().get(0));
// System.out.println(message);
// }catch (RemoteException ex){
// System.out.println(ex.getMessage());
// }
}
public synchronized void serverCounter() throws InterruptedException{
executor.execute(()->{
try {
System.out.println("Server is working...");
//Thread.sleep(120000);
Thread.sleep(300000);
System.out.println("Server is shutting down...");
serverOn = false;
//TODO:Notify clients that server is off
} catch (InterruptedException e) {
e.printStackTrace();
}
});
}
public synchronized void verify() throws InterruptedException {
executor.execute(()->{
while (serverOn){
try {
System.out.println("Sleeping...");
//Thread.sleep(120000);
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (serverOn) {
System.out.println("Verifying...");
executor.execute(()->{
//List<VerificareEntity> verificari = new ArrayList<>();
if(serverOn) {
boolean ok = true;
List<SpectacoleEntity> spectacole = repoSpectacole.findSpectacole();
for (SpectacoleEntity s : spectacole) {
VerificareEntity verif = new VerificareEntity();
verif.setSpectacol(s);
verif.setDateTime(OffsetDateTime.now());
verif.setSold(soldPerSpectacle(s));
verif.setSalesList(salesList(s));
if (!verifyPlaces(s) || !verifySold(s)) {
System.out.println("Integrity error for " + s.getTitlu());
ok = false;
verif.setStatus("incorect");
} else {
verif.setStatus("corect");
}
repoVerificare.save(verif);
}
if (ok) {
System.out.println("All ok");
} else {
System.out.println("Not ok");
}
}
});
}else {
System.out.println("Done veryfing");
}
}
});
}
public synchronized boolean verifySold(SpectacoleEntity spectacol){
if(serverOn){
Map<Long, Long> soldPerTranz = new HashMap<>();
List<VanzareEntity> vanzari = repoVanzare.findVanzariBySpectacol(spectacol);
for(VanzareEntity v:vanzari){
if(soldPerTranz.containsKey(v.getIdTranzactie())){
Long price = soldPerTranz.get(v.getIdTranzactie());
price = price + spectacol.getPretBilet();
soldPerTranz.replace(v.getIdTranzactie(), price);
}else {
soldPerTranz.put(v.getIdTranzactie(), spectacol.getPretBilet());
}
}
Long sold = (long)0.0;
for(Long key:soldPerTranz.keySet()){
sold = sold + soldPerTranz.get(key);
}
if(!sold.equals(soldPerSpectacle(spectacol))){
return false;
}
return true;
}
return false;
}
public synchronized boolean verifyPlaces(SpectacoleEntity spectacol){
if(serverOn){
List<VanzareEntity> vanzari = repoVanzare.findVanzariBySpectacol(spectacol);
List<VanzareLocEntity> soldPlaces = new ArrayList<>();
for(VanzareEntity v:vanzari){
List<VanzareLocEntity> locuri = repoVanzareLoc.findLocByVanzare(v);
if(locuri.size() > 1){
System.out.println("S-au vandut doua locuri in aceeasi tranzactie");
return false;
}
soldPlaces.add(locuri.get(0));
}
for(VanzareLocEntity p:soldPlaces){
int count = 0;
for(VanzareLocEntity q:soldPlaces){
if(q.equals(p)){
count++;
}
}
if(count != 1){
System.out.println("S-a vandut acelasi loc de doua ori pentru spectacolul " + spectacol.getTitlu());
return false;
}
}
return true;
}else {
System.out.println("Server is off");
}
return false;
}
public synchronized Long soldPerSpectacle(SpectacoleEntity spectacol){
Long price = spectacol.getPretBilet();
List<VanzareEntity> vanzari = repoVanzare.findVanzariBySpectacol(spectacol);
return price * vanzari.size();
}
public synchronized String salesList(SpectacoleEntity spectacol){
StringBuilder out = new StringBuilder();
for(VanzareEntity v: repoVanzare.findVanzariBySpectacol(spectacol)){
out.append(v.getId().toString()).append(";");
}
return out.toString();
}
public synchronized List<VanzareLocEntity> getLocBySpectacol(SpectacoleEntity spectacol){
List<VanzareLocEntity> locuri = new ArrayList<>();
List<VanzareEntity> vanzari = repoVanzare.findVanzariBySpectacol(spectacol);
for(VanzareEntity v:vanzari){
locuri.add(repoVanzareLoc.findLocByVanzare(v).get(0));
}
return locuri;
}
public synchronized boolean isFree(Integer loc, SpectacoleEntity spectacol){
boolean ok = true;
for(VanzareLocEntity locVandut:getLocBySpectacol(spectacol)){
if(locVandut.getNrLoc().equals((long)loc)){
ok = false;
}
}
return ok;
}
@Override
public synchronized String buyTickets(List<Integer> locuri, SpectacoleEntity spetacol) throws RemoteException {
String message = "";
VanzareEntity last = repoVanzare.findLastTransaction();
Long idTr = (long)0.0;
if(last != null){
idTr = last.getIdTranzactie() + 1;
}
boolean allAreFree = true;
for(Integer loc:locuri){
if(!isFree(loc, spetacol)){
allAreFree = false;
}
}
if(allAreFree) {
for (Integer loc : locuri) {
VanzareEntity vanzareEntity = new VanzareEntity();
vanzareEntity.setIdTranzactie(idTr);
vanzareEntity.setSpectacol(spetacol);
vanzareEntity.setDataVanzare(OffsetDateTime.now());
VanzareLocEntity vanzareLocEntity = new VanzareLocEntity();
vanzareLocEntity.setVanzare(vanzareEntity);
vanzareLocEntity.setNrLoc((long) loc);
VanzareEntity outVanzare = repoVanzare.save(vanzareEntity);
VanzareLocEntity outVanzareLoc = repoVanzareLoc.save(vanzareLocEntity);
if (outVanzare == null || outVanzareLoc == null) {
message = "Something went wrong";
} else {
message = "Tickets bought!";
}
}
}else {
message = "Sorry, some places were already bought";
}
return message;
}
@Override
public List<SpectacoleEntity> getSpectacole() throws RemoteException {
return repoSpectacole.findSpectacole();
}
}
| [
"62251834+AndreiPetrescu99@users.noreply.github.com"
] | 62251834+AndreiPetrescu99@users.noreply.github.com |
996099eae393abfd9211ac8014b2f615f2bba685 | c64886a0f25c0e24cf917b21d20046bb8751d2f6 | /app/src/main/java/com/akhdmny/driver/ApiResponse/AcceptModel/Driver.java | 457c684cd8fd3b44ab1db92a399d0d1a446df651 | [] | no_license | saqibahsan1/Driver | a4551e51eb7c34e18227a8daf43f7bacb75baa65 | 587e0b5faacd4ae15e2492e27ba101789a6b10ec | refs/heads/master | 2020-04-02T18:45:49.240347 | 2019-03-21T12:21:15 | 2019-03-21T12:21:15 | 154,712,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,994 | java |
package com.akhdmny.driver.ApiResponse.AcceptModel;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Driver {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("email")
@Expose
private String email;
@SerializedName("first_name")
@Expose
private String firstName;
@SerializedName("last_name")
@Expose
private String lastName;
@SerializedName("user_id")
@Expose
private Integer userId;
@SerializedName("name")
@Expose
private String name;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("address")
@Expose
private String address;
@SerializedName("avatar")
@Expose
private String avatar;
@SerializedName("gender")
@Expose
private String gender;
@SerializedName("car_color")
@Expose
private String carColor;
@SerializedName("car_no")
@Expose
private String carNo;
@SerializedName("car_model")
@Expose
private Integer carModel;
@SerializedName("car_company")
@Expose
private String carCompany;
@SerializedName("rating")
@Expose
private String rating;
@SerializedName("lat")
@Expose
private Double lat;
@SerializedName("long")
@Expose
private Double _long;
@SerializedName("IsBusy")
@Expose
private Object isBusy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
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 Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getCarColor() {
return carColor;
}
public void setCarColor(String carColor) {
this.carColor = carColor;
}
public String getCarNo() {
return carNo;
}
public void setCarNo(String carNo) {
this.carNo = carNo;
}
public Integer getCarModel() {
return carModel;
}
public void setCarModel(Integer carModel) {
this.carModel = carModel;
}
public String getCarCompany() {
return carCompany;
}
public void setCarCompany(String carCompany) {
this.carCompany = carCompany;
}
public String getRating() {
return rating;
}
public void setRating(String rating) {
this.rating = rating;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLong() {
return _long;
}
public void setLong(Double _long) {
this._long = _long;
}
public Object getIsBusy() {
return isBusy;
}
public void setIsBusy(Object isBusy) {
this.isBusy = isBusy;
}
}
| [
"umerabduljabbar@icloud.com"
] | umerabduljabbar@icloud.com |
f841dbe59ff1f1f24ccc86313ca0c56577e687a5 | 3b94e111fe455114afcaef96da767dd331f6c0e8 | /src/test/java/de/uhd/ifi/se/decision/management/jira/recommendation/decisionguidance/TestRecommender.java | 3ae2f2a74e1fdf347307af2b98dcacda6791ecea | [
"MIT"
] | permissive | cures-hub/cures-condec-jira | c8be5a86d27b0186cffb7ab2dc60288397bdee0e | fbadb34925ef379f4929c9370e31c993825592f6 | refs/heads/develop | 2023-08-17T19:53:28.482601 | 2023-06-02T09:36:38 | 2023-06-02T09:36:38 | 96,444,830 | 15 | 9 | MIT | 2023-09-01T04:15:50 | 2017-07-06T15:24:50 | JavaScript | UTF-8 | Java | false | false | 4,270 | java | package de.uhd.ifi.se.decision.management.jira.recommendation.decisionguidance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import de.uhd.ifi.se.decision.management.jira.TestSetUp;
import de.uhd.ifi.se.decision.management.jira.model.Argument;
import de.uhd.ifi.se.decision.management.jira.model.KnowledgeElement;
import de.uhd.ifi.se.decision.management.jira.model.KnowledgeGraph;
import de.uhd.ifi.se.decision.management.jira.recommendation.Recommendation;
import de.uhd.ifi.se.decision.management.jira.recommendation.decisionguidance.projectsource.ProjectSource;
import de.uhd.ifi.se.decision.management.jira.testdata.JiraProjects;
import de.uhd.ifi.se.decision.management.jira.testdata.JiraUsers;
import de.uhd.ifi.se.decision.management.jira.testdata.KnowledgeElements;
import net.java.ao.test.jdbc.NonTransactional;
public class TestRecommender extends TestSetUp {
private ProjectSource projectSource;
@Before
public void setUp() {
init();
// search for solutions in the same project
projectSource = new ProjectSource(JiraProjects.getTestProject().getKey(), true);
}
@Test
@NonTransactional
public void testAddToKnowledgeGraph() {
KnowledgeSource source = new ProjectSource("TEST", true);
ElementRecommendation recommendationA = new ElementRecommendation("RecommendationA", source, "TESTURL");
ElementRecommendation recommendationB = new ElementRecommendation("RecommendationB", source, "TESTURL");
recommendationB.addArgument(new Argument(KnowledgeElements.getProArgument()));
List<Recommendation> recommendations = new ArrayList<>();
recommendations.add(recommendationA);
recommendations.add(recommendationB);
KnowledgeElement decisionProblem = KnowledgeElements.getSolvedDecisionProblem();
KnowledgeGraph graph = KnowledgeGraph.getInstance("TEST");
Recommender.addToKnowledgeGraph(decisionProblem, JiraUsers.SYS_ADMIN.getApplicationUser(), recommendations);
assertTrue(graph.vertexSet().size() > 10);
}
@Test
@NonTransactional
public void testRecommenderProperties() {
Recommender<?> recommender = Recommender.getRecommenderForKnowledgeSource("TEST", projectSource);
assertEquals(projectSource, recommender.getKnowledgeSource());
recommender.setProjectKey("TEST-CHANGE");
assertEquals("TEST-CHANGE", recommender.getProjectKey());
}
@Test
@NonTransactional
public void testGetRecommendations() {
Recommender<?> recommender = Recommender.getRecommenderForKnowledgeSource("TEST", projectSource);
List<ElementRecommendation> recommendations = recommender.getRecommendations((KnowledgeElement) null);
assertEquals(0, recommendations.size());
assertEquals(projectSource, recommender.getKnowledgeSource());
recommender.setProjectKey("TEST-CHANGE");
assertEquals("TEST-CHANGE", recommender.getProjectKey());
}
@Test
@NonTransactional
public void testGetRecommendationsWithDiscardedStatus() {
Recommender<?> recommender = Recommender.getRecommenderForKnowledgeSource("TEST", projectSource);
KnowledgeSource source = new ProjectSource("TEST", true);
ElementRecommendation recommendationA = new ElementRecommendation("RecommendationA", source, "TESTURL");
ElementRecommendation recommendationB = new ElementRecommendation("RecommendationB", source, "TESTURL");
ElementRecommendation recommendationC = new ElementRecommendation("RecommendationC", source, "TESTURL");
List<ElementRecommendation> recommendations = new ArrayList<>();
List<ElementRecommendation> discardedRecommendations = new ArrayList<>();
recommendations.add(recommendationA);
recommendations.add(recommendationB);
discardedRecommendations.add(recommendationB);
discardedRecommendations.add(recommendationC);
recommendations = recommender.getRecommendationsWithDiscardedStatus(recommendations, discardedRecommendations);
assertEquals(2, recommendations.size());
assertEquals("RecommendationA", recommendations.get(0).getSummary());
assertEquals("RecommendationB", recommendations.get(1).getSummary());
assertFalse(recommendations.get(0).isDiscarded());
assertTrue(recommendations.get(1).isDiscarded());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
14e89867d2a6fdbc87af78a169e2477148eabd57 | dce4ff9edbef476d218c79cec4acd8861b09642c | /xenon-box2d-library/src/main/java/com/abubusoft/xenon/box2d/callbacks/ParticleQueryCallback.java | cf1c4a17779c151be5f7ac6e83b6ea4619e28c2a | [] | no_license | skykying/xenon | d3e1cdc79932892d2a396926f9d21962ddef0568 | 619cc533e602307a62ceaf739daea76f88c37994 | refs/heads/master | 2021-09-16T04:22:45.416370 | 2018-06-16T09:01:28 | 2018-06-16T09:01:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | package com.abubusoft.xenon.box2d.callbacks;
import com.abubusoft.xenon.box2d.dynamics.World;
/**
* Callback class for AABB queries. See
* {@link World#queryAABB(QueryCallback, com.abubusoft.xenon.box2d.collision.AABB)}.
*
* @author dmurph
*
*/
public interface ParticleQueryCallback {
/**
* Called for each particle found in the query AABB.
*
* @return false to terminate the query.
*/
boolean reportParticle(int index);
}
| [
"abubusoft@gmail.com"
] | abubusoft@gmail.com |
5f814d864012741833a734781fdbe657e23ded23 | d47a77742e75aa6a63f4a7d1a019ee0d50812ab4 | /misc/MaxValueEachLengthOnceRhodeCuttingDP.java | 03cb72c0825cc8ee60f6d6dd915d78e10b0a3739 | [] | no_license | egultekin/interview | 1727a4a08ccabf83e2aa2fb76623405b62d5c182 | f01a4f772b58c2d6e21956e60bc85234b647719f | refs/heads/master | 2021-01-18T16:35:03.629943 | 2018-04-22T09:58:54 | 2018-04-22T09:58:54 | 84,352,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,600 | java | package misc;
import java.util.ArrayList;
public class MaxValueEachLengthOnceRhodeCuttingDP {
public MaxValueEachLengthOnceRhodeCuttingDP() {
// TODO Auto-generated constructor stub
}
public int maxValueCut(int[] cutLength, int[] cutValue, int length) {
if (null == cutLength || null == cutValue || length <= 0 || cutLength.length != cutValue.length)
throw new IllegalArgumentException("Invalid parameters.");
int[] solution = new int[length+1];
ArrayList<ArrayList<Integer>> indices = new ArrayList<ArrayList<Integer>>(length+1);
for (int i=0; i < length+1; i++) { solution[i] = 0; indices.add(i, new ArrayList<Integer>()); }
for (int i=0; i < cutLength.length; i++) { solution[cutLength[i]] = cutValue[i]; indices.get(cutLength[i]).add(i); }
for (int sum=2; sum <= length; sum++)
for (int i=0; i < cutLength.length; i++)
if (sum >= cutLength[i]
&& !indices.get(sum-cutLength[i]).contains(i)
&& solution[sum] < solution[sum-cutLength[i]] + cutValue[i]) {
solution[sum] = solution[sum-cutLength[i]] + cutValue[i];
indices.get(sum).addAll(indices.get(sum-cutLength[i]));
indices.get(sum).add(i);
}
return solution[length];
}
public static void main(String[] args) {
int[] cutLength = new int[] { 1, 9, 2, 3, 5, 7};
int[] cutValue = new int[] { 1, 2, 3, 4, 5, 6 };
int length = 20;
MaxValueEachLengthOnceRhodeCuttingDP s = new MaxValueEachLengthOnceRhodeCuttingDP();
System.out.format("Max value collectable cutting a rhode of length %d is %d.",
length, s.maxValueCut(cutLength, cutValue, length));
}
}
| [
"emre.gultekin@gmail.com"
] | emre.gultekin@gmail.com |
d0ebdcfea4e6d5e75fc22b780c971f22320b5fae | c62fd0c14e14a59df314b53e67153910df4c6ad0 | /src/main/java/com/example/reactiveprogramming/service/IStudentService.java | 13817e683a82d50afd491ee15570a361179e47fe | [] | no_license | GeovanniAlexander/ReactivePrograming | 3b88b7157cc398830d6ceefefd1528a3ed4308d8 | 49c88102dda6accc5151d81af8449e7a704baac6 | refs/heads/master | 2023-08-17T16:20:45.541309 | 2021-09-24T20:13:19 | 2021-09-24T20:13:19 | 410,090,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 967 | java | package com.example.reactiveprogramming.service;
import com.example.reactiveprogramming.serviceDto.request.AddStudentRequest;
import com.example.reactiveprogramming.serviceDto.request.UpdateStudentRequest;
import com.example.reactiveprogramming.serviceDto.response.AddStudentResponse;
import com.example.reactiveprogramming.serviceDto.response.GetActiveStudentsResponse;
import com.example.reactiveprogramming.serviceDto.response.GetStudentResponse;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Single;
import java.util.List;
public interface IStudentService {
Single<AddStudentResponse> addStudent(AddStudentRequest addStudentRequest);
Completable updateStudent(UpdateStudentRequest updateStudentRequest);
Single<GetStudentResponse> getStudent(Long studentId);
Observable<List<GetStudentResponse>> getActiveStudents();
Completable deleteStudent(Long studentId);
}
| [
"alex123joha@gmail.com"
] | alex123joha@gmail.com |
ec3e1dc19fd73012c951b98b7c9a3c76705c02e4 | 24fd5a8af3044447a989a9776876c54d5170ee91 | /src/main/java/node/Tree.java | 54ed903c22c24b6431bdd67386644107c4e8f3d1 | [] | no_license | faystmax/erlang-java | 5645d12b73494f98e9cab3d339565f63a0ea1993 | cecf64ca99fcc08d67bd90c0883c6f22d3e10192 | refs/heads/master | 2020-04-04T10:36:38.844921 | 2018-11-04T13:22:28 | 2018-11-04T13:22:28 | 155,860,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package node;
import javafx.scene.control.ListView;
import java.io.IOException;
import java.util.Collection;
/**
* @author Amosov Maxim - amosov.m@ext-system.com
* @since 04.11.2018
*/
public class Tree extends BaseNode {
static final String name = "tree";
public Tree(ListView<String> listView) throws IOException {
super(name, listView);
}
@Override
public void start(Collection<String> addresses) throws Exception {
super.start(addresses);
doWork();
}
private void doWork() throws Exception {
String value = receiveAtomValue();
if (value.equals("wind")) {
log("Received wind from tree...");
log("Sending leaves to street...");
send(Street.name, "leaves");
}
doWork();
}
}
| [
"faystmax@gmail.com"
] | faystmax@gmail.com |
32815685296290863297809a2ec9642666680f22 | 120713cf26a45ee52a2c9fa57f0a74ba122fee67 | /REST/src/test/java/api/testing/google/VolumeInfo.java | cf3931028a971eead11af8d0463177f4791e4b7a | [] | no_license | shivavinod/Api-testing | f6e84e98ce1a94b70ae69f8c283789c98dbd08a2 | 50aaf6bbdd596cf4536ad5da26f6e7199a9ad64b | refs/heads/master | 2020-04-05T10:56:02.732078 | 2018-11-09T07:07:23 | 2018-11-09T07:07:23 | 156,816,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,001 | java |
package api.testing.google;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class VolumeInfo {
@SerializedName("title")
@Expose
private String title;
@SerializedName("authors")
@Expose
private List<String> authors = null;
@SerializedName("publisher")
@Expose
private String publisher;
@SerializedName("publishedDate")
@Expose
private String publishedDate;
@SerializedName("description")
@Expose
private String description;
@SerializedName("industryIdentifiers")
@Expose
private List<IndustryIdentifier> industryIdentifiers = null;
@SerializedName("readingModes")
@Expose
private ReadingModes readingModes;
@SerializedName("pageCount")
@Expose
private Integer pageCount;
@SerializedName("printType")
@Expose
private String printType;
@SerializedName("categories")
@Expose
private List<String> categories = null;
@SerializedName("averageRating")
@Expose
private Double averageRating;
@SerializedName("ratingsCount")
@Expose
private Integer ratingsCount;
@SerializedName("maturityRating")
@Expose
private String maturityRating;
@SerializedName("allowAnonLogging")
@Expose
private Boolean allowAnonLogging;
@SerializedName("contentVersion")
@Expose
private String contentVersion;
@SerializedName("panelizationSummary")
@Expose
private PanelizationSummary panelizationSummary;
@SerializedName("imageLinks")
@Expose
private ImageLinks imageLinks;
@SerializedName("language")
@Expose
private String language;
@SerializedName("previewLink")
@Expose
private String previewLink;
@SerializedName("infoLink")
@Expose
private String infoLink;
@SerializedName("canonicalVolumeLink")
@Expose
private String canonicalVolumeLink;
@SerializedName("subtitle")
@Expose
private String subtitle;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<String> getAuthors() {
return authors;
}
public void setAuthors(List<String> authors) {
this.authors = authors;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getPublishedDate() {
return publishedDate;
}
public void setPublishedDate(String publishedDate) {
this.publishedDate = publishedDate;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<IndustryIdentifier> getIndustryIdentifiers() {
return industryIdentifiers;
}
public void setIndustryIdentifiers(List<IndustryIdentifier> industryIdentifiers) {
this.industryIdentifiers = industryIdentifiers;
}
public ReadingModes getReadingModes() {
return readingModes;
}
public void setReadingModes(ReadingModes readingModes) {
this.readingModes = readingModes;
}
public Integer getPageCount() {
return pageCount;
}
public void setPageCount(Integer pageCount) {
this.pageCount = pageCount;
}
public String getPrintType() {
return printType;
}
public void setPrintType(String printType) {
this.printType = printType;
}
public List<String> getCategories() {
return categories;
}
public void setCategories(List<String> categories) {
this.categories = categories;
}
public Double getAverageRating() {
return averageRating;
}
public void setAverageRating(Double averageRating) {
this.averageRating = averageRating;
}
public Integer getRatingsCount() {
return ratingsCount;
}
public void setRatingsCount(Integer ratingsCount) {
this.ratingsCount = ratingsCount;
}
public String getMaturityRating() {
return maturityRating;
}
public void setMaturityRating(String maturityRating) {
this.maturityRating = maturityRating;
}
public Boolean getAllowAnonLogging() {
return allowAnonLogging;
}
public void setAllowAnonLogging(Boolean allowAnonLogging) {
this.allowAnonLogging = allowAnonLogging;
}
public String getContentVersion() {
return contentVersion;
}
public void setContentVersion(String contentVersion) {
this.contentVersion = contentVersion;
}
public PanelizationSummary getPanelizationSummary() {
return panelizationSummary;
}
public void setPanelizationSummary(PanelizationSummary panelizationSummary) {
this.panelizationSummary = panelizationSummary;
}
public ImageLinks getImageLinks() {
return imageLinks;
}
public void setImageLinks(ImageLinks imageLinks) {
this.imageLinks = imageLinks;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getPreviewLink() {
return previewLink;
}
public void setPreviewLink(String previewLink) {
this.previewLink = previewLink;
}
public String getInfoLink() {
return infoLink;
}
public void setInfoLink(String infoLink) {
this.infoLink = infoLink;
}
public String getCanonicalVolumeLink() {
return canonicalVolumeLink;
}
public void setCanonicalVolumeLink(String canonicalVolumeLink) {
this.canonicalVolumeLink = canonicalVolumeLink;
}
public String getSubtitle() {
return subtitle;
}
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
}
| [
"vinodh4india@gmail.com"
] | vinodh4india@gmail.com |
e1ee3479f868f2358744bd9460a91890c572b1c6 | faaeac4107808615287b0664937ce78dff6d2ab5 | /SunofInt.java | eaee89a4b3065d9e80766acb2c656534c65f34a7 | [] | no_license | Dhandapani299/Code-Katta-Java-Programs | 17cdd7c056fdfd059bdac9807bd8e2a799e36d70 | 858e881fd36ba8bda95510ecd035745d73c52424 | refs/heads/master | 2020-05-05T06:24:35.123569 | 2019-04-06T17:23:12 | 2019-04-06T17:23:12 | 179,787,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | import java.io.*;
import java.util.*;
public class SunofInt{
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
int k,n,i;
int sum= 0;
System.out.println("enter the value" ) ;
n= s.nextInt();
k= s.nextInt();
int a[] = new int[n];
for(i=0;i<a.length;i++){
a[i]=s.nextInt();
}
for(i=0;i<k;i++)
{sum=sum+a[i];}
System.out.println(sum);
}
} | [
"noreply@github.com"
] | noreply@github.com |
7493927ef91a578de5c185910b4901f078ffc1fd | e64366bfd69d3ac7e6ff9cafc389a3803c678c9f | /AddChefController.java | efb5654309ca6d35c0d31e84aaba3a5fbc0a973f | [] | no_license | DeveloperPoo/FoodDeliverySystem | 3cec4480c8dfbce8891ffc0e99c0fab7acc82dde | 63fadf43e70a548bea7bd22d29881e28de7f512a | refs/heads/master | 2022-12-13T00:13:12.608630 | 2020-09-11T00:23:13 | 2020-09-11T00:23:13 | 294,305,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,144 | java | package Controller;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import DBManager.DTO;
import Model.ChefBean;
import Model.ManagerBean;
import View.AddChef;
public class AddChefController {
DTO dto;
AddChef view;
public AddChefController(String resname,String username) {
dto = new DTO();
view = new AddChef();
view.setVisible(true);
view.getBtnSave().setEnabled(false);
view.getOrderMenu().setVisible(false);
//System.out.println(mname);
view.getTxtRestName().setText(resname);
view.getBtnVerify().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
view.getBtnSave().setEnabled(false);
String uname=view.getTxtUserName().getText();
if(uname.trim().isEmpty()) {
// TODO Show error message Please insert username first
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter UserName To Verify", "Registration Error",0);
return;
}
if(null == dto.getClient(uname.trim())) {
//System.out.println("Username available");
JOptionPane.showMessageDialog(view.getPanel(), "Good To Go !!", "Registration Error",0);
view.getTxtUserName().setEnabled(false);
view.getBtnSave().setEnabled(true);
}else {
JOptionPane.showMessageDialog(view.getPanel(), "OOPPS !!! UserName Already Exist!!", "Registration Error",0);
}
}
});
view.getBtnSave().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String restaurantname = view.getTxtRestName().getText().trim();
String username = view.getTxtUserName().getText().trim();
/* String password = view.getTxtPassword().getText().trim();
String cpassword = view.getTxtConfrimPassword().getText().trim();*/
String password=String.valueOf(view.getPasswordField().getPassword());
String cpassword=String.valueOf(view.getConfrimPasswordField().getPassword());
String lastname = view.getTxtLastName().getText().trim();
String firstname = view.getTxtFirstName().getText().trim();
String address = view.getTxtAddress().getText().trim();
String email = view.getTxtEmail().getText().trim();
String phoneno = view.getTxtPhoneNo().getText().trim();
//validation
if(username.trim().isEmpty() && password.trim().isEmpty() && lastname.trim().isEmpty() && firstname.trim().isEmpty() &&
address.trim().isEmpty() && email.trim().isEmpty() && phoneno.trim().isEmpty()) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter UserName To Verify", "Registration Error",0);
}else if(password.trim().isEmpty()) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Password", "Registration Error",0);
}else if(cpassword.trim().isEmpty()) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Confirm Password", "Registration Error",0);
}else if(password.length()<=5) {
JOptionPane.showMessageDialog(view.getPanel(), "Password Should Be Greates Than Five Character", "Registration Error",0);
}else if(!password.equals(cpassword)) {
JOptionPane.showMessageDialog(view.getPanel(), "Password And Confirm Password Must Be Same", "Registration Error",0);
}else if(lastname.trim().isEmpty() || lastname.length()<=5 ) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Your Last Name", "Registration Error",0);
}
else if((!lastname.trim().matches("\\p{Lower}+\\s?"))) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Valid Last Name", "Registration Error",0);
}
else if(firstname.trim().isEmpty()) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Your First Name", "Registration Error",0);
}
else if((!firstname.trim().matches("\\p{Lower}+\\s?"))) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Valid First Name", "Registration Error",0);
}
else if(address.trim().isEmpty()) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Your Current Address", "Registration Error",0);
}else if(email.trim().isEmpty()) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Your Email-ID", "Registration Error",0);
}else if(phoneno.trim().isEmpty()) {
JOptionPane.showMessageDialog(view.getPanel(), "Please Enter Your Phone Number", "Registration Error",0);
}else if(!phoneno.matches("\\d{10}")) {
JOptionPane.showMessageDialog(view.getPanel(), "Opps !! Please Enter Valid Number (MUST BE 10 DIGIT) ", "Registration Error",0);
}else {
ChefBean bean = new ChefBean();
bean.setRestaurantname(restaurantname);
bean.setUsername(username);
bean.setPassword(password);
bean.setCpassword(cpassword);
bean.setLastname(lastname);
bean.setFirstname(firstname);
bean.setAddress(address);
bean.setEmail(email);
bean.setPhonenumber(phoneno);
dto.ChefInsert(bean);
int a=JOptionPane.showConfirmDialog(view.getPanel(),"Do You Want To Add Other Chef?");
if(a==JOptionPane.YES_OPTION){
new AddChefController(resname,username);
view.dispose();
} else if(a==JOptionPane.NO_OPTION){
view.dispose();
new ManagerDashboardController(username);
}
}
}
});
// restaurant crud
view.getEditRestaurantMItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
new EditRestaurantController(resname,username);
view.setVisible(false);
}
});
//------------------- chef crud
view.getEditChefMenuItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
view.setVisible(false);
new EditChefController(resname,username);
}
});
view.getDeleteChefMenuItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
view.setVisible(false);
new DeleteChefController(resname,username);
}
});
// -------------------menu crud
view.getEditFoodMenuItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
view.dispose();
new EditMenuController(resname,username);
}
});
view.getCreateFoodMenuItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
view.dispose();
new AddMenuController(resname,username);
}
});
view.getDeleteFoodMenuItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
view.dispose();
new DeleteMenuController(resname,username);
}
});
//------------- Manager CRUD
view.getEditManagerItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
view.dispose();
new EditManagerController(resname,username);
}
});
// -------------File
view.getDisconnectMItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
view.dispose();
new ManagerDashboardController(username);
}
});
view.getCloseMItem().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
view.dispose();
}
});
}
}
| [
"noreply@github.com"
] | noreply@github.com |
15d0a08edd8793b2c5e628d8023ddc10d42cc1ad | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Csv-10/org.apache.commons.csv.CSVPrinter/BBC-F0-opt-30/2/org/apache/commons/csv/CSVPrinter_ESTest.java | 3808b96edeb4e9e1d7bd81b4dd42b28d6eac2360 | [
"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 | 39,541 | java | /*
* This file was automatically generated by EvoSuite
* Thu Oct 14 00:14:58 GMT 2021
*/
package org.apache.commons.csv;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.io.BufferedOutputStream;
import java.io.CharArrayWriter;
import java.io.File;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PipedReader;
import java.io.PipedWriter;
import java.io.StringWriter;
import java.nio.BufferOverflowException;
import java.nio.CharBuffer;
import java.nio.ReadOnlyBufferException;
import java.nio.charset.Charset;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLInvalidAuthorizationSpecException;
import java.sql.SQLRecoverableException;
import java.sql.SQLSyntaxErrorException;
import java.sql.SQLTimeoutException;
import java.util.ArrayDeque;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.TreeSet;
import java.util.function.Predicate;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.csv.Quote;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.evosuite.runtime.mock.java.io.MockFile;
import org.evosuite.runtime.mock.java.io.MockFileInputStream;
import org.evosuite.runtime.mock.java.io.MockFileOutputStream;
import org.evosuite.runtime.mock.java.io.MockFileWriter;
import org.evosuite.runtime.mock.java.io.MockPrintStream;
import org.evosuite.runtime.mock.java.io.MockPrintWriter;
import org.evosuite.runtime.testdata.EvoSuiteFile;
import org.evosuite.runtime.testdata.FileSystemHandling;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class CSVPrinter_ESTest extends CSVPrinter_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
Object[] objectArray0 = new Object[6];
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("05EXc]z>$3Q{");
CSVPrinter cSVPrinter0 = cSVFormat1.print(charArrayWriter0);
cSVPrinter0.printRecords(objectArray0);
assertEquals("05EXc]z>$3Q{\r\n05EXc]z>$3Q{\r\n05EXc]z>$3Q{\r\n05EXc]z>$3Q{\r\n05EXc]z>$3Q{\r\n05EXc]z>$3Q{\r\n", charArrayWriter0.toString());
assertEquals(84, charArrayWriter0.size());
}
@Test(timeout = 4000)
public void test01() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
StringWriter stringWriter0 = new StringWriter();
StringBuffer stringBuffer0 = stringWriter0.getBuffer();
CharBuffer charBuffer0 = CharBuffer.wrap((CharSequence) stringBuffer0);
CSVPrinter cSVPrinter0 = cSVFormat0.print(charBuffer0);
// Undeclared exception!
// try {
cSVPrinter0.println();
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test02() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat0);
// try {
cSVPrinter0.println();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test03() throws Throwable {
Object[] objectArray0 = new Object[4];
CSVFormat cSVFormat0 = CSVFormat.newFormat('W');
CharBuffer charBuffer0 = CharBuffer.wrap((CharSequence) "lpmkJ @78LPny`Rnt~");
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.printRecords(objectArray0);
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test04() throws Throwable {
char[] charArray0 = new char[4];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
Object[] objectArray0 = new Object[6];
// Undeclared exception!
// try {
cSVPrinter0.printRecords(objectArray0);
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test05() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.newFormat('A');
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("+rL+\u0007a-apt8o0I");
CSVPrinter cSVPrinter0 = cSVFormat0.print(mockPrintWriter0);
// Undeclared exception!
// try {
cSVPrinter0.printRecords((Object[]) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.csv.CSVPrinter", e);
// }
}
@Test(timeout = 4000)
public void test06() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat0);
Object[] objectArray0 = new Object[9];
// try {
cSVPrinter0.printRecords(objectArray0);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test07() throws Throwable {
MockFile mockFile0 = new MockFile("LJ<5", "LJ<5");
mockFile0.setLastModified(796L);
mockFile0.delete();
MockFileWriter mockFileWriter0 = new MockFileWriter(mockFile0, false);
mockFileWriter0.getEncoding();
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
CSVFormat cSVFormat1 = cSVFormat0.withDelimiter('v');
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat0);
Object[] objectArray0 = new Object[9];
objectArray0[1] = (Object) mockFileWriter0;
objectArray0[2] = (Object) cSVFormat1;
objectArray0[3] = (Object) cSVFormat0;
objectArray0[4] = (Object) cSVPrinter0;
objectArray0[5] = (Object) "ASCII";
objectArray0[6] = (Object) cSVPrinter0;
objectArray0[7] = (Object) "ASCII";
Object object0 = new Object();
objectArray0[8] = object0;
SQLSyntaxErrorException sQLSyntaxErrorException0 = new SQLSyntaxErrorException();
sQLSyntaxErrorException0.getStackTrace();
StackTraceElement[] stackTraceElementArray0 = new StackTraceElement[0];
EvoSuiteFile evoSuiteFile0 = new EvoSuiteFile("LJ<5");
FileSystemHandling.appendLineToFile(evoSuiteFile0, "4x");
sQLSyntaxErrorException0.setStackTrace(stackTraceElementArray0);
SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("LJ<5", sQLSyntaxErrorException0);
cSVPrinter0.print(sQLTimeoutException0);
ResultSetMetaData resultSetMetaData0 = mock(ResultSetMetaData.class, new ViolatedAssumptionAnswer());
doReturn(5).when(resultSetMetaData0).getColumnCount();
ResultSet resultSet0 = mock(ResultSet.class, new ViolatedAssumptionAnswer());
doReturn(resultSetMetaData0).when(resultSet0).getMetaData();
doReturn((String) null, (String) null, (String) null, (String) null, (String) null).when(resultSet0).getString(anyInt());
doReturn(true, false).when(resultSet0).next();
cSVPrinter0.printRecords(resultSet0);
}
@Test(timeout = 4000)
public void test08() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("Unexpected Quote value: ");
CSVPrinter cSVPrinter0 = cSVFormat0.print(mockPrintWriter0);
ResultSet resultSet0 = mock(ResultSet.class, new ViolatedAssumptionAnswer());
doReturn((ResultSetMetaData) null).when(resultSet0).getMetaData();
// Undeclared exception!
// try {
cSVPrinter0.printRecords(resultSet0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.csv.CSVPrinter", e);
// }
}
@Test(timeout = 4000)
public void test09() throws Throwable {
MockPrintStream mockPrintStream0 = new MockPrintStream("1^OOxup4xR\"``T?Gl2");
SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("Unexpected Quote value: ", "Unexpected Quote value: ");
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
SQLException sQLException0 = new SQLException(sQLTimeoutException0);
sQLTimeoutException0.initCause(sQLException0);
CSVPrinter cSVPrinter0 = new CSVPrinter(mockPrintStream0, cSVFormat0);
// Undeclared exception!
cSVPrinter0.printRecords((Iterable<?>) sQLTimeoutException0);
}
@Test(timeout = 4000)
public void test10() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("org.apache.commons.csv.CSVPrinter");
char[] charArray0 = new char[4];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.printRecords((Iterable<?>) sQLTimeoutException0);
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test11() throws Throwable {
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
CSVFormat cSVFormat0 = CSVFormat.TDF;
PipedReader pipedReader0 = new PipedReader();
CSVParser cSVParser0 = cSVFormat0.parse(pipedReader0);
CSVPrinter cSVPrinter0 = cSVFormat0.print(charArrayWriter0);
// Undeclared exception!
// try {
cSVPrinter0.printRecords((Iterable<?>) cSVParser0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // java.io.IOException: Pipe not connected
// //
// verifyException("org.apache.commons.csv.CSVParser$1", e);
// }
}
@Test(timeout = 4000)
public void test12() throws Throwable {
MockFileWriter mockFileWriter0 = new MockFileWriter("lpmkJ @78LPny`Rnt~", false);
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.printRecords((Iterable<?>) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.csv.CSVPrinter", e);
// }
}
@Test(timeout = 4000)
public void test13() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("RKhaV-yLRF2{'w3", "\r\n");
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat0);
// try {
cSVPrinter0.printRecords((Iterable<?>) sQLTimeoutException0);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test14() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
Object[] objectArray0 = new Object[6];
CharBuffer charBuffer0 = CharBuffer.wrap((CharSequence) "sun.nio.cs.US_ASCII@0000000002,,,,,");
CSVPrinter cSVPrinter0 = cSVFormat0.print(charBuffer0);
// Undeclared exception!
// try {
cSVPrinter0.printRecord(objectArray0);
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.StringCharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test15() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(44);
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
Predicate<Object> predicate0 = Predicate.isEqual((Object) cSVFormat0);
Object[] objectArray0 = new Object[9];
objectArray0[0] = (Object) predicate0;
// Undeclared exception!
// try {
cSVPrinter0.printRecord(objectArray0);
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test16() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(44);
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.printRecord((Object[]) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.csv.CSVPrinter", e);
// }
}
@Test(timeout = 4000)
public void test17() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat0);
Object[] objectArray0 = new Object[9];
// try {
cSVPrinter0.printRecord(objectArray0);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test18() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(44);
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
LinkedList<Byte> linkedList0 = new LinkedList<Byte>();
cSVPrinter0.print(cSVFormat0);
HashSet<Byte> hashSet0 = new HashSet<Byte>(linkedList0);
// Undeclared exception!
// try {
cSVPrinter0.printRecord((Iterable<?>) hashSet0);
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test19() throws Throwable {
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
PipedReader pipedReader0 = new PipedReader();
CSVParser cSVParser0 = cSVFormat0.parse(pipedReader0);
CSVPrinter cSVPrinter0 = cSVFormat0.print(charArrayWriter0);
// Undeclared exception!
// try {
cSVPrinter0.printRecord((Iterable<?>) cSVParser0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // java.io.IOException: Pipe not connected
// //
// verifyException("org.apache.commons.csv.CSVParser$1", e);
// }
}
@Test(timeout = 4000)
public void test20() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.printRecord((Iterable<?>) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test21() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat0);
ArrayDeque<SQLInvalidAuthorizationSpecException> arrayDeque0 = new ArrayDeque<SQLInvalidAuthorizationSpecException>((-6635));
// try {
cSVPrinter0.printRecord((Iterable<?>) arrayDeque0);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test22() throws Throwable {
Character character0 = new Character('O');
CSVFormat cSVFormat0 = CSVFormat.newFormat('U');
CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0);
CharBuffer charBuffer0 = CharBuffer.wrap((CharSequence) "Fc! G`riYMaSx??g");
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat1);
// Undeclared exception!
// try {
cSVPrinter0.printComment("Fc! G`riYMaSx??g");
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.StringCharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test23() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.TDF;
Character character0 = new Character('6');
CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0);
char[] charArray0 = new char[0];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat1);
// Undeclared exception!
// try {
cSVPrinter0.printComment("");
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.Buffer", e);
// }
}
@Test(timeout = 4000)
public void test24() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
Character character0 = new Character('m');
CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0);
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat1);
// try {
cSVPrinter0.printComment("5Uwb?^[uL9bIyH");
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test25() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(13);
CharBuffer charBuffer1 = CharBuffer.wrap((CharSequence) charBuffer0, 13, 13);
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer1, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.print("");
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test26() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(44);
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
LinkedList<Byte> linkedList0 = new LinkedList<Byte>();
HashSet<Byte> hashSet0 = new HashSet<Byte>(linkedList0);
Byte byte0 = new Byte((byte)13);
hashSet0.add(byte0);
cSVPrinter0.printRecord((Iterable<?>) hashSet0);
// Undeclared exception!
// try {
cSVPrinter0.print(hashSet0);
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test27() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVPrinter cSVPrinter0 = new CSVPrinter(pipedWriter0, cSVFormat0);
SQLRecoverableException sQLRecoverableException0 = new SQLRecoverableException("YG:N\";ZeLD!", "VdAZe", (-2430));
// try {
cSVPrinter0.print(sQLRecoverableException0);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test28() throws Throwable {
Object[] objectArray0 = new Object[1];
FileSystemHandling.shouldAllThrowIOExceptions();
MockFileWriter mockFileWriter0 = new MockFileWriter("lpmkJ @78LPny`Rnt~", false);
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat0);
cSVPrinter0.printRecords(objectArray0);
// try {
cSVPrinter0.flush();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Simulated IOException
// //
// verifyException("org.evosuite.runtime.vfs.VirtualFileSystem", e);
// }
}
@Test(timeout = 4000)
public void test29() throws Throwable {
FileSystemHandling.shouldAllThrowIOExceptions();
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"", true);
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat0);
// try {
cSVPrinter0.close();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Simulated IOException
// //
// verifyException("org.evosuite.runtime.vfs.VirtualFileSystem", e);
// }
}
@Test(timeout = 4000)
public void test30() throws Throwable {
StringWriter stringWriter0 = new StringWriter(90);
CSVFormat cSVFormat0 = CSVFormat.newFormat('k');
CSVFormat cSVFormat1 = cSVFormat0.withEscape('k');
CSVPrinter cSVPrinter0 = null;
// try {
cSVPrinter0 = new CSVPrinter(stringWriter0, cSVFormat1);
// fail("Expecting exception: IllegalStateException");
// } catch(IllegalStateException e) {
// //
// // The escape character and the delimiter cannot be the same ('k')
// //
// verifyException("org.apache.commons.csv.CSVFormat", e);
// }
}
@Test(timeout = 4000)
public void test31() throws Throwable {
PipedWriter pipedWriter0 = new PipedWriter();
CSVPrinter cSVPrinter0 = null;
// try {
cSVPrinter0 = new CSVPrinter(pipedWriter0, (CSVFormat) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Parameter 'format' must not be null!
// //
// verifyException("org.apache.commons.csv.Assertions", e);
// }
}
@Test(timeout = 4000)
public void test32() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.newFormat('H');
SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("?", "?");
CharBuffer charBuffer0 = CharBuffer.wrap((CharSequence) "C~HY}O9gkLxMLl");
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.printRecord((Iterable<?>) sQLTimeoutException0);
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test33() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.TDF;
char[] charArray0 = new char[0];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.println();
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test34() throws Throwable {
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("lpmkJ @78LPny`Rnt~");
CSVFormat cSVFormat0 = CSVFormat.newFormat('/');
CSVPrinter cSVPrinter0 = new CSVPrinter(mockPrintWriter0, cSVFormat0);
cSVPrinter0.println();
}
@Test(timeout = 4000)
public void test35() throws Throwable {
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"", true);
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("ASCII");
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockFileWriter0);
cSVPrinter0.print((Object) null);
}
@Test(timeout = 4000)
public void test36() throws Throwable {
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
Charset charset0 = Charset.defaultCharset();
CSVFormat cSVFormat0 = CSVFormat.TDF;
FileDescriptor fileDescriptor0 = new FileDescriptor();
MockFileInputStream mockFileInputStream0 = new MockFileInputStream(fileDescriptor0);
InputStreamReader inputStreamReader0 = new InputStreamReader(mockFileInputStream0, charset0);
CSVParser cSVParser0 = cSVFormat0.parse(inputStreamReader0);
CSVPrinter cSVPrinter0 = new CSVPrinter(charArrayWriter0, cSVFormat0);
Object[] objectArray0 = new Object[3];
objectArray0[0] = (Object) cSVParser0;
// Undeclared exception!
// try {
cSVPrinter0.printRecords(objectArray0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // org.evosuite.runtime.mock.java.lang.MockThrowable
// //
// verifyException("org.apache.commons.csv.CSVParser$1", e);
// }
}
@Test(timeout = 4000)
public void test37() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(1320);
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
TreeSet<String> treeSet0 = new TreeSet<String>();
treeSet0.add("L(PLi~qc(h");
cSVPrinter0.printRecords((Iterable<?>) treeSet0);
assertEquals(29, charBuffer0.position());
assertEquals(1291, charBuffer0.remaining());
}
@Test(timeout = 4000)
public void test38() throws Throwable {
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("out");
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
Character character0 = Character.valueOf('v');
CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0);
CSVPrinter cSVPrinter0 = new CSVPrinter(mockPrintWriter0, cSVFormat1);
cSVPrinter0.printComment("\r\n");
}
@Test(timeout = 4000)
public void test39() throws Throwable {
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
Character character0 = new Character('x');
CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0);
CSVPrinter cSVPrinter0 = new CSVPrinter(charArrayWriter0, cSVFormat1);
cSVPrinter0.printComment("\r");
assertEquals(6, charArrayWriter0.size());
assertEquals("x \nx \n", charArrayWriter0.toString());
}
@Test(timeout = 4000)
public void test40() throws Throwable {
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("lpmkJ @78LPny`Rnt~");
CSVFormat cSVFormat0 = CSVFormat.newFormat('/');
Character character0 = Character.valueOf('U');
CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0);
CSVPrinter cSVPrinter0 = new CSVPrinter(mockPrintWriter0, cSVFormat1);
cSVPrinter0.print((Object) null);
cSVPrinter0.printComment("lpmkJ @78LPny`Rnt~");
}
@Test(timeout = 4000)
public void test41() throws Throwable {
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("lpmkJ @78LPny`Rnt~");
CSVFormat cSVFormat0 = CSVFormat.newFormat('/');
CSVPrinter cSVPrinter0 = new CSVPrinter(mockPrintWriter0, cSVFormat0);
cSVPrinter0.printComment("K,W?a?|S$0D");
}
@Test(timeout = 4000)
public void test42() throws Throwable {
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
Character character0 = Character.valueOf('U');
CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0);
CSVPrinter cSVPrinter0 = new CSVPrinter(charArrayWriter0, cSVFormat1);
cSVPrinter0.printComment("\rp\n");
assertEquals(13, charArrayWriter0.size());
assertEquals("U \r\nU p\r\nU \r\n", charArrayWriter0.toString());
}
@Test(timeout = 4000)
public void test43() throws Throwable {
Object[] objectArray0 = new Object[7];
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"");
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("Unexpected Quote value: ");
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockFileWriter0);
cSVPrinter0.printRecord(objectArray0);
assertEquals(7, objectArray0.length);
}
@Test(timeout = 4000)
public void test44() throws Throwable {
MockFile mockFile0 = new MockFile("LJ<5", "LJ<5");
MockFileWriter mockFileWriter0 = new MockFileWriter(mockFile0, false);
CSVFormat cSVFormat0 = CSVFormat.TDF;
CSVFormat cSVFormat1 = cSVFormat0.withDelimiter('v');
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat1);
Object[] objectArray0 = new Object[8];
objectArray0[0] = (Object) cSVPrinter0;
cSVPrinter0.printRecord(objectArray0);
assertEquals(8, objectArray0.length);
}
@Test(timeout = 4000)
public void test45() throws Throwable {
Object[] objectArray0 = new Object[7];
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"");
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("~6upYu_;#JR");
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockFileWriter0);
cSVPrinter0.printRecord(objectArray0);
assertEquals(7, objectArray0.length);
}
@Test(timeout = 4000)
public void test46() throws Throwable {
Object[] objectArray0 = new Object[7];
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"");
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("]|QYCpe%V");
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockFileWriter0);
cSVPrinter0.printRecord(objectArray0);
assertEquals(7, objectArray0.length);
}
@Test(timeout = 4000)
public void test47() throws Throwable {
Object[] objectArray0 = new Object[7];
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"");
CSVFormat cSVFormat0 = CSVFormat.RFC4180;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("<V.bH,j9pYc");
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat1);
cSVPrinter0.printRecords(objectArray0);
assertEquals(7, objectArray0.length);
}
@Test(timeout = 4000)
public void test48() throws Throwable {
Object[] objectArray0 = new Object[5];
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"");
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("\")@{8vatfS2\"<");
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockFileWriter0);
cSVPrinter0.printRecord(objectArray0);
assertEquals(5, objectArray0.length);
}
@Test(timeout = 4000)
public void test49() throws Throwable {
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("wA]H,f3?");
MockPrintStream mockPrintStream0 = new MockPrintStream(mockFileOutputStream0, false);
Quote quote0 = Quote.NON_NUMERIC;
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0);
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockPrintStream0);
Byte byte0 = new Byte((byte) (-78));
cSVPrinter0.print(byte0);
}
@Test(timeout = 4000)
public void test50() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("Db2~49UM Gf/^/Ba$R");
MockPrintStream mockPrintStream0 = new MockPrintStream(mockFileOutputStream0, false);
Quote quote0 = Quote.NON_NUMERIC;
CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0);
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockPrintStream0);
BufferedOutputStream bufferedOutputStream0 = new BufferedOutputStream(mockPrintStream0, 98);
cSVPrinter0.print(bufferedOutputStream0);
}
@Test(timeout = 4000)
public void test51() throws Throwable {
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("lpmkJ @78LPny`Rnt~");
CSVFormat cSVFormat0 = CSVFormat.TDF;
Quote quote0 = Quote.ALL;
CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0);
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockPrintWriter0);
cSVPrinter0.print(mockPrintWriter0);
}
@Test(timeout = 4000)
public void test52() throws Throwable {
MockFileWriter mockFileWriter0 = new MockFileWriter("\"V&");
CSVFormat cSVFormat0 = CSVFormat.MYSQL;
CSVFormat cSVFormat1 = cSVFormat0.withDelimiter('n');
Character character0 = new Character('i');
CSVFormat cSVFormat2 = cSVFormat1.withEscape(character0);
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat2);
cSVPrinter0.print("ASCII");
}
@Test(timeout = 4000)
public void test53() throws Throwable {
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
CSVFormat cSVFormat0 = CSVFormat.TDF;
CSVFormat cSVFormat1 = cSVFormat0.withEscape('h');
Quote quote0 = Quote.NONE;
CSVFormat cSVFormat2 = cSVFormat1.withQuotePolicy(quote0);
CSVPrinter cSVPrinter0 = cSVFormat2.print(charArrayWriter0);
cSVPrinter0.print(charArrayWriter0);
assertEquals(35, charArrayWriter0.size());
}
@Test(timeout = 4000)
public void test54() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.newFormat('H');
SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("?", "?");
CharBuffer charBuffer0 = CharBuffer.wrap((CharSequence) "C~HY}O9gkLxMLl");
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
// Undeclared exception!
// try {
cSVPrinter0.printRecords((Iterable<?>) sQLTimeoutException0);
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test55() throws Throwable {
Object[] objectArray0 = new Object[5];
MockFileWriter mockFileWriter0 = new MockFileWriter("Fc! G`r`Y7Mx??g");
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
CSVFormat cSVFormat1 = cSVFormat0.withNullString("93M\"|\"");
CSVPrinter cSVPrinter0 = cSVFormat1.print(mockFileWriter0);
cSVPrinter0.printRecord(objectArray0);
assertEquals(5, objectArray0.length);
}
@Test(timeout = 4000)
public void test56() throws Throwable {
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
File file0 = MockFile.createTempFile("Hm--)D", "~eoTDKnGG.x^H<Y{w");
MockPrintWriter mockPrintWriter0 = new MockPrintWriter(file0);
CSVPrinter cSVPrinter0 = cSVFormat0.print(mockPrintWriter0);
cSVPrinter0.flush();
}
@Test(timeout = 4000)
public void test57() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(44);
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
cSVPrinter0.flush();
}
@Test(timeout = 4000)
public void test58() throws Throwable {
MockFileWriter mockFileWriter0 = new MockFileWriter("MtV>I\"", true);
CSVFormat cSVFormat0 = CSVFormat.DEFAULT;
CSVPrinter cSVPrinter0 = new CSVPrinter(mockFileWriter0, cSVFormat0);
cSVPrinter0.close();
}
@Test(timeout = 4000)
public void test59() throws Throwable {
CharBuffer charBuffer0 = CharBuffer.allocate(44);
CSVFormat cSVFormat0 = CSVFormat.EXCEL;
CSVPrinter cSVPrinter0 = new CSVPrinter(charBuffer0, cSVFormat0);
cSVPrinter0.close();
}
@Test(timeout = 4000)
public void test60() throws Throwable {
MockPrintWriter mockPrintWriter0 = new MockPrintWriter("lpmkJ @78LPny`Rnt~");
CSVFormat cSVFormat0 = CSVFormat.newFormat('/');
CSVPrinter cSVPrinter0 = new CSVPrinter(mockPrintWriter0, cSVFormat0);
Appendable appendable0 = cSVPrinter0.getOut();
assertSame(mockPrintWriter0, appendable0);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
ae0561490efc0fd6c1fda695b1d55b013034ded3 | 16164838fed14e1bd041232e63257890d70e8fe6 | /CriaVetor.java | b9f02f0281d4397f6d093f327cbf58c1cadba1db | [] | no_license | JACX16/control-threads-full | 2a6776ae496d49c78ec063d32884ab64b04da3c3 | 0e76d341c865361de92f2fd335faa33d509c80a2 | refs/heads/master | 2021-01-12T12:25:46.827390 | 2016-11-01T01:18:12 | 2016-11-01T01:18:12 | 72,490,197 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package programacaoconcorrente;
class CriaVetor {
private int vet[];
public CriaVetor() {
vet = new int[22000];
escreveVet();
}
public int[] escreveVet() {
for (int i = 0; i < 22000; i++) {
vet[i] = (int) (Math.random() * 12001-6000);
}
return vet;
}
}
| [
"jac.analista16@gmail.com"
] | jac.analista16@gmail.com |
fee68f07fc491282ee324efa6bb337f2c9d8a121 | ecb7cbdc6952cb27e59568480d0bbce79f872508 | /app/src/main/java/com/betterthannoobs/codeutsava/hackathon/blooddonorapp/retrofit/ApiService.java | eead12ee6331d7ac53c1e9cc280e9d280d1f9503 | [] | no_license | Vrihas123/blood-donor-app | f50a971c81799c44ea05c945d3c7500c4be91070 | 4c2a661ab27e3ba1668c34e50a65241a4224d379 | refs/heads/master | 2020-04-23T17:23:42.156349 | 2019-02-18T18:25:13 | 2019-02-18T18:25:13 | 171,330,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,382 | java | package com.betterthannoobs.codeutsava.hackathon.blooddonorapp.retrofit;
import com.betterthannoobs.codeutsava.hackathon.blooddonorapp.OkHttpClientProvider;
import com.betterthannoobs.codeutsava.hackathon.blooddonorapp.model.LoginData;
import com.betterthannoobs.codeutsava.hackathon.blooddonorapp.utils.constants.HttpRequestConstants;
import com.betterthannoobs.codeutsava.hackathon.blooddonorapp.utils.retrofit.BaseResponse;
import io.reactivex.Observable;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface ApiService {
@POST(HttpRequestConstants.REQUEST_LOGIN)
Observable<BaseResponse> getLoginResultsUsingObservable(@Body LoginData loginData);
class Creator {
private Creator() {
}
public static ApiService newApiService() {
Retrofit retrofit = new Retrofit.Builder()
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(HttpRequestConstants.BASE_URL)
.client(new OkHttpClientProvider().getOkHttpClient())
.build();
return retrofit.create(ApiService.class);
}
}
}
| [
"vrihas007@gmail.com"
] | vrihas007@gmail.com |
1a009585e03805cbc3d0971c71c36aea504a43a3 | 173b3c835553df008fdf343683ba214549832113 | /app/src/main/java/com/kamal/archcompnonents/App.java | ea1875022a2b00c15c21985222ea84ac24de43c1 | [] | no_license | CammyKamal/AndroidMvvm-Java | 710dfcbf8e68aae8dfc3e67025d89a9c1545b295 | bfea2c2426aefdb9a00203f22896d4f2c2cce375 | refs/heads/master | 2020-04-01T18:41:17.441549 | 2018-10-17T19:10:31 | 2018-10-17T19:10:31 | 153,508,122 | 19 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,097 | java | /*
* Copyright (c) 2018 Phunware Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.kamal.archcompnonents;
import android.app.Application;
import com.kamal.archcompnonents.daggercomponent.AppComponent;
import com.kamal.archcompnonents.daggercomponent.component.DaggerAppComponent;
import com.kamal.archcompnonents.daggercomponent.ApiModule;
import com.kamal.archcompnonents.daggercomponent.ApplicationModule;
/**
* Created by Kamal Vaid
* Application class of the application initializing dagger and other as per need
*/
public class App extends Application {
private AppComponent mAppComponent;
public static Application instance;
@Override
public void onCreate() {
super.onCreate();
instance=this;
mAppComponent = DaggerAppComponent.builder()
.applicationModule(new ApplicationModule(this))
.apiModule(new ApiModule(this))
.build();
mAppComponent.inject(this);
}
public AppComponent getAppComponent() {
return mAppComponent;
}
}
| [
"kamalkumar.vaid@avon.com"
] | kamalkumar.vaid@avon.com |
380fd79ceff330f2ca958d7d3fcd7c5083b91b33 | ea1872cc2b1203c20b508301c431857dd37ea4ec | /jmetal-exec/src/main/java/org/uma/jmetal/runner/singleobjective/ParallelGenerationalGeneticAlgorithmRunner.java | d032655868182c79762c6b36520c6418800d72db | [
"MIT"
] | permissive | tianzhuzhu/myOwnJmetal | d8816ea248d10822e00982a261ec926ef253034c | 7a4201082520ac590e77ebb42a1bc4bdb788a21a | refs/heads/master | 2021-06-25T17:24:31.513134 | 2019-11-20T03:35:21 | 2019-11-20T03:35:21 | 221,119,993 | 0 | 0 | MIT | 2021-04-26T19:39:49 | 2019-11-12T03:15:38 | Java | UTF-8 | Java | false | false | 3,531 | java | package org.uma.jmetal.runner.singleobjective;
import org.uma.jmetal.algorithm.Algorithm;
import org.uma.jmetal.algorithm.singleobjective.geneticalgorithm.GeneticAlgorithmBuilder;
import org.uma.jmetal.operator.crossover.CrossoverOperator;
import org.uma.jmetal.operator.crossover.impl.SinglePointCrossover;
import org.uma.jmetal.operator.mutation.MutationOperator;
import org.uma.jmetal.operator.mutation.impl.BitFlipMutation;
import org.uma.jmetal.operator.selection.SelectionOperator;
import org.uma.jmetal.operator.selection.impl.BinaryTournamentSelection;
import org.uma.jmetal.problem.binaryproblem.BinaryProblem;
import org.uma.jmetal.problem.singleobjective.OneMax;
import org.uma.jmetal.runner.AlgorithmRunner;
import org.uma.jmetal.solution.binarysolution.BinarySolution;
import org.uma.jmetal.util.JMetalLogger;
import org.uma.jmetal.util.evaluator.impl.MultithreadedSolutionListEvaluator;
import org.uma.jmetal.util.fileoutput.SolutionListOutput;
import org.uma.jmetal.util.fileoutput.impl.DefaultFileOutputContext;
import java.util.ArrayList;
import java.util.List;
/**
* Class to configure and run a parallel (multithreaded) generational genetic algorithm. The number
* of cores is specified as an optional parameter. A default value is used is the parameter is not
* provided. The target problem is OneMax
*
* @author Antonio J. Nebro <antonio@lcc.uma.es>
*/
public class ParallelGenerationalGeneticAlgorithmRunner {
private static final int DEFAULT_NUMBER_OF_CORES = 0 ;
/**
* Usage: java org.uma.jmetal.TestRunnerC5.singleobjective.ParallelGenerationalGeneticAlgorithmRunner [cores]
*/
public static void main(String[] args) throws Exception {
Algorithm<BinarySolution> algorithm;
BinaryProblem problem = new OneMax(512) ;
int numberOfCores ;
if (args.length == 1) {
numberOfCores = Integer.valueOf(args[0]) ;
} else {
numberOfCores = DEFAULT_NUMBER_OF_CORES ;
}
CrossoverOperator<BinarySolution> crossoverOperator = new SinglePointCrossover(0.9) ;
MutationOperator<BinarySolution> mutationOperator = new BitFlipMutation(1.0 / problem.getBitsFromVariable(0)) ;
SelectionOperator<List<BinarySolution>, BinarySolution> selectionOperator = new BinaryTournamentSelection<BinarySolution>();
GeneticAlgorithmBuilder<BinarySolution> builder = new GeneticAlgorithmBuilder<BinarySolution>(
problem, crossoverOperator, mutationOperator)
.setPopulationSize(100)
.setMaxEvaluations(25000)
.setSelectionOperator(selectionOperator)
.setSolutionListEvaluator(new MultithreadedSolutionListEvaluator<BinarySolution>(numberOfCores, problem)) ;
algorithm = builder.build() ;
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
.execute() ;
builder.getEvaluator().shutdown();
BinarySolution solution = algorithm.getResult() ;
List<BinarySolution> population = new ArrayList<>(1) ;
population.add(solution) ;
long computingTime = algorithmRunner.getComputingTime() ;
new SolutionListOutput(population)
.setSeparator("\t")
.setVarFileOutputContext(new DefaultFileOutputContext("VAR.tsv"))
.setFunFileOutputContext(new DefaultFileOutputContext("FUN.tsv"))
.print();
JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");
JMetalLogger.logger.info("Objectives values have been written to file FUN.tsv");
JMetalLogger.logger.info("Variables values have been written to file VAR.tsv");
}
}
| [
"532978773"
] | 532978773 |
a1d791f7a789b6a89b0754d0d01f9e71101a4faf | 81326065414e0499056cffe36ac3c36e1e5dfc3d | /app/src/main/java/com/dnu/loi/smartrm/ui/normal/order/OrderFragment.java | a89fdc1d72c2b33cc291dbbd4c4ca3893885f4a6 | [] | no_license | loitrantien/SMARTRMBanhang | e0f650b8853ab91d9ce15b1c458891aaa3b83558 | 4ac63334343da15a5a07d4cc416c947cdb76fe52 | refs/heads/master | 2020-03-10T07:24:58.489171 | 2018-05-07T15:08:41 | 2018-05-07T15:08:49 | 129,262,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,824 | java | package com.dnu.loi.smartrm.ui.normal.order;
import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.dnu.loi.smartrm.R;
import com.dnu.loi.smartrm.bl.order.OrderBL;
import com.dnu.loi.smartrm.common.OrderMode;
import com.dnu.loi.smartrm.common.OrderState;
import com.dnu.loi.smartrm.custom.EditTextClearAble;
import com.dnu.loi.smartrm.dl.order.OrderDL;
import com.dnu.loi.smartrm.entity.Dishes;
import com.dnu.loi.smartrm.entity.DishesType;
import com.dnu.loi.smartrm.entity.Order;
import com.dnu.loi.smartrm.entity.OrderDetail;
import com.dnu.loi.smartrm.entity.Table;
import com.dnu.loi.smartrm.ui.normal.adddishes.AddDishesDialog;
import com.dnu.loi.smartrm.ui.normal.adddishes.DishesTypeAdapter;
import com.dnu.loi.smartrm.ui.base.BaseFragment;
import com.dnu.loi.smartrm.ui.normal.bill.PayActivity;
import com.dnu.loi.smartrm.ui.normal.bill.InvoiceFragment;
import com.dnu.loi.smartrm.ui.normal.dialog.ISimpleCallBack;
import com.dnu.loi.smartrm.ui.normal.dialog.InputNumberDialog;
import com.dnu.loi.smartrm.ui.normal.dialog.SimpleListDialog;
import com.dnu.loi.smartrm.utils.DateTimeHelper;
import com.dnu.loi.smartrm.utils.MoneyHelper;
import com.dnu.loi.smartrm.utils.UIHelper;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class OrderFragment extends BaseFragment implements IOrderView {
private RecyclerView mRecyclerView;
private TextView tvSave, tvTakeMoney, tvFilter, tvTotal, tvPeopleCount, tvTableNum;
private ImageView ivBack, ivAddDishes, ivCancel;
private EditTextClearAble etSearch;
private AdapterDishesList mAdapter;
private IOrderPresenter mPresenter;
private Order order;
private String node = "";
private DishesTypeAdapter adapter;
public static OrderMode MODE;
private int itemPos;
/**
* khởi tạo fragment theo chức năng tạo mới order
*
* @param table table
*/
public static OrderFragment newInstance(Table table) {
OrderFragment fragment = new OrderFragment();
fragment.order = new Order();
fragment.order.setTable(table);
fragment.order.setTableId(table.getId());
fragment.order.setPeople(0);
fragment.order.setId(UUID.randomUUID().toString());
fragment.order.setCreateDate(DateTimeHelper.getCurrentDateTime());
MODE = OrderMode.ADD_MODE;
return fragment;
}
/**
* Khởi tạo fragment theo chức năng chỉnh sử order
*
* @param order order
*/
public static OrderFragment newInstance(Order order) {
OrderFragment fragment = new OrderFragment();
fragment.order = order;
MODE = OrderMode.EDIT_MODE;
return fragment;
}
@Override
protected int getLayoutInflate() {
return R.layout.fragment_order;
}
@Override
protected void mappingView(View view) {
tvSave = view.findViewById(R.id.tvSave);
tvTakeMoney = view.findViewById(R.id.tvTakeMoney);
mRecyclerView = view.findViewById(R.id.rcvDishesList);
etSearch = view.findViewById(R.id.etDishesSearch);
tvFilter = view.findViewById(R.id.tvDishesFilter);
tvPeopleCount = view.findViewById(R.id.tvPeopleNum);
tvTableNum = view.findViewById(R.id.tvTableNum);
tvTotal = view.findViewById(R.id.tvTotal);
ivBack = view.findViewById(R.id.ivBack);
ivAddDishes = view.findViewById(R.id.ivAddDishes);
ivCancel = view.findViewById(R.id.ivCancel);
}
@Override
protected void onBindView() {
mAdapter = new AdapterDishesList(getContext(), getFragmentManager());
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(mAdapter);
tvTableNum.setText(order.getTable().getName());
tvPeopleCount.setText(String.valueOf(order.getPeople()));
mPresenter.initData();
}
@Override
protected void setViewEvent() {
try {
mAdapter.setOnItemClickedListener((view, dishes) -> tvTotal.setText(MoneyHelper.getMoneyFromDouble(mAdapter.getTotalPrice())));
tvTakeMoney.setOnClickListener((v) -> gotoPay());
tvSave.setOnClickListener(v -> saveOrder(getOrder()));
ivBack.setOnClickListener((v) -> getActivity().finish());
ivAddDishes.setOnClickListener(v -> showAddDishes());
tvFilter.setOnClickListener(v -> showDishesTypeList());
tvTableNum.setOnClickListener(v -> showDialogInput(getString(R.string.input_table_num), getString(R.string.table_num), aDouble -> tvTableNum.setText(String.valueOf(aDouble.intValue()))));
tvPeopleCount.setOnClickListener(v -> showDialogInput(getString(R.string.input_people_count), getString(R.string.people_count), aDouble -> tvPeopleCount.setText(String.valueOf(aDouble.intValue()))));
ivCancel.setOnClickListener(v -> getActivity().finish());
} catch (Exception e) {
e.printStackTrace();
}
}
private Order getOrder() {
order.setPeople(Integer.parseInt(tvPeopleCount.getText().toString()));
order.setDetails(dishesListToDetailList(mAdapter.getDishesSelected()));
order.setTotal(mAdapter.getTotalPrice());
if (order.getState() == null) {
order.setState(OrderState.NEW.getState());
}
order.setNote(node);
order.setUpdateDate(DateTimeHelper.getCurrentDateTime());
return order;
}
private List<OrderDetail> dishesListToDetailList(List<Dishes> dishesList) {
List<OrderDetail> orderDetails = null;
try {
orderDetails = new ArrayList<>();
for (Dishes dishes : dishesList) {
OrderDetail orderDetail = new OrderDetail();
orderDetail.setName(dishes.getName());
orderDetail.setAmount(dishes.getAmount());
orderDetail.setPrice(dishes.getPrice());
orderDetail.setOrderId(order.getId());
orderDetails.add(orderDetail);
}
} catch (Exception e) {
e.printStackTrace();
}
return orderDetails;
}
@Override
protected void onViewAttach() {
mPresenter = new OrderPresenter(new OrderBL(new OrderDL()));
mPresenter.onViewAttach(this);
}
@Override
protected void onViewDestroy() {
mPresenter.onViewDestroy();
}
@Override
public void showLoading() {
}
@Override
public void hideLoading() {
}
@Override
public void showNetworkError() {
UIHelper.ToastShort(getString(R.string.network_error));
}
@Override
public void showError(String message) {
runOnUiThread(() -> UIHelper.ToastShort(message));
}
@Override
public void showSaveOrderSuccess() {
runOnUiThread(() -> {
UIHelper.ToastShort(UIHelper.getString(R.string.save_order_success));
getActivity().finish();
});
}
@Override
public void setDishesList(List<Dishes> dishesList) {
runOnUiThread(() -> {
mAdapter.refresh(dishesList);
if (MODE == OrderMode.EDIT_MODE) {
setDishesSelected(order.getDetails());
tvTotal.setText(MoneyHelper.getMoneyFromDouble(mAdapter.getTotalPrice()));
}
});
}
@Override
public void setDishesSelected(List<OrderDetail> dishesList) {
mAdapter.setDishesSelected(dishesList);
}
@Override
public void saveOrder(Order order) {
if (UIHelper.isConnected(getContext()))
mPresenter.saveOrder(order);
else
showNetworkError();
}
@Override
public void searchDishesList(String s) {
}
@Override
public void setDishesTypeList(List<DishesType> typeList) {
runOnUiThread(() -> {
adapter = new DishesTypeAdapter(typeList, 0);
tvFilter.setText(typeList.get(0).getName());
//gọi khởi tạo danh sách đồ ăn
mPresenter.getDishesListByType(typeList.get(0));
});
}
@Override
public void showDishesTypeList() {
SimpleListDialog<DishesType> dialog = new SimpleListDialog<>();
dialog.setTitle(getString(R.string.dishes_type));
adapter.setCurrentItemPosition(itemPos);
adapter.setOnItemClickedListener((view, dishesType) -> {
tvFilter.setText(dishesType.getName());
itemPos = adapter.getCurrentItemPosition();
mPresenter.getDishesListByType(dishesType);
dialog.dismiss();
});
dialog.setInstance(adapter);
dialog.show(getFragmentManager(), null);
}
@Override
public void gotoPay() {
runOnUiThread(() -> {
Intent intent = new Intent(getContext(), PayActivity.class);
PayActivity.setFrament(InvoiceFragment.newInstance(getOrder(), () -> getActivity().finish()));
startActivity(intent);
});
}
@Override
public void showAddDishes() {
AddDishesDialog addDishesDialog = AddDishesDialog.newInstance(dishes -> mAdapter.add(dishes));
addDishesDialog.show(getFragmentManager(), null);
}
@Override
public void showDialogInput(String title, String field, ISimpleCallBack<Double> callBack) {
InputNumberDialog dialog = InputNumberDialog.newInstance(title, field, callBack);
dialog.show(getFragmentManager(), null);
}
}
| [
"tranloi24796@gmail.com"
] | tranloi24796@gmail.com |
6b698adda403658803a2040d146657c01f576494 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_f554a8bde9107d1cec48482f18a6d4b36fee95ff/Parser/11_f554a8bde9107d1cec48482f18a6d4b36fee95ff_Parser_s.java | 64e8b12203788f68a45368e55422bdc76091d0fd | [] | 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 | 27,223 | java | /*
* (c) 2009
* Damian Steer <mailto:pldms@mac.com>
*/
package net.rootdev.javardfa;
import com.hp.hpl.jena.iri.IRI;
import com.hp.hpl.jena.iri.IRIFactory;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Namespace;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
/**
*
* @author pldms
*/
public class Parser implements ContentHandler {
final static List<String> _allowed = Arrays.asList(
"alternate", "appendix", "bookmark", "cite",
"chapter", "contents", "copyright", "first",
"glossary", "help", "icon", "index", "last",
"license", "meta", "next", "p3pv1", "prev",
"collection", "role", "section", "stylesheet",
"subsection", "start", "top", "up" );
final static Set<String> SpecialRels = new HashSet<String>(_allowed);
final static IRIFactory IRIFact = IRIFactory.semanticWebImplementation();
final static XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
final static XMLEventFactory EventFactory = XMLEventFactory.newInstance();
private final XMLEventReader reader;
private final StatementSink sink;
// Suggestion: switch this for object produced by factory that matches QNames
// we can then en-slacken if needed by passing in different factory etc
final QName about = new QName("about"); // safe
final QName resource = new QName("resource"); // safe
final QName href = new QName("href"); // URI
final QName src = new QName("src"); // URI
final QName property = new QName("property"); // CURIE
final QName datatype = new QName("datatype"); // CURIE
final QName typeof = new QName("typeof"); // CURIE
final QName rel = new QName("rel"); // Link types and CURIES
final QName rev = new QName("rev"); // Link type and CURIES
final QName content = new QName("content");
final QName lang = new QName("http://www.w3.org/XML/1998/namespace", "lang", "xml");
final QName base = new QName("http://www.w3.org/1999/xhtml", "base");
final QName head = new QName("http://www.w3.org/1999/xhtml", "head");
final QName body = new QName("http://www.w3.org/1999/xhtml", "body");
// Hack bits
final QName input = new QName("input");
final QName name = new QName("name");
final QName form = new QName("form");
final Collection<String> rdfType = Collections.singleton("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
final String xmlLiteral = "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral";
final Set<Setting> settings = EnumSet.noneOf(Setting.class);
public enum Setting {
FormMode, ManualNamespaces
}
public Parser(StatementSink sink) {
this.reader = null;
this.sink = sink;
outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
}
public void enable(Setting setting) { settings.add(setting); }
public void disable(Setting setting) { settings.remove(setting); }
public void setBase(String base) {
this.context = new EvalContext(base);
}
//private String currentBase;
EvalContext parse(EvalContext context, StartElement element)
throws XMLStreamException, IOException {
boolean recurse = true;
boolean skipElement = false;
String newSubject = null;
String currentObject = null;
//Map<String, String> uriMappings = context.uriMappings;
List<String> forwardProperties = new LinkedList(context.forwardProperties);
List<String> backwardProperties = new LinkedList(context.backwardProperties);
String currentLanguage = context.language;
String currentBase = context.base;
// TODO element.getNamespace();
if (element.getAttributeByName(lang) != null)
currentLanguage = element.getAttributeByName(lang).getValue();
if (base.equals(element.getName()) && element.getAttributeByName(href) != null) {
currentBase = getBase(element.getAttributeByName(href));
context.base = currentBase;
if (context.original) context.parentSubject = currentBase;
}
if (element.getAttributeByName(rev) == null &&
element.getAttributeByName(rel) == null) {
Attribute nSubj = findAttribute(element, about, src, resource, href);
if (nSubj != null) {
newSubject = getURI(currentBase, element, nSubj);
} else {
if (element.getAttributeByName(typeof) != null) {
if (body.equals(element.getName()) ||
head.equals(element.getName()))
newSubject = currentBase;
else
newSubject = createBNode();
} else {
if (context.parentObject != null) {
newSubject = context.parentObject;
}
if (element.getAttributeByName(property) == null) {
skipElement = true;
}
}
}
} else {
Attribute nSubj = findAttribute(element, about, src);
if (nSubj != null) {
newSubject = getURI(currentBase, element, nSubj);
} else {
// TODO if element is head or body assume about=""
if (element.getAttributeByName(typeof) != null) {
newSubject = createBNode();
} else {
if (context.parentObject != null) {
newSubject = context.parentObject;
}
}
}
Attribute cObj = findAttribute(element, resource, href);
if (cObj != null) {
currentObject = getURI(currentBase, element, cObj);
}
}
if (newSubject != null && element.getAttributeByName(typeof) != null) {
List<String> types = getURIs(currentBase, element, element.getAttributeByName(typeof));
for (String type : types) {
emitTriples(newSubject,
rdfType,
type);
}
}
if (newSubject == null) newSubject = context.parentSubject;
// Dodgy extension
if (settings.contains(Setting.FormMode)) {
if (form.equals(element.getName()))
emitTriples(newSubject, rdfType, "http://www.w3.org/1999/xhtml/vocab/#form"); // Signal entering form
if (input.equals(element.getName()) &&
element.getAttributeByName(name) != null)
currentObject = "?:" + element.getAttributeByName(name).getValue();
}
if (currentObject != null) {
if (element.getAttributeByName(rel) != null) {
emitTriples(newSubject,
getURIs(currentBase, element, element.getAttributeByName(rel)),
currentObject);
}
if (element.getAttributeByName(rev) != null) {
emitTriples(currentObject,
getURIs(currentBase, element, element.getAttributeByName(rev)),
newSubject);
}
} else {
if (element.getAttributeByName(rel) != null) {
forwardProperties.addAll(getURIs(currentBase, element, element.getAttributeByName(rel)));
}
if (element.getAttributeByName(rev) != null) {
backwardProperties.addAll(getURIs(currentBase, element, element.getAttributeByName(rev)));
}
if (element.getAttributeByName(rel) != null || // if predicate present
element.getAttributeByName(rev) != null) {
currentObject = createBNode(); // TODO generate bnode
}
}
// Getting literal values. Complicated!
if (element.getAttributeByName(property) != null) {
List<String> props = getURIs(currentBase, element, element.getAttributeByName(property));
String dt = getDatatype(element);
if (element.getAttributeByName(content) != null) { // The easy bit
String lex = element.getAttributeByName(content).getValue();
if (dt == null || dt.length() != 0)
emitTriplesPlainLiteral(newSubject, props, lex, currentLanguage);
else
emitTriplesDatatypeLiteral(newSubject, props, lex, dt);
} else {
//recurse = false;
level = 1;
theDatatype = dt;
literalWriter = new StringWriter();
litProps = props;
if (dt == null) // either plain or xml
queuedEvents = new LinkedList<XMLEvent>();
else if (dt.length() == 0) // force plain
;
else if (xmlLiteral.equals(dt)) // definitely xml?
xmlWriter = outputFactory.createXMLEventWriter(literalWriter);
}
}
if (!skipElement && newSubject != null) {
emitTriples(context.parentSubject,
context.forwardProperties,
newSubject);
emitTriples(newSubject,
context.backwardProperties,
context.parentSubject);
}
if (recurse) {
EvalContext ec = new EvalContext(context);
if (skipElement) {
ec.language = currentLanguage;
ec.original = context.original;
//copy uri mappings
} else {
if (newSubject != null) {
ec.parentSubject = newSubject;
} else {
ec.parentSubject = context.parentSubject;
}
if (currentObject != null) {
ec.parentObject = currentObject;
} else if (newSubject != null) {
ec.parentObject = newSubject;
} else {
ec.parentObject = context.parentSubject;
}
//ec.uriMappings = uriMappings;
ec.language = currentLanguage;
ec.forwardProperties = forwardProperties;
ec.backwardProperties = backwardProperties;
}
/*
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
parse(ec, event.asStartElement());
if (!currentBase.equals(ec.base)) { // bubbling up base change
// I could just let parentS = null, rather than bother with original?
context.base = ec.base;
if (context.original) context.parentSubject = ec.base;
}
}
if (event.isEndDocument() || event.isEndElement()) {
return;
}
}
*/
return ec;
}
return null;
}
private Attribute findAttribute(StartElement element, QName... names) {
for (QName aName : names) {
Attribute a = element.getAttributeByName(aName);
if (a != null) {
return a;
}
}
return null;
}
private void emitTriples(String subj, Collection<String> props, String obj) {
for (String prop : props) {
sink.addObject(subj, prop, obj);
}
}
private void emitTriplesPlainLiteral(String subj, Collection<String> props, String lex, String language) {
for (String prop : props) {
sink.addLiteral(subj, prop, lex, language, null);
}
}
private void emitTriplesDatatypeLiteral(String subj, Collection<String> props, String lex, String datatype) {
for (String prop : props) {
sink.addLiteral(subj, prop, lex, null, datatype);
}
}
private String getURI(String base, StartElement element, Attribute attr) {
QName attrName = attr.getName();
if (attrName.equals(href) || attrName.equals(src)) // A URI
{
if (attr.getValue().length() == 0) return base;
IRI uri = IRIFact.construct(base);
IRI resolved = uri.resolve(attr.getValue());
return resolved.toString();
}
if (attrName.equals(about) || attrName.equals(resource)) // Safe CURIE or URI
{
return expandSafeCURIE(base, element, attr.getValue());
}
if (attrName.equals(datatype)) // A CURIE
{
return expandCURIE(element, attr.getValue());
}
throw new RuntimeException("Unexpected attribute: " + attr);
}
private List<String> getURIs(String base, StartElement element, Attribute attr) {
List<String> uris = new LinkedList<String>();
String[] curies = attr.getValue().split("\\s+");
boolean permitReserved = rel.equals(attr.getName()) ||
rev.equals(attr.getName());
for (String curie : curies) {
if (permitReserved && SpecialRels.contains(curie))
uris.add("http://www.w3.org/1999/xhtml/vocab#" + curie);
else if (!SpecialRels.contains(curie)) {
String uri = expandCURIE(element, curie);
if (uri != null) uris.add(uri);
}
}
return uris;
}
int bnodeId = 0;
private String createBNode() // TODO probably broken? Can you write bnodes in rdfa directly?
{
return "_:node" + (bnodeId++);
}
private String expandCURIE(StartElement element, String value) {
if (value.startsWith("_:")) return value;
if (settings.contains(Setting.FormMode) && // variable
value.startsWith("?:")) return value;
int offset = value.indexOf(":");
if (offset == -1) {
//throw new RuntimeException("Is this a curie? \"" + value + "\"");
return null;
}
String prefix = value.substring(0, offset);
String namespaceURI = prefix.length() == 0 ?
"http://www.w3.org/1999/xhtml/vocab#" :
element.getNamespaceURI(prefix) ;
if (namespaceURI == null) {
throw new RuntimeException("Unknown prefix: " + prefix);
}
if (namespaceURI.endsWith("/") || namespaceURI.endsWith("#"))
return namespaceURI + value.substring(offset + 1);
else
return namespaceURI + "#" + value.substring(offset + 1);
}
private String expandSafeCURIE(String base, StartElement element, String value) {
if (value.startsWith("[") && value.endsWith("]")) {
return expandCURIE(element, value.substring(1, value.length() - 1));
} else {
if (value.length() == 0) return base;
if (settings.contains(Setting.FormMode) &&
value.startsWith("?:")) return value;
IRI uri = IRIFact.construct(base);
IRI resolved = uri.resolve(value);
return resolved.toString();
}
}
private String getDatatype(StartElement element) {
Attribute de = element.getAttributeByName(datatype);
if (de == null) {
return null;
}
String dt = de.getValue();
if (dt.length() == 0) {
return dt;
}
return expandCURIE(element, dt);
}
private String getBase(Attribute attr) {
String theBase = attr.getValue();
if (theBase.contains("#"))
return theBase.substring(0, theBase.indexOf("#"));
else
return theBase;
}
static class EvalContext {
EvalContext parent;
String base;
String parentSubject;
String parentObject;
//Map<String, String> uriMappings;
String language;
List<String> forwardProperties;
List<String> backwardProperties;
boolean original;
private EvalContext(String base) {
this.base = base;
this.parentSubject = base;
this.forwardProperties = new LinkedList<String>();
this.backwardProperties = new LinkedList<String>();
//this.uriMappings = new HashMap<String, String>();
original = true;
}
public EvalContext(EvalContext toCopy) {
this.base = toCopy.base;
this.parentSubject = toCopy.parentSubject;
this.parentObject = toCopy.parentObject;
//this.uriMappings = new HashMap<String, String>(toCopy.uriMappings);
this.language = toCopy.language;
this.forwardProperties = new LinkedList<String>(toCopy.forwardProperties);
this.backwardProperties = new LinkedList<String>(toCopy.backwardProperties);
original = false;
this.parent = toCopy;
}
//@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[\n\tbase: " + base);
sb.append("\n\tparentSubject: " + parentSubject);
sb.append("\n\tparentObject: " + parentObject);
//sb.append("\nforward: [");
//for (String prop : forwardProperties) {
// sb.append(prop);
// sb.append(" ");
//}
sb.append("]");
return sb.toString();
}
}
static class Appender implements Iterator {
final Iterator parent;
final Object appended;
boolean finished;
public Appender(Iterator parent, Object appended) {
this.parent = parent;
this.appended = appended;
finished = false;
}
//@Override
public boolean hasNext() {
return parent.hasNext() || !finished;
}
//@Override
public Object next() {
if (parent.hasNext()) return parent.next();
if (finished) throw new NoSuchElementException("I'm empty, dum dum");
finished = true;
return appended;
}
//@Override
public void remove() {
throw new UnsupportedOperationException("Not supported");
}
}
/**
* SAX methods
*/
private Locator locator;
private NSMapping mapping;
private EvalContext context = new EvalContext("http://www.example.com/");
// For literals (what fun!)
private List<XMLEvent> queuedEvents;
private int level = -1;
private XMLEventWriter xmlWriter;
private StringWriter literalWriter;
private String theDatatype;
private List<String> litProps;
public void setDocumentLocator(Locator arg0) { this.locator = arg0; }
public void startDocument() throws SAXException {
sink.start();
mapping = new NSMapping();
}
public void endDocument() throws SAXException { sink.end(); }
public void startPrefixMapping(String arg0, String arg1) throws SAXException {
//System.err.println("Mapping: " + arg0 + " " + arg1);
mapping.add(arg0, arg1);
}
public void endPrefixMapping(String arg0) throws SAXException {
mapping.remove(arg0);
}
public void startElement(String arg0, String localname, String qname, Attributes arg3) throws SAXException {
try {
//System.err.println("Start element: " + arg0 + " " + arg1 + " " + arg2);
// Dammit, not quit the same as XMLEventFactory
String prefix = (localname.equals(qname)) ? ""
: qname.substring(0, qname.indexOf(':'));
StartElement e = EventFactory.createStartElement(
prefix, arg0, localname,
fromAttributes(arg3), mapping.current(), mapping);
if (level != -1) { // getting literal
handleForLiteral(e);
return;
}
context = parse(context, e);
} catch (XMLStreamException ex) {
Logger.getLogger(Parser.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Parser.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void endElement(String arg0, String arg1, String arg2) throws SAXException {
//System.err.println("End element: " + arg0 + " " + arg1 + " " + arg2);
if (level != -1) { // getting literal
XMLEvent e = EventFactory.createEndElement(arg0, arg1, arg2);
handleForLiteral(e);
return;
}
context = context.parent;
}
public void characters(char[] arg0, int arg1, int arg2) throws SAXException {
if (level != -1) {
XMLEvent e = EventFactory.createCharacters(String.valueOf(arg0, arg1, arg2));
handleForLiteral(e);
return;
}
}
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException {
//System.err.println("Whitespace...");
if (level != -1) {
XMLEvent e = EventFactory.createIgnorableSpace(String.valueOf(arg0, arg1, arg2));
handleForLiteral(e);
}
}
public void processingInstruction(String arg0, String arg1) throws SAXException {}
public void skippedEntity(String arg0) throws SAXException {}
private Iterator fromAttributes(Attributes attributes) {
List toReturn = new LinkedList();
for (int i = 0; i < attributes.getLength(); i++) {
Attribute attr = EventFactory.createAttribute(
attributes.getQName(i), attributes.getURI(i),
attributes.getLocalName(i), attributes.getValue(i));
toReturn.add(attr);
}
return toReturn.iterator();
}
private void handleForLiteral(XMLEvent e) {
try {
handleForLiteralEx(e);
} catch (XMLStreamException ex) {
throw new RuntimeException("Literal handling error", ex);
} catch (IOException ex) {
throw new RuntimeException("Literal handling error", ex);
}
}
private void handleForLiteralEx(XMLEvent e) throws XMLStreamException, IOException {
if (e.isStartElement()) {
level++;
if (queuedEvents != null) { // Aha, we ain't plain
xmlWriter = outputFactory.createXMLEventWriter(literalWriter);
for (XMLEvent ev: queuedEvents) xmlWriter.add(ev);
queuedEvents = null;
theDatatype = xmlLiteral;
}
}
if (e.isEndElement()) {
level--;
if (level == 0) { // Finished!
if (xmlWriter != null) xmlWriter.close();
else if (queuedEvents != null) {
for (XMLEvent ev: queuedEvents)
literalWriter.append(ev.asCharacters().getData());
}
String lex = literalWriter.toString();
if (theDatatype == null)
emitTriplesPlainLiteral(context.parentSubject,
litProps, lex, context.language);
else
emitTriplesDatatypeLiteral(context.parentSubject,
litProps, lex, theDatatype);
xmlWriter = null;
literalWriter = null;
theDatatype = null;
litProps = null;
level = -1;
return;
}
}
if (xmlWriter != null) xmlWriter.add(e);
else if (e.isCharacters() && queuedEvents != null)
queuedEvents.add(e);
else if (e.isCharacters())
literalWriter.append(e.asCharacters().getData());
}
static class NSMapping implements NamespaceContext {
Map<String, LinkedList<String>> mappings =
new HashMap<String, LinkedList<String>>();
public String getNamespaceURI(String prefix) {
if (mappings.containsKey(prefix))
return mappings.get(prefix).getLast();
return null;
}
public void add(String prefix, String uri) {
if (mappings.containsKey(prefix))
mappings.get(prefix).add(uri);
else {
LinkedList<String> list = new LinkedList<String>();
list.add(uri);
mappings.put(prefix, list);
}
}
public void remove(String prefix) {
if (mappings.containsKey(prefix)) {
mappings.get(prefix).removeLast();
if (mappings.get(prefix).isEmpty())
mappings.remove(prefix);
}
}
public Iterator<Namespace> current() {
List<Namespace> toReturn = new LinkedList<Namespace>();
for (Entry<String, LinkedList<String>> e: mappings.entrySet()) {
toReturn.add(
EventFactory.createNamespace(e.getKey(), e.getValue().getLast())
);
}
return toReturn.iterator();
}
public String getPrefix(String arg0) {
throw new UnsupportedOperationException("Not supported yet.");
}
public Iterator getPrefixes(String arg0) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
1629fc6032a39b17ab5a97b5ee6e6a2c9a2419a4 | f4094d80db0d651b6a79df391356b99ff76e6115 | /src/com/gsyoa/action/MessagesAction.java | fcd3c7943f5102dc4f663d92c55c5b7c8fca3f5a | [
"Apache-2.0"
] | permissive | hou2538/GSYOA | 17e2b80a5064110f652fce0f2a993b0f1be55379 | 9e492a69ea10c39f76c0dabdf97c2f3373424658 | refs/heads/master | 2020-05-25T20:25:10.370506 | 2014-01-18T13:36:12 | 2014-01-18T13:36:12 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,532 | java | package com.gsyoa.action;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.struts2.ServletActionContext;
import com.gsyoa.entity.MessageInfo;
import com.gsyoa.entity.Messages;
import com.gsyoa.entity.MessagesReply;
import com.gsyoa.entity.User;
import com.gsyoa.service.MessagesReplyService;
import com.gsyoa.service.MessagesService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
/**
* 站内信处理
* @author Hello_海生
* @date 2013年12月16日
* 韦海生 2013年12月23日,最后整理
*/
public class MessagesAction extends ActionSupport {
//站内信实体
private Messages messages;
public Messages getMessages() {
return messages;
}
public void setMessages(Messages messages) {
this.messages = messages;
}
//回复实体
private MessagesReply messagesReply;
public MessagesReply getMessagesReply() {
return messagesReply;
}
public void setMessagesReply(MessagesReply messagesReply) {
this.messagesReply = messagesReply;
}
//声明,MessageInfo 实体,用于 提示
private MessageInfo message;
public MessageInfo getMessage() {
return message;
}
public void setMessage(MessageInfo message) {
this.message = message;
}
// 声明 站内信 服务,并设置 Set方法
private MessagesService messagesService;
public void setMessagesService(MessagesService messagesService) {
this.messagesService = messagesService;
}
//声明 站内信 服务,并设置 Set方法
private MessagesReplyService messagesReplyService;
public void setMessagesReplyService(MessagesReplyService messagesReplyService) {
this.messagesReplyService = messagesReplyService;
}
//发送站内信
public String send(){
if(messages.getTitle().equals("") || messages.getReceiveUserId().equals("") || messages.getContent().equals("")){
message = new MessageInfo(0, "您输入的信息不完整,请输入完整再进行提交!", "", "");
}else{
User user = (User) ActionContext.getContext().getSession().get("User"); //获取用户session
messages.setSendUserId(new User(user.getId()));
messages.setState("未读");
messages.setCreateTime(new Date());
if(messagesService.saveMessages(messages))message = new MessageInfo(0, "信息已发送成功!", "", "");
else message = new MessageInfo(0, "信息发送失败,请联系管理员!", "", "");
}
return "message";
}
//站内信列表
public String list(){
User user = (User) ActionContext.getContext().getSession().get("User"); //获取用户session
List<Messages> messagesList= messagesService.SelectMessagesByUserId(user.getId()); //查询该用户下的所有信息
List<Messages> msgList=new ArrayList<Messages>(); //创建一个 信息数组用于 赛选
for (Messages messages : messagesList) {
if(!messages.getState().equals("删除"))msgList.add(messages); //获取未删除的信息
}
ServletActionContext.getRequest().setAttribute("messagesList",msgList);
return "list"; //返回列表页
}
//回复站内信 页面
public String reply(){
Messages m= messagesService.SelectMessagesById(messages.getId()); //根据Id 获取该站内信的信息
if(m==null)message=new MessageInfo(0, "该条站内信不存在!", "", "");
else{
ServletActionContext.getRequest().setAttribute("messages",m); //存储站内信 信息
if(!m.getState().equals("删除")){ //如果该条信息不是 已经删除,则 修改状态为已读,
m.setState("已读");
messagesService.updateMessages(m);
}
List<MessagesReply> messagesReplyList = messagesReplyService.selectMessagesReplyByMessagesId(m.getId()); //查询回复信息
ServletActionContext.getRequest().setAttribute("messagesReplyList",messagesReplyList);
}
return "reply";
}
//处理信息回复
public String doReply(){
if(messagesReply.getContent().equals(""))message = new MessageInfo(0, "回复内容不能为空!", "", "");
else{
User u = (User) ActionContext.getContext().getSession().get("User"); //获取用户session
messagesReply.setReplyTime(new Date());
messagesReply.setSendUserId(u);
if(messagesReplyService.saveMessagesReply(messagesReply)){
Messages m= messagesService.SelectMessagesById(messagesReply.getMessagesId().getId());
m.setState("新回复");
messagesService.updateMessages(m);
message = new MessageInfo(0, "信息回复成功!", "", "");
}else{
message = new MessageInfo(0, "信息回复失败!", "", "");
}
}
return "message";
}
//删除站内信
public String delete(){
User user = (User) ActionContext.getContext().getSession().get("User"); //获取用户session
Messages m = messagesService.SelectMessagesById(messages.getId()); //查询该条站内信的 信息
if(m.getReceiveUserId().getId()!=user.getId())message = new MessageInfo(0, "该短息不属于您,您不能删除!", "","");
else{
if(m.getState().equals("删除")){ //如果 该条站内信的 状态 是 删除, 则 彻底删除
if(messagesService.deleteMessages(m.getId()))message = new MessageInfo(0, "彻底删除成功!", "","");
else message = new MessageInfo(0, "彻底删除失败!", "","");
}else{
m.setState("删除");
if(messagesService.updateMessages(m))message = new MessageInfo(0, "删除成功!", "","");
else message = new MessageInfo(0, "删除失败!", "","");
}
}
return "message";
}
//已删除信息列表
public String deletelist(){
User user = (User) ActionContext.getContext().getSession().get("User"); //获取用户session
List<Messages> messagesList= messagesService.SelectMessagesByUserId(user.getId()); //查询该用户的所有信息
List<Messages> msgList=new ArrayList<Messages>();
for (Messages messages : messagesList) {
if(messages.getState().equals("删除"))msgList.add(messages); //遍历获取 已删除的数组
}
ServletActionContext.getRequest().setAttribute("messagesList",msgList);
return "list";
}
//恢复已删除的站内信
public String recovery(){
Messages m = messagesService.SelectMessagesById(messages.getId());
if(m==null)message = new MessageInfo(0, "该站内信不存在或已被删除!", "","");
else{
m.setState("已读");
if(messagesService.updateMessages(m))message = new MessageInfo(0, "短信息恢复成功!", "","");
else message = new MessageInfo(0, "短信息恢复失败!", "","");
}
return "message";
}
}
| [
"hais1992@163.com"
] | hais1992@163.com |
272087ba84a135eda92a18612faf1d0fd547c8b3 | 4c19b724f95682ed21a82ab09b05556b5beea63c | /XMSYGame/java2/network/pay/xinfapay/src/main/java/com/xmsy/network/pay/xinfapay/utils/ResultUtil.java | b776d9c99cd1d42ca88bf6face74a5619fc5e633 | [] | no_license | angel-like/angel | a66f8fda992fba01b81c128dd52b97c67f1ef027 | 3f7d79a61dc44a9c4547a60ab8648bc390c0f01e | refs/heads/master | 2023-03-11T03:14:49.059036 | 2022-11-17T11:35:37 | 2022-11-17T11:35:37 | 222,582,930 | 3 | 5 | null | 2023-02-22T05:29:45 | 2019-11-19T01:41:25 | JavaScript | UTF-8 | Java | false | false | 383 | java | package com.xmsy.network.pay.xinfapay.utils;
import com.xmsy.network.pay.xinfapay.def.Config;
/**
* .支付结果工具类
*
* @author aleng
* @date 2018年11月22日
* @version 1.0
*/
public class ResultUtil {
/**
* 支付是否成功
*
* @param result
* @return
*/
public static boolean success(String code) {
return Config.ORDER_SUCCESS.equals(code);
}
}
| [
"163@qq.com"
] | 163@qq.com |
a871cf8690d2e43bb05b80d006ec9656e788d2c5 | 9adfbc2e85782980f652ef24cdceec4fd33b6ae4 | /smart-httpd/src/main/java/freelifer/smarthttpd/inner/managerimpl/ServiceManager.java | 5821c13e6a9c1696e2e8c75164bc49e5c83fbb78 | [] | no_license | freelifer/SmartHttpd | ade19a5025b45c83a273a0b64bff5d383ff9c6ef | c73abd06c044a553eed935392b1412b1f843e9f3 | refs/heads/master | 2021-01-01T18:36:08.928748 | 2017-07-28T12:24:21 | 2017-07-28T12:24:21 | 98,375,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package freelifer.smarthttpd.inner.managerimpl;
import java.util.HashMap;
import java.util.Map;
import freelifer.smarthttpd.inner.log.Logger;
import freelifer.smarthttpd.inner.manager.IServiceManager;
/**
* @author kzhu on 2017/7/26.
*/
public class ServiceManager {
final static Map<String, Object> managerMap = new HashMap<>();
static {
managerMap.put(IServiceManager.CONFIG_MANAGER, new ConfigManagerImpl());
}
public static IServiceManager getInstance() {
return Singleton.instance;
}
private static class Singleton {
private static final IServiceManager instance = new ServiceManagerImpl(managerMap);
}
}
| [
"576618121@qq.com"
] | 576618121@qq.com |
032fcae6b702d911f04d9573b912de1a831704a1 | 771bc274ae1e21ecd2aabe92c18d4dd4d00eadab | /src/generalization/testDisInfo.java | 965d004e1de4493212dd01983942b7367f2675f2 | [] | no_license | CJMAurora/codeRepo | 6fea7b894c14f7d15dfc34fb713577170cd81866 | 8c71a74257f4d579aa7c119cb18ae3f7d8bc8f2f | refs/heads/master | 2020-03-11T14:53:27.447137 | 2018-05-20T09:13:34 | 2018-05-20T09:13:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package generalization;
import stoStructure.Storage;
public class testDisInfo {
public static void main(String[] args) {
DisInfo disInfo=new DisInfo();
disInfo.setDisInfo(4);
}
}
| [
"chenjinmei010@163.com"
] | chenjinmei010@163.com |
d42dd6c2489da7416c4f911d9e81f8119957c2de | c293f6877201ff960a335365ce4d5d24a4d8af73 | /eblog/src/main/java/com/example/mapper/UserActionMapper.java | c51f05545e6f8373beced1d0d24b29e0612774fe | [] | no_license | njq-ustc/eblog | e88ee50837e135fd74e5e0480c6e3948cbdcc210 | 0e5147bda7b94cd9b146bb68d0e5f86a46cef037 | refs/heads/master | 2023-01-09T18:21:21.314252 | 2020-11-16T15:21:02 | 2020-11-16T15:21:02 | 303,987,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package com.example.mapper;
import com.example.entity.UserAction;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author 公众号:java思维导图
* @since 2020-10-11
*/
public interface UserActionMapper extends BaseMapper<UserAction> {
}
| [
"596638515@qq.com"
] | 596638515@qq.com |
c775cb2de96c5a0f54293abc8ad3bf8429539dd7 | f47b38c3daa5c9a9e8586d6e3abac69101469450 | /src/com/shpp/p2p/cs/dpron/assignment6/tm/ToneMatrixDisplay.java | ed79b60b0f95ac7ff1260a0afcfd0e94526e393d | [
"MIT"
] | permissive | PronDmytro/CS50 | be9136f61b1e378da6c5d8eb889bcbad01772acf | b6b3a9bc5000c24bd3d385ce0a83e7291496d04f | refs/heads/master | 2023-08-13T07:36:54.679350 | 2021-09-29T23:28:47 | 2021-09-29T23:28:47 | 387,017,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,876 | java | package com.shpp.p2p.cs.dpron.assignment6.tm;
import acm.graphics.GCanvas;
import acm.graphics.GRect;
import java.awt.*;
import java.awt.event.*;
public class ToneMatrixDisplay extends GCanvas implements MouseListener, MouseMotionListener, ComponentListener {
private static final int GSCALE = 20;
private static final Color LIT_COLOR = new Color(232, 232, 232);
private static final Color UNLIT_COLOR = (new Color(134, 110, 255)).darker();
private static final Color HIGHLIGHT_RECT_COLOR = new Color(255, 255, 0, 128);
private static final Color BACKGROUND_COLOR;
private boolean[][] matrix = new boolean[ToneMatrixConstants.size()][ToneMatrixConstants.size()];
private GRect[][] matrixRects = new GRect[ToneMatrixConstants.size()][ToneMatrixConstants.size()];
private double xScale;
private double yScale;
private double xTrans;
private double yTrans;
private boolean isMarking;
private GRect highlightRect;
private volatile int highlightedColumn = -1;
static {
BACKGROUND_COLOR = Color.GRAY;
}
public ToneMatrixDisplay() {
this.setBackground(BACKGROUND_COLOR);
for (int i = 0; i < ToneMatrixConstants.size(); ++i) {
for (int j = 0; j < ToneMatrixConstants.size(); ++j) {
this.matrixRects[i][j] = new GRect(0.0D, 0.0D, 0.0D, 0.0D);
this.matrixRects[i][j].setFilled(true);
this.matrixRects[i][j].setColor(Color.BLACK);
this.matrixRects[i][j].setFillColor(UNLIT_COLOR);
this.add(this.matrixRects[i][j]);
}
}
this.highlightRect = new GRect(0.0D, 0.0D, 0.0D, 0.0D);
this.highlightRect.setFilled(true);
this.highlightRect.setColor(HIGHLIGHT_RECT_COLOR);
this.add(this.highlightRect);
this.setPreferredSize(new Dimension(ToneMatrixConstants.size() * 20, ToneMatrixConstants.size() * 20));
this.addMouseListener(this);
this.addMouseMotionListener(this);
this.addComponentListener(this);
}
private void redrawAll() {
for (int row = 0; row < ToneMatrixConstants.size(); ++row) {
for (int col = 0; col < ToneMatrixConstants.size(); ++col) {
this.matrixRects[row][col].setBounds(this.xScale * (double) col + this.xTrans, this.yScale * (double) row + this.yTrans, this.xScale, this.yScale);
this.matrixRects[row][col].setFillColor(this.matrix[row][col] ? LIT_COLOR : UNLIT_COLOR);
}
}
if (this.highlightedColumn == -1) {
this.highlightRect.setBounds(0.0D, 0.0D, 0.0D, 0.0D);
} else {
this.highlightRect.setBounds(this.xScale * (double) this.highlightedColumn + this.xTrans, this.yTrans, this.xScale, this.yScale * (double) ToneMatrixConstants.size());
}
}
private void recalculateGeometry() {
this.xScale = (double) this.getWidth() / (double) ToneMatrixConstants.size();
this.yScale = (double) this.getHeight() / (double) ToneMatrixConstants.size();
this.xScale = this.yScale = Math.min(this.xScale, this.yScale);
this.xTrans = ((double) this.getWidth() - this.xScale * (double) ToneMatrixConstants.size()) / 2.0D;
this.yTrans = ((double) this.getHeight() - this.yScale * (double) ToneMatrixConstants.size()) / 2.0D;
}
private boolean inBounds(int row, int col) {
return row >= 0 && col >= 0 && row < ToneMatrixConstants.size() && col < ToneMatrixConstants.size();
}
private void markAt(int row, int col, boolean set) {
if (this.inBounds(row, col)) {
this.matrix[row][col] = set;
this.matrixRects[row][col].setFillColor(set ? LIT_COLOR : UNLIT_COLOR);
}
}
public void clear() {
for (int i = 0; i < ToneMatrixConstants.size(); ++i) {
for (int j = 0; j < ToneMatrixConstants.size(); ++j) {
this.markAt(i, j, false);
}
}
}
public void mouseDragged(MouseEvent e) {
int x = (int) (((double) e.getX() - this.xTrans) / this.xScale);
int y = (int) (((double) e.getY() - this.yTrans) / this.yScale);
this.markAt(y, x, this.isMarking);
}
public void mousePressed(MouseEvent e) {
int x = (int) (((double) e.getX() - this.xTrans) / this.xScale);
int y = (int) (((double) e.getY() - this.yTrans) / this.yScale);
if (this.inBounds(y, x)) {
this.isMarking = !this.matrix[y][x];
}
this.markAt(y, x, this.isMarking);
}
public void mouseClicked(MouseEvent arg0) {
}
public void mouseEntered(MouseEvent arg0) {
}
public void mouseExited(MouseEvent arg0) {
}
public void mouseReleased(MouseEvent arg0) {
}
public void mouseMoved(MouseEvent arg0) {
}
public void componentHidden(ComponentEvent arg0) {
}
public void componentMoved(ComponentEvent arg0) {
}
public void componentShown(ComponentEvent arg0) {
}
public void componentResized(ComponentEvent arg0) {
this.recalculateGeometry();
this.redrawAll();
}
public boolean[][] getMatrix() {
boolean[][] result = new boolean[ToneMatrixConstants.size()][ToneMatrixConstants.size()];
for (int i = 0; i < ToneMatrixConstants.size(); ++i) {
for (int j = 0; j < ToneMatrixConstants.size(); ++j) {
result[ToneMatrixConstants.size() - 1 - i][j] = this.matrix[i][j];
}
}
return result;
}
public void setMatrix(boolean[][] newMatrix) {
if (newMatrix == null) {
throw new NullPointerException("setMatrix cannot be called on a null matrix.");
} else if (newMatrix.length != ToneMatrixConstants.size()) {
throw new IllegalArgumentException("Incorrect size for setMatrix");
} else {
int row;
for (row = 0; row < newMatrix.length; ++row) {
if (newMatrix[row] == null) {
throw new IllegalArgumentException("Inner array is null.");
}
if (newMatrix[row].length != ToneMatrixConstants.size()) {
throw new IllegalArgumentException("Incorrect size for setMatrix");
}
}
for (row = 0; row < ToneMatrixConstants.size(); ++row) {
for (int col = 0; col < ToneMatrixConstants.size(); ++col) {
this.matrix[ToneMatrixConstants.size() - 1 - row][col] = newMatrix[row][col];
}
}
this.redrawAll();
}
}
public void highlightColumn(int column) {
if (column < 0 || column >= ToneMatrixConstants.size()) {
column = -1;
}
this.highlightedColumn = column;
this.redrawAll();
}
}
| [
"dmytropron5838@gmail.com"
] | dmytropron5838@gmail.com |
62c8b4cbf8cb9dd825e3b694f4907f2169ad7f1f | 6b3adca87f2e55c40e20d64a4ed7d1ede258f32a | /linden-core/src/main/java/com/xiaomi/linden/util/ResponseUtils.java | a9251db4e29c10ee3bb4db4fa568d74244b2c02a | [
"Apache-2.0"
] | permissive | XiaoMi/linden | 19b3147408252c0638479b7eba37987778b7fcf3 | f4e9806704dfb8da484df92711c0aa82a90e93df | refs/heads/master | 2023-04-12T14:39:46.444970 | 2022-04-01T03:31:06 | 2022-04-01T03:31:06 | 76,436,183 | 256 | 57 | Apache-2.0 | 2023-04-10T13:48:05 | 2016-12-14T07:38:38 | Java | UTF-8 | Java | false | false | 1,485 | java | // Copyright 2016 Xiaomi, 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.xiaomi.linden.util;
import com.google.common.base.Throwables;
import com.twitter.util.Future;
import com.xiaomi.linden.thrift.common.Response;
public class ResponseUtils {
public static final Response SUCCESS = new Response();
public static final Response FAILED = new Response(false);
public static Future<Response> buildFailedFutureResponse(Exception e) {
return Future.value(new Response(false).setError(Throwables.getStackTraceAsString(e)));
}
public static Future<Response> buildFailedFutureResponse(String errorStackInfo) {
return Future.value(new Response(false).setError(errorStackInfo));
}
public static Response buildFailedResponse(String error) {
return new Response(false).setError(error);
}
public static Response buildFailedResponse(Exception e) {
return new Response(false).setError(Throwables.getStackTraceAsString(e));
}
}
| [
"zhaoyonghui@xiaomi.com"
] | zhaoyonghui@xiaomi.com |
cfcfcb8b996e6791c7da8f734256c10ec3d09860 | 51f6f451c1264a999d83556406aa8a6cdc9ad12c | /app/src/test/java/com/itg8/healthapp/ExampleUnitTest.java | dc92698d73dc0196896ab2af3f972d6c9fd5df4c | [] | no_license | AndroidItg8/HealthApp | 80312f652d09c2871c53db3e3ff708aea7ee8138 | 4ea57f3489aa07f8bef08a0e1310d7b8f0fb2c17 | refs/heads/master | 2020-08-05T15:36:42.448979 | 2019-10-03T14:17:29 | 2019-10-03T14:17:29 | 212,598,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.itg8.healthapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"itechgalaxy.app@gmail.com"
] | itechgalaxy.app@gmail.com |
1544e3ecd473dbc65aee5b7c82bef1f34d5f4799 | 838576cc2e44f590d4c59f8a4d120f629969eedf | /src/com/sino/ams/system/user/dto/SfGroupDTO.java | c54501b5dfdffcf12afad138234c7c2c327bea55 | [] | no_license | fancq/CQEAM | ecbfec8290fc4c213101b88365f7edd4b668fdc8 | 5dbb23cde5f062d96007f615ddae8fd474cb37d8 | refs/heads/master | 2021-01-16T20:33:40.983759 | 2013-09-03T16:00:57 | 2013-09-03T16:00:57 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 9,244 | java | package com.sino.ams.system.user.dto;
import java.sql.Timestamp;
import com.sino.base.calen.SimpleCalendar;
import com.sino.base.dto.CheckBoxDTO;
import com.sino.base.exception.CalendarException;
import com.sino.base.util.StrUtil;
/**
* <p>Title: SfGroup</p>
* <p>Description: 程序自动生成DTO数据传输对象</p>
* <p>Copyright: 北京思诺博信息科技有限公司 Copyright (c) 2006</p>
* <p>Company: 北京思诺博信息科技有限公司</p>
* @author 唐明胜
* @version 1.0
*/
public class SfGroupDTO extends CheckBoxDTO {
private int groupId ;
private String groupCode = "";
private String groupname = "";
private String groupName = "";
private String groupPid = "";
private int organizationId;
private String sortno = "";
private String isroot = "";
private String category = "";
private String enabled = "";
private String isInner = "";
private Timestamp creationDate = null;
private int createdBy;
private Timestamp lastUpdateDate = null;
private int lastUpdateBy;
private String isDesigner = "";
private int pFlowId;
private String categoryDesc = "";
private String groupProp = "";
private String isDesignerOption = "";
private String flowGroupOption = "";
private String enableOption = "";
private String groupThred = "";
private String deptId = "";
private String deptName = "";
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getCategoryDesc() {
return categoryDesc;
}
public void setCategoryDesc(String categoryDesc) {
this.categoryDesc = categoryDesc;
}
/**
* 功能:获取DTO属性 pFlowId
* @return String
*/
public int getpFlowId() {
return this.pFlowId;
}
/**
* 功能:设置DTO属性 pFlowId
* @param pFlowId String
*/
public void setpFlowId(int pFlowId) {
this.pFlowId = pFlowId;
}
/**
* 功能:获取DTO属性 isDesigner
* @return String
*/
public String getIsDesigner() {
return this.isDesigner;
}
/**
* 功能:设置DTO属性 isDesigner
* @param isDesigner String
*/
public void setIsDesigner(String isDesigner) {
this.isDesigner = isDesigner;
}
/**
* 功能:设置DTO属性 groupId
* @param groupId String
*/
public void setGroupId(int groupId) {
this.groupId = groupId;
}
/**
* 功能:设置DTO属性 groupCode
* @param groupCode String
*/
public void setGroupCode(String groupCode) {
this.groupCode = groupCode;
}
/**
* 功能:设置DTO属性 groupname
* @param groupname String
*/
public void setGroupname(String groupname) {
this.groupname = groupname;
}
/**
* 功能:设置DTO属性 groupPid
* @param groupPid String
*/
public void setGroupPid(String groupPid) {
this.groupPid = groupPid;
}
/**
* 功能:设置DTO属性 organizationId
* @param organizationId String
*/
public void setOrganizationId(int organizationId) {
this.organizationId = organizationId;
}
/**
* 功能:设置DTO属性 sortno
* @param sortno String
*/
public void setSortno(String sortno) {
this.sortno = sortno;
}
/**
* 功能:设置DTO属性 isroot
* @param isroot String
*/
public void setIsroot(String isroot) {
this.isroot = isroot;
}
/**
* 功能:设置DTO属性 category
* @param category String
*/
public void setCategory(String category) {
this.category = category;
}
/**
* 功能:设置DTO属性 enabled
* @param enabled String
*/
public void setEnabled(String enabled) {
this.enabled = enabled;
}
/**
* 功能:设置DTO属性 isInner
* @param isInner String
*/
public void setIsInner(String isInner) {
this.isInner = isInner;
}
/**
* 功能:设置DTO属性 creationDate
* @param creationDate Timestamp
* @throws CalendarException 传入值不是正确的日期或者是基础库不能识别的格式时抛出该异常
*/
public void setCreationDate(String creationDate) throws CalendarException {
if (!StrUtil.isEmpty(creationDate)) {
SimpleCalendar cal = new SimpleCalendar(creationDate);
this.creationDate = cal.getSQLTimestamp();
}
}
/**
* 功能:设置DTO属性 createdBy
* @param createdBy String
*/
public void setCreatedBy(int createdBy) {
this.createdBy = createdBy;
}
/**
* 功能:设置DTO属性 lastUpdateDate
* @param lastUpdateDate Timestamp
* @throws CalendarException 传入值不是正确的日期或者是基础库不能识别的格式时抛出该异常
*/
public void setLastUpdateDate(String lastUpdateDate) throws CalendarException {
if (!StrUtil.isEmpty(lastUpdateDate)) {
SimpleCalendar cal = new SimpleCalendar(lastUpdateDate);
this.lastUpdateDate = cal.getSQLTimestamp();
}
}
/**
* 功能:设置DTO属性 lastUpdateBy
* @param lastUpdateBy String
*/
public void setLastUpdateBy(int lastUpdateBy) {
this.lastUpdateBy = lastUpdateBy;
}
public void setGroupProp(String groupProp) {
this.groupProp = groupProp;
}
public void setFlowGroupOption(String flowGroupOption) {
this.flowGroupOption = flowGroupOption;
}
public void setIsDesignerOption(String isDesignerOption) {
this.isDesignerOption = isDesignerOption;
}
public void setEnableOption(String enableOption) {
this.enableOption = enableOption;
}
/**
* 功能:获取DTO属性 groupId
* @return String
*/
public int getGroupId() {
return this.groupId;
}
/**
* 功能:获取DTO属性 groupCode
* @return String
*/
public String getGroupCode() {
return this.groupCode;
}
/**
* 功能:获取DTO属性 groupname
* @return String
*/
public String getGroupname() {
return this.groupname;
}
/**
* 功能:获取DTO属性 groupPid
* @return String
*/
public String getGroupPid() {
return this.groupPid;
}
/**
* 功能:获取DTO属性 organizationId
* @return String
*/
public int getOrganizationId() {
return this.organizationId;
}
/**
* 功能:获取DTO属性 sortno
* @return String
*/
public String getSortno() {
return this.sortno;
}
/**
* 功能:获取DTO属性 isroot
* @return String
*/
public String getIsroot() {
return this.isroot;
}
/**
* 功能:获取DTO属性 category
* @return String
*/
public String getCategory() {
return this.category;
}
/**
* 功能:获取DTO属性 enabled
* @return String
*/
public String getEnabled() {
return this.enabled;
}
/**
* 功能:获取DTO属性 isInner
* @return String
*/
public String getIsInner() {
return this.isInner;
}
/**
* 功能:获取DTO属性 creationDate
* @return Timestamp
*/
public Timestamp getCreationDate() {
return this.creationDate;
}
/**
* 功能:获取DTO属性 createdBy
* @return String
*/
public int getCreatedBy() {
return this.createdBy;
}
/**
* 功能:获取DTO属性 lastUpdateDate
* @return Timestamp
*/
public Timestamp getLastUpdateDate() {
return this.lastUpdateDate;
}
/**
* 功能:获取DTO属性 lastUpdateBy
* @return String
*/
public int getLastUpdateBy() {
return this.lastUpdateBy;
}
public String getGroupProp() {
return groupProp;
}
public String getFlowGroupOption() {
return flowGroupOption;
}
public String getIsDesignerOption() {
return isDesignerOption;
}
public String getEnableOption() {
return enableOption;
}
public String getGroupThred() {
return groupThred;
}
public void setGroupThred(String groupThred) {
this.groupThred = groupThred;
}
public String getDeptId() {
return deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
}
| [
"lq_xm@163.com"
] | lq_xm@163.com |
085b9e9fc3696a2968023dbd9925e49643154382 | e5c3ca5ac9e99a4113d2155cd7e05626cd51c86a | /Calculate Calibration Matrix Code/Libraries/ddogleg/test/org/ddogleg/sorting/TestStraightInsertionSort.java | f417e67275f3717c42498a0a8f6c6bbb02bf99ee | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | huimei/HoloEvac_MResIndividualProject | 81c00cebb471d73c6c6d048809eb0af400c0a7a6 | 5a373050fe463c12f4b0a29f86385d5616c6d919 | refs/heads/master | 2020-03-25T11:06:32.484912 | 2018-08-06T12:02:37 | 2018-08-06T12:02:37 | 143,719,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | /*
* Copyright (c) 2012-2013, Peter Abeles. All Rights Reserved.
*
* This file is part of DDogleg (http://ddogleg.org).
*
* 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.ddogleg.sorting;
import org.junit.Test;
import java.util.Random;
import static org.junit.Assert.fail;
public class TestStraightInsertionSort {
Random rand = new Random(0xfeed);
@Test
public void testSortDouble() {
double[] ret = BenchMarkSort.createRandom_F64(rand,200);
StraightInsertionSort.sort(ret);
double prev = ret[0];
for( int i = 1; i < ret.length; i++ ) {
if( ret[i] < prev )
fail("Not ascending");
}
}
}
| [
"huimei-93@hotmail.com"
] | huimei-93@hotmail.com |
3650cf583d46bf2fd2565a4d0f299f02e5c844c0 | 5665d02c8ecaaaa922d3fe9d1ea3c8989fd84eed | /day07线程池Lambda表达式/src/Demo01/WaitAndNotify/Customer.java | ebfe2a54dbf66c9c9350f1cad11fc3e33577320b | [] | no_license | showmeskills/Java-Advanced | e5296143db3543aeff6a6ae149471524da3a1129 | 74ef85fb3f66a1f49d16f0d6438986352fbaaa57 | refs/heads/master | 2023-07-28T10:24:15.264295 | 2021-09-16T04:16:11 | 2021-09-16T04:16:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,933 | java | package Demo01.WaitAndNotify;
public class Customer extends Thread{
private Buns buns;
boolean isFlag = true;
boolean isTrue = true;
int second = 0;
public Customer(){
super();
}
public Customer(String name,Buns buns){
super(name);
this.buns = buns;
}
@Override
public void run(){
while(this.isFlag){
synchronized(this.buns){
if(this.buns.flag == false){
try{
this.buns.wait();
}catch(InterruptedException e){
e.printStackTrace();
}
}
//Thread is waited and then to run below codes
System.out.println("吃货正在吃"+this.buns.skin + this.buns.inner+"的包子");
System.out.println("customer in three seconds to finish");
this.isFlag = false;
this.reset();
while(isTrue){
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
if(second < 4){
second++;
System.out.println(second + "s");
}else{
this.buns.flag = false;
this.buns.notify();
System.out.println("吃货把"+this.buns.skin + this.buns.inner +"的包子吃完");
System.out.println("通知包子铺继续做包子");
System.out.println("-----------------------");
this.isTrue = false;
this.isFlag = true;
}
}
}
}
}
public void reset(){
this.isTrue = true;
this.second=0;
}
}
| [
"465446853yan@gmail.com"
] | 465446853yan@gmail.com |
9834a6aeaba72a197054ca27e12a31139b4d6610 | 0ffdbc1c9f23fe140850ae85d87f03dc45ee6b5f | /src/com/defrag/redmineplugin/service/util/RedmineEntitySetter.java | fdb3993b3e5f3182b439b9a236835d8943a67318 | [] | no_license | iselimov/RedmineIntegration | 892ad0c9da10b7ec46b5f1b32ce9ece3df993aca | 2a146e10a1ebfbcd7cb2fc5ae56a527882b92035 | refs/heads/master | 2021-04-18T21:29:14.712385 | 2018-11-19T13:09:27 | 2018-11-19T13:09:27 | 126,810,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package com.defrag.redmineplugin.service.util;
/**
* Created by defrag on 26.09.17.
*/
public interface RedmineEntitySetter<T> {
void post(int taskId, T queryValue);
} | [
"i.selimov@eastbanctech.ru"
] | i.selimov@eastbanctech.ru |
5fdb192d5e1977bb198551c87d4b4f68e88494f2 | a106a58f0ea1530eedf767b50713b3665fdaf92c | /app/src/main/java/com/example/sensealert20/help.java | bce842c992b31d608d8b0b39956d8c5b10577c26 | [] | no_license | luka2220/SenseAlert | 99a252672b0680b31d027270adcec22fec7a29df | cdd0bf442642a66ef428f58bb3675f2f6ebdc65d | refs/heads/main | 2023-04-11T00:33:14.121754 | 2021-04-23T15:53:04 | 2021-04-23T15:53:04 | 332,611,809 | 0 | 2 | null | 2021-01-29T18:26:16 | 2021-01-25T02:46:30 | Java | UTF-8 | Java | false | false | 2,272 | java | package com.example.sensealert20;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
public class help extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_top, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_one:
Intent i = new Intent(this,ProfileInfo.class);
startActivity(i);
// Handle the camera action
//Toast.makeText(getApplicationContext(), "Ahh.. going", Toast.LENGTH_LONG).show();
return false;
case R.id.action_two:
Intent r = new Intent(this,help.class);
startActivity(r);
//Toast.makeText(getApplicationContext(), "Ahh.. going", Toast.LENGTH_LONG).show();
return false;
case R.id.action_three:
Intent s = new Intent(this,info.class);
startActivity(s);
//Toast.makeText(getApplicationContext(), "Ahh.. going", Toast.LENGTH_LONG).show();
return false;
case R.id.action_four:
Intent d = new Intent(this,Login.class);
startActivity(d);
//Toast.makeText(getApplicationContext(), "Ahh.. going", Toast.LENGTH_LONG).show();
return false;
case R.id.action_five:
Intent f = new Intent(this,Connection.class);
startActivity(f);
// Toast.makeText(getApplicationContext(), "Ahh.. going", Toast.LENGTH_LONG).show();
return false;
default:
break;
}
return false;
}
} | [
"n01294879@users.noreply.github.com"
] | n01294879@users.noreply.github.com |
618908dada0d8ead7ee1de3b6ea4302acb4a2cda | 51ead0878edf5dbc525f0bf0146e46b67102b676 | /src/main/java/br/com/licitacao/web/rest/errors/EmailNotFoundException.java | 91b262cb25782a4fed161187ab7efade0af83b4b | [] | no_license | Fabriciobr/licitacao | 925fcc81bdb41dc115a8c56e92286e319c61d0ce | 4e831476e02543b222819fa32e66f64175006743 | refs/heads/master | 2020-03-17T16:03:39.757813 | 2018-05-30T01:13:58 | 2018-05-30T01:13:58 | 133,733,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package br.com.licitacao.web.rest.errors;
import org.zalando.problem.AbstractThrowableProblem;
import org.zalando.problem.Status;
public class EmailNotFoundException extends AbstractThrowableProblem {
public EmailNotFoundException() {
super(ErrorConstants.EMAIL_NOT_FOUND_TYPE, "Email address not registered", Status.BAD_REQUEST);
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
2c8d2d9a30f3ae7e3d48b5643bf3d68b23a7b8e4 | 0457e3ed901026ad466afe5619da4ffc181eeb03 | /app/src/main/java/test/TPPresenter.java | 8e2d3013841aa07c3526d5164629ed9fd9850c45 | [] | no_license | duzihao2424/ServerSup | 4aaede99237c4f4da38bf6ce20bae4cf083ba0af | a18ae156405f5ee925b3d54250c14e1c9ca60eee | refs/heads/master | 2020-04-06T21:25:26.726708 | 2018-11-16T02:48:13 | 2018-11-16T02:48:13 | 157,802,774 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,347 | java | package test;
import android.content.Context;
import com.dzh.netlibrary.presenter.BasePresenter;
import com.dzh.netlibrary.util.NetUtil;
import rx.android.schedulers.AndroidSchedulers;
import rx.Subscriber;
import rx.schedulers.Schedulers;
public class TPPresenter extends BasePresenter {
private Context context;
private TPView tpView;
private ServiceManager serviceManager;
public TPPresenter(Context context, TPView tpView){
this.context = context;
this.tpView = tpView;
this.serviceManager = new ServiceManager(context);
}
public void getInfo(){
if (NetUtil.isConnectNetwork(context)){
mCompositeSubscription.clear();
}
mCompositeSubscription.add(serviceManager.getInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<Beantest>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable throwable) {
}
@Override
public void onNext(Beantest beantest) {
tpView.onSuccess(beantest);
}
}));
}
}
| [
"duzh@wdcloud.cc"
] | duzh@wdcloud.cc |
9003464741fe131e8b4c1c797460da23bd7b5630 | d2d8a2b1bc6bd63a769f76cb5d3888033e2d8b2c | /back-end/src/main/java/com/esacco/modules/controller/StoreController.java | ce37287ef167c1ee824b1065f4acad7a663325ff | [] | no_license | FrankMwesigwa/esacco | 103559013f3d78915157b716cec82533bb1492ba | 35a1a395e336fca8505e9f7e7568b3ecf0479f67 | refs/heads/master | 2020-03-13T00:47:59.968605 | 2018-05-02T19:56:25 | 2018-05-02T19:56:25 | 130,893,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package com.esacco.modules.controller;
import com.esacco.modules.model.AppUser;
import com.esacco.modules.repository.BookRepository;
import com.esacco.modules.service.UserService;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.persistence.ManyToOne;
@CrossOrigin(origins = "http://localhost:3000", maxAge = 3600)
@RestController
public class StoreController {
@Autowired
@ManyToOne
@JsonIgnore
private BookRepository repository;
@Autowired
private UserService userService;
// Rest Api provider methods
@RequestMapping(value = "/signup", method = RequestMethod.POST)
public void saveUser(@RequestBody AppUser user) {
userService.save(user);
}
}
| [
"frank.mwesigwa1@gmail.com"
] | frank.mwesigwa1@gmail.com |
1095e796b0c4ed1a404735877869546fb465acd5 | 1bacdfb6cfedc93c1e1509e3d9064048e569b095 | /csc201/src/csc201/A5complexnumber.java | 3153d0ffa5cb5aca2b0cfaed416e64097e6f295b | [] | no_license | ShengPeng27/School-Locker | e5f46edc1935ecc5f53efed602bf1e399f3c7cab | a6ad34bfb3392273efcfaf286f8a7fe54547d326 | refs/heads/master | 2021-01-23T14:04:07.318653 | 2014-05-29T05:34:16 | 2014-05-29T05:34:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,219 | java | package csc201;
import java.util.Scanner;
public class A5complexnumber {
public static void main(String[] args) {
double a1, b1, a2, b2;
System.out.print("Please enter the real part ");
System.out.println("of the first complex number");
Scanner keyboard = new Scanner(System.in);
a1=keyboard.nextDouble();
System.out.print("Please enter the imaginary part ");
System.out.println("of the first number");
b1=keyboard.nextDouble();
System.out.print("Please enter the real part ");
System.out.println("of the second number");
a2=keyboard.nextDouble();
System.out.print("Please enter the imaginary part ");
System.out.println("of the second number");
b2=keyboard.nextDouble();
System.out.print("The addition of these two number is");
System.out.println(a1+a2+""+b1+b2+"i");
System.out.print("The subtraction of these two number is");
System.out.println((a1-a2)+""+(b1-b2)+"i");
System.out.print("The multiplication of them is ");
System.out.println((a1*a2-b1*b2)+""+(a1*b2+a2*b1)+"i");
System.out.print("The division of them is ");
System.out.print((a1*a2)+(b1*b2)/(a2*a2+b2*b2)+"");
System.out.println((b1*a2-a1*b2)/(a2*a2+b2*b2)+"i");
}
}
| [
"Sheng@192.168.2.12"
] | Sheng@192.168.2.12 |
9e66bc2231e1a44dbcb4f4c2ac16016889cbfc2f | c7b515bb1237449502eed7f88495666c67789760 | /src/main/java/ua/com/danit/entity/PasswordResetToken.java | 2b0887e608c8573865db3e89b4abff516e4b8164 | [] | no_license | AndreyStadnyk/finalProject | 9d4fe0bfce3835bd8aee77117d3420aafadaa561 | 0a9f914cb8c911439edd3345d345ed47b436c36d | refs/heads/master | 2023-01-09T21:39:39.358018 | 2020-06-28T13:10:30 | 2020-06-28T13:10:30 | 240,220,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package ua.com.danit.entity;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import java.util.Date;
@Data
@Entity
@Table(name = "pass_reset_tokens")
public class PasswordResetToken {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne(targetEntity = User.class, fetch = FetchType.EAGER)
@JoinColumn(nullable = true, name = "username")
private User user;
private String token;
private Date expiryDate;
}
| [
"noreply@github.com"
] | noreply@github.com |
04581a465f9b7eaf6b0e1207fea06189a4d7fc11 | eafe90c67bd2818340db36fbd349cb84693ed0cf | /matlib/Polynomial.java | 37d41781715f07fc4b5b253258c65efcac1868b8 | [] | no_license | vdasu/oop-assignment | e89f48de75b8f2e6f7b29c1c586d0e3a9c6e8bff | b88691d2d792ebb70b433e79575a8b143afeda7e | refs/heads/master | 2021-07-22T13:37:19.060705 | 2017-10-31T08:15:17 | 2017-10-31T08:15:17 | 108,657,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,331 | java | package matlib;
import java.util.LinkedList;
/**
*The Polynomial class stores a polynomial linked list and performs
*various functions such as add,multiply,find roots,compute,etc.
*@author Raghav Daruka
*@since 2017-10-29
*/
public class Polynomial extends Computable
{
private LinkedList<Term> poly;
/**
*Default Constructor.
*/
Polynomial()
{
poly=new LinkedList<Term>();
}
/**
*Parametrised Constructor
*@param l Takes linked list and stores it in polynomial class
*/
Polynomial(LinkedList<Term> l)
{
poly=l;
poly.sort(new Term());
}
/**
*Appends the given term to the polynomial
*@param coeff Coefficient
*@param exp Exponent
*/
public void addTerm(int coeff,int exp)
{
Term p=new Term(exp,coeff);
poly.add(p);
poly.sort(new Term());
}
/**
*Adds two given polynomials
*@param p6 Object of polynomial class
*@param p7 Object of polynomial class
*@return The sum of p6 and p7
*/
public static Polynomial addition(Polynomial p6,Polynomial p7)
{
LinkedList<Term> poly=p6.poly;
LinkedList<Term> po=p7.poly;
int i=0,j=0,s1,s2;
poly.sort(new Term());
po.sort(new Term());
s1=poly.size();
s2=po.size();
LinkedList<Term> ans=new LinkedList<Term>();
while(i<s1 && j<s2)
{
Term p3=new Term();
Term p1=poly.get(i);
Term p2=po.get(j);
if(p1.exp==p2.exp)
{
p3.exp=p1.exp;
p3.coeff=p1.coeff+p2.coeff;
ans.add(p3);
i++;j++;
}
else if(p1.exp<p2.exp)
{
p3.exp=p2.exp;
p3.coeff=p2.coeff;
ans.add(p3);
j++;
}
else if(p1.exp>p2.exp)
{
p3.exp=p1.exp;
p3.coeff=p1.coeff;
ans.add(p3);
i++;
}
}
if(i==s1)
{
while(j<s2)
{
Term p2=po.get(j);
ans.add(p2);
j++;
}
}
else if(j==s2)
{
while(i<s1)
{
Term p1=poly.get(i);
ans.add(p1);
i++;
}
}
Polynomial temp=new Polynomial(ans);
//return ans;
return temp;
}
/**
*Computes the polynomial by substituting the value
*@param x The value of x
*@return Calculated value of the polynomial
*/
public double compute(double x)
{
int s=poly.size();
float sum=0;
for(int i=0;i<s;i++) //Compute values
{
Term p3=poly.get(i);
sum+=(p3.coeff*(Math.pow(x,p3.exp)));
}
return sum;
}
/**
*Displays the polynomial stored in polynomial class
*/
public void display()
{
int s=poly.size();
for(int i=0;i<s;i++)
{
Term p=poly.get(i);
System.out.println("Exponent:"+p.exp +"\t Coefficient:"+p.coeff);
}
}
/**
*Multiplies given polnomial with the polnomial present in the class
*@param p7 Polynomial object to be multiplied.
*@return Product of this and p7
*@throws InterruptedException throws exception when thread error
*/
public Polynomial multiply(Polynomial p7) throws InterruptedException
{
LinkedList<Term> a=p7.poly;
//LinkedList<Term> fin=new LinkedList<Term>();
Polynomial fin=new Polynomial();
int s1=poly.size();
int s2=a.size();
NewThread m[]=new NewThread[s1];
for(int i=0;i<s1;i++)
m[i]=new NewThread(poly.get(i),a);
for(int i=0;i<s1;i++)
m[i].t.join();
for(int i=0;i<s1;i++)
fin=addition(fin,m[i].p7);
return fin;
}
/**
*Find all rational roots of the given polynomial
*@return Contains all the roots in array
*/
public float[] rationalRoot()
{
float arr[]=new float[1000];
float f[]=new float[100];
int a1,a2,j=0,k=0,p=0,t=0;
float sum=0;
int arrc[]=new int[1000];
int arrb[]=new int[1000];
int s=poly.size();
Term p2=poly.get(s-1);
Term p1=poly.get(0);
if(p2.exp==0)
{
for(int i=1;i<=Math.abs(p2.coeff);i++)//Find Factors for constant term
{
if(p2.coeff%i==0)
{
arrc[j++]=i;
arrc[j++]=-i;
}
}
for(int i=1;i<=Math.abs(p1.coeff);i++)//Find factors for coefficient of highest exponent
{
if(p1.coeff%i==0)
{
arrb[k++]=i;
arrb[k++]=-i;
}
}
}
for(int i=0;i<j;i++) //Calculate all possible root values
{
for(int l=0;l<k;l++)
{
arr[p++]=(float)(arrc[i])/arrb[l];
}
}
for(int i=0;i<p;i++) //Check which roots satisfy
{
sum=0;
for(int l=0;l<s;l++)
{
Term p3=poly.get(l);
sum+=(p3.coeff*(Math.pow(arr[i],p3.exp)));
}
if(sum<0.0001 && sum>-0.0001)
{
int flag=1;
for(int q=0;q<t;q++) //REmove duplicates
{
if(f[q]==arr[i])
{flag=0;break;}
}
if(flag==1)
f[t++]=arr[i];
}
}
return f; //Return array containing possible rational roots
}
/**
*Adds one polynomial to the class polynomial
*@param p7 Polynomial object
*@return The sum of this and p7
*/
public Polynomial addition(Polynomial p7)
{
LinkedList<Term> po=p7.poly;
int i=0,j=0,s1,s2;
s1=poly.size();
s2=po.size();
LinkedList<Term> ans=new LinkedList<Term>();
Term p1=null,p2=null,p3=new Term();
while(i<s1 && j<s2)
{
p3=new Term();
p1=poly.get(i);
p2=po.get(j);
if(p1.exp==p2.exp)
{
p3.exp=p1.exp;
p3.coeff=p1.coeff+p2.coeff;
ans.add(p3);
i++;j++;
}
else if(p1.exp<p2.exp)
{
p3.exp=p2.exp;
p3.coeff=p2.coeff;
ans.add(p3);
j++;
}
else if(p1.exp>p2.exp)
{
p3.exp=p1.exp;
p3.coeff=p1.coeff;
ans.add(p3);
i++;
}
}
if(i==s1)
{
while(j<s2)
{
p2=po.get(j);
ans.add(p2);
j++;
}
}
else if(j==s2)
{
while(i<s1)
{
p1=poly.get(i);
ans.add(p1);
i++;
}
}
Polynomial x1=new Polynomial(ans);
return x1;
}
/**
*Creates Threads for computing simultaneous multiplications
*/
class NewThread implements Runnable
{
Term e;
LinkedList<Term> g=new LinkedList<Term>();
LinkedList<Term> f=new LinkedList<Term>();
Polynomial p7=new Polynomial(f);
Thread t;
/**
*Parametrised Constructor
*@param e Object of class Term
*@param g Linked List containing polynomial
*/
NewThread(Term e, LinkedList<Term> g)
{
this.e=e;
this.g=g;
t=new Thread(this);
t.start();
}
public void run()
{
int s=g.size();
for(int i=0;i<s;i++)
{
Term p=g.get(i);
Term c=new Term(e.exp+p.exp,e.coeff*p.coeff);
//f.add(c);
p7.poly.add(c);
}
}
}
}
| [
"shreyanshmurarka97@gmail.com"
] | shreyanshmurarka97@gmail.com |
89153c4775b02fbf8c8bcc9eec4175663db04134 | efaa0c361e7abacc9efb8e0991c0f8f98f185f9c | /2학기/ProgramMethodlogy/PSulGISilSup/src/b/MainB2.java | 4ca7554e9317e69f3f6d9fcfacde6cab5aec3421 | [] | no_license | imscs21/myuniv | 71c0523dba940b98b09c6b7661971a9e60f2ba01 | 79e9002112ed0c1b4001fe13a8f6ee1e4761478c | refs/heads/master | 2020-04-12T02:30:39.679301 | 2016-12-25T11:58:47 | 2016-12-25T11:58:47 | 53,939,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package b;
import java.util.*;
import base.BaseMain;
public class MainB2 extends BaseMain {
public static void main(String... args){
Scanner sc = getScanner();
print("온도를 입력하세요. ");
final double input_degree=sc.nextDouble();
String kind;
print("입력하신 온도가 섭씨온도이면 C를, 화씨온도이면 F를 입력하세요. ");
kind = sc.next();
if(kind.equals("C")){
double f_degree = input_degree*1.8d+32;
System.out.println("변환된 온도는 "+f_degree+"도 입니다.");
}
else if(kind.equals("F")){
double f_degree = (input_degree-32)/1.8d;
System.out.println("변환된 온도는 "+f_degree+"도 입니다.");
}
}
}
| [
"imscs21@hanyang.ac.kr"
] | imscs21@hanyang.ac.kr |
8216b9fab17cd93a811496e520557610f48cd13b | 06454b6ec56cb3aabc8c2e76089e2469206a7836 | /app/src/androidTest/java/com/rujira/roomdatabase/ExampleInstrumentedTest.java | 55188acdd2d3727bf46e6155d0ab0987e121f74c | [] | no_license | RujiraKongsomran/RoomDatabase | 68a7bd9c5696efef5ae11c07c4c3d17c639a1c07 | 8c92acfbc6d4da01bbcf008dcc31dfd9e985af27 | refs/heads/master | 2020-12-03T02:50:46.958973 | 2020-01-01T11:05:36 | 2020-01-01T11:05:36 | 231,185,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.rujira.roomdatabase;
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.rujira.roomdatabase", appContext.getPackageName());
}
}
| [
"biwberry@outlook.com"
] | biwberry@outlook.com |
9af2f4152fd8dba84565e608d505bfc45ccb15c2 | ce5f5095ad583026e9ee88105dee1d7c75799c56 | /src/mrl_2021/world/routing/graph/GraphModule.java | 7d3af572bb78cf8a4efe91be5677e45891710816 | [
"MIT",
"BSD-3-Clause"
] | permissive | amirh-moshfeghi/MRL-Rescue-Simulation | cecd2a3dd16b070e345b33f8f77506a915c28176 | 5a3340ce9334ae3ce552edd8e05a77e903d18ea6 | refs/heads/master | 2023-08-15T21:48:14.328241 | 2021-10-15T18:04:38 | 2021-10-15T18:04:38 | 417,587,162 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,523 | java | package mrl_2021.world.routing.graph;
import adf.agent.develop.DevelopData;
import adf.agent.info.AgentInfo;
import adf.agent.info.ScenarioInfo;
import adf.agent.info.WorldInfo;
import adf.agent.module.ModuleManager;
import adf.component.module.AbstractModule;
import javolution.util.FastMap;
import mrl_2021.util.Util;
import rescuecore2.misc.Pair;
import rescuecore2.misc.geometry.Point2D;
import rescuecore2.standard.entities.*;
import rescuecore2.worldmodel.EntityID;
import java.awt.geom.Line2D;
import java.util.*;
/**
* Created by Mostafa Shabani.
* Date: Sep 22, 2010
* Time: 5:03:52 PM
*/
public class GraphModule extends AbstractModule {
private Map<EntityID, Node> nodes = new FastMap<EntityID, Node>();
private Map<EntityID, ArrayList<Node>> allAreasNodes = new FastMap<EntityID, ArrayList<Node>>();
private Map<Pair<Integer, Integer>, Node> pairNodeMap = new FastMap<Pair<Integer, Integer>, Node>();
// private Map<EntityID, MyEdge> myEdges = new FastMap<EntityID, MyEdge>();
private Map<EntityID, List<MyEdge>> allAreaMyEdges = new FastMap<EntityID, List<MyEdge>>();
private int graphSize;
int nodeIdGenerator = 0;
int edgeIdGenerator = 0;
private Collection<StandardEntity> entrances;
private Set<StandardEntity> buildings, roads, areas;
public GraphModule(AgentInfo ai, WorldInfo wi, ScenarioInfo si, ModuleManager moduleManager, DevelopData developData) {
super(ai, wi, si, moduleManager,developData);
areas = new HashSet<>(getAreasWithURN());
roads = new HashSet<>(getRoadsWithURN());
buildings = new HashSet<>(getBuildingsWithURN());
entrances = new HashSet<>();
for (StandardEntity roadEntity : roads) {
Road road = (Road) roadEntity;
for (Edge edge : road.getEdges()) {
if (edge.isPassable()) {
if (buildings.contains(worldInfo.getEntity(edge.getNeighbour()))) {
entrances.add(roadEntity);
break;
}
}
}
}
createGraph();
}
@Override
public AbstractModule calc() {
return this;
}
// public Collection<Node> getNodes() {
// return nodes.values();
// }
public Node getNode(EntityID id) {
return nodes.get(id);
}
public Node getNode(Pair<Integer, Integer> pair) {
return pairNodeMap.get(pair);
}
public Node getNode(Point2D point) {
return getNode(new Pair<Integer, Integer>((int) point.getX(), (int) point.getY()));
}
public Map<EntityID, List<MyEdge>> getAllAreaMyEdges() {
return allAreaMyEdges;
}
public MyEdge getMyEdge(EntityID areaId, Pair<Node, Node> pair) {
List<MyEdge> thisAreaMyEdges = allAreaMyEdges.get(areaId);
Pair<Node, Node> reversePair = new Pair<Node, Node>(pair.second(), pair.first());
for (MyEdge myEdge : thisAreaMyEdges) {
// if (pair.first().equals(myEdge.getNodes().first().getId()) && pair.second().equals(myEdge.getNodes().second().getId())
// || reversePair.first().equals(myEdge.getNodes().first().getId()) && reversePair.second().equals(myEdge.getNodes().second().getId())) {
if (pair.equals(myEdge.getNodes()) || reversePair.equals(myEdge.getNodes())) {
return myEdge;
}
}
throw new RuntimeException("ERROR: getMyEdge(): not found myEdge in area:" + areaId +
" nodes:<" + pair.first().getId().getValue() + ", " + pair.second().getId().getValue() + ">");
}
public List<MyEdge> getMyEdgesBetween(Area from, Area to) {
List<MyEdge> myEdgesBetween = new ArrayList<MyEdge>();
List<MyEdge> thisAreaMyEdge = getMyEdgesInArea(from.getID());
for (MyEdge myEdge : thisAreaMyEdge) {
if (!myEdgesBetween.contains(myEdge) &&
(myEdge.getNodes().first().getNeighbourAreaIds().contains(to.getID()) || myEdge.getNodes().second().getNeighbourAreaIds().contains(to.getID()))) {
myEdgesBetween.add(myEdge);
}
}
return myEdgesBetween;
}
private MyEdge getThisAreaMyEdge(Pair<Node, Node> pair, List<MyEdge> thisAreaMyEdges) {
Pair<Node, Node> reversePair = new Pair<Node, Node>(pair.second(), pair.first());
for (MyEdge myEdge : thisAreaMyEdges) {
if (pair.equals(myEdge.getNodes()) || reversePair.equals(myEdge.getNodes())) {
return myEdge;
}
}
return null;
}
public List<MyEdge> getMyEdgesInArea(EntityID areaId) {
return allAreaMyEdges.get(areaId);
}
public List<Node> getAreaNodes(EntityID areaId) {
/**
* in method tamame node haye yek area ro barmigardoone.
*/
return allAreasNodes.get(areaId);
}
public Node getNodeBetweenAreas(EntityID areaId1, EntityID areaId2, Edge edge) {
List<Node> nodes = new ArrayList<Node>(allAreasNodes.get(areaId1));
if (edge == null) {
for (Node node : nodes) {
if (node.getNeighbourAreaIds().contains(areaId2)) {
return node;
}
}
} else {
for (Node node : nodes) {
if (node.getNeighbourAreaIds().contains(areaId2) && getEdgeMiddle(edge).equals(node.getPosition())) {
return node;
}
}
}
return null;
}
private void createGraph() {
/**
* method asli baraye sakhtane graph.
* be ezaye har area edge haye passable ra gerefte va rooye harkodam yek node dorost mikonad.
*/
ArrayList<Pair<Integer, Integer>> thisAreaVertices;
for (StandardEntity entity : areas) {
Area area = (Area) entity;
thisAreaVertices = new ArrayList<Pair<Integer, Integer>>();
thisAreaVertices.addAll(findVertexes(area));
createAreNodes(area, thisAreaVertices);
}
List<Node> thisAreaNodes;
for (StandardEntity entity : areas) {
Area area = (Area) entity;
thisAreaNodes = allAreasNodes.get(entity.getID());
createAreaGraph(area, thisAreaNodes);
}
graphSize = nodes.size();
}
public Collection<StandardEntity> getAreasWithURN() {
return worldInfo.getEntitiesOfType(
StandardEntityURN.BUILDING,
StandardEntityURN.REFUGE,
StandardEntityURN.ROAD,
StandardEntityURN.AMBULANCE_CENTRE,
StandardEntityURN.POLICE_OFFICE,
StandardEntityURN.FIRE_STATION,
StandardEntityURN.HYDRANT,
StandardEntityURN.GAS_STATION);
}
public Collection<StandardEntity> getBuildingsWithURN() {
return worldInfo.getEntitiesOfType(
StandardEntityURN.BUILDING,
StandardEntityURN.REFUGE,
StandardEntityURN.AMBULANCE_CENTRE,
StandardEntityURN.POLICE_OFFICE,
StandardEntityURN.FIRE_STATION,
StandardEntityURN.GAS_STATION);
}
public Collection<StandardEntity> getRoadsWithURN() {
return worldInfo.getEntitiesOfType(
StandardEntityURN.ROAD,
StandardEntityURN.HYDRANT);
}
private ArrayList<Pair<Integer, Integer>> findVertexes(Area area) {
/**
* bedast avardane middle edge haye passable.
* created by P.D.G
*/
ArrayList<Pair<Integer, Integer>> nodes = new ArrayList<Pair<Integer, Integer>>();
Pair<Integer, Integer> edgeMiddle;
// int size = (int) (MRLConstants.AGENT_SIZE * 1.5d);
for (Edge edge : area.getEdges()) {
if (edge.isPassable() /*&& EdgeHelper.getEdgeLength(edge) >= size*/) { //todo: Mostafa merge edges
edgeMiddle = getEdgeMiddle(edge);
nodes.add(edgeMiddle);
}
}
return nodes;
}
private void createAreNodes(Area area, ArrayList<Pair<Integer, Integer>> pairs) {
ArrayList<Node> thisAreaNodes = new ArrayList<Node>();
boolean isEntrance = getEntrances().contains(area);
// create area Nodes
for (Pair<Integer, Integer> pair1 : pairs) {
Node node1 = getNode(pair1);
if (node1 == null) {
EntityID id = new EntityID(++nodeIdGenerator);
node1 = new Node(id, pair1);
nodes.put(id, node1);
pairNodeMap.put(pair1, node1);
}
//set all nodes on edges of building flag
if (isEntrance && !node1.isOnBuilding()) {
node1.setOnBuilding(true);
}
if (isOnTooSmallEdge(area, node1)) {
node1.setOnTooSmallEdge(true);
}
// add nodes neighbours
for (Pair<Integer, Integer> pair2 : pairs) {
Node node2 = getNode(pair2);
if (node2 == null) {
EntityID id = new EntityID(++nodeIdGenerator);
node2 = new Node(id, pair2);
nodes.put(id, node2);
pairNodeMap.put(pair2, node2);
}
if (isEntrance && !node2.isOnBuilding()) {
node2.setOnBuilding(true);
}
if (isOnTooSmallEdge(area, node2)) {
node2.setOnTooSmallEdge(true);
}
}
thisAreaNodes.add(node1);
node1.addNeighbourAreaIds(area.getID());
}
allAreasNodes.put(area.getID(), thisAreaNodes);
}
private boolean isOnTooSmallEdge(Area area, Node node) {
Line2D line2D;
for (Edge edge : area.getEdges()) {
if (edge.isPassable()) {
line2D = new Line2D.Double(edge.getStartX(), edge.getStartY(), edge.getEndX(), edge.getEndY());
if (Util.distance(edge.getStartX(), edge.getStartY(), edge.getEndX(), edge.getEndY()) < 600
&& line2D.contains(node.getPosition().first(), node.getPosition().second())) {
return true;
}
}
}
return false;
}
private void createAreaGraph(Area area, List<Node> nodes) {
/**
* yek area va point ha ra gerefte va ba anha baraye area node dorost mikonad.
*/
ArrayList<MyEdge> thisAreaMyEdges = new ArrayList<MyEdge>();
int weight;
// create area Nodes
for (Node node1 : nodes) {
// add nodes neighbours
for (Node node2 : nodes) {
if (!node1.equals(node2)) {
MyEdge myEdge = getThisAreaMyEdge(new Pair<Node, Node>(node1, node2), thisAreaMyEdges);
if (myEdge == null) {
EntityID edgeId = new EntityID(edgeIdGenerator++);
weight = Util.distance(node1.getPosition(), node2.getPosition());
myEdge = new MyEdge(edgeId, new Pair<Node, Node>(node1, node2), area.getID(), weight, false/*world.getHighways().isContains(area.getID())*/);
setMyEdgeNeighbours(area, myEdge);
// myEdges.put(edgeId, myEdge);
thisAreaMyEdges.add(myEdge);
//set edge weight for on building
if (node1.isOnBuilding() || node2.isOnBuilding()) {
myEdge.setEntranceEdgeWeight();
}
if (node1.isOnTooSmallEdge() || node2.isOnTooSmallEdge()) {
weight = (myEdge.getWeight() * 20);
myEdge.setWeight(weight);
}
}
node1.addNeighbourNode(node2.getId(), myEdge);
}
}
}
allAreaMyEdges.put(area.getID(), thisAreaMyEdges);
}
private void setMyEdgeNeighbours(Area area, MyEdge myEdge) {
EntityID n1 = null;
EntityID n2 = null;
for (EntityID neighbour : myEdge.getNodes().first().getNeighbourAreaIds()) {
if (neighbour.equals(area.getID()))
continue;
n1 = neighbour;
break;
}
for (EntityID neighbour : myEdge.getNodes().second().getNeighbourAreaIds()) {
if (neighbour.equals(area.getID()))
continue;
n2 = neighbour;
break;
}
myEdge.setNeighbours(n1, n2);
}
public int getGraphSize() {
return graphSize;
}
public void setHighWayStrategy() {
for (List<MyEdge> edges : allAreaMyEdges.values()) {
for (MyEdge edge : edges) {
edge.setHighWayStrategy();
}
}
}
public static int getEdgeLength(Edge edge) {
return Util.distance(edge.getStartX(), edge.getStartY(), edge.getEndX(), edge.getEndY());
}
public static Pair<Integer, Integer> getEdgeMiddle(Edge edge) {
int x = (int) ((edge.getStartX() + edge.getEndX()) / 2.0);
int y = (int) ((edge.getStartY() + edge.getEndY()) / 2.0);
return new Pair<Integer, Integer>(x, y);
}
public Collection<StandardEntity> getEntrances() {
return entrances;
}
} | [
"amirh.moshfeghi@gmail.com"
] | amirh.moshfeghi@gmail.com |
41ca870f6b1eff6ca9da881488ab7569dcf01451 | 87d141a90cd0ced61239afae60800a99f8648a81 | /src/main/java/co/luizao/corporation/service/dto/UserDTO.java | eecbc9fde9a773f9379034117ca0a57f89b7ca97 | [] | no_license | thewriterl/loremgit | 92261780ae5fb03845f5cb286c755017ed6a1130 | 53723d07c1dfcb4bcab1b2153c5222234848eebd | refs/heads/master | 2023-01-04T19:25:13.924690 | 2020-11-08T02:37:14 | 2020-11-08T02:37:14 | 310,968,697 | 0 | 0 | null | 2020-11-08T02:37:15 | 2020-11-08T02:13:29 | Java | UTF-8 | Java | false | false | 4,539 | java | package co.luizao.corporation.service.dto;
import co.luizao.corporation.config.Constants;
import co.luizao.corporation.domain.Authority;
import co.luizao.corporation.domain.User;
import java.time.Instant;
import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.constraints.*;
/**
* A DTO representing a user, with his authorities.
*/
public class UserDTO {
private Long id;
@NotBlank
@Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 50)
private String login;
@Size(max = 50)
private String firstName;
@Size(max = 50)
private String lastName;
@Email
@Size(min = 5, max = 254)
private String email;
@Size(max = 256)
private String imageUrl;
private boolean activated = false;
@Size(min = 2, max = 10)
private String langKey;
private String createdBy;
private Instant createdDate;
private String lastModifiedBy;
private Instant lastModifiedDate;
private Set<String> authorities;
public UserDTO() {
// Empty constructor needed for Jackson.
}
public UserDTO(User user) {
this.id = user.getId();
this.login = user.getLogin();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.email = user.getEmail();
this.activated = user.getActivated();
this.imageUrl = user.getImageUrl();
this.langKey = user.getLangKey();
this.createdBy = user.getCreatedBy();
this.createdDate = user.getCreatedDate();
this.lastModifiedBy = user.getLastModifiedBy();
this.lastModifiedDate = user.getLastModifiedDate();
this.authorities = user.getAuthorities().stream().map(Authority::getName).collect(Collectors.toSet());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public Set<String> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<String> authorities) {
this.authorities = authorities;
}
// prettier-ignore
@Override
public String toString() {
return "UserDTO{" +
"login='" + login + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", imageUrl='" + imageUrl + '\'' +
", activated=" + activated +
", langKey='" + langKey + '\'' +
", createdBy=" + createdBy +
", createdDate=" + createdDate +
", lastModifiedBy='" + lastModifiedBy + '\'' +
", lastModifiedDate=" + lastModifiedDate +
", authorities=" + authorities +
"}";
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
c810534cc31ae864872824bf97f0cbd394b49a73 | 63eb2ae2646d8a031bcd0e6bbe2b5a1cb33fec37 | /app/src/main/java/com/example/android/touristguide/MainActivity.java | a1f6315434f28f3c0af58894797bbb9f92d0863e | [] | no_license | amribrahimali/TouristGuide | 7c48b049d1f21c4aaef507c59ab44a98194258d4 | f96f49ec51f038761775a0eb0047f86211542987 | refs/heads/master | 2020-03-29T06:26:22.003706 | 2018-09-20T14:45:19 | 2018-09-20T14:45:19 | 149,624,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package com.example.android.touristguide;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewPager viewPager=(ViewPager) findViewById(R.id.view_pager);
SimpleFragmentPagerAdapter adapter=new
SimpleFragmentPagerAdapter(this,getSupportFragmentManager());
viewPager.setAdapter(adapter);
TabLayout tabLayout=(TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
} | [
"amribrahimgazala@gmail.com"
] | amribrahimgazala@gmail.com |
dbde5445e4a03a89520a2c036fc962b1999376af | a802e2bb728ee32eba70f0dd0c128fd75f7f4844 | /app/src/main/java/com/aserbao/aserbaosandroid/comon/BaseFragment.java | 5dd088bad8dd0b63979073b04ef4eb73b6a0fa75 | [] | no_license | dmwhw/AserbaosAndroid | ad47c1c72212a0e3b02d24ef7fdc5eae166609d3 | 8c25ebda70d5d748c3720f2a71906809bbae89ff | refs/heads/master | 2021-01-05T10:46:09.794695 | 2020-01-16T10:13:33 | 2020-01-16T10:13:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,329 | java | package com.aserbao.aserbaosandroid.comon;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.aserbao.aserbaosandroid.R;
import com.aserbao.aserbaosandroid.comon.base.adapters.BaseRecyclerViewActivityAdapter;
import com.aserbao.aserbaosandroid.comon.base.beans.BaseRecyclerBean;
import com.aserbao.aserbaosandroid.comon.base.interfaces.IBaseRecyclerItemClickListener;
import com.aserbao.aserbaosandroid.comon.commonData.ASourceUtil;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* 功能:
*
* @author aserbao
* @date : On 2019-08-19 10:57
* @project:AserbaosAndroid
* @package:com.aserbao.aserbaosandroid.comon
*/
public abstract class BaseFragment extends Fragment implements IBaseRecyclerItemClickListener {
@BindView(R.id.base_recycler_tv)
public TextView mBaseRecyclerTv;
@BindView(R.id.show_data_content_rv)
public RecyclerView mShowDataContentRv;
@BindView(R.id.base_recycler_view)
public RecyclerView mBaseRecyclerView;
@BindView(R.id.base_recycler_view_fl)
public RelativeLayout mBaseRecyclerViewFl;
@BindView(R.id.base_recycler_empty_container)
public FrameLayout mBaseRecyclerEmptyContainer;
protected Context mContext;
@BindView(R.id.base_up_tv)
TextView mBaseUpTv;
@BindView(R.id.base_down_tv)
TextView mBaseDownTv;
public LinearLayoutManager mLinearLayoutManager;
public BaseRecyclerViewActivityAdapter mCommonAdapter;
public int mOrientation = LinearLayoutManager.VERTICAL;
public List<BaseRecyclerBean> mBaseRecyclerBeen = new ArrayList<>();
public abstract void initGetData();
public void setLinearLayoutOrientationHorizontal() {
mOrientation = LinearLayoutManager.HORIZONTAL;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getContext()).inflate(R.layout.base_recyclerview_activity, container, false);
ButterKnife.bind(this,view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initGetData();
initView();
}
public void initView() {
mCommonAdapter = new BaseRecyclerViewActivityAdapter(getContext(), getActivity(), mBaseRecyclerBeen, this);
mLinearLayoutManager = new LinearLayoutManager(getContext(), mOrientation, false);
mBaseRecyclerView.setLayoutManager(mLinearLayoutManager);
mBaseRecyclerView.setAdapter(mCommonAdapter);
mBaseRecyclerViewFl.setBackgroundResource(ASourceUtil.getRandomImageId());
mBaseRecyclerView.post(new Runnable() {
@Override
public void run() {
int lastVisibleItemPosition = mLinearLayoutManager.findLastVisibleItemPosition();
if (lastVisibleItemPosition <= 8){
mBaseUpTv.setVisibility(View.GONE);
mBaseDownTv.setVisibility(View.GONE);
}else{
mBaseUpTv.setVisibility(View.VISIBLE);
mBaseDownTv.setVisibility(View.VISIBLE);
}
}
});
mBaseUpTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mLinearLayoutManager.findFirstVisibleItemPosition() == 0) return;
mBaseRecyclerView.smoothScrollToPosition(0);
}
});
mBaseDownTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mBaseRecyclerView.smoothScrollToPosition(mCommonAdapter.getItemCount()-1);
}
});
}
}
| [
"aserbao@163.com"
] | aserbao@163.com |
25a35a814262f9f1a07c2a9695e98ecb72697c20 | 9942fc333e8029ca1cca320fe5e0546674b6c9f7 | /313219672/p7/Vacas/cows/.svn/pristine/25/25a35a814262f9f1a07c2a9695e98ecb72697c20.svn-base | 80b0610181acd53577ed66536e4d6fd90cbbfd06 | [
"MIT"
] | permissive | chrigarc/cd2019-1 | 71d82aec54b14e2dd0804caf144bea1a7c9480e9 | 7f7377a84b56fd32b866932d91fe2b963a49fb76 | refs/heads/master | 2021-07-17T17:24:33.305638 | 2018-12-05T16:08:34 | 2018-12-05T16:08:34 | 144,762,976 | 4 | 51 | MIT | 2018-12-07T15:08:31 | 2018-08-14T19:21:15 | Java | UTF-8 | Java | false | false | 3,458 | package cows;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import main.Action;
import main.ActionType;
import main.Config;
import main.GlobalRandom;
import main.ICow;
import main.LocalInfo;
public class CowJorgeAscencio implements ICow{
public Color getColor() {
return new Color(255,216,216);
}
class Cell{int di,dj; Cell(int di, int dj){this.di = di; this.dj = dj;}}
public Action make_turn(LocalInfo li) {
//Determine free cells
List<Cell> freeCells = new ArrayList<Cell>();
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++){
if(li.nc[i][j] != null && li.nc[i][j].cowID == null){
freeCells.add(new Cell(i,j));
}
}
//can't move, can't breed, so try to eat until the end...
if(li.grassEaten > (1.2)*Config.grassToBreed && !freeCells.isEmpty()){
Cell freeCell = freeCells.get(GlobalRandom.getInstance().rand.nextInt(freeCells.size()));
if(li.nc[2][2] != null && li.nc[2][2].grass > 0 && li.nc[2][2].cowID == null)
return new Action(ActionType.BREED,1,1);
if(li.nc[0][0] != null && li.nc[0][0].grass > 0 && li.nc[0][0].cowID == null)
return new Action(ActionType.BREED,-1,-1);
if(li.nc[0][2] != null && li.nc[0][2].grass > 0 && li.nc[0][2].cowID == null)
return new Action(ActionType.BREED,-1,1);
if(li.nc[1][2] != null && li.nc[1][2].grass > 0 && li.nc[1][2].cowID == null)
return new Action(ActionType.BREED,0,1);
if(li.nc[2][1] != null && li.nc[2][1].grass > 0 && li.nc[2][1].cowID == null)
return new Action(ActionType.BREED,1,0);
if(li.nc[0][1] != null && li.nc[0][1].grass > 0 && li.nc[0][1].cowID == null)
return new Action(ActionType.BREED,-1,0);
return new Action(ActionType.BREED,freeCell.di,freeCell.dj);
}
if(li.nc[1][1].grass > 0)
return new Action(ActionType.EAT,0,0);
if(li.nc[0][2] != null && li.nc[0][2].grass > 0 && li.nc[0][2].cowID == null)
return new Action(ActionType.MOVE,-1,1);
if(li.nc[2][2] != null && li.nc[2][2].grass > 0 && li.nc[2][2].cowID == null)
return new Action(ActionType.MOVE,1,1);
if(li.nc[0][0] != null && li.nc[0][0].grass > 0 && li.nc[0][0].cowID == null)
return new Action(ActionType.MOVE,-1,-1);
if(li.nc[0][1] != null && li.nc[0][1].grass > 0 && li.nc[0][1].cowID == null)
return new Action(ActionType.MOVE,-1,0);
if(li.nc[2][1] != null && li.nc[2][1].grass > 0 && li.nc[2][1].cowID == null)
return new Action(ActionType.MOVE,1,0);
if(li.nc[2][0] != null && li.nc[2][0].grass > 0 && li.nc[2][0].cowID == null)
return new Action(ActionType.MOVE,1,-1);
return new Action(ActionType.MOVE,0,-1);
}
public Integer getSTUDENTid() {
return 309043511;
}
public String getName() {
return "Yorche";
}
public ICow clone(){
return new CowJorgeAscencio();
}
public boolean skipPopulation() {
return false;
}
}
| [
"fercho@ciencias.unam.mx"
] | fercho@ciencias.unam.mx | |
81a0bcc3b8b11ecb76a68194a57abe9dee3905c7 | 0539e781068154288a0fd7de6f437327aa8efcad | /icm-budget/icm-budget-rest-api/src/main/java/org/shenzhijian/controller/budget/ProjectBudgetController.java | 04f95102687f0eedb3108fbdc8e15d8eecb66357 | [] | no_license | shenzhijiangit/ICMServer | b47cc13cb4c72d9fba8beb4839fdde87b5c890be | 20c55013a5c74d6f263829ca7f77903e043ad3b8 | refs/heads/master | 2022-11-29T02:56:40.436762 | 2020-04-01T07:08:26 | 2020-04-01T07:08:28 | 251,308,038 | 0 | 0 | null | 2022-11-16T08:59:13 | 2020-03-30T13:09:17 | Java | UTF-8 | Java | false | false | 4,208 | java | package org.shenzhijian.controller.budget;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.shenzhijian.persistence.budget.entity.ProjectBudget;
import org.shenzhijian.service.budget.ProjectBudgetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
@Api(tags = {"预算编制"})
@RestController
@RequestMapping("/api/icm-budget/projectBudget")
public class ProjectBudgetController {
private static final String DATA_TYPE = "项目支出预算";
private final ProjectBudgetService projectBudgetService;
@Autowired
public ProjectBudgetController(ProjectBudgetService projectBudgetService) {
this.projectBudgetService = projectBudgetService;
}
// @ApiOperation(value = "分页查询项目支出预算信息")
// @GetMapping(value = "")
// public PageDataDTO<ProjectBudgetDTO> findOnePage(
// @ApiParam(value = "页号,从0开始", required = true, defaultValue = "0") @RequestParam("page") @Min(0) int page,
// @ApiParam(value = "每页纪录条数", required = true, defaultValue = "20") @RequestParam("size") @Min(1) @Max(100) int size,
// @ApiParam(value = "排序字段, 例如:字段1,asc,字段2,desc") @RequestParam(value = "sort", required = false, defaultValue = "id,desc") String sort,
// @ApiParam(value = "申报部门") @RequestParam(value = "departmentId", required = false) String departmentId,
// @ApiParam(value = "项目名称") @RequestParam(value = "projectName", required = false) String projectName,
// @ApiParam(value = "项目类别") @RequestParam(value = "projectType", required = false) String projectType,
// @ApiParam(value = "项目类别明细") @RequestParam(value = "detailedProjectType", required = false) String detailedProjectType,
// @ApiParam(value = "查询类型:全部/已审核/待审核", required = true) @RequestParam(value = "queryType") StateType stateType,
// @ApiParam(value = "项目编码, 模糊查询") @RequestParam(value = "projectCode", required = false) String projectCode
// ) {
// return projectBudgetService.findOnePage(page, size, sort, departmentId, projectName, projectType, detailedProjectType, stateType, projectCode);
// }
@ApiOperation(value = "根据ID查询项目支出预算")
@GetMapping(value = "{id}")
public ProjectBudget findById(
@ApiParam(value = "支出预算Id", required = true) @PathVariable(name = "id") String id
) throws IOException {
return projectBudgetService.findById(id);
}
@ApiOperation(value = "新建项目支出预算")
@PostMapping(value = "")
public ProjectBudget create(
@ApiParam(value = "项目支出预算编辑信息", required = true) @RequestBody @Validated ProjectBudget projectBudgetCreateInfo
) throws IOException {
return projectBudgetService.create(projectBudgetCreateInfo);
}
@ApiOperation(value = "提交项目支出预算")
@PutMapping(value = "/{id}")
public ProjectBudget complete(
@ApiParam(value = "支出预算Id", required = true) @PathVariable(name = "id") String id,
@ApiParam(value = "项目支出预算编辑信息", required = true) @RequestBody @Validated ProjectBudget projectBudgetEditInfo
) throws IOException {
return projectBudgetService.complete(id, projectBudgetEditInfo);
}
@ApiOperation(value = "查询审批完未批复的编制")
@GetMapping(value = "/all")
public List<ProjectBudget> findAll(@ApiParam(value = "状态") @RequestParam(value = "state", required = false) String state) {
return null;
}
@ApiOperation(value = "删除项目支出预算")
@DeleteMapping(value = "/{id}")
public void delete(
@ApiParam(value = "支出预算Id", required = true) @PathVariable(name = "id") String id
) throws IOException {
projectBudgetService.delete(id);
}
} | [
"780974941@qq.com"
] | 780974941@qq.com |
ba7918ffdc5347a72286261c9f48f775e0cf8cac | 68be4dbcc07f4f5556ba35e1c86a643808b9cf1a | /src/main/java/za/co/dladle/model/Contact.java | dd83b9f9f309d0535f87421bfe8a8e00336c602c | [] | no_license | pradyumnaswain/dladle-rest | 228c6cf2c271f6b4c0636b98f22402b92d8b31f7 | 258afac4f34e2fc7b3e7a9d9a4641f5179fa5435 | refs/heads/master | 2020-03-30T11:48:55.034210 | 2018-10-02T03:33:02 | 2018-10-02T03:33:02 | 151,194,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package za.co.dladle.model;
/**
* Created by prady on 6/4/2017.
*/
public class Contact {
private ContactType contactType;
private String name;
private String address;
private String contactNumber;
public Contact() {
}
public ContactType getContactType() {
return contactType;
}
public void setContactType(ContactType contactType) {
this.contactType = contactType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
}
| [
"pradyumnaswain76@gmail.com"
] | pradyumnaswain76@gmail.com |
851d463f8b327ee74b453a2f2015b5de13f2d8e1 | 4db8374ecbfa4e75eb3270681d5b59f9f56a145e | /datagridservice/src/main/java/com/rdas/grid/util/HzScheduler.java | 188c6517b7136267195a80060832a07324948b10 | [] | no_license | ranadas/sb-search | d420471358c1bf72d20772e5def938af4396166b | a05eab05e15cc41bf6906cb0085d969188731cd0 | refs/heads/master | 2020-04-25T00:51:17.010789 | 2019-04-16T06:28:01 | 2019-04-16T06:28:01 | 172,391,072 | 0 | 0 | null | 2019-03-12T07:23:01 | 2019-02-24T21:14:00 | Java | UTF-8 | Java | false | false | 1,911 | java | package com.rdas.grid.util;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.scheduledexecutor.IScheduledExecutorService;
import com.hazelcast.scheduledexecutor.IScheduledFuture;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.Serializable;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import static com.hazelcast.scheduledexecutor.impl.NamedTaskDecorator.named;
//https://stackoverflow.com/questions/49274273/running-a-cron-job-on-hazelcast-durableexecutorservice/49274504
//https://octoperf.com/blog/2018/06/12/spring-boot-hazelcast-tutorial/
//https://github.com/javanotes/ticker/blob/master/src/main/java/org/reactivetechnologies/ticker/scheduler/DistributedScheduledTask.java
public class HzScheduler {
@PostConstruct
public void init() throws ExecutionException, InterruptedException {
HazelcastInstance instance = Hazelcast.newHazelcastInstance();
IScheduledExecutorService scheduler = instance.getScheduledExecutorService("scheduler");
IScheduledFuture<String> future = scheduler.schedule(named("MyTask", new EchoTask("foobar")), 5, TimeUnit.SECONDS);
Object result = future.get();
System.out.println(future.getHandler().getTaskName() + " result: " + result);
future.dispose();
//Hazelcast.shutdownAll();
}
//https://github.com/hazelcast/hazelcast-code-samples/blob/master/distributed-executor/scheduling-named-task/src/main/java/MasterMember.java
public class EchoTask implements Callable<String>, Serializable {
private final String msg;
public EchoTask(String msg) {
this.msg = msg;
}
@Override
public String call() throws Exception {
return msg;
}
}
}
| [
"rana.pratap.das@gmail.com"
] | rana.pratap.das@gmail.com |
b7e00b79ffc676a8c625d47d99d16601137c3642 | d4d51e7faadd39ca77979835f6281685e221f28d | /common-lang/src/main/java/com/github/cpfniliu/common/ext/bean/DoubleBean.java | 50b1f6d8990fed699153102e3829639801b6ea91 | [] | no_license | cpfree/my-artifact | 0b6eb30803c2544b8d8c8771f13b3db4218c62bb | ef2f0893d249748c3948796773004aceccc3cf81 | refs/heads/master | 2023-07-30T14:15:50.307554 | 2020-09-20T06:25:29 | 2020-09-20T06:25:29 | 267,820,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.github.cpfniliu.common.ext.bean;
/**
* <b>Description : </b>
*
* @author CPF
* Date: 2020/7/9 18:29
*/
public class DoubleBean<O1, O2> {
public static <O, T> DoubleBean<O, T> of(O o, T t) {
return new DoubleBean<>(o, t);
}
private O1 o1;
private O2 two;
private DoubleBean(O1 o, O2 t) {
this.o1 = o;
this.two = t;
}
public O1 getO1() {
return o1;
}
public void setO1(O1 o1) {
this.o1 = o1;
}
public O2 getTwo() {
return two;
}
public void setTwo(O2 two) {
this.two = two;
}
}
| [
"2484661388@qq.com"
] | 2484661388@qq.com |
1d52d9cda035a4d84a24fcc38a0febb8fa2d4089 | c50b8d6f3465e84adb60aeb07912642013d0c59c | /src/main/java/com/mindBowser/exception/ResourceNotFoundException.java | dca5644a4f7a25c11101ab482ed8199e61624dcb | [
"Apache-2.0"
] | permissive | krishnarathi333/DemoRestApi | d9bf89332041d5124c69c38092ef67892e4d2131 | 7f1b7404372fde713bd863bd8dc094bcbc175553 | refs/heads/master | 2022-11-15T07:00:50.589109 | 2020-07-12T07:50:53 | 2020-07-12T07:50:53 | 279,017,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java |
package com.mindBowser.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {
/**
* Instantiates a new Resource not found exception.
*
* @param message the message
*/
public ResourceNotFoundException(String message) {
super(message);
}
}
| [
"krishnarathi333@gmail.com"
] | krishnarathi333@gmail.com |
c80981a7f7f812c74394c7a149433f51ae707481 | 17dcd86d1482f5793b71614aeca273f1c22aa3c3 | /AdminCloudModel/src/java/saludtec/admincloud/ejb/entidades/Facturas.java | ead18c3d41b6017ea948177409fdfbd9eef39818 | [] | no_license | Saintecco/AdminCloudEJB | a8b241dcaa166daa3e8ae9ec470d3a1ccd184d7d | a7768ced19171ca8d0891bee6730b6b75e8c1975 | refs/heads/master | 2018-12-29T02:59:48.556198 | 2014-11-13T19:51:40 | 2014-11-13T19:51:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,043 | 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 saludtec.admincloud.ejb.entidades;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author saintec
*/
@Entity
@Table(name = "facturas")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Facturas.findAll", query = "SELECT f FROM Facturas f"),
@NamedQuery(name = "Facturas.findByIdFactura", query = "SELECT f FROM Facturas f WHERE f.idFactura = :idFactura"),
@NamedQuery(name = "Facturas.findByNumeroFactura", query = "SELECT f FROM Facturas f WHERE f.numeroFactura = :numeroFactura"),
@NamedQuery(name = "Facturas.findByNombrePaciente", query = "SELECT f FROM Facturas f WHERE f.nombrePaciente = :nombrePaciente"),
@NamedQuery(name = "Facturas.findByApellidoPaciente", query = "SELECT f FROM Facturas f WHERE f.apellidoPaciente = :apellidoPaciente"),
@NamedQuery(name = "Facturas.findByTipoDeDocumento", query = "SELECT f FROM Facturas f WHERE f.tipoDeDocumento = :tipoDeDocumento"),
@NamedQuery(name = "Facturas.findByNumeroDeDocumento", query = "SELECT f FROM Facturas f WHERE f.numeroDeDocumento = :numeroDeDocumento"),
@NamedQuery(name = "Facturas.findByRazonSocialClinica", query = "SELECT f FROM Facturas f WHERE f.razonSocialClinica = :razonSocialClinica"),
@NamedQuery(name = "Facturas.findByNitClinica", query = "SELECT f FROM Facturas f WHERE f.nitClinica = :nitClinica"),
@NamedQuery(name = "Facturas.findByTipoRegimenClinica", query = "SELECT f FROM Facturas f WHERE f.tipoRegimenClinica = :tipoRegimenClinica"),
@NamedQuery(name = "Facturas.findByDireccionClinica", query = "SELECT f FROM Facturas f WHERE f.direccionClinica = :direccionClinica"),
@NamedQuery(name = "Facturas.findByTelefonoClinica", query = "SELECT f FROM Facturas f WHERE f.telefonoClinica = :telefonoClinica"),
@NamedQuery(name = "Facturas.findByFaxClinica", query = "SELECT f FROM Facturas f WHERE f.faxClinica = :faxClinica"),
@NamedQuery(name = "Facturas.findByEmailClinica", query = "SELECT f FROM Facturas f WHERE f.emailClinica = :emailClinica"),
@NamedQuery(name = "Facturas.findByFecha", query = "SELECT f FROM Facturas f WHERE f.fecha = :fecha"),
@NamedQuery(name = "Facturas.findByHora", query = "SELECT f FROM Facturas f WHERE f.hora = :hora"),
@NamedQuery(name = "Facturas.findByEstado", query = "SELECT f FROM Facturas f WHERE f.estado = :estado")})
public class Facturas implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id_factura")
private Integer idFactura;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "numero_factura")
private String numeroFactura;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "nombre_paciente")
private String nombrePaciente;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "apellido_paciente")
private String apellidoPaciente;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "tipo_de_documento")
private String tipoDeDocumento;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "numero_de_documento")
private String numeroDeDocumento;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 200)
@Column(name = "razon_social_clinica")
private String razonSocialClinica;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "nit_clinica")
private String nitClinica;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "tipo_regimen_clinica")
private String tipoRegimenClinica;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "direccion_clinica")
private String direccionClinica;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "telefono_clinica")
private String telefonoClinica;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "fax_clinica")
private String faxClinica;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "email_clinica")
private String emailClinica;
@Basic(optional = false)
@NotNull
@Lob
@Size(min = 1, max = 2147483647)
@Column(name = "otros_clinica")
private String otrosClinica;
@Basic(optional = false)
@NotNull
@Column(name = "fecha")
@Temporal(TemporalType.DATE)
private Date fecha;
@Basic(optional = false)
@NotNull
@Column(name = "hora")
@Temporal(TemporalType.TIME)
private Date hora;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "estado")
private String estado;
@JoinColumn(name = "id_clinica", referencedColumnName = "id_clinica")
@ManyToOne(optional = false, fetch = FetchType.LAZY)
private Clinicas idClinica;
@JoinColumn(name = "id_paciente", referencedColumnName = "id_paciente")
@ManyToOne(optional = false, fetch = FetchType.LAZY)
private Pacientes idPaciente;
@OneToMany(mappedBy = "idFactura", fetch = FetchType.LAZY)
private List<DescripcionFacturas> descripcionFacturasList;
public Facturas() {
}
public Facturas(Integer idFactura) {
this.idFactura = idFactura;
}
public Facturas(Integer idFactura, String numeroFactura, String nombrePaciente, String apellidoPaciente, String tipoDeDocumento, String numeroDeDocumento, String razonSocialClinica, String nitClinica, String tipoRegimenClinica, String direccionClinica, String telefonoClinica, String faxClinica, String emailClinica, String otrosClinica, Date fecha, Date hora, String estado) {
this.idFactura = idFactura;
this.numeroFactura = numeroFactura;
this.nombrePaciente = nombrePaciente;
this.apellidoPaciente = apellidoPaciente;
this.tipoDeDocumento = tipoDeDocumento;
this.numeroDeDocumento = numeroDeDocumento;
this.razonSocialClinica = razonSocialClinica;
this.nitClinica = nitClinica;
this.tipoRegimenClinica = tipoRegimenClinica;
this.direccionClinica = direccionClinica;
this.telefonoClinica = telefonoClinica;
this.faxClinica = faxClinica;
this.emailClinica = emailClinica;
this.otrosClinica = otrosClinica;
this.fecha = fecha;
this.hora = hora;
this.estado = estado;
}
public Integer getIdFactura() {
return idFactura;
}
public void setIdFactura(Integer idFactura) {
this.idFactura = idFactura;
}
public String getNumeroFactura() {
return numeroFactura;
}
public void setNumeroFactura(String numeroFactura) {
this.numeroFactura = numeroFactura;
}
public String getNombrePaciente() {
return nombrePaciente;
}
public void setNombrePaciente(String nombrePaciente) {
this.nombrePaciente = nombrePaciente;
}
public String getApellidoPaciente() {
return apellidoPaciente;
}
public void setApellidoPaciente(String apellidoPaciente) {
this.apellidoPaciente = apellidoPaciente;
}
public String getTipoDeDocumento() {
return tipoDeDocumento;
}
public void setTipoDeDocumento(String tipoDeDocumento) {
this.tipoDeDocumento = tipoDeDocumento;
}
public String getNumeroDeDocumento() {
return numeroDeDocumento;
}
public void setNumeroDeDocumento(String numeroDeDocumento) {
this.numeroDeDocumento = numeroDeDocumento;
}
public String getRazonSocialClinica() {
return razonSocialClinica;
}
public void setRazonSocialClinica(String razonSocialClinica) {
this.razonSocialClinica = razonSocialClinica;
}
public String getNitClinica() {
return nitClinica;
}
public void setNitClinica(String nitClinica) {
this.nitClinica = nitClinica;
}
public String getTipoRegimenClinica() {
return tipoRegimenClinica;
}
public void setTipoRegimenClinica(String tipoRegimenClinica) {
this.tipoRegimenClinica = tipoRegimenClinica;
}
public String getDireccionClinica() {
return direccionClinica;
}
public void setDireccionClinica(String direccionClinica) {
this.direccionClinica = direccionClinica;
}
public String getTelefonoClinica() {
return telefonoClinica;
}
public void setTelefonoClinica(String telefonoClinica) {
this.telefonoClinica = telefonoClinica;
}
public String getFaxClinica() {
return faxClinica;
}
public void setFaxClinica(String faxClinica) {
this.faxClinica = faxClinica;
}
public String getEmailClinica() {
return emailClinica;
}
public void setEmailClinica(String emailClinica) {
this.emailClinica = emailClinica;
}
public String getOtrosClinica() {
return otrosClinica;
}
public void setOtrosClinica(String otrosClinica) {
this.otrosClinica = otrosClinica;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public Date getHora() {
return hora;
}
public void setHora(Date hora) {
this.hora = hora;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public Clinicas getIdClinica() {
return idClinica;
}
public void setIdClinica(Clinicas idClinica) {
this.idClinica = idClinica;
}
public Pacientes getIdPaciente() {
return idPaciente;
}
public void setIdPaciente(Pacientes idPaciente) {
this.idPaciente = idPaciente;
}
@XmlTransient
public List<DescripcionFacturas> getDescripcionFacturasList() {
return descripcionFacturasList;
}
public void setDescripcionFacturasList(List<DescripcionFacturas> descripcionFacturasList) {
this.descripcionFacturasList = descripcionFacturasList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idFactura != null ? idFactura.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Facturas)) {
return false;
}
Facturas other = (Facturas) object;
if ((this.idFactura == null && other.idFactura != null) || (this.idFactura != null && !this.idFactura.equals(other.idFactura))) {
return false;
}
return true;
}
@Override
public String toString() {
return "saludtec.admincloud.ejb.entidades.Facturas[ idFactura=" + idFactura + " ]";
}
}
| [
"saintec@saintec-pc"
] | saintec@saintec-pc |
856d99d19ebc04e63c7020963d6cb58c991d6bbb | b83910d792f01bc6aa459c2a719ba852a3b84f24 | /LevelCode/Program01/day05/src/homework/Test2/Test01/Father.java | af4bdfb4614ad108dcc59163aabc5790d9b77d6c | [] | no_license | lanrenke/Java | 8ed83cc76bb1076cbcf3172a029a9e8fd95fd9c6 | f5263b7a6ca9d91f1c2780b8cefa28463a9ec744 | refs/heads/master | 2020-05-02T13:04:56.698438 | 2019-04-20T13:40:07 | 2019-04-20T13:40:07 | 177,974,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package homework.Test2.Test01;
/*
2.定义用于测试的父类Father
a)提供一个吃(eat)的成员方法,抛出牙疼异常
i.输出吃到一个石子
ii.抛出一个牙疼的异常
b)提供一个喝(drink)的成员方法不抛出异常
i.输出: 喝什么都没有问题
*/
public class Father {
// a)提供一个吃(eat)的成员方法,抛出牙疼异常
public void eat() throws ToothPainException {
// i.输出吃到一个石子
System.out.println("吃到一个石头子");
// ii.抛出一个牙疼的异常
throw new ToothPainException();
}
// b)提供一个喝(drink)的成员方法不抛出异常
public void drink() {
// i.输出: 喝什么都没有问题
System.out.println("喝什么都没有问题");
}
} | [
"noreply@github.com"
] | noreply@github.com |
f81cc501a595a01ba49c66dd56bb40bc6fc202e2 | 5e12d56989c6a7419147d43abc53e9ba71db44de | /src/main/java/com/example/service/UserService.java | 9ad51f95c7c313aff6b2e63a162190d210fe8989 | [] | no_license | Vlad-NZR/calendar_of_exhibitions | bd8a85ca551f26c8b24d7308d42a0e5b6f509efc | bc9fb2a5465a27531d9395b09e61ee547a8a9595 | refs/heads/master | 2021-03-19T00:47:28.419076 | 2020-03-13T16:43:16 | 2020-03-13T16:43:16 | 247,115,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 952 | java | package com.example.service;
import com.example.domain.User;
import com.example.service.UserDetailsImpl;
import com.example.repos.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class UserService implements UserDetailsService {
@Autowired
private UserRepository userRepository;
@Override
public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException {
Optional<User> user = userRepository.findByLogin(login);
user.orElseThrow(() -> new UsernameNotFoundException(login + " not found."));
return user.map(UserDetailsImpl::new).get();
}
}
| [
"52040177+Vlad-NZR@users.noreply.github.com"
] | 52040177+Vlad-NZR@users.noreply.github.com |
858b6d758c67a7d92c8184484aeb10e3fb0ef1d3 | 0922a149ac4ac39a1303e6eb97a3494186463fb5 | /quant-platform-data-service-common/src/test/java/quant/platform/data/service/common/utils/TimeHelpersTest.java | 95eb295ed87783b19efe0f622fe64567f8f8abee | [] | no_license | sunjianbo945/quant_java | 572aed848415c8f98f69c481a4d13af5d6666ae3 | ca2400d3bd0ed9cf15a08a5a427f7db17191adf8 | refs/heads/main | 2023-08-05T15:53:49.094823 | 2021-09-14T23:03:02 | 2021-09-14T23:03:02 | 406,545,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,107 | java | package quant.platform.data.service.common.utils;
import org.junit.Test;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import static junit.framework.TestCase.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
public class TimeHelpersTest {
@Test
public void testToGMT(){
TimeHelpers t = new TimeHelpers();
String formatter ="yyyy-MM-dd'T'HH:mm:ss'Z'";
t.setFormatter(formatter);
//Tuesday, April 3, 2018 12:53:45 AM
long l = 1522716825;
String result = t.convertLongToGMTDateString(l*1000L);
String specificGMTTimezoneStr = t.convertLongToSpecificTimezoneTimeDateString(l*1000L, "GMT");
assertEquals(result,"2018-04-03T00:53:45Z");
assertEquals(specificGMTTimezoneStr,"2018-04-03T00:53:45Z");
}
@Test
public void testToLocalTime(){
TimeHelpers t = new TimeHelpers();
String formater ="yyyy-MM-dd HH:mm:ss";
t.setFormatter(formater);
//Monday, April 2, 2018 8:53:45 PM GMT-04:00 DST
long l = 1522716825;
String result = t.convertLongToLocalTimeDateString(l*1000L);
//Only test get local in NYC time
if(TimeZone.getDefault().getDisplayName().equals(TimeZone.getTimeZone("America/New_York").getDisplayName())) {
assertEquals(result, "2018-04-02 20:53:45");
}
}
@Test
public void testNoFormatter(){
TimeHelpers t = new TimeHelpers();
//Monday, April 2, 2018 8:53:45 PM GMT-04:00 DST
long l = 1522716825;
String result = t.convertLongToLocalTimeDateString(l*1000L);
assertEquals(result,"2018-04-02");
}
@Test
public void testNextTime(){
TimeHelpers t = new TimeHelpers();
String formater ="yyyy-MM-dd'T'HH:mm:ss'Z'";
t.setFormatter(formater);
String date = "2018-04-02";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
Date time = t.nextTime(sdf.parse(date), Calendar.HOUR,1);
String result = t.convertLongToGMTDateString(time.getTime());
assertEquals(result,"2018-04-02T01:00:00Z");
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void testTrimDateTimeToHourLong(){
//Wednesday, April 18, 2018 4:59:59.999 AM
long time = 1524027599999L;
String right = "2018-04-18T04:00:00Z";
String next = "2018-04-18T05:00:00Z";
// 1524024000000
TimeHelpers th = TimeHelpers.getUTCTimeConverter();
long ret = TimeHelpers.floorDateTimeToHourLong(time);
assertTrue(right.equals(th.convertLongToGMTDateString(ret)));
//Wednesday, April 18, 2018 4:00:00.001 AM
time = 1524024000001L;
ret = TimeHelpers.floorDateTimeToHourLong(time);
assertTrue(right.equals(th.convertLongToGMTDateString(ret)));
//Wednesday, April 18, 2018 4:00:00 AM
time = 1524024000000L;
ret = TimeHelpers.floorDateTimeToHourLong(time);
assertTrue(right.equals(th.convertLongToGMTDateString(ret)));
time = 1524027600000L;
ret = TimeHelpers.floorDateTimeToHourLong(time);
System.out.println(th.convertLongToGMTDateString(ret));
assertTrue(next.equals(th.convertLongToGMTDateString(ret)));
}
@Test
public void testTrimDateTimeToMinLong() {
long time = 1518220814789L;
long ret = TimeHelpers.floorMillsecLongToMinLong(time);
TimeHelpers th = TimeHelpers.getUTCTimeConverter();
System.out.println(th.convertLongToGMTDateString(time));
String str = "2018-02-10T00:00:00Z";
System.out.println(th.convertLongToGMTDateString(ret));
assertTrue(str.equals(th.convertLongToGMTDateString(ret)));
}
}
| [
"js7995@nyu.edu"
] | js7995@nyu.edu |
488238729448d97c0d0c89b7a13b65194a7f7d0c | 7405a9e527c8a16d5580b8db3654654472347671 | /src/contrib/raid/src/java/org/apache/hadoop/raid/Codec.java | 6bd68cc8cf2f115893f3f1ae2da5caf928033f4f | [
"Apache-2.0"
] | permissive | rhli/hadoop-rstair | e5f1b5037f56d132e2a4240bc0a8039e3deb30de | f16254580e5f11d0ee7a7bc6b106c7b4385f2774 | refs/heads/master | 2020-04-09T07:34:55.356736 | 2015-09-10T14:08:49 | 2015-09-10T14:08:49 | 42,175,363 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,899 | 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.hadoop.raid;
import java.io.IOException;
import java.io.Serializable;
import java.lang.IllegalArgumentException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.ReflectionUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* A class with the information of a raid codec.
* A raid codec has the information of
* 1. Which ErasureCode used
* 2. Stripe and parity length
* 3. Parity directory location
* 4. Codec priority
*/
public class Codec implements Serializable {
public static final Log LOG = LogFactory.getLog(Codec.class);
public static final String ERASURE_CODE_KEY_PREFIX = "hdfs.raid.erasure.code.";
/**
* Used by ErasureCode.init() to get Code specific extra parameters.
*/
public final String jsonStr;
/**
* id of the codec. Used by policy in raid.xml
*/
public final String id;
/**
* Number of blocks in one stripe
*/
public final int stripeLength;
/**
* Number of parity blocks of the codec for one stripe
*/
public final int parityLength;
/**
* The full class name of the ErasureCode used
*/
public final String erasureCodeClass;
/**
* Human readable description of the codec
*/
public final String description;
/**
* Where to store the parity files
*/
public final String parityDirectory;
public String parityDirectoryPS;
/**
* Where to store the temp parity files
*/
public final String tmpParityDirectory;
public String tmpParityDirectoryPS;
/**
* Where to store the temp har files
*/
public final String tmpHarDirectory;
public String tmpHarDirectoryPS;
/**
* Simulate the block fix or not
*/
public boolean simulateBlockFix;
/**
* Priority of the codec.
*
* Purge parity files:
* When parity files of two Codecs exists, the parity files of the lower
* priority codec will be purged.
*
* Generating parity files:
* When a source files are under two policies, the policy with a higher
* codec priority will be triggered.
*/
public final int priority;
/**
* Is file-level raiding or directory-level raiding
*/
public boolean isDirRaid;
private static List<Codec> codecs;
private static Map<String, Codec> idToCodec;
/**
* Get single instantce of the list of codecs ordered by priority.
*/
public static List<Codec> getCodecs() {
return Codec.codecs;
}
/**
* Get the instance of the codec by id
*/
public static Codec getCodec(String id) {
return idToCodec.get(id);
}
static {
try {
Configuration.addDefaultResource("hdfs-default.xml");
Configuration.addDefaultResource("raid-default.xml");
Configuration.addDefaultResource("hdfs-site.xml");
Configuration.addDefaultResource("raid-site.xml");
initializeCodecs(new Configuration());
} catch (Exception e) {
LOG.fatal("Fail initialize Raid codecs", e);
System.exit(-1);
}
}
public static void initializeCodecs(Configuration conf) throws IOException {
try {
String source = conf.get("raid.codecs.json");
if (source == null) {
codecs = Collections.emptyList();
idToCodec = Collections.emptyMap();
if (LOG.isDebugEnabled()) {
LOG.debug("None Codec is specified");
}
return;
}
JSONArray jsonArray = new JSONArray(source);
List<Codec> localCodecs = new ArrayList<Codec>();
Map<String, Codec> localIdToCodec = new HashMap<String, Codec>();
for (int i = 0; i < jsonArray.length(); ++i) {
Codec codec = new Codec(jsonArray.getJSONObject(i));
localIdToCodec.put(codec.id, codec);
localCodecs.add(codec);
}
Collections.sort(localCodecs, new Comparator<Codec>() {
@Override
public int compare(Codec c1, Codec c2) {
// Higher priority on top
return c2.priority - c1.priority;
}
});
codecs = Collections.unmodifiableList(localCodecs);
idToCodec = Collections.unmodifiableMap(localIdToCodec);
} catch (JSONException e) {
throw new IOException(e);
}
}
private Codec(JSONObject json) throws JSONException {
this.jsonStr = json.toString();
this.id = json.getString("id");
this.parityLength = json.getInt("parity_length");
this.stripeLength = json.getInt("stripe_length");
this.erasureCodeClass = json.getString("erasure_code");
this.parityDirectory = json.getString("parity_dir");
this.priority = json.getInt("priority");
this.description = getJSONString(json, "description", "");
this.isDirRaid = Boolean.parseBoolean(getJSONString(json, "dir_raid", "false"));
this.tmpParityDirectory = getJSONString(
json, "tmp_parity_dir", "/tmp" + this.parityDirectory);
this.tmpHarDirectory = getJSONString(
json, "tmp_har_dir", "/tmp" + this.parityDirectory + "_har");
this.simulateBlockFix = json.getBoolean("simulate_block_fix");
checkDirectory(parityDirectory);
checkDirectory(tmpParityDirectory);
checkDirectory(tmpHarDirectory);
setPathSeparatorDirectories();
}
/**
* Make sure the direcotry string has the format "/a/b/c"
*/
private void checkDirectory(String d) {
if (!d.startsWith(Path.SEPARATOR)) {
throw new IllegalArgumentException("Bad directory:" + d);
}
if (d.endsWith(Path.SEPARATOR)) {
throw new IllegalArgumentException("Bad directory:" + d);
}
}
static private String getJSONString(
JSONObject json, String key, String defaultResult) {
String result = defaultResult;
try {
result = json.getString(key);
} catch (JSONException e) {
}
return result;
}
public ErasureCode createErasureCode(Configuration conf) {
// Create the scheduler
Class<?> erasureCode = null;
try {
erasureCode = conf.getClass(ERASURE_CODE_KEY_PREFIX + this.id,
conf.getClassByName(this.erasureCodeClass));
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
ErasureCode code;
/* fixed by RH Dec 12th begins */
//LOG.info("code class id:" + this.id);
if (this.id.equals("stair")) {
//if (this.erasureCodeClass.equals("stair")) {
/* fixed by RH Dec 12th ends */
StairCode stairCode = (StairCode) ReflectionUtils.newInstance(erasureCode, conf);
stairCode.init(this.stripeLength, this.parityLength, this.jsonStr);
code = stairCode;
} else {
code = (ErasureCode) ReflectionUtils.newInstance(erasureCode, conf);
code.init(this.stripeLength, this.parityLength);
}
return code;
}
@Override
public String toString() {
if (jsonStr == null) {
return "Test codec " + id;
} else {
return jsonStr;
}
}
public String getParityPrefix() {
String prefix = this.parityDirectory;
if (!prefix.endsWith(Path.SEPARATOR)) {
prefix += Path.SEPARATOR;
}
return prefix;
}
/**
* Used by unit test only
*/
static void addCodec(Codec codec) {
List<Codec> newCodecs = new ArrayList<Codec>();
newCodecs.addAll(codecs);
newCodecs.add(codec);
codecs = Collections.unmodifiableList(newCodecs);
Map<String, Codec> newIdToCodec = new HashMap<String, Codec>();
newIdToCodec.putAll(idToCodec);
newIdToCodec.put(codec.id, codec);
idToCodec = Collections.unmodifiableMap(newIdToCodec);
}
/**
* Used by unit test only
*/
static void clearCodecs() {
codecs = Collections.emptyList();
idToCodec = Collections.emptyMap();
}
/**
* Used by unit test only
*/
Codec(String id,
int parityLength,
int stripeLength,
String erasureCodeClass,
String parityDirectory,
int priority,
String description,
String tmpParityDirectory,
String tmpHarDirectory,
boolean isDirRaid,
boolean simulateBlockFix) {
this.jsonStr = null;
this.id = id;
this.parityLength = parityLength;
this.stripeLength = stripeLength;
this.erasureCodeClass = erasureCodeClass;
this.parityDirectory = parityDirectory;
this.priority = priority;
this.description = description;
this.tmpParityDirectory = tmpParityDirectory;
this.tmpHarDirectory = tmpHarDirectory;
this.isDirRaid = isDirRaid;
this.simulateBlockFix = simulateBlockFix;
setPathSeparatorDirectories();
}
private void setPathSeparatorDirectories() {
parityDirectoryPS = parityDirectory + Path.SEPARATOR;
tmpParityDirectoryPS = tmpParityDirectory + Path.SEPARATOR;
tmpHarDirectoryPS = tmpHarDirectory + Path.SEPARATOR;
}
}
| [
"lrhdiy@gmail.com"
] | lrhdiy@gmail.com |
a9cc4ca22acacaf28de68372289b03b23af67730 | 8662345e04b2e6e47fcc07b96306741a1a9567fd | /src/main/java/resources/util/HttpHeaderHelper.java | caf81f4fbb12e170f31bacf2fcf44baba1a423da | [] | no_license | antalalexandru/FreelancingPlatform-resources_server | e42e718eba15ff700e6b944370af450dc2533cb0 | b670020e79404c39660ca566c2f10a4262bebe3e | refs/heads/master | 2020-09-12T20:17:31.449727 | 2020-02-06T07:38:20 | 2020-02-06T07:38:20 | 222,541,355 | 0 | 0 | null | 2020-02-02T16:23:21 | 2019-11-18T20:46:16 | Java | UTF-8 | Java | false | false | 699 | java | package resources.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
@Component
public class HttpHeaderHelper {
@Value("${authorizationServer.clientId:clientIdPassword}")
private String clientId;
@Value("${authorizationServer.clientSecret:secret}")
private String clientSecret;
public HttpHeaders getLoginHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.setBasicAuth(clientId, clientSecret);
return headers;
}
}
| [
"dragos.nicolae.stefanescu@gmail.com"
] | dragos.nicolae.stefanescu@gmail.com |
be8bf7659a924efcf35c2ffa3ff016e25b1b5a67 | 973a8e4bbf906b70007ef049a0ee294071ed45ab | /vendors-api/src/main/java/com/flipkartshop/vendorsapi/bids/BidRepository.java | e37c8b4f1dd20df2631acd5d3f1ddf743f4ada8d | [] | no_license | ankit-kumar-iitbhu/flipkart-shop | d1ba196a6a5a1797d49e29e7276ba5038df72bd8 | 8bd4aa42445b44e0a675605150ad22e19da2dfa0 | refs/heads/master | 2022-07-27T00:18:35.609389 | 2020-05-20T15:22:55 | 2020-05-20T15:22:55 | 265,173,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.flipkartshop.vendorsapi.bids;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface BidRepository extends MongoRepository<Bid,Integer>{
List<Bid> findByVendorVid(Integer vid);
List<Bid> findByProductId(Integer pid);
}
| [
"ankit.kumar.btech21@gmail.com"
] | ankit.kumar.btech21@gmail.com |
c0ad32c4aa18b13acef8159e0cdd1ddac8aab404 | 26f4c3f1bc0a28aa756ad0f99c7096676789475a | /oauth-server/server/src/main/java/com/harbois/oauth/server/api/v1/common/RestResponse.java | f9b9eac2c5e05d11df159866cbad81818d193c05 | [] | no_license | singhjoga/devoat | 4a8fb1f0e4fb37c7204626c6a720da8ff2d6ad85 | 1b47a09e572e04e13916635fe76215047dbf4031 | refs/heads/main | 2023-07-20T14:24:17.546799 | 2021-09-07T15:20:19 | 2021-09-07T15:20:19 | 334,115,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,390 | java | package com.harbois.oauth.server.api.v1.common;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
* Common REST Response
* @author JogaSingh
*
*/
@JsonInclude(Include.NON_NULL)
public class RestResponse {
private Object result;
private WarningDetail warningDetail;
private ErrorDetail<?> errorDetail;
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
public WarningDetail getWarningDetail() {
return warningDetail;
}
public void setWarningDetail(WarningDetail warningDetail) {
this.warningDetail = warningDetail;
}
public ErrorDetail<?> getErrorDetail() {
return errorDetail;
}
public void setErrorDetail(ErrorDetail<?> errorDetail) {
this.errorDetail = errorDetail;
}
public boolean hasErrors() {
return this.errorDetail != null;
}
public boolean hasWarnings() {
return this.warningDetail != null;
}
@SuppressWarnings("unchecked")
public <T> T resultAs(Class<T> clz) {
return (T)result;
}
@SuppressWarnings("unchecked")
public <T> List<T> resultAsList(Class<T> clz) {
return (List<T>)result;
}
public static class WarningDetail extends MessageDetail{
private List<Warning> warnings;
public WarningDetail() {
super(null,null);
}
public WarningDetail(String message, Set<String> warningList) {
super(message, null);
if (warningList != null && !warningList.isEmpty()) {
warnings = new ArrayList<RestResponse.Warning>();
for (String warnMsg: warningList) {
warnings.add(new Warning(warnMsg,null));
}
}
}
public List<Warning> getWarnings() {
return warnings;
}
public void setWarnings(List<Warning> warnings) {
this.warnings = warnings;
}
}
public static abstract class ErrorDetail<T extends Error> extends MessageDetail{
private List<T> errors;
public ErrorDetail() {
this(null, null,null);
}
public ErrorDetail(String message, String code, List<T> errors) {
super(message, code);
this.errors = errors;
}
public List<T> getErrors() {
return errors;
}
public void setErrors(List<T> errors) {
this.errors = errors;
}
}
public static class ValidationErrorDetail extends ErrorDetail<ValidationError> {
public ValidationErrorDetail() {
super();
}
public ValidationErrorDetail(String message, String code, List<ValidationError> errors) {
super(message, code, errors);
}
}
public static class GeneralErrorDetail extends ErrorDetail<Error>{
public GeneralErrorDetail() {
super();
}
public GeneralErrorDetail(String message, String code, List<Error> errors) {
super(message, code, errors);
}
}
public static class Warning extends MessageDetail{
public Warning() {
this(null, null);
}
public Warning(String message, String code) {
super(message, code);
}
}
public static class ValidationError extends Error{
private String field;
public ValidationError() {
super(null, null);
}
public ValidationError(String field, String message, String code) {
super(message, code);
this.field=field;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
}
public static class Error extends MessageDetail{
public Error() {
this(null,null);
}
public Error(String message, String code) {
super(message, code);
}
}
public static class MessageDetail {
private String message;
private String code;
public MessageDetail(String message, String code) {
super();
this.message = message;
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
public static class AddResult {
private String id;
private String location;
public AddResult() {
}
public AddResult(String id, String location) {
this.id = id;
this.location = location;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
}
}
| [
"joga.singh-extern@deutschebahn.com"
] | joga.singh-extern@deutschebahn.com |
a43419ad6faf90e3676f2d2d7cf12917dbb4ce63 | f2777908a639d077ae9be38ada9aceb7fc59b31f | /src/main/java/com/hongmeng/gcgyy/service/industryService/DeclareApplyService.java | 04d66ab159f920ecd74cc45abdb7cc776953be9b | [] | no_license | freedomx04/ncgyy2 | 637fe8ff8c9d6d0fe31a3231d2b8218229d79ac2 | 45442b91c096fed6518a8ee391c38b7a4b2dceed | refs/heads/master | 2021-01-25T08:07:11.379359 | 2017-06-08T06:37:51 | 2017-06-08T06:37:51 | 93,715,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package com.hongmeng.gcgyy.service.industryService;
import java.util.List;
import com.hongmeng.gcgyy.entity.industryService.DeclareApplyEntity;
public interface DeclareApplyService {
DeclareApplyEntity findOne(Long declareApplyId);
DeclareApplyEntity findOne(Long declareId, Long enterpriseId);
void save(DeclareApplyEntity declareApply);
void update(DeclareApplyEntity declareApply, String description, String attachName, String attachPath);
void delete(List<Long> declareApplyIds);
List<DeclareApplyEntity> list(Long enterpriseId);
List<DeclareApplyEntity> list(Long enterpriseId, int page, int size);
}
| [
"freedomx04@163.com"
] | freedomx04@163.com |
cf6b8805bb48dd2746d418a699b301cc20d608ee | 51cb04a6078b42372baa773cab1b26128007c24a | /src/coderetreatsession5/Board.java | 65e337d38eef45147dfecfc3eabc05c95c1d2c49 | [] | no_license | Geruhn/gdrc | 5c4527d18eb1d516a3607cc6a6c06385edd33d3d | 917103a929e7a7d93875d0db900a28901c84289c | refs/heads/master | 2016-09-16T04:35:01.446292 | 2013-12-14T21:20:52 | 2013-12-14T21:20:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,456 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package coderetreatsession5;
/**
*
* @author andy
*/
public class Board {
Cell[][] field;
public Board(int sizeX, int sizeY) {
this.field = new Cell[sizeX][sizeY];
initializeField();
}
public void nextGeneration() {
Cell[][] newGeneration = this.field.clone();
for(int x = 0; x < this.field.length; x++) {
newGeneration = newGenerationForLine(x, newGeneration);
}
}
public int getLivingCellsAt(int x, int y, int neighbours) {
for(int testX = x - 1; testX <= x + 1; testX++) {
neighbours += getLivingCellsInRow(testX, y, neighbours);
}
return neighbours;
}
public int getLivingCellsInRow(int x, int y, int neighbours) {
for(int testY = y - 1; testY <= y + 1; testY++) {
neighbours += this.field[x][y].toInt();
}
return neighbours;
}
private void initializeField() {
for(int x = 0; x < this.field.length; x++) {
initializeRow(x);
}
}
private void initializeRow(int x) {
for(int y = 0; y < this.field[x].length; y++) {
this.field[x][y] = new DeadCell();
}
}
public void revive(int x, int y) {
this.field[x][y] = new LivingCell();
}
private Cell[][] newGenerationForLine(int x, Cell[][] newGeneration) {
for(int y = this.field[x].length; y >= 0; y++) {
// newGeneration[x][y] = ;
}
return newGeneration;
}
}
| [
"geruhn@hotmail.com"
] | geruhn@hotmail.com |
92a6315488e0de7c77246b00af08b2db93987258 | ec7e184408cd4960f8c590fff84bf0d99c237b0a | /ASSIGNMENT9_JAVA_MULTITHREADING/Question9.java | 8368a2f1b00e47b1f974df3b9dd6d16d146b6d2d | [] | no_license | pooja-ttn/Assignment2 | 60c6ab2a46b7f9be582d9c1be8eaecf25711036b | 753b7776c81e56b9a87c341ffec1b5b7f2fd01fc | refs/heads/master | 2020-04-21T06:17:59.243863 | 2019-03-31T17:16:20 | 2019-03-31T17:16:20 | 169,362,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/*
Q9) Increase concurrency with Thread pools using newCachedThreadPool() and newFixedThreadPool().
*/
class Process implements Runnable{
int id;
public Process(int id) {
this.id = id;
}
@Override
public void run() {
System.out.println("Thread name::"+Thread.currentThread().getName()+" Start :"+id);
try {
Thread.sleep(2000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Thread name::"+Thread.currentThread().getName()+" End :"+id);
}
}
public class Question9 {
public static void main(String[] args) {
// ExecutorService executorService= Executors.newFixedThreadPool(4);
ExecutorService executorService= Executors.newCachedThreadPool();
for (int i = 0; i <= 4; i++) {
executorService.submit(new Process(i));
}
executorService.shutdown();
}
}
| [
"pooja.joshi@tothenew.com"
] | pooja.joshi@tothenew.com |
1a95c96ec1d602a365370b9c5114e71dc10408bd | af9603dea9fd263219cae71c6d7cff5828cbe77b | /src/main/java/net/floodlightcontroller/randomizer/Randomizer.java | 4df0b9318b27c08840371cad9f0e536de0a67dfb | [
"Apache-2.0"
] | permissive | geddings/EAGERFloodlight | c793ba8d17f5936585805677f5d22e7e295efcc3 | ba40046db0e40e5cbdf13c46c70f466ca3670152 | refs/heads/master | 2022-05-25T20:20:28.705990 | 2017-02-10T14:48:59 | 2017-02-10T14:48:59 | 67,057,666 | 0 | 0 | Apache-2.0 | 2022-04-22T07:23:03 | 2016-08-31T17:10:32 | Java | UTF-8 | Java | false | false | 18,621 | java | package net.floodlightcontroller.randomizer;
import ch.qos.logback.classic.Level;
import net.floodlightcontroller.core.*;
import net.floodlightcontroller.core.internal.IOFSwitchService;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.devicemanager.IDeviceService;
import net.floodlightcontroller.forwarding.Forwarding;
import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.packet.ARP;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.IPv4;
import net.floodlightcontroller.randomizer.web.RandomizerWebRoutable;
import net.floodlightcontroller.restserver.IRestApiService;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.match.MatchField;
import org.projectfloodlight.openflow.types.*;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.stream.Collectors;
import static org.quartz.DateBuilder.evenMinuteDateAfterNow;
import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
import static org.quartz.TriggerBuilder.newTrigger;
/**
* Created by geddingsbarrineau on 7/14/16.
* <p>
* This is the Randomizer Floodlight module.
*/
public class Randomizer implements IOFMessageListener, IOFSwitchListener, IFloodlightModule, IRandomizerService {
//================================================================================
//region Properties
private ScheduledExecutorService executorService;
private IFloodlightProviderService floodlightProvider;
private IRestApiService restApiService;
protected static IOFSwitchService switchService;
private static Logger log;
private static List<Connection> connections;
private static ServerManager serverManager;
private static boolean enabled;
private static boolean randomize;
private static OFPort lanport;
private static OFPort wanport;
private static int addressUpdateInterval;
private static int prefixUpdateInterval;
//endregion
//================================================================================
//================================================================================
//region Helper Functions
private void scheduleJobs() {
SchedulerFactory schedulerFactory = new org.quartz.impl.StdSchedulerFactory();
Scheduler scheduler = null;
try {
scheduler = schedulerFactory.getScheduler();
} catch (SchedulerException e) {
e.printStackTrace();
}
Trigger prefixtrigger = newTrigger()
.withIdentity("trigger8") // because group is not specified, "trigger8" will be in the default group
.startAt(evenMinuteDateAfterNow()) // get the next even-minute (seconds zero ("**:00"))
.withSchedule(simpleSchedule()
.withIntervalInSeconds(prefixUpdateInterval)
.repeatForever())
// note that in this example, 'forJob(..)' is not called
// - which is valid if the trigger is passed to the scheduler along with the job
.build();
JobDetail prefixjob = JobBuilder.newJob(PrefixUpdateJob.class)
.withIdentity("Prefix Update")
.build();
Trigger addresstrigger = newTrigger()
.withIdentity("trigger9") // because group is not specified, "trigger8" will be in the default group
.startAt(evenMinuteDateAfterNow()) // get the next even-minute (seconds zero ("**:00"))
.withSchedule(simpleSchedule()
.withIntervalInSeconds(addressUpdateInterval)
.repeatForever())
// note that in this example, 'forJob(..)' is not called
// - which is valid if the trigger is passed to the scheduler along with the job
.build();
JobDetail addressjob = JobBuilder.newJob(AddressUpdateJob.class)
.withIdentity("Address Update")
.build();
try {
if (scheduler != null) {
scheduler.scheduleJob(prefixjob, prefixtrigger);
scheduler.scheduleJob(addressjob, addresstrigger);
scheduler.start();
}
} catch (SchedulerException e) {
e.printStackTrace();
}
}
public static class AddressUpdateJob implements Job {
Logger log = LoggerFactory.getLogger(AddressUpdateJob.class);
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.debug("Updating IP addresses for each server. Flows will be updated as well.");
serverManager.updateServers();
connections.forEach(Connection::update);
}
}
public static class PrefixUpdateJob implements Job {
Logger log = LoggerFactory.getLogger(PrefixUpdateJob.class);
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.debug("Updating prefixes for each server.");
serverManager.getServers().forEach(Server::updatePrefix);
}
}
//endregion
//================================================================================
//================================================================================
//region IRandomizerService Implementation
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public RandomizerReturnCode enable() {
log.warn("Enabling Randomizer");
enabled = true;
return RandomizerReturnCode.ENABLED;
}
@Override
public RandomizerReturnCode disable() {
log.warn("Disabling Randomizer");
enabled = false;
return RandomizerReturnCode.DISABLED;
}
@Override
public boolean isRandom() {
return randomize;
}
@Override
public RandomizerReturnCode setRandom(Boolean random) {
randomize = random;
FlowFactory.setRandomize(randomize);
log.warn("Set randomize to {}", random);
return RandomizerReturnCode.CONFIG_SET;
}
@Override
public OFPort getLanPort() {
return lanport;
}
@Override
public RandomizerReturnCode setLanPort(int portnumber) {
lanport = OFPort.of(portnumber);
FlowFactory.setLanport(lanport);
log.warn("Set lanport to {}", portnumber);
return RandomizerReturnCode.CONFIG_SET;
}
@Override
public OFPort getWanPort() {
return wanport;
}
@Override
public RandomizerReturnCode setWanPort(int portnumber) {
wanport = OFPort.of(portnumber);
FlowFactory.setWanport(wanport);
log.warn("Set wanport to {}", portnumber);
return RandomizerReturnCode.CONFIG_SET;
}
@Override
public Server getServer(IPv4Address serveraddress) {
return serverManager.getServer(serveraddress);
}
@Override
public List<Server> getServers() {
return serverManager.getServers();
}
@Override
public RandomizerReturnCode addServer(Server server) {
// Todo Make this portion more robust by adding more checks as needed
serverManager.addServer(server);
return RandomizerReturnCode.SERVER_ADDED;
}
@Override
public RandomizerReturnCode removeServer(Server server) {
// Todo Make this portion more robust by adding more checks as needed
serverManager.removeServer(server);
return RandomizerReturnCode.SERVER_REMOVED;
}
@Override
public List<Connection> getConnections() {
return connections;
}
@Override
public RandomizerReturnCode addConnection(Connection connection) {
connections.add(connection);
return RandomizerReturnCode.CONNECTION_ADDED;
}
@Override
public RandomizerReturnCode removeConnection(Connection connection) {
connections.remove(connection);
return RandomizerReturnCode.CONNECTION_REMOVED;
}
@Override
public Map<IPv4Address, IPv4AddressWithMask> getCurrentPrefix() {
return serverManager.getServers().stream()
.collect(Collectors.toMap(Server::getiPv4AddressReal, Server::getPrefix));
}
public Map<IPv4Address, List<IPv4AddressWithMask>> getPrefixes() {
return serverManager.getServers().stream()
.collect(Collectors.toMap(Server::getiPv4AddressReal, Server::getPrefixes));
}
@Override
public void addPrefix(Server server, IPv4AddressWithMask prefix) {
if (!serverManager.getServer(server.getiPv4AddressReal()).getPrefixes().contains(prefix)) {
// TODO: This can be simplified a ton.
serverManager.getServer(server.getiPv4AddressReal()).addPrefix(prefix);
}
}
@Override
public void removePrefix(Server server, IPv4AddressWithMask prefix) {
if (serverManager.getServer(server.getiPv4AddressReal()).getPrefixes().contains(prefix)) {
// TODO: This can also be simplified a lot.
serverManager.getServer(server.getiPv4AddressReal()).removePrefix(prefix);
}
}
//endregion
//================================================================================
//================================================================================
//region IOFMessageListener Implementation
@Override
public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
/*
* If we're disabled, then just stop now
* and let Forwarding/Hub handle the connection.
*/
if (!enabled) {
log.trace("Randomizer disabled. Not acting on packet; passing to next module.");
return Command.CONTINUE;
} else {
/*
* Randomizer is enabled; proceed
*/
log.trace("Randomizer enabled. Inspecting packet to see if it's a candidate for randomization.");
}
OFPacketIn pi = (OFPacketIn) msg;
OFPort inPort = (pi.getVersion().compareTo(OFVersion.OF_12) < 0 ? pi.getInPort() : pi.getMatch().get(MatchField.IN_PORT));
Ethernet l2 = IFloodlightProviderService.bcStore.get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
Server server;
if (l2.getEtherType() == EthType.IPv4) {
IPv4 l3 = (IPv4) l2.getPayload();
/* Packet is coming from client to the servers fake IP on the randomized side*/
if ((server = serverManager.getServerThatContainsIP(l3.getDestinationAddress())) != null) {
log.debug("IPv4 packet destined for a randomized server's external prefix found: {}", server);
}
/* Packet is coming from the non-randomized client side (probably initiation) */
else if ((server = serverManager.getServer(l3.getDestinationAddress())) != null) {
log.debug("IPv4 packet destined for a randomized server's internal IP found: {}", server);
}
/* Packet is unrelated to any randomized server connection */
else {
log.debug("IPv4 packet not destined for a randomized server. Continuing...");
return Command.CONTINUE;
}
for (Connection c : connections) {
if (c.getServer().equals(server)) {
log.error("ERROR! Received packet that belongs to an existing connection...");
return Command.STOP;
}
}
log.info("New EAGER connection created...");
connections.add(new Connection(server, sw.getId()));
return Command.STOP;
} else if (l2.getEtherType() == EthType.ARP) {
ARP arp = (ARP) l2.getPayload();
if ((server = serverManager.getServerFromFakeIP(arp.getTargetProtocolAddress())) != null) {
log.debug("ARP packet destined for a randomized server's external prefix found: {}", server);
}
else if((server = serverManager.getServer(arp.getTargetProtocolAddress())) != null) {
log.debug("ARP packet destined for a randomized server's internal IP found: {}", server);
}
else {
log.trace("ARP packet not destined for a randomized server. Continuing...");
return Command.CONTINUE;
}
for (Connection c : connections) {
if (c.getServer().equals(server)) {
log.error("ERROR! Received packet that belongs to an existing connection...");
return Command.STOP;
}
}
log.info("New EAGER connection created...");
connections.add(new Connection(server, sw.getId()));
}
return Command.CONTINUE;
}
@Override
public String getName() {
return Randomizer.class.getSimpleName();
}
@Override
public boolean isCallbackOrderingPrereq(OFType type, String name) {
return false;
}
@Override
public boolean isCallbackOrderingPostreq(OFType type, String name) {
if (type.equals(OFType.PACKET_IN) && (name.equals("forwarding"))) {
log.trace("Randomizer is telling Forwarding to run later.");
return true;
} else {
return false;
}
}
//endregion
//================================================================================
//================================================================================
//region IFloodlightModule Implementation
@Override
public Collection<Class<? extends IFloodlightService>> getModuleServices() {
Collection<Class<? extends IFloodlightService>> s = new HashSet<>();
s.add(IRandomizerService.class);
return s;
}
@Override
public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
Map<Class<? extends IFloodlightService>, IFloodlightService> m = new HashMap<>();
m.put(IRandomizerService.class, this);
return m;
}
@Override
public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
Collection<Class<? extends IFloodlightService>> l = new ArrayList<>();
l.add(IDeviceService.class);
l.add(IFloodlightProviderService.class);
l.add(IOFSwitchService.class);
return l;
}
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
executorService = Executors.newScheduledThreadPool(2);
floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
restApiService = context.getServiceImpl(IRestApiService.class);
switchService = context.getServiceImpl(IOFSwitchService.class);
log = LoggerFactory.getLogger(Randomizer.class);
/* For testing only: Set log levels of other classes */
((ch.qos.logback.classic.Logger) log).setLevel(Level.DEBUG);
((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Forwarding.class)).setLevel(Level.ERROR);
((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(LinkDiscoveryManager.class)).setLevel(Level.ERROR);
connections = new ArrayList<Connection>();
serverManager = new ServerManager();
/* Add prefixes here */
//prefixes.add(IPv4AddressWithMask.of("184.164.243.0/24"));
/* Add servers here */
serverManager.addServer(new Server(IPv4Address.of(10, 0, 0, 1)));
serverManager.addServer(new Server(IPv4Address.of(20, 0, 0, 1)));
}
@Override
public void startUp(FloodlightModuleContext context) throws FloodlightModuleException {
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
switchService.addOFSwitchListener(this);
restApiService.addRestletRoutable(new RandomizerWebRoutable());
Map<String, String> configOptions = context.getConfigParams(this);
try {
/* These are defaults */
enabled = Boolean.parseBoolean(configOptions.get("enabled"));
randomize = Boolean.parseBoolean(configOptions.get("randomize"));
lanport = OFPort.of(Integer.parseInt(configOptions.get("lanport")));
wanport = OFPort.of(Integer.parseInt(configOptions.get("wanport")));
addressUpdateInterval = Integer.parseInt(configOptions.get("addressUpdateIntervalInSeconds"));
prefixUpdateInterval = Integer.parseInt(configOptions.get("prefixUpdateIntervalInSeconds"));
} catch (IllegalArgumentException | NullPointerException ex) {
log.error("Incorrect Randomizer configuration options. Required: 'enabled', 'randomize', 'lanport', 'wanport'", ex);
throw ex;
}
if (log.isInfoEnabled()) {
log.info("Initial config options: enabled:{}, randomize:{}, lanport:{}, wanport:{}",
new Object[]{enabled, randomize, lanport, wanport});
}
FlowFactory.setRandomize(randomize);
FlowFactory.setWanport(wanport);
FlowFactory.setLanport(lanport);
//updatePrefixes();
//updateIPs();
scheduleJobs();
}
//endregion
//================================================================================
//================================================================================
//region IOFSwitchListener Implementation
@Override
public void switchAdded(DatapathId switchId) {
}
@Override
public void switchRemoved(DatapathId switchId) {
}
@Override
public void switchActivated(DatapathId switchId) {
}
@Override
public void switchPortChanged(DatapathId switchId, OFPortDesc port, PortChangeType type) {
}
@Override
public void switchChanged(DatapathId switchId) {
}
@Override
public void switchDeactivated(DatapathId switchId) {
}
//endregion
//================================================================================
}
| [
"cbarrin@g.clemson.edu"
] | cbarrin@g.clemson.edu |
c6cabb81fcad75c0a52b55390ba7e93010ddfc03 | 0012c948046df1d23808e18ce78c1a510d8f9272 | /CORTO2_POO2_JoseMulato/src/main/java/com/sv/udb/modelo/Roles.java | ed54230e356221005f89094e4be2803b65b613fd | [] | no_license | JoseMulato1/CORTO2_POO2_JoseMulato | 7bf8d0b2a4306b08fd744878a52b60113720d1af | 8fec15d3a0ccccbb7f04b716406067838dbbbf97 | refs/heads/master | 2021-01-24T08:08:39.030212 | 2016-10-07T04:42:32 | 2016-10-07T04:42:32 | 70,197,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,486 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sv.udb.modelo;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author joseph
*/
@Entity
@Table(name = "roles", catalog = "parcial01_poo2_josemulato", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Roles.findAll", query = "SELECT r FROM Roles r"),
@NamedQuery(name = "Roles.findByCodiRole", query = "SELECT r FROM Roles r WHERE r.codiRole = :codiRole"),
@NamedQuery(name = "Roles.findByDescRole", query = "SELECT r FROM Roles r WHERE r.descRole = :descRole"),
@NamedQuery(name = "Roles.findByDireRole", query = "SELECT r FROM Roles r WHERE r.direRole = :direRole"),
@NamedQuery(name = "Roles.findByEstaRole", query = "SELECT r FROM Roles r WHERE r.estaRole = :estaRole"),
@NamedQuery(name = "Roles.findByFechAltaRole", query = "SELECT r FROM Roles r WHERE r.fechAltaRole = :fechAltaRole"),
@NamedQuery(name = "Roles.findByFechBajaRole", query = "SELECT r FROM Roles r WHERE r.fechBajaRole = :fechBajaRole")})
public class Roles implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "codi_role")
private Integer codiRole;
@Size(max = 250)
@Column(name = "desc_role")
private String descRole;
@Size(max = 250)
@Column(name = "dire_role")
private String direRole;
@Column(name = "esta_role")
private Integer estaRole;
@Column(name = "fech_alta_role")
@Temporal(TemporalType.DATE)
private Date fechAltaRole;
@Column(name = "fech_baja_role")
@Temporal(TemporalType.DATE)
private Date fechBajaRole;
@OneToMany(mappedBy = "refeRole", fetch = FetchType.LAZY)
private List<Roles> rolesList;
@JoinColumn(name = "refe_role", referencedColumnName = "codi_role")
@ManyToOne(fetch = FetchType.LAZY)
private Roles refeRole;
@OneToMany(mappedBy = "codiRole", fetch = FetchType.LAZY)
private List<UsuariosRoles> usuariosRolesList;
public Roles() {
}
public Roles(Integer codiRole) {
this.codiRole = codiRole;
}
public Integer getCodiRole() {
return codiRole;
}
public void setCodiRole(Integer codiRole) {
this.codiRole = codiRole;
}
public String getDescRole() {
return descRole;
}
public void setDescRole(String descRole) {
this.descRole = descRole;
}
public String getDireRole() {
return direRole;
}
public void setDireRole(String direRole) {
this.direRole = direRole;
}
public Integer getEstaRole() {
return estaRole;
}
public void setEstaRole(Integer estaRole) {
this.estaRole = estaRole;
}
public Date getFechAltaRole() {
return fechAltaRole;
}
public void setFechAltaRole(Date fechAltaRole) {
this.fechAltaRole = fechAltaRole;
}
public Date getFechBajaRole() {
return fechBajaRole;
}
public void setFechBajaRole(Date fechBajaRole) {
this.fechBajaRole = fechBajaRole;
}
@XmlTransient
public List<Roles> getRolesList() {
return rolesList;
}
public void setRolesList(List<Roles> rolesList) {
this.rolesList = rolesList;
}
public Roles getRefeRole() {
return refeRole;
}
public void setRefeRole(Roles refeRole) {
this.refeRole = refeRole;
}
@XmlTransient
public List<UsuariosRoles> getUsuariosRolesList() {
return usuariosRolesList;
}
public void setUsuariosRolesList(List<UsuariosRoles> usuariosRolesList) {
this.usuariosRolesList = usuariosRolesList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (codiRole != null ? codiRole.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Roles)) {
return false;
}
Roles other = (Roles) object;
if ((this.codiRole == null && other.codiRole != null) || (this.codiRole != null && !this.codiRole.equals(other.codiRole))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.sv.udb.modelo.Roles[ codiRole=" + codiRole + " ]";
}
}
| [
"joseph@JoseMulato.lan"
] | joseph@JoseMulato.lan |
6acf2cd13064fe51c5a2da6d90692f6f17f5d187 | 0eefbbe53381e0e8bc0e08292c34562e61bfe804 | /comments/app/src/main/java/com/warriorminds/comments/domain/RedditResponse.java | d11aa997f12363ced3132675fa61d85470e94251 | [] | no_license | warriorminds/reddit-and-other-things | b3582e3050a0f9bc734a9b7c36382bce244e326a | e2cd38a73f46df7f732216976edd14f1227be150 | refs/heads/master | 2020-07-31T14:11:03.280651 | 2019-09-24T14:54:08 | 2019-09-24T14:54:08 | 210,629,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.warriorminds.comments.domain;
public class RedditResponse {
private String kind;
private RedditData data;
public String getKind() {
return kind;
}
public RedditData getData() {
return data;
}
public void setKind(String kind) {
this.kind = kind;
}
public void setData(RedditData data) {
this.data = data;
}
}
| [
"rodrigo.x.guerero.-nd@disney.com"
] | rodrigo.x.guerero.-nd@disney.com |
12c2382f0a191292d172069de5f5d216e090591b | ee63c628c8da3f20631f13fd19b54cbc962a37b0 | /app/src/main/java/bibi/com/newsmvp/mvp/view/iml/MvpActivity.java | 6a93853fef2d7be759ea3ab513b9d29317e35cbd | [] | no_license | zhangyalong123feiyu/NewsMvp | 9bc1ede7b41df8fd5da34afac44c8029911de964 | 4078243cd75fbe12dfc066aa91305deb3ab06e1c | refs/heads/master | 2021-01-19T05:00:04.564505 | 2017-04-08T02:12:10 | 2017-04-08T02:12:10 | 87,406,590 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package bibi.com.newsmvp.mvp.view.iml;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import bibi.com.newsmvp.mvp.presenter.iml.MvpBasePresenter;
import bibi.com.newsmvp.mvp.view.MvpView;
/**
* Created by bibinet on 2016-12-27.
*/
public abstract class MvpActivity<P extends MvpBasePresenter> extends AppCompatActivity implements MvpView {
private P presenter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
presenter = bindpresenter();
if (presenter != null) {
presenter.attchview(this);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (presenter != null) {
presenter.deattchview();
}
}
public abstract P bindpresenter();
}
| [
"409812937@qq.com"
] | 409812937@qq.com |
21c87ebfb84e540aa2a1a2adcf688c1b1bb805e2 | 0fea2b4c1b86eb142580ac1ab7d967a4f96ac786 | /src/main/java/com/demo/Assignment1_Modified/Clerk.java | c50cfe1d2b7ba83cba77b965217290d33cbb7a50 | [] | no_license | sahithiviss/assignment1_modified_employee | fd7609ad4b419ca0b42958a5336b198b1432b437 | de066f5273fc150d00eb45436591e537b4cc0b02 | refs/heads/master | 2021-07-16T08:30:46.559134 | 2019-08-08T06:57:08 | 2019-08-08T06:57:08 | 201,197,350 | 0 | 0 | null | 2020-10-13T15:11:13 | 2019-08-08T06:55:58 | Java | UTF-8 | Java | false | false | 168 | java | package com.demo.Assignment1_Modified;
public class Clerk extends Employee{
public Clerk() {
super(8000, "Clerk");
// TODO Auto-generated constructor stub
}
}
| [
"sahithivsl@gmail.com"
] | sahithivsl@gmail.com |
5d9a51dc7c934d786a90a6cc23c46ad12eeb552b | 72fc511f0243334f9b24a73f4f69589da0d7953c | /src/org/vcssl/nano/combinedtest/VectorCastOperationCombinedTest.java | f1e25de1e58025fbb0f70845c7851a4eca89ba1b | [
"MIT"
] | permissive | RINEARN/vnano | 924ef2a8bb6822b535b737063a3a92b3d7203bef | 3cf4901a299bc6e79f09191185f3f5653cba5bf0 | refs/heads/main | 2022-12-17T02:28:25.460256 | 2022-12-11T15:50:11 | 2022-12-11T15:50:11 | 149,329,603 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,999 | java | package org.vcssl.nano.combinedtest;
import org.vcssl.nano.VnanoEngine;
import org.vcssl.nano.VnanoException;
public class VectorCastOperationCombinedTest extends CombinedTestElement {
VnanoEngine engine = null;
@Override
public void initializeTest(VnanoEngine engine) {
this.engine = engine;
}
@Override
public void finalizeTest() {
this.engine = null;
}
@Override
public void executeTest() {
try {
this.testCastInt1DToFloat1D();
this.testCastInt1DToString1D();
this.testCastFloat1DToInt1D();
this.testCastFloat1DToString1D();
this.testCastBool1DToString1D();
this.testCastString1DToInt1D();
this.testCastString1DToFloat1D();
this.testCastString1DToBool1D();
this.testCastInt2DToFloat2D();
this.testCastInt2DToString2D();
this.testCastFloat2DToInt2D();
this.testCastFloat2DToString2D();
this.testCastBool2DToString2D();
this.testCastString2DToInt2D();
this.testCastString2DToFloat2D();
this.testCastString2DToBool2D();
this.testCastBetweenIncompatibleArrays();
} catch (VnanoException e) {
throw new CombinedTestException(e);
}
}
private void testCastInt1DToFloat1D() throws VnanoException {
String scriptCode =
"int i[3]; " +
"i[0] = 1; i[1] = -2; i[2] = 3; " +
"(float[]) i; ";
double[] result = (double[])this.engine.executeScript(scriptCode);
double[] expected = new double[] { 1.0, -2.0, 3.0 };
super.evaluateResult(result, expected, "cast int[] to float[]", scriptCode);
}
private void testCastInt1DToString1D() throws VnanoException {
String scriptCode =
"int i[3]; " +
"i[0] = 1; i[1] = -2; i[2] = 3; " +
"(string[]) i; ";
String[] result = (String[])this.engine.executeScript(scriptCode);
String[] expected = new String[] { "1", "-2", "3" };
super.evaluateResult(result, expected, "cast int[] to string[]", scriptCode);
}
private void testCastFloat1DToInt1D() throws VnanoException {
String scriptCode =
"float f[3]; " +
"f[0] = 1.1; f[1] = -2.2; f[2] = 3.3; " +
"(int[]) f; ";
long[] result = (long[])this.engine.executeScript(scriptCode);
long[] expected = new long[] { 1L, -2L, 3L };
super.evaluateResult(result, expected, "cast float[] to int[]", scriptCode);
}
private void testCastFloat1DToString1D() throws VnanoException {
String scriptCode =
"float f[3]; " +
"f[0] = 1.25; f[1] = -2.25; f[2] = 3.25; " +
"(string[]) f; ";
String[] result = (String[])this.engine.executeScript(scriptCode);
String[] expected = new String[] { "1.25", "-2.25", "3.25" };
super.evaluateResult(result, expected, "cast float[] to sting[]", scriptCode);
}
private void testCastBool1DToString1D() throws VnanoException {
String scriptCode =
"bool b[3]; " +
"b[0] = true; b[1] = false; b[2] = true; " +
"(string[]) b; ";
String[] result = (String[])this.engine.executeScript(scriptCode);
String[] expected = new String[] { "true", "false", "true" };
super.evaluateResult(result, expected, "cast bool[] to sting[]", scriptCode);
}
private void testCastString1DToInt1D() throws VnanoException {
String scriptCode =
"string s[3]; " +
"s[0] = \"1\"; s[1] = \"-2\"; s[2] = \"3\"; " +
"(int[]) s; ";
long[] result = (long[])this.engine.executeScript(scriptCode);
long[] expected = new long[] { 1L, -2L, 3L };
super.evaluateResult(result, expected, "cast string[] to int[]", scriptCode);
}
private void testCastString1DToFloat1D() throws VnanoException {
String scriptCode =
"string s[3]; " +
"s[0] = \"1.25\"; s[1] = \"-2.25\"; s[2] = \"3.25\"; " +
"(float[]) s; ";
double[] result = (double[])this.engine.executeScript(scriptCode);
double[] expected = new double[] { 1.25, -2.25, 3.25 };
super.evaluateResult(result, expected, "cast string[] to float[]", scriptCode);
}
private void testCastString1DToBool1D() throws VnanoException {
String scriptCode =
"string s[3]; " +
"s[0] = \"true\"; s[1] = \"false\"; s[2] = \"true\"; " +
"(bool[]) s; ";
boolean[] result = (boolean[])this.engine.executeScript(scriptCode);
boolean[] expected = new boolean[] { true, false, true };
super.evaluateResult(result, expected, "cast string[] to bool[]", scriptCode);
}
private void testCastInt2DToFloat2D() throws VnanoException {
String scriptCode =
"int i[2][3]; " +
"i[0][0] = 1; i[0][1] = -2; i[0][2] = 3; " +
"i[1][0] = 11; i[1][1] = -22; i[1][2] = 33; " +
"(float[][]) i; ";
double[][] result = (double[][])this.engine.executeScript(scriptCode);
double[][] expected = new double[][] { { 1.0, -2.0, 3.0 }, { 11.0, -22.0, 33.0 } };
super.evaluateResult(result, expected, "cast int[][] to float[][]", scriptCode);
}
private void testCastInt2DToString2D() throws VnanoException {
String scriptCode =
"int i[2][3]; " +
"i[0][0] = 1; i[0][1] = -2; i[0][2] = 3; " +
"i[1][0] = 11; i[1][1] = -22; i[1][2] = 33; " +
"(string[][]) i; ";
String[][] result = (String[][])this.engine.executeScript(scriptCode);
String[][] expected = new String[][] { { "1", "-2", "3" }, { "11", "-22", "33" } };
super.evaluateResult(result, expected, "cast int[][] to string[][]", scriptCode);
}
private void testCastFloat2DToInt2D() throws VnanoException {
String scriptCode =
"float f[2][3]; " +
"f[0][0] = 1.1; f[0][1] = -2.2; f[0][2] = 3.3; " +
"f[1][0] = 11.1; f[1][1] = -22.2; f[1][2] = 33.3; " +
"(int[][]) f; ";
long[][] result = (long[][])this.engine.executeScript(scriptCode);
long[][] expected = new long[][] { { 1L, -2L, 3L }, { 11L, -22L, 33L } };
super.evaluateResult(result, expected, "cast float[][] to int[][]", scriptCode);
}
private void testCastFloat2DToString2D() throws VnanoException {
String scriptCode =
"float f[2][3]; " +
"f[0][0] = 1.25; f[0][1] = -2.25; f[0][2] = 3.25; " +
"f[1][0] = 11.25; f[1][1] = -22.25; f[1][2] = 33.25; " +
"(string[][]) f; ";
String[][] result = (String[][])this.engine.executeScript(scriptCode);
String[][] expected = new String[][] { { "1.25", "-2.25", "3.25" }, { "11.25", "-22.25", "33.25" } };
super.evaluateResult(result, expected, "cast float[][] to sting[][]", scriptCode);
}
private void testCastBool2DToString2D() throws VnanoException {
String scriptCode =
"bool b[2][3]; " +
"b[0][0] = true; b[0][1] = false; b[0][2] = true; " +
"b[1][0] = false; b[1][1] = true; b[1][2] = false; " +
"(string[][]) b; ";
String[][] result = (String[][])this.engine.executeScript(scriptCode);
String[][] expected = new String[][] { { "true", "false", "true" }, { "false", "true", "false" } };
super.evaluateResult(result, expected, "cast bool[][] to sting[][]", scriptCode);
}
private void testCastString2DToInt2D() throws VnanoException {
String scriptCode =
"string s[2][3]; " +
"s[0][0] = \"1\"; s[0][1] = \"-2\"; s[0][2] = \"3\"; " +
"s[1][0] = \"11\"; s[1][1] = \"-22\"; s[1][2] = \"33\"; " +
"(int[][]) s; ";
long[][] result = (long[][])this.engine.executeScript(scriptCode);
long[][] expected = new long[][] { { 1L, -2L, 3L }, { 11L, -22L, 33L } };
super.evaluateResult(result, expected, "cast string[][] to int[][]", scriptCode);
}
private void testCastString2DToFloat2D() throws VnanoException {
String scriptCode =
"string s[2][3]; " +
"s[0][0] = \"1.25\"; s[0][1] = \"-2.25\"; s[0][2] = \"3.25\"; " +
"s[1][0] = \"11.25\"; s[1][1] = \"-22.25\"; s[1][2] = \"33.25\"; " +
"(float[][]) s; ";
double[][] result = (double[][])this.engine.executeScript(scriptCode);
double[][] expected = new double[][] { { 1.25, -2.25, 3.25 }, { 11.25, -22.25, 33.25 } };
super.evaluateResult(result, expected, "cast string[] to float[]", scriptCode);
}
private void testCastString2DToBool2D() throws VnanoException {
String scriptCode =
"string s[2][3]; " +
"s[0][0] = \"true\"; s[0][1] = \"false\"; s[0][2] = \"true\"; " +
"s[1][0] = \"false\"; s[1][1] = \"true\"; s[1][2] = \"false\"; " +
"(bool[][]) s; ";
boolean[][] result = (boolean[][])this.engine.executeScript(scriptCode);
boolean[][] expected = new boolean[][] { { true, false, true }, { false, true, false } };
super.evaluateResult(result, expected, "cast string[][] to bool[][]", scriptCode);
}
private void testCastBetweenIncompatibleArrays() throws VnanoException {
// Scalar to 1D: NG
try {
String scriptCode =
"float f; " +
"(int[]) f; ";
this.engine.executeScript(scriptCode);
super.missedExpectedError("cast between arrays having incompatible ranks 1; (should be failed) ", scriptCode);
} catch (VnanoException vne) {
// Expected to be thrown.
super.succeeded("cast between arrays having incompatible ranks 1; (should be failed) ");
}
// 1D to scalar: NG
try {
String scriptCode =
"float f[3]; " +
"(int) f; ";
this.engine.executeScript(scriptCode);
super.missedExpectedError("cast between arrays having incompatible ranks 2; (should be failed) ", scriptCode);
} catch (VnanoException vne) {
// Expected to be thrown.
super.succeeded("cast between arrays having incompatible ranks 2; (should be failed) ");
}
// 2D to 1D: NG
try {
String scriptCode =
"float f[2][3]; " +
"(int[]) f; ";
this.engine.executeScript(scriptCode);
super.missedExpectedError("cast between arrays having incompatible ranks 3; (should be failed) ", scriptCode);
} catch (VnanoException vne) {
// Expected to be thrown.
super.succeeded("cast between arrays having incompatible ranks 3; (should be failed) ");
}
// 1D to 2D: NG
try {
String scriptCode =
"float f[3]; " +
"(int[][]) f; ";
this.engine.executeScript(scriptCode);
super.missedExpectedError("cast between arrays having incompatible ranks 4; (should be failed) ", scriptCode);
} catch (VnanoException vne) {
// Expected to be thrown.
super.succeeded("cast between arrays having incompatible ranks 4; (should be failed) ");
}
}
}
| [
"commit@rinearn.com"
] | commit@rinearn.com |
72f34a7a02cb91f45b31c44612e633614bbc5a54 | 8999b157fd3e14faa74d6b137bf03bf76857083f | /libCompiler/src/main/java/com/duy/pascal/backend/ast/codeunit/ExecutableCodeUnit.java | 5bfb245d3415499efbd3aa100ec00dc41e553f35 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | phapli/pascalnide | 8b63033cb4bc35a5485cb870278c4a9a9cb79c98 | a073b43e3e9ed055361f319f140a3f835a55fefb | refs/heads/master | 2021-01-23T10:38:33.992343 | 2017-06-01T09:05:38 | 2017-06-01T09:05:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 964 | java | package com.duy.pascal.backend.ast.codeunit;
import com.duy.pascal.backend.ast.AbstractFunction;
import com.duy.pascal.backend.parse_exception.ParsingException;
import com.duy.pascal.backend.source_include.ScriptSource;
import com.duy.pascal.frontend.activities.IRunnablePascal;
import com.google.common.collect.ListMultimap;
import java.io.Reader;
import java.util.List;
public abstract class ExecutableCodeUnit extends CodeUnit {
public ExecutableCodeUnit(Reader r,
ListMultimap<String, AbstractFunction> functionTable,
String sourceName, //for DEBUG
List<ScriptSource> includeDirectories,
IRunnablePascal handler)
throws ParsingException {
super(r, functionTable, sourceName, includeDirectories, handler);
}
@Override
public abstract RuntimeExecutableCodeUnit<? extends ExecutableCodeUnit> run();
}
| [
"tranleduy1233@gmail.com"
] | tranleduy1233@gmail.com |
fcefde6b1511af01ec41cb30ba9180634c2b9333 | 3f0c39968610c41074218fd5658010a524be21bb | /src/lc/solutions/LC055_JumpGame.java | e684ac72d0aecf0986ac3c1b64a6abbdbdc50aaa | [] | no_license | knightseu/Algs | d429a36e0e49871fbfc68c58e95b7c942cb7cfac | 02d001b7c451576a5b829c3a550f4b36d4e233ef | refs/heads/master | 2021-01-22T08:32:56.856632 | 2018-03-29T21:37:17 | 2018-03-29T21:37:17 | 31,428,351 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,003 | java | package lc.solutions;
public class LC055_JumpGame {
//DP
public boolean canJump(int[] A) {
boolean[] can = new boolean[A.length];
can[0] = true;
for (int i = 1; i < A.length; i++) {
for (int j = 0; j < i; j++) {
if (can[j] && j + A[j] >= i) {
can[i] = true;
break;
}
}
}
return can[A.length - 1];
}
//Greedy
public boolean canJumpGreedy(int[] A) {
// think it as merging n intervals
if (A == null || A.length == 0) {
return false;
}
int farthest = A[0];
for (int i = 1; i < A.length; i++) {
if (i <= farthest && A[i] + i >= farthest) {
farthest = A[i] + i;
}
}
return farthest >= A.length - 1;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"sean.xuanlin@gmail.com"
] | sean.xuanlin@gmail.com |
99c06f23f482f359163d7a59fe72f2071aa65d4d | 0ed20fe0fc9e1cd76034d5698c4f7dcf42c47a60 | /_FDM/ProjectYoGrannyApples/src/test/java/com/fdmgroup/appleGram/InventoryBeanTester.java | dd173b3cf0e73d04e21927b921118e35436cb0d6 | [] | no_license | Kamurai/EclipseRepository | 61371f858ff82dfdfc70c3de16fd3322222759ed | 4af50d1f63a76faf3e04a15129c0ed098fc6c545 | refs/heads/master | 2022-12-22T13:05:13.965919 | 2020-11-05T03:42:09 | 2020-11-05T03:42:09 | 101,127,637 | 0 | 0 | null | 2022-12-16T13:43:14 | 2017-08-23T02:18:08 | Java | UTF-8 | Java | false | false | 1,125 | java | /**
*
*/
package com.fdmgroup.appleGram;
import java.util.ArrayList;
import java.util.List;
import com.fdmgroup.appleGram.*;
/**
* @author Christopher.Kemerait
*
*/
public class InventoryBeanTester {
/**
* @param args
*/
public static void main(String[] args)
{
InventoryBean ibean = new InventoryBean();
for(int x = 0; x < ibean.getProductList().size(); x++)
{
printApple( (Apple) ibean.getProductList().get(x));
}
}
public static void printApple(Apple apple)
{
System.out.println("Id: " + apple.getId());
System.out.println("Name: " + apple.getName());
System.out.println("Price: $" + apple.getPrice());
System.out.println("Picture URL: " + apple.getPicurl());
System.out.println();
}
public static void printObjectToApple(Object object)
{
Apple apple = (Apple) object;
System.out.println("Id: " + apple.getId());
System.out.println("Name: " + apple.getName());
System.out.println("Price: $" + apple.getPrice());
System.out.println("Picture URL: " + apple.getPicurl());
System.out.println();
}
}
| [
"christopher.kemerait@fdmgroup.com"
] | christopher.kemerait@fdmgroup.com |
28aa035646615c257b98142ccfa99468ceb63f30 | e70abc02efbb8a7637eb3655f287b0a409cfa23b | /hyjf-web/src/main/java/com/hyjf/web/api/user/ApiUserPostBean.java | fd4e2ddc5b728cfcaa105025a578e26816fa5cc8 | [] | no_license | WangYouzheng1994/hyjf | ecb221560460e30439f6915574251266c1a49042 | 6cbc76c109675bb1f120737f29a786fea69852fc | refs/heads/master | 2023-05-12T03:29:02.563411 | 2020-05-19T13:49:56 | 2020-05-19T13:49:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,117 | java | /**
* Description:(类功能描述-必填) 需要在每个方法前添加业务描述,方便业务业务行为的BI工作
* Copyright: Copyright (HYJF Corporation)2017
* Company: HYJF Corporation
* @author: lb
* @version: 1.0
* Created at: 2017年9月15日 上午9:23:07
* Modification History:
* Modified by :
*/
package com.hyjf.web.api.user;
import com.hyjf.web.api.base.ApiBaseBean;
/**
* @author liubin
*/
public class ApiUserPostBean extends ApiBaseBean {
/** 加密的汇晶社用户ID */
private String bindUniqueIdScy;
/** 返回Url */
private String retUrl;
/** 平台id */
private Integer pid;
/** 手机号码*/
private String mobile;
/** 身份证号码*/
private String idCard;
/** 姓名*/
private String name;
/**
* bindUniqueIdScy
* @return the bindUniqueIdScy
*/
public String getBindUniqueIdScy() {
return bindUniqueIdScy;
}
public void setBindUniqueIdScy(String bindUniqueIdScy) {
this.bindUniqueIdScy = bindUniqueIdScy;
}
/**
* retUrl
* @return the retUrl
*/
public String getRetUrl() {
return retUrl;
}
/**
* @param retUrl the retUrl to set
*/
public void setRetUrl(String retUrl) {
this.retUrl = retUrl;
}
/**
* pid
* @return the pid
*/
public Integer getPid() {
return pid;
}
/**
* @param pid the pid to set
*/
public void setPid(Integer pid) {
this.pid = pid;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* 执行前每个方法前需要添加BusinessDesc描述
* @return
* @author lb
*/
@Override
public String toString() {
return "ApiUserPostBean [bindUniqueIdScy=" + bindUniqueIdScy + ", retUrl=" + retUrl + ", pid=" + pid + ", timestamp=" + super.getTimestamp() +", chkValue=" + super.getChkValue() + "]";
}
}
| [
"heshuying@hyjf.com"
] | heshuying@hyjf.com |
78b93014957a53641bdb2625e5ff83e589256eb2 | 0d46d7021930763db0e37cb7f17ef072070dabfc | /src/covid/json/XML.java | 730577656bb52a71efbfec4b214332d96c1b65a2 | [] | no_license | LakshanViranga/Covid-JavaFX | c094a1dee0a64afe2f48b20e113628c78bc1eb52 | 3e508899b92ed5720ef725195edc4fb26114efb9 | refs/heads/master | 2023-02-09T16:30:13.889933 | 2020-11-30T02:48:28 | 2020-11-30T02:48:28 | 316,956,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,832 | java | package covid.json;
/*
Copyright (c) 2015 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Iterator;
/**
* This provides static methods to convert an XML text into a JSONObject, and to
* covert a JSONObject into an XML text.
*
* @author JSON.org
* @version 2016-08-10
*/
@SuppressWarnings("boxing")
public class XML {
/** The Character '&'. */
public static final Character AMP = '&';
/** The Character '''. */
public static final Character APOS = '\'';
/** The Character '!'. */
public static final Character BANG = '!';
/** The Character '='. */
public static final Character EQ = '=';
/** The Character <pre>{@code '>'. }</pre>*/
public static final Character GT = '>';
/** The Character '<'. */
public static final Character LT = '<';
/** The Character '?'. */
public static final Character QUEST = '?';
/** The Character '"'. */
public static final Character QUOT = '"';
/** The Character '/'. */
public static final Character SLASH = '/';
/**
* Null attribute name
*/
public static final String NULL_ATTR = "xsi:nil";
public static final String TYPE_ATTR = "xsi:type";
/**
* Creates an iterator for navigating Code Points in a string instead of
* characters. Once Java7 support is dropped, this can be replaced with
* <code>
* string.codePoints()
* </code>
* which is available in Java8 and above.
*
* @see <a href=
* "http://stackoverflow.com/a/21791059/6030888">http://stackoverflow.com/a/21791059/6030888</a>
*/
private static Iterable<Integer> codePointIterator(final String string) {
return new Iterable<Integer>() {
@Override
public Iterator<Integer> iterator() {
return new Iterator<Integer>() {
private int nextIndex = 0;
private int length = string.length();
@Override
public boolean hasNext() {
return this.nextIndex < this.length;
}
@Override
public Integer next() {
int result = string.codePointAt(this.nextIndex);
this.nextIndex += Character.charCount(result);
return result;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
}
/**
* Replace special characters with XML escapes:
*
* <pre>{@code
* & (ampersand) is replaced by &amp;
* < (less than) is replaced by &lt;
* > (greater than) is replaced by &gt;
* " (double quote) is replaced by &quot;
* ' (single quote / apostrophe) is replaced by &apos;
* }</pre>
*
* @param string
* The string to be escaped.
* @return The escaped string.
*/
public static String escape(String string) {
StringBuilder sb = new StringBuilder(string.length());
for (final int cp : codePointIterator(string)) {
switch (cp) {
case '&':
sb.append("&");
break;
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '"':
sb.append(""");
break;
case '\'':
sb.append("'");
break;
default:
if (mustEscape(cp)) {
sb.append("&#x");
sb.append(Integer.toHexString(cp));
sb.append(';');
} else {
sb.appendCodePoint(cp);
}
}
}
return sb.toString();
}
/**
* @param cp code point to test
* @return true if the code point is not valid for an XML
*/
private static boolean mustEscape(int cp) {
/* Valid range from https://www.w3.org/TR/REC-xml/#charsets
*
* #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
*
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
*/
// isISOControl is true when (cp >= 0 && cp <= 0x1F) || (cp >= 0x7F && cp <= 0x9F)
// all ISO control characters are out of range except tabs and new lines
return (Character.isISOControl(cp)
&& cp != 0x9
&& cp != 0xA
&& cp != 0xD
) || !(
// valid the range of acceptable characters that aren't control
(cp >= 0x20 && cp <= 0xD7FF)
|| (cp >= 0xE000 && cp <= 0xFFFD)
|| (cp >= 0x10000 && cp <= 0x10FFFF)
)
;
}
/**
* Removes XML escapes from the string.
*
* @param string
* string to remove escapes from
* @return string with converted entities
*/
public static String unescape(String string) {
StringBuilder sb = new StringBuilder(string.length());
for (int i = 0, length = string.length(); i < length; i++) {
char c = string.charAt(i);
if (c == '&') {
final int semic = string.indexOf(';', i);
if (semic > i) {
final String entity = string.substring(i + 1, semic);
sb.append(XMLTokener.unescapeEntity(entity));
// skip past the entity we just parsed.
i += entity.length() + 1;
} else {
// this shouldn't happen in most cases since the parser
// errors on unclosed entries.
sb.append(c);
}
} else {
// not part of an entity
sb.append(c);
}
}
return sb.toString();
}
/**
* Throw an exception if the string contains whitespace. Whitespace is not
* allowed in tagNames and attributes.
*
* @param string
* A string.
* @throws JSONException Thrown if the string contains whitespace or is empty.
*/
public static void noSpace(String string) throws JSONException {
int i, length = string.length();
if (length == 0) {
throw new JSONException("Empty string.");
}
for (i = 0; i < length; i += 1) {
if (Character.isWhitespace(string.charAt(i))) {
throw new JSONException("'" + string
+ "' contains a space character.");
}
}
}
/**
* Scan the content following the named tag, attaching it to the context.
*
* @param x
* The XMLTokener containing the source string.
* @param context
* The JSONObject that will include the new material.
* @param name
* The tag name.
* @return true if the close tag is processed.
* @throws JSONException
*/
private static boolean parse(XMLTokener x, JSONObject context, String name, XMLParserConfiguration config)
throws JSONException {
char c;
int i;
JSONObject jsonObject = null;
String string;
String tagName;
Object token;
XMLXsiTypeConverter<?> xmlXsiTypeConverter;
// Test for and skip past these forms:
// <!-- ... -->
// <! ... >
// <![ ... ]]>
// <? ... ?>
// Report errors for these forms:
// <>
// <=
// <<
token = x.nextToken();
// <!
if (token == BANG) {
c = x.next();
if (c == '-') {
if (x.next() == '-') {
x.skipPast("-->");
return false;
}
x.back();
} else if (c == '[') {
token = x.nextToken();
if ("CDATA".equals(token)) {
if (x.next() == '[') {
string = x.nextCDATA();
if (string.length() > 0) {
context.accumulate(config.getcDataTagName(), string);
}
return false;
}
}
throw x.syntaxError("Expected 'CDATA['");
}
i = 1;
do {
token = x.nextMeta();
if (token == null) {
throw x.syntaxError("Missing '>' after '<!'.");
} else if (token == LT) {
i += 1;
} else if (token == GT) {
i -= 1;
}
} while (i > 0);
return false;
} else if (token == QUEST) {
// <?
x.skipPast("?>");
return false;
} else if (token == SLASH) {
// Close tag </
token = x.nextToken();
if (name == null) {
throw x.syntaxError("Mismatched close tag " + token);
}
if (!token.equals(name)) {
throw x.syntaxError("Mismatched " + name + " and " + token);
}
if (x.nextToken() != GT) {
throw x.syntaxError("Misshaped close tag");
}
return true;
} else if (token instanceof Character) {
throw x.syntaxError("Misshaped tag");
// Open tag <
} else {
tagName = (String) token;
token = null;
jsonObject = new JSONObject();
boolean nilAttributeFound = false;
xmlXsiTypeConverter = null;
for (;;) {
if (token == null) {
token = x.nextToken();
}
// attribute = value
if (token instanceof String) {
string = (String) token;
token = x.nextToken();
if (token == EQ) {
token = x.nextToken();
if (!(token instanceof String)) {
throw x.syntaxError("Missing value");
}
if (config.isConvertNilAttributeToNull()
&& NULL_ATTR.equals(string)
&& Boolean.parseBoolean((String) token)) {
nilAttributeFound = true;
} else if(config.getXsiTypeMap() != null && !config.getXsiTypeMap().isEmpty()
&& TYPE_ATTR.equals(string)) {
xmlXsiTypeConverter = config.getXsiTypeMap().get(token);
} else if (!nilAttributeFound) {
jsonObject.accumulate(string,
config.isKeepStrings()
? ((String) token)
: stringToValue((String) token));
}
token = null;
} else {
jsonObject.accumulate(string, "");
}
} else if (token == SLASH) {
// Empty tag <.../>
if (x.nextToken() != GT) {
throw x.syntaxError("Misshaped tag");
}
if (nilAttributeFound) {
context.accumulate(tagName, JSONObject.NULL);
} else if (jsonObject.length() > 0) {
context.accumulate(tagName, jsonObject);
} else {
context.accumulate(tagName, "");
}
return false;
} else if (token == GT) {
// Content, between <...> and </...>
for (;;) {
token = x.nextContent();
if (token == null) {
if (tagName != null) {
throw x.syntaxError("Unclosed tag " + tagName);
}
return false;
} else if (token instanceof String) {
string = (String) token;
if (string.length() > 0) {
if(xmlXsiTypeConverter != null) {
jsonObject.accumulate(config.getcDataTagName(),
stringToValue(string, xmlXsiTypeConverter));
} else {
jsonObject.accumulate(config.getcDataTagName(),
config.isKeepStrings() ? string : stringToValue(string));
}
}
} else if (token == LT) {
// Nested element
if (parse(x, jsonObject, tagName, config)) {
if (jsonObject.length() == 0) {
context.accumulate(tagName, "");
} else if (jsonObject.length() == 1
&& jsonObject.opt(config.getcDataTagName()) != null) {
context.accumulate(tagName, jsonObject.opt(config.getcDataTagName()));
} else {
context.accumulate(tagName, jsonObject);
}
return false;
}
}
}
} else {
throw x.syntaxError("Misshaped tag");
}
}
}
}
/**
* This method tries to convert the given string value to the target object
* @param string String to convert
* @param typeConverter value converter to convert string to integer, boolean e.t.c
* @return JSON value of this string or the string
*/
public static Object stringToValue(String string, XMLXsiTypeConverter<?> typeConverter) {
if(typeConverter != null) {
return typeConverter.convert(string);
}
return stringToValue(string);
}
/**
* This method is the same as {@link JSONObject#stringToValue(String)}.
*
* @param string String to convert
* @return JSON value of this string or the string
*/
// To maintain compatibility with the Android API, this method is a direct copy of
// the one in JSONObject. Changes made here should be reflected there.
// This method should not make calls out of the XML object.
public static Object stringToValue(String string) {
if ("".equals(string)) {
return string;
}
// check JSON key words true/false/null
if ("true".equalsIgnoreCase(string)) {
return Boolean.TRUE;
}
if ("false".equalsIgnoreCase(string)) {
return Boolean.FALSE;
}
if ("null".equalsIgnoreCase(string)) {
return JSONObject.NULL;
}
/*
* If it might be a number, try converting it. If a number cannot be
* produced, then the value will just be a string.
*/
char initial = string.charAt(0);
if ((initial >= '0' && initial <= '9') || initial == '-') {
try {
return stringToNumber(string);
} catch (Exception ignore) {
}
}
return string;
}
/**
* direct copy of {@link JSONObject#stringToNumber(String)} to maintain Android support.
*/
private static Number stringToNumber(final String val) throws NumberFormatException {
char initial = val.charAt(0);
if ((initial >= '0' && initial <= '9') || initial == '-') {
// decimal representation
if (isDecimalNotation(val)) {
// Use a BigDecimal all the time so we keep the original
// representation. BigDecimal doesn't support -0.0, ensure we
// keep that by forcing a decimal.
try {
BigDecimal bd = new BigDecimal(val);
if(initial == '-' && BigDecimal.ZERO.compareTo(bd)==0) {
return Double.valueOf(-0.0);
}
return bd;
} catch (NumberFormatException retryAsDouble) {
// this is to support "Hex Floats" like this: 0x1.0P-1074
try {
Double d = Double.valueOf(val);
if(d.isNaN() || d.isInfinite()) {
throw new NumberFormatException("val ["+val+"] is not a valid number.");
}
return d;
} catch (NumberFormatException ignore) {
throw new NumberFormatException("val ["+val+"] is not a valid number.");
}
}
}
// block items like 00 01 etc. Java number parsers treat these as Octal.
if(initial == '0' && val.length() > 1) {
char at1 = val.charAt(1);
if(at1 >= '0' && at1 <= '9') {
throw new NumberFormatException("val ["+val+"] is not a valid number.");
}
} else if (initial == '-' && val.length() > 2) {
char at1 = val.charAt(1);
char at2 = val.charAt(2);
if(at1 == '0' && at2 >= '0' && at2 <= '9') {
throw new NumberFormatException("val ["+val+"] is not a valid number.");
}
}
// integer representation.
// This will narrow any values to the smallest reasonable Object representation
// (Integer, Long, or BigInteger)
// BigInteger down conversion: We use a similar bitLenth compare as
// BigInteger#intValueExact uses. Increases GC, but objects hold
// only what they need. i.e. Less runtime overhead if the value is
// long lived.
BigInteger bi = new BigInteger(val);
if(bi.bitLength() <= 31){
return Integer.valueOf(bi.intValue());
}
if(bi.bitLength() <= 63){
return Long.valueOf(bi.longValue());
}
return bi;
}
throw new NumberFormatException("val ["+val+"] is not a valid number.");
}
/**
* direct copy of {@link JSONObject#isDecimalNotation(String)} to maintain Android support.
*/
private static boolean isDecimalNotation(final String val) {
return val.indexOf('.') > -1 || val.indexOf('e') > -1
|| val.indexOf('E') > -1 || "-0".equals(val);
}
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* <[ [ ]]>}</pre>
* are ignored.
*
* @param string
* The source string.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(String string) throws JSONException {
return toJSONObject(string, XMLParserConfiguration.ORIGINAL);
}
/**
* Convert a well-formed (but not necessarily valid) XML into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* <[ [ ]]>}</pre>
* are ignored.
*
* @param reader The XML source reader.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(Reader reader) throws JSONException {
return toJSONObject(reader, XMLParserConfiguration.ORIGINAL);
}
/**
* Convert a well-formed (but not necessarily valid) XML into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* <[ [ ]]>}</pre>
* are ignored.
*
* All values are converted as strings, for 1, 01, 29.0 will not be coerced to
* numbers but will instead be the exact value as seen in the XML document.
*
* @param reader The XML source reader.
* @param keepStrings If true, then values will not be coerced into boolean
* or numeric values and will instead be left as strings
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(Reader reader, boolean keepStrings) throws JSONException {
if(keepStrings) {
return toJSONObject(reader, XMLParserConfiguration.KEEP_STRINGS);
}
return toJSONObject(reader, XMLParserConfiguration.ORIGINAL);
}
/**
* Convert a well-formed (but not necessarily valid) XML into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* <[ [ ]]>}</pre>
* are ignored.
*
* All values are converted as strings, for 1, 01, 29.0 will not be coerced to
* numbers but will instead be the exact value as seen in the XML document.
*
* @param reader The XML source reader.
* @param config Configuration options for the parser
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(Reader reader, XMLParserConfiguration config) throws JSONException {
JSONObject jo = new JSONObject();
XMLTokener x = new XMLTokener(reader);
while (x.more()) {
x.skipPast("<");
if(x.more()) {
parse(x, jo, null, config);
}
}
return jo;
}
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* <[ [ ]]>}</pre>
* are ignored.
*
* All values are converted as strings, for 1, 01, 29.0 will not be coerced to
* numbers but will instead be the exact value as seen in the XML document.
*
* @param string
* The source string.
* @param keepStrings If true, then values will not be coerced into boolean
* or numeric values and will instead be left as strings
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(String string, boolean keepStrings) throws JSONException {
return toJSONObject(new StringReader(string), keepStrings);
}
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject. Some information may be lost in this transformation because
* JSON is a data format and XML is a document format. XML uses elements,
* attributes, and content text, while JSON uses unordered collections of
* name/value pairs and arrays of values. JSON does not does not like to
* distinguish between elements and attributes. Sequences of similar
* elements are represented as JSONArrays. Content text may be placed in a
* "content" member. Comments, prologs, DTDs, and <pre>{@code
* <[ [ ]]>}</pre>
* are ignored.
*
* All values are converted as strings, for 1, 01, 29.0 will not be coerced to
* numbers but will instead be the exact value as seen in the XML document.
*
* @param string
* The source string.
* @param config Configuration options for the parser.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException Thrown if there is an errors while parsing the string
*/
public static JSONObject toJSONObject(String string, XMLParserConfiguration config) throws JSONException {
return toJSONObject(new StringReader(string), config);
}
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object
* A JSONObject.
* @return A string.
* @throws JSONException Thrown if there is an error parsing the string
*/
public static String toString(Object object) throws JSONException {
return toString(object, null, XMLParserConfiguration.ORIGINAL);
}
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object
* A JSONObject.
* @param tagName
* The optional name of the enclosing tag.
* @return A string.
* @throws JSONException Thrown if there is an error parsing the string
*/
public static String toString(final Object object, final String tagName) {
return toString(object, tagName, XMLParserConfiguration.ORIGINAL);
}
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object
* A JSONObject.
* @param tagName
* The optional name of the enclosing tag.
* @param config
* Configuration that can control output to XML.
* @return A string.
* @throws JSONException Thrown if there is an error parsing the string
*/
public static String toString(final Object object, final String tagName, final XMLParserConfiguration config)
throws JSONException {
StringBuilder sb = new StringBuilder();
JSONArray ja;
JSONObject jo;
String string;
if (object instanceof JSONObject) {
// Emit <tagName>
if (tagName != null) {
sb.append('<');
sb.append(tagName);
sb.append('>');
}
// Loop thru the keys.
// don't use the new entrySet accessor to maintain Android Support
jo = (JSONObject) object;
for (final String key : jo.keySet()) {
Object value = jo.opt(key);
if (value == null) {
value = "";
} else if (value.getClass().isArray()) {
value = new JSONArray(value);
}
// Emit content in body
if (key.equals(config.getcDataTagName())) {
if (value instanceof JSONArray) {
ja = (JSONArray) value;
int jaLength = ja.length();
// don't use the new iterator API to maintain support for Android
for (int i = 0; i < jaLength; i++) {
if (i > 0) {
sb.append('\n');
}
Object val = ja.opt(i);
sb.append(escape(val.toString()));
}
} else {
sb.append(escape(value.toString()));
}
// Emit an array of similar keys
} else if (value instanceof JSONArray) {
ja = (JSONArray) value;
int jaLength = ja.length();
// don't use the new iterator API to maintain support for Android
for (int i = 0; i < jaLength; i++) {
Object val = ja.opt(i);
if (val instanceof JSONArray) {
sb.append('<');
sb.append(key);
sb.append('>');
sb.append(toString(val, null, config));
sb.append("</");
sb.append(key);
sb.append('>');
} else {
sb.append(toString(val, key, config));
}
}
} else if ("".equals(value)) {
sb.append('<');
sb.append(key);
sb.append("/>");
// Emit a new tag <k>
} else {
sb.append(toString(value, key, config));
}
}
if (tagName != null) {
// Emit the </tagName> close tag
sb.append("</");
sb.append(tagName);
sb.append('>');
}
return sb.toString();
}
if (object != null && (object instanceof JSONArray || object.getClass().isArray())) {
if(object.getClass().isArray()) {
ja = new JSONArray(object);
} else {
ja = (JSONArray) object;
}
int jaLength = ja.length();
// don't use the new iterator API to maintain support for Android
for (int i = 0; i < jaLength; i++) {
Object val = ja.opt(i);
// XML does not have good support for arrays. If an array
// appears in a place where XML is lacking, synthesize an
// <array> element.
sb.append(toString(val, tagName == null ? "array" : tagName, config));
}
return sb.toString();
}
string = (object == null) ? "null" : escape(object.toString());
return (tagName == null) ? "\"" + string + "\""
: (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName
+ ">" + string + "</" + tagName + ">";
}
}
| [
"lakshanviranga0000@gmail.com"
] | lakshanviranga0000@gmail.com |
37c59e96a0e9b1bb313d73b865ddbedb7d8a7514 | 0844d96d5a618905daa47423f0ec461d9218aa6b | /cpc/CPC_Notification_UI/src/org/electrocodeogram/cpc/notification/ui/CPCNotificationUiPlugin.java | 1ca61918e03cd27e956ecc17c03d56eea78a29f8 | [] | no_license | ag-se/ecg | f7515d644ee3c0110346e357b9cd9c02b179aec0 | 2fe6511027431fdb30dd50aa492fa64dc6d1fe3a | refs/heads/master | 2020-06-04T10:45:16.005646 | 2015-08-25T16:13:25 | 2015-08-25T16:13:25 | 41,373,269 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,905 | java | package org.electrocodeogram.cpc.notification.ui;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class CPCNotificationUiPlugin extends Plugin
{
private static Log log = LogFactory.getLog(CPCNotificationUiPlugin.class);
// The plug-in ID
public static final String PLUGIN_ID = "org.electrocodeogram.cpc.notification.ui";
// The shared instance
private static CPCNotificationUiPlugin plugin;
//private static final String LOG_PROPERTIES_FILE = "logging.properties";
// private ILogManager logManager;
/**
* The constructor
*/
public CPCNotificationUiPlugin()
{
plugin = this;
// configureLogging();
log.info("using shared logging");
log.trace("trace enabled");
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext context) throws Exception
{
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception
{
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static CPCNotificationUiPlugin getDefault()
{
return plugin;
}
// public static ILogManager getLogManager()
// {
// return getDefault().logManager;
// }
// private void configureLogging()
// {
// we can either use a shared ECGEclipseCorePlugin logger or get our own
// stand alone logger.
// for now we use a shared logger.
// logManager = ECGEclipseCorePlugin.getDefault().getPluginLogManager();
// log = this.logManager.getLogger(CPCNotificationUiPlugin.class.getName());
// log.info("using shared logging");
// standalone logger
/*
try
{
URL url = getBundle().getEntry("/" + LOG_PROPERTIES_FILE);
InputStream propertiesInputStream = url.openStream();
if (propertiesInputStream != null)
{
Properties props = new Properties();
props.load(propertiesInputStream);
propertiesInputStream.close();
this.logManager = new PluginLogManager(this, props);
log = this.logManager.getLogger(CPCCorePlugin.class.getName());
log.info("Logging Initialized");
}
else
{
System.err.println("ERROR - failed to load properties file - " + LOG_PROPERTIES_FILE);
}
}
catch (Exception e)
{
String message = "Error while initializing log properties." + e.getMessage();
System.err.println(message);
IStatus status = new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), IStatus.ERROR,
message, e);
getLog().log(status);
throw new RuntimeException("Error while initializing log properties.", e);
}
*/
// }
}
| [
"weckerle@3537aeea-94f2-0310-a3c2-ed66167d6be7"
] | weckerle@3537aeea-94f2-0310-a3c2-ed66167d6be7 |
dbfdd09c1757f9d0c0119d89a5a993254ccb8085 | 59132171ef2bb5027769d3aa6097f08ccd0f68d1 | /src/tipedata/Refrensi.java | 3c0c66c157adf448c21c89f3348783c2234093fe | [] | no_license | alvxyz/JavaSemester2 | edd9ca8faaf1860fe3d32affb1fec9bd0211ff1f | 2d8eb9c4333dc59266263b71d8c228c8b0987af7 | refs/heads/master | 2020-06-08T05:54:26.042738 | 2019-07-31T01:27:13 | 2019-07-31T01:27:13 | 193,171,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package tipedata;
public class Refrensi {
public static void main(String args[]){
String nama, jenisKelamin, statusMenikah;
Integer nilai;
nama = "Andi"; // nama = new String("Andi")
jenisKelamin = "Pria";
statusMenikah = "Menikah";
nilai = 10;
// menampilkan nilai variabel ke layar output
System.out.println(nama);
System.out.println(jenisKelamin);
System.out.println(statusMenikah);
System.out.println(nilai);
}
}
| [
"alvianteddy@gmail.com"
] | alvianteddy@gmail.com |
db53d5637d11e0873b71d5abd29c6e2b9d729561 | aa6cded9c81e3a6a5061e8c744f69812da8800f9 | /src/com/huyang/aaa/DownloadManageActivity.java | f3656c9470da379234f21d3a866971a6c0312c12 | [] | no_license | huyang1/textReader | 708cb73c246a2b0a6f422805dca171b054a53cea | a3ceef4d579fb3741cbc14c9486d1b20aa7f9299 | refs/heads/master | 2020-12-29T00:29:33.726150 | 2017-11-27T10:25:44 | 2017-11-27T10:25:44 | 60,943,136 | 1 | 0 | null | 2016-06-19T04:57:39 | 2016-06-12T05:00:10 | Java | GB18030 | Java | false | false | 7,909 | java | package com.huyang.aaa;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import com.example.DataBase.Book;
import com.example.DataBase.sqliteDataBase;
import com.example.linkWeb.DownloadTask;
import com.example.linkWeb.DownloadTask.Callback;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class DownloadManageActivity extends Activity {
public static ArrayList<HashMap<String, String>> book_nums=new ArrayList<HashMap<String,String>>();
private ListView listview;
private static Context context;
private static ArrayList<View> view_list=new ArrayList<View>();
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.download_manage);
context=this;
listview=(ListView) findViewById(R.id.listview);
listview.setAdapter(new MyListAdapter());
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
DownloadManageActivity.this.finish();
}
});
}
public static class DownloadBook extends AsyncTask<HashMap<String, String>, Integer,Void >
{
public int download_num=-1;
private long down_len=0;
private String name;
private String downloadPath;
private Bitmap bitmap;
private sqliteDataBase downloadBookSet;
public DownloadBook(Context context,Bitmap bitmap)
{
downloadBookSet=new sqliteDataBase(context);
download_num++;
this.bitmap=bitmap;
}
@Override
protected Void doInBackground(HashMap<String, String>... params) {
// TODO Auto-generated method stub
params[0].put("progress", Integer.toString(0));
book_nums.add(params[0]);
downloadPath=params[0].get("path");
name=params[0].get("bookName");
String Url=params[0].get("url");
File file = new File(downloadPath);
if (file.exists()) {
file.delete();
Log.i("file","delete");
}
try {
file.createNewFile();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
URL url = new URL(Url);
URLConnection con = url.openConnection();
int length=con.getContentLength();
InputStream is = con.getInputStream();
byte[] bs = new byte[1024];
int len=0;
OutputStream os = new FileOutputStream(downloadPath);
while ((len = is.read(bs)) != -1) {
os.write(bs, 0, len);
down_len+=len;
publishProgress((int) ((down_len / (float) length) * 100));
}
os.close();
is.close();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");
Date curDate = new Date(System.currentTimeMillis());//获取当前时间
String date = formatter.format(curDate);
if(bitmap!=null)
Log.i("message","bitmap 已存入数据库");
downloadBookSet.insert(name,imageZoom(bitmap),date);
}
@Override
protected void onProgressUpdate(Integer... values) {
// TODO Auto-generated method stub
super.onProgressUpdate(values);
View view=null;
if(download_num<view_list.size())
view=view_list.get(download_num);
if(view!=null)
{
ViewHolder viewHolder=(ViewHolder) view.getTag();
viewHolder.progress.setProgress(values[0]);
viewHolder.precent.setText(values[0]+"%");
}
book_nums.get(download_num).remove("progress");
book_nums.get(download_num).put("progress", Integer.toString(values[0]));
}
}
private class MyListAdapter extends BaseAdapter
{
@Override
public int getCount() {
// TODO Auto-generated method stub
return book_nums.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return book_nums.get(arg0);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final ViewHolder viewHolder;
if(convertView==null)
{
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.down_item, null, false);
viewHolder=new ViewHolder();
viewHolder.bookImage=(ImageView) convertView.findViewById(R.id.bookimage);
viewHolder.bookName=(TextView) convertView.findViewById(R.id.bookname);
viewHolder.bookName.setText(book_nums.get(position).get("bookName"));
viewHolder.progress=(ProgressBar) convertView.findViewById(R.id.progress);
viewHolder.precent=(TextView) convertView.findViewById(R.id.precent);
viewHolder.precent.setText(book_nums.get(position).get("progress")+"%");
viewHolder.progress.setProgress(Integer.parseInt(book_nums.get(position).get("progress")));
DownloadTask download=new DownloadTask();
Drawable drawable=download.loadDrawble(book_nums.get(position).get("bookImageUrl"), new Callback(){
@Override
public void imagecache(Drawable drawble) {
// TODO Auto-generated method stub
viewHolder.bookImage.setImageDrawable(drawble);
}
});
convertView.setTag(viewHolder);
}
else
viewHolder = (ViewHolder) convertView.getTag();
convertView.setTag(R.id.listview, position);
view_list.add(convertView);
return convertView;
}
}
private class ViewHolder
{
ImageView bookImage;
TextView bookName;
ProgressBar progress;
TextView precent;
}
private static Bitmap imageZoom(Bitmap bip) {
// 图片允许最大空间 单位:KB
double maxSize = 20.00;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bip.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] b = baos.toByteArray();
// 将字节换成KB
double mid = b.length / 1024;
// 判断bitmap占用空间是否大于允许最大空间 如果大于则压缩 小于则不压缩
if (mid > maxSize) {
// 获取bitmap大小 是允许最大大小的多少倍
double i = mid / maxSize;
// 开始压缩 此处用到平方根 将宽带和高度压缩掉对应的平方根倍
// (1.保持刻度和高度和原bitmap比率一致,压缩后也达到了最大大小占用空间的大小)
bip = zoomImage(bip, bip.getWidth() / Math.sqrt(i), bip.getHeight()
/ Math.sqrt(i));
}
return bip;
}
public static Bitmap zoomImage(Bitmap bgimage, double newWidth,
double newHeight) {
// 获取这个图片的宽和高
float width = bgimage.getWidth();
float height = bgimage.getHeight();
// 创建操作图片用的matrix对象
Matrix matrix = new Matrix();
// 计算宽高缩放率
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// 缩放图片动作
matrix.postScale(scaleWidth, scaleHeight);
Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width,
(int) height, matrix, true);
return bitmap;
}
}
| [
"2807374220@qq.com"
] | 2807374220@qq.com |
814b10c714bda853cbc6e32da032cd314fa9c85e | 5911d7ab59ab910b4c93f55f0b0e34aea5bcd469 | /app/src/main/java/com/example/julian/sunshine/app/widget/DetailWidgetRemoteViewsService.java | 67673d67157eaeda3e16d91d03fa4d1a84ee7d76 | [
"Apache-2.0"
] | permissive | AleksanderSleszynski/Sunshine | c6595a4ee7326f4a266c13c0bf7aa86363e1b6c1 | 497bce63eade3f808f33ec714aca4b6b00ca6767 | refs/heads/master | 2021-05-30T19:32:10.558808 | 2016-02-12T19:25:52 | 2016-02-12T19:25:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,086 | java | package com.example.julian.sunshine.app.widget;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Binder;
import android.util.Log;
import android.widget.AdapterView;
import android.widget.RemoteViews;
import android.widget.RemoteViewsService;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.Target;
import com.example.julian.sunshine.app.R;
import com.example.julian.sunshine.app.Utility;
import com.example.julian.sunshine.app.data.WeatherContract;
import java.util.concurrent.ExecutionException;
public class DetailWidgetRemoteViewsService extends RemoteViewsService {
public final String LOG_TAG = DetailWidgetRemoteViewsService.class.getSimpleName();
private static final String[] FORECAST_COLUMNS = {
WeatherContract.WeatherEntry.TABLE_NAME + "." + WeatherContract.WeatherEntry._ID,
WeatherContract.WeatherEntry.COLUMN_DATE,
WeatherContract.WeatherEntry.COLUMN_WEATHER_ID,
WeatherContract.WeatherEntry.COLUMN_SHORT_DESC,
WeatherContract.WeatherEntry.COLUMN_MAX_TEMP,
WeatherContract.WeatherEntry.COLUMN_MIN_TEMP
};
static final int INDEX_WEATHER_ID = 0;
static final int INDEX_WEATHER_DATE = 1;
static final int INDEX_WEATHER_CONDITION_ID = 2;
static final int INDEX_WEATHER_DESC = 3;
static final int INDEX_WEATHER_MAX_TEMP = 4;
static final int INDEX_WEATHER_MIN_TEMP = 5;
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
return new RemoteViewsFactory() {
private Cursor data = null;
@Override
public void onCreate() {}
@Override
public void onDataSetChanged() {
if(data != null){
data.close();
}
final long identityToken = Binder.clearCallingIdentity();
String location = Utility.getPreferredLocation(DetailWidgetRemoteViewsService.this);
Uri weatherForLocationUri = WeatherContract.WeatherEntry
.buildWeatherLocationWithStartDate(location, System.currentTimeMillis());
data = getContentResolver().query(weatherForLocationUri,
FORECAST_COLUMNS,
null,
null,
WeatherContract.WeatherEntry.COLUMN_DATE + " ASC");
Binder.restoreCallingIdentity(identityToken);
}
@Override
public void onDestroy() {
if(data != null){
data.close();
data = null;
}
}
@Override
public int getCount() {
return data == null ? 0 : data.getCount();
}
@Override
public RemoteViews getViewAt(int position) {
if(position == AdapterView.INVALID_POSITION ||
data == null || !data.moveToPosition(position)){
return null;
}
RemoteViews views = new RemoteViews(getPackageName(),
R.layout.widget_detail_list_item);
int weatherId = data.getInt(INDEX_WEATHER_CONDITION_ID);
int weatherArtResourceId = Utility.getIconResourceForWeatherCondition(weatherId);
Bitmap weatherArtImage = null;
if(!Utility.usingLocalGraphics(DetailWidgetRemoteViewsService.this)){
String weatherArtResourceUrl = Utility.getArtUrlForWeatherCondition(
DetailWidgetRemoteViewsService.this, weatherId);
try {
weatherArtImage = Glide.with(DetailWidgetRemoteViewsService.this)
.load(weatherArtResourceUrl)
.asBitmap()
.error(weatherArtResourceId)
.into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).get();
} catch (InterruptedException | ExecutionException e) {
Log.e(LOG_TAG, "Error retrieving large icon from " + weatherArtResourceUrl, e);
}
}
String description = data.getString(INDEX_WEATHER_DESC);
long dataInMillis = data.getLong(INDEX_WEATHER_DATE);
String formattedDate = Utility.getFriendlyDayString(
DetailWidgetRemoteViewsService.this, dataInMillis, false);
double maxTemp = data.getDouble(INDEX_WEATHER_MAX_TEMP);
double minTemp = data.getDouble(INDEX_WEATHER_MIN_TEMP);
String formattedMaxTemperature = Utility.formatTemperature(
DetailWidgetRemoteViewsService.this, maxTemp);
String formattedMinTemperature = Utility.formatTemperature(
DetailWidgetRemoteViewsService.this, minTemp);
if (weatherArtImage != null) {
views.setImageViewBitmap(R.id.widget_icon, weatherArtImage);
} else {
views.setImageViewResource(R.id.widget_icon, weatherArtResourceId);
}
setRemoteContentDescription(views, description);
views.setTextViewText(R.id.widget_date, formattedDate);
views.setTextViewText(R.id.widget_description, description);
views.setTextViewText(R.id.widget_high_temperature, formattedMaxTemperature);
views.setTextViewText(R.id.widget_low_temperature, formattedMinTemperature);
final Intent fillInIntent = new Intent();
String locationSetting = Utility.getPreferredLocation(
DetailWidgetRemoteViewsService.this);
Uri weatherUri = WeatherContract.WeatherEntry.buildWeatherLocationWithDate(
locationSetting,
dataInMillis);
fillInIntent.setData(weatherUri);
views.setOnClickFillInIntent(R.id.widget_list_item, fillInIntent);
return views;
}
private void setRemoteContentDescription(RemoteViews views, String description){
views.setContentDescription(R.id.widget_icon, description);
}
@Override
public RemoteViews getLoadingView() {
return new RemoteViews(getPackageName(), R.layout.widget_detail_list_item);
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public long getItemId(int position) {
if(data.moveToPosition(position))
return data.getLong(INDEX_WEATHER_ID);
return position;
}
@Override
public boolean hasStableIds() {
return true;
}
};
}
}
| [
"a.sleszynski@gmail.com"
] | a.sleszynski@gmail.com |
e0bfe2b500eb1688547e401fdb32fa4dd41668a8 | d7ad5016ee841be062a7ffd3cb8d861136eeef6e | /app/src/main/java/tenqube/com/qlip_android/ui_kj/calendarsample/CalendarData.java | d265d4239624c79feba315c2193ac3c9e00f09bb | [] | no_license | wjscksdnd11/qlip-tutorial | 94c5743fc87c70f16cbeefc97ee06a831c2b6c47 | 13fe26693bb38b11a7a83f8ab5249f680656f027 | refs/heads/master | 2021-01-12T00:25:14.020679 | 2017-01-12T08:34:37 | 2017-01-12T08:34:37 | 78,723,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package tenqube.com.qlip_android.ui_kj.calendarsample;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
/**
* Created by tenqube on 2016. 10. 18..
*/
public class CalendarData implements Serializable{
// 달에 해당 하는 데이터
public String month;
public String year;
public String yearMonth;
public Calendar calendar;
public ArrayList<CalendarSpentData> dayDataList;
}
| [
"12270618ko"
] | 12270618ko |
c565ba5847c61c194c550969a774fe5200132577 | 6f690afabcbc9d511e7b1abef0985f57cdef6569 | /src/main/java/com/alex/spring/boot/blog/repository/CatalogRepository.java | 9972cc5cabf05e3dc56acf6442d772f6f5072946 | [
"MIT"
] | permissive | Shenchangxin/SpringBoot-Blog | 8245334378814e17ff685af67c8e22d853b2e5ea | 29e85124792d26e03f8633fa71cb2c48d7f9ed03 | refs/heads/master | 2023-08-03T07:40:19.869439 | 2023-07-26T10:02:05 | 2023-07-26T10:02:05 | 305,093,100 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.alex.spring.boot.blog.repository;
import com.alex.spring.boot.blog.domain.Catalog;
import com.alex.spring.boot.blog.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface CatalogRepository extends JpaRepository <Catalog,Long> {
/**
* 根据用户查询
*/
List<Catalog> findByUser(User user);
/**
* 根据用户,分类名称查询
*/
List<Catalog> findByUserAndName(User user,String name);
}
| [
"2863727114@qq.com"
] | 2863727114@qq.com |
63b5cb82d08080ec5361352af55a6740c27a8240 | 35fe1e978ef7959bfee7b3572319d495a5f48dd8 | /javaEE/src/com/kaisheng/web/HomeServlet.java | 22c5cd128da96e02869aa1e8a8455351cefa802e | [] | no_license | lmbat/code | 3d2709838b6e7996973e9a01fe93f289045e4f95 | ba712ffc3acca2430b4fc8ea2b6417f97bf9730e | refs/heads/master | 2021-04-15T15:26:19.781808 | 2018-03-23T09:12:27 | 2018-03-23T09:12:27 | 126,358,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package com.kaisheng.web;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
*
* @author 小白
* @date 2018/3/22
*/
@WebServlet("/home")
public class HomeServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("Hello Servlet");
}
}
| [
"827795781@qq.com"
] | 827795781@qq.com |
5b99e145aa3d60ff0fa4ea3095a98e81b1f85875 | 9a8c10504a250d8a518fc9f8b51c5c6095271cfb | /Lecture/Evening_lectures/Lecture8/src/main/java/docsandvets/Vet.java | fb75b7a165d3ce9a9cb3a38f61fb6d0ac524d219 | [] | no_license | sharonzidi/cs5004_object_oriented_design | 5c51c2ac96239b49002aa5504b699ee8b015f425 | c0cbe1dd762d8e6b908798d602189084a8a4468f | refs/heads/main | 2023-08-29T07:55:15.937750 | 2021-10-27T19:42:54 | 2021-10-27T19:42:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package docsandvets;
import animals.AbstractNonHuman;
public class Vet<T extends AbstractNonHuman> extends AbstractProvider<T> {
public Vet(String firstname, String lastname, int maxPatients) {
super(firstname, lastname, maxPatients);
}
}
| [
"xia.zid@northeastern.edu"
] | xia.zid@northeastern.edu |
2763a60df43a5272d60ce3ab54f3916eebc86d76 | 15bc61b593cc6985ee17834f88cddfa4aa23c216 | /app/src/androidTest/java/com/threenod/helloworld/ExampleInstrumentedTest.java | a931fb572f66176ab0344373545b88f350882c99 | [] | no_license | kgwangjj/HelloWorld | fe81c14936d91f2ae39b674cea41286399ce6e43 | b1e22a46ad2dc481d566338bcbcf686f93eee666 | refs/heads/master | 2020-03-19T11:22:17.143871 | 2018-06-07T09:02:37 | 2018-06-07T09:08:19 | 136,450,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package com.threenod.helloworld;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.threenod.helloworld", appContext.getPackageName());
}
}
| [
"470996211@qq.com"
] | 470996211@qq.com |
4f1c12783cec804f8bcb5ebf3bfb5601a5ff332a | e36a91e10a26e0bb569e8db84e45563133887eb8 | /app/src/main/java/com/micompaia/wow/provider/monturas/MonturasCursor.java | cebeb2880a5ad95c6b210f19b258eb5de6cf67b7 | [] | no_license | 45722053P/AndroidWOWUF1 | f0f331ac37aade36866d7ae0c9f0b9128a7ff539 | cffb51f679b29b233e40f8e5f4e86f4cc2dc8267 | refs/heads/master | 2021-01-01T04:57:40.981491 | 2016-05-27T16:14:44 | 2016-05-27T16:14:44 | 59,735,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,986 | java | package com.micompaia.wow.provider.monturas;
import java.util.Date;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.micompaia.wow.provider.base.AbstractCursor;
/**
* Cursor wrapper for the {@code monturas} table.
*/
public class MonturasCursor extends AbstractCursor implements MonturasModel {
public MonturasCursor(Cursor cursor) {
super(cursor);
}
/**
* Primary key.
*/
public long getId() {
Long res = getLongOrNull(MonturasColumns._ID);
if (res == null)
throw new NullPointerException("The value of '_id' in the database was null, which is not allowed according to the model definition");
return res;
}
/**
* Get the {@code name} value.
* Can be {@code null}.
*/
@Nullable
public String getName() {
String res = getStringOrNull(MonturasColumns.NAME);
return res;
}
/**
* Get the {@code spellid} value.
* Can be {@code null}.
*/
@Nullable
public Integer getSpellid() {
Integer res = getIntegerOrNull(MonturasColumns.SPELLID);
return res;
}
/**
* Get the {@code creatureid} value.
* Can be {@code null}.
*/
@Nullable
public Integer getCreatureid() {
Integer res = getIntegerOrNull(MonturasColumns.CREATUREID);
return res;
}
/**
* Get the {@code itemid} value.
* Can be {@code null}.
*/
@Nullable
public Integer getItemid() {
Integer res = getIntegerOrNull(MonturasColumns.ITEMID);
return res;
}
/**
* Get the {@code qualityid} value.
* Can be {@code null}.
*/
@Nullable
public Integer getQualityid() {
Integer res = getIntegerOrNull(MonturasColumns.QUALITYID);
return res;
}
/**
* Get the {@code icon} value.
* Can be {@code null}.
*/
@Nullable
public String getIcon() {
String res = getStringOrNull(MonturasColumns.ICON);
return res;
}
/**
* Get the {@code isground} value.
* Can be {@code null}.
*/
@Nullable
public String getIsground() {
String res = getStringOrNull(MonturasColumns.ISGROUND);
return res;
}
/**
* Get the {@code isflying} value.
* Can be {@code null}.
*/
@Nullable
public String getIsflying() {
String res = getStringOrNull(MonturasColumns.ISFLYING);
return res;
}
/**
* Get the {@code isaquatic} value.
* Can be {@code null}.
*/
@Nullable
public String getIsaquatic() {
String res = getStringOrNull(MonturasColumns.ISAQUATIC);
return res;
}
/**
* Get the {@code isjumping} value.
* Can be {@code null}.
*/
@Nullable
public String getIsjumping() {
String res = getStringOrNull(MonturasColumns.ISJUMPING);
return res;
}
}
| [
"45722053p@iespoblenou.org"
] | 45722053p@iespoblenou.org |
6f6e6d6a9e2a03b4268f95dd7a620377a3cb8160 | e96acf0b07ee2bcb9cbb8f632f85f1f79ee43229 | /HopelessBastardsComponented/src/screenconverter/descriptors/RectangleDescriptor.java | e2f8b4c01414246456e7e4ae77bd61c29f3a9948 | [] | no_license | hopelessbastards/HopelessBastards | 57638bd5f23496ecb74f297e6247e40cfb36296e | 20b7265a8bdcc884f9f9668bbce937aaf63b4908 | refs/heads/master | 2020-12-25T14:48:08.762840 | 2016-08-10T09:56:47 | 2016-08-10T09:56:47 | 63,252,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package screenconverter.descriptors;
import java.awt.Color;
public class RectangleDescriptor extends DrawObjectDescriptor{
private int width;
private int height;
public RectangleDescriptor(int x, int y, double angle, int angleCenterPointX, int angleCenterPointY, int width,
int height,Color color,boolean draw) {
super(x, y, angle, angleCenterPointX, angleCenterPointY, color,draw);
this.width = width;
this.height = height;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
} | [
"viktor123@vipmail.hu"
] | viktor123@vipmail.hu |
9029782280c6c9d56ed447558ebd73153e76ddcd | bad30f1f8a34fb335f059f450c6732036eb3d5a7 | /src/main/java/com/parasoft/parabank/domain/LoanResponse.java | aa5d24bcfaf11c90f7952c2d35cd95e2fd258467 | [] | no_license | piczmar/parabank | dabe3632417ce8a548dab45f9697b066faf53637 | 0d96d26bb3cf7359c5b7d7bc0c431c7db79fa5bd | refs/heads/master | 2021-07-10T16:42:22.897560 | 2017-10-13T07:00:44 | 2017-10-13T07:00:44 | 105,659,460 | 0 | 2 | null | 2017-10-03T14:09:36 | 2017-10-03T14:09:35 | null | UTF-8 | Java | false | false | 3,683 | java | package com.parasoft.parabank.domain;
import java.text.*;
import java.util.*;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.*;
import com.google.gson.*;
import com.parasoft.parabank.util.*;
/**
* Domain object representing a loan application response
*/
@XmlRootElement(name="loanResponse" , namespace="http://service.parabank.parasoft.com/")
@XmlType(propOrder={"responseDate", "loanProviderName", "approved", "message", "accountId"})
public class LoanResponse {
private Date responseDate;
private String loanProviderName;
private boolean approved;
private String message;
private Integer accountId;
@XmlJavaTypeAdapter(DateTimeAdapter.class)
@XmlSchemaType(name = "dateTime")
public Date getResponseDate() {
return responseDate;
}
public void setResponseDate(Date responseDate) {
this.responseDate = responseDate;
}
@XmlElement(required=true)
public String getLoanProviderName() {
return loanProviderName;
}
public void setLoanProviderName(String loanProviderName) {
this.loanProviderName = loanProviderName;
}
public boolean isApproved() {
return approved;
}
public void setApproved(boolean approved) {
this.approved = approved;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getAccountId() {
return accountId;
}
public void setAccountId(Integer accountId) {
this.accountId = accountId;
}
public static LoanResponse readFrom(JsonObject json) throws ParseException {
LoanResponse response = new LoanResponse();
boolean approved = json.get("approved").getAsBoolean();
response.setApproved(approved);
if (approved) {
response.setAccountId(json.get("accountId").getAsInt());
} else {
response.setMessage(json.get("message").getAsString());
}
response.setLoanProviderName(json.get("loanProviderName").getAsString());
final String dt = json.get("responseDate").getAsString();
final Date date = DateTimeAdapter.dateFromString(dt);
response.setResponseDate(date);
return response;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (responseDate == null ? 0 : responseDate.hashCode());
result = prime * result + (loanProviderName == null ? 0 : loanProviderName.hashCode());
result = prime * result + (approved ? 1231 : 1237);
result = prime * result + (message == null ? 0 : message.hashCode());
result = prime * result + (accountId == null ? 0 : accountId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof LoanResponse)) {
return false;
}
LoanResponse other = (LoanResponse)obj;
return Util.equals(responseDate, other.responseDate) &&
Util.equals(loanProviderName, other.loanProviderName) &&
approved == other.approved &&
Util.equals(message, other.message) &&
Util.equals(accountId, other.accountId);
}
@Override
public String toString() {
return "LoanResponse [responseDate=" + responseDate
+ ", loanProviderName=" + loanProviderName + ", approved="
+ approved + ", message=" + message + ", accountId="
+ accountId + "]";
}
}
| [
"sang@parasoft.com"
] | sang@parasoft.com |
9406055b7cddf0ee8987f6a04a0085154be92bed | 76b0f07a26c7ba7c80f2d31db2d35f3f895858ec | /app/src/androidTest/java/cn/edu/ncist/ncistapkmarket/ExampleInstrumentedTest.java | 503c17ccc163871edc2f4b296bc92deba4ceabfa | [] | no_license | fazhongxu/NCISTApkMarket | 8c59005d371debc4ae347a785b66191291f076c8 | b99b06eb70d46a97d98ff753eb7d2adc01e2471a | refs/heads/master | 2020-12-02T05:23:32.207113 | 2017-07-11T13:59:17 | 2017-07-11T13:59:17 | 96,899,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package cn.edu.ncist.ncistapkmarket;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cn.edu.ncist.ncistapkmarket", appContext.getPackageName());
}
}
| [
"fazhongxu0914@163.com"
] | fazhongxu0914@163.com |
2aea578f72e10f0773e735ab68a57d14715db529 | 89e4e05f5d12a4aff3783758aaf9c44df79eca41 | /app/src/androidTest/java/com/zcj/weather/ExampleInstrumentedTest.java | a35fc61b2ed0804962106e6239c653bce6c76f81 | [] | no_license | wintterHub/weather | 75d04d89f57394c3c998a86f8cd33912ff7a2968 | 3e958639e32e003289a46d59d7d7fda141784f21 | refs/heads/master | 2020-04-04T00:32:56.792101 | 2018-11-01T03:39:09 | 2018-11-01T03:39:09 | 155,653,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.zcj.weather;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.zcj.weather", appContext.getPackageName());
}
}
| [
"zhaochangjin@zving.com"
] | zhaochangjin@zving.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.