blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 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 listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63edf1639d5567f000df5a436e142cb09bde0f64 | c4eba15dc3a7cf9c3c9e1d28494831bc20e6827d | /dias/BTRelayDriver/src/edu/virginia/dtc/DexcomBTRelayDriver/BluetoothConn.java | c756b4b777dba3b91147b718b02fbc4879236758 | [] | no_license | miiihi/APMMP-git | 3b9cda841c84e8e7b4777e8579f3c480fbe66f12 | a980ec69c22de22566b235dcf83027aca32b512a | refs/heads/master | 2021-01-19T00:21:12.917681 | 2015-04-24T15:36:59 | 2015-04-24T15:36:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,448 | java | package edu.virginia.dtc.DexcomBTRelayDriver;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import edu.virginia.dtc.SysMan.Debug;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.provider.ContactsContract.Contacts.Data;
public class BluetoothConn extends Object{
private static final String TAG = "BluetoothConn";
private String NAME;
private UUID UUID_SECURE;
private static final int RETRY_WAIT = 5;
public static final int NONE = 0;
public static final int LISTENING = 1;
public static final int CONNECTING =2;
public static final int CONNECTED = 3;
private BluetoothAdapter adapter;
private int state, prevState;
private ListenThread listen;
private ConnectThread connect;
private RunningThread running;
private LinkedList<String> rxData;
private Lock rxLock;
private boolean autoRetry = true;
private BluetoothDevice prevDev = null;
public String device = "";
private InterfaceData data;
public ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
public ScheduledFuture<?> retrySchedule;
public BluetoothConn(BluetoothAdapter bt, String uuid, String name, LinkedList<String> rx, Lock lock, boolean retry)
{
final String FUNC_TAG = "BluetoothConn";
Debug.i(TAG, FUNC_TAG, name +"Starting BT connection!");
adapter = bt;
UUID_SECURE = UUID.fromString(uuid);
NAME = name;
rxData = rx;
rxLock = lock;
autoRetry = retry;
data = InterfaceData.getInstance();
}
public void listen()
{
final String FUNC_TAG = "listen";
Debug.i(TAG, FUNC_TAG, NAME +"Listen()");
if(connect!=null)
{
connect.cancel();
connect = null;
}
if(running != null)
{
running.cancel();
running = null;
}
setState(LISTENING);
if(listen == null)
{
listen = new ListenThread();
listen.start();
}
}
public void connect(BluetoothDevice dev, boolean async)
{
final String FUNC_TAG = "connect";
if(async) //Basically a flag to say whether it comes from the UI or internally
{ //We only want to overwrite the device from the UI, not the retry
prevDev = dev;
}
Debug.i(TAG, FUNC_TAG, NAME +"Connect()");
if(state == CONNECTING)
{
if(connect != null)
{
connect.cancel();
connect = null;
}
}
if(running != null)
{
running.cancel();
running = null;
}
connect = new ConnectThread(dev);
connect.start();
setState(CONNECTING);
}
private void running(BluetoothSocket sock)
{
final String FUNC_TAG = "running";
Debug.i(TAG, FUNC_TAG, NAME +"Running()");
if(connect != null)
{
connect.cancel();
connect = null;
}
if(running != null)
{
running.cancel();
running = null;
}
if(listen != null)
{
listen.cancel();
listen = null;
}
running = new RunningThread(sock);
running.start();
setState(CONNECTED);
}
public synchronized void stop()
{
final String FUNC_TAG = "stop";
Debug.i(TAG, FUNC_TAG, NAME + "Stopping Bluetooth");
if(connect != null)
{
connect.cancel();
connect = null;
}
if(running != null)
{
running.cancel();
running = null;
}
if(listen != null)
{
listen.cancel();
listen = null;
}
setState(NONE);
}
public boolean write(byte[] b)
{
RunningThread r;
synchronized(this)
{
if(state != CONNECTED)
return false;
r = running;
}
r.write(b);
return true;
}
private void failed()
{
final String FUNC_TAG = "failed";
Debug.i(TAG, FUNC_TAG, "Connection failed...retrying previous device");
listen();
Runnable retry = new Runnable()
{
public void run()
{
if(prevDev != null && state != CONNECTED)
connect(prevDev, false);
}
};
if(retrySchedule != null)
retrySchedule.cancel(true);
retrySchedule = scheduler.schedule(retry, RETRY_WAIT, TimeUnit.SECONDS);
}
private void lost()
{
final String FUNC_TAG = "lost";
Debug.i(TAG, FUNC_TAG, "Connection lost...retrying previous device");
listen();
Runnable retry = new Runnable()
{
public void run()
{
if(prevDev != null && state != CONNECTED)
connect(prevDev, false);
}
};
if(retrySchedule != null)
retrySchedule.cancel(true);
retrySchedule = scheduler.schedule(retry, RETRY_WAIT, TimeUnit.SECONDS);
}
private synchronized void setState(int st)
{
prevState = state;
state = st;
}
public synchronized int getState()
{
return state;
}
/***************************************************************************************
* Thread classes (Derived from BluetoothChat example developer.android.com)
***************************************************************************************/
private class ListenThread extends Thread
{
private final BluetoothServerSocket servSock;
public ListenThread()
{
final String FUNC_TAG = "ListenThread";
Debug.i(TAG, FUNC_TAG,NAME +"ListenThread starting...");
BluetoothServerSocket tmpSock = null;
try
{
tmpSock = adapter.listenUsingRfcommWithServiceRecord(NAME, UUID_SECURE);
}
catch (IOException e)
{
Debug.e(TAG, FUNC_TAG, NAME + ": ListenThread: socket listen() failed");
}
servSock = tmpSock;
}
public void run()
{
final String FUNC_TAG = "run";
BluetoothSocket socket = null;
while(state != CONNECTED)
{
try
{
socket = servSock.accept();
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG, NAME + ": ListenThread: socket accept() failed");
break;
}
if(socket != null)
{
synchronized(this)
{
switch(state)
{
case LISTENING:
case CONNECTING:
//Start connected thread
break;
case NONE:
case CONNECTED:
try
{
socket.close();
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG, NAME + ": ListenThread: couldn't close unwanted socket");
}
break;
}
}
}
}
}
public void cancel()
{
final String FUNC_TAG = "cancel";
try{
servSock.close();
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG, NAME + ": ListenThread: unable to close() server socket");
}
}
}
private class ConnectThread extends Thread
{
private final BluetoothSocket socket;
private final BluetoothDevice device;
public ConnectThread(BluetoothDevice dev)
{
final String FUNC_TAG = "ConnectThread";
Debug.i(TAG, FUNC_TAG,NAME + ": ConnectThread starting...");
device = dev;
BluetoothSocket tmp = null;
try
{
tmp = device.createRfcommSocketToServiceRecord(UUID_SECURE);
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG,NAME + ": ConnectThread: socket create() failed");
}
socket = tmp;
}
public void run()
{
final String FUNC_TAG = "run";
adapter.cancelDiscovery();
try{
socket.connect();
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG, e.getMessage());
try
{
socket.close();
}
catch(IOException e2)
{
Debug.e(TAG, FUNC_TAG, NAME + ": ConnectThread: unable to close() socket");
}
failed();
return;
}
synchronized(this)
{
connect = null;
}
running(socket);
}
public void cancel()
{
final String FUNC_TAG = "cancel";
try
{
socket.close();
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG, NAME + ": ConnectThread: unable to close() during cancel call");
}
}
}
private class RunningThread extends Thread
{
private final BluetoothSocket socket;
private final InputStream input;
private final OutputStream output;
public RunningThread(BluetoothSocket sock)
{
final String FUNC_TAG = "RunningThread";
Debug.i(TAG, FUNC_TAG,NAME + ": RunningThread starting...");
socket = sock;
InputStream tmpInput = null;
OutputStream tmpOutput = null;
try
{
tmpInput = socket.getInputStream();
tmpOutput = socket.getOutputStream();
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG, NAME + ": RunningThread: IO sockets not created");
}
input = tmpInput;
output = tmpOutput;
}
public void run()
{
final String FUNC_TAG = "run";
byte[] buffer = new byte[1024];
int bytes;
while(true)
{
try
{
bytes = input.read(buffer);
Debug.i(TAG, FUNC_TAG, NAME + ": RunningThread: read "+bytes+" bytes");
if(bytes>0)
{
String out = "";
for(int i=0;i<bytes;i++)
out += String.format("%c", buffer[i]);
Debug.i(TAG, FUNC_TAG, NAME + "Output: " + out);
data.addMessage(rxData, rxLock, out);
}
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG,NAME + ": RunningThread: connection lost, unable to read");
lost();
break;
}
}
}
public void write(byte[] buffer)
{
final String FUNC_TAG = "write";
try
{
output.write(buffer);
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG,NAME + ": RunningThread: Exception during write process");
}
}
public void cancel()
{
final String FUNC_TAG = "cancel";
try
{
socket.close();
}
catch(IOException e)
{
Debug.e(TAG, FUNC_TAG, NAME + ": RunningThread: cancelling of socket failed close()");
}
}
}
}
| [
"antoine.al.robert@gmail.com"
] | antoine.al.robert@gmail.com |
93808dc6de9bd02cdd7e49801ddbce2ea55667b4 | 28d674b8ee27c41fe7c46e334c724a154c166646 | /InheritanceChallenge/src/academy/learnprogramming/Vehicle.java | abafe2c207fad1052cc5c0c80645f3973f52aaff | [] | no_license | DanielFlynn/JavaBasics | 50e59a089e4398fd9c34892819769c93ae91a038 | 0ac8190b8ed55dd78f6971909d04b7662c9a2208 | refs/heads/master | 2020-08-07T10:58:10.897071 | 2019-10-23T13:29:31 | 2019-10-23T13:29:31 | 213,422,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,500 | java | package academy.learnprogramming;
public class Vehicle {
private String name;
private String size;
private int currentVelocity;
private int currentDirection;
public Vehicle(String name, String size) {
this.name = name;
this.size = size;
this.currentVelocity = 0;
this.currentDirection = 0;
}
public void steer(int direction) {
this.currentDirection += direction;
System.out.println("Vehicle.steer(): Steering at " + currentDirection + " degrees.");
}
public void move (int velocity, int direction) {
currentDirection = direction;
currentVelocity = velocity;
System.out.println("Vehicle.move(): Moving at " + currentVelocity + " in direction " + currentDirection);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public int getCurrentVelocity() {
return currentVelocity;
}
public void setCurrentVelocity(int currentVelocity) {
this.currentVelocity = currentVelocity;
}
public int getCurrentDirection() {
return currentDirection;
}
public void setCurrentDirection(int currentDirection) {
this.currentDirection = currentDirection;
}
public void stop() {
this.currentVelocity = 0;
}
}
| [
"dfflynn@uk-c02z42c7lvdl.uk.deloitte.com"
] | dfflynn@uk-c02z42c7lvdl.uk.deloitte.com |
041a52f04d0fd6e53146509519922d1e22d186d9 | b14bb46647bbc24ba697c81919e5a6b0f27eadc0 | /NotificationService/src/main/java/com/java/notification/config/RabbitMQConfig.java | 7ef3e18900c4fba8fb8dd555707ffb8d8f97120d | [] | no_license | luciferMF/java | 3a5e04e242917c5ed5d9d9d5bb3fbdb7e10c9395 | fbb4f651827d62991a8ffc5a6956391d105abc85 | refs/heads/master | 2023-04-23T05:48:16.838705 | 2021-05-03T15:26:10 | 2021-05-03T15:26:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,705 | java | package com.java.notification.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitMQConfig {
@Value("${notification.rabbit.queue.name}")
private String queueName;
@Value("${notification.rabbit.queue.exchange}")
private String exchange;
@Value("${notification.rabbit.queue.routingKey}")
private String routingkey;
@Bean
Queue queue() {
return new Queue(queueName, true);
}
@Bean
DirectExchange exchange() {
return new DirectExchange(exchange);
}
@Bean
Binding binding(Queue queue, DirectExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(routingkey);
}
@Bean
public MessageConverter jsonMessageConverter() {
return new Jackson2JsonMessageConverter();
}
@Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
final RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setMessageConverter(jsonMessageConverter());
return rabbitTemplate;
}
} | [
"noreply@github.com"
] | luciferMF.noreply@github.com |
d85d49fa1a52d3553aeec284ab51ae0532d76188 | 9b798481fd0e68bdba9fd296b4ef496a4d8881fc | /src/main/java/br/com/lucas/twgerenciadortarefas/TwGerenciadorTarefasApplication.java | 30fc0b460dd0fb0be7723f21caeba62ea3781a16 | [] | no_license | LuLiveira/tw-gerenciador-tarefas | 2ec642d5b9e2b685ab58f710b4fa2fac6cab33a6 | 7b265e638a9462086c1180a0c7d55b939e54195d | refs/heads/master | 2020-06-18T00:09:31.767207 | 2019-07-13T17:52:41 | 2019-07-13T17:52:41 | 196,107,039 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package br.com.lucas.twgerenciadortarefas;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TwGerenciadorTarefasApplication {
public static void main(String[] args) {
SpringApplication.run(TwGerenciadorTarefasApplication.class, args);
}
}
| [
"lcsd.lucas@gmail.com"
] | lcsd.lucas@gmail.com |
b23dda8ffc9171ab02156498d4a73215afa4d2a3 | 73f675f05d2c931147baa1ef7275d8c205bd4002 | /interpreter/src/main/java/com/myorg/debuglanguage/interpreter/ast/Negacion.java | 0206c1230d3704ff87fded158f694de6733b21e3 | [] | no_license | Criscape/Algorithm-Debug-Language | 8bd2abcc7c613f95b98ea32dc9cee55826b9c39f | 39263c1f4e6ae521d54d28611bb80893e5b0b07e | refs/heads/master | 2020-05-03T11:56:46.115716 | 2019-05-02T17:41:26 | 2019-05-02T17:41:26 | 178,612,646 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.myorg.debuglanguage.interpreter.ast;
import java.util.Map;
public class Negacion implements ASTNode,java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private ASTNode nodo;
public Negacion(ASTNode nodo) {
super();
this.nodo = nodo;
}
@Override
public Object execute(Map<String, Object> symbolTable, Map<String, Object> localSymbolTable) {
return !((Boolean)nodo.execute(symbolTable, localSymbolTable));
}
}
| [
"criscape99@gmail.com"
] | criscape99@gmail.com |
4cf32e5ee7360b6a2ed83623a066ae08b1f36499 | eca69197507341718c7107d014e793b1170078be | /oplexecutor/src/main/java/org/imf/oplexecutor/fims/bms/ScanningOrderType.java | e35548d28a5fd30b880cde2ed09bc925868c2028 | [] | no_license | ben2602/OPLExecutor | 1328a5b1b38579fff808574d20c06e0d56884adc | 9c3b4d86c575052361e8bef72bec5fbd3cc98636 | refs/heads/master | 2021-01-13T03:15:08.135417 | 2017-04-07T09:42:11 | 2017-04-07T09:42:11 | 77,609,883 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,635 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.03.13 at 10:49:01 AM CET
//
package org.imf.oplexecutor.fims.bms;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ScanningOrderType.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="ScanningOrderType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="top"/>
* <enumeration value="bottom"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "ScanningOrderType")
@XmlEnum
public enum ScanningOrderType {
/**
* Scanning Order Type Top value.
*
*/
@XmlEnumValue("top")
TOP("top"),
/**
* Scanning Order Type Bottom value.
*
*/
@XmlEnumValue("bottom")
BOTTOM("bottom");
private final String value;
ScanningOrderType(String v) {
value = v;
}
public String value() {
return value;
}
public static ScanningOrderType fromValue(String v) {
for (ScanningOrderType c: ScanningOrderType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"Benjamin@benjaminsapfel"
] | Benjamin@benjaminsapfel |
e10412a2447832e087f385b529d459e298009551 | 9aec1b497363d1198e4095fd25424ec9850949e0 | /javaDay06/src/javaDay19/FileEx04.java | cfdb4573cf62f72174b958a8a454183e0356107e | [] | no_license | woosj/javastudy | 5a0dc1c6aa88c2f2ca12b542ba53111dc920aae3 | 097baee8181dd5303b00a94a05e59b7442c05d01 | refs/heads/master | 2021-01-19T09:36:42.951232 | 2017-02-23T03:39:34 | 2017-02-23T03:39:34 | 82,129,148 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 709 | java | package javaDay19;
import java.io.File;
public class FileEx04 {
public static void main(String[] args) {
// TODO Auto-generated method stub
//파일명과 경로 설정
String filename = "fileio.txt";
String filepath = "l:/files";
//파일 혹은 폴더 이름 변경
File src = new File(filepath+"/" +filename); //원본파일
File des = new File(filepath + "/dest.txt"); //
File des2 = new File(filepath); //
if(src.exists()){
src.renameTo(des);
src.renameTo(des2);
}
//폴더목록의 출력
if(des2.exists()){
String dir[] = des2.list();
for(String sss : dir){
System.out.println("dir : " + sss);
}
}
}
}
| [
"woo417@nate.com"
] | woo417@nate.com |
c5e8df3b1c01e8f9e8e43ce3469a7c583af9fa0a | 238d77a00fba46f5a2d061aa8cc087b6f97fd01e | /src/main/java/net/zubial/hibernate/encrypt/types/PBEHibernateParameterNaming.java | e9ebdd0bb92db74ac71e5870f240398faec8509b | [
"Apache-2.0"
] | permissive | zubial/hibernate-encrypt | b07a9dd2c99c6cbf39a4fc817f99edb99b243f19 | f2683da800bb4b39a7f9e9b0a08f9ebf8b09f014 | refs/heads/master | 2020-03-12T22:07:41.733032 | 2018-05-30T09:29:17 | 2018-05-30T09:29:17 | 130,841,256 | 0 | 0 | Apache-2.0 | 2018-05-30T09:31:50 | 2018-04-24T11:07:19 | Java | UTF-8 | Java | false | false | 241 | java | package net.zubial.hibernate.encrypt.types;
public final class PBEHibernateParameterNaming {
public static final String ENCRYPTOR_NAME = "encryptorRegisteredName";
private PBEHibernateParameterNaming() {
super();
}
}
| [
"brodrigues@sbeglobalservice.com"
] | brodrigues@sbeglobalservice.com |
4745690af2fc75a6923dc0ee205952bfe991099c | 845de0a98eaa851af31e0bed8cc8d0e0152611fd | /MavenImplementation/src/test/java/selenium/MavenImplementation/sreenshot3Test.java | eddc6855c4add57507df269edc478197e2aaad12 | [] | no_license | mayuri121/selenium | eb96377c4d14f328d2abdd8a097c68b0e3720e81 | 6acf442ff10a50967d3f625b34475117401c9ccb | refs/heads/master | 2022-07-13T12:26:21.909299 | 2019-10-02T13:43:55 | 2019-10-02T13:43:55 | 212,264,559 | 0 | 0 | null | 2022-06-29T17:41:03 | 2019-10-02T05:47:28 | HTML | UTF-8 | Java | false | false | 870 | java | package selenium.MavenImplementation;
import java.awt.dnd.DragGestureEvent;
import java.io.File;
import java.io.IOException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.io.FileHandler;
import org.testng.annotations.Test;
public class sreenshot3Test {
WebDriver driver;
@Test
public void brower() throws IOException
{
System.setProperty("webdriver.chrome.driver","F:\\selenium software\\chromedriver.exe");
driver=new ChromeDriver();
driver.get("https://www.flipkart.com");
driver.manage().window().maximize();
File f=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileHandler.copy(f, new File("F:\\selenium software\\MavenImplementation\\screenshot\\flipkart.jpg"));
}
}
| [
"Mayuri@192.168.100.22"
] | Mayuri@192.168.100.22 |
12b3d201436ce9c11dd66fa3f8fd4e42e459a7aa | b56a4a115b24c95877d7b11a84f4292df0bfc10b | /CodeRacing/local-runner/decompile/com/google/inject/internal/InternalContext.java | dc923fd764d23fb53f33b5f750c6950e2fc9eacf | [
"Apache-2.0"
] | permissive | tyamgin/AiCup | fd020f8b74b37b97c3a91b67ba1781585e0dcb56 | 5a7a7ec15d99da52b1c7a7de77f6a7ca22356903 | refs/heads/master | 2020-03-30T06:00:59.997652 | 2020-01-16T09:10:57 | 2020-01-16T09:10:57 | 15,261,033 | 16 | 8 | null | null | null | null | UTF-8 | Java | false | false | 3,397 | java | package com.google.inject.internal;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Maps;
import com.google.inject.Key;
import com.google.inject.spi.Dependency;
import com.google.inject.spi.DependencyAndSource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
final class InternalContext
{
private final InjectorImpl.InjectorOptions options;
private Map constructionContexts = Maps.newHashMap();
private Dependency dependency;
private final DependencyStack state = new DependencyStack(null);
InternalContext(InjectorImpl.InjectorOptions paramInjectorOptions)
{
this.options = paramInjectorOptions;
}
public InjectorImpl.InjectorOptions getInjectorOptions()
{
return this.options;
}
public ConstructionContext getConstructionContext(Object paramObject)
{
ConstructionContext localConstructionContext = (ConstructionContext)this.constructionContexts.get(paramObject);
if (localConstructionContext == null)
{
localConstructionContext = new ConstructionContext();
this.constructionContexts.put(paramObject, localConstructionContext);
}
return localConstructionContext;
}
public Dependency getDependency()
{
return this.dependency;
}
public Dependency pushDependency(Dependency paramDependency, Object paramObject)
{
Dependency localDependency = this.dependency;
this.dependency = paramDependency;
this.state.add(paramDependency, paramObject);
return localDependency;
}
public void popStateAndSetDependency(Dependency paramDependency)
{
this.state.pop();
this.dependency = paramDependency;
}
public void pushState(Key paramKey, Object paramObject)
{
this.state.add(paramKey, paramObject);
}
public void popState()
{
this.state.pop();
}
public List getDependencyChain()
{
ImmutableList.Builder localBuilder = ImmutableList.builder();
for (int i = 0; i < this.state.size(); i += 2)
{
Object localObject = this.state.get(i);
Dependency localDependency;
if ((localObject instanceof Key)) {
localDependency = Dependency.get((Key)localObject);
} else {
localDependency = (Dependency)localObject;
}
localBuilder.add(new DependencyAndSource(localDependency, this.state.get(i + 1)));
}
return localBuilder.build();
}
private static final class DependencyStack
{
private Object[] elements = new Object[16];
private int size = 0;
public void add(Object paramObject1, Object paramObject2)
{
if (this.elements.length < this.size + 2) {
this.elements = Arrays.copyOf(this.elements, this.elements.length * 3 / 2 + 2);
}
this.elements[(this.size++)] = paramObject1;
this.elements[(this.size++)] = paramObject2;
}
public void pop()
{
this.elements[(--this.size)] = null;
this.elements[(--this.size)] = null;
}
public Object get(int paramInt)
{
return this.elements[paramInt];
}
public int size()
{
return this.size;
}
}
}
/* Location: D:\Projects\AiCup\CodeRacing\local-runner\local-runner.jar!\com\google\inject\internal\InternalContext.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"tyamgin@gmail.com"
] | tyamgin@gmail.com |
78beed75e631efd749ad195cd47d739e16de0326 | 3f71e0470b462c071ba54fadbe25080e43d169f9 | /src/main/java/javaPractice/LeetCode/suanfa/two/TwoNumDivide_29/TwoNumDivide.java | b632a042513987cb97fec592c62a6549fa17bc2a | [] | no_license | 18753377299/JavaPracticeMaven | 017af4c603c1c6085e923973a3e0292aa8cb727b | 4f373fbb17701689486ddfbb0fc2d7569cf3789b | refs/heads/master | 2023-04-11T16:21:17.320828 | 2021-05-17T13:25:52 | 2021-05-17T13:25:52 | 321,356,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package javaPractice.LeetCode.suanfa.two.TwoNumDivide_29;
/**29:两数相除(难度中等)
给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。
返回被除数 dividend 除以除数 divisor 得到的商。
整数除法的结果应当截去(truncate)其小数部分,例如:truncate(8.345) = 8 以及 truncate(-2.7335) = -2
示例 1:
输入: dividend = 10, divisor = 3
输出: 3
解释: 10/3 = truncate(3.33333..) = truncate(3) = 3
示例 2:
输入: dividend = 7, divisor = -3
输出: -2
解释: 7/-3 = truncate(-2.33333..) = -2
提示:
被除数和除数均为 32 位有符号整数。
除数不为 0。
假设我们的环境只能存储 32 位有符号整数,其数值范围是 [−231, 231 − 1]。本题中,如果除法结果溢出,则返回 231 − 1。
通过次数8
*/
public class TwoNumDivide {
public static void main(String[] args) {
}
}
| [
"1733856225@qq.com"
] | 1733856225@qq.com |
a99da2c02fea4c7e3246095f5624fccad045f606 | 3fe43aa90c58731655b8c6a0da4a1ed9cb339ef2 | /src/javaff/data/metric/BinaryComparator.java | 54e08dfbc934f39cab740484e24f3333d753b7c8 | [] | no_license | markormesher/javaff-cwk-4 | a407c6beb743cb8a57aee67503f21c2c9bb7f196 | fe30222e0f9698c098e4f75491dbe013ff4be5ee | refs/heads/master | 2021-03-27T17:13:05.252939 | 2016-12-09T15:07:59 | 2016-12-09T15:07:59 | 74,455,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,478 | java | //
// BinaryComparator.java
// JavaFF
//
// Created by Keith Halsey on Fri Jan 16 2004.
//
package javaff.data.metric;
import javaff.planning.State;
import javaff.planning.MetricState;
import javaff.data.PDDLPrinter;
import javaff.data.GroundCondition;
import javaff.data.UngroundCondition;
import javaff.data.UngroundEffect;
import java.math.BigDecimal;
import java.io.PrintStream;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
public class BinaryComparator implements javaff.data.GroundCondition, javaff.data.UngroundCondition
{
public Function first, second;
public int type;
public BinaryComparator(String s, Function f1, Function f2)
{
type = MetricSymbolStore.getType(s);
first = f1;
second = f2;
}
public BinaryComparator(int t, Function f1, Function f2)
{
type = t;
first = f1;
second = f2;
}
public boolean isStatic()
{
return (first.isStatic() && second.isStatic());
}
public boolean effectedBy(ResourceOperator ro)
{
return (first.effectedBy(ro) || second.effectedBy(ro));
}
public GroundCondition staticifyCondition(Map fValues)
{
first = first.staticify(fValues);
second = second.staticify(fValues);
return this;
}
public UngroundCondition minus(UngroundEffect effect)
{
return effect.effectsAdd(this);
}
public Set getStaticPredicates()
{
return new HashSet();
}
public GroundCondition groundCondition(Map varMap)
{
return new BinaryComparator(type, first.ground(varMap), second.ground(varMap));
}
public boolean isTrue(State s)
{
MetricState ms = (MetricState) s;
BigDecimal df = first.getValue(ms);
BigDecimal ds = second.getValue(ms);
boolean result = false;
if (type == MetricSymbolStore.GREATER_THAN) result = (df.compareTo(ds) > 0);
else if (type == MetricSymbolStore.GREATER_THAN_EQUAL) result = (df.compareTo(ds) >= 0);
else if (type == MetricSymbolStore.LESS_THAN) result = (df.compareTo(ds) < 0);
else if (type == MetricSymbolStore.LESS_THAN_EQUAL) result = (df.compareTo(ds) <= 0);
else if (type == MetricSymbolStore.EQUAL) result = (df.compareTo(ds) == 0);
return result;
}
public void PDDLPrint(PrintStream ps, int i)
{
PDDLPrinter.printToString(this, ps, false, false, i);
}
public Set getConditionalPropositions()
{
return new HashSet();
}
public Set getComparators()
{
Set s = new HashSet();
s.add(this);
return s;
}
public String toString()
{
return MetricSymbolStore.getSymbol(type) + " " + first.toString() + " " + second.toString();
}
public String toStringTyped()
{
return MetricSymbolStore.getSymbol(type) + " " + first.toStringTyped() + " " + second.toStringTyped();
}
public boolean equals(Object obj)
{
if (obj instanceof BinaryComparator)
{
BinaryComparator bc = (BinaryComparator) obj;
if (bc.type == this.type && first.equals(bc.first) && second.equals(bc.second)) return true;
else if (((bc.type == MetricSymbolStore.LESS_THAN && this.type == MetricSymbolStore.GREATER_THAN) ||
(this.type == MetricSymbolStore.LESS_THAN && bc.type == MetricSymbolStore.GREATER_THAN) ||
(this.type == MetricSymbolStore.LESS_THAN_EQUAL && bc.type == MetricSymbolStore.GREATER_THAN_EQUAL) ||
(this.type == MetricSymbolStore.LESS_THAN_EQUAL && bc.type == MetricSymbolStore.GREATER_THAN_EQUAL)) &&
(first.equals(bc.second) && second.equals(bc.first))) return true;
else return false;
}
else return false;
}
}
| [
"me@markormesher.co.uk"
] | me@markormesher.co.uk |
12500200028030ed1451beb1aef09817911f5a7e | 2f9a4fec917db74e649e3472790cf54fefb290e6 | /src/java/gov/health/bean/util/JsfUtil.java | 93919cabbc99e362dfcaa9ab3c987d4bf5b23056 | [] | no_license | chamiw2008/hr | 9fe54c4f4c1487544b208bae1c2eea86e22ef8be | cea492512b847558afbed7920079c91fdbcf9912 | refs/heads/master | 2016-08-04T21:30:03.676107 | 2014-06-10T06:28:06 | 2014-06-10T06:28:06 | 7,622,319 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,102 | java | package gov.health.bean.util;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.model.SelectItem;
public class JsfUtil {
public static SelectItem[] getSelectItems(List<?> entities, boolean selectOne) {
int size = selectOne ? entities.size() + 1 : entities.size();
SelectItem[] items = new SelectItem[size];
int i = 0;
if (selectOne) {
items[0] = new SelectItem("", "---");
i++;
}
for (Object x : entities) {
items[i++] = new SelectItem(x, x.toString());
}
return items;
}
public static void addErrorMessage(Exception ex, String defaultMsg) {
String msg = ex.getLocalizedMessage();
if (msg != null && msg.length() > 0) {
addErrorMessage(msg);
} else {
addErrorMessage(defaultMsg);
}
}
public static void addErrorMessages(List<String> messages) {
for (String message : messages) {
addErrorMessage(message);
}
}
public static void addErrorMessage(String msg) {
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
FacesContext.getCurrentInstance().addMessage(null, facesMsg);
}
public static void addSuccessMessage(String msg) {
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg);
}
public static String getRequestParameter(String key) {
return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(key);
}
public static Object getObjectFromRequestParameter(String requestParameterName, Converter converter, UIComponent component) {
String theId = JsfUtil.getRequestParameter(requestParameterName);
return converter.getAsObject(FacesContext.getCurrentInstance(), component, theId);
}
} | [
"chamiw2008@gmail.com"
] | chamiw2008@gmail.com |
69f6b05cc1f06bb7d5eaee644129626c71f9a864 | d38c21ca741cdf366119711ba52c314eed33d0c6 | /src/main/java/com/udemy/workshopmongo/resources/exception/StandardError.java | 7aa4a591d3303cf75f0e5502c37c57d70d436282 | [] | no_license | GabrielAparecido36/workshop-spring-boot-mongodb | 3fd6aa18966a394c3bcf39febb4f8252395dc04f | 667f161dbd5a37125397e379cc8e769f9dfe11b2 | refs/heads/master | 2022-12-07T05:52:05.011768 | 2020-09-07T05:33:15 | 2020-09-07T15:58:36 | 292,974,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package com.udemy.workshopmongo.resources.exception;
import java.io.Serializable;
public class StandardError implements Serializable{
private static final long serialVersionUID = 1L;
private Long timestamp;
private Integer status;
private String error;
private String message;
private String path;
public StandardError() {
}
public StandardError(Long timestamp, Integer status, String error, String message, String path) {
super();
this.timestamp = timestamp;
this.status = status;
this.error = error;
this.message = message;
this.path = path;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
| [
"contato.gabrielaparecido36@gmail.com"
] | contato.gabrielaparecido36@gmail.com |
d63db0230009fe324089fb78d728c7cc4cec49b8 | 29cd88520d592cf42ae9fa4cae06c3401213b260 | /ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/notification/AHNotificationHelper.java | be3b32e8e92935427145464d2374a112907436df | [] | no_license | manbuxingkong/CustomBottomNavigation | d5a6a936f4666584ebbecab40ab3fe65a45ac874 | 09f049a1afb867383e04671e1fe21e36f18dd540 | refs/heads/master | 2020-06-27T17:56:31.159975 | 2019-08-01T08:48:40 | 2019-08-01T08:48:40 | 200,013,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | package com.aurelhubert.ahbottomnavigation.notification;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
/**
* @author repitch
*/
public final class AHNotificationHelper {
private AHNotificationHelper() {
// empty
}
/**
* Get text color for given notification. If color is not set (0), returns default value.
*
* @param notification AHNotification, non null
* @param defaultTextColor int default text color for all notifications
* @return
*/
public static int getTextColor(@NonNull AHNotification notification, @ColorInt int defaultTextColor) {
int textColor = notification.getTextColor();
return textColor == 0 ? defaultTextColor : textColor;
}
/**
* Get background color for given notification. If color is not set (0), returns default value.
*
* @param notification AHNotification, non null
* @param defaultBackgroundColor int default background color for all notifications
* @return
*/
public static int getBackgroundColor(@NonNull AHNotification notification, @ColorInt int defaultBackgroundColor) {
int backgroundColor = notification.getBackgroundColor();
return backgroundColor == 0 ? defaultBackgroundColor : backgroundColor;
}
}
| [
"manbuxingkong@aliyun.com"
] | manbuxingkong@aliyun.com |
09eed850d5513269d7b08cbd1213a043a32de6d7 | 40214e83344dba00200f670319bb56ef3e12c5c5 | /app/src/main/java/com/sampling/Beans/OrderInfo.java | d2e4ad7c39bc2c9f2e9528ce52f22f1a2fdc2537 | [] | no_license | zhouzhenfei8888/sampling | 7b459918f7e8ddfa99b359be05241875873aa384 | ef6381beeb14215e57d364478e89dc97d2ca1334 | HEAD | 2018-09-03T06:51:01.447939 | 2018-07-04T07:27:41 | 2018-07-04T07:27:41 | 115,298,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,993 | java |
package com.sampling.Beans;
import javax.annotation.Generated;
import com.google.gson.annotations.SerializedName;
@Generated("net.hexar.json2pojo")
@SuppressWarnings("unused")
public class OrderInfo {
@SerializedName("xid")
private String mXid;
@SerializedName("\u4e0b\u8fbe\u65e5\u671f")
private String m下达日期;
@SerializedName("\u4efb\u52a1\u76ee\u6807")
private String m任务目标;
@SerializedName("\u4efb\u52a1\u7f16\u53f7")
private String m任务编号;
@SerializedName("\u5907\u6ce8")
private String m备注;
@SerializedName("\u62bd\u68c0\u6570\u91cf")
private Long m抽检数量;
@SerializedName("\u62bd\u68c0\u6837\u672c")
private String m抽检样本;
@SerializedName("\u62bd\u68c0\u9879\u76ee")
private String m抽检项目;
@SerializedName("\u72b6\u6001")
private String m状态;
@SerializedName("\u76ee\u6807\u5b8c\u6210\u65e5\u671f")
private String m目标完成日期;
@SerializedName("\u5b8c\u6210\u6570\u91cf")
private String m完成数量;
@SerializedName("\u5df2\u91c7\u6837\u6570\u91cf")
private String m已采样数量;
public String getM已采样数量() {
return m已采样数量;
}
public void setM已采样数量(String m已采样数量) {
this.m已采样数量 = m已采样数量;
}
public String get完成数量() {
return m完成数量;
}
public void set完成数量(String m完成数量) {
this.m完成数量 = m完成数量;
}
public String getXid() {
return mXid;
}
public void setXid(String xid) {
mXid = xid;
}
public String get下达日期() {
return m下达日期;
}
public void set下达日期(String 下达日期) {
m下达日期 = 下达日期;
}
public String get任务目标() {
return m任务目标;
}
public void set任务目标(String 任务目标) {
m任务目标 = 任务目标;
}
public String get任务编号() {
return m任务编号;
}
public void set任务编号(String 任务编号) {
m任务编号 = 任务编号;
}
public String get备注() {
return m备注;
}
public void set备注(String 备注) {
m备注 = 备注;
}
public Long get抽检数量() {
return m抽检数量;
}
public void set抽检数量(Long 抽检数量) {
m抽检数量 = 抽检数量;
}
public String get抽检样本() {
return m抽检样本;
}
public void set抽检样本(String 抽检样本) {
m抽检样本 = 抽检样本;
}
public String get抽检项目() {
return m抽检项目;
}
public void set抽检项目(String 抽检项目) {
m抽检项目 = 抽检项目;
}
public String get状态() {
return m状态;
}
public void set状态(String 状态) {
m状态 = 状态;
}
public String get目标完成日期() {
return m目标完成日期;
}
public void set目标完成日期(String 目标完成日期) {
m目标完成日期 = 目标完成日期;
}
@Override
public String toString() {
return "OrderInfo{" +
"mXid='" + mXid + '\'' +
", m下达日期='" + m下达日期 + '\'' +
", m任务目标='" + m任务目标 + '\'' +
", m任务编号='" + m任务编号 + '\'' +
", m备注='" + m备注 + '\'' +
", m抽检数量=" + m抽检数量 +
", m抽检样本='" + m抽检样本 + '\'' +
", m抽检项目='" + m抽检项目 + '\'' +
", m状态='" + m状态 + '\'' +
", m目标完成日期='" + m目标完成日期 + '\'' +
", m完成数量='" + m完成数量 + '\'' +
", m已采样数量='" + m已采样数量 + '\'' +
'}';
}
}
| [
"8zzf@sina.com"
] | 8zzf@sina.com |
4541b4bb78881f5c9ab7e479746bc6de3bbcfbac | a7e028f8d5e246ced53b66ca0e7925b2488e0f03 | /app/src/test/java/com/example/andriod/myquizapp/ExampleUnitTest.java | 8191071ba01ac2c1cd130f63520e6164cc882801 | [] | no_license | Thandeka2/MyQuizapp2 | 9fcfde6b62a4dd12255b0cc66dd77174d4f1af6b | c7b7202ec3e05473774f7142dea2121e0d029301 | refs/heads/master | 2021-08-08T03:17:24.581514 | 2017-11-09T12:34:24 | 2017-11-09T12:34:24 | 110,113,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package com.example.andriod.myquizapp;
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);
}
} | [
"thandekakhanyile880@gmail.com"
] | thandekakhanyile880@gmail.com |
3c7172b40305ce0a57243128813eac4b6578898c | 86baac0906e0bc319d3e7fee0ab4efaecb5a0f7d | /HtxkEmsm-system/src/main/java/com/htxk/ruoyi/system/domain/SysPost.java | 6d968841e319729bd82e0ac0d921f545c849d320 | [] | no_license | hongmaple/HtxkEmsm | d267dd83d635c7addf04666bce9eac36d1b926ff | 148a45599a5b21b1e410d61bb81aaaee7154e4e3 | refs/heads/master | 2023-03-03T09:40:28.164681 | 2023-02-24T10:12:23 | 2023-02-24T10:12:23 | 231,493,661 | 100 | 57 | null | 2021-09-20T20:55:17 | 2020-01-03T02:07:43 | HTML | UTF-8 | Java | false | false | 3,116 | java | package com.htxk.ruoyi.system.domain;
import com.htxk.ruoyi.common.annotation.Excel;
import com.htxk.ruoyi.common.annotation.Excel.ColumnType;
import com.htxk.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 岗位表 sys_post
*
* @author ruoyi
*/
public class SysPost extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 岗位序号
*/
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
private Long postId;
/**
* 岗位编码
*/
@Excel(name = "岗位编码")
private String postCode;
/**
* 岗位名称
*/
@Excel(name = "岗位名称")
private String postName;
/**
* 岗位排序
*/
@Excel(name = "岗位排序", cellType = ColumnType.NUMERIC)
private String postSort;
/**
* 状态(0正常 1停用)
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/**
* 用户是否存在此岗位标识 默认不存在
*/
private boolean flag = false;
public Long getPostId() {
return postId;
}
public void setPostId(Long postId) {
this.postId = postId;
}
@NotBlank(message = "岗位编码不能为空")
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
@NotBlank(message = "岗位名称不能为空")
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
public String getPostName() {
return postName;
}
public void setPostName(String postName) {
this.postName = postName;
}
@NotBlank(message = "显示顺序不能为空")
public String getPostSort() {
return postSort;
}
public void setPostSort(String postSort) {
this.postSort = postSort;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("postId", getPostId())
.append("postCode", getPostCode())
.append("postName", getPostName())
.append("postSort", getPostSort())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
| [
"2496155694@qq.com"
] | 2496155694@qq.com |
ccceee1d3a35df214c6d01b9af88abd101d5c85b | 9ae22bd19b2748b61b4ac3076603eb43ce49d9b4 | /src/lexicon.java | c107cff54b6e93dc0c3b91bf3e09bdee2eddbd9e | [] | no_license | Pranay-Mistry/CS-435-Hash-Table | 6f0cbb0e34920f9754430ccf2b57167c2829fb80 | 4ce469216aa0c22c9ebb1f4a49ec02d5f190aad5 | refs/heads/master | 2020-05-14T22:18:43.277171 | 2019-04-17T22:29:46 | 2019-04-17T22:29:46 | 181,972,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,884 | java | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
public class lexicon {
public MakeHash T;
public String a;
public int m;
public int insert = 10;
public int delete = 11;
public int search = 12;
public int print = 13;
public int create = 14;
public int comment = 15;
public void HashCreate(int size) {
m = size;
T = new MakeHash(m);
char[] ar = new char[15 * m];
Arrays.fill(ar, ' ');
a = new String(ar);
}
public void insertInHash(String w) {
T.HashInsert(w, a, freeSpace(w));
int in = freeSpace(w);
w = w + '\0';
a = a.substring(0, in) + w + a.substring(in + 1);
}
public void increaseSize(String str) {
char[] copy = a.toCharArray();
copy = Arrays.copyOf(copy, a.length() * 2);
a = new String(copy);
}
public int freeSpace(String w) {
for (int i = 0; i < a.length(); i++) {
if (a.charAt(i) == ' ') {
if (a.length() - i > w.length())
return i;
else {
increaseSize(a);
return i;
}
}
}
return 0;
}
public void searchWord(String word) {
int idx = T.HashSearch(word, a);
if (idx == -1) {
System.out.println(word + " not found");
} else {
System.out.println(word + " is at index: " + idx);
}
}
public void deleteWord(String word) {
T.HashDelete(word, a);
}
public void printHash() {
System.out.print("Hash Table [T]:\t\t\t\t\t\t\t A:");
for (int k = 0; k < a.length(); k++) {
char l = a.charAt(k);
if (l == '\0') {
System.out.print("\\");
} else {
System.out.print(l);
}
}
System.out.println();
for (int i = 0; i < T.table.length; i++) {
if (T.table[i] == -1 || T.table[i] == -2) {
System.out.println(i + " = ");
continue;
}
String word = "";
for (int j = T.table[i]; j < a.length(); j++) {
if (a.charAt(j) != '\0') {
word += a.charAt(j);
} else {
System.out.println(i + " = " + word);
break;
}
}
}
System.out.println();
}
public void HashBatch(String filename) {
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
String line;
while ((line = reader.readLine()) != null) {
String temp[] = line.split(" ");
String op = "";
String value = "";
op = temp[0];
int operator = Integer.parseInt(op);
if (temp.length > 1)
value = temp[1];
if(operator == create)
HashCreate(Integer.parseInt(value));
else if(operator == insert)
insertInHash(value);
else if(operator == delete)
deleteWord(value);
else if(operator == search)
searchWord(value);
else if(operator == comment)
continue;
else if(temp.length == 1) {
if (operator == print)
printHash();
else if(operator == comment)
continue;
}
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"pm458@njit.edu"
] | pm458@njit.edu |
4692a10ef9e352d1df921f3415a36bc3663317dc | 2653a5d4beccd088f1424478c7dfcd6dca82de11 | /src/main/java/application/rest/v1/Example.java | 46bd12cb36f3e96a0e5a930813f992704f1f9405 | [
"MIT"
] | permissive | gameontext/j12017escape | 04161ab5ac2336b8987e114f973269be6915c72f | fe59779fe2a0d7f684d4db2f12fde3ad5c43239d | refs/heads/master | 2021-07-06T06:51:29.594142 | 2017-10-04T05:09:52 | 2017-10-04T05:09:52 | 105,278,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | package application.rest.v1;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import java.util.ArrayList;
import javax.inject.Inject;
import application.bluemix.ServiceName;
import com.cloudant.client.api.CloudantClient;
@Path("v1/example")
public class Example {
@Inject
@ServiceName(name="j12017escape-cloudantno-1506936539245")
protected CloudantClient client;
@GET
@Produces(MediaType.TEXT_PLAIN)
public Response example() {
List<String> list = new ArrayList<>();
//return a simple list of strings
list.add("Some data");
return Response.ok(list.toString()).build();
}
@GET
@Produces(MediaType.TEXT_PLAIN)
@Path("cloudant")
public Response exampleCloudant() {
List<String> list = new ArrayList<>();
try {
list = client.getAllDbs();
} catch (NullPointerException e) {
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
return Response.ok("The magic word to escape the room is : " + list.toString()).build();
}
}
| [
"MarkNSweep@github.com"
] | MarkNSweep@github.com |
3dbc18f6a8e8139cbf3c9428decffe28fe44f994 | c79764ea1d278ebec961bab342145cb0e195b4f7 | /UMLEditor/src/test/java/org/jinxs/umleditor/MementoTest.java | 5b92220424d6351678fdbf821f940e70985c9b89 | [
"MIT"
] | permissive | mucsci-students/2021sp-420-JINXS | 56854f740cd82e214016c6c82c83ecae4afb8b3f | fddb69f71b63ceb2f4b29b2948a314ae1679b8a8 | refs/heads/develop | 2023-08-02T18:07:54.768000 | 2021-05-03T04:00:00 | 2021-05-03T04:00:00 | 331,989,259 | 2 | 1 | MIT | 2023-07-24T15:35:57 | 2021-01-22T15:42:39 | Java | UTF-8 | Java | false | false | 2,599 | java | package org.jinxs.umleditor;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class MementoTest {
@Test
public void initializeMeme() {
Memento meme = new Memento();
assertEquals("After initialization, the number of states in the memento should be 0", 0, meme.numStates());
}
@Test
public void saveToMeme() {
Memento meme = new Memento();
meme.saveState("test");
assertEquals("Meme should contain one state", 1, meme.numStates());
}
@Test
public void loadFromMeme() {
Memento meme = new Memento();
meme.saveState("test");
assertEquals("Meme should contain one state", 1, meme.numStates());
String state = meme.loadState();
assertEquals("Loaded state should be \"test\"", "test", state);
assertEquals("Meme should be empty", 0, meme.numStates());
}
@Test
public void saveMultipleToMeme() {
Memento meme = new Memento();
meme.saveState("test1");
meme.saveState("test2");
meme.saveState("test3");
assertEquals("Meme should contain three states", 3, meme.numStates());
}
@Test
public void loadMultipleFromMeme() {
Memento meme = new Memento();
meme.saveState("test1");
meme.saveState("test2");
meme.saveState("test3");
assertEquals("Meme should contain three states", 3, meme.numStates());
String state3 = meme.loadState();
assertEquals("First loaded state should be \"test3\"", "test3", state3);
String state2 = meme.loadState();
assertEquals("First loaded state should be \"test2\"", "test2", state2);
String state1 = meme.loadState();
assertEquals("First loaded state should be \"test1\"", "test1", state1);
}
@Test
public void removeOldestStateFromMeme() {
Memento meme = new Memento();
meme.saveState("test1");
meme.saveState("test2");
meme.saveState("test3");
meme.saveState("test4");
meme.saveState("test5");
meme.saveState("test6");
meme.saveState("test7");
meme.saveState("test8");
meme.saveState("test9");
meme.saveState("test10");
assertEquals("Meme should contain ten states", 10, meme.numStates());
meme.saveState("test11");
String newOldestState = "";
for (int s = 0; s < 10; ++s) {
newOldestState = meme.loadState();
}
assertEquals("Oldest state should now be \"test2\"", "test2", newOldestState);
}
}
| [
"jonathan.wilkins28@gmail.com"
] | jonathan.wilkins28@gmail.com |
aeca6df0d005d8dcb21ea9a0dec5edc932a2979c | ee992033f3bc6b2e61769930dfb851415eda0ea0 | /OpenJMLTest/src/org/jmlspecs/openjmltest/testcases/modelghost.java | 67469dfa75d6bfaf6ef7584b4cdb1c40ba30063c | [] | no_license | BogusCurry/OpenJML | 39434af4457d7890bf353c4411508b2b7cbc9fec | fae1879aad04c9d5edd709628ad1447d1468a1bc | refs/heads/master | 2021-07-03T14:14:08.368346 | 2017-09-22T17:37:15 | 2017-09-22T17:37:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,303 | java | package org.jmlspecs.openjmltest.testcases;
import java.util.ArrayList;
import java.util.Collection;
import org.jmlspecs.openjmltest.TCBase;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.ParameterizedWithNames;
import org.junit.runners.Parameterized.Parameters;
/** These tests check various improper declarations of model and ghost
* methods and fields.
* @author David R. Cok
*
*/
@RunWith(ParameterizedWithNames.class)
public class modelghost extends TCBase {
@Parameters
static public Collection<Boolean[]> parameters() {
Collection<Boolean[]> data = new ArrayList<>(2);
data.add(new Boolean[]{false});
data.add(new Boolean[]{true});
return data;
}
public modelghost(Boolean b) {
useSystemSpecs = b;
}
@Test
public void testClassSimple() {
helpTCF("A.java",
"public class A { /*@ model int m() { return B.n; } */ C mm() { return C.nn; }}\n" +
"/*@ model class B { public static int n; } */\n" +
"class C { public static C nn; }"
);
}
@Test
public void testClassSimple2() {
helpTCF("A.java",
"public class A { /*@ model int m() { return B.n; } */ B mm() { return B.nn; }}\n" +
"/*@ model class B { public static int n; } */\n"
,"/A.java:1: cannot find symbol\n symbol: class B\n location: class A",55
,"/A.java:1: cannot find symbol\n symbol: variable B\n location: class A",71
);
}
@Test
public void testClassSimple3() {
helpTCF("A.java",
"public class A { /*@ model B m() { return B.n; } */ }\n" +
"/*@ model class B { public static B n; } */\n"
);
}
@Test
public void testMethod() {
helpTCF("A.java",
"public class A { \n" +
" void m() {}\n" + // OK
" //@ model int m1() { return 0; }\n" + // OK
" /*@ model */ int m2() { return 9; }\n" + // BAD
" void p();\n" + // BAD
" //@ model int p1();\n" + // OK
" /*@ model */ int p2();\n" + // BAD
" //@ int q();\n" + // BAD
" static public class II {\n" + // Line 9
" void m() {}\n" + // OK
" //@ model int m1() { return 0; }\n" + // OK
" /*@ model */ int m2() { return 9; }\n" + // BAD
" void p();\n" + // BAD
" //@ model int p1();\n" + // OK
" /*@ model */ int p2();\n" + // BAD
" //@ int q();\n" + // BAD
" }\n" +
" /*@ static model public class III {\n" + // Line 18
" void m() {}\n" + // OK
" model int m1() { return 0; }\n" + // NO NESTING
" void p();\n" + // OK - FIXME - resolve the rules about model methods and embedded model declarations
" model int p1();\n" + // NO NESTING
" }*/\n" +
"}\n" +
"/*@ model class B { \n" + // Line 25
" void m() {}\n" + // OK
" model int m1() { return 0; }\n" + // NO NESTING
" void p();\n" + // OK -- FIXME - as above
" model int p1();\n" + // NO NESTING
"}\n*/" +
" class C { \n" + // Line 31
" void m() {}\n" + // OK
" //@ model int m1() { return 0; }\n" + // OK
" /*@ model */ int m2() { return 9; }\n" + // BAD
" void p();\n" + // BAD
" //@ model int p1();\n" + // OK
" /*@ model */ int p2();\n" + // BAD
" //@ int q();\n" + // BAD
"}"
// errors in a different order in Java 8
,"/A.java:4: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:5: missing method body, or declare abstract",8
,"/A.java:7: missing method body, or declare abstract",20
,"/A.java:7: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:8: A method or type declaration within a JML annotation must be model",11
,"/A.java:12: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:13: missing method body, or declare abstract",8
,"/A.java:15: missing method body, or declare abstract",20
,"/A.java:15: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:16: A method or type declaration within a JML annotation must be model",11
,"/A.java:20: A model type may not contain model declarations",13
//,"/A.java:21: missing method body, or declare abstract",8
//,"/A.java:22: missing method body, or declare abstract",13
,"/A.java:22: A model type may not contain model declarations",13
,"/A.java:27: A model type may not contain model declarations",14
//,"/A.java:28: missing method body, or declare abstract",8
//,"/A.java:29: missing method body, or declare abstract",14
,"/A.java:29: A model type may not contain model declarations",14
,"/A.java:34: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:35: missing method body, or declare abstract",8
,"/A.java:37: missing method body, or declare abstract",20
,"/A.java:37: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:38: A method or type declaration within a JML annotation must be model",11 // FIXME - beginning of declaration?
// ,"/A.java:8: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: int",7
// ,"/A.java:16: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: int",7
// ,"/A.java:38: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: int",7
// ,"/A.java:4: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:5: missing method body, or declare abstract",8
// ,"/A.java:7: missing method body, or declare abstract",20
// ,"/A.java:7: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:12: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:13: missing method body, or declare abstract",8
// ,"/A.java:15: missing method body, or declare abstract",20
// ,"/A.java:15: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:20: A model type may not contain model declarations",13
// ,"/A.java:21: missing method body, or declare abstract",8
// ,"/A.java:22: missing method body, or declare abstract",13
// ,"/A.java:22: A model type may not contain model declarations",13
// ,"/A.java:34: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:35: missing method body, or declare abstract",8
// ,"/A.java:37: missing method body, or declare abstract",20
// ,"/A.java:37: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:27: A model type may not contain model declarations",14
// ,"/A.java:28: missing method body, or declare abstract",8
// ,"/A.java:29: missing method body, or declare abstract",14
// ,"/A.java:29: A model type may not contain model declarations",14
);
}
@Test
public void testUseMethod() {
helpTCF("A.java",
"public class A { \n" +
" boolean m() {}\n" + // OK
" //@ model boolean m1() { return true; }\n" + // OK
" //@ invariant m() && m1();\n" +
" //@ requires m() && m1();\n" +
" void p() {} ;\n" +
" //@ requires m() && m1();\n" + // BAD - VISIBILITY PROBLEMS
" public void pp() {} ;\n" +
"}\n"
,"/A.java:7: An identifier with package visibility may not be used in a requires clause with public visibility",16
,"/A.java:7: An identifier with package visibility may not be used in a requires clause with public visibility",23
);
}
@Test
public void testUseMethod2() {
helpTCF("A.java",
"public class A { \n" +
" //@ requires B.m() && B.m1();\n" +
" static void p() {};\n" +
" //@ requires B.m() && B.m1();\n" + // BAD - VISIBILITY PROBLEMS
" public static void pp() {} ;\n" +
"}\n" +
"class B { \n" +
" static boolean m() {}\n" + // OK
" //@ model static boolean m1() { return true; }\n" + // OK
" //@ static invariant m() && m1();\n" +
"}\n"
,"/A.java:4: An identifier with package visibility may not be used in a requires clause with public visibility",17
,"/A.java:4: An identifier with package visibility may not be used in a requires clause with public visibility",26
);
}
@Test
public void testUseJML() {
if (!useSystemSpecs) return; // Irrelevant if useSystemSpecs is false
helpTCF("A.java",
"import org.jmlspecs.lang.JML; public class A { \n" +
" //@ requires JML.erasure(\\typeof(this)) == JML.erasure(\\type(A));\n" +
" void p() {};\n" +
"}\n"
);
}
@Test
public void testClass() {
helpTCF("A.java",
"public class A { \n" +
" //@ model static public class B{}\n" +
" /*@ model */ static public class C{}\n" + // NOT MODEL
" //@ static public class D{}\n" + // SHOULD BE MODEL
" public class AA { \n" +
" //@ model public class B{}\n" +
" /*@ model */ public class C{}\n" + // NOT MODEL
" //@ public class D{}\n" + // SHOULD BE MODEL
" }\n" +
" /*@ model public class M { \n" + // Line 10
" model public class B{}\n" + // NO POINT
" public class C{}\n" +
" }*/\n" +
"}\n" +
"/*@ model */ class Y { \n" + // BAD
"}\n" +
"/*@ model class Q { \n" +
" model public class C{}\n" + // NO POINT
" public class D{}\n" +
"}*/\n" + // Line 20
"class Z { \n" +
" //@ model public class B{}\n" +
" /*@ model */ public class C{}\n" + // BAD
" //@ public class D{}\n" + // BAD
"}\n"
// Java 8
,"/A.java:3: A Java declaration (not within a JML annotation) may not be either ghost or model",30
,"/A.java:4: A method or type declaration within a JML annotation must be model", 21
,"/A.java:7: A Java declaration (not within a JML annotation) may not be either ghost or model",26
,"/A.java:8: A method or type declaration within a JML annotation must be model", 17
,"/A.java:11: A model type may not contain model declarations",19
,"/A.java:15: A Java declaration (not within a JML annotation) may not be either ghost or model",14
,"/A.java:18: A model type may not contain model declarations",17
,"/A.java:23: A Java declaration (not within a JML annotation) may not be either ghost or model",24
,"/A.java:24: A method or type declaration within a JML annotation must be model", 15
// Java 7
// ,"/A.java:4: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: class",21
// ,"/A.java:8: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: class",17
// ,"/A.java:24: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: class",15
// ,"/A.java:3: A Java declaration (not within a JML annotation) may not be either ghost or model",30
// ,"/A.java:7: A Java declaration (not within a JML annotation) may not be either ghost or model",26
// ,"/A.java:11: A model type may not contain model declarations",19
// ,"/A.java:15: A Java declaration (not within a JML annotation) may not be either ghost or model",14
// ,"/A.java:23: A Java declaration (not within a JML annotation) may not be either ghost or model",24
// ,"/A.java:18: A model type may not contain model declarations",17
);
}
@Test
public void testField() {
helpTCF("A.java",
"public class A { \n" +
" int m;\n" + // OK
" //@ model int m1;\n" + // OK
" //@ ghost int m1a;\n" + // OK
" /*@ model */ int m2;\n" + // BAD
" /*@ ghost */ int m2a;\n" + // BAD
" //@ int q;\n" + // BAD
" static public class II {\n" + // Line 8
" int m;\n" + // OK
" //@ model int m1;\n" + // OK
" //@ ghost int m1a;\n" + // OK
" /*@ model */ int m2;\n" + // BAD
" /*@ ghost */ int m2a;\n" + // BAD
" //@ int q;\n" + // BAD
" }\n" +
" /*@ static model public class III {\n" + // Line 16
" int m;\n" + // OK
" model int m1;\n" + // NO NESTING
" ghost int m1a;\n" + // NO NESTING
" \n" +
" }*/\n" +
"}\n" +
"/*@ model class B { \n" + // Line 23
" int m;\n" + // OK
" model int m1; ghost int m2; \n" + // NO NESTING
"}\n*/" +
" class C { \n" + // Line 31
" int m;\n" + // OK
" //@ model int m1;\n" + // OK
" //@ ghost int m1a;\n" + // OK
" /*@ model */ int m2;\n" + // BAD
" /*@ ghost */ int m2a;\n" + // BAD
" //@ int q;\n" + // BAD
"}"
// Order changed for Java8
,"/A.java:5: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:6: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:7: A declaration within a JML annotation must be either ghost or model",11
,"/A.java:12: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:13: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:14: A declaration within a JML annotation must be either ghost or model",11
,"/A.java:18: A model type may not contain model declarations",15
,"/A.java:19: A model type may not contain ghost declarations",15
,"/A.java:25: A model type may not contain model declarations",14
,"/A.java:25: A model type may not contain ghost declarations",28
,"/A.java:31: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:32: A Java declaration (not within a JML annotation) may not be either ghost or model",20
,"/A.java:33: A declaration within a JML annotation must be either ghost or model",11 // FIXME - beginning of declaration?
// ,"/A.java:7: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: int",7
// ,"/A.java:14: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: int",7
// ,"/A.java:33: A JML annotation must start with a JML keyword or have a Model or Ghost annotation: int",7
// ,"/A.java:5: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:6: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:12: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:13: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:18: A model type may not contain model declarations",15
// ,"/A.java:19: A model type may not contain ghost declarations",15
// ,"/A.java:31: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:32: A Java declaration (not within a JML annotation) may not be either ghost or model",20
// ,"/A.java:25: A model type may not contain model declarations",14
// ,"/A.java:25: A model type may not contain ghost declarations",28
);
}
@Test
public void testInitializer() {
addMockFile("$A/A.jml","public class A { { i = 2; } }");
helpTCF("A.java","public class A { int i; { i = 1; } } "
,"/$A/A.jml:1: Initializer blocks are not allowed in specifications",18
);
}
@Test
public void testInitializer2() {
addMockFile("$A/A.jml","public class A { } /*@ model class B { int i; { i = 2; } } */ ");
helpTCF("A.java","public class A { int i; { i = 1; } } "
);
}
@Test
public void testInitializer2a() {
addMockFile("$A/A.jml","public class A { } /*@ model public class B { int i; { i = 2; } } */ ");
helpTCF("A.java","public class A { int i; { i = 1; } } "
,"/A.java:1: class B is public, should be declared in a file named B.java",37
);
}
@Test
public void testPackage() {
addMockFile("$A/A.jml","package p; public class A { /*@ model public class B { int i; { i = 2; } } */ }");
helpTCF("A.java","package p; public class A { int i; { i = 1; } } "
);
}
@Test
public void testPackage2() {
addMockFile("$A/A.jml","package pp; public class A { /*@ model public class B { int i; { i = 2; } } */ }");
helpTCF("A.java","package p; public class A { int i; { i = 1; } } "
);
}
@Test public void testInterface() {
helpTCF("TestJava.java","package tt; \n"
+"public interface TestJava { \n"
+" //@ public model int z;\n"
+" //@ static model int z2;\n"
+" public static int zz = 0;\n"
+"}"
);
}
}
| [
"cok@frontiernet.net"
] | cok@frontiernet.net |
2ce66b903143816e34b26811806f512edba9809d | 057a023d0a5c1794b1c6378527c4949989b51523 | /core/src/main/java/it/cilea/core/util/Md5Digester.java | 564c7c93fa3542f25591877158acb4d24adef422 | [] | no_license | lap82/framework-lite | 2b043d50c827d7d0244c966193abfc45541bbe26 | 6ad1e2238144b2b4332a5820099892974e983ccc | refs/heads/master | 2021-01-21T15:52:58.365527 | 2016-01-28T12:49:08 | 2016-01-28T12:49:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package it.cilea.core.util;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.lang.StringUtils;
public final class Md5Digester {
public static String getDigestString(String plainText) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5"); // step 2
} catch (NoSuchAlgorithmException e) {
}
try {
md.update(plainText.getBytes("UTF-8")); // step 3
} catch (UnsupportedEncodingException e) {
}
StringBuffer digestedString = new StringBuffer();
byte raw[] = md.digest(); // step 4
for(int i = 0; i < raw.length; i++)
digestedString.append("+" + raw[i]);
return StringUtils.replace(digestedString.toString(),"+-","-");
}
public static void main(String[] args) {
}
}
| [
"l.pascarelli@cineca.it"
] | l.pascarelli@cineca.it |
dc85b152fe9c83b603e7cdf60498a401523b824e | 3aa2ca8ecc42053638cb86ebf34b55726ffa1efd | /src/business/service/ICashierService.java | c1d016e18c69a599291e7e798fad158b960cfe11 | [] | no_license | adelamera/SD | e1bc38ff67a0679574373562f50824738466cd98 | b9661b5fe1141eff0c624d189cc2937bf03806d7 | refs/heads/master | 2021-04-15T18:36:03.665463 | 2018-06-09T08:48:04 | 2018-06-09T08:48:04 | 126,699,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | package business.service;
import java.util.List;
import business.model.CashierModel;
public interface ICashierService {
public abstract List<CashierModel> findAll();
public abstract CashierModel findById(int id);
public abstract boolean create(CashierModel cashier);
public abstract void update(CashierModel cashier);
public abstract void delete(int id);
public abstract String login(String username, String password);
}
| [
"meradela@yahoo.com"
] | meradela@yahoo.com |
d56fa367b6cdb1308164ebb5bb36e217a8d80797 | 4149f30d2005a759d21b682bb23bd8bf1f03c372 | /other/src/test/java/serialize/model/SerializeModelBuilder.java | 321255001e4387f863f05345837e2a50ba3eab32 | [] | no_license | abelzyp/zava | 522e18fbfbcb85a319f4df2f8dba1babc77ce87c | e4e4cc45eb718ff150c6cf390f80edf059c64c04 | refs/heads/master | 2023-06-21T14:51:08.182488 | 2023-06-18T09:16:25 | 2023-06-18T09:16:25 | 145,134,859 | 1 | 1 | null | 2023-06-18T09:16:27 | 2018-08-17T15:06:44 | Java | UTF-8 | Java | false | false | 1,798 | java | package serialize.model;
import org.apache.commons.compress.utils.Lists;
import java.time.LocalDate;
import java.util.List;
import java.util.stream.IntStream;
/**
* @author zhangyupeng
* @date 2019-04-24
*/
public class SerializeModelBuilder {
/**
* 构造1个poi下10个产品,每个产品包含5天价格日历
*/
public PoiGoodsPrice buildPoiGoodsPrice() {
return PoiGoodsPrice.builder()
.poiId(395529)
.goodsPriceList(buildGoodsPriceList())
.build();
}
private List<GoodsPrice> buildGoodsPriceList() {
List<GoodsPrice> list = Lists.newArrayList();
IntStream.rangeClosed(1, 10)
.forEach(value -> list.add(buildGoodsPrice()));
return list;
}
private GoodsPrice buildGoodsPrice() {
return GoodsPrice.builder()
.goodsId(395529380)
.partnerId(445265172)
.goodsPriceCalendarList(buildPriceCalendarList())
.surcharge(500_00)
.grossProfit(100_00)
.goodsName("产品")
.build();
}
private List<GoodsPriceCalendar> buildPriceCalendarList() {
List<GoodsPriceCalendar> list = Lists.newArrayList();
IntStream.rangeClosed(1, 5)
.forEach(value -> list.add(buildGoodsPriceCalendar()));
return list;
}
private GoodsPriceCalendar buildGoodsPriceCalendar() {
return GoodsPriceCalendar.builder()
.date(LocalDate.now().getDayOfYear())
.salePrice(1000_00)
.originPrice(1000_00)
.basePrice(900_00)
.subPrice(500_00)
.subRatio(50)
.inventory(27)
.build();
}
} | [
"abelzyp@foxmail.com"
] | abelzyp@foxmail.com |
82ab77242046da223cbefc65b1e8c370e089abed | c61700c7b0b86d0e973cb5e35e828ce11343be71 | /src/main/java/com/yixue/xdatam/domain/SessionEventParam.java | 7e895ce2436479865307de4e396ec17366a9368c | [] | no_license | zhangyatao123456/springboot | 89248996c60a9382eb830abfb82d6e4d9fb056f5 | e745c9aa7c3e82770358c65144b34b9746893dd5 | refs/heads/master | 2020-03-09T06:57:06.268486 | 2018-04-08T15:12:44 | 2018-04-08T15:12:44 | 128,652,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | package com.yixue.xdatam.domain;
public class SessionEventParam extends EventParam{
}
| [
"zhangyatao@classba.cn"
] | zhangyatao@classba.cn |
f6a948ae83c006828287cc8afca6b2c502bbcec2 | c8fe40aa94a99f5a190b74b83805b2fcbbb5233a | /assignment-3/src/main/java/com/wipro/assignment3/controller/BankController.java | 30fc443a839b95c1d6b3a03c89e8c126a327064a | [] | no_license | developerAviral/springboot-practice-code | f0255a26b6c3f65bf6a6c9ad9f4e82589b2e1886 | 14bf7c0e4bc3fb3645b0b04c1eecaeabd6f223aa | refs/heads/master | 2020-08-01T21:39:51.285524 | 2019-09-26T15:54:16 | 2019-09-26T15:54:16 | 211,125,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,256 | java | package com.wipro.assignment3.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping("/wipro")
public class BankController {
/*
* This method returns Bank name
* */
@RequestMapping("/get-bank-branches")
public String getBankName(Model model){
List<String> branchList = new ArrayList<>();
for(int i =0; i<10;i++){
branchList.add("Branch-Name"+ i);
}
model.addAttribute("bankName","HSBC");
model.addAttribute("branchList",branchList);
return "bank-details";
}
/*
* This method returns Bank address
* */
@RequestMapping("/get-bank-services")
public String getBankAddress(Model model){
List<String> bankServicesList = new ArrayList<>();
for(int i =0; i<10;i++){
bankServicesList.add("Service-"+ i);
}
model.addAttribute("bankName","HSBC");
model.addAttribute("bankServicesList",bankServicesList);
return "bank-services";
}
}
| [
"developer.aviral@gmail.com"
] | developer.aviral@gmail.com |
792c9a2e3b35365b556b029b90711b41d8eea671 | dd0468634cdf089e9444aa3535adf1edfc1fb3b3 | /app/src/main/java/com/example/huoshangkou/jubowan/bean/CheckHintBean.java | 9ab45451c4c36e641e70df0921fabc1e028229ef | [] | no_license | tkf896309129/JuBoBao | b98fb88d806ffcdc3cae6ba4ca128a38a84b2ce9 | ef432cc34f85c781bbd964f25541c156c704b521 | refs/heads/master | 2021-01-14T15:02:51.553255 | 2020-04-30T01:20:01 | 2020-04-30T01:20:01 | 242,653,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.example.huoshangkou.jubowan.bean;
/**
* 作者:唐先生
* 包名:com.example.huoshangkou.jubowan.bean
* 类名:CheckHintBean
* 描述:
* 创建时间:2018-06-14 17:45
*/
public class CheckHintBean {
private String ErrMsg;
private CheckHintObjBean ReObj;
private int Success;
public String getErrMsg() {
return ErrMsg;
}
public void setErrMsg(String errMsg) {
ErrMsg = errMsg;
}
public CheckHintObjBean getReObj() {
return ReObj;
}
public void setReObj(CheckHintObjBean reObj) {
ReObj = reObj;
}
public int getSuccess() {
return Success;
}
public void setSuccess(int success) {
Success = success;
}
}
| [
"you@example.com"
] | you@example.com |
35ef30e40a24fa5eaa9923b4965fbd5dcfb891ee | 019351eb9567fefa8c9c15588899b52edbb68616 | /Multi-thread/src/cn/shyshetxwh/v2/v21/Service.java | 4a624691301bed607ada60be4090d793410935f2 | [] | no_license | shyshetxwh/selfstudy | 3220bbdee656f659a8890053d12e7a792bc67ad6 | 9b536e83243214a9ea37ff46a48b72d5d242ef2b | refs/heads/master | 2023-04-02T09:52:44.067355 | 2021-04-02T13:33:46 | 2021-04-02T13:33:46 | 352,621,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package cn.shyshetxwh.v2.v21;
/**
* FileName: Service
* Author: Administrator+shyshetxwh
* Date: 2021/1/3 0003 18:47
*/
class Thread6 extends Thread {
@Override
public void run() {
Service service = new Service();
service.service1();
}
}
public class Service {
public synchronized void service1() {
System.out.println("service1");
service2();
}
private synchronized void service2() {
System.out.println("service2");
service3();
}
private synchronized void service3() {
System.out.println("service3");
}
public static void main(String[] args) {
new Thread6().start();
}
}
| [
"shyshetxwh@163.com"
] | shyshetxwh@163.com |
c6c762b388b6a63be03c7fa4aa627c185c0076f3 | d381092dd5f26df756dc9d0a2474b253b9e97bfb | /impe3/impe3-pms-api/src/main/java/com/isotrol/impe3/pms/api/user/UserTemplateDTO.java | 96f00a206d1bd63ecddcadfb32eef8008ffe125b | [] | no_license | isotrol-portal3/portal3 | 2d21cbe07a6f874fff65e85108dcfb0d56651aab | 7bd4dede31efbaf659dd5aec72b193763bfc85fe | refs/heads/master | 2016-09-15T13:32:35.878605 | 2016-03-07T09:50:45 | 2016-03-07T09:50:45 | 39,732,690 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,296 | java | /**
* This file is part of Port@l
* Port@l 3.0 - Portal Engine and Management System
* Copyright (C) 2010 Isotrol, SA. http://www.isotrol.com
*
* Port@l is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Port@l is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Port@l. If not, see <http://www.gnu.org/licenses/>.
*/
package com.isotrol.impe3.pms.api.user;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.isotrol.impe3.pms.api.GlobalAuthority;
import com.isotrol.impe3.pms.api.GlobalRole;
/**
* DTO for user mangement.
* @author Andres Rodriguez
*/
public class UserTemplateDTO extends UserSelDTO {
/**
* Builds a list of granted roles.
* @param sr Granted roles.
* @param names Roles display names.
* @param authNames Authorities display names.
* @return The requested list.
*/
private static List<Granted<GlobalRoleDTO>> roles(Set<GlobalRole> sr, Map<GlobalRole, String> names,
Map<GlobalAuthority, String> authNames) {
final List<Granted<GlobalRoleDTO>> roles = new ArrayList<Granted<GlobalRoleDTO>>(GlobalAuthority.values().length);
for (GlobalRole gr : GlobalRole.values()) {
roles.add(Granted.of(sr != null && sr.contains(gr), new GlobalRoleDTO(gr, names, authNames)));
}
return roles;
}
/**
* Builds a list of granted authorities.
* @param sa Granted authorities.
* @param authNames Authorities display names.
* @return The requested list.
*/
private static List<Granted<GlobalAuthorityDTO>> authorities(Set<GlobalAuthority> sa,
Map<GlobalAuthority, String> authNames) {
final List<Granted<GlobalAuthorityDTO>> authorities = new ArrayList<Granted<GlobalAuthorityDTO>>(GlobalRole
.values().length);
for (GlobalAuthority ga : GlobalAuthority.values()) {
authorities.add(Granted.of(sa != null && sa.contains(ga), new GlobalAuthorityDTO(ga, authNames)));
}
return authorities;
}
/** Serial UID. */
private static final long serialVersionUID = 1591425780854399004L;
/** Roles. */
private final List<Granted<GlobalRoleDTO>> roles;
/** Authorities. */
private final List<Granted<GlobalAuthorityDTO>> authorities;
/**
* Constructor based on a previous user.
* @param dto Source DTO.
* @param names Roles display names.
* @param authNames Authorities display names.
*/
UserTemplateDTO(UserDTO dto, Map<GlobalRole, String> names, Map<GlobalAuthority, String> authNames) {
super(dto);
this.roles = roles(dto.getRoles(), names, authNames);
this.authorities = authorities(dto.getAuthorities(), authNames);
}
/**
* Empty template constructor.
* @param names Roles display names.
* @param authNames Authorities display names.
*/
public UserTemplateDTO(Map<GlobalRole, String> names, Map<GlobalAuthority, String> authNames) {
setActive(true);
this.roles = roles(null, names, authNames);
this.authorities = authorities(null, authNames);
}
/**
* Returns the roles.
* @return The roles.
*/
public List<Granted<GlobalRoleDTO>> getRoles() {
return roles;
}
/**
* Returns the authorities.
* @return The authorities.
*/
public List<Granted<GlobalAuthorityDTO>> getAuthorities() {
return authorities;
}
public UserDTO toDTO() {
final UserDTO dto = new UserDTO(this);
final Set<GlobalRole> sr = new HashSet<GlobalRole>();
for (Granted<GlobalRoleDTO> gr : roles) {
if (gr.isGranted()) {
sr.add(gr.get().getRole());
}
}
dto.setRoles(sr);
final Set<GlobalAuthority> sa = new HashSet<GlobalAuthority>();
for (Granted<GlobalAuthorityDTO> ga : authorities) {
if (ga.isGranted()) {
sa.add(ga.get().getAuthority());
}
}
dto.setAuthorities(sa);
return dto;
}
}
| [
"isotrol-portal@portal.isotrol.com"
] | isotrol-portal@portal.isotrol.com |
1bc0d52b6f884763c143b6683bda2c18473f8521 | 2c3a39f08dbb4dbe9d706865cd26f1b7c1ba621f | /src/main/java/com/amazonaws/s3/core/S3Reader.java | f85c535e2c173b2010fcb700a8e28c72b49265b1 | [] | no_license | nirmal1067/S3Connect | 548b0f399c69decad28a4f7de1b7dcecc1a90724 | 0bce03cfcb8d3eb686e7afbc9ceeb1dfa602d5a5 | refs/heads/main | 2023-01-21T23:04:19.170198 | 2020-12-01T10:50:51 | 2020-12-01T10:50:51 | 317,507,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,184 | java | package com.amazonaws.s3.core;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import com.amazonaws.s3.operations.IReader;
import com.amazonaws.services.s3.model.S3Object;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
public class S3Reader implements IReader{
public String readJson(String bucket,String key) throws JsonParseException, JsonMappingException, IOException {
S3Object object = S3ClientProvider.AmazonS3Client().getObject(bucket, key);
String json = parseString(object.getObjectContent());
return json;
}
private String parseString(InputStream input) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String line ;
StringBuilder builder = new StringBuilder();
while ((line = reader.readLine())!=null) {
builder.append(line);
System.out.println(" " + line);
}
// System.out.println(builder.toString());
return builder.toString();
}
}
| [
"nirmal1067@gmail.com"
] | nirmal1067@gmail.com |
28d9a6dd17356d36b67b16e2b8cc10381997811d | 1b3bd97a0e36bb4cc1a593a2fb743535afb95231 | /State Pattern/src/gumball/WinnerState.java | fa04182575d8c4712d245ac8e915baf2a976b7bb | [] | no_license | gagreen/Design-Pattern | 8c56fb33ea0f408c3aa26c115fee7f4de8caab11 | da70b46f634586904238af86e6d5cb037aca394e | refs/heads/master | 2023-04-21T10:18:28.776509 | 2021-05-10T14:55:12 | 2021-05-10T14:55:12 | 282,681,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,184 | java | package gumball;
/* 당첨 상태(손잡이를 돌린 상태 + 알맹이 하나 더) */
public class WinnerState implements State {
GumballMachine gumballMachine;
public WinnerState(GumballMachine gumballMachine) {
this.gumballMachine = gumballMachine;
}
@Override
public void insertQuater() {
System.out.println("잠시만 기다려 주세요. 알맹이가 나가고 있습니다.");
}
@Override
public void ejectQuater() {
System.out.println("이미 알맹이를 뽑으셨습니다.");
}
@Override
public boolean turnCrank() {
System.out.println("손잡이는 한 번만 돌려주세요");
return false;
}
@Override
public void dispense() {
System.out.println("축하드립니다! 알맹이를 하나 더!!!");
gumballMachine.releaseBall(); // 일단 한 번 뽑고
if(gumballMachine.getCount() == 0) {
gumballMachine.setState(gumballMachine.getSoldOutState());
} else {
gumballMachine.releaseBall(); // 한 번 더!
if(gumballMachine.getCount() > 0) {
gumballMachine.setState(gumballMachine.getNoQuarterState());
} else {
gumballMachine.setState(gumballMachine.getSoldOutState());
}
}
}
public void refill() {}
}
| [
"minsang6088@naver.com"
] | minsang6088@naver.com |
eaca18cb278d9f02771085437976b21e96d3b9be | 50c079a0aea174b6cfb50f1bd6a478008536dc90 | /app/src/main/java/br/com/futeboldospais/futeboldospais/controller/DecimaTerceiraRodadaFragment.java | 8f2fcf147e4a5e52905f304934f0bd4e94a1fd74 | [] | no_license | DanielAlmeida2016/FutebolDosPais | 094b7a337f4477fa2cf7fb6225e88c1291882c6e | 5ff3d536535d342dff6641c7d2a97eff9812fcb0 | refs/heads/master | 2021-09-08T21:02:16.312570 | 2018-03-12T06:58:11 | 2018-03-12T06:58:11 | 103,862,115 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,474 | java | package br.com.futeboldospais.futeboldospais.controller;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import br.com.futeboldospais.futeboldospais.R;
import br.com.futeboldospais.futeboldospais.model.Resultado;
import br.com.futeboldospais.futeboldospais.service.ResultadoService;
import br.com.futeboldospais.futeboldospais.util.AdapterPadrao;
import br.com.futeboldospais.futeboldospais.util.NavegacaoRodadasHelper;
import br.com.futeboldospais.futeboldospais.util.ResultadoAdapter;
/**
* A simple {@link Fragment} subclass.
*/
public class DecimaTerceiraRodadaFragment extends Fragment {
/**
* Created by Solange Carlos on 28/10/2017.
* Cria um singleton da classe
*/
private static DecimaTerceiraRodadaFragment fragment = null;
public static DecimaTerceiraRodadaFragment newInstance() {
if (fragment == null) {
fragment = new DecimaTerceiraRodadaFragment();
}
return fragment;
}
public static DecimaTerceiraRodadaFragment getInstance() {
return fragment;
}
private ListView tabelaResultado;
private Resultado[] listaResultado;
public DecimaTerceiraRodadaFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_decimaterceira_rodada, container, false);
tabelaResultado = (ListView) view.findViewById(R.id.decimaterceira_rodada_tabela);
listaResultado = NavegacaoRodadasHelper.carregarAdapter(tabelaResultado, listaResultado, 13, 2, getActivity());
tabelaResultado.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (listaResultado[position].getGolsEquipe1() != -1 && listaResultado[position].getGolsEquipe2() != -1) {
NavegacaoRodadasHelper.abrirSumula(listaResultado, position, getActivity());
}
}
});
return view;
}
}
| [
"danielboninialmeida@gmail.com"
] | danielboninialmeida@gmail.com |
756f38291353c6d7166f61347d7cc4d936e72e9c | 605360b9f98c16e10d3a4e3fc6bd7316c4410468 | /portlet-xml-generator-source-generator/src/main/java/com/rapatao/projects/portletxmlgenerator/mavenplugin/definitions/portlet/v2/FilterType.java | 3fe49b5ef3e0fa67b9493d221e8a88228ef9fe4e | [] | no_license | rapatao/portlet-xml-generator-maven-plugin | 127fde1b09030c777cfef6e8609fbf27dffa3f53 | 9c031f6684049e705faa34d4e4bdf94cea4efdff | refs/heads/master | 2021-01-10T05:40:47.418514 | 2016-02-25T21:40:45 | 2016-02-25T21:40:45 | 52,308,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,706 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.02.22 at 02:18:31 PM BRT
//
package com.rapatao.projects.portletxmlgenerator.mavenplugin.definitions.portlet.v2;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* The filter element specifies a filter that can transform the
* content of portlet requests and portlet responses.
* Filters can access the initialization parameters declared in
* the deployment descriptor at runtime via the FilterConfig
* interface.
* A filter can be restricted to one or more lifecycle phases
* of the portlet. Valid entries for lifecycle are:
* ACTION_PHASE, EVENT_PHASE, RENDER_PHASE,
* RESOURCE_PHASE
* Used in: portlet-app
*
*
* <p>Java class for filterType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="filterType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="filter-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-nameType"/>
* <element name="filter-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType"/>
* <element name="lifecycle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" maxOccurs="unbounded"/>
* <element name="init-param" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}init-paramType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "filterType", propOrder = {
"description",
"displayName",
"filterName",
"filterClass",
"lifecycle",
"initParam"
})
public class FilterType {
protected List<DescriptionType> description;
@XmlElement(name = "display-name")
protected List<DisplayNameType> displayName;
@XmlElement(name = "filter-name", required = true)
protected String filterName;
@XmlElement(name = "filter-class", required = true)
protected String filterClass;
@XmlElement(required = true)
protected List<String> lifecycle;
@XmlElement(name = "init-param")
protected List<InitParamType> initParam;
/**
* Gets the value of the description property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the description property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDescription().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DescriptionType }
*
*
*/
public List<DescriptionType> getDescription() {
if (description == null) {
description = new ArrayList<DescriptionType>();
}
return this.description;
}
/**
* Gets the value of the displayName property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the displayName property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDisplayName().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DisplayNameType }
*
*
*/
public List<DisplayNameType> getDisplayName() {
if (displayName == null) {
displayName = new ArrayList<DisplayNameType>();
}
return this.displayName;
}
/**
* Gets the value of the filterName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFilterName() {
return filterName;
}
/**
* Sets the value of the filterName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFilterName(String value) {
this.filterName = value;
}
/**
* Gets the value of the filterClass property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFilterClass() {
return filterClass;
}
/**
* Sets the value of the filterClass property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFilterClass(String value) {
this.filterClass = value;
}
/**
* Gets the value of the lifecycle property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the lifecycle property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getLifecycle().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getLifecycle() {
if (lifecycle == null) {
lifecycle = new ArrayList<String>();
}
return this.lifecycle;
}
/**
* Gets the value of the initParam property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the initParam property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getInitParam().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link InitParamType }
*
*
*/
public List<InitParamType> getInitParam() {
if (initParam == null) {
initParam = new ArrayList<InitParamType>();
}
return this.initParam;
}
}
| [
"rapatao@rapatao.com"
] | rapatao@rapatao.com |
faa39fd6cce21f49b2f8954d911ea9e35b14e21c | 5329a8165bd7b4ac71125fef7148d7e1ccb8ff18 | /src/main/pre/tree/BinarySearchTreeTest.java | 00bb4e5d01757750b449ae4c62e91fe43423f447 | [] | no_license | 0jiejie0/AlgorithmPractice | c54c521afb9c54796ebaf5fdb363a0ef6bad753b | 63345cc3576c2321871d46c7e824045934fc60f1 | refs/heads/master | 2020-12-06T23:15:43.252847 | 2020-11-14T11:43:17 | 2020-11-14T11:43:17 | 232,577,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,403 | java | package main.pre.tree;
import junit.framework.TestCase;
public class BinarySearchTreeTest extends TestCase {
BinarySearchTree<Integer,String> tree=new BinarySearchTree<>();
public void setUp() throws Exception {
// testInsert();
}
public void testInsert() {
assertEquals(tree.getHeight(),-1);
tree.insert(4,"four");
assertEquals(tree.getHeight(),0);
tree.insert(1);
assertEquals(tree.getHeight(),1);
tree.insert(10);
assertEquals(tree.getHeight(),1);
tree.insert(14,"shisi");
assertEquals(tree.getSize(),4);
assertEquals(tree.getHeight(),2);
tree.insert(7,"banlan");
assertEquals(tree.getSize(),5);
assertEquals(tree.getHeight(),2);
tree.insert(16);
assertEquals(tree.getHeight(),3);
tree.insert(9);
assertEquals(tree.getSize(),7);
assertEquals(tree.getHeight(),3);
tree.insert(3);
assertEquals(tree.getHeight(),3);
tree.insert(5);
assertEquals(tree.getSize(),9);
assertEquals(tree.getHeight(),3);
tree.insert(2);
assertEquals(tree.getHeight(),3);
tree.insert(20);
assertEquals(tree.getHeight(),4);
tree.insert(25,"erwu");
assertEquals(tree.getSize(),12);
assertEquals(tree.getHeight(),5);
}
public void testInorder() {
tree.inorder(k->{
System.out.println(k);
});
}
public void testLookupValue() {
assertEquals(tree.lookupValue(4),"four");
assertEquals(tree.lookupValue(25),"erwu");
assertEquals(tree.lookupValue(14),"shisi");
assertEquals(tree.lookupValue(7),"banlan");
tree.insert(25,"zuidazhi");
assertEquals(tree.lookupValue(25),"zuidazhi");
}
public void testMin() {
assertEquals(tree.min(),(Integer) 1);
assertEquals(tree.max(),(Integer)25);
tree.insert(26);
tree.insert(0);
assertEquals(tree.min(),(Integer) 0);
assertEquals(tree.max(),(Integer)26);
}
public void testMax() {
}
public void testRemove() {
}
public void testSuccessor() {
}
public void testPredecessor() {
}
public void testIsBalance() {
}
public void testGetSize() {
}
public void testGetHeight() {
}
public void testLevelOrder() {
}
} | [
"36239770+0jiejie0@users.noreply.github.com"
] | 36239770+0jiejie0@users.noreply.github.com |
2b86885f0becee7edcfdd63f6ae791178e7cef13 | 28d9dbf070f064396ad57f6671b0b45960bc8cc8 | /src/main/java/generator/model/EcsCartCombo.java | 41a3442d106a407332866acc25582da280688497 | [] | no_license | Black1499/mybatis_study | 8dfa01be4e33f5d8b52477596ba6c185b38c8485 | e3d3abd019f2f66eb811dd08008596adb2fed68f | refs/heads/master | 2020-04-24T01:07:19.909938 | 2019-02-20T06:21:02 | 2019-02-20T06:21:02 | 171,587,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,779 | java | package generator.model;
import java.math.BigDecimal;
public class EcsCartCombo {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.rec_id
*
* @mbg.generated
*/
private Integer recId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.user_id
*
* @mbg.generated
*/
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.session_id
*
* @mbg.generated
*/
private String sessionId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.goods_id
*
* @mbg.generated
*/
private Integer goodsId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.goods_sn
*
* @mbg.generated
*/
private String goodsSn;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.product_id
*
* @mbg.generated
*/
private Integer productId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.group_id
*
* @mbg.generated
*/
private String groupId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.goods_name
*
* @mbg.generated
*/
private String goodsName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.market_price
*
* @mbg.generated
*/
private BigDecimal marketPrice;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.goods_price
*
* @mbg.generated
*/
private BigDecimal goodsPrice;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.goods_number
*
* @mbg.generated
*/
private Short goodsNumber;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.is_real
*
* @mbg.generated
*/
private byte[] isReal;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.extension_code
*
* @mbg.generated
*/
private String extensionCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.parent_id
*
* @mbg.generated
*/
private Integer parentId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.rec_type
*
* @mbg.generated
*/
private byte[] recType;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.is_gift
*
* @mbg.generated
*/
private Short isGift;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.is_shipping
*
* @mbg.generated
*/
private byte[] isShipping;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.can_handsel
*
* @mbg.generated
*/
private Byte canHandsel;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.goods_attr_id
*
* @mbg.generated
*/
private String goodsAttrId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ecs_cart_combo.goods_attr
*
* @mbg.generated
*/
private String goodsAttr;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.rec_id
*
* @return the value of ecs_cart_combo.rec_id
*
* @mbg.generated
*/
public Integer getRecId() {
return recId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.rec_id
*
* @param recId the value for ecs_cart_combo.rec_id
*
* @mbg.generated
*/
public void setRecId(Integer recId) {
this.recId = recId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.user_id
*
* @return the value of ecs_cart_combo.user_id
*
* @mbg.generated
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.user_id
*
* @param userId the value for ecs_cart_combo.user_id
*
* @mbg.generated
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.session_id
*
* @return the value of ecs_cart_combo.session_id
*
* @mbg.generated
*/
public String getSessionId() {
return sessionId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.session_id
*
* @param sessionId the value for ecs_cart_combo.session_id
*
* @mbg.generated
*/
public void setSessionId(String sessionId) {
this.sessionId = sessionId == null ? null : sessionId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.goods_id
*
* @return the value of ecs_cart_combo.goods_id
*
* @mbg.generated
*/
public Integer getGoodsId() {
return goodsId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.goods_id
*
* @param goodsId the value for ecs_cart_combo.goods_id
*
* @mbg.generated
*/
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.goods_sn
*
* @return the value of ecs_cart_combo.goods_sn
*
* @mbg.generated
*/
public String getGoodsSn() {
return goodsSn;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.goods_sn
*
* @param goodsSn the value for ecs_cart_combo.goods_sn
*
* @mbg.generated
*/
public void setGoodsSn(String goodsSn) {
this.goodsSn = goodsSn == null ? null : goodsSn.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.product_id
*
* @return the value of ecs_cart_combo.product_id
*
* @mbg.generated
*/
public Integer getProductId() {
return productId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.product_id
*
* @param productId the value for ecs_cart_combo.product_id
*
* @mbg.generated
*/
public void setProductId(Integer productId) {
this.productId = productId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.group_id
*
* @return the value of ecs_cart_combo.group_id
*
* @mbg.generated
*/
public String getGroupId() {
return groupId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.group_id
*
* @param groupId the value for ecs_cart_combo.group_id
*
* @mbg.generated
*/
public void setGroupId(String groupId) {
this.groupId = groupId == null ? null : groupId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.goods_name
*
* @return the value of ecs_cart_combo.goods_name
*
* @mbg.generated
*/
public String getGoodsName() {
return goodsName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.goods_name
*
* @param goodsName the value for ecs_cart_combo.goods_name
*
* @mbg.generated
*/
public void setGoodsName(String goodsName) {
this.goodsName = goodsName == null ? null : goodsName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.market_price
*
* @return the value of ecs_cart_combo.market_price
*
* @mbg.generated
*/
public BigDecimal getMarketPrice() {
return marketPrice;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.market_price
*
* @param marketPrice the value for ecs_cart_combo.market_price
*
* @mbg.generated
*/
public void setMarketPrice(BigDecimal marketPrice) {
this.marketPrice = marketPrice;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.goods_price
*
* @return the value of ecs_cart_combo.goods_price
*
* @mbg.generated
*/
public BigDecimal getGoodsPrice() {
return goodsPrice;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.goods_price
*
* @param goodsPrice the value for ecs_cart_combo.goods_price
*
* @mbg.generated
*/
public void setGoodsPrice(BigDecimal goodsPrice) {
this.goodsPrice = goodsPrice;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.goods_number
*
* @return the value of ecs_cart_combo.goods_number
*
* @mbg.generated
*/
public Short getGoodsNumber() {
return goodsNumber;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.goods_number
*
* @param goodsNumber the value for ecs_cart_combo.goods_number
*
* @mbg.generated
*/
public void setGoodsNumber(Short goodsNumber) {
this.goodsNumber = goodsNumber;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.is_real
*
* @return the value of ecs_cart_combo.is_real
*
* @mbg.generated
*/
public byte[] getIsReal() {
return isReal;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.is_real
*
* @param isReal the value for ecs_cart_combo.is_real
*
* @mbg.generated
*/
public void setIsReal(byte[] isReal) {
this.isReal = isReal;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.extension_code
*
* @return the value of ecs_cart_combo.extension_code
*
* @mbg.generated
*/
public String getExtensionCode() {
return extensionCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.extension_code
*
* @param extensionCode the value for ecs_cart_combo.extension_code
*
* @mbg.generated
*/
public void setExtensionCode(String extensionCode) {
this.extensionCode = extensionCode == null ? null : extensionCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.parent_id
*
* @return the value of ecs_cart_combo.parent_id
*
* @mbg.generated
*/
public Integer getParentId() {
return parentId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.parent_id
*
* @param parentId the value for ecs_cart_combo.parent_id
*
* @mbg.generated
*/
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.rec_type
*
* @return the value of ecs_cart_combo.rec_type
*
* @mbg.generated
*/
public byte[] getRecType() {
return recType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.rec_type
*
* @param recType the value for ecs_cart_combo.rec_type
*
* @mbg.generated
*/
public void setRecType(byte[] recType) {
this.recType = recType;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.is_gift
*
* @return the value of ecs_cart_combo.is_gift
*
* @mbg.generated
*/
public Short getIsGift() {
return isGift;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.is_gift
*
* @param isGift the value for ecs_cart_combo.is_gift
*
* @mbg.generated
*/
public void setIsGift(Short isGift) {
this.isGift = isGift;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.is_shipping
*
* @return the value of ecs_cart_combo.is_shipping
*
* @mbg.generated
*/
public byte[] getIsShipping() {
return isShipping;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.is_shipping
*
* @param isShipping the value for ecs_cart_combo.is_shipping
*
* @mbg.generated
*/
public void setIsShipping(byte[] isShipping) {
this.isShipping = isShipping;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.can_handsel
*
* @return the value of ecs_cart_combo.can_handsel
*
* @mbg.generated
*/
public Byte getCanHandsel() {
return canHandsel;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.can_handsel
*
* @param canHandsel the value for ecs_cart_combo.can_handsel
*
* @mbg.generated
*/
public void setCanHandsel(Byte canHandsel) {
this.canHandsel = canHandsel;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.goods_attr_id
*
* @return the value of ecs_cart_combo.goods_attr_id
*
* @mbg.generated
*/
public String getGoodsAttrId() {
return goodsAttrId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.goods_attr_id
*
* @param goodsAttrId the value for ecs_cart_combo.goods_attr_id
*
* @mbg.generated
*/
public void setGoodsAttrId(String goodsAttrId) {
this.goodsAttrId = goodsAttrId == null ? null : goodsAttrId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ecs_cart_combo.goods_attr
*
* @return the value of ecs_cart_combo.goods_attr
*
* @mbg.generated
*/
public String getGoodsAttr() {
return goodsAttr;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ecs_cart_combo.goods_attr
*
* @param goodsAttr the value for ecs_cart_combo.goods_attr
*
* @mbg.generated
*/
public void setGoodsAttr(String goodsAttr) {
this.goodsAttr = goodsAttr == null ? null : goodsAttr.trim();
}
} | [
"liu1499@foxmail.com"
] | liu1499@foxmail.com |
d60f72249949fd1a6f6a89a98e9dd5e0ca8d1494 | 1bee303695520d34f3336ddca40862ac88675618 | /app/src/main/java/com/example/splashscreen/leh/food/Leh_food.java | 962c31c5f2b230105a92e68fa6783e99e91ac155 | [] | no_license | priyangshupal/RoamIndia | 61fd4e52697f03e700e100f3bd9d8ba3f6a0274d | 0f2d705aa1468d1dd6a3bb76e27bd42e7da31546 | refs/heads/master | 2020-07-21T17:47:12.255397 | 2020-02-15T17:25:22 | 2020-02-15T17:25:22 | 206,934,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,065 | java | package com.example.splashscreen.leh.food;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.example.splashscreen.Adapters.Adapter_food;
import com.example.splashscreen.Adapters.Adapter_shopping;
import com.example.splashscreen.R;
import com.example.splashscreen.main.Place;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
*/
public class Leh_food extends Fragment {
public Leh_food() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_leh_food, container, false);
ArrayList<Place> lehFood = new ArrayList<>();
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/Pizzaria.jpg", "La Pizzeria", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/CHOPSTICKS.jpg", "Chopsticks", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/GESMO.jpg", "Gesmo ", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/LEH-VIEW-RESTAURANT.jpg", "Leh View Restaurant", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/TIBETAN-KITCHEN.jpg", "Tibetan Kitchen", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/LAMAYURU-RESTAURANT.jpg", "Lamayuru Restaurant", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/IL-FOMO.jpg", "Il Fomo", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/SHELDON-GARDEN-RESTAURANT.jpg", "Sheldon Garden Restaurant", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/HIMALAYA-CAFE.jpg", "Himalaya Café", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/Momos.jpg", "Momos", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/Thupka.jpg", "Thukpas", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/GERMAN-BAKERY.jpg", "German Bakery", "Leh Market"));
lehFood.add(new Place("https://www.makemytrip.com/travel-guide/media/dg_image/leh/KHAMBIR.jpg", "Khambir", ""));
ArrayAdapter lehFoodAdapter = new Adapter_food(getActivity().getApplicationContext(), lehFood);
ListView listView= rootView.findViewById(R.id.lehFoodList);
listView.setAdapter(lehFoodAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch(position){
case 0:
Intent intent = new Intent(getActivity(), LaPizzeria.class);
startActivity(intent);
break;
case 1:
Intent intent1 = new Intent(getActivity(), Chopsticks.class);
startActivity(intent1);
break;
case 2:
Intent intent2 = new Intent(getActivity(), Gesmo.class);
startActivity(intent2);
break;
case 3:
Intent intent3 = new Intent(getActivity(), LehViewRestaurant.class);
startActivity(intent3);
break;
case 4:
Intent intent4 = new Intent(getActivity(), TibetanKitchen.class);
startActivity(intent4);
break;
case 5:
Intent intent5 = new Intent(getActivity(), LamayuruRestaurant.class);
startActivity(intent5);
break;
case 6:
Intent intent6 = new Intent(getActivity(), IlFomo.class);
startActivity(intent6);
break;
case 7:
Intent intent7 = new Intent(getActivity(), SheldonGardenRestaurant.class);
startActivity(intent7);
break;
case 8:
Intent intent8 = new Intent(getActivity(), HimalayaCafe.class);
startActivity(intent8);
break;
case 9:
Intent intent9 = new Intent(getActivity(), Momos.class);
startActivity(intent9);
break;
case 10:
Intent intent10 = new Intent(getActivity(), Thukpas.class);
startActivity(intent10);
break;
case 11:
Intent intent11 = new Intent(getActivity(), GermanBakery.class);
startActivity(intent11);
break;
case 12:
Intent intent12 = new Intent(getActivity(), Khambir.class);
startActivity(intent12);
break;
}
}
});
return rootView;
}
}
| [
"priyangshupal@gmail.com"
] | priyangshupal@gmail.com |
d5a9ce44386725c1c39405bd9807e74397296e66 | 6c0a20799a3d3de7c1884a81514337106b46bcd7 | /src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java | 9f46c097f60d56a0770e9e196dd6021f47555174 | [
"Apache-2.0"
] | permissive | ReactiveX/RxJava | 3f206da292c89037e9157a0ec3a3d7fdbae8f6b2 | 542374c80d0df9886384433bd0a25b1358136eda | refs/heads/3.x | 2023-09-03T17:44:06.790656 | 2023-08-29T22:16:58 | 2023-08-29T22:16:58 | 7,508,411 | 49,585 | 9,617 | Apache-2.0 | 2023-09-08T06:51:56 | 2013-01-08T20:11:48 | Java | UTF-8 | Java | false | false | 3,044 | java | /*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex.rxjava3.internal.operators.mixed;
import java.util.concurrent.atomic.AtomicReference;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
/**
* After Completable completes, it relays the signals
* of the ObservableSource to the downstream observer.
*
* @param <R> the result type of the ObservableSource and this operator
* @since 2.1.15
*/
public final class CompletableAndThenObservable<R> extends Observable<R> {
final CompletableSource source;
final ObservableSource<? extends R> other;
public CompletableAndThenObservable(CompletableSource source,
ObservableSource<? extends R> other) {
this.source = source;
this.other = other;
}
@Override
protected void subscribeActual(Observer<? super R> observer) {
AndThenObservableObserver<R> parent = new AndThenObservableObserver<>(observer, other);
observer.onSubscribe(parent);
source.subscribe(parent);
}
static final class AndThenObservableObserver<R>
extends AtomicReference<Disposable>
implements Observer<R>, CompletableObserver, Disposable {
private static final long serialVersionUID = -8948264376121066672L;
final Observer<? super R> downstream;
ObservableSource<? extends R> other;
AndThenObservableObserver(Observer<? super R> downstream, ObservableSource<? extends R> other) {
this.other = other;
this.downstream = downstream;
}
@Override
public void onNext(R t) {
downstream.onNext(t);
}
@Override
public void onError(Throwable t) {
downstream.onError(t);
}
@Override
public void onComplete() {
ObservableSource<? extends R> o = other;
if (o == null) {
downstream.onComplete();
} else {
other = null;
o.subscribe(this);
}
}
@Override
public void dispose() {
DisposableHelper.dispose(this);
}
@Override
public boolean isDisposed() {
return DisposableHelper.isDisposed(get());
}
@Override
public void onSubscribe(Disposable d) {
DisposableHelper.replace(this, d);
}
}
}
| [
"noreply@github.com"
] | ReactiveX.noreply@github.com |
5b813dc687baeb202d8dfde63c1c9acc4604492b | 7cafc987c39a5062c677d04449830eeefb6c16f9 | /AMS2.0-Tejaswini/src/com/dxc/ams2/manager/crud/ManagerCrud.java | 965efef4975395e2550f57360d87626b03805b33 | [] | no_license | shivansh-beep/ProjectModule1 | 1f1bed6ba8e4003e73b18e1a9d9f0088995e600b | af327fa3c932e8b98b41a6ddfb972e1f8c72f553 | refs/heads/master | 2022-11-24T19:52:38.989890 | 2020-08-04T04:16:30 | 2020-08-04T04:16:30 | 284,780,898 | 0 | 1 | null | 2020-08-03T18:47:03 | 2020-08-03T18:47:02 | null | UTF-8 | Java | false | false | 395 | java | package com.dxc.ams2.manager.crud;
import com.dxc.ams2.entity.Agent;
public interface ManagerCrud {
public void viewManager();
public void viewAgent();
public void addAgent(Agent a);
public void viewAgentPerformance(String agid);
public void setTarget(String agno,int target);
public void viewPolicyDetails(String custid);
public void logout();
}
| [
"noreply@github.com"
] | shivansh-beep.noreply@github.com |
021b5a0eec16145ca32cef8b64c6a61074fb7283 | 0ac86d18d1bdc21abfb068cfa06741ea2a117718 | /app/src/main/java/ru/vaszol/contactlist/contact/model/spec/db/TestDbHelper.java | 8ed310d6c7b330de2fc94e2398f956f280458ec4 | [] | no_license | vaszol/ContactList | b0998c21e19670af30df4cc117fba8efb666f94c | 07ceea8115202a1650e09d864a08eda942e9da0d | refs/heads/master | 2021-01-01T18:37:17.213926 | 2015-08-08T23:43:41 | 2015-08-08T23:43:41 | 40,411,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package ru.vaszol.contactlist.contact.model.spec.db;
/**
* Created by vas on 09.08.2015.
*/
import java.sql.SQLException;
import com.j256.ormlite.jdbc.JdbcConnectionSource;
import com.j256.ormlite.support.ConnectionSource;
public class TestDbHelper {
private static final String DB_NAME = "unit_tests.db";
private ConnectionSource connectionSource;
private String databaseUrl = "jdbc:sqlite:" + DB_NAME;
// create a connection source to our database
public ConnectionSource getConnectionSource() {
try {
connectionSource = new JdbcConnectionSource(databaseUrl);
return connectionSource;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
} | [
"vaszol@mail.ru"
] | vaszol@mail.ru |
a474ba4d1f0b5ef091db25343175d03c38765f87 | bd9ac962ccde996b86fc20322f5dd6976d02a2d9 | /src/telran/lessons/_36/dto/persons/Employee.java | 4a1c46f233da8bea4f5b56b96b0e16791eb7eb3b | [] | no_license | djiney/javaTasks | c96b51659b712bc332b230c6c0961a0610ab9dce | 92d95dd3ea666269d174f3774518968878891742 | refs/heads/master | 2021-01-03T21:22:15.345945 | 2020-06-08T12:46:56 | 2020-06-08T12:46:56 | 240,241,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,089 | java | package telran.lessons._36.dto.persons;
import java.time.LocalDate;
public class Employee extends Person
{
private static final long serialVersionUID = 10L;
String company;
Titles title;
int salary;
public Employee() {}
public Employee(long id, Address address, String name, LocalDate birthDate, String company, Titles title, int salary)
{
super(id, address, name, birthDate);
this.company = company;
this.title = title;
this.salary = salary;
}
public String getCompany()
{
return company;
}
public void setCompany(String company)
{
this.company = company;
}
public Titles getTitle()
{
return title;
}
public void setTitle(Titles title)
{
this.title = title;
}
public int getSalary()
{
return salary;
}
public void setSalary(int salary)
{
this.salary = salary;
}
@Override
public String toString()
{
return "Employee{" +
"company='" + company + '\'' +
", title=" + title +
", salary=" + salary +
", id=" + id +
", address=" + address +
", name='" + name + '\'' +
", birthDate=" + birthDate +
'}';
}
}
| [
"DjineyX@gmail.com"
] | DjineyX@gmail.com |
9d7d1ff4e0d0548e63d32d8a5ff238e943f12d9e | 65a5ecaad3030492dd359d8f2dc1a39a747e3b64 | /2.JavaCore/src/com/javarush/task/mywork/com/javarush/task/mywork/Arrays_multy.java | 0797354eee19b443094dca05fa5a3dd234891958 | [] | no_license | PavlenkovIgor/TestGit | 54cd2d719b10f59bcd811454316018024ec4ab02 | acc61202319a20c10431500857b1a940d6fe7ff4 | refs/heads/master | 2020-11-25T00:32:08.637015 | 2020-02-20T18:16:42 | 2020-02-20T18:16:42 | 228,409,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package com.javarush.task.mywork;
public class Arrays_multy {
public static void main(String[] args) {
int [][] matrice = {{1,2,3},
{11,22,33},
{111,222,333}};
for (int i = 0; i < matrice.length; i++){
for (int y = 0; y <matrice[i].length; y++){
System.out.print(matrice[i][y] + " ");
}
System.out.println();
}
}
}
| [
"pavlenkov.igor@mail.ru"
] | pavlenkov.igor@mail.ru |
c709b9316843785789bbe1aca5fbde6f0406587f | 1d462d124ca0879ecf7602a13536885d65066b1c | /src/com/facebook/buck/rules/Buildable.java | 0ef11cfa9a028188b428ce6a5e20c8e3d7fafb07 | [
"Apache-2.0"
] | permissive | alonewolf/buck | 6fd53f76b3a66120961ddb6dcd7db54d38cfa662 | b5387bd4b0a6ed4475e0d794d2e43c6a0a19ec6e | refs/heads/master | 2021-01-18T14:01:57.373138 | 2013-10-25T00:22:37 | 2013-10-25T04:00:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,591 | java | /*
* Copyright 2013-present Facebook, 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.facebook.buck.rules;
import com.facebook.buck.step.Step;
import java.io.IOException;
import java.util.List;
import javax.annotation.Nullable;
/**
* Represents something that Buck is able to build, encapsulating the logic of how to determine
* whether the rule needs to be rebuilt and how to actually go about building the rule itself.
*/
public interface Buildable {
public BuildableProperties getProperties();
/**
* Get the set of input files whose contents should be hashed for the purpose of determining
* whether this rule is cached.
* <p>
* Note that inputs are iterable and should generally be alphatized so that lists with the same
* elements will be {@code .equals()} to one another. However, for some build rules (such as
* {@link com.facebook.buck.shell.Genrule}), the order of the inputs is significant and in these
* cases the inputs may be ordered in any way the rule feels most appropriate.
*/
public Iterable<String> getInputsToCompareToOutput();
/**
* When this method is invoked, all of its dependencies will have been built.
*/
public List<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext)
throws IOException;
public RuleKey.Builder appendDetailsToRuleKey(RuleKey.Builder builder) throws IOException;
/**
* Currently, this is used by {@link AbstractCachingBuildRule} to determine which files should be
* be included in the {@link BuildInfoRecorder}. Ultimately, a {@link Buildable} should be
* responsible for updating the {@link BuildInfoRecorder} itself in its
* {@link #getBuildSteps(BuildContext, BuildableContext)} method. The use of this method should be
* restricted to things like {@code buck targets --show_output}.
*
* @return the relative path to the primary output of the build rule. If non-null, this path must
* identify a single file (as opposed to a directory).
*/
@Nullable
public String getPathToOutputFile();
}
| [
"mbolin@fb.com"
] | mbolin@fb.com |
b801b07cc0a20a6a58b9ef745e2453bfdddc75ee | 006576b09a56194796d7d7b21c633389ccbf246b | /ieee-1516/src/java/hla/rti1516/AttributeSetRegionSetPairList.java | f7be024ee1970dda5bd43121000e22bba4c38934 | [
"Apache-2.0"
] | permissive | zhj149/OpenHLA | ca20ab74ff70404189b5bb606d36718e233c0155 | 1fed36211e54d5dc09cc30b92a1714d5a124b82d | refs/heads/master | 2020-11-25T19:12:34.090527 | 2019-12-20T02:08:17 | 2019-12-20T02:08:17 | 228,805,204 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package hla.rti1516;
import java.io.Serializable;
import java.util.List;
public interface AttributeSetRegionSetPairList
extends List<AttributeRegionAssociation>, Cloneable, Serializable
{
}
| [
"mnewcomb@c6f40f97-f50e-0410-af12-a330f67be530"
] | mnewcomb@c6f40f97-f50e-0410-af12-a330f67be530 |
61d48affea153afbafd3e0a51e8b319fc3cae91c | 470b88c99f37842e8474d49970099cc30aee8b8d | /app/src/main/java/com/delivriko/askdoctorstask/Adapter/InsuranceAdapter.java | f424b76a4ff6a1eca0daf0097e335e0c6f0a6ea3 | [] | no_license | HalimaHanafy/Delivriko-task | 32a736dcf93987c915802646329c2ac78bc3cb7e | afd626b6e41ba4bfb468b8a53917fc5884ebac3a | refs/heads/master | 2021-01-08T04:29:37.524946 | 2020-02-21T09:28:23 | 2020-02-21T09:28:23 | 241,912,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,356 | java | package com.delivriko.askdoctorstask.Adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.delivriko.askdoctorstask.R;
import com.delivriko.askdoctorstask.viewmodel.InsuranceModel;
import java.util.ArrayList;
public class InsuranceAdapter extends RecyclerView.Adapter<InsuranceAdapter.RecyclerViewHolder> {
ArrayList<InsuranceModel> newsModels;
public InsuranceAdapter(ArrayList<InsuranceModel> models) {
this.newsModels = models;
}
@Override
public RecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_insurance, parent, false);
RecyclerViewHolder recyclerViewHolder = new RecyclerViewHolder(view, viewType);
return recyclerViewHolder;
}
@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
InsuranceModel model = newsModels.get(position);
holder.bind(model, position);
}
@Override
public int getItemCount() {
return newsModels.size();
}
class RecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
// TextView title, det;
CardView cardView;
public RecyclerViewHolder(View view, int viewType) {
super(view);
// view.setOnClickListener(this);
cardView = view.findViewById(R.id.card);
}
@Override
public void onClick(View v) {
}
public void bind(InsuranceModel model, int i) {
// title.setText(model.title);
// det.setText(model.desc);
switch (i) {
case 1:
cardView.setCardBackgroundColor(itemView.getResources().getColor(R.color.green)); // it will set fab child's color
cardView.setRadius(110);
// cardView.setPreventCornerOverlap(true);
break;
default:
cardView.setRadius(110);
cardView.setCardBackgroundColor(itemView.getResources().getColor(R.color.colorPrimary)); // it will set fab child's color
}
}
}
}
| [
"Halimahanafy@gmail.com"
] | Halimahanafy@gmail.com |
7e8b03b8cebbd502d3d32ec56a464d1dc9a2c3c4 | 71c579f5f8ac72d7e3d21c77855b62690433c919 | /Documents/Git/ToDoApp/app/src/main/java/com/hilareut/todoapp/common/Constants.java | 654fcf698b5b61f9c2c6a562fc0d6b5a1449bc9f | [] | no_license | hilakr/Text-Mining | 90ed7d2bcd5e89f29a1b9d693e19b1c2a7517498 | d4778d60d999c2bc756b9e210d77dae677f610b8 | refs/heads/master | 2022-02-20T07:49:22.768320 | 2016-06-12T15:59:20 | 2016-06-12T15:59:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package com.hilareut.todoapp.common;
/**
* Created by Hila on 3/3/16.
*/
public class Constants {
//intent vars
public static final String ADD_NEW_TASK = "add_new_task";
public static final String UPDATE_TASK = "update_task";
public static String PARSE_APPLICATION_ID = "utQMLxMYur35Dt5ZSEkwuVgQ8LgOfyloEw70wFlQ";
public static String PARSE_CLIENT_KEY = "6rhHRhdOD784fTAjHPr0XQi7FLoUUN9cWopz0Ouh";
public static final String EDIT_TASK_POSITION = "edit_task_position";
public static final int TASK_UPDATE_LISTENER_CODE_ALL_ITEMS = 1;
public static final int TASK_UPDATE_LISTENER_CODE_ALL_UPDATE = 2;
public static final int TASK_UPDATE_LISTENER_CODE_ALL_DELETE = 3;
public static final int TASK_UPDATE_LISTENER_CODE_ALL_ADD = 4;
}
| [
"hilatashtash@gmail.com"
] | hilatashtash@gmail.com |
6d4184ee6f104f54addb1220cb8c35ccf86d4310 | 229b11b3633f0b26d2968b48fb5cfac1dcb12bdc | /LocationTest_API_23_Test/app/src/main/java/org/example/locationtest/LocationTest.java | c66055b859520d9cbf46db8c89dd13650ef9c42f | [] | no_license | AswaggyP/AndroidStudioProjects | 6195f87a6ad4e1a401d4a1d37716711fa6a8479d | 3863fa067ac688d40a047ba286675e9e93f2e3d3 | refs/heads/master | 2021-01-20T06:23:21.821722 | 2017-04-03T14:45:08 | 2017-04-03T14:45:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,890 | java | /***
* Excerpted from "Hello, Android! 3e",
* published by The Pragmatic Bookshelf.*/
package org.example.locationtest;
import android.Manifest;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Criteria;
import android.location.Geocoder;
import android.location.GpsSatellite;
import android.location.GpsStatus;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationProvider;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.ToggleButton;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
public class LocationTest extends AppCompatActivity {
private static final String TAG = "my Location Test";
private static final int MY_PERMISSIONS_REQUEST_GET_LOCATION = 17291;
// Define human readable names
private static final String[] ACCURACY = {"invalid", "n/a", "fine", "coarse"};
private static final String[] POWER = {"invalid", "n/a", "low", "medium",
"high"};
private static final String[] STATUS = {"out of service",
"temporarily unavailable", "available"};
private static final String[] GPS_EVENTS = {"GPS event started", "GPS event stopped",
"GPS event first fix", "GPS event satellite status"};
private LocationManager mgr;
private ScrollView scrollView;
private TextView output;
private GpsStatus gps;
private ArrayList<SimpleLocationListener> mLocationListeners;
private ToggleButton toggleButton;
private int tryCount;
private Location lastKnownLocation;
private boolean locationPermissionsGranted;
private boolean haveDumpedProviders;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLocationListeners = new ArrayList<>();
mgr = (LocationManager) getSystemService(LOCATION_SERVICE);
output = (TextView) findViewById(R.id.output);
scrollView = (ScrollView) findViewById(R.id.scroll_view_1);
toggleButton = (ToggleButton) findViewById(R.id.toggleButton);
Criteria criteria = new Criteria();
String best = mgr.getBestProvider(criteria, true);
log("\nBest provider is: " + best);
// keep screen on
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
public void toggleLocationProvider(View v) {
if (toggleButton.isChecked()) {
setListener(LocationManager.GPS_PROVIDER);
showCurrentLocation(LocationManager.GPS_PROVIDER);
} else {
setListener(LocationManager.NETWORK_PROVIDER);
showCurrentLocation(LocationManager.NETWORK_PROVIDER);
}
}
public void setNearNotice(View v) {
double gdcLat = Double.parseDouble(getString(R.string.gdc_lat));
double gdcLong = Double.parseDouble(getString(R.string.gdc_long));
Intent showLeavingGDCIntent = new Intent(this, LeavingGDC.class);
int requestCode = 2008;
PendingIntent showLeavingGDCPendingIntent
= PendingIntent.getActivity(this,
requestCode, showLeavingGDCIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
mgr.addProximityAlert(gdcLat, gdcLong,
100, -1, showLeavingGDCPendingIntent);
}
}
// address Button clicked, show address
public void showAddress(View v) {
if (lastKnownLocation != null) {
tryCount = 0;
getAddress();
} else {
output.append("\n\nNo location available. Please try again later.\n\n");
}
}
private void getAddress() {
AsyncTask<Geocoder, Void, List<Address>>
addressFetcher = new AddFetch();
Geocoder gc = new Geocoder(this, Locale.US);
addressFetcher.execute(gc);
}
public void tryAgain() {
tryCount++;
if (tryCount < 5) {
getAddress();
} else {
output.append("Unable to access addresses. Try again later.\n\n");
}
}
// show current location on map
public void showMap(View view) {
if (lastKnownLocation != null) {
// Create a Uri from an intent string.
// // Use last known location.
double lat = lastKnownLocation.getLatitude();
double lng = lastKnownLocation.getLongitude();
String locationURI = "geo:" + lat + "," + lng;
//locationURI += "?z=5";
Uri uriForMappingIntent = Uri.parse(locationURI);
// locationURI = "geo:0,0?q="
// + lat + "," + lng
// + "(Current Location)";
// Create an Intent from gmmIntentUri.
// Set the action to ACTION_VIEW
Intent mapIntent = new Intent(Intent.ACTION_VIEW,
uriForMappingIntent);
// Make the Intent explicit by setting the Google Maps package.
// If want to use user's preferred map app, don't do this!
// mapIntent.setPackage("com.google.android.apps.maps");
// Attempt to start an activity that can handle the Intent
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
}
}
}
private class AddFetch extends AsyncTask<Geocoder, Void, List<Address>> {
List<Address> addresses;
@Override
protected List<Address> doInBackground(Geocoder... arg0) {
Geocoder gc = arg0[0];
Log.d(TAG, "Geocode is present: " + Geocoder.isPresent());
addresses = null;
// // "forwasrd geocoding": get lat and long from name or address
// try {
// addresses = gc.getFromLocationName(
// "713 North Duchesne, St. Charles, MO", 5);
// } catch (IOException e) {}
// if(addresses != null && addresses.size() > 0) {
// double lat = addresses.get(0).getLatitude();
// double lng = addresses.get(0). getLongitude ();
// String zip = addresses.get(0).getPostalCode();
// Log.d(TAG, "FORWARD GEO CODING: lat: " + lat + ", long: " + lng + ", zip: " + zip);
// }
// Log.d(TAG, "forward geocoding address list: " + addresses);
// also try reverse geocoding, location from lat and long
tryReverseGeocoding(gc);
return addresses;
}
private void tryReverseGeocoding(Geocoder gc) {
double lat = lastKnownLocation.getLatitude();
double lng = lastKnownLocation.getLongitude();
Log.d(TAG, "REVERSE GEO CODE TEST lat: " + lat);
Log.d(TAG, "REVERSE GEO CODE TEST long: " + lng);
addresses = null;
try {
addresses = gc.getFromLocation(lat, lng, 10); // maxResults
} catch (IOException e) {
}
}
protected void onPostExecute(List<Address> result) {
if (result == null) {
tryAgain();
Log.d(TAG, "\n\nNo addresses from Geocoder. Trying again. " +
"Try count: " + tryCount);
} else {
output.append("\n\nNumber of addresses " +
"at current location :" + addresses.size());
output.append("\n\nBEST ADDRESS FOR CURRENT LOCATION:");
output.append(addresses.get(0).toString());
Log.d(TAG, "reverse geocoding, " +
"addresses from lat and long: "
+ addresses.size());
for (Address address : addresses) {
Log.d(TAG, address.toString());
}
}
}
}
private void showCurrentLocation(String locationProvider) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
Location location
= mgr.getLastKnownLocation(locationProvider);
dumpLocation(location);
}
}
private void setListener(String locationProvider) {
clearListOfListeners();
SimpleLocationListener sll = new SimpleLocationListener();
mLocationListeners.add(sll);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
mgr.requestLocationUpdates(locationProvider, 1000, 10, sll);
}
}
private void clearListOfListeners() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
for (SimpleLocationListener sll : mLocationListeners)
mgr.removeUpdates(sll);
}
}
@Override
protected void onStart() {
super.onStart();
checkPermissions();
if (!locationPermissionsGranted) {
requestLocationPermissions();
}
}
@Override
protected void onResume() {
super.onResume();
// GPS OR NETWORK????
// mgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 15000, 1, locationListener);
// provider, update in milliseconds, update in location change, listener
// mgr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 200, 10, locationListener);
//TO SEE NETWORK INFO AND STATUS
// SimpleLocationListener sll = new SimpleLocationListener();
// mLocationListeners.add(sll);
// mgr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 5000, 5, sll);
//
// TO SEE GPS INFO AND STATUS
// SimpleLocationListener sll = new SimpleLocationListener();
// mLocationListeners.add(sll);
// mgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 10, sll);
//// mgr.addGpsStatusListener(gpsStatusListener);
if (locationPermissionsGranted && !haveDumpedProviders) {
haveDumpedProviders = true;
log("Location providers:");
dumpProviders();
}
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
log("\nLocations (starting with last known):");
lastKnownLocation
= mgr.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (lastKnownLocation != null) {
dumpLocation(lastKnownLocation);
}
if (toggleButton.isChecked()) {
setListener(LocationManager.GPS_PROVIDER);
} else {
setListener(LocationManager.NETWORK_PROVIDER);
}
}
}
private void requestLocationPermissions() {
log("Requesting Permission for Location");
Log.d(TAG, "Requesting Permission for Location");
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.READ_CONTACTS)) {
// Show an explanation to the user (likely with a
// dialog) *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(this,
new String[]{
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION},
MY_PERMISSIONS_REQUEST_GET_LOCATION);
// MY_PERMISSIONS_REQUEST_GET_LOCATION is an
// app-defined int constant. The callback method gets the
// result of the request.
}
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[],
int[] grantResults) {
log("onRequestPermissionsResult");
Log.d(TAG, "onRequestPermissionsResult");
Log.d(TAG, "permissions: " + Arrays.toString(permissions));
Log.d(TAG, "results: " + Arrays.toString(grantResults));
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_GET_LOCATION: {
// If request is cancelled, the result arrays are empty.
locationPermissionsGranted =
(grantResults.length > 0)
&& (grantResults[0]
== PackageManager.PERMISSION_GRANTED);
}
}
}
private void checkPermissions() {
int permissionCoarse
= ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION);
int permissionFine
= ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION);
if (permissionCoarse == PackageManager.PERMISSION_GRANTED) {
log(getString(R.string.have_coarse_permission));
} else {
log(getString(R.string.lack_coarse_location));
}
if (permissionFine == PackageManager.PERMISSION_GRANTED) {
log(getString(R.string.have_fine_permission));
} else {
log(getString(R.string.lack_fine_location));
}
locationPermissionsGranted =
permissionCoarse == PackageManager.PERMISSION_GRANTED
&& permissionFine == PackageManager.PERMISSION_GRANTED;
}
@Override
protected void onPause() {
super.onPause();
// Stop updates to save power while app paused
clearListOfListeners();
mgr.removeGpsStatusListener(gpsStatusListener);
}
private class SimpleLocationListener implements LocationListener {
public void onLocationChanged(Location location) {
log("\n" + "onLocationChanged CALLED: ");
if (location != null) {
lastKnownLocation = location;
}
dumpLocation(location);
Log.d("LocationTest", "Updated Location.");
}
public void onProviderDisabled(String provider) {
log("\nProvider disabled: " + provider);
}
public void onProviderEnabled(String provider) {
log("\nProvider enabled: " + provider);
}
public void onStatusChanged(String provider, int status,
Bundle extras) {
log("\nProvider status changed: " + provider + ", status="
+ STATUS[status] + ", extras=" + extras);
}
}
/**
* Write a string to the output window
*/
private void log(String string) {
output.append(string + "\n");
int height = scrollView.getChildAt(0).getHeight();
Log.d(TAG, "scroll view height: " + height);
scrollView.scrollTo(0, height + 2000);
}
/**
* Write information from all location providers
*/
private void dumpProviders() {
List<String> providers = mgr.getAllProviders();
for (String provider : providers) {
dumpProvider(provider);
}
}
/**
* Write information from a single location provider
*/
private void dumpProvider(String provider) {
LocationProvider info = mgr.getProvider(provider);
StringBuilder builder = new StringBuilder();
builder.append("LocationProvider:")
.append(" name=")
.append(info.getName())
.append("\nenabled=")
.append(mgr.isProviderEnabled(provider))
.append("\ngetAccuracy=")
.append(ACCURACY[info.getAccuracy() + 1])
.append("\ngetPowerRequirement=")
.append(POWER[info.getPowerRequirement() + 1])
.append("\nhasMonetaryCost=")
.append(info.hasMonetaryCost())
.append("\nrequiresCell=")
.append(info.requiresCell())
.append("\nrequiresNetwork=")
.append(info.requiresNetwork())
.append("\nrequiresSatellite=")
.append(info.requiresSatellite())
.append("\nsupportsAltitude=")
.append(info.supportsAltitude())
.append("\nsupportsBearing=")
.append(info.supportsBearing())
.append("\nsupportsSpeed=")
.append(info.supportsSpeed())
.append("\n\n\n");
log(builder.toString());
}
/**
* Describe the given location, which might be null
*/
private void dumpLocation(Location location) {
if (location == null)
log(" ");
else {
log("\n" + location.toString());
}
}
GpsStatus.Listener gpsStatusListener = new GpsStatus.Listener() {
public void onGpsStatusChanged(int event) {
Log.d("Location Test", "gps status changed");
log("\n-- GPS STATUS HAS CHANGED -- " + "\n" + GPS_EVENTS[event - 1]);
int permissionResult
= ActivityCompat.checkSelfPermission(LocationTest.this,
Manifest.permission.ACCESS_FINE_LOCATION);
if (permissionResult == PackageManager.PERMISSION_GRANTED) {
gps = mgr.getGpsStatus(null);
}
showSats();
}
};
private void showSats() {
int satNum = 0;
StringBuilder builder = new StringBuilder();
for (GpsSatellite sat : gps.getSatellites()) {
builder.append("Satellite Data: ");
builder.append("\nnumber: ");
builder.append(satNum);
builder.append("\nAzimuth: ");
builder.append(sat.getAzimuth());
builder.append("\nElevation: ");
builder.append(sat.getElevation());
builder.append("\nSNR: ");
builder.append(sat.getSnr());
builder.append("\nUsed in fix?: ");
builder.append(sat.usedInFix());
log("\n\n" + builder.toString());
builder.delete(0, builder.length());
satNum++;
}
}
}
| [
"scottm@cs.utexas.edu"
] | scottm@cs.utexas.edu |
f3115b37182cee8d3958f21e87b0b9c72c3b5f22 | 59a29274261929891b608ef62ce3434bfebc55ef | /BaoLi_HuoYe/src/com/ufo/framework/system/repertory/ModuleRepertory.java | 286094fd1938e388366138e55f2201fedf1adba5 | [] | no_license | liveqmock/wuye | 2abf4f3ae1dab1b1f1c2cecaee493ed894701ea9 | d48af311ce17042e20b26d4c23d3c8c3c058a9ff | refs/heads/master | 2020-12-03T06:40:53.219409 | 2015-02-07T03:34:40 | 2015-02-07T03:34:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,543 | java | package com.ufo.framework.system.repertory;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import ognl.Ognl;
import ognl.OgnlException;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.aspect.ModuleAspect;
import com.model.hibernate.addition._Addition;
import com.model.hibernate.system._Module;
import com.ufo.framework.common.core.exception.TimeoutException;
import com.ufo.framework.common.core.json.JsonDateProcessor;
import com.ufo.framework.common.core.web.ModuleServiceFunction;
import com.ufo.framework.common.core.web.TypeChange;
import com.ufo.framework.system.ebo.ApplicationService;
import com.ufo.framework.system.irepertory.IModelRepertory;
import com.ufo.framework.system.shared.module.DataFetchRequestInfo;
import com.ufo.framework.system.shared.module.DataFetchResponseInfo;
import com.ufo.framework.system.shared.module.DataUpdateResponseInfo;
import com.ufo.framework.system.shared.module.ModuleFormOperateType;
import com.ufo.framework.system.shared.module.grid.GridFilterData;
@Repository
public class ModuleRepertory extends HibernateRepertory implements IModelRepertory {
public static final int STATUS_FAILURE = -1;
public static final int STATUS_SUCCESS = 0;
public static final int STATUS_VALIDATION_ERROR = -4;
public static final String UPDATEJSONOBJECT = "updateJsonObject";
public static final String INSERTJSONOBJECT = "insertJsonObject";
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getModuleDataWithName(java.lang.String, java.lang.String)
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public Object getModuleDataWithName(String moduleName, String name) throws Exception {
_Module module = ApplicationService.getModuleWithName(moduleName);
if (module == null)
return null;
List<?> records = findByProperty(moduleName, module.getTf_nameFields(), name);
if (records.size() >= 1)
return records.get(0);
else
return null;
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getBeanIdWithIdOrName(com.model.hibernate.system.Module, java.lang.Object)
*/
@Override
public Object getBeanIdWithIdOrName(_Module module, Object idOrName) {
Object bean = getBeanWithIdOrName(module, idOrName);
if (bean == null)
return null;
else
try {
return Ognl.getValue(module.getTf_primaryKey(), bean);
} catch (OgnlException e) {
e.printStackTrace();
return null;
}
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getBeanWithIdOrName(com.model.hibernate.system.Module, java.lang.Object)
*/
@Override
public Object getBeanWithIdOrName(_Module module, Object idOrName) {
Class<?> BeanClass = ModuleServiceFunction.getModuleBeanClass(module.getTf_moduleName());
Object bean = null;
try {
bean = findById(BeanClass, idOrName);
} catch (Exception e) {
}
if (bean == null) {
try {
List<?> beans = findByProperty(BeanClass, module.getTf_nameFields(), idOrName);
if (beans.size() == 1)
bean = beans.get(0);
else if ((beans.size() > 1))
return null;
} catch (Exception e) {
}
}
if (bean == null) {
try {
@SuppressWarnings("unchecked")
List<Object> beans =findByLikeProperty(BeanClass.getSimpleName(),
module.getTf_nameFields(), "%" + idOrName + "%");
if (beans.size() == 1)
bean = beans.get(0);
} catch (Exception e) {
}
}
return bean;
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#updateValueToBean(java.lang.String, java.lang.Object, net.sf.json.JSONObject)
*/
@Override
@SuppressWarnings("unchecked")
public void updateValueToBean(String moduleName, Object record, JSONObject keyValue)
throws OgnlException {
//_Module module = ApplicationService.getModuleWithName(moduleName);
Iterator<String> keyIterator = keyValue.keys();
while (keyIterator.hasNext()) {
String key = keyIterator.next();
Object value = keyValue.get(key);
// 是不是manytoone 的值进行了修改
debug("更新字段:" + key + ",value:" + value);
ModuleServiceFunction.setValueToRecord(key, record, value);
}
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getModuleData(java.lang.String, com.ufo.framework.system.shared.module.DataFetchRequestInfo, com.ufo.framework.system.shared.module.grid.GridFilterData, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public DataFetchResponseInfo getModuleData(String moduleName, DataFetchRequestInfo dsRequest,
GridFilterData gridFilterData,HttpServletRequest req) throws Exception {
_Module module = ApplicationService.getModuleWithName(moduleName);
// 所有的导航tree产生的过滤条件
//List<SqlModuleFilter> treeAndParentFilters = new ArrayList<SqlModuleFilter>();
List<SqlModuleFilter> treeAndParentFilters=dsRequest.getModuleFilters();
addParentModuleFiltToSQLFilters(module, gridFilterData.getParentModuleFilter(),
treeAndParentFilters);
SqlGenerator generator = new SqlGenerator(module);
generator.setModuleFilters(treeAndParentFilters);
generator.setGridColumnNames(gridFilterData.getGridColumnNames());
generator.setSearchText(gridFilterData.getSearchText());
generator.setSorts(dsRequest.getSorts());
generator.setGroupFieldname(gridFilterData.getGroupFieldName());
Class<ModuleAspect> classAspect=ModuleServiceFunction.getModuleAspectClass(moduleName);
if(classAspect!=null){
ModuleAspect aspect;
try {
aspect = classAspect.newInstance();
aspect.loadBefore(dsRequest, req, generator);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
Integer totalRow = getRecordCount(generator);
debug("统计计录个数:" + totalRow);
Integer startRow = dsRequest.getStartRow();
Integer endRow = dsRequest.getEndRow();
endRow = Math.min(endRow, totalRow - 1);
JSONArray jsonArray = getData(generator, startRow, endRow);
DataFetchResponseInfo response = new DataFetchResponseInfo();
response.setStartRow(startRow);
response.setEndRow(endRow);
response.setTotalRows(totalRow);
// if (dsRequest.getIsExport())
response.setMatchingObjects(jsonArray);
// else
// response.setJsonMatchingItems(jsonArray.toString());
return response;
}
/**
* // 如果有父模块约束,加入父模块约束
*
* @param moduleName
* @param module
* @param parentModuleFilter
* @param treeAndParentFilters
*/
private void addParentModuleFiltToSQLFilters(_Module module, SqlModuleFilter parentModuleFilter,
List<SqlModuleFilter> treeAndParentFilters) {
// 如果有父模块约束,加入父模块约束
if (parentModuleFilter != null) {
// 如果是附件的父模块约束,则要加入另外二个条件
if (module.getTf_moduleName().equals(_Addition._ADDITION)) {
SqlModuleFilter additionModuleIdFilter = new SqlModuleFilter();
additionModuleIdFilter.setModuleName(module.getTf_moduleName());
additionModuleIdFilter.setTableAsName(module.getTableAsName());
additionModuleIdFilter.setPrimarykey(_Addition.MODULEID);
additionModuleIdFilter.setEqualsValue(parentModuleFilter.getModuleId());
treeAndParentFilters.add(additionModuleIdFilter);
SqlModuleFilter additionModuleKeyIdFilter = new SqlModuleFilter();
additionModuleKeyIdFilter.setModuleName(module.getTf_moduleName());
additionModuleKeyIdFilter.setTableAsName(module.getTableAsName());
additionModuleKeyIdFilter.setPrimarykey(_Addition.MODULEKEYID);
additionModuleKeyIdFilter.setEqualsValue(parentModuleFilter.getEqualsValue());
treeAndParentFilters.add(additionModuleKeyIdFilter);
} else {
treeAndParentFilters.add(parentModuleFilter);
}
}
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getModuleRecord(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public JSONObject getModuleRecord(String moduleName, String keyValue, HttpServletRequest request) throws Exception {
_Module module = ApplicationService.getModuleWithName(moduleName);
SqlGenerator generator = new SqlGenerator(module);
generator.setKeyValue(keyValue);
JSONArray jsonArray = getData(generator, -1, 0);
if (jsonArray.size() > 0)
return jsonArray.getJSONObject(0);
else
return null;
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getRecordCount(com.ufo.framework.system.repertory.SqlGenerator)
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public Integer getRecordCount(SqlGenerator generator) {
String sql = generator.isGene()?generator.getGeneCountSql():generator.getCountSqlStatement();
Session session = getSf().getCurrentSession();
SQLQuery query = session.createSQLQuery(sql);
Integer countInteger = 0;
try {
countInteger = TypeChange.toInt(query.uniqueResult());
} catch (Exception e) {
e.printStackTrace();
}
return countInteger;
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getData(com.ufo.framework.system.repertory.SqlGenerator, java.lang.Integer, java.lang.Integer)
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public JSONArray getData(SqlGenerator generator, Integer startRow, Integer endRow) {
Session session = getSf().getCurrentSession();
String sql =generator.isGene()? generator.getGeneSql():generator.getSqlStatment();
SQLQuery query = session.createSQLQuery(sql);
if (startRow != -1) {
query.setFirstResult(startRow);
query.setMaxResults(endRow - startRow + 1);
}
//generator.addScalar(query);
List<?> results = null;
try {
results = query.list();
} catch (Exception e) {
e.printStackTrace();
}
JSONArray resultArray = new JSONArray();
if (results != null)
for (Object row : results) {
Object[] rowObjects = (Object[]) row;
Map<String, Object> objMap = new LinkedHashMap<String, Object>();
JSONObject object = new JSONObject();
int i = 0;
for (SqlField field : generator.getFieldList())
objMap.put(field.getFieldasScalar(), rowObjects[i++]);
for (SqlField field : generator.getJoinField())
objMap.put(field.getFieldasScalar(), rowObjects[i++]);
object.putAll(objMap, JsonDateProcessor.us_jsonConfig);
resultArray.add(object);
}
return resultArray;
}
/* (non-Javadoc)
* @see com.ufo.framework.system.repertory.ModelDao#getRecordNameValue(com.model.hibernate.system.Module, java.lang.Object)
*/
@Override
public String getRecordNameValue(_Module module, Object record) {
String result = "";
try {
result = (module.getTf_nameFields() != null && module.getTf_nameFields().length() > 0) ? Ognl
.getValue(module.getTf_nameFields(), record).toString() : "未定义";
} catch (Exception e) {
}
return result;
}
@Override
public DataUpdateResponseInfo changeRecordId(String moduleName, String id,
String oldid) throws Exception {
DataUpdateResponseInfo result = new DataUpdateResponseInfo();
_Module module = ApplicationService.getModuleWithName(moduleName);
Session session = getSf().getCurrentSession();
// try {
Query query = session.createSQLQuery("update " + moduleName + " set "
+ module.getTf_primaryKey() + " = :newvalue where " + module.getTf_primaryKey()
+ "=:oldvalue");
query.setParameter("oldvalue", oldid);
query.setParameter("newvalue", id);
query.executeUpdate();
return result;
}
@Override
public DataUpdateResponseInfo update(String moduleName, String id,
String operType, String updated, HttpServletRequest request) throws Exception {
debug("数据update:" + moduleName + "," + id + "," + updated);
JSONObject updateJsonObject = JSONObject.fromObject(updated);
request.setAttribute(UPDATEJSONOBJECT, updateJsonObject);
DataUpdateResponseInfo result = new DataUpdateResponseInfo();
Class<?> beanClass = ModuleServiceFunction.getModuleBeanClass(moduleName);
_Module module = ApplicationService.getModuleWithName(moduleName);
if (operType == null)
operType = ModuleFormOperateType.EDIT.getValue();
try {
// 保存数据之前老的值
Object oldRecord =findById(beanClass, id);
// 使oldRecord 处于游离状态
getSf().getCurrentSession().evict(oldRecord);
Object record = findById(beanClass, id);
updateValueToBean(moduleName, record, updateJsonObject);
saveOrUpdate(record, null);
record = findById(beanClass, id);
result.setResultCode(STATUS_SUCCESS);
} catch (DataAccessException e) {
e.printStackTrace();
ModuleServiceFunction.addExceptionCauseToErrorMessage(e, result.getErrorMessage(),
module.getTf_primaryKey());
result.setResultCode(STATUS_VALIDATION_ERROR);
} catch (Exception e) {
e.printStackTrace();
result.getErrorMessage().put("error", e.getMessage());
result.setResultCode(STATUS_FAILURE);
}
debug("update返回值:" + result.toString());
return result;
}
}
| [
"houlynn@gzinterest.com"
] | houlynn@gzinterest.com |
e92e74612531b48c77f7242ce1b60af230fe6ea2 | 3413ba43672655874301050c0feca0fb45d723b4 | /src/org/apache/catalina/connector/CoyoteInputStream.java | 0fb235176676cc359960ce52408c993b2541f232 | [] | no_license | takedatmh/CBIDAU_tsukuba | 44e13d35107e05f922d227bbd9401c3cea5bcb39 | b9ef8377fcd3fa10f29383c59676c81a4dc95966 | refs/heads/master | 2020-07-30T06:51:13.900841 | 2020-06-29T16:37:04 | 2020-06-29T16:37:04 | 210,117,863 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,613 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.connector;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import javax.servlet.ServletInputStream;
import org.apache.catalina.security.SecurityUtil;
/**
* This class handles reading bytes.
*
* @author Remy Maucherat
* @author Jean-Francois Arcand
*/
public class CoyoteInputStream
extends ServletInputStream {
// ----------------------------------------------------- Instance Variables
protected InputBuffer ib;
// ----------------------------------------------------------- Constructors
protected CoyoteInputStream(InputBuffer ib) {
this.ib = ib;
}
// -------------------------------------------------------- Package Methods
/**
* Clear facade.
*/
void clear() {
ib = null;
}
// --------------------------------------------------------- Public Methods
/**
* Prevent cloning the facade.
*/
@Override
protected Object clone()
throws CloneNotSupportedException {
throw new CloneNotSupportedException();
}
// --------------------------------------------- ServletInputStream Methods
@Override
public int read()
throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
Integer result =
AccessController.doPrivileged(
new PrivilegedExceptionAction<Integer>(){
@Override
public Integer run() throws IOException{
Integer integer = Integer.valueOf(ib.readByte());
return integer;
}
});
return result.intValue();
} catch(PrivilegedActionException pae){
Exception e = pae.getException();
if (e instanceof IOException){
throw (IOException)e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
}
} else {
return ib.readByte();
}
}
@Override
public int available() throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
Integer result =
AccessController.doPrivileged(
new PrivilegedExceptionAction<Integer>(){
@Override
public Integer run() throws IOException{
Integer integer = Integer.valueOf(ib.available());
return integer;
}
});
return result.intValue();
} catch(PrivilegedActionException pae){
Exception e = pae.getException();
if (e instanceof IOException){
throw (IOException)e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
}
} else {
return ib.available();
}
}
@Override
public int read(final byte[] b) throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
Integer result =
AccessController.doPrivileged(
new PrivilegedExceptionAction<Integer>(){
@Override
public Integer run() throws IOException{
Integer integer =
Integer.valueOf(ib.read(b, 0, b.length));
return integer;
}
});
return result.intValue();
} catch(PrivilegedActionException pae){
Exception e = pae.getException();
if (e instanceof IOException){
throw (IOException)e;
} else {
throw new RuntimeException(e.getMessage() ,e);
}
}
} else {
return ib.read(b, 0, b.length);
}
}
@Override
public int read(final byte[] b, final int off, final int len)
throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
Integer result =
AccessController.doPrivileged(
new PrivilegedExceptionAction<Integer>(){
@Override
public Integer run() throws IOException{
Integer integer =
Integer.valueOf(ib.read(b, off, len));
return integer;
}
});
return result.intValue();
} catch(PrivilegedActionException pae){
Exception e = pae.getException();
if (e instanceof IOException){
throw (IOException)e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
}
} else {
return ib.read(b, off, len);
}
}
@Override
public int readLine(byte[] b, int off, int len) throws IOException {
return super.readLine(b, off, len);
}
/**
* Close the stream
* Since we re-cycle, we can't allow the call to super.close()
* which would permanently disable us.
*/
@Override
public void close() throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
AccessController.doPrivileged(
new PrivilegedExceptionAction<Void>(){
@Override
public Void run() throws IOException{
ib.close();
return null;
}
});
} catch(PrivilegedActionException pae){
Exception e = pae.getException();
if (e instanceof IOException){
throw (IOException)e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
}
} else {
ib.close();
}
}
}
| [
"takedatmh@gmail.com"
] | takedatmh@gmail.com |
19181a42db39fba94657fc2d9f6e885d4ecbe207 | 7eafe35122c42f345af6c23f28008c4a8f70603c | /src/test/java/eu/kalodiodev/springjumpstart/domain/PasswordResetTokenTest.java | 8f82ac165494c818bdb6970307e6f2bad9e26c9d | [
"MIT"
] | permissive | kalodiodev/spring-boot-jump-start | 0499e5e7bd0fe20912d85a8c49fcec562423c4f4 | 8d0d9ab2b4a91ff75121474bd6d754adcb842d7b | refs/heads/master | 2021-01-01T17:20:17.545872 | 2017-08-02T18:09:03 | 2017-08-02T18:09:03 | 98,053,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,417 | java | package eu.kalodiodev.springjumpstart.domain;
import static org.assertj.core.api.Assertions.assertThat;
import java.time.ZonedDateTime;
import org.junit.Test;
/**
* Unit test for {@link PasswordResetToken}
*
* @author Athanasios Raptodimos
*/
public class PasswordResetTokenTest {
private String token = "token uuid";
private User user = new User();
private ZonedDateTime creationDate = ZonedDateTime.now();
private int expiryLength = 120;
@Test
public void shouldInstantiatePasswordResetToken() {
PasswordResetToken passwordResetToken = new PasswordResetToken(token, user, creationDate, expiryLength);
assertThat(passwordResetToken.getToken()).isEqualTo(token);
assertThat(passwordResetToken.getUser()).isEqualTo(user);
assertThat(passwordResetToken.getExpiryDate()).isEqualTo(creationDate.plusMinutes(expiryLength));
}
@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionWhenUserNull() {
new PasswordResetToken(token, null, creationDate, expiryLength);
}
@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionWhenTokenNull() {
new PasswordResetToken(null, user, creationDate, expiryLength);
}
@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionWhenCreationDateNull() {
new PasswordResetToken(token, user, null, expiryLength);
}
}
| [
"thanosra@gmail.com"
] | thanosra@gmail.com |
97096b7b647495aec28cad4db9d87550c96071f6 | c5952b6ad163b603763ee773e25f9cc8d91b4003 | /qyuilib/src/main/java/com/ccys/qyuilib/network/LoggingInterceptor.java | 1967827ed1805b38def99a808f11fad6c4cfef8b | [] | no_license | qinyangQY/QyUi | ab61ef57afa9fb350af2d0813ddffce901b215c1 | 46054e042c58440bae4c860b79c9f78bd4a462f2 | refs/heads/master | 2022-04-15T15:38:21.906116 | 2020-04-13T07:43:29 | 2020-04-13T07:43:29 | 255,211,566 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.ccys.qyuilib.network;
import com.ccys.qyuilib.util.LogUtil;
import okhttp3.logging.HttpLoggingInterceptor;
public class LoggingInterceptor implements HttpLoggingInterceptor.Logger{
public LoggingInterceptor(){
}
@Override
public void log(String message) {
LogUtil.v("NET_WORK",message);
}
}
| [
"563281908@qq.com"
] | 563281908@qq.com |
a110846cf842b92583198005594a4c45214bd77b | 9e1ad925f368f89a3849de6cedcfa4eb67658494 | /src/main/java/trees/TreeTwoSumOne.java | fc95d7a8024d4167e0f2ca52bcefe0bfa7917ff6 | [] | no_license | sherif98/ProblemSolving | d776c7aff35f3369a5316d567d092daee290c125 | e120733197d6db08cd82448412ce8fa8626a4763 | refs/heads/master | 2021-09-16T22:40:36.257030 | 2018-06-25T16:52:46 | 2018-06-25T16:52:46 | 125,643,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package trees;
import java.util.HashSet;
import java.util.Set;
public class TreeTwoSumOne {
public int t2Sum(TreeNode A, int B) {
return solve(A, B, new HashSet<>()) ? 1 : 0;
}
private boolean solve(TreeNode root, int target, Set<Integer> set) {
if (root == null) {
return false;
}
if (set.contains(target - root.val)) {
return true;
}
set.add(root.val);
return solve(root.left, target, set) || solve(root.right, target, set);
}
class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
left = null;
right = null;
}
}
}
| [
"sherif.hamdy.1995@gmail.com"
] | sherif.hamdy.1995@gmail.com |
37541b1c061d2afd59101922f2df335201fb6b60 | 0b7e2d45437c32d5c3268bb4d764ad40eb8c33c1 | /src/com/library/DAO/impl/IBookItemDAOImpl.java | da05b2a68cc63e8a6aef89c5673719c3b324f216 | [] | no_license | ExistOrLive/LibraryServer | 00456f0e7033688d155fb3328fde92e416fffebe | 8b89aca6653338474647f5b9c4f00b613eef5095 | refs/heads/master | 2020-03-09T13:03:01.639215 | 2018-04-22T15:23:29 | 2018-04-22T15:23:29 | 128,800,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.library.DAO.impl;
import java.util.List;
import com.library.DAO.IBookItemDAO;
import com.library.entity.BookItem;
public class IBookItemDAOImpl extends IDAOImpl<BookItem> implements IBookItemDAO {
@Override
public List<BookItem> getByBookId(int bookId) {
String hql="from BookItem i where i.bookId.id=?0";
return query(hql,bookId);
}
}
| [
"2068531506@qq.com"
] | 2068531506@qq.com |
3f824a3b686017b281fafc6ce3b04098297413da | 06d1d1b3e6a121793435a72b101d963df45deb20 | /hbaseapi20/src/main/java/com/zhiyou/bd20/weibo/WeiBoUtils.java | 11d438c1844c4dc6836603674a3f065bf2e2dcf5 | [] | no_license | realguoshuai/Hbase_api | 28762991fc9503ce6fc945c78340bf296097a1a4 | 5a6d92afba72652f5f0f78129b5cbb86dd54b393 | refs/heads/master | 2021-04-06T00:27:09.828745 | 2018-03-19T06:56:15 | 2018-03-19T06:56:15 | 125,144,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,625 | java | package com.zhiyou.bd20.weibo;
import java.nio.ByteBuffer;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.util.Bytes;
import com.zhiyou.bd20.hbasetest.HBaseUtil;
public class WeiBoUtils {
public static final byte BLANK_STR=0x1f;
public static final byte ZERO=0x00;
public static final byte ONE=0x01;
public static byte[] getUserRowKey(String accountNo,String phoneNo) throws Exception {
//1.获取唯一标识pk
//调用getSequenceByTableName,传'w_user'为参数,获取w_user的递增序列
long sequence =getSequenceByTableName("w_user");
//获取到的值,转成字符串,逆向
String pk = StringUtils.reverse(String.valueOf(sequence));
//然后根据长度在后面补'0'
int coverNum =12-pk.length();
//唯一标识pk
pk=coverLeft(pk, '0', coverNum);
//2.对accountNo限定或补长 补0x1f,在左边补
byte[] account =coverLeft(accountNo, 17);
//3.对phoneNo限定长度或补长 补0x1f
byte[] phone =coverLeft(phoneNo, 11);
//4.组装上面三个获得rowkey
ByteBuffer buffer = ByteBuffer.allocate(40);
buffer.put(Bytes.toBytes(pk));
buffer.put(account);
buffer.put(phone);
return buffer.array();
}
//从sequence表中获取递增序列
public static long getSequenceByTableName(String tableName) throws Exception {
//对 bd20:sequence表调用incr指令,rowkey是tName,获取到的sequence ,转成long返回
Table sequence =HBaseUtil.getTable("bd20:sequence");
long result = sequence.incrementColumnValue(Bytes.toBytes("tableName")
,Bytes.toBytes("i"),Bytes.toBytes("s"),2);
return result;
}
//把给定的字符串补另一个字符串,补N次
public static String coverLeft(String source,char cover,int times){
while (times>0) {
source+=cover;
times -=1;
}
return source;
}
//把给定的字符串转化成字节数组后,空白的在左边补0xlf(空)
public static byte[] coverLeft(String source,int length){
ByteBuffer buffer =ByteBuffer.allocate(length);
buffer.put(Bytes.toBytes(source));
while (buffer.hasRemaining()) {
buffer.put(BLANK_STR);
}
return buffer.array();
}
//给ByteBuffer后面补N个字节
public static void coverLeft(ByteBuffer source,int length,byte cover){
while (length>0) {
source.put(cover);
length-=1;
}
}
public static void main(String[] args) throws Exception {
/*long result = getSequenceByTableName("w_user");
System.out.println(result);*/
byte[] rowkey =getUserRowKey("aaahgjgh","12345678910");
System.out.println(rowkey.length);
System.out.println(Bytes.toString(rowkey));
}
}
| [
"yooless@163.com"
] | yooless@163.com |
010d47934cfe5d3a6d55bf19e5db6da818f31caf | c91402ef4622a4d3eaf63c4e601e45e629fb1945 | /src.java/org/anodyneos/commons/db/CsvReport.java | be2f19dce0886f14e924cc74f906cd374d99d6ca | [
"MIT"
] | permissive | jvasileff/aos-commons | abb5874c72a1f805e8e380ba9674538d42c6f515 | 290334ab39b411f1b3cf4df01e538505b3d6a946 | refs/heads/master | 2020-04-18T15:58:46.158192 | 2011-01-14T02:39:57 | 2011-01-14T02:39:57 | 1,376,819 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 12,336 | java | package org.anodyneos.commons.db;
import java.sql.*;
import java.util.Properties;
import java.io.*;
import org.anodyneos.commons.text.CsvWriter;
public class CsvReport {
public static final String JDBC_USER = "jdbcUser";
public static final String JDBC_PASSWORD = "jdbcPassword";
public static final String JDBC_URL = "jdbcURL";
public static final String JDBC_DRIVER = "jdbcDriver";
public static final String JDBC_PROPERTIES = "jdbcProperties";
public static final String IN = "in";
public static final String OUT = "out";
public static final String QUIET = "quiet";
public static final String HELP = "help";
private static java.text.SimpleDateFormat isof;
static {
// FIXME: is SimpleDateFormat thread safe?
isof = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
isof.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
}
private static final String shortHelp = "Try 'CsvReport --help' for more information.";
private static final String usageHelp =
"CsvReport Executes an SQL query and Generates CSV output.\n"
+ "\n"
+ "Usage: CsvReport [OPTION]...\n"
+ "\n"
+ "JDBC Properties can be provided by command line options, a\n"
+ "properties file, or system properties, in that order of priority\n"
+ "if specified more than once.\n"
+ "\n"
+ "Options:\n"
+ " -P <file> props file to use for jdbc\n"
+ " -u, --jdbcUser <username> db user name\n"
+ " -p, --jdbcPassword <password> db password\n"
+ " -U, --jdbcUrl <url> db url\n"
+ " -d, --jdbcDriver <class> db driver class name\n"
+ " -i, --in <file> file containing SQL query; stdin\n"
+ " will be used if -i not specified\n"
+ " -o, --out <file> file for CSV output; stdout\n"
+ " will be used if -o not specified\n"
+ " -q, --quiet suppress extra output"
;
private String jdbcUser = null;
private String jdbcPassword = null;
private String jdbcURL = null;
private String jdbcDriver = null;
private String outPath = null;
private String inPath = null;
private boolean quiet = false;
public static void main(String[] argv) throws SQLException, ClassNotFoundException,
InstantiationException, IllegalAccessException, IOException {
try {
CsvReport report = new CsvReport();
if (!report.readParms(argv)) {
return;
}
report.go();
} catch (ReportException e) {
System.err.println(e.getMessage());
System.err.println(shortHelp);
}
}
private CsvReport() {
// private constructor
}
private boolean readParms(String[] argv) throws ReportException {
String jdbcProperties = null;
jdbcUser = System.getProperty(JDBC_USER);
jdbcPassword = System.getProperty(JDBC_PASSWORD);
jdbcURL = System.getProperty(JDBC_URL);
jdbcDriver = System.getProperty(JDBC_DRIVER);
String which = null;
for (int i = 0; i < argv.length; i++) {
String param = argv[i];
if (param.equals("--" + HELP)) {
System.err.println(usageHelp);
return false;
} else if (param.equals("--" + JDBC_USER) || param.equals("-u")) {
which = JDBC_USER;
} else if (param.equals("--" + JDBC_PASSWORD) || param.equals("-p")) {
which = JDBC_PASSWORD;
} else if (param.equals("--" + JDBC_URL) || param.equals("-U")) {
which = JDBC_URL;
} else if (param.equals("--" + JDBC_DRIVER) || param.equals("-d")) {
which = JDBC_DRIVER;
} else if (param.equals("-P")) {
which = JDBC_PROPERTIES;
} else if (param.equals("--" + IN) || param.equals("-i")) {
which = IN;
} else if (param.equals("--" + OUT) || param.equals("-o")) {
which = OUT;
} else if (param.equals("--" + QUIET) || param.equals("-q")) {
quiet = true;
} else if (null == which) {
throw new ReportException("invalid parameter '" + param + "'");
} else {
if (JDBC_USER == which) { jdbcUser = param;
} else if (JDBC_PASSWORD == which) { jdbcPassword = param;
} else if (JDBC_URL == which) { jdbcURL = param;
} else if (JDBC_DRIVER == which) { jdbcDriver = param;
} else if (JDBC_PROPERTIES == which) { jdbcProperties = param;
} else if (IN == which) { inPath = param;
} else if (OUT == which) { outPath = param;
} else {
throw new Error("bug in command line parameter parsing");
}
which = null;
}
}
if (null != jdbcProperties) {
try {
Properties props = new Properties();
props.load(new FileInputStream(jdbcProperties));
if (null == jdbcUser) { jdbcUser = props.getProperty(JDBC_USER); }
if (null == jdbcPassword) { jdbcPassword = props.getProperty(JDBC_PASSWORD); }
if (null == jdbcURL) { jdbcURL = props.getProperty(JDBC_URL); }
if (null == jdbcDriver) { jdbcDriver = props.getProperty(JDBC_DRIVER); }
} catch (Exception e) {
throw new ReportException("cannot load properties file '" + jdbcProperties + "'\n" + e.getMessage());
}
}
if (null == jdbcUser || null == jdbcPassword || null == jdbcURL || null == jdbcDriver) {
throw new ReportException("jdbcUser, jdbcPassword, jdbcURL, and jdbcDriver must be provided");
}
return true;
}
private void go() throws ReportException {
try {
Class.forName(jdbcDriver).newInstance();
} catch (ClassNotFoundException e) {
throw new ReportException("JDBC driver '" + jdbcDriver + "' cannot be found; check CLASSPATH");
} catch (InstantiationException e) {
throw new ReportException("JDBC driver '" + jdbcDriver + "' cannot be instantiated; check CLASSPATH");
} catch (IllegalAccessException e) {
throw new ReportException("JDBC driver '" + jdbcDriver + "' cannot be instantiated; check CLASSPATH");
}
Connection con = null;
try {
con = DriverManager.getConnection(jdbcURL, jdbcUser, jdbcPassword);
} catch (SQLException e) {
throw new ReportException("Unable to open db connection to '" + jdbcURL + "'\n" + e.getMessage());
}
try {
StringBuffer query = new StringBuffer();
if (inPath == null) {
if (!quiet) {
System.err.println("Enter your query, terminate with EOF: ");
}
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = null;
try {
while ((str = in.readLine()) != null) {
query.append(str).append('\n');
}
} catch (IOException e) {
throw new ReportException("cannot read from stdin\n" + e.getMessage());
}
if (!quiet) {
System.err.println("Thank you.");
}
} else {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(inPath));
String str = null;
while ((str = in.readLine()) != null) {
query.append(str).append('\n');
}
} catch (FileNotFoundException e) {
throw new ReportException("cannot find input file '" + inPath + "'");
} catch (IOException e) {
throw new ReportException("cannot read input file '" + inPath + "'\n" + e.getMessage());
} finally {
try { if (null != in) { in.close(); } } catch (IOException e) { /* no op */ }
}
}
runQuery(con, query.toString());
} finally {
try { con.close(); } catch (SQLException e) { /* no op */ }
}
}
private void runQuery(Connection con, String query) throws ReportException {
CsvWriter out = null;
Statement stmt = null;
ResultSet rs = null;
try {
if (outPath == null) {
out = new CsvWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
} else {
File outFile = new File(outPath);
if (outFile.exists()) {
outFile.delete();
}
out = new CsvWriter(new BufferedWriter(new FileWriter(outPath)));
}
stmt = con.createStatement();
rs = stmt.executeQuery(query);
ResultSetMetaData md = rs.getMetaData();
int column_count = md.getColumnCount();
for (int i = 1; i <= column_count; i++) {
out.writeField(md.getColumnName(i));
}
out.endRecord();
Object o = null;
while (rs.next()) {
for (int i = 1; i <= column_count; i++) {
if ((o = rs.getObject(i)) != null) {
int colType = md.getColumnType(i);
String colClass = md.getColumnClassName(i).toUpperCase();
if (o instanceof Number) {
out.writeField((Number) o);
} else if (colType == Types.DATE || colType == Types.TIMESTAMP || (colClass.indexOf("TIMESTAMP") != -1)) {
Timestamp ts = rs.getTimestamp(i);
if (null != ts) {
//out.writeField(isof.format(rs.getTimestamp(i)));
out.writeField((rs.getTimestamp(i)).toString());
} else {
out.endField();
}
} else if (colType == Types.CLOB) {
Clob c = rs.getClob(i);
Reader r = c.getCharacterStream();
char[] buff = new char[1024];
int num;
while (-1 != (num = r.read(buff))) {
out.write(buff, 0, num);
}
out.endField();
r.close();
} else {
out.writeField(o.toString());
}
} else {
out.endField();
}
}
out.endRecord();
}
} catch (SQLException e) {
throw new ReportException("An SQLException has occured\n" + e.getMessage());
} catch (IOException e) {
throw new ReportException("An IOException has occured\n" + e.getMessage());
} finally {
if (null != stmt) {
try { stmt.close(); } catch (SQLException e) { /* no op */ }
}
if (null != rs) {
try { rs.close(); } catch (SQLException e) { /* no op */ }
}
if (null != out) {
try { out.close(); } catch (IOException e) { /* no op */ }
}
}
}
private class ReportException extends Exception {
private static final long serialVersionUID = 4051049661752095284L;
ReportException(String message) {
super(message);
}
}
}
| [
"git@netcc.us"
] | git@netcc.us |
c19f54d7ae7f0b56453f226dd42ee817775b644c | ecb434ec91149210acc30a44fa331c88107a1e8b | /Threads/src/threads/ReentranceTest.java | 57b54afc8694ab374ed2328ebc72f884ae3d61ca | [] | no_license | elniko/TestProjects | 98689fabb47d55faaf2ba90d00864a8d2dc8f305 | 209e2b06c55b6bdbba2051442408275f9efe7c2d | refs/heads/master | 2020-04-04T15:25:19.805944 | 2015-04-17T09:37:11 | 2015-04-17T09:37:11 | 26,648,710 | 0 | 0 | null | 2014-12-08T14:08:34 | 2014-11-14T17:07:52 | Java | UTF-8 | Java | false | false | 1,679 | java | package threads;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ReentranceTest {
static final DateFormat FORMAT = new SimpleDateFormat("HH:mm:ss.SSS");
public static void main(String[] args) {
SynchronizedObject object = new SynchronizedObject();
object.setValue(1);
Thread t = new Thread(new ProcessingThread(object));
t.start();
try{
Thread.sleep(1000);
}catch(InterruptedException ex){
System.err.println("main::Interrupted: "+ex.getMessage());
}
log("main::Setting value");
object.setValue(2);
log("main::Value set");
}
static void log(String msg){
System.out.println(FORMAT.format(new Date())+": "+msg);
}
static class SynchronizedObject{
private int value;
public synchronized void setValue(int value){
this.value = value;
}
public synchronized void process(){
log("own:: value: "+value);
try{
log("own:: Sleeping");
Thread.sleep(2000);
log("own:: Waiting");
wait(1000);
}catch(InterruptedException ex){
System.err.println("own:: Interrupted: "+ex.getMessage());
}
log("own:: value: "+value);
}
}
static class ProcessingThread implements Runnable{
private SynchronizedObject object;
public ProcessingThread(SynchronizedObject object){
this.object = object;
}
public void run() {
object.process();
}
}
} | [
"stag@mail.com"
] | stag@mail.com |
2203bca1331047a4d605f8aa85b2141a235b5b69 | f7bc09c3a6c2855f570ab5d84c7d8b8010ef7e31 | /src/main/java/com/innowhere/relproxy/jproxy/JProxyShell.java | 4a000e6d3553475c73a0c341f86b264175ef6542 | [
"Apache-2.0"
] | permissive | ravindranathakila/relproxy | 7d05a627472d6f35cfadd6503682a1501922e097 | 5d4d3199ba3fd08ff2947f45a22de54c25ee4488 | refs/heads/master | 2021-01-22T00:45:33.115564 | 2013-12-25T12:40:06 | 2013-12-25T12:40:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | java | package com.innowhere.relproxy.jproxy;
import com.innowhere.relproxy.impl.jproxy.JProxyShellImpl;
/**
*
* @author jmarranz
*/
public class JProxyShell
{
public static void main(String[] args)
{
JProxyShellImpl.main(args);
}
}
| [
"josemaria.arranz@bqreaders.com"
] | josemaria.arranz@bqreaders.com |
8daef98cd8b90c1deea97315de43c1c58446ace0 | d97a0ac279b2aa3e6ce978be04f2c7678f7e9cae | /src/trees/Problem5.java | 626a5ffacf1a3ed6a7a7ef846269b243bfe7c972 | [] | no_license | KundaiClayton/Algo-Ds | 7b4c41427277d4067f15734b3711112983c17de6 | 08bf72f48ad8d0ea6e57a6fcf9baa0889e3a820e | refs/heads/master | 2021-09-17T06:34:47.698303 | 2018-06-28T17:31:12 | 2018-06-28T17:31:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | package trees;
// Non-Recursive post order traversal
import java.util.Stack;
public class Problem5
{
static void preordernonrec(Tree t)
{
if(t==null)
{
System.out.println("Tree is empty");
return;
}
Stack <Tree> s=new Stack<Tree>();
Tree temp=t;
while(true)
{
while(temp!=null)
{
s.push(temp);
System.out.print(temp.getData()+" ");
temp=temp.getLeft();
}
if(s.isEmpty())
break;
temp=s.pop();
temp=temp.getRight();
}
}
public static void main(String[] args)
{
Tree t=new Tree(1);
t.setLeft(new Tree(2));
t.setRight(new Tree(3));
t.getLeft().setLeft(new Tree(4));
t.getLeft().setRight(new Tree(5));
t.getRight().setLeft(new Tree(6));
t.getLeft().getRight().setLeft(new Tree(7));
preordernonrec(t);
}
}
| [
"m28p@DESKTOP-18PE4TU"
] | m28p@DESKTOP-18PE4TU |
27c07402b6e3349e62d82f7df48c1a26967ed88d | ab6756d0f71d5eebd4d540b4869d40f08ea94bb2 | /src/main/java/com/xsimo/dwiki/defaultView/Editor.java | ee58f5e10ff592a6d3e91e16ce848d41ce768eb6 | [
"MIT"
] | permissive | xsimo/DWiki | 3d76edd977438fba372457bf99a2395fdb971726 | 64c40f9f0303cedf56fd0280b1d009d39d50668e | refs/heads/master | 2021-01-21T17:41:21.169530 | 2017-05-21T19:29:20 | 2017-05-21T19:29:20 | 91,981,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package com.xsimo.dwiki.defaultView;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.Date;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import com.xsimo.dwiki.common.DWikiIPage;
/**
* The Editor extends JPanel and uses a JTextArea which is in fact editable.
* Minor modifications have been done including Panel Dimension.
* @author DIRO
* @author Simon Arame
*/
public class Editor extends JPanel {
private static final long serialVersionUID = 1L;
private JTextArea textForm;
public Editor() {
this.setLayout(new BorderLayout());
this.textForm = new JTextArea();
this.textForm.setLineWrap(true);
this.textForm.setWrapStyleWord(true);
this.textForm.setEditable(true);
this.setPreferredSize(new Dimension(675,400));
this.add(this.textForm,BorderLayout.CENTER);
}
public void edit(DWikiIPage page) {
setFormText(page.getText());
}
/**
* When a page is edited, this method calls {@link ca.diro.dwiki.Page#setText(String)} and {@link ca.diro.dwiki.Page#setEditDate(Date)}
* @throws DWikiException if the current page has no modifications.
*/
public String getFormText() {
return this.textForm.getText();
}
public void setFormText(String text) {
this.textForm.setText(text);
}
@Override
public void setPreferredSize(Dimension d) {
super.setPreferredSize(d);
this.textForm.setPreferredSize(d);
}
}
| [
"arame@xsimo.ca"
] | arame@xsimo.ca |
a9eae75201e2d7a757841c6cb08aa096d7b3ab09 | 7f4db9a3dba8300a24891c305dd1c08b17af0342 | /ESERCIZI_ESAME/20170406/package1/Montagna.java | 746fb98b9f68252610968f2f0b0ddf92cf20e10d | [] | no_license | SerenaFraD/UNI-POO | 3e622d5d32bba82dc6366410149e1d34fd15a630 | 653fac37ce194efa35d416dff222330cdc1be1d0 | refs/heads/master | 2023-03-15T02:46:18.344975 | 2021-03-16T12:55:42 | 2021-03-16T12:55:42 | 237,629,637 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package package1;
public class Montagna extends Vacanza {
private int nSaune;
private double cSaune;
public Montagna(String identificativo, double cost, String descrizione, int nSaune, double cSaune) {
super(identificativo, cost, descrizione);
this.nSaune = nSaune;
this.cSaune = cSaune;
}
public Montagna() {
nSaune = 0;
}
public int getnSaune() {
return nSaune;
}
public void setnSaune(int nSaune) {
this.nSaune = nSaune;
}
public double getCosto() {
return super.getCosto() + cSaune * nSaune;
}
public double getcSaune() {
return cSaune;
}
public void setcSaune(double cSaune) {
this.cSaune = cSaune;
}
public String toString() {
return super.toString() + "[nSaune=" + nSaune + ", cSaune=" + cSaune + "]";
}
public boolean equals(Object o) {
if(!super.equals(o))
return false;
Montagna other = (Montagna) o;
return (other.nSaune == this.nSaune) && (other.cSaune == this.cSaune);
}
public Montagna clone() {
return (Montagna) super.clone();
}
}
| [
"dursoserena61@gmail.com"
] | dursoserena61@gmail.com |
36d79d5d735105a86344228ee56df1d78bb4baf3 | 2269725826c44bcdcb9ffc9db0fb9acdac7c7bc2 | /app/src/main/java/com/zxy/study/blur/FastBlur.java | 168842e8e2c2314408f24f5cca6246497c56f03f | [] | no_license | lianshangyangguang/Study | efe47c1874fcfd208be3c817bc0374c12eecb755 | a719cc0401b52e789a01210591a8bd736036036e | refs/heads/master | 2021-05-13T14:43:30.526189 | 2018-01-09T01:03:07 | 2018-01-09T01:03:07 | 111,364,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,323 | java | package com.zxy.study.blur;
import android.graphics.Bitmap;
/**
* Created by xiyingzhu on 2017/11/14.
*/
public class FastBlur {
public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) {
// Stack Blur v1.0 from
//http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
//
// Java Author: Mario Klingemann <mario at="" quasimondo.com="">
//http://incubator.quasimondo.com
// created Feburary 29, 2004
// Android port : Yahel Bouaziz <yahel at="" kayenko.com="">
//http://www.kayenko.com
// ported april 5th, 2012
// This is a compromise between Gaussian Blur and Box blur
// It creates much better looking blurs than Box Blur, but is
// 7x faster than my Gaussian Blur implementation.
//
// I called it Stack Blur because this describes best how this
// filter works internally: it creates a kind of moving stack
// of colors whilst scanning through the image. Thereby it
// just has to add one new block of color to the right side
// of the stack and remove the leftmost color. The remaining
// colors on the topmost layer of the stack are either added on
// or reduced by one, depending on if they are on the right or
// on the left side of the stack.
//
// If you are using this algorithm in your code please add
// the following line:
//
// Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com>
Bitmap bitmap;
if(canReuseInBitmap) {
bitmap = sentBitmap;
}else{
bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
}
if(radius < 1) {
return(null);
}
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int[] pix = new int[w * h];
bitmap.getPixels(pix,0, w, 0,0, w, h);
int wm = w - 1;
int hm = h - 1;
int wh = w * h;
int div = radius + radius + 1;
int r[] = new int[wh];
int g[] = new int[wh];
int b[] = new int[wh];
int rsum, gsum, bsum, x, y, i, p, yp, yi, yw;
int vmin[] = new int[Math.max(w, h)];
int divsum = (div + 1) >> 1;
divsum *= divsum;
int dv[] = new int[256* divsum];
for(i = 0; i < 256* divsum; i++) {
dv[i] = (i / divsum);
}
yw = yi = 0;
int[][] stack = new int[div][3];
int stackpointer;
int stackstart;
int[] sir;
int rbs;
int r1 = radius + 1;
int routsum, goutsum, boutsum;
int rinsum, ginsum, binsum;
for(y = 0; y < h; y++) {
rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
for(i = -radius; i <= radius; i++) {
p = pix[yi + Math.min(wm, Math.max(i, 0))];
sir = stack[i + radius];
sir[0] = (p & 0xff0000) >> 16;
sir[1] = (p & 0x00ff00) >> 8;
sir[2] = (p & 0x0000ff);
rbs = r1 - Math.abs(i);
rsum += sir[0] * rbs;
gsum += sir[1] * rbs;
bsum += sir[2] * rbs;
if(i > 0) {
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
}else{
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
}
}
stackpointer = radius;
for(x = 0; x < w; x++) {
r[yi] = dv[rsum];
g[yi] = dv[gsum];
b[yi] = dv[bsum];
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
stackstart = stackpointer - radius + div;
sir = stack[stackstart % div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
if(y == 0) {
vmin[x] = Math.min(x + radius + 1, wm);
}
p = pix[yw + vmin[x]];
sir[0] = (p & 0xff0000) >> 16;
sir[1] = (p & 0x00ff00) >> 8;
sir[2] = (p & 0x0000ff);
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
stackpointer = (stackpointer + 1) % div;
sir = stack[(stackpointer) % div];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
yi++;
}
yw += w;
}
for(x = 0; x < w; x++) {
rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
yp = -radius * w;
for(i = -radius; i <= radius; i++) {
yi = Math.max(0, yp) + x;
sir = stack[i + radius];
sir[0] = r[yi];
sir[1] = g[yi];
sir[2] = b[yi];
rbs = r1 - Math.abs(i);
rsum += r[yi] * rbs;
gsum += g[yi] * rbs;
bsum += b[yi] * rbs;
if(i > 0) {
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
}else{
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
}
if(i < hm) {
yp += w;
}
}
yi = x;
stackpointer = radius;
for(y = 0; y < h; y++) {
// Preserve alpha channel: ( 0xff000000 & pix[yi] )
pix[yi] = (0xff000000& pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum];
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
stackstart = stackpointer - radius + div;
sir = stack[stackstart % div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
if(x == 0) {
vmin[y] = Math.min(y + r1, hm) * w;
}
p = x + vmin[y];
sir[0] = r[p];
sir[1] = g[p];
sir[2] = b[p];
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
stackpointer = (stackpointer + 1) % div;
sir = stack[stackpointer];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
yi += w;
}
}
bitmap.setPixels(pix,0, w, 0,0, w, h);
return(bitmap);
}
}
| [
"1141179268@qq.com"
] | 1141179268@qq.com |
92135c76b41af7015a4eb77d640dd68f7514249e | 67a145997b747950983bc269ec3aade2cd74ddd1 | /app/src/androidTest/java/com/example/mike/week3day1/ExampleInstrumentedTest.java | ef8a3f05d66f80d3be3e8c4d515ce3d43f2bedcf | [] | no_license | MikhailKashtaevMobileApps/week3day1 | 1e36399d5b737d8c7d42e1e87d1f29627a1799d5 | 225ab3a4c4eb1c052e7e2f841a1091f07e3b3627 | refs/heads/master | 2020-04-04T21:56:10.824586 | 2018-11-06T00:45:49 | 2018-11-06T00:45:49 | 156,303,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.example.mike.week3day1;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.mike.week3day1", appContext.getPackageName());
}
}
| [
"mikhail.kashtaev@mobileappscompany.us"
] | mikhail.kashtaev@mobileappscompany.us |
a2cdaa4f8184c5393e7af2ceaebbe1fa67b9df32 | f051ee9d89950383a842a6e2094083f6b4b8b316 | /Lecture/Android/Work/Registration/app/src/androidTest/java/com/android/registration/ExampleInstrumentedTest.java | b331b0c03e4613fcf03763630815075a34903561 | [] | no_license | BBongR/workspace | 6d3b5c5a05bee75c031a80b971c859b6749e541e | 2f020cd7809e28a2cae0199cac59375d407f58cf | refs/heads/master | 2021-09-13T14:49:51.825677 | 2018-02-07T09:18:40 | 2018-02-07T09:18:40 | 106,399,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 749 | java | package com.android.registration;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.android.registration", appContext.getPackageName());
}
}
| [
"suv1214@naver.com"
] | suv1214@naver.com |
84ff1830d676ba65c883fecccb945eee0c3cd318 | d174b41d34a55de16ae07dcd8bdd8bafa9284725 | /AndroidBillionDemo/androidbillion/src/main/java/demo/binea/com/androidbillion/SameThreadExecutor.java | dd0632f105b91b15fce7f37386080103c4bcd14d | [
"MIT"
] | permissive | xu6148152/binea_project_for_android | b65277c299c718ea3ed7f8750a2cd032979053b6 | 3288eb96bca4cb2297abfecca70248841015acf8 | refs/heads/master | 2021-01-15T09:09:58.283606 | 2017-03-21T09:51:25 | 2017-03-21T09:51:25 | 35,715,190 | 1 | 0 | null | 2015-07-14T03:46:51 | 2015-05-16T08:02:36 | Java | UTF-8 | Java | false | false | 1,173 | java | /*
* Copyright 2014 serso aka se.solovyev
*
* 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.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package demo.binea.com.androidbillion;
import javax.annotation.Nonnull;
class SameThreadExecutor implements CancellableExecutor {
@Nonnull
public static final SameThreadExecutor INSTANCE = new SameThreadExecutor();
private SameThreadExecutor() {
}
@Override
public void execute(@Nonnull Runnable command) {
command.run();
}
@Override
public void cancel(@Nonnull Runnable runnable) {
}
}
| [
"xubinggui@zepplabs.com"
] | xubinggui@zepplabs.com |
0db91e4ee72b9cfb54b17c6bc85b2b064fc7734c | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/profile/cards/tfa/di/TfaSettingsItemModule.java | 83e2c0b625f8b6d0b6d28297f2c89ae6d83bcda9 | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,001 | java | package com.avito.android.profile.cards.tfa.di;
import com.avito.android.di.PerActivity;
import com.avito.android.profile.cards.tfa.TfaSettingsBlueprint;
import com.avito.android.profile.cards.tfa.TfaSettingsItemPresenter;
import com.avito.android.profile.cards.tfa.TfaSettingsItemPresenterImpl;
import com.avito.konveyor.blueprint.ItemBlueprint;
import dagger.Binds;
import dagger.Module;
import dagger.multibindings.IntoSet;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\bg\u0018\u00002\u00020\u0001J\u001f\u0010\u0005\u001a\n\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u00042\u0006\u0010\u0003\u001a\u00020\u0002H'¢\u0006\u0004\b\u0005\u0010\u0006J\u0017\u0010\n\u001a\u00020\t2\u0006\u0010\b\u001a\u00020\u0007H'¢\u0006\u0004\b\n\u0010\u000b¨\u0006\f"}, d2 = {"Lcom/avito/android/profile/cards/tfa/di/TfaSettingsItemModule;", "", "Lcom/avito/android/profile/cards/tfa/TfaSettingsBlueprint;", "blueprint", "Lcom/avito/konveyor/blueprint/ItemBlueprint;", "bindBlueprint", "(Lcom/avito/android/profile/cards/tfa/TfaSettingsBlueprint;)Lcom/avito/konveyor/blueprint/ItemBlueprint;", "Lcom/avito/android/profile/cards/tfa/TfaSettingsItemPresenterImpl;", "impl", "Lcom/avito/android/profile/cards/tfa/TfaSettingsItemPresenter;", "bindPresenter", "(Lcom/avito/android/profile/cards/tfa/TfaSettingsItemPresenterImpl;)Lcom/avito/android/profile/cards/tfa/TfaSettingsItemPresenter;", "profile_release"}, k = 1, mv = {1, 4, 2})
@Module
public interface TfaSettingsItemModule {
@Binds
@IntoSet
@NotNull
@PerActivity
ItemBlueprint<?, ?> bindBlueprint(@NotNull TfaSettingsBlueprint tfaSettingsBlueprint);
@PerActivity
@Binds
@NotNull
TfaSettingsItemPresenter bindPresenter(@NotNull TfaSettingsItemPresenterImpl tfaSettingsItemPresenterImpl);
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
222b0f53635ba15b62d91714d003dfb1d5192622 | 49ecb0daf855576adb7dbc1066b843045b54893b | /Pertemuan 8/1941720152_Moh.ZulfanAkbar/Tugas2/Tugas2.java | c92ff1017be9c519ff2b7c349aecbc92c61c234c | [] | no_license | zulfanakbar/Algoritma-dan-Struktur-Data | 7a9e16f5e13b7390d3a8c2663f18a4dff3c0394d | b6cce639ad6711492211a02e6a1e14d491c71581 | refs/heads/master | 2020-12-29T11:33:03.248101 | 2020-05-14T04:35:56 | 2020-05-14T04:35:56 | 238,592,475 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package Tugas2;
public class Tugas2 {
int size, top;
String data[];
public Tugas2(int size) {
this.size = size;
data = new String[size];
top = -1;
}
public boolean IsFull() {
if (top == size - 1) {
return true;
} else {
return false;
}
}
public void push(String dt) {
if (!IsFull()) {
top++;
data[top] = dt;
}
}
public void print() {
System.out.print("Kalimat dibalik : ");
for (int i = top; i >= 0; i--) {
System.out.print(data[i] + " ");
}
System.out.println("");
}
}
| [
"noreply@github.com"
] | zulfanakbar.noreply@github.com |
08c66ae09f11ff604afe6f557501eb97eda568bf | adf3084225fe57cf891a722468758eb098ac2358 | /src/main/java/demotivirus/controllers/HomeController.java | 8689b6bd1ad6c6e5d41707809bdf8999dde916c3 | [] | no_license | demotivirus/Spring-WORK | 317a251fecc451fd8bda30510f87c09faec2f58f | ef906f64a0d0c4d2a476d38adecdb14e06933e48 | refs/heads/master | 2022-12-22T13:17:38.824264 | 2020-01-20T20:15:39 | 2020-01-20T20:15:39 | 231,647,519 | 0 | 0 | null | 2022-12-16T10:52:30 | 2020-01-03T18:59:07 | Java | UTF-8 | Java | false | false | 1,446 | java | package demotivirus.controllers;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import demotivirus.models.User;
import demotivirus.services.UserManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
/**
* Handles requests for the application home page.
*/
@Controller
public class HomeController {
@Autowired
UserManager manager;
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView main() {
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("user", new User());
modelAndView.setViewName("index");
return modelAndView;
}
@RequestMapping(value = "/check-user")
public ModelAndView checkUser(@ModelAttribute("user") User user) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("secondPage");
modelAndView.addObject("user", user);
return modelAndView;
}
// @RequestMapping(value = "/get-all-users", method = RequestMethod.POST)
// public String getAllEmployees(Model model) {
// model.addAttribute("user", manager.getAllUsers());
// return "allUsersDisplay";
// }
}
| [
"demotivirus@gmail.com"
] | demotivirus@gmail.com |
66f7c497d415ceb2425ab9d8e44c0ec65bcbfbbf | 92225460ebca1bb6a594d77b6559b3629b7a94fa | /src/com/kingdee/eas/fdc/finance/FDCDepConPayPlanItemInfo.java | 25f088a13f7d9925c477f06c71330949a84517b9 | [] | no_license | yangfan0725/sd | 45182d34575381be3bbdd55f3f68854a6900a362 | 39ebad6e2eb76286d551a9e21967f3f5dc4880da | refs/heads/master | 2023-04-29T01:56:43.770005 | 2023-04-24T05:41:13 | 2023-04-24T05:41:13 | 512,073,641 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package com.kingdee.eas.fdc.finance;
import java.io.Serializable;
public class FDCDepConPayPlanItemInfo extends AbstractFDCDepConPayPlanItemInfo implements Serializable
{
public FDCDepConPayPlanItemInfo()
{
super();
}
protected FDCDepConPayPlanItemInfo(String pkField)
{
super(pkField);
}
} | [
"yfsmile@qq.com"
] | yfsmile@qq.com |
7060a69e852502ceaabc72874c3b874932ba7ede | 7cf42defa006644112984ccb763fe7e153432a63 | /src/com/fh/entity/pluginAndprocess/ModuleInfo.java | ac07c84df1c5d33d4b075b0b5670d44b2d1c45f9 | [] | no_license | Only-Name/QualityWeb | 3f51eb95853a4423053bfde573ace2aab5406f5b | 88150d2d5b159a230b6ef03fe2664e691600a1a9 | refs/heads/master | 2023-02-17T21:23:39.360190 | 2021-01-12T08:36:31 | 2021-01-12T08:36:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,708 | java | package com.fh.entity.pluginAndprocess;
/**
* 1 *
* 2 * @Author:w_kiven
* 3 * @Date:2019/11/5 18:14
* 4
*/
public class ModuleInfo {
private int moduleId;
private String pluginName;
private String displayName;
private String publisher;
private String createTime;
private String updateTime;
private String version;
private String nodeReq;
private String memReq;
private String cpuReq;
private String gpuReq;
private String wallTime;
private String executeFile;
private String queue;
public int getModuleId() {
return moduleId;
}
public void setModuleId(int moduleId) {
this.moduleId = moduleId;
}
public String getPluginName() {
return pluginName;
}
public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getNodeReq() {
return nodeReq;
}
public void setNodeReq(String nodeReq) {
this.nodeReq = nodeReq;
}
public String getMemReq() {
return memReq;
}
public void setMemReq(String memReq) {
this.memReq = memReq;
}
public String getCpuReq() {
return cpuReq;
}
public void setCpuReq(String cpuReq) {
this.cpuReq = cpuReq;
}
public String getGpuReq() {
return gpuReq;
}
public void setGpuReq(String gpuReq) {
this.gpuReq = gpuReq;
}
public String getWallTime() {
return wallTime;
}
public void setWallTime(String wallTime) {
this.wallTime = wallTime;
}
public String getExecuteFile() {
return executeFile;
}
public void setExecuteFile(String executeFile) {
this.executeFile = executeFile;
}
public String getQueue() {
return queue;
}
public void setQueue(String queue) {
this.queue = queue;
}
}
| [
"15313299705@163.com"
] | 15313299705@163.com |
7c7af5f92edce52de4603aba9a5cf78cbde5209a | 09e46ef9fe833bb53cfee9642ac43de2534e359f | /src/ddd/simple/action/permission/VipLoginAction.java | 5ed26aacc5606b0099f9bff84637042bf65938f0 | [] | no_license | JerryCaoHPE/DDD | f9432f220985d4feda6959680da8b593e143f423 | e1646d3fa8cee87ce72173eddf75f175b21ddc21 | refs/heads/master | 2021-01-19T21:12:57.994592 | 2017-08-24T02:50:36 | 2017-08-24T02:50:36 | 101,246,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,875 | java | package ddd.simple.action.permission;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import ddd.base.annotation.Action;
import ddd.base.annotation.RequestMapping;
import ddd.base.exception.DDDException;
import ddd.base.persistence.EntitySet;
import ddd.simple.entity.member.Member;
import ddd.simple.entity.memberGroup.MemberGroup;
import ddd.simple.service.member.MemberService;
@Action
@RequestMapping("/VipLogin")
@Controller
public class VipLoginAction
{
@Resource(name = "memberServiceBean")
private MemberService memberService;
public Map<String, Object> vipLogin(String name, String password) throws Exception
{
try
{
Map<String, Object> result = new HashMap<String, Object>();
result.put("isSuccess", false);
//采用md5加密
if (password.length() != 32) {
return new HashMap<String, Object>();
}
Member member = this.memberService.findMemberByNameAndPassword(name, password);
if (member != null)
{
result.put("isSuccess", true);
result.put("groups", this.memberService.searchGroup(name));
}
return result;
} catch (DDDException e)
{
throw e;
}
}
public Map<String, Object> checkOrganization(String name, String password, MemberGroup group) throws Exception
{
return this.memberService.checkOrganization(name, password, group);
}
public EntitySet<MemberGroup> searchGroup(String memberName) throws Exception
{
try
{
return this.memberService.searchGroup(memberName);
} catch (DDDException e)
{
throw e;
}
}
public void vipLoginOut(HttpServletRequest request) throws Exception
{
this.memberService.removeLoginUser();
}
}
| [
"caojianlin_cq@163.com"
] | caojianlin_cq@163.com |
6fdc8ccc018219728177f1bac4b39eaa210824ac | 0423cf9e0bace93c88a91d46620ff5fd152747ab | /algorithms/src/main/java/com/ithub/source/learn/DataStructures/Trees/ValidBSTOrNot.java | 707a1d8045c629eb1de8c64892ad9aa518bcf620 | [
"Apache-2.0"
] | permissive | itchenp/java-learn | 227c81c76c70810ae423deecdcf359b124c86ae5 | 9b43038a0d1c46b0c4b5db7badd4e70d5c1f8e58 | refs/heads/master | 2022-03-27T16:32:45.514087 | 2022-03-15T09:21:54 | 2022-03-15T09:21:54 | 204,019,261 | 1 | 0 | Apache-2.0 | 2022-02-14T10:40:39 | 2019-08-23T14:56:37 | Java | UTF-8 | Java | false | false | 1,269 | java | package com.ithub.source.learn.DataStructures.Trees;
public class ValidBSTOrNot {
class Node {
int data;
Node left, right;
public Node(int item) {
data = item;
left = right = null;
}
}
//Root of the Binary Tree
Node root;
/* can give min and max value according to your code or
can write a function to find min and max value of tree. */
/* returns true if given search tree is binary
search tree (efficient version) */
boolean isBST() {
return isBSTUtil(root, Integer.MIN_VALUE,
Integer.MAX_VALUE);
}
/* Returns true if the given tree is a BST and its
values are >= min and <= max. */
boolean isBSTUtil(Node node, int min, int max) {
/* an empty tree is BST */
if (node == null)
return true;
/* false if this node violates the min/max constraints */
if (node.data < min || node.data > max)
return false;
/* otherwise check the subtrees recursively
tightening the min/max constraints */
// Allow only distinct values
return (isBSTUtil(node.left, min, node.data - 1) &&
isBSTUtil(node.right, node.data + 1, max));
}
} | [
"2wsx3edc"
] | 2wsx3edc |
9dee34c5fc1f08a9d08cc49ed944513781d03a30 | d1bd0d85ce28f1665fddadce3eb4a6652c7b2a1b | /src/main/java/miw_padel_back/configuration/security/WebSecurityConfig.java | a9419c27ad075d18e2b53b6c63dd0bd4649d2ec8 | [] | no_license | Diegoxlus/miw-padel-back | c73fabdc8c4b1f0fccb9eb7963eaffa2fae5673b | 90e9f7827e3ab7df082dd2571938e122869e7cac | refs/heads/master | 2023-06-12T05:51:49.947374 | 2021-06-28T12:07:35 | 2021-06-28T12:07:35 | 359,967,387 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,670 | java | package miw_padel_back.configuration.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
import reactor.core.publisher.Mono;
/**
* @author ard333
*/
@EnableWebFluxSecurity
@EnableReactiveMethodSecurity()
public class WebSecurityConfig {
private final AuthenticationManager authenticationManager;
private final SecurityContextRepository securityContextRepository;
private static final String[] AUTH_WHITELIST = {
// -- Swagger UI v2
"/v2/api-docs",
"/swagger-resources",
"/swagger-resources/**",
"/configuration/**",
"/configuration/security",
"/swagger-ui.html",
"/webjars/**",
// -- Swagger UI v3 (OpenAPI)
"/v3/api-docs/**",
"/swagger-ui/**"
};
@Autowired
public WebSecurityConfig(AuthenticationManager authenticationManager, SecurityContextRepository securityContextRepository) {
this.authenticationManager = authenticationManager;
this.securityContextRepository = securityContextRepository;
}
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
return http
.exceptionHandling()
.authenticationEntryPoint((swe, e) ->
Mono.fromRunnable(() -> swe.getResponse().setStatusCode(HttpStatus.UNAUTHORIZED))
).accessDeniedHandler((swe, e) ->
Mono.fromRunnable(() -> swe.getResponse().setStatusCode(HttpStatus.FORBIDDEN))
).and()
.csrf().disable()
.formLogin().disable()
.httpBasic().disable()
.authenticationManager(authenticationManager)
.securityContextRepository(securityContextRepository)
.authorizeExchange()
.pathMatchers(HttpMethod.OPTIONS).permitAll()
.pathMatchers("/user/login", "/user/register", "/user/register/*", "/user/image").permitAll()
.pathMatchers(AUTH_WHITELIST).permitAll()
.anyExchange().authenticated()
.and().build();
}
}
| [
"lusky1996@gmail.com"
] | lusky1996@gmail.com |
c9010f6bd2cce5ada7612c40df07c40051cdcd41 | 17f040f53aa110f006f80873921fe4dee2702a00 | /src/org/omg/IOP/TAG_CODE_SETS.java | 968c1d4e877b0304a10c1d202fa97842a626e215 | [] | no_license | YangYangDai/JDK1.8 | 9ba0afe4bfacd318905b1aee4075ccb1bdea875e | 318ffb5402977c495d028905d8b64744fa544ad6 | refs/heads/master | 2021-07-21T12:53:20.880505 | 2020-07-11T08:43:25 | 2020-07-11T08:43:25 | 194,397,032 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package org.omg.IOP;
/**
* org/omg/IOP/TAG_CODE_SETS.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u161/10277/corba/src/share/classes/org/omg/PortableInterceptor/IOP.idl
* Tuesday, December 19, 2017 4:24:00 PM PST
*/
public interface TAG_CODE_SETS
{
/**
* The code set component of the IOR multi-component profile structure
* contains:
* <ul>
* <li>server's native char code set and conversion code sets, and</li>
* <li>server's native wchar code set and conversion code sets.</li>
* </ul>
* Both char and wchar conversion code sets are listed in order of
* preference.
*/
public static final int value = (int)(1L);
}
| [
"1071617783@qq.com"
] | 1071617783@qq.com |
d75b163ae4da3bc4b472e0cf12525b2b6c322602 | 67abf7383fa516ecfd1a35dedd79a6ed0292d853 | /src/main/java/com/example/gateways/repository/GatewayRepository.java | 28d912cde4e427cb5cf6aa45dba47127fe217ddc | [] | no_license | twinster/gateway | 610c10e59234d8308d3b64f44195a3f0748798ba | 403278a75e0c3c5c756c293a2e1807f5730ece6f | refs/heads/master | 2021-01-02T11:21:28.112280 | 2020-02-10T20:22:15 | 2020-02-10T20:22:15 | 239,599,569 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package com.example.gateways.repository;
import com.example.gateways.model.Gateway;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface GatewayRepository extends JpaRepository<Gateway, Long> {
public Gateway findGatewayById(Long id);
}
| [
"igochitashvili@vaba.co"
] | igochitashvili@vaba.co |
f8f01df7b1b801b42c5e0f5d1a5a757b9d3ab0c8 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/14/14_9f57d4e5910a507831468c6c4a571a27a18697cc/NoteList/14_9f57d4e5910a507831468c6c4a571a27a18697cc_NoteList_t.java | acac4b5e45c1f569447ba2a60cfa29ff43b647b9 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 8,556 | java | /* *************************************************************************************************
* eNotes *
* *************************************************************************************************
* File: NoteList.java *
* Copyright: (c) 2011-2012 Emanuele Alimonda, Giovanni Serra *
* eNotes is free software: you can redistribute it and/or modify it under the terms *
* of the GNU General Public License as published by the Free Software Foundation, *
* either version 3 of the License, or (at your option) any later version. eNotes is *
* distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without *
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. You should have received a *
* copy of the GNU General Public License along with eNotes. *
* If not, see <http://www.gnu.org/licenses/> *
* *************************************************************************************************/
package it.unica.enotes;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.CharBuffer;
import android.app.Dialog;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.text.format.Time;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.Toast;
/**
* Activity to list all existing notes
* @author Emanuele Alimonda
* @author Giovanni Serra
*/
public class NoteList extends ListActivity {
/** Menu IDs */
private static final int kMenuItemAdd = 100;
private static final int kMenuItemSearch = 101;
/** Logging tag */
private static final String kTag = "NoteList";
/** Database helper / content provider */
private NoteDB _database;
/** Fields to query */
private static final String fields[] = { Note.kTitle, Note.kTimestamp, Note.kTags, Note.kID };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(kTag, "created activity");
setContentView(R.layout.main);
this._database = null;
ListView view = getListView();
view.setHeaderDividersEnabled(true);
refreshList();
if (savedInstanceState == null) {
// Run this only if we're not resuming
Intent intent = getIntent();
newIntent(intent);
}
}
@Override
public void onResume() {
super.onResume();
refreshList();
}
@Override
public void onStart() {
super.onStart();
refreshList();
// Do some temporary files cleanup (Why here? See note in NoteView.)
try {
File tmpDir = Note.getSharedTmpDir();
File[] tmpFileList = tmpDir.listFiles();
Time thresholdTimestamp = new Time();
thresholdTimestamp.setToNow();
thresholdTimestamp.set(thresholdTimestamp.toMillis(true)-1000*3600*24); // 24 hours
for (int i = 0; i < tmpFileList.length; i++) {
if (!tmpFileList[i].exists() || !tmpFileList[i].isFile()) {
continue;
}
if (tmpFileList[i].lastModified() < thresholdTimestamp.toMillis(true)) {
tmpFileList[i].delete();
Log.v(kTag, "Deleted temp file " + tmpFileList.toString());
}
}
Log.v(kTag, "temp file check done");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
newIntent(intent);
}
/**
* Import a new note from a file loaded through intent
* @param intent The loading intent
*/
protected void newIntent(Intent intent) {
setIntent(intent);
Log.v(kTag, "Found intent: "+ intent.toString());
Uri importUri = intent.getData();
if (importUri != null) {
File importFile = new File(importUri.getPath());
if (
// File doesn't exist
!importFile.isFile()
// File is zero bytes
|| importFile.length() <= 0
// File is larger than max attachment size
|| importFile.length() > NoteAttachment.kMaxAttachmentSize*15/10
) {
Toast.makeText(this.getApplicationContext(), R.string.invalidImportFile,
Toast.LENGTH_LONG).show();
return;
}
try {
FileReader importReader = new FileReader(importFile);
CharBuffer importBuffer = CharBuffer.allocate((int)importFile.length());
importReader.read(importBuffer);
importReader.close();
Log.v(kTag, "Importing: " + String.valueOf(importBuffer.array()));
long newID = this._database.addNote(this, null, getString(R.string.importedNote),
String.valueOf(importBuffer.array()));
refreshList();
if (newID >= 0) {
Intent i = new Intent(this, NoteEdit.class);
i.putExtra(Note.kID, newID);
startActivityForResult(i, 0);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
} catch (IOException e) {
e.printStackTrace();
return;
}
}
}
/** Refresh the list, re-querying the database as needed */
protected void refreshList() {
if (this._database == null) {
this._database = new NoteDB();
}
Cursor data = this._database.getAllNotesHeaders(this);
SimpleCursorAdapter dataSource = new SimpleCursorAdapter(this, R.layout.row, data, fields,
new int[] { R.id.RowTitle, R.id.RowTimestamp, R.id.RowTags, -1 });
dataSource.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
@Override
public boolean setViewValue(View aView, Cursor aCursor, int aColumnIndex) {
if (aView.getId() == R.id.RowTimestamp) {
TextView textView = (TextView) aView;
Time timestamp = new Time();
timestamp.set(aCursor.getLong(aColumnIndex));
textView.setText(timestamp.format("%c"));
return true;
}
return false;
}
});
setListAdapter(dataSource);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Intent i = new Intent(this, NoteView.class);
i.putExtra(Note.kID, id);
startActivity(i);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, kMenuItemAdd, 1, R.string.addItem).setIcon(getResources().getDrawable(R.drawable.ic_new_note));
menu.add(0, kMenuItemSearch, 2, R.string.searchItem).setIcon(getResources().getDrawable(R.drawable.ic_search));
return true;
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
switch (item.getItemId()) {
case kMenuItemAdd:
{
long newID = this._database.addNote(this, null, null, null);
refreshList();
if (newID < 0) {
return false;
}
Intent i = new Intent(this, NoteEdit.class);
i.putExtra(Note.kID, newID);
startActivity(i);
}
break;
case kMenuItemSearch:
{
Intent i = new Intent(this, NoteSearch.class);
startActivity(i);
}
break;
default:
return false;
}
return true;
}
@Override
protected Dialog onCreateDialog(int id) {
return null;
}
}
/* vim: set ts=3 sw=3 smarttab expandtab cc=101 : */
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
06742ce80ec2e6d1f51855799bd9f44e2bdedb42 | 80708c68c79aafc7627440fd09fc1f9815e8bdc4 | /adigitalwash/laundryservice/src/main/java/com/adesso/digitalwash/LaundryserviceApplication.java | dccb4ef75a9c9d9ad1ab167c8b7d5a50a2f54a36 | [
"MIT"
] | permissive | rogeraime/microservices-java | 10bbe22280de46a08ed6381804c59179f7454775 | 4c7fce0c2821b4c833bab06814a5d68bda0a829d | refs/heads/main | 2023-04-25T23:10:02.353146 | 2021-06-10T20:05:40 | 2021-06-10T20:05:40 | 375,816,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,635 | java | package com.adesso.digitalwash;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableDiscoveryClient
@SpringBootApplication
@EnableScheduling
@EnableAsync
@EnableSwagger2
public class LaundryserviceApplication extends SpringBootServletInitializer {
@Value("${server.ip}")
String allowedOrigin;
public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(LaundryserviceApplication.class, args);
}
// @Bean
// public WebMvcConfigurer corsConfigurer() {
// return new WebMvcConfigurer() {
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**").allowedMethods("GET", "PUT", "POST", "DELETE", "OPTIONS")
// .allowedOrigins("http://" + allowedOrigin);
// }
// };
// }
ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Laundry Service API Documentation")
.description("Documentation automatically generated").license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html").termsOfServiceUrl("").version("0.0.1")
.contact(new Contact("Tamer Karatekin", "", "tamer.karatekin@adesso.de")).build();
}
@Bean
public Docket customImplementation() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.basePackage("com.adesso.digitalwash.api")).build().apiInfo(apiInfo());
}
} | [
"r.ngnosse@breuer-gmbh.de"
] | r.ngnosse@breuer-gmbh.de |
ece6c25700a8a522aa99f855073aacfd5489c353 | d9f76f0a811bfcb856c6b9cda9f50c52c28e7228 | /app/src/main/java/android/com/skyh/service/ParseXmlService.java | b7cf7410a0258781daf6e601d2d172e38ad7f2e8 | [] | no_license | llwangyu/Skyh | 86932f8efe64a80b96ff7c8a3aac9ecd25b50b88 | 29006f41f0f1e1a045fffad42574c69b0a89dc79 | refs/heads/master | 2021-01-19T21:44:44.898779 | 2018-05-31T07:32:48 | 2018-05-31T07:32:48 | 88,698,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | package android.com.skyh.service;
import android.com.skyh.entity.UpdataInfo;
import android.util.Xml;
import org.xmlpull.v1.XmlPullParser;
import java.io.InputStream;
/**
* Created by Administrator on 2015/11/15.
*/
public class ParseXmlService {
public static UpdataInfo getUpdataInfo(InputStream is) throws Exception {
XmlPullParser parser = Xml.newPullParser();
parser.setInput(is, "utf-8");
int type = parser.getEventType();
UpdataInfo info = new UpdataInfo();
while(type != XmlPullParser.END_DOCUMENT ){
switch (type) {
case XmlPullParser.START_TAG:
if("version".equals(parser.getName())){
info.setVersion(parser.nextText());
}else if ("url".equals(parser.getName())){
info.setUrl(parser.nextText());
}else if ("description".equals(parser.getName())){
info.setDescription(parser.nextText());
}
break;
}
type = parser.next();
}
return info;
}
}
| [
"37074150@qq.com"
] | 37074150@qq.com |
c77aefe8231ace3d00c4a81a07a3c68ac2bd11a8 | 93108689aab56aff29f2251750a58888b4023ff9 | /src/test/java/com/ramhacks/foodassist/security/SecurityUtilsUnitTest.java | 06fffff61750e4142078e2586aecf2a573ec5fb8 | [] | no_license | sanjanahajela/ramhacks | ae788b279320c10ee75183db128b7bf1f2cca0ed | a29a21fadad90bb5080bde91817b7657184b3019 | refs/heads/master | 2020-03-29T12:16:20.550598 | 2018-09-22T20:04:57 | 2018-09-22T20:04:57 | 149,891,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,795 | java | package com.ramhacks.foodassist.security;
import org.junit.Test;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test class for the SecurityUtils utility class.
*
* @see SecurityUtils
*/
public class SecurityUtilsUnitTest {
@Test
public void testgetCurrentUserLogin() {
SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin"));
SecurityContextHolder.setContext(securityContext);
Optional<String> login = SecurityUtils.getCurrentUserLogin();
assertThat(login).contains("admin");
}
@Test
public void testIsAuthenticated() {
SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin"));
SecurityContextHolder.setContext(securityContext);
boolean isAuthenticated = SecurityUtils.isAuthenticated();
assertThat(isAuthenticated).isTrue();
}
@Test
public void testAnonymousIsNotAuthenticated() {
SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
Collection<GrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS));
securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities));
SecurityContextHolder.setContext(securityContext);
boolean isAuthenticated = SecurityUtils.isAuthenticated();
assertThat(isAuthenticated).isFalse();
}
@Test
public void testIsCurrentUserInRole() {
SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
Collection<GrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER));
securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities));
SecurityContextHolder.setContext(securityContext);
assertThat(SecurityUtils.isCurrentUserInRole(AuthoritiesConstants.USER)).isTrue();
assertThat(SecurityUtils.isCurrentUserInRole(AuthoritiesConstants.ADMIN)).isFalse();
}
}
| [
"sanjanahajela@Sanjanas-MacBook-Pro.local"
] | sanjanahajela@Sanjanas-MacBook-Pro.local |
f306fbdeee1f8ea579e561a1337fe9435e48028f | 406b3033f2fe1440d1bb77aa28b048818bbf1e93 | /src/deniro/basicmqttserialized/BasicMQTTSerialized.java | f7107fa3559d15666932c842bfed2f5b3699e374 | [] | no_license | hanshenrik/deniro | 9e3c39d285f089023db3fd8bcf77721a11eeeff4 | ae7f8a9f510345734ac8ed48924b0848736eca8f | refs/heads/master | 2021-01-21T18:11:11.367650 | 2014-05-09T11:24:56 | 2014-05-09T11:24:56 | 18,340,064 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | package deniro.basicmqttserialized;
import no.ntnu.item.arctis.runtime.Block;
public class BasicMQTTSerialized extends Block {
public String printError(String s) {
System.out.println("BasicMQTTSerialized error: "+s);
return s;
}
}
| [
"hh.gronsleth@gmail.com"
] | hh.gronsleth@gmail.com |
100c31325166facad3fa3c899177a691908bfc6c | e6f0bc837ffbed6feba29b5cefbff3d1f14b4827 | /src/main/java/com/contentbig/kgdatalake/graphql/generated/ProductTueryDefinition.java | e96c85582211c3778a72a045920c19e84683e559 | [
"Apache-2.0"
] | permissive | covid19angels/kgis-datalake-dgraph | 1b152657a105e8c9fb503a5f47464aab853d7557 | 66e3bfabcd24dc1bfd6b8776f563b117362dbf2d | refs/heads/master | 2021-05-23T00:05:36.151365 | 2020-04-22T09:38:52 | 2020-04-22T09:38:52 | 253,148,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | // Generated from graphql_java_gen gem with template TueryDefinition.java.erb
package com.contentbig.kgdatalake.graphql.generated;
public interface ProductTueryDefinition {
void define(ProductTuery _queryBuilder);
} | [
"conan8chan@yahoo.com"
] | conan8chan@yahoo.com |
f25c45911656773fd6c1fdc7389e721ee7e56b98 | 3aad75d66091e8d1c03d13930b4937eb6feb2590 | /src/main/java/br/edu/ifrs/canoas/tcc/sisbov/domain/TypeMedicine.java | c7231f75037309304b62c5f5d57184b2f6c2139a | [
"MIT"
] | permissive | ArthurRosso/sisboi | 0adc2644f65e3a862bd1a2ac6264afbc0595648a | cf8ede45b197775ca0cfa2e814d4696a6330fc4f | refs/heads/master | 2020-03-09T19:54:10.879807 | 2018-05-16T16:49:42 | 2018-05-16T16:49:42 | 128,969,198 | 1 | 0 | MIT | 2018-04-23T13:31:29 | 2018-04-10T17:14:01 | HTML | UTF-8 | Java | false | false | 1,115 | java | package br.edu.ifrs.canoas.tcc.sisbov.domain;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import org.hibernate.annotations.GenericGenerator;
@Entity
public class TypeMedicine implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "increment")
@GenericGenerator( name = "increment", strategy = "increment")
private Long id;
private String type;
private String description;
@OneToMany (mappedBy = "type")
private List<Medicine> medicine;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String toString () {
return getType();
}
}
| [
"arthurderosso@gmail.com"
] | arthurderosso@gmail.com |
c6936494f1b4f54f51b8a3bf7f68e4eaf5291001 | 17a88002b237132dfcb987fa91d21c80a7a7703d | /java/com/fatih/dersasistan/ActivityNotEkleme.java | 1cd9c225afaf82ed6dd63ff4914b7494012f2b0f | [] | no_license | 2fatihceylan/Ders-Asistan- | 985e21af202de85cf9431e640747ac41e79f8ddc | 0b97e0aebbd5c22a87ef45e59bb9b08ff2fdaa2f | refs/heads/main | 2023-07-10T07:40:46.996251 | 2021-08-24T11:34:17 | 2021-08-24T11:34:17 | 399,439,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,654 | java | package com.fatih.dersasistan;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class ActivityNotEkleme extends AppCompatActivity {
EditText editTextkonu,editTextnot;
TextView textnot;
veriKaynagi vk;
Date today;
boolean notvarmi=false;
public Not not;
ImageView back,delete,save;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_not_ekleme);
editTextkonu=findViewById(R.id.editTextkonu);
editTextnot=findViewById(R.id.editTextnot);
textnot=findViewById(R.id.textnot);
back=findViewById(R.id.imageback);
delete=findViewById(R.id.imagedelete);
save=findViewById(R.id.imagesave);
vk=new veriKaynagi(ActivityNotEkleme.this);
vk.ac();
Intent intent=getIntent();
Bundle bundle=intent.getExtras();
if (bundle!=null) {
String notid = bundle.getString("notid");
not=vk.getNot(Integer.parseInt(notid));
editTextnot.setText(not.getNoticerik());
editTextkonu.setText(not.getNotkonu());
notvarmi=true;
}
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
today=new Date();
String stoday=formatter.format(today);
if (notvarmi){
not.setNotkonu(editTextkonu.getText().toString());
not.setNoticerik(editTextnot.getText().toString());
not.setNottarih(stoday);
vk.notGuncelle(not);
}else {
vk.notOlustur(new Not(editTextnot.getText().toString(),editTextkonu.getText().toString(),stoday));
}
Intent intentgeri=new Intent(ActivityNotEkleme.this,MainActivity.class);
startActivity(intentgeri);
finish();
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
vk.notSil(not);
Intent intentgeri=new Intent(ActivityNotEkleme.this,MainActivity.class);
startActivity(intentgeri);
finish();
}
});
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentgeri=new Intent(ActivityNotEkleme.this,MainActivity.class);
startActivity(intentgeri);
finish();
}
});
}
} | [
"noreply@github.com"
] | 2fatihceylan.noreply@github.com |
3cf848e3f87849741efa14a9365a6f7bb532f8dc | 4cda293cad14612ecbc1f5bd992956cf2c305db0 | /01.JavaSE/javase_20190311/src/com/test044/Sub.java | 3e918a175f7c9aae2a5cd843aece9ec344d4e92a | [] | no_license | dongtw93/sist_20190218 | a57af3ba89eec5b77de17be27e1eaf3cdab47b2a | e733f8cbe7aa6f3988392aff2574b8392216c4f5 | refs/heads/master | 2020-05-02T03:07:08.772425 | 2019-03-26T04:56:49 | 2019-03-26T04:56:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.test044;
//상속 관계(IS-A)
//자식 역할 클래스
public class Sub extends Sample {
//Sample 클래스의 멤버를 상속 받은 상태이다
//->Object 클래스의 멤버 + method()
//오버라이딩(Overriding)
//부모의 멤버를 자식에서 재정의해서 사용하는 것
//오버라이딩 전에는 부모의 멤버가 가진 기능 그대로 사용
//오버라이딩 후에는 자식이 재정의한 기능 사용
//부모 멤버 일부를 오버라이딩 선언
//부모 메소드 시그니처는 그대로 유지
@Override
public void method() {
//메소드 내용은 재정의
System.out.println("부모 역할 클래스 메소드에 대한 오버라이딩!");
}
}
| [
"min0425@naver.com"
] | min0425@naver.com |
25ca59039f97cf36d3ee200290fbd1ab07bb468a | b1fb0d5ee25616af4d265cba61d4842950c74f55 | /JAVA_Arc/src/backjoon/BJ_1062_SetCombination.java | 5f1e15943f4b07aadbcdb38eafbeed496fcc95ee | [] | no_license | songpang/algoritm_archive | 2586920bed983f0fe05bc07c29ae87bf9a1edecd | fdde453ba5921344ea38ca4c77d633f12b468622 | refs/heads/master | 2023-08-21T11:52:03.944614 | 2021-10-24T11:25:42 | 2021-10-24T11:25:42 | 253,319,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,622 | java | package backjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
// 백준 1062 가르침
// 고민하다가 조합으로 접근
// 반례로 인해 고생
// 해결하였으나 ***너무 느림***
/*
2 7
antatica
antaktica
*/
public class BJ_1062_SetCombination {
static int N, K, maxCount;
static Character[] alphabet;
static String[] words;
static String base = "antic";
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
K = Integer.parseInt(st.nextToken());
String temp;
// a n t i c
if (K < 5) {
System.out.println(0);
return;
}
words = new String[N];
int idx = 0;
// 알파벳 중복 검사를 위해 SET
Set<Character> noDuplicate = new HashSet<>();
for (int i = 0; i < N; i++) {
temp = br.readLine();
words[idx++] = temp;
int size = temp.length();
// anta tica 필요 없으니 범위 제외.
for (int j = 4; j < size - 4; j++) {
noDuplicate.add(temp.charAt(j));
}
}
for (int i = 0; i < 5; i++) {
noDuplicate.remove(base.charAt(i));
}
maxCount = 0;
alphabet = noDuplicate.toArray(new Character[0]);
if(alphabet.length <= K - 5) {
System.out.println(words.length);
return;
}
char[] output = new char[K];
for (int i = 0; i < 5; i++) {
output[i] = base.charAt(i);
}
combination(5, 0, output);
System.out.println(maxCount);
}
public static void combination(int count, int start, char[] output) {
if (count == K) {
int wordCount = 0;
String temp = String.valueOf(output);
loop:
for (String word : words) {
for (int i = 0; i < word.length(); i++) {
if (!temp.contains(String.valueOf(word.charAt(i)))) {
continue loop;
}
}
wordCount++;
}
maxCount = Math.max(wordCount, maxCount);
return;
}
for (int i = start; i < alphabet.length; i++) {
output[count] = alphabet[i];
combination(count + 1, i + 1, output);
}
}
}
| [
"scc6920@naver.com"
] | scc6920@naver.com |
4685cec24cbfa725acf6882a96272e59d539e715 | 028d6009f3beceba80316daa84b628496a210f8d | /uidesigner/com.nokia.sdt.sourcegen/src/com/nokia/sdt/sourcegen/doms/rss/IRssModelManipulator.java | 2922b14d98dcb6d13e501381581f723e8a03fdfb | [] | no_license | JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp | fa50cafa69d3e317abf0db0f4e3e557150fd88b3 | 4420f338bc4e522c563f8899d81201857236a66a | refs/heads/master | 2020-12-30T16:45:28.474973 | 2010-10-20T16:19:31 | 2010-10-20T16:19:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,750 | java | /*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
/**
*
*/
package com.nokia.sdt.sourcegen.doms.rss;
import com.nokia.sdt.sourcegen.*;
import com.nokia.sdt.sourcegen.core.ResourceTracker;
/**
* This is the main interface to the RSS engine.
*
*
*/
public interface IRssModelManipulator {
/**
* Get the model proxy
*/
public IRssModelProxy getModelProxy();
/**
* Get the name generator
*/
public INameGenerator getNameGenerator();
/**
* Get the include handler
*/
public IIncludeFileLocator getIncludeHandler();
/**
* Get the source formatter
*/
public ISourceFormatter getSourceFormatter();
/**
* Get the resource tracker, which manages instance -> resource
* mappings for the model.
* @return a resource tracker
*/
public ResourceTracker getResourceTracker();
/**
* Get the file manager, which manages the various
* files associated with a model
*/
//public IRssProjectFileManager getFileManager();
/**
* Get the type handler, which manages
* enums and structs
*/
public IRssModelTypeHandler getTypeHandler();
/**
* Get the resource handler
*/
public IRssModelResourceHandler getResourceHandler();
/**
* Get the variable provider
*/
public IVariableProvider getVariableProvider();
}
| [
"Deepak.Modgil@Nokia.com"
] | Deepak.Modgil@Nokia.com |
1074a769daf147ff80a1b5d9e1790bd9463ad37b | 36696c4c3e463976e8eda0d4a5b38a384d449ec5 | /src/main/java/com/javaex/controller/GalleryController.java | b1f478b5ce1e64f5b69faad2a487fb3a3530f18d | [] | no_license | kjbgo90/mysite3 | bf9deb04eb2fd4bc53675008e985ea31b818e949 | 9d7259a8983f2c1def46c83d473c2f74d689a4c2 | refs/heads/master | 2020-05-07T05:44:18.942851 | 2019-05-17T07:59:37 | 2019-05-17T07:59:37 | 180,283,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,242 | java | package com.javaex.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.javaex.service.GalleryService;
import com.javaex.vo.FileVo;
import com.javaex.vo.UserVo;
@Controller
@RequestMapping(value = "gallery")
public class GalleryController {
@Autowired
private GalleryService galleryService;
@RequestMapping(value = {"", "/list"}, method = RequestMethod.GET)
public String list(Model model) {
List<FileVo> list = galleryService.getList();
model.addAttribute("list", list);
return "gallery/list";
}
@ResponseBody
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public FileVo insert(MultipartHttpServletRequest request,
HttpSession session) {
MultipartFile file = request.getFile("file");
String comments = request.getParameter("comments");
//로그인 된 유저의 정보를 가져옴
UserVo userVo = (UserVo)session.getAttribute("authUser");
FileVo fileVo = new FileVo();
fileVo.setUser_no(userVo.getNo());
fileVo.setComments(comments);
return galleryService.insertImg(file, fileVo);
}
@ResponseBody
@RequestMapping(value = "/view", method = RequestMethod.POST)
public FileVo view(@RequestParam("no") int no) {
FileVo fileVo = galleryService.getImg(no);
return fileVo;
}
@ResponseBody
@RequestMapping(value = "/delete", method = RequestMethod.POST)
public boolean delete(@RequestParam("no") int no,
@RequestParam("user_no") int user_no,
HttpSession session) {
int result = 0;
UserVo userVo = (UserVo)session.getAttribute("authUser");
if(user_no == userVo.getNo())
result = galleryService.delete(no);
if (result == 1)
return true;
else
return false;
}
}
| [
"bong@192.168.1.12"
] | bong@192.168.1.12 |
da9c0cbb0cf6b500811769a0811b6dabba331738 | cff95628784a4c35ef6f88445fb9522258578396 | /src/com/hub4techie/dsc/streamsetAPI/JvmMemoryNonHeapCommitted.java | 00bdeb1a0b1a3a678e1c5a97ba1932c2ce3c4485 | [] | no_license | anuragdeb3/StreamSetAutomationDataLoad | f5287701f8de99fe9eab0ffb053919fb38131716 | 10ad3999c33f5a242e189b27d94178f5744c6897 | refs/heads/master | 2023-02-16T21:58:32.890317 | 2021-01-18T12:19:29 | 2021-01-18T12:19:29 | 329,827,015 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java |
package com.hub4techie.dsc.streamsetAPI;
import java.math.BigInteger;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class JvmMemoryNonHeapCommitted {
@SerializedName("value")
@Expose
private BigInteger value;
public BigInteger getValue() {
return value;
}
public void setValue(BigInteger value) {
this.value = value;
}
}
| [
"anuragdeb8@gmail.com"
] | anuragdeb8@gmail.com |
24a4ed5890c45f656592223b562b5f7e5139d680 | 29580d0714c31d4d257fe0501ee22db8e235323a | /spring-cloud-zipkin/service-hi/src/main/java/tian/pusen/web/HelloController.java | 687dfe70d5844717c91cfcaf7175bc4486f3890c | [] | no_license | pustian/spring-cloud | 0f198cc172ae062adfad3dd719f7c50a85a70c02 | 9a314803dc059ef07d2fa90688cbb82c7a17e377 | refs/heads/master | 2021-01-20T06:36:12.837347 | 2017-05-17T15:34:45 | 2017-05-17T15:34:45 | 89,899,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package tian.pusen.web;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
/**
* Created by tianpusen on 2017/5/15.
*/
@RestController
public class HelloController {
public static final Logger logger = LoggerFactory.getLogger(HelloController.class);
@Autowired
private RestTemplate restTemplate;
@Bean
public RestTemplate restTemplate(){
return new RestTemplate();
}
@Bean
public AlwaysSampler alwaysSampler(){
return new AlwaysSampler();
}
@RequestMapping("/hi")
public String hi(){
return "I am service-hi";
// return restTemplate.getForObject("http://127.0.0.1:8122/miya", String.class);
}
@RequestMapping("/callMiya")
public String callMiya(){
logger.info("service-hi callMiya method");
return restTemplate.getForObject("http://127.0.0.1:8122/miya", String.class);
}
@RequestMapping("/callMiyacCallHi")
public String callMiyacCallHi(){
logger.info("service-hi callMiya method");
return restTemplate.getForObject("http://127.0.0.1:8122/callHi", String.class);
}
}
| [
"tps@jfpal.com"
] | tps@jfpal.com |
46ab97a8a94bb1f8e393e8b6154b85677d9cd931 | 60309a1acbb3ae6d0faed62ce58dc6099f636964 | /bundleSplashScreen/src/test/java/com/taobao/splashscreen/ExampleUnitTest.java | a9a76df42d75480cd20021a9cfbb5003d3c544ba | [] | no_license | ProZoom/ProZoomAtlas | 359c030248d3024d1df8ddf3f360d358678abf5d | 00e699e4bb5b9d88d5068a99a9b9b002e7cb56e4 | refs/heads/master | 2021-01-15T11:57:35.264056 | 2017-08-08T01:17:38 | 2017-08-08T01:17:38 | 99,635,410 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.taobao.splashscreen;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
/**
* 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);
}
} | [
"18642118+ProZoom@users.noreply.github.com"
] | 18642118+ProZoom@users.noreply.github.com |
59d04153268313e11581765fd9b42d7fd714d7f0 | fd29324df4ad8a3531f37f3d959cb03396663d5c | /src/main/java/com/zdkzdk/utils/Utils.java | a057c84eb169394e094587cd06a6c46c9ea070fe | [] | no_license | nanprivate/wordToHtml | 2b6be532443dc5a424ca8e06518fe6793ada3e39 | d1b7677153d96a02635bfab89033311cc4d8eb04 | refs/heads/master | 2022-12-24T23:41:13.702205 | 2019-11-09T08:25:33 | 2019-11-09T08:25:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,420 | java | package com.zdkzdk.utils;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
public class Utils {
/**
* 判断一个字符串是否为null且为""
*
* @param string
* @return 如为null或者为""返回true
*/
public static boolean isBlank(String string) {
return string != null && !"".equals(string) ? false : true;
}
/**
* 将指定路径下docx转成html并保存在directory
*/
public static void wordToHtml(String filePath, String saveDirectory) {
//根据电脑操作系统位数将jacob的dll文件复制到jdk/bin
Properties p_ps = System.getProperties();
String OperatingSystemNumber = p_ps.getProperty("sun.arch.data.model");
byte num = 0;
if (OperatingSystemNumber.contains("64")) {
num = 64;
} else if (OperatingSystemNumber.contains("32")) {
num = 86;
}
File file = new File(System.getProperty("java.home") + "\\bin\\jacob-1.19-x" + num + ".dll");
if (!file.exists()) {
try {
file.createNewFile();
FileUtils.copyFile(new File("dll\\jacob-1.19-x" + num + ".dll"), file);
} catch (IOException e) {
e.printStackTrace();
}
}
//利用jaboc转换
ActiveXComponent app = new ActiveXComponent("WORD.Application");// 启动word进程
app.setProperty("Visible", new Variant(false));//设置用后台隐藏方式打开,即不在窗口显示word程序
Dispatch documents = app.getProperty("Documents").toDispatch();//获取操作word的document调用
Dispatch doc = Dispatch.call(documents, "Open", filePath).toDispatch();//调用打开命令,同时传入word路径
String name = new File(filePath).getName().replace(".docx",".htm");//调用另存为命令,同时传入html的路径
Dispatch.invoke(doc, "SaveAs", Dispatch.Method,
new Object[]{saveDirectory + "\\" + name, new Variant(8)}, new int[1]);
Dispatch.call(doc, "Close", new Variant(0));//关闭document对象
Dispatch.call(app, "Quit");//关闭WINWORD.exe进程
//清空对象
doc = null;
app = null;
}
}
| [
"zdkdchao@gmail.com"
] | zdkdchao@gmail.com |
e969d2cdb240dd690278a4ce7b74e10dddfd2d2d | 79a5ab0eaecdf1bdd57d3ab75cae387ead128df4 | /pageRank/src/main/java/com/gachanja/pagerank/model/Status.java | d3c30e5a1b9917fda75484e2b5b68539e53e65db | [] | no_license | gksamuel/news | 72a4435f41be6840ee75445d852e1e83eacfabe8 | e26a97c8600d968bdc236ce930cce2050b28285a | refs/heads/master | 2020-12-14T09:55:11.385353 | 2017-06-26T18:04:59 | 2017-06-26T18:04:59 | 95,468,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,666 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.gachanja.pagerank.model;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author gachanja
*/
@Entity
@Table(name = "status")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Status.findAll", query = "SELECT s FROM Status s"),
@NamedQuery(name = "Status.findByStatusid", query = "SELECT s FROM Status s WHERE s.statusid = :statusid"),
@NamedQuery(name = "Status.findByDescription", query = "SELECT s FROM Status s WHERE s.description = :description"),
@NamedQuery(name = "Status.findByDatecreated", query = "SELECT s FROM Status s WHERE s.datecreated = :datecreated"),
@NamedQuery(name = "Status.findByDatemodified", query = "SELECT s FROM Status s WHERE s.datemodified = :datemodified")})
public class Status implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "statusid")
private Integer statusid;
@Basic(optional = false)
@Column(name = "description")
private String description;
@Basic(optional = false)
@Column(name = "datecreated")
@Temporal(TemporalType.TIMESTAMP)
private Date datecreated;
@Basic(optional = false)
@Column(name = "datemodified")
@Temporal(TemporalType.TIMESTAMP)
private Date datemodified;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "statusid")
private Collection<Articles> articlesCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "statusid")
private Collection<Authors> authorsCollection;
public Status() {
}
public Status(Integer statusid) {
this.statusid = statusid;
}
public Status(Integer statusid, String description, Date datecreated, Date datemodified) {
this.statusid = statusid;
this.description = description;
this.datecreated = datecreated;
this.datemodified = datemodified;
}
public Integer getStatusid() {
return statusid;
}
public void setStatusid(Integer statusid) {
this.statusid = statusid;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getDatecreated() {
return datecreated;
}
public void setDatecreated(Date datecreated) {
this.datecreated = datecreated;
}
public Date getDatemodified() {
return datemodified;
}
public void setDatemodified(Date datemodified) {
this.datemodified = datemodified;
}
@XmlTransient
public Collection<Articles> getArticlesCollection() {
return articlesCollection;
}
public void setArticlesCollection(Collection<Articles> articlesCollection) {
this.articlesCollection = articlesCollection;
}
@XmlTransient
public Collection<Authors> getAuthorsCollection() {
return authorsCollection;
}
public void setAuthorsCollection(Collection<Authors> authorsCollection) {
this.authorsCollection = authorsCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (statusid != null ? statusid.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Status)) {
return false;
}
Status other = (Status) object;
if ((this.statusid == null && other.statusid != null) || (this.statusid != null && !this.statusid.equals(other.statusid))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.gachanja.pagerank.model.Status[ statusid=" + statusid + " ]";
}
}
| [
"gksamuel1@gmail.com"
] | gksamuel1@gmail.com |
27df3f696c0e9b9f86dde78c0097a7233b82fa56 | a3333475f0ded82ebff62728739e84b93aa06240 | /src/main/java/com/anvar/bookmanager/dao/BookDAO.java | e19f2ce5f1ee43e92260cb65b8138dee0c12d4c9 | [] | no_license | azelio5/BookManager | 38c2a6429555475f1b071455f7562062f7d52f7f | a35dd184ed94d5f0ad74069275b40f8a2dd5302b | refs/heads/master | 2021-01-19T08:30:55.152951 | 2017-04-08T14:38:17 | 2017-04-08T14:38:17 | 87,640,333 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package com.anvar.bookmanager.dao;
import com.anvar.bookmanager.model.Book;
import java.util.List;
public interface BookDAO {
public void addBook(Book book);
public void updateBook(Book book);
public void removeBook(int id);
public Book getBookById(int id);
public List<Book> listBooks();
}
| [
"a.alakbarov@gmail.com"
] | a.alakbarov@gmail.com |
067062486fe539f0d9b11a1ca586647180b8f45a | 3122e0283746e575f334554690f2499d86c48b12 | /zksandbox/src/org/zkoss/zksandbox/MainLayoutAPI.java | 3d4e485d010777a7b80473639d351f07dc6c8f41 | [] | no_license | sffej/java_learn | cfe6c7250d51af5d121418be97286ed9eb26c2ff | 1b25d9b4a7a6cfe786a915bc702478254ff03fcb | refs/heads/master | 2021-01-13T04:14:09.438033 | 2013-12-06T00:53:07 | 2013-12-06T00:53:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | /* MainLayoutAPI.java
{{IS_NOTE
Purpose:
Description:
History:
Nov 12, 2008 3:26:47 PM , Created by jumperchen
}}IS_NOTE
Copyright (C) 2008 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under GPL Version 3.0 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zksandbox;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.ListitemRenderer;
/**
* @author jumperchen
*
*/
public interface MainLayoutAPI {
public Category[] getCategories();
public ListModel getSelectedModel();
public ListitemRenderer getItemRenderer();
}
| [
"gongwenwei@gmail.com"
] | gongwenwei@gmail.com |
2d3db3de25c57b8c266f34587db13d894363bd16 | c74f69872f5da28f8c72df1f895cde1ef3c6afa7 | /src/main/java/com/config/load/command/CommandArgs.java | 99776ef66e3e963c61416734e9b6f1d85916b44a | [] | no_license | wo94zj/config-loador | 9bcfee208149a276fbc0486a7027a0385e655e5b | dcfda63b5807421557069e232fc460d41708796c | refs/heads/master | 2021-07-09T02:17:19.827259 | 2019-07-02T07:22:26 | 2019-07-02T07:22:26 | 194,809,248 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package com.config.load.command;
import java.util.Map;
/**
*
* @author zhaoj
*
* 加载命令行配置信息
* 直接参数通过getArgs()获取;“-”开头的参数格式为“-key value”,“--”开头的参数格式为“--key=value”,通过getValue获取
*/
public class CommandArgs {
private String[] params = null;
private Map<String, String> map =null;
protected void initArgs(String[] params, Map<String, String> map) {
this.params = params;
this.map = map;
}
public String[] getArgs() {
return params;
}
public String getValue(String key) {
return map.get(key);
}
public String getValue(String key, String defaultValue) {
return map.getOrDefault(key, defaultValue);
}
}
| [
"zhaojie@uyplay.cn"
] | zhaojie@uyplay.cn |
ee298a2c6e53eb6e2a90784895fc7c3b4287a43a | 2cfb9e9c510cdf809a342307fc3594904342fbeb | /src/main/java/com/airwallex/rpncalculator/biz/processors/impl/DecimalProcessor.java | 788c7dfae527f266db993760702bbe2405b82011 | [] | no_license | jimmycyu/rpncalculator | b2b9a97ec9e2c0b41993d9d27e58b18268aaf757 | 79549a1b0c1ad8b24d25e15bd2bfe50aab743ceb | refs/heads/master | 2021-01-06T15:34:23.328135 | 2020-02-20T01:09:35 | 2020-02-20T01:09:35 | 241,381,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package com.airwallex.rpncalculator.biz.processors.impl;
import com.airwallex.rpncalculator.biz.processors.ParameterProcessor;
import com.airwallex.rpncalculator.model.CalculatorStatus;
import java.math.BigDecimal;
public class DecimalProcessor implements ParameterProcessor<BigDecimal> {
@Override
public void acceptParameter(BigDecimal param, CalculatorStatus stack) {
stack.push(param);
}
}
| [
"yuchen@yuchendeMacBook-Pro.local"
] | yuchen@yuchendeMacBook-Pro.local |
2e90fcaaccafb9e38bbcf88ad1342ae437294c26 | dfbc0d4a9a2f54b13a2e4e22b0dc67719e41a102 | /Programming/Intro/HW9/src/queue/LinkedQueue.java | 266a0bbcce49950411a030c780e16bf51858e5c8 | [] | no_license | Ckefy/Java-Paradigms | 91fe62e18c4e41c63f8ab8ca7d0bcd3231819b1b | 1a0aed120ff5ba2f680eae2cc0c43fbec4925bf0 | refs/heads/master | 2020-12-10T20:02:21.496972 | 2020-01-13T21:19:19 | 2020-01-13T21:19:19 | 233,695,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,064 | java | package queue;
public class LinkedQueue extends AbstractQueue {
private Node head;
private Node tail;
protected void enqueueImpl(Object x) {
if (size == 1) {
head = tail = new Node(x, null);
} else {
tail.next = new Node(x, null);
tail = tail.next;
}
}
protected Object elementImpl() {
return head.value;
}
protected void dequeueImpl() {
head = head.next;
if (size == 0) {
tail = head = null;
}
}
protected void clearImpl() {
tail = head = null;
}
protected LinkedQueue copyQueue() {
LinkedQueue answer = new LinkedQueue();
Node now = head;
while (now != null){
answer.enqueue(now.value);
now = now.next;
}
return answer;
}
private class Node {
private Object value;
private Node next;
private Node(Object newVal, Node newNext) {
value = newVal;
next = newNext;
}
}
}
| [
"lukonin004@gmail.com"
] | lukonin004@gmail.com |
432a86f2bcc4a22c0bb8e15324478206f0d1b340 | 4a7d51decfe3f13b4daa46e00858fc2ea1e74ca2 | /cas-4.2.7/cas-server-webapp-actions/src/main/java/org/jasig/cas/web/flow/AuthenticationViaFormAction.java | 96b29a0768ea180308c3ba39a9d8bbb31ecec185 | [
"Apache-2.0"
] | permissive | Morphing-Liu/cas-4.2.7 | 6474123f6af3f6d34aaa55e95186739405645111 | 2f2f083343d6805705fd0d77e9e10cfc730c9fce | refs/heads/master | 2022-08-06T05:47:09.077891 | 2018-03-03T14:53:31 | 2018-03-03T14:53:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,645 | java | package org.jasig.cas.web.flow;
import org.apache.commons.lang3.StringUtils;
import org.jasig.cas.CasProtocolConstants;
import org.jasig.cas.CentralAuthenticationService;
import org.jasig.cas.authentication.AuthenticationContext;
import org.jasig.cas.authentication.AuthenticationContextBuilder;
import org.jasig.cas.authentication.AuthenticationException;
import org.jasig.cas.authentication.AuthenticationSystemSupport;
import org.jasig.cas.authentication.AuthenticationTransaction;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.DefaultAuthenticationContextBuilder;
import org.jasig.cas.authentication.DefaultAuthenticationSystemSupport;
import org.jasig.cas.authentication.HandlerResult;
import org.jasig.cas.authentication.MessageDescriptor;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.ticket.AbstractTicketException;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.ticket.TicketCreationException;
import org.jasig.cas.ticket.TicketGrantingTicket;
import org.jasig.cas.web.support.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.binding.message.MessageBuilder;
import org.springframework.binding.message.MessageContext;
import org.springframework.stereotype.Component;
import org.springframework.web.util.CookieGenerator;
import org.springframework.webflow.core.collection.LocalAttributeMap;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;
import javax.validation.constraints.NotNull;
import java.util.Map;
/**
* Action to authenticate credential and retrieve a TicketGrantingTicket for
* those credential. If there is a request for renew, then it also generates
* the Service Ticket required.
*
* @author Scott Battaglia
* @since 3.0.0
*/
@Component("authenticationViaFormAction")
public class AuthenticationViaFormAction {
/** Authentication succeeded with warnings from authn subsystem that should be displayed to user. */
public static final String SUCCESS_WITH_WARNINGS = "successWithWarnings";
/** Authentication failure result. */
public static final String AUTHENTICATION_FAILURE = "authenticationFailure";
/** Flow scope attribute that determines if authn is happening at a public workstation. */
public static final String PUBLIC_WORKSTATION_ATTRIBUTE = "publicWorkstation";
/** Logger instance. **/
protected final transient Logger logger = LoggerFactory.getLogger(getClass());
/** Core we delegate to for handling all ticket related tasks. */
@NotNull
@Autowired
@Qualifier("centralAuthenticationService")
private CentralAuthenticationService centralAuthenticationService;
@NotNull
@Autowired
@Qualifier("warnCookieGenerator")
private CookieGenerator warnCookieGenerator;
@NotNull
@Autowired(required=false)
@Qualifier("defaultAuthenticationSystemSupport")
private AuthenticationSystemSupport authenticationSystemSupport = new DefaultAuthenticationSystemSupport();
/**
* Handle the submission of credentials from the post.
*
* @param context the context
* @param credential the credential
* @param messageContext the message context
* @return the event
* @since 4.1.0
*/
public final Event submit(final RequestContext context, final Credential credential,
final MessageContext messageContext) {
if (isRequestAskingForServiceTicket(context)) {
return grantServiceTicket(context, credential);
}
return createTicketGrantingTicket(context, credential, messageContext);
}
/**
* Is request asking for service ticket?
*
* @param context the context
* @return true, if both service and tgt are found, and the request is not asking to renew.
* @since 4.1.0
*/
protected boolean isRequestAskingForServiceTicket(final RequestContext context) {
final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
final Service service = WebUtils.getService(context);
return (StringUtils.isNotBlank(context.getRequestParameters().get(CasProtocolConstants.PARAMETER_RENEW))
&& ticketGrantingTicketId != null
&& service != null);
}
/**
* Grant service ticket for the given credential based on the service and tgt
* that are found in the request context.
*
* @param context the context
* @param credential the credential
* @return the resulting event. Warning, authentication failure or error.
* @since 4.1.0
*/
protected Event grantServiceTicket(final RequestContext context, final Credential credential) {
final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
try {
final Service service = WebUtils.getService(context);
final AuthenticationContextBuilder builder = new DefaultAuthenticationContextBuilder(
this.authenticationSystemSupport.getPrincipalElectionStrategy());
final AuthenticationTransaction transaction =
AuthenticationTransaction.wrap(credential);
this.authenticationSystemSupport.getAuthenticationTransactionManager().handle(transaction, builder);
final AuthenticationContext authenticationContext = builder.build(service);
final ServiceTicket serviceTicketId = this.centralAuthenticationService.grantServiceTicket(
ticketGrantingTicketId, service, authenticationContext);
WebUtils.putServiceTicketInRequestScope(context, serviceTicketId);
WebUtils.putWarnCookieIfRequestParameterPresent(this.warnCookieGenerator, context);
return newEvent(AbstractCasWebflowConfigurer.TRANSITION_ID_WARN);
} catch (final AuthenticationException e) {
return newEvent(AUTHENTICATION_FAILURE, e);
} catch (final TicketCreationException e) {
logger.warn("Invalid attempt to access service using renew=true with different credential. Ending SSO session.");
this.centralAuthenticationService.destroyTicketGrantingTicket(ticketGrantingTicketId);
} catch (final AbstractTicketException e) {
return newEvent(AbstractCasWebflowConfigurer.TRANSITION_ID_ERROR, e);
}
return newEvent(AbstractCasWebflowConfigurer.TRANSITION_ID_ERROR);
}
/**
* Create ticket granting ticket for the given credentials.
* Adds all warnings into the message context.
*
* @param context the context
* @param credential the credential
* @param messageContext the message context
* @return the resulting event.
* @since 4.1.0
*/
protected Event createTicketGrantingTicket(final RequestContext context, final Credential credential,
final MessageContext messageContext) {
try {
final Service service = WebUtils.getService(context);
final AuthenticationContextBuilder builder = new DefaultAuthenticationContextBuilder(
this.authenticationSystemSupport.getPrincipalElectionStrategy());
final AuthenticationTransaction transaction =
AuthenticationTransaction.wrap(credential);
this.authenticationSystemSupport.getAuthenticationTransactionManager().handle(transaction, builder);
final AuthenticationContext authenticationContext = builder.build(service);
final TicketGrantingTicket tgt = this.centralAuthenticationService.createTicketGrantingTicket(authenticationContext);
WebUtils.putTicketGrantingTicketInScopes(context, tgt);
WebUtils.putWarnCookieIfRequestParameterPresent(this.warnCookieGenerator, context);
putPublicWorkstationToFlowIfRequestParameterPresent(context);
if (addWarningMessagesToMessageContextIfNeeded(tgt, messageContext)) {
return newEvent(SUCCESS_WITH_WARNINGS);
}
return newEvent(AbstractCasWebflowConfigurer.TRANSITION_ID_SUCCESS);
} catch (final AuthenticationException e) {
logger.debug(e.getMessage(), e);
return newEvent(AUTHENTICATION_FAILURE, e);
} catch (final Exception e) {
logger.debug(e.getMessage(), e);
return newEvent(AbstractCasWebflowConfigurer.TRANSITION_ID_ERROR, e);
}
}
/**
* Add warning messages to message context if needed.
*
* @param tgtId the tgt id
* @param messageContext the message context
* @return true if warnings were found and added, false otherwise.
* @since 4.1.0
*/
protected boolean addWarningMessagesToMessageContextIfNeeded(final TicketGrantingTicket tgtId, final MessageContext messageContext) {
boolean foundAndAddedWarnings = false;
for (final Map.Entry<String, HandlerResult> entry : tgtId.getAuthentication().getSuccesses().entrySet()) {
for (final MessageDescriptor message : entry.getValue().getWarnings()) {
addWarningToContext(messageContext, message);
foundAndAddedWarnings = true;
}
}
return foundAndAddedWarnings;
}
/**
* Put public workstation into the flow if request parameter present.
*
* @param context the context
*/
private static void putPublicWorkstationToFlowIfRequestParameterPresent(final RequestContext context) {
if (StringUtils.isNotBlank(context.getExternalContext()
.getRequestParameterMap().get(PUBLIC_WORKSTATION_ATTRIBUTE))) {
context.getFlowScope().put(PUBLIC_WORKSTATION_ATTRIBUTE, Boolean.TRUE);
}
}
/**
* New event based on the given id.
*
* @param id the id
* @return the event
*/
private Event newEvent(final String id) {
return new Event(this, id);
}
/**
* New event based on the id, which contains an error attribute referring to the exception occurred.
*
* @param id the id
* @param error the error
* @return the event
*/
private Event newEvent(final String id, final Exception error) {
return new Event(this, id, new LocalAttributeMap("error", error));
}
/**
* Adds a warning message to the message context.
*
* @param context Message context.
* @param warning Warning message.
*/
private static void addWarningToContext(final MessageContext context, final MessageDescriptor warning) {
final MessageBuilder builder = new MessageBuilder()
.warning()
.code(warning.getCode())
.defaultText(warning.getDefaultMessage())
.args(warning.getParams());
context.addMessage(builder.build());
}
public void setCentralAuthenticationService(final CentralAuthenticationService centralAuthenticationService) {
this.centralAuthenticationService = centralAuthenticationService;
}
public void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
this.warnCookieGenerator = warnCookieGenerator;
}
public void setAuthenticationSystemSupport(final AuthenticationSystemSupport authenticationSystemSupport) {
this.authenticationSystemSupport = authenticationSystemSupport;
}
}
[ZoneTransfer]
ZoneId=3
| [
"liujl91@163.com"
] | liujl91@163.com |
a28c525f9a89cbd8f4d84075adea2d27b2e738f7 | d1eb1d815a9c4a5a030c7f5116b918e6efa4c859 | /src/main/java/com/zianedu/lms/dto/CalculateInfoDTO.java | 421bc92fc83dd8246dfc745db0441a021caacdf7 | [] | no_license | anjiho/zian-lms | ef91611efc956459dbdc3b967751125728792454 | 772ad0bc01ac5015273a17948418c546ac4408fb | refs/heads/master | 2021-06-29T05:57:26.569282 | 2019-09-18T03:10:00 | 2019-09-18T03:10:00 | 177,072,206 | 0 | 0 | null | 2020-10-13T12:33:24 | 2019-03-22T04:39:43 | JavaScript | UTF-8 | Java | false | false | 758 | java | package com.zianedu.lms.dto;
import com.zianedu.lms.utils.Util;
import lombok.Data;
@Data
public class CalculateInfoDTO {
private int gKey;
private String name;
private Long jKey;
private int type;
private int kind;
private int price;
private int couponDcPrice;
private int dcWelfare;
private int dcPoint;
private int dcFree;
private int calcCalculateRate;
private int gCalculateRate;
private int gTCalculateRate;
private int tCalculateRate;
private int jGCount;
private float payCharge;
private int pmType;
private int payStatus;
private int calcPrice;
private Long calculateKey;
private String indate = Util.returnNow();
private int jCount;
}
| [
"anjo0080@gmail.com"
] | anjo0080@gmail.com |
9311eab4b28f88ea308f7f1f01d01057a919d250 | 937b60443f5ea17232c42b039ea94ffdffc5fdd6 | /classes/Server/ChatServer.java | 9239a4730993fb778cf98ab82210b405d6621bc7 | [] | no_license | ppc-ntu-khpi/Sockets-Starter | d216b3d08389d1d389cac8055cd871959e65a840 | d14dfb4d8c49078d32e95bc554f44c8cffe5810d | refs/heads/master | 2022-10-07T12:46:46.394068 | 2020-06-05T16:09:45 | 2020-06-05T16:09:45 | 269,651,435 | 0 | 4 | null | 2020-06-05T13:46:44 | 2020-06-05T13:46:34 | null | UTF-8 | Java | false | false | 5,071 | java | import java.io.*;
import java.net.*;
import java.util.*;
import java.applet.*;
public class ChatServer {
public static void main(String[] args) {
ChatServer cs = new ChatServer();
cs.go();
}
public final static int DEFAULT_PORT = 2000;
public final static int DEFAULT_MAX_BACKLOG = 5;
public final static int DEFAULT_MAX_CONNECTIONS = 20;
public final static String DEFAULT_HOST_FILE = "hosts.txt";
public final static String DEFAULT_SOUND_FILE = "file:gong.au";
public final static String MAGIC = "Yippy Skippy";
private String magic = MAGIC;
private int port = DEFAULT_PORT;
private int backlog = DEFAULT_MAX_BACKLOG;
private int numConnections = 0;
private int maxConnections = DEFAULT_MAX_CONNECTIONS;
private String hostfile = DEFAULT_HOST_FILE;
private String soundfile = DEFAULT_SOUND_FILE;
private List<Connection> connections = null;
private AudioClip connectSound = null;
private Map<String,String> hostToStudentMap = null;
//
// Methods for the Connection class
//
String getMagicPassphrase() {
return magic;
}
String getStudentName(String host) {
return hostToStudentMap.get(host);
}
void sendToAllClients(String message) {
for ( Connection c : connections ) {
c.sendMessage(message);
}
}
void playMagicSound() {
if ( connectSound != null ) {
connectSound.play();
}
}
synchronized void closeConnection(Connection connection) {
connections.remove(connection);
numConnections--;
notify();
}
//
// Private methods
//
private void go() {
String portString = System.getProperty("port");
if (portString != null) port = Integer.parseInt(portString);
this.port = port;
String backlogString = System.getProperty("backlog");
if (backlogString != null) backlog = Integer.parseInt(backlogString);
String hostFileString = System.getProperty("hostfile");
if (hostFileString != null) hostfile = hostFileString;
String soundFileString = System.getProperty("soundfile");
if (soundFileString != null) soundfile = soundFileString;
String magicString = System.getProperty("magic");
if (magicString != null) magic = magicString;
String connections = System.getProperty("connections");
if (connections != null) maxConnections = Integer.parseInt(connections);
this.connections = new ArrayList<Connection>(maxConnections);
this.hostToStudentMap = new HashMap<String,String>(15);
System.out.println("Server settings:\n\tPort="+port+"\n\tMax Backlog="+
backlog+"\n\tMax Connections="+maxConnections+
"\n\tHost File="+hostfile+"\n\tSound File="+soundfile);
createHostList();
try {
URL sound = new URL(soundfile);
connectSound = Applet.newAudioClip(sound);
} catch(Exception e) {
e.printStackTrace();
}
// Begin the processing cycle
processRequests();
}
private void createHostList() {
File hostFile = new File(hostfile);
try {
System.out.println("Attempting to read hostfile hosts.txt: ");
FileInputStream fis = new FileInputStream(hostFile);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
String aLine = null;
while((aLine = br.readLine()) != null) {
int spaceIndex = aLine.indexOf(' ');
if (spaceIndex == -1) {
System.out.println("Invalid line in host file: "+aLine);
continue;
}
String host = aLine.substring(0,spaceIndex);
String student = aLine.substring(spaceIndex+1);
System.out.println("Read: "+student+"@"+host);
hostToStudentMap.put(host,student);
}
} catch(Exception e) {
e.printStackTrace();
}
}
private void processRequests() {
ServerSocket serverSocket = null;
Socket communicationSocket;
try {
System.out.println("Attempting to start server...");
serverSocket = new ServerSocket(port,backlog);
} catch (IOException e) {
System.out.println("Error starting server: Could not open port "+port);
e.printStackTrace();
System.exit(-1);
}
System.out.println ("Started server on port "+port);
// Run the listen/accept loop forever
while (true) {
try {
// Wait here and listen for a connection
communicationSocket = serverSocket.accept();
handleConnection(communicationSocket);
} catch (Exception e) {
System.out.println("Unable to spawn child socket.");
e.printStackTrace();
}
}
}
private synchronized void handleConnection(Socket connection) {
while (numConnections == maxConnections) {
try {
wait();
} catch(Exception e) {
e.printStackTrace();
}
}
numConnections++;
Connection con = new Connection(this, connection);
Thread t = new Thread(con);
t.start();
connections.add(con);
}
}
| [
"noreply@github.com"
] | ppc-ntu-khpi.noreply@github.com |
f2addc9f8bca4598d5649125ff56c22be3878c13 | 26e2530303f935d1fd1a939602666b38cb140d5d | /ihm_tp/src/serie05/model/filters/AbstractFilter.java | 620c8c28fc1592c9af11a402b6538fa88845423a | [] | no_license | addi18/IHM | 584b4937c982c023be37efd5e0e37b1f3d7e094a | 15f8b7f07d12c9c604814963bc5427397cb5cbb0 | refs/heads/main | 2023-03-27T22:16:03.269475 | 2021-03-24T11:49:38 | 2021-03-24T11:49:38 | 351,042,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,836 | java | package serie05.model.filters;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.List;
import util.Contract;
/**
* Implantation partielle des critères de filtrage.
*/
public abstract class AbstractFilter<E extends Filterable<V>, V>
implements Filter<E, V> {
// ATTRIBUTS
private final PropertyChangeSupport propSupport;
private V value;
// CONSTRUCTEURS
protected AbstractFilter(V initValue) {
Contract.checkCondition(initValue != null);
value = initValue;
propSupport = new PropertyChangeSupport(this);
}
// REQUETES
@Override
public List<E> filter(List<E> list) {
Contract.checkCondition(list != null);
List<E> result = new ArrayList<E>();
for (E e : list) {
if (isValid(e)) {
result.add(e);
}
}
return result;
}
@Override
public V getValue() {
return value;
}
@Override
public PropertyChangeListener[] getValueChangeListeners() {
return propSupport.getPropertyChangeListeners("value");
}
// COMMANDES
@Override
public void addValueChangeListener(PropertyChangeListener lst) {
if (lst == null) {
return;
}
propSupport.addPropertyChangeListener("value", lst);
}
@Override
public void removeValueChangeListener(PropertyChangeListener lst) {
if (lst == null) {
return;
}
propSupport.removePropertyChangeListener("value", lst);
}
@Override
public void setValue(V val) {
Contract.checkCondition(val != null);
V oldValue = value;
value = val;
propSupport.firePropertyChange("value", oldValue, value);
}
}
| [
"noreply@github.com"
] | addi18.noreply@github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.