blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
50f2b2bac8c6a07346592ad7ad2f743a5698dae1
818ca91fb1b4249160b510b6cdc980529dc8c420
/src/main/java/com/example/CarApp/domain/TripRepository.java
3a3e7fc0527dea274a37a8193098be8c9aff362e
[]
no_license
BasheerKH/CarApp
bb080a72c080bb2869db0657a817e72fb1730c10
ec938be6f498701f7c3664415d82f9b5f9dbc42c
refs/heads/master
2020-04-11T23:21:46.890122
2019-01-05T03:28:40
2019-01-05T03:28:40
162,164,528
0
0
null
null
null
null
UTF-8
Java
false
false
174
java
package com.example.CarApp.domain; import org.springframework.data.repository.CrudRepository; public interface TripRepository extends CrudRepository<Trip, Long>{ }
[ "Basheerkhlaif@gmail.com" ]
Basheerkhlaif@gmail.com
4e26f07b52fd19ec06917d978aa808b9d9cdd11f
4bdcf0014a8a52418c059389bd46de05dbe5d21a
/src/robillo/stack/Stack.java
ef70a2c2046ea167e1fd8178fccabadec297b446
[]
no_license
robillo/programming_questions
0b64d9982246044b49ff4832db4e6f0f7cd2ffd5
8456a1304fec636f25908bcc41f0d125f4ff3388
refs/heads/master
2021-05-05T14:40:18.413161
2018-12-04T03:00:12
2018-12-04T03:00:12
118,494,068
3
0
null
null
null
null
UTF-8
Java
false
false
1,111
java
package robillo.stack; //Linked List implemented as a stack import java.util.ArrayList; import java.util.List; public class Stack { int top; int capacity = 0; //to limit the number of elements to be inserted in the stack List<Integer> stack = new ArrayList<>(); public Stack(int capacity) { this.capacity = capacity; top = -1; } public void push(int item) { if(isFull()) return; stack.add(item); top++; } public void pop() { if(isEmpty()) return; if(stack.size()>= top){ stack.remove(top); top--; } } public int getTop() { return top; } public int getRear() { return stack.size()-1; } public int getTopValue() { return stack.get(top); } private boolean isFull() { return (stack.size() == capacity); } public boolean isEmpty() { return (stack.size() == 0); } public Object[] getArrayValues() { return stack.toArray(); } public int getStackSize() { return stack.size(); } }
[ "dev.robinkamboj@gmail.com" ]
dev.robinkamboj@gmail.com
c70d5e2c2764d02ac75dbd73030b94066ae6d5f8
a7020e7449ead95cf7cc3af058fb15e0515154fd
/src/app/Hrad40_TCP_伺服端.java
ee337b577fc4cbcb8002484d0a06f6fddbadcac3
[]
no_license
gorillaz18010589/tomcat_p_java_v1
7bf013aa11eaf4f590d89aee091f1c2ed556aab9
6034b6d8e312487a00e4828803b57534ce850baa
refs/heads/master
2021-01-02T07:10:38.733385
2020-02-10T15:16:39
2020-02-10T15:16:39
239,542,547
0
0
null
null
null
null
UTF-8
Java
false
false
1,711
java
package app; import java.io.InputStream; import java.net.InetAddress; //伺服器用串流方式 //java.net.ServerSocket.ServerSocket(int port) :伺服器端建立ServerSocket(port號) //java.net.ServerSocket.accept():伺服器端開始聽接收(回傳Socket) //java.net.Socket.getInetAddress()://取得對方ip(回傳InetAddress ) //java.net.Socket.getInputStream()://取得用戶端的訊息串流(回傳InputStream) //java.io.InputStream.read(byte[] b) //用串流方式read讀黨,當read讀黨部等於-1繼續讀(回傳int) //java.lang.String.String(byte[] bytes, int offset, int length)://String(buf資訊,從0開始,buf.lentgth檔案多打讀多大) //伺服器建立好後cmd打netstat /na,看是否出現7777port號,執行後出現7777 import java.net.ServerSocket; import java.net.Socket; public class Hrad40_TCP_伺服端 { public static void main(String[] args) { try { ServerSocket server = new ServerSocket(7777);//伺服器端建立ServerSocket(7777號) Socket socket = server.accept(); //伺服器端開始接收用戶端訊息 InputStream in = socket.getInputStream(); //取得用戶端的訊息串流,存入in InetAddress urip = socket.getInetAddress(); //取得對方ip int len; byte[] buf = new byte[1024]; //read(讀byte陣列) 回傳int:len while((len = in.read(buf))!= -1) { //用串流方式read讀黨,當read讀黨部等於-1繼續讀 System.out.println(urip + ":" + new String(buf, 0, buf.length)); //String(buf資訊,從0開始,buf.lentgth檔案多打讀多大) } server.close(); System.out.println("伺服器接收OK"); }catch (Exception e) { System.out.println(e.toString()); } } }
[ "gorillaz1801058@gmail.com" ]
gorillaz1801058@gmail.com
fc65082577684f3f8b7d4999d1dda663f86897f8
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5686313294495744_0/java/MathBunny123/ProblemC.java
cea916ed6291d394bb0b7e191de44e3acd63cd49
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Java
false
false
2,834
java
/* Programming Competition - Template (Horatiu Lazu) */ import java.io.*; import java.util.*; import java.lang.*; import java.awt.*; import java.awt.geom.*; import java.math.*; import java.text.*; class Main{ BufferedReader in; StringTokenizer st; public static void main (String [] args){ new Main(); } static class Priority implements Comparable<Priority>{ String a; String b; int p; public Priority(String a, String b, int p){ this.a = a; this.b = b; this.p = p; } public int compareTo(Priority o){ return o.p - p; } } public Main(){ try{ in = new BufferedReader(new FileReader("cSmall3.in")); PrintWriter out = new PrintWriter(new FileWriter("out.txt")); int T = nextInt(); for(int q = 0; q < T; q++){ int N = nextInt(); Priority[] arr = new Priority[N]; HashMap<String, Boolean> usedA = new HashMap<String, Boolean>(); HashMap<String, Boolean> usedB = new HashMap<String, Boolean>(); HashMap<String, Boolean> ex = new HashMap<String, Boolean>(); for(int qq = 0; qq < N; qq++){ String a = next(); String b = next(); if (usedA.get(a) == null && usedB.get(b) == null){ arr[qq] = new Priority(a, b, 0); } else{ arr[qq] = new Priority(a, b, 0); } usedA.put(a, true); usedB.put(b, true); } for(int qq = 0; qq < N; qq++){ if (usedA.get(arr[qq].a) != null && usedB.get(arr[qq].b)!=null){ arr[qq].p=0; } else if (usedA.get(arr[qq].a) != null || usedB.get(arr[qq].b)!=null){ arr[qq].p=1; } } Arrays.sort(arr); int counter = 0; usedA = new HashMap<String, Boolean>(); usedB = new HashMap<String, Boolean>(); ex = new HashMap<String, Boolean>(); for(int x = 0; x < arr.length; x++){ Priority temp = arr[x]; //System.out.println(temp.a + " " + temp.b); if (usedA.get(temp.a) != null && usedB.get(temp.b) != null && ex.get(temp.a + temp.b) == null){ //if (!(usedA.get(temp.a) == null && usedB.get(temp.b) == null)){ counter++; ex.put(temp.a + temp.b, true); //} } usedA.put(temp.a, true); usedB.put(temp.b, true); } out.println("Case #" + (q+1)+": " + counter); } out.close(); } catch(IOException e){ System.out.println("IO: General"); } } String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine().trim()); return st.nextToken(); } long nextLong() throws IOException { return Long.parseLong(next()); } int nextInt() throws IOException { return Integer.parseInt(next()); } double nextDouble() throws IOException { return Double.parseDouble(next()); } String nextLine() throws IOException { return in.readLine().trim(); } }
[ "alexandra1.back@gmail.com" ]
alexandra1.back@gmail.com
627305b1634d1301598fc7fc2ac19b2c0c18c378
12672a9b5914404ed63f24152326bfa4c8095b1b
/src/main/java/com/lostofthought/lostbot/Main.java
28add79821ff8052329f534688eafad26d8ecb83
[ "MIT" ]
permissive
LostOfBot/LostBot
3186bac5352c02833da6d2405548f446937e4b34
937d4df09ed1ef7a78e9cfb94c69b0bf00a330dc
refs/heads/main
2023-02-09T23:04:26.840672
2021-01-08T11:13:27
2021-01-08T11:13:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,847
java
package com.lostofthought.lostbot; import com.lostofthought.lostbot.EventHandlers.EventHandler; import com.lostofthought.util.*; import com.lostofthought.util.PriorityList; import discord4j.core.DiscordClient; import discord4j.core.GatewayDiscordClient; import discord4j.core.event.domain.*; import discord4j.core.event.domain.channel.*; import discord4j.core.event.domain.guild.*; import discord4j.core.event.domain.lifecycle.*; import discord4j.core.event.domain.message.*; import discord4j.core.event.domain.role.RoleCreateEvent; import discord4j.core.event.domain.role.RoleDeleteEvent; import discord4j.core.event.domain.role.RoleUpdateEvent; import discord4j.core.object.entity.User; import org.reflections.Reflections; import org.reflections.scanners.MethodAnnotationsScanner; import reactor.core.publisher.Mono; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import java.util.function.Function; public class Main { public static DiscordClient client; public static GatewayDiscordClient gateway; public static User self; @SuppressWarnings("unchecked") public static void main(String[] args){ final String token; try { token = new String(Files.readAllBytes(Paths.get("DISCORD_TOKEN")), StandardCharsets.UTF_8).trim(); } catch (IOException e) { e.printStackTrace(); System.out.println("" + "Failed to get discord token\n" + "Exiting..." ); return; } Map<Class<? extends Event>, PriorityList<Function<? extends Event, EventHandler.Action>>> eventHandlers = new HashMap<>(); Reflections reflections = new Reflections( "com.lostofthought", new MethodAnnotationsScanner()); reflections.getMethodsAnnotatedWith(com.lostofthought.lostbot.EventHandlers.EventHandler.class).forEach( handler -> { EventHandler annotation = handler.getAnnotation(EventHandler.class); if(annotation.disabled()){ return; } PriorityList<Function<? extends Event, EventHandler.Action>> priorityList = eventHandlers.computeIfAbsent((Class<? extends Event>) handler.getParameterTypes()[0], k -> new PriorityList<>()); priorityList.add( annotation.priority(), (Event event) -> { try { return (EventHandler.Action) handler.invoke(null, event); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return EventHandler.Action.Continue; } }); } ); final DiscordClient client = DiscordClient.create(token); final GatewayDiscordClient gateway = client.login().block(); if(gateway == null){ return; } gateway.on(Event.class).flatMap((Event e) -> { try { System.out.println(e); if(eventHandlers.containsKey(e.getClass())){ for (Function<? extends Event, EventHandler.Action> f : eventHandlers.get(e.getClass())) { EventHandler.Action a = f.apply(Cast.unchecked(e)); if(a == EventHandler.Action.RemoveAndContinue || a == EventHandler.Action.RemoveAndBreak){ PriorityList<?> list = eventHandlers.get(e.getClass()); if(list.size() <= 0){ eventHandlers.remove(e.getClass()); } } if(a == EventHandler.Action.Break || a == EventHandler.Action.RemoveAndBreak){ break; } } } } catch (Exception ex) { System.out.println("Exception: " + ex); } return Mono.empty(); }).subscribe(); gateway.onDisconnect().block(); } }
[ "lostofthought@gmail.com" ]
lostofthought@gmail.com
fa8f8bb600760cddf47cbefc5aaa8f36c38d4d66
86197b907c19d7b4551ad2772966852437dc533b
/SOAPNovcanikBanka/BankaService/src/service/Transakcija.java
c1e2d0fc9b96c9bdb2093e6df97b1a04d8a4e3eb
[]
no_license
PaneOdalovic/SOAPNovcanikBanka
826e93855002fb2b26e86dacb3c17f78c78d6b0c
a4d00c40250c15cd7f5575d106ba61cd81a214f6
refs/heads/master
2020-03-20T06:26:25.951947
2018-06-14T17:33:09
2018-06-14T17:33:09
137,248,937
0
0
null
null
null
null
UTF-8
Java
false
false
2,414
java
package service; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for transakcija complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="transakcija"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="datuma" type="{http://www.w3.org/2001/XMLSchema}dateTime"/&gt; * &lt;element name="iznos" type="{http://www.w3.org/2001/XMLSchema}double"/&gt; * &lt;element name="ulaz" type="{http://www.w3.org/2001/XMLSchema}boolean"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "transakcija", propOrder = { "datuma", "iznos", "ulaz" }) public class Transakcija { @XmlElement(required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar datuma; protected double iznos; protected boolean ulaz; /** * Gets the value of the datuma property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDatuma() { return datuma; } /** * Sets the value of the datuma property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDatuma(XMLGregorianCalendar value) { this.datuma = value; } /** * Gets the value of the iznos property. * */ public double getIznos() { return iznos; } /** * Sets the value of the iznos property. * */ public void setIznos(double value) { this.iznos = value; } /** * Gets the value of the ulaz property. * */ public boolean isUlaz() { return ulaz; } /** * Sets the value of the ulaz property. * */ public void setUlaz(boolean value) { this.ulaz = value; } }
[ "pane.odalovic@lightsoft.co.rs" ]
pane.odalovic@lightsoft.co.rs
ccbb19633f500aa623b7a8c8cad00e0993bb394d
c4dc2bc29c5590f1b8290b049d49a33c5973d4e4
/niubi-job-core/src/main/java/com/zuoxiaolong/niubi/job/core/helper/AssertHelper.java
3d183f88f096a3db2214212bc9136229f2b2fcb8
[ "Apache-2.0" ]
permissive
tangzhengyue/niubi-job
a2a6d14fe5e6fe44eb44600c20c7b46cdddc15ac
92d9647c8f5b599bd74091d8d8bbd01a435541fa
refs/heads/master
2021-01-20T18:45:12.498592
2016-01-20T12:30:36
2016-01-20T12:30:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
/* * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.zuoxiaolong.niubi.job.core.helper; /** * @author Xiaolong Zuo * @since 16/1/13 02:43 */ public abstract class AssertHelper { public static void notNull(Object o, String message) { if (o == null) { throw new IllegalArgumentException(message); } } public static void notEmpty(Object o, String message) { if (o == null || o.toString().trim().length() == 0) { throw new IllegalArgumentException(message); } } }
[ "xiaolong.zuo@jimubox.com" ]
xiaolong.zuo@jimubox.com
2f9750bf9944742e460b655a015e2c9fd828dbcb
55fd75151de7e7afb7118fe3cc0d49dff329645e
/src/minecraft/net/minecraft/block/BlockClay.java
dfb84604b1e690116a045011bbba977290c4c81e
[]
no_license
DraconisIra/MFBridge
ded956980905328a2d728c8f8f083e10d6638706
fa77fe09f2872b7feae52fb814e1920c98d10e91
refs/heads/master
2021-01-23T04:49:08.935654
2017-01-30T04:39:40
2017-01-30T04:39:40
80,393,957
2
0
null
null
null
null
UTF-8
Java
false
false
702
java
package net.minecraft.block; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class BlockClay extends Block { public BlockClay(int par1) { super(par1, Material.clay); this.setCreativeTab(CreativeTabs.tabBlock); } /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { return Item.clay.itemID; } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random par1Random) { return 4; } }
[ "mikal_500@yahoo.com.au" ]
mikal_500@yahoo.com.au
c6f181c4e04b0645e2d24769bf772b5a2b0ca5a4
d30de6af9e21ee20fd2b6ccccfd10915aec1fa7e
/src/main/java/by/bookmarket/service/UserService.java
3c338b626fd3dac82d72355aaee3875afed3acc1
[]
no_license
simonpirko/book-market-c34
ee02aca24ad72923fd2f598477652ec3a21e6bf0
78a641ee499681bc7c44d6bd28a2c122877b7fe5
refs/heads/main
2023-01-23T09:03:00.521756
2020-12-10T07:54:15
2020-12-10T07:54:15
311,369,648
0
6
null
2020-12-10T07:54:16
2020-11-09T14:45:09
Java
UTF-8
Java
false
false
2,815
java
package by.bookmarket.service; import by.bookmarket.dao.user.InMemoryUserDao; import by.bookmarket.dao.user.UserDaoDB; import by.bookmarket.entity.user.User; import by.bookmarket.errors.*; import java.util.List; public class UserService { private InMemoryUserDao iMUD = new InMemoryUserDao(); private UserDaoDB uDDB = new UserDaoDB(); public boolean synchronizedSave(User user) { if (iMUD.contains(user) && uDDB.contains(user)) { return false; } else { uDDB.save(user); iMUD.save(uDDB.getByUsername(user.getUsername())); } return true; } public void synchronizedDelete(long id) { if (iMUD.contains(id) && uDDB.contains(id)) { if (iMUD.getById(id).equals(uDDB.getById(id))) { iMUD.delete(id); uDDB.delete(id); } else { throw new UsersByIdDoesntMatch(); } } else { throw new IdDoesntExist(); } } public void synchronizedUpdateName(String newName, long id) { if (iMUD.contains(id) && uDDB.contains(id)) { if (iMUD.getById(id).equals(uDDB.getById(id))) { iMUD.updateName(newName, id); uDDB.updateName(newName, id); } else { throw new UsersByIdDoesntMatch(); } } else { throw new IdDoesntExist(); } } public void synchronizedUpdatePassword(String newPassword, long id) { if (iMUD.contains(id) && uDDB.contains(id)) { if (iMUD.getById(id).equals(uDDB.getById(id))) { iMUD.updatePassword(newPassword, id); uDDB.updatePassword(newPassword, id); } else { throw new UsersByIdDoesntMatch(); } } else { throw new IdDoesntExist(); } } public List<User> getAllFromInMemory() { if (iMUD.getAll().isEmpty()) { throw new IsEmptyException(); } return iMUD.getAll(); } public List<User> getAllFromDB() { if (uDDB.getAll().isEmpty()) { throw new IsEmptyException(); } return uDDB.getAll(); } public void synchronize() { iMUD.save(uDDB.getAll()); } public User getByUsernameFromInMemory(String username) { if (iMUD.getByUsername(username) == null) { throw new UserByUsernameDoesntExist(); } return iMUD.getByUsername(username); } public User getByIdFromInMemory(long id) { if (iMUD.getById(id) == null) { throw new UsersByIdDoesntMatch(); } return iMUD.getById(id); } public boolean contains(String username) { return iMUD.contains(username); } }
[ "noximt@gmail.com" ]
noximt@gmail.com
7b24e66485334069a953f35f6021d017e20293be
7dbbf698227e3943a54b025350f032524e883dd7
/recyclerviewfinalapp/src/main/java/com/example/recyclerviewfinalapp/interfaces/OnItemClickListener.java
ecd5b30cf7e9728a76d26541223f0ae2ca5a78e7
[]
no_license
YugandharVadlamudi/MaterialDesignApplication
492c9f724bee600a3e5f0a6f9561a667158530a8
57f7c9f3dde708729b0e048f8c2ae6c50787768f
refs/heads/master
2020-04-10T21:03:14.736322
2016-09-15T10:37:18
2016-09-15T10:37:18
68,274,217
0
1
null
null
null
null
UTF-8
Java
false
false
211
java
package com.example.recyclerviewfinalapp.interfaces; import android.view.View; /** * Created by Kiran on 08-06-2016. */ public interface OnItemClickListener { public void onItemClickListener(View v); }
[ "yugandhardcs21@gmail.com" ]
yugandhardcs21@gmail.com
2625b44233945607ef77e7bc0841b09ce9e591aa
8bcfea9936a4ca147948a2a77be435ac1bfa2566
/src/main/java/dataAccess/TraingSurveysAcces.java
3ec5825ea732a22d120a374be05527b87bfbb028
[]
no_license
SoftwareProjectIIGroep4/java
8e0d5d037a993bb283717a9b63dd7b4aa0fd180f
51f623a49dffe5b8c0b86f470def0eccd00e45b9
refs/heads/master
2021-05-15T09:29:55.952233
2017-12-24T11:59:57
2017-12-24T11:59:57
108,137,863
0
0
null
2017-12-25T07:05:04
2017-10-24T14:22:56
Java
UTF-8
Java
false
false
2,118
java
package dataAccess; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.List; import com.fasterxml.jackson.core.type.TypeReference; import models.Address; import models.TrainigSurvey; //TODO public class TraingSurveysAcces extends RestRequest { public static TrainigSurvey get(TrainigSurvey traingSurveys) throws IOException, URISyntaxException { String JSONts = getAllOrOne(new URI(Constants.TRAINING_SURVEYS_SOURCE)); TrainigSurvey NTraingSurvey = mapper.readValue(JSONts, TrainigSurvey.class); return NTraingSurvey; } public static HashMap<Integer, TrainigSurvey> getAll() throws IOException, URISyntaxException { String JSONts = getAllOrOne(new URI(Constants.TRAINING_SURVEYS_SOURCE)); List<TrainigSurvey> traingSurveys = mapper.readValue(JSONts, new TypeReference<List<TrainigSurvey>>() { }); HashMap<Integer, TrainigSurvey> traingSurveysMap = new HashMap<Integer, TrainigSurvey>(); for (TrainigSurvey traingSurvey : traingSurveys) { traingSurveysMap.put(traingSurvey.getSurveyId(), traingSurvey); } return traingSurveysMap; } public static TrainigSurvey add(TrainigSurvey trainigSurvey) throws IOException, URISyntaxException { String JSONts = postObject(trainigSurvey, new URI(Constants.TRAINING_SURVEYS_SOURCE)); return mapper.readValue(JSONts, TrainigSurvey.class); } public static void update(TrainigSurvey trainigSurvey) throws URISyntaxException, IOException { putObject(trainigSurvey, new URI(Constants.TRAINING_SURVEYS_SOURCE + trainigSurvey.getSurveyId())); } public static TrainigSurvey remove(Integer id) throws URISyntaxException, IOException { String JSONts = deleteObject(id, new URI(Constants.TRAINING_SURVEYS_SOURCE + id)); return mapper.readValue(JSONts, TrainigSurvey.class); } public static TrainigSurvey getBySurveyId(Integer id) throws IOException, URISyntaxException { String JSONts = getAllOrOne(new URI(Constants.TRAINING_SURVEYS_SOURCE+"/"+id)); TrainigSurvey NTraingSurvey = mapper.readValue(JSONts, TrainigSurvey.class); return NTraingSurvey; } }
[ "ruben.de.neckere@student.ehb.be" ]
ruben.de.neckere@student.ehb.be
874a4159b9706fd7274735e44880a189b538b49d
f76a042a9cfe3462bb90079a96d883719f6f856f
/src/main/java/com/koory1st/spring/beanAnnotationAutowire/AutowireDao.java
a650a9f34dbe0cedd2f9cf5a3d363030d611a104
[]
no_license
koory1st/spring_practice
2f30170540d3d42989dedc905f7ec68c452074eb
401d9d7c5d79417dca1da1dca0b05e0d4f4ff669
refs/heads/master
2020-03-26T07:35:48.256055
2018-09-06T10:03:27
2018-09-06T10:03:27
144,661,699
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package com.koory1st.spring.beanAnnotationAutowire; import org.springframework.stereotype.Repository; @Repository public class AutowireDao { public void say(String word) { System.out.println("AutowireDao:" + word); } }
[ "32436334@qq.com" ]
32436334@qq.com
1767d29d562a8b88111864b9e9e3b11981526538
b75978e8071489559190c369f77971c8523d4bb6
/controller/src/main/java/fr/lesoiseauxdemer/controller/AccueilController.java
62aed4125aff2fa5bbb0bb903fdd94edcf728e88
[]
no_license
jeromelebaron/les_oiseaux_de_mer
944d4be4e22b4d5a3b3c81ab9ba49363fb7628a9
2ef3ce11cd19db1832339b2d9429d6b42aca5cc3
refs/heads/master
2021-09-05T20:03:42.158525
2018-01-30T19:00:17
2018-01-30T19:00:17
116,711,561
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package fr.lesoiseauxdemer.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import fr.lesoiseauxdemer.service.interfaces.IAccueilService; /** * Le controller de la page d'accueil. * * @author Jerome */ @RestController public class AccueilController { @Autowired private IAccueilService accueil; @GetMapping(value = "/") public String getPageAcceuil() { return getAccueil().getMessageAccueil(); } public IAccueilService getAccueil() { return accueil; } }
[ "lebaronjerome@free.fr" ]
lebaronjerome@free.fr
2cd0c7cebc2b77ac7bde91426fab3c76e6e90801
410054f990b8e4d9c1b48c7c842a0d337d357e49
/CoordinatorTabLayout-master/coordinatortablayout/src/main/java/cn/hugeterry/coordinatortablayout/CoordinatorTabLayout.java
fc9892a7e4b5566fedce7088bfe894a17983a79e
[ "Apache-2.0" ]
permissive
yesl0210/Own-memorizing-app
5643495527dc21d875675a0dba74f8a234d13718
16e321b7b4a8625ef55fbe1dfaf5a156fccec995
refs/heads/master
2020-05-05T11:02:41.356057
2019-05-28T09:19:50
2019-05-28T09:19:50
179,972,312
1
1
null
null
null
null
UTF-8
Java
false
false
11,283
java
package cn.hugeterry.coordinatortablayout; import android.app.Activity; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Color; import android.os.Build; import android.support.annotation.NonNull; import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.TabLayout; import android.support.v4.content.ContextCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.AttributeSet; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.view.animation.AnimationUtils; import android.widget.ImageView; import cn.hugeterry.coordinatortablayout.listener.LoadHeaderImagesListener; import cn.hugeterry.coordinatortablayout.listener.OnTabSelectedListener; import cn.hugeterry.coordinatortablayout.utils.SystemView; /** * @author hugeterry(http://hugeterry.cn) */ public class CoordinatorTabLayout extends CoordinatorLayout { private int[] mImageArray, mColorArray; private Context mContext; private Toolbar mToolbar; private ActionBar mActionbar; private TabLayout mTabLayout; private ImageView mImageView; private CollapsingToolbarLayout mCollapsingToolbarLayout; private LoadHeaderImagesListener mLoadHeaderImagesListener; private OnTabSelectedListener mOnTabSelectedListener; public CoordinatorTabLayout(Context context) { super(context); mContext = context; } public CoordinatorTabLayout(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; if (!isInEditMode()) { initView(context); initWidget(context, attrs); } } public CoordinatorTabLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mContext = context; if (!isInEditMode()) { initView(context); initWidget(context, attrs); } } private void initView(Context context) { LayoutInflater.from(context).inflate(R.layout.view_coordinatortablayout, this, true); initToolbar(); mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsingtoolbarlayout); mTabLayout = (TabLayout) findViewById(R.id.tabLayout); mImageView = (ImageView) findViewById(R.id.imageview); } private void initWidget(Context context, AttributeSet attrs) { TypedArray typedArray = context.obtainStyledAttributes(attrs , R.styleable.CoordinatorTabLayout); TypedValue typedValue = new TypedValue(); mContext.getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true); int contentScrimColor = typedArray.getColor( R.styleable.CoordinatorTabLayout_contentScrim, typedValue.data); mCollapsingToolbarLayout.setContentScrimColor(contentScrimColor); int tabIndicatorColor = typedArray.getColor(R.styleable.CoordinatorTabLayout_tabIndicatorColor, Color.WHITE); mTabLayout.setSelectedTabIndicatorColor(tabIndicatorColor); int tabTextColor = typedArray.getColor(R.styleable.CoordinatorTabLayout_tabTextColor, Color.WHITE); mTabLayout.setTabTextColors(ColorStateList.valueOf(tabTextColor)); typedArray.recycle(); } private void initToolbar() { mToolbar = (Toolbar) findViewById(R.id.toolbar); ((AppCompatActivity) mContext).setSupportActionBar(mToolbar); mActionbar = ((AppCompatActivity) mContext).getSupportActionBar(); } /** * 设置Toolbar标题 * * @param title 标题 * @return CoordinatorTabLayout */ public CoordinatorTabLayout setTitle(String title) { if (mActionbar != null) { mActionbar.setTitle(title); } return this; } /** * 设置Toolbar显示返回按钮及标题 * * @param canBack 是否返回 * @return CoordinatorTabLayout */ public CoordinatorTabLayout setBackEnable(Boolean canBack) { if (canBack && mActionbar != null) { mActionbar.setDisplayHomeAsUpEnabled(true); mActionbar.setHomeAsUpIndicator(R.drawable.ic_arrow_white_24dp); } return this; } /** * 设置每个tab对应的头部图片 * * @param imageArray 图片数组 * @return CoordinatorTabLayout */ public CoordinatorTabLayout setImageArray(@NonNull int[] imageArray) { mImageArray = imageArray; return this; } /** * 设置每个tab对应的头部照片和ContentScrimColor * * @param imageArray 图片数组 * @param colorArray ContentScrimColor数组 * @return CoordinatorTabLayout */ public CoordinatorTabLayout setImageArray(@NonNull int[] imageArray, @NonNull int[] colorArray) { mImageArray = imageArray; mColorArray = colorArray; return this; } /** * 设置每个tab对应的ContentScrimColor * * @param colorArray 图片数组 * @return CoordinatorTabLayout */ public CoordinatorTabLayout setContentScrimColorArray(@NonNull int[] colorArray) { mColorArray = colorArray; return this; } private void setupTabLayout() { mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { mImageView.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.anim_dismiss)); if (mLoadHeaderImagesListener == null) { if (mImageArray != null) { mImageView.setImageResource(mImageArray[tab.getPosition()]); } } else { mLoadHeaderImagesListener.loadHeaderImages(mImageView, tab); } if (mColorArray != null) { mCollapsingToolbarLayout.setContentScrimColor( ContextCompat.getColor( mContext, mColorArray[tab.getPosition()])); } mImageView.setAnimation(AnimationUtils.loadAnimation(mContext, R.anim.anim_show)); if (mOnTabSelectedListener != null) { mOnTabSelectedListener.onTabSelected(tab); } } @Override public void onTabUnselected(TabLayout.Tab tab) { if (mOnTabSelectedListener != null) { mOnTabSelectedListener.onTabUnselected(tab); } } @Override public void onTabReselected(TabLayout.Tab tab) { if (mOnTabSelectedListener != null) { mOnTabSelectedListener.onTabReselected(tab); } } }); } /** * 设置TabLayout TabMode * * @param mode * @return CoordinatorTabLayout */ public CoordinatorTabLayout setTabMode(@TabLayout.Mode int mode) { mTabLayout.setTabMode(mode); return this; } /** * 设置与该组件搭配的ViewPager * * @param viewPager 与TabLayout结合的ViewPager * @return CoordinatorTabLayout */ public CoordinatorTabLayout setupWithViewPager(ViewPager viewPager) { setupTabLayout(); mTabLayout.setupWithViewPager(viewPager); return this; } /** * 获取该组件中的ActionBar */ public ActionBar getActionBar() { return mActionbar; } /** * 获取该组件中的TabLayout */ public TabLayout getTabLayout() { return mTabLayout; } /** * 获取该组件中的ImageView */ public ImageView getImageView() { return mImageView; } /** * 设置LoadHeaderImagesListener * * @param loadHeaderImagesListener 设置LoadHeaderImagesListener * @return CoordinatorTabLayout */ public CoordinatorTabLayout setLoadHeaderImagesListener(LoadHeaderImagesListener loadHeaderImagesListener) { mLoadHeaderImagesListener = loadHeaderImagesListener; return this; } /** * 设置onTabSelectedListener * * @param onTabSelectedListener 设置onTabSelectedListener * @return CoordinatorTabLayout */ public CoordinatorTabLayout addOnTabSelectedListener(OnTabSelectedListener onTabSelectedListener) { mOnTabSelectedListener = onTabSelectedListener; return this; } /** * 设置透明状态栏 * * @param activity 当前展示的activity * @return CoordinatorTabLayout */ public CoordinatorTabLayout setTranslucentStatusBar(@NonNull Activity activity) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return this; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { activity.getWindow().setStatusBarColor(Color.TRANSPARENT); activity.getWindow() .getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { activity.getWindow() .setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } if (mToolbar != null) { ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) mToolbar.getLayoutParams(); layoutParams.setMargins( layoutParams.leftMargin, layoutParams.topMargin + SystemView.getStatusBarHeight(activity), layoutParams.rightMargin, layoutParams.bottomMargin); } return this; } /** * 设置沉浸式 * * @param activity 当前展示的activity * @return CoordinatorTabLayout */ public CoordinatorTabLayout setTranslucentNavigationBar(@NonNull Activity activity) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return this; } else { mToolbar.setPadding(0, SystemView.getStatusBarHeight(activity) >> 1, 0, 0); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); activity.getWindow().setStatusBarColor(Color.TRANSPARENT); } else { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } return this; } }
[ "32731032+pkhssy@users.noreply.github.com" ]
32731032+pkhssy@users.noreply.github.com
ff58bfb58d6a9c372d3b3b953e37e4e27a2c8148
14b5415b4a0125c37811157183602a1983126a64
/src/main/java/com/zws/datastruct/tree/binarytree/ArrBinaryTree.java
0c3a2daf91896af68dfeb1d21549f8472cee7e57
[]
no_license
zws-io/DataStructures
cdf487ce10e01e3ac283641a39f082a667b154a9
4c8052f429f15058be207a6de24980cb02d57db3
refs/heads/master
2022-12-22T16:59:53.827221
2020-03-11T09:54:25
2020-03-11T09:54:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,673
java
package com.zws.datastruct.tree.binarytree; /** * @author zhengws * @date 2019-11-02 09:21 */ public class ArrBinaryTree { private int[] arr; public ArrBinaryTree(int[] arr) { this.arr = arr; } /** * 前序遍历 * 左子节点 2 * n + 1 * 右子节点 2 * n + 2 */ public void preOrder() { checkEmptyArr(); preOrderPrint(0); } private void preOrderPrint(int index) { if (checkIndexRange(index)) { System.out.println(arr[index]); //遍历左子节点 preOrderPrint(2 * index + 1); //遍历右子节点 preOrderPrint(2 * index + 2); } } private void checkEmptyArr() { if (arr == null || arr.length == 0) { throw new RuntimeException("arr is empty"); } } private boolean checkIndexRange(int index) { if (index < 0 || index >= arr.length) { return false; } return true; } /** * 后序遍历 */ public void postOrder() { checkEmptyArr(); postOrderPrint(0); } private void postOrderPrint(int index) { if (checkIndexRange(index)) { //遍历左子节点 postOrderPrint(2 * index + 1); //遍历右子节点 postOrderPrint(2 * index + 2); System.out.println(arr[index]); } } /** * 中序遍历 */ public void infixOrder() { checkEmptyArr(); infixOrderPrint(0); } private void infixOrderPrint(int index) { if (checkIndexRange(index)) { //遍历左子节点 infixOrderPrint(2 * index + 1); System.out.println(arr[index]); //遍历右子节点 infixOrderPrint(2 * index + 2); } } public static void main(String[] args) { int[] arr = {1,2,3,4,5,6,7}; ArrBinaryTree tree = new ArrBinaryTree(arr); System.out.println("#######preOrder########"); tree.preOrder(); System.out.println("#######postOrder########"); tree.postOrder(); System.out.println("#######infixOrder########"); tree.infixOrder(); /** * 输出: * #######preOrder######## * 1 * 2 * 4 * 5 * 3 * 6 * 7 * #######postOrder######## * 4 * 5 * 2 * 6 * 7 * 3 * 1 * #######infixOrder######## * 4 * 2 * 5 * 1 * 6 * 3 * 7 */ } }
[ "zhengws@wangsu.com" ]
zhengws@wangsu.com
85ea36b8f695ed05b2189624b38777d40d1ec317
8137ff5c965c1162db211cc6bed72164b79a18fd
/mail/common/src/main/java/com/fsck/k9m_m/mail/message/MessageHeaderParser.java
5f5cbfddbf38ede6636e2a7916e72ad8085b2b9e
[ "Apache-2.0" ]
permissive
EverlastingHopeX/K-9-Modularization
f1095984c08d9e711547a8d4d64c88f665cda27b
f611b289828f5b1f27d4274af76c0082c119dec0
refs/heads/master
2021-07-04T21:05:57.923497
2021-02-10T23:28:01
2021-02-10T23:28:01
226,972,945
0
0
null
null
null
null
UTF-8
Java
false
false
3,343
java
package com.fsck.k9m_m.mail.message; import java.io.IOException; import java.io.InputStream; import com.fsck.k9m_m.mail.MessagingException; import com.fsck.k9m_m.mail.Part; import org.apache.james.mime4j.MimeException; import org.apache.james.mime4j.parser.ContentHandler; import org.apache.james.mime4j.parser.MimeStreamParser; import org.apache.james.mime4j.stream.BodyDescriptor; import org.apache.james.mime4j.stream.Field; import org.apache.james.mime4j.stream.MimeConfig; public class MessageHeaderParser { public static void parse(final Part part, InputStream headerInputStream) throws MessagingException { MimeStreamParser parser = getMimeStreamParser(); parser.setContentHandler(new MessageHeaderParserContentHandler(part)); try { parser.parse(headerInputStream); } catch (MimeException me) { throw new MessagingException("Error parsing headers", me); } catch (IOException e) { throw new MessagingException("I/O error parsing headers", e); } } private static MimeStreamParser getMimeStreamParser() { MimeConfig parserConfig = new MimeConfig.Builder() .setMaxHeaderLen(-1) .setMaxLineLen(-1) .setMaxHeaderCount(-1) .build(); return new MimeStreamParser(parserConfig); } private static class MessageHeaderParserContentHandler implements ContentHandler { private final Part part; public MessageHeaderParserContentHandler(Part part) { this.part = part; } @Override public void field(Field rawField) throws MimeException { String name = rawField.getName(); String raw = rawField.getRaw().toString(); part.addRawHeader(name, raw); } @Override public void startMessage() throws MimeException { /* do nothing */ } @Override public void endMessage() throws MimeException { /* do nothing */ } @Override public void startBodyPart() throws MimeException { /* do nothing */ } @Override public void endBodyPart() throws MimeException { /* do nothing */ } @Override public void startHeader() throws MimeException { /* do nothing */ } @Override public void endHeader() throws MimeException { /* do nothing */ } @Override public void preamble(InputStream is) throws MimeException, IOException { /* do nothing */ } @Override public void epilogue(InputStream is) throws MimeException, IOException { /* do nothing */ } @Override public void startMultipart(BodyDescriptor bd) throws MimeException { /* do nothing */ } @Override public void endMultipart() throws MimeException { /* do nothing */ } @Override public void body(BodyDescriptor bd, InputStream is) throws MimeException, IOException { /* do nothing */ } @Override public void raw(InputStream is) throws MimeException, IOException { /* do nothing */ } } }
[ "491032242@qq.com" ]
491032242@qq.com
372d83d338c4f31c99cfc1c087d306a885c72f52
ee08098f08b3dad9bc80404c15209e91d632a486
/src/main/java/com/example/htmlEventsController.java
f07582837b23ac8e65f588e833f808057043cd77
[]
no_license
yusufcoban/GroupEventManagerSite
6d7fdc79c13f735dd72ddb915a93a2714e4d7ef0
c843f5f8fbde46c1b6d07ed6762491000bf7c9b9
refs/heads/master
2021-07-05T12:09:55.649373
2017-09-29T15:54:42
2017-09-29T15:54:42
105,289,614
0
0
null
null
null
null
ISO-8859-1
Java
false
false
8,240
java
package com.example; import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @Controller @RequestMapping("events") public class htmlEventsController { @Autowired public eventDao eventsController; @Autowired public userDao userController; @Autowired public sportartenDao sportController; @RequestMapping(method = RequestMethod.GET) public String user(ModelMap modelmap) { user logged = getcurrentuser(); Iterable<events> eventtester = eventsController.findAll(); Set<events> kompletteListe = new HashSet<events>((Collection) eventtester); Set<events> vergleichsListe = logged.getEventSet(); kompletteListe.removeAll(vergleichsListe); modelmap.put("eventListe", kompletteListe); int id = getcurrentuser().getUserid(); if (id <= 1) { Iterable<sportarten> sportart = sportController.findAll(); modelmap.addAttribute("sportarten", sportart); return "events_admin"; } if (id == 4) { return "events"; } else return "events_user"; } // Details über das Event @RequestMapping("/details") public String getinfos(@RequestParam int id, ModelMap modelmap) { events event = eventsController.findOne(id); modelmap.put("eventListe", event); modelmap.put("userListe", event.getUser()); modelmap.put("infos", event.getInfos()); modelmap.put("austragen", "/events/invent?id=" + event.getEventid()); modelmap.put("eintragen", "/events/expend?id=" + event.getEventid()); user current = getcurrentuser(); // NEU boolean syso=current.getEventSet().contains(event); System.out.println(syso); if (current.getEventSet().contains(event)) { modelmap.put("status", "ja"); } else modelmap.put("status", "nein"); int ids = getcurrentuser().getUserid(); if (ids <= 1) { return "eventdetails_admin"; } if (ids == 4) { return "eventdetails"; } return "eventdetails_user"; // GEHT LAKa } // Event löschen @RequestMapping("/delete") public String delete(@RequestParam int id, ModelMap modelmap) throws MessagingException { events event = eventsController.findOne(id); System.out.println(event.getEventid() + "gelöscht!"); sendmail(event, "gelöscht"); eventsController.delete(event); modelmap.put("eventListe", event); return "redirect://localhost:7777/events.html"; } @RequestMapping("/update") public String update(@RequestParam int id, ModelMap modelmap) { events event = eventsController.findOne(id); modelmap.put("eventListe", event); return "eventdetails"; // GEHT LAK } // Eintragen @RequestMapping(value = "/invent", method = RequestMethod.GET) public String invevent(@RequestParam int id, ModelMap modelmap, HttpServletResponse http) throws MessagingException { user logged = getcurrentuser(); events event = eventsController.findOne(id); Set<events> listetester = logged.getEventSet(); events naaa = eventsController.findOne(id); // WENN VOLL DANN NIEMAND NEILASSEN if (event.getmaxspieler() == event.getUser().size()) { return "redirect://localhost:7777/events.html"; } if (listetester.contains(naaa)) { System.out.println("Bist schon Mitglied"); modelmap.put("eventListe", logged.getEventSet()); return "redirect://localhost:7777/events.html"; // Kann nicht mehr passieren } else { listetester.add(event); logged.setEventSet(listetester); userController.save(logged); modelmap.put("eventListe", logged.getEventSet()); // sendmail(naaa, "hinzugefügt"); sendmail(event); return "redirect://localhost:7777/events.html"; } } // Austragen @RequestMapping(value = "/expend", method = RequestMethod.GET) public String expend(@RequestParam int id, ModelMap modelmap, HttpServletResponse http, HttpServletResponse httpServletResponse) { user logged = getcurrentuser(); try { sendmail_neg(eventsController.findOne(id)); } catch (MessagingException e) { // TODO Auto-generated catch block e.printStackTrace(); } Set<events> neueliste = logged.getEventSet(); neueliste.remove(eventsController.findOne(id)); userController.save(logged); return "redirect://localhost:7777/myevents.html"; } // get logged User public user getcurrentuser() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); String name = auth.getName(); user logged = userController.findOne(Integer.parseInt(name)); return logged; } // Mail Sender universal public void sendmail(events events, String inhalt) throws MessagingException { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(AppConfig.class); ctx.refresh(); JavaMailSenderImpl mailSender = ctx.getBean(JavaMailSenderImpl.class); MimeMessage mimeMessage = mailSender.createMimeMessage(); MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage); for (user a : events.getUserliste()) { mailMsg.setFrom("projektserverhsesslingen@gmail.com"); mailMsg.setTo(a.getEmail()); mailMsg.setSubject("Event wurde " + inhalt + "..."); mailMsg.setText("EVENT mit der ID: " + events.getEventid() + " wurde " + inhalt + "...."); mailSender.send(mimeMessage); System.out.println("---Done---"); } } // Mail Sender eintragen public void sendmail(events events) throws MessagingException { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(AppConfig.class); ctx.refresh(); JavaMailSenderImpl mailSender = ctx.getBean(JavaMailSenderImpl.class); MimeMessage mimeMessage = mailSender.createMimeMessage(); MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage); for (user a : events.getUserliste()) { mailMsg.setFrom("SPOGROMA"); mailMsg.setTo("projektserverhsesslingen@gmail.com"); mailMsg.setSubject("Event " + events.getEventid() + " hat ein neues Mitglied"); mailMsg.setText("Benutzer mit der ID:" + getcurrentuser().getUserid() + "hat sich in das Event mit der ID: " + events.getEventid() + "eingetragen"); mailSender.send(mimeMessage); System.out.println("---Done---"); } } // Mail Sender austragen public void sendmail_neg(events events) throws MessagingException { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(AppConfig.class); ctx.refresh(); JavaMailSenderImpl mailSender = ctx.getBean(JavaMailSenderImpl.class); MimeMessage mimeMessage = mailSender.createMimeMessage(); MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage); for (user a : events.getUserliste()) { mailMsg.setFrom("SPOGROMA"); mailMsg.setTo("projektserverhsesslingen@gmail.com"); mailMsg.setSubject("Event " + events.getEventid() + " hat einen Mitglied weniger"); mailMsg.setText("Benutzer mit der ID:" + getcurrentuser().getUserid() + "hat sich aus den Event mit der ID: " + events.getEventid() + " ausgetragen"); mailSender.send(mimeMessage); System.out.println("---Done---"); } } // Daten Datum @InitBinder public void initBinder(WebDataBinder webDataBinder) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); dateFormat.setLenient(false); webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); } }
[ "coban.yusuf.hassan@gmail.com" ]
coban.yusuf.hassan@gmail.com
b90eddc608e3a9f985600efe29ec008292aa95cd
8176ef7683bd30f7412eac5d3393518026fbb217
/app/src/main/java/com/bharatarmy/Activity/ImageVideoPrivacyActivity.java
6057d4276f10c5e7ce01e8ad693c7be8bff62ffe
[]
no_license
gitbharatarmy/BharatArmy
39265097ca24aa07d5dcd714dc6cf5bde7dc6e67
aac64f88c8a25b7da144f8222986994d9fc8e738
refs/heads/master
2021-07-23T00:22:28.924033
2020-05-29T14:27:20
2020-05-29T14:27:20
179,429,853
0
0
null
null
null
null
UTF-8
Java
false
false
5,582
java
package com.bharatarmy.Activity; import androidx.appcompat.app.AppCompatActivity; import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Context; import android.os.Bundle; import android.text.Html; import android.util.Log; import android.view.View; import com.bharatarmy.Adapter.ImageVideoPrivacyAdapter; import com.bharatarmy.Interfaces.MorestoryClick; import com.bharatarmy.Models.GalleryImageModel; import com.bharatarmy.Models.MyScreenChnagesModel; import com.bharatarmy.R; import com.bharatarmy.databinding.ActivityImageVideoPrivacyBinding; import org.greenrobot.eventbus.EventBus; import java.util.ArrayList; import java.util.List; public class ImageVideoPrivacyActivity extends AppCompatActivity implements View.OnClickListener { ActivityImageVideoPrivacyBinding activityImageVideoPrivacyBinding; Context mContext; ImageVideoPrivacyAdapter imageVideoPrivacyAdapter; List<GalleryImageModel> privacyoptionList; int selectedposition = -1; String privacyStr,headertxt,subtxt,privacytagStr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activityImageVideoPrivacyBinding = DataBindingUtil.setContentView(this, R.layout.activity_image_video_privacy); mContext = ImageVideoPrivacyActivity.this; init(); setListiner(); } public void init() { privacyStr=getIntent().getStringExtra("privacytxt"); privacytagStr =getIntent().getStringExtra("privacytype"); if (privacytagStr.equalsIgnoreCase("Image")){ privacyoptionList = new ArrayList<GalleryImageModel>(); privacyoptionList.add(new GalleryImageModel(getResources().getString(R.string.photo_public_option_Imageheader_txt), getResources().getString(R.string.photo_public_option_Imagesub_txt), R.drawable.ic_aboutus, "1")); privacyoptionList.add(new GalleryImageModel(getResources().getString(R.string.photo_private_option_Imageheader_txt), getResources().getString(R.string.photo_private_option_Imagesub_txt), R.drawable.ic_private_user, "0")); activityImageVideoPrivacyBinding.privacyHeaderTxt.setText(getResources().getString(R.string.photo_privacy_Imageheader_txt)); activityImageVideoPrivacyBinding.privacySubTxt.setText(getResources().getString(R.string.photo_privacy_Imagesub_txt)); activityImageVideoPrivacyBinding.privacyLinkTxt.setText(Html.fromHtml("<u>"+getResources().getString(R.string.photo_privacy_Imagetxt)+"<u>")); }else{ privacyoptionList = new ArrayList<GalleryImageModel>(); privacyoptionList.add(new GalleryImageModel(getResources().getString(R.string.photo_public_option_videoheader_txt), getResources().getString(R.string.photo_public_option_videosub_txt), R.drawable.ic_aboutus, "1")); privacyoptionList.add(new GalleryImageModel(getResources().getString(R.string.photo_private_option_videoheader_txt), getResources().getString(R.string.photo_private_option_videosub_txt), R.drawable.ic_private_user, "0")); activityImageVideoPrivacyBinding.privacyHeaderTxt.setText(getResources().getString(R.string.photo_privacy_videoheader_txt)); activityImageVideoPrivacyBinding.privacySubTxt.setText(getResources().getString(R.string.photo_privacy_videosub_txt)); activityImageVideoPrivacyBinding.privacyLinkTxt.setText(Html.fromHtml("<u>"+getResources().getString(R.string.photo_privacy_videotxt)+"<u>")); } for (int i = 0; i < privacyoptionList.size(); i++) { if (privacyoptionList.get(i).getHeadertxt().equalsIgnoreCase(privacyStr)) { selectedposition = i; } } Log.d("selectedposition : ", "" + selectedposition); imageVideoPrivacyAdapter = new ImageVideoPrivacyAdapter(mContext, privacyoptionList, selectedposition, new MorestoryClick() { @Override public void getmorestoryClick() { String getData = String.valueOf(imageVideoPrivacyAdapter.getDatas()); getData=getData.substring(1,getData.length()-1); String[] splitString = getData.split("\\|"); headertxt = splitString[0]; subtxt = splitString[1]; Log.d("headertxt :", headertxt + " subtxt :" + subtxt); } }); LinearLayoutManager mLayoutManager = new LinearLayoutManager(mContext, RecyclerView.VERTICAL, false); activityImageVideoPrivacyBinding.privacyRcv.setLayoutManager(mLayoutManager); activityImageVideoPrivacyBinding.privacyRcv.setItemAnimator(new DefaultItemAnimator()); activityImageVideoPrivacyBinding.privacyRcv.setAdapter(imageVideoPrivacyAdapter); } public void setListiner() { activityImageVideoPrivacyBinding.backImg.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.back_img: EventBus.getDefault().post(new MyScreenChnagesModel(headertxt,subtxt)); finish(); break; } } @Override public void onBackPressed() { EventBus.getDefault().post(new MyScreenChnagesModel(headertxt,subtxt)); finish(); super.onBackPressed(); } }
[ "developer@bharatarmy.com" ]
developer@bharatarmy.com
b1ea88ef58807c06ac4883bb7bedf41aa432fe74
c813e7bf34b0d19bf98fac1e0ff924a94a8f18e2
/src/com/eby/mhs/MhsViewController.java
3cf4a5cf1759d7209f56ff0548d6f65f31c779be
[]
no_license
kevinmel2000/BasicCRUDHibernateGenericDAO
1789dc31f1e0f35e2a836bee8bc6e84d599cac7c
3f67f8eb1d2d9a30730dc2d0f485a96924f4ef76
refs/heads/master
2020-04-12T12:23:25.172892
2015-08-24T11:55:43
2015-08-24T11:55:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,152
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.eby.mhs; import com.eby.animations.FadeInLeftTransition; import com.eby.animations.FadeOutRightTransition; import com.eby.autocomplete.ComboBoxAuto; import com.eby.frameworkConfig.Config; import com.eby.orm.entity.Dosen; import com.eby.orm.entity.Mahasiswa; import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView; import java.net.URL; import java.util.ResourceBundle; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.DatePicker; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.GridPane; import javafx.scene.text.Text; import javafx.util.converter.LocalDateStringConverter; /** * FXML Controller class * * @author eby */ public class MhsViewController implements Initializable { @FXML private GridPane gridPane; @FXML private TextField txtNIM; @FXML private TextField txtNama; @FXML private TextField txtKelas; @FXML private TextArea txtAlamat; @FXML private ComboBox<String> cbDosen; @FXML private DatePicker dateLahir; @FXML private TableView<Mahasiswa> tableMhs; @FXML private Button btTambah; @FXML private Button btUbah; @FXML private Button btHapus; @FXML private FontAwesomeIconView ubahIcon; @FXML private FontAwesomeIconView hapusIcon; @FXML private TextField txtCari; @FXML private FontAwesomeIconView cariIcon; @FXML private Text txtClose; @FXML private FontAwesomeIconView plusIcon; @FXML private AnchorPane paneView; private MhsModel model; private MhsTableModel tableModel; private MhsComboBoxModel comboBoxModel; private Config con; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { initModel(); initTable(); initComboBox(); fadeIn(); con = new Config(); Platform.runLater(() -> { cbDosen.setOnKeyReleased(KeyEvent -> { new ComboBoxAuto<>(cbDosen); }); }); } @FXML private void tableClicked(MouseEvent event) { int index = tableMhs.getSelectionModel().getSelectedIndex(); if (index != -1) { Mahasiswa m = tableModel.getItem().get(index); txtNIM.setText(m.getNim()); txtNama.setText(m.getNama()); txtKelas.setText(m.getKelas()); txtAlamat.setText(m.getAlamat()); LocalDateStringConverter ld = new LocalDateStringConverter(); dateLahir.setValue(ld.fromString(m.getTglLahir())); cbDosen.getSelectionModel().select(m.getDosen().getNama()); } else { System.out.println("index -1, pilih data"); } } @FXML private void tambahAction(ActionEvent event) { String nim = txtNIM.getText(); String nama = txtNama.getText(); String kelas = txtKelas.getText(); String alamat = txtAlamat.getText(); //Konversi localDate menjadi String LocalDateStringConverter ld = new LocalDateStringConverter(); String tglLahir = ld.toString(dateLahir.getValue()); int dosen = cbDosen.getSelectionModel().getSelectedIndex(); if (nim.equals("") || nama.equals("") || kelas.equals("") || alamat.equals("") || tglLahir.isEmpty() || dosen == -1) { con.dialog(Alert.AlertType.WARNING, "data tidak boleh kosong", null); } else { //megambil index pada combo box int index = cbDosen.getSelectionModel().getSelectedIndex(); //menyimpan index pada object Dosen d = comboBoxModel.get(index); Mahasiswa m = new Mahasiswa(nim, d, nama, kelas, alamat, tglLahir); model.save(m); con.dialog(Alert.AlertType.INFORMATION, "data berhasil disimpan", null); loadData(); loadComboBox(); reset(); } } @FXML private void ubahAction(ActionEvent event) { String nim = txtNIM.getText(); String nama = txtNama.getText(); String kelas = txtKelas.getText(); String alamat = txtAlamat.getText(); LocalDateStringConverter ld = new LocalDateStringConverter(); String tglLahir = ld.toString(dateLahir.getValue()); int dosen = cbDosen.getSelectionModel().getSelectedIndex(); if (nim.equals("") || nama.equals("") || kelas.equals("") || alamat.equals("") || tglLahir.isEmpty() || dosen == -1) { con.dialog(Alert.AlertType.WARNING, "data tidak boleh kosong", null); } else { int index = cbDosen.getSelectionModel().getSelectedIndex(); Dosen d = comboBoxModel.get(index); Mahasiswa m = new Mahasiswa(nim, d, nama, kelas, alamat, tglLahir); model.update(m); con.dialog(Alert.AlertType.INFORMATION, "data berhasil diupdate", null); loadData(); loadComboBox(); reset(); } } @FXML private void hapusAction(ActionEvent event) { int index = tableMhs.getSelectionModel().getSelectedIndex(); if (index != -1) { Mahasiswa m = tableModel.getItem().get(index); model.delete(m); con.dialog(Alert.AlertType.WARNING, "data berhasil dihapus", null); loadData(); loadComboBox(); reset(); } else { con.dialog(Alert.AlertType.WARNING, "Pilih data", null); } } @FXML private void onKeyReleased(KeyEvent event) { String key = txtCari.getText(); if (key.equals("")) { loadData(); } else { tableModel.getItem().remove(0, tableModel.getItem().size()); tableMhs.setItems(tableModel.getItem()); tableModel.getItem().addAll(model.findData(key)); } } @FXML private void closeAction(MouseEvent event) { this.fadeOut(); } public void fadeIn() { new FadeInLeftTransition(gridPane).play(); new FadeInLeftTransition(btTambah).play(); new FadeInLeftTransition(btUbah).play(); new FadeInLeftTransition(btHapus).play(); new FadeInLeftTransition(plusIcon).play(); new FadeInLeftTransition(ubahIcon).play(); new FadeInLeftTransition(hapusIcon).play(); new FadeInLeftTransition(txtCari).play(); new FadeInLeftTransition(cariIcon).play(); new FadeInLeftTransition(tableMhs).play(); // new FadeInLeftTransition(paneView).play(); new FadeInLeftTransition(txtClose).play(); } public void fadeOut() { new FadeOutRightTransition(gridPane).play(); new FadeOutRightTransition(btTambah).play(); new FadeOutRightTransition(btUbah).play(); new FadeOutRightTransition(btHapus).play(); new FadeOutRightTransition(plusIcon).play(); new FadeOutRightTransition(ubahIcon).play(); new FadeOutRightTransition(hapusIcon).play(); new FadeOutRightTransition(txtCari).play(); new FadeOutRightTransition(cariIcon).play(); new FadeOutRightTransition(tableMhs).play(); new FadeOutRightTransition(paneView).play(); new FadeOutRightTransition(txtClose).play(); } private void initModel() { model = new MhsModel(); model.setController(this); } private void initTable() { tableModel = new MhsTableModel(); tableMhs.getColumns().addAll(tableModel.getAllColumn()); tableMhs.setItems(tableModel.getItem()); tableModel.getItem().addAll(model.list()); } public void initComboBox() { comboBoxModel = new MhsComboBoxModel(); cbDosen.setItems(comboBoxModel.getItems()); comboBoxModel.add(model.listDosen()); } public void loadData() { tableModel.getItem().remove(0, tableModel.getItem().size()); tableMhs.setItems(tableModel.getItem()); tableModel.getItem().addAll(model.list()); } public void loadComboBox() { comboBoxModel.getItems().remove(0, comboBoxModel.getItems().size()); cbDosen.setItems(comboBoxModel.getItems()); comboBoxModel.add(model.listDosen()); } public void reset() { txtNIM.setText(""); txtNama.setText(""); txtKelas.setText(""); txtAlamat.setText(""); dateLahir.setValue(null); cbDosen.getSelectionModel().clearSelection(); } }
[ "eby.clickhander7@gmail.com" ]
eby.clickhander7@gmail.com
4f50ab255bdaccfc9b96b66f9ed681485f97bdc5
0398f66458d68e87adbe11393a07ed07ce78574a
/src/main/java/com/octavio/mancillaco/security/DatabaseWebSecurity.java
21dc3cb7b913571221b5ade19d65358c47ed442c
[]
no_license
octasvio1330/EstacionVelaOctavio-
34685877cd1353f5b9aa4dcc63b5de3c46a7fcdc
1b848c3142532a6068fd98c8ffef7806b1e082d8
refs/heads/main
2023-07-31T23:09:55.009139
2021-09-20T19:42:25
2021-09-20T19:42:25
408,576,581
0
0
null
null
null
null
UTF-8
Java
false
false
2,318
java
package com.octavio.mancillaco.security; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @Configuration @EnableWebSecurity public class DatabaseWebSecurity extends WebSecurityConfigurerAdapter { @Autowired private DataSource dataSource; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { //auth.jdbcAuthentication().dataSource(dataSource); auth.jdbcAuthentication().dataSource(dataSource) .usersByUsernameQuery("select username, password, estatus from Usuarios where username=?") .authoritiesByUsernameQuery("select u.username, p.perfil from UsuarioPerfil up " + "inner join Usuarios u on u.id = up.idUsuario " + "inner join Perfiles p on p.id = up.idPerfil " + "where u.username = ?"); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() // Los recursos estáticos no requieren autenticación .antMatchers( "/bootstrap/**", "/images/**", "/tinymce/**", "/logos/**").permitAll() // Las vistas públicas no requieren autenticación .antMatchers("/", "/crear", "/guardar", "/acerca", "/vacantes/detalle/**").permitAll() // Asignar permisos a URLs por ROLES .antMatchers("/vacantes/**").hasAnyAuthority("Supervisor","Administrador") .antMatchers("/categorias/**").hasAnyAuthority("Supervisor","Administrador") .antMatchers("/usuarios/**").hasAnyAuthority("Supervisor","Administrador") // Todas las demás URLs de la Aplicación requieren autenticación .anyRequest().authenticated() // El formulario de Login no requiere autenticacion .and().formLogin().loginPage("/login").permitAll(); } }
[ "octavioruizfinal@gmail.com" ]
octavioruizfinal@gmail.com
869df481cc3978d16f12ef18e7ca2671ed38b1ed
06bd6dc5a3477ad4be1b6f331a032aed11dfd5cb
/src/main/java/io/renren/common/utils/PageUtils.java
d96e6dc8292bbca9edc56df557d6bc063f1b2289
[]
no_license
windlikeman/jingke-web-vue
672f123df258caef135938284467a427c2128ff7
d45b211bd708a0d7734e2736fc508f8b27cafac1
refs/heads/master
2020-03-28T01:08:07.360372
2018-09-07T01:45:05
2018-09-07T01:45:05
147,479,535
0
0
null
null
null
null
UTF-8
Java
false
false
2,452
java
/** * Copyright 2018 人人开源 http://www.renren.io * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.renren.common.utils; import com.baomidou.mybatisplus.plugins.Page; import java.io.Serializable; import java.util.List; /** * 分页工具类 * * @author jingke * @email * @date 2016年11月4日 下午12:59:00 */ public class PageUtils implements Serializable { private static final long serialVersionUID = 1L; //总记录数 private int totalCount; //每页记录数 private int pageSize; //总页数 private int totalPage; //当前页数 private int currPage; //列表数据 private List<?> list; /** * 分页 * @param list 列表数据 * @param totalCount 总记录数 * @param pageSize 每页记录数 * @param currPage 当前页数 */ public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) { this.list = list; this.totalCount = totalCount; this.pageSize = pageSize; this.currPage = currPage; this.totalPage = (int)Math.ceil((double)totalCount/pageSize); } /** * 分页 */ public PageUtils(Page<?> page) { this.list = page.getRecords(); this.totalCount = (int)page.getTotal(); this.pageSize = page.getSize(); this.currPage = page.getCurrent(); this.totalPage = (int)page.getPages(); } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getCurrPage() { return currPage; } public void setCurrPage(int currPage) { this.currPage = currPage; } public List<?> getList() { return list; } public void setList(List<?> list) { this.list = list; } }
[ "liyongfei@ancun.com" ]
liyongfei@ancun.com
71fc60695977232be2947799b9b951db4bd08c3c
48fd0b689f9cdb660ad06a191107e14d47542fd8
/ada97/src/Main.java
c98328bbf5e82f7c0674abf5f3bd866fc566851e
[ "MIT" ]
permissive
chiendarrendor/AlbertsAdalogicalAenigmas
3dfc6616d47c361ad6911e2ee4e3a3ec24bb6b75
c6f91d4718999089686f3034a75a11b312fa1458
refs/heads/master
2022-08-28T11:34:02.261386
2022-07-08T22:45:24
2022-07-08T22:45:24
115,220,665
1
1
null
null
null
null
UTF-8
Java
false
false
4,912
java
import grid.copycon.Deep; import grid.puzzlebits.Direction; import grid.puzzlebits.Path.Path; import grid.puzzlebits.Turns; import grid.solverrecipes.singleloopflatten.EdgeState; import grid.spring.GridFrame; import grid.spring.GridPanel; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Point; import java.awt.image.BufferedImage; public class Main { private static class MyListener implements GridPanel.GridListener, GridPanel.EdgeListener{ Board b; String[] lines; public MyListener(Board b,String[] lines) { this.b = b; this.lines = lines; } @Override public int getNumXCells() { return b.getWidth(); } @Override public int getNumYCells() { return b.getHeight(); } @Override public boolean drawGridNumbers() { return true; } @Override public boolean drawGridLines() { return true; } @Override public boolean drawBoundary() { return true; } @Override public String[] getAnswerLines() { return lines; } private static EdgeDescriptor WALL = new EdgeDescriptor(Color.BLACK,5); private static EdgeDescriptor INSIDE = new EdgeDescriptor(Color.BLACK,1); private EdgeDescriptor getED(int x, int y, Direction d) { Point op = d.delta(x,y,1); return b.getRegion(x,y) == b.getRegion(op.x,op.y) ? INSIDE : WALL; } @Override public EdgeDescriptor onBoundary() { return WALL; } @Override public EdgeDescriptor toEast(int x, int y) { return getED(x,y,Direction.EAST); } @Override public EdgeDescriptor toSouth(int x, int y) { return getED(x,y,Direction.SOUTH); } private void drawPath(BufferedImage bi,int x,int y, Direction d) { Graphics2D g = (Graphics2D)bi.getGraphics(); int cenx = bi.getWidth()/2; int ceny = bi.getHeight()/2; EdgeState es = b.getEdge(x,y,d); int ox = -1; int oy = -1; switch(d) { case NORTH: ox = cenx; oy = 0; break; case EAST: ox = bi.getWidth(); oy = ceny; break; case SOUTH: ox = cenx; oy = bi.getHeight(); break; case WEST: ox = 0; oy = ceny ; break; } switch(es) { case UNKNOWN: return; case PATH: g.setColor(Color.BLUE); g.setStroke(new BasicStroke(5)); g.drawLine(cenx,ceny,ox,oy); break; case WALL: GridPanel.DrawStringInCorner(bi,Color.RED,"X",d); break; } } @Override public boolean drawCellContents(int cx, int cy, BufferedImage bi) { if (b.hasLetter(cx,cy)) GridPanel.DrawStringInCorner(bi,Color.BLACK,""+b.getLetter(cx,cy),Direction.NORTHWEST); if (b.hasNumber(cx,cy)) { Graphics2D g = (Graphics2D)bi.getGraphics(); g.setColor(Color.BLACK); g.setFont(g.getFont().deriveFont(g.getFont().getSize() * 3.0f)); GridPanel.DrawStringInCorner(g,0,0,bi.getWidth(),bi.getHeight(),""+b.getNumber(cx,cy),Direction.NORTHWEST); } drawPath(bi,cx,cy,Direction.NORTH); drawPath(bi,cx,cy,Direction.SOUTH); drawPath(bi,cx,cy,Direction.WEST); drawPath(bi,cx,cy,Direction.EAST); return true; } } public static void main(String[] args) { if (args.length != 1) { System.out.println("Bad Command Line"); System.exit(1); } Board b = new Board(args[0]); String[] lines = new String[] { "", "Adalogical Aenigma", "#97 solver"}; lines[0] = b.getTitle(); Solver s = new Solver(b); s.Solve(b); if (s.GetSolutions().size() == 1) { System.out.println("Solution Found"); b = s.GetSolutions().get(0); Path p = b.getPaths().iterator().next(); Point start = new Point(0,0); Path.Cursor cursor = p.getCursor(0,0); if (!cursor.getNext().equals(new Point(1,0))) { p.reverse(); cursor = p.getCursor(0,0); } StringBuffer sb = new StringBuffer(); for( ; !cursor.getNext().equals(start) ; cursor.next()) { Point cp = cursor.get(); if (!b.hasLetter(cp.x,cp.y)) continue; if (Turns.makeTurn(cursor.getPrev(),cursor.get(),cursor.getNext()) != Turns.RIGHT) continue; sb.append(b.getLetter(cp.x,cp.y)); } lines[1] = sb.toString(); lines[2] = b.getSolution(); } MyListener myl = new MyListener(b,lines); GridFrame gf = new GridFrame("Adalogical Aenigma #97 solver",1200,800,myl,myl); } }
[ "chiendarrendor@yahoo.com" ]
chiendarrendor@yahoo.com
b4f115e25015818f1de05be8a6994c8275372dd3
62eec6735a798eded9d50840c27a73fe8b83ea7a
/src/test/java/edu/jhuapl/exterminator/grammar/coq/ContainsTest.java
4a3e75519b95f0b181f1f1cecbed03985259a284
[ "BSD-3-Clause" ]
permissive
jhuapl-saralab/exterminator
49a2fb2b3f8a9e2f41d65aa6d06df40243ebdeab
98c44e82ae8ba8c6dfa1204428581a7c9ff78f56
refs/heads/master
2021-01-12T11:09:27.831847
2016-11-04T14:25:37
2016-11-04T14:25:37
72,854,767
2
0
null
null
null
null
UTF-8
Java
false
false
6,222
java
/* * Copyright (c) 2016, Johns Hopkins University Applied Physics * Laboratory All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ package edu.jhuapl.exterminator.grammar.coq; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.BailErrorStrategy; import org.antlr.v4.runtime.CommonTokenStream; import org.junit.Assert; import org.junit.Test; import edu.jhuapl.exterminator.grammar.coq.term.Ident; import edu.jhuapl.exterminator.grammar.coq.term.Name; import edu.jhuapl.exterminator.grammar.coq.term.Qualid; import edu.jhuapl.exterminator.grammar.coq.term.Term; public class ContainsTest { private static CoqFTParser parser(String str) { CoqLexer lexer = new CoqLexer(new ANTLRInputStream(str)); CoqFTParser parser = new CoqFTParser(new CommonTokenStream(lexer)); parser.setErrorHandler(new BailErrorStrategy()); return parser; } private static Term parseTerm(String str) { CoqFTParser parser = parser(str); return Term.make(parser, parser.term()); } private static Ident parseIdent(String str) { CoqFTParser parser = parser(str); return new Ident(parser, parser.ident()); } private static Name parseName(String str) { CoqFTParser parser = parser(str); return new Name(parser, parser.name()); } private static Qualid parseQualid(String str) { CoqFTParser parser = parser(str); return new Qualid(parser, parser.qualid()); } @Test public void testIDEquals() { // ident x ident { Ident i1 = parseIdent("a"); Ident i2 = parseIdent("a"); Assert.assertTrue(i1.equals(i2)); Assert.assertTrue(i2.equals(i1)); Ident i3 = parseIdent("b"); Assert.assertFalse(i1.equals(i3)); Assert.assertFalse(i3.equals(i1)); } // ident x name { Ident i1 = parseIdent("a"); Name n1 = parseName("a"); Name n2 = parseName("b"); Name n3 = parseName("_"); Assert.assertTrue(i1.equals(n1)); Assert.assertTrue(n1.equals(i1)); Assert.assertFalse(i1.equals(n2)); Assert.assertFalse(n2.equals(i1)); Assert.assertFalse(i1.equals(n3)); Assert.assertFalse(n3.equals(i1)); Ident i2 = parseIdent("_"); Assert.assertFalse(i2.equals(n1)); Assert.assertFalse(n1.equals(i2)); Assert.assertFalse(i2.equals(n2)); Assert.assertFalse(n2.equals(i2)); Assert.assertTrue(i2.equals(n3)); Assert.assertTrue(n3.equals(i2)); } // ident x qualid { Ident i1 = parseIdent("a"); Qualid q1 = parseQualid("a"); Qualid q2 = parseQualid("b"); Qualid q3 = parseQualid("a.a"); Assert.assertTrue(i1.equals(q1)); Assert.assertTrue(q1.equals(i1)); Assert.assertFalse(i1.equals(q2)); Assert.assertFalse(q2.equals(i1)); Assert.assertFalse(i1.equals(q3)); Assert.assertFalse(q3.equals(i1)); } // name x name { Name n1 = parseName("_"); Name n2 = parseName("_"); Name n3 = parseName("a"); Assert.assertTrue(n1.equals(n2)); Assert.assertTrue(n2.equals(n1)); Assert.assertFalse(n1.equals(n3)); Assert.assertFalse(n3.equals(n1)); } // name x qualid { Name n1 = parseName("_"); Qualid q1 = parseQualid("_"); Qualid q2 = parseQualid("a"); Qualid q3 = parseQualid("_._"); Assert.assertTrue(n1.equals(q1)); Assert.assertTrue(q1.equals(n1)); Assert.assertFalse(n1.equals(q2)); Assert.assertFalse(q2.equals(n1)); Assert.assertFalse(n1.equals(q3)); Assert.assertFalse(q3.equals(n1)); Name n2 = parseName("a"); Qualid q4 = parseQualid("a.a"); Assert.assertFalse(n2.equals(q1)); Assert.assertFalse(q1.equals(n2)); Assert.assertTrue(n2.equals(q2)); Assert.assertTrue(q2.equals(n2)); Assert.assertFalse(n2.equals(q4)); Assert.assertFalse(q4.equals(n2)); } // qualid x qualid { Qualid q1 = parseQualid("a"); Qualid q2 = parseQualid("a"); Assert.assertTrue(q1.equals(q2)); Assert.assertTrue(q2.equals(q1)); Qualid q3 = parseQualid("b"); Assert.assertFalse(q1.equals(q3)); Assert.assertFalse(q3.equals(q1)); Qualid q4 = parseQualid("a.b"); Qualid q5 = parseQualid("a.b"); Assert.assertFalse(q1.equals(q4)); Assert.assertFalse(q4.equals(q1)); Assert.assertTrue(q4.equals(q5)); Assert.assertTrue(q5.equals(q4)); Qualid q6 = parseQualid("b.b"); Assert.assertFalse(q1.equals(q6)); Assert.assertFalse(q6.equals(q1)); } } @Test public void testContains1() { Term term = parseTerm("(a b c)"); Ident i = parseIdent("a"); Assert.assertNotEquals(term, i); Assert.assertTrue(term.contains(i)); i = parseIdent("b"); Assert.assertNotEquals(term, i); Assert.assertTrue(term.contains(i)); i = parseIdent("c"); Assert.assertNotEquals(term, i); Assert.assertTrue(term.contains(i)); } }
[ "aaron.pendergrass@jhuapl.edu" ]
aaron.pendergrass@jhuapl.edu
81ef999cbf04a5085c4d112daa08fbc86fb83572
4917bcfe0f4d1b8a974ca02ba1a28e0dcad7aaaf
/src/main/java/com/google/schemaorg/core/impl/MedicalTrialImpl.java
abbeff3d96abf95e0001c90e035a034382261045
[ "Apache-2.0" ]
permissive
google/schemaorg-java
e9a74eb5c5a69014a9763d961103a32254e792b7
d11c8edf686de6446c34e92f9b3243079d8cb76e
refs/heads/master
2023-08-23T12:49:26.774277
2022-08-25T12:49:06
2022-08-25T12:49:06
58,669,416
77
48
Apache-2.0
2022-08-06T11:35:15
2016-05-12T19:08:04
Java
UTF-8
Java
false
false
14,267
java
/* * Copyright 2016 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.schemaorg.core; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; import com.google.schemaorg.SchemaOrgType; import com.google.schemaorg.SchemaOrgTypeImpl; import com.google.schemaorg.ValueType; import com.google.schemaorg.core.datatype.Text; import com.google.schemaorg.core.datatype.URL; import com.google.schemaorg.goog.GoogConstants; import com.google.schemaorg.goog.PopularityScoreSpecification; /** Implementation of {@link MedicalTrial}. */ public class MedicalTrialImpl extends MedicalStudyImpl implements MedicalTrial { private static final ImmutableSet<String> PROPERTY_SET = initializePropertySet(); private static ImmutableSet<String> initializePropertySet() { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); builder.add(CoreConstants.PROPERTY_ADDITIONAL_TYPE); builder.add(CoreConstants.PROPERTY_ALTERNATE_NAME); builder.add(CoreConstants.PROPERTY_CODE); builder.add(CoreConstants.PROPERTY_DESCRIPTION); builder.add(CoreConstants.PROPERTY_GUIDELINE); builder.add(CoreConstants.PROPERTY_IMAGE); builder.add(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE); builder.add(CoreConstants.PROPERTY_MEDICINE_SYSTEM); builder.add(CoreConstants.PROPERTY_NAME); builder.add(CoreConstants.PROPERTY_OUTCOME); builder.add(CoreConstants.PROPERTY_PHASE); builder.add(CoreConstants.PROPERTY_POPULATION); builder.add(CoreConstants.PROPERTY_POTENTIAL_ACTION); builder.add(CoreConstants.PROPERTY_RECOGNIZING_AUTHORITY); builder.add(CoreConstants.PROPERTY_RELEVANT_SPECIALTY); builder.add(CoreConstants.PROPERTY_SAME_AS); builder.add(CoreConstants.PROPERTY_SPONSOR); builder.add(CoreConstants.PROPERTY_STATUS); builder.add(CoreConstants.PROPERTY_STUDY); builder.add(CoreConstants.PROPERTY_STUDY_LOCATION); builder.add(CoreConstants.PROPERTY_STUDY_SUBJECT); builder.add(CoreConstants.PROPERTY_TRIAL_DESIGN); builder.add(CoreConstants.PROPERTY_URL); builder.add(GoogConstants.PROPERTY_DETAILED_DESCRIPTION); builder.add(GoogConstants.PROPERTY_POPULARITY_SCORE); return builder.build(); } static final class BuilderImpl extends SchemaOrgTypeImpl.BuilderImpl<MedicalTrial.Builder> implements MedicalTrial.Builder { @Override public MedicalTrial.Builder addAdditionalType(URL value) { return addProperty(CoreConstants.PROPERTY_ADDITIONAL_TYPE, value); } @Override public MedicalTrial.Builder addAdditionalType(String value) { return addProperty(CoreConstants.PROPERTY_ADDITIONAL_TYPE, Text.of(value)); } @Override public MedicalTrial.Builder addAlternateName(Text value) { return addProperty(CoreConstants.PROPERTY_ALTERNATE_NAME, value); } @Override public MedicalTrial.Builder addAlternateName(String value) { return addProperty(CoreConstants.PROPERTY_ALTERNATE_NAME, Text.of(value)); } @Override public MedicalTrial.Builder addCode(MedicalCode value) { return addProperty(CoreConstants.PROPERTY_CODE, value); } @Override public MedicalTrial.Builder addCode(MedicalCode.Builder value) { return addProperty(CoreConstants.PROPERTY_CODE, value.build()); } @Override public MedicalTrial.Builder addCode(String value) { return addProperty(CoreConstants.PROPERTY_CODE, Text.of(value)); } @Override public MedicalTrial.Builder addDescription(Text value) { return addProperty(CoreConstants.PROPERTY_DESCRIPTION, value); } @Override public MedicalTrial.Builder addDescription(String value) { return addProperty(CoreConstants.PROPERTY_DESCRIPTION, Text.of(value)); } @Override public MedicalTrial.Builder addGuideline(MedicalGuideline value) { return addProperty(CoreConstants.PROPERTY_GUIDELINE, value); } @Override public MedicalTrial.Builder addGuideline(MedicalGuideline.Builder value) { return addProperty(CoreConstants.PROPERTY_GUIDELINE, value.build()); } @Override public MedicalTrial.Builder addGuideline(String value) { return addProperty(CoreConstants.PROPERTY_GUIDELINE, Text.of(value)); } @Override public MedicalTrial.Builder addImage(ImageObject value) { return addProperty(CoreConstants.PROPERTY_IMAGE, value); } @Override public MedicalTrial.Builder addImage(ImageObject.Builder value) { return addProperty(CoreConstants.PROPERTY_IMAGE, value.build()); } @Override public MedicalTrial.Builder addImage(URL value) { return addProperty(CoreConstants.PROPERTY_IMAGE, value); } @Override public MedicalTrial.Builder addImage(String value) { return addProperty(CoreConstants.PROPERTY_IMAGE, Text.of(value)); } @Override public MedicalTrial.Builder addMainEntityOfPage(CreativeWork value) { return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, value); } @Override public MedicalTrial.Builder addMainEntityOfPage(CreativeWork.Builder value) { return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, value.build()); } @Override public MedicalTrial.Builder addMainEntityOfPage(URL value) { return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, value); } @Override public MedicalTrial.Builder addMainEntityOfPage(String value) { return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, Text.of(value)); } @Override public MedicalTrial.Builder addMedicineSystem(MedicineSystem value) { return addProperty(CoreConstants.PROPERTY_MEDICINE_SYSTEM, value); } @Override public MedicalTrial.Builder addMedicineSystem(String value) { return addProperty(CoreConstants.PROPERTY_MEDICINE_SYSTEM, Text.of(value)); } @Override public MedicalTrial.Builder addName(Text value) { return addProperty(CoreConstants.PROPERTY_NAME, value); } @Override public MedicalTrial.Builder addName(String value) { return addProperty(CoreConstants.PROPERTY_NAME, Text.of(value)); } @Override public MedicalTrial.Builder addOutcome(Text value) { return addProperty(CoreConstants.PROPERTY_OUTCOME, value); } @Override public MedicalTrial.Builder addOutcome(String value) { return addProperty(CoreConstants.PROPERTY_OUTCOME, Text.of(value)); } @Override public MedicalTrial.Builder addPhase(Text value) { return addProperty(CoreConstants.PROPERTY_PHASE, value); } @Override public MedicalTrial.Builder addPhase(String value) { return addProperty(CoreConstants.PROPERTY_PHASE, Text.of(value)); } @Override public MedicalTrial.Builder addPopulation(Text value) { return addProperty(CoreConstants.PROPERTY_POPULATION, value); } @Override public MedicalTrial.Builder addPopulation(String value) { return addProperty(CoreConstants.PROPERTY_POPULATION, Text.of(value)); } @Override public MedicalTrial.Builder addPotentialAction(Action value) { return addProperty(CoreConstants.PROPERTY_POTENTIAL_ACTION, value); } @Override public MedicalTrial.Builder addPotentialAction(Action.Builder value) { return addProperty(CoreConstants.PROPERTY_POTENTIAL_ACTION, value.build()); } @Override public MedicalTrial.Builder addPotentialAction(String value) { return addProperty(CoreConstants.PROPERTY_POTENTIAL_ACTION, Text.of(value)); } @Override public MedicalTrial.Builder addRecognizingAuthority(Organization value) { return addProperty(CoreConstants.PROPERTY_RECOGNIZING_AUTHORITY, value); } @Override public MedicalTrial.Builder addRecognizingAuthority(Organization.Builder value) { return addProperty(CoreConstants.PROPERTY_RECOGNIZING_AUTHORITY, value.build()); } @Override public MedicalTrial.Builder addRecognizingAuthority(String value) { return addProperty(CoreConstants.PROPERTY_RECOGNIZING_AUTHORITY, Text.of(value)); } @Override public MedicalTrial.Builder addRelevantSpecialty(MedicalSpecialty value) { return addProperty(CoreConstants.PROPERTY_RELEVANT_SPECIALTY, value); } @Override public MedicalTrial.Builder addRelevantSpecialty(String value) { return addProperty(CoreConstants.PROPERTY_RELEVANT_SPECIALTY, Text.of(value)); } @Override public MedicalTrial.Builder addSameAs(URL value) { return addProperty(CoreConstants.PROPERTY_SAME_AS, value); } @Override public MedicalTrial.Builder addSameAs(String value) { return addProperty(CoreConstants.PROPERTY_SAME_AS, Text.of(value)); } @Override public MedicalTrial.Builder addSponsor(Organization value) { return addProperty(CoreConstants.PROPERTY_SPONSOR, value); } @Override public MedicalTrial.Builder addSponsor(Organization.Builder value) { return addProperty(CoreConstants.PROPERTY_SPONSOR, value.build()); } @Override public MedicalTrial.Builder addSponsor(String value) { return addProperty(CoreConstants.PROPERTY_SPONSOR, Text.of(value)); } @Override public MedicalTrial.Builder addStatus(MedicalStudyStatus value) { return addProperty(CoreConstants.PROPERTY_STATUS, value); } @Override public MedicalTrial.Builder addStatus(String value) { return addProperty(CoreConstants.PROPERTY_STATUS, Text.of(value)); } @Override public MedicalTrial.Builder addStudy(MedicalStudy value) { return addProperty(CoreConstants.PROPERTY_STUDY, value); } @Override public MedicalTrial.Builder addStudy(MedicalStudy.Builder value) { return addProperty(CoreConstants.PROPERTY_STUDY, value.build()); } @Override public MedicalTrial.Builder addStudy(String value) { return addProperty(CoreConstants.PROPERTY_STUDY, Text.of(value)); } @Override public MedicalTrial.Builder addStudyLocation(AdministrativeArea value) { return addProperty(CoreConstants.PROPERTY_STUDY_LOCATION, value); } @Override public MedicalTrial.Builder addStudyLocation(AdministrativeArea.Builder value) { return addProperty(CoreConstants.PROPERTY_STUDY_LOCATION, value.build()); } @Override public MedicalTrial.Builder addStudyLocation(String value) { return addProperty(CoreConstants.PROPERTY_STUDY_LOCATION, Text.of(value)); } @Override public MedicalTrial.Builder addStudySubject(MedicalEntity value) { return addProperty(CoreConstants.PROPERTY_STUDY_SUBJECT, value); } @Override public MedicalTrial.Builder addStudySubject(MedicalEntity.Builder value) { return addProperty(CoreConstants.PROPERTY_STUDY_SUBJECT, value.build()); } @Override public MedicalTrial.Builder addStudySubject(String value) { return addProperty(CoreConstants.PROPERTY_STUDY_SUBJECT, Text.of(value)); } @Override public MedicalTrial.Builder addTrialDesign(MedicalTrialDesign value) { return addProperty(CoreConstants.PROPERTY_TRIAL_DESIGN, value); } @Override public MedicalTrial.Builder addTrialDesign(String value) { return addProperty(CoreConstants.PROPERTY_TRIAL_DESIGN, Text.of(value)); } @Override public MedicalTrial.Builder addUrl(URL value) { return addProperty(CoreConstants.PROPERTY_URL, value); } @Override public MedicalTrial.Builder addUrl(String value) { return addProperty(CoreConstants.PROPERTY_URL, Text.of(value)); } @Override public MedicalTrial.Builder addDetailedDescription(Article value) { return addProperty(GoogConstants.PROPERTY_DETAILED_DESCRIPTION, value); } @Override public MedicalTrial.Builder addDetailedDescription(Article.Builder value) { return addProperty(GoogConstants.PROPERTY_DETAILED_DESCRIPTION, value.build()); } @Override public MedicalTrial.Builder addDetailedDescription(String value) { return addProperty(GoogConstants.PROPERTY_DETAILED_DESCRIPTION, Text.of(value)); } @Override public MedicalTrial.Builder addPopularityScore(PopularityScoreSpecification value) { return addProperty(GoogConstants.PROPERTY_POPULARITY_SCORE, value); } @Override public MedicalTrial.Builder addPopularityScore(PopularityScoreSpecification.Builder value) { return addProperty(GoogConstants.PROPERTY_POPULARITY_SCORE, value.build()); } @Override public MedicalTrial.Builder addPopularityScore(String value) { return addProperty(GoogConstants.PROPERTY_POPULARITY_SCORE, Text.of(value)); } @Override public MedicalTrial build() { return new MedicalTrialImpl(properties, reverseMap); } } public MedicalTrialImpl( Multimap<String, ValueType> properties, Multimap<String, Thing> reverseMap) { super(properties, reverseMap); } @Override public String getFullTypeName() { return CoreConstants.TYPE_MEDICAL_TRIAL; } @Override public boolean includesProperty(String property) { return PROPERTY_SET.contains(CoreConstants.NAMESPACE + property) || PROPERTY_SET.contains(GoogConstants.NAMESPACE + property) || PROPERTY_SET.contains(property); } @Override public ImmutableList<SchemaOrgType> getPhaseList() { return getProperty(CoreConstants.PROPERTY_PHASE); } @Override public ImmutableList<SchemaOrgType> getTrialDesignList() { return getProperty(CoreConstants.PROPERTY_TRIAL_DESIGN); } }
[ "yuanzh@google.com" ]
yuanzh@google.com
f3646700d8c0f1c4dd448b7b02ce7216f97b12b5
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_eff11c3a1f96e8b48830f21eb670bed372f780ec/MessageSender/8_eff11c3a1f96e8b48830f21eb670bed372f780ec_MessageSender_s.java
d8c1d82c97735d7ae70dea6f74e394aa2abf1feb
[]
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
4,997
java
package freemail; import java.io.File; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.Vector; import java.util.Enumeration; import freemail.fcp.HighLevelFCPClient; import freemail.utils.EmailAddress; import freemail.utils.DateStringFactory; public class MessageSender implements Runnable { public static final String OUTBOX_DIR = "outbox"; private static final int MIN_RUN_TIME = 60000; public static final String NIM_KEY_PREFIX = "KSK@freemail-nim-"; private static final int MAX_TRIES = 10; private final File datadir; private Thread senderthread; public MessageSender(File d) { this.datadir = d; } public void send_message(String from_user, Vector to, File msg) throws IOException { File user_dir = new File(this.datadir, from_user); File outbox = new File(user_dir, OUTBOX_DIR); Enumeration e = to.elements(); while (e.hasMoreElements()) { EmailAddress email = (EmailAddress) e.nextElement(); this.copyToOutbox(msg, outbox, email.user + "@" + email.domain); } this.senderthread.interrupt(); } private void copyToOutbox(File src, File outbox, String to) throws IOException { File tempfile = File.createTempFile("fmail-msg-tmp", null, Freemail.getTempDir()); FileOutputStream fos = new FileOutputStream(tempfile); FileInputStream fis = new FileInputStream(src); byte[] buf = new byte[1024]; int read; while ( (read = fis.read(buf)) > 0) { fos.write(buf, 0, read); } fis.close(); fos.close(); this.moveToOutbox(tempfile, 0, to, outbox); } // save a file to the outbox handling name collisions and atomicity private void moveToOutbox(File f, int tries, String to, File outbox) { File destfile; int prefix = 1; synchronized (this.senderthread) { do { String filename = prefix + ":" + tries + ":" + to; destfile = new File(outbox, filename); prefix++; } while (destfile.exists()); f.renameTo(destfile); } } public void run() { this.senderthread = Thread.currentThread(); while (true) { long start = System.currentTimeMillis(); // iterate through users File[] files = this.datadir.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].getName().startsWith(".")) continue; File outbox = new File(files[i], OUTBOX_DIR); if (!outbox.exists()) outbox.mkdir(); this.sendDir(files[i], outbox); } // don't spin around the loop if nothing's // going on long runtime = System.currentTimeMillis() - start; if (MIN_RUN_TIME - runtime > 0) { try { Thread.sleep(MIN_RUN_TIME - runtime); } catch (InterruptedException ie) { } } } } private void sendDir(File accdir, File dir) { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].getName().startsWith(".")) continue; this.sendSingle(accdir, files[i]); } } private void sendSingle(File accdir, File msg) { String parts[] = msg.getName().split(":", 3); EmailAddress addr; int tries; if (parts.length < 3) { System.out.println("Warning invalid file in outbox - deleting."); msg.delete(); return; } else { tries = Integer.parseInt(parts[1]); addr = new EmailAddress(parts[2]); } if (addr.domain == null || addr.domain.length() == 0) { msg.delete(); return; } if (addr.is_nim_address()) { HighLevelFCPClient cli = new HighLevelFCPClient(); if (cli.SlotInsert(msg, NIM_KEY_PREFIX+addr.user+"-"+DateStringFactory.getKeyString(), 1, "") > -1) { msg.delete(); } } else { if (this.sendSecure(accdir, addr, msg)) { msg.delete(); } else { tries++; if (tries > MAX_TRIES) { if (Postman.bounceMessage(msg, new MessageBank(accdir.getName()), "Tried too many times to deliver this message, but it doesn't apear that this address even exists. If you're sure that it does, check your Freenet connection.")) { msg.delete(); } } else { this.moveToOutbox(msg, tries, parts[2], msg.getParentFile()); } } } } private boolean sendSecure(File accdir, EmailAddress addr, File msg) { System.out.println("sending secure"); OutboundContact ct; try { ct = new OutboundContact(accdir, addr); } catch (BadFreemailAddressException bfae) { // bounce return Postman.bounceMessage(msg, new MessageBank(accdir.getName()), "The address that this message was destined for ("+addr+") is not a valid Freemail address."); } catch (OutboundContactFatalException obfe) { // bounce return Postman.bounceMessage(msg, new MessageBank(accdir.getName()), obfe.getMessage()); } catch (IOException ioe) { // couldn't get the mailsite - try again if you're not ready //to give up yet return false; } return ct.sendMessage(msg); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
7347a298ebae4aa0ef905afd476b203481b4e43a
2148a0f14418ac28ea9780706173308d72a2ae2d
/src/protocol47/java/org/topdank/minenet/protocols/v47/packets/play/server/entity/player/PacketPS38PlayerList.java
a0a147982d73b0e293e67d339d39c3a16aa18ef2
[]
no_license
t81lal/mcbot
85831a0a62c49c5142114bfdeaf85362b5d502a2
de6f8ca7879e3d83e253d2f6fbf9ecfb263462fb
refs/heads/master
2022-06-03T06:16:29.541751
2015-12-24T19:46:30
2015-12-24T19:46:30
229,469,980
0
0
null
2022-05-20T21:19:45
2019-12-21T18:53:48
Java
UTF-8
Java
false
false
4,395
java
package org.topdank.minenet.protocols.v47.packets.play.server.entity.player; import java.io.IOException; import java.util.UUID; import org.topdank.bot.net.io.ReadableInput; import org.topdank.bot.net.packet.IdentifiableReadablePacket; import org.topdank.mc.bot.api.world.settings.GameMode; import org.topdank.minenet.protocols.v47.packets.play.server.entity.player.PacketPS38PlayerList.CompletePlayerListEntry.Property; public class PacketPS38PlayerList implements IdentifiableReadablePacket { // (PlayerListEntryAction.ADD_PLAYER, 0); // (PlayerListEntryAction.UPDATE_GAMEMODE, 1); // (PlayerListEntryAction.UPDATE_LATENCY, 2); // (PlayerListEntryAction.UPDATE_DISPLAY_NAME, 3); // (PlayerListEntryAction.REMOVE_PLAYER, 4); private CompletePlayerListEntry[] entries; public PacketPS38PlayerList() { } @Override public void read(ReadableInput in) throws IOException { int action = in.readVarInt(); int len = in.readVarInt(); entries = new CompletePlayerListEntry[len]; for (int i = 0; i < len; i++) { UUID uuid = in.readUUID(); CompletePlayerListEntry currentEntry = entries[i] = new CompletePlayerListEntry(uuid); switch (action) { case 0: currentEntry.setUsername(in.readString()); int pLen = in.readVarInt(); Property[] properties = new Property[pLen]; for (int pI = 0; pI < pLen; pI++) { String n = in.readString(); String v = in.readString(); String s = null; if (in.readBoolean()) { // is signed s = in.readString(); } properties[pI] = currentEntry.new Property(n, v, s); } currentEntry.setProperties(properties); currentEntry.setGameMode(GameMode.getGameModeById(in.readVarInt())); currentEntry.setPing(in.readVarInt()); if (in.readBoolean()) { // Has Display Name currentEntry.setDisplayName(in.readString()); } break; case 1: currentEntry.setGameMode(GameMode.getGameModeById(in.readVarInt())); break; case 2: currentEntry.setPing(in.readVarInt()); break; case 3: if (in.readBoolean()) { // Has Display Name currentEntry.setDisplayName(in.readString()); } break; case 4: break; } } } public CompletePlayerListEntry[] getEntries() { return entries; } @Override public boolean isPriorityPacket() { return false; } @Override public int getId() { return 0x38; } public abstract class PlayerListEntry { private final UUID uuid; public PlayerListEntry(UUID uuid) { this.uuid = uuid; } public UUID getUUID() { return uuid; } } public class CompletePlayerListEntry extends PlayerListEntry { private String username; private Property[] properties; private GameMode gameMode; private int ping; private String displayName; public CompletePlayerListEntry(UUID uuid) { super(uuid); } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Property[] getProperties() { return properties; } public void setProperties(Property[] properties) { this.properties = properties; } public GameMode getGameMode() { return gameMode; } public void setGameMode(GameMode gameMode) { this.gameMode = gameMode; } public int getPing() { return ping; } public void setPing(int ping) { this.ping = ping; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public class Property { private final String name; private final String value; private final String signature; public Property(String name, String value, String signature) { this.name = name; this.value = value; this.signature = signature; } public String getName() { return name; } public String getValue() { return value; } public String getSignature() { return signature; } public boolean isSigned() { return signature != null; } @Override public String toString() { return "Property [name=" + name + ", value=" + value + ", signature=" + signature + "]"; } } } }
[ "GenerallyCool@hotmail.com" ]
GenerallyCool@hotmail.com
07d56f2750721d5dbf06fc36f24c33d76063609c
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-13372-7-4-MOEAD-WeightedSum:TestLen:CallDiversity/org/xwiki/extension/xar/internal/handler/packager/Packager_ESTest.java
b0fa46d0ea1481a1e4a159d3db4feb1ebb386e5f
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
572
java
/* * This file was automatically generated by EvoSuite * Wed Apr 08 06:07:10 UTC 2020 */ package org.xwiki.extension.xar.internal.handler.packager; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class Packager_ESTest extends Packager_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
1d4dc9bd13538bbf8bfa0e9d9decb64b883385a9
963e8a65011aa3083d58b184697253732b675a0c
/src/main/java/com/sinmin/rest/solr/SolrClient.java
8509c171edc0041def00b7e1d8ba45a7b1eb89bc
[ "Apache-2.0" ]
permissive
DImuthuUpe/SinminREST
835318756f0b4a9ea7b54f5bd2b1777fdbaab195
9f2f74071b4a869572d7f6be277a4593903db1b9
refs/heads/master
2016-08-04T21:23:37.925090
2015-02-12T21:08:49
2015-02-12T21:08:49
27,870,215
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.sinmin.rest.solr; import com.sinmin.rest.beans.response.WildCardR; import corpus.sinhala.wildcard.search.SolrWildCardSearch; import java.util.List; /** * Created by dimuthuupeksha on 1/8/15. */ public class SolrClient { public WildCardR[] getWildCardWords(String val){ SolrWildCardSearch solrWildCardSearch = new SolrWildCardSearch(); List<String> wordList= solrWildCardSearch.searchWord(val, true); if(wordList!=null){ WildCardR [] wordArr = new WildCardR[wordList.size()]; for(int i=0;i<wordList.size();i++){ WildCardR resp = new WildCardR(); resp.setValue(wordList.get(i)); wordArr[i]=resp; } return wordArr; } return null; } }
[ "dimuthu.upeksha2@gmail.com" ]
dimuthu.upeksha2@gmail.com
15ce217f4cfe953d386b76c3a55636f80351dec1
ad99a913cca71d1e0bb94854ad51cfb206eec86a
/src/main/java/jp/powerbase/xquery/expr/Doc.java
d5323316acf361cc02511a79375ec03cc1630da1
[ "Apache-2.0" ]
permissive
powerbase/powerbase-xq
d417f0aca46ff17a9fd8c1722ffcc11fed679f38
6fbb1c187eaf3c2e978ee01c01adee80746cc519
refs/heads/master
2021-01-23T12:22:09.616590
2017-05-29T10:27:47
2017-05-29T10:27:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,137
java
/* * @(#)$Id: Doc.java 1087 2011-05-25 05:28:29Z hirai $ * * Copyright 2005-2011 Infinite Corporation. * * 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. * * Contributors: * Toshio HIRAI - initial implementation */ package jp.powerbase.xquery.expr; public class Doc implements Expr { private String document; public Doc(String document) { this.document = document; } @Override public String toString() { StringBuffer doc = new StringBuffer(); doc.append("doc(\""); doc.append(document); doc.append("\")"); return doc.toString(); } @Override public String display() { return toString(); } }
[ "toshio.hirai@gmail.com" ]
toshio.hirai@gmail.com
1f58f4c942eba456895fc92cb8b0fe37d35ad017
b82da3ad621b7fa7be7979cdc5974321d9421baa
/app/src/main/java/cs654/secureme/SendSms.java
1bfd14e77f9b98e37b4db9587bcd8ecd404bf559
[]
no_license
sunil12738/SecureMe
e0d8a7347f469b3d2c88e45d7124587ee0bac7d2
8104b7f634649b99e259b77d778106811f99a6d7
refs/heads/master
2021-01-01T05:22:45.103461
2016-04-29T03:21:04
2016-04-29T03:21:04
55,978,731
0
2
null
null
null
null
UTF-8
Java
false
false
3,071
java
package cs654.secureme; import android.app.Activity; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.telephony.SmsManager; import android.util.Log; import android.widget.Toast; /** * Created by ViPul Sublaniya on 20-03-2016. */ public class SendSms { Context context; SharedPreferences sharedPreferences; String phoneNo; double latitude,longitude; public SendSms(Context context) { this.context = context; } protected void sendSMSMessage(String message, String phoneNo) { Log.i("Send SMS", ""); // String phoneNo = "8560057004"; // sharedPreferences = context.getSharedPreferences("details", Context.MODE_PRIVATE); // phoneNo = sharedPreferences.getString("helpMobile", ""); // GPS gps = new GPS(context); // if (gps.canGetLocation()) { // latitude = gps.getLatitude(); // longitude = gps.getLongitude(); // } // // String message = "i'm in trouble, help me at GPS location. Lat= "+latitude+" and Long= "+longitude; try { String SENT = "SMS_SENT"; PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent(SENT), 0); context.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { int resultCode = getResultCode(); switch (resultCode) { case Activity.RESULT_OK: Toast.makeText(context, "SMS sent", Toast.LENGTH_LONG).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(context, "Generic failure", Toast.LENGTH_LONG).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(context, "No service", Toast.LENGTH_LONG).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(context, "Null PDU", Toast.LENGTH_LONG).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(context, "Radio off", Toast.LENGTH_LONG).show(); break; } } }, new IntentFilter(SENT)); SmsManager smsMgr = SmsManager.getDefault(); smsMgr.sendTextMessage(phoneNo, null, message, sentPI, null); } catch (Exception e) { Toast.makeText(context, e.getMessage() + "!\n" + "Failed to send SMS", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } }
[ "sunil12738@gmail.com" ]
sunil12738@gmail.com
37cfa91c0aacf6fbb48d5f8cc4cdc35026ac306f
106b4366e5be2acb5cec561b2cc0eacba33c90f6
/CloneWorkbench/test/JUnitTestandoGroupBy.java
87f5c03b1a23e2acd2062021f3797644cd73a52f
[]
no_license
eduardala/CloneWorkbench
961a3504e82dd77aa31fbd6d76942770f17c3b21
5ca13f33e5e22551eb306d06bacf1e1e29c7a0f4
refs/heads/master
2020-06-13T06:39:10.930584
2019-07-08T20:26:52
2019-07-08T20:26:52
194,574,444
0
0
null
null
null
null
UTF-8
Java
false
false
1,199
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. */ import com.eduarda.clone.Uteis.GroupBy; import java.io.FileNotFoundException; import junit.framework.TestCase; /** * * @author eduardadelima */ public class JUnitTestandoGroupBy extends TestCase { public JUnitTestandoGroupBy() { } GroupBy gb = new GroupBy(); public void testGroupMax() throws FileNotFoundException { gb.comMax("Funcionarios", "5", "idCargo"); System.out.println(gb.gerador()); assertEquals("SELECT idCargo, MAX(5) FROM Funcionarios GROUP BY idCargo;", this); gb.geraSQL("src/Arquivos/scriptGroupBy.sql"); } public void testGroupCount() { gb.Count("Funcionarios", "idCargo"); System.out.println(gb.gerador()); assertEquals("SELECT idCargo, COUNT(*) FROM Funcionarios GROUP BY idCargo;", this); } /*public void testConsultaseOperacoes() { gp.GroupByMax("idCargo", "5", "Funcionario"); gp.GroupByCountSimples("idCargo", "Funcionario"); }*/ }
[ "delimadosanjoseduarda@gmail.com" ]
delimadosanjoseduarda@gmail.com
a619af244a3e4c8f0be8b7f48519fe068d2f1bc2
23e01ee3ce3aa0857ce5987baaed8af99a3b5da2
/user-services-basic/src/main/java/com/lgmn/userservices/basic/entity/LgmnFormControlPropsEntity.java
3febc544d4d38af4f92909f90385e65cedc1b8e2
[]
no_license
uma-511/lgmn-user-services
0c23d468a033b4e91cf0c9b87f519f8f04c68276
d65844aadc6e7f7ab683acd9031287ff512be0f1
refs/heads/master
2023-01-07T11:45:18.064793
2020-01-17T07:40:34
2020-01-17T07:40:34
312,195,788
0
0
null
null
null
null
UTF-8
Java
false
false
2,775
java
package com.lgmn.userservices.basic.entity; import javax.persistence.*; import java.util.Objects; @Entity @Table(name = "lgmn_form_control_props", schema = "lgmn_user_services", catalog = "") public class LgmnFormControlPropsEntity { private int id; private int lfcId; private String key; private String value; private String type; private String group; private Integer multilang; private Integer langId; @Id @Column(name = "id", nullable = false) public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name = "lfc_id", nullable = false) public int getLfcId() { return lfcId; } public void setLfcId(int lfcId) { this.lfcId = lfcId; } @Basic @Column(name = "key", nullable = false, length = 20) public String getKey() { return key; } public void setKey(String key) { this.key = key; } @Basic @Column(name = "value", nullable = true, length = 20) public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Basic @Column(name = "type", nullable = true, length = 20) public String getType() { return type; } public void setType(String type) { this.type = type; } @Basic @Column(name = "group", nullable = true, length = 20) public String getGroup() { return group; } public void setGroup(String group) { this.group = group; } @Basic @Column(name = "multilang", nullable = true) public Integer getMultilang() { return multilang; } public void setMultilang(Integer multilang) { this.multilang = multilang; } @Basic @Column(name = "lang_id", nullable = true) public Integer getLangId() { return langId; } public void setLangId(Integer langId) { this.langId = langId; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LgmnFormControlPropsEntity that = (LgmnFormControlPropsEntity) o; return id == that.id && lfcId == that.lfcId && Objects.equals(key, that.key) && Objects.equals(value, that.value) && Objects.equals(type, that.type) && Objects.equals(group, that.group) && Objects.equals(multilang, that.multilang) && Objects.equals(langId, that.langId); } @Override public int hashCode() { return Objects.hash(id, lfcId, key, value, type, group, multilang, langId); } }
[ "511639411@qq.com" ]
511639411@qq.com
7cefe022a937ea8541beee2cbc90ea1c6834c65e
75c4fbd316738f0bf1dcc350c8bfbcac4f94e68b
/luna-core/src/main/java/com/thrashplay/luna/math/Vector2D.java
08dcc062c926397f16bceaebc2abd9da053b3dc3
[]
no_license
skleinjung-archive/luna
9793f4772b489231033d76158fdcc6ff4c5a34f8
b880c71f10ed5bbf3370cc570a7310734a0a7111
refs/heads/master
2020-03-13T03:08:38.377112
2018-05-02T17:06:16
2018-05-02T17:06:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package com.thrashplay.luna.math; /** * TODO: Add class documentation * * @author Sean Kleinjung */ public class Vector2D { private double x; private double y; public Vector2D() { } public Vector2D(double x, double y) { this.x = x; this.y = y; } public double getX() { return x; } public void setX(double x) { this.x = x; } public double getY() { return y; } public void setY(double y) { this.y = y; } }
[ "sean@bluegoji.com" ]
sean@bluegoji.com
a029795cd0637df5f33780893e3d76e5cf630196
02b38767a1e59f4014c65f3fe17fd7ae5c51b013
/media/src/main/java/com/chuncheng/sample/media/video/manager/mssage/player/ClearAbstractPlayerInstanceMessage.java
55b227705c009f2c54c8b9f5409b59530895ce0e
[]
no_license
zhangchuncheng/ScalableMedia
3256d354b0c0302fcf991c2e38c8b8289be5ff8b
e6ae656ca93034ce6f5d78a6a63920d46053c30a
refs/heads/master
2021-06-28T21:12:21.060823
2020-10-12T03:20:51
2020-10-12T03:20:51
137,838,034
3
1
null
null
null
null
UTF-8
Java
false
false
1,290
java
package com.chuncheng.sample.media.video.manager.mssage.player; import com.chuncheng.sample.media.video.manager.PlayerMessageState; import com.chuncheng.sample.media.video.manager.VideoPlayerManagerCallback; import com.chuncheng.sample.media.video.manager.mssage.AbstractPlayerMessage; import com.chuncheng.sample.media.video.ui.VideoPlayerView; /** * Description:清除播放器实例消息 * * @author: zhangchuncheng * @date: 2017/3/22 */ public class ClearAbstractPlayerInstanceMessage extends AbstractPlayerMessage { private PlayerMessageState mPlayerMessageState; public ClearAbstractPlayerInstanceMessage(VideoPlayerView playerView, VideoPlayerManagerCallback callback) { super(playerView, callback); } @Override protected void performAction(VideoPlayerView videoPlayerView) { videoPlayerView.clearPlayerInstance(); mPlayerMessageState = PlayerMessageState.PLAYER_INSTANCE_CLEARED; } @Override protected PlayerMessageState stateBefore() { return PlayerMessageState.CLEARING_PLAYER_INSTANCE; } @Override protected PlayerMessageState stateAfter() { return mPlayerMessageState; } @Override protected String getName() { return "name:ClearPlayerInstanceMessage"; } }
[ "zhangchuncheng@allinmd.cn" ]
zhangchuncheng@allinmd.cn
ed5d89ee3be48b36ebc1a2bf45c042e1a1d68f37
295ba07d516ac19863691c923e811cceb63b4638
/src/main/java/com/lzw/hrmsys/domain/Job.java
b24ea1dc08313099c129416305984183217d12ff
[]
no_license
1987Mn/SSM-hrm
8ddd52adcd046703e94f05dbd3b5480b36dbccb8
a00d32925297ad1f489c187fd83354ae961da136
refs/heads/master
2022-12-21T11:48:38.571336
2020-03-18T02:03:08
2020-03-18T02:03:08
248,113,413
0
0
null
2022-12-16T11:36:32
2020-03-18T01:47:07
JavaScript
UTF-8
Java
false
false
966
java
package com.lzw.hrmsys.domain; public class Job { private Integer id; private String name; private String remark; public Job() { } public Job(Integer id, String name, String remark) { this.id = id; this.name = name; this.remark = remark; } @Override public String toString() { return "Job{" + "id=" + id + ", name='" + name + '\'' + ", remark='" + remark + '\'' + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark == null ? null : remark.trim(); } }
[ "2312341@qq.com" ]
2312341@qq.com
a80cbd033413b4f362fd6a19a547ac4837213a04
1695529661fbcd37aba21493153393b78a146f68
/Utilkhh/src/khh/db/connection/pool/ConnectionQueue.java
40bcab47bb22e681721b69545d9406081855a46b
[]
no_license
visualkhh/lib-java
b3d33ac72b2c7d1923b580cde53a7ba7b94aa3c7
54a832881b58f7378b403be95be39dc8d6e66349
refs/heads/master
2021-06-11T18:27:21.846677
2016-11-04T00:39:55
2016-11-04T00:39:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,092
java
package khh.db.connection.pool; import java.util.ArrayList; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import khh.db.connection.ConnectionCreator_I; import khh.debug.LogK; public class ConnectionQueue extends Thread{ private int min = 1; private int max = 10; private long pollTimeoutms = 10000; private ConnectionCreator_I creator; private ArrayList<ConnectionPool_Connection> storege; private LinkedBlockingQueue<ConnectionPool_Connection> queue; private LogK log = LogK.getInstance(); public ConnectionQueue(ConnectionCreator_I creator, int max) { this.creator = creator; this.max = max; init(); } private void init() { storege = new ArrayList<ConnectionPool_Connection>(); queue = new LinkedBlockingQueue<ConnectionPool_Connection>(); try { storege.add(new ConnectionPool_Connection(getCreator().getMakeConnection())); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public int getMin() { return min; } public void setMin(int min) { this.min = min; } public int getMax() { return max; } public void setMax(int max) { this.max = max; } public ConnectionCreator_I getCreator() { return creator; } public void setCreator(ConnectionCreator_I creator) { this.creator = creator; } public long getPollTimeoutms() { return pollTimeoutms; } public void setPollTimeoutms(long pollTimeoutms) { this.pollTimeoutms = pollTimeoutms; } public void run() { //계속돌면서 넣어줘야함 while(true){ try {Thread.sleep(100);} catch (InterruptedException e1) {e1.printStackTrace();} for (int i = 0; i < storege.size(); i++){ //사용가능한것이 있을때 queue에 넣는다. try{ ConnectionPool_Connection c = storege.get(i); //log.debug("Connection State:"+c+" storege.size("+storege.size()+") qsize:"+queue.size()); if(c.isClosed()){ //사용가능한것이 있을때 queue에 넣는다. c.open(); if(!queue.contains(c)){ queue.put(c); log.debug("move BlockingQueue("+c+") storege.size("+storege.size()+") qsize:"+queue.size()); } }; if(storege.size()<max && queue.size()<=0){ try { storege.add(new ConnectionPool_Connection(getCreator().getMakeConnection())); log.debug("Full Busy storege.size("+storege.size()+") qsize:"+queue.size()+" (setting -> min:"+getMin()+", max:"+getMax()+") -> add one Connection Create"); } catch (Exception e) {e.printStackTrace();} } }catch(Exception e){log.debug("queue Error",e);} } } } public ConnectionPool_Connection poll() throws InterruptedException{ return poll(getPollTimeoutms()); } public ConnectionPool_Connection poll(long pollTimeoutms) throws InterruptedException { ConnectionPool_Connection i = queue.poll(pollTimeoutms, TimeUnit.MILLISECONDS); if(null==i){ log.debug("getConnection TimeOut wite mills: "+pollTimeoutms); } return i; } }
[ "visualkhh@gmail.com" ]
visualkhh@gmail.com
c1a0cad47621534fc815ba820fe1582b301b384c
92225460ebca1bb6a594d77b6559b3629b7a94fa
/src/com/kingdee/eas/fdc/market/client/AreaSetListUI.java
af2d024949ff56e730b20f6136d4e504dea13aff
[]
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
1,762
java
/** * output package name */ package com.kingdee.eas.fdc.market.client; import org.apache.log4j.Logger; import com.kingdee.bos.ui.face.CoreUIObject; import com.kingdee.eas.basedata.org.OrgConstants; import com.kingdee.eas.basedata.org.SaleOrgUnitInfo; import com.kingdee.eas.common.client.UIFactoryName; import com.kingdee.eas.fdc.basedata.FDCDataBaseInfo; import com.kingdee.eas.fdc.basedata.client.FDCClientHelper; import com.kingdee.eas.fdc.market.AreaSetFactory; import com.kingdee.eas.fdc.market.AreaSetInfo; import com.kingdee.eas.fdc.sellhouse.client.SHEHelper; import com.kingdee.eas.framework.ICoreBase; /** * output class name */ public class AreaSetListUI extends AbstractAreaSetListUI { private static final Logger logger = CoreUIObject.getLogger(AreaSetListUI.class); SaleOrgUnitInfo saleOrg = SHEHelper.getCurrentSaleOrg(); /** * output class constructor */ public AreaSetListUI() throws Exception { super(); } public void onLoad() throws Exception { super.onLoad(); FDCClientHelper.addSqlMenu(this, this.menuEdit); if (!saleOrg.getId().toString().equals(OrgConstants.DEF_CU_ID)){ actionAddNew.setEnabled(false); actionEdit.setEnabled(false); actionRemove.setEnabled(false); } } /** * output storeFields method */ public void storeFields() { super.storeFields(); } protected FDCDataBaseInfo getBaseDataInfo() { return new AreaSetInfo(); } protected ICoreBase getBizInterface() throws Exception { return AreaSetFactory.getRemoteInstance(); } protected String getEditUIName() { return com.kingdee.eas.fdc.market.client.AreaSetEditUI.class.getName(); } protected String getEditUIModal() { return UIFactoryName.MODEL; } }
[ "yfsmile@qq.com" ]
yfsmile@qq.com
d26d58321e0b4a1a6e0d0d73af913512fbf7298a
a25b0cf7fc632540d29875bfcf0489424f6ef839
/YiBaoTong/libDialog/src/main/java/ybt/library/dialog/bean/CCountysBean.java
2fee3aec5860fad7082b6a2c0270c5a68a7c7707
[]
no_license
ILoveLin/YibaoTong
6ace12e7d829e9680097c0b0e0b59ea0ae3e7f07
a885b90a186e1fa3413a4b2c438c0721bdf428e8
refs/heads/master
2021-10-28T04:49:50.532101
2019-04-22T06:51:34
2019-04-22T06:51:34
182,638,313
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
package ybt.library.dialog.bean; import java.io.Serializable; /** * 县级城市 * Created by yang on 2017/01/05. */ public class CCountysBean implements Serializable { private String county; private String county_id; public String getCounty() { return county; } public void setCounty(String county) { this.county = county; } public String getCounty_id() { return county_id; } public void setCounty_id(String county_id) { this.county_id = county_id; } }
[ "tongzhengtong@126.com" ]
tongzhengtong@126.com
84cb807c6001c6506ad88307ce4856d05b0676c4
4b9cbe7cc1cbe526454788aecbb2499cc59f0c8a
/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/audit/SamlRequestAuditResourceResolver.java
c032ae00ae02c1cd61cd28bef29b92092d4cf2a7
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
jimmytheneutrino/cas
e631b5ef878bfff2fdede7f596688f6f2b9ac8ae
1a200a7122a343d3e463ff02872c49079e5dae0f
refs/heads/master
2019-07-11T13:46:08.499721
2018-07-04T16:18:25
2018-07-04T16:18:25
114,123,654
0
0
Apache-2.0
2018-07-04T16:18:26
2017-12-13T13:23:07
Java
UTF-8
Java
false
false
2,251
java
package org.apereo.cas.support.saml.web.idp.audit; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.tuple.Pair; import org.apereo.inspektr.audit.spi.support.ReturnValueAsStringResourceResolver; import org.aspectj.lang.JoinPoint; import org.opensaml.core.xml.XMLObject; import org.opensaml.saml.saml2.core.AuthnRequest; import org.opensaml.saml.saml2.core.LogoutRequest; /** * This is {@link SamlRequestAuditResourceResolver}. * * @author Misagh Moayyed * @since 5.3.0 */ @Slf4j public class SamlRequestAuditResourceResolver extends ReturnValueAsStringResourceResolver { @Override public String[] resolveFrom(final JoinPoint joinPoint, final Object returnValue) { if (returnValue instanceof Pair) { return getAuditResourceFromSamlRequest((Pair) returnValue); } return new String[]{}; } private String[] getAuditResourceFromSamlRequest(final Pair result) { final var returnValue = (XMLObject) result.getLeft(); if (returnValue instanceof AuthnRequest) { return getAuditResourceFromSamlAuthnRequest((AuthnRequest) returnValue); } if (returnValue instanceof LogoutRequest) { return getAuditResourceFromSamlLogoutRequest((LogoutRequest) returnValue); } return new String[]{}; } private String[] getAuditResourceFromSamlLogoutRequest(final LogoutRequest returnValue) { final var request = returnValue; final var result = new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE) .append("issuer", request.getIssuer().getValue()) .toString(); return new String[]{result}; } private String[] getAuditResourceFromSamlAuthnRequest(final AuthnRequest returnValue) { final var request = returnValue; final var result = new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE) .append("issuer", request.getIssuer().getValue()) .append("binding", request.getProtocolBinding()) .toString(); return new String[]{result}; } }
[ "mmoayyed@unicon.net" ]
mmoayyed@unicon.net
b12eb117ed3d36d297cb16e89218901e98d510ca
d9d882893fc26c1c45a525087f00c10a9ea02fb3
/src/Demo/GetTupleFromRelationIterator.java
71de59bbb4222685217508c608c9e1761f2757cd
[]
no_license
gbkjunior/SortingToCyDIW
1e38203aa228453a5349588dbcd68b5713c0c426
7cd11fffb157bb15f41a72e57bfcae0b55e4fbe5
refs/heads/master
2021-05-01T20:11:49.948261
2018-02-09T22:42:05
2018-02-09T22:42:05
120,961,295
0
0
null
null
null
null
UTF-8
Java
false
false
2,763
java
package Demo; import java.io.File; import java.nio.ByteBuffer; import PTCFramework.ProducerIterator; import StorageManager.Storage; import storagemanager.StorageConfig; import storagemanager.StorageUtils; import cysystem.diwGUI.gui.*; import cycsx.csxpagination.util.Constant; import storagemanager.StorageConfig; import storagemanager.FileStorageManager; import storagemanager.StorageManagerClient; import storagemanager.StorageDirectoryDocument; public class GetTupleFromRelationIterator implements ProducerIterator<byte []>{ String filename; int tuplelength; int currentpage; int count = 0; int nextPage; int numbytesread; int pagesize; Storage s; byte[] mainbuffer; private StorageManagerClient xmlClient; public GetTupleFromRelationIterator(String filename, int tuplelength, int currentpage){ this.filename = filename; this.tuplelength = tuplelength; this.nextPage = currentpage; } public void open() throws Exception{ s = new Storage(); //s.LoadStorage(filename); StorageUtils su = new StorageUtils(); String fileName ="StorageConfig.xml" ; File fStorageConfig = new File(fileName); if (!fStorageConfig.exists()) { System.out.println("Please make sure storage config exists"); } // Please remember to set storageConfig first before createStorage and useStorage StorageConfig temp = new StorageConfig(fStorageConfig); su.loadStorage(temp); this.pagesize = s.pageSize; } public void checkNextPage() throws Exception{ if(nextPage!=-1){ currentpage = nextPage; byte[] buffer = new byte[pagesize]; //s.ReadPage(currentpage, buffer); xmlClient.readPagewithoutPin(currentpage); mainbuffer = buffer; numbytesread = 8; int size = 4; byte[] countval = new byte[size]; for(int i=0; i<4; i++){ countval[i] = buffer[i]; } count = ByteBuffer.wrap(countval).getInt(); for(int i=0; i<4; i++){ countval[i] = buffer[i+4]; } nextPage = ByteBuffer.wrap(countval).getInt(); } } public boolean hasNext(){ if(count<=0){ try { checkNextPage(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if(count>0){ return true; } else{ return false; } } return true; } public void prinnext(){ System.out.println(count); count--; } public byte[] next(){ byte[] res = new byte[tuplelength]; for(int i=0; i<tuplelength; i++){ res[i] = mainbuffer[numbytesread+i]; } numbytesread+=tuplelength; count--; return res; } @Override public void close() throws Exception { // TODO Auto-generated method stub } }
[ "gbvijayadeepak@gmail.com" ]
gbvijayadeepak@gmail.com
80795f2f5a5c84598f867e30c78a1ffd54e9b13b
5dee48937a738bebbc5b6d4bda1175c954dbc4bc
/src/main/java/org/semux/gui/model/WalletDelegate.java
53607359985813ccb0d296d96da39d9b34c5e004
[ "MIT" ]
permissive
pelenthium/semux
93e7472031d01bee763cacee1b94564621e4a9b3
174cd0460978020448862ddcda730ef2ae23dda1
refs/heads/master
2021-05-07T00:13:58.616152
2017-11-09T04:29:01
2017-11-09T04:29:01
110,088,883
0
0
null
2017-11-09T08:37:45
2017-11-09T08:37:44
null
UTF-8
Java
false
false
1,364
java
package org.semux.gui.model; import org.semux.core.state.Delegate; public class WalletDelegate extends Delegate { protected long votesFromMe; protected long numberOfBlocksForged; protected long numberOfTurnsHit; protected long numberOfTurnsMissed; public WalletDelegate(Delegate d) { super(d.getAddress(), d.getName(), d.getRegisteredAt(), d.getVotes()); } public long getVotesFromMe() { return votesFromMe; } public void setVotesFromMe(long votesFromMe) { this.votesFromMe = votesFromMe; } public long getNumberOfBlocksForged() { return numberOfBlocksForged; } public void setNumberOfBlocksForged(long numberOfBlocksForged) { this.numberOfBlocksForged = numberOfBlocksForged; } public long getNumberOfTurnsHit() { return numberOfTurnsHit; } public void setNumberOfTurnsHit(long numberOfTurnsHit) { this.numberOfTurnsHit = numberOfTurnsHit; } public long getNumberOfTurnsMissed() { return numberOfTurnsMissed; } public void setNumberOfTurnsMissed(long numberOfTurnsMissed) { this.numberOfTurnsMissed = numberOfTurnsMissed; } public double getRate() { long total = numberOfTurnsHit + numberOfTurnsMissed; return total == 0 ? 0 : numberOfTurnsHit * 100.0 / total; } }
[ "dev@semux.org" ]
dev@semux.org
283869ec4bff18955a81c6041d1cee06945b4e24
4e6311f196223dfe6c7443f732c0f8a184107b30
/app/src/androidTest/java/br/com/mrcsfelipe/voo/ApplicationTest.java
e068304ce67cf3a9e624f25941835b08b06a6280
[]
no_license
MarcosiOSdev/Android----ListAdpter-e-Parceble
e1550dff6b7741d61a6fcad01e2635f77c9261f7
902301447707b49522c953f50db034b230ab80fb
refs/heads/master
2021-05-29T20:56:47.822806
2015-10-26T21:45:42
2015-10-26T21:45:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package br.com.mrcsfelipe.voo; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "mfelipesp@gmail.com" ]
mfelipesp@gmail.com
7de1f2bec65e56cbf0ea3c5187b5bd6c0f3e25f7
8e24c354edf308a9fa48aa61ea15b489c65a4d1e
/src/main/java/com/neusoft/controller/TranTestController.java
fdc3f16f9c09e32c4afb98f62d4785416ee775d5
[]
no_license
huang0843/powermanager
d7934ca4b1419b50bf02bde8a4604c7009846653
6d8d488fe1dc47b46ed2b4fa29fdec9890aa31de
refs/heads/master
2022-12-26T17:14:24.860785
2020-02-29T03:11:46
2020-02-29T03:11:46
217,663,346
0
0
null
2022-12-16T05:46:46
2019-10-26T05:59:14
JavaScript
UTF-8
Java
false
false
788
java
package com.neusoft.controller; import com.neusoft.bean.Manager; import com.neusoft.service.IManagerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("index") public class TranTestController { @Autowired private IManagerService service; @ResponseBody @RequestMapping("test1") public Object test1(Manager manager){ service.saveManager(manager); return manager; } @ResponseBody @RequestMapping("test2") public Object test2(Manager manager){ service.saveManager2(manager); return manager; } }
[ "huanghui0843@163.com" ]
huanghui0843@163.com
df26831c3aa5d2d41d95c76647f090a35311aec1
fee4b7ff8a9172541639f280bbe52cc739d3a9c7
/1_Gloves.java
d85b962fafa02922855a92dc694c3f96e9fd5228
[]
no_license
andli0626/CodeEveryday
2aa67c9953433378af2eb5e6732effbdd022c448
6d54e3af8c8077614a0b5f33dd4e6b5d22da225d
refs/heads/master
2020-12-25T11:52:32.827465
2016-05-10T12:58:54
2016-05-10T12:58:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,344
java
import java.util.*; public class Gloves { public static int findMinimum(int n, int[] left, int[] right) { // write code here int selectNum = 0; if(n==0||left==null||right==null||left.length==0||right.length==0) return selectNum; int tmpSelectNum = 0; tmpSelectNum = findOneColorCost(left,right)+getAllColorCost(left,right); selectNum = findOneColorCost(right,left)+getAllColorCost(right,left); if(tmpSelectNum<selectNum) return tmpSelectNum; return selectNum; } public static int findOneColorCost(int[] array1,int[] array2){ int cost = 0; for(int i=0; i<array1.length; i++) if(array2[i]==0) cost += array1[i]; cost++; return cost; } public static int getAllColorCost(int[] array1,int[] array2){ int min = -1; int cost = 0; for(int j=0; j<array1.length; j++){ if(min==-1&&array2[j]!=0) min = array2[j]; else if(min!=-1&&array2[j]<min&&array2[j]!=0) min = array2[j]; cost += array2[j]; } if(min>1) cost = cost - min + 1; return cost; } public static void main(String[] args){ int [] left = {1,2,0,1,3,1}; int [] right= {0,0,0,2,0,1}; System.out.println(findMinimum(6,left,right)); } }
[ "jensenczx@gmail.com" ]
jensenczx@gmail.com
04991e85867009cfbfb3db3291dce069a3f9d351
648e697be9b56cb50aa1b455dcc1d2f6cfef099b
/src/main/java/fr/tolan/safetynetalerts/exceptions/CustomizedResponseEntityExceptionHandler.java
c28c827e75ebd87118b23c5bad98f297b4685243
[]
no_license
xTbeniaminTx/SafetyNet-Alerts
b3d3cb7d6c66e5391b7b25e71652f96e5420a6ac
9622381d4579a5f43c92f72657497919e70108cf
refs/heads/main
2023-05-09T14:47:02.566531
2021-05-29T21:38:09
2021-05-29T21:38:09
370,968,274
0
0
null
null
null
null
UTF-8
Java
false
false
1,883
java
package fr.tolan.safetynetalerts.exceptions; import java.util.Date; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; @ControllerAdvice @RestController public class CustomizedResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(Exception.class) public final ResponseEntity<Object> handleAllExceptions(Exception ex, WebRequest request) { ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), ex.getMessage(), request.getDescription(false)); return new ResponseEntity(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR); } @ExceptionHandler(PersonNotFoundException.class) public final ResponseEntity<Object> handlePersonNotFoundException(PersonNotFoundException ex, WebRequest request) { ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), ex.getMessage(), request.getDescription(false)); return new ResponseEntity(exceptionResponse, HttpStatus.NOT_FOUND); } @Override protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), "Validation Failed", ex.getBindingResult().toString()); return new ResponseEntity(exceptionResponse, HttpStatus.BAD_REQUEST); } }
[ "39988307+xTbeniaminTx@users.noreply.github.com" ]
39988307+xTbeniaminTx@users.noreply.github.com
a884d95899c0e3aaf86cbf0b504548b4efe176c0
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/dds-20151201/src/main/java/com/aliyun/dds20151201/models/ModifyDBInstanceConnectionStringRequest.java
579fc2c95a48bc8d3ca39d97ebca07a0be58eab2
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
4,672
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.dds20151201.models; import com.aliyun.tea.*; public class ModifyDBInstanceConnectionStringRequest extends TeaModel { /** * <p>The current connection string, which is to be modified.</p> */ @NameInMap("CurrentConnectionString") public String currentConnectionString; /** * <p>The ID of the instance.</p> * <br> * <p>> If you set this parameter to the ID of a sharded cluster instance, you must also specify the **NodeId** parameter.</p> */ @NameInMap("DBInstanceId") public String DBInstanceId; /** * <p>The new connection string. It must be 8 to 64 characters in length and can contain letters and digits. It must start with a lowercase letter.</p> * <br> * <p>> You need only to specify the prefix of the connection string. The content other than the prefix cannot be modified.</p> */ @NameInMap("NewConnectionString") public String newConnectionString; /** * <p>this parameter can be used. The new port should be within the range of 1000 to 65535.</p> * <p>>When the DBInstanceId parameter is passed in as a cloud disk instance ID</p> */ @NameInMap("NewPort") public Integer newPort; /** * <p>The ID of the mongos in the specified sharded cluster instance. Only one mongos ID can be specified in each call.</p> * <br> * <p>> This parameter is valid only if you set the **DBInstanceId** parameter to the ID of a sharded cluster instance.</p> */ @NameInMap("NodeId") public String nodeId; @NameInMap("OwnerAccount") public String ownerAccount; @NameInMap("OwnerId") public Long ownerId; @NameInMap("ResourceOwnerAccount") public String resourceOwnerAccount; @NameInMap("ResourceOwnerId") public Long resourceOwnerId; @NameInMap("SecurityToken") public String securityToken; public static ModifyDBInstanceConnectionStringRequest build(java.util.Map<String, ?> map) throws Exception { ModifyDBInstanceConnectionStringRequest self = new ModifyDBInstanceConnectionStringRequest(); return TeaModel.build(map, self); } public ModifyDBInstanceConnectionStringRequest setCurrentConnectionString(String currentConnectionString) { this.currentConnectionString = currentConnectionString; return this; } public String getCurrentConnectionString() { return this.currentConnectionString; } public ModifyDBInstanceConnectionStringRequest setDBInstanceId(String DBInstanceId) { this.DBInstanceId = DBInstanceId; return this; } public String getDBInstanceId() { return this.DBInstanceId; } public ModifyDBInstanceConnectionStringRequest setNewConnectionString(String newConnectionString) { this.newConnectionString = newConnectionString; return this; } public String getNewConnectionString() { return this.newConnectionString; } public ModifyDBInstanceConnectionStringRequest setNewPort(Integer newPort) { this.newPort = newPort; return this; } public Integer getNewPort() { return this.newPort; } public ModifyDBInstanceConnectionStringRequest setNodeId(String nodeId) { this.nodeId = nodeId; return this; } public String getNodeId() { return this.nodeId; } public ModifyDBInstanceConnectionStringRequest setOwnerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; return this; } public String getOwnerAccount() { return this.ownerAccount; } public ModifyDBInstanceConnectionStringRequest setOwnerId(Long ownerId) { this.ownerId = ownerId; return this; } public Long getOwnerId() { return this.ownerId; } public ModifyDBInstanceConnectionStringRequest setResourceOwnerAccount(String resourceOwnerAccount) { this.resourceOwnerAccount = resourceOwnerAccount; return this; } public String getResourceOwnerAccount() { return this.resourceOwnerAccount; } public ModifyDBInstanceConnectionStringRequest setResourceOwnerId(Long resourceOwnerId) { this.resourceOwnerId = resourceOwnerId; return this; } public Long getResourceOwnerId() { return this.resourceOwnerId; } public ModifyDBInstanceConnectionStringRequest setSecurityToken(String securityToken) { this.securityToken = securityToken; return this; } public String getSecurityToken() { return this.securityToken; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
5a3828e48306394bab45fb5af3e536b3d19e4c93
c27a9ab18791cbcd5b99f24a90c9d33b02b84d99
/src/main/java/io/github/juliandresbv/jhipster/mg/application/config/CloudDatabaseConfiguration.java
7bd46af262ad26404e94a7ee79f4cfad833f89fe
[]
no_license
juliandresbv/JHMicroservicesGatewayApplication
4f31241a50244d5773bf6641846fa53acdbd4f4f
ba958edf54166d27e365e4d886c26251bd25ecdf
refs/heads/master
2021-08-23T11:16:32.627612
2017-12-04T17:04:09
2017-12-04T17:04:09
113,070,651
0
0
null
null
null
null
UTF-8
Java
false
false
3,153
java
package io.github.juliandresbv.jhipster.mg.application.config; import com.github.mongobee.Mongobee; import io.github.jhipster.config.JHipsterConstants; import io.github.jhipster.domain.util.JSR310DateConverters.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cache.CacheManager; import org.springframework.cloud.Cloud; import org.springframework.cloud.CloudException; import org.springframework.cloud.config.java.AbstractCloudConfig; import org.springframework.cloud.service.ServiceInfo; import org.springframework.cloud.service.common.MongoServiceInfo; import org.springframework.context.annotation.*; import org.springframework.core.convert.converter.Converter; import org.springframework.data.mongodb.MongoDbFactory; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.convert.CustomConversions; import org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import java.util.ArrayList; import java.util.List; @Configuration @EnableMongoRepositories("io.github.juliandresbv.jhipster.mg.application.repository") @Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) public class CloudDatabaseConfiguration extends AbstractCloudConfig { private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); @Bean public MongoDbFactory mongoFactory() { return connectionFactory().mongoDbFactory(); } @Bean public LocalValidatorFactoryBean validator() { return new LocalValidatorFactoryBean(); } @Bean public ValidatingMongoEventListener validatingMongoEventListener() { return new ValidatingMongoEventListener(validator()); } @Bean public CustomConversions customConversions() { List<Converter<?, ?>> converterList = new ArrayList<>(); converterList.add(DateToZonedDateTimeConverter.INSTANCE); converterList.add(ZonedDateTimeToDateConverter.INSTANCE); return new CustomConversions(converterList); } @Bean public Mongobee mongobee(MongoDbFactory mongoDbFactory, MongoTemplate mongoTemplate, Cloud cloud) { log.debug("Configuring Cloud Mongobee"); List<ServiceInfo> matchingServiceInfos = cloud.getServiceInfos(MongoDbFactory.class); if (matchingServiceInfos.size() != 1) { throw new CloudException("No unique service matching MongoDbFactory found. Expected 1, found " + matchingServiceInfos.size()); } MongoServiceInfo info = (MongoServiceInfo) matchingServiceInfos.get(0); Mongobee mongobee = new Mongobee(info.getUri()); mongobee.setDbName(mongoDbFactory.getDb().getName()); mongobee.setMongoTemplate(mongoTemplate); // package to scan for migrations mongobee.setChangeLogsScanPackage("io.github.juliandresbv.jhipster.mg.application.config.dbmigrations"); mongobee.setEnabled(true); return mongobee; } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
3b3f2467813be7bfa17c39bfaa78bac89c7b6e7d
4d37505edab103fd2271623b85041033d225ebcc
/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java
d8a1dbe05b484de9aad9db610a61514e7ff857ff
[ "Apache-2.0" ]
permissive
huifer/spring-framework-read
1799f1f073b65fed78f06993e58879571cc4548f
73528bd85adc306a620eedd82c218094daebe0ee
refs/heads/master
2020-12-08T08:03:17.458500
2020-03-02T05:51:55
2020-03-02T05:51:55
232,931,630
6
2
Apache-2.0
2020-03-02T05:51:57
2020-01-10T00:18:15
Java
UTF-8
Java
false
false
1,323
java
/* * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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.springframework.aop.target; /** * Config interface for a pooling target source. * * @author Rod Johnson * @author Juergen Hoeller */ public interface PoolingConfig { /** * Return the maximum size of the pool. */ int getMaxSize(); /** * Return the number of active objects in the pool. * * @throws UnsupportedOperationException if not supported by the pool */ int getActiveCount() throws UnsupportedOperationException; /** * Return the number of idle objects in the pool. * * @throws UnsupportedOperationException if not supported by the pool */ int getIdleCount() throws UnsupportedOperationException; }
[ "huifer97@163.com" ]
huifer97@163.com
a9c164043257bac9e73657bb7dc8a77afd70a8bb
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/neo4j--neo4j/2023711f17b5c616aa93d72df8986377948c8275/before/CoreServerModule.java
cf05ff7d76ddd1e090f9cd71ec42fd2e7bc484ce
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
8,894
java
/* * Copyright (c) 2002-2016 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.coreedge.core.server; import java.io.File; import java.io.IOException; import java.util.function.Supplier; import org.neo4j.coreedge.ReplicationModule; import org.neo4j.coreedge.catchup.CatchUpClient; import org.neo4j.coreedge.catchup.CatchupServer; import org.neo4j.coreedge.catchup.CheckpointerSupplier; import org.neo4j.coreedge.catchup.DataSourceSupplier; import org.neo4j.coreedge.catchup.storecopy.LocalDatabase; import org.neo4j.coreedge.catchup.storecopy.StoreCopyClient; import org.neo4j.coreedge.catchup.storecopy.StoreFetcher; import org.neo4j.coreedge.catchup.tx.TransactionLogCatchUpFactory; import org.neo4j.coreedge.catchup.tx.TxPullClient; import org.neo4j.coreedge.core.CoreEdgeClusterSettings; import org.neo4j.coreedge.core.consensus.ConsensusModule; import org.neo4j.coreedge.core.consensus.ContinuousJob; import org.neo4j.coreedge.core.consensus.RaftMessages; import org.neo4j.coreedge.core.consensus.RaftServer; import org.neo4j.coreedge.core.consensus.log.pruning.PruningScheduler; import org.neo4j.coreedge.core.consensus.membership.MembershipWaiter; import org.neo4j.coreedge.core.consensus.membership.MembershipWaiterLifecycle; import org.neo4j.coreedge.core.state.CommandApplicationProcess; import org.neo4j.coreedge.core.state.CoreState; import org.neo4j.coreedge.core.state.CoreStateApplier; import org.neo4j.coreedge.core.state.LongIndexMarshal; import org.neo4j.coreedge.core.state.machines.CoreStateMachinesModule; import org.neo4j.coreedge.core.state.snapshot.CoreStateDownloader; import org.neo4j.coreedge.core.state.storage.DurableStateStorage; import org.neo4j.coreedge.core.state.storage.StateStorage; import org.neo4j.coreedge.discovery.CoreTopologyService; import org.neo4j.coreedge.identity.MemberId; import org.neo4j.coreedge.logging.MessageLogger; import org.neo4j.coreedge.messaging.CoreReplicatedContentMarshal; import org.neo4j.coreedge.messaging.LoggingInbound; import org.neo4j.coreedge.messaging.address.ListenSocketAddress; import org.neo4j.coreedge.messaging.routing.NotMyselfSelectionStrategy; import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.impl.factory.PlatformModule; import org.neo4j.kernel.impl.logging.LogService; import org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore; import org.neo4j.kernel.impl.transaction.log.TransactionIdStore; import org.neo4j.kernel.impl.util.Dependencies; import org.neo4j.kernel.impl.util.JobScheduler; import org.neo4j.kernel.internal.DatabaseHealth; import org.neo4j.kernel.lifecycle.LifeSupport; import org.neo4j.logging.LogProvider; import org.neo4j.time.Clocks; import static org.neo4j.kernel.impl.util.JobScheduler.SchedulingStrategy.NEW_THREAD; public class CoreServerModule { public final MembershipWaiterLifecycle membershipWaiterLifecycle; public CoreServerModule( MemberId myself, final PlatformModule platformModule, ConsensusModule consensusModule, CoreStateMachinesModule coreStateMachinesModule, ReplicationModule replicationModule, File clusterStateDirectory, CoreTopologyService discoveryService, LocalDatabase localDatabase, MessageLogger<MemberId> messageLogger ) { final Dependencies dependencies = platformModule.dependencies; final Config config = platformModule.config; final LogService logging = platformModule.logging; final FileSystemAbstraction fileSystem = platformModule.fileSystem; final LifeSupport life = platformModule.life; LogProvider logProvider = logging.getInternalLogProvider(); final Supplier<DatabaseHealth> databaseHealthSupplier = dependencies.provideDependency( DatabaseHealth.class ); StateStorage<Long> lastFlushedStorage; lastFlushedStorage = life.add( new DurableStateStorage<>( fileSystem, clusterStateDirectory, ReplicationModule.LAST_FLUSHED_NAME, new LongIndexMarshal(), config.get( CoreEdgeClusterSettings.last_flushed_state_size ), logProvider ) ); consensusModule.raftMembershipManager().setRecoverFromIndexSupplier( lastFlushedStorage::getInitialState ); ListenSocketAddress raftListenAddress = config.get( CoreEdgeClusterSettings.raft_listen_address ); RaftServer raftServer = new RaftServer( new CoreReplicatedContentMarshal(), raftListenAddress, logProvider ); LoggingInbound<RaftMessages.StoreIdAwareMessage> loggingRaftInbound = new LoggingInbound<>( raftServer, messageLogger, myself ); CatchUpClient catchUpClient = life.add( new CatchUpClient( discoveryService, logProvider, Clocks.systemClock() ) ); StoreFetcher storeFetcher = new StoreFetcher( logProvider, fileSystem, platformModule.pageCache, new StoreCopyClient( catchUpClient ), new TxPullClient( catchUpClient, platformModule.monitors ), new TransactionLogCatchUpFactory() ); CoreStateApplier coreStateApplier = new CoreStateApplier( logProvider ); CoreStateDownloader downloader = new CoreStateDownloader( localDatabase, storeFetcher, catchUpClient, logProvider ); NotMyselfSelectionStrategy someoneElse = new NotMyselfSelectionStrategy( discoveryService, myself ); CoreState coreState = new CoreState( consensusModule.raftMachine(), localDatabase, logProvider, someoneElse, downloader, new CommandApplicationProcess( coreStateMachinesModule.coreStateMachines, consensusModule.raftLog(), config.get( CoreEdgeClusterSettings.state_machine_apply_max_batch_size ), config.get( CoreEdgeClusterSettings.state_machine_flush_window_size ), databaseHealthSupplier, logProvider, replicationModule.getProgressTracker(), lastFlushedStorage, replicationModule.getSessionTracker(), coreStateApplier, consensusModule.inFlightMap(), platformModule.monitors ) ); dependencies.satisfyDependency( coreState ); life.add( new PruningScheduler( coreState, platformModule.jobScheduler, config.get( CoreEdgeClusterSettings.raft_log_pruning_frequency ), logProvider ) ); int queueSize = config.get( CoreEdgeClusterSettings.raft_in_queue_size ); int maxBatch = config.get( CoreEdgeClusterSettings.raft_in_queue_max_batch ); BatchingMessageHandler batchingMessageHandler = new BatchingMessageHandler( coreState, queueSize, maxBatch, logProvider ); long electionTimeout = config.get( CoreEdgeClusterSettings.leader_election_timeout ); MembershipWaiter membershipWaiter = new MembershipWaiter( myself, platformModule.jobScheduler, electionTimeout * 4, coreState, logProvider ); long joinCatchupTimeout = config.get( CoreEdgeClusterSettings.join_catch_up_timeout ); membershipWaiterLifecycle = new MembershipWaiterLifecycle( membershipWaiter, joinCatchupTimeout, consensusModule.raftMachine(), logProvider ); loggingRaftInbound.registerHandler( batchingMessageHandler ); CatchupServer catchupServer = new CatchupServer( logProvider, localDatabase, platformModule.dependencies.provideDependency( TransactionIdStore.class ), platformModule.dependencies.provideDependency( LogicalTransactionStore.class ), new DataSourceSupplier( platformModule ), new CheckpointerSupplier( platformModule.dependencies ), coreState, config.get( CoreEdgeClusterSettings.transaction_listen_address ), platformModule.monitors ); life.add( coreState ); life.add( new ContinuousJob( platformModule.jobScheduler, new JobScheduler.Group( "raft-batch-handler", NEW_THREAD ), batchingMessageHandler, logProvider ) ); life.add( raftServer ); life.add( catchupServer ); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
db7947782138f540b45a3982e0fde8af4bcc86e9
972c92ef8d42ca405386a123fd8b160aa98291f0
/chapter 11/Holding/11.27/E27_CommandQueue.java
7fc400364fc1cb169681321d5c3b86935cadcfce
[]
no_license
zhwei5311/Think-in-Java-4th-Edition-Exercise
d60051e3377abdea0d96c4d2ccead494e1dd2053
ae554b0b03124ab7cd79f51265872aa2cd23ce50
refs/heads/master
2020-03-07T22:55:40.195224
2018-04-02T14:30:02
2018-04-02T14:30:02
127,767,671
4
0
null
null
null
null
UTF-8
Java
false
false
1,235
java
//: holding/E27_CommandQueue.java /****************** Exercise 27 ***************** * Write a class called Command that contains a * String and has a method operation() that * displays the String. Write a second class with * a method that fills a Queue with Command objects * and returns it. Pass the filled Queue to a method * in a third class that consumes the objects in the * Queue and calls their operation() methods. ***********************************************/ package holding; import java.util.*; class Command { private final String cmd; Command(String cmd) { this.cmd = cmd; } public void operation() { System.out.println(cmd); } } class Producer { public static void produce(Queue<Command> q) { q.offer(new Command("load")); q.offer(new Command("delete")); q.offer(new Command("save")); q.offer(new Command("exit")); } } class Consumer { public static void consume(Queue<Command> q) { while(q.peek() != null) q.remove().operation(); } } public class E27_CommandQueue { public static void main(String[] args) { Queue<Command> cmds = new LinkedList<Command>(); Producer.produce(cmds); Consumer.consume(cmds); } } /* Output: load delete save exit *///:~
[ "zhwei1228@qq.com" ]
zhwei1228@qq.com
1e62efb3d0fbd0ef9d6ab8252df22462be1e7a13
d096f3647e0706da9374d45b89895cfc7980816a
/fherdelpino/src/com/example/fherdelpino/FherdelpinoServlet.java
5a3d2c5a8af7ecda66c778c90b1a83adebf9e844
[]
no_license
lalitnandandiwakar/fherdelpino-project
a9187aa21266709b2c1f4fe39e5744d69d7df39e
ada3b97fd70217ac96d0017c07cd0c11f808a120
refs/heads/master
2021-01-01T17:32:15.156206
2015-03-13T23:12:42
2015-03-13T23:12:42
37,964,754
0
0
null
null
null
null
UTF-8
Java
false
false
1,967
java
package com.example.fherdelpino; import java.io.IOException; import java.util.Collection; import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; import javax.servlet.http.*; import com.example.datastore.jdo.PMF; import com.example.datastore.jdo.entities.Greeting; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.api.datastore.DatastoreServiceFactory; import com.google.appengine.api.datastore.Entity; import com.google.appengine.api.datastore.FetchOptions; import com.google.appengine.api.datastore.Key; import com.google.appengine.api.datastore.KeyFactory; import com.google.appengine.api.datastore.Query; @SuppressWarnings("serial") public class FherdelpinoServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); resp.getWriter().println("Hello, world"); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Key guestbookKey = KeyFactory.createKey("Guestbook", "default"); // Run an ancestor query to ensure we see the most up-to-date // view of the Greetings belonging to the selected Guestbook. Query query = new Query("Greeting", guestbookKey).addSort("date", Query.SortDirection.DESCENDING); List<Entity> greetings = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(10000)); // for (Entity greeting : greetings) { // System.out.println(greeting.getProperty("user")); // System.out.println(greeting.getProperty("content")); // System.out.println(greeting.getProperty("date")); // // } PersistenceManager pm = PMF.get().getPersistenceManager(); Key k = KeyFactory.createKey(Greeting.class.getSimpleName(), "test@example.com"); Object o = pm.getObjectsById(guestbookKey, 4573968371548160l); // for(Object o : list) { // System.out.println( o); // } } }
[ "fherdelpino@gmail.com" ]
fherdelpino@gmail.com
28e61a10f2eda751010bc9f5ed990eff2093d62f
ba139578e186deb18fd3bdfbdffc8a607bc7ca88
/app/src/main/java/com/example/julio/my_coverage_taxi/control/NumberPicker.java
65a5a2075b6c6365e51af7facd7b141e8aa1aa59
[]
no_license
juliocsar13/My_Coverage_Taxi
3cd4e09c0ce075cca9575f53e5d86aa1014038dc
e4f78dfe9e6af054df94b6e81fdf32efbb80c242
refs/heads/master
2020-05-30T03:32:21.977568
2015-07-03T01:29:14
2015-07-03T01:29:21
38,465,091
0
0
null
null
null
null
UTF-8
Java
false
false
8,372
java
/* * Copyright (c) 2010, Jeffrey F. Cole * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the technologichron.net nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package com.example.julio.my_coverage_taxi.control; import android.content.Context; import android.os.Handler; import android.text.InputType; import android.util.AttributeSet; import android.view.Gravity; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import com.example.julio.my_coverage_taxi.R; /** * A simple layout group that provides a numeric text area with two buttons to * increment or decrement the value in the text area. Holding either button * will auto increment the value up or down appropriately. * * @author Jeffrey F. Cole * */ public class NumberPicker extends LinearLayout { private final long REPEAT_DELAY = 50; private final int ELEMENT_HEIGHT = 100; private final int ELEMENT_WIDTH = ELEMENT_HEIGHT; // you're all squares, yo private final int MINIMUM = 1; private final int MAXIMUM = 3; private final int TEXT_SIZE = 22; public Integer value; Button decrement; Button increment; /*decrement.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_coverage_design));*/ public EditText valueText; private Handler repeatUpdateHandler = new Handler(); private boolean autoIncrement = false; private boolean autoDecrement = false; /** * This little guy handles the auto part of the auto incrementing feature. * In doing so it instantiates itself. There has to be a pattern name for * that... * * @author Jeffrey F. Cole * */ class RepetetiveUpdater implements Runnable { public void run() { if( autoIncrement ){ increment(); repeatUpdateHandler.postDelayed( new RepetetiveUpdater(), REPEAT_DELAY ); } else if( autoDecrement ){ decrement(); repeatUpdateHandler.postDelayed( new RepetetiveUpdater(), REPEAT_DELAY ); } } } public NumberPicker(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.setLayoutParams( new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT ) ); LayoutParams elementParams = new LinearLayout.LayoutParams( ELEMENT_HEIGHT, ELEMENT_WIDTH ); // init the individual elements initDecrementButton( context ); initValueEditText( context ); initIncrementButton( context ); // Can be configured to be vertical or horizontal // Thanks for the help, LinearLayout! if( getOrientation() == VERTICAL ){ addView( increment, elementParams ); addView( valueText, elementParams ); addView( decrement, elementParams ); } else { addView( decrement, elementParams ); addView( valueText, elementParams ); addView( increment, elementParams ); } } private void initIncrementButton( Context context){ increment = new Button( context ); increment.setTextSize( TEXT_SIZE ); increment.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_coverage_design)); increment.setText( "+" ); // Increment once for a click increment.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { increment(); } }); // Auto increment for a long click increment.setOnLongClickListener( new View.OnLongClickListener(){ public boolean onLongClick(View arg0) { autoIncrement = true; repeatUpdateHandler.post( new RepetetiveUpdater() ); return false; } } ); // When the button is released, if we're auto incrementing, stop increment.setOnTouchListener( new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if( event.getAction() == MotionEvent.ACTION_UP && autoIncrement ){ autoIncrement = false; } return false; } }); } private void initValueEditText( Context context){ value = new Integer( 0 ); valueText = new EditText( context ); valueText.setTextSize( TEXT_SIZE ); // Since we're a number that gets affected by the button, we need to be // ready to change the numeric value with a simple ++/--, so whenever // the value is changed with a keyboard, convert that text value to a // number. We can set the text area to only allow numeric input, but // even so, a carriage return can get hacked through. To prevent this // little quirk from causing a crash, store the value of the internal // number before attempting to parse the changed value in the text area // so we can revert to that in case the text change causes an invalid // number valueText.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int arg1, KeyEvent event) { int backupValue = value; try { value = Integer.parseInt(((EditText) v).getText().toString()); } catch( NumberFormatException nfe ){ value = backupValue; } return false; } }); // Highlight the number when we get focus valueText.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if( hasFocus ){ ((EditText)v).selectAll(); } } }); valueText.setGravity( Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL ); valueText.setText( value.toString() ); valueText.setInputType( InputType.TYPE_CLASS_NUMBER ); } private void initDecrementButton( Context context){ decrement = new Button( context ); decrement.setTextSize( TEXT_SIZE ); decrement.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_coverage_design)); decrement.setText( "-" ); // Decrement once for a click decrement.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { decrement(); } }); // Auto Decrement for a long click decrement.setOnLongClickListener( new View.OnLongClickListener(){ public boolean onLongClick(View arg0) { autoDecrement = true; repeatUpdateHandler.post( new RepetetiveUpdater() ); return false; } } ); // When the button is released, if we're auto decrementing, stop decrement.setOnTouchListener( new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if( event.getAction() == MotionEvent.ACTION_UP && autoDecrement ){ autoDecrement = false; } return false; } }); } public void increment(){ if( value < MAXIMUM ){ value = value + 1; valueText.setText( value.toString() ); } } public void decrement(){ if( value > MINIMUM ){ value = value - 1; valueText.setText( value.toString() ); } } public int getValue(){ return value; } public void setValue( int value ){ if( value > MAXIMUM ) value = MAXIMUM; if( value >= 0 ){ this.value = value; valueText.setText( this.value.toString() ); } } }
[ "jc_redcsar@hotmail.com" ]
jc_redcsar@hotmail.com
73fd46fa910fdbc620b59f2ae2cf7377e281e6d8
8da934c40dc0f326ed5e08369be0ff87ac98ed5e
/Crafts Beer Submission/source code/app/src/androidTest/java/com/kotiyaltech/craftsbeer/ExampleInstrumentedTest.java
b8f609cb9dc0c20a026389e3e62857c2b0b5a44e
[]
no_license
Abhishek92/CraftsBeer
fb138917227d40432605d1a6074125c0d0e376c9
db03091ffa11c3d0a5d00187758c197e65c8e642
refs/heads/master
2020-03-22T16:09:35.135245
2018-07-09T15:44:46
2018-07-09T15:44:46
140,307,295
0
0
null
null
null
null
UTF-8
Java
false
false
753
java
package com.kotiyaltech.craftsbeer; 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.kotiyaltech.craftsbeer", appContext.getPackageName()); } }
[ "abhishek.kotiyal@ranosys.com" ]
abhishek.kotiyal@ranosys.com
f018af0791428a9e41dffc5e893058473d15f4ff
dac6b7b31fc729d566d391f5d99c9756e3d3ca5a
/src/test/java/com/library/customerinfo/CustomerinfoApplicationTests.java
f1335c82bb47477b61b7358242154c2cac3a6b05
[]
no_license
Akhil1905/SpringProject
0d0434fa20a00273c87d33abdbce038d120c31dc
b189f45ac3b0c4ffcbaa1e0ddc858a21a9093783
refs/heads/main
2023-03-08T23:19:51.194394
2021-02-13T03:55:10
2021-02-13T03:55:10
327,883,026
0
0
null
null
null
null
UTF-8
Java
false
false
222
java
package com.library.customerinfo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class CustomerinfoApplicationTests { @Test void contextLoads() { } }
[ "akhil.sharma0612@gmail.com" ]
akhil.sharma0612@gmail.com
c7146e700a3baaef4d4c8d67c132607408f2465f
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_910dded9a0a2e350a681482a5a65a9031b6d74d3/TrackingLogger/2_910dded9a0a2e350a681482a5a65a9031b6d74d3_TrackingLogger_t.java
9047d87c9dc2f3dfcf01f4d79775fe604a4dea7d
[]
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
3,340
java
/* * Copyright 2006 Niclas Hedhman. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. * * See the License for the specific language governing permissions and * limitations under the License. */ package org.ops4j.pax.logging.internal; import org.ops4j.pax.logging.DefaultServiceLog; import org.ops4j.pax.logging.PaxLogger; import org.ops4j.pax.logging.PaxLoggingService; import org.osgi.framework.Bundle; public class TrackingLogger implements PaxLogger { private PaxLoggingService m_service; private String m_category; private Bundle m_bundle; private PaxLogger m_delegate; private String m_fqcn; public TrackingLogger( PaxLoggingService service, String category, Bundle bundle, String fqcn ) { m_fqcn = fqcn; m_category = category; m_bundle = bundle; added( service ); } public boolean isTraceEnabled() { return m_delegate.isTraceEnabled(); } public boolean isDebugEnabled() { return m_delegate.isDebugEnabled(); } public boolean isWarnEnabled() { return m_delegate.isWarnEnabled(); } public boolean isInfoEnabled() { return m_delegate.isInfoEnabled(); } public boolean isErrorEnabled() { return m_delegate.isErrorEnabled(); } public boolean isFatalEnabled() { return m_delegate.isFatalEnabled(); } public void trace( String message, Throwable t ) { m_delegate.trace( message, t ); } public void debug( String message, Throwable t ) { m_delegate.debug( message, t ); } public void inform( String message, Throwable t ) { m_delegate.inform( message, t ); } public void warn( String message, Throwable t ) { m_delegate.warn( message, t ); } public void error( String message, Throwable t ) { m_delegate.error( message, t ); } public void fatal( String message, Throwable t ) { m_delegate.fatal( message, t ); } public int getLogLevel() { return m_delegate.getLogLevel(); } public String getName() { return m_delegate.getName(); } public void added( PaxLoggingService service ) { m_service = service; if( m_service != null ) { m_delegate = m_service.getLogger( m_bundle, m_category, m_fqcn ); } else { m_delegate = new DefaultServiceLog( m_bundle, m_category ); } } /** * Called by the tracker when there is no service available, and the reference should * be dropped. */ public void removed() { m_service = null; m_delegate = new DefaultServiceLog( m_bundle, m_category ); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
2f71917f6e7be9c3e565cd6ad91cd4fb2df5b745
fc4c4962aa61ab102a3008cc91d587508b70165e
/src/Erie.java
f2de38ed25458518444aa67a1323178975a721dd
[]
no_license
afc1755/Erie
21ebec0657d032ac9ec61a9be45cee1d47e907fc
75460ae3011906b68bb169ead96e4f320e11b383
refs/heads/master
2020-04-22T06:00:04.719384
2019-02-13T21:38:20
2019-02-13T21:38:20
169,340,517
0
0
null
null
null
null
UTF-8
Java
false
false
965
java
/** * @author Andrew Chabot * @version 1.0 * Erie.java * Main Class for the Erie program, COPADS project 1 * February 13, 2019 */ /** * Erie class, runnable class that mainly performs argument checking */ public class Erie { /** * usageMess: string to print if arguments are incorrect, shows proper usage */ static final String usageMess = "Usage: java Erie number-of-cars"; /** * Main function, checks the arguments for correctness and then creates a new Bridge * and starts the Bridge's execution if the given arguments are correct * @param args input arguments from running the program */ public static void main(String[] args) { if(args.length != 1 || !(args[0].matches("-?\\d+")) || Integer.parseInt(args[0]) < 1){ throw new Error(usageMess); }else{ Bridge currBridge = new Bridge(Integer.parseInt(args[0])); currBridge.startRun(); } } }
[ "afc1755@rit.edu" ]
afc1755@rit.edu
93881567fa7aff82848f5cab846c30569926f2f1
447520f40e82a060368a0802a391697bc00be96f
/apks/obfuscation_and_logging/com_advantage_RaiffeisenBank/source/com/thinkdesquared/banking/models/Biller.java
55c5730631ae55401fbf7e023adc210ada6e8348
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
1,547
java
package com.thinkdesquared.banking.models; import java.util.ArrayList; public class Biller { private String highDefImage; private String id; private String logoPath; private String lowDefImage; private String mediumDefImage; private String name; private ArrayList<BillPaymentVariableField> variableFields; public Biller() {} public String getHighDefImage() { return this.highDefImage; } public String getId() { return this.id; } public String getLogoPath() { return this.logoPath; } public String getLowDefImage() { return this.lowDefImage; } public String getMediumDefImage() { return this.mediumDefImage; } public String getName() { return this.name; } public ArrayList<BillPaymentVariableField> getVariableFields() { return this.variableFields; } public void setHighDefImage(String paramString) { this.highDefImage = paramString; } public void setId(String paramString) { this.id = paramString; } public void setLogoPath(String paramString) { this.logoPath = paramString; } public void setLowDefImage(String paramString) { this.lowDefImage = paramString; } public void setMediumDefImage(String paramString) { this.mediumDefImage = paramString; } public void setName(String paramString) { this.name = paramString; } public void setVariableFields(ArrayList<BillPaymentVariableField> paramArrayList) { this.variableFields = paramArrayList; } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
f6d404aa734a207f28860be51e578a65bc4c5cac
348af9594bf4f23ca177c476e37303d7b9ee100d
/src/main/java/automation/examples/pages/AbstractLoadable.java
766b77c2d3b8995e9301110957e5d2f1d760b655
[]
no_license
TanyaSivnitska/gitHubTests
e12d2135a71f4252012cd9a9d45b842bb7a93e8d
4e567ddebead9dcac5a71c0ce2be7c26ca0b65b7
refs/heads/master
2022-04-16T12:14:26.654846
2020-04-13T00:09:49
2020-04-13T00:09:49
255,066,848
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package automation.examples.pages; import automation.examples.framework.driver.DriverProvider; import org.openqa.selenium.support.ui.WebDriverWait; import org.springframework.beans.factory.annotation.Autowired; public abstract class AbstractLoadable { private static final int DEFAULT_TIMEOUT = 10; @Autowired protected DriverProvider driverProvider; public abstract void waitUntilLoaded(); protected WebDriverWait getDriverWait() { return new WebDriverWait(driverProvider.getInstance(), DEFAULT_TIMEOUT); } }
[ "tetiana.sivnitska@thomsonreuters.com" ]
tetiana.sivnitska@thomsonreuters.com
0a9161c431c0835f58e40a8924e8fd7b72ff3f64
5fa90bfe3eae44c61dd38449a6105d8da1133ef5
/app/src/androidTest/java/com/example/haipingguo/rxjavademo/ExampleInstrumentedTest.java
93b07a49c069ac51a66665237bb2e2470cb001e0
[]
no_license
guohaiping521/RxJavaDemo
c5a779f090e1630d9f2a750f4184a7fc46d8d938
6298ce266e174e73ec2528b35cc25bc925a4039a
refs/heads/master
2020-04-05T02:24:18.793890
2019-04-26T08:55:43
2019-04-26T08:55:43
156,475,725
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package com.example.haipingguo.rxjavademo; 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.haipingguo.rxjavademo", appContext.getPackageName()); } }
[ "guohaiping@zuoyebang.com" ]
guohaiping@zuoyebang.com
85c5eef750835cc9b7d6c8761fc8133b29fe49b6
c2f73f2f9d23d946f2c0ceeffe11710d0968cdec
/app/src/main/java/com/example/almacenamiento/fragmentos/SecondFragment.java
fd183da0f59f495525cc7df42ae8233d959d8069
[]
no_license
aljofloro/Almacenamiento
fc0549a72204a30f414ac4be90469d809e9e0580
41d8c434e411c7a978ce3f78ad4f983d014941d1
refs/heads/master
2022-11-15T16:07:56.503785
2020-07-11T23:33:34
2020-07-11T23:33:34
278,958,374
0
0
null
null
null
null
UTF-8
Java
false
false
4,806
java
package com.example.almacenamiento.fragmentos; import android.Manifest; import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; import android.os.Environment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.core.app.ActivityCompat; import androidx.fragment.app.Fragment; import androidx.navigation.fragment.NavHostFragment; import com.example.almacenamiento.R; import com.google.android.material.snackbar.Snackbar; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.util.Vector; public class SecondFragment extends Fragment { final File ruta = Environment.getExternalStorageDirectory(); final File fichero = new File(ruta.getAbsolutePath(),"externo.txt"); private static final int REQUEST_EXTERNAL_STORAGE = 1; private static String[] PERMISSIONS_STORAGE = { Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE }; public static void verificarPermisosAlmacenamiento(Activity activity){ int permisos = ActivityCompat.checkSelfPermission(activity ,Manifest.permission.WRITE_EXTERNAL_STORAGE); if(permisos != PackageManager.PERMISSION_GRANTED){ ActivityCompat .requestPermissions(activity ,PERMISSIONS_STORAGE ,REQUEST_EXTERNAL_STORAGE); } } @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState ) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_second, container, false); } @Override public void onResume(){ super.onResume(); actualizarEtiqueta(); ((Button)getActivity().findViewById(R.id.btn_add)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { guardarArchivo(((EditText)getActivity() .findViewById(R.id.edt_editar)) .getText().toString(),getContext()); ((EditText)getActivity().findViewById(R.id.edt_editar)) .setText(""); actualizarEtiqueta(); } }); } public void guardarArchivo(String datos, Context context){ String estadoSD = Environment.getExternalStorageState(); if(!estadoSD.equals(Environment.MEDIA_MOUNTED)){ Snackbar.make(getView(),"No es posible escribir en la " + "memoria externa", Snackbar.LENGTH_SHORT).show(); return; } try{ verificarPermisosAlmacenamiento(getActivity()); FileOutputStream stream = new FileOutputStream(fichero,true); String texto = datos + "\n"; stream.write(texto.getBytes()); stream.close(); Snackbar.make(getView(),"Se guardó exitosamente" ,Snackbar.LENGTH_SHORT).show(); }catch (Exception e){ e.printStackTrace(); } } public Vector<String> obtenerDatos(Context context){ Vector<String> resultado = new Vector<>(); String estadoSD = Environment.getExternalStorageState(); if(!estadoSD.equals(Environment.MEDIA_MOUNTED) && !estadoSD.equals(Environment.MEDIA_MOUNTED_READ_ONLY)){ Snackbar.make(getView(),"No se puede leer" + "el almacenamiento externo",Snackbar.LENGTH_SHORT).show(); return resultado; } try{ verificarPermisosAlmacenamiento(getActivity()); FileInputStream stream = new FileInputStream(fichero); BufferedReader entrada = new BufferedReader(new InputStreamReader(stream)); String linea; do{ linea = entrada.readLine(); if(linea != null){ resultado.add(linea); } }while(linea != null); stream.close(); Snackbar.make(getView(),"Fichero cargado!" ,Snackbar.LENGTH_SHORT).show(); }catch (Exception e){ e.printStackTrace(); } return resultado; } public void actualizarEtiqueta(){ ((TextView)getActivity().findViewById(R.id.txt_view)) .setText((obtenerDatos(getContext()).toString())); } }
[ "aljofloro@gmail.com" ]
aljofloro@gmail.com
efd88600a96b327d3229b608f8ee486fe14bdb19
2083486a106166bbde992ce99dab1a4b804572c1
/src/Leetcode/array/MoveZeros.java
4fe3f354de737181665b7c0a78ea07495b7f6704
[]
no_license
SandyWKX/IntelliJSpace
34f42c14a82dc9ced85870c268cb696ad19b0473
5e94e14dc15d766ed0cfcd45c0ab59030f677e78
refs/heads/master
2020-03-23T00:41:45.566502
2018-07-16T21:32:41
2018-07-16T21:32:41
140,879,713
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package Leetcode.array; //No.283. Move Zeroes public class MoveZeros { public static void main(String[] args){ int[] A = {0,1,3,0,12}; MoveZeros obj = new MoveZeros(); int[]B = obj.moveZero(A); for(int i =0; i< B.length;i++){ System.out.println(B[i]); } } int[] moveZero(int[] A){ int j =0; for(int i = 0; i<A.length;i++){ if(A[i] != 0){ A[j] = A[i]; j++; } } for(int k = j; k<A.length;k++) { A[k] = 0; } return A; } }
[ "kwu3@wpi.edu" ]
kwu3@wpi.edu
0b4b4321313d30f24449e6391a0d9d9bdb468416
945b270ea1e4b941d71f2b98d4405bcb730883b7
/src/main/java/net/jodah/failsafe/DelayablePolicy.java
cb4ae927567fbcd44ae969d45edb5c66b10cddf3
[ "Apache-2.0" ]
permissive
abhisheknishant138/failsafe
7dea82e68928d57f35f99fe0f1697e0ddff760d7
3cf9e66db76bcd1adfc57f9bd1e4f0127be87776
refs/heads/master
2022-12-02T01:49:32.284162
2020-08-20T11:58:30
2020-08-20T11:58:30
286,497,593
0
0
Apache-2.0
2020-08-10T14:28:23
2020-08-10T14:28:22
null
UTF-8
Java
false
false
3,670
java
package net.jodah.failsafe; import net.jodah.failsafe.function.DelayFunction; import net.jodah.failsafe.internal.util.Assert; import java.time.Duration; /** * A policy that can be delayed between executions. * * @param <S> self type * @param <R> result type * @author Jonathan Halterman */ public abstract class DelayablePolicy<S, R> extends FailurePolicy<S, R> { DelayFunction<R, ? extends Throwable> delayFn; Object delayResult; Class<? extends Throwable> delayFailure; /** * Returns the function that determines the next delay before allowing another execution. * * @see #withDelay(DelayFunction) * @see #withDelayOn(DelayFunction, Class) * @see #withDelayWhen(DelayFunction, Object) */ public DelayFunction<R, ? extends Throwable> getDelayFn() { return delayFn; } /** * Sets the {@code delayFunction} that computes the next delay before allowing another execution. * * @param delayFunction the function to use to compute the delay before a next attempt * @throws NullPointerException if {@code delayFunction} is null * @see DelayFunction */ @SuppressWarnings("unchecked") public S withDelay(DelayFunction<R, ? extends Throwable> delayFunction) { Assert.notNull(delayFunction, "delayFunction"); this.delayFn = delayFunction; return (S) this; } /** * Sets the {@code delayFunction} that computes the next delay before allowing another execution. Delays will only * occur for failures that are assignable from the {@code failure}. * * @param delayFunction the function to use to compute the delay before a next attempt * @param failure the execution failure that is expected in order to trigger the delay * @param <F> failure type * @throws NullPointerException if {@code delayFunction} or {@code failure} are null * @see DelayFunction */ @SuppressWarnings("unchecked") public <F extends Throwable> S withDelayOn(DelayFunction<R, F> delayFunction, Class<F> failure) { withDelay(delayFunction); Assert.notNull(failure, "failure"); this.delayFailure = failure; return (S) this; } /** * Sets the {@code delayFunction} that computes the next delay before allowing another execution. Delays will only * occur for results that equal the {@code result}. * * @param delayFunction the function to use to compute the delay before a next attempt * @param result the execution result that is expected in order to trigger the delay * @throws NullPointerException if {@code delayFunction} or {@code result} are null * @see DelayFunction */ @SuppressWarnings("unchecked") public S withDelayWhen(DelayFunction<R, ? extends Throwable> delayFunction, R result) { withDelay(delayFunction); Assert.notNull(result, "result"); this.delayResult = result; return (S) this; } /** * Returns a computed delay for the {@code result} and {@code context} else {@code null} if no delay function is * configured or the computed delay is invalid. */ @SuppressWarnings("unchecked") protected Duration computeDelay(ExecutionContext context) { Duration computed = null; if (context != null && delayFn != null) { Object exResult = context.getLastResult(); Throwable exFailure = context.getLastFailure(); if ((delayResult == null || delayResult.equals(exResult)) && (delayFailure == null || (exFailure != null && delayFailure.isAssignableFrom(exFailure.getClass())))) { computed = ((DelayFunction<Object, Throwable>) delayFn).computeDelay(exResult, exFailure, context); } } return computed != null && !computed.isNegative() ? computed : null; } }
[ "jhalterman@gmail.com" ]
jhalterman@gmail.com
c510a180d6def5c011b169cd46e5d4795ef5224f
0529524c95045b3232f6553d18a7fef5a059545e
/app/src/androidTest/java/TestCase_01F43BBD70800267D46EDA936621C4DFFE292EBD59B3448689EBDE206501484E_1698085100.java
160c378523535ecadd494c91565f9f6f1d0a6200
[]
no_license
sunxiaobiu/BasicUnitAndroidTest
432aa3e10f6a1ef5d674f269db50e2f1faad2096
fed24f163d21408ef88588b8eaf7ce60d1809931
refs/heads/main
2023-02-11T21:02:03.784493
2021-01-03T10:07:07
2021-01-03T10:07:07
322,577,379
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class TestCase_01F43BBD70800267D46EDA936621C4DFFE292EBD59B3448689EBDE206501484E_1698085100 { @Test public void testCase() throws Exception { // $FF: Couldn't be decompiled } }
[ "sunxiaobiu@gmail.com" ]
sunxiaobiu@gmail.com
22d40c2b9b7e3b5ded0bb603963ec031805c49b8
82d16721dec40c5ea7705defc4fa73831f80a90b
/app/src/main/java/ansteph/com/lotto/app/GlobalRetainer.java
7b402b09d72104f0d2f96d70ff02240532ffeb86
[]
no_license
LNdame/lotto_project
dac974feb86b9dc0a73cae2818ca513a106f060b
69d6adcf260a6ba605b3c131b7fb81ccb0dd90dc
refs/heads/master
2021-01-12T15:13:09.012006
2016-10-07T21:26:42
2016-10-07T21:26:42
69,876,958
0
0
null
null
null
null
UTF-8
Java
false
false
111
java
package ansteph.com.lotto.app; /** * Created by loicStephan on 02/10/16. */ public class GlobalRetainer { }
[ "ls20045@gmail.com" ]
ls20045@gmail.com
44e7035f42633db47619debf75939b25fc97b083
5bbe3057508230e063e43a182a36613924d21ea7
/android/app/src/main/java/com/prizy/MainActivity.java
f95e1657b1546f2577d8010e4c0b67271276c4b1
[]
no_license
Larissa-Developers/prizy_mobile
4ac104eabfbf4c538c08ab69d99af20864b74bc6
4059709105c883c233d893e0dd5270db2acbfafb
refs/heads/develop
2021-07-14T18:05:20.140174
2019-02-23T15:53:02
2019-02-23T15:53:02
139,560,229
1
4
null
2019-02-23T14:38:51
2018-07-03T09:29:58
JavaScript
UTF-8
Java
false
false
355
java
package com.prizy; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "Prizy"; } }
[ "renegens@gmail.com" ]
renegens@gmail.com
655b7c6f0739a9a365055db4859ab3f30c6e90a6
e0dc7b0066aedd07d54ae7f17a6d4bf590dbd58e
/JohanPersonnal/AndroidLearning/Dev/app/src/main/java/com/johan/dev/ApplicationProvider.java
f25a5f1308aded58c1027983ae4c238a68972e59
[]
no_license
lanzrein/coms309projectISU
4397ef87face546abb4c2756452d220fe83f6dc7
b58c81534e58ff3e2536406eb5b84ac7b458e735
refs/heads/master
2021-10-21T15:03:27.098145
2019-03-04T16:18:56
2019-03-04T16:18:56
121,995,784
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package com.johan.dev; import android.app.Application; import android.content.Context; /** * Created by johan on 13.09.2017. */ public class ApplicationProvider extends Application { private static Context sApplicationContext; @Override public void onCreate(){ super.onCreate(); sApplicationContext = getApplicationContext(); } public static Context getContext(){ return sApplicationContext; } }
[ "johan.lanzrein@epfl.ch" ]
johan.lanzrein@epfl.ch
ef126b1b8fd607ddc1f71ce666e57c05f9deb50d
006e02881583f537edff46e9422d0752ec1c1512
/src/main/java/com/fred1900/lop/base/rpc/client/ProxyFactory.java
75ef4c0905f3ac1669e1177743a52462d3072577
[]
no_license
fred1900/lop-base
7494a503d85546cbc3aef595b70f67dc2129335e
702dac30c0340d0ee3cac321db31826fb44da6fd
refs/heads/master
2021-01-23T22:06:28.151623
2017-06-20T15:15:24
2017-06-20T15:15:24
83,118,076
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package com.fred1900.lop.base.rpc.client; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; public class ProxyFactory { @SuppressWarnings("unchecked") public static <T> T create(Class<T> c, String ip, int port) { InvocationHandler handler = new RpcProxy(ip, port, c); return (T) Proxy.newProxyInstance(c.getClassLoader(), new Class[] { c }, handler); } }
[ "xiaozhi.xiong@andpay.me" ]
xiaozhi.xiong@andpay.me
9130208ba555da683813ce4f5339507cd6f20354
81be6755cff2e3166e45f3827dbb998e69bebb53
/src/main/java/com/CIMthetics/jvulkan/Wayland/Objects/WaylandEventObject.java
1dd8ac689b181c1b547e2a587229a4dd5ea63605
[ "Apache-2.0" ]
permissive
dkaip/jvulkan
a48f461c42228c38f6f070e4e1be9962098e839a
ff3547ccc17b39e264b3028672849ccd4e59addc
refs/heads/master
2021-07-06T23:21:57.192034
2020-09-13T23:04:46
2020-09-13T23:04:46
183,513,821
0
0
null
null
null
null
UTF-8
Java
false
false
1,170
java
/* * Copyright 2019-2020 Douglas Kaip * * 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.CIMthetics.jvulkan.Wayland.Objects; import com.CIMthetics.jvulkan.VulkanCore.Handles.VulkanHandle; public class WaylandEventObject { private VulkanHandle vulkanHandle; private boolean dieYaBastard = false; public WaylandEventObject(VulkanHandle vulkanHandle) { this.vulkanHandle = vulkanHandle; } void killEventHandler() { dieYaBastard = true; } boolean isTimeToDie() { return dieYaBastard; } public VulkanHandle getHandle() { return vulkanHandle; } }
[ "dkaip@earthlink.net" ]
dkaip@earthlink.net
6156c0bcc6ea7c6d5df9be5867a0620d6f29c760
565f813e6950f66f4d9d8e642059cf6fb9b2ebe2
/src/main/java/app/controllers/BloodDonationCenterController.java
7632836d9c8308c3426afc02f458fe087ce0a93b
[]
no_license
PDraganovP/blood-donation-system
e484fe7b0d8aea72f36d2f9903743197f74bbdeb
d5d13d980f51b6866c5610575a5483e59d3dc2ff
refs/heads/master
2020-04-13T08:28:30.077158
2019-02-16T14:14:47
2019-02-16T14:14:47
162,994,345
0
0
null
null
null
null
UTF-8
Java
false
false
4,334
java
package app.controllers; import app.entities.Address; import app.models.bindingModels.BloodDonationCenterRegistrationModel; import app.models.bindingModels.BloodDonationCenterBindingModel; import app.models.viewModels.BloodDonatorViewModel; import app.services.BloodDonationCenterService; import app.services.BloodDonatorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import java.util.List; import java.util.Set; @Controller public class BloodDonationCenterController { @Autowired private BloodDonatorService bloodDonatorService; @Autowired private BloodDonationCenterService bloodDonationCenterService; @GetMapping("/blood-donation-center-register") public String registrationBloodDonationCenter(@ModelAttribute BloodDonationCenterRegistrationModel bloodDonationCenterRegistrationModel) { return "blood-donation-centers/blood-donation-center-register"; } @PostMapping("/blood-donation-center-register") public String registrationBloodDonationCenter(@Valid @ModelAttribute BloodDonationCenterRegistrationModel bloodDonationCenterRegistrationModel, BindingResult result, Model model) { List<FieldError> fieldErrors = result.getFieldErrors(); if (result.hasErrors()) { for (FieldError err : fieldErrors) { String field = err.getField(); String error = err.getDefaultMessage().toString(); String param = field + "Error"; model.addAttribute(param, error); } return "blood-donation-centers/blood-donation-center-register"; } this.bloodDonationCenterService.save(bloodDonationCenterRegistrationModel); return "redirect:/successfully-edited"; } @GetMapping("/find-blood-donation-center-by-username") public String findByUsername() { return "blood-donation-centers/blood-donation-center"; } @PostMapping("/find-blood-donation-center-by-username") public String findByUsername(Model model, String username) { BloodDonationCenterBindingModel bloodDonationCenter = this.bloodDonationCenterService.findBloodDonationCenterByUsername(username); if (username == "" || bloodDonationCenter == null) { return "blood-donation-centers/blood-donation-center"; } Set<BloodDonatorViewModel> bloodDonators = bloodDonationCenter.getBloodDonators(); model.addAttribute("bloodDonationCenter", bloodDonationCenter); model.addAttribute("bloodDonators", bloodDonators); return "blood-donation-centers/blood-donation-center"; } @RequestMapping("/blood-donation-center-info") public String getBloodDonatorInfo(HttpServletRequest req, Model model) { String username = req.getRemoteUser(); BloodDonationCenterBindingModel bloodDonationCenter = this.bloodDonationCenterService.findBloodDonationCenterByUsername(username); model.addAttribute("bloodDonationCenter",bloodDonationCenter); return "blood-donation-centers/blood-donation-center-info"; } @GetMapping("/edit-blood-donation-center") String edit() { return "blood-donation-centers/edit-blood-donation-center"; } @PostMapping("/edit-blood-donation-center") String edit(String name , Address address, Model model,HttpServletRequest req) { String user = req.getRemoteUser(); if(user==null){ return "blood-donation-centers/edit-blood-donation-center"; } BloodDonationCenterBindingModel bloodDonationCenter = this.bloodDonationCenterService.findBloodDonationCenterByUsername(user); long id = bloodDonationCenter.getId(); this.bloodDonationCenterService.editBloodDonationCenterById(name,address,id); return "successfully-edited"; } }
[ "petar.draganov.petrov@abv.bg" ]
petar.draganov.petrov@abv.bg
b242b4fe12863209569905e8c66ef555edbfd74c
902bcc09384a087787efdc224f1ed266039c5985
/pcds/src/com/shuhao/clean/apps/model/ext/TextField.java
756f6bcd5ea79a8c12da8ad6b8b61bcf74343501
[]
no_license
dfjxpcxm/pcds
d0b80c69110211384bc7f9250067b051753a010c
c5964279f5bcc781423fff248b8dcd7ea78d7e62
refs/heads/master
2020-07-02T00:44:05.735317
2020-06-29T07:20:28
2020-06-29T07:20:28
201,363,363
0
1
null
null
null
null
UTF-8
Java
false
false
2,158
java
package com.shuhao.clean.apps.model.ext; public class TextField extends BaseField { protected boolean allowBlank = true; protected String blankText = "该项不能为空"; protected Integer minLength; protected Integer maxLength; protected String minLengthText; protected String maxLengthText ; public String output(){ StringBuffer buffer = new StringBuffer(); buffer.append("_"+this.name).append("Field = new Ext.form.TextField({").append(enter); buffer.append(this.fieldParams()).append(",").append(enter); buffer.append("allowBlank : ").append(this.allowBlank); if(this.allowBlank){ buffer.append(",").append(enter); buffer.append("blankText : '").append(this.blankText).append("'"); } if(isNotNull(this.minLength)){ buffer.append(",").append(enter); buffer.append("minLength : ").append(this.minLength).append(",").append(enter); buffer.append("minLengthText : '").append(this.minLengthText).append("'"); } if(isNotNull(this.maxLength)){ buffer.append(",").append(enter); buffer.append("maxLength : ").append(this.maxLength).append(",").append(enter); buffer.append("maxLengthText : '").append(this.maxLengthText).append("'"); } buffer.append(enter); buffer.append("})").append(enter); return buffer.toString(); } public boolean isAllowBlank() { return allowBlank; } public void setAllowBlank(boolean allowBlank) { this.allowBlank = allowBlank; } public String getBlankText() { return blankText; } public void setBlankText(String blankText) { this.blankText = blankText; } public Integer getMinLength() { return minLength; } public void setMinLength(Integer minLength) { this.minLength = minLength; } public Integer getMaxLength() { return maxLength; } public void setMaxLength(Integer maxLength) { this.maxLength = maxLength; } public String getMinLengthText() { return minLengthText; } public void setMinLengthText(String minLengthText) { this.minLengthText = minLengthText; } public String getMaxLengthText() { return maxLengthText; } public void setMaxLengthText(String maxLengthText) { this.maxLengthText = maxLengthText; } }
[ "chenxuehua0@163.com" ]
chenxuehua0@163.com
6e9d9e8983891f78118ae47c76efb7ed99544dc4
d42f4ea723f12ebdd9fe218762704bac92665f85
/Pre-Uni-Application/app/src/main/java/com/federation/masters/preuni/models/Assignment.java
5991507407462b7e1183ebfe2a3779b7b73f34d4
[]
no_license
kshbharati/Master-Project
ebb70aa3e0bb6a6371657dc9baf2c9d1b071490d
a2f750365b7dc14d737b35e8278da5220380332e
refs/heads/main
2023-06-04T07:52:24.563911
2021-06-14T10:57:15
2021-06-14T10:57:15
357,791,806
0
0
null
null
null
null
UTF-8
Java
false
false
2,384
java
package com.federation.masters.preuni.models; import com.google.gson.JsonObject; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class Assignment { private int id; private String assignmentTitle; private String assignmentDesc; private String assignmentSubmissionDate; private int assignmentAddedBy; private int courseId; ArrayList<Submission> submissions=new ArrayList<Submission>(); public ArrayList<Submission> getSubmissions() { return submissions; } public void setSubmissions(ArrayList<Submission> submissions) { this.submissions = submissions; } public int getId() { return id; } public void setId(int assignmentID) { this.id = assignmentID; } public String getAssignmentTitle() { return assignmentTitle; } public void setAssignmentTitle(String assignmentName) { this.assignmentTitle = assignmentName; } public String getAssignmentDesc() { return assignmentDesc; } public void setAssignmentDesc(String assignmentDesc) { this.assignmentDesc = assignmentDesc; } public String getAssignmentSubmissionDate() { return assignmentSubmissionDate; } public void setAssignmentSubmissionDate(String assignmentSubmissionDate) { this.assignmentSubmissionDate = assignmentSubmissionDate; } public int getAssignmentAddedBy() { return assignmentAddedBy; } public void setAssignmentAddedBy(int assignmentAddedBy) { this.assignmentAddedBy = assignmentAddedBy; } public int getCourseId() { return courseId; } public void setCourseId(int courseId) { this.courseId = courseId; } public JSONObject getAssignmentPutObject() { JSONObject request=new JSONObject(); try { request.put("assignmentTitle",getAssignmentTitle()); request.put("assignmentDesc",getAssignmentDesc()); request.put("assignmentSubmissionDate",getAssignmentSubmissionDate()); request.put("assignmentAddedBy",getAssignmentAddedBy()); request.put("courseId",getCourseId()); } catch (JSONException e) { e.printStackTrace(); } return request; } }
[ "kshitizxox@hotmail.com" ]
kshitizxox@hotmail.com
72f6742835f5eff8b967d146c272e2d05474cf95
101b51235317a530229e0b47d69c897d5a004a74
/master-detail/src/main/java/com/modelncode/crudpattern/domain/exception/DomainException.java
5c4f3d73449c44216241d529c2eb0e5c557b836d
[]
no_license
modelandcode/java-crud-patterns
a8c4e456ca896ec9d524bbf82971cb2b02f66bd5
22ce290ed6410cf8682906cf347eb3655f344efd
refs/heads/master
2021-01-25T11:27:59.980736
2017-12-12T14:50:23
2017-12-12T14:50:23
93,928,626
0
0
null
null
null
null
UTF-8
Java
false
false
726
java
package com.modelncode.crudpattern.domain.exception; /** * Created by g on 2017-06-12. */ public class DomainException extends RuntimeException { static final long serialVersionUID = 1; private String errorMessage; public DomainException() { super(); } public DomainException(Throwable throwable, String errorMessage){ super(errorMessage, throwable); this.errorMessage = errorMessage; } public DomainException(String errorMessage){ super(errorMessage); this.errorMessage = errorMessage; } public DomainException(Throwable throwable){ super(throwable); } public String getErrorMessage() { return errorMessage; } }
[ "gisangkim@gmail.com" ]
gisangkim@gmail.com
fe8ce695fd737e178aaa4a6f85fae3ea81937581
e2902e2a69fc790b1f6a9c1ddcbc49a00f6d7764
/src/br/com/carlosemanuel/buzzreader/parsers/handlers/UserProfileHandler.java
78fdce42872df391cf03e0770c425b8131cf520e
[]
no_license
carlosemanuel/Buzz-Reader
4482bfdf223285bcb078d7bb0694042792d7b9e3
8c5154502e5be1dfba58f39cfef92c1e7749c5ac
refs/heads/master
2021-01-10T20:55:53.962407
2011-03-16T01:33:59
2011-03-16T01:33:59
2,595,811
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package br.com.carlosemanuel.buzzreader.parsers.handlers; import org.json.JSONObject; import br.com.carlosemanuel.buzzreader.exception.BuzzParsingException; import br.com.carlosemanuel.buzzreader.model.BuzzUserProfile; /** * Handler for element: <b>User Profile</b> * * @author roberto.estivill */ public class UserProfileHandler extends BaseHandler { // TODO public static BuzzUserProfile handle(JSONObject jsonObject) throws BuzzParsingException { BuzzUserProfile buzzUserProfile = new BuzzUserProfile(); return buzzUserProfile; } }
[ "Carlos@.(none)" ]
Carlos@.(none)
df6e6f85e583a3a5a34ef4301ca028fbef990386
8df236c519f655e68012f6962b89fe6a5b25e753
/app/src/main/java/com/example/comp7082/comp7082photogallery/androidos/ExifUtility.java
881c37431a3a8b5d23222f3bb80fd5af4698689d
[]
no_license
SahejBhatia/Comp7082FinalProject
3b2dfb9603c80e86b81c6553e0bac16b6159f9ae
bba4845d9b2d5c4bf172cf8b4047b045a7fb47c4
refs/heads/master
2020-09-11T21:56:34.203172
2019-12-05T08:44:24
2019-12-05T08:44:24
222,203,304
0
0
null
2019-12-04T08:22:34
2019-11-17T05:46:49
null
UTF-8
Java
false
false
3,135
java
package com.example.comp7082.comp7082photogallery.androidos; import android.media.ExifInterface; import android.util.Log; import java.io.File; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Locale; /** * utility methods to read and write data to EXIF data tags * * Use with android version 24+ * */ public class ExifUtility { public static final String EXIF_KEYWORDS_TAG = ExifInterface.TAG_MAKER_NOTE; public static final String EXIF_CAPTION_TAG = ExifInterface.TAG_USER_COMMENT; public static final String EXIF_DATETIME_TAG = ExifInterface.TAG_DATETIME_DIGITIZED; /** * reads a string based Exif Tag for the given file * * @param exifFile the File object to read from * @param exifTagName the Exif tag to read from * @return a string with the Exif tag data */ static public String getExifTagString(File exifFile, String exifTagName) { String exifTagString; try { ExifInterface exif = new ExifInterface(exifFile.getCanonicalPath()); exifTagString = exif.getAttribute(exifTagName); Log.d("getExifTagString", "Read " + exifTagName + ": " + (exifTagString == null ? "is null" : exifTagString)); } catch (IOException e) { Log.d("getExifTagString", "IOException: " + e.getMessage()); exifTagString = null; } return exifTagString; } /** * writes a string to the given Exif tag for the given file * * @param exifFile the File object to write to * @param exifTagName the Exif tag to write to. Should be a string based tag * @param exifTagValue the Exif string data to write */ static public void setExifTagString(File exifFile, String exifTagName, String exifTagValue) { try { ExifInterface exif = new ExifInterface(exifFile.getCanonicalPath()); exif.setAttribute(exifTagName, exifTagValue); exif.saveAttributes(); Log.d("setExifTagString", "Write " + exifTagName + ": " + (exifTagValue == null ? "is null" : exifTagValue)); } catch (IOException e) { Log.d("setExifTagString", "IOException: " + e.getMessage()); } } /** * gets the latitude and longitude coordinates from the Exif tags * * @param exifFile the File object to read from * @param location the float array to return the latitude and longitude coordinates through * @return true if latitude and longitude are successfully retrieved, false otherwise */ static public boolean getExifLatLong(File exifFile, float[] location) { boolean result = false; try { ExifInterface exif = new ExifInterface(exifFile.getCanonicalPath()); result = exif.getLatLong(location); Log.d("getExifLatLong", "Read LatLong: " + result + (result ? ": lat: " + location[0] + ": long:" + location[1] : "")); } catch (IOException e) { Log.d("getExifLatLong", "IOException: " + e.getMessage()); } return result; } }
[ "cmurraybc@gmail.com" ]
cmurraybc@gmail.com
dc2d11b5f6710e6110ec13cfa1d0d0d2a3741a23
ede8047f1c4a33f35f7ea5251f431ab87aef81b6
/PrefuseDemo/src/Visualization/VisualizationComponent.java
fdaf28ba75f2f8f8b582838ce555cac47074a203
[]
no_license
pi11e/PrefuseKinect
ac95c8322cd4a324d2c10421d5037f3a7d1a1c16
878d811c4541e10a80d9bc474610f9656c7a6c07
refs/heads/master
2016-08-06T16:13:10.665531
2013-02-11T09:37:13
2013-02-11T09:37:13
8,093,470
1
0
null
null
null
null
UTF-8
Java
false
false
13,846
java
package Visualization; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Point; import java.awt.event.MouseEvent; import java.util.Iterator; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.SwingConstants; import prefuse.Constants; import prefuse.Display; import prefuse.Visualization; import prefuse.action.ActionList; import prefuse.action.GroupAction; import prefuse.action.ItemAction; import prefuse.action.RepaintAction; import prefuse.action.animate.ColorAnimator; import prefuse.action.animate.PolarLocationAnimator; import prefuse.action.animate.QualityControlAnimator; import prefuse.action.animate.VisibilityAnimator; import prefuse.action.assignment.ColorAction; import prefuse.action.assignment.FontAction; import prefuse.action.layout.CollapsedSubtreeLayout; import prefuse.action.layout.graph.RadialTreeLayout; import prefuse.activity.SlowInSlowOutPacer; import prefuse.controls.ControlAdapter; import prefuse.controls.DragControl; import prefuse.controls.FocusControl; import prefuse.controls.HoverActionControl; import prefuse.controls.PanControl; import prefuse.controls.ZoomControl; import prefuse.controls.ZoomToFitControl; import prefuse.data.Graph; import prefuse.data.Node; import prefuse.data.Table; import prefuse.data.Tuple; import prefuse.data.event.TupleSetListener; import prefuse.data.io.GraphMLReader; import prefuse.data.query.SearchQueryBinding; import prefuse.data.search.PrefixSearchTupleSet; import prefuse.data.search.SearchTupleSet; import prefuse.data.tuple.DefaultTupleSet; import prefuse.data.tuple.TupleSet; import prefuse.demos.TreeMap.NodeRenderer; import prefuse.render.AbstractShapeRenderer; import prefuse.render.DefaultRendererFactory; import prefuse.render.EdgeRenderer; import prefuse.render.LabelRenderer; import prefuse.render.Renderer; import prefuse.render.ShapeRenderer; import prefuse.util.ColorLib; import prefuse.util.FontLib; import prefuse.util.ui.JFastLabel; import prefuse.util.ui.JSearchPanel; import prefuse.util.ui.UILib; import prefuse.visual.VisualItem; import prefuse.visual.expression.InGroupPredicate; import prefuse.visual.sort.TreeDepthItemSorter; /** * Demonstration of a node-link tree viewer * * @version 1.0 * @author <a href="http://jheer.org">jeffrey heer</a> */ public class VisualizationComponent extends Display { /** * */ private static final long serialVersionUID = 1L; private static VisualizationComponent instance; public static final String DATA_FILE = "/data.xml"; private static final String tree = "tree"; private static final String treeNodes = "tree.nodes"; private static final String treeEdges = "tree.edges"; private static final String linear = "linear"; private LabelRenderer m_nodeRenderer; private NodeRenderer m_customNodeRenderer; private EdgeRenderer m_edgeRenderer; private String m_label = "label"; public VisualizationComponent(Graph g, String label) { super(new Visualization()); m_label = label; // -- set up visualization -- m_vis.add(tree, g); m_vis.setInteractive(treeEdges, null, false); // -- set up renderers -- /* ORIGINAL CODE */ m_nodeRenderer = new LabelRenderer(m_label); m_nodeRenderer.setRenderType(AbstractShapeRenderer.RENDER_TYPE_FILL); m_nodeRenderer.setHorizontalAlignment(Constants.CENTER); m_nodeRenderer.setRoundedCorner(8,8); DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer); rf.add(new InGroupPredicate(treeEdges), m_edgeRenderer); m_vis.setRendererFactory(rf); /* END OF ORIGINAL CODE */ /* * Try to set up renderers that will display * - nodes as circles (SLUB-red filled) * - labels to the side of the circle (if possible, *outside*; i.e. facing away from center of radial graph) */ // label here is "name", referring to the "name" property given in the xml data file /* m_nodeRenderer = new ShapeRenderer(); m_nodeRenderer.setRenderType(AbstractShapeRenderer.RENDER_TYPE_FILL); m_nodeRenderer.setBaseSize(20); m_edgeRenderer = new EdgeRenderer(); DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer); rf.add(new InGroupPredicate(treeEdges), m_edgeRenderer); m_vis.setRendererFactory(rf); */ // -- set up processing actions -- // colors ItemAction nodeColor = new NodeColorAction(treeNodes); ItemAction textColor = new TextColorAction(treeNodes); m_vis.putAction("textColor", textColor); ItemAction edgeColor = new ColorAction(treeEdges, VisualItem.STROKECOLOR, ColorLib.rgb(200,200,200)); FontAction fonts = new FontAction(treeNodes, FontLib.getFont("Tahoma", 10)); fonts.add("ingroup('_focus_')", FontLib.getFont("Tahoma", 11)); // recolor ActionList recolor = new ActionList(); recolor.add(nodeColor); recolor.add(textColor); m_vis.putAction("recolor", recolor); // repaint ActionList repaint = new ActionList(); repaint.add(recolor); repaint.add(new RepaintAction()); m_vis.putAction("repaint", repaint); // animate paint change ActionList animatePaint = new ActionList(400); animatePaint.add(new ColorAnimator(treeNodes)); animatePaint.add(new RepaintAction()); m_vis.putAction("animatePaint", animatePaint); // create the tree layout action RadialTreeLayout treeLayout = new RadialTreeLayout(tree); //treeLayout.setAngularBounds(-Math.PI/2, Math.PI); m_vis.putAction("treeLayout", treeLayout); CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout(tree); m_vis.putAction("subLayout", subLayout); // create the filtering and layout ActionList filter = new ActionList(); filter.add(new TreeRootAction(tree)); filter.add(fonts); filter.add(treeLayout); filter.add(subLayout); filter.add(textColor); filter.add(nodeColor); filter.add(edgeColor); m_vis.putAction("filter", filter); // animated transition ActionList animate = new ActionList(1250); animate.setPacingFunction(new SlowInSlowOutPacer()); animate.add(new QualityControlAnimator()); animate.add(new VisibilityAnimator(tree)); animate.add(new PolarLocationAnimator(treeNodes, linear)); animate.add(new ColorAnimator(treeNodes)); animate.add(new RepaintAction()); m_vis.putAction("animate", animate); m_vis.alwaysRunAfter("filter", "animate"); // ------------------------------------------------ // initialize the display this.setSize(600,600); setItemSorter(new TreeDepthItemSorter()); addControlListener(new DragControl()); addControlListener(new ZoomToFitControl()); addControlListener(new ZoomControl()); addControlListener(new PanControl()); addControlListener(new FocusControl(1, "filter")); addControlListener(new HoverActionControl("repaint")); // ------------------------------------------------ // filter graph and perform layout m_vis.run("filter"); // maintain a set of items that should be interpolated linearly // this isn't absolutely necessary, but makes the animations nicer // the PolarLocationAnimator should read this set and act accordingly m_vis.addFocusGroup(linear, new DefaultTupleSet()); m_vis.getGroup(Visualization.FOCUS_ITEMS).addTupleSetListener( new TupleSetListener() { public void tupleSetChanged(TupleSet t, Tuple[] add, Tuple[] rem) { TupleSet linearInterp = m_vis.getGroup(linear); if ( add.length < 1 ) return; linearInterp.clear(); for ( Node n = (Node)add[0]; n!=null; n=n.getParent() ) linearInterp.addTuple(n); } } ); SearchTupleSet search = new PrefixSearchTupleSet(); m_vis.addFocusGroup(Visualization.SEARCH_ITEMS, search); search.addTupleSetListener(new TupleSetListener() { public void tupleSetChanged(TupleSet t, Tuple[] add, Tuple[] rem) { m_vis.cancel("animatePaint"); m_vis.run("recolor"); m_vis.run("animatePaint"); } }); } public static JPanel createPanel() { Graph g = null; try { // construct graph instance from data given in DATA_FILE path (XML format) g = new GraphMLReader().readGraph(DATA_FILE); } catch ( Exception e ) { e.printStackTrace(); System.exit(1); } return demo(g, "name"); } public void updateSize() { m_vis.run("treeLayout"); } public static VisualizationComponent getInstance() { return instance; } private static JPanel demo(Graph g, final String label) { // create a new radial tree view final VisualizationComponent gview = new VisualizationComponent(g, label); VisualizationComponent.instance = gview; Visualization vis = gview.getVisualization(); // // // create a search panel for the tree map // SearchQueryBinding sq = new SearchQueryBinding( // (Table)vis.getGroup(treeNodes), label, // (SearchTupleSet)vis.getGroup(Visualization.SEARCH_ITEMS)); // JSearchPanel search = sq.createSearchPanel(); // search.setShowResultCount(true); // search.setBorder(BorderFactory.createEmptyBorder(5,5,4,0)); // search.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 11)); // // final JFastLabel title = new JFastLabel(" "); // title.setPreferredSize(new Dimension(350, 20)); // title.setVerticalAlignment(SwingConstants.BOTTOM); // title.setBorder(BorderFactory.createEmptyBorder(3,0,0,0)); // title.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 16)); // // gview.addControlListener(new ControlAdapter() { // public void itemEntered(VisualItem item, MouseEvent e) { // if ( item.canGetString(label) ) // title.setText(item.getString(label)); // } // public void itemExited(VisualItem item, MouseEvent e) { // title.setText(null); // } // }); // // Box box = new Box(BoxLayout.X_AXIS); // box.add(Box.createHorizontalStrut(10)); // box.add(title); // box.add(Box.createHorizontalGlue()); // box.add(search); // box.add(Box.createHorizontalStrut(3)); JPanel panel = new JPanel(new BorderLayout()); panel.add(gview, BorderLayout.CENTER); // panel.add(box, BorderLayout.SOUTH); Color BACKGROUND = Color.WHITE; Color FOREGROUND = Color.DARK_GRAY; UILib.setColor(panel, BACKGROUND, FOREGROUND); return panel; } // ------------------------------------------------------------------------ /** * Switch the root of the tree by requesting a new spanning tree * at the desired root */ public static class TreeRootAction extends GroupAction { public TreeRootAction(String graphGroup) { super(graphGroup); } public void run(double frac) { TupleSet focus = m_vis.getGroup(Visualization.FOCUS_ITEMS); if ( focus==null || focus.getTupleCount() == 0 ) return; Graph g = (Graph)m_vis.getGroup(m_group); Node f = null; Iterator tuples = focus.tuples(); while (tuples.hasNext() && !g.containsTuple(f=(Node)tuples.next())) { f = null; } if ( f == null ) return; g.getSpanningTree(f); } } /** * Set node fill colors */ public static class NodeColorAction extends ColorAction { public NodeColorAction(String group) { super(group, VisualItem.FILLCOLOR, ColorLib.rgba(255,255,255,0)); add("_hover", ColorLib.gray(220,230)); add("ingroup('_search_')", ColorLib.rgb(255,190,190)); add("ingroup('_focus_')", ColorLib.rgb(198,229,229)); } } // end of inner class NodeColorAction /** * Set node text colors */ public static class TextColorAction extends ColorAction { public TextColorAction(String group) { super(group, VisualItem.TEXTCOLOR, ColorLib.gray(0)); add("_hover", ColorLib.rgb(255,0,0)); } } // end of inner class TextColorAction } // end of class RadialGraphView
[ "darthkad@hotmail.com" ]
darthkad@hotmail.com
04f49f21d0fbe5fc4a32c4cb1873893b422022d7
3a2c5f0f73f90b749ca324851b83e11de4195553
/Day02_Spring01/src/main/java/cn/sust/service/impl/AccountServiceImpl.java
a6b5e9d6de2ed13e4c4ce9010dec19d334c95ede
[]
no_license
aikudezizizi/Spring
358080ff0562bc401fbe36d1126179b227885936
30a2dcb2576938922ab3e6ac09c258c6c52cbbcb
refs/heads/master
2022-06-26T09:46:56.039032
2019-12-07T12:34:07
2019-12-07T12:34:07
226,509,180
0
0
null
2022-06-21T02:24:02
2019-12-07T12:28:40
Java
UTF-8
Java
false
false
863
java
package cn.sust.service.impl; import cn.sust.dao.AccountDao; import cn.sust.domain.Account; import cn.sust.service.AccountService; import java.util.List; public class AccountServiceImpl implements AccountService { private AccountDao accountDao; public void setAccountDao(AccountDao accountDao) { this.accountDao = accountDao; } @Override public void save(Account account) { accountDao.save(account); } @Override public void update(Account account) { accountDao.update(account); } @Override public void delete(Integer accountId) { accountDao.delete(accountId); } @Override public Account findById(Integer accountid) { return accountDao.findById(accountid); } @Override public List<Account> findAll() { return accountDao.findAll(); } }
[ "489273196@qq.com" ]
489273196@qq.com
de8ebab6568a3827a38bb09bcf9b96a32970cd2b
abe405c297ee3281d08e0a01138efe7cea76b331
/src/Abilities/Bard_MassConfusion.java
7933f1286b1a953c402d62077ef031a47556242b
[]
no_license
Skyman12/AdaptiveAI
83363727e8d0fb314dbf790d44836b34d9c0ec19
4cceb5b8bfd913e356edf10f209aed470e8f3be2
refs/heads/master
2016-08-12T12:25:26.964146
2016-04-04T02:58:42
2016-04-04T02:58:42
54,614,223
1
1
null
2016-04-05T00:20:32
2016-03-24T04:19:31
Java
UTF-8
Java
false
false
1,408
java
package Abilities; import java.util.ArrayList; import java.util.Random; import General.AttackType; import General.Attacks; import General.Class; public class Bard_MassConfusion extends Attacks { public Bard_MassConfusion(Class attacker) { super(attacker); attackType = AttackType.ABILITIES; attackName = "Mass Confusion"; attackDescription = "Targets everyone on the board. 50% chance they choose random targets for the rest of this turn."; damage = 5; speed = 5; cost = 60; critChance = 0; numOfTargets = 0; } @Override protected String attack(Class target) { String result = doBeginningActions(theAttacker, target); if (!result.equals("Success")) return result; Random random = new Random(); int confused = random.nextInt(2); confuse(theAttacker, theTarget, damage, confused); effectivness = confused * 30; return "Used " + attackName + " on " + theTarget.name + " -- Confused for " + confused + " turns\n"; } @Override public void chooseTargetForAttack(Class target) { theTargets.addAll(getAlivePlayers(theAttacker)); } @Override public boolean getSoftCap() { ArrayList<Class> players = getAliveAllies(theAttacker); for (Class p : players) { if (p.currentHealth + p.currentShield < damage) { return false; } } return true; } @Override public void chooseAITarget() { chooseTargetForAttack(theAttacker); } }
[ "bskaja@iastate.edu" ]
bskaja@iastate.edu
392390e3d27a23efea2705144c1f9a76b6453298
ac77a4f904b026a6c3abc23f102e32f99f12eb7a
/MyCassandra-0.2.1/src/java/org/apache/cassandra/tools/NodeCmd.java
cad3af9f7b326d42599f99607ddfe8b50244c8d3
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
sunsuk7tp/MyCassandra
2e1075b09d472619b0e23195504213cc0c83ca0b
5da67c4ab57a0a581e2ce639fb512b144a4bb203
refs/heads/master
2020-04-05T23:44:55.034171
2019-06-05T14:57:13
2019-06-05T14:57:13
693,666
14
4
Apache-2.0
2023-03-20T11:53:48
2010-05-30T07:33:12
Java
UTF-8
Java
false
false
32,957
java
package org.apache.cassandra.tools; /* * * 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. * */ import java.io.IOException; import java.io.PrintStream; import java.lang.management.MemoryUsage; import java.net.InetAddress; import java.text.DecimalFormat; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import org.apache.cassandra.utils.Pair; import org.apache.cassandra.config.ConfigurationException; import org.apache.commons.cli.*; import org.apache.cassandra.cache.JMXInstrumentedCacheMBean; import org.apache.cassandra.concurrent.IExecutorMBean; import org.apache.cassandra.db.ColumnFamilyStoreMBean; import org.apache.cassandra.db.CompactionManagerMBean; import org.apache.cassandra.dht.Token; import org.apache.cassandra.net.MessagingServiceMBean; import org.apache.cassandra.utils.EstimatedHistogram; public class NodeCmd { private static final Pair<String, String> HOST_OPT = new Pair<String, String>("h", "host"); private static final Pair<String, String> PORT_OPT = new Pair<String, String>("p", "port"); private static final Pair<String, String> USERNAME_OPT = new Pair<String, String>("u", "username"); private static final Pair<String, String> PASSWORD_OPT = new Pair<String, String>("pw", "password"); private static final int DEFAULT_PORT = 8080; private static ToolOptions options = null; private NodeProbe probe; static { options = new ToolOptions(); options.addOption(HOST_OPT, true, "node hostname or ip address", true); options.addOption(PORT_OPT, true, "remote jmx agent port number"); options.addOption(USERNAME_OPT, true, "remote jmx agent username"); options.addOption(PASSWORD_OPT, true, "remote jmx agent password"); } public NodeCmd(NodeProbe probe) { this.probe = probe; } public enum NodeCommand { RING, INFO, CFSTATS, SNAPSHOT, CLEARSNAPSHOT, VERSION, TPSTATS, FLUSH, DRAIN, DECOMMISSION, MOVE, LOADBALANCE, REMOVETOKEN, REPAIR, CLEANUP, COMPACT, SCRUB, SETCACHECAPACITY, GETCOMPACTIONTHRESHOLD, SETCOMPACTIONTHRESHOLD, NETSTATS, CFHISTOGRAMS, COMPACTIONSTATS, DISABLEGOSSIP, ENABLEGOSSIP, INVALIDATEKEYCACHE, INVALIDATEROWCACHE, DISABLETHRIFT, ENABLETHRIFT, JOIN } /** * Prints usage information to stdout. */ private static void printUsage() { HelpFormatter hf = new HelpFormatter(); StringBuilder header = new StringBuilder(); header.append("\nAvailable commands:\n"); // No args addCmdHelp(header, "ring", "Print informations on the token ring"); addCmdHelp(header, "join", "Join the ring"); addCmdHelp(header, "info", "Print node informations (uptime, load, ...)"); addCmdHelp(header, "cfstats", "Print statistics on column families"); addCmdHelp(header, "clearsnapshot", "Remove all existing snapshots"); addCmdHelp(header, "version", "Print cassandra version"); addCmdHelp(header, "tpstats", "Print usage statistics of thread pools"); addCmdHelp(header, "drain", "Drain the node (stop accepting writes and flush all column families)"); addCmdHelp(header, "decommission", "Decommission the node"); addCmdHelp(header, "loadbalance", "Loadbalance the node"); addCmdHelp(header, "compactionstats", "Print statistics on compactions"); addCmdHelp(header, "disablegossip", "Disable gossip (effectively marking the node dead)"); addCmdHelp(header, "enablegossip", "Reenable gossip"); addCmdHelp(header, "disablethrift", "Disable thrift server"); addCmdHelp(header, "enablethrift", "Reenable thrift server"); // One arg addCmdHelp(header, "snapshot [snapshotname]", "Take a snapshot using optional name snapshotname"); addCmdHelp(header, "netstats [host]", "Print network information on provided host (connecting node by default)"); addCmdHelp(header, "move <new token>", "Move node on the token ring to a new token"); addCmdHelp(header, "removetoken status|force|<token>", "Show status of current token removal, force completion of pending removal or remove providen token"); // Two args addCmdHelp(header, "flush [keyspace] [cfnames]", "Flush one or more column family"); addCmdHelp(header, "repair [keyspace] [cfnames]", "Repair one or more column family"); addCmdHelp(header, "cleanup [keyspace] [cfnames]", "Run cleanup on one or more column family"); addCmdHelp(header, "compact [keyspace] [cfnames]", "Force a (major) compaction on one or more column family"); addCmdHelp(header, "scrub [keyspace] [cfnames]", "Scrub (rebuild sstables for) one or more column family"); addCmdHelp(header, "invalidatekeycache [keyspace] [cfnames]", "Invalidate the key cache of one or more column family"); addCmdHelp(header, "invalidaterowcache [keyspace] [cfnames]", "Invalidate the key cache of one or more column family"); addCmdHelp(header, "getcompactionthreshold <keyspace> <cfname>", "Print min and max compaction thresholds for a given column family"); addCmdHelp(header, "cfhistograms <keyspace> <cfname>", "Print statistic histograms for a given column family"); // Four args addCmdHelp(header, "setcachecapacity <keyspace> <cfname> <keycachecapacity> <rowcachecapacity>", "Set the key and row cache capacities of a given column family"); addCmdHelp(header, "setcompactionthreshold <keyspace> <cfname> <minthreshold> <maxthreshold>", "Set the min and max compaction thresholds for a given column family"); String usage = String.format("java %s --host <arg> <command>%n", NodeCmd.class.getName()); hf.printHelp(usage, "", options, ""); System.out.println(header.toString()); } private static void addCmdHelp(StringBuilder sb, String cmd, String description) { sb.append(" ").append(cmd); // Ghetto indentation (trying, but not too hard, to not look too bad) if (cmd.length() <= 20) for (int i = cmd.length(); i < 22; ++i) sb.append(" "); sb.append(" - ").append(description).append("\n"); } /** * Write a textual representation of the Cassandra ring. * * @param outs the stream to write to */ public void printRing(PrintStream outs) { Map<Token, String> tokenToEndpoint = probe.getTokenToEndpointMap(); List<Token> sortedTokens = new ArrayList<Token>(tokenToEndpoint.keySet()); Collections.sort(sortedTokens); Collection<String> liveNodes = probe.getLiveNodes(); Collection<String> deadNodes = probe.getUnreachableNodes(); Collection<String> joiningNodes = probe.getJoiningNodes(); Collection<String> leavingNodes = probe.getLeavingNodes(); Map<String, String> loadMap = probe.getLoadMap(); outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s%n", "Address", "Status", "State", "Load", "Owns", "Token"); // show pre-wrap token twice so you can always read a node's range as // (previous line token, current line token] if (sortedTokens.size() > 1) outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s%n", "", "", "", "", "", sortedTokens.get(sortedTokens.size() - 1)); // Calculate per-token ownership of the ring Map<Token, Float> ownerships = probe.getOwnership(); for (Token token : sortedTokens) { String primaryEndpoint = tokenToEndpoint.get(token); String status = liveNodes.contains(primaryEndpoint) ? "Up" : deadNodes.contains(primaryEndpoint) ? "Down" : "?"; String state = joiningNodes.contains(primaryEndpoint) ? "Joining" : leavingNodes.contains(primaryEndpoint) ? "Leaving" : "Normal"; String load = loadMap.containsKey(primaryEndpoint) ? loadMap.get(primaryEndpoint) : "?"; String owns = new DecimalFormat("##0.00%").format(ownerships.get(token)); outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s%n", primaryEndpoint, status, state, load, owns, token); } } public void printThreadPoolStats(PrintStream outs) { outs.printf("%-25s%10s%10s%15s%n", "Pool Name", "Active", "Pending", "Completed"); Iterator<Map.Entry<String, IExecutorMBean>> threads = probe.getThreadPoolMBeanProxies(); while (threads.hasNext()) { Entry<String, IExecutorMBean> thread = threads.next(); String poolName = thread.getKey(); IExecutorMBean threadPoolProxy = thread.getValue(); outs.printf("%-25s%10s%10s%15s%n", poolName, threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(), threadPoolProxy.getCompletedTasks()); } } /** * Write node information. * * @param outs the stream to write to */ public void printInfo(PrintStream outs) { boolean gossipInitialized = probe.isInitialized(); outs.println(probe.getToken()); outs.printf("%-17s: %s%n", "Gossip active", gossipInitialized); outs.printf("%-17s: %s%n", "Load", probe.getLoadString()); if (gossipInitialized) outs.printf("%-17s: %s%n", "Generation No", probe.getCurrentGenerationNumber()); else outs.printf("%-17s: %s%n", "Generation No", 0); // Uptime long secondsUp = probe.getUptime() / 1000; outs.printf("%-17s: %d%n", "Uptime (seconds)", secondsUp); // Memory usage MemoryUsage heapUsage = probe.getHeapMemoryUsage(); double memUsed = (double)heapUsage.getUsed() / (1024 * 1024); double memMax = (double)heapUsage.getMax() / (1024 * 1024); outs.printf("%-17s: %.2f / %.2f%n", "Heap Memory (MB)", memUsed, memMax); } public void printReleaseVersion(PrintStream outs) { outs.println("ReleaseVersion: " + probe.getReleaseVersion()); } public void printNetworkStats(final InetAddress addr, PrintStream outs) { outs.printf("Mode: %s%n", probe.getOperationMode()); Set<InetAddress> hosts = addr == null ? probe.getStreamDestinations() : new HashSet<InetAddress>(){{add(addr);}}; if (hosts.size() == 0) outs.println("Not sending any streams."); for (InetAddress host : hosts) { try { List<String> files = probe.getFilesDestinedFor(host); if (files.size() > 0) { outs.printf("Streaming to: %s%n", host); for (String file : files) outs.printf(" %s%n", file); } else { outs.printf(" Nothing streaming to %s%n", host); } } catch (IOException ex) { outs.printf(" Error retrieving file data for %s%n", host); } } hosts = addr == null ? probe.getStreamSources() : new HashSet<InetAddress>(){{add(addr); }}; if (hosts.size() == 0) outs.println("Not receiving any streams."); for (InetAddress host : hosts) { try { List<String> files = probe.getIncomingFiles(host); if (files.size() > 0) { outs.printf("Streaming from: %s%n", host); for (String file : files) outs.printf(" %s%n", file); } else { outs.printf(" Nothing streaming from %s%n", host); } } catch (IOException ex) { outs.printf(" Error retrieving file data for %s%n", host); } } MessagingServiceMBean ms = probe.getMsProxy(); outs.printf("%-25s", "Pool Name"); outs.printf("%10s", "Active"); outs.printf("%10s", "Pending"); outs.printf("%15s%n", "Completed"); int pending; long completed; pending = 0; for (int n : ms.getCommandPendingTasks().values()) pending += n; completed = 0; for (long n : ms.getCommandCompletedTasks().values()) completed += n; outs.printf("%-25s%10s%10s%15s%n", "Commands", "n/a", pending, completed); pending = 0; for (int n : ms.getResponsePendingTasks().values()) pending += n; completed = 0; for (long n : ms.getResponseCompletedTasks().values()) completed += n; outs.printf("%-25s%10s%10s%15s%n", "Responses", "n/a", pending, completed); } public void printCompactionStats(PrintStream outs) { CompactionManagerMBean cm = probe.getCompactionManagerProxy(); outs.println("compaction type: " + (cm.getCompactionType() == null ? "n/a" : cm.getCompactionType())); outs.println("column family: " + (cm.getColumnFamilyInProgress() == null ? "n/a" : cm.getColumnFamilyInProgress())); outs.println("bytes compacted: " + (cm.getBytesCompacted() == null ? "n/a" : cm.getBytesCompacted())); outs.println("bytes total in progress: " + (cm.getBytesTotalInProgress() == null ? "n/a" : cm.getBytesTotalInProgress() )); outs.println("pending tasks: " + cm.getPendingTasks()); } public void printColumnFamilyStats(PrintStream outs) { Map <String, List <ColumnFamilyStoreMBean>> cfstoreMap = new HashMap <String, List <ColumnFamilyStoreMBean>>(); // get a list of column family stores Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> cfamilies = probe.getColumnFamilyStoreMBeanProxies(); while (cfamilies.hasNext()) { Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next(); String tableName = entry.getKey(); ColumnFamilyStoreMBean cfsProxy = entry.getValue(); if (!cfstoreMap.containsKey(tableName)) { List<ColumnFamilyStoreMBean> columnFamilies = new ArrayList<ColumnFamilyStoreMBean>(); columnFamilies.add(cfsProxy); cfstoreMap.put(tableName, columnFamilies); } else { cfstoreMap.get(tableName).add(cfsProxy); } } // print out the table statistics for (Entry<String, List<ColumnFamilyStoreMBean>> entry : cfstoreMap.entrySet()) { String tableName = entry.getKey(); List<ColumnFamilyStoreMBean> columnFamilies = entry.getValue(); long tableReadCount = 0; long tableWriteCount = 0; int tablePendingTasks = 0; double tableTotalReadTime = 0.0f; double tableTotalWriteTime = 0.0f; outs.println("Keyspace: " + tableName); for (ColumnFamilyStoreMBean cfstore : columnFamilies) { long writeCount = cfstore.getWriteCount(); long readCount = cfstore.getReadCount(); if (readCount > 0) { tableReadCount += readCount; tableTotalReadTime += cfstore.getTotalReadLatencyMicros(); } if (writeCount > 0) { tableWriteCount += writeCount; tableTotalWriteTime += cfstore.getTotalWriteLatencyMicros(); } tablePendingTasks += cfstore.getPendingTasks(); } double tableReadLatency = tableReadCount > 0 ? tableTotalReadTime / tableReadCount / 1000 : Double.NaN; double tableWriteLatency = tableWriteCount > 0 ? tableTotalWriteTime / tableWriteCount / 1000 : Double.NaN; outs.println("\tRead Count: " + tableReadCount); outs.println("\tRead Latency: " + String.format("%s", tableReadLatency) + " ms."); outs.println("\tWrite Count: " + tableWriteCount); outs.println("\tWrite Latency: " + String.format("%s", tableWriteLatency) + " ms."); outs.println("\tPending Tasks: " + tablePendingTasks); // print out column family statistics for this table for (ColumnFamilyStoreMBean cfstore : columnFamilies) { outs.println("\t\tColumn Family: " + cfstore.getColumnFamilyName()); outs.println("\t\tSSTable count: " + cfstore.getLiveSSTableCount()); outs.println("\t\tSpace used (live): " + cfstore.getLiveDiskSpaceUsed()); outs.println("\t\tSpace used (total): " + cfstore.getTotalDiskSpaceUsed()); outs.println("\t\tMemtable Columns Count: " + cfstore.getMemtableColumnsCount()); outs.println("\t\tMemtable Data Size: " + cfstore.getMemtableDataSize()); outs.println("\t\tMemtable Switch Count: " + cfstore.getMemtableSwitchCount()); outs.println("\t\tRead Count: " + cfstore.getReadCount()); outs.println("\t\tRead Latency: " + String.format("%01.3f", cfstore.getRecentReadLatencyMicros() / 1000) + " ms."); outs.println("\t\tWrite Count: " + cfstore.getWriteCount()); outs.println("\t\tWrite Latency: " + String.format("%01.3f", cfstore.getRecentWriteLatencyMicros() / 1000) + " ms."); outs.println("\t\tPending Tasks: " + cfstore.getPendingTasks()); JMXInstrumentedCacheMBean keyCacheMBean = probe.getKeyCacheMBean(tableName, cfstore.getColumnFamilyName()); if (keyCacheMBean.getCapacity() > 0) { outs.println("\t\tKey cache capacity: " + keyCacheMBean.getCapacity()); outs.println("\t\tKey cache size: " + keyCacheMBean.getSize()); outs.println("\t\tKey cache hit rate: " + keyCacheMBean.getRecentHitRate()); } else { outs.println("\t\tKey cache: disabled"); } JMXInstrumentedCacheMBean rowCacheMBean = probe.getRowCacheMBean(tableName, cfstore.getColumnFamilyName()); if (rowCacheMBean.getCapacity() > 0) { outs.println("\t\tRow cache capacity: " + rowCacheMBean.getCapacity()); outs.println("\t\tRow cache size: " + rowCacheMBean.getSize()); outs.println("\t\tRow cache hit rate: " + rowCacheMBean.getRecentHitRate()); } else { outs.println("\t\tRow cache: disabled"); } outs.println("\t\tCompacted row minimum size: " + cfstore.getMinRowSize()); outs.println("\t\tCompacted row maximum size: " + cfstore.getMaxRowSize()); outs.println("\t\tCompacted row mean size: " + cfstore.getMeanRowSize()); outs.println(""); } outs.println("----------------"); } } public void printRemovalStatus(PrintStream outs) { outs.println("RemovalStatus: " + probe.getRemovalStatus()); } private void printCfHistograms(String keySpace, String columnFamily, PrintStream output) { ColumnFamilyStoreMBean store = this.probe.getCfsProxy(keySpace, columnFamily); // default is 90 offsets long[] offsets = new EstimatedHistogram().getBucketOffsets(); long[] rrlh = store.getRecentReadLatencyHistogramMicros(); long[] rwlh = store.getRecentWriteLatencyHistogramMicros(); long[] sprh = store.getRecentSSTablesPerReadHistogram(); long[] ersh = store.getEstimatedRowSizeHistogram(); long[] ecch = store.getEstimatedColumnCountHistogram(); output.println(String.format("%s/%s histograms", keySpace, columnFamily)); output.println(String.format("%-10s%10s%18s%18s%18s%18s", "Offset", "SSTables", "Write Latency", "Read Latency", "Row Size", "Column Count")); for (int i = 0; i < offsets.length; i++) { output.println(String.format("%-10d%10s%18s%18s%18s%18s", offsets[i], (i < sprh.length ? sprh[i] : ""), (i < rwlh.length ? rrlh[i] : ""), (i < rrlh.length ? rwlh[i] : ""), (i < ersh.length ? ersh[i] : ""), (i < ecch.length ? ecch[i] : ""))); } } public static void main(String[] args) throws IOException, InterruptedException, ConfigurationException, ParseException { CommandLineParser parser = new PosixParser(); ToolCommandLine cmd = null; try { cmd = new ToolCommandLine(parser.parse(options, args)); } catch (ParseException p) { badUse(p.getMessage()); } String host = cmd.getOptionValue(HOST_OPT.left); int port = DEFAULT_PORT; String portNum = cmd.getOptionValue(PORT_OPT.left); if (portNum != null) { try { port = Integer.parseInt(portNum); } catch (NumberFormatException e) { throw new ParseException("Port must be a number"); } } String username = cmd.getOptionValue(USERNAME_OPT.left); String password = cmd.getOptionValue(PASSWORD_OPT.left); NodeProbe probe = null; try { probe = username == null ? new NodeProbe(host, port) : new NodeProbe(host, port, username, password); } catch (IOException ioe) { err(ioe, "Error connection to remote JMX agent!"); } NodeCommand command = null; try { command = cmd.getCommand(); } catch (IllegalArgumentException e) { badUse(e.getMessage()); } NodeCmd nodeCmd = new NodeCmd(probe); // Execute the requested command. String[] arguments = cmd.getCommandArguments(); switch (command) { case RING : nodeCmd.printRing(System.out); break; case INFO : nodeCmd.printInfo(System.out); break; case CFSTATS : nodeCmd.printColumnFamilyStats(System.out); break; case DECOMMISSION : probe.decommission(); break; case LOADBALANCE : probe.loadBalance(); break; case CLEARSNAPSHOT : probe.clearSnapshot(); break; case TPSTATS : nodeCmd.printThreadPoolStats(System.out); break; case VERSION : nodeCmd.printReleaseVersion(System.out); break; case COMPACTIONSTATS : nodeCmd.printCompactionStats(System.out); break; case DISABLEGOSSIP : probe.stopGossiping(); break; case ENABLEGOSSIP : probe.startGossiping(); break; case DISABLETHRIFT : probe.stopThriftServer(); break; case ENABLETHRIFT : probe.startThriftServer(); break; case DRAIN : try { probe.drain(); } catch (ExecutionException ee) { err(ee, "Error occured during flushing"); } break; case NETSTATS : if (arguments.length > 0) { nodeCmd.printNetworkStats(InetAddress.getByName(arguments[0]), System.out); } else { nodeCmd.printNetworkStats(null, System.out); } break; case SNAPSHOT : if (arguments.length > 0) { probe.takeSnapshot(arguments[0]); } else { probe.takeSnapshot(""); } break; case MOVE : if (arguments.length != 1) { badUse("Missing token argument for move."); } probe.move(arguments[0]); break; case JOIN: if (probe.isJoined()) { System.err.println("This node has already joined the ring."); System.exit(1); } probe.joinRing(); break; case REMOVETOKEN : if (arguments.length != 1) { badUse("Missing an argument for removetoken (either status, force, or a token)"); } else if (arguments[0].equals("status")) { nodeCmd.printRemovalStatus(System.out); } else if (arguments[0].equals("force")) { nodeCmd.printRemovalStatus(System.out); probe.forceRemoveCompletion(); } else { probe.removeToken(arguments[0]); } break; case CLEANUP : case COMPACT : case REPAIR : case FLUSH : case SCRUB : case INVALIDATEKEYCACHE : case INVALIDATEROWCACHE : optionalKSandCFs(command, arguments, probe); break; case GETCOMPACTIONTHRESHOLD : if (arguments.length != 2) { badUse("getcompactionthreshold requires ks and cf args."); } probe.getCompactionThreshold(System.out, arguments[0], arguments[1]); break; case CFHISTOGRAMS : if (arguments.length != 2) { badUse("cfhistograms requires ks and cf args"); } nodeCmd.printCfHistograms(arguments[0], arguments[1], System.out); break; case SETCACHECAPACITY : if (arguments.length != 4) { badUse("setcachecapacity requires ks, cf, keycachecap, and rowcachecap args."); } probe.setCacheCapacities(arguments[0], arguments[1], Integer.parseInt(arguments[2]), Integer.parseInt(arguments[3])); break; case SETCOMPACTIONTHRESHOLD : if (arguments.length != 4) { badUse("setcompactionthreshold requires ks, cf, min, and max threshold args."); } int minthreshold = Integer.parseInt(arguments[2]); int maxthreshold = Integer.parseInt(arguments[3]); if ((minthreshold < 0) || (maxthreshold < 0)) { badUse("Thresholds must be positive integers"); } if (minthreshold > maxthreshold) { badUse("Min threshold cannot be greater than max."); } if (minthreshold < 2 && maxthreshold != 0) { badUse("Min threshold must be at least 2"); } probe.setCompactionThreshold(arguments[0], arguments[1], minthreshold, maxthreshold); break; default : throw new RuntimeException("Unreachable code."); } System.exit(0); } private static void badUse(String useStr) { System.err.println(useStr); printUsage(); System.exit(1); } private static void err(Exception e, String errStr) { System.err.println(errStr); e.printStackTrace(); System.exit(3); } private static void optionalKSandCFs(NodeCommand nc, String[] cmdArgs, NodeProbe probe) throws InterruptedException, IOException { // if there is one additional arg, it's the keyspace; more are columnfamilies List<String> keyspaces = cmdArgs.length == 0 ? probe.getKeyspaces() : Arrays.asList(cmdArgs[0]); for (String keyspace : keyspaces) { if (!probe.getKeyspaces().contains(keyspace)) { System.err.println("Keyspace [" + keyspace + "] does not exist."); System.exit(1); } } // second loop so we're less likely to die halfway through due to invalid keyspace for (String keyspace : keyspaces) { String[] columnFamilies = cmdArgs.length <= 1 ? new String[0] : Arrays.copyOfRange(cmdArgs, 1, cmdArgs.length); switch (nc) { case REPAIR : probe.forceTableRepair(keyspace, columnFamilies); break; case INVALIDATEKEYCACHE : probe.invalidateKeyCaches(keyspace, columnFamilies); break; case INVALIDATEROWCACHE : probe.invalidateRowCaches(keyspace, columnFamilies); break; case FLUSH : try { probe.forceTableFlush(keyspace, columnFamilies); } catch (ExecutionException ee) { err(ee, "Error occured during flushing"); } break; case COMPACT : try { probe.forceTableCompaction(keyspace, columnFamilies); } catch (ExecutionException ee) { err(ee, "Error occured during compaction"); } break; case CLEANUP : if (keyspace.equals("system")) { break; } // Skip cleanup on system cfs. try { probe.forceTableCleanup(keyspace, columnFamilies); } catch (ExecutionException ee) { err(ee, "Error occured during cleanup"); } break; case SCRUB : try { probe.scrub(keyspace, columnFamilies); } catch (ExecutionException ee) { err(ee, "Error occured while scrubbing keyspace " + keyspace); } break; default: throw new RuntimeException("Unreachable code."); } } } private static class ToolOptions extends Options { public void addOption(Pair<String, String> opts, boolean hasArgument, String description) { addOption(opts, hasArgument, description, false); } public void addOption(Pair<String, String> opts, boolean hasArgument, String description, boolean required) { addOption(opts.left, opts.right, hasArgument, description, required); } public void addOption(String opt, String longOpt, boolean hasArgument, String description, boolean required) { Option option = new Option(opt, longOpt, hasArgument, description); option.setRequired(required); addOption(option); } } private static class ToolCommandLine { private final CommandLine commandLine; public ToolCommandLine(CommandLine commands) { commandLine = commands; } public Option[] getOptions() { return commandLine.getOptions(); } public boolean hasOption(String opt) { return commandLine.hasOption(opt); } public String getOptionValue(String opt) { return commandLine.getOptionValue(opt); } public NodeCommand getCommand() { if (commandLine.getArgs().length == 0) throw new IllegalArgumentException("Command was not specified."); String command = commandLine.getArgs()[0]; try { return NodeCommand.valueOf(command.toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unrecognized command: " + command); } } public String[] getCommandArguments() { List params = commandLine.getArgList(); if (params.size() < 2) // command parameters are empty return new String[0]; String[] toReturn = new String[params.size() - 1]; for (int i = 1; i < params.size(); i++) toReturn[i - 1] = (String) params.get(i); return toReturn; } } }
[ "sunsuk7tp@gmail.com" ]
sunsuk7tp@gmail.com
e350e5c04b44e416137daca9c3cac73296e4b032
a00326c0e2fc8944112589cd2ad638b278f058b9
/src/main/java/000/147/470/CWE89_SQL_Injection__getParameter_Servlet_executeUpdate_75a.java
a5248226ee7f75c5be27a357a356db39c347428d
[]
no_license
Lanhbao/Static-Testing-for-Juliet-Test-Suite
6fd3f62713be7a084260eafa9ab221b1b9833be6
b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68
refs/heads/master
2020-08-24T13:34:04.004149
2019-10-25T09:26:00
2019-10-25T09:26:00
216,822,684
0
1
null
2019-11-08T09:51:54
2019-10-22T13:37:13
Java
UTF-8
Java
false
false
6,906
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE89_SQL_Injection__getParameter_Servlet_executeUpdate_75a.java Label Definition File: CWE89_SQL_Injection.label.xml Template File: sources-sinks-75a.tmpl.java */ /* * @description * CWE: 89 SQL Injection * BadSource: getParameter_Servlet Read data from a querystring using getParameter() * GoodSource: A hardcoded string * Sinks: executeUpdate * GoodSink: Use prepared statement and executeUpdate (properly) * BadSink : data concatenated into SQL statement used in executeUpdate(), which could result in SQL Injection * Flow Variant: 75 Data flow: data passed in a serialized object from one method to another in different source files in the same package * * */ import java.io.ByteArrayOutputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.io.IOException; import java.util.logging.Level; import javax.servlet.http.*; public class CWE89_SQL_Injection__getParameter_Servlet_executeUpdate_75a extends AbstractTestCaseServlet { public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* POTENTIAL FLAW: Read data from a querystring using getParameter */ data = request.getParameter("name"); /* serialize data to a byte array */ ByteArrayOutputStream streamByteArrayOutput = null; ObjectOutput outputObject = null; try { streamByteArrayOutput = new ByteArrayOutputStream() ; outputObject = new ObjectOutputStream(streamByteArrayOutput) ; outputObject.writeObject(data); byte[] dataSerialized = streamByteArrayOutput.toByteArray(); (new CWE89_SQL_Injection__getParameter_Servlet_executeUpdate_75b()).badSink(dataSerialized , request, response ); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "IOException in serialization", exceptIO); } finally { /* clean up stream writing objects */ try { if (outputObject != null) { outputObject.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ObjectOutputStream", exceptIO); } try { if (streamByteArrayOutput != null) { streamByteArrayOutput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ByteArrayOutputStream", exceptIO); } } } public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable { goodG2B(request, response); goodB2G(request, response); } /* goodG2B() - use GoodSource and BadSink */ private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* FIX: Use a hardcoded string */ data = "foo"; /* serialize data to a byte array */ ByteArrayOutputStream streamByteArrayOutput = null; ObjectOutput outputObject = null; try { streamByteArrayOutput = new ByteArrayOutputStream() ; outputObject = new ObjectOutputStream(streamByteArrayOutput) ; outputObject.writeObject(data); byte[] dataSerialized = streamByteArrayOutput.toByteArray(); (new CWE89_SQL_Injection__getParameter_Servlet_executeUpdate_75b()).goodG2BSink(dataSerialized , request, response ); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "IOException in serialization", exceptIO); } finally { /* clean up stream writing objects */ try { if (outputObject != null) { outputObject.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ObjectOutputStream", exceptIO); } try { if (streamByteArrayOutput != null) { streamByteArrayOutput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ByteArrayOutputStream", exceptIO); } } } /* goodB2G() - use BadSource and GoodSink */ private void goodB2G(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* POTENTIAL FLAW: Read data from a querystring using getParameter */ data = request.getParameter("name"); /* serialize data to a byte array */ ByteArrayOutputStream streamByteArrayOutput = null; ObjectOutput outputObject = null; try { streamByteArrayOutput = new ByteArrayOutputStream() ; outputObject = new ObjectOutputStream(streamByteArrayOutput) ; outputObject.writeObject(data); byte[] dataSerialized = streamByteArrayOutput.toByteArray(); (new CWE89_SQL_Injection__getParameter_Servlet_executeUpdate_75b()).goodB2GSink(dataSerialized , request, response ); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "IOException in serialization", exceptIO); } finally { /* clean up stream writing objects */ try { if (outputObject != null) { outputObject.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ObjectOutputStream", exceptIO); } try { if (streamByteArrayOutput != null) { streamByteArrayOutput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ByteArrayOutputStream", exceptIO); } } } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "anhtluet12@gmail.com" ]
anhtluet12@gmail.com
6ffd30364b563c4b805f5c47b47700aa579a4113
3f9457963586b56ddbc979a8318abceb0296b87b
/app/src/main/java/com/aztlandev/abc/viewsFragments/About_abc.java
53fc14aa49779413dd79e0270bf6b92abdc1ddb9
[]
no_license
Dgiovan/123abc
d5bd483f2209def0b57c56091f3cfcd04b14d721
1373a482f9824c2eb6f9456cc749a5eff01cc9be
refs/heads/master
2022-11-17T03:40:12.312413
2020-07-11T00:02:06
2020-07-11T00:02:06
278,506,583
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package com.aztlandev.abc.viewsFragments; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.aztlandev.Bases.BaseFragment; import com.aztlandev.abc.R; /** * A simple {@link Fragment} subclass. */ public class About_abc extends BaseFragment { public About_abc() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_about_abc, container, false); } @Override public void setup(View rootView, Bundle savedInstanceState) { } }
[ "giogirecd32@gmail.com" ]
giogirecd32@gmail.com
281b0722fc5dfd272523ceabf63a52e9da02343e
f8405484c956d85a1bf6fce05b499790a6f2b0e2
/src/main/java/astro/TreeNode/CheckJson.java
77c0e6acdeb1f7316983889edf746ee68bb9aa8b
[]
no_license
Astropl/ToDoApp
06c8ab9730a7f4d3304a207828e4c3ed8e0330c7
85367919d53258da9754728aaa4d1e75f5f204c9
refs/heads/master
2020-03-28T11:24:50.281025
2018-10-10T20:32:03
2018-10-10T20:32:03
148,210,297
0
0
null
null
null
null
UTF-8
Java
false
false
5,607
java
//package astro.TreeNode; // //import javax.json.*; //import javax.json.stream.JsonGenerator; //import javax.json.stream.JsonGeneratorFactory; //import javax.json.stream.JsonParser; //import javax.json.stream.JsonParserFactory; //import java.io.ByteArrayInputStream; //import java.io.OutputStream; //import java.util.Collections; //import java.util.Map; // //public class CheckJson //{ // // // public static void main(String[] args) { // objectModeWriting(); // objectModeReading(); // streamModeWriting(); // streamModeReading(); // } // // private static void streamModeWriting() { // JsonGeneratorFactory generatorFactory = Json.createGeneratorFactory(Collections.singletonMap(JsonGenerator.PRETTY_PRINTING, true)); // JsonGenerator generator = generatorFactory.createGenerator(System.out); // generator // .writeStartObject() // .write("imię", "Marcin") // .write("nazwisko", "Pietraszek") // .writeStartObject("strona") // .write("adres www", "http://www.samouczekprogramisty.pl") // .writeStartArray("artykuły") // .writeStartObject() // .write("tytuł", "Format JSON w języku Java") // .writeStartObject("data publikacji") // .write("rok", 2018) // .write("miesiąc", 9) // .write("dzień", 13) // .writeEnd() // .writeEnd() // .writeEnd() // .writeEnd() // .writeEnd().flush(); // } // // private static void streamModeReading() { // JsonParserFactory parserFactory = Json.createParserFactory(Collections.emptyMap()); // JsonParser parser = parserFactory.createParser(buildObject()); // // while (parser.hasNext()) { // JsonParser.Event event = parser.next(); // switch (event) { // case START_OBJECT: // System.out.println("{"); // break; // case END_OBJECT: // System.out.println("}"); // break; // case START_ARRAY: // System.out.println("["); // break; // case END_ARRAY: // System.out.println("]"); // break; // case KEY_NAME: // System.out.print(String.format("\"%s\": ", parser.getString())); // break; // case VALUE_NUMBER: // System.out.println(parser.getBigDecimal()); // break; // case VALUE_STRING: // System.out.println(String.format("\"%s\"", parser.getString())); // break; // default: // System.out.println("true, false or null"); // } // } // // } // // private static void objectModeWriting() { // JsonObject authorObject = buildObject(); // // System.out.println(authorObject.toString()); // write(authorObject, System.out); // } // // private static void write(JsonObject jsonObject, OutputStream outputStream) { // Map<String, ?> config = Collections.singletonMap(JsonGenerator.PRETTY_PRINTING, true); // JsonWriterFactory writerFactory = Json.createWriterFactory(config); // writerFactory.createWriter(outputStream).write(jsonObject); // } // // private static void objectModeReading() { // String jsonDocument = buildObject().toString(); // // JsonReaderFactory readerFactory = Json.createReaderFactory(Collections.emptyMap()); // try (JsonReader jsonReader = readerFactory.createReader(new ByteArrayInputStream(jsonDocument.getBytes()))) { // JsonStructure jsonStructure = jsonReader.read(); // System.out.println(jsonStructure.getValue("/strona/artykuły/0/data publikacji")); // } // // try (JsonReader jsonReader = readerFactory.createReader(new ByteArrayInputStream(jsonDocument.getBytes()))) { // JsonObject jsonObject = jsonReader.readObject(); // System.out.println(jsonObject // .getJsonObject("strona") // .getJsonArray("artykuły") // .get(0).asJsonObject() // .getJsonObject("data publikacji") // ); // } // } // // private static JsonObject buildObject() { // JsonBuilderFactory builderFactory = Json.createBuilderFactory(Collections.emptyMap()); // JsonObject publicationDateObject = builderFactory.createObjectBuilder() // .add("rok", 2018) // .add("miesiąc", 9) // .add("dzień", 13).build(); // // JsonObject articleObject = builderFactory.createObjectBuilder() // .add("tytuł", "Format JSON w języku Java") // .add("data publikacji", publicationDateObject).build(); // // JsonArray articlesArray = builderFactory.createArrayBuilder().add(articleObject).build(); // // JsonObject webPageObject = builderFactory.createObjectBuilder() // .add("adres www", "http://www.samouczekprogramisty.pl") // .add("artykuły", articlesArray).build(); // // return builderFactory.createObjectBuilder() // .add("imię", "Marcin") // .add("nazwisko", "Pietraszek") // .add("strona", webPageObject).build(); // } // // //}
[ "martys.pawel@gmail.com" ]
martys.pawel@gmail.com
df34fab0be99eea3b62280139079859a0342e3fa
ee61434c64bb92be965c3dfc59843cc2ffa3c01b
/GenArView-FW/src/pro/pmmc/genarview/functional/consumer/CLabelComponentTypical.java
80c6eb983a1836412713f8f7cad143ee80ebbb8e
[]
no_license
paulnetedu/genarview
6041f68f6233faed5cc056676f90331e4fc75326
2b3712e16c25076114c04d907db7d604f10d744b
refs/heads/master
2016-09-06T20:06:29.798492
2015-09-18T14:33:36
2015-09-18T14:33:36
42,727,300
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package pro.pmmc.genarview.functional.consumer; import java.util.List; import java.util.function.Consumer; import org.neo4j.graphdb.DynamicLabel; import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Transaction; import pro.pmmc.genarview.util.GraphUtil; public class CLabelComponentTypical implements Consumer<Node> { private List<String> lstLabel; public CLabelComponentTypical(List<String> lstLabel) { this.lstLabel = lstLabel; } @Override public void accept(Node t) { Transaction tx = GraphUtil.getGraphService().beginTx(); if (t.getProperty("name").equals("SingletonBean")) { String s = null; s = null; } for (String label : lstLabel) { t.addLabel(DynamicLabel.label(label)); } t.setProperty("base", t.getProperty("fullName").toString()); tx.success(); tx.close(); } }
[ "pmendozadelcarpio@gmail.com" ]
pmendozadelcarpio@gmail.com
5be134a10597f7f93de3f6e4ab8dc5652032176b
62d8278bb715a0c6f47312402d182ee08717a952
/src/KMPTester.java
1e047bdc6a168a7277285d1ab6aea33ef3af8138
[]
no_license
shirleyyoung0812/Knuth-Morris-Pratt-Algorithm
2eb37de7daf70d53f3ea3c11ab46dd42a7161b00
4c1fdf05dbf213ee36480451da8c1db63bfd6dcb
refs/heads/master
2020-05-17T02:51:25.251308
2015-01-12T06:01:12
2015-01-12T06:01:12
29,121,047
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
import java.util.*; public class KMPTester { public static void main(String[] args) { // TODO Auto-generated method stub KMP k = new KMP(); String text = "bbaba"; String pattern = "bbb"; //k.searchSubString(text, pattern); List<Integer> rst = k.searchSubString(text, pattern); for (Integer i : rst) System.out.println(i); } }
[ "yutian.yang.88@gmail.com" ]
yutian.yang.88@gmail.com
ee160d6fb47cbfcdffb951b80e82106ec93a1d1a
15e1aeed93809b3228ec2c24c7df68119dda3eba
/library/src/main/java/library/DictImpl.java
b75ebe6d1992fc3703ddd33acfabfa62957f18f6
[]
no_license
NivShalmon/software-design-2
1d7ab1adf8cd2671e78535e7c9c23c7df345aeb2
cd1a7cf7781393fc5cc4f0943c77c77f593968a3
refs/heads/master
2021-01-23T12:33:21.642662
2017-09-12T05:30:32
2017-09-12T05:30:32
93,169,908
0
0
null
null
null
null
UTF-8
Java
false
false
1,842
java
package library; import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; import com.google.inject.Inject; import com.google.inject.assistedinject.Assisted; import il.ac.technion.cs.sd.buy.ext.FutureLineStorage; import il.ac.technion.cs.sd.buy.ext.FutureLineStorageFactory; /** * The provided implementation of {@link Dict}, using {@link FutureLineStorage} * * @see {@link DictFactory} and {@link LibraryModule} for more info on how to * create an instance */ public class DictImpl implements Dict { private final FutureLineStorage storer; private final Map<String, String> pairs = new HashMap<>(); @Inject DictImpl(FutureLineStorageFactory factory, // @Assisted String name) { try { storer = factory.open(name).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } public CompletableFuture<Void> store() { return storeToStorage(pairs, storer).thenAccept(s -> { }); } static CompletableFuture<Void> storeToStorage(Map<String, String> map, FutureLineStorage store) { try { for (String key : map.keySet().stream().sorted().collect(Collectors.toList())) { store.appendLine(key).get(); store.appendLine(map.get(key)).get(); } } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } return CompletableFuture.completedFuture(null); } @Override public void add(String key, String value) { pairs.put(key, value); } @Override public void addAll(Map<String, String> ps) { pairs.putAll(ps); } @Override public CompletableFuture<Optional<String>> find(String key) { return BinarySearch.valueOf(storer, key, 0, storer.numberOfLines()); } }
[ "shalmon.niv@gmail.com" ]
shalmon.niv@gmail.com
2f46ab29c5307c71ece7e1098dcd20a6d84c553b
31cf98fc9e5f64f8529174e8afedf426f3c88af6
/MissedCall2Sms/src/com/bitbee/android/missedcall2sms/MissedCallContentObserver.java
44ed0ae72b5805631dae5adcd585ba733dd3e2fa
[]
no_license
leo4all/pangu
f0eba0e0732d1253a5ce73a0a11bbc2d298ddace
51cc7d6abcb5ba67eb6550e0a7e6aab07e5d464b
refs/heads/master
2016-09-11T02:53:17.203732
2011-08-04T08:16:45
2011-08-04T08:16:45
34,941,196
0
0
null
null
null
null
UTF-8
Java
false
false
2,371
java
package com.bitbee.android.missedcall2sms; import java.text.SimpleDateFormat; import android.content.Context; import android.database.ContentObserver; import android.database.Cursor; import android.os.Handler; import android.provider.CallLog.Calls; import android.telephony.SmsManager; import android.util.Log; public class MissedCallContentObserver extends ContentObserver { private Context ctx; private String _phoneNumber; private static Long lastTime = new Long(System.currentTimeMillis()); private static final String TAG = "MissedCallContentObserver"; public MissedCallContentObserver(Context context, Handler handler , String phone_number) { super(handler); ctx = context; _phoneNumber = phone_number; } @Override public void onChange(boolean selfChange) { Cursor csr = ctx.getContentResolver().query(Calls.CONTENT_URI, new String[] { Calls.NUMBER, Calls.TYPE, Calls.NEW, Calls.DATE, Calls.CACHED_NAME }, null, null, Calls.DEFAULT_SORT_ORDER); if (csr != null) { if (csr.moveToFirst()) { int type = csr.getInt(csr.getColumnIndex(Calls.TYPE)); switch (type) { case Calls.MISSED_TYPE: if(lastTime < csr.getLong(csr.getColumnIndex(Calls.DATE))){ Log.v(TAG, "missed type"); SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); String strMsg = ""; String _number = csr.getString(csr.getColumnIndex(Calls.NUMBER)); String _name = csr.getString(csr.getColumnIndex(Calls.CACHED_NAME)); if(_name == null){ strMsg = _number + "于" + df.format(csr.getLong(csr.getColumnIndex(Calls.DATE))) + "给你打过电话。"; }else{ strMsg = _number + "(" + _name + ")于" + df.format(csr.getLong(csr.getColumnIndex(Calls.DATE))) + "给你打过电话。"; } SmsManager smsMgr = SmsManager.getDefault(); smsMgr.sendTextMessage(_phoneNumber, null,strMsg, null, null); lastTime = csr.getLong(csr.getColumnIndex(Calls.DATE)); } break; case Calls.INCOMING_TYPE: Log.v(TAG, "incoming type"); break; case Calls.OUTGOING_TYPE: Log.v(TAG, "outgoing type"); break; } } csr.close(); } } @Override public boolean deliverSelfNotifications() { return super.deliverSelfNotifications(); } }
[ "longben@gmail.com@4d87f418-fb31-0410-b12f-21406559f0cb" ]
longben@gmail.com@4d87f418-fb31-0410-b12f-21406559f0cb
7ee10e6e194e9b74c33eecf5c0abb9b52f473a02
c98824b25b2bdfdb28e85c8c4c3b4e0546004a21
/weixin_sell/src/main/java/com/itguang/weixinsell/project_test/TestFormValidController.java
b58d1712d4b85b54a27b2e64b30e1d4e80067ab4
[]
no_license
itguang/weixin_sell
9a97017c1c6ff44dbc48d2a6b53265e89a970b0f
7d0c1bdadbceb77490f2864dc273b1a7d133d6c1
refs/heads/master
2021-08-24T00:23:20.160243
2017-12-07T07:44:02
2017-12-07T07:44:02
112,056,941
0
1
null
null
null
null
UTF-8
Java
false
false
928
java
package com.itguang.weixinsell.project_test; import com.itguang.weixinsell.project_test.pojo.User; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; /** * @author itguang * @create 2017-12-07 14:42 **/ @RestController @RequestMapping("/test") public class TestFormValidController { @RequestMapping("/saveUser") public void saveUser(@Valid User user, BindingResult result) { System.out.println("user:"+user); if(result.hasErrors()) { List<ObjectError> list = result.getAllErrors(); for (ObjectError error : list) { System.out.println(error.getCode() + "-" + error.getDefaultMessage()); } } } }
[ "1445037803@qq.com" ]
1445037803@qq.com
06ca375581b6175cc27848f83882666dfe6e4af0
b6e703be01f5019b395032ebef2263fdb38f8493
/src/main/java/com/mikemyzhao/springbootdemo/entity/Student.java
9f2a6417d804f82f4263f7c5f6c6cdf6462b2be0
[]
no_license
tjzhaomengyi/SpringBootDemo
0bbb9d243c72e3ce1c4c930b03dfc74a2bd5f9a9
f8906bea691109d5d13eb2c4b0a9ae1d335daaf1
refs/heads/master
2020-07-16T18:01:54.399546
2019-09-03T09:20:06
2019-09-03T09:20:06
205,838,257
0
0
null
null
null
null
UTF-8
Java
false
false
2,394
java
package com.mikemyzhao.springbootdemo.entity; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; /** * @Auther: zhaomengyi * @Date: 2019/9/2 16:19 * @Description: */ @Component @ConfigurationProperties(prefix = "student") //@PropertySource(value = {"classpath:confg.properties"}) public class Student { // @Value("zl") private String name; private int age; private boolean sex; private Date birthday; private Map<String,Object> location; private String[] hobbies; private List<String> skills; private Pet pet; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public boolean isSex() { return sex; } public void setSex(boolean sex) { this.sex = sex; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public Map<String, Object> getLocation() { return location; } public void setLocation(Map<String, Object> location) { this.location = location; } public String[] getHobbies() { return hobbies; } public void setHobbies(String[] hobbies) { this.hobbies = hobbies; } public List<String> getSkills() { return skills; } public void setSkills(List<String> skills) { this.skills = skills; } public Pet getPet() { return pet; } public void setPet(Pet pet) { this.pet = pet; } @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", age=" + age + ", sex=" + sex + ", birthday=" + birthday + ", location=" + location + ", hobbies=" + Arrays.toString(hobbies) + ", skills=" + skills + ", pet=" + pet + '}'; } }
[ "tjzhaomengyi@163.com" ]
tjzhaomengyi@163.com
cc2b1636dcdb2bb6375250ec86c858ddf535da20
9d09f0a59fe5087000ce4010737441357de9ae65
/app/src/main/java/com/xsvideoLive/www/mvp/contract/ChiliOutlayContract.java
66a294b5920146b904b6bbaf261e64e4b744f372
[]
no_license
lgh990/XiuSe
694e6fd078fec2c4ca537654f8d4aeef5037272d
b3d659c47fae10cf59b2a8fe1eeb65e68f82836f
refs/heads/master
2023-03-01T13:14:19.763557
2021-02-02T04:53:38
2021-02-02T04:53:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,423
java
package com.xsvideoLive.www.mvp.contract; import com.xsvideoLive.www.base.BaseView; import com.xsvideoLive.www.net.HttpObservable; import com.xsvideoLive.www.net.bean.BaseResponse; import com.xsvideoLive.www.net.bean.ChiliIncomeResult; import com.xsvideoLive.www.net.bean.HomeRoomResult; import com.scwang.smartrefresh.layout.api.RefreshLayout; import java.util.List; public interface ChiliOutlayContract { interface View extends BaseView { void onError(String msg); /** * 设置时间 * * @param date */ void setTime(String date); /** * 刷新成功 * @param refresh * @param incomeList */ void refreshSuccess(RefreshLayout refresh, List<ChiliIncomeResult> incomeList); /** * 加载成功 * @param refresh * @param incomeList */ void loadMoreSuccess(RefreshLayout refresh, List<ChiliIncomeResult> incomeList); } interface Presenter { /** * 时间选择 */ void selectTime(String date); /** * 获取收入列表 * @param date */ void getOutlayList(RefreshLayout refresh, String date); } interface Model { HttpObservable<BaseResponse<HomeRoomResult<List<ChiliIncomeResult>>>> getOutlayList(String current, String size, String date); } }
[ "895977304@qq.com" ]
895977304@qq.com
bb96371fcc97821f0289dbbc418464fc718aeaf4
b16953fc909eea1116dd9ee7a9ee1a9d340ffb80
/src/main/java/com/gioov/spiny/system/controller/ApiController.java
c207c820745da2ede81cb311d9c15098901fd569
[]
no_license
tamutamu-archive/spiny
b166ab3fb1ce99e5977f7a27f6e18a286374b125
1bcc52e090593888130b4299cd0258b05970bc51
refs/heads/master
2021-09-20T06:27:41.278456
2018-08-06T00:29:22
2018-08-06T00:29:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
997
java
package com.gioov.spiny.system.controller; import com.gioov.spiny.common.constant.Page; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import static com.gioov.spiny.user.service.UserService.SYSTEM_ADMIN; /** * @author godcheese * @date 2018/5/18 */ @Controller @RequestMapping(Page.System.API) public class ApiController { @PreAuthorize("hasRole('" + SYSTEM_ADMIN + "') OR hasAuthority('/SYSTEM/API/PAGE_ALL')") @RequestMapping("/page_all") public String pageAll() { return Page.System.API + "/page_all"; } @PreAuthorize("isAuthenticated()") @RequestMapping("/add_dialog") public String addDialog() { return Page.System.API + "/add_dialog"; } @PreAuthorize("isAuthenticated()") @RequestMapping("/edit_dialog") public String editDialog() { return Page.System.API + "/edit_dialog"; } }
[ "godcheese@outlook.com" ]
godcheese@outlook.com
6ecaddac486dc0f9d1878bafaf2ef35291a551a4
35588ed2085b0d8cbd36c16e2ad2d860519f8158
/addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/appmanager/HelperBase.java
aab5538497f41e4b0b13622f6626815fa11f7c8c
[ "Apache-2.0" ]
permissive
OlgaSaw/java_kurs
36ec7202864471a78775116722bbf85b05bbd526
e2de028b4c41be3af7ed200390f5ef2bc16f0f0f
refs/heads/master
2020-04-07T03:05:04.885253
2019-03-28T18:59:58
2019-03-28T18:59:58
158,001,819
0
0
null
null
null
null
UTF-8
Java
false
false
1,251
java
package ru.stqa.pft.addressbook.appmanager; import org.openqa.selenium.By; import org.openqa.selenium.NoAlertPresentException; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import java.io.File; public class HelperBase { protected WebDriver wd; public HelperBase(WebDriver wd) { this.wd=wd; } protected void click(By locator) { wd.findElement(locator).click(); } protected void type(By locator, String text) { click(locator); if (text !=null) { String existingText = wd.findElement(locator).getAttribute("value"); if (! text.equals(existingText)){ wd.findElement(locator).clear(); wd.findElement(locator).sendKeys(text); } } } protected void attach(By locator, File file) { if (file !=null) { wd.findElement(locator).sendKeys(file.getAbsolutePath()); } } public boolean isAlertPresent() { try { wd.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } } protected boolean isElementPresent(By locator) { try { wd.findElement(locator); return true; } catch (NoSuchElementException ex) { return false; } } }
[ "olga.nowakowska@op.pl" ]
olga.nowakowska@op.pl
c9f86c5c261455b7e5c69b1b20bad5f669778153
7365ae3cc2b333f0b831573b14e1ab44c049bc95
/app/src/main/java/com/example/desktop/sr06/TextToSpeechStartupListener.java
5a4efb007c2ee18bd5fdb9b5d6d653cc955baaad
[]
no_license
candidature/SR06
09e6c11ddd4ee18400c855113c19ca33bd33701d
4a24ffeed0593590e59017d3aebcd1f71caa2de5
refs/heads/master
2021-01-01T08:21:11.998517
2015-08-03T10:21:36
2015-08-03T10:21:36
37,545,175
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.example.desktop.sr06; import android.speech.tts.TextToSpeech; /** * Created by Desktop on 6/14/2015. */ public interface TextToSpeechStartupListener { public void onSuccessfulInit(TextToSpeech tts); public void onFailedToInit(); }
[ "contact.gpankaj@gmail.com" ]
contact.gpankaj@gmail.com
a7846f055309931dec2a45f52244e999f975585b
bae620be89738a2ec576006767fc9a8887f0997a
/app/src/main/java/com/example/newminerisk/tools/NameValuePair.java
f2f018b8d82eaf0537ab6326d48a2c470e3f38ff
[]
no_license
guojiandongs/NewMineRIsk
47147e8c0b7004ef72cca27e4ad45b84a07309a7
c0bdb0555ec050d76c57c4f189d1fdf3012b1677
refs/heads/master
2021-07-10T09:26:01.888813
2020-07-08T06:34:57
2020-07-08T06:34:57
161,507,281
0
0
null
null
null
null
UTF-8
Java
false
false
229
java
package com.example.newminerisk.tools; // // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // public interface NameValuePair { String getName(); String getValue(); }
[ "guojiandong@gaoxinzb.com" ]
guojiandong@gaoxinzb.com
02e6aa1f6bcb56223c3014d7450d62af7499bbce
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-codebuild/src/main/java/com/amazonaws/services/codebuild/model/ProjectSortByType.java
eb3b30f64828a2aa5c42b2e5d782e1c0750bb96c
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
1,847
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.codebuild.model; import javax.annotation.Generated; /** * */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public enum ProjectSortByType { NAME("NAME"), CREATED_TIME("CREATED_TIME"), LAST_MODIFIED_TIME("LAST_MODIFIED_TIME"); private String value; private ProjectSortByType(String value) { this.value = value; } @Override public String toString() { return this.value; } /** * Use this in place of valueOf. * * @param value * real value * @return ProjectSortByType corresponding to the value * * @throws IllegalArgumentException * If the specified value does not map to one of the known values in this enum. */ public static ProjectSortByType fromValue(String value) { if (value == null || "".equals(value)) { throw new IllegalArgumentException("Value cannot be null or empty!"); } for (ProjectSortByType enumEntry : ProjectSortByType.values()) { if (enumEntry.toString().equals(value)) { return enumEntry; } } throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); } }
[ "" ]
57eaa93bc578ac868c81eeb6ceeacebf8687eee3
c534f1bf74397e7600c87b8fa13c756afff6e019
/COMP3-ExercícioPresencial/Exercício Presencial - Patrícia Wang/DO_SL_GATW/src/entidades/ComodoComposto.java
e67533b96a9763f3e4f39d2b742ed7a8d4e37d35
[]
no_license
patywang/git-ufrrj
ffceac0b687774cbcd5b9533c8b4612463679c99
155df82e2b99bc37d6d63cc155e36d07a940bafe
refs/heads/master
2021-01-11T20:45:28.729019
2017-01-17T02:50:34
2017-01-17T02:50:34
79,178,777
0
0
null
null
null
null
UTF-8
Java
false
false
1,179
java
package entidades; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import dao.ComodoDAO; import dao.MobiliaDAO; public class ComodoComposto extends Comodo{ private List<Comodo>comodos; public ComodoComposto(){super();}; public ComodoComposto(String desc, String tipo){ super(desc,tipo); } public List<Comodo> getComodos() { return comodos; } public void setComodos(List<Comodo> comodos) { this.comodos = comodos; } @Override public Map<Integer,String> listaMobiliaDisponivel() { return null; } public static List<Mobilia> listarMobilias(int id) throws SQLException{ MobiliaDAO dao = new MobiliaDAO(); ComodoDAO comodoDAO = new ComodoDAO(); List<Mobilia>mob = new ArrayList<Mobilia>(); try { List<Comodo>lista = comodoDAO.recuperarComodoComposto(id); if(lista != null && !lista.isEmpty()){ for (Comodo comodo2 : lista) { mob.addAll(listarMobilias(comodo2.getIdComodo())); System.out.println(comodo2.getIdComodo()); } } } catch (SQLException e) { e.printStackTrace(); } mob.addAll(dao.listarMobiliasPorComodo(id)); return mob; } }
[ "patriciadecastrowang@yahoo.com.br" ]
patriciadecastrowang@yahoo.com.br
7da3d88fcd28bf6d695ee35fbcff75b3e53de91c
54e010e7511081bd3564b56f9ec5570a9a05c33a
/src/main/java/leetcode/code600/Code521.java
f03523a1fcbdee7fea26011d79a3fc320b6c5579
[]
no_license
hanhauran/leetcode-java
f640c0a7f2623de283050676f5090e9dcad94f38
9099f2f011004152fc5a0a883e3644be6f415afa
refs/heads/master
2021-10-11T00:40:26.197821
2019-01-20T05:33:39
2019-01-20T05:33:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package leetcode.code600; /** * @author hr.han * @date 2018/12/5 20:34 */ public class Code521 { public int findLUSlength(String a, String b) { return a.length() == b.length() ? (a.equals(b) ? -1 : a.length()) : Math.max(a.length(), b.length()); } }
[ "1793302404@qq.com" ]
1793302404@qq.com
a4e289d12b2720594f71ba106da38e1e92658ff4
d1eab95f28e9ffea20df4281f77f179f82c4f88f
/src/main/java/ru/ablog/megad/configurator/Megad2561Model.java
40b7163760ff3caec9ee01a39877cf0a99591c94
[]
no_license
Pshatsillo/megaConfigurator
16fd80c1ea5f9f9b267f4bf16d96c331b5a7265b
f868cc123d77fe2b67f296784c3aaf7c8628006f
refs/heads/master
2023-04-18T20:49:36.699130
2023-04-04T19:29:46
2023-04-04T19:29:46
237,795,201
0
0
null
2023-04-04T19:29:47
2020-02-02T15:52:53
Java
UTF-8
Java
false
false
71
java
package ru.ablog.megad.configurator; public class Megad2561Model { }
[ "Pshatsillo@gmail.com" ]
Pshatsillo@gmail.com
be4fd70a74f7ecf9279a5c3437aff8f6064ab116
c19cb77e3958a194046d6f84ca97547cc3a223c3
/pkix/src/main/java/org/bouncycastle/pkcs/bc/BcPKCS12MacCalculatorBuilder.java
b9420793fcd15454e59cd5f83806605b83e36f51
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
bcgit/bc-java
1b6092bc5d2336ec26ebd6da6eeaea6600b4c70a
62b03c0f704ebd243fe5f2d701aef4edd77bba6e
refs/heads/main
2023-09-04T00:48:33.995258
2023-08-30T05:33:42
2023-08-30T05:33:42
10,416,648
1,984
1,021
MIT
2023-08-26T05:14:28
2013-06-01T02:38:42
Java
UTF-8
Java
false
false
1,823
java
package org.bouncycastle.pkcs.bc; import java.security.SecureRandom; import org.bouncycastle.asn1.DERNull; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PKCS12PBEParams; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.crypto.ExtendedDigest; import org.bouncycastle.crypto.digests.SHA1Digest; import org.bouncycastle.operator.MacCalculator; import org.bouncycastle.pkcs.PKCS12MacCalculatorBuilder; public class BcPKCS12MacCalculatorBuilder implements PKCS12MacCalculatorBuilder { private ExtendedDigest digest; private AlgorithmIdentifier algorithmIdentifier; private SecureRandom random; private int saltLength; private int iterationCount = 1024; public BcPKCS12MacCalculatorBuilder() { this(new SHA1Digest(), new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE)); } public BcPKCS12MacCalculatorBuilder(ExtendedDigest digest, AlgorithmIdentifier algorithmIdentifier) { this.digest = digest; this.algorithmIdentifier = algorithmIdentifier; this.saltLength = digest.getDigestSize(); } public BcPKCS12MacCalculatorBuilder setIterationCount(int iterationCount) { this.iterationCount = iterationCount; return this; } public AlgorithmIdentifier getDigestAlgorithmIdentifier() { return algorithmIdentifier; } public MacCalculator build(final char[] password) { if (random == null) { random = new SecureRandom(); } byte[] salt = new byte[saltLength]; random.nextBytes(salt); return PKCS12PBEUtils.createMacCalculator(algorithmIdentifier.getAlgorithm(), digest, new PKCS12PBEParams(salt, iterationCount), password); } }
[ "dgh@cryptoworkshop.com" ]
dgh@cryptoworkshop.com
0116a8a439b31d06365ecf9e8579b832ea13791e
afab90e214f8cb12360443e0877ab817183fa627
/bitcamp-java/src/main/java/com/eomcs/oop/ex12/Exam0140.java
f122c9f0ac805a1be40341a408536be81d4e3ea1
[]
no_license
oreoTaste/bitcamp-study
40a96ef548bce1f80b4daab0eb650513637b46f3
8f0af7cd3c5920841888c5e04f30603cbeb420a5
refs/heads/master
2020-09-23T14:47:32.489490
2020-05-26T09:05:40
2020-05-26T09:05:40
225,523,347
1
0
null
null
null
null
UTF-8
Java
false
false
427
java
// 람다(lambda) - 파라미터 package com.eomcs.oop.ex12; public class Exam0140 { static interface Player { void play(String name, int age); } public static void main(String[] args) { Player p1 = (String name, int age) -> System.out.println(name + "(" + age + ")"); p1.play("홍길동", 34); p1 = (name, age) -> System.out.println(name + "\"" + age + "\""); p1.play("홍길동", 34); } }
[ "youngkuk.sohn@gmail.com" ]
youngkuk.sohn@gmail.com
ae02303f48646bff1840b508976a079f1c855459
171ca73cd1e0ac38eb6fd610c8463735f2458682
/library-base/src/main/java/com/zhulong/library_base/mvvm/model/BaseModel.java
1dc5ff4464c2ac302ef5870a1052c83650befb66
[]
no_license
caolinxing/MvvmEmptyProject
24185f130f4255d291a97767cabe6022ea1893b9
dfae7bd558b645be9173f8be19bb9f228a097bda
refs/heads/master
2023-07-09T15:40:12.424487
2021-07-31T03:00:35
2021-07-31T03:00:35
380,462,840
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package com.zhulong.library_base.mvvm.model; /** * Created by goldze on 2017/6/15. */ public class BaseModel implements IModel { public BaseModel() { } @Override public void onCleared() { } }
[ "1533406071@qq.com" ]
1533406071@qq.com
5063468d7c2596dbfab17dfa75ebd4c559b40452
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/LANG-9b-1-14-Single_Objective_GGA-IntegrationSingleObjective-BasicBlockCoverage/org/apache/commons/lang3/time/FastDateParser_ESTest_scaffolding.java
1b3c895fefdce041082449dbea1a647a5758e299
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat May 16 11:40:00 UTC 2020 */ package org.apache.commons.lang3.time; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class FastDateParser_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com