blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
151c392c9e71de9508aa97deb3515a4a42cf6fdc | aad22755d19873889cd7ed3801d97ed10e891920 | /test/controller/ServerTest.java | 532c0e19d1af925126ac3410564c31ddb88d9fd5 | [
"Apache-2.0"
] | permissive | blernermhc/Bridge4Blind | 40e92a396cdd9cf4e57fec6e623228898e7e292c | decc31913b98cb6b62fa8508292714acd9a3eb7c | refs/heads/master | 2020-05-17T15:19:03.869735 | 2018-03-07T02:06:56 | 2018-03-07T02:06:56 | 30,430,982 | 1 | 1 | Apache-2.0 | 2018-07-01T19:34:56 | 2015-02-06T20:12:54 | Java | UTF-8 | Java | false | false | 1,977 | java | package controller;
import java.io.IOException;
import model.Card;
import model.CardDatabase;
import model.Direction;
import controller.AntennaHandler;
import controller.CardListener;
public class ServerTest extends AntennaHandler {
public ServerTest(CardDatabase cardDatabase) {
super(cardDatabase);
}
public void run()
{
try{
for (int i = 0; i < 1000; i++) {
// Works well!
// switchHand("N");
// switchHand("E");
// switchHand("S");
// switchHand("W");
// Following includes cycling to the id antenna
switchHand(Direction.NORTH);
Thread.sleep(200);
switchHand(Direction.EAST);
Thread.sleep(200);
switchHand(Direction.SOUTH);
Thread.sleep(200);
switchHand(Direction.WEST);
Thread.sleep(200);
}
quitServer();
in.close();
out.close();
requestSocket.close();
System.out.println("Everything is closed");
System.exit(0);
}
catch(IOException ioException){
System.err.println("Lost connection to the server!");
ioException.printStackTrace();
} catch (InterruptedException e) {
System.err.println("Antenna server was interrupted");
e.printStackTrace();
}
}
private void startNotifyingThread() {
new Thread(new Runnable() {
@Override
public void run() {
try {
byte[] messageRec = new byte[3000];
while (true) {
String message = requestCard(messageRec);
if (!message.startsWith("NOCARD")) {
System.out.println("Received " + message.substring(0, MESSAGE_LENGTH));
}
Thread.sleep(400);
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).start();
}
public static void main(String[] args) throws IOException{
// Client's antenna handler
ServerTest a = new ServerTest(new CardDatabase());
a.connect();
a.startNotifyingThread();
new Thread(a).start();
}
}
| [
"[email protected]"
] | |
0f5a4211e9443e5777f2f7d2040bfe79a03ff802 | de3eb812d5d91cbc5b81e852fc32e25e8dcca05f | /tags/5.0.4/Crux/src/core/org/cruxframework/crux/core/client/rpc/st/CruxSynchronizerTokenServiceAsync.java | 11ac6653562c9f993f98bbb4977ff71e2a3e60d4 | [] | no_license | svn2github/crux-framework | 7dd52a951587d4635112987301c88db23325c427 | 58bcb4821752b405a209cfc21fb83e3bf528727b | refs/heads/master | 2016-09-06T13:33:41.975737 | 2015-01-22T08:03:25 | 2015-01-22T08:03:25 | 13,135,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | /*
* Copyright 2011 cruxframework.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.cruxframework.crux.core.client.rpc.st;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* @author Thiago da Rosa de Bustamante
*
*/
public interface CruxSynchronizerTokenServiceAsync
{
void getSynchronizerToken(String methodFullSignature, AsyncCallback<String> callback);
}
| [
"[email protected]@a5d2bbaa-053c-11de-b17c-0f1ef23b492c"
] | [email protected]@a5d2bbaa-053c-11de-b17c-0f1ef23b492c |
d307c7faccf6f0bf52d750680fa69d2627fbed63 | 03d7066fcd00eed3298474e776b8a4eca53411c4 | /src/main/java/TestClass3.java | 1b2a965212b9dc4217e09328681b7ea6c39ab7b8 | [] | no_license | nevermore6264/SOF304_Lab7 | 2a1c6e49422a590efb769e22f05633b3e7b03df0 | 68c5bc417d8b14ef6b283a624083b2c55f265d1c | refs/heads/master | 2020-04-01T19:37:59.794096 | 2018-10-18T04:31:46 | 2018-10-18T04:31:46 | 153,563,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 191 | java | import org.testng.Assert;
import org.testng.annotations.Test;
public class TestClass3 {
@Test(groups = "mygroup")
public void d1() {
}
@Test
public void d2() {
}
}
| [
"[email protected]"
] | |
a6431b1cf1eb09d1dc9ec26d4c12f200255de6d3 | 949b52fbdd9a2d96ae419c2e8201f768390dd692 | /Android-Firebase-Notification-SourceCode/app/src/test/java/com/hellohasan/android_firebase_notification/ExampleUnitTest.java | 4a85c2c8dcc1aa2cfd348d8d03871bd2094da625 | [] | no_license | morristech/Android-Firebase-Notification-With-PHP-Backend | 3c9811046af5a41260bf917d860624f9acd59b02 | 7ac68161513fce0d89d8b10650a2126d3b0deca6 | refs/heads/master | 2020-04-16T07:14:46.166064 | 2017-04-04T09:09:12 | 2017-04-04T09:09:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.hellohasan.android_firebase_notification;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
5c1b30bac11461fbfc1458abce85b9a8be066c39 | 8c3c6722e567499ac9577433b9c00fbb4a94ff4f | /poo20204_201907515_vitor/src/aula11/salaaula/factory_method/mensagem/EmissorSMS.java | 024e26dbf6cf51d255f4fe9d9f4ff7ed036a554a | [] | no_license | vitorpedeo/POO_2020-4 | 37564c0700f760708d8df3c4e5b903516bb5f58e | baacca3acd0ceeb744c7933013c59c0df5f41429 | refs/heads/master | 2020-12-12T18:16:04.322040 | 2020-02-08T14:07:15 | 2020-02-08T14:07:15 | 234,195,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package aula11.salaaula.factory_method.mensagem;
public class EmissorSMS implements Emissor {
public void envia(String mensagem) {
System.out.println(mensagem);
System.out.println("Mensagem enviada por SMS!");
}
} | [
"[email protected]"
] | |
98ff230edab700a3c6937cbc5ff93191410a6efd | 603f7697fb026d0c31ee12f99f70a908873bb9f5 | /src/main/java/com/algaworks/socialbooks/services/excelptions/LivroNaoEncontradoException.java | 215fcd8629962be1849562d32fc41314d2cf6b57 | [] | no_license | murilloc/socialbooks | ef69f6c0cee000daa72cdf495ef0e143ad6e648b | a6dfb07b40e30efae742dbf0f3be3a026f49ac00 | refs/heads/master | 2022-12-28T05:08:17.884668 | 2019-12-11T00:10:28 | 2019-12-11T00:10:28 | 224,916,846 | 0 | 0 | null | 2022-12-10T05:50:20 | 2019-11-29T20:15:43 | Java | UTF-8 | Java | false | false | 388 | java | package com.algaworks.socialbooks.services.excelptions;
import net.bytebuddy.implementation.bytecode.Throw;
public class LivroNaoEncontradoException extends RuntimeException {
public LivroNaoEncontradoException(String mensagem) {
super(mensagem);
}
public LivroNaoEncontradoException(String mensagem, Throwable causa) {
super(mensagem, causa);
}
}
| [
"[email protected]"
] | |
318c8170ad91ca87aa3a9267fe69398ed9bb06d4 | 3d521ab5e3207241877d54e387632fc0d2055e7b | /ch13_ex1_NameParser/src/Console.java | bd614c25e50e06d543d461434e9f1db9254e8b84 | [] | no_license | Jeff-Peters513/java_instruction | ea8f78641d7d0076558b78dde87e241564339e8c | 8886bbf6af05addb9a20bc4a13218ede6faba617 | refs/heads/master | 2022-03-31T20:31:01.742989 | 2022-03-30T19:49:24 | 2022-03-30T19:49:24 | 249,800,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,292 | java |
import java.util.Scanner;
public class Console {
private static Scanner sc = new Scanner(System.in);
public static String getString(String prompt) {
return getString(prompt, false);
}
public static String getString(String prompt, boolean isRequired) {
String s = "";
boolean isValid = false;
while (!isValid) {
System.out.print(prompt);
s = sc.nextLine();
if (isRequired && s.equals("")) {
System.out.println("Error! This entry is required. Try again.");
} else {
isValid = true;
}
}
return s;
}
public static String getString(String prompt, String s1, String s2) {
String s = "";
boolean isValid = false;
while (!isValid) {
s = getString(prompt, true);
if (!s.equalsIgnoreCase(s1) && !s.equalsIgnoreCase(s2)) {
System.out.println("Error! Entry must be '" + s1 + "' or '" +
s2 + "'. Try again.");
} else {
isValid = true;
}
}
return s;
}
public static int getInt(String prompt) {
int i = 0;
boolean isValid = false;
while (!isValid) {
System.out.print(prompt);
if (sc.hasNextInt()) {
i = sc.nextInt();
isValid = true;
} else {
System.out.println("Error! Invalid integer. Try again.");
}
sc.nextLine(); // discard any other data entered on the line
}
return i;
}
public static int getInt(String prompt, int min, int max) {
int i = 0;
boolean isValid = false;
while (!isValid) {
i = getInt(prompt);
if (i <= min) {
System.out.println(
"Error! Number must be greater than " + min + ".");
} else if (i >= max) {
System.out.println(
"Error! Number must be less than " + max + ".");
} else {
isValid = true;
}
}
return i;
}
public static double getDouble(String prompt) {
double d = 0;
boolean isValid = false;
while (!isValid) {
System.out.print(prompt);
if (sc.hasNextDouble()) {
d = sc.nextDouble();
isValid = true;
} else {
System.out.println("Error! Invalid number. Try again.");
}
sc.nextLine(); // discard any other data entered on the line
}
return d;
}
public static double getDouble(String prompt, double min, double max) {
double d = 0;
boolean isValid = false;
while (!isValid) {
d = getDouble(prompt);
if (d <= min) {
System.out.println(
"Error! Number must be greater than " + min + ".");
} else if (d >= max) {
System.out.println(
"Error! Number must be less than " + max + ".");
} else {
isValid = true;
}
}
return d;
}
}
| [
"[email protected]"
] | |
a6aea0343cab8fdebc2859e6a9a2226ecc3ea5df | 379c8c1dda9e07cdd23c75e1a70ad73c669a7c75 | /src/main/java/ru/systemoteh/resume/repository/storage/CourseRepository.java | 1a96598452186623d053fa252503fca9800cfd9e | [] | no_license | systemoteh/resume | caf0596daf3a77028e0053d44c4a9c9a246e2a38 | 09d033f62812c32cfcb822a2c91e85bfe1d36cb4 | refs/heads/master | 2022-12-21T14:29:23.088074 | 2020-04-13T11:27:44 | 2020-04-13T11:27:44 | 184,400,857 | 1 | 0 | null | 2022-12-16T07:25:47 | 2019-05-01T10:29:22 | JavaScript | UTF-8 | Java | false | false | 180 | java | package ru.systemoteh.resume.repository.storage;
import ru.systemoteh.resume.domain.Course;
public interface CourseRepository extends AbstractProfileEntityRepository<Course> {
}
| [
"[email protected]"
] | |
c2fcaf20e9819cf9fb2826b5efe303590dd643fd | daea1f5b7eb738ddb03cda63d3119d329b5abf8f | /android/app/src/main/java/com/janna/MainApplication.java | 661a86333276c2b5b0feb40742d69c094a5d73dc | [] | no_license | LimCharles/Janna | 3e0c39ee5f0dc9866a03d83efd63f34e284b1e2e | a7b83299e3d13e4a399493694f6f7aa2fc9629f5 | refs/heads/master | 2023-04-02T13:27:57.864209 | 2021-04-10T08:52:21 | 2021-04-10T08:52:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,769 | java | package com.janna;
import android.app.Application;
import android.content.Context;
import android.net.Uri;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.janna.generated.BasePackageList;
import org.unimodules.adapters.react.ReactAdapterPackage;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.Package;
import org.unimodules.core.interfaces.SingletonModule;
import expo.modules.constants.ConstantsPackage;
import expo.modules.permissions.PermissionsPackage;
import expo.modules.filesystem.FileSystemPackage;
import expo.modules.updates.UpdatesController;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
new BasePackageList().getPackageList()
);
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected @Nullable String getJSBundleFile() {
if (BuildConfig.DEBUG) {
return super.getJSBundleFile();
} else {
return UpdatesController.getInstance().getLaunchAssetFile();
}
}
@Override
protected @Nullable String getBundleAssetName() {
if (BuildConfig.DEBUG) {
return super.getBundleAssetName();
} else {
return UpdatesController.getInstance().getBundleAssetName();
}
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
if (!BuildConfig.DEBUG) {
UpdatesController.initialize(this);
}
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.janna.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
47c7877dd17dba268efaeca6ab82eb6d5298958d | dfb542bc0c2657f43405463a5775cdeb1ae913de | /src/test/java/com/inetbanking/pageObjects/LoginPage.java | 854114923a545980c5dcbfe4c226bb11013908e7 | [] | no_license | abhyanandmauar/inetBanking | fb6eb12d4752133a485c3fda9f9fcd86dadebd91 | 9ef4e0e751df8304afab3ae79cc01f30a2698d13 | refs/heads/master | 2023-05-12T07:11:34.997323 | 2021-06-02T11:22:41 | 2021-06-02T11:22:41 | 367,854,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 885 | java | package com.inetbanking.pageObjects;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class LoginPage {
WebDriver ldriver;
public LoginPage(WebDriver rdriver) {
ldriver = rdriver;
PageFactory.initElements(rdriver, this);
}
@FindBy(name="uid")
WebElement txtUserName;
@FindBy(name="password")
WebElement txtPassword;
@FindBy(name="btnLogin")
WebElement btnLogin;
@FindBy(xpath="/html[1]/body[1]/div[3]/div[1]/ul[1]/li[15]/a[1]")
WebElement lnkLogout;
public void setUserName(String uname) {
txtUserName.sendKeys(uname);
}
public void setPassword(String pwd) {
txtPassword.sendKeys(pwd);
}
public void clickSubmit() {
btnLogin.click();
}
public void clickLogout() {
lnkLogout.click();
}
}
| [
"[email protected]"
] | |
feb5c65f03c06139c0d3774fd339a7d075695046 | bef66c2698241c9e06fdc6a4aae8010aa1a685e9 | /untitled2/src/main/java/com/jhx/demo/web/WebTest.java | de758fb095eac5e9590e8dd7b91090021c8ec3a9 | [] | no_license | iosyyy/springcloud | fbb141ab005e72015c3a0a04eac23dc3bfa646d9 | a9d0e816b2ded5cb61ba26d964897d398e766ee8 | refs/heads/master | 2023-04-04T01:45:42.815999 | 2021-03-30T03:06:33 | 2021-03-30T03:06:33 | 351,043,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.jhx.demo.web;
import com.jhx.demo.dao.MyTbMapper;
import com.jhx.demo.po.MyTb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author 靖鸿宣
* @since 2021/2/14
*/
@RestController
public class WebTest {
@Autowired
MyTbMapper mapper;
@GetMapping("/name")
public List<MyTb> myTb()
{
return mapper.selectByPrimaryKey(110);
}
}
| [
"[email protected]"
] | |
beded7ac331cbf43881a59ba97c69d69da548d8c | 92b5db70d341c44bb163626961a61c179cc77d9f | /MaskLibs/maskcommons/src/main/java/de/frederickerber/maskcommons/LowPassFilter.java | c78dae11edba2131ae4ea53fcaac1869eeab1e1e | [] | no_license | fkerber/MASK | 25da05efdb0031218b27eedc102f7dec67629697 | 693a563880fb0cc1134b70f1de45723b4987e0f0 | refs/heads/master | 2021-06-18T20:29:42.559909 | 2021-01-25T00:08:45 | 2021-01-25T00:08:45 | 138,095,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,282 | java | package de.frederickerber.maskcommons;
/**
* A low-pass filter for n-dimensional data represented in a n-length float array.
* Use this to e.g. filter accelerometer readings depending on previous readings.
*
* @see <a href="https://en.wikipedia.org/wiki/Low-pass_filter#Algorithmic_implementation">Wikipedia article</a>
* @see <a href="https://developer.android.com/reference/android/hardware/SensorEvent.html#values">Android documentation</a>
*/
public class LowPassFilter extends Filter {
private float alpha;
private float[] prevReading;
private boolean init = false;
/**
* Initialize this filter with the desired smoothing factor, alpha. 0 <= alpha <= 1
* For choosing alpha, refer to the wikipedia article.
*
* @param initParams A float array containing the smoothing factor at index 0;
* @see <a href="https://en.wikipedia.org/wiki/Low-pass_filter#Algorithmic_implementation">Wikipedia article</a>
*/
@Override
public void init(float... initParams) {
if (initParams == null || initParams.length < 1) {
throw new IllegalArgumentException("provide alpha");
}
alpha = initParams[0];
init = true;
}
/**
* @param data A new n-dimensional sensor reading. You may not change dimensionality after the first call.
* @return A float array of length n representing the n-dimensional filtered input.
* @see <a href="https://developer.android.com/reference/android/hardware/SensorEvent.html#values">Android documentation</a>
*/
@Override
public float[] apply(float... data) {
if (!init) {
throw new IllegalStateException("initialize the filter first");
}
if (data == null) {
throw new IllegalArgumentException("argument may not be null");
}
if (prevReading != null && prevReading.length != data.length) {
throw new IllegalArgumentException("data dimension may not change");
}
if (prevReading == null) {
prevReading = data;
return prevReading;
}
for (int i = 0; i < data.length; i++) {
prevReading[i] = prevReading[i] + alpha * (data[i] - prevReading[i]);
}
return prevReading;
}
}
| [
"[email protected]"
] | |
d328aafe2211a0826e7dbc62a3ff20107c6cb030 | b8ac55387fe0909e793cd15d8f3d983dbb122183 | /placementcelladmin/src/main/java/com/akhil/placementcelladmin/helper/AppConstant.java | f7a4b14e23918959f84cc01d4445051b4f62b7e2 | [
"Apache-2.0"
] | permissive | akhilbattula/Placement-Cell-Project | 5314c0d3889421b6e6aa2d72a5dfc6d641968ee7 | 262d9f100dc33bf479b8b610f233995f10931497 | refs/heads/master | 2020-05-31T01:46:28.430871 | 2019-06-03T19:45:16 | 2019-06-03T19:45:16 | 190,056,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | package com.akhil.placementcelladmin.helper;
import java.util.Arrays;
import java.util.List;
public class AppConstant {
// Number of columns of Grid View
public static final int NUM_OF_COLUMNS = 3;
// Gridview image padding
public static final int GRID_PADDING = 8; // in dp
// SD card image directory
public static final String PHOTO_ALBUM = "NAT";
// supported file formats
public static final List<String> FILE_EXTN = Arrays.asList("jpg", "jpeg",
"png");
}
| [
"[email protected]"
] | |
aed520d72e0725e81474ba515e1e45b541296b8f | ebef376b1dcc156dbac25143a1bb2cfbff2d185c | /collect-server/src/main/java/org/openforis/collect/designer/viewmodel/CodeListsVM.java | b32d00c188a4c8bc2e60aad3db815f88d975e510 | [
"MIT"
] | permissive | infperu/collect | 03399649f94a400e47c539a4a35934231ce5f9e0 | 1a33e438b70843428f35c6e116e1b3a7f30ab179 | refs/heads/master | 2020-12-30T19:44:53.041095 | 2014-11-24T15:08:38 | 2014-11-24T15:08:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,901 | java | /**
*
*/
package org.openforis.collect.designer.viewmodel;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.openforis.collect.designer.form.CodeListFormObject;
import org.openforis.collect.designer.form.CodeListFormObject.Type;
import org.openforis.collect.designer.form.FormObject;
import org.openforis.collect.designer.form.validator.BaseValidator;
import org.openforis.collect.designer.session.SessionStatus;
import org.openforis.collect.designer.util.ComponentUtil;
import org.openforis.collect.designer.util.MessageUtil;
import org.openforis.collect.designer.util.MessageUtil.ConfirmHandler;
import org.openforis.collect.designer.util.Resources;
import org.openforis.collect.designer.viewmodel.referencedata.ReferenceDataImportErrorPopUpVM;
import org.openforis.collect.io.metadata.codelist.CodeListBatchExportJob;
import org.openforis.collect.io.metadata.codelist.CodeListBatchImportJob;
import org.openforis.collect.io.metadata.codelist.CodeListImportTask;
import org.openforis.collect.manager.CodeListManager;
import org.openforis.collect.manager.SurveyManager;
import org.openforis.collect.manager.dataexport.codelist.CodeListExportProcess;
import org.openforis.collect.model.CollectSurvey;
import org.openforis.commons.collection.CollectionUtils;
import org.openforis.commons.io.OpenForisIOUtils;
import org.openforis.concurrency.Job;
import org.openforis.concurrency.spring.SpringJobManager;
import org.openforis.idm.metamodel.CodeAttributeDefinition;
import org.openforis.idm.metamodel.CodeList;
import org.openforis.idm.metamodel.CodeList.CodeScope;
import org.openforis.idm.metamodel.CodeListItem;
import org.openforis.idm.metamodel.CodeListLevel;
import org.openforis.idm.metamodel.EntityDefinition;
import org.openforis.idm.metamodel.NodeDefinition;
import org.openforis.idm.metamodel.PersistedCodeListItem;
import org.openforis.idm.metamodel.Schema;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.Binder;
import org.zkoss.bind.ValidationContext;
import org.zkoss.bind.Validator;
import org.zkoss.bind.annotation.AfterCompose;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.bind.annotation.DependsOn;
import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.util.media.Media;
import org.zkoss.util.resource.Labels;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.DropEvent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zk.ui.select.annotation.VariableResolver;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Filedownload;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Window;
/**
*
* @author S. Ricci
*
*/
@VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)
public class CodeListsVM extends SurveyObjectBaseVM<CodeList> {
public static final String EDITING_ATTRIBUTE_PARAM = "editingAttribute";
public static final String SELECTED_CODE_LIST_PARAM = "selectedCodeList";
private static final String CODE_LISTS_UPDATED_GLOBAL_COMMAND = "codeListsUpdated";
private static final String SURVEY_CODE_LIST_GENERATED_LEVEL_NAME_LABEL_KEY = "survey.code_list.generated_level_name";
public static final String CLOSE_CODE_LIST_ITEM_POP_UP_COMMAND = "closeCodeListItemPopUp";
public static final String CLOSE_CODE_LIST_IMPORT_POP_UP_COMMAND = "closeCodeListImportPopUp";
private static final String CSV_CONTENT_TYPE = "text/csv";
private List<List<CodeListItem>> itemsPerLevel;
private boolean newChildItem;
private CodeListItem editedChildItem;
private CodeListItem editedChildItemParentItem;
private int editedChildItemLevelIndex;
private List<CodeListItem> selectedItemsPerLevel;
private Window codeListItemPopUp;
private Window referencedNodesPopUp;
private Window codeListImportPopUp;
private boolean editingAttribute;
@WireVariable
private SurveyManager surveyManager;
@WireVariable
private CodeListManager codeListManager;
@WireVariable
private SpringJobManager springJobManager;
private Window jobStatusPopUp;
private CodeListBatchExportJob batchExportJob;
private CodeListBatchImportJob batchImportJob;
private Window dataImportErrorPopUp;
public CodeListsVM() {
super();
formObject = createFormObject();
fieldLabelKeyPrefixes.addAll(0, Arrays.asList("survey.code_list"));
}
@Init(superclass=false)
public void init(@ExecutionArgParam(EDITING_ATTRIBUTE_PARAM) Boolean editingAttribute,
@ExecutionArgParam(SELECTED_CODE_LIST_PARAM) CodeList selectedCodeList) {
super.init();
if ( selectedCodeList != null ) {
selectionChanged(selectedCodeList);
}
this.editingAttribute = editingAttribute != null && editingAttribute.booleanValue();
}
@Override
@AfterCompose
public void doAfterCompose(@ContextParam(ContextType.VIEW) Component view){
super.doAfterCompose(view);
}
@Override
protected List<CodeList> getItemsInternal() {
CollectSurvey survey = getSurvey();
List<CodeList> codeLists = survey.getCodeLists(false);
codeLists = sort(codeLists);
return codeLists;
}
@Override
protected void addNewItemToSurvey() {
CollectSurvey survey = getSurvey();
survey.addCodeList(editedItem);
dispatchCodeListsUpdatedCommand();
dispatchSurveySaveCommand();
initItemsPerLevel();
notifyChange("itemsPerLevel");
}
@Override
protected void deleteItemFromSurvey(CodeList item) {
codeListManager.delete(item);
dispatchCodeListsUpdatedCommand();
dispatchSurveySaveCommand();
}
@Override
protected FormObject<CodeList> createFormObject() {
return new CodeListFormObject();
}
protected void dispatchCodeListsUpdatedCommand() {
BindUtils.postGlobalCommand(null, null, CODE_LISTS_UPDATED_GLOBAL_COMMAND, null);
}
protected void dispatchSurveySaveCommand() {
BindUtils.postGlobalCommand(null, null, SurveyEditVM.BACKGROUD_SAVE_GLOBAL_COMMAND, null);
}
@Command
@Override
protected void performNewItemCreation(Binder binder) {
super.performNewItemCreation(binder);
notifyChange("listLevels","itemsPerLevel","selectedItemsPerLevel");
}
@Override
protected CodeList createItemInstance() {
CodeList instance = survey.createCodeList();
instance.setCodeScope(CodeScope.LOCAL);
return instance;
}
@Override
protected void performItemSelection(CodeList item) {
super.performItemSelection(item);
notifyChange("listLevels","itemsPerLevel","selectedItemsPerLevel");
}
@Override
protected void moveSelectedItemInSurvey(int indexTo) {
survey.moveCodeList(selectedItem, indexTo);
}
@Override
@Command
public void deleteItem(@BindingParam("item") final CodeList item) {
List<NodeDefinition> references = getReferences(item);
if ( ! references.isEmpty() ) {
String title = Labels.getLabel("global.message.title.warning");
String message = Labels.getLabel("survey.code_list.alert.cannot_delete_used_list");
referencedNodesPopUp = SurveyErrorsPopUpVM.openPopUp(title, message,
references, new MessageUtil.ConfirmHandler() {
@Override
public void onOk() {
closeReferencedNodesPopUp();
}
}, true);
} else {
super.deleteItem(item);
}
}
protected void closeReferencedNodesPopUp() {
closePopUp(referencedNodesPopUp);
referencedNodesPopUp = null;
}
protected List<NodeDefinition> getReferences(CodeList item) {
List<NodeDefinition> references = new ArrayList<NodeDefinition>();
Schema schema = survey.getSchema();
List<EntityDefinition> rootEntities = schema.getRootEntityDefinitions();
Stack<NodeDefinition> stack = new Stack<NodeDefinition>();
stack.addAll(rootEntities);
while ( ! stack.isEmpty() ) {
NodeDefinition defn = stack.pop();
if ( defn instanceof EntityDefinition ) {
stack.addAll(((EntityDefinition) defn).getChildDefinitions());
} else if ( defn instanceof CodeAttributeDefinition ) {
CodeList list = ((CodeAttributeDefinition) defn).getList();
if ( list.equals(item) ) {
references.add(defn);
}
};
}
return references;
}
@Command
public void typeChanged(@BindingParam("type") String type) {
Type typeEnum = CodeListFormObject.Type.valueOf(type);
switch (typeEnum) {
case HIERARCHICAL:
addLevel();
break;
default:
editedItem.removeLevel(0);
}
CodeListFormObject fo = (CodeListFormObject) formObject;
fo.setType(type);
notifyChange("formObject","listLevels");
}
@Command
@NotifyChange({"listLevels"})
public void addLevel() {
List<CodeListLevel> levels = editedItem.getHierarchy();
int levelPosition = levels.size() + 1;
CodeListLevel level = new CodeListLevel();
String generatedName = Labels.getLabel(SURVEY_CODE_LIST_GENERATED_LEVEL_NAME_LABEL_KEY, new Object[]{levelPosition});
level.setName(generatedName);
editedItem.addLevel(level);
}
@Command
public void removeLevel() {
final List<CodeListLevel> levels = editedItem.getHierarchy();
if ( ! levels.isEmpty() ) {
final int levelIndex = levels.size() - 1;
if ( codeListManager.hasChildItemsInLevel(editedItem, levelIndex + 1) ) {
ConfirmHandler handler = new ConfirmHandler() {
@Override
public void onOk() {
performRemoveLevel(levelIndex);
}
};
MessageUtil.ConfirmParams params = new MessageUtil.ConfirmParams(handler, "survey.code_list.alert.cannot_delete_non_empty_level");
params.setOkLabelKey("global.delete_item");
MessageUtil.showConfirm(params);
} else {
performRemoveLevel(levelIndex);
}
}
}
public String getHierarchyLevelNameValidationKey(int levelIdx) {
return "hiearchyLevelName_" + levelIdx;
}
public Validator getHierarchyLevelNameValidator(final int levelIdx) {
return new BaseValidator() {
@Override
public void validate(ValidationContext ctx) {
String validationKey = getHierarchyLevelNameValidationKey(levelIdx);
if ( validateRequired(ctx, null, validationKey) ) {
validateInternalName(ctx, null, validationKey);
}
}
};
}
protected void performRemoveLevel(int levelIndex) {
codeListManager.removeLevel(editedItem, levelIndex + 1);
deselectItemsAfterLevel(levelIndex);
initItemsPerLevel();
notifyChange("listLevels","selectedItemsPerLevel","itemsPerLevel");
}
@Command
@NotifyChange({"itemsPerLevel"})
public void addItemInLevel(@BindingParam("levelIndex") int levelIndex) {
if ( checkCanLeaveForm() ) {
newChildItem = true;
editedChildItemLevelIndex = levelIndex;
editedChildItem = createChildItem();
if ( editedChildItemLevelIndex == 0 ) {
editedChildItemParentItem = null;
} else {
editedChildItemParentItem = selectedItemsPerLevel.get(editedChildItemLevelIndex - 1);
}
openChildItemEditPopUp();
}
}
protected CodeListItem createChildItem() {
if ( editedItem.isExternal() ) {
throw new UnsupportedOperationException("Cannot instantiate ExternalCodeListItem object");
} else if ( editedItem.isEmpty() ) {
return new PersistedCodeListItem(editedItem, editedChildItemLevelIndex + 1);
} else {
return editedItem.createItem(editedChildItemLevelIndex + 1);
}
}
@Command
@NotifyChange({"itemsPerLevel"})
public void deleteCodeListItem(@BindingParam("item") final CodeListItem item) {
if ( isSurveyPublished() && isEnumeratingCodeList() ) {
MessageUtil.showWarning("survey.code_list.cannot_delete_enumerating_code_list_items");
} else {
String messageKey;
if ( codeListManager.hasChildItems(item) ) {
messageKey = "survey.code_list.confirm.delete_non_empty_item";
} else {
messageKey = "survey.code_list.confirm.delete_item";
}
MessageUtil.ConfirmParams params = new MessageUtil.ConfirmParams(new MessageUtil.ConfirmHandler() {
@Override
public void onOk() {
performDeleteCodeListItem(item);
}
}, messageKey);
params.setOkLabelKey("global.delete_item");
MessageUtil.showConfirm(params);
}
}
protected boolean isEnumeratingCodeList() {
return editedItem.isEnumeratingList();
}
protected void performDeleteCodeListItem(CodeListItem item) {
boolean selected = isCodeListItemSelected(item);
int itemLevelIndex = getLevelIndex(item);
codeListManager.delete(item);
if ( selected ) {
deselectItemsAfterLevel(itemLevelIndex);
}
initItemsPerLevel();
notifyChange("itemsPerLevel","selectedItemsPerLevel");
BindUtils.postNotifyChange(null, null, editedItem, ".");
}
@Command
public void moveChildItem(@ContextParam(ContextType.TRIGGER_EVENT) DropEvent event) {
Listitem dragged = (Listitem) event.getDragged();
Listitem dropped = (Listitem) event.getTarget();
CodeListItem draggedItem = dragged.getValue();
CodeListItem droppedItem = dropped.getValue();
int indexTo = getItemIndex(droppedItem);
moveChildItem(draggedItem, indexTo);
}
@Override
public void setEditedItem(CodeList editedItem) {
super.setEditedItem(editedItem);
selectedItemsPerLevel = new ArrayList<CodeListItem>();
initItemsPerLevel();
}
@Command
public void editCodeListItem(@BindingParam("item") CodeListItem item) {
newChildItem = false;
editedChildItem = item;
editedChildItemParentItem = codeListManager.loadParentItem(item);
openChildItemEditPopUp();
}
@Command
public void batchImportFileUploaded(@ContextParam(ContextType.TRIGGER_EVENT) UploadEvent event) {
Media media = event.getMedia();
String fileName = media.getName();
String extension = FilenameUtils.getExtension(fileName);
File tempFile = OpenForisIOUtils.copyToTempFile(media.getStreamData(), extension);
batchImportJob = new CodeListBatchImportJob();
batchImportJob.setJobManager(springJobManager);
batchImportJob.setCodeListManager(codeListManager);
batchImportJob.setSurvey(survey);
batchImportJob.setOverwriteData(true);
batchImportJob.setFile(tempFile);
springJobManager.start(batchImportJob);
jobStatusPopUp = JobStatusPopUpVM.openPopUp(Labels.getLabel("survey.code_list.batch_import"), batchImportJob, true);
}
@Command
public void batchExport() {
batchExportJob = new CodeListBatchExportJob();
batchExportJob.setJobManager(springJobManager);
batchExportJob.setCodeListManager(codeListManager);
batchExportJob.setSurvey(survey);
springJobManager.start(batchExportJob);
jobStatusPopUp = JobStatusPopUpVM.openPopUp(Labels.getLabel("survey.code_list.batch_export"), batchExportJob, true);
}
protected void closeJobStatusPopUp() {
closePopUp(jobStatusPopUp);
jobStatusPopUp = null;
}
@GlobalCommand
public void jobAborted(@BindingParam("job") Job job) {
closeJobStatusPopUp();
clearJob(job);
}
@GlobalCommand
public void jobFailed(@BindingParam("job") Job job) {
closeJobStatusPopUp();
if (job instanceof CodeListBatchImportJob && job.getCurrentTask() != null) {
CodeListImportTask lastTask = (CodeListImportTask) ((CodeListBatchImportJob) job).getCurrentTask();
dataImportErrorPopUp = ReferenceDataImportErrorPopUpVM.showPopUp(lastTask.getErrors(),
Labels.getLabel("survey.code_list.import_data.error_popup.title", new String[]{lastTask.getEntryName()}));
} else {
String errorMessageKey = job.getErrorMessage();
String errorMessage = StringUtils.defaultIfBlank(Labels.getLabel(errorMessageKey), errorMessageKey);
MessageUtil.showError("global.job_status.failed.message", new String[]{errorMessage});
}
clearJob(job);
}
@GlobalCommand
public void jobCompleted(@BindingParam("job") Job job) {
closeJobStatusPopUp();
if (job == batchExportJob) {
downloadFile(batchExportJob.getOutputFile(), survey.getName() + "_code_lists.zip");
} else if (job == batchImportJob) {
notifyChange("items");
}
clearJob(job);
}
private void downloadFile(File file, String fileName) {
try {
Filedownload.save(new FileInputStream(file), "application/zip", fileName);
} catch(Exception e) {
throw new RuntimeException(e);
}
}
private void clearJob(Job job) {
if (job == batchExportJob) {
batchExportJob = null;
} else if (job == batchImportJob) {
batchImportJob = null;
}
}
protected String generateItemCode(CodeListItem item) {
return "item_" + item.getId();
}
public void openChildItemEditPopUp() {
Map<String, Object> args = new HashMap<String, Object>();
args.put(CodeListItemVM.ITEM_ARG, editedChildItem);
args.put(CodeListItemVM.PARENT_ITEM_ARG, editedChildItemParentItem);
args.put(CodeListItemVM.ENUMERATING_CODE_LIST_ARG, isSurveyPublished() && isEnumeratingCodeList());
codeListItemPopUp = openPopUp(Resources.Component.CODE_LIST_ITEM_EDIT_POP_UP.getLocation(), true, args);
Binder binder = ComponentUtil.getBinder(codeListItemPopUp);
validateForm(binder);
}
@Command
@NotifyChange({"itemsPerLevel","selectedItemsPerLevel"})
public void listItemSelected(@BindingParam("item") CodeListItem item,
@BindingParam("levelIndex") int levelIndex) {
deselectItemsAfterLevel(levelIndex);
selectedItemsPerLevel.add(item);
initItemsPerLevel();
}
@DependsOn("listLevels")
public boolean isMultipleLevelsPresent() {
if ( editedItem != null ) {
return editedItem.getHierarchy().size() > 1;
} else {
return false;
}
}
protected void deselectItemsAfterLevel(int levelIndex) {
int maxSelectedLevelIndex = selectedItemsPerLevel.size() - 1;
for (int i = maxSelectedLevelIndex; i >= levelIndex; i --) {
selectedItemsPerLevel.remove(i);
}
}
protected void moveChildItem(CodeListItem item, int toIndex) {
codeListManager.shiftItem(item, toIndex);
int levelIdx = getLevelIndex(item);
List<CodeListItem> siblings = itemsPerLevel.get(levelIdx);
CollectionUtils.shiftItem(siblings, item, toIndex);
itemsPerLevel.set(levelIdx, siblings);
if ( item instanceof PersistedCodeListItem ) {
reloadSiblingsSortOrder((PersistedCodeListItem) item);
}
notifyChange("itemsPerLevel");
}
/**
* Reloads the siblings from the database.
* The sort order of these items changes after calling codeListManager.shiftItem method.
*
* @param item
*/
protected void reloadSiblingsSortOrder(PersistedCodeListItem item) {
int levelIdx = getLevelIndex(item);
List<CodeListItem> newItems;
if ( levelIdx == 0 ) {
newItems = codeListManager.loadRootItems(item.getCodeList());
} else {
CodeListItem parentItem = codeListManager.loadParentItem(item);
newItems = codeListManager.loadChildItems(parentItem);
}
List<CodeListItem> items = itemsPerLevel.get(levelIdx);
for(int i=0; i < items.size(); i++) {
CodeListItem oldItem = items.get(i);
CodeListItem newItem = newItems.get(i);
((PersistedCodeListItem) oldItem).setSortOrder(((PersistedCodeListItem) newItem).getSortOrder());
}
}
protected int getLevelIndex(CodeListItem item) {
for ( int index = 0; index < itemsPerLevel.size(); index++) {
List<CodeListItem> items = itemsPerLevel.get(index);
if ( items.contains(item) ) {
return index;
}
}
throw new IllegalArgumentException("Item not found in cache");
}
protected List<CodeListItem> getSiblings(CodeListItem item) {
int levelIdx = getLevelIndex(item);
List<CodeListItem> siblings = itemsPerLevel.get(levelIdx);
return siblings;
}
protected int getItemIndex(CodeListItem item) {
List<CodeListItem> siblings = getSiblings(item);
int index = siblings.indexOf(item);
return index;
}
@GlobalCommand
public void closeCodeListItemPopUp(@BindingParam("undoChanges") boolean undoChanges) {
closePopUp(codeListItemPopUp);
codeListItemPopUp = null;
if ( undoChanges ) {
dispatchCurrentFormValidatedCommand(true);
} else {
if ( newChildItem ) {
addChildItemToCodeList();
} else {
dispatchSurveySaveCommand();
if ( editedChildItem instanceof PersistedCodeListItem ) {
codeListManager.save((PersistedCodeListItem) editedChildItem);
}
BindUtils.postNotifyChange(null, null, editedChildItem, "*");
}
}
}
@Override
public void commitChanges() {
super.commitChanges();
dispatchCodeListsUpdatedCommand();
}
@Command
public void openCodeListImportPopUp() {
if ( canImportCodeList() ) {
Map<String, Object> args = new HashMap<String, Object>();
args.put("codeListId", editedItem.getId());
codeListImportPopUp = openPopUp(Resources.Component.CODE_LIST_IMPORT_POPUP.getLocation(), true, args);
} else if ( editedItem.isExternal() ) {
MessageUtil.showWarning("survey.code_list.cannot_import_items_on_external_code_list");
} else {
MessageUtil.showWarning("survey.code_list.cannot_import_items_on_enumerating_code_list");
}
}
@Command
public void exportCodeList() throws IOException {
CollectSurvey survey = getSurvey();
CodeListExportProcess codeListExportProcess = new CodeListExportProcess(codeListManager);
File tempFile = File.createTempFile("code_list_" + editedItem.getName(), ".csv");
FileOutputStream os = new FileOutputStream(tempFile);
codeListExportProcess.exportToCSV(os, survey, editedItem.getId());
Filedownload.save(tempFile, CSV_CONTENT_TYPE);
}
@GlobalCommand
public void closeReferenceDataImportErrorPopUp() {
closePopUp(dataImportErrorPopUp);
dataImportErrorPopUp = null;
}
protected boolean canImportCodeList() {
return ! editedItem.isExternal() && ! isUsedAsEnumeratorInPublishedSurvey();
}
private boolean isUsedAsEnumeratorInPublishedSurvey() {
return isSurveyPublished() && isEnumeratingCodeList() && isCodeListInPublishedSurvey();
}
protected boolean isCodeListInPublishedSurvey() {
SessionStatus sessionStatus = getSessionStatus();
Integer publishedSurveyId = sessionStatus.getPublishedSurveyId();
if ( publishedSurveyId != null ) {
CollectSurvey publishedSurvey = surveyManager.getById(publishedSurveyId);
CodeList oldPublishedCodeList = publishedSurvey.getCodeListById(editedItem.getId());
return oldPublishedCodeList != null;
} else {
return false;
}
}
@GlobalCommand
public void closeCodeListImportPopUp() {
closePopUp(codeListImportPopUp);
codeListImportPopUp = null;
if ( editedItem != null ) {
boolean hasMultipleLevels = editedItem.getHierarchy().size() > 1;
Type type = hasMultipleLevels ? Type.HIERARCHICAL: Type.FLAT;
CodeListFormObject fo = (CodeListFormObject) formObject;
fo.setType(type.name());
selectedItemsPerLevel = new ArrayList<CodeListItem>();
initItemsPerLevel();
notifyChange("formObject","listLevels","selectedItemsPerLevel");
}
}
@GlobalCommand
public void closeCodeListsManagerPopUp() {
resetEditedItem();
notifyChange("items");
}
private void addChildItemToCodeList() {
if ( editedItem.isEmpty() && isSurveyStored() ) {
//persist item in db
PersistedCodeListItem persistedChildItem = (PersistedCodeListItem) editedChildItem;
if ( editedChildItemParentItem != null ) {
persistedChildItem.setParentId(((PersistedCodeListItem) editedChildItemParentItem).getSystemId());
}
codeListManager.save(persistedChildItem);
dispatchSurveySaveCommand();
} else if ( editedChildItemParentItem == null ) {
//add item among the root items
editedItem.addItem(editedChildItem);
} else {
//add item as a child of the edited parent item in the code list
editedChildItemParentItem.addChildItem(editedChildItem);
}
List<CodeListItem> itemsForCurrentLevel = itemsPerLevel.get(editedChildItemLevelIndex);
itemsForCurrentLevel.add(editedChildItem);
deselectItemsAfterLevel(editedChildItemLevelIndex);
selectedItemsPerLevel.add(editedChildItem);
initItemsPerLevel();
notifyChange("itemsPerLevel","selectedItemsPerLevel");
BindUtils.postNotifyChange(null, null, editedItem, ".");
}
protected void initItemsPerLevel() {
itemsPerLevel = new ArrayList<List<CodeListItem>>();
if ( /*isSurveyStored() && */ editedItem != null && ! editedItem.isExternal() ) {
List<CodeListItem> rootItems = codeListManager.loadRootItems(editedItem);
itemsPerLevel.add(new ArrayList<CodeListItem>(rootItems));
for (CodeListItem selectedItem : selectedItemsPerLevel) {
List<CodeListItem> childItems = codeListManager.loadChildItems(selectedItem);
itemsPerLevel.add(new ArrayList<CodeListItem>(childItems));
}
} else {
//add empty root items list
itemsPerLevel.add(new ArrayList<CodeListItem>());
}
}
public List<CodeListLevel> getListLevels() {
List<CodeListLevel> levels = null;
if ( editedItem != null ) {
levels = editedItem.getHierarchy();
if ( levels.isEmpty() ) {
CodeListLevel fakeFirstLevel = new CodeListLevel();
return Arrays.asList(fakeFirstLevel);
}
}
return levels;
}
public List<CodeListItem> getSelectedItemsPerLevel() {
return selectedItemsPerLevel;
}
@DependsOn("selectedItemsPerLevel")
public int getLastSelectedLevelIndex() {
return selectedItemsPerLevel.size() - 1;
}
public List<List<CodeListItem>> getItemsPerLevel() {
return itemsPerLevel;
}
public boolean isCodeListItemSelected(CodeListItem item) {
return selectedItemsPerLevel.contains(item);
}
public boolean hasChildItems(CodeListItem item) {
boolean result = codeListManager.hasChildItems(item);
return result;
}
public String getCodeListItemLabel(CodeListItem item) {
String label = item.getLabel(currentLanguageCode);
return label;
}
public boolean isEditingAttribute() {
return editingAttribute;
}
public boolean hasWarnings(CodeList list) {
return ! codeListManager.isInUse(list) || codeListManager.isEmpty(list);
}
public String getWarnings(CodeList list) {
String messageKey;
if ( codeListManager.isEmpty(list) ) {
messageKey = "survey.validation.error.empty_code_list";
} else if ( ! codeListManager.isInUse(list) ) {
messageKey = "survey.validation.error.unused_code_list";
} else {
messageKey = null;
}
return messageKey == null ? null: Labels.getLabel(messageKey);
}
@GlobalCommand
public void codeListAssigned(@BindingParam("list") CodeList list, @BindingParam("oldList") CodeList oldList) {
BindUtils.postNotifyChange(null, null, list, ".");
BindUtils.postNotifyChange(null, null, oldList, ".");
}
@Command
public void close(@ContextParam(ContextType.TRIGGER_EVENT) Event event) {
event.stopPropagation();
checkCanLeaveForm(new CanLeaveFormConfirmHandler() {
@Override
public void onOk(boolean confirmed) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("editingAttribute", editingAttribute);
params.put("selectedCodeList", selectedItem);
BindUtils.postGlobalCommand((String) null, (String) null, "closeCodeListsManagerPopUp", params);
}
});
}
}
| [
"[email protected]"
] | |
2d73f4746f21138895dab25d35bb8541f4ae6094 | 3183c15317d9bb7fb2a435280c42930cfed61dcd | /ymate-platform-persistence-jdbc/src/main/java/net/ymate/platform/persistence/jdbc/impl/DefaultModuleCfg.java | 83884976c2035aa2257bd75bdf58f13440c0a618 | [
"Apache-2.0"
] | permissive | zhiqinghuang/ymate-platform-v2 | 16c4d9fb8a0ed2063dd6d1abbaef15eaa3b023c3 | f90601d488bc6262c770bc80e4ed3b9f5304c35f | refs/heads/master | 2021-04-25T01:13:23.011398 | 2017-12-29T02:57:38 | 2017-12-29T02:57:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,552 | java | /*
* Copyright 2007-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.ymate.platform.persistence.jdbc.impl;
import net.ymate.platform.core.YMP;
import net.ymate.platform.core.lang.BlurObject;
import net.ymate.platform.core.support.IPasswordProcessor;
import net.ymate.platform.core.util.ClassUtils;
import net.ymate.platform.core.util.RuntimeUtils;
import net.ymate.platform.persistence.jdbc.*;
import org.apache.commons.lang.StringUtils;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* 默认数据库JDBC持久化模块配置类
*
* @author 刘镇 ([email protected]) on 2012-12-29 下午2:19:18
* @version 1.0
*/
public class DefaultModuleCfg implements IDatabaseModuleCfg {
private String dataSourceDefaultName;
private Map<String, DataSourceCfgMeta> dataSourceCfgMetas;
public DefaultModuleCfg(YMP owner) throws Exception {
Map<String, String> _moduleCfgs = owner.getConfig().getModuleConfigs(IDatabase.MODULE_NAME);
//
this.dataSourceDefaultName = StringUtils.defaultIfBlank(_moduleCfgs.get("ds_default_name"), "default");
//
this.dataSourceCfgMetas = new HashMap<String, DataSourceCfgMeta>();
String _dsNameStr = StringUtils.defaultIfBlank(_moduleCfgs.get("ds_name_list"), "default");
if (StringUtils.contains(_dsNameStr, this.dataSourceDefaultName)) {
String[] _dsNameList = StringUtils.split(_dsNameStr, "|");
for (String _dsName : _dsNameList) {
DataSourceCfgMeta _meta = __doParserDataSourceCfgMeta(_dsName, _moduleCfgs);
if (_meta != null) {
this.dataSourceCfgMetas.put(_dsName, _meta);
}
}
} else {
throw new IllegalArgumentException("The default datasource name does not match");
}
}
/**
* @param dsName 数据源名称
* @param _moduleCfgs 模块配置参数映射
* @return 分析并封装数据源配置
* @throws Exception 可能产生的异常
*/
@SuppressWarnings("unchecked")
private DataSourceCfgMeta __doParserDataSourceCfgMeta(String dsName, Map<String, String> _moduleCfgs) throws Exception {
Map<String, String> _dataSourceCfgs = RuntimeUtils.keyStartsWith(_moduleCfgs, "ds." + dsName + ".");
if (!_dataSourceCfgs.isEmpty()) {
//
DataSourceCfgMeta _meta = new DataSourceCfgMeta();
_meta.setName(dsName);
_meta.setConnectionUrl(_dataSourceCfgs.get("connection_url"));
_meta.setUsername(_dataSourceCfgs.get("username"));
// 验证必填参数
if (StringUtils.isNotBlank(_meta.getConnectionUrl()) && StringUtils.isNotBlank(_meta.getUsername())) {
// 基础参数
_meta.setIsShowSQL(new BlurObject(_dataSourceCfgs.get("show_sql")).toBooleanValue());
_meta.setIsStackTraces(new BlurObject(_dataSourceCfgs.get("stack_traces")).toBooleanValue());
_meta.setStackTraceDepth(new BlurObject(_dataSourceCfgs.get("stack_trace_depth")).toIntValue());
_meta.setStackTracePackage(_dataSourceCfgs.get("stack_trace_package"));
_meta.setTablePrefix(_dataSourceCfgs.get("table_prefix"));
_meta.setIdentifierQuote(_dataSourceCfgs.get("identifier_quote"));
// 数据源适配器
String _adapterClassName = JDBC.DS_ADAPTERS.get(StringUtils.defaultIfBlank(_dataSourceCfgs.get("adapter_class"), "default"));
_meta.setAdapterClass((Class<? extends IDataSourceAdapter>) ClassUtils.loadClass(_adapterClassName, this.getClass()));
//
// 连接和数据库类型
try {
_meta.setType(JDBC.DATABASE.valueOf(StringUtils.defaultIfBlank(_dataSourceCfgs.get("type"), "").toUpperCase()));
} catch (IllegalArgumentException e) {
// 通过连接字符串分析数据库类型
String _connUrl = URI.create(_meta.getConnectionUrl()).toString();
String[] _type = StringUtils.split(_connUrl, ":");
if (_type != null && _type.length > 0) {
if ("microsoft".equals(_type[1])) {
_type[1] = "sqlserver";
}
_meta.setType(JDBC.DATABASE.valueOf(_type[1].toUpperCase()));
}
}
//
_meta.setDialectClass(_dataSourceCfgs.get("dialect_class"));
_meta.setDriverClass(StringUtils.defaultIfBlank(_dataSourceCfgs.get("driver_class"), JDBC.DB_DRIVERS.get(_meta.getType())));
_meta.setPassword(_dataSourceCfgs.get("password"));
_meta.setIsPasswordEncrypted(new BlurObject(_dataSourceCfgs.get("password_encrypted")).toBooleanValue());
//
if (_meta.isPasswordEncrypted()
&& StringUtils.isNotBlank(_meta.getPassword())
&& StringUtils.isNotBlank(_dataSourceCfgs.get("password_class"))) {
_meta.setPasswordClass((Class<? extends IPasswordProcessor>) ClassUtils.loadClass(_dataSourceCfgs.get("password_class"), this.getClass()));
}
//
return _meta;
}
}
return null;
}
@Override
public String getDataSourceDefaultName() {
return dataSourceDefaultName;
}
@Override
public Map<String, DataSourceCfgMeta> getDataSourceCfgs() {
return Collections.unmodifiableMap(dataSourceCfgMetas);
}
@Override
public DataSourceCfgMeta getDefaultDataSourceCfg() {
return dataSourceCfgMetas.get(dataSourceDefaultName);
}
@Override
public DataSourceCfgMeta getDataSourceCfg(String name) {
return dataSourceCfgMetas.get(name);
}
}
| [
"[email protected]"
] | |
642d7b689c244585c34148d3edaca287ae1ef22c | 2a48d8501d3676f131c48923e4dff3dc36ec7090 | /src/main/java/com/example/helpdesk/repository/TipoPessoaRepository.java | eea64aeff08af7b1faa04641ad36afee1e45769e | [] | no_license | Christianfoz/APIHelpdesk | 7f3eb6970d1b3dbdfe4f2184bab2ccceb027f6a7 | a782c3c5b77cb546596b4f932c462eccc5e2bf4b | refs/heads/main | 2023-06-10T16:37:18.407087 | 2021-06-28T22:58:57 | 2021-06-28T22:58:57 | 346,428,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | package com.example.helpdesk.repository;
import com.example.helpdesk.model.TipoPessoa;
import org.springframework.data.repository.CrudRepository;
public interface TipoPessoaRepository extends CrudRepository<TipoPessoa, Integer> {
TipoPessoa findById(int id);
}
| [
"[email protected]"
] | |
cb234d1fe73d2ff06987293218f0b12466c06d5b | f9633597517f6ddce7f5a2ccaa0606d0cbade2db | /src/com/supremesir/experiment2/TryList.java | 034fa908e94d0716e51cc7d6db39013adb0f2969 | [
"MIT"
] | permissive | Supremesir/JavaReview | 1211017fa20fc092f82e2f441fb3611f52b67597 | 21d8b70d421e87ff24d46ccd70edd95cf4e77793 | refs/heads/master | 2020-09-26T11:49:33.662991 | 2019-12-13T03:37:56 | 2019-12-13T03:37:56 | 226,249,258 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,365 | java | package com.supremesir.experiment2;
import java.util.*;
/**
* @author HaoFan Fang
* @date 2019/12/11 19:09
*/
public class TryList {
public static void main(String[] args) {
String name;
int score;
//新建一个链表,用来存放Student4的对象
LinkedList<Student4> stuList = new LinkedList<>();
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("请输入学生的姓名和计算机成绩:");
name = scanner.next();
//String字符串比较不能用 X == Y
if (name.equals("finish")) {
break;
}
score = scanner.nextInt();
//根据读取到的信息对Student实例化
Student4 stu4 = new Student4(name, score);
//将实例化的对象添加到链表
stuList.add(stu4);
}
//旧写法,匿名类Comparator重写compare方法
// Collections.sort(stuList, new Comparator<Student4>() {
// @Override
// public int compare(Student4 o1, Student4 o2) {
// return o1.name.compareTo(o2.name);
// }
// });
//新写法,lambda比较器
//根据姓名排序
//FIXME: lambda比较器不能按照中文姓名排序
Collections.sort(stuList,((o1, o2) -> o1.name.compareTo(o2.name)));
System.out.println("按学生姓名排序:");
//为stuList设置迭代器
Iterator<Student4> iterator = stuList.iterator();
while (iterator.hasNext()) {
//返回下一个对象
Student4 student4 = iterator.next();
System.out.println("学生姓名:" + student4.name + "\n学生计算机成绩:" + student4.computerScore);
}
//根据计算机成绩排序
Collections.sort(stuList,((o1, o2) -> o1.computerScore-o2.computerScore));
System.out.println("\n按学生计算机成绩排序:");
//为stuList设置迭代器
Iterator<Student4> iterator1 = stuList.iterator();
while (iterator1.hasNext()) {
//返回下一个对象
Student4 student4 = iterator1.next();
System.out.println("学生姓名:" + student4.name + "\n学生计算机成绩:" + student4.computerScore);
}
}
}
| [
"[email protected]"
] | |
848d278c6bd476b454df72d708ec5a156b5caa79 | e2692758f9d529d2ce0fbf23f9ac45af307492b3 | /src/main/java/com/supyuan/mkd/common/MSessionUser.java | 53bec3d3436149a394d6eccd76e006869845f9c2 | [] | no_license | dingfei2018/anfapc | 63b119c640ed43b506fcd90d7fe18b268347b489 | c72af000b4f063d52fa57fabf31d4b58d690ba6a | refs/heads/master | 2020-03-16T01:19:24.052505 | 2018-08-01T11:38:35 | 2018-08-01T11:38:35 | 132,437,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,364 | java | package com.supyuan.mkd.common;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 手机用户信息
* @author liangxp
*
* Date:2018年1月30日上午11:56:04
*
* @email [email protected]
*/
public class MSessionUser {
private int userId;
private String mobile;
private String password;
private int usertype;//用户类型,3 - 非物流公司, 4 -物流公司, 5 -个人(司机), 6 -车队
private int isCert;//是否认证
private int isCompany;//是否完善公司信息,1:表示已完善
private int companyId;//所属公司
private List<Integer> networkIds;//所属网点
private Set<String> permissUrls;
private Map<String, Set<String>> urls;
private String userkey;
public MSessionUser() {
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getUsertype() {
return usertype;
}
public void setUsertype(int usertype) {
this.usertype = usertype;
}
public int getCompanyId() {
return companyId;
}
public void setCompanyId(int companyId) {
this.companyId = companyId;
}
public List<Integer> getNetworkIds() {
return networkIds;
}
public void setNetworkIds(List<Integer> networkIds) {
this.networkIds = networkIds;
}
public int getIsCert() {
return isCert;
}
public void setIsCert(int isCert) {
this.isCert = isCert;
}
public int getIsCompany() {
return isCompany;
}
public void setIsCompany(int isCompany) {
this.isCompany = isCompany;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Set<String> getPermissUrls() {
return permissUrls;
}
public void setPermissUrls(Set<String> permissUrls) {
this.permissUrls = permissUrls;
}
public Map<String, Set<String>> getUrls() {
return urls;
}
public void setUrls(Map<String, Set<String>> urls) {
this.urls = urls;
}
public String toNetWorkIdsStr(){
if(networkIds==null)return "0";
return networkIds.toString().replace("[", "").replace("]", "");
}
public String getUserkey() {
return userkey;
}
public void setUserkey(String userkey) {
this.userkey = userkey;
}
}
| [
"[email protected]"
] | |
de37ee6b3fc95ce8ae2fcd40a785442765e8eae7 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project18/src/test/java/org/gradle/test/performance18_1/Test18_25.java | a0428463e04d0f9d22634f590f33b3cb09c33781 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 289 | java | package org.gradle.test.performance18_1;
import static org.junit.Assert.*;
public class Test18_25 {
private final Production18_25 production = new Production18_25("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"[email protected]"
] | |
e7aaa4ef934ea1fc0fa2fab6f305f43f86c65ed8 | 5d19e46b8d7dc80a5885752ff424693bf6a7fa57 | /warn-master/src/main/java/com/warn/service/impl/AlarmServiceImpl.java | bd7e0dc6ca50180b635757695fabfe1decf1944f | [] | no_license | typeyuki/warn-smart | ee989084e6db2b90d34e5d6a3d099144f94fd41c | 679f308c10af288c54902c4ed1305b83abe464eb | refs/heads/master | 2020-04-17T17:49:48.183600 | 2019-01-21T11:10:15 | 2019-01-21T11:10:15 | 166,800,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,750 | java | package com.warn.service.impl;
import com.warn.controller.SystemController;
import com.warn.dao.BedDao;
import com.warn.dao.DataDao;
import com.warn.dao.ThresholdDao;
import com.warn.dao.WarnHistoryDao;
import com.warn.dto.*;
import com.warn.dwr.Remote;
import com.warn.entity.*;
import com.warn.exception.NullFromDBException;
import com.warn.exception.WarnException;
import com.warn.mongodb.model.SensorCollection;
import com.warn.service.AlarmService;
import com.warn.service.SensorService;
import com.warn.service.WarnHistoryService;
import com.warn.util.Commons;
import com.warn.util.common.Const;
import org.apache.commons.codec.binary.Base64;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.xml.crypto.Data;
import java.security.PrivateKey;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Service
public class AlarmServiceImpl implements AlarmService {
@Autowired
WarnHistoryDao warnHistoryDao;
@Autowired
BedDao bedDao;
@Autowired
DataDao dataDao;
@Autowired
SensorService sensorService;
@Autowired
ThresholdDao thresholdDao;
@Autowired
WarnHistoryService warnHistoryService;
private static Map<OldMan,Boolean> gravity = new HashMap<OldMan,Boolean>();
private static Map<OldMan,String> gravityBed = new HashMap<OldMan,String>();
private static Map<OldMan,ScheduledExecutorService> gravityTimer = new HashMap<OldMan,ScheduledExecutorService>();
public Result addAlarmFaceTest(HttpServletRequest request) {
String value1;
WarnData warnData = new WarnData();
Map<String,String> keyValue = new HashMap<String, String>();
try {
ServletInputStream inputStream = request.getInputStream();
StringBuffer buffer = new StringBuffer();
byte[] b = new byte[1024];
int len = 0;
while((len = inputStream.read(b) )!= -1){
buffer.append(new String(b,0,len));
}
JSONObject json = JSONObject.fromObject(buffer.toString());
String data = json.get("data").toString();
// data = new String(data.getBytes("ISO8859-1"),"utf-8");
byte[] base64 = Base64.decodeBase64(data.getBytes("utf-8"));
PrivateKey privateKey = Commons.getPrivateKey(Const.privateKey);
String value = Commons.decrypt(base64, privateKey);
value1 = value;
String parameter[] = value.split("&");
for(int i=0;i < parameter.length;i++){
String[] param = parameter[i].split("=");
keyValue.put(param[0],param[1]);
}
String alarmTime = Commons.longToDate(new Long(keyValue.get("alarmTime")));
AlarmFace alarmFace = new AlarmFace();
alarmFace.setAlarmTime(alarmTime);
alarmFace.setEquipIp(keyValue.get("equipIp"));
alarmFace.setIdCard(keyValue.get("idCard"));
alarmFace.setPicture(keyValue.get("picture"));
alarmFace.setPosition(keyValue.get("position"));
alarmFace.setName(keyValue.get("name"));
DwrData dwrData = new DwrData();
dwrData.setType("alarm_face");
dwrData.setAlarmFace(alarmFace);
warnHistoryService.addWarnHistory(dwrData);
// Date d = new Date();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
// String dateNowStr = sdf.format(d);
// warnData.setTimeW(dateNowStr);
// OldMan oldMan = new OldMan();
// oldMan.setOldName(keyValue.get("name"));
// Warn warn = new Warn();
// warn.setFlag(keyValue.get("position"));
// warn.setInTime(keyValue.get("equipIp"));
// DwrData dwrData = new DwrData();
// dwrData.setType("face");
// dwrData.setWarn(warn);
// dwrData.setOldMan(oldMan);
// warnHistoryDao.addWarnHistory(warnData);
//
Remote.noticeNewOrder(dwrData);
} catch (Exception e) {
return new Result(false,e.getMessage());
}
return new Result(true, value1);
}
@Override
public void AlarmGravity(SensorCollection sensorCollection) throws WarnException{
try{
final Bed bed = bedDao.getBedBySPId(sensorCollection.getSensorPointID());
if(bed == null)
throw new NullFromDBException("离床预警:找不到对应床位!");
final OldMan oldMan = dataDao.getOldManByOid(bed.getOldMan().getOid());
if(oldMan == null)
throw new NullFromDBException("离床预警:找不到对应老人!");
if(sensorCollection.getSensorData() == 15){
if(gravityTimer.get(oldMan) != null){
gravityTimer.get(oldMan).shutdown();
gravityTimer.remove(oldMan);
}
}
if(sensorCollection.getSensorData() == 240){
String[] ctime = sensorCollection.getTime().split(" ");
final String time = ctime[1];
final ThresholdGravity thresholdGByOid = thresholdDao.getThresholdGByOid(oldMan.getOid());
if(thresholdGByOid == null)
throw new NullFromDBException("离床预警:找不到阈值!");
Runnable runnable = new Runnable() {
@Override
public void run() {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
String currentTime = sdf.format(d);
SystemController.logger.info("当前时间:" + currentTime + " 离床时间:" + time);
int value = sensorService.intervalTime(currentTime, time) / 60;//当前时间与最初时间的差值 单位分钟
SystemController.logger.info("老人已经离床:" + value + "分钟");
if(value >= thresholdGByOid.getThresholdGravity()){
if(moment_timeDeal(time,thresholdGByOid.getTimes()).isInTime() || moment_timeDeal(currentTime,thresholdGByOid.getTimes()).isInTime()){
AlarmGravity alarmGravity = new AlarmGravity();
alarmGravity.setBedNum(bed.getBedNum());
alarmGravity.setRoomNum(bed.getRoomNum());
alarmGravity.setTime(time + "-" + currentTime);
alarmGravity.setValue(value);
alarmGravity.setMapX(bed.getMapX());
alarmGravity.setMapY(bed.getMapY());
DwrData dwrData = new DwrData();
dwrData.setType("alarm_gravity");
dwrData.setAlarmGravity(alarmGravity);
warnHistoryService.addWarnHistory(dwrData);
Remote.noticeNewOrder(dwrData);
}
}
}
};
ScheduledExecutorService service = Executors
.newSingleThreadScheduledExecutor();
// 第二个参数为首次执行的延时时间,第三个参数为定时执行的间隔时间
service.scheduleAtFixedRate(runnable, 1, 60, TimeUnit.SECONDS);
gravityTimer.put(oldMan,service);
}
}catch(NullFromDBException ex1){
throw ex1;
}catch(Exception e){
throw new WarnException("gravity inner error" + e.getMessage());
}
}
public MomentInTime moment_timeDeal(String moment, String time){
MomentInTime momentInTime=new MomentInTime();
String[] times=time.split("-");// /xx:xx-yy:yy
//模型时间段位 20:30:00-06:30:00的情况
if(times[1].compareTo(times[0])<0){
if(moment.compareTo(times[0])>0||moment.compareTo(times[1])<0){
momentInTime.setInTime(true);
// //距结束的时长 因为规律模型是 hh:mm 手动构造 hh:mm:ss形式
// momentInTime.setToEnd(intervalTime(times[1] + ":00", moment));
//时间段 时长
momentInTime.setTime(sensorService.intervalTime(times[1] + ":00", times[0] + ":00"));
} else {
momentInTime.setInTime(false);
}
}else {
//直接比较字符串 不要拆分成 时分秒
if (moment.compareTo(times[0]) >= 0 && moment.compareTo(times[1]) < 0) {
momentInTime.setInTime(true);
// //距结束的时长 因为规律模型是 hh:mm 手动构造 hh:mm:ss形式
// momentInTime.setToEnd(intervalTime(times[1] + ":00", moment));
//时间段 时长
momentInTime.setTime(sensorService.intervalTime(times[1] + ":00", times[0] + ":00"));
} else {
momentInTime.setInTime(false);
}
}
return momentInTime;
}
}
| [
"[email protected]"
] | |
fc109164262ff0fba6c4dbcbcc849c88d16686cb | ec418dc59e060f2864db53ddd0fe566a9cd68426 | /src/test/java/parsers/StockExchangeParserTest.java | 4df698075f0c02588bbebb4967f36fe28047fe3d | [] | no_license | krishnamohan-seelam/parsers | 8e01d445896b042a97a215477a329a156f33dc79 | b6bcc07b3cfe1bab26c3baf488b9c68c6438fbf0 | refs/heads/master | 2021-01-10T08:34:43.894493 | 2015-11-02T02:41:45 | 2015-11-02T02:41:45 | 44,010,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package parsers;
import org.apache.hadoop.io.Text;
import org.junit.Test;
import com.krishna.hadoop.StockExchangeParser;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.is;
public class StockExchangeParserTest {
@Test
public void testStockrecord()
{
Text testRecord = new Text("21-12-1995,5096.53,DJINDUS");
StockExchangeParser sep = new StockExchangeParser();
sep.parse(testRecord);
assertThat(sep.getDateStr(), is( new String("1995-12-21")));
assertThat(sep.getExchangeName(),is(new String("DJINDUS")));
assertThat(sep.getEodIndex() ,is( new Double(5096.53)));
}
}
| [
"[email protected]"
] | |
be6e6e79370cc1afcd41b2f7ade613e7946a0a77 | 751dc8a22f8452a723de0a966d664e6c6ab56ea7 | /src/Inicio.java | c62b48ad6d06d758fb1088518ce80db38dd11474 | [] | no_license | rohusemer/Base_Datos | abebd64fd0afa06294db14fd3022baaca1c75a90 | 780753ebe9b8abf089d9f73e00b900f52a543491 | refs/heads/main | 2023-03-25T21:59:25.009618 | 2021-03-23T18:47:52 | 2021-03-23T18:47:52 | 350,818,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,086 | java |
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.sql.Connection;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/*
* 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.
*/
/**
*
* @author Usuario
*/
public class Inicio extends javax.swing.JFrame {
/**
* Creates new form Inicio
*/
public Inicio() {
initComponents();
this.setLocationRelativeTo(null);
cerrar();
}
public void cerrar(){
try{
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e){
confirmarSalida();
}
});
this.setVisible(true);
} catch (Exception e){
e.printStackTrace();
}
}
public void confirmarSalida(){
int valor1 = JOptionPane.showConfirmDialog(this,"¿Esta seguro de salir de la Aplicacion?","Advertencia",JOptionPane.YES_NO_OPTION);
if(valor1 == JOptionPane.YES_OPTION){
JOptionPane.showMessageDialog(null,"GRacias por su visita!","Gracias", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
btnFActura = new javax.swing.JButton();
btnViaje = new javax.swing.JButton();
btnVehiculo = new javax.swing.JButton();
btnPago = new javax.swing.JButton();
btnManoObra = new javax.swing.JButton();
btnProveedor = new javax.swing.JButton();
btnPersona = new javax.swing.JButton();
btnEmpleado = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Inicio");
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
btnFActura.setText("FACTURA");
btnFActura.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnFActuraActionPerformed(evt);
}
});
getContentPane().add(btnFActura, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 320, -1, -1));
btnViaje.setText("VIAJES");
btnViaje.setMaximumSize(new java.awt.Dimension(77, 32));
btnViaje.setMinimumSize(new java.awt.Dimension(77, 32));
btnViaje.setPreferredSize(new java.awt.Dimension(77, 32));
btnViaje.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnViajeActionPerformed(evt);
}
});
getContentPane().add(btnViaje, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 250, -1, -1));
btnVehiculo.setText("VEHICULOS");
btnVehiculo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnVehiculoActionPerformed(evt);
}
});
getContentPane().add(btnVehiculo, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 320, -1, -1));
btnPago.setText("PAGOS");
btnPago.setMaximumSize(new java.awt.Dimension(77, 32));
btnPago.setMinimumSize(new java.awt.Dimension(77, 32));
btnPago.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPagoActionPerformed(evt);
}
});
getContentPane().add(btnPago, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 180, -1, -1));
btnManoObra.setText("MANO DE OBRA");
btnManoObra.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnManoObraActionPerformed(evt);
}
});
getContentPane().add(btnManoObra, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 320, -1, -1));
btnProveedor.setText("PROVEEDOR");
btnProveedor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnProveedorActionPerformed(evt);
}
});
getContentPane().add(btnProveedor, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 180, -1, -1));
btnPersona.setText("CLIENTE");
btnPersona.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPersonaActionPerformed(evt);
}
});
getContentPane().add(btnPersona, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 180, -1, -1));
btnEmpleado.setText("EMPLEADO");
btnEmpleado.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEmpleadoActionPerformed(evt);
}
});
getContentPane().add(btnEmpleado, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 250, -1, -1));
jLabel2.setFont(new java.awt.Font("Dialog", 1, 30)); // NOI18N
jLabel2.setForeground(new java.awt.Color(0, 0, 0));
jLabel2.setText("Bienvenido al sistema de LOGICMANATRANS");
jLabel2.setVerticalAlignment(javax.swing.SwingConstants.TOP);
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 50, 670, 70));
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/au2.jpg"))); // NOI18N
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 760, 470));
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnProveedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProveedorActionPerformed
// TODO add your handling code here:
RProveedor rp = new RProveedor();
rp.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_btnProveedorActionPerformed
private void btnViajeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViajeActionPerformed
// TODO add your handling code here:
RViaje rv = new RViaje();
rv.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_btnViajeActionPerformed
private void btnManoObraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnManoObraActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_btnManoObraActionPerformed
private void btnEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEmpleadoActionPerformed
// TODO add your handling code here:
REmpleado re = new REmpleado();
re.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_btnEmpleadoActionPerformed
private void btnFActuraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFActuraActionPerformed
tFactura tf = new tFactura();
tf.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_btnFActuraActionPerformed
private void btnPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPersonaActionPerformed
// TODO add your handling code here:
RCliente rc = new RCliente();
rc.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_btnPersonaActionPerformed
private void btnPagoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPagoActionPerformed
// TODO add your handling code here:
RPago rp = new RPago();
rp.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_btnPagoActionPerformed
private void btnVehiculoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVehiculoActionPerformed
// TODO add your handling code here:
RVehiculo rv = new RVehiculo();
rv.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_btnVehiculoActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new Inicio().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnEmpleado;
private javax.swing.JButton btnFActura;
private javax.swing.JButton btnManoObra;
private javax.swing.JButton btnPago;
private javax.swing.JButton btnPersona;
private javax.swing.JButton btnProveedor;
private javax.swing.JButton btnVehiculo;
private javax.swing.JButton btnViaje;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
179863b1b21bd9026441da79441312673f498115 | 4aef2cee827dc4f291664ab5bf306d5bb54fea00 | /com.github.ipaas.ifw/com.github.ipaas.ifw.component/src/test/java/com/github/ipaas/ifw/test/_TestZeroOperationsNC.java | 362a8415564f39e3a32c13ae4073023c73b56fbc | [
"Apache-2.0"
] | permissive | harrywu304/ipaas | ea49567841e66b46ad2b563204ca005efd8e9fcf | 549295a703fa7c56654ab841f3c94e076a71b294 | refs/heads/master | 2020-06-09T18:19:35.707224 | 2015-11-04T14:32:05 | 2015-11-04T14:32:05 | 44,369,318 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | // **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
// Ice version 3.3.1
package com.github.ipaas.ifw.test;
public interface _TestZeroOperationsNC
{
String sayHello(String name);
}
| [
"[email protected]"
] | |
ca34342690320f9504cd1c95893be5b3c5d18bf0 | 52687cb447d4bda3f63a03fb1c9f45419a7cd3ba | /gym/src/com/vooda/frame/entity/Vuser.java | bfde83c4e14e2cec41e3f194fc85df6e4816610a | [] | no_license | simplezpw/gym | f9301b674a6b80e9ad48e5a75d4ce4d0c28ed083 | 1307dfb5e2e6c1877eeeac8e8eead33643308683 | refs/heads/master | 2021-04-09T15:15:31.501135 | 2018-03-16T12:03:11 | 2018-03-16T12:03:11 | 125,509,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 446 | java | package com.vooda.frame.entity;
public class Vuser {
private String id;
private String name;
private String account;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
}
| [
"[email protected]"
] | |
d05e5f2d92577e63e2e5bf1c3f72a60ac3d04a94 | 94b1bfd054a78b8a1d52361d561408dead0f2425 | /src/main/java/com/mdzy/xqbadmin/modules/api/action/CollectionActionApi.java | bfff3e8cd73541d8d1b8d3c18626e4ee3042aa4f | [] | no_license | cymhh123/xqb_admim | 6ed502f1579c0bb2e86b7aff55877a2cbf466d93 | a7fb22b76b96d23ea2422cbe4af506cf5a0f3144 | refs/heads/master | 2021-01-11T00:10:27.730836 | 2016-10-19T02:43:40 | 2016-10-19T02:43:40 | 70,564,070 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,107 | java | package com.mdzy.xqbadmin.modules.api.action;
import com.github.pagehelper.PageInfo;
import com.mdzy.xqbadmin.common.exception.ServiceException;
import com.mdzy.xqbadmin.common.utils.StringUtils;
import com.mdzy.xqbadmin.modules.sys.action.BaseController;
import com.mdzy.xqbadmin.modules.sys.entity.ExecuteBean;
import com.mdzy.xqbadmin.modules.video.entity.CollectionBean;
import com.mdzy.xqbadmin.modules.video.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Created by Administrator on 2016/9/27.
*/
@Controller
@RequestMapping("/api/collection")
public class CollectionActionApi extends BaseController {
@Autowired
private CollectionService collectionService;
/**
* 用户收藏的专题
* @param userId
* @param page
* @return
*/
@RequestMapping("/list")
@ResponseBody
public Object list(String userId,Integer page){
if(StringUtils.isBlank(userId) || page == null){
return new ExecuteBean<>("201","参数错误");
}
CollectionBean collectionBean = new CollectionBean();
collectionBean.setUserId(userId);
List<CollectionBean> list = this.collectionService.findByPage(collectionBean,page);
PageInfo<CollectionBean> pageInfo = new PageInfo<>(list);
return new ExecuteBean<>(pageInfo);
}
/**
* 收藏专题
* @return
*/
@RequestMapping("/save")
@ResponseBody
public Object saveCollection(String userId,String subjectId){
if(StringUtils.isBlank(userId) || StringUtils.isBlank(subjectId)){
return new ExecuteBean<>("201","参数有误");
}
try{
this.collectionService.saveCollection(userId,subjectId);
}catch (ServiceException e){
return new ExecuteBean<>("202",e.getMessage());
}
return new ExecuteBean<>();
}
}
| [
"[email protected]"
] | |
fb1b2d27f3eb90a6918b0e75432b8db7ecc86a3d | 8b495f291c998c4f88d62c7d99faaf26729f0e06 | /BDCRJ/20154816395wangzepingBDCRJ/app/src/main/java/com/example/wero/a1_20154816395/mvp/IView.java | d50213260b1f989a4f88209bfab6dfaf6a011151 | [] | no_license | wumingTiger/danci | 2f4df0c1fcbb665ba54089af077e79e323542440 | 527157ee88df4548a81baa0e19e67c678da9a622 | refs/heads/master | 2020-08-27T22:17:28.842785 | 2019-12-05T05:45:16 | 2019-12-05T05:45:16 | 217,502,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.example.wero.a1_20154816395.mvp;
/**
* Created by wero on 18-4-24.
* v层的base
* mvp, v
* 外部层提供统一调用的规范
*/
public interface IView {
/**
* 显示登录进度
*/
void showProgress();
/**
* 隐藏
*/
void hideProgress();
}
| [
"[email protected]"
] | |
8ceb43340880fac943e7a7717868422fee06ade8 | cb7a3c9719c48815e6ca330877b5264701859792 | /springTest01/src/test/java/leetcode/RomanToInt.java | 917f410d174d5c6171da2705ddadfad2930e0cc1 | [] | no_license | Eason-Yin/springTest | 5caf756f179406a215255da5bdd7c644df5841b3 | 2bbe3a6a931fdd37bcf71f9f367d93e4ebb1af68 | refs/heads/master | 2023-03-27T17:32:03.904857 | 2021-03-25T08:13:37 | 2021-03-25T08:13:37 | 346,362,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 899 | java | package leetcode;
public class RomanToInt {
public static int romanToInt(String s){
int sum = 0;
int preNum = getValue(s.charAt(0));
for (int i = 1;i < s.length();i++){
int num = getValue(s.charAt(i));
if(preNum < num){
sum -= preNum;
}else{
sum += preNum;
}
preNum = num;
}
sum += preNum;
return sum;
}
public static int getValue(char ch){
switch (ch){
case 'I': return 1;
case 'V': return 5;
case 'X': return 10;
case 'L': return 50;
case 'C': return 100;
case 'D': return 500;
case 'M': return 1000;
default: return 0;
}
}
public static void main(String[] args) {
System.out.println(romanToInt("XXVII"));
}
}
| [
"[email protected]"
] | |
694d1c67e7a474ad949045ef6be12e10da3cfe21 | 17a55cf7d73d9b17ea308a260f743a4c6aa49270 | /atsys/src/main/java/utils/DaoConnection.java | 0ef3e3eb2d212edd3c42f1db11c359f06f7826f8 | [] | no_license | daesmondid/Atsys | 70b7dc54a85b319c0a56d6d1d6f4257dd3efe700 | 4fb60e11c44e187edb3b7c0951293d7064e5747c | refs/heads/master | 2020-07-01T21:58:11.132052 | 2016-11-30T22:44:38 | 2016-11-30T22:44:38 | 74,253,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,443 | java | package utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class DaoConnection {
protected Connection connect = null;
protected Statement statement = null;
protected ResultSet resultSet = null;
final protected String xhost = "188.166.238.168";
final protected String xuser = "atsysuser";
final protected String xpasswd = "d@H!2brTg5D4";
final protected String xdatabase = "atsys";
// final protected String xhost = "127.0.0.1";
// final protected String xuser = "root";
// final protected String xpasswd = "";
// final protected String xdatabase = "atsys";
public DaoConnection() {
try {
connectToDB();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void connectToDB() throws Exception {
try {
// This will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
// Setup the connection with the DB
connect = DriverManager.getConnection("jdbc:mysql://" + xhost + "/"
+ xdatabase + "?" + "user=" + xuser + "&password=" + xpasswd);
} catch (Exception e) {
throw e;
}
}
public void close() {
try {
if (resultSet != null) {
resultSet.close();
}
if (statement != null) {
statement.close();
}
if (connect != null) {
connect.close();
}
} catch (Exception e) {
}
}
}
| [
"[email protected]"
] | |
184d73a3a3ccb7fa9354195f02d4972b86bf39bd | 3e97d2d3d0088588e3f78caea769511597516299 | /src/com/zlx/nyoj/e144.java | fdfeedac02a5e31296cb3513925fc3353c47ef4e | [] | no_license | zoulux/JudgeOnline | 631042d4bd5cde70e9f7f056893a9c6d1fe1b768 | 1b3a8c921979ef2ae1483f28aac901bf9b6328ce | refs/heads/master | 2021-01-18T13:48:57.795824 | 2015-05-18T00:24:03 | 2015-05-18T00:24:03 | 32,773,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package com.zlx.nyoj;
import java.util.Scanner;
public class e144 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner cin = new Scanner(System.in);
int T = cin.nextInt();
while (T-- > 0) {
int a = cin.nextInt();
int b = cin.nextInt();
int n = cin.nextInt();
int gys = gys(a, b);
if (gys % n == 0)
System.out.println("Yes");
else
System.out.println("No");
}
}
private static int gys(int a, int b) {
int t = 1;
if (a < b) {
int temp = a;
a = b;
b = temp;
}
while ((t = a % b) != 0) {
a = b;
b = t;
}
return b;
}
}
| [
"[email protected]"
] | |
7ff53fbfaddf226e1b2e185dc49aca377da78e46 | c0eeef213a8cee03f69b260cbd00c2bd9bd62c00 | /src/main/java/com/musichubappfront/Dto/YTIdDto.java | 3a95270a31f3f2601bac5456673721fae5c274ee | [] | no_license | Maria-Zurakowska/Music-Hub-App-Front | 3a3b9f1652662b3852d0fa74e9def9b4a4096331 | fdc89930b9a95b1a5b4f782a0d1fa0741ee46c64 | refs/heads/master | 2022-12-30T16:17:34.724730 | 2020-10-08T11:16:08 | 2020-10-08T11:16:08 | 289,688,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package com.musichubappfront.Dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class YTIdDto {
private String kind;
private String channelId;
}
| [
"[email protected]"
] | |
068aa324ee33cbf4dbcd66bf340d100b92464008 | cbaa4dc61f1e58406a9b0588f992ce860fd1e947 | /src/fr/kohen/alexandre/framework/components/VisualComponent.java | ad36418acfeb6a79cb9d4c04fbe43ca02778952c | [] | no_license | akohen/Merkurius | 4880507ee7062dc163873645d4bbea44218fdc48 | 949bf3587a7826c6395da5ffcfdf89aab8e1b3fe | refs/heads/master | 2021-01-22T11:38:36.982500 | 2013-06-22T20:54:09 | 2013-06-22T20:54:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package fr.kohen.alexandre.framework.components;
import com.artemis.Component;
/**
* Holds the visual representation of the entity
* @author Alexandre
*
*/
public class VisualComponent extends Component {
public String type = "";
public String currentAnimationName = "";
public float stateTime = 0f;
public VisualComponent(String type) {
this.type = type;
}
}
| [
"[email protected]"
] | |
789ab8f2e200410b6bb354dc28c0d752401bee20 | 7dbbe21b902fe362701d53714a6a736d86c451d7 | /BzenStudio-5.6/Source/com/zend/ide/m/bc.java | f0cca978cc39d6475831e47b25d2b08e5b0e5f2d | [] | no_license | HS-matty/dev | 51a53b4fd03ae01981549149433d5091462c65d0 | 576499588e47e01967f0c69cbac238065062da9b | refs/heads/master | 2022-05-05T18:32:24.148716 | 2022-03-20T16:55:28 | 2022-03-20T16:55:28 | 196,147,486 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package com.zend.ide.m;
import com.zend.ide.b.m;
import java.io.Serializable;
public class bc
implements Serializable
{
private String a;
private m b;
public bc(String paramString, m paramm)
{
this.a = paramString;
this.b = paramm;
}
public String c()
{
return this.a;
}
public m b()
{
return this.b;
}
}
/* Location: C:\Program Files\Zend\ZendStudio-5.5.1\bin\ZendIDE.jar
* Qualified Name: com.zend.ide.m.bc
* JD-Core Version: 0.6.0
*/ | [
"[email protected]"
] | |
c9fd43728b97b9d5f770a24e6065b22d9f23c653 | 84039ffe6c4c285d27bb77e9d9c68dadc75012b5 | /AndroidFirst/app/src/test/java/vn/msf/dinhlap/appandroid/ExampleUnitTest.java | f9ac5e4cce862fca3f502c433582c93b4fe94069 | [] | no_license | dinhlap/mvcasp | 22fbc3d7749fa797284dc4559610db11264f3c05 | afef823ee91f1b0f2791b5f30705aef97a5fab03 | refs/heads/master | 2020-03-11T19:10:09.266817 | 2018-05-20T05:44:33 | 2018-05-20T05:44:33 | 130,199,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package vn.msf.dinhlap.appandroid;
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);
}
} | [
"[email protected]"
] | |
037892d65974081536330fffe3abbae9cd435791 | 07364001f6094058af3c41332d9acd1208d9ff8f | /codility-solutions/src/main/java/ru/roman/task/pramp/ValidateIpAddress.java | e41263e43ce01f34e81710c05f41b327bd4d4d99 | [] | no_license | rrrrrr111/codility-examples | bb1b1937eb5197c15d758a97cf2d487ee93d1807 | 52213a0ee713c88cc7629054409c12c0ef5de17a | refs/heads/master | 2020-04-15T13:53:14.572174 | 2019-06-28T22:05:45 | 2019-06-28T22:05:45 | 164,735,051 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,105 | java | package ru.roman.task.pramp;
/**
* Validate IP Address
* Validate an IP address (IPv4). An address is valid if and only if it is in the form "X.X.X.X", where each X is a number from 0 to 255.
* <p>
* For example, "12.34.5.6", "0.23.25.0", and "255.255.255.255" are valid IP addresses, while "12.34.56.oops", "1.2.3.4.5", and "123.235.153.425" are invalid IP addresses.
* <p>
* Examples:
* <p>
* ip = '192.168.0.1'
* output: true
* <p>
* ip = '0.0.0.0'
* output: true
* <p>
* ip = '123.24.59.99'
* output: true
* <p>
* ip = '192.168.123.456'
* output: false
* Constraints:
* <p>
* [time limit] 5000ms
* [input] string ip
* [output] boolean
*/
class ValidateIpAddress {
public boolean solution(String ip) {
System.out.printf("On input: %s%n", ip);
return ip.matches(
"(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)\\." +
"(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)\\." +
"(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)\\." +
"(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)"
);
}
}
| [
"[email protected]"
] | |
ae6e2fb731d47d7d2277aa8b8966a910788dc058 | f71a7ec87f7e90f8025a3079daced5dbf41aca9c | /sf-pay/src/main/java/com/alipay/api/request/AlipayAssetAccountUnbindRequest.java | e25792ad76f56705809c6931e13979f8095ea9e4 | [] | no_license | luotianwen/yy | 5ff456507e9ee3dc1a890c9bead4491d350f393d | 083a05aac4271689419ee7457cd0727eb10a5847 | refs/heads/master | 2021-01-23T10:34:24.402548 | 2017-10-08T05:03:10 | 2017-10-08T05:03:10 | 102,618,007 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 3,353 | java | package com.alipay.api.request;
import java.util.Map;
import com.alipay.api.AlipayRequest;
import com.alipay.api.internal.util.AlipayHashMap;
import com.alipay.api.response.AlipayAssetAccountUnbindResponse;
import com.alipay.api.AlipayObject;
/**
* ALIPAY API: alipay.asset.account.unbind request
*
* @author auto create
* @since 1.0, 2016-10-11 19:38:49
*/
public class AlipayAssetAccountUnbindRequest implements AlipayRequest<AlipayAssetAccountUnbindResponse> {
private AlipayHashMap udfParams; // add user-defined text parameters
private String apiVersion="1.0";
/**
* 业务参数 使用该app提供用户信息的商户在支付宝签约时的支付宝账户userID,可以和app相同。
*/
private String providerId;
/**
* 用户在商户网站的会员标识。商户需确保其唯一性,不可变更。
*/
private String providerUserId;
public void setProviderId(String providerId) {
this.providerId = providerId;
}
public String getProviderId() {
return this.providerId;
}
public void setProviderUserId(String providerUserId) {
this.providerUserId = providerUserId;
}
public String getProviderUserId() {
return this.providerUserId;
}
private String terminalType;
private String terminalInfo;
private String prodCode;
private String notifyUrl;
private String returnUrl;
private boolean needEncrypt=false;
private AlipayObject bizModel=null;
public String getNotifyUrl() {
return this.notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
public String getReturnUrl() {
return this.returnUrl;
}
public void setReturnUrl(String returnUrl) {
this.returnUrl = returnUrl;
}
public String getApiVersion() {
return this.apiVersion;
}
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
public void setTerminalType(String terminalType){
this.terminalType=terminalType;
}
public String getTerminalType(){
return this.terminalType;
}
public void setTerminalInfo(String terminalInfo){
this.terminalInfo=terminalInfo;
}
public String getTerminalInfo(){
return this.terminalInfo;
}
public void setProdCode(String prodCode) {
this.prodCode=prodCode;
}
public String getProdCode() {
return this.prodCode;
}
public String getApiMethodName() {
return "alipay.asset.account.unbind";
}
public Map<String, String> getTextParams() {
AlipayHashMap txtParams = new AlipayHashMap();
txtParams.put("provider_id", this.providerId);
txtParams.put("provider_user_id", this.providerUserId);
if(udfParams != null) {
txtParams.putAll(this.udfParams);
}
return txtParams;
}
public void putOtherTextParam(String key, String value) {
if(this.udfParams == null) {
this.udfParams = new AlipayHashMap();
}
this.udfParams.put(key, value);
}
public Class<AlipayAssetAccountUnbindResponse> getResponseClass() {
return AlipayAssetAccountUnbindResponse.class;
}
public boolean isNeedEncrypt() {
return this.needEncrypt;
}
public void setNeedEncrypt(boolean needEncrypt) {
this.needEncrypt=needEncrypt;
}
public AlipayObject getBizModel() {
return this.bizModel;
}
public void setBizModel(AlipayObject bizModel) {
this.bizModel=bizModel;
}
}
| [
"tw l"
] | tw l |
0169ecb6ba6d43c1623fed90607dfa108ea910f0 | cd2a1e1a5857fc7f272e48210161efb9e0722904 | /jboard2/src/kr/co/jboard2/controller/CommandAction.java | 1871723716e65915eb894e2f038bc734c88b5bf5 | [] | no_license | heeglee/jspboard | 5958db90d4ae38ec347609933ba1419a7aebcb3c | 120ce85cf460c7f537f2d5eb17bf8aff8bc41a78 | refs/heads/master | 2020-04-10T20:30:41.327155 | 2018-12-26T01:44:29 | 2018-12-26T01:44:29 | 161,270,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 263 | java | package kr.co.jboard2.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface CommandAction {
public String requestProc(HttpServletRequest request, HttpServletResponse response);
}
| [
"heega@DESKTOP-0O56IMB"
] | heega@DESKTOP-0O56IMB |
d40b6a1c39916e6244fd8eb956cb444316896f8c | dff36e9d7bc5df3bb6e7c18276d68b8f8991f666 | /src/main/test/com/sheby/oddOrEvenTest.java | fc7043b32510772716cfde155b118f18ed8257d5 | [] | no_license | ShebyBabu/Java-TestingSet-PE01 | b2d41c2fd2d5f803eb31ff1fb1be5feaf3f7ef77 | ea8c1412e9190a5441a9bc961be93ae059825e4e | refs/heads/master | 2020-05-17T22:35:29.459810 | 2019-04-29T05:38:34 | 2019-04-29T05:38:34 | 184,006,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,075 | java | package com.sheby;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class oddOrEvenTest {
private oddOrEven oddEven;
@Before
public void setUp() throws Exception {
oddEven = new oddOrEven(25);
//System.out.println("This test is running before the test cases");
}
@After
public void tearDown() throws Exception {
oddEven = new oddOrEven(25);
//System.out.println("This test is running after the test cases");
}
@Test
public void checkOdd() throws Exception {
//oddEven=new oddOrEven(25);
String result=oddEven.checkOddOrEven(25);
assertEquals("Tom", result);
}
@Test
public void checkEven() throws Exception {
//oddEven=new oddOrEven(25);
String result=oddEven.checkOddOrEven(26);
assertEquals("Jerry", result);
}
@Test
public void checkRange() throws Exception {
String result=oddEven.checkOddOrEven(32);
assertEquals("Error",result);
}
} | [
"[email protected]"
] | |
d2b81ce4ad66ae48a9f4844b2fb6b6268f05ae1f | fe82b60c85ab16839aa10884bc0b5b5480cd8264 | /app/src/main/java/com/mncomunity1/ViewPagerAdapter.java | bdcc7c7b9461fe2c6e8f4eed112350e9816c7e1e | [] | no_license | Itissoftware/Maintenance-Community | 94306e043b2f2847573919282c2cdef218778957 | 9c23675f607869db35ae17b51507577b8aa6f1f8 | refs/heads/master | 2021-01-02T22:54:08.019179 | 2017-08-31T18:18:29 | 2017-08-31T18:18:29 | 99,417,131 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,088 | java | package com.mncomunity1;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
public class ViewPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public ViewPagerAdapter(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
@Override
public int getItemPosition(Object object){
return super.getItemPosition(object);
}
}
| [
"[email protected]"
] | |
8eb500a84f9945ab7e66852df7f37ed08c43bc64 | bdcfd9395419c01d2a6f97202668c17c16709a26 | /src/exercices/AreaCirculo02.java | 1c983360343783259b5975d026e7ab536173849a | [] | no_license | mucheniski/java-completo-2019 | 5735abb620752cd9443da7c6970bef9d4397eaa4 | 1c00e9341734f874de32d5124f13ab90252c221c | refs/heads/master | 2020-07-08T12:54:01.567453 | 2019-09-08T19:37:38 | 2019-09-08T19:37:38 | 203,678,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package exercices;
import java.util.Locale;
import java.util.Scanner;
public class AreaCirculo02 {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
double raio, area, pi=3.14159;
raio = sc.nextDouble();
area = pi * Math.pow(raio, 2);
System.out.printf("A=%.4f%n", area);
sc.close();
}
}
| [
"[email protected]"
] | |
81da803e9e02e3eb0595d27d2b672fcb45cd763f | 2bea965fae75b1c21bf010cd88fa99ae963f4ae3 | /DS/String/541_reverse_string_2.java | 898b259b4afd80bafeb567e1da7d4aa22a005872 | [
"MIT"
] | permissive | YinhaoHe/LeetCode | b05ba30cdc2c87435a7c03dd1c8e27d1512cc234 | f33219264a2b998121634f30d3d197fa9a484069 | refs/heads/master | 2021-11-14T19:41:04.290094 | 2021-10-18T03:18:08 | 2021-10-18T03:18:08 | 242,684,259 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | class Solution {
public String reverseStr(String s, int k) {
char[] arr = s.toCharArray();
for (int start = 0; start < arr.length; start += 2 * k) {
int i = start, j = Math.min(start + k - 1, arr.length - 1);
while (i < j) {
char tmp = arr[i];
arr[i ++] = arr[j];
arr[j --] = tmp;
}
}
return new String(arr);
}
} | [
"[email protected]"
] | |
a233837deb2a7c2aaaed270fc3c32ac11f7d60da | ea019308fe40f513bee8819bc47fd31fe906d047 | /src/snakegame/CellDataProviderintf.java | b634e2487d97fd9ebf39f5faec3f69180fb58d2b | [] | no_license | camillecampbell/SnakeGame | 5c64dbef3bcb0497a4e071d1106e35beafdbaaf1 | 9486a8f241c7d7705cb83a662f5a4edf8bcdb129 | refs/heads/master | 2016-08-11T18:38:53.773275 | 2016-02-19T19:14:26 | 2016-02-19T19:14:26 | 47,998,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | 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 snakegame;
/**
*
* @author Camille
*/
public interface CellDataProviderintf {
public int getCellWidth();
public int getCellHeight();
public int getSystemCoordX(int x, int y);
public int getSystemCoordY(int x, int y);
}
| [
"[email protected]"
] | |
533cf1f853b429744a2324b2c30909552f11dfa5 | eaa3da760e1901e8b462ad235a843d43b4f7ffe4 | /app/src/main/java/com/augustopinto/melichallenge/util/Resource.java | 55736ac4c967dcbbc077ca6785bf571d006baac2 | [] | no_license | augusto2610/meli_challenge | 18ce6d7ef73c1319f50e6eff5aabef4ac0355851 | 77838334a866416cb44d00ccdad860fa652c98cb | refs/heads/master | 2020-05-02T10:42:35.319754 | 2019-04-03T20:10:54 | 2019-04-03T20:10:54 | 177,904,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | java | package com.augustopinto.melichallenge.util;
public class Resource<T> {
public enum Status {
SUCCESS, ERROR, LOADING
}
private Status mStatus;
private T mData;
private Exception mException;
public Resource success(T data) {
mStatus = Status.SUCCESS;
mData = data;
mException = null;
return this;
}
public Resource error(Exception exception) {
mStatus = Status.ERROR;
mData = null;
mException = exception;
return this;
}
public Resource loading() {
mStatus = Status.LOADING;
mData = null;
mException = null;
return this;
}
public Status getStatus() {
return mStatus;
}
public T getData() {
return mData;
}
public Exception getException() {
return mException;
}
}
| [
"[email protected]"
] | |
bc5af238e3c125bb5b0aee0cd950354cf91f0031 | aead0046ee8eab25c03649666794b373ebd5d462 | /sourceopener/src/net/ftlines/wicketsource/sourceopener/PackageFileSearchRequester.java | 9d3a3d894e478730dc37e5fb80a5fd62d7f44a44 | [] | no_license | astrapi69/wicket-source | 85bd3047cac6db01b6c3c0bfef8ab2db2faed6f8 | fa200fe6b0d29362a334772787729279a9d9d9d5 | refs/heads/master | 2020-12-31T03:26:03.087731 | 2015-10-17T14:54:08 | 2015-10-17T14:54:08 | 26,870,742 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,216 | java | package net.ftlines.wicketsource.sourceopener;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import net.ftlines.wicketsource.sourceopener.views.OpenFileException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.search.SearchMatch;
import org.eclipse.jdt.core.search.SearchRequestor;
public class PackageFileSearchRequester extends SearchRequestor implements IExceptionCallbackHandler {
private String packageName;
private String fileName;
List<SearchMatch> list = new ArrayList<SearchMatch>();
boolean complete = false;
boolean cancelled = false;
IProgressMonitor progressMonitor;
Exception exceptionWhileSearching;
Logger log = Logger.getLogger("PackageFileSearchRequester");
public PackageFileSearchRequester(String packageName, String fileName) {
// IWorkspace workspace= ResourcesPlugin.getWorkspace();
// IPath workspaceRoot = workspace.getRoot().getLocation();
// IProject[] projects = workspace.getRoot().getProjects();
this.packageName = packageName;
this.fileName = fileName;
progressMonitor = new FileSearchProgressMonitor();
}
public void searchAndWait() throws OpenFileException
{
exceptionWhileSearching = null;
search();
waitForCompletion();
if (exceptionWhileSearching != null) {
throw new OpenFileException(OpenFileException.Reason.EXCEPTION, exceptionWhileSearching);
}
}
private void waitForCompletion()
{
// wait for completion kills the display thread, but what else should I do? TODO:FIXME
while (!this.complete) {
try {
Thread.sleep(100);
} catch (InterruptedException ie) {
}
if (cancelled) {
progressMonitor.setCanceled(true);
break;
}
}
}
private void search()
{
Job job = new SearchWithProgress(this, packageName, fileName);
job.setUser(true);
job.schedule();
}
public boolean isCancelled()
{
return cancelled;
}
public void setCancelled(boolean cancelled)
{
this.cancelled = cancelled;
progressMonitor.setCanceled(cancelled);
}
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
list.add(match);
}
public SearchMatch[] allMatches()
throws OpenFileException
{
if (list.isEmpty()) {
throw new OpenFileException(OpenFileException.Reason.FILE_NOT_FOUND);
}
SearchMatch[] matches = new SearchMatch[list.size()];
for (int i = 0; i < list.size(); i++) {
SearchMatch match = list.get(i);
log.info("Matched SourceOpener file with project-relative path of project=" + match.getResource().getProject() + " and path=" + match.getResource().getProjectRelativePath());
matches[i] = match;
}
return matches;
}
@Override
public void beginReporting()
{
complete = false;
list.clear();
}
@Override
public void endReporting()
{
complete = true;
}
@Override
public void onError(Exception e)
{
exceptionWhileSearching = e;
Logger log = Logger.getLogger("SearchWithProgress");
log.info("Problem with search engine : " + e);
}
}
| [
"[email protected]"
] | |
74a5f2d741111a1ea99b4020d67393acfc1e9d21 | dc620b8f6ea4333804708b1d5e843d795be8763c | /app/src/main/java/com/badr/mockapp/DividerItemDecoration.java | bf5554c762e26fc8a80f9710ee0d7d929bd8186d | [
"MIT"
] | permissive | AhmedBadr2018/mockApp | 68ec2f4984d6a61196f090634c76a7eada18e515 | ab54f6bbf44e25e19315b17daaf231e797b45d71 | refs/heads/main | 2023-02-04T08:56:15.370632 | 2020-12-27T16:19:50 | 2020-12-27T16:19:50 | 324,334,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,414 | java | package com.badr.mockapp;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
private Drawable mDivider;
private int mPaddingLeft;
public DividerItemDecoration(Drawable divider) {
mDivider = divider;
mPaddingLeft = 0;
}
public DividerItemDecoration(Drawable divider, int paddingLeft) {
mDivider = divider;
mPaddingLeft = paddingLeft;
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
if (mDivider == null) return;
if (parent.getChildAdapterPosition(view) < 1) return;
if (getOrientation(parent) == LinearLayoutManager.VERTICAL) {
outRect.top = mDivider.getIntrinsicHeight();
} else {
outRect.left = mDivider.getIntrinsicWidth();
}
}
@Override
public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
if (mDivider == null) {
super.onDrawOver(canvas, parent, state);
return;
}
if (getOrientation(parent) == LinearLayoutManager.VERTICAL) {
final int left = parent.getPaddingLeft() + mPaddingLeft;
final int right = parent.getWidth() - parent.getPaddingRight();
final int childCount = parent.getChildCount();
for (int i = 1; i < childCount; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int size = mDivider.getIntrinsicHeight();
final int top = child.getTop() - params.topMargin;
final int bottom = top + size;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(canvas);
}
} else {
final int top = parent.getPaddingTop();
final int bottom = parent.getHeight() - parent.getPaddingBottom();
final int childCount = parent.getChildCount();
for (int i = 1; i < childCount; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int size = mDivider.getIntrinsicWidth();
final int left = child.getLeft() - params.leftMargin;
final int right = left + size;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(canvas);
}
}
}
private int getOrientation(RecyclerView parent) {
if (parent.getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) parent.getLayoutManager();
return layoutManager.getOrientation();
} else
throw new IllegalStateException("DividerItemDecoration can only be used with a LinearLayoutManager.");
}
}
| [
"[email protected]"
] | |
03b8b113a091368d85b52bdc340305db1b9ddea1 | 617b113244e5afcd1fb4c2ad96d96a53d1afd381 | /PluginsAndFeatures/com.persistent.winazure.eclipseplugin/src/com/persistent/contextmenu/AddWorkerRole.java | 6b4ca6e76aa6ff1b809d779fbc5621b4d36595a8 | [] | no_license | gouthammc/MyRun | 6e123eec797155f32ea167c3df1f4ebba40475af | 18875fe784341d4ecfde26c1de8882ff2414cee6 | refs/heads/master | 2021-03-13T00:06:48.947103 | 2014-04-28T15:11:34 | 2014-04-28T15:11:34 | 19,239,800 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,288 | java | /**
* Copyright 2014 Microsoft Open Technologies, 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.persistent.contextmenu;
import org.eclipse.jface.window.Window;
import java.io.File;
import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import waeclipseplugin.Activator;
import com.interopbridges.tools.windowsazure.WindowsAzureProjectManager;
import com.interopbridges.tools.windowsazure.WindowsAzureRole;
import com.persistent.util.WAEclipseHelper;
/**
* Add Worker Role class will be invoked
* when sub menu "Add Role..." of fly out menu
* of azure deployment project
* is clicked.
* Dialog to add worker role will be opened.
*/
public class AddWorkerRole extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0)
throws ExecutionException {
try {
IProject selProject = WAEclipseHelper.getSelectedProject();
String path = selProject.getLocation().toPortableString();
WindowsAzureProjectManager waProjManager = WindowsAzureProjectManager.
load(new File(path));
List<WindowsAzureRole> listRoles = waProjManager.getRoles();
WindowsAzureRole windowsAzureRole = WAEclipseHelper.
prepareRoleToAdd(waProjManager);
int btnID = WAEclipseHelper.
openRolePropertyDialog(windowsAzureRole,
Messages.genPgId);
if (btnID == Window.CANCEL) {
listRoles.remove(windowsAzureRole);
}
WAEclipseHelper.refreshWorkspace(
com.persistent.winazureroles.Messages.rolsRefTitle,
com.persistent.winazureroles.Messages.rolsRefMsg);
} catch (Exception e) {
Activator.getDefault().log(e.getMessage());
}
return null;
}
}
| [
"[email protected]"
] | |
e09b347112c2a414acb98e2ad2aab021d2cb8012 | d2a54e07036aa333515761d3e62f593a99730cc0 | /app/src/main/java/com/example/inventorymaterial/ProductActivity.java | 2ef358a45ea4b471f5fe761941514a9661eb2569 | [] | no_license | zhuoIC/InventoryMaterialDesign | 15398a85daf45a3a7ef9fd173a3d4f5f8e968876 | 09f12f2b00b7394015531e9985b8660c7e6341fa | refs/heads/master | 2021-05-07T08:45:19.850608 | 2017-11-09T10:56:22 | 2017-11-09T10:56:22 | 109,399,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,682 | java | package com.example.inventorymaterial;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
/**
* Permite seleccionar todos los datos del producto
* @author Nicolás Hernández Jiménez
*/
public class ProductActivity extends AppCompatActivity {
Spinner spnCategory;
Spinner spnSubcategory;
Spinner spnType;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product);
spnCategory = (Spinner) findViewById(R.id.spnCategory);
spnSubcategory = (Spinner) findViewById(R.id.spnSubcategory);
spnType = (Spinner) findViewById(R.id.spnType);
ArrayAdapter<CharSequence> adpCategory = ArrayAdapter.createFromResource(this,
R.array.spnCategory, android.R.layout.simple_spinner_item);
adpCategory.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnCategory.setAdapter(adpCategory);
ArrayAdapter<CharSequence> adpSubcategory = ArrayAdapter.createFromResource(this,
R.array.spnSubcategory, android.R.layout.simple_spinner_item);
adpSubcategory.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnSubcategory.setAdapter(adpSubcategory);
ArrayAdapter<CharSequence> adpType = ArrayAdapter.createFromResource(this,
R.array.spnType, android.R.layout.simple_spinner_item);
adpCategory.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnType.setAdapter(adpType);
}
}
| [
"[email protected]"
] | |
1832c86726e49659f36da33b17f44da9f4d7a467 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/grade/769cd811312cbbb82c87033a78ac9584ad282550bcb9cc3ae8c4e3da44c288c1a5b3954e01998c3c0654ee6774ceab66e9fe5b135750905c917d2b0bb5fab98b/000/mutations/120/grade_769cd811_000.java | e516b77a3f2597f33c92b9868d19fae57316cf12 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,458 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class grade_769cd811_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
grade_769cd811_000 mainClass = new grade_769cd811_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
FloatObj A = new FloatObj (), B = new FloatObj (), C =
new FloatObj (), D = new FloatObj (), S = new FloatObj ();
output +=
(String.format
("Enter thresholds for A, B, C, D\nin that order, decreasing percentages > "));
A.value = scanner.nextFloat ();
B.value = scanner.nextFloat ();
C.value = scanner.nextFloat ();
D.value = scanner.nextFloat ();
output +=
(String.format ("Thank you. Now enter student score (percent) >"));
S.value = scanner.nextFloat ();
if (S.value >= A.value) {
output += (String.format ("Student has an A grade\n"));
}
if (S.value >= B.value && S.value < A.value) {
output += (String.format ("Student has an B grade\n"));
}
if (S.value >= D.value && S.value < B.value) {
output += (String.format ("Student has an C grade\n"));
}
if (S.value >= D.value && S.value < C.value) {
output += (String.format ("Student has an D grade\n"));
}
if (S.value < D.value) {
output += (String.format ("Student has an F grade\n"));
}
if (true)
return;;
}
}
| [
"[email protected]"
] | |
42a8f04ba5e5688f9927b397c3a1860d277d2b61 | 76e591db97358dc3745beed79c3a7526c583a5d2 | /src/main/java/com/github/khalemano/vdjmut/utilities/Hmmer.java | 950639cc8511b356cb1023899b6aa35397a2c393 | [] | no_license | khalemano/VDJMut | c3e4ecb40828e78ca7f1948f6f436826ba7ee05c | 90641a10706aef9171a8e41e470500ac0388f67f | refs/heads/master | 2021-01-11T07:48:18.380724 | 2015-09-25T02:11:18 | 2015-09-25T02:11:18 | 40,727,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,234 | java | package com.github.khalemano.vdjmut.utilities;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
/*
* 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.
*/
/**
*
* @author kalani
*/
public class Hmmer {
/**
* Finds the 1-based indexes for the start and ends of the four framework
* regions
*
* @param seq A string of [ATCG]s
* @return Array of 8 1-based index values for the start and ends
* of each framework region
*
*/
public static int[] findFrameworkRegions(String seq){
int[] results = new int[8];
//Construct hmmscan command
String command =
// call to hmmscan
"/home/kejun/MiSeq/Reference_databases/hmm_databases/" +
"hmmer-3.1b1-linux-intel-x86_64/binaries/hmmscan " +
//--domE sets a threshold for the domain E score
"--domE 0.01 " +
//this sets the location of the hmm database
"/home/kejun/MiSeq/Reference_databases/hmm_databases/FWR.hmm " +
//this sets the input to stdin
"-";
// "/home/kejun/MiSeq/Reference_databases/hmm_databases/test.fasta";
try{
//Open a process to execute the hmmscan command
Process p = Runtime.getRuntime().exec(command);
//Creates a BufferedWriter to output the sequence string to hmmscan
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
p.getOutputStream()));
//Creates BufferedReader to accept the output of hmmscan
BufferedReader err = new BufferedReader(
new InputStreamReader(p.getErrorStream()));
//Creates BufferedReader to accept the output of hmmscan
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
//sends stdin to hmmscan
seq = ">test\n" + seq;
out.write(seq);
out.flush();
out.close();
//reads stdout from hmmscan; stdout is in the form of a
// human-readable table, so it must be parsed with spaces
//rather than tabs or commas
String line;
while ((line = in.readLine()) != null){
//find segments with indexes for the four framework regions
if(line.startsWith(">> FWR")){
String FWR = line.substring(3, 7);
int indexStart =0;
int indexEnd = 0;
switch (FWR) {
case "FWR1":
indexStart = 0;
indexEnd = 1;
break;
case "FWR2":
indexStart = 2;
indexEnd = 3;
break;
case "FWR3":
indexStart = 4;
indexEnd = 5;
break;
case "FWR4":
indexStart = 6;
indexEnd = 7;
break;
}
in.readLine();
in.readLine();
String line2 = in.readLine();
String[] data = line2.split("\\s+");
results[indexStart] = Integer.valueOf(data[13]);
results[indexEnd] = Integer.valueOf(data[14]);
}
}
} catch (IOException e){
System.out.println(e);
}
return results;
}// End of method FindFrameworkRegions
}//End of class Hmmer
| [
"[email protected]"
] | |
fb7031b0ee7af90b9630b3e4feafbf70ded91e83 | a3e110e3936c8bebde78ea35e2b157ca531943e1 | /src/main/java/com/cjt/concurrency3/MyTest4.java | 63b4ec8cdf76ee9e98f4e59e1931b3b8f587a19e | [] | no_license | cjt281570985/java_concurrency | 13e2ae4979bbeb334008a55d7b9f3f18c5b4b989 | fd38eceece87d8828d6afa14e153f6bb6fc6fd8b | refs/heads/master | 2023-07-06T20:51:29.454081 | 2023-06-29T04:12:34 | 2023-06-29T04:12:34 | 229,276,347 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package com.cjt.concurrency3;
/**
* 编译器对于锁的优化措施:
*
* 锁消除技术
* JIT编译器(Just In Time编译器)可以在动态编译同步代码时,使用一种叫做逃逸分析的技术,来通过该项技术判别程序中所使用
* 的锁对象是否只被一个线程所使用,而没有散布到其他线程当中;如果情况就是这样的话,那么JIT编辑器在编译这个同步代码时就
* 不会生成synchronized关键字所标识的锁的申请与释放机器码,从而消除了锁的使用流程。
*/
public class MyTest4 {
//若将此行移到方法内有何差别
//private Object object = new Object();
public void test() {
Object object = new Object(); //此代码在方法体内,同步无意义. 字节码生成是是还会出现monitor
//此例在真正执行时 synchronized 相当于不存在
synchronized (object) {
System.out.println("hello world");
}
}
}
| [
"[email protected]"
] | |
d18f9eff09f5bdd3b36620d61e3314197a574b3a | 993cae9edae998529d4ef06fc67e319d34ee83ef | /src/cn/edu/sau/eop/sdk/widget/IWidget.java | 3c551c9a27d00ddccfa0e9e0e912d0f9024ef874 | [] | no_license | zhangyuanqiao93/MySAUShop | 77dfe4d46d8ac2a9de675a9df9ae29ca3cae1ef7 | cc72727b2bc1148939666b0f1830ba522042b779 | refs/heads/master | 2021-01-25T05:02:20.602636 | 2017-08-03T01:06:43 | 2017-08-03T01:06:43 | 93,504,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 626 | java | package cn.edu.sau.eop.sdk.widget;
import java.util.Map;
/**
* 挂件接口
*/
public interface IWidget {
/**
* 解析挂件并返回解析后的html片段
* @param params 挂件参数Map
* @return 解析后的html片段
*/
public String process(Map<String, String> params);
/**
* 挂件设置
* @param params
* @return
*/
public String setting(Map<String, String> params);
/**
* 挂件数据 更新操作
* @param params
*/
public void update(Map<String, String> params);
/**
* 挂件是否缓存
* @return true:缓存 false不缓存
*/
public boolean cacheAble();
}
| [
"[email protected]"
] | |
d57b721117df816b673fb3a1f56c5d3f58d18233 | 7491d268f73927617d11a89510c4e917f24b8a1c | /practice 3/resultactivity/src/androidTest/java/ru/mirea/tyve/resultactivity/ExampleInstrumentedTest.java | 1709d09175527763e7f17f538318e0d13bff15b4 | [] | no_license | NineDoctor/lab_mobile | 58f1e069239ba99a43b4d52daf29fc2a8b1988c5 | d5d735e43b6d3fa4e8a1031c0d0e6861140062f1 | refs/heads/master | 2023-05-11T04:00:09.428874 | 2021-06-06T21:05:39 | 2021-06-06T21:05:39 | 374,461,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package ru.mirea.tyve.resultactivity;
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("ru.mirea.tyve.resultactivity", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
ae5d96db00fa21d6221fe9796abcb64e634b8f8a | a0d040f8ba2600d4b206c2d7884b6897d0785196 | /bootstrap/src/main/java/com/cll/bootstrap/tcp/ServerBootstrap0.java | 395541b781d30e27c87f95ba1dccb7e16706476a | [] | no_license | iloveruning/netty-demo | 098a8f808e1d8576829e5efb0cfab0895d6ecae1 | f7e91bb0df6aec15f315de14ee964b5fe09c5f3f | refs/heads/master | 2020-03-10T20:59:44.285206 | 2018-04-17T14:57:31 | 2018-04-17T14:57:31 | 129,582,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,830 | java | package com.cll.bootstrap.tcp;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.util.AttributeKey;
/**
* @author chenliangliang
* @date 2018/4/16
*/
public class ServerBootstrap0 {
public static void main(String[] args) throws InterruptedException {
final AttributeKey<Integer> id=AttributeKey.valueOf("ID");
EventLoopGroup group=new NioEventLoopGroup();
ServerBootstrap bootstrap=new ServerBootstrap();
bootstrap.group(group)
.channel(NioServerSocketChannel.class)
.handler(new SimpleChannelInboundHandler<ByteBuf>() {
@Override
protected void messageReceived(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf) throws Exception {
}
})
.childHandler(new SimpleChannelInboundHandler<ByteBuf>() {
@Override
protected void messageReceived(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf) throws Exception {
}
});
bootstrap.option(ChannelOption.SO_KEEPALIVE,true)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,5000);
bootstrap.attr(id,123456);
ChannelFuture future = bootstrap.bind(8989);
future.addListener((ChannelFutureListener) channelFuture -> {
if (channelFuture.isSuccess()) {
System.out.println("Server bound");
} else {
System.err.println("Bound attempt failed");
channelFuture.cause().printStackTrace();
}
});
future.sync();
}
}
| [
"[email protected]"
] | |
417300483281c5b2c6607b5d3b600864e3f894eb | ba3346bfe48d4a42d6d9682abb60081643b93ba6 | /HashTableCounter/src/correa/Test.java | 6789351e31bce3d50078badccfad92a4c075b3af | [] | no_license | jarin-correa/HashTableCounterRepository | cd45254dd46e1360b72f7e6ceb090a2cf16b2817 | 58a440b3c28a0d689bc07f00fe260c4e7832472d | refs/heads/master | 2022-12-27T22:36:36.841731 | 2020-10-12T06:55:26 | 2020-10-12T06:55:26 | 303,302,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | package correa;
public class Test {
//THIS IS JUST TO TEST FOR COMMENTS AND WHITE SPACE
/**/
int i = 0;
}
| [
"[email protected]"
] | |
e27f06b07b9cc78a1cc39cdb655e7e059ae936e8 | 7b0c196c420bf11283c819bda9f65472e1327d05 | /src/main/java/rhinova/metapopulation/model/components/reserve/ReserveInputable.java | 2fba2ea2754c8513b04be2c64f6654c424dee96f | [] | no_license | derrick3192/populationoptimizer | fedc09bea0595468668b9e4d6f948a3931ff4956 | 423f9a9c631965f6f8b4a295c52e68dcd3db4886 | refs/heads/master | 2021-01-10T11:55:52.094732 | 2015-11-24T05:16:36 | 2015-11-24T05:16:36 | 46,768,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package rhinova.metapopulation.model.components.reserve;
import rhinova.metapopulation.model.components.Inputable;
public interface ReserveInputable extends Inputable{
}
| [
"[email protected]"
] | |
8dcc7256d35f968771fb870b6f503864ebcda7fb | ef084495c5781c0246cbfafcf5b21fc52bb59789 | /6th week/java-homework-day-2/Cohort.java | c66c451f1de3ee8013a750b77f91ae3849aa34cb | [] | no_license | andrewrlonsdale/CodeClan-Homework | 37dfeceb139d00f3d7d12c49e1886f5e02f35090 | 02f5304c298401453e6d2469f2e04eaf63f9dc03 | refs/heads/master | 2021-01-11T11:18:07.262601 | 2017-03-13T23:27:59 | 2017-03-13T23:27:59 | 78,626,576 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | import java.util.*;
public class Cohort {
private String name;
private ArrayList<Classroom> room;
public Cohort(String name){
this.name = name;
this.room = new ArrayList<Classroom>();
}
public String getName(){
return this.name;
}
public void add(Classroom person) {
room.add(person);
}
public int personCount(){
return room.size();
}
public void empty(){
room.clear();
}
} | [
"[email protected]"
] | |
da19b491292023031bceee13a3ea6440dd6159e8 | ad3ad2bd7b5da324ad06d2a0e26fda18687fae68 | /XMLScanner/src/main/java/com/xmlscanner/daoimpl/UploadsDAOImpl.java | 7948450e01b60923d9a0cb89cef9acaf72d4715b | [] | no_license | MubashirAR/Guess-The-Vehicle | 2fd5fcd76410bd73a0bb441a5a4709451a798112 | d539cad36eb2b5e6c2228a4460ac20786b8fe5c6 | refs/heads/master | 2021-05-11T11:28:04.351578 | 2018-01-16T05:52:25 | 2018-01-16T05:52:25 | 117,637,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,683 | java | package com.xmlscanner.daoimpl;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.xmlscanner.dao.UploadsDAO;
import com.xmlscanner.model.Uploads;
@Transactional
@Repository("uploadsDAO")
public class UploadsDAOImpl implements UploadsDAO{
@Autowired
private SessionFactory sessionFactory;
@Transactional
public Uploads get(String id) {
// TODO Auto-generated method stub
return (Uploads) sessionFactory.getCurrentSession().createQuery("from Uploads where id='"+id+"'").uniqueResult();
}
@Transactional
public Uploads save(Uploads uploads) {
uploads.setId(getMaxId());
uploads.setTimestamp(LocalDateTime.now());
try {
sessionFactory.getCurrentSession().save(uploads);
return uploads;
} catch (HibernateException e) {
e.printStackTrace();
return null;
}
}
@Transactional
private Long getMaxId() {
Long maxID = 100L;
try {
String hql = "select max(id) from Uploads";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
if (query !=null && query.uniqueResult() !=null) {
maxID = (Long) query.uniqueResult();
}
} catch (HibernateException e) {
maxID = 100L;
e.printStackTrace();
}
return maxID + 1;
}
@Override
public List<Uploads> getAll() {
return sessionFactory.getCurrentSession().createQuery("from Uploads").list();
}
}
| [
"[email protected]"
] | |
c1857d9e7298fdefa3cedb5962d4ae80df70e1ff | 33a2c7a30780d16190a6b3db32422d33772f5338 | /comcarde/src/main/java/com/comcarde/assessment/models/AdviceDetails.java | 462e55ae9e8d8a7c3d9c991d5ed2eab90e7f3aa9 | [] | no_license | 23021981/assessment-comcarde | 777dcbc9b2b9bcc97043d6954768f6ec2fbe136e | 1a0d2a125b7d72dbe0dd1d5025c8bdf023d23d54 | refs/heads/master | 2021-01-14T07:16:43.209175 | 2020-02-24T10:35:09 | 2020-02-24T10:35:09 | 242,636,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package com.comcarde.assessment.models;
import lombok.*;
/**
*Author : Atul Kumar
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AdviceDetails {
String productName;
String suggestionMessage;
}
| [
"[email protected]"
] | |
413f35e3c00efdd92adf9aa29f3b607fb5fbf5df | 1ff716cf6a4acbfe0398c4c3056f2c6f020d75ab | /app/src/main/java/com/zht/samplewidget/activity/LineChartActivity.java | 45bb32347ffdc03ee6a0334acdeaf2180282ee94 | [] | no_license | zhtoo/MyWidget | 6ace5d3ddad83a9f0c188d0d826e552040845be4 | e47903e6ba76a7956e306374c5d3dc900ccb8e7a | refs/heads/master | 2021-01-06T20:36:50.025184 | 2020-08-06T02:44:26 | 2020-08-06T02:44:26 | 99,529,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,646 | java | package com.zht.samplewidget.activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import com.zht.samplewidget.R;
import com.zht.samplewidget.myView.chart.LineChartParams;
import com.zht.samplewidget.myView.chart.LineChartView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by ZhangHaitao on 2019/11/22
*/
public class LineChartActivity extends AppCompatActivity {
private final String TAG = this.getClass().getSimpleName();
private LineChartView lineChartView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Log.e(TAG, "onCreate");
super.onCreate(savedInstanceState);
Log.e(TAG, "setContentView");
setContentView(R.layout.activity_line_chart);
Log.e(TAG, "findViewById");
lineChartView = findViewById(R.id.lineChartView);
// handler.sendEmptyMessageDelayed(1000 ,2000);
}
//
// Handler handler = new Handler(){
// @Override
// public void handleMessage(Message msg) {
//
// }
// };
String[] oneDate = {"12-01", "12-02", "12-03", "12-04", "12-05", "12-06", "12-07"};
Integer[] oneData1 = {0, 0, 0, 0, 0, 0, 0};
Integer[] oneData2 = {0, 0, 0, 0, 0, 0, 0};
Integer[] oneData3 = {0, 0, 0, 0, 0, 0, 0};
public void one(View view) {
for (int i = 0; i < oneDate.length; i++) {
oneData1[i]= (int) (Math.random()*500);
oneData2[i]= (int) (Math.random()*500);
oneData3[i]= (int) (Math.random()*500);
}
createData(oneDate, oneData1, oneData2, oneData3);
}
String[] twoDate = {
"12-01", "12-02", "12-03", "12-04", "12-05", "12-06", "12-07",
"12-05", "12-06", "12-07", "12-08", "12-09", "12-06", "12-07",
"12-01", "12-02", "12-03", "12-04", "12-05", "12-06", "12-07",
"12-01", "12-02", "12-03", "12-04", "12-05", "12-06", "12-07",
"12-01", "12-02"};
Integer[] twoData1 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Integer[] twoData2 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Integer[] twoData3 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
public void two(View view) {
for (int i = 0; i < twoDate.length; i++) {
twoData1[i]= (int) (Math.random()*500);
twoData2[i]= (int) (Math.random()*500);
twoData3[i]= (int) (Math.random()*500);
}
createData(twoDate, twoData1, twoData2, twoData3);
}
String[] thirdDate = {"2018-11", "2018-12", "2019-01", "2019-02"};
Integer[] thirdData1 = {0, 0, 0, 0};
Integer[] thirdData2 = {0, 0, 0, 0};
Integer[] thirdData3 = {0, 0, 0, 0};
public void third(View view) {
for (int i = 0; i < thirdDate.length; i++) {
thirdData1[i]= (int) (Math.random()*500);
thirdData2[i]= (int) (Math.random()*500);
thirdData3[i]= (int) (Math.random()*500);
}
createData(thirdDate, thirdData1, thirdData2, thirdData3);
}
int[] colors = {0xFFFFB000, 0xFF3379F8, 0xFFFC4A5B};
String[] names = {"我的学习时长", "同事平均学习时长", "乱七八糟的学习时长"};
private void createData(
String[] data, Integer[]... integers
) {
LineChartParams lineChartBean = new LineChartParams();
lineChartBean.setyAxis(new LineChartParams.YAxisBean());
lineChartBean.setxAxis(new LineChartParams.XAxisBean());
lineChartBean.setSeries(new ArrayList<LineChartParams.SeriesBean>());
LineChartParams.XAxisBean xAxisBean = lineChartBean.getxAxis();
xAxisBean.setDrawColor(0xFF555555);
xAxisBean.setData(new ArrayList<String>());
xAxisBean.getData().addAll(Arrays
.asList(data));
List<LineChartParams.SeriesBean> series = lineChartBean.getSeries();
for (int i = 0; i < integers.length; i++) {
LineChartParams.SeriesBean seriesBean = new LineChartParams.SeriesBean();
seriesBean.setDrawColor(colors[i]);
seriesBean.setData(Arrays.asList(integers[i]));
seriesBean.setName(names[i]);
series.add(seriesBean);
}
LineChartParams.YAxisBean yAxisBean = lineChartBean.getyAxis();
yAxisBean.setDrawColor(0xFFCCCCCC);
lineChartView.setParams(lineChartBean);
}
}
| [
"[email protected]"
] | |
c966498386e4770de0398c8b3f81dcda27a343d4 | 04253c148f24f31fe579f6ec889d8baa2cc702af | /563 Binary Tree Tilt .java | d8bf6eb6f6ccabb66ec5b8083d3a323ed1e5661c | [] | no_license | parteek-3108/LeetCode | ef6e0169c7641ca7e7ae32a513ab5bc9634b7cbf | 0051b6563eb49a26362060344e18bf2891209f43 | refs/heads/master | 2023-01-24T13:23:06.995019 | 2020-12-07T07:52:06 | 2020-12-07T07:52:06 | 300,227,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
* this.left = left;
* this.right = right;
* }
* }
*/
class Solution {
int sum=0;
public int find(TreeNode root)
{
if(root==null)
return 0;
int l=find(root.left);
int r=find(root.right);
sum+=Math.abs(l-r);
return l+r+root.val;
}
public int findTilt(TreeNode root) {
find(root);
return sum;
}
} | [
"[email protected]"
] | |
e283587863d608f595be89081da4062f4faa6444 | 9b6d0b4cca96be08f89022e72fe61c677c04e782 | /src/com/pvedha/ms/main/IterateIt.java | c62324b88b74344221487b82ac909e0934128e64 | [] | no_license | pvedha/JavaContests | 24d47fc14e85946a2a2468a5e6b0673e2d778e48 | f9f45d2bba6f296dfe40d974c1b3ee5745bbc7f1 | refs/heads/master | 2021-08-29T16:56:52.407035 | 2017-12-14T10:50:57 | 2017-12-14T10:50:57 | 114,233,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package com.pvedha.ms.main;
import java.io.*;
import java.util.*;
public class IterateIt {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner in = new Scanner(System.in);
int count = in.nextInt();
Set<Integer> arr = new TreeSet<Integer>();
for(int i=0;i<count;i++){
arr.add(in.nextInt());
}
operate(arr);
System.out.println(ops);
}
static int ops = 0;
static void operate(Set<Integer> arr){
ops++;
System.out.println(arr.toString());
Set<Integer> tmp = new TreeSet<Integer>();
while(arr.size() > 2){
Integer i1 = (Integer) arr.toArray()[0];
arr.remove(i1);
System.out.println(i1);
for(Integer i2 : arr){
//if(i1 != i2){
tmp.add(Math.abs(i1-i2));
//}
}
}
System.out.println("Loop : " + ops + " Array Size : " + tmp.size());
if(tmp.size() == (Integer)tmp.toArray()[tmp.size()-1]){
ops+=tmp.size();
return;
}
if(tmp.isEmpty()) return;
operate(tmp);
}
} | [
"[email protected]"
] | |
901d18982ba53a90fb77ee4edf1c36bfe64ef29e | af798fcc3b31fbadf67619ffaf8436110d67761a | /src/test/java/ru/netology/web/CallbackTest.java | 5bed78bf2605ff58e16511ccbc2b52954fb8a9f1 | [] | no_license | elenaslavutina/2.1_WEB_and_Selenium_2 | d1278cc74da6f36f3582a5524ba6f63cc7e16d6c | fc9a529733c36143e942707e75ee9949a046c8cd | refs/heads/master | 2022-11-07T10:53:44.064189 | 2020-06-14T13:28:37 | 2020-06-14T13:28:37 | 268,851,104 | 0 | 3 | null | 2020-06-12T11:00:03 | 2020-06-02T16:22:59 | Java | UTF-8 | Java | false | false | 890 | java | package ru.netology.web;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import static com.codeborne.selenide.Selenide.open;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static com.codeborne.selenide.Selenide.*;
class CallbackTest {
@Test
void shouldTestV1() {
open("http://localhost:9999");
$(By.xpath("//*[@id=\"root\"]/div/form/div[1]/span/span/span[2]/input")).sendKeys("Василий Пупкин");
$("[data-test-id=phone] input").sendKeys("+71231234123");
$("[data-test-id=agreement]").click();
$("button.button").click();
String actual = $("[data-test-id=order-success]").getText();
assertEquals("Ваша заявка успешно отправлена! Наш менеджер свяжется с вами в ближайшее время.", actual.trim());
}
} | [
"[email protected]"
] | |
df2c7206a5f8089f7b2da68ff23854f84d3ae6fc | 09673dc20e7534a67c0db33504ba995e904c5e4f | /WebsiteDuan/src/main/java/com/website/Repository/BaitestRepository.java | 095b7c061e316771d3153ede91f928b4979d3fba | [] | no_license | virajtandel/WebsiteDuan | 1ba354c0b1144ff5905fa984d354bfb2cc7f9641 | dfe76143fada3899ed5925e6c584534767b89bc5 | refs/heads/master | 2022-12-26T16:29:06.232767 | 2020-10-01T05:40:24 | 2020-10-01T05:40:24 | 300,158,722 | 0 | 0 | null | 2020-10-01T05:38:50 | 2020-10-01T05:38:49 | null | UTF-8 | Java | false | false | 361 | java | package com.website.Repository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import com.website.Entity.Baitest;
public interface BaitestRepository extends CrudRepository<Baitest, Integer> {
@Query(value = "FROM Baitest e where e.idbaitest = ?1")
Baitest findByBaiTestbyID(Integer ID);
}
| [
"[email protected]"
] | |
d9122c9f52ae867b5c82973b3be0300df2a4830c | 2011e67a67c05619508f3797bcbc2b8cf2ab2936 | /HashSetDemo.java | cc954cf15318bc1c89c9cc344e33fd4bf23f6869 | [] | no_license | imdeepak12/Test | ca75ca73d4ac8cf3f2959d4074d405def642462e | 8c24ac6ad8430b3ab668ad96e47222c2ced5621a | refs/heads/master | 2023-07-09T09:57:23.352853 | 2021-08-17T04:37:30 | 2021-08-17T04:37:30 | 389,536,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | import java.util.*;
class HashSetDemo
{
public static void main(String[] args)
{
LinkedHashSet h = new LinkedHashSet(); //If we replace HashSet with LinkedhashSet then insertion order will be preserved.
h.add("A"); //That is the main difference bw these two.
h.add("L");
h.add(15);
h.add(null);
h.add("Z");
h.add("a");
h.add("h");
System.out.println(h.add("A")); //Duplicates are not allowed it just returns false no CE or RE.
System.out.println(h);
}
} | [
"[email protected]"
] | |
631c7e00f6a0f3fa4856af8364de16912dfb71a7 | 2ff8877af067bf82c0bcaaa6e586f08dd6f8835c | /src/main/java/sorting/SelectionSort.java | b648680bb24fec08b925fc7ebb9ab51dff6cdbb6 | [] | no_license | jeevanrd/mylearnings | 880fb5dda1d8bf4c4bcdb06395ef8f5d79a80762 | f46436728f3cb1bf61197cf66a78a3998b20dc60 | refs/heads/master | 2021-05-06T07:00:27.669135 | 2017-12-12T01:56:44 | 2017-12-12T01:56:44 | 113,928,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package sorting;
import java.util.Arrays;
public class SelectionSort {
public static void main(String args[]) {
int[] numbers = new int[] { 23,4,20,3,30, 6, 34, 11, 1};
int len = numbers.length;
for(int i = 0; i< len ; i++) {
int min_pos = i;
for(int j = i+1; j < len; j ++) {
if (numbers[j] < numbers[min_pos])
min_pos = j;
}
if(min_pos != i) {
int temp = numbers[i];
numbers[i] = numbers[min_pos];
numbers[min_pos] = temp;
}
}
System.out.println(Arrays.toString(numbers));
}
}
| [
"[email protected]"
] | |
348e527563ff7070ffbb6435067292e9c3e5dc3f | ebaabfe60887d529391f96c162bd395f38607ba4 | /app/src/main/java/com/nickming/familyfinancing/ui/chart/ChartFragment.java | 9ea58b8af443f1972819b1e0891f27a687b8f9fc | [] | no_license | nickming/FamilyFinancing | 27a2184d533e09461176d953185dc7656565b8a2 | ba9fbe64f49352a131804e15db2981b5cc77acc7 | refs/heads/master | 2020-05-22T21:41:02.867311 | 2017-03-12T13:18:57 | 2017-03-12T13:18:57 | 84,726,944 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,268 | java | package com.nickming.familyfinancing.ui.chart;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.afollestad.materialdialogs.MaterialDialog;
import com.borax12.materialdaterangepicker.date.DatePickerDialog;
import com.nickming.familyfinancing.R;
import com.nickming.familyfinancing.adapter.ChartDetailAdapter;
import com.nickming.familyfinancing.base.BaseApplication;
import com.nickming.familyfinancing.base.BaseFragment;
import com.nickming.familyfinancing.base.Constant;
import com.nickming.familyfinancing.engine.TypeIconFactory;
import com.nickming.familyfinancing.entity.ChartCountEntity;
import com.nickming.familyfinancing.entity.RecordTypeEntity;
import com.nickming.familyfinancing.util.TimeUtil;
import com.nickming.familyfinancing.widget.EarningAndExpendChangeBox;
import com.orhanobut.logger.Logger;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import lecho.lib.hellocharts.gesture.ZoomType;
import lecho.lib.hellocharts.model.PieChartData;
import lecho.lib.hellocharts.model.SliceValue;
import lecho.lib.hellocharts.view.PieChartView;
/**
* Desc:
* Author:nickming
* Date:2017/1/14
* Time:16:20
* E-mail:[email protected]
*/
public class ChartFragment extends BaseFragment implements ChartContract.View {
private static final String TAG = "ChartFragment";
@BindView(R.id.iv_chart_back)
ImageView mBack;
@BindView(R.id.chart_change_bar)
EarningAndExpendChangeBox mChartChangeBar;
@BindView(R.id.tv_chart_from_date)
TextView mFromDateTv;
@BindView(R.id.tv_chart_to_date)
TextView mToDateTv;
@BindView(R.id.pie_chart)
PieChartView mPieChart;
@BindView(R.id.rv_chart)
RecyclerView mRecyclerView;
@BindView(R.id.tv_chart_change)
TextView mChartChangeTv;
private DatePickerDialog mDatePickerDialog;
private ChartContract.Presenter mPresenter;
private ChartDetailAdapter mAdapter;
private List<ChartCountEntity> mChartCountList = new ArrayList<>();
private int mCurrentType = ChartPresenter.TYPE_EXPEND;
private int mCurrentFromDate;
private int mCurrentToDate;
private String mCurrentBookName = "mime";
private boolean isChannel = false;
public static ChartFragment newInstance() {
Bundle args = new Bundle();
ChartFragment fragment = new ChartFragment();
fragment.setArguments(args);
return fragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_chart, container, false);
ButterKnife.bind(this, rootView);
return rootView;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
back();
}
});
if (getActivity().getIntent() != null) {
mCurrentBookName = getActivity().getIntent().getStringExtra(Constant.ACCOUNT_BOOK_NAME);
}
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
mRecyclerView.setAdapter(mAdapter = new ChartDetailAdapter(mChartCountList));
mPieChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
mAdapter.setChannel(false);
mAdapter.setClickItemListener(new ChartDetailAdapter.OnCLickItemClickListener() {
@Override
public void clickItem(ChartCountEntity chartCountEntity) {
showItemDetail(chartCountEntity);
}
});
mChartChangeBar.setOnChnageStyleListener(new EarningAndExpendChangeBox.OnChangeStyleListener() {
@Override
public void onChangeToEarning() {
if (!isChannel)
mPresenter.requestChartData(mCurrentBookName, true, mCurrentFromDate, mCurrentToDate);
else
mPresenter.requestChannelChartData(mCurrentBookName, true, mCurrentFromDate, mCurrentToDate);
}
@Override
public void onChangeToExpend() {
if (!isChannel)
mPresenter.requestChartData(mCurrentBookName, false, mCurrentFromDate, mCurrentToDate);
else
mPresenter.requestChannelChartData(mCurrentBookName, false, mCurrentFromDate, mCurrentToDate);
}
});
//日历选择器的初始化
Calendar now = Calendar.getInstance();
mDatePickerDialog = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth,
int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) {
Log.i(TAG, "onDateSet: " + dayOfMonth + "," + dayOfMonthEnd);
int fromDate = year * 10000 + (monthOfYear + 1) * 100 + dayOfMonth;
int toDate = yearEnd * 10000 + (monthOfYearEnd + 1) * 100 + dayOfMonthEnd;
Logger.i("from:" + fromDate);
Logger.i("to:" + toDate);
if (!isChannel) {
if (mCurrentType == ChartPresenter.TYPE_EXPEND) {
mPresenter.requestChartData(mCurrentBookName, false, fromDate, toDate);
} else {
mPresenter.requestChartData(mCurrentBookName, true, fromDate, toDate);
}
} else {
if (mCurrentType == ChartPresenter.TYPE_EXPEND) {
mPresenter.requestChannelChartData(mCurrentBookName, false, fromDate, toDate);
} else {
mPresenter.requestChannelChartData(mCurrentBookName, true, fromDate, toDate);
}
}
mCurrentFromDate = fromDate;
mCurrentToDate = toDate;
mFromDateTv.setText(convertIntToStr(mCurrentFromDate));
mToDateTv.setText(convertIntToStr(mCurrentToDate));
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
//选择日期
mFromDateTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectDate();
}
});
mToDateTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectDate();
}
});
mCurrentFromDate = Integer.valueOf(TimeUtil.getFirstDayOfMonth(TimeUtil.DATABASE_TIME_FORMAT));
mCurrentToDate = Integer.valueOf(TimeUtil.getCurrentTime(TimeUtil.DATABASE_TIME_FORMAT));
mFromDateTv.setText(convertIntToStr(mCurrentFromDate));
mToDateTv.setText(convertIntToStr(mCurrentToDate));
mPresenter.requestChartData(mCurrentBookName, false, mCurrentFromDate, mCurrentToDate);
mChartChangeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new MaterialDialog.Builder(getActivity())
.title("更改")
.items(R.array.chart_list)
.itemsCallbackSingleChoice(-1, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
if (text.equals("消费类型统计")) {
isChannel = false;
mAdapter.setChannel(false);
mPresenter.requestChartData(mCurrentBookName, false, mCurrentFromDate, mCurrentToDate);
} else {
mAdapter.setChannel(true);
isChannel = true;
mPresenter.requestChannelChartData(mCurrentBookName, false, mCurrentFromDate, mCurrentToDate);
}
return false;
}
})
.positiveText("确定")
.show();
}
});
}
private String convertIntToStr(int date) {
String result = String.valueOf(date);
return result.substring(4, 6) + "-" + result.substring(6, result.length());
}
@Override
public void setPresenter(ChartContract.Presenter presenter) {
this.mPresenter = presenter;
}
@Override
public void showSelectDate() {
mDatePickerDialog.show(getActivity().getFragmentManager(), TAG);
}
@Override
public void showItemDetail(ChartCountEntity chartCountEntity) {
Intent intent = new Intent(getActivity(), ChartDetailActivity.class);
intent.putExtra(Constant.CHART_COUNT_ENTITY, chartCountEntity);
intent.putExtra(Constant.CHART_COUNT_ENTITY_CHANNEL, isChannel);
getActivity().startActivity(intent);
}
@Override
public void showChartAndDetail(List<ChartCountEntity> chartCountEntities) {
if (chartCountEntities != null && chartCountEntities.size() != 0) {
List<SliceValue> sliceValueList = new ArrayList<>();
int size = chartCountEntities.size();
float sum = 0;
for (int i = 0; i < size; i++) {
ChartCountEntity entity = chartCountEntities.get(i);
if (entity.getDatas() != null && entity.getDatas().size() != 0) {
RecordTypeEntity recordTypeEntity = null;
if (!isChannel)
recordTypeEntity = TypeIconFactory.createTypeEntityForType(entity.getDatas().get(0).type());
else
recordTypeEntity = TypeIconFactory.createTypeEntityForType(entity.getDatas().get(0).payChannel());
SliceValue sliceValue = new SliceValue(entity.getSum(), BaseApplication.getsContext().getResources()
.getColor(recordTypeEntity.color()));
sliceValueList.add(sliceValue);
}
sum += entity.getSum();
}
PieChartData charData = new PieChartData(sliceValueList);
charData.setHasLabels(true);
charData.setHasLabelsOutside(false);
charData.setHasCenterCircle(true);
charData.setCenterText1("" + sum);
charData.setCenterText1FontSize(25);
if (TypeIconFactory.isEarningOrExpendType(chartCountEntities.get(0).getDatas().get(0).type())) {
charData.setCenterText2("总支出");
} else {
charData.setCenterText2("总收入");
}
mPieChart.setPieChartData(charData);
mChartCountList.clear();
mChartCountList.addAll(chartCountEntities);
mAdapter.notifyDataSetChanged();
} else {
mChartCountList.clear();
mAdapter.notifyDataSetChanged();
mPieChart.setPieChartData(null);
}
}
@Override
public void back() {
getActivity().finish();
}
}
| [
"[email protected]"
] | |
586c2a29516876ccbca0e46c993b30f4156f9b7b | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/MOCKITO-10b-4-25-Single_Objective_GGA-WeightedSum/org/mockito/internal/creation/MockSettingsImpl_ESTest.java | 1b14fad6fe9296266201e8af74786e98e46c0e2d | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | /*
* This file was automatically generated by EvoSuite
* Tue Mar 31 12:21:17 UTC 2020
*/
package org.mockito.internal.creation;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class MockSettingsImpl_ESTest extends MockSettingsImpl_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"[email protected]"
] | |
7764ca434f11e74ba36fdc822045dc5247808d78 | 75a6706e9a3d040b868de3148aac9b18433146c2 | /src/main/java/com/tea/common/base/constant/ProjectName.java | 76a25515ff465d966d2cb6e44d1306db8f727de8 | [] | no_license | bobbygb/Common | bffe6d3de5c52114003c64d8d06cdb6b0db62bdb | fc846faceaa0c622e111222c5b9dd70d9b075fa7 | refs/heads/master | 2021-01-01T20:07:47.455912 | 2017-09-10T03:00:57 | 2017-09-10T03:00:57 | 98,770,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package com.tea.common.base.constant;
public enum ProjectName {
//用户系统
UserApp("1000","UserApp","com.tea","用户服务模块"),
UserSchedule("1001","UserSchedule","com.tea","用户消息模块"),
UserWeb("1002","UserWeb","com.tea","用户前端模块"),
UserAdminWeb("1003","UserAdminWeb","com.tea","用户后台模块"),
Common("8888","Common","com.tea","公用模块"),
;
private String appId;
private String appName;
private String packageName;
private String projectName;
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
private ProjectName(String appId,String appName,String packageName,String projectName){
this.appId = appId;
this.appName = appName;
this.packageName = packageName;
this.projectName = projectName;
}
public String getAppId() {
return appId;
}
public String getAppName() {
return appName;
}
public String getPackageName() {
return packageName;
}
}
| [
"[email protected]"
] | |
ed212681a9fdeab8b7d79d334bce6abcc0c1e2a8 | 5dd3daa15726c0c0782a630104a4a9a883ee2f72 | /2.JavaCore/src/com/javarush/task/task15/task1529/Solution.java | f852048f47c04179c510827fb4ca35925386f13c | [] | no_license | TigranMonte/JavaRushTasks | 3476c9b2396cf333f7807ffa6bfbb27a07bffb15 | 7a945d80745c153badbcbe1a4ab0acc407789179 | refs/heads/master | 2023-06-16T00:01:40.513230 | 2021-07-10T20:08:11 | 2021-07-10T20:08:11 | 298,334,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,030 | java | package com.javarush.task.task15.task1529;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Осваивание статического блока
*/
public class Solution {
public static void main(String[] args) {
}
static {
try {
reset();//add your code here - добавьте код тут
} catch (IOException e) {
e.printStackTrace();
}
}
public static CanFly result;
public static void reset() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
if (s.equals("helicopter"))
{
result = new Helicopter();
}
else if ("plane".equals(s))
{
String k = reader.readLine();
int n = Integer.parseInt(k);
result = new Plane(n);
}
reader.close();//add your code here - добавьте код тут
}
}
| [
"[email protected]"
] | |
9dc3fc9f80b4a9ccec50c2c52ae03970d57c96cb | 0b529ce6f7ff6c20b559d58a14590ca23da51e11 | /sources/appsgate-project/appsgate-EUDE/EUDEInterpreter/src/main/java/appsgate/lig/eude/interpreter/langage/nodes/NodeEmpty.java | df38b2a8220e388ed835f7ed61e3b2b0a3f31d04 | [] | no_license | appsgate2015/appsgate | 5b9228a6d63b45f41f6c05b4ecfb4b3eec9a5ba7 | 485a49d3e1d900b2a3165d78edd6e3b3c416f5fd | refs/heads/master | 2020-12-24T16:16:06.044105 | 2016-03-04T13:18:41 | 2016-03-04T13:18:41 | 19,860,116 | 1 | 2 | null | 2014-12-22T22:24:04 | 2014-05-16T14:51:24 | Java | UTF-8 | Java | false | false | 1,405 | 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 appsgate.lig.eude.interpreter.langage.nodes;
import appsgate.lig.eude.interpreter.langage.components.EndEvent;
import org.json.JSONException;
import org.json.JSONObject;
/**
*
* @author jr
*/
public class NodeEmpty extends Node {
private NodeEmpty(Node p) {
super(p);
}
/**
*
* @param p
* @param o
*/
public NodeEmpty(JSONObject o, Node p) {
super(p, o);
}
@Override
protected void specificStop() {
}
@Override
public JSONObject call() {
fireEndEvent(new EndEvent(this));
return null;
}
@Override
public String getExpertProgramScript() {
return "";
}
@Override
protected Node copy(Node parent) {
NodeEmpty n = new NodeEmpty(parent);
return n;
}
@Override
public void endEventFired(EndEvent e) {
}
@Override
public JSONObject getJSONDescription() {
JSONObject o = super.getJSONDescription();
try {
o.put("type", "empty");
} catch (JSONException ex) {
// will never happen
}
return o;
}
@Override
public String getTypeSpec() {
return "Empty";
}
}
| [
"[email protected]"
] | |
0da0f1e663e67f41df5773a4d7a8a8ec8a7fdcdd | 62c56806f1ed1b9609b24e272bce48960816cbf8 | /src/dados/AvaliacaoTableGateway.java | cbdca89fc36bb42924e7de312f82e9493dd26e3d | [
"MIT"
] | permissive | ronaldosvieira/caro-nao | 9ef175eeb4145b5aa396dfc35c84beaacce41b50 | 6e8552b65dc7e0116021b4c7dc5209e1fb2d4f41 | refs/heads/master | 2021-06-11T19:24:37.898462 | 2017-02-24T19:52:27 | 2017-02-24T19:52:27 | 79,803,877 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 6,773 | java | package dados;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import util.RecordSet;
import util.Row;
public class AvaliacaoTableGateway extends TableGateway {
public AvaliacaoTableGateway() throws ClassNotFoundException, SQLException {
super("avaliacao");
}
public RecordSet obterTodos() throws SQLException {
ResultSet rs = null;
RecordSet dataset = new RecordSet();
String sql = String.format(this.select, this.getTableName());
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
if (stmt.execute()) rs = stmt.getResultSet();
while (rs.next()) {
Row row = new Row();
row.put("id", rs.getInt("id"));
row.put("avaliador_id", rs.getInt("avaliador_id"));
row.put("avaliado_id", rs.getInt("avaliado_id"));
row.put("nota", rs.getInt("nota"));
row.put("data", rs.getDate("data"));
dataset.add(row);
}
return dataset;
}
public RecordSet obter(int idCarona, int idAvaliador, int idAvaliado)
throws SQLException, IndexOutOfBoundsException {
ResultSet rs = null;
RecordSet dataset = new RecordSet();
String sql = String.format(this.selectMany, this.getTableName(),
"carona_id = ? and avaliador_id = ? and avalido_id = ?");
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
stmt.setInt(1, idCarona);
stmt.setInt(2, idAvaliador);
stmt.setInt(3, idAvaliado);
if (stmt.execute()) rs = stmt.getResultSet();
else throw new IndexOutOfBoundsException();
while (rs.next()) {
Row row = new Row();
row.put("carona_id", rs.getInt("carona_id"));
row.put("avaliador_id", rs.getInt("avaliador_id"));
row.put("avaliado_id", rs.getInt("avaliado_id"));
row.put("nota", rs.getInt("nota"));
row.put("data", rs.getDate("data"));
dataset.add(row);
}
return dataset;
}
public RecordSet obterPorCarona(int idCarona)
throws SQLException, IndexOutOfBoundsException {
ResultSet rs = null;
RecordSet dataset = new RecordSet();
String sql = String.format(this.selectColumn,
this.getTableName(), "carona_id");
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
stmt.setInt(1, idCarona);
if (stmt.execute()) rs = stmt.getResultSet();
else throw new IndexOutOfBoundsException();
while (rs.next()) {
Row row = new Row();
row.put("carona_id", rs.getInt("carona_id"));
row.put("avaliador_id", rs.getInt("avaliador_id"));
row.put("avaliado_id", rs.getInt("avaliado_id"));
row.put("nota", rs.getInt("nota"));
row.put("data", rs.getDate("data"));
dataset.add(row);
}
return dataset;
}
public RecordSet obterPorAvaliador(int idAvaliador) throws SQLException, IndexOutOfBoundsException {
ResultSet rs = null;
RecordSet dataset = new RecordSet();
String sql = String.format(this.selectColumn,
this.getTableName(), "avaliador_id");
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
stmt.setInt(1, idAvaliador);
if (stmt.execute()) rs = stmt.getResultSet();
else throw new IndexOutOfBoundsException();
while (rs.next()) {
Row row = new Row();
row.put("carona_id", rs.getInt("carona_id"));
row.put("avaliador_id", rs.getInt("avaliador_id"));
row.put("avaliado_id", rs.getInt("avaliado_id"));
row.put("nota", rs.getInt("nota"));
row.put("data", rs.getDate("data"));
dataset.add(row);
}
return dataset;
}
public RecordSet obterPorAvaliado(int idAvaliado) throws SQLException, IndexOutOfBoundsException {
ResultSet rs = null;
RecordSet dataset = new RecordSet();
String sql = String.format(this.selectColumn,
this.getTableName(), "avaliado_id");
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
stmt.setInt(1, idAvaliado);
if (stmt.execute()) rs = stmt.getResultSet();
else throw new IndexOutOfBoundsException();
while (rs.next()) {
Row row = new Row();
row.put("carona_id", rs.getInt("carona_id"));
row.put("avaliador_id", rs.getInt("avaliador_id"));
row.put("avaliado_id", rs.getInt("avaliado_id"));
row.put("nota", rs.getInt("nota"));
row.put("data", rs.getDate("data"));
dataset.add(row);
}
return dataset;
}
public RecordSet obterPorCaronaEAvaliador(int idCarona, int idAvaliador)
throws SQLException, IndexOutOfBoundsException {
ResultSet rs = null;
RecordSet dataset = new RecordSet();
String sql = String.format(this.selectMany,
this.getTableName(), "carona_id = ? and avaliador_id = ?");
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
stmt.setInt(1, idCarona);
stmt.setInt(2, idAvaliador);
if (stmt.execute()) rs = stmt.getResultSet();
else throw new IndexOutOfBoundsException();
while (rs.next()) {
Row row = new Row();
row.put("carona_id", rs.getInt("carona_id"));
row.put("avaliador_id", rs.getInt("avaliador_id"));
row.put("avaliado_id", rs.getInt("avaliado_id"));
row.put("nota", rs.getInt("nota"));
row.put("data", rs.getDate("data"));
dataset.add(row);
}
return dataset;
}
public void inserir(int idCarona, int idAvaliador,
int idAvaliado, int nota)
throws SQLException {
String sql = String.format(this.insert,
this.getTableName(),
"carona_id, avaliador_id, avaliado_id, nota",
"?, ?, ?, ?");
PreparedStatement stmt =
this.getConnection().prepareStatement(
sql,
Statement.RETURN_GENERATED_KEYS);
stmt.setInt(1, idCarona);
stmt.setInt(2, idAvaliador);
stmt.setInt(3, idAvaliado);
stmt.setInt(4, nota);
int affectedRows = stmt.executeUpdate();
if (affectedRows == 0) {
throw new SQLException("Erro ao inserir avaliação.");
}
}
public void atualizar(int idCarona, int idAvaliador,
int idAvaliado, int nota)
throws SQLException, IndexOutOfBoundsException {
String sql = String.format(this.updateMany,
this.getTableName(), "nota = ?",
"carona_id = ? and avaliador_id = ? and avaliado_id = ?");
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
stmt.setInt(1, nota);
stmt.setInt(2, idAvaliador);
stmt.setInt(3, idAvaliado);
stmt.setInt(4, idCarona);
stmt.executeUpdate();
}
public void excluir(int idCarona, int idAvaliador, int idAvaliado)
throws SQLException, IndexOutOfBoundsException {
String sql = String.format(this.deleteMany, this.getTableName(),
"carona_id = ? and avaliador_id = ? and avaliado_id = ?");
PreparedStatement stmt =
this.getConnection().prepareStatement(sql);
stmt.setInt(1, idCarona);
stmt.setInt(2, idAvaliador);
stmt.setInt(3, idAvaliado);
stmt.executeUpdate();
}
}
| [
"[email protected]"
] | |
d03095f2493494de2f9978a38cfffb375fbb0375 | 3399d8b355959adcf0fda94697c5d5d4b4d4b904 | /com/java/unit1/Banking.java | cd8ce469df8b7040343ff8b88699d5e3a766328f | [] | no_license | pv1823/Java | 625d1057b25a3e449e011aba897f480b206e99c0 | a29e2eb6c4cb47df18d94a0046a14833808ff25e | refs/heads/master | 2022-04-08T14:51:16.236374 | 2020-03-15T08:58:42 | 2020-03-15T08:58:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package com.java.unit1;
import java.text.SimpleDateFormat;
public class Banking {
public static void main(String[] args) throws Exception {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/mm/dd");
Account fromAcc = new Account(1,"Savings", "pavan", "varanasi", formatter.parse("2001/05/26"));
Account toAcc = new Account(420,"Dbit", "chandu","Varanasi", formatter.parse("1983/01/11"));
Transaction tx = new Transaction(123, fromAcc, toAcc, formatter.parse("2020/02/01"), formatter.parse("2019/04/11"), 200000);
System.out.println(tx);
}
}
| [
"[email protected]"
] | |
c80a17916610e9ca7e4c9d428c1e0ad32ebd513d | 9f8cf421ad537b42fba745f83e7d6a1ba0f263f3 | /src/main/java/com/lemon/util/StringUtils.java | ec1f86ce2d5affad31557d834fd85afd56a2d084 | [] | no_license | fanggege123/lmb | 31cc9036ab0e010e71cc7c1371653d894bb160a9 | 6e2dc5ecebc861bd38817d8d7ab6b995094c16fb | refs/heads/master | 2022-12-25T04:10:27.810480 | 2019-08-31T10:26:18 | 2019-08-31T10:26:18 | 205,509,714 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package com.lemon.util;
public class StringUtils {
public static boolean isEmpty(String str) {
return null == str || "".equals(str);
}
}
| [
"[email protected]"
] | |
f15ab9112d6de925fe6fc407a9e2b35d5cc2099c | dd25e98a343a7c9f23fa756eb709b6ceeb30733b | /qwork-kernel/src/test/java/org/qwork/kernel/test/TestQCharList.java | 1a959ebc958fce7afaf71ed62808317a3d15cf08 | [] | no_license | hzaydan/QWork | 0ee4f36cd70eff088b7a3f29a6c0b2fb75d8a9d2 | 889d5c18a7810487368f72ea1f34818e8183b396 | refs/heads/main | 2023-04-03T08:06:03.144949 | 2021-04-11T08:13:57 | 2021-04-11T08:13:57 | 343,033,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package org.qwork.kernel.test;
import org.qwork.kernel.tools.frompdf.QCharList;
import org.qwork.kernel.utils.Utf;
public class TestQCharList {
public static void main(String[] args) {
System.out.println(QCharList.mainChars());
System.out.println(QCharList.puncChars());
System.out.println(Utf.u('آ'));
System.out.println(Utf.u('ء'));
System.out.println(Utf.u('ا'));
}
}
| [
"[email protected]"
] | |
c19bb78edffcf1b0b59dc42ba71c2a86c6fbd7b5 | 4742d95d0952913d989e51a2bf689cc1f7244287 | /app/src/main/java/DTO/overview.java | 1fbc25f3ac747df0bdfc826d2bcbc0bfdc88e9c2 | [] | no_license | Phonghh9920/QL_CALOTIEUTHU | 7e41ec8bf54743f5e74078beb200a8fb84f47430 | b7577180c4da230e38d444010bd97e6d8d3ded4b | refs/heads/master | 2023-05-08T20:39:34.532771 | 2021-05-26T15:22:38 | 2021-05-26T15:22:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 646 | java | package DTO;
public class overview {
private int sumOfMoveCal;
private int sumOfEatCal;
public overview() {
}
public overview(int sumOfMoveCal, int sumOfEatCal) {
this.sumOfMoveCal = sumOfMoveCal;
this.sumOfEatCal = sumOfEatCal;
}
public int getSumOfMoveCal() {
return sumOfMoveCal;
}
public void setSumOfMoveCal(int sumOfMoveCal) {
this.sumOfMoveCal = sumOfMoveCal;
}
public int getSumOfEatCal() {
return sumOfEatCal;
}
public void setSumOfEatCal(int sumOfEatCal) {
this.sumOfEatCal = sumOfEatCal;
}
}
| [
"[email protected]"
] | |
c9e294fbdb5d01fd04e0ad27a6832d9a88739896 | 600a341572dbdca670d671586685aa36d24071de | /second largest/Second.java | 9a7cc4a155deb6128fd3c6f4c872286a50166806 | [
"Apache-2.0"
] | permissive | Jajabenit250/java-exercises | 1191fbc5c15e2eac05eb5cd07d8cf7501cf311dc | 64382b49713fccf98362cfd68fb4d6a9149c2b9c | refs/heads/main | 2023-05-06T02:17:09.388966 | 2021-05-18T16:22:59 | 2021-05-18T16:22:59 | 368,595,762 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | /**
* Second
*/
public class Second {
public static void main(String[] args) {
int a[] = {4,3,1,2};
System.out.println(theSecond(a));
}
static int theSecond(int a[]) {
int max = 0;
int secMax = 0;
for (int i = 0; i < a.length; i++) {
if (a[i] > max) {
max = a[i];
}
}
for (int i = 0; i < a.length; i++) {
if (a[i] > secMax && a[i] <max) {
secMax = a[i];
}
}
return secMax;
}
} | [
"[email protected]"
] | |
a4376a4c2d8ba6e6b421be9a2d8160f8863f597d | 742269ecbc9e8e0b9ec0814e3428a4e5da9e064a | /src/main/java/br/com/florafoz/control/LogModController.java | 4368e2ee2d5ab4888bb7fbb9f71c75cf35b8ccb7 | [] | no_license | lokol2k/florafoz | 5dc846f444c4bba092747094c6aca1e76d4108b2 | a48309d78b4894bf11c6929ca24a8a3a5752b7dd | refs/heads/master | 2022-12-21T21:12:37.597292 | 2020-09-24T21:25:37 | 2020-09-24T21:25:37 | 287,145,174 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,020 | java | package br.com.florafoz.control;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import br.com.florafoz.model.LogMod;
import br.com.florafoz.service.LogModService;
@Controller
@RequestMapping("/logMods")
public class LogModController {
@Autowired
private LogModService service;
@PostMapping
public ResponseEntity<?> save(@RequestBody LogMod entity) {
try {
LogMod body = service.save(entity);
return ResponseEntity.ok(body);
} catch (InternalError | Exception ex) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
}
}
@GetMapping
public ResponseEntity<?> getAll() {
try {
List<LogMod> response = service.getAll();
return ResponseEntity.ok(response);
} catch (InternalError | Exception ex) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
}
}
@DeleteMapping("{id}")
public ResponseEntity<?> deleteById(@PathVariable long id) {
try {
service.delete(id);
return ResponseEntity.ok(true);
} catch (InternalError | Exception ex) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
}
}
@GetMapping("{id}")
public ResponseEntity<?> findById(@PathVariable long id) {
try {
LogMod response = service.findById(id);
return ResponseEntity.ok(response);
} catch (InternalError | Exception ex) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
}
}
}
| [
"[email protected]"
] | |
de21c170d4230d6d494cf0d2b788fcf654ed4e15 | a4923c72a6ef6e03ab523b1e1455b96557b03033 | /fizzbuzz/src/main/java/fizzbuzz/FizzBuzz.java | 04f6ffaa8113f9c4f6b146d8cff6be4031aeba5a | [] | no_license | JuliaWolters/Games | cc16cc201601ac8fb5e20b13c76009f6cb88ae0b | 70269dc6fa180e174e4be1dfef6fd0072fbb2d69 | refs/heads/develop | 2021-01-02T22:34:49.341707 | 2017-08-06T15:52:00 | 2017-08-06T15:52:00 | 99,346,622 | 1 | 0 | null | 2017-08-06T15:48:18 | 2017-08-04T13:42:30 | null | ISO-8859-3 | Java | false | false | 546 | java | package fizzbuzz;
public class FizzBuzz {
/**
* FizzBuzz gibt unterbestimmten Bedingungen einen Text aus:
*
* Sollte
* i durch 3 teilbar sein: Fizz
* i durch 5 teilbar sein: Buzz
* i durch 3 und 5 teilbar sein: FizzBuzz
*
* Sonst wird i selbt zurück gegeben.
*
* @param i
* @return
*/
public static String fizzBuzz(int i) {
if(i % 3 == 0 && i % 5 == 0) {
return "FizzBuzz";
}
if(i % 3 == 0) {
return "Fizz";
}
if(i % 5 == 0) {
return "Buzz";
}
return String.valueOf(i);
}
}
| [
"[email protected]"
] | |
ecc631ea470c53122f36cf008b4fdd8eea6d38e0 | 9caa786e43545a563aefe08b1545decd763e38fb | /stdlib/llvm/src/main/java/org/ballerinalang/nativeimpl/llvm/gen/LLVMGetBasicBlockTerminator.java | 413c35710e203a4a569f1961680af377fa5311ca | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-mit-old-style",
"MPL-2.0",
"LicenseRef-scancode-unicode",
"MIT"
] | permissive | mohamednizar/ballerina-lang | 2bb5c2df3143af1894e06d8c25716512e74e1a0c | 22efe9bfac8daf9318bbfb38c72771b5272a11fa | refs/heads/master | 2023-02-05T20:58:27.718202 | 2019-11-02T12:16:10 | 2019-11-02T12:16:10 | 212,315,547 | 1 | 0 | Apache-2.0 | 2023-01-26T10:32:48 | 2019-10-02T10:55:23 | Java | UTF-8 | Java | false | false | 2,267 | java | // Copyright (c) 2018 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 Inc. 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.ballerinalang.nativeimpl.llvm.gen;
import org.ballerinalang.bre.Context;
import org.ballerinalang.bre.bvm.BlockingNativeCallableUnit;
import org.ballerinalang.model.values.BMap;
import org.ballerinalang.model.values.BValue;
import org.ballerinalang.nativeimpl.llvm.FFIUtil;
import org.ballerinalang.natives.annotations.Argument;
import org.ballerinalang.natives.annotations.BallerinaFunction;
import org.ballerinalang.natives.annotations.ReturnType;
import org.bytedeco.javacpp.LLVM;
import org.bytedeco.javacpp.LLVM.LLVMValueRef;
import static org.ballerinalang.model.types.TypeKind.RECORD;
import static org.bytedeco.javacpp.LLVM.LLVMGetBasicBlockTerminator;
/**
* Auto generated class.
*/
@BallerinaFunction(
orgName = "ballerina", packageName = "llvm",
functionName = "LLVMGetBasicBlockTerminator",
args = {
@Argument(name = "bb", type = RECORD, structType = "LLVMBasicBlockRef"),
},
returnType = {
@ReturnType(type = RECORD, structType = "LLVMValueRef", structPackage = "ballerina/llvm"),
}
)
public class LLVMGetBasicBlockTerminator extends BlockingNativeCallableUnit {
@Override
public void execute(Context context) {
LLVM.LLVMBasicBlockRef bb = FFIUtil.getRecodeArgumentNative(context, 0);
LLVMValueRef returnValue = LLVMGetBasicBlockTerminator(bb);
BMap<String, BValue> rerunWrapperRecode = FFIUtil.newRecord(context, "LLVMValueRef");
FFIUtil.addNativeToRecode(returnValue, rerunWrapperRecode);
context.setReturnValues(rerunWrapperRecode);
}
}
| [
"[email protected]"
] | |
7933475e914caf78dbd027072b4c3054bc4e666a | d5f09c7b0e954cd20dd613af600afd91b039c48a | /sources/com/alibaba/mtl/appmonitor/SdkMeta.java | 1487fe76fd26ad80765812ce605d0c7415d8733c | [] | no_license | t0HiiBwn/CoolapkRelease | af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3 | a6a2b03e32cde0e5163016e0078391271a8d33ab | refs/heads/main | 2022-07-29T23:28:35.867734 | 2021-03-26T11:41:18 | 2021-03-26T11:41:18 | 345,290,891 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,296 | java | package com.alibaba.mtl.appmonitor;
import android.content.Context;
import com.alibaba.mtl.log.a;
import com.alibaba.mtl.log.d.i;
import java.util.HashMap;
import java.util.Map;
public class SdkMeta {
public static final String SDK_VERSION = "2.6.4.5_for_bc";
private static final Map<String, String> d;
public static Map<String, String> getSDKMetaData() {
a.getContext();
Map<String, String> map = d;
if (!map.containsKey("sdk-version")) {
map.put("sdk-version", "2.6.4.5_for_bc");
}
return map;
}
static {
HashMap hashMap = new HashMap();
d = hashMap;
hashMap.put("sdk-version", "2.6.4.5_for_bc");
}
public static void setExtra(Map<String, String> map) {
if (map != null) {
d.putAll(map);
}
}
public static String getString(Context context, String str) {
if (context == null) {
return null;
}
int i = 0;
try {
i = context.getResources().getIdentifier(str, "string", context.getPackageName());
} catch (Throwable th) {
i.a("SdkMeta", "getString Id error", th);
}
if (i != 0) {
return context.getString(i);
}
return null;
}
}
| [
"[email protected]"
] | |
38822f280b36e0ddbeb5a99029bd78d7e5f0c626 | 0375baf5546bbaa8d0d6bbab190c3f36d1c32285 | /Version1/src/observable/ClockObservableImpl.java | 615bdb8ab829fdad4625c158395bfae2dccd8827 | [] | no_license | Kaustubh-DB/Game-Maker-Object-Oriented-Software-Development | 21103d54459fd2995b28a48aaee71705425783e1 | 05dca244bb699bddd2dbc36e0943fdbbaa58f428 | refs/heads/master | 2021-08-03T21:34:44.903176 | 2019-11-25T22:58:37 | 2019-11-25T22:58:37 | 224,039,779 | 0 | 0 | null | 2020-10-13T17:45:00 | 2019-11-25T20:55:40 | Java | UTF-8 | Java | false | false | 750 | java | package observable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Timer;
public class ClockObservableImpl implements ClockObservable
{
private List<ClockObserver> observersList;
Timer timer = new Timer();
public ClockObservableImpl()
{
observersList = new ArrayList<ClockObserver>();
}
@Override
public void register(ClockObserver clockObserver)
{
observersList.add(clockObserver);
}
@Override
public void deRegister(ClockObserver clockObserver)
{
observersList.add(clockObserver);
}
@Override
public void notifyObservers()
{
for (ClockObserver timeObserver : observersList)
{
timeObserver.timeIncrementNotification();
}
}
}
| [
"[email protected]"
] | |
3c96eef58492255fe7c59e382ef0ee33fd21b1fb | 839bef25b8d778aadcddbdeccb3538b9b8bc0ee7 | /src/main/java/org/isatools/resources/ISATABNanoValidate.java | 5b2387f33c98dbab8c7419b77dc5488f74c53da4 | [] | no_license | NCIP/ISAValidatorWS | 5d7f6ad2fc859cf9d4611dc50b9a8806f6901dc2 | 2f703a28d5d7bda34604763f0bc67ac39d33d485 | refs/heads/master | 2020-12-30T19:11:44.588545 | 2013-05-10T20:20:26 | 2013-05-10T20:20:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,204 | java | package org.isatools.resources;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.core.Response;
import org.apache.log4j.Level;
import org.isatools.isatab.gui_invokers.GUIISATABValidator;
import org.isatools.isatab.gui_invokers.GUIInvokerResult;
import org.isatools.isatab.isaconfigurator.ISAConfigurationSet;
import org.isatools.tablib.utils.BIIObjectStore;
import org.isatools.tablib.utils.logging.TabLoggingEventWrapper;
import org.omg.CORBA_2_3.portable.OutputStream;
import org.isatools.errorreporter.model.ErrorUtils;
import uk.ac.ebi.bioinvindex.model.Investigation;
import uk.ac.ebi.bioinvindex.model.Study;
import uk.ac.ebi.bioinvindex.model.processing.Assay;
import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.multipart.FormDataParam;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@Path("/")
public class ISATABNanoValidate {
static {
ISAConfigurationSet.setConfigPath("C:/bin/apache-tomcat-6.0.37/bin/config/default-config");
}
private static Logger log = Logger.getLogger(ISATABNanoValidate.class.getName());
@Context
private UriInfo context;
// Creates a new instance of MICheckout
public ISATABNanoValidate() {
}
/**
* Retrieves representation of an instance of MICheckout
*
* @return an instance of java.lang.String
*/
@GET
@Path("test")
@Produces("text/plain")
public String getTestChecklist(@QueryParam("name") String name) {
return "This is a test output " + name + "! :D The service is working...";
}
/**
* Retrieves the ISATAB Nano Zip file, stores it locally, perform the validation and return the response.
*
* @return an instance of java.lang.String
*/
@POST
@Path("validate")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces("text/plain")
public String getZipFile(@FormDataParam("ZipFile") InputStream uploadedFile,
@FormDataParam("ZipFile") FormDataContentDisposition fileDetail) {
try {
File isatabFile = saveFileToSystem(uploadedFile);
ValidationReport result;
result = validateISATabFile(isatabFile);
if(result.result == GUIInvokerResult.SUCCESS) {
return "Validation successful for " + fileDetail.getFileName() + "\n" + result.report;
} else {
return "Validation Unsuccessful for " + fileDetail.getFileName() + "\n" + result.report;
}
} catch (IOException e) {
// TODO Auto-generated catch block
return "Error occurred when unzipping files." + e.getMessage();
}
}
private File saveFileToSystem(InputStream isatabFile) throws IOException {
BufferedOutputStream bos = null;
File file = new File(System.getProperty("java.io.tmpdir") + "/ISATabNano-" + System.currentTimeMillis() + ".zip");
System.out.println("Saving to " + file.getAbsolutePath());
FileOutputStream out = new FileOutputStream(file);
int read =0;
byte[] bytes = new byte[1024];
while((read = isatabFile.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
out.flush();
out.close();
return file;
}
private ValidationReport validateISATabFile(File isatab) throws IOException {
GUIISATABValidator validator = new GUIISATABValidator();
String path = isatab.getAbsolutePath();
if(!isatab.isDirectory()) {
System.out.println("Unzipping!");
path = FileUnzipper.unzip(isatab);
}
GUIInvokerResult result = validator.validate(path);
ValidationReport report = new ValidationReport(result, "");
if(result == GUIInvokerResult.SUCCESS) {
report.report = validator.report();
} else {
populateErrorReport(report, validator.getLog());
}
return report;
}
private void populateErrorReport(ValidationReport report, List<TabLoggingEventWrapper> logEvents) {
StringBuilder builder = new StringBuilder();
for(TabLoggingEventWrapper event : logEvents) {
String fileName = ErrorUtils.extractFileInformation(event.getLogEvent());
if(fileName != null) {
if(event.getLogEvent().getLevel().toInt() >= Level.WARN_INT) {
builder.append("File name " + fileName).append("\n");
builder.append("\t" + event.getLogEvent().getMessage());
}
}
}
report.report = builder.toString();
}
class ValidationReport {
GUIInvokerResult result;
String report;
ValidationReport(GUIInvokerResult result, String report) {
this.result= result;
this.report = report;
}
}
} | [
"[email protected]"
] | |
0596ee787f798186749845a776e710d2411e0709 | 4d179c9bd904ebc9937153233f8617aeb1ffedfe | /src/main/java/com/ecoInfo/basic/model/SearchRegionResultDTO.java | 1639b0bfa846740900ec856cc1bec39dcfef978e | [] | no_license | yblee1029/ecoInfoService | bc0bb6d271b37ca7bac7064547bc63b57c69b015 | 8d1ccb5b3375e4cdb22f0daf28519608861ee445 | refs/heads/master | 2022-02-02T07:38:28.964692 | 2019-08-01T11:48:34 | 2019-08-01T11:48:34 | 197,940,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.ecoInfo.basic.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SearchRegionResultDTO {
private String prgm_name;
private String theme;
}
| [
"[email protected]"
] | |
d9cbf612740f0669af9c4c05b8300b25fa1f45d1 | d668fe255330263d396af91b2e5e889dbd4412b3 | /src/TheProxyPattern/VideoGameOwner.java | badc2d47dc54c98f3686aaca0505946d9e4953c7 | [] | no_license | LS2991/SSE_659_Project_2 | 2b9588fa629ad08b6f112cc7739a6b1bcc18af05 | 232088e969bc2c1275100e765dac6ab20606b07e | refs/heads/master | 2016-09-06T18:56:09.351776 | 2015-03-16T13:34:26 | 2015-03-16T13:34:26 | 32,295,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package TheProxyPattern;
import java.util.Hashtable;
public interface VideoGameOwner
{
public Hashtable makeGameList();
}
| [
"[email protected]"
] | |
76b7c72d1bb8684a8ebcb22f072dfa29e791bfae | 12b75ba88d14631e2c99a2fff6b3f3683aafc976 | /nts/texmf/source/nts/nts-1.00-beta/nts/node/HSkipNode.java | 59456198c7b0f13c2695e36d2ec4177da67390d7 | [] | no_license | tex-other/nts | 50b4f66b3cafa870be4572dff92d23ab4321ddc8 | b4b333723326dc06a84bcd28e2672a76537d9752 | refs/heads/master | 2021-09-09T07:41:55.366960 | 2018-03-14T07:37:37 | 2018-03-14T07:37:37 | 125,165,059 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,707 | java | // Copyright 2001 by
// DANTE e.V. and any individual authors listed elsewhere in this file.
//
// This file is part of the NTS system.
// ------------------------------------
//
// It may be distributed and/or modified under the
// conditions of the NTS Public License (NTSPL), either version 1.0
// of this license or (at your option) any later version.
// The latest version of this license is in
// http://www.dante.de/projects/nts/ntspl.txt
// and version 1.0 or later is part of all distributions of NTS
// version 1.0-beta or later.
//
// The list of all files belonging to the NTS distribution is given in
// the file `manifest.txt'.
//
// Filename: nts/node/HSkipNode.java
// $Id: HSkipNode.java,v 1.1.1.1 2001/03/06 14:55:56 ksk Exp $
package nts.node;
import nts.base.Dimen;
import nts.base.Glue;
import nts.io.Log;
public class HSkipNode extends AnySkipNode {
/* corresponding to glue_node */
public HSkipNode(Glue skip) { super(skip); }
public Dimen getWidth() { return skip.getDimen(); }
public Dimen getWstr() { return skip.getStretch(); }
public byte getWstrOrd() { return skip.getStrOrder(); }
public Dimen getWshr() { return skip.getShrink(); }
public byte getWshrOrd() { return skip.getShrOrder(); }
public Dimen getWidth(GlueSetting setting)
{ return setting.set(skip, true); }
public void contributeVisible(VisibleSummarizer summarizer) {
if (summarizer.setting.makesElastic(skip))
summarizer.claimElastic();
super.contributeVisible(summarizer);
}
public boolean startsWordBlock() { return true; }
public byte afterWord() { return SUCCESS; }
public String toString() { return "HSkip(" + skip + ')'; }
}
| [
"[email protected]"
] | |
a221238148d994e257a7b947e8c9589eca5899f6 | 9d2a8e41512d20e274e9710dd32e7e69b38fcb0e | /pwa-webapp/src/test/java/com/pwa/listener/EntityListenerTest.java | dbd1e9af51fe34b39d00b933749591ebcccbcb9e | [] | no_license | hugofock/personalize-weather-app | 785f37fff93c0f43b3a5f4b69fad67ad40d8b02f | 225b5b3bec0a4bca9af689f4d1f32774878715f3 | refs/heads/master | 2021-01-20T16:59:32.457776 | 2016-06-30T19:47:09 | 2016-06-30T19:47:09 | 62,079,139 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,923 | java | package com.pwa.listener;
import com.pwa.builder.CityBuilder;
import com.pwa.common.listener.EntityListener;
import com.pwa.model.City;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:/spring/appcontext.xml", "classpath:/spring/appcontext-controller.xml" })
public class EntityListenerTest {
@Test
public void testEntityListenerPrePersistWithoutId() throws Exception {
EntityListener entityListener = new EntityListener();
City city = new CityBuilder().withSearchId(12345).withName("name").withCountry("country").build();
entityListener.prePersistOrUpdate(city);
assertNotNull(city.getId());
assertNotNull(city.getCreatedBy());
assertThat(city.getCreatedBy(), is("SYSTEM"));
assertNotNull(city.getCreatedDate());
assertNotNull(city.getLastModifiedBy());
assertThat(city.getLastModifiedBy(), is("SYSTEM"));
assertNotNull(city.getLastModifiedDate());
}
@Test
public void testEntityListenerPrePersistId() throws Exception {
EntityListener entityListener = new EntityListener();
City city = new CityBuilder().withId("id").withSearchId(12345).withName("name").withCountry("country").build();
entityListener.prePersistOrUpdate(city);
assertNotNull(city.getId());
assertThat(city.getId(), is("id"));
assertNull(city.getCreatedBy());
assertNull(city.getCreatedDate());
assertNotNull(city.getLastModifiedBy());
assertThat(city.getLastModifiedBy(), is("SYSTEM"));
assertNotNull(city.getLastModifiedDate());
}
} | [
"[email protected]"
] | |
7a8d263b4709ebe3ba2e397563e05d27cb42ae7d | 94f72d323cd4519e11d03643833beac05e1410c6 | /NewHere.java | af8fb78afe84fa92b22ad782f91e22a2f3ed1f5b | [] | no_license | SJ2511/Our-App-1 | bfc2b04547556fe8a1e92d594894cc5944ac5920 | 9a9571c9c51c8d8515ccc306e115b62d23573e67 | refs/heads/master | 2021-01-20T20:02:29.694959 | 2016-07-03T17:03:03 | 2016-07-03T17:03:03 | 61,880,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,201 | java | package com.example.dell.intents;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class NewHere extends AppCompatActivity
{
EditText etname= null;
EditText etusername= null;
EditText etpassword= null;
EditText etconfirmpassword= null;
Button bregister;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_here);
final Logindao logindao= new Logindao();
etname= (EditText) findViewById(R.id.etname);
etusername= (EditText) findViewById(R.id.etusername);
etpassword= (EditText) findViewById(R.id.etpassword);
etconfirmpassword= (EditText) findViewById(R.id.etconfirmpassword);
bregister= (Button) findViewById(R.id.bregister);
bregister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String pwd= etpassword.getText().toString();
String confirmPwd = etconfirmpassword.getText().toString();
String name= etname.getText().toString();
String username= etusername.getText().toString();
if (!(pwd.equals(confirmPwd))) {
Toast.makeText(NewHere.this, "Confirmed password and passwords do not match", Toast.LENGTH_SHORT).show();
}
else
{
logindao.saveDataRegistered(getApplicationContext(), name,username,pwd);
Intent setSignUpIntent= new Intent(NewHere.this,MainActivity.class);
NewHere.this.startActivity(setSignUpIntent);
}
}
});
}
public void onRegisterCLick(View view)
{
}
}
| [
"[email protected]"
] | |
b335ec731726e9cd04f7bddedceac0f2ae899062 | f4eab9489e56c6cd62d3c60344dd7f0e75e15857 | /fleet-app/src/main/java/com/shritech/fleetapp/model/Country.java | 9f727da4326d27bd73f3bd2eff1b9e9503bd6386 | [] | no_license | shripradhan/vehicle-management-system | 3dc8e14b65bfa5fcce8f20ae2851a3eaad8182a8 | 72341c764a874ed13faed39eff4fea4ff037edfb | refs/heads/master | 2022-11-05T13:39:21.381878 | 2020-06-29T14:46:22 | 2020-06-29T14:46:22 | 274,454,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package com.shritech.fleetapp.model;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Shrikant Pradhan
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class , property = "id")
public class Country {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String code;
private String capital;
private String description;
private String nationality;
private String continent;
@OneToMany(mappedBy = "country")
private List<State> states;
}
| [
"[email protected]"
] | |
0d4ddba03aa0819e3bf9f17598443ecfbcb4b6b9 | 2760aedf558b79262a356345cbd52fec6e689cff | /ColorMemoryFinal/app/src/test/java/com/example/ColorMemoryFinal/ExampleUnitTest.java | d814c7f9b1d49ffc185d9acef555d3af497d56a7 | [] | no_license | TaPierre/ColorMemory | fe59115f2dafc768eed9f01c3d7bdd9af4de904b | 253cca772040a8773ca7745de03688962bddab0f | refs/heads/master | 2020-05-03T11:14:21.002486 | 2019-03-31T00:20:07 | 2019-03-31T00:20:07 | 178,596,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.example.ColorMemoryFinal;
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);
}
} | [
"[email protected]"
] | |
28ae6290cedd5666b3d8d7c650eef2f548d77f39 | 00bbaae166795efc4ea2ad13e8a557e9f7080625 | /src/main/java/com/leadtechnologist/licketyscript/bash/snippet/readme/ReadmeSnippet.java | 5c55afaeb0ce1705ae40626f2a419c15d2d9f6ca | [] | no_license | mikeleitz/licketyscript-quarkus-service | 98a0c949da9d0535d12266b83c7516e0f44e65be | a421e49c3fb2d73dde9964b3ba22c2309a348896 | refs/heads/master | 2023-07-17T11:30:38.617456 | 2021-08-25T21:24:41 | 2021-08-25T21:24:41 | 335,503,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package com.leadtechnologist.licketyscript.bash.snippet.readme;
import com.leadtechnologist.licketyscript.base.Snippet;
import com.leadtechnologist.licketyscript.base.SnippetContext;
import lombok.SneakyThrows;
/**
* @author [email protected]
*/
public class ReadmeSnippet extends Snippet {
private static final String TEMPLATE_LOCATION = "META-INF/resources/bash/readme-file/readme-instructions.stg";
@SneakyThrows
public ReadmeSnippet(SnippetContext context) {
super(context);
setSnippetTemplate(TEMPLATE_LOCATION);
}
}
| [
"[email protected]"
] | |
229ff172c60bb68b17dc9d94e62a95a012fbb292 | fa9a38ad016b854e628d7b940191db12232eac81 | /WebModule/src/main/java/com/boss/web/index/controller/IndexController.java | 0a2a37fe2f80ee99d36be49c2afa59cf12eaef4a | [] | no_license | zhouyuhong/EnjoylifeBoss | cfcbdcec471f34bf4ef37350a4e1c64a7ae2802e | bcb8259ab11578f14dd067ae3ba8880593d9fdff | refs/heads/master | 2021-01-19T11:15:28.348429 | 2017-05-30T15:36:28 | 2017-05-30T15:36:28 | 87,945,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.boss.web.index.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* ranmin-zhouyuhong
* 2016/12/12
*/
@Controller
public class IndexController {
@RequestMapping("/index.html")
public String index(ModelMap map){
return "index/index";
}
}
| [
"[email protected]"
] | |
5b4ad18b7d821ac785bc657e19a3667769128506 | 372d46f3dd65120d2ba730a665158be0a2c623ed | /backend/src/main/java/com/dvsuperior/crud/services/exceptions/DatabaseException.java | 5a5e71290ff1cfe2eb02ea0e62a9bf3e8e42a7fa | [] | no_license | cauefb/tarefa-crud-bootcamp-devsuperior | e452137e81a017f93dc0e68154dfcc3e9828e876 | a1d7c0af86b5481935c4253fc7462f23fc0a6549 | refs/heads/main | 2023-04-21T21:17:05.059986 | 2021-05-21T20:14:40 | 2021-05-21T20:14:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java |
package com.dvsuperior.crud.services.exceptions;
public class DatabaseException extends RuntimeException{
private static final long serialVersionUID = 1L;
public DatabaseException(String msg){
super(msg);
}
}
| [
"[email protected]"
] | |
364dbeabd6fac75bbeb7e40d1d530707c8ed3972 | 446d682a06969b04ff637f83fa71b2448fda423f | /tinker/tconstruct/items/CraftingItem.java | 3f4c28efc07a9c8418546edc0ebc21d96d7f9dfc | [] | no_license | agaricusb/TinkersConstruct | 21ad2db01f867a1397788e80be334c7b5bab9213 | 2f5d798753d1642eb5ee5f15270b6fe73bfdce3c | refs/heads/master | 2021-01-16T00:17:33.310208 | 2013-03-09T11:49:04 | 2013-03-09T11:49:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package tinker.tconstruct.items;
import java.util.List;
import tinker.tconstruct.TConstruct;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class CraftingItem extends Item
{
public CraftingItem(int id, int icon, String tex)
{
super(id);
this.setCreativeTab(TConstruct.materialTab);
this.iconIndex = icon;
this.setTextureFile(tex);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@SideOnly(Side.CLIENT)
public int getIconFromDamage(int meta)
{
return this.iconIndex + meta;
}
}
| [
"[email protected]"
] | |
6ab22694afb1559b35fefbb6c38c99867a9f8704 | 884cfabbe4e6ca4a011fcc8d601daef6fb1522c9 | /src/main/java/org/jhttping/Header.java | d7015d2a57f5b98300ab921a6d95061c07107af5 | [] | no_license | achmelev/jhttping | a52e17f434cf00081127ca1947b8259eb37e56f7 | 529d2f9f02090bd0a92d7f449aab89d1f9549c29 | refs/heads/master | 2021-06-25T12:45:41.146786 | 2019-10-31T12:20:18 | 2019-10-31T12:20:18 | 216,259,691 | 0 | 0 | null | 2021-04-26T19:37:52 | 2019-10-19T19:29:03 | Java | UTF-8 | Java | false | false | 423 | java | package org.jhttping;
public class Header {
private String name;
private String value;
public Header(String name, String value) {
super();
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
| [
"[email protected]"
] | |
50dae3672fcc5be837dc9abb8613dc62073995cc | 440f26d3ee405d87fc26f4a3bc3cef4703733387 | /src/main/java/io/opensec/oval/model/macos/Plist510Test.java | a3d83e8ef9ff24169d91dcf541496ddfe207171c | [
"Apache-2.0"
] | permissive | nakamura5akihito/opensec-oval | 37e6e22d79da959a7d64eb7820c4aa81461d056e | 7afea82fd919d882231a34e73c0e59d4b184e3e7 | refs/heads/master | 2021-01-10T06:58:02.597702 | 2015-06-17T10:56:33 | 2015-06-17T10:56:33 | 36,717,938 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,922 | java | /**
* Opensec OVAL - https://nakamura5akihito.github.io/
* Copyright (C) 2015 Akihito Nakamura
*
* 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 io.opensec.oval.model.macos;
import io.opensec.oval.model.ComponentType;
import io.opensec.oval.model.Family;
import io.opensec.oval.model.common.CheckEnumeration;
import io.opensec.oval.model.definitions.StateRefType;
import io.opensec.oval.model.definitions.SystemObjectRefType;
import io.opensec.oval.model.definitions.TestType;
/**
* The plist510 test is used to check the value(s) associated with property list preference keys.
*
* @author Akihito Nakamura, AIST
* @see <a href="http://oval.mitre.org/language/">OVAL Language</a>
*/
public class Plist510Test
extends TestType
{
/**
* Constructor.
*/
public Plist510Test()
{
this( null, 0 );
}
public Plist510Test(
final String id,
final int version
)
{
this( id, version, null, null );
}
public Plist510Test(
final String id,
final int version,
final String comment,
final CheckEnumeration check
)
{
this( id, version, comment, check, null, null );
}
public Plist510Test(
final String id,
final int version,
final String comment,
final CheckEnumeration check,
final SystemObjectRefType object,
final StateRefType[] stateList
)
{
super( id, version, comment, check, object, stateList );
_oval_family = Family.MACOS;
_oval_component = ComponentType.PLIST510;
}
//**************************************************************
// java.lang.Object
//**************************************************************
@Override
public int hashCode()
{
return super.hashCode();
}
@Override
public boolean equals(
final Object obj
)
{
if (!(obj instanceof Plist510Test)) {
return false;
}
return super.equals( obj );
}
@Override
public String toString()
{
return "plist510_test[" + super.toString() + "]";
}
}
//
| [
"[email protected]"
] | |
05dfb81a414f21a52e4671efdbed17c3df8603a7 | d3504e02bef9a08680f10678a7c595104ca5431d | /src/main/java/com/invoicegenerator/CabInvoiceGenerator.java | bac6508a432a8b5fc0a22b0c8200c3f392152524 | [] | no_license | dineshkumarpeddakotla/CabInvoiceGenerator | 3ff8404ab53d67fb35d10e87e23019bdecfc9661 | 0116aa2375e3187366c1144b336ee279c78e073b | refs/heads/master | 2023-08-10T10:19:48.079393 | 2021-04-28T02:10:18 | 2021-04-28T02:10:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,868 | java | package com.invoicegenerator;
import java.util.HashMap;
public class CabInvoiceGenerator {
private static final int COST_PER_MINUTE = 1;
private static final double MINIMUM_COSt_PER_KILOMETER = 10;
private static final double MINIMUM_FARE = 5.0;
private final HashMap<Integer,double[]> rideRepository = new HashMap<>();
private static Integer userId;
public CabInvoiceGenerator() {
}
public CabInvoiceGenerator(int userId) {
CabInvoiceGenerator.userId = userId;
rideRepository.put(userId, null);
}
public double calculateFare(double distance, int time) {
double totalFare = distance * MINIMUM_COSt_PER_KILOMETER + time * COST_PER_MINUTE;
return Math.max(totalFare, MINIMUM_FARE);
}
public double calculateTotalFare(Ride[] rides) {
double totalFare = 0;
for (Ride ride : rides) {
totalFare += this.calculateFare(ride.getDistance(), ride.getTime());
}
return totalFare;
}
public int getNumberOfRides(Ride[] rides) {
return rides.length;
}
public double calculateAverageRideCost(Ride[] rides) {
double totalFare = 0;
for (Ride ride : rides) {
totalFare += calculateFare(ride.getDistance(), ride.getTime());
}
return totalFare / rides.length;
}
public Integer getUserId() {
return userId;
}
public void addUserRideRegister(CabInvoiceGenerator user, Ride[] Ride){
double[] userRideRegistry = { user.calculateAverageRideCost(Ride),
user.calculateTotalFare(Ride),
user.getNumberOfRides(Ride)};
rideRepository.put(getUserId(),userRideRegistry);
}
public double[] getRideDetails(Integer userId) {
return rideRepository.get(userId);
}
}
| [
"[email protected]"
] | |
09db77ad3e56e38e16eb7862975fb047f2a975b1 | 4d26dd8f090aeab45e54957bcd9af323e4dc87bd | /PokerHands/src/pokerhands/BasicCardType.java | 5f8c586186b6fc31bed069124538193c5198d19f | [] | no_license | sallav/PokerHands | f64481732181a398d9900a6554b8988bdb454188 | c0f596a65c733468cdb6992667aa5523c545f8da | refs/heads/master | 2020-05-30T19:40:08.497826 | 2017-03-02T21:11:25 | 2017-03-02T21:11:25 | 83,679,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java |
package pokerhands;
import java.util.*;
/**
* Luokka korttien vertailua varten
* @author Salla
*/
public class BasicCardType implements Comparator<Integer>, CardType {
final private String[] suits = {"Hertta", "Ruutu", "Risti", "Pata"};
final private String[] ranks = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
final private int[] values = {14, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
@Override
public int compare(Integer first, Integer other){
try{
return values[first-1] - values[other-1];
}catch(Exception e){
return first-other;
}
}
/**
* Palauttaa käytössä olevan arvomerkinnän
* @return käytettävät arvot taulukkona
*/
@Override
public String[] ranks(){
return ranks;
}
/**
* Palauttaa käytössä olevat maat
* @return käytettävät maat taulukkona
*/
@Override
public String[] suits(){
return suits;
}
}
| [
"[email protected]"
] | |
b2607d98a507077ce8fcc937de31c3502b5ea870 | d65ba84df3ad7e2e0918d6923a364367abf1cd61 | /src/main/java/com/liuqi/business/service/CtcOrderService.java | 4f0dda61cfe0f9ca812ca38e363f4b90e35e4dfb | [] | no_license | zhanglinjiang30/afil | 1199f41002d9a81affb852273c573fbfe60a391a | 47c63e4c267a57ed80a7a330e9d6b7af4d5a99bd | refs/heads/master | 2023-01-29T03:25:31.000798 | 2020-12-15T11:34:11 | 2020-12-15T11:34:17 | 321,542,651 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | //package com.liuqi.business.service;
//
//import com.liuqi.base.BaseService;
//import com.liuqi.business.model.CtcConfigModelDto;
//import com.liuqi.business.model.CtcOrderModel;
//import com.liuqi.business.model.CtcOrderModelDto;
//
//import java.math.BigDecimal;
//
//public interface CtcOrderService extends BaseService<CtcOrderModel,CtcOrderModelDto>{
//
// /**
// * 创建订单
// * @param userId
// * @param config
// * @param price
// * @param quantity
// * @param tradeType
// * @return
// */
// Long createOrder(Long userId, CtcConfigModelDto config, BigDecimal price, BigDecimal quantity, Integer tradeType,String opeName);
//
// /**
// * 匹配商家
// * @param orderId
// */
// void matchStore(Long orderId);
//
// /**
// * 完成
// * @param orderId
// * @param opeName
// */
// void confirm(Long orderId,String remark, String opeName);
//
// /**
// * 取消
// *
// * @param orderId
// * @param opeName
// */
// void cancel(Long orderId,String remark,String opeName);
//
// /**
// * 自动取消
// *
// * @param orderId
// */
// void autoCancel(Long orderId);
//
//
//}
| [
"[email protected]"
] | |
d71a5342dfc46908ed5e9bd2c42274504ca12bd2 | 39c46a9ea5c1b5127b6c3df3ec4ab988d442fe83 | /app/src/main/java/com/example/smartcharger/ScanQRCodeActivity.java | 9e19c615eeb0459d1da5d909ed5f8b3731e65041 | [] | no_license | TOUHOUALICE/SmartCharger | 62def49b4714da4ea48e5892e071ebcd21e43139 | e027f4512f14d940b665fd7a7a90962c3e504321 | refs/heads/master | 2022-07-29T13:31:58.795117 | 2020-05-31T14:10:00 | 2020-05-31T14:10:00 | 268,201,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,733 | java | package com.example.smartcharger;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
public class ScanQRCodeActivity extends AppCompatActivity {
private CaptureManager capture;
private DecoratedBarcodeView bv_barcode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan_qrcode);
bv_barcode = (DecoratedBarcodeView) findViewById(R.id.bv_barcode);
capture = new CaptureManager(this, bv_barcode);
capture.initializeFromIntent(getIntent(), savedInstanceState);
capture.decode();
}
@Override
protected void onResume() {
super.onResume();
capture.onResume();
}
@Override
protected void onPause() {
super.onPause();
capture.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
capture.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
capture.onSaveInstanceState(outState);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
capture.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return bv_barcode.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
}
}
| [
"[email protected]"
] | |
c33def8fa03098a043c1bcff0a09812f6f0bc3e0 | d25dfca045936ead42dc39b5fb2bdd6c3882fe2f | /src/de/htwhome/MainPC1Stress.java | 49c69e2e81624d54d305b81206592e9f51c1bce9 | [] | no_license | timb-stud/HTW-Home | 9bff808341a32075f362b0bba9ca2e4bc73898cc | 8f1b5b44f020aaddd24aa3f1498b1d5228a8027e | refs/heads/master | 2021-01-22T02:34:14.137163 | 2011-04-13T08:20:31 | 2011-04-13T08:20:31 | 1,486,564 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package de.htwhome;
import de.htwhome.devices.OnOffTimer;
import de.htwhome.gui.LightFrame;
import java.io.IOException;
import java.net.SocketException;
/**
*
* @author tobiaslana
*/
public class MainPC1Stress {
public static void main(String[] args) throws SocketException, IOException{
OnOffTimer onoff = new OnOffTimer(1000, Boolean.TRUE, "Test", "Stresstest");
onoff.startNotifier(1000);
// int[] gidLight = {22000, 21100, 21102};
// for ( int i = 0; i < 40; i++){
// new LightFrame(i, false, "Wohnzimmer", "Licht hinten", gidLight).setVisible(true);
// }
}
}
| [
"[email protected]"
] | |
8ca6a674623e655dafc6acb04b73867796cad70d | 357fe03065b6cb5e15272f0f426e2bfaec39b004 | /2019-20-2/prognyelvek (Java)/hf2/Complex.java | 8cde19cac75748baae54b8a78e58d2f89840f807 | [] | no_license | imdonix/elte-ik-bsc | f2101456dac556264ee5bed0650829bf9522fbaa | 126181bebcf9af323b54222a2177eb8dbb797144 | refs/heads/master | 2023-07-30T23:36:03.440246 | 2022-05-17T21:25:57 | 2022-05-17T21:25:57 | 219,555,437 | 6 | 4 | null | 2021-11-17T22:07:07 | 2019-11-04T17:15:05 | C++ | UTF-8 | Java | false | false | 912 | java | class Complex
{
double re,im;
double abs()
{
return Math.sqrt(re*re + im*im);
}
void add(Complex c)
{
re+=c.re;
im+=c.im;
}
void sub(Complex c)
{
re-=c.re;
im-=c.im;
}
void mul(Complex c)
{
double temp = re;
re=(re*c.re) - (im*c.im);
im=(temp*c.im) + (im*c.re);
}
void conjugate()
{
im*=-1;
}
void reciprocate() {
double scale = re*re + im*im;
re = re / scale;
im = -im / scale;
}
void div(Complex c)
{
// Division : Smith's formula.
double t=re;
if (Math.abs(c.im) < Math.abs(c.re))
{
double d=c.im/c.re;
re=(re+im*d)/(c.re+c.im*d);
im=(im-t*d)/(c.re+c.im*d);
}
else
{
double e=c.re/c.im;
re=(im+re*e)/(c.im+c.re*e);
im=(-t+im*e)/(c.im+c.re*e);
}
}
void print()
{
if(im==0.0)
System.out.println(re);
else
System.out.println(re + ((im >= 0) ? " + " : " - ") + Math.abs(im) + "i");
}
} | [
"[email protected]"
] |
Subsets and Splits