blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
3120bb40764fba2c0a200ef0a510acdcc7bd7408
8d767f6de585abd7de3af4e6b4c15c8c7ee1c716
/app/src/main/java/com/example/budspaces/Samples/GroupsFixtures.java
cb514001a18fd4fcd079bba93e24b49e33b42544
[]
no_license
mohameddhouibi/Budspaces
480a0a3a1aa4c9bd5ccbc92fd25eda78bdc6cb62
4cc4d0628d8cd889445c3e894804abaa65f1a476
refs/heads/master
2022-12-04T13:13:28.077325
2020-08-27T12:03:22
2020-08-27T12:03:22
290,764,168
0
0
null
null
null
null
UTF-8
Java
false
false
1,833
java
package com.example.budspaces.Samples; import android.content.Context; import com.example.budspaces.Models.Event; import com.example.budspaces.Models.Group; import com.example.budspaces.R; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Random; public final class GroupsFixtures extends FixturesData { private GroupsFixtures() { throw new AssertionError(); } private static int millis = 1000; private static List<Event> events = new ArrayList<>(); private static ArrayList<Integer> eventNb = new ArrayList<Integer>() { { add(0); add(3); add(1); add(0); add(2); add(0); add(5); } }; private static ArrayList<String> interestsSampleList = new ArrayList<String>() { { add("Ski"); add("Snowboard"); add("Aventure"); add("Hiver"); add("Neige"); } }; public static ArrayList<Integer> getEventNb() { return eventNb; } public static Group getGroup(Context context) { Group group = new Group(); group.setName("Le ski est notre vie"); group.setInterests(interestsSampleList); group.setAddress("Mürren, Suisse"); group.setDescription(context.getString(R.string.post_tmp)); group.setPicture("https://media.lesechos.com/api/v1/images/view/5e4fb8353e4546766f258c04/1280x720/b49e0658da6147fc4f3e9d1a575bc946e9b54dbd.jpg"); return group; } public static Event getEvent() { Event event = new Event(); return event; } public static List<Event> getEvents() { if (events.size() <= 0) { Event a = new Event(); } return events; } }
785a5b8c3d6a99b988935d23c4710910697339a1
2fad9de50ef9bcc741e2a9c7a4d70e053cec7c46
/common/src/main/java/es/udc/fic/acs/infmsb01/atm/common/model/session/DataPipeline.java
c27f27b14c6c83b2cc9eeda1b4788793318f8df7
[ "Apache-2.0" ]
permissive
marcos-sb/distributed-banking-system
446f355339fd9d5f06eb37ab9f45afa5ef30badc
e5130c1ea82fc69a43b236bc6dcff41309b9f86e
refs/heads/master
2016-09-06T20:06:28.892919
2014-03-25T22:26:16
2014-03-25T22:26:16
11,578,786
1
3
null
null
null
null
UTF-8
Java
false
false
4,041
java
package es.udc.fic.acs.infmsb01.atm.common.model.session; import java.util.ArrayList; import es.udc.fic.acs.infmsb01.atm.common.model.agentinfo.RecipientInfo; import es.udc.fic.acs.infmsb01.atm.common.model.exception.BusyChannelException; import es.udc.fic.acs.infmsb01.atm.common.model.message.DataMessage; import es.udc.fic.acs.infmsb01.atm.common.model.message.DataRequestMessage; import es.udc.fic.acs.infmsb01.atm.common.model.message.DataResponseMessage; class DataPipeline { private ArrayList<Channel> channels; private byte numberOfChannels; private long sumDeposits; private long sumWithdrawals; private long sumTransfers; DataPipeline(byte numberOfChannels) { this.numberOfChannels = numberOfChannels; this.channels = new ArrayList<Channel>(numberOfChannels); for (int i = 0; i < numberOfChannels; i++) { Channel c = new Channel(); channels.add(c); } sumDeposits = 0; sumWithdrawals = 0; sumTransfers = 0; } ArrayList<DataMessage> getAllCurrentMessages() { ArrayList<DataMessage> drms = new ArrayList<DataMessage>(); for (Channel c : channels) { if (c.getCurrentRequestNumber() > 0) { drms.add(c.getCurrentRequestMessage()); } if (c.getCurrentResponseNumber() > 0) { drms.add(c.getCurrentResponseMessage()); } } return drms; } public ArrayList<DataRequestMessage> getAllCurrentRequests() { ArrayList<DataRequestMessage> drms = new ArrayList<DataRequestMessage>(); for (Channel c : channels) { if (c.getCurrentRequestNumber() > 0) { drms.add(c.getCurrentRequestMessage()); } } return drms; } DataRequestMessage getCurrentRequestMessage(byte channelNumber) { return channels.get(channelNumber-1).getCurrentRequestMessage(); } DataResponseMessage getCurrentResponseMessage(byte channelNumber) { return channels.get(channelNumber-1).getCurrentResponseMessage(); } boolean isDataPipelineOnline() { return numberOfChannels > 0; } void setNumberOfChannels(byte numberOfChannels) { int newChannels = numberOfChannels - this.numberOfChannels; int length = channels.size(); if (newChannels > 0) { for (int i = 0; i < newChannels; i++) { Channel c = new Channel(); channels.add(c); } } else { for (int i = 0; i > newChannels; i--) { channels.remove(length - 1 + i); } } this.numberOfChannels = (byte) newChannels; } long getSumDeposits() { return sumDeposits; } void setSumDeposits(long sumDeposits) { this.sumDeposits = sumDeposits; } long getSumWithdrawals() { return sumWithdrawals; } void setSumWithdrawals(long sumWithdrawals) { this.sumWithdrawals = sumWithdrawals; } long getSumTransfers() { return sumTransfers; } void setSumTransfers(long sumTransfers) { this.sumTransfers = sumTransfers; } byte getNumberOfChannels() { return numberOfChannels; } RecipientInfo getATM(byte channelNumber) { return channels.get(channelNumber-1).getATM(); } void setATM(byte channelNumber, RecipientInfo atm) { channels.get(channelNumber-1).setATM(atm); } short getCurrentRequest(byte channelNumber) { return channels.get(channelNumber-1).getCurrentRequestNumber(); } short getCurrentResponse(byte channelNumber) { return channels.get(channelNumber-1).getCurrentResponseNumber(); } boolean isAvailable(byte channelNumber) { return channels.get(channelNumber-1).isAvailable(); } void appendMessage(DataRequestMessage message) throws BusyChannelException { channels.get(message.getChannelNumber()-1).appendMessage(message); } boolean appendMessage(DataResponseMessage message) { synchronized (this) { boolean inserted = channels.get(message.getChannelNumber()-1).appendMessage(message); this.notify(); return inserted; } } byte getAvailableChannelNumber() { while (true) { synchronized (this) { byte i = 1; for (Channel c : channels) { if (c.isAvailable()) { return i; } i++; } try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }
ba7e8813533f06ead3559cf68c926aec2575c2fb
5bf95536563c45fc55097a2cbaed2bd78ef310f3
/src/test/java/net/jackofalltrades/taterbot/HelpCommandIntegerationTest.java
80b6497d2e2a9204fef9bb256dad55ecd03ed9a2
[ "Apache-2.0" ]
permissive
bradhandy/tater-bot
4e72f3d4ab977c4dd144b7c549c2c926e41dbfc7
6401f99971077fca0e43b1d4e60cbf89bc4be9a3
refs/heads/master
2020-03-27T11:17:55.852414
2019-01-28T13:57:04
2019-01-28T13:57:04
146,477,406
0
0
null
null
null
null
UTF-8
Java
false
false
5,508
java
package net.jackofalltrades.taterbot; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import com.fasterxml.jackson.core.JsonProcessingException; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.linecorp.bot.client.LineMessagingClient; import com.linecorp.bot.model.ReplyMessage; import com.linecorp.bot.model.event.MessageEvent; import com.linecorp.bot.model.event.message.TextMessageContent; import com.linecorp.bot.model.event.source.GroupSource; import com.linecorp.bot.model.event.source.UserSource; import com.linecorp.bot.model.message.TextMessage; import net.jackofalltrades.taterbot.command.annotation.ChannelCommand; import net.jackofalltrades.taterbot.command.annotation.UserCommand; import net.jackofalltrades.taterbot.util.LineCallback; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ApplicationContext; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import java.lang.annotation.Annotation; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.Map; @RunWith(SpringRunner.class) @SpringBootTest(classes = HelpCommandIntegerationTest.SpringBootConfiguration.class) @TestPropertySource(locations = "integration-test.properties") @AutoConfigureMockMvc public class HelpCommandIntegerationTest { @Autowired private ApplicationContext applicationContext; @Autowired private LineCallback lineCallback; @MockBean private LineMessagingClient lineMessagingClient; @Before @After public void resetLineMessagingClientInvocations() { // this is necessary since we're setting up the mock within the Spring Bean container. the invocations need // to be cleared clearInvocations(lineMessagingClient); } @Test public void helpCommandIsSupportedForGroupSource() throws JsonProcessingException { MessageEvent<TextMessageContent> textMessageEvent = new MessageEvent<>("replyToken", new GroupSource("groupId", "userId"), new TextMessageContent("id", "taterbot help"), LocalDateTime.now().toInstant(ZoneOffset.UTC)); lineCallback.submit(textMessageEvent); ArgumentCaptor<ReplyMessage> replyMessageCaptor = ArgumentCaptor.forClass(ReplyMessage.class); verify(lineMessagingClient, times(1)).replyMessage(replyMessageCaptor.capture()); ReplyMessage replyMessage = replyMessageCaptor.getValue(); assertEquals( "The reply token does not match.", "replyToken", replyMessage.getReplyToken()); assertEquals("There should only be a single message.", 1, replyMessage.getMessages().size()); assertTrue("The message should be a text message.", replyMessage.getMessages().get(0) instanceof TextMessage); TextMessage textMessage = (TextMessage) Iterables.getFirst(replyMessage.getMessages(), null); assertEquals("The help message does not match.", createExpectedMessage(ChannelCommand.class), textMessage.getText()); } @Test public void helpCommandIsSupportedForUserSource() throws JsonProcessingException { MessageEvent<TextMessageContent> textMessageEvent = new MessageEvent<>("replyToken", new UserSource("userId"), new TextMessageContent("id", "help"), LocalDateTime.now().toInstant(ZoneOffset.UTC)); lineCallback.submit(textMessageEvent); ArgumentCaptor<ReplyMessage> replyMessageCaptor = ArgumentCaptor.forClass(ReplyMessage.class); verify(lineMessagingClient, times(1)).replyMessage(replyMessageCaptor.capture()); ReplyMessage replyMessage = replyMessageCaptor.getValue(); assertEquals( "The reply token does not match.", "replyToken", replyMessage.getReplyToken()); assertEquals("There should only be a single message.", 1, replyMessage.getMessages().size()); assertTrue("The message should be a text message.", replyMessage.getMessages().get(0) instanceof TextMessage); TextMessage textMessage = (TextMessage) Iterables.getFirst(replyMessage.getMessages(), null); assertEquals("The help message does not match.", createExpectedMessage(UserCommand.class), textMessage.getText()); } private String createExpectedMessage(Class<? extends Annotation> annotation) { Map<String, Object> commandBeanMap = Maps.newTreeMap(); commandBeanMap.putAll(applicationContext.getBeansWithAnnotation(annotation)); StringBuilder helpOutput = new StringBuilder("Available Commands:\n"); for (String commandName : commandBeanMap.keySet()) { helpOutput.append(" - ") .append(commandName) .append('\n'); } return helpOutput.toString(); } @TaterBotCommandIntegrationTestConfiguration static class SpringBootConfiguration { } }
c1072abd558734b00deb067b9b8a49b0cebb3b32
18fe0339834f0dd966a2c4cd1b02eb9752c7566b
/ImageProcessing/src/com/neevtech/imageprocessing/constants/Neevimagick.java
877c57871fe25c22b796e77b716d435f8e18df14
[]
no_license
hiteshi/Android-samples
1a51b4ff29f969dc9104074b4b8376200ff8abfc
89f4226419090c91b8574a0cacd78bf214d30b9e
refs/heads/master
2020-05-17T01:03:00.107358
2015-04-08T05:35:06
2015-04-08T05:35:18
13,681,407
1
1
null
null
null
null
UTF-8
Java
false
false
2,076
java
<<<<<<< HEAD /** * */ package com.neevtech.imageprocessing.constants; /** * @author Ashish R Agre * */ public class Neevimagick { /* * String Constants */ public static final String SNOW = "Snow"; public static final String ENGRAVE = "Engrave"; public static final String GLOW = "Glow"; public static final String EMBOSS = "Emboss"; /* * Integer Constants */ public static final int SNOW_EFFECT = 1; public static final int ENGRAVE_EFFECT = 2; public static final int GLOW_EFFECT = 3; public static final int EMBOSS_EFFECT = 4; /* * Time seconds constants */ // 500ms public static final int SNOW_EFFECT_TIME = 500; public static final int FLIP_VERTICAL = 11; public static final int FLIP_HORIZONTAL = 22; /* * color constants */ public static final int COLOR_MAX = 0XFF; public static final int COLOR_MIN = 0x00; /* * facebook App Constants */ public static final String FACEBOOK_APP_ID = "521474017872130"; public static String FACEBOOK_ACCESS_TOKEN = ""; } ======= /** * */ package com.neevtech.imageprocessing.constants; /** * @author Ashish R Agre * */ public class Neevimagick { /* * String Constants */ public static final String SNOW = "Snow"; public static final String ENGRAVE = "Engrave"; public static final String GLOW = "Glow"; public static final String EMBOSS = "Emboss"; /* * Integer Constants */ public static final int SNOW_EFFECT = 1; public static final int ENGRAVE_EFFECT = 2; public static final int GLOW_EFFECT = 3; public static final int EMBOSS_EFFECT = 4; /* * Time seconds constants */ // 500ms public static final int SNOW_EFFECT_TIME = 500; public static final int FLIP_VERTICAL = 11; public static final int FLIP_HORIZONTAL = 22; /* * color constants */ public static final int COLOR_MAX = 0XFF; public static final int COLOR_MIN = 0x00; /* * facebook App Constants */ public static final String FACEBOOK_APP_ID = "521474017872130"; public static String FACEBOOK_ACCESS_TOKEN = ""; } >>>>>>> 89fda57b84f3f45b593875cb6cde08a56a510b8d
e83caa09e5e006c806d00f9bbe4bd6ff6faf553a
f06b58555bb1b403126f283fcaa5e492200a87bf
/app/src/main/java/com/zhongchuang/canting/net/BaseHttpUtil.java
a0c1868b7d9d494924ed453f9ef50e8fee1ab18b
[]
no_license
sengeiou/CantingGit
89ca8cefbc2509674010ec551e603522cd0ec7d0
1126c108b61921d23b03c4fd601fb1eb441f401e
refs/heads/master
2020-06-13T01:09:17.353739
2019-06-27T02:57:40
2019-06-27T02:57:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,199
java
package com.zhongchuang.canting.net; import android.content.Context; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.File; import java.security.SecureRandom; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.concurrent.TimeUnit; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import okhttp3.Cache; import okhttp3.OkHttpClient; /** * Created by Administrator on 2017/11/8. */ public class BaseHttpUtil { protected Context mContext; protected boolean isDebug; protected Gson initGson() { // Gson gson = new GsonBuilder() // .serializeNulls() //支持null字段输出 // .setLenient() // .create(); return new Gson(); } protected OkHttpClient initOkHttp() { try { File cacheFile = new File(mContext.getCacheDir().getAbsolutePath(), "cacheData"); long cacheSize = 1024 * 1024 * 10; Cache cache = new Cache(cacheFile, cacheSize); TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) { } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) { } @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[]{}; } }}; SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustAllCerts, new SecureRandom()); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); OkHttpClient.Builder builder = new OkHttpClient().newBuilder(); builder.readTimeout(20, TimeUnit.SECONDS) .connectTimeout(20, TimeUnit.SECONDS) .addInterceptor(new TokenInterceptor()) // .cache(cache) .sslSocketFactory(socketFactory) .hostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }); return builder.build(); } catch (Exception e) { throw new RuntimeException(e); } } private okhttp3.logging.HttpLoggingInterceptor getLogInterceptor() { okhttp3.logging.HttpLoggingInterceptor loggingInterceptor = new okhttp3.logging.HttpLoggingInterceptor(); if (isDebug) { loggingInterceptor.setLevel(okhttp3.logging.HttpLoggingInterceptor.Level.BODY); } else { loggingInterceptor.setLevel(okhttp3.logging.HttpLoggingInterceptor.Level.NONE); } return loggingInterceptor; } }
[ "admin" ]
admin
4e7e57d9777fa0ffe347cf26c17491cf696a2b24
10a7d1d80494d2ea7f4a3d62ad150c3ff952e8a7
/src/main/java/com/example/demo/DemoApplication.java
391a55c546c8b560a7a26b5b826c6553ec3ab167
[]
no_license
chinhcomhut/MD4-SpringBoot-Thymeleaf
21b75458e82afe39c1142dbffcabd44637b687a2
59fc37ddc1374c1ed1eaf606f759e288cd8584c5
refs/heads/master
2023-03-30T08:32:57.545913
2021-04-05T16:54:10
2021-04-05T16:54:10
354,905,504
0
0
null
null
null
null
UTF-8
Java
false
false
2,535
java
package com.example.demo; import com.example.demo.model.Person; import com.example.demo.model.PersonForm; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import java.util.ArrayList; import java.util.List; @SpringBootApplication //@EnableWebMvc @Controller public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } private static List<Person> persons = new ArrayList<>(); static { persons.add(new Person("Bill", "Gates")); persons.add(new Person("Steve", "Jobs")); } // Được tiêm vào (inject) từ application.properties. @Value("${welcome.message}") private String message; @Value("${error.message}") private String errorMessage; @RequestMapping(value = {"/index"}, method = RequestMethod.GET) public String index(Model model) { System.out.println("goi ham nay"); model.addAttribute("message", message); return "index"; } @RequestMapping(value = { "/personList" }, method = RequestMethod.GET) public String personList(Model model) { model.addAttribute("persons", persons); System.out.println("person"+persons); return "listPerson"; } @RequestMapping(value = { "/addPerson" }, method = RequestMethod.GET) public String showAddPersonPage(Model model) { PersonForm personForm = new PersonForm(); model.addAttribute("personForm", personForm); return "addPerson"; } @RequestMapping(value = { "/addPerson" }, method = RequestMethod.POST) public String savePerson(Model model, // @ModelAttribute("personForm") PersonForm personForm) { String firstName = personForm.getFirstName(); String lastName = personForm.getLastName(); if (firstName != null && firstName.length() > 0 // && lastName != null && lastName.length() > 0) { Person newPerson = new Person(firstName, lastName); persons.add(newPerson); return "redirect:/personList"; } model.addAttribute("errorMessage", errorMessage); return "addPerson"; } }
0d0c88adf3f18e6fb42b89b73e082dc2472a22ef
10786e33aeb68d77b2cf552e43f72b739ceab062
/src/com/atguigu/test/Hello.java
e4735dde8d3eab78cc8edeaefe10c7dbd14ed44b
[]
no_license
AndrewYin133/TestEgit
0b74632c3d3b0fe264734a47e8f0e071f414b454
75a54914517d04e0827a0f7602a69a8f05867a6e
refs/heads/master
2020-07-10T10:25:51.437302
2019-08-25T03:43:31
2019-08-25T03:43:31
204,241,031
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package com.atguigu.test; public class Hello { public static void main(String[] args) { System.out.println("Hello Egit"); System.out.println("我是新手请多多关照"); } }
b23140e7f4493941f7035977a0293fe568de1616
b936b9adf61ab670e8b8e2e87b2939e59a82ecbd
/app/src/main/java/com/hackumass/med/boltaction/Cricket.java
a9e72cb538dcea995d18e180907d19c086c0f538
[]
no_license
singh1aryan/Team-Player
138aa4d6ece763a4318ece4f5107ba93dc0ba80d
814dd260db4b42e9cf7ba39fc116489c854221da
refs/heads/master
2023-06-08T06:54:20.639010
2018-11-20T19:05:25
2018-11-20T19:05:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
114
java
package com.hackumass.med.boltaction; /** * Created by Aryan Singh on 11/10/2018. */ public class Cricket { }
5a7f5488a6be17bb26baf61f3a98857c172683b5
7cbb3f5b2b599fe9ac7e60c941b5451d48954feb
/Complementario1/Ejercicio1.java
a4c041e854b7fdc7b586a093807d0c68e234e91b
[]
no_license
ncicka/java-info-2021
4126a7e73c06e68f3503005f87f17be893b39cbc
0457a4c019160643dda349d9e5607213c2996960
refs/heads/main
2023-07-19T11:01:11.090566
2021-09-08T00:09:41
2021-09-08T00:09:41
369,820,796
1
0
null
null
null
null
UTF-8
Java
false
false
615
java
import java.util.Scanner; /* Solicitar por consola el nombre de Usuario y mostrar por pantalla Hola {Usuario} */ public class Ejercicio1 { public static void main(String[] args){ Scanner scan = new Scanner(System.in); try { String usuario = Libreria.leerConsola("Ingrese su nombre ", scan); if (usuario.isEmpty()){ System.out.println("No ingreso ningun valor"); }else { System.out.println("Hola "+usuario); } } catch (EntidadVacia e) { e.printStackTrace(); } } }
34e0f14d6abbfc04aa6774bdbef35213c5209eb2
d01dd4f3647b06c963ef7d0ddb55b8eeb36083f5
/src/DiagonalStar.java
3634225a65dabb1f804eca02eb90efa33f4f7bdd
[]
no_license
mrtrsv/CodingExercises
3d18746c7e932aa55b62c475b7c2e13a081ea060
1505aee2750e840e1e04176ed37fb258e3a24c98
refs/heads/master
2020-03-25T23:36:30.320736
2018-11-13T09:53:29
2018-11-13T09:53:29
144,278,871
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
public class DiagonalStar { public static void printSquareStar (int number ) { if (number < 5 ) { System.out.println("Invalid Value"); } else { for (int row = 1; row <= number; row++) { for(int column = 1; column <= number; column++) { if (row==1 || row ==number || column == 1 || column == number) { System.out.printf("*"); } else if (row == column) { System.out.printf("*"); } else if (column == ((number-row) + 1) ) { System.out.printf("*"); } else System.out.printf(" "); } System.out.println(); } } } }
2f68a577a7a66123312ffaf91ba4e5597e590713
6e82a577bec1de618a3f3fc70c7a50dcbd791041
/src/main/java/code/controller/RequestController.java
12f4b22e0568793ffbad08beec66194b18b6b5d3
[]
no_license
julioklauss/server
2b347b1f9fe7fb8e4cf60625d5aa629a1bac116b
dcad1ca937d0ba87575f455d0ff6912d7bf80630
refs/heads/master
2020-04-10T22:28:43.628293
2018-12-11T16:47:21
2018-12-11T16:47:21
161,325,689
0
0
null
null
null
null
UTF-8
Java
false
false
1,970
java
package code.controller; import code.exception.AppException; import code.model.Book; import code.model.Request; import code.model.User; import code.repository.BookRepository; import code.repository.RequestRepository; import code.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; import static code.model.Message.FailMsg; @RestController @RequestMapping("/api/request") public class RequestController { @Autowired private RequestRepository requestRepository; @Autowired private UserRepository userRepository; @Autowired private BookRepository bookRepository; @GetMapping("/list") // @PreAuthorize("hasRole('USER')") public List<Request> listRequest() { return requestRepository.findAll(); } @GetMapping("/create") // @PreAuthorize("hasRole('USER')") public Request createRequest(@RequestParam Long bookId, @RequestParam Long userId) { Request request = new Request(); Book book = bookRepository.findById(bookId) .orElseThrow(() -> new AppException(FailMsg.getMsg())); request.setBook(book); User user = userRepository.findById(userId) .orElseThrow(() -> new AppException(FailMsg.getMsg())); request.setUser(user); request.setStatus(false); return requestRepository.save(request); } @GetMapping("/check") public boolean checkRequest(@RequestParam Long bookId, @RequestParam Long userId) { List<Request> request = requestRepository.findFirstByUserIdAndBookId(userId, bookId); if (request.size() > 0) { return true; } return false; } @PostMapping("{id}/delete") public void deleteBook(@PathVariable Long id) { requestRepository.deleteById(id); } @GetMapping("/test") public char test() { return 'd'; } }
11fe50ce37a8a2583a64e451b5d2fce52d942cdd
23636f00e34919668352a1ef1160b0636924fd8b
/java-web/src/org/mvc/form/elements/Submit.java
756ee2da1eb1284f1651f81ab3d210fd30163219
[]
no_license
Baytars/xNova-Regenesis
917dd8f3c8e47e62b577c910e3d3a82b6e77192d
36fe5ecf725789349985396c5d3ba662789dea47
refs/heads/master
2022-12-04T07:02:52.393289
2009-11-01T00:33:26
2009-11-01T00:33:26
222,698,015
0
0
null
2022-11-24T01:54:29
2019-11-19T13:04:51
Java
UTF-8
Java
false
false
398
java
package org.mvc.form.elements; import org.mvc.form.Element; import org.mvc.form.renderers.InputRenderer; import org.mvc.form.renderers.Renderer; public class Submit extends Element { public Submit(String name) { super(); this.type = "submit"; this.name = name; } @Override public Renderer createRenderer() { return new InputRenderer(); } }
[ "nikelin@3563ec04-6e0e-4e4c-ae04-418762d187c5" ]
nikelin@3563ec04-6e0e-4e4c-ae04-418762d187c5
8b12ded9b5fc145d20a3c227b6787568d588926d
f9f61351f75ac43808171b49323a346fb672cb28
/MySql-1.16/MySql-1.16/cbs-ejb/src/java/com/cbs/entity/neftrtgs/EPSAckMessage.java
0ee10057b6001cec039a1a30a297445ac73dc64f
[]
no_license
Udit0079/Projects
9ab8bafdd2ac1d88b85b556127d7b24b692f09ca
16e780c6cabf7ea8b46341665aaab3024334e3ad
refs/heads/master
2022-12-27T11:59:04.018772
2021-02-23T09:18:52
2021-02-23T09:18:52
229,883,071
0
0
null
2022-12-15T23:24:01
2019-12-24T06:19:27
Java
UTF-8
Java
false
false
7,773
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.cbs.entity.neftrtgs; import com.cbs.entity.BaseEntity; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; /** * * @author root */ @Entity @Table(name = "eps_ackmessage") @NamedQueries({ @NamedQuery(name = "EPSAckMessage.findAll", query = "SELECT e FROM EPSAckMessage e"), @NamedQuery(name = "EPSAckMessage.findByBlockBeginIdentifier", query = "SELECT e FROM EPSAckMessage e WHERE e.blockBeginIdentifier = :blockBeginIdentifier"), @NamedQuery(name = "EPSAckMessage.findByBankAppIdentifier", query = "SELECT e FROM EPSAckMessage e WHERE e.bankAppIdentifier = :bankAppIdentifier"), @NamedQuery(name = "EPSAckMessage.findByMessageIdentifier", query = "SELECT e FROM EPSAckMessage e WHERE e.messageIdentifier = :messageIdentifier"), @NamedQuery(name = "EPSAckMessage.findByInputOutputIdentifier", query = "SELECT e FROM EPSAckMessage e WHERE e.inputOutputIdentifier = :inputOutputIdentifier"), @NamedQuery(name = "EPSAckMessage.findBySequenceNo", query = "SELECT e FROM EPSAckMessage e WHERE e.ePSAckMessagePK.sequenceNo = :sequenceNo"), @NamedQuery(name = "EPSAckMessage.findBySenderIFSC", query = "SELECT e FROM EPSAckMessage e WHERE e.senderIFSC = :senderIFSC"), @NamedQuery(name = "EPSAckMessage.findByDateTime", query = "SELECT e FROM EPSAckMessage e WHERE e.dateTime = :dateTime"), @NamedQuery(name = "EPSAckMessage.findByErrorCode", query = "SELECT e FROM EPSAckMessage e WHERE e.errorCode = :errorCode"), @NamedQuery(name = "EPSAckMessage.findByFiller", query = "SELECT e FROM EPSAckMessage e WHERE e.filler = :filler"), @NamedQuery(name = "EPSAckMessage.findByBlockEndIdentifier", query = "SELECT e FROM EPSAckMessage e WHERE e.blockEndIdentifier = :blockEndIdentifier"), @NamedQuery(name = "EPSAckMessage.findByInsertionTime", query = "SELECT e FROM EPSAckMessage e WHERE e.ePSAckMessagePK.insertionTime = :insertionTime")}) public class EPSAckMessage extends BaseEntity implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected EPSAckMessagePK ePSAckMessagePK; @Basic(optional = false) @Column(name = "BlockBeginIdentifier") private String blockBeginIdentifier; @Basic(optional = false) @Column(name = "BankAppIdentifier") private String bankAppIdentifier; @Basic(optional = false) @Column(name = "MessageIdentifier") private String messageIdentifier; @Basic(optional = false) @Column(name = "InputOutputIdentifier") private String inputOutputIdentifier; @Basic(optional = false) @Column(name = "SenderIFSC") private String senderIFSC; @Basic(optional = false) @Column(name = "DateTime") private String dateTime; @Column(name = "ErrorCode") private String errorCode; @Column(name = "Filler") private String filler; @Basic(optional = false) @Column(name = "BlockEndIdentifier") private String blockEndIdentifier; public EPSAckMessage() { } public EPSAckMessage(EPSAckMessagePK ePSAckMessagePK) { this.ePSAckMessagePK = ePSAckMessagePK; } public EPSAckMessage(EPSAckMessagePK ePSAckMessagePK, String blockBeginIdentifier, String bankAppIdentifier, String messageIdentifier, String inputOutputIdentifier, String senderIFSC, String dateTime, String blockEndIdentifier) { this.ePSAckMessagePK = ePSAckMessagePK; this.blockBeginIdentifier = blockBeginIdentifier; this.bankAppIdentifier = bankAppIdentifier; this.messageIdentifier = messageIdentifier; this.inputOutputIdentifier = inputOutputIdentifier; this.senderIFSC = senderIFSC; this.dateTime = dateTime; this.blockEndIdentifier = blockEndIdentifier; } /********************added by dinesh************************/ public EPSAckMessage(EPSAckMessagePK ePSAckMessagePK, String blockBeginIdentifier, String bankAppIdentifier, String messageIdentifier, String inputOutputIdentifier, String senderIFSC, String dateTime, String errorCode, String filler, String blockEndIdentifier) { this.ePSAckMessagePK = ePSAckMessagePK; this.blockBeginIdentifier = blockBeginIdentifier; this.bankAppIdentifier = bankAppIdentifier; this.messageIdentifier = messageIdentifier; this.inputOutputIdentifier = inputOutputIdentifier; this.senderIFSC = senderIFSC; this.dateTime = dateTime; this.errorCode = errorCode; this.filler = filler; this.blockEndIdentifier = blockEndIdentifier; } public EPSAckMessage(String sequenceNo, Date insertionTime) { this.ePSAckMessagePK = new EPSAckMessagePK(sequenceNo, insertionTime); } public EPSAckMessagePK getEPSAckMessagePK() { return ePSAckMessagePK; } public void setEPSAckMessagePK(EPSAckMessagePK ePSAckMessagePK) { this.ePSAckMessagePK = ePSAckMessagePK; } public String getBlockBeginIdentifier() { return blockBeginIdentifier; } public void setBlockBeginIdentifier(String blockBeginIdentifier) { this.blockBeginIdentifier = blockBeginIdentifier; } public String getBankAppIdentifier() { return bankAppIdentifier; } public void setBankAppIdentifier(String bankAppIdentifier) { this.bankAppIdentifier = bankAppIdentifier; } public String getMessageIdentifier() { return messageIdentifier; } public void setMessageIdentifier(String messageIdentifier) { this.messageIdentifier = messageIdentifier; } public String getInputOutputIdentifier() { return inputOutputIdentifier; } public void setInputOutputIdentifier(String inputOutputIdentifier) { this.inputOutputIdentifier = inputOutputIdentifier; } public String getSenderIFSC() { return senderIFSC; } public void setSenderIFSC(String senderIFSC) { this.senderIFSC = senderIFSC; } public String getDateTime() { return dateTime; } public void setDateTime(String dateTime) { this.dateTime = dateTime; } public String getErrorCode() { return errorCode; } public void setErrorCode(String errorCode) { this.errorCode = errorCode; } public String getFiller() { return filler; } public void setFiller(String filler) { this.filler = filler; } public String getBlockEndIdentifier() { return blockEndIdentifier; } public void setBlockEndIdentifier(String blockEndIdentifier) { this.blockEndIdentifier = blockEndIdentifier; } @Override public int hashCode() { int hash = 0; hash += (ePSAckMessagePK != null ? ePSAckMessagePK.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof EPSAckMessage)) { return false; } EPSAckMessage other = (EPSAckMessage) object; if ((this.ePSAckMessagePK == null && other.ePSAckMessagePK != null) || (this.ePSAckMessagePK != null && !this.ePSAckMessagePK.equals(other.ePSAckMessagePK))) { return false; } return true; } @Override public String toString() { return "entity.neftrtgs.EPSAckMessage[ePSAckMessagePK=" + ePSAckMessagePK + "]"; } }
328c8bf688aecce0622641eb5f0d63494a06302a
eecda18eb4bff4e49a7788002887b61a49f2995d
/src/main/java/com/situ/mall/listener/OnlineAdminListener.java
46d80d3dd0c67819a5e77f1d56fd518e1e29aa8d
[]
no_license
LLLLLLJch/mavenMall
3c977da7a3044cc54473e8ff60593c5af1f108b7
2016cb45afa375bdd78eeb1cea6a74b0f33f6464
refs/heads/master
2021-08-07T10:15:57.901263
2017-11-08T01:22:55
2017-11-08T01:22:55
108,786,299
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
package com.situ.mall.listener; import java.util.List; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import com.situ.mall.pojo.User; public class OnlineAdminListener implements HttpSessionListener{ @Override public void sessionCreated(HttpSessionEvent se) { } @Override public void sessionDestroyed(HttpSessionEvent se) { HttpSession session = se.getSession(); ServletContext servletContext = session.getServletContext(); List<User> onlineList = (List<User>) servletContext.getAttribute("onlineList"); User user = (User) session.getAttribute("user"); if (user != null) { onlineList.remove(user); } } }
1fa843eb31475f6de2f6b1dc53ed717781fe0b36
028cbe18b4e5c347f664c592cbc7f56729b74060
/v2/appserv-core/src/java/com/sun/enterprise/web/jsp/JspServlet.java
344f32b77fec0d5104128c66826a887d6b0597a7
[]
no_license
dmatej/Glassfish-SVN-Patched
8d355ff753b23a9a1bd9d7475fa4b2cfd3b40f9e
269e29ba90db6d9c38271f7acd2affcacf2416f1
refs/heads/master
2021-05-28T12:55:06.267463
2014-11-11T04:21:44
2014-11-11T04:21:44
23,610,469
1
0
null
null
null
null
UTF-8
Java
false
false
30,294
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can obtain * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt. * Sun designates this particular file as subject to the "Classpath" exception * as provided by Sun in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the License * Header, with the fields enclosed by brackets [] replaced by your own * identifying information: "Portions Copyrighted [year] * [name of copyright owner]" * * Contributor(s): * * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package com.sun.enterprise.web.jsp; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.SingleThreadModel; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.JspFactory; import java.util.Map; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.io.File; import java.io.PrintWriter; import java.io.IOException; import java.io.FileNotFoundException; import java.io.FilePermission; import java.lang.RuntimePermission; import java.net.URL; import java.net.URLClassLoader; import java.net.MalformedURLException; import java.security.AccessController; import java.security.CodeSource; import java.security.PermissionCollection; import java.security.Policy; import java.security.PrivilegedAction; import org.apache.jasper.JasperException; import org.apache.jasper.Constants; import org.apache.jasper.Options; import org.apache.jasper.EmbededServletOptions; import org.apache.jasper.JspCompilationContext; import org.apache.jasper.JspEngineContext; import org.apache.jasper.compiler.JspMangler; import org.apache.jasper.compiler.Compiler; import org.apache.jasper.runtime.JspFactoryImpl; import org.apache.jasper.servlet.JasperLoader; import org.apache.jasper.logging.Logger; import org.apache.jasper.logging.DefaultLogger; /** * This is an iPlanet adaptation of the Apache Jasper JSPServlet. * This servlet has several performance enhancements over the Apache * JspServlet. These include: * - Reducing the overall number of file stats per request * - Checking for JSP modifications based on a reload interval * - Caching compilation exceptions and recompiling the JSP only when * it is modified */ public class JspServlet extends HttpServlet { protected ServletContext context = null; protected Map jsps = null; protected ServletConfig config; protected Options options; protected URLClassLoader parentClassLoader; private PermissionCollection permissionCollection = null; private CodeSource codeSource = null; // Time in millisecs to check for changes in jsps to force recompilation private long reloadInterval = 0L; // if this flag is false, the JSPs are not checked for modifications // and are never recompiled private boolean checkJSPmods = true; // flag for whether debug messages need to be logged private boolean debugLogEnabled = false; // directory under which to generate the servlets String outputDir = null; // urls used by JasperLoader to load generated jsp class files URL[] loaderURLs = null; static boolean firstTime = true; public void init(ServletConfig config) throws ServletException { super.init(config); this.config = config; this.context = config.getServletContext(); Constants.jasperLog = new DefaultLogger(this.context); Constants.jasperLog.setName("JASPER_LOG"); Constants.jasperLog.setTimestamp("false"); Constants.jasperLog.setVerbosityLevel( config.getInitParameter("logVerbosityLevel")); debugLogEnabled = Constants.jasperLog.matchVerbosityLevel(Logger.DEBUG); // reload-interval (specified in seconds) is the interval at which // JSP files are checked for modifications. Values that have 'special' // significance are: // 0 : Check JSPs for modifications on every request // -1 : do not check for JSP modifications and disable recompilation String interval = config.getInitParameter("reload-interval"); if (interval != null) { try { this.reloadInterval = Integer.parseInt(interval) * 1000; if (this.reloadInterval < 0) { checkJSPmods = false; Constants.message("jsp.message.recompile.disabled", Logger.INFORMATION ); } else if (this.reloadInterval > 0) { Constants.message("jsp.message.reload.interval", new Object[] {interval}, Logger.INFORMATION ); } } catch (NumberFormatException nfe) { Constants.message("jsp.warning.interval.invalid", new Object[] {interval}, Logger.WARNING ); } } // In case of checking JSP for mods, use a HashMap instead of a // Hashtable since we anyway synchronize on all accesses to the jsp // wrappers for the sake of ref counting, so this avoids double // synchronization if (checkJSPmods) jsps = new HashMap(); else jsps = new Hashtable(); options = new EmbededServletOptions(config, context); outputDir = options.getScratchDir().toString(); // set the loader urls to the output dir since that is where the // java classes corresponding to the jsps can be found File f = new File(outputDir); // If the toplevel output directory does not exist, then // create it at this point before adding it to the classloader path // If the directory does not exist when adding to the classloader, // the classloader has problems loading the classes later if (f.exists() == false) { f.mkdirs(); } loaderURLs = new URL[1]; try { loaderURLs[0] = f.toURL(); } catch(MalformedURLException mfe) { throw new ServletException(mfe); } // Get the parent class loader. The servlet container is responsible // for providing a URLClassLoader for the web application context // the JspServlet is being used in. parentClassLoader = (URLClassLoader) Thread.currentThread().getContextClassLoader(); if (parentClassLoader == null) parentClassLoader = (URLClassLoader)this.getClass().getClassLoader(); String loaderString = "<none>"; if (parentClassLoader != null) loaderString = parentClassLoader.toString(); if (debugLogEnabled) Constants.message("jsp.message.parent_class_loader_is", new Object[] {loaderString}, Logger.DEBUG); // Setup the PermissionCollection for this web app context // based on the permissions configured for the root of the // web app context directory, then add a file read permission // for that directory. Policy policy = Policy.getPolicy(); if( policy != null ) { try { // Get the permissions for the web app context String contextDir = context.getRealPath("/"); if( contextDir == null ) contextDir = outputDir; URL url = new URL("file:" + contextDir); codeSource = new CodeSource(url,null); permissionCollection = policy.getPermissions(codeSource); // Create a file read permission for web app context directory if (contextDir.endsWith(File.separator)) contextDir = contextDir + "-"; else contextDir = contextDir + File.separator + "-"; permissionCollection.add( new FilePermission(contextDir,"read") ); // Allow the JSP to access org.apache.jasper.runtime.HttpJspBase permissionCollection.add( new RuntimePermission( "accessClassInPackage.org.apache.jasper.runtime") ); if (parentClassLoader instanceof URLClassLoader) { URL [] urls = parentClassLoader.getURLs(); String jarUrl = null; String jndiUrl = null; for (int i=0; i<urls.length; i++) { if (jndiUrl == null && urls[i].toString().startsWith("jndi:") ) { jndiUrl = urls[i].toString() + "-"; } if (jarUrl == null && urls[i].toString().startsWith("jar:jndi:") ) { jarUrl = urls[i].toString(); jarUrl = jarUrl.substring(0,jarUrl.length() - 2); jarUrl = jarUrl.substring(0,jarUrl.lastIndexOf('/')) + "/-"; } } if (jarUrl != null) { permissionCollection.add( new FilePermission(jarUrl,"read") ); permissionCollection.add( new FilePermission(jarUrl.substring(4),"read") ); } if (jndiUrl != null) permissionCollection.add( new FilePermission(jndiUrl,"read") ); } } catch(MalformedURLException mfe) {} } if (firstTime) { firstTime = false; if( System.getSecurityManager() != null ) { // Make sure classes needed at runtime by a JSP servlet // are already loaded by the class loader so that we // don't get a defineClassInPackage security exception. String apacheBase = "org.apache.jasper."; String iplanetBase = "com.sun.enterprise.web.jsp."; try { parentClassLoader.loadClass( apacheBase + "runtime.JspFactoryImpl$PrivilegedGetPageContext"); parentClassLoader.loadClass( apacheBase + "runtime.JspFactoryImpl$PrivilegedReleasePageContext"); parentClassLoader.loadClass( apacheBase + "runtime.JspRuntimeLibrary"); parentClassLoader.loadClass( apacheBase + "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper"); parentClassLoader.loadClass( apacheBase + "runtime.ServletResponseWrapperInclude"); this.getClass().getClassLoader().loadClass( iplanetBase + "JspServlet$JspServletWrapper"); } catch (ClassNotFoundException ex) { Constants.jasperLog.log( Constants.getString("jsp.message.preload.failure"), ex, Logger.WARNING); } } Constants.message("jsp.message.scratch.dir.is", new Object[] {outputDir}, Logger.INFORMATION ); Constants.message("jsp.message.dont.modify.servlets", Logger.INFORMATION); JspFactory.setDefaultFactory(new JspFactoryImpl()); } } public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String jspUri; String includeUri = (String) request.getAttribute(Constants.INC_SERVLET_PATH); if (includeUri == null) jspUri = request.getServletPath(); else jspUri = includeUri; String jspFile = (String) request.getAttribute(Constants.JSP_FILE); if (jspFile != null) jspUri = jspFile; if (debugLogEnabled) { Logger jasperLog = Constants.jasperLog; jasperLog.log("JspEngine --> "+jspUri); jasperLog.log(" ServletPath: "+request.getServletPath()); jasperLog.log(" PathInfo: "+request.getPathInfo()); jasperLog.log(" RealPath: "+context.getRealPath(jspUri)); jasperLog.log(" RequestURI: "+request.getRequestURI()); jasperLog.log(" QueryString: "+request.getQueryString()); } serviceJspFile(request, response, jspUri); } catch (RuntimeException e) { throw e; } catch (ServletException e) { throw e; } catch (IOException e) { throw e; } catch (Throwable e) { throw new ServletException(e); } } /** * This is the main service function which creates the wrapper, loads * the JSP if not loaded, checks for JSP modifications if specified, * recompiles the JSP if needed and finally calls the service function * on the wrapper. */ private void serviceJspFile(HttpServletRequest request, HttpServletResponse response, String jspUri) throws ServletException, IOException { JspServletWrapper wrapper = null; try { if (checkJSPmods) { // this increments the refcount wrapper = getWrapper(jspUri); if (wrapper == null) { // ensure that only one thread creates the wrapper synchronized (this) { wrapper = getWrapper(jspUri); if (wrapper == null) { // create a new wrapper and load the jsp inside it wrapper = new JspServletWrapper(jspUri); wrapper.loadJSP(request, response); // add the new wrapper to the map, this increments // the refcount as well putWrapper(jspUri, wrapper); } } } else if (wrapper.isJspFileModified()) { // create a new wrapper and load the jsp inside it JspServletWrapper newWrapper = new JspServletWrapper(jspUri); newWrapper.loadJSP(request, response); // add the new wrapper to the map, this increments the // refcount as well putWrapper(jspUri, newWrapper); // decrement the refcount on the old wrapper releaseWrapper(wrapper); wrapper = newWrapper; } } else { wrapper = (JspServletWrapper) jsps.get(jspUri); if (wrapper == null) { // ensure that only one thread creates the wrapper synchronized (this) { wrapper = (JspServletWrapper) jsps.get(jspUri); if (wrapper == null) { // create a new wrapper and load the jsp inside it wrapper = new JspServletWrapper(jspUri); wrapper.loadJSP(request, response); // add the new wrapper to the map jsps.put(jspUri, wrapper); } } } } // throw any compile exception generated during compilation JasperException compileException = wrapper.getCompileException(); if (compileException != null) throw compileException; // service the request if it is not a precompile request if (!preCompile(request)) wrapper.service(request, response); } catch (FileNotFoundException ex) { // remove the wrapper from the map. In the case where we are not // checking for JSP mods, the wrapper would never have been in // the map since the exception would be thrown in loadJSP if (checkJSPmods) removeWrapper(jspUri); String includeRequestUri = (String) request.getAttribute("javax.servlet.include.request_uri"); if (includeRequestUri != null) { // This file was included. Throw an exception as // a response.sendError() will be ignored by the // servlet engine. throw new ServletException(ex); } else { try { response.sendError(HttpServletResponse.SC_NOT_FOUND, ex.getMessage()); } catch (IllegalStateException ise) { Constants.jasperLog.log(Constants.getString ("jsp.error.file.not.found", new Object[] {ex.getMessage()}), ex, Logger.ERROR); } } } finally { // decrement the refcount even in case of an exception if (checkJSPmods) releaseWrapper(wrapper); } } /** * The following methods allow synchronized access to the jsps * map as well and perform refcounting on the wrappers as well. * These methods are called only when we check for JSP modifications */ private synchronized JspServletWrapper getWrapper(String jspUri) { JspServletWrapper wrapper = (JspServletWrapper) jsps.get(jspUri); if (wrapper != null) wrapper.incrementRefCount(); return wrapper; } private synchronized void releaseWrapper(JspServletWrapper wrapper) { if (wrapper != null) wrapper.decrementRefCount(); } private synchronized void putWrapper(String jspUri, JspServletWrapper wrapper) { wrapper.incrementRefCount(); JspServletWrapper replaced = (JspServletWrapper)jsps.put(jspUri, wrapper); // flag the wrapper that was replaced for destruction if (replaced != null) replaced.tryDestroy(); } private synchronized void removeWrapper(String jspUri) { JspServletWrapper removed = (JspServletWrapper)jsps.remove(jspUri); // flag the wrapper that was removed for destruction if (removed != null) removed.tryDestroy(); } /** * <p>Look for a <em>precompilation request</em> as described in * Section 8.4.2 of the JSP 1.2 Specification. <strong>WARNING</strong> * we cannot use <code>request.getParameter()</code> for this, because * that will trigger parsing all of the request parameters, and not give * a servlet the opportunity to call * <code>request.setCharacterEncoding()</code> first.</p> * * @param request The servlet requset we are processing * * @exception ServletException if an invalid parameter value for the * <code>jsp_precompile</code> parameter name is specified */ boolean preCompile(HttpServletRequest request) throws ServletException { String queryString = request.getQueryString(); if (queryString == null) return (false); int start = queryString.indexOf(Constants.PRECOMPILE); if (start < 0) return (false); queryString = queryString.substring(start + Constants.PRECOMPILE.length()); if (queryString.length() == 0) return (true); // ?jsp_precompile if (queryString.startsWith("&")) return (true); // ?jsp_precompile&foo=bar... if (!queryString.startsWith("=")) return (false); // part of some other name or value int limit = queryString.length(); int ampersand = queryString.indexOf("&"); if (ampersand > 0) limit = ampersand; String value = queryString.substring(1, limit); if (value.equals("true")) return (true); // ?jsp_precompile=true else if (value.equals("false")) return (true); // ?jsp_precompile=false else throw new ServletException("Cannot have request parameter " + Constants.PRECOMPILE + " set to " + value); } public void destroy() { if (Constants.jasperLog != null) Constants.jasperLog.log("JspServlet.destroy()", Logger.INFORMATION); // ensure that only one thread destroys the jsps synchronized (this) { Iterator iter = jsps.values().iterator(); while (iter.hasNext()) ((JspServletWrapper)iter.next()).destroy(); jsps.clear(); } } /** * This is an embedded class within the JspServlet. Each JSP uri is * associated with a separate wrapper class. */ class JspServletWrapper { String jspUri; File jspFile = null; boolean jspFileExists = true; String jspClassName = null; Class servletClass = null; Servlet theServlet = null; // used for reference counting int refCount = 0; boolean markedForDestroy = false; URLClassLoader loader = null; // A volatile on a long guarantees atomic read/write volatile long lastCheckedTime = 0L; volatile long jspLastModifiedTime = 0L; // cached compile exception JasperException compileException = null; JspServletWrapper(String jspUri) throws ServletException, FileNotFoundException { this.jspUri = jspUri; String jspFileName = context.getRealPath(jspUri); if (jspFileName == null) throw new FileNotFoundException(jspUri); jspFile = new File(jspFileName); jspFileExists = jspFile.exists(); if (checkJSPmods && !jspFileExists) throw new FileNotFoundException(jspUri); JspMangler mangler = new JspMangler(jspUri, outputDir); this.jspClassName = mangler.getPackageName() + "." + mangler.getClassName(); } public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (theServlet instanceof SingleThreadModel) { // sync on the wrapper so that the freshness // of the page is determined right before servicing synchronized (this) { theServlet.service(request, response); } } else { theServlet.service(request, response); } } /** * this function checks once every reload interval whether the * JSP file has been modified. Note that this function also sets * jspLastModifiedTime if the file has been modified and hence * is not idempotent. */ private boolean isJspFileModified() throws FileNotFoundException { boolean res = false; long currTime = System.currentTimeMillis(); if (currTime >= (reloadInterval + lastCheckedTime)) { long lastModTime = jspFile.lastModified(); // check if jsp file exists if (lastModTime == 0L) throw new FileNotFoundException(jspUri); // check if jsp file has been modified if (lastModTime != jspLastModifiedTime) { // ensure that only one thread sets the jspLastModifiedTime synchronized (this) { if (lastModTime != jspLastModifiedTime) { // set the last modification time so that the jsp // is not considered to be outdated anymore jspLastModifiedTime = lastModTime; res = true; } } } // update the time the jsp file was checked for being outdated lastCheckedTime = currTime; } return res; } /** * This function compiles the JSP if necessary and loads it. */ private void loadJSP(HttpServletRequest req, HttpServletResponse res) throws ServletException, FileNotFoundException { if (!checkJSPmods && !jspFileExists) { // Check if the JSP can be loaded in case it has been // precompiled try { loadAndInit(); } catch (JasperException ex) { Constants.jasperLog.log(ex.getMessage(), ex.getRootCause(), Logger.INFORMATION); throw new FileNotFoundException(jspUri); } return; } // First try context attribute; if that fails then use the // classpath init parameter. String classpath = (String) context.getAttribute(Constants.SERVLET_CLASSPATH); if (debugLogEnabled) Constants.message("jsp.message.context.classpath", new Object[] { classpath == null ? "<none>" : classpath }, Logger.DEBUG); JspCompilationContext ctxt = new JspEngineContext(parentClassLoader, classpath, context, jspUri, false, options, req, res); Compiler compiler = ctxt.createCompiler(); if (checkJSPmods) { // set the time that the jsp file has last been checked for // being outdated and the JSP last mod time lastCheckedTime = System.currentTimeMillis(); jspLastModifiedTime = jspFile.lastModified(); } // compile and load the JSP try { compiler.compile(); loadAndInit(); } catch (JasperException ex) { compileException = ex; } catch (FileNotFoundException ex) { compiler.removeGeneratedFiles(); throw ex; } catch (Exception ex) { compileException = new JasperException( Constants.getString("jsp.error.unable.compile"), ex); } } private void loadAndInit() throws JasperException, ServletException { try { loader = new JasperLoader(loaderURLs, jspClassName, parentClassLoader, permissionCollection, codeSource); servletClass = loader.loadClass(jspClassName); } catch (ClassNotFoundException cnfe) { throw new JasperException( Constants.getString("jsp.error.unable.load"), cnfe); } try { theServlet = (Servlet) servletClass.newInstance(); } catch (Exception ex) { throw new JasperException(ex); } theServlet.init(JspServlet.this.config); } // returns the cached compilation exception private JasperException getCompileException() { return compileException; } private void incrementRefCount() { refCount++; } private void decrementRefCount() { refCount--; if ((refCount == 0) && markedForDestroy) destroy(); } // try to destroy the JSP, the actual destroy occurs only when // the refcount goes down to 0 private void tryDestroy() { if (refCount == 0) destroy(); markedForDestroy = true; } private void destroy() { if (theServlet != null) theServlet.destroy(); servletClass = null; theServlet = null; jspFile = null; loader = null; } } }
[ "amyroh@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5" ]
amyroh@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5
db3a1b5041ba0c540e110cb223321d4777514478
f1b04480b0bb6114313cfee87ad075f71090cf22
/src/main/java/com/example/piepaas_api/dto/ProjectDto.java
a7cfd9d24f9ddb185c30d3ac0c5dd067ebb04a6d
[]
no_license
ahmedou-yahya/PaaS-api
3a65889221347c5a766a6eebd689f8417929fe08
84b7ca20515a1ecd0cec3963b20e94c888c226ae
refs/heads/main
2023-07-22T00:09:07.622921
2021-09-05T11:14:54
2021-09-05T11:14:54
403,287,736
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
package com.example.piepaas_api.dto; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.io.Serializable; @Data @AllArgsConstructor @NoArgsConstructor @Builder public class ProjectDto implements Serializable{ private String name; private String subdomain; private String namespace; private String dbName; private String dbUsername; private String dbPassword; private Long idClient; }
ebedeea2084166db23831f8647104bdb7d976afd
ca3219dd5158f0926372d71db658bba0d1b2619c
/ch04/src/ch04/Ch04Ex02_14.java
832227226e6e5ce25637eb3fa58f7fbb35cdfe27
[]
no_license
alsgur2102/work_java
ea5971e4d54ca6e8e0c6cec476a3bc8779b6b15a
7aef0ce126260fadccdebe168eb86856d1706ece
refs/heads/master
2020-03-18T03:51:59.218930
2018-07-24T11:33:24
2018-07-24T11:33:24
134,253,241
0
0
null
null
null
null
UHC
Java
false
false
999
java
package ch04; import java.util.Scanner; public class Ch04Ex02_14 { public static void main(String[] args) { // 1. 두개의 정수 입력받기 Scanner scanner = new Scanner(System.in); String[] numbers = scanner.nextLine().split(" "); int num01 = Integer.parseInt(numbers[0]); int num02 = Integer.parseInt(numbers[1]); // 2. 단순하게 코드를 두 부분으로 나누기 // 2. 1. 첫번째 수가 작고 두번째 수가 클 경우 if (num01 < num02) { // 3. 틀 작성 for (int i = 1; i <= 9; i++) { for (int j = num01; j <= num02; j++) { System.out.printf("%d * %d =%3d ", j, i, j * i); } System.out.println(); } } // 2.2. 첫번째 수가 크고 두번째 수가 작은 경우 else if (num01 > num02) { // 3. 틀 작성 for (int i = 1; i <= 9; i++) { for (int j = num01; j >= num02; j--) { System.out.printf("%d * %d =%3d ", j, i, j * i); } System.out.println(); } } } }
[ "KOITT@KOITT-PC" ]
KOITT@KOITT-PC
b8861558f0578a6a27fd162cea79bfe0a69c10e6
01c39fff2be0bbcba0654c63781dc8b8df22c825
/src/main/java/hl7/cda/schema/StrucDocTitleContent.java
b7b84d743711de166ac193b0348ca0eb7a754011
[]
no_license
sherlockq/ccda-xsd
1f47344beec59e34101e5b4d3985b2eedd28bb93
1625191d53ae1c9f90bc288c8255f79f805ea82e
refs/heads/master
2022-04-26T05:48:52.437101
2020-04-27T09:04:08
2020-04-27T09:04:08
257,550,544
1
1
null
2020-04-24T14:12:35
2020-04-21T09:50:56
Java
UTF-8
Java
false
false
6,180
java
package hl7.cda.schema; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>Java class for StrucDoc.TitleContent complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="StrucDoc.TitleContent"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;choice maxOccurs="unbounded" minOccurs="0"> * &lt;element name="content" type="{urn:hl7-org:v3}StrucDoc.TitleContent"/> * &lt;element name="sub" type="{urn:hl7-org:v3}StrucDoc.Sub"/> * &lt;element name="sup" type="{urn:hl7-org:v3}StrucDoc.Sup"/> * &lt;element name="br" type="{urn:hl7-org:v3}StrucDoc.Br"/> * &lt;element name="footnote" type="{urn:hl7-org:v3}StrucDoc.TitleFootnote"/> * &lt;element name="footnoteRef" type="{urn:hl7-org:v3}StrucDoc.FootnoteRef"/> * &lt;/choice> * &lt;attribute name="ID" type="{http://www.w3.org/2001/XMLSchema}ID" /> * &lt;attribute name="language" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" /> * &lt;attribute name="styleCode" type="{http://www.w3.org/2001/XMLSchema}NMTOKENS" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "StrucDoc.TitleContent", propOrder = { "content" }) public class StrucDocTitleContent { @XmlElementRefs({ @XmlElementRef(name = "sup", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false), @XmlElementRef(name = "br", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false), @XmlElementRef(name = "footnote", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false), @XmlElementRef(name = "footnoteRef", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false), @XmlElementRef(name = "sub", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false), @XmlElementRef(name = "content", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false) }) @XmlMixed protected List<Serializable> content; @XmlAttribute(name = "ID") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String id; @XmlAttribute(name = "language") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlSchemaType(name = "NMTOKEN") protected String language; @XmlAttribute(name = "styleCode") @XmlSchemaType(name = "NMTOKENS") protected List<String> styleCode; /** * Gets the value of the content property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the content property. * * <p> * For example, to add a new item, do as follows: * <pre> * getContent().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * {@link JAXBElement }{@code <}{@link StrucDocSup }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link JAXBElement }{@code <}{@link StrucDocTitleFootnote }{@code >} * {@link JAXBElement }{@code <}{@link StrucDocFootnoteRef }{@code >} * {@link JAXBElement }{@code <}{@link StrucDocSub }{@code >} * {@link JAXBElement }{@code <}{@link StrucDocTitleContent }{@code >} * * */ public List<Serializable> getContent() { if (content == null) { content = new ArrayList<Serializable>(); } return this.content; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getID() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setID(String value) { this.id = value; } /** * Gets the value of the language property. * * @return * possible object is * {@link String } * */ public String getLanguage() { return language; } /** * Sets the value of the language property. * * @param value * allowed object is * {@link String } * */ public void setLanguage(String value) { this.language = value; } /** * Gets the value of the styleCode property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the styleCode property. * * <p> * For example, to add a new item, do as follows: * <pre> * getStyleCode().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getStyleCode() { if (styleCode == null) { styleCode = new ArrayList<String>(); } return this.styleCode; } }
f3707a40cdba83af1f3d65e54acc5655620abc18
7cd135fcc8ce9488025930b0596655cb0004a412
/web/src/main/java/com/es/phoneshop/web/entity/InputQuantityUnit.java
23960df52582ef8191c9d0f6f357f25f9da93f37
[]
no_license
kalinama/phoneshop
547e3cffb72a95c117fc7355fbb6dd2bf0a9f946
057f6f1e2e4ee0c209d8ffeb2ed3ccb13fc3d61b
refs/heads/master
2023-03-31T11:47:02.016139
2021-04-10T18:14:24
2021-04-10T18:14:24
302,061,806
0
0
null
2020-12-14T15:13:27
2020-10-07T14:26:53
Java
UTF-8
Java
false
false
627
java
package com.es.phoneshop.web.entity; import java.util.Locale; public class InputQuantityUnit { private String quantity; private Locale locale; public InputQuantityUnit(String quantity, Locale locale) { this.quantity = quantity; this.locale = locale; } public InputQuantityUnit() { } public String getQuantity() { return quantity; } public void setQuantity(String quantity) { this.quantity = quantity; } public Locale getLocale() { return locale; } public void setLocale(Locale locale) { this.locale = locale; } }
93e09fbf6dfb2213d7c48c22d32768b027a1c42c
fa1c528067036f836fa864ab253eb16a97687f0b
/smartmirror_android/app/src/main/java/com/example/smartmirror/OAuth.java
7bd25b9bb8146b9f70cfae17d4f9b92cf3dedc0d
[]
no_license
nathaniel-johnston/SmartMirror
90bac980d86ab492cb1d7f061a69432e55c1630b
459d1942671e806e5a167cf682ee31be20e2dba1
refs/heads/main
2023-05-07T02:28:28.556592
2021-06-04T20:46:36
2021-06-04T20:46:36
323,218,634
0
0
null
null
null
null
UTF-8
Java
false
false
3,460
java
package com.example.smartmirror; import android.content.Context; import android.util.Base64; import android.util.Log; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import java.util.HashMap; import java.util.Map; public class OAuth { private static OAuth instance = null; public RequestQueue queue; public OAuth(Context context) { queue = Volley.newRequestQueue(context); } public static synchronized OAuth getInstance(Context context) { if (null == instance) instance = new OAuth(context); return instance; } //this is so you don't need to pass context each time public static synchronized OAuth getInstance() { if (null == instance) { throw new IllegalStateException(OAuth.class.getSimpleName() + " is not initialized, call getInstance(...) first"); } return instance; } public void getToken(String clientId, String clientSecret, String redirectUri, String grantType, String codeOrToken, final NetworkCallback<String> callback) { StringRequest request = new StringRequest(Request.Method.POST, "https://accounts.spotify.com/api/token", new Response.Listener<String>() { @Override public void onResponse(String response) { callback.onSuccess(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("OAuth", error.toString()); callback.onFailure(error.toString()); } }) { @Override public String getBodyContentType() { return "application/x-www-form-urlencoded; charset=UTF-8"; } @Override protected Map<String, String> getParams() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("grant_type", grantType); if(grantType.equals("authorization_code")){ params.put("code", codeOrToken); params.put("redirect_uri", redirectUri); } else { params.put("refresh_token", codeOrToken); } return params; } @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> headers = new HashMap<String, String>(); String auth = ""; try { byte[] bytes = (clientId + ":" + clientSecret).getBytes("UTF-8"); auth = "Basic " + Base64.encodeToString(bytes, Base64.NO_WRAP); } catch (Exception e) { Log.e("b64", "something went wrong"); } headers.put("Authorization", auth); return headers; } }; queue.add(request); } }
b9ebf9471838748b4c6ab7150f3f496699fb585f
49ffdcc00481e0ad6178d759336e0379cc0ffd8b
/src/main/java/com/ezendai/credit2/apply/dao/BankDao.java
df0438be8db2f7c51692843674848e2a09ae6566
[]
no_license
InverseOfControl/car
5ffaffc0d37ed0476bc58e89ae975ec369b908cf
351962fc6378612b2127b18c33088dbff39c2dd3
refs/heads/master
2020-03-09T23:05:51.599055
2018-04-12T02:38:54
2018-04-12T02:38:54
129,050,850
0
1
null
null
null
null
UTF-8
Java
false
false
407
java
/** * ZenDaiMoney.com Inc. * Copyright (c) 2014-2016 All Rights Reserved. */ package com.ezendai.credit2.apply.dao; import com.ezendai.credit2.apply.model.Bank; import com.ezendai.credit2.framework.dao.BaseDao; /** * <pre> * * </pre> * * @author xiaoxiong * @version $Id: BankDao.java, v 0.1 2014年6月24日 上午8:42:18 xiaoxiong Exp $ */ public interface BankDao extends BaseDao<Bank> { }
86a9b53eade28f3d9c4473b6c0288286ef264afd
ef38d70d9b0c20da068d967e089046e626b60dea
/apache-ant/AntBugResults/63/Between/remove authors c885f5683_diff.java
52953a90cbab794c5cc4c8b204376de41a804ecc
[]
no_license
martapanc/SATD-replication-package
0ea0e8a27582750d39f8742b3b9b2e81bb7ec25d
e3235d25235b3b46416239ee9764bfeccd2d7433
refs/heads/master
2021-07-18T14:28:24.543613
2020-07-10T09:04:40
2020-07-10T09:04:40
94,113,844
1
0
null
null
null
null
UTF-8
Java
false
false
37,839
java
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java b/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java index f011e2dc7..19d665136 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java @@ -1,1071 +1,1067 @@ /* * Copyright 2000-2002,2004 The Apache Software Foundation * * 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.apache.tools.ant.taskdefs.optional.scm; import com.starbase.starteam.Folder; import com.starbase.starteam.Item; import com.starbase.starteam.Property; import com.starbase.starteam.Server; import com.starbase.starteam.StarTeamFinder; import com.starbase.starteam.Type; import com.starbase.starteam.View; import com.starbase.util.Platform; import java.util.StringTokenizer; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; /** * Checks out files from a specific StarTeam server, project, view, and * folder. * <BR><BR> * This program logs in to a StarTeam server and opens up the specified * project and view. Then, it searches through that view for the given * folder (or, if you prefer, it uses the root folder). Beginning with * that folder and optionally continuing recursivesly, AntStarTeamCheckOut * compares each file with your include and exclude filters and checks it * out only if appropriate. * <BR><BR> * Checked out files go to a directory you specify under the subfolder * named for the default StarTeam path to the view. That is, if you * entered /home/cpovirk/work as the target folder, your project was named * "OurProject," the given view was named "TestView," and that view is * stored by default at "C:\projects\Test," your files would be checked * out to /home/cpovirk/work/Test." I avoided using the project name in * the path because you may want to keep several versions of the same * project on your computer, and I didn't want to use the view name, as * there may be many "Test" or "Version 1.0" views, for example. This * system's success, of course, depends on what you set the default path * to in StarTeam. * <BR><BR> * You can set AntStarTeamCheckOut to verbose or quiet mode. Also, it has * a safeguard against overwriting the files on your computer: If the * target directory you specify already exists, the program will throw a * BuildException. To override the exception, set <CODE>force</CODE> to * true. * <BR><BR> * <B>This program makes use of functions from the StarTeam API. As a result * AntStarTeamCheckOut is available only to licensed users of StarTeam and * requires the StarTeam SDK to function. You must have * <CODE>starteam-sdk.jar</CODE> in your classpath to run this program. * For more information about the StarTeam API and how to license it, see * the link below.</B> * - * @author <A HREF="mailto:[email protected]">Chris Povirk</A> - * @author <A HREF="mailto:[email protected]">JC Mann</A> - * @author <A HREF="mailto:[email protected]">Jeff Gettle</A> - * @author <A HREF="mailto:[email protected]">Steve Cohen</A> * @version 1.0 * @see <A HREF="http://www.starbase.com/">StarBase Web Site</A> * * @ant.task name="starteam" category="scm" ignore="true" */ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { /** * This constant sets the filter to include all files. This default has * the same result as <CODE>setIncludes("*")</CODE>. * * @see #getIncludes() * @see #setIncludes(String includes) */ public static final String DEFAULT_INCLUDESETTING = "*"; /** * This disables the exclude filter by default. In other words, no files * are excluded. This setting is equivalent to <CODE>setExcludes(null)</CODE> * . * * @see #getExcludes() * @see #setExcludes(String excludes) */ public static final String DEFAULT_EXCLUDESETTING = null; /** * The default folder to search; the root folder. Since * AntStarTeamCheckOut searches subfolders, by default it processes an * entire view. * * @see #getFolderName() * @see #setFolderName(String folderName) */ public static final String DEFAULT_FOLDERSETTING = null; /** * This is used when formatting the output. The directory name is * displayed only when it changes. */ private Folder prevFolder = null; /** This field keeps count of the number of files checked out. */ private int checkedOut = 0; // Change these through their GET and SET methods. /** The name of the server you wish to connect to. */ private String serverName = null; /** The port on the server used for StarTeam. */ private int serverPort = -1; /** The name of your project. */ private String projectName = null; /** * The name of the folder you want to check out files from. All subfolders * will be searched, as well. */ private String folderName = DEFAULT_FOLDERSETTING; /** The view that the files you want are in. */ private String viewName = null; /** Your username on the StarTeam server. */ private String username = null; /** Your StarTeam password. */ private String password = null; /** * The path to the root folder you want to check out to. This is a local * directory. */ private String targetFolder = null; /** * If force set to true, AntStarTeamCheckOut will overwrite files in the * target directory. */ private boolean force = false; /** * When verbose is true, the program will display all files and * directories as they are checked out. */ private boolean verbose = false; /** * Set recursion to false to check out files in only the given folder and * not in its subfolders. */ private boolean recursion = true; // These fields deal with includes and excludes /** All files that fit this pattern are checked out. */ private String includes = DEFAULT_INCLUDESETTING; /** All files fitting this pattern are ignored. */ private String excludes = DEFAULT_EXCLUDESETTING; /** The file delimitor on the user's system. */ private String delim = Platform.getFilePathDelim(); /** * whether to use the Starteam "default folder" when calculating the * target paths to which files are checked out (false) or if targetFolder * represents an absolute mapping to folderName. */ private boolean targetFolderAbsolute = false; /** convenient method to check for conditions */ private static void assertTrue(boolean value, String msg) throws BuildException { if (!value) { throw new BuildException(msg); } } protected void checkParameters() throws BuildException { // Check all of the properties that are required. assertTrue(getServerName() != null, "ServerName must be set."); assertTrue(getServerPort() != -1, "ServerPort must be set."); assertTrue(getProjectName() != null, "ProjectName must be set."); assertTrue(getViewName() != null, "ViewName must be set."); assertTrue(getUsername() != null, "Username must be set."); assertTrue(getPassword() != null, "Password must be set."); assertTrue(getTargetFolder() != null, "TargetFolder must be set."); // Because of the way I create the full target path, there // must be NO slash at the end of targetFolder and folderName // However, if the slash or backslash is the only character, leave it alone if ((getTargetFolder().endsWith("/") || getTargetFolder().endsWith("\\")) && getTargetFolder().length() > 1) { setTargetFolder(getTargetFolder().substring(0, getTargetFolder().length() - 1)); } // Check to see if the target directory exists. java.io.File dirExist = new java.io.File(getTargetFolder()); if (dirExist.isDirectory() && !getForce()) { throw new BuildException("Target directory exists. Set \"force\" " + "to \"true\" to continue anyway."); } } /** * Do the execution. * * @exception BuildException */ public void execute() throws BuildException { log("DEPRECATED - The starteam task is deprecated. Use stcheckout instead.", Project.MSG_WARN); // Connect to the StarTeam server, and log on. Server s = getServer(); try { // Search the items on this server. runServer(s); } finally { // Disconnect from the server. s.disconnect(); } // after you are all of the properties are ok, do your thing // with StarTeam. If there are any kind of exceptions then // send the message to the project log. // Tell how many files were checked out. log(checkedOut + " files checked out."); } /** * Creates and logs in to a StarTeam server. * * @return A StarTeam server. */ protected Server getServer() { // Simplest constructor, uses default encryption algorithm and compression level. Server s = new Server(getServerName(), getServerPort()); // Optional; logOn() connects if necessary. s.connect(); // Logon using specified user name and password. s.logOn(getUsername(), getPassword()); return s; } /** * Searches for the specified project on the server. * * @param s A StarTeam server. */ protected void runServer(Server s) { com.starbase.starteam.Project[] projects = s.getProjects(); for (int i = 0; i < projects.length; i++) { com.starbase.starteam.Project p = projects[i]; if (p.getName().equals(getProjectName())) { if (getVerbose()) { log("Found " + getProjectName() + delim); } runProject(s, p); break; } } } /** * Searches for the given view in the project. * * @param s A StarTeam server. * @param p A valid project on the given server. */ protected void runProject(Server s, com.starbase.starteam.Project p) { View[] views = p.getViews(); for (int i = 0; i < views.length; i++) { View v = views[i]; if (v.getName().equals(getViewName())) { if (getVerbose()) { log("Found " + getProjectName() + delim + getViewName() + delim); } runType(s, p, v, s.typeForName(s.getTypeNames().FILE)); break; } } } /** * Searches for folders in the given view. * * @param s A StarTeam server. * @param p A valid project on the server. * @param v A view name from the specified project. * @param t An item type which is currently always "file". */ protected void runType(Server s, com.starbase.starteam.Project p, View v, Type t) { // This is ugly; checking for the root folder. Folder f = v.getRootFolder(); if (getFolderName() != null) { if (getFolderName().equals("\\") || getFolderName().equals("/")) { setFolderName(null); } else { f = StarTeamFinder.findFolder(v.getRootFolder(), getFolderName()); assertTrue(null != f, "ERROR: " + getProjectName() + delim + getViewName() + delim + v.getRootFolder() + delim + getFolderName() + delim + " does not exist."); } } if (getVerbose() && getFolderName() != null) { log("Found " + getProjectName() + delim + getViewName() + delim + getFolderName() + delim + "\n"); } // For performance reasons, it is important to pre-fetch all the // properties we'll need for all the items we'll be searching. // We always display the ItemID (OBJECT_ID) and primary descriptor. int nProperties = 2; // We'll need this item type's primary descriptor. Property p1 = getPrimaryDescriptor(t); // Does this item type have a secondary descriptor? // If so, we'll need it. Property p2 = getSecondaryDescriptor(t); if (p2 != null) { nProperties++; } // Now, build an array of the property names. String[] strNames = new String[nProperties]; int iProperty = 0; strNames[iProperty++] = s.getPropertyNames().OBJECT_ID; strNames[iProperty++] = p1.getName(); if (p2 != null) { strNames[iProperty++] = p2.getName(); } // Pre-fetch the item properties and cache them. f.populateNow(t.getName(), strNames, -1); // Now, search for items in the selected folder. runFolder(s, p, v, t, f, calcTargetFolder(v, f)); // Free up the memory used by the cached items. f.discardItems(t.getName(), -1); } /** * Returns a file object that defines the root of the local checkout tree. * Depending on the value of targetFolderAbsolute, this will be either the * targetFolder exactly as set by the user or the path formed by appending * the default folder onto the specified target folder. * * @param v view from which the file is checked out, supplies the "default * folder" * @param rootSourceFolder root folder of the checkout operation in Star * Team * @return an object referencing the local file * @see #getTargetFolderAbsolute() */ private java.io.File calcTargetFolder(View v, Folder rootSourceFolder) { java.io.File root = new java.io.File(getTargetFolder()); if (!getTargetFolderAbsolute()) { // Create a variable dir that contains the name of // the StarTeam folder that is the root folder in this view. // Get the default path to the current view. String defaultPath = v.getDefaultPath(); // convert whatever separator char is in starteam to that of the target system. defaultPath = defaultPath.replace('/', java.io.File.separatorChar); defaultPath = defaultPath.replace('\\', java.io.File.separatorChar); java.io.File dir = new java.io.File(defaultPath); String dirName = dir.getName(); // If it ends with separator then strip it off if (dirName.endsWith(delim)) { dirName = dirName.substring(0, dirName.length() - 1); } // Replace the projectName in the file's absolute path to the viewName. // This makes the root target of a checkout operation equal to: // targetFolder + dirName StringTokenizer pathTokenizer = new StringTokenizer(rootSourceFolder.getFolderHierarchy(), delim); String currentToken = null; boolean foundRoot = false; while (pathTokenizer.hasMoreTokens()) { currentToken = pathTokenizer.nextToken(); if (currentToken.equals(getProjectName()) && !foundRoot) { currentToken = dirName; foundRoot = true; // only want to do this the first time } root = new java.io.File(root, currentToken); } } return root; } /** * Searches for files in the given folder. This method is recursive and * thus searches all subfolders. * * @param s A StarTeam server. * @param p A valid project on the server. * @param v A view name from the specified project. * @param t An item type which is currently always "file". * @param f The folder to search. * @param tgt Target folder on local machine */ protected void runFolder(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f, java.io.File tgt) { // Process all items in this folder. Item[] items = f.getItems(t.getName()); for (int i = 0; i < items.length; i++) { runItem(s, p, v, t, f, items[i], tgt); } // Process all subfolders recursively if recursion is on. if (getRecursion()) { Folder[] subfolders = f.getSubFolders(); for (int i = 0; i < subfolders.length; i++) { runFolder(s, p, v, t, subfolders[i], new java.io.File(tgt, subfolders[i].getName())); } } } /** * Check out one file if it matches the include filter but not the exclude * filter. * * @param s A StarTeam server. * @param p A valid project on the server. * @param v A view name from the specified project. * @param t An item type which is currently always "file". * @param f The folder the file is localed in. * @param item The file to check out. * @param tgt target folder on local machine */ protected void runItem(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f, Item item, java.io.File tgt) { // Get descriptors for this item type. Property p1 = getPrimaryDescriptor(t); Property p2 = getSecondaryDescriptor(t); String pName = (String) item.get(p1.getName()); if (!shouldCheckout(pName)) { return; } // VERBOSE MODE ONLY if (getVerbose()) { // Show folder only if changed. boolean bShowHeader = (f != prevFolder); if (bShowHeader) { // We want to display the folder the same way you would // enter it on the command line ... so we remove the // View name (which is also the name of the root folder, // and therefore shows up at the start of the path). String strFolder = f.getFolderHierarchy(); int i = strFolder.indexOf(delim); if (i >= 0) { strFolder = strFolder.substring(i + 1); } log(" Folder: \"" + strFolder + "\""); prevFolder = f; // If we displayed the project, view, item type, or folder, // then show the list of relevant item properties. StringBuffer header = new StringBuffer(" Item"); header.append(",\t").append(p1.getDisplayName()); if (p2 != null) { header.append(",\t").append(p2.getDisplayName()); } log(header.toString()); } // Finally, show the Item properties ... // Always show the ItemID. StringBuffer itemLine = new StringBuffer(" "); itemLine.append(item.getItemID()); // Show the primary descriptor. // There should always be one. itemLine.append(",\t").append(formatForDisplay(p1, item.get(p1.getName()))); // Show the secondary descriptor, if there is one. // Some item types have one, some don't. if (p2 != null) { itemLine.append(",\t").append(formatForDisplay(p2, item.get(p2.getName()))); } // Show if the file is locked. int locker = item.getLocker(); if (locker > -1) { itemLine.append(",\tLocked by ").append(locker); } else { itemLine.append(",\tNot locked"); } log(itemLine.toString()); } // END VERBOSE ONLY // Check it out; also ugly. // Change the item to be checked out to a StarTeam File. com.starbase.starteam.File remote = (com.starbase.starteam.File) item; // The local file name is simply the local target path (tgt) which has // been passed recursively down from the top of the tree, with the item's name appended. java.io.File local = new java.io.File(tgt, (String) item.get(p1.getName())); try { remote.checkoutTo(local, Item.LockType.UNCHANGED, false, true, true); checkedOut++; } catch (Exception e) { throw new BuildException("Failed to checkout '" + local + "'", e); } } /** * Look if the file should be checked out. Don't check it out if It fits * no include filters and It fits an exclude filter. * * @param pName the item name to look for being included. * @return whether the file should be checked out or not. */ protected boolean shouldCheckout(String pName) { boolean includeIt = matchPatterns(getIncludes(), pName); boolean excludeIt = matchPatterns(getExcludes(), pName); return (includeIt && !excludeIt); } /** * Convenient method to see if a string match a one pattern in given set * of space-separated patterns. * * @param patterns the space-separated list of patterns. * @param pName the name to look for matching. * @return whether the name match at least one pattern. */ protected boolean matchPatterns(String patterns, String pName) { if (patterns == null) { return false; } StringTokenizer exStr = new StringTokenizer(patterns, " "); while (exStr.hasMoreTokens()) { if (DirectoryScanner.match(exStr.nextToken(), pName)) { return true; } } return false; } /** * Get the primary descriptor of the given item type. Returns null if * there isn't one. In practice, all item types have a primary descriptor. * * @param t An item type. At this point it will always be "file". * @return The specified item's primary descriptor. */ protected Property getPrimaryDescriptor(Type t) { Property[] properties = t.getProperties(); for (int i = 0; i < properties.length; i++) { Property p = properties[i]; if (p.isPrimaryDescriptor()) { return p; } } return null; } /** * Get the secondary descriptor of the given item type. Returns null if * there isn't one. * * @param t An item type. At this point it will always be "file". * @return The specified item's secondary descriptor. There may not be one * for every file. */ protected Property getSecondaryDescriptor(Type t) { Property[] properties = t.getProperties(); for (int i = 0; i < properties.length; i++) { Property p = properties[i]; if (p.isDescriptor() && !p.isPrimaryDescriptor()) { return p; } } return null; } /** * Formats a property value for display to the user. * * @param p An item property to format. * @param value * @return A string containing the property, which is truncated to 35 * characters for display. */ protected String formatForDisplay(Property p, Object value) { if (p.getTypeCode() == Property.Types.TEXT) { String str = value.toString(); if (str.length() > 35) { str = str.substring(0, 32) + "..."; } return "\"" + str + "\""; } else { if (p.getTypeCode() == Property.Types.ENUMERATED) { return "\"" + p.getEnumDisplayName(((Integer) value).intValue()) + "\""; } else { return value.toString(); } } } // Begin SET and GET methods /** * Sets the <CODE>serverName</CODE> attribute to the given value. * * @param serverName The name of the server you wish to connect to. * @see #getServerName() */ public void setServerName(String serverName) { this.serverName = serverName; } /** * Gets the <CODE>serverName</CODE> attribute. * * @return The StarTeam server to log in to. * @see #setServerName(String serverName) */ public String getServerName() { return serverName; } /** * Sets the <CODE>serverPort</CODE> attribute to the given value. The * given value must be a valid integer, but it must be a string object. * * @param serverPort A string containing the port on the StarTeam server * to use. * @see #getServerPort() */ public void setServerPort(int serverPort) { this.serverPort = serverPort; } /** * Gets the <CODE>serverPort</CODE> attribute. * * @return A string containing the port on the StarTeam server to use. * @see #setServerPort(int) */ public int getServerPort() { return serverPort; } /** * Sets the <CODE>projectName</CODE> attribute to the given value. * * @param projectName The StarTeam project to search. * @see #getProjectName() */ public void setProjectName(String projectName) { this.projectName = projectName; } /** * Gets the <CODE>projectName</CODE> attribute. * * @return The StarTeam project to search. * @see #setProjectName(String projectName) */ public String getProjectName() { return projectName; } /** * Sets the <CODE>viewName</CODE> attribute to the given value. * * @param viewName The view to find the specified folder in. * @see #getViewName() */ public void setViewName(String viewName) { this.viewName = viewName; } /** * Gets the <CODE>viewName</CODE> attribute. * * @return The view to find the specified folder in. * @see #setViewName(String viewName) */ public String getViewName() { return viewName; } /** * Sets the <CODE>folderName</CODE> attribute to the given value. To * search the root folder, use a slash or backslash, or simply don't set a * folder at all. * * @param folderName The subfolder from which to check out files. * @see #getFolderName() */ public void setFolderName(String folderName) { this.folderName = folderName; } /** * Gets the <CODE>folderName</CODE> attribute. * * @return The subfolder from which to check out files. All subfolders * will be searched, as well. * @see #setFolderName(String folderName) */ public String getFolderName() { return folderName; } /** * Sets the <CODE>username</CODE> attribute to the given value. * * @param username Your username for the specified StarTeam server. * @see #getUsername() */ public void setUsername(String username) { this.username = username; } /** * Gets the <CODE>username</CODE> attribute. * * @return The username given by the user. * @see #setUsername(String username) */ public String getUsername() { return username; } /** * Sets the <CODE>password</CODE> attribute to the given value. * * @param password Your password for the specified StarTeam server. * @see #getPassword() */ public void setPassword(String password) { this.password = password; } /** * Gets the <CODE>password</CODE> attribute. * * @return The password given by the user. * @see #setPassword(String password) */ public String getPassword() { return password; } /** * Sets the <CODE>targetFolder</CODE> attribute to the given value. * * @param targetFolder The target path on the local machine to check out to. * @see #getTargetFolder() */ public void setTargetFolder(String targetFolder) { this.targetFolder = targetFolder; } /** * Gets the <CODE>targetFolder</CODE> attribute. * * @return The target path on the local machine to check out to. * @see #setTargetFolder(String targetFolder) */ public String getTargetFolder() { return targetFolder; } /** * Sets the <CODE>force</CODE> attribute to the given value. * * @param force if true, it overwrites files in the target directory. By * default it set to false as a safeguard. Note that if the target * directory does not exist, this setting has no effect. * @see #getForce() */ public void setForce(boolean force) { this.force = force; } /** * Gets the <CODE>force</CODE> attribute. * * @return whether to continue if the target directory exists. * @see #setForce(boolean) */ public boolean getForce() { return force; } /** * Turns recursion on or off. * * @param recursion if it is true, the default, subfolders are searched * recursively for files to check out. Otherwise, only files * specified by <CODE>folderName</CODE> are scanned. * @see #getRecursion() */ public void setRecursion(boolean recursion) { this.recursion = recursion; } /** * Gets the <CODE>recursion</CODE> attribute, which tells * AntStarTeamCheckOut whether to search subfolders when checking out * files. * * @return whether to search subfolders when checking out files. * @see #setRecursion(boolean) */ public boolean getRecursion() { return recursion; } /** * Sets the <CODE>verbose</CODE> attribute to the given value. * * @param verbose whether to display all files as it checks them out. By * default it is false, so the program only displays the total number * of files unless you override this default. * @see #getVerbose() */ public void setVerbose(boolean verbose) { this.verbose = verbose; } /** * Gets the <CODE>verbose</CODE> attribute. * * @return whether to display all files as it checks them out. * @see #setVerbose(boolean verbose) */ public boolean getVerbose() { return verbose; } // Begin filter getters and setters /** * Sets the include filter. When filtering files, AntStarTeamCheckOut uses * an unmodified version of <CODE>DirectoryScanner</CODE>'s <CODE>match</CODE> * method, so here are the patterns straight from the Ant source code: * <BR> * <BR> * Matches a string against a pattern. The pattern contains two special * characters: <BR> * '*' which means zero or more characters, <BR> * '?' which means one and only one character. <BR> * <BR> * Separate multiple inlcude filters by <I>spaces</I> , not commas as Ant * uses. For example, if you want to check out all .java and .class\ * files, you would put the following line in your program: * <CODE>setIncludes("*.java *.class");</CODE> * Finally, note that filters have no effect on the <B>directories</B> * that are scanned; you could not check out files from directories with * names beginning only with "build," for instance. Of course, you could * limit AntStarTeamCheckOut to a particular folder and its subfolders * with the <CODE>setFolderName(String folderName)</CODE> command. <BR> * <BR> * Treatment of overlapping inlcudes and excludes: To give a simplistic * example suppose that you set your include filter to "*.htm *.html" and * your exclude filter to "index.*". What happens to index.html? * AntStarTeamCheckOut will not check out index.html, as it matches an * exclude filter ("index.*"), even though it matches the include filter, * as well. <BR> * <BR> * Please also read the following sections before using filters: * * @param includes A string of filter patterns to include. Separate the * patterns by spaces. * @see #getIncludes() * @see #setExcludes(String excludes) * @see #getExcludes() */ public void setIncludes(String includes) { this.includes = includes; } /** * Gets the patterns from the include filter. Rather that duplicate the * details of AntStarTeanCheckOut's filtering here, refer to these links: * * @return A string of filter patterns separated by spaces. * @see #setIncludes(String includes) * @see #setExcludes(String excludes) * @see #getExcludes() */ public String getIncludes() { return includes; } /** * Sets the exclude filter. When filtering files, AntStarTeamCheckOut uses * an unmodified version of <CODE>DirectoryScanner</CODE>'s <CODE>match</CODE> * method, so here are the patterns straight from the Ant source code: * <BR> * <BR> * Matches a string against a pattern. The pattern contains two special * characters: <BR> * '*' which means zero or more characters, <BR> * '?' which means one and only one character. <BR> * <BR> * Separate multiple exlcude filters by <I>spaces</I> , not commas as Ant * uses. For example, if you want to check out all files except .XML and * .HTML files, you would put the following line in your program: * <CODE>setExcludes("*.XML *.HTML");</CODE> * Finally, note that filters have no effect on the <B>directories</B> * that are scanned; you could not skip over all files in directories * whose names begin with "project," for instance. <BR> * <BR> * Treatment of overlapping inlcudes and excludes: To give a simplistic * example suppose that you set your include filter to "*.htm *.html" and * your exclude filter to "index.*". What happens to index.html? * AntStarTeamCheckOut will not check out index.html, as it matches an * exclude filter ("index.*"), even though it matches the include filter, * as well. <BR> * <BR> * Please also read the following sections before using filters: * * @param excludes A string of filter patterns to exclude. Separate the * patterns by spaces. * @see #setIncludes(String includes) * @see #getIncludes() * @see #getExcludes() */ public void setExcludes(String excludes) { this.excludes = excludes; } /** * Gets the patterns from the exclude filter. Rather that duplicate the * details of AntStarTeanCheckOut's filtering here, refer to these links: * * @return A string of filter patterns separated by spaces. * @see #setExcludes(String excludes) * @see #setIncludes(String includes) * @see #getIncludes() */ public String getExcludes() { return excludes; } /** * returns whether the StarTeam default path is factored into calculated * target path locations (false) or whether targetFolder is an absolute * mapping to the root folder named by folderName * * @return returns true if absolute mapping is used, false if it is not * used. * @see #setTargetFolderAbsolute(boolean) */ public boolean getTargetFolderAbsolute() { return this.targetFolderAbsolute; } /** * sets the property that indicates whether or not the Star Team "default * folder" is to be used when calculation paths for items on the target * (false) or if targetFolder is an absolute mapping to the root folder * named by foldername. * * @param targetFolderAbsolute <tt>true</tt> if the absolute mapping is to
b7603cb315938e936ef3d1753e37840c187aeef2
ab12c857aec0ed2b35ca36399a596b080db6bd9d
/src/main/java/com/cjq/SpringBootDemo/repository/GirlRepository.java
6fe16ecd9ab56194656a2484aed79cee38b1548c
[]
no_license
ntcjq/SpringBootDemo
551b972b47ccb48443c0e078f6ad29f131df033e
872321992dd87d04d235fbdf4cbb04b36120b3d6
refs/heads/master
2022-09-02T14:50:07.053658
2022-08-12T02:41:56
2022-08-12T02:41:56
143,507,688
0
0
null
2022-08-12T02:42:25
2018-08-04T07:28:29
Java
UTF-8
Java
false
false
761
java
package com.cjq.SpringBootDemo.repository; import com.cjq.SpringBootDemo.domain.Girl; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import java.util.List; import java.util.Map; public interface GirlRepository extends JpaRepository<Girl,Integer> ,JpaSpecificationExecutor<Girl> { //自定义通过年龄查询 List<Girl> findByAge(Integer age); @Query("select count(id) from Girl where age = 18 ") Integer getGirlAmount(); /** * 返回的是List里装的Object[] * @return */ @Query("select cupSize , count(cupSize) from Girl group by cupSize") List getGroupBy(); }
bf787afd9a62e128cda2817cdaf7f15ffd238edf
4a45879f3faebefebb27fad5b61b398bf87217f9
/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java
e6d0b09819ffd2e8a1415dbb0ad6ac8a7624c150
[ "Apache-2.0" ]
permissive
zhaojigang/dubbo-notes
eda9f2ad21af5665f80382cca0af515d5c038b52
51816c8349a073c7801268898a5895f2124ce6ba
refs/heads/2.6.x
2022-09-23T02:31:48.859625
2019-08-15T06:46:39
2019-08-15T06:46:46
194,365,385
3
2
Apache-2.0
2022-09-15T03:37:28
2019-06-29T04:48:15
Java
UTF-8
Java
false
false
2,797
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.dubbo.config.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Service * * @export */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) @Inherited public @interface Service { Class<?> interfaceClass() default void.class; String interfaceName() default ""; String version() default ""; String group() default ""; String path() default ""; boolean export() default false; String token() default ""; boolean deprecated() default false; boolean dynamic() default false; String accesslog() default ""; int executes() default 0; boolean register() default true; int weight() default 0; String document() default ""; int delay() default 0; String local() default ""; String stub() default ""; String cluster() default ""; String proxy() default ""; int connections() default 0; int callbacks() default 0; String onconnect() default ""; String ondisconnect() default ""; String owner() default ""; String layer() default ""; int retries() default 0; String loadbalance() default ""; boolean async() default false; int actives() default 0; boolean sent() default false; String mock() default ""; String validation() default ""; int timeout() default 0; String cache() default ""; String[] filter() default {}; String[] listener() default {}; String[] parameters() default {}; String application() default ""; String module() default ""; String provider() default ""; String[] protocol() default {}; String monitor() default ""; String[] registry() default {}; String tag() default ""; Method[] methods() default {}; }
0a2a8ee7cb6493de1a36f73f16031cb95dc4b22e
9df1bceb4af220236ab189c3205ceba02ec8c02c
/app/src/main/java/com/app/qunadai/bean/BankcardBean.java
3d51de086aefa80f3f7824b1514da07a5a1aeb25
[ "Apache-2.0" ]
permissive
rooney0928/qnd2
405e79fc081237f630f983ab1b666d73f4d338b0
a916bb17b471159964151e1d7f1ce9ccd6460ab6
refs/heads/master
2021-01-20T07:15:14.552213
2017-11-02T10:16:04
2017-11-02T10:16:04
89,982,743
0
0
null
null
null
null
UTF-8
Java
false
false
4,044
java
package com.app.qunadai.bean; /** * Created by wayne on 2017/5/14. */ public class BankcardBean { /** * msg : 操作成功 * code : 000 * detail : 操作成功 * content : {"requirement":{"id":"6bebd0a4-a6e1-4cd0-bf31-4432147d554e","createdTime":1491975235958,"updatedTime":1491975235958,"user":null,"name":"彼得潘","bankCardNumber":"123123123123123","mobileNumber":"13162695559","idNumber":"310100000000000000"}} */ private String msg; private String code; private String detail; private ContentBean content; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public ContentBean getContent() { return content; } public void setContent(ContentBean content) { this.content = content; } public static class ContentBean { /** * requirement : {"id":"6bebd0a4-a6e1-4cd0-bf31-4432147d554e","createdTime":1491975235958,"updatedTime":1491975235958,"user":null,"name":"彼得潘","bankCardNumber":"123123123123123","mobileNumber":"13162695559","idNumber":"310100000000000000"} */ private RequirementBean requirement; public RequirementBean getRequirement() { return requirement; } public void setRequirement(RequirementBean requirement) { this.requirement = requirement; } public static class RequirementBean { /** * id : 6bebd0a4-a6e1-4cd0-bf31-4432147d554e * createdTime : 1491975235958 * updatedTime : 1491975235958 * user : null * name : 彼得潘 * bankCardNumber : 123123123123123 * mobileNumber : 13162695559 * idNumber : 310100000000000000 */ private String id; private long createdTime; private long updatedTime; private Object user; private String name; private String bankCardNumber; private String mobileNumber; private String idNumber; public String getId() { return id; } public void setId(String id) { this.id = id; } public long getCreatedTime() { return createdTime; } public void setCreatedTime(long createdTime) { this.createdTime = createdTime; } public long getUpdatedTime() { return updatedTime; } public void setUpdatedTime(long updatedTime) { this.updatedTime = updatedTime; } public Object getUser() { return user; } public void setUser(Object user) { this.user = user; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBankCardNumber() { return bankCardNumber; } public void setBankCardNumber(String bankCardNumber) { this.bankCardNumber = bankCardNumber; } public String getMobileNumber() { return mobileNumber; } public void setMobileNumber(String mobileNumber) { this.mobileNumber = mobileNumber; } public String getIdNumber() { return idNumber; } public void setIdNumber(String idNumber) { this.idNumber = idNumber; } } } }
[ "rooney0928@hotmail" ]
rooney0928@hotmail
26dd5672221ba670350f76f991920f71012b2ba5
1dc69106a38582cd8e96e3cf6c5c138d0b28b11e
/src/main/java/com/nelioalves/cursomc/dto/CidadeDTO.java
6bc72d43f68bc61ae0281443a6729bd07b88cff7
[]
no_license
danielgibeli/cursomc
5132273a28b765cb73fafa2f47faeb7bd14753fa
cb5893508f4e026bd5d955b02b1ab2125fcca873
refs/heads/master
2020-03-17T02:06:13.412269
2018-06-16T03:06:13
2018-06-16T03:06:13
133,178,263
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package com.nelioalves.cursomc.dto; import java.io.Serializable; import com.nelioalves.cursomc.domain.Cidade; public class CidadeDTO implements Serializable{ private static final long serialVersionUID = 1L; private Integer id; private String nome; public CidadeDTO() { } public CidadeDTO(Cidade obj) { id = obj.getId(); nome = obj.getNome(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
81370f7259415769f07e8162e860a76072907bf7
cda3816a44e212b52fdf1b9578e66a4543445cbb
/trunk/build/dist/server/data/scripts/npc/model/residences/clanhall/LidiaVonHellmannInstance.java
2e6a950fe807c05e28bf35b694ec717bf16369ef
[]
no_license
gryphonjp/L2J
556d8b1f24971782f98e1f65a2e1c2665a853cdb
003ec0ed837ec19ae7f7cf0e8377e262bf2d6fe4
refs/heads/master
2020-05-18T09:51:07.102390
2014-09-16T14:25:06
2014-09-16T14:25:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,353
java
package npc.model.residences.clanhall; import l2next.gameserver.model.AggroList; import l2next.gameserver.model.Creature; import l2next.gameserver.model.Playable; import l2next.gameserver.model.Player; import l2next.gameserver.model.entity.events.impl.ClanHallSiegeEvent; import l2next.gameserver.model.entity.events.impl.SiegeEvent; import l2next.gameserver.model.pledge.Clan; import l2next.gameserver.templates.npc.NpcTemplate; import npc.model.residences.SiegeGuardInstance; import java.util.HashMap; import java.util.Map; /** * @author VISTALL * @date 12:25/08.05.2011 */ public class LidiaVonHellmannInstance extends SiegeGuardInstance { /** * */ private static final long serialVersionUID = 880184515847917714L; public LidiaVonHellmannInstance(int objectId, NpcTemplate template) { super(objectId, template); } @Override public void onDeath(Creature killer) { SiegeEvent siegeEvent = getEvent(SiegeEvent.class); if(siegeEvent == null) { return; } siegeEvent.processStep(getMostDamagedClan()); super.onDeath(killer); } public Clan getMostDamagedClan() { ClanHallSiegeEvent siegeEvent = getEvent(ClanHallSiegeEvent.class); Player temp = null; Map<Player, Integer> damageMap = new HashMap<Player, Integer>(); for(AggroList.HateInfo info : getAggroList().getPlayableMap().values()) { Playable killer = (Playable) info.attacker; int damage = info.damage; if(killer.isPet() || killer.isSummon()) { temp = killer.getPlayer(); } else if(killer.isPlayer()) { temp = (Player) killer; } if(temp == null || siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, temp.getClan()) == null) { continue; } if(!damageMap.containsKey(temp)) { damageMap.put(temp, damage); } else { int dmg = damageMap.get(temp) + damage; damageMap.put(temp, dmg); } } int mostDamage = 0; Player player = null; for(Map.Entry<Player, Integer> entry : damageMap.entrySet()) { int damage = entry.getValue(); Player t = entry.getKey(); if(damage > mostDamage) { mostDamage = damage; player = t; } } return player == null ? null : player.getClan(); } @Override public boolean isEffectImmune() { return true; } }
[ "tuningxtreme@108c6750-40d5-47c8-815d-bc471747907c" ]
tuningxtreme@108c6750-40d5-47c8-815d-bc471747907c
824ea78c2f8261b289e152d8228fb16c22cb54ef
2a942e4a627d75ffc38a54999bdc63040ae88eef
/src/main/java/thanhto/katalon/katalon_notes/ui/tree/KatalonNotesTreeLabelProvider.java
1c178193690db0b103b3ceb4b19ead9cf430bb30
[ "Apache-2.0" ]
permissive
minhthanh3145/katalon-notes
f027ec1f55fa8d93b68e3021a4045f1dc859ff34
adb6f3c3bc545024cb2ab856e3ef77801883efa8
refs/heads/master
2021-06-21T17:32:46.493437
2019-08-04T09:37:59
2019-08-04T09:37:59
195,997,722
0
0
Apache-2.0
2021-03-31T21:26:41
2019-07-09T11:45:12
Java
UTF-8
Java
false
false
1,028
java
package thanhto.katalon.katalon_notes.ui.tree; import java.io.IOException; import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import thanhto.katalon.katalon_notes.constant.ImageConstants; import thanhto.katalon.katalon_notes.model.KatalonNote; import thanhto.katalon.katalon_notes.util.ImageUtil; public class KatalonNotesTreeLabelProvider extends CellLabelProvider { @Override public void update(ViewerCell cell) { String name = ""; if (cell.getElement() != null && cell.getElement() instanceof KatalonNote) { name = ((KatalonNote) cell.getElement()).getTitle(); } cell.setText(name); try { cell.setImage(getImage(ImageConstants.NOTE_SMALL_ICON)); } catch (IOException e) { } } public static Image getImage(String location) throws IOException { ImageData source = new ImageData(ImageUtil.class.getResourceAsStream(location)); return new Image(null, source); } }
db60fb029e57e428093e622820de269862b608f2
d14e83686026dd9db408a926073fc1120cb1d5f9
/app/src/main/java/com/example/dhiren/passkeymanager/Register.java
174af7d797995cef96b5e7a8bda1329139666479
[]
no_license
kunal0895/PasskeyManager
9a731817bc23fa75c17a27ed32d98ee03ee72f28
b8b13de5799d0749b32b4300f4f8bb8d17d08139
refs/heads/master
2021-01-12T15:42:06.532539
2017-01-15T05:56:03
2017-01-15T05:56:03
74,297,474
0
1
null
null
null
null
UTF-8
Java
false
false
1,968
java
package com.example.dhiren.passkeymanager; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Register extends AppCompatActivity { //Button register,login; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); Thread timerThread = new Thread() { public void run() { try { sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } finally { Intent intent = new Intent(Register.this, AfterSplash.class); startActivity(intent); } } }; timerThread.start(); /* register = (Button)findViewById(R.id.button); login = (Button)findViewById(R.id.button2); register.setOnClickListener(this); login.setOnClickListener(this); */ } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); finish(); } /* public void onClick(View v) { switch (v.getId()) { case R.id.button: Intent i = new Intent(Register.this,Login_Page.class); startActivity(i); break; case R.id.button2: Intent i1 = new Intent(Register.this,RegisterPage.class); startActivity(i1); break; } } public void onBackPressed() { Intent intent1 = new Intent(Intent.ACTION_MAIN); intent1.addCategory(Intent.CATEGORY_HOME); intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent1); } */ }
1194592cd5a2c075d9117fc2546f6973a1258d97
10de7a8b543cef2e7080edf978c9730ac12a226d
/org.strategoxt.imp.debug.stratego.test/test/java/org/strategoxt/debug/core/util/dctests/DebugCompileTransformer.java
7bb70533cdc8795d615882cb89867811da651eb0
[ "Apache-2.0" ]
permissive
metaborg/spoofax-debug
8229d1a5492ddb56d8c09cf4f2de9d4e3820be60
1e63866f84a38609f5232d78471039df6c065a0f
refs/heads/master
2021-01-22T03:39:40.250696
2016-03-14T10:43:17
2016-03-14T10:43:17
9,931,520
0
0
null
null
null
null
UTF-8
Java
false
false
11,776
java
package org.strategoxt.debug.core.util.dctests; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.StrategoFileManager; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.junit.Assert; import org.junit.Test; import org.strategoxt.debug.core.util.DebugCompiler; import org.strategoxt.debug.core.util.DebugSessionSettings; import org.strategoxt.debug.core.util.DebugSessionSettingsFactory; /* Stackoverflow Add command line options! -Xss8m -Xms256m -Xmx1024m -XX:MaxPermSize=256m -server gen-debug-var.str:213 to-string : value -> NoAnnoList(Str(value)) replace it with to-string-term : value -> NoAnnoList(Str(value)) Compile str to java... Exception: giving-up org.strategoxt.debug.core.util.DebugCompileException: Failed to compile stratego program to java. error: redefining external definition: to-string giving-up at org.strategoxt.debug.core.util.DebugCompiler.compileStratego(DebugCompiler.java:377) at org.strategoxt.debug.core.util.DebugCompiler.debugCompile(DebugCompiler.java:168) at org.strategoxt.debug.core.util.dctests.DebugCompileTransformer.testDebugCompileTransformer(DebugCompileTransformer.java:51) at org.strategoxt.debug.core.util.dctests.DebugCompileTransformer.main(DebugCompileTransformer.java:17) Caused by: org.strategoxt.lang.StrategoErrorExit: giving-up at org.strategoxt.lang.SRTS_EXT_fatal_err_0_2.invoke(SRTS_EXT_fatal_err_0_2.java:23) at org.strategoxt.lang.compat.override.java_integration.fatal_error_0_0_override.invoke(fatal_error_0_0_override.java:34) at org.strategoxt.stratego_lib.giving_up_0_0.invoke(giving_up_0_0.java:23) at org.strategoxt.strc.$Join$Defs$Ext_0_0.invoke($Join$Defs$Ext_0_0.java:81) at org.strategoxt.strc.lifted1852.invoke(lifted1852.java:42) at org.strategoxt.strc.m_transform_def_1_0.invoke(m_transform_def_1_0.java:54) at org.strategoxt.strc.lifted2876.invoke(lifted2876.java:31) at org.strategoxt.lang.SRTS_EXT_filter_1_0.filterIgnoreAnnos(SRTS_EXT_filter_1_0.java:83) at org.strategoxt.lang.SRTS_EXT_filter_1_0.invoke(SRTS_EXT_filter_1_0.java:34) at org.strategoxt.lang.compat.override.performance_tweaks.filter_1_0_override.invoke(filter_1_0_override.java:21) at org.strategoxt.strc.m_transform_local_defs_1_0.invoke(m_transform_local_defs_1_0.java:31) at org.strategoxt.strc.lifted1811.invoke(lifted1811.java:184) at org.strategoxt.strc.lifted2875.invoke(lifted2875.java:28) at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java:58) at org.strategoxt.strc.lifted2874.invoke(lifted2874.java:32) at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java:58) at org.strategoxt.strc.lifted2873.invoke(lifted2873.java:32) at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java:58) at org.strategoxt.strc.lifted2872.invoke(lifted2872.java:32) at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java:58) at org.strategoxt.strc.lifted2871.invoke(lifted2871.java:32) at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java:58) at org.strategoxt.strc.m_transform_no_overlays_1_0.invoke(m_transform_no_overlays_1_0.java:33) at org.strategoxt.strc.frontend_0_0.invoke(frontend_0_0.java:38) at org.strategoxt.strc.lifted836.invoke(lifted836.java:55) at org.strategoxt.strc.log_timed_1_2.invoke(log_timed_1_2.java:60) at org.strategoxt.strc.strc_front_end_0_0.invoke(strc_front_end_0_0.java:32) at org.strategoxt.strj.lifted591.invoke(lifted591.java:53) at org.strategoxt.strj.lifted6.invoke(lifted6.java:32) at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java:58) at org.strategoxt.strj.dr_scope_all_verbose_1_0.invoke(dr_scope_all_verbose_1_0.java:32) at org.strategoxt.strj.strj_0_0.invoke(strj_0_0.java:75) at org.strategoxt.strj.strj_or_die_0_0.invoke(strj_or_die_0_0.java:31) at org.strategoxt.stratego_xtc.lifted80.invoke(lifted80.java:35) at org.strategoxt.stratego_lib.restore_always_2_0.invoke(restore_always_2_0.java:28) at org.strategoxt.stratego_xtc.xtc_temp_files_1_0.invoke(xtc_temp_files_1_0.java:30) at org.strategoxt.stratego_xtc.xtc_input_1_0.invoke(xtc_input_1_0.java:24) at org.strategoxt.strj.lifted586.invoke(lifted586.java:24) at org.strategoxt.strc.log_timed_1_2.invoke(log_timed_1_2.java:60) at org.strategoxt.strj.main_strj_0_0.invoke(main_strj_0_0.java:37) at org.strategoxt.strj.main_0_0.invoke(main_0_0.java:25) at org.strategoxt.lang.Context.invokeStrategyCLI(Context.java:174) at org.strategoxt.strj.Main.mainNoExit(Main.java:2748) at org.strategoxt.debug.core.util.DebugCompiler.compileStratego(DebugCompiler.java:365) ... 3 more */ public class DebugCompileTransformer extends AbstractDebugCompileTest { public static void main(String[] args) { DebugCompileTransformer test = new DebugCompileTransformer(); long a1 = System.currentTimeMillis(); test.testDebugCompileTransformer(); long a2 = System.currentTimeMillis(); System.out.println("DBG:" + (a2 - a1)); //test.testRunCompileTransformer(); long a3 = System.currentTimeMillis(); System.out.println("RUN:" + (a3 - a2)); } @Test public void testDebugCompileTransformer() { String baseInputPath = "trans"; IPath strategoFilePath = new Path("stratego-transformer.str"); String transformerProject = "../org.strategoxt.imp.debug.stratego.transformer"; File f = new File(transformerProject); try { //System.out.println("INPUT: " + f.getCanonicalPath()); transformerProject = f.getCanonicalPath(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } IPath strategoSourceBasedir = new Path(transformerProject).append(baseInputPath); String projectName = "transformer_debug"; DebugCompiler debugCompiler = new DebugCompiler(); DebugSessionSettings debugSessionSettings = DebugSessionSettingsFactory.createTest(StrategoFileManager.WORKING_DIR, projectName); debugSessionSettings.setStrategoSourceBasedir(strategoSourceBasedir); debugSessionSettings.setStrategoFilePath(strategoFilePath); String[] compileTimeExtraArguments = new String[] { "-I", transformerProject , "-la", "strc" , "-la", "org.strategoxt.imp.debug.stratego.transformer.strategies" }; IPath[] javaCompileExtraClasspath = new IPath[] { new Path(transformerProject + "/" + "include/stratego-transformer-java.jar") }; debugSessionSettings.setCompileTimeExtraArguments(compileTimeExtraArguments); debugSessionSettings.setJavaCompileExtraClasspath(javaCompileExtraClasspath); // mkdir localvar/stratego in workingdir // mkdir localvar/java // mkdir localvar/class IPath binBase = null; boolean compileSucces = false; try { binBase = debugCompiler.debugCompile(debugSessionSettings); compileSucces = true; } catch (IOException e) { //e.printStackTrace(); Assert.fail(e.getMessage()); } catch(StackOverflowError e) { // change jvm arguments /* -Xss8m -Xms256m -Xmx1024m -XX:MaxPermSize=256m -server */ Assert.fail(e.getMessage()); } catch (Exception e) { //e.printStackTrace(); Assert.fail(e.getMessage()); } Assert.assertTrue("Debug compiling failed!", compileSucces); Assert.assertNotNull("Bin output directory should be set!", binBase); //checkOutput(debugSessionSettings); boolean runjava = false; // run .class if (runjava && compileSucces) { String input = StrategoFileManager.BASE + "/src/stratego/localvar/localvar.str"; // program that will be debug transformed String output = StrategoFileManager.WORKING_DIR + "/transformer_debug_output_localvar"; String argsForMainClass = "-i " + input + " --gen-dir " + output; String mainClass = "transformer_debug.transformer_debug"; String mainArgs = mainClass + " " + argsForMainClass; List<IPath> classpaths = new ArrayList<IPath>(); // TODO: add strategoxt, add runtime jars, add application classpath //String cp = debugSessionSettings.getRunClasspath(); if (debugSessionSettings.getJavaCompileExtraClasspath() != null) { for(IPath c : debugSessionSettings.getJavaCompileExtraClasspath()) { classpaths.add(c); } } System.out.println("ARGS: " + mainArgs); IPath tableDirectory = null; org.strategoxt.debug.core.util.Runner.run(mainArgs, classpaths, tableDirectory); } debugCompiler.getDebugCompileProgress().printStats(); } @Test public void testRunCompileTransformer() { String baseInputPath = "trans"; IPath strategoFilePath = new Path("stratego-transformer.str"); String transformerProject = "../org.strategoxt.imp.debug.stratego.transformer"; File f = new File(transformerProject); try { //System.out.println("INPUT: " + f.getCanonicalPath()); transformerProject = f.getCanonicalPath(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } IPath strategoSourceBasedir = new Path(transformerProject).append(baseInputPath); String projectName = "transformer_run"; DebugCompiler debugCompiler = new DebugCompiler(); DebugSessionSettings debugSessionSettings = DebugSessionSettingsFactory.createTest(StrategoFileManager.WORKING_DIR, projectName); debugSessionSettings.setStrategoSourceBasedir(strategoSourceBasedir); debugSessionSettings.setStrategoFilePath(strategoFilePath); String[] compileTimeExtraArguments = new String[] { "-I", transformerProject , "-la", "strc" , "-la", "org.strategoxt.imp.debug.stratego.transformer.strategies" }; IPath[] javaCompileExtraClasspath = new IPath[] { new Path(transformerProject + "/" + "include/stratego-transformer-java.jar") }; debugSessionSettings.setCompileTimeExtraArguments(compileTimeExtraArguments); debugSessionSettings.setJavaCompileExtraClasspath(javaCompileExtraClasspath); // mkdir localvar/stratego in workingdir // mkdir localvar/java // mkdir localvar/class IPath binBase = null; boolean compileSucces = false; try { binBase = debugCompiler.runCompile(debugSessionSettings); compileSucces = true; } catch (StackOverflowError e) { Assert.fail(e.getMessage()); } catch (IOException e) { //e.printStackTrace(); Assert.fail(e.getMessage()); } catch (Exception e) { //e.printStackTrace(); Assert.fail(e.getMessage()); } Assert.assertTrue("Debug compiling failed!", compileSucces); Assert.assertNotNull("Bin output directory should be set!", binBase); //checkOutput(debugSessionSettings); boolean runjava = false; // run .class if (runjava && compileSucces) { String input = StrategoFileManager.BASE + "/src/stratego/localvar/localvar.str"; // program that will be debug transformed String output = StrategoFileManager.WORKING_DIR + "/transformer_run_output_localvar"; String argsForMainClass = "-i " + input + " --gen-dir " + output; String mainClass = "transformer_run.transformer_run"; String mainArgs = mainClass + " " + argsForMainClass; List<IPath> classpaths = new ArrayList<IPath>(); // TODO: add strategoxt, add runtime jars, add application classpath //String cp = debugSessionSettings.getRunClasspath(); if (debugSessionSettings.getJavaCompileExtraClasspath() != null) { for(IPath c : debugSessionSettings.getJavaCompileExtraClasspath()) { classpaths.add(c); } } System.out.println("ARGS: " + mainArgs); IPath tableDirectory = debugSessionSettings.getTableDirectory(); org.strategoxt.debug.core.util.Runner.run(mainArgs, classpaths, tableDirectory); } debugCompiler.getDebugCompileProgress().printStats(); } }
c95247fb81cd36bf55f27d5d44282b9576116ab5
e4ca3cb3bbbb88e6980ef63d4eb29a3d59c0502d
/app/src/main/java/com/example/senthilkumar/moviesotg/Fragments/DetailFragment.java
9577912aad020b7c103de2792dea6c31e20587f8
[]
no_license
PavanVarma369/Movies-On-The-Go-Android-Application
456654a8e3b93d1a29123e5b23b7dc6e2fd66a37
8186d65ce55d4f179f73297da091e6545d8a92ee
refs/heads/master
2021-05-31T22:26:51.013583
2016-07-13T14:36:11
2016-07-13T14:36:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,733
java
package com.example.senthilkumar.moviesotg.Fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.SparseArray; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.android.volley.VolleyError; import com.android.volley.toolbox.ImageLoader; import com.example.senthilkumar.moviesotg.Activities.MainActivity; import com.example.senthilkumar.moviesotg.Classes.Movie; import com.example.senthilkumar.moviesotg.Classes.TVShow; import com.example.senthilkumar.moviesotg.R; import com.example.senthilkumar.moviesotg.Volley.VolleySingleton; /** * A simple {@link Fragment} subclass. */ public class DetailFragment extends Fragment { TextView name, year, genres, release_date, language, rating, voteCount, description; ImageView imageView_poster; VolleySingleton volleySingleton = VolleySingleton.getInstance(); ImageLoader imageLoader = volleySingleton.getImageLoader(); public DetailFragment() {} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.detail_fragment, container, false); name = (TextView) view.findViewById(R.id.title_detail); year = (TextView) view.findViewById(R.id.year_detail); genres = (TextView) view.findViewById(R.id.genre_detail); release_date = (TextView) view.findViewById(R.id.release_detail); language = (TextView) view.findViewById(R.id.lang_detail); rating = (TextView) view.findViewById(R.id.rating_detail); voteCount = (TextView) view.findViewById(R.id.voteCount_detail); description = (TextView) view.findViewById(R.id.description_details); imageView_poster = (ImageView) view.findViewById(R.id.imageView_details); if("Movie".equals(getArguments().getString(MainActivity.DETAIL_FRAGMENT_TYPE_KEY))) { PopulateMovieData((Movie) getArguments().getSerializable(MainActivity.DETAIL_FRAGMENT_KEY)); } else { PopulateTVShowData((TVShow) getArguments().getSerializable(MainActivity.DETAIL_FRAGMENT_KEY)); } return view; } public void PopulateMovieData(Movie movie) { if (movie != null) { name.setText(movie.getName()); String date = String.valueOf(movie.getRelease_date()); if(date.length() > 4) year.setText(date.substring(0, 4)); StringBuilder str = new StringBuilder(); int[] genres_ids = movie.getGenres(); for (int genre : genres_ids) { str.append(Movie.GENRES.get(genre)); str.append(" "); } genres.setText(str); release_date.setText(String.format("%s%s", getString(R.string.release_detail), movie.getRelease_date())); language.setText(R.string.language_detail); rating.setText(String.format("%s%s", String.valueOf(movie.getRating()), getString(R.string.ten_detail))); voteCount.setText(String.valueOf(movie.getVoteCount())); description.setText(movie.getDescription()); String urlThumbnail = MainActivity.URL_THUMBNAIL_DETAILS + movie.getURL_thumbnail(); if(movie.getURL_thumbnail() != null) { imageLoader.get(urlThumbnail, new ImageLoader.ImageListener() { @Override public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) { imageView_poster.setImageBitmap(response.getBitmap()); } @Override public void onErrorResponse(VolleyError error) { imageView_poster.setImageResource(R.mipmap.ic_launcher); } }); } } } public void PopulateTVShowData(TVShow tvShow) { if (tvShow != null) { name.setText(tvShow.getName()); String date = String.valueOf(tvShow.getAir_date()); if(date.length() > 4) year.setText(date.substring(0, 4)); StringBuilder str = new StringBuilder(); int[] genres_ids = tvShow.getGenres(); for (int genre : genres_ids) { str.append(Movie.GENRES.get(genre)); str.append(" "); } genres.setText(str); release_date.setText(String.format("%s%s", getString(R.string.release_detail), tvShow.getAir_date())); language.setText(R.string.language_detail); rating.setText(String.format("%s%s", String.valueOf(tvShow.getRating()), getString(R.string.ten_detail))); voteCount.setText(String.valueOf(tvShow.getVoteCount())); description.setText(tvShow.getDescription()); String urlThumbnail = MainActivity.URL_THUMBNAIL_DETAILS + tvShow.getURL_thumbnail(); if(tvShow.getURL_thumbnail() != null) { imageLoader.get(urlThumbnail, new ImageLoader.ImageListener() { @Override public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) { imageView_poster.setImageBitmap(response.getBitmap()); } @Override public void onErrorResponse(VolleyError error) { imageView_poster.setImageResource(R.mipmap.ic_launcher); } }); } } } }
364e40e904af182788d33586ce2a9df38b28d6fa
578f9da31c5b500ed78f5e9900100601db82014e
/app/src/test/java/com/example/datastore_sqlite/ExampleUnitTest.java
864345254ada3529110031d2ffa31d5c55352777
[]
no_license
kkoo121221/QR-Code_creator
45299513d3c5fcf8a1f2cd218baa8f8b620c1860
784322afd806e348a4100878605c038d478b3667
refs/heads/master
2022-11-19T23:45:29.742193
2020-07-03T10:53:18
2020-07-03T10:53:18
276,872,644
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.example.datastore_sqlite; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
823051b789c6beb0cc6d0b34eb14be850952b834
4d6204980dd5196371ffd0230262a56c8ff566cf
/src/com/study/oo/exercise/java8/exercise_java8/Ex2.java
dc2b069a8b5ec7ae931d9f31e37473b00beb6055
[]
no_license
danny12138/JavaExercise
a1890a5d66278229a44ac041110502bd269fbbc6
57c56ab1e392de1fdc5d8005494f48459d6b533b
refs/heads/master
2023-04-01T22:25:34.744322
2021-04-19T07:25:38
2021-04-19T07:25:38
359,358,196
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package com.study.oo.exercise.java8.exercise_java8; //练习二:函数式接口 // 1. 定义一个函数式接口IntCalc,其中抽象方法int calc(int a , int b),使用注解@FunctionalInterface // 2. 在测试类中定义static void getProduct(int a , int b ,IntCalc calc), 该方法的预期行为是使用calc得到a和b的乘积并打印结果 // 3. 测试getProduct(),通过lambda表达式完成需求 public class Ex2 { public static void main(String[] args) { IntCalc ca = (x,y) -> x*y; getProduct(5,6,ca); } static void getProduct(int a, int b, IntCalc calc){ System.out.println(calc.calc(a,b)); } } @FunctionalInterface interface IntCalc{ int calc(int a, int b); }
dd6cdc23eef0fe0bda4544e5858246328e676e79
b110345ce6740d1e12fd2383b1186f6bb36a5bf8
/src/main/java/com/douleha/www/controller/exception/NotFoundException.java
d93a6abd755ea9391770d52d8b650d09c218f21e
[]
no_license
febwindy/douleha
0e1d526aab44ffadf0ba96aba05f3717669ea73c
db408c7a69d625c99c1fd85db8cb71db68b0096d
refs/heads/master
2016-09-05T22:36:22.888189
2015-09-16T03:06:14
2015-09-16T03:06:14
40,591,978
0
0
null
null
null
null
UTF-8
Java
false
false
971
java
package com.douleha.www.controller.exception; import com.douleha.www.utils.type.api.ApiResponse; /** * Created by ivan_ on 2015/8/27. * [*]:用户发出的请求针对的是不存在的记录,服务器没有进行操作,该操作是幂等的。 httpStatus 404 */ public class NotFoundException extends RuntimeException { private ApiResponse apiResponse; public NotFoundException() { super(); } public NotFoundException(ApiResponse apiResponse) { this.apiResponse = apiResponse; } public NotFoundException(String message) { super(message); } public NotFoundException(String message, Throwable cause) { super(message, cause); } public NotFoundException(Throwable cause) { super(cause); } public ApiResponse getApiResponse() { return apiResponse; } public void setApiResponse(ApiResponse apiResponse) { this.apiResponse = apiResponse; } }
53dd494203e8edb0f7bb91f079c405a8bd731f80
4214e1373bb63f4aa5f8e06479776c5c3510a624
/src/main/java/com/navent/realestate/examples/Aviso.java
64ee0cb35271c74ed516179005a937a195b55a56
[]
no_license
mkfuri/apiSearchExamples
7c7fe63c44f82bbcd71e05fd22d80ecf6e8a6f31
f26e2ddaf9a7acf02bdff8fd61942a0fe5bcb6a7
refs/heads/master
2021-01-23T02:30:02.644148
2017-03-23T21:46:33
2017-03-23T21:46:33
86,000,633
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.navent.realestate.examples; import lombok.Getter; import lombok.Setter; import org.apache.solr.client.solrj.beans.Field; import org.springframework.data.solr.core.mapping.SolrDocument; /** * Created by mkfuri on 3/23/17. */ @Getter @Setter @SolrDocument(solrCoreName = "default_core") public class Aviso { @Field private Long idAviso; @Field private String titulo; }
1917cfa83ea733b192c5bffeb2149d8b9a7ac199
1c9aafbac0b4f0fa85d350254cae2a2b077212c8
/.svn/pristine/07/071b6cee73a911fd634e4fcc6ed3a7bd45affd67.svn-base
bf007ec06b1838f82137ca83c5a0858932f2047d
[ "MIT" ]
permissive
taopangtian/RuoYi4.0
110f3053e6e7d2fa2b4cb8f229b195847fa3cba3
a37edb10969766d6a0fd90462706c233b0035767
refs/heads/master
2022-09-08T00:55:47.239184
2019-12-10T08:44:34
2019-12-10T08:44:34
224,764,636
0
0
MIT
2022-09-01T23:17:29
2019-11-29T02:47:33
HTML
UTF-8
Java
false
false
10,432
package com.backstage.generator.service.impl; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.StringWriter; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.io.IOUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.backstage.common.constant.Constants; import com.backstage.common.constant.GenConstants; import com.backstage.common.core.text.Convert; import com.backstage.common.exception.BusinessException; import com.backstage.common.utils.StringUtils; import com.backstage.generator.domain.GenTable; import com.backstage.generator.domain.GenTableColumn; import com.backstage.generator.mapper.GenTableColumnMapper; import com.backstage.generator.mapper.GenTableMapper; import com.backstage.generator.service.IGenTableService; import com.backstage.generator.util.GenUtils; import com.backstage.generator.util.VelocityInitializer; import com.backstage.generator.util.VelocityUtils; /** * 业务 服务层实现 * * @author jack.lin */ @Service public class GenTableServiceImpl implements IGenTableService { private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class); @Autowired private GenTableMapper genTableMapper; @Autowired private GenTableColumnMapper genTableColumnMapper; /** * 查询业务信息 * * @param id 业务ID * @return 业务信息 */ @Override public GenTable selectGenTableById(Long id) { GenTable genTable = genTableMapper.selectGenTableById(id); setTableFromOptions(genTable); return genTable; } /** * 查询业务列表 * * @param genTable 业务信息 * @return 业务集合 */ @Override public List<GenTable> selectGenTableList(GenTable genTable) { return genTableMapper.selectGenTableList(genTable); } /** * 查询据库列表 * * @param genTable 业务信息 * @return 数据库表集合 */ public List<GenTable> selectDbTableList(GenTable genTable) { return genTableMapper.selectDbTableList(genTable); } /** * 查询据库列表 * * @param tableNames 表名称组 * @return 数据库表集合 */ public List<GenTable> selectDbTableListByNames(String[] tableNames) { return genTableMapper.selectDbTableListByNames(tableNames); } /** * 修改业务 * * @param genTable 业务信息 * @return 结果 */ @Override @Transactional public void updateGenTable(GenTable genTable) { String options = JSON.toJSONString(genTable.getParams()); genTable.setOptions(options); int row = genTableMapper.updateGenTable(genTable); if (row > 0) { for (GenTableColumn cenTableColumn : genTable.getColumns()) { genTableColumnMapper.updateGenTableColumn(cenTableColumn); } } } /** * 删除业务对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override @Transactional public void deleteGenTableByIds(String ids) { genTableMapper.deleteGenTableByIds(Convert.toLongArray(ids)); genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); } /** * 导入表结构 * * @param tableList 导入表列表 * @param operName 操作人员 */ @Override @Transactional public void importGenTable(List<GenTable> tableList, String operName) { for (GenTable table : tableList) { try { String tableName = table.getTableName(); GenUtils.initTable(table, operName); int row = genTableMapper.insertGenTable(table); if (row > 0) { // 保存列信息 List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); for (GenTableColumn column : genTableColumns) { GenUtils.initColumnField(column, table); genTableColumnMapper.insertGenTableColumn(column); } } } catch (Exception e) { log.error("表名 " + table.getTableName() + " 导入失败:", e); } } } /** * 预览代码 * * @param tableId 表编号 * @return 预览数据列表 */ public Map<String, String> previewCode(Long tableId) { Map<String, String> dataMap = new LinkedHashMap<>(); // 查询表信息 GenTable table = genTableMapper.selectGenTableById(tableId); // 查询列信息 List<GenTableColumn> columns = table.getColumns(); setPkColumn(table, columns); VelocityInitializer.initVelocity(); VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory()); for (String template : templates) { // 渲染模板 StringWriter sw = new StringWriter(); Template tpl = Velocity.getTemplate(template, Constants.UTF8); tpl.merge(context, sw); dataMap.put(template, sw.toString()); } return dataMap; } /** * 生成代码 * * @param tableName 表名称 * @return 数据 */ @Override public byte[] generatorCode(String tableName) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(outputStream); generatorCode(tableName, zip); IOUtils.closeQuietly(zip); return outputStream.toByteArray(); } /** * 批量生成代码 * * @param tableNames 表数组 * @return 数据 */ @Override public byte[] generatorCode(String[] tableNames) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(outputStream); for (String tableName : tableNames) { generatorCode(tableName, zip); } IOUtils.closeQuietly(zip); return outputStream.toByteArray(); } /** * 查询表信息并生成代码 */ private void generatorCode(String tableName, ZipOutputStream zip) { // 查询表信息 GenTable table = genTableMapper.selectGenTableByName(tableName); // 查询列信息 List<GenTableColumn> columns = table.getColumns(); setPkColumn(table, columns); VelocityInitializer.initVelocity(); VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory()); for (String template : templates) { // 渲染模板 StringWriter sw = new StringWriter(); Template tpl = Velocity.getTemplate(template, Constants.UTF8); tpl.merge(context, sw); try { // 添加到zip zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); IOUtils.write(sw.toString(), zip, Constants.UTF8); IOUtils.closeQuietly(sw); zip.closeEntry(); } catch (IOException e) { log.error("渲染模板失败,表名:" + table.getTableName(), e); } } } /** * 修改保存参数校验 * * @param genTable 业务信息 */ public void validateEdit(GenTable genTable) { if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { String options = JSON.toJSONString(genTable.getParams()); JSONObject paramsObj = JSONObject.parseObject(options); if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) { throw new BusinessException("树编码字段不能为空"); } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) { throw new BusinessException("树父编码字段不能为空"); } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) { throw new BusinessException("树名称字段不能为空"); } } } /** * 设置主键列信息 * * @param genTable 业务表信息 * @param columns 业务字段列表 */ public void setPkColumn(GenTable table, List<GenTableColumn> columns) { for (GenTableColumn column : columns) { if (column.isPk()) { table.setPkColumn(column); break; } } if (StringUtils.isNull(table.getPkColumn())) { table.setPkColumn(columns.get(0)); } } /** * 设置代码生成其他选项值 * * @param genTable 设置后的生成对象 */ public void setTableFromOptions(GenTable genTable) { JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions()); if (StringUtils.isNotNull(paramsObj)) { String treeCode = paramsObj.getString(GenConstants.TREE_CODE); String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE); String treeName = paramsObj.getString(GenConstants.TREE_NAME); genTable.setTreeCode(treeCode); genTable.setTreeParentCode(treeParentCode); genTable.setTreeName(treeName); } } }
4151a78a4aa0bd6e2f247e90c481ba863d685f53
9410ef0fbb317ace552b6f0a91e0b847a9a841da
/src/main/java/com/tencentcloudapi/mariadb/v20170312/models/CloneAccountRequest.java
9a9da6fef673a8b970f12a7cc1cb0b4cf8630e7c
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-java-intl-en
274de822748bdb9b4077e3b796413834b05f1713
6ca868a8de6803a6c9f51af7293d5e6dad575db6
refs/heads/master
2023-09-04T05:18:35.048202
2023-09-01T04:04:14
2023-09-01T04:04:14
230,567,388
7
4
Apache-2.0
2022-05-25T06:54:45
2019-12-28T06:13:51
Java
UTF-8
Java
false
false
5,154
java
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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.tencentcloudapi.mariadb.v20170312.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class CloneAccountRequest extends AbstractModel{ /** * Instance ID */ @SerializedName("InstanceId") @Expose private String InstanceId; /** * Source user account name */ @SerializedName("SrcUser") @Expose private String SrcUser; /** * Source user host */ @SerializedName("SrcHost") @Expose private String SrcHost; /** * Target user account name */ @SerializedName("DstUser") @Expose private String DstUser; /** * Target user host */ @SerializedName("DstHost") @Expose private String DstHost; /** * Target account description */ @SerializedName("DstDesc") @Expose private String DstDesc; /** * Get Instance ID * @return InstanceId Instance ID */ public String getInstanceId() { return this.InstanceId; } /** * Set Instance ID * @param InstanceId Instance ID */ public void setInstanceId(String InstanceId) { this.InstanceId = InstanceId; } /** * Get Source user account name * @return SrcUser Source user account name */ public String getSrcUser() { return this.SrcUser; } /** * Set Source user account name * @param SrcUser Source user account name */ public void setSrcUser(String SrcUser) { this.SrcUser = SrcUser; } /** * Get Source user host * @return SrcHost Source user host */ public String getSrcHost() { return this.SrcHost; } /** * Set Source user host * @param SrcHost Source user host */ public void setSrcHost(String SrcHost) { this.SrcHost = SrcHost; } /** * Get Target user account name * @return DstUser Target user account name */ public String getDstUser() { return this.DstUser; } /** * Set Target user account name * @param DstUser Target user account name */ public void setDstUser(String DstUser) { this.DstUser = DstUser; } /** * Get Target user host * @return DstHost Target user host */ public String getDstHost() { return this.DstHost; } /** * Set Target user host * @param DstHost Target user host */ public void setDstHost(String DstHost) { this.DstHost = DstHost; } /** * Get Target account description * @return DstDesc Target account description */ public String getDstDesc() { return this.DstDesc; } /** * Set Target account description * @param DstDesc Target account description */ public void setDstDesc(String DstDesc) { this.DstDesc = DstDesc; } public CloneAccountRequest() { } /** * NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy, * and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy. */ public CloneAccountRequest(CloneAccountRequest source) { if (source.InstanceId != null) { this.InstanceId = new String(source.InstanceId); } if (source.SrcUser != null) { this.SrcUser = new String(source.SrcUser); } if (source.SrcHost != null) { this.SrcHost = new String(source.SrcHost); } if (source.DstUser != null) { this.DstUser = new String(source.DstUser); } if (source.DstHost != null) { this.DstHost = new String(source.DstHost); } if (source.DstDesc != null) { this.DstDesc = new String(source.DstDesc); } } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "InstanceId", this.InstanceId); this.setParamSimple(map, prefix + "SrcUser", this.SrcUser); this.setParamSimple(map, prefix + "SrcHost", this.SrcHost); this.setParamSimple(map, prefix + "DstUser", this.DstUser); this.setParamSimple(map, prefix + "DstHost", this.DstHost); this.setParamSimple(map, prefix + "DstDesc", this.DstDesc); } }
a411f8882d54d7d8a0d748029d096bba46b924bd
af2c1c3c2f9b8f48e17b3bc7bb83aeecfcd144ca
/src/main/java/com/sungho/book/springboot/config/auth/LoginUser.java
8c51a40a775f539fba9a6c52c48228c77a177096
[]
no_license
S-Tiger/springboot2-webservice
45eff72b588fb41404bf5448ecd49e52293de5e1
25f3d360348bab27ef5a2f73b7ee5c46c1de39d2
refs/heads/master
2022-11-30T02:47:24.298036
2020-07-23T07:00:45
2020-07-23T07:00:45
281,033,817
0
0
null
null
null
null
UTF-8
Java
false
false
609
java
package com.sungho.book.springboot.config.auth; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.PARAMETER) //이 어노테이션의 생성위치를 지정 parameter로 지정했으니 메소드의 파라미터로 선언된 객체에서만 사용 가능 @Retention(RetentionPolicy.RUNTIME) public @interface LoginUser { //@interface: 이 파일을 어노테이션 클래스로 한다 LoginUser라는 이름을 가진 어노테이션을 생성한다고 보면 된다 }
04e6b1e6ea212c73aeec306a674d97ab1e632d0d
0b9cef77596cd0afbea7ac7034e86ab2e1a112be
/src/test/java/colum/mullally/fyp/Controllers/AdminControllerTest.java
05588b1c65f66c4d3d79680ef57073947d3a3aaa
[]
no_license
Colum-Mullally/FYP-Webservice
2a9240fda19155cc2a493e2ff8afa6ce8765c046
a7049a0bb9b552d00de27b9b53359091d059fbec
refs/heads/master
2020-04-17T05:10:27.285375
2019-03-23T23:52:37
2019-03-23T23:52:37
166,266,475
0
0
null
null
null
null
UTF-8
Java
false
false
4,037
java
package colum.mullally.fyp.Controllers; import colum.mullally.fyp.Repositories.UserAuthenticationRepository; import colum.mullally.fyp.Repositories.UserRepository; import colum.mullally.fyp.model.User; import colum.mullally.fyp.model.UserAuthentication; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.springframework.http.HttpHeaders; import org.springframework.restdocs.JUnitRestDocumentation; import org.springframework.restdocs.mockmvc.RestDocumentationResultHandler; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.util.Base64Utils; import java.security.Principal; import java.util.Arrays; import java.util.List; import static com.amazonaws.services.elasticbeanstalk.model.ConfigurationOptionValueType.List; import static org.junit.Assert.*; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; @RunWith(SpringJUnit4ClassRunner.class) public class AdminControllerTest { @Rule public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation( "build/generated-snippets"); private MockMvc mockMvc; @InjectMocks private AdminController adminController; @Mock private UserRepository userRepository; @Mock private UserAuthenticationRepository userAuthenticationRepository; @Before public void setUp() throws Exception { RestDocumentationResultHandler document = document("Admin", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())); mockMvc = MockMvcBuilders.standaloneSetup(adminController).apply(documentationConfiguration(this.restDocumentation)).alwaysDo(document).build(); } @Test public void getAll() throws Exception { Mockito.when(userAuthenticationRepository.findByUsername("Admin")).thenReturn(new UserAuthentication("Admin","admin","ADMIN")); Principal mockPrincipal = Mockito.mock(Principal.class); Mockito.when(mockPrincipal.getName()).thenReturn("Admin"); java.util.List< User > users = Arrays.asList(new User("Admin"), new User("user2"), new User("user3")); Mockito.when(userRepository.findAll()).thenReturn(users); mockMvc.perform(MockMvcRequestBuilders.get("/v1/admin/allusers").principal(mockPrincipal).header(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString("user:secret".getBytes()))) .andExpect(MockMvcResultMatchers.status().isOk()).andDo(document("Admin get all")); } @Test public void promote() throws Exception { Mockito.when(userAuthenticationRepository.findByUsername("Admin")).thenReturn(new UserAuthentication("Admin","admin","ADMIN")); Principal mockPrincipal = Mockito.mock(Principal.class); Mockito.when(mockPrincipal.getName()).thenReturn("Admin"); Mockito.when(userAuthenticationRepository.findByUsername("user")).thenReturn(new UserAuthentication("user","user","USER")); mockMvc.perform(MockMvcRequestBuilders.post("/v1/admin/promote").param("username","user").principal(mockPrincipal).header(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString("user:secret".getBytes()))).andExpect(MockMvcResultMatchers.status().isOk()).andDo(document("Admin Promote")); } }
fc6bc29ac49c489caa1f8f57b3ceb789e4f12723
59dcce4371ae91f8f47ac35ffe9f2adccd601b8e
/code/org.softlang.maxmeffert.bscthesis/src/main/java/org/softlang/maxmeffert/bscthesis/ccrecovery/core/fragments/kbs/IFragmentKBFactory.java
5efa765d0475f33d7ac799a6dd3e5d350ae3f0bf
[]
no_license
hayasam/BScThesis
933d9f3b84909ba18fe75af86c80de5795a9023e
448b2eaff997ca126a9bbd49912b07cb540f7a15
refs/heads/master
2020-07-25T02:03:42.443071
2018-01-20T12:58:31
2018-01-20T12:58:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package org.softlang.maxmeffert.bscthesis.ccrecovery.core.fragments.kbs; import org.softlang.maxmeffert.bscthesis.ccrecovery.core.fragments.IFragment; public interface IFragmentKBFactory { IFragmentKB newFragmentKB(IFragment fragment); }
97cc5475bc1f7262e59ea55c0eb4b77a2fc0bb96
6dfb805f084a8ed77bcddf3f83b3ed3d4a600b73
/src/Main/BoardPanel2.java
a9f9d612d0de4afa1ddbdf2bfd3225db259aff94
[]
no_license
Kimyeongsan/DrimStudy
cbb7e89c515d75ae921403ad0d1b967bda4c9963
135d3d837d5aca7dfea4f03d867436587fab9d36
refs/heads/master
2023-07-09T00:02:42.676113
2021-08-23T07:19:23
2021-08-23T07:19:23
391,793,994
0
0
null
null
null
null
UHC
Java
false
false
9,088
java
package Main; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Dictionary; import java.util.HashMap; import java.util.Map; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumnModel; import Database.ConnectionDB; import Database.cheermsgDB; import Database.maintableDB; public class BoardPanel2 extends JPanel { private JTable table; private JScrollPane jscp1; //스크롤바 ConnectionDB cDB = null; Connection con = null; private String header[] = {"제목", "내용", "작성자", "작성기간"}; private DefaultTableModel model = new DefaultTableModel(header, 0){ public boolean isCellEditable(int i, int c){ return false; } }; public int now ; JTextField s1; maintableDB s = new maintableDB(); // DB함수를 호출 // 테이블 데이터 모델 객체 생성 public BoardPanel2(JFrame frame) { super(); cDB = new ConnectionDB(); PanelInit(frame); Search_InputBox(); s.select(model); // 해당 함수에 data를 보내줌 pagination(); } private void PanelInit(JFrame frame) { this.setBackground(new Color(255, 255, 255)); this.setBounds(0, 0, 1280, 300); this.setLayout(null); // Table table = new JTable(model); //table.setLocation(0,0); jscp1 = new JScrollPane(table); //이런식으로 생성시에 테이블을 넘겨주어야 정상적으로 볼 수 있다. //jscp1.add(table); 과 같이 실행하면, 정상적으로 출력되지 않음. jscp1.setLocation(70,40); jscp1.setSize(1060,315); //mainPanel.add(jscp1); // 이 부분을 해줘야 Panel위에 표를 추가할 수 있음. this.add(jscp1); //테이블 행, 열 크기 조절 //table.getRow(header).setPreferredHi table.setRowHeight(28); table.getColumn(header[0]).setPreferredWidth(200); table.getColumn(header[1]).setPreferredWidth(400); table.getColumn(header[2]).setPreferredWidth(200); table.getColumn(header[3]).setPreferredWidth(200); table.getTableHeader().setBackground(new Color(12, 12, 12)); table.getTableHeader().setFont(new Font("맑은고딕", Font.BOLD, 16)); table.getTableHeader().setForeground(Color.white); table.getTableHeader().setPreferredSize(new Dimension(1,32)); //테이블 내용 가운데 정렬 DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); //디폴트테이블셀렌더러 생성 dtcr.setHorizontalAlignment(SwingConstants.CENTER); //렌더러의 가로정렬 CENTER TableColumnModel tcm = table.getColumnModel(); //정렬할 테이블의 컬럼모델 가져오기 for(int i = 0;i < tcm.getColumnCount(); i++) { tcm.getColumn(i).setCellRenderer(dtcr); // 각각의 셀렌더러를 dtcr에 set } } private void pagination() { JButton btnfirst = new JButton("<<"); JButton btnprev = new JButton("<"); JButton btn1 = new JButton("1"); JButton btn2 = new JButton("2"); JButton btn3 = new JButton("3"); JButton btn4 = new JButton("4"); JButton btn5 = new JButton("5"); JButton btn6 = new JButton("6"); JButton btn7 = new JButton("7"); JButton btn8 = new JButton("8"); JButton btn9 = new JButton("9"); JButton btn10 = new JButton("10"); JButton btnnext = new JButton(">"); JButton btnlast = new JButton(">>"); btnfirst.setBounds(239, 400, 60, 30); btnfirst.setBackground(Color.black); btnfirst.setForeground(Color.white); btnprev.setBounds(299, 400, 50, 30); btnprev.setBackground(Color.black); btnprev.setForeground(Color.white); btn1.setBounds(360, 400, 48, 30); btn1.setBackground(Color.black); btn1.setForeground(Color.white); btn2.setBounds(410, 400, 48, 30); btn2.setBackground(Color.black); btn2.setForeground(Color.white); btn3.setBounds(460, 400, 48, 30); btn3.setBackground(Color.black); btn3.setForeground(Color.white); btn4.setBounds(510, 400, 48, 30); btn4.setBackground(Color.black); btn4.setForeground(Color.white); btn5.setBounds(560, 400, 48, 30); btn5.setBackground(Color.black); btn5.setForeground(Color.white); btn6.setBounds(610, 400, 48, 30); btn6.setBackground(Color.black); btn6.setForeground(Color.white); btn7.setBounds(660, 400, 48, 30); btn7.setBackground(Color.black); btn7.setForeground(Color.white); btn8.setBounds(710, 400, 48, 30); btn8.setBackground(Color.black); btn8.setForeground(Color.white); btn9.setBounds(760, 400, 48, 30); btn9.setBackground(Color.black); btn9.setForeground(Color.white); btn10.setBounds(810, 400, 48, 30); btn10.setBackground(Color.black); btn10.setForeground(Color.white); btnnext.setBounds(870, 400, 50, 30); btnnext.setBackground(Color.black); btnnext.setForeground(Color.white); btnlast.setBounds(920, 400, 60, 30); btnlast.setBackground(Color.black); btnlast.setForeground(Color.white); this.add(btnfirst); this.add(btnprev); this.add(btn1); this.add(btn2); this.add(btn3); this.add(btn4); this.add(btn5); this.add(btn6); this.add(btn7); this.add(btn8); this.add(btn9); this.add(btn10); this.add(btnnext); this.add(btnlast); btnfirst.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =1; s.btn_active(model, now); } }); btnprev.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(now==1) now=1; else now = now-1; s.btn_active(model, now); } }); btn1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =1; s.btn_active(model, now); } }); btn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =2; s.btn_active(model, now); } }); btn3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =3; s.btn_active(model, now); } }); btn4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =4; s.btn_active(model, now); } }); btn5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =5; s.btn_active(model, now); } }); btn6.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =6; s.btn_active(model, now); } }); btn7.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =7; s.btn_active(model, now); } }); btn8.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =8; s.btn_active(model, now); } }); btn9.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =9; s.btn_active(model, now); } }); btn10.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =10; s.btn_active(model, now); } }); btnnext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(now==10) now=10; else now = now+1; s.btn_active(model, now); } }); btnlast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { now =10; s.btn_active(model, now); } }); } // 검색어 입력 private void Search_InputBox() { // 이름 입력 s1 = new JTextField(" 검색어를 입력하시오."); s1.setBounds(820, 0, 240, 30); this.add(s1); s1.addMouseListener(new MouseAdapter(){ @Override public void mouseClicked(MouseEvent e){ s1.setText(""); } }); // input 결과물 출력 JButton btnSearch = new JButton("검색"); btnSearch.setBounds(1060, 0, 68, 30); btnSearch.setBackground(Color.black); btnSearch.setForeground(Color.white); this.add(btnSearch); // 적용버튼 리스너 btnSearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String search; search = (String) s1.getText(); // 임시 출력 System.out.println(search); model.setNumRows(0); s.search(model, search, s1); } }); } }
01aa9b8eabdd0fd2c539673fecf814c8c11fe2c4
6ba67d5b62a43026b2ce354e399fe7a9b68ea07a
/test/java/be/howest/breakout/data/MySqlPowerRepositoryTester.java
9cf37a3ea55d8b98c7bf185d2c4ddeaddec93a7f
[]
no_license
StaelensJarne/Breakout
6c2c116dc58f20e8303259d7d4451c93d56719bf
a96fbb9b8f2dbc9ce28cab5559dba1e6b66cbb5c
refs/heads/master
2021-06-27T03:33:41.799709
2020-09-25T13:49:22
2020-09-25T13:49:22
150,418,937
0
0
null
null
null
null
UTF-8
Java
false
false
1,651
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 be.howest.breakout.data; import be.howest.breakout.domain.Block; import be.howest.breakout.domain.PowerDown; import be.howest.breakout.domain.PowerUp; import be.howest.breakout.util.BreakoutException; import org.junit.*; /** * * @author jarne */ public class MySqlPowerRepositoryTester { @Test public void testGetAllPowerUpsDowns() { try { Repositories.getPowerRepository().getPowers(); } catch(BreakoutException ex){ Assert.fail(); } } @Test public void testGetPowerUps() { try { Repositories.getPowerRepository().getPowerUps(); } catch(BreakoutException ex){ Assert.fail(); } } @Test public void testGetPowerDowns() { try { Repositories.getPowerRepository().getPowerDowns(); } catch(BreakoutException ex){ Assert.fail(); } } @Test public void testAddPowerUp() { try { PowerUp p = new PowerUp("lazer"); Repositories.getPowerRepository().addPowerUpDown(p); } catch(BreakoutException ex){ Assert.fail(); } } @Test public void testAddPowerDown() { try { PowerDown p = new PowerDown("many balls"); Repositories.getPowerRepository().addPowerUpDown(p); } catch(BreakoutException ex){ Assert.fail(); } } }
137a1b2640a9ffa153b0ca9b1d546b2723ec95c6
95fcfd22391294ba712daf5de10b1f148e5aea61
/src/main/java/nissan/dao/impl/PartDaoImpl.java
ab5da8c4877d201e6a55bfa347c3b068900322a8
[]
no_license
jhoni4/PartsInventory
0d5c0339ed0bde0a700ac0a6c6dfa606a2ad9026
4f1689d0ded3dcf95707333695d1c22f0bc5f4ef
refs/heads/master
2020-04-15T00:13:23.853755
2017-10-20T22:51:55
2017-10-20T22:51:55
83,231,151
1
0
null
null
null
null
UTF-8
Java
false
false
1,306
java
package nissan.dao.impl; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import nissan.dao.PartDao; import nissan.model.Part; @Repository public class PartDaoImpl implements PartDao { @Autowired private SessionFactory sessionFactory; public List<Part> getPartsList() { Session session = sessionFactory.getCurrentSession(); Query query = (Query) session.createQuery("from Part"); List<Part> partsList = query.list(); session.flush(); return partsList; } public Part getPartsById(int partId) { Session session = sessionFactory.getCurrentSession(); Part part = session.get(Part.class, partId); session.flush(); return part; } public void addParts(Part part) { Session session = sessionFactory.getCurrentSession(); session.saveOrUpdate(part); session.flush(); } public void editParts(Part part) { Session session = sessionFactory.getCurrentSession(); session.saveOrUpdate(part); session.flush(); } public void deleteParts(int partId) { Session session = sessionFactory.getCurrentSession(); session.delete(session.get(Part.class, partId)); session.flush(); } }
ba8af1db505350776dece4a7c05d5615e767c454
98e6e5f765712f6cdd067f20b2743512ef348796
/Interfaces and Abstraction - Lab/src/sayHello/European.java
7b703535fa3a9fcd075f0f1b7ff320a553721e75
[]
no_license
GeorgeK95/JavaOOPAdvanced
1cb0a47f0cbb61509995fcb2293a64e790238839
1566a84552114097924a850332081d4f1c144cb7
refs/heads/master
2021-09-03T11:22:48.944404
2018-01-08T17:31:37
2018-01-08T17:31:37
110,693,137
0
1
null
null
null
null
UTF-8
Java
false
false
413
java
package sayHello; /** * Created by George-Lenovo on 6/29/2017. */ public class European implements Person { private static final String GREETING = "Hello"; private String name; public European(String name) { this.name = name; } @Override public String sayHello() { return GREETING; } @Override public String getName() { return this.name; } }
afee13f227d10e0a9e07196c190ed66f15d056b6
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
/src/number_of_direct_superinterfaces/i48256.java
dd55c4613669b24783357039e2efa0b91091f1aa
[]
no_license
vincentclee/jvm-limits
b72a2f2dcc18caa458f1e77924221d585f23316b
2fd1c26d1f7984ea8163bc103ad14b6d72282281
refs/heads/master
2020-05-18T11:18:41.711400
2014-09-14T04:25:18
2014-09-14T04:25:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
package number_of_direct_superinterfaces; public interface i48256 {}
b4d6c0d72c3b3847f0d2924f51b44d6c16a71e0c
62c86c13a8d26328fd51b7e90c049924cbe78615
/src/com/java/thread/CachedThreadPool.java
a15a61fcfc5a0e69dd6e595656d2a891969b5a2c
[]
no_license
hello1234123/JavaTest
81f00a6eb3d9642105ce4de3b7561a6f32e46d3d
ec9cc93e9e905d985cb5d547170e785bf3002ccd
refs/heads/master
2021-01-01T17:16:46.778625
2015-01-12T13:37:11
2015-01-12T13:37:11
29,055,849
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.java.thread; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class CachedThreadPool { public CachedThreadPool() { } /** * @param args */ public static void main(String[] args) { ExecutorService exec = Executors.newCachedThreadPool(); for (int i = 0; i < 5; i++) exec.execute(new LiftOff()); exec.shutdown(); } }
ae988208418028ba3c89745f65cb4a97f27092bf
1b72958ab7d8749594fd0dca20e3d9e793151b4e
/BMTSync/src/main/java/com/mhe/ctb/oas/BMTSync/rest/CreateAssignmentRequest.java
835e932830eccfc1070dedc04c33db70e009bec6
[]
no_license
sumit-sardar/GitMigrationRepo01
d0a89e33d3c7d873fac2dd66a7a5e59fd2b1bc3a
a474889914ea0e9805547ac7f4659c49e1a6b712
refs/heads/master
2021-01-17T00:45:16.256869
2016-05-12T18:37:01
2016-05-12T18:37:01
61,346,131
1
0
null
null
null
null
UTF-8
Java
false
false
1,527
java
package com.mhe.ctb.oas.BMTSync.rest; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.mhe.ctb.oas.BMTSync.model.TestAssignment; /** * Request to BMT to synch assignments. * @author oas */ public class CreateAssignmentRequest { private static final Logger logger = Logger.getLogger(CreateAssignmentRequest.class); private final ObjectMapper mapper; private List<TestAssignment> _testAssignments; public CreateAssignmentRequest() { this(new ObjectMapper()); } public CreateAssignmentRequest(final ObjectMapper mapper) { _testAssignments = new ArrayList<TestAssignment>(); this.mapper = mapper; } public List<TestAssignment> getTestAssignments() { return _testAssignments; } @JsonProperty(value="testAssignments", required=true) public void addTestAssignment(TestAssignment testAssignment) { _testAssignments.add(testAssignment); } @JsonProperty(value="testAssignments", required=true) public void addTestAssignments(List<TestAssignment> testAssignments) { _testAssignments.addAll(testAssignments); } public String toJson() { try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { logger.error("Failure to serialize Test Assignment request object"); return null; } } }
[ "" ]
93d35298952763539b8504ae63bc234295b501e9
33998ab69889a24f670bab15d9ecf852034f1378
/app/src/main/java/com/jaehyun/businesscard/customview/BusinessCardView.java
798e6cc15ce4304a0662a97a09fcc83d8decc298
[]
no_license
aaaicu/BusinessCard
aadbdbdc7558de5deb1c4e850adc6bd06b779318
9020c759b4baffa7db70b8d20449699e901630fe
refs/heads/master
2023-03-05T04:40:01.006699
2020-12-20T15:29:19
2020-12-20T15:29:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,380
java
package com.jaehyun.businesscard.customview; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.Nullable; import com.jaehyun.businesscard.R; import com.jaehyun.businesscard.data.local.BusinessCardEntity; public class BusinessCardView extends LinearLayout { LinearLayout card = null; Context context; TextView name = null; TextView email = null; TextView tel = null; TextView mobile = null; TextView team = null; TextView position = null; TextView address = null; TextView fax = null; public BusinessCardView(Context context) { super(context); this.context = context; initView(); } public BusinessCardView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); this.context = context; initView(); } public BusinessCardView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.context = context; initView(); } private void initView(){ String infService = Context.LAYOUT_INFLATER_SERVICE; LayoutInflater li = (LayoutInflater) getContext().getSystemService(infService); card = (LinearLayout) li.inflate(R.layout.view_business_card, this, false); name = card.findViewById(R.id.textViewName); email = card.findViewById(R.id.textViewEmail); tel = card.findViewById(R.id.textViewTel); mobile = card.findViewById(R.id.textViewMobile); team = card.findViewById(R.id.textViewTeamName); position = card.findViewById(R.id.textViewPosition); address = card.findViewById(R.id.textViewCompanyAddress); fax = card.findViewById(R.id.textViewFax); addView(card); } public View setBusinessCardData(BusinessCardEntity e){ name.setText(e.getName()); email.setText(e.getEmail()); tel.setText(e.getTel()); mobile.setText(e.getMobile()); team.setText(e.getTeam()); position.setText(e.getPosition()); address.setText(e.getAddress()); fax.setText(e.getFax()); // removeView(card); // addView(card); return card; } }
a7d414a3e998411c51960eb1bf11918b7a93fbfb
81bdd74919042c6afaa655d67be70a61eeadad02
/src/main/java/com/Rest/service/MyGardenService.java
7aa0bc16fb40ed2a99b9a40b9bd3cf36c8735886
[]
no_license
Crouching-Tiger-Hidden-Dragon/Oauth2-JWT
99ec9804ce36d758a9a46b406d6088017c671f04
bd91068890fb0b9abefcb5d9b63cef3cba024e10
refs/heads/main
2023-06-15T21:33:35.974373
2021-07-09T22:08:35
2021-07-09T22:08:35
384,503,516
0
1
null
null
null
null
UTF-8
Java
false
false
1,000
java
package com.Rest.service; import com.Rest.model.MyGarden; import com.Rest.repository.MyGardenRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional public class MyGardenService implements IMyGardenService { @Autowired private MyGardenRepository myGardenRepository; @Override public void deletePlant(long gardenId) { myGardenRepository.deletePlant(gardenId); } @Override public void add(long userId, long plantId){ myGardenRepository.addPant(userId, plantId); } @Override public MyGarden findByPlantId(long userId, long plantId) { return myGardenRepository.findByPlantId(userId, plantId); } @Override public List<MyGardenRepository.MyGardenDetail> getMyGarden(long userId) { return myGardenRepository.getMyGarden(userId); } }
40d33c2cba9289e562f38a44b691fc664812f0b2
54a3d21bf81a41e9fe276fd478a9dbece6902dec
/GenericsConcat.java
e11e2f7e261fb67490ac7d7223c3dfeff594456b
[ "MIT" ]
permissive
it676/ImamaJava2
4cbc18484fdccc3863b1a7e5f3b51feb286ba0aa
ebcc2f5899f83579d67b2a7a309ba18dfe956da2
refs/heads/master
2021-05-08T23:24:19.100118
2018-05-01T11:48:18
2018-05-01T11:48:18
119,708,855
4
0
null
null
null
null
UTF-8
Java
false
false
1,107
java
public class GenericsConcat { public static void main(String[] args) { String[] strings1 = {"Sara", "Khalid"}; String[] strings2 = {"Amal", "Rayan"}; Object[] all = concat(strings1, strings2); for (Object s : all) { System.out.print(s + " , "); } /* Output : Sara , Khalid , Amal , Rayan , */ } //1-Write a generic method to concat two arrays of the same type into one single array public static <T> T[] concat(T[] arr1, T[] arr2) { //size int size = arr1.length + arr2.length; //create the array T[] array = (T[]) new Object[size]; //index counter int indexCounter = 0; //copy items i--->i for (T item : arr1) { array[indexCounter++] = item; } for (T item : arr2) { array[indexCounter++] = item; } //you can imporve the code to use a single loop insted of two loops //return the array contained all items of arr1 and arr2 return array; } }
a6631eeb6a8f03e194edf7ddc5392d2883fe1b8e
13478e295f0d9680e85dddbb1568688323cfd41c
/SaleOA-SA/src/com/saleoa/service/ISalaryConfigServiceImpl.java
3c0f044105471f1caab44a34b9138d4dd469156a
[]
no_license
Linuslan/Java
8a8e9e90b06dff6f1dcdf662ce7497f542d4e609
a141ca3fbb913a895022d22d7337bccf4c586b75
refs/heads/master
2021-05-16T13:06:17.057130
2019-01-14T07:56:23
2019-01-14T07:56:23
105,357,723
0
0
null
null
null
null
UTF-8
Java
false
false
560
java
package com.saleoa.service; import com.saleoa.base.IBaseServiceImpl; import com.saleoa.dao.IDepartmentDaoImpl; import com.saleoa.dao.ILevelDao; import com.saleoa.dao.ILevelDaoImpl; import com.saleoa.dao.ISalaryConfigDaoImpl; import com.saleoa.model.Department; import com.saleoa.model.SalaryConfig; public class ISalaryConfigServiceImpl extends IBaseServiceImpl<SalaryConfig> implements ISalaryConfigService { private ILevelDao levelDao; public ISalaryConfigServiceImpl() { this.dao = new ISalaryConfigDaoImpl(); levelDao = new ILevelDaoImpl(); } }
f51cad233b7e8318d188f9073548c970c0cb1b21
083d1781eab539d58b774d572d9ad458c5b38d5d
/cuckoo_video_line/cuckoo_video_line_android_2_5/bogo/src/main/java/com/eliaovideo/videoline/json/JsonDoGetSelectContact.java
ecfee534aa5aeb731a317fdb8adc6a0cff224287
[]
no_license
zhubinsheng/cuckoo_video_line
90c5f4dbaa466e181814d771f4193055c8e78cc6
7eb0470adb63d846b276df11352b2d57a1dfef77
refs/heads/master
2022-02-16T22:13:06.514406
2019-08-03T01:47:26
2019-08-03T01:47:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package com.eliaovideo.videoline.json; import com.eliaovideo.videoline.modle.ConfigModel; public class JsonDoGetSelectContact extends JsonRequestBase{ private String number; private String price; public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getPrice() { return price; } public String getPriceFormat() { return price + ConfigModel.getInitData().getCurrency_name(); } public void setPrice(String price) { this.price = price; } }
03f0b26ab3dc152855df8bbde5c6ed1006f0d2b0
c66e59175879a7c0cb3e790c82e4f87a0119ac88
/src/StockLimitReachedException.java
ba9acab6218ab9a3184becad995fed1db44e78f6
[]
no_license
re-vc/Java_CodeReview4_Rehovic
d495f27862ccf9570b548e19ac049ab85d4b8856
50f48e42342d0e0fb541d1bd592cbfdb00400534
refs/heads/main
2023-05-06T15:26:18.272347
2023-05-04T22:45:45
2023-05-04T22:45:45
636,461,452
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
public class StockLimitReachedException extends Exception { public StockLimitReachedException() { super("Stock Limit Reached. - this is an Exception"); } }
7a9446b16bd9d5edee5f5b79afb86e052f6b9683
99bc52ee95532f057a641e6de041bf5d62377da9
/app/src/main/java/com/rossevine/project_1/entity/Pemasukan.java
1e9e14f69cb18052a9d3b15c6084267fd77722d2
[]
no_license
RossevineArtha/Project_1
dae47498239fc09b93f634ca26c3c3d83e2899cf
a191733225cb5fe8a139d167e04cf29c0962d507
refs/heads/master
2021-04-30T08:08:56.848817
2018-02-26T17:04:53
2018-02-26T17:04:53
121,366,311
0
0
null
null
null
null
UTF-8
Java
false
false
1,868
java
package com.rossevine.project_1.entity; import java.util.Date; /** * Created by LENOVO on 2/25/2018. */ public class Pemasukan { private int idPemasukan; private int jumlahPemasukan; private String informasiPemasukan; private Date waktuPemasukan; private String judulPemasukan; private CategoryPemasukan categoryPemasukan_idCategoryPemasukan; private User user_idUser; public int getIdPemasukan() { return idPemasukan; } public void setIdPemasukan(int idPemasukan) { this.idPemasukan = idPemasukan; } public int getJumlahPemasukan() { return jumlahPemasukan; } public void setJumlahPemasukan(int jumlahPemasukan) { this.jumlahPemasukan = jumlahPemasukan; } public String getInformasiPemasukan() { return informasiPemasukan; } public void setInformasiPemasukan(String informasiPemasukan) { this.informasiPemasukan = informasiPemasukan; } public Date getWaktuPemasukan() { return waktuPemasukan; } public void setWaktuPemasukan(Date waktuPemasukan) { this.waktuPemasukan = waktuPemasukan; } public String getJudulPemasukan() { return judulPemasukan; } public void setJudulPemasukan(String judulPemasukan) { this.judulPemasukan = judulPemasukan; } public CategoryPemasukan getCategoryPemasukan_idCategoryPemasukan() { return categoryPemasukan_idCategoryPemasukan; } public void setCategoryPemasukan_idCategoryPemasukan(CategoryPemasukan categoryPemasukan_idCategoryPemasukan) { this.categoryPemasukan_idCategoryPemasukan = categoryPemasukan_idCategoryPemasukan; } public User getUser_idUser() { return user_idUser; } public void setUser_idUser(User user_idUser) { this.user_idUser = user_idUser; } }
e611fad1864af6a41ba50171887ace45f45d1ee0
6fefc4908bc87426d490819b94330bc9a924ca42
/library/src/main/java/cn/yhq/http/core/ICancelable.java
20970827a2f7e290e64bd2026fe4671502710abc
[]
no_license
lizhengdao/android-http
c3d159c523269d6782aca0760ab1a9c6e70c9585
2c7b3856d8845e584a72bf472d767c40a504ddea
refs/heads/master
2021-09-10T10:09:45.819245
2018-03-24T13:25:05
2018-03-24T13:25:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
130
java
package cn.yhq.http.core; /** * Created by Yanghuiqiang on 2016/10/14. */ public interface ICancelable { void cancel(); }
86203650f8112466fe244f2f249135a7be5d1105
7886dd4d82043301444fadc6ac5f83302296e429
/src/grammar/Event.java
2861d439bdf6f8d4d91f4569936bbf658cb0f19a
[]
no_license
romantz/HebrewStatisticalParsing
8cafe79889717b2a7691fd5b615ab1089778ca17
fe59aaf523d558e90e7c9f7fad0225148685d08e
refs/heads/master
2020-03-16T16:44:54.718483
2018-05-24T21:22:21
2018-05-24T21:22:21
132,801,515
0
0
null
null
null
null
UTF-8
Java
false
false
1,636
java
package grammar; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; /** * * @author rtsarfat * * CLASS: Event * * Definition: * Structured events * Role: * Define the form of the * left-hand-side and right-hand-side of grammar rules * Responsibility: * keep track of symbols lists, * check event identity * * Usage: Each event may define multiple daughters separated by space * */ public class Event { private List<String> m_lstSymbols = new ArrayList<String>(); private String representation = null; public Event(String s) { StringTokenizer st = new StringTokenizer(s); while (st.hasMoreTokens()) { String sym = (String) st.nextToken(); addSymbol(sym); } } private void addSymbol(String sym) { getSymbols().add(sym); representation = null; } public boolean equals(Object o) { return toString().equals(((Event)o).toString()); } // Calculate toString only once as a performance improvement public String toString() { if(representation == null) { // return concatenation of symbols StringBuffer sb = new StringBuffer(); Iterator<String> it = getSymbols().iterator(); while (it.hasNext()) { String s = (String) it.next(); sb.append(s); if (it.hasNext()) sb.append(" "); } representation = sb.toString(); } return representation; } public int hashCode() { return toString().hashCode(); } public List<String> getSymbols() { return m_lstSymbols; } public void setSymbols(List<String> symbols) { m_lstSymbols = symbols; } }
a7501665b95be9c65e5cefccc503557df2028242
d5c4902267e45a75833b7ecff6afd01afb18ae61
/src/main/java/com/spam/mctool/view/main/receivertable/ReceiverGroupRow.java
259ce3b60e9ad67056521f98d33c9bf45b846fc6
[]
no_license
Erkan-Yilmaz/Multicast-Testing-Tool
468a754fc0dba3499fbe6cb10999b119ff6465c8
4f60909bd3839d4a69b44555d629521724593a9e
refs/heads/master
2020-04-10T21:28:29.221128
2012-03-07T09:58:30
2012-03-07T09:58:30
3,647,844
0
0
null
null
null
null
UTF-8
Java
false
false
2,394
java
package com.spam.mctool.view.main.receivertable; import com.spam.mctool.model.Receiver; import com.spam.mctool.model.ReceiverGroup; import java.util.ArrayList; import java.util.List; /** * Model class representing a receiver group's row and the rows of the receivers * it contains. * @author Tobias Stöckel */ class ReceiverGroupRow extends ReceiverTableRow { /** * the group represented by this row */ private final ReceiverGroup group; /** * the rows of this group's receivers */ private List<ReceiverRow> receiverRows = new ArrayList<ReceiverRow>(); /** * whether the row is currently expanded in the view */ private boolean expanded = true; /** * Creates a new receiver group row for the specified receiver group. */ ReceiverGroupRow(ReceiverGroup group) { this.group = group; // group rows are always visible this.setVisible(true); } /** * Add a new receiver's row to this row */ void add(ReceiverRow receiverRow) { receiverRows.add(receiverRow); } /** * Returns whether the receiver rows contained in this row are currently * expanded in the view. */ boolean isExpanded() { return expanded; } /** * Mark this row as expanded * @param expanded */ void setExpanded(boolean expanded) { this.expanded = expanded; } /** * Determines whether one of this row's children represents the specified * receiver. */ boolean contains(Receiver receiver) { for(ReceiverRow row : receiverRows) { if(row.getReceiver() == receiver) { return true; } } return false; } /** * Get the group represented by this row. */ ReceiverGroup getReceiverGroup() { return group; } /** * Get the number of receiver rows contained by this row. */ int getReceiverRowCount() { return receiverRows.size(); } /** * Get a list of all receiver rows contained by this row. * @return */ List<ReceiverRow> getReceiverRows() { return receiverRows; } /** * Remove a receiver row from this row's children. */ void remove(ReceiverRow rrow) { receiverRows.remove(rrow); } }
[ "none@none" ]
none@none
684c2c390dc6d59756d2770914d6361c3d6809bc
198a72ec618696c98b58ff5b3c9d1a70bf342caa
/src/app/src/main/java/net/gsantner/opoc/preference/SharedPreferencesPropertyBackend.java
bfcce37b93235f20e86f6e49b9bc4c660b9bcb8d
[ "MIT" ]
permissive
roptat/Stringlate
db28836b46e3867bee9c5050fe8a4fed1d48612c
fa24d20e98ca2106d38d609af33a079fb624a3af
refs/heads/master
2020-04-23T12:31:50.271563
2019-03-12T10:14:40
2019-03-12T10:16:40
171,172,083
1
1
MIT
2019-02-17T21:02:11
2019-02-17T21:02:11
null
UTF-8
Java
false
false
18,210
java
/*####################################################### * * Maintained by Gregor Santner, 2016- * https://gsantner.net/ * * License: Apache 2.0 * https://github.com/gsantner/opoc/#licensing * https://www.apache.org/licenses/LICENSE-2.0 * #########################################################*/ /* * This is a wrapper for settings based on SharedPreferences * with keys in resources. Extend from this class and add * getters/setters for the app's settings. * Example: public boolean isAppFirstStart(boolean doSet) { int value = getInt(R.string.pref_key__app_first_start, -1); if (doSet) { setBool(true); } return value; } public boolean isAppCurrentVersionFirstStart(boolean doSet) { int value = getInt(R.string.pref_key__app_first_start_current_version, -1); if (doSet) { setInt(R.string.pref_key__app_first_start_current_version, BuildConfig.VERSION_CODE); } return value != BuildConfig.VERSION_CODE; } */ package net.gsantner.opoc.preference; import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; import android.support.annotation.ColorRes; import android.support.annotation.NonNull; import android.support.annotation.StringRes; import android.support.v4.content.ContextCompat; import android.text.TextUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Wrapper for settings based on SharedPreferences, optionally with keys in resources * Default SharedPreference (_prefApp) will be taken if no SP is specified, else the first one */ @SuppressWarnings({"WeakerAccess", "unused", "SpellCheckingInspection", "SameParameterValue"}) public class SharedPreferencesPropertyBackend implements PropertyBackend<String, SharedPreferencesPropertyBackend> { protected static final String ARRAY_SEPARATOR = "%%%"; protected static final String ARRAY_SEPARATOR_SUBSTITUTE = "§§§"; public static final String SHARED_PREF_APP = "app"; // // Members, Constructors // protected final SharedPreferences _prefApp; protected final String _prefAppName; protected final Context _context; public SharedPreferencesPropertyBackend(final Context context) { this(context, SHARED_PREF_APP); } public SharedPreferencesPropertyBackend(final Context context, final String prefAppName) { _context = context.getApplicationContext(); _prefAppName = TextUtils.isEmpty(prefAppName) ? _context.getPackageName() + "_preferences" : prefAppName; _prefApp = _context.getSharedPreferences(_prefAppName, Context.MODE_PRIVATE); } // // Methods // public Context getContext() { return _context; } public boolean isKeyEqual(String key, int stringKeyResourceId) { return key.equals(rstr(stringKeyResourceId)); } public void resetSettings() { resetSettings(_prefApp); } @SuppressLint("ApplySharedPref") public void resetSettings(final SharedPreferences pref) { pref.edit().clear().commit(); } public boolean isPrefSet(@StringRes int stringKeyResourceId) { return isPrefSet(_prefApp, stringKeyResourceId); } public boolean isPrefSet(final SharedPreferences pref, @StringRes int stringKeyResourceId) { return pref.contains(rstr(stringKeyResourceId)); } public void registerPreferenceChangedListener(SharedPreferences.OnSharedPreferenceChangeListener value) { registerPreferenceChangedListener(_prefApp, value); } public void registerPreferenceChangedListener(final SharedPreferences pref, SharedPreferences.OnSharedPreferenceChangeListener value) { pref.registerOnSharedPreferenceChangeListener(value); } public void unregisterPreferenceChangedListener(SharedPreferences.OnSharedPreferenceChangeListener value) { unregisterPreferenceChangedListener(_prefApp, value); } public void unregisterPreferenceChangedListener(final SharedPreferences pref, SharedPreferences.OnSharedPreferenceChangeListener value) { pref.unregisterOnSharedPreferenceChangeListener(value); } public SharedPreferences getDefaultPreferences() { return _prefApp; } public SharedPreferences.Editor getDefaultPreferencesEditor() { return _prefApp.edit(); } public String getDefaultPreferencesName() { return _prefAppName; } private SharedPreferences gp(final SharedPreferences... pref) { return (pref != null && pref.length > 0 ? pref[0] : _prefApp); } public static void limitListTo(final List<?> list, int maxSize, boolean removeDuplicates) { Object o; int pos; for (int i = 0; removeDuplicates && i < list.size(); i++) { o = list.get(i); while ((pos = list.lastIndexOf(o)) != i && pos >= 0) { list.remove(pos); } } while ((pos = list.size()) > maxSize && pos > 0) { list.remove(list.size() - 1); } } // // Getter for resources // public String rstr(@StringRes int stringKeyResourceId) { return _context.getString(stringKeyResourceId); } public int rcolor(@ColorRes int resColorId) { return ContextCompat.getColor(_context, resColorId); } // // Getter & Setter for String // public void setString(@StringRes int keyResourceId, String value, final SharedPreferences... pref) { gp(pref).edit().putString(rstr(keyResourceId), value).apply(); } public void setString(String key, String value, final SharedPreferences... pref) { gp(pref).edit().putString(key, value).apply(); } public void setString(@StringRes int keyResourceId, @StringRes int defaultValueResourceId, final SharedPreferences... pref) { gp(pref).edit().putString(rstr(keyResourceId), rstr(defaultValueResourceId)).apply(); } public String getString(@StringRes int keyResourceId, String defaultValue, final SharedPreferences... pref) { return gp(pref).getString(rstr(keyResourceId), defaultValue); } public String getString(@StringRes int keyResourceId, @StringRes int defaultValueResourceId, final SharedPreferences... pref) { return gp(pref).getString(rstr(keyResourceId), rstr(defaultValueResourceId)); } public String getString(String key, String defaultValue, final SharedPreferences... pref) { return gp(pref).getString(key, defaultValue); } public String getString(@StringRes int keyResourceId, String defaultValue, @StringRes int keyResourceIdDefaultValue, final SharedPreferences... pref) { return gp(pref).getString(rstr(keyResourceId), rstr(keyResourceIdDefaultValue)); } private void setStringListOne(String key, List<String> values, final SharedPreferences pref) { StringBuilder sb = new StringBuilder(); for (String value : values) { sb.append(ARRAY_SEPARATOR); sb.append(value.replace(ARRAY_SEPARATOR, ARRAY_SEPARATOR_SUBSTITUTE)); } setString(key, sb.toString().replaceFirst(ARRAY_SEPARATOR, ""), pref); } private ArrayList<String> getStringListOne(String key, final SharedPreferences pref) { ArrayList<String> ret = new ArrayList<>(); String value = pref .getString(key, ARRAY_SEPARATOR) .replace(ARRAY_SEPARATOR_SUBSTITUTE, ARRAY_SEPARATOR); if (value.equals(ARRAY_SEPARATOR)) { return ret; } ret.addAll(Arrays.asList(value.split(ARRAY_SEPARATOR))); return ret; } public void setStringArray(@StringRes int keyResourceId, String[] values, final SharedPreferences... pref) { setStringArray(rstr(keyResourceId), values, pref); } public void setStringArray(String key, String[] values, final SharedPreferences... pref) { setStringListOne(key, Arrays.asList(values), gp(pref)); } public void setStringList(@StringRes int keyResourceId, List<String> values, final SharedPreferences... pref) { setStringArray(rstr(keyResourceId), values.toArray(new String[values.size()]), pref); } public void setStringList(String key, List<String> values, final SharedPreferences... pref) { setStringArray(key, values.toArray(new String[values.size()]), pref); } @NonNull public String[] getStringArray(@StringRes int keyResourceId, final SharedPreferences... pref) { return getStringArray(rstr(keyResourceId), pref); } @NonNull public String[] getStringArray(String key, final SharedPreferences... pref) { List<String> list = getStringListOne(key, gp(pref)); return list.toArray(new String[list.size()]); } public ArrayList<String> getStringList(@StringRes int keyResourceId, final SharedPreferences... pref) { return getStringListOne(rstr(keyResourceId), gp(pref)); } public ArrayList<String> getStringList(String key, final SharedPreferences... pref) { return getStringListOne(key, gp(pref)); } // // Getter & Setter for integer // public void setInt(@StringRes int keyResourceId, int value, final SharedPreferences... pref) { gp(pref).edit().putInt(rstr(keyResourceId), value).apply(); } public void setInt(String key, int value, final SharedPreferences... pref) { gp(pref).edit().putInt(key, value).apply(); } public int getInt(@StringRes int keyResourceId, int defaultValue, final SharedPreferences... pref) { return gp(pref).getInt(rstr(keyResourceId), defaultValue); } public int getInt(String key, int defaultValue, final SharedPreferences... pref) { return gp(pref).getInt(key, defaultValue); } public int getIntOfStringPref(@StringRes int keyResId, int defaultValue, final SharedPreferences... pref) { return getIntOfStringPref(rstr(keyResId), defaultValue, gp(pref)); } public int getIntOfStringPref(String key, int defaultValue, final SharedPreferences... pref) { String strNum = getString(key, Integer.toString(defaultValue), gp(pref)); return Integer.valueOf(strNum); } private void setIntListOne(String key, List<Integer> values, final SharedPreferences pref) { StringBuilder sb = new StringBuilder(); for (Integer value : values) { sb.append(ARRAY_SEPARATOR); sb.append(value.toString()); } setString(key, sb.toString().replaceFirst(ARRAY_SEPARATOR, ""), pref); } private ArrayList<Integer> getIntListOne(String key, final SharedPreferences pref) { ArrayList<Integer> ret = new ArrayList<>(); String value = pref.getString(key, ARRAY_SEPARATOR); if (value.equals(ARRAY_SEPARATOR)) { return ret; } for (String s : value.split(ARRAY_SEPARATOR)) { ret.add(Integer.parseInt(s)); } return ret; } public void setIntArray(@StringRes int keyResourceId, Integer[] values, final SharedPreferences... pref) { setIntArray(rstr(keyResourceId), values, gp(pref)); } public void setIntArray(String key, Integer[] values, final SharedPreferences... pref) { setIntListOne(key, Arrays.asList(values), gp(pref)); } public Integer[] getIntArray(@StringRes int keyResourceId, final SharedPreferences... pref) { return getIntArray(rstr(keyResourceId), gp(pref)); } public Integer[] getIntArray(String key, final SharedPreferences... pref) { List<Integer> data = getIntListOne(key, gp(pref)); return data.toArray(new Integer[data.size()]); } public void setIntList(@StringRes int keyResourceId, List<Integer> values, final SharedPreferences... pref) { setIntListOne(rstr(keyResourceId), values, gp(pref)); } public void setIntList(String key, List<Integer> values, final SharedPreferences... pref) { setIntListOne(key, values, gp(pref)); } public ArrayList<Integer> getIntList(@StringRes int keyResourceId, final SharedPreferences... pref) { return getIntListOne(rstr(keyResourceId), gp(pref)); } public ArrayList<Integer> getIntList(String key, final SharedPreferences... pref) { return getIntListOne(key, gp(pref)); } // // Getter & Setter for Long // public void setLong(@StringRes int keyResourceId, long value, final SharedPreferences... pref) { gp(pref).edit().putLong(rstr(keyResourceId), value).apply(); } public void setLong(String key, long value, final SharedPreferences... pref) { gp(pref).edit().putLong(key, value).apply(); } public long getLong(@StringRes int keyResourceId, long defaultValue, final SharedPreferences... pref) { return gp(pref).getLong(rstr(keyResourceId), defaultValue); } public long getLong(String key, long defaultValue, final SharedPreferences... pref) { return gp(pref).getLong(key, defaultValue); } // // Getter & Setter for Float // public void setFloat(@StringRes int keyResourceId, float value, final SharedPreferences... pref) { gp(pref).edit().putFloat(rstr(keyResourceId), value).apply(); } public void setFloat(String key, float value, final SharedPreferences... pref) { gp(pref).edit().putFloat(key, value).apply(); } public float getFloat(@StringRes int keyResourceId, float defaultValue, final SharedPreferences... pref) { return gp(pref).getFloat(rstr(keyResourceId), defaultValue); } public float getFloat(String key, float defaultValue, final SharedPreferences... pref) { return gp(pref).getFloat(key, defaultValue); } // // Getter & Setter for Double // public void setDouble(@StringRes int keyResourceId, double value, final SharedPreferences... pref) { setLong(rstr(keyResourceId), Double.doubleToRawLongBits(value)); } public void setDouble(String key, double value, final SharedPreferences... pref) { setLong(key, Double.doubleToRawLongBits(value)); } public double getDouble(@StringRes int keyResourceId, double defaultValue, final SharedPreferences... pref) { return getDouble(rstr(keyResourceId), defaultValue, gp(pref)); } public double getDouble(String key, double defaultValue, final SharedPreferences... pref) { return Double.longBitsToDouble(getLong(key, Double.doubleToRawLongBits(defaultValue), gp(pref))); } // // Getter & Setter for boolean // public void setBool(@StringRes int keyResourceId, boolean value, final SharedPreferences... pref) { gp(pref).edit().putBoolean(rstr(keyResourceId), value).apply(); } public void setBool(String key, boolean value, final SharedPreferences... pref) { gp(pref).edit().putBoolean(key, value).apply(); } public boolean getBool(@StringRes int keyResourceId, boolean defaultValue, final SharedPreferences... pref) { return gp(pref).getBoolean(rstr(keyResourceId), defaultValue); } public boolean getBool(String key, boolean defaultValue, final SharedPreferences... pref) { return gp(pref).getBoolean(key, defaultValue); } // // Getter & Setter for Color // public int getColor(String key, @ColorRes int defaultColor, final SharedPreferences... pref) { return gp(pref).getInt(key, rcolor(defaultColor)); } public int getColor(@StringRes int keyResourceId, @ColorRes int defaultColor, final SharedPreferences... pref) { return gp(pref).getInt(rstr(keyResourceId), rcolor(defaultColor)); } // // PropertyBackend<String> implementations // @Override public String getString(String key, String defaultValue) { return getString(key, defaultValue, _prefApp); } @Override public int getInt(String key, int defaultValue) { return getInt(key, defaultValue, _prefApp); } @Override public long getLong(String key, long defaultValue) { return getLong(key, defaultValue, _prefApp); } @Override public boolean getBool(String key, boolean defaultValue) { return getBool(key, defaultValue, _prefApp); } @Override public float getFloat(String key, float defaultValue) { return getFloat(key, defaultValue, _prefApp); } @Override public double getDouble(String key, double defaultValue) { return getDouble(key, defaultValue, _prefApp); } @Override public ArrayList<Integer> getIntList(String key) { return getIntList(key, _prefApp); } @Override public ArrayList<String> getStringList(String key) { return getStringList(key, _prefApp); } @Override public SharedPreferencesPropertyBackend setString(String key, String value) { setString(key, value, _prefApp); return this; } @Override public SharedPreferencesPropertyBackend setInt(String key, int value) { setInt(key, value, _prefApp); return this; } @Override public SharedPreferencesPropertyBackend setLong(String key, long value) { setLong(key, value, _prefApp); return this; } @Override public SharedPreferencesPropertyBackend setBool(String key, boolean value) { setBool(key, value, _prefApp); return this; } @Override public SharedPreferencesPropertyBackend setFloat(String key, float value) { setFloat(key, value, _prefApp); return this; } @Override public SharedPreferencesPropertyBackend setDouble(String key, double value) { setDouble(key, value, _prefApp); return this; } @Override public SharedPreferencesPropertyBackend setIntList(String key, List<Integer> value) { setIntListOne(key, value, _prefApp); return this; } @Override public SharedPreferencesPropertyBackend setStringList(String key, List<String> value) { setStringListOne(key, value, _prefApp); return this; } }
290c5bf1e6bbad4e2049d3385272fdd9ae9a1eaa
4aa41abab8867552a5e5519186abbcb9d1894844
/app/src/main/java/com/example/ar_proba/CustomArFragment.java
9fd29f3dbcee960dca417d0047bcd642d032afa9
[]
no_license
bushmek/AR-Application-NULES
935ce0b612820ad603ac5ec9b03deea5749b3f94
4c50633970a8ac1e4c917f6f6d94b5bb1c50d9a2
refs/heads/master
2023-04-06T22:20:22.203052
2021-04-05T19:27:32
2021-04-05T19:27:32
354,948,453
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package com.example.ar_proba; import android.util.Log; import com.google.ar.core.Config; import com.google.ar.core.Session; import com.google.ar.sceneform.ux.ArFragment; public class CustomArFragment extends ArFragment { @Override protected Config getSessionConfiguration(Session session) { getPlaneDiscoveryController().setInstructionView(null); Config config = new Config(session); config.setUpdateMode(Config.UpdateMode.LATEST_CAMERA_IMAGE); session.configure(config); getArSceneView().setupSession(session); if ((((MainActivity) getActivity()).setupAugmentedImagesDb(config, session))) { Log.d("SetupAugImgDb", "Success"); } else { Log.e("SetupAugImgDb","Faliure setting up db"); } return config; } }
0aa9b8e7183e03b056495c4d353b6ec728ce4027
3298fb976726732b29087e49a7b972184e22bb6c
/Source_Code/Gitmine/src/main/java/edu/nju/common/SortTypeBuilder.java
1bb63cfa30915ab158d4a29614ac2e06a3a1c0c3
[]
no_license
CodingFairy/Gitmining
ce41c4adf2ccd7e55ac9ea340e0dd5c1fac5b8cc
5e3d0953caf566d423464b4f25f1f43ec5361bac
refs/heads/master
2021-01-23T14:33:11.288728
2017-06-18T08:50:14
2017-06-18T08:50:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
package edu.nju.common; /** * Created by Harry on 2016/5/12. * this is a tool to generate enumeration of <tt>SortType</tt> from string. */ public class SortTypeBuilder { public static SortType getSortType(String type){ SortType sortType; switch(type){ case "repo_star": sortType = SortType.Repo_Star;break; case "repo_fork": sortType = SortType.Repo_Fork;break; case "repo_update": sortType = SortType.Repo_Update;break; case "repo_watcher": sortType = SortType.Repo_Watch;break; case "repo_name": sortType = SortType.Repo_Name;break; case "hobby_match": sortType = SortType.Hobby_Match;break; case "user_followed": sortType = SortType.User_Follored;break; case "user_following": sortType = SortType.User_Folloring;break; case "user_ownrepos": sortType = SortType.User_Repos;break; case "user_update": sortType = SortType.User_Update;break; case "user_name": sortType = SortType.User_Name;break; default:sortType = null; } return sortType; } }
5a8a95ed91a6d5491713099f9e3fa9eb2faed2b1
7bc5b3d8639460ecb3a0fdaeab0417a57a4f8b91
/app/src/main/java/com/example/android/quizapp/MainActivity.java
1f799fc3e19af706388bec38debb40465007396d
[]
no_license
marjusz/QuizApp
986185629f18411cb70867f47f36d0ca65a09e91
d87e2ab23bcb43237ce1cd70c26279536415df11
refs/heads/master
2021-05-03T12:56:13.044238
2018-02-06T17:58:09
2018-02-06T17:58:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,904
java
package com.example.android.quizapp; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import android.widget.RadioButton; import android.widget.Toast; public class MainActivity extends AppCompatActivity { int score = 0; CheckBox checkBoxOne; CheckBox checkBoxTwo; CheckBox checkBoxThree; CheckBox checkBoxFour; CheckBox checkBoxFive; CheckBox checkBoxSix; EditText editTextDucati; RadioButton radioButtonNo; EditText editTextMotoGuzzi; RadioButton radioButtonLech; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); checkBoxOne = findViewById(R.id.checkbox_one); checkBoxTwo = findViewById(R.id.checkbox_two); checkBoxThree = findViewById(R.id.checkbox_three); checkBoxFour = findViewById(R.id.checkbox_four); checkBoxFive = findViewById(R.id.checkbox_five); checkBoxSix = findViewById(R.id.checkbox_six); editTextDucati = findViewById(R.id.second_ducati_question); radioButtonNo = findViewById(R.id.no_radio_button); editTextMotoGuzzi = findViewById(R.id.fourth_guzzi_question); radioButtonLech = findViewById(R.id.lech_radio_button); } //Method used when button Submit is clicked public void Submit(View view) { //1st answer contains 3 incorrect answers (3rd,4th,6th), if they selected 0 point to score if (checkBoxThree.isChecked() || (checkBoxFour.isChecked()) || (checkBoxSix.isChecked())) { score += 0; //1st answer contains 3 correct answers (1st,2nd,5th), if they selected +1 point to score } else if (checkBoxOne.isChecked() && (checkBoxTwo.isChecked()) && (checkBoxFive.isChecked())) { score += 1; } //2nd answer is 'Ducati', if it's correct +1 point to score if (editTextDucati.getText().toString().equalsIgnoreCase("ducati")) { score += 1; } // 3rd answer is 'No', if it's correct +1 point to score if (radioButtonNo.isChecked()) { score += 1; } // 4th answer is Moto Guzzi, if it's correct +1 point to score if (editTextMotoGuzzi.getText().toString().equalsIgnoreCase("moto guzzi")) { score += 1; } //5th aswer is 'Lech', if it's correct +1 point to score // 3rd answer is 'No', if it's correct +1 point to score if (radioButtonLech.isChecked()) { score += 1; } if (score == 5) { //If someone get maximum points, display a toast message Context context = getApplicationContext(); CharSequence text = "You scored " + score + "/5 \nCongratulation, you're 100% a motorcyclist!"; int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, text, duration); toast.show(); } if (score < 5) { //If someone get <5 points, display a toast message Context context = getApplicationContext(); CharSequence text = "You scored " + score + "/5 \nIt was close. Try again!"; int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, text, duration); toast.show(); } // New activity with 3 seconds of delay final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Intent intent = getIntent(); finish(); startActivity(intent); } }, 3000); } }
5ea0e79122cc3645a67059fea792abfc6b3f7bf6
b34a5adbd65d3034701a18a1857ae9c72b6e2bc1
/BF_project/src/main/java/com/pro/bf/dao/PTF_DldDao.java
e72d0566bf16eeb6231b6caa0fceed2315d3bac8
[]
no_license
BF-Project/BF_Project_update
e3b655f79270afbaa85be35c7974c7a45ae30ac5
6a0e9cfecef043e0348966dfd29d1d3de5854747
refs/heads/master
2021-01-20T11:10:11.013452
2017-03-10T04:24:39
2017-03-10T04:24:39
81,816,229
0
0
null
null
null
null
UTF-8
Java
false
false
58
java
package com.pro.bf.dao; public interface PTF_DldDao { }
5a4a9d1566182a32e86462b25cd246e0c9aae5fc
fa8f658d0cb870149423025bcb9e388b10fb95ff
/mobile/src/androidTest/java/com/hmkcode/com/sqliteapp/ApplicationTest.java
0058f90cf87440743dd8e9cc58d8c54c71cd0768
[]
no_license
minnmake/SQLiteApp
2a83e6e33bdee67e3fb615aefea606fd3f624b3a
80c3baa060a512ce99aedc5e89901ecde5317703
refs/heads/master
2021-01-13T01:35:44.413165
2015-04-06T14:53:27
2015-04-06T14:53:27
33,487,341
0
1
null
null
null
null
UTF-8
Java
false
false
356
java
package com.hmkcode.com.sqliteapp; 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); } }
c09548abae144e0a423f2f108a01e03e2d52113f
5b191a8597500afc6b825cf919dafffb2914d6a1
/regis/src/main/java/com/test/regis/Repositories/StudentRepository.java
bd7521b214a6a3baa7cd7e4eaaa8a22b50b0e2fe
[]
no_license
commonmeen/full-student-regis
5687c0c37bc4b599942129c853e42eac2d3c48da
ca0ea5f7528a69075d9918079722867ca62b7952
refs/heads/master
2023-01-23T22:53:09.804756
2020-02-18T08:13:57
2020-02-18T08:13:57
203,329,182
0
0
null
2023-01-04T07:39:28
2019-08-20T08:04:24
JavaScript
UTF-8
Java
false
false
308
java
package com.test.regis.Repositories; import com.test.regis.Entities.Student; import org.springframework.data.repository.CrudRepository; public interface StudentRepository extends CrudRepository<Student,Long> { public Student getStudentById(Long id); public Student getStudentByName(String name); }
ffce9664abe3c4106c369d2c3a8df580012676eb
2ca10e285af65729fb6ef071d758a43604e36415
/src/com/thaiprogramer/ooplab/Ceo.java
4026b792ec57c6bb723b57271c32a1306f852033
[]
no_license
KulToon/java-part-3-12
b9c0572aa877e326f5204343ed46f126a9d35f05
607fd3bdae4ebe7ef7f6c8b9546725e4bee8479d
refs/heads/main
2023-05-06T11:23:02.142741
2021-05-22T16:47:21
2021-05-22T16:47:21
369,859,949
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package com.thaiprogramer.ooplab; public class Ceo extends Employee { public Ceo(String firstNameInput, String lastNameInput, int salaryInput) { super(firstNameInput, lastNameInput, salaryInput); } public int getSalary() { return super.getSalary() * 2; } }
8a223d501bf24cd02cfb0524a126019cf128d43e
fd4de39ad8da51a9e61a7c99b29368ff279e4672
/src/main/java/Calculator.java
55b69ed53bd31e05345503fb092b53dfdfd0bb89
[]
no_license
GeorgetAbraham/SPE_MiniProject
a29a5b5f7f55d188bc0804ba8beaf12a38b902e6
fc4ece590753d3edd5ed7b4d57dd521becd60c6f
refs/heads/master
2023-03-21T12:32:20.418982
2021-03-09T17:36:34
2021-03-09T17:36:34
345,188,344
0
0
null
null
null
null
UTF-8
Java
false
false
2,178
java
import java.util.Scanner; import java.lang.Math; public class Calculator{ public float add(float a,float b){ return a+b; } public float divide(float a,float b){ return a/b; } public static int factorial(int x) { if (x == 0 || x==1) { return 1; } if(x>1){ return x*factorial(x-1);} else { throw new ArithmeticException("The entered number is negative,no factorial defined"); } } public static void main(String[] args){ System.out.println("Hello friend"); System.out.println("How are you?"); int a; Scanner obj=new Scanner(System.in); boolean state=true; while(state){ System.out.println("Enter any of the following options to perform related operations"); System.out.println("1.Square Root"); System.out.println("2.Factorial Function"); System.out.println("3.Natural Log"); System.out.println("4.Exponentiation"); System.out.println("5.Exit Calculator"); a=obj.nextInt(); if(a==1){ System.out.println("Enter number for which to find square root\n"); double x=obj.nextDouble(); System.out.println(Math.sqrt(x)); } else if(a==2){ System.out.println("Enter number for which to find Factorial\n"); int x=obj.nextInt(); System.out.println(factorial(x)); // break; } else if(a==3){ System.out.println("Enter number for which to find log\n"); double x=obj.nextDouble(); System.out.println(Math.log(x)); } else if(a==4){ System.out.println("Enter numbers x and b for exponentiation\n"); double x,b; x=obj.nextDouble(); b=obj.nextDouble(); System.out.println(Math.pow(x,b)); } else{ state=false; break; } } } }
96947d5538864baed47ac3608b65ddad9ff8d7cc
76127a356f260f6bcc2a8ef35ea07e47f879523e
/src/main/java/com/screens/product/dto/ProductDTO.java
fc401983b54c7d6493f6ab78cbc2de7f8e563205
[]
no_license
thannhattruong99/CFFE-API
7726cc86b0df03efb16d5535b92c1de08319bda2
ce552093bf960df68a4d62212e46800da1424fe4
refs/heads/master
2023-09-02T03:45:08.828480
2021-11-14T04:56:27
2021-11-14T04:56:27
414,096,311
0
0
null
null
null
null
UTF-8
Java
false
false
2,911
java
package com.screens.product.dto; import com.common.dto.BaseDTO; import java.io.Serializable; import java.util.List; public class ProductDTO extends BaseDTO implements Serializable { private String productId; private String productName; private String imageUrl; private String description; private String createTime; private String updateTime; private String reasonInactive; private int statusId; private String statusName; private int categoryId; private List<Integer> categories; private int totalOfRecord; private String storeId; public ProductDTO() { } public String getStoreId() { return storeId; } public void setStoreId(String storeId) { this.storeId = storeId; } public int getTotalOfRecord() { return totalOfRecord; } public void setTotalOfRecord(int totalOfRecord) { this.totalOfRecord = totalOfRecord; } public int getCategoryId() { return categoryId; } public void setCategoryId(int categoryId) { this.categoryId = categoryId; } public List<Integer> getCategories() { return categories; } public void setCategories(List<Integer> categories) { this.categories = categories; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getUpdateTime() { return updateTime; } public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } public String getReasonInactive() { return reasonInactive; } public void setReasonInactive(String reasonInactive) { this.reasonInactive = reasonInactive; } public int getStatusId() { return statusId; } public void setStatusId(int statusId) { this.statusId = statusId; } public String getStatusName() { return statusName; } public void setStatusName(String statusName) { this.statusName = statusName; } }
6e842b935bfc97d77268f690ce3becc8defa4472
8a19b641bed3b2f17a2ca6a5feea9a498762c0f7
/src/main/java/com/nanosai/examples/rionops/RionWriterExamples.java
d0ac58e99afd1f21bcadbd9e58df593ac8283a28
[ "Apache-2.0" ]
permissive
nanosai/nanosai-ops-examples
3f161e16b8617518cf741f4597a02061da0c1ed4
9ea6fb1fb9349459f9129cd5373aac571fdaa293
refs/heads/master
2020-09-17T04:18:47.572285
2020-01-15T11:21:48
2020-01-15T11:21:48
223,986,041
1
1
null
null
null
null
UTF-8
Java
false
false
1,235
java
package com.nanosai.examples.rionops; import com.nanosai.rionops.rion.write.RionWriter; public class RionWriterExamples { public static void main(String[] args) { //writeObject(); writeTable(); } private static void writeObject() { RionWriter rionWriter = new RionWriter(); rionWriter.setDestination(new byte[1024], 0); rionWriter.setNestedFieldStack(new int[16]); rionWriter.writeObjectBeginPush(2); // reserve 2 bytes to hold object length (number of length bytes) rionWriter.writeUtf8("Hello World"); rionWriter.writeInt64(123); rionWriter.writeFloat64(1234.5678); rionWriter.writeObjectEndPop(); } private static void writeTable() { RionWriter rionWriter = new RionWriter(); rionWriter.setDestination(new byte[1024], 0); rionWriter.setNestedFieldStack(new int[16]); rionWriter.writeObjectBeginPush(2); // reserve 2 bytes to hold object length (number of length bytes) rionWriter.writeUtf8("Hello World"); rionWriter.writeInt64(123); rionWriter.writeFloat64(1234.5678); rionWriter.writeObjectEndPop(); } }
6200203b94c6bff16bdb061aac1233dc337dd5d1
558d29fdf8b59bad3b720b44412b1750907303de
/src/main/java/com/asiainfo/requirement/service/ReqService.java
fc4a252a6b0570d158c1e44d132c57f77bd21ca2
[]
no_license
EueDeath/ReqAnalysis
f86cc1183273a3f529ec4671b2f1df80b057d0a7
f251cecdf2493be0c096ffc226029f5b504dd745
refs/heads/master
2020-04-19T02:44:50.685170
2019-01-28T06:49:16
2019-01-28T06:49:16
167,913,516
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package com.asiainfo.requirement.service; import java.util.List; import com.asiainfo.requirement.entity.Issue; public interface ReqService { List<String> getIssueComponentsByPro(String p); List<String> getProjectKey(); List<String> getCostByComAndPro(String c, String p); List<Issue> getIssueByComAndPro(String c, String p); Integer getListByComAndPro(String c, String p); Integer getMonNees(String mon); List<String> getMonCost(String mon); Integer getMonPublish1(String mon1); Integer getMonPublish2(String mon1); }
e78f655453940f657f9651459f6f86425e6da833
56b3db5c738e846de7fb88888f0e83f3fde37086
/simple-travel/app/src/main/java/org/vaadin/activiti/simpletravel/domain/Expense.java
3301d6f3155df813ef376f339541cd6e3ce1214e
[ "Apache-2.0" ]
permissive
dyhbfh/ActivitiVaadinDevoxx11
570570693ae8347bb8af017d65032088c33e8369
910c8b2063f9d055b3e64dbb2615c06d7edc537f
refs/heads/master
2021-01-21T17:47:14.683026
2012-06-11T10:28:11
2012-06-11T10:28:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,162
java
package org.vaadin.activiti.simpletravel.domain; import java.math.BigDecimal; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotNull; @Embeddable public class Expense extends AbstractValueObject { @NotNull(message = "Please enter a description for your expense") protected String description; @NotNull(message = "Please enter a quantity") protected Integer quantity = 1; @NotNull(message = "Please enter a price") @Column(precision = 8, scale = 2) protected BigDecimal price = BigDecimal.ZERO; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } public BigDecimal getTotal() { return price.multiply(new BigDecimal(getQuantity())); } }
a2d7dcc30186db4a5a1dd18048ce4227b4eeafc4
9c7e6fec853d3f52db355bfacf5b3e07c31a67b6
/src/main/java/com/ruhul/tomcatsse/controller/ServerSentEventController.java
50748b365407d8a191194df13f238adbf4b2a62d
[]
no_license
RuhulxD/SSE-tomcat-Springboot
d53eec5cf8b4cc382719b3f083e13ba336e34d43
f808bc249c2a495b71cdd8d49156b11fcac7c9ce
refs/heads/main
2023-03-25T15:56:48.343143
2021-03-25T12:04:25
2021-03-25T12:04:25
351,399,164
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package com.ruhul.tomcatsse.controller; import com.ruhul.tomcatsse.common.EventDto; import com.ruhul.tomcatsse.service.ServerSentEventServiceImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; @RestController public class ServerSentEventController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); // private final ServerSentEventServiceImpl serverSentEventService; public ServerSentEventController(ServerSentEventServiceImpl serverSentEventService) { this.serverSentEventService = serverSentEventService; } @GetMapping(path = "/public/ping/subscribe", produces = MediaType.TEXT_EVENT_STREAM_VALUE) public Flux<EventDto> pingSubscribe() { //TODO add check from customerId return serverSentEventService.onPingSubscribe(); } @GetMapping(path = "/public/file", produces = MediaType.TEXT_HTML_VALUE) public Flux<String> getFile() { //TODO add check from customerId return serverSentEventService.getFile(); } }
d36342825128057264912b9f55378c8b58e5a04f
a1a7e11664887863de45d4b022323f874cb2fc27
/src/main/java/com/nuctech/platform/auth/service/CacheUserService.java
167d0edb3721faa78be870bf8513f17132f545b3
[]
no_license
wzh404/zuul-api-gateway
efe94f712d3bb5e599089954851f41cf679b5255
9db9255d53135b0868c52429b966922d96dd1d38
refs/heads/master
2020-03-20T09:18:15.819044
2018-06-20T03:20:35
2018-06-20T03:20:35
137,333,395
0
0
null
null
null
null
UTF-8
Java
false
false
1,833
java
package com.nuctech.platform.auth.service; import com.nuctech.platform.auth.bean.User; import com.nuctech.platform.cache.Cache; import com.nuctech.platform.util.TokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.concurrent.TimeUnit; /** * Created by @author wangzunhui on 2018/4/11. */ public class CacheUserService extends AbstractUserService { private final Logger logger = LoggerFactory.getLogger(CacheUserService.class); @Autowired private Cache<String, String> cache; @Override public Optional<User> getUser(String token) { return Optional.ofNullable(j2u(cache.get(token))); } @Override public String createToken(User user) { String token = TokenUtil.createSessionId(); long timeout = user.getTimeout(); if (timeout <= 0){ timeout = defaultTimeout; } int online = user.getNumPerUser(); logger.debug("default user online number is {}", online); if (online > 0) { // 限制用户在线人数. cache.set(user.getId(), token, u2j(user), timeout, online); } else { cache.set(token, u2j(user), timeout, TimeUnit.MINUTES); } return token; } @Override public List<String> getAuthorize(String uid) { String join = cache.get(prefixUserPermission + uid); if (join == null) { return new ArrayList<>(); } return Arrays.asList(join.split(",")); } @Override public void setAuthorize(String uid, List<String> uris) { cache.set(prefixUserPermission + uid, String.join(",", uris)); } }
3af2f11e04a45b906ebb5d79013875611a9e408f
5fc567ef2dc5181609d6388d69e1c49c2c9278c5
/app/src/main/java/com/xjtu/friendtrip/util/BitmapUtil.java
a854952efeab608945676ff5f99db95c965ee25f
[]
no_license
Meshine001/FriendTrip
930abfe2a34c83a670f9ace491eb19c58e784991
e476d1d4af24ff80936f90ba4d796ffeca89705c
refs/heads/master
2021-01-17T12:57:04.700971
2016-06-20T09:56:07
2016-06-20T09:56:07
59,589,477
0
0
null
null
null
null
UTF-8
Java
false
false
11,059
java
package com.xjtu.friendtrip.util; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.renderscript.Allocation; import android.renderscript.RenderScript; import android.renderscript.ScriptIntrinsicBlur; import android.view.View; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.UUID; /** * Created by Meshine on 16/5/19. */ public class BitmapUtil { /** * 背景虚化 * @param bkg * @param view * @param radius * @param context */ private void blur(Bitmap bkg, View view, float radius, Context context) { Bitmap overlay = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(overlay); canvas.drawBitmap(bkg, -view.getLeft(), -view.getTop(), null); RenderScript rs = RenderScript.create(context); Allocation overlayAlloc = Allocation.createFromBitmap(rs, overlay); ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, overlayAlloc.getElement()); blur.setInput(overlayAlloc); blur.setRadius(radius); blur.forEach(overlayAlloc); overlayAlloc.copyTo(overlay); view.setBackground(new BitmapDrawable(context.getResources(), overlay)); rs.destroy(); } // 可用于生成缩略图。 /** * Creates a centered bitmap of the desired size. Recycles the input. * * @param source */ public static Bitmap extractMiniThumb(Bitmap source, int width, int height) { return extractMiniThumb(source, width, height, true); } public static Bitmap extractMiniThumb(Bitmap source, int width, int height, boolean recycle) { if (source == null) { return null; } float scale; if (source.getWidth() < source.getHeight()) { scale = width / (float) source.getWidth(); } else { scale = height / (float) source.getHeight(); } Matrix matrix = new Matrix(); matrix.setScale(scale, scale); Bitmap miniThumbnail = transform(matrix, source, width, height, false); if (recycle && miniThumbnail != source) { source.recycle(); } return miniThumbnail; } public static Bitmap transform(Matrix scaler, Bitmap source, int targetWidth, int targetHeight, boolean scaleUp) { int deltaX = source.getWidth() - targetWidth; int deltaY = source.getHeight() - targetHeight; if (!scaleUp && (deltaX < 0 || deltaY < 0)) { /* * In this case the bitmap is smaller, at least in one dimension, * than the target. Transform it by placing as much of the image as * possible into the target and leaving the top/bottom or left/right * (or both) black. */ Bitmap b2 = Bitmap.createBitmap(targetWidth, targetHeight, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b2); int deltaXHalf = Math.max(0, deltaX / 2); int deltaYHalf = Math.max(0, deltaY / 2); Rect src = new Rect(deltaXHalf, deltaYHalf, deltaXHalf + Math.min(targetWidth, source.getWidth()), deltaYHalf + Math.min(targetHeight, source.getHeight())); int dstX = (targetWidth - src.width()) / 2; int dstY = (targetHeight - src.height()) / 2; Rect dst = new Rect(dstX, dstY, targetWidth - dstX, targetHeight - dstY); c.drawBitmap(source, src, dst, null); return b2; } float bitmapWidthF = source.getWidth(); float bitmapHeightF = source.getHeight(); float bitmapAspect = bitmapWidthF / bitmapHeightF; float viewAspect = (float) targetWidth / targetHeight; if (bitmapAspect > viewAspect) { float scale = targetHeight / bitmapHeightF; if (scale < .9F || scale > 1F) { scaler.setScale(scale, scale); } else { scaler = null; } } else { float scale = targetWidth / bitmapWidthF; if (scale < .9F || scale > 1F) { scaler.setScale(scale, scale); } else { scaler = null; } } Bitmap b1; if (scaler != null) { // this is used for minithumb and crop, so we want to filter here. b1 = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), scaler, true); } else { b1 = source; } int dx1 = Math.max(0, b1.getWidth() - targetWidth); int dy1 = Math.max(0, b1.getHeight() - targetHeight); Bitmap b2 = Bitmap.createBitmap(b1, dx1 / 2, dy1 / 2, targetWidth, targetHeight); if (b1 != source) { b1.recycle(); } return b2; } /** * 质量压缩方法 * * @param image * @return */ public static Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.JPEG, 100, baos);//质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中 int options = 100; while (baos.toByteArray().length / 1024 > 100) { //循环判断如果压缩后图片是否大于100kb,大于继续压缩 baos.reset();//重置baos即清空baos image.compress(Bitmap.CompressFormat.JPEG, options, baos);//这里压缩options%,把压缩后的数据存放到baos中 options -= 10;//每次都减少10 } ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());//把压缩后的数据baos存放到ByteArrayInputStream中 Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);//把ByteArrayInputStream数据生成图片 return bitmap; } /** * 图片按比例大小压缩方法(根据路径获取图片并压缩) * * @param srcPath * @return */ public static Bitmap getImage(String srcPath) { BitmapFactory.Options newOpts = new BitmapFactory.Options(); //开始读入图片,此时把options.inJustDecodeBounds 设回true了 newOpts.inJustDecodeBounds = true; Bitmap bitmap = BitmapFactory.decodeFile(srcPath, newOpts);//此时返回bm为空 newOpts.inJustDecodeBounds = false; int w = newOpts.outWidth; int h = newOpts.outHeight; //现在主流手机比较多是800*480分辨率,所以高和宽我们设置为 float hh = 800f;//这里设置高度为800f float ww = 480f;//这里设置宽度为480f //缩放比。由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可 int be = 1;//be=1表示不缩放 if (w > h && w > ww) {//如果宽度大的话根据宽度固定大小缩放 be = (int) (newOpts.outWidth / ww); } else if (w < h && h > hh) {//如果高度高的话根据宽度固定大小缩放 be = (int) (newOpts.outHeight / hh); } if (be <= 0) be = 1; newOpts.inSampleSize = be;//设置缩放比例 //重新读入图片,注意此时已经把options.inJustDecodeBounds 设回false了 bitmap = BitmapFactory.decodeFile(srcPath, newOpts); return compressImage(bitmap);//压缩好比例大小后再进行质量压缩 } /** * 图片按比例大小压缩方法(根据Bitmap图片压缩) * * @param image * @return */ public static Bitmap comp(Bitmap image) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.JPEG, 100, baos); if (baos.toByteArray().length / 1024 > 1024) {//判断如果图片大于1M,进行压缩避免在生成图片(BitmapFactory.decodeStream)时溢出 baos.reset();//重置baos即清空baos image.compress(Bitmap.CompressFormat.JPEG, 50, baos);//这里压缩50%,把压缩后的数据存放到baos中 } ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray()); BitmapFactory.Options newOpts = new BitmapFactory.Options(); //开始读入图片,此时把options.inJustDecodeBounds 设回true了 newOpts.inJustDecodeBounds = true; Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, newOpts); newOpts.inJustDecodeBounds = false; int w = newOpts.outWidth; int h = newOpts.outHeight; //现在主流手机比较多是800*480分辨率,所以高和宽我们设置为 float hh = 800f;//这里设置高度为800f float ww = 480f;//这里设置宽度为480f //缩放比。由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可 int be = 1;//be=1表示不缩放 if (w > h && w > ww) {//如果宽度大的话根据宽度固定大小缩放 be = (int) (newOpts.outWidth / ww); } else if (w < h && h > hh) {//如果高度高的话根据宽度固定大小缩放 be = (int) (newOpts.outHeight / hh); } if (be <= 0) be = 1; newOpts.inSampleSize = be;//设置缩放比例 //重新读入图片,注意此时已经把options.inJustDecodeBounds 设回false了 isBm = new ByteArrayInputStream(baos.toByteArray()); bitmap = BitmapFactory.decodeStream(isBm, null, newOpts); return compressImage(bitmap);//压缩好比例大小后再进行质量压缩 } /** * 将bitmap存储到本地格式为JPG * @param bitmap * @return 存储的地址 */ public static String saveBitmap(Bitmap bitmap) { FileOutputStream fOut = null; String folder = CommonUtil.getAppSDCardDir() + "/temp"; File dir = new File(folder); if (!dir.exists()) { dir.mkdirs(); } String path = folder + "/" + UUID.randomUUID() + ".jpg"; try { File f = new File(path); f.createNewFile(); fOut = new FileOutputStream(f); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut); } catch (IOException e) { e.printStackTrace(); path = ""; } finally { try { fOut.flush(); fOut.close(); } catch (IOException e) { e.printStackTrace(); path = ""; } } return path; } }
5b8a07b5dba351eff4b757f059bb52ea65c3ac95
512e26922cedc548a23aa84c9416e0b8e597d622
/TopNews/ourNews/src/main/java/com/oushangfeng/ounews/widget/slidr/model/SlidrListener.java
da22ce43eb98970f5005aee5d24d736800b153eb
[]
no_license
xuhang1993/TopNewsApp
d0f7c6db98ea3852f42cfdcf68b3ce1c5b5ecc2a
525b1d1b0739c90c4f2264b43ee3b815b856437b
refs/heads/master
2021-01-20T01:42:51.086925
2018-03-28T08:30:10
2018-03-28T08:30:10
89,317,881
1
0
null
null
null
null
UTF-8
Java
false
false
892
java
package com.oushangfeng.ounews.widget.slidr.model; /** * This listener interface is for receiving events from the sliding panel such as state changes * and slide progress * * Project: Slidr * Package: com.r0adkll.slidr.model * Created by drew.heavner on 2/24/15. */ @Deprecated public interface SlidrListener { /** * This is called when the {@link android.support.v4.widget.ViewDragHelper} calls it's * state change callback. * * @see android.support.v4.widget.ViewDragHelper#STATE_IDLE * @see android.support.v4.widget.ViewDragHelper#STATE_DRAGGING * @see android.support.v4.widget.ViewDragHelper#STATE_SETTLING * * @param state the {@link android.support.v4.widget.ViewDragHelper} state */ void onSlideStateChanged(int state); void onSlideChange(float percent); void onSlideOpened(); void onSlideClosed(); }
21c8803461799df52dcceeda79b11274752b2675
3f27f5de1fea87c654c91094d6a43d3d32505c0e
/packet/src/main/java/kaap/veiko/debuggerforker/packet/VirtualMachinePacketStream.java
f05569c9aeefd059cef6ae85d44eb88b8c984938
[]
no_license
veikokaap/jvm-multi-debugger-proxy
317435548c42c863e8e21d6dc357b8f23240fa52
170dcc3b9ac5933ddbf657dd36a5f55cc77aa633
refs/heads/master
2022-07-11T01:26:49.418192
2020-10-13T08:22:32
2020-10-13T08:22:32
124,928,985
6
0
null
2022-06-20T22:39:57
2018-03-12T17:52:36
Java
UTF-8
Java
false
false
2,116
java
package kaap.veiko.debuggerforker.packet; import static kaap.veiko.debuggerforker.packet.PacketSource.SourceType.VIRTUAL_MACHINE; import java.io.IOException; import java.nio.channels.SocketChannel; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import kaap.veiko.debuggerforker.packet.internal.PacketStreamBase; import kaap.veiko.debuggerforker.packet.internal.VmPacketTransformer; public class VirtualMachinePacketStream extends PacketStreamBase { private final Logger log = LoggerFactory.getLogger(VirtualMachinePacketStream.class); private final ConcurrentMap<Integer, CommandPacket> writtenCommands = new ConcurrentHashMap<>(); private final ReplyPacketVisitor replyPacketVisitor = new ReplyPacketVisitor(); public VirtualMachinePacketStream(SocketChannel socketChannel) throws IOException { super(socketChannel, VIRTUAL_MACHINE, new VmPacketTransformer()); } @Override public Packet read() throws IOException { Packet packet = super.read(); if (packet == null) { return null; } return packet.visit(replyPacketVisitor); } @Override public void write(Packet packet) throws IOException { if (!packet.isReply() && packet instanceof CommandPacket) { writtenCommands.put(packet.getId(), (CommandPacket) packet); super.write(packet); } else { log.error("VirtualMachine can't receive replies. Tried to write packet {}", packet); } } private class ReplyPacketVisitor implements PacketVisitor<Packet> { @Override public Packet visit(ReplyPacket replyPacket) { CommandPacket commandPacket = writtenCommands.get(replyPacket.getId()); commandPacket.setReplyPacket(replyPacket); replyPacket.setCommandPacket(commandPacket); return replyPacket; } @Override public Packet visit(CommandPacket packet) { return packet; } } @Override public String toString() { return "VirtualMachinePacketStream{" + "socketChannel=" + getSocketChannel() + '}'; } }
b2b82b47982be9c95e43df8f522b9efab3869b86
003a6ee01d39c3d5e7d3e57f0bac56bc411d2bd5
/MGGolf2.0/MalengaGolfLibrary/src/main/java/com/boha/malengagolf/library/util/CacheVideoUtil.java
f9bb136422fe3c629f89f3d38aa05e3c6f273604
[]
no_license
malengatiger/TigerGolf004
e9ee4c7b88f384907670971b7e21d5f66a22e096
16c7e5afa26711bf2aab70fc9685cca983d9a2c7
refs/heads/master
2021-01-18T23:43:35.285638
2016-06-08T13:07:47
2016-06-08T13:07:47
54,854,472
0
0
null
null
null
null
UTF-8
Java
false
false
3,543
java
package com.boha.malengagolf.library.util; import android.content.Context; import android.os.AsyncTask; import android.util.Log; import com.boha.malengagolf.library.data.VideoClipContainer; import com.google.gson.Gson; import java.io.*; /** * Created by aubreyM on 2014/04/16. */ public class CacheVideoUtil { public interface CacheVideoListener { public void onDataDeserialized(VideoClipContainer vcc); } static VideoClipContainer videoClipContainer; static CacheVideoListener listener; static Context ctx; public static void cacheVideo(Context context, VideoClipContainer r) { videoClipContainer = r; ctx = context; new CacheTask().execute(); } public static void getCachedVideo(Context context, CacheVideoListener cacheVideoListener) { listener = cacheVideoListener; ctx = context; new CacheRetrieveTask().execute(); } static class CacheTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... voids) { String json = null; File file = null; FileOutputStream outputStream; try { json = gson.toJson(videoClipContainer); outputStream = ctx.openFileOutput(VIDEO_CLIP_FILENAME, Context.MODE_PRIVATE); outputStream.write(json.getBytes()); outputStream.close(); file = ctx.getFileStreamPath(VIDEO_CLIP_FILENAME); Log.i(LOG, "VideoClipContainer json written to file: " + file.getAbsolutePath() + " - length: " + file.length()); } catch (IOException e) { Log.e(LOG, "Failed to cache data", e); } return null; } } static class CacheRetrieveTask extends AsyncTask<Void, Void, VideoClipContainer> { @Override protected VideoClipContainer doInBackground(Void... voids) { VideoClipContainer vcc = null; FileInputStream stream; try { try { stream = ctx.openFileInput(VIDEO_CLIP_FILENAME); String json = getStringFromInputStream(stream); Log.i(LOG, "VideoClipContainer json retrieved: " + json.length()); vcc = gson.fromJson(json, VideoClipContainer.class); } catch (FileNotFoundException e) { return new VideoClipContainer(); } return vcc; } catch (IOException e) { } return vcc; } private static String getStringFromInputStream(InputStream is) throws IOException { BufferedReader br = null; StringBuilder sb = new StringBuilder(); String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { sb.append(line); } } finally { if (br != null) { br.close(); } } String json = sb.toString(); return json; } @Override protected void onPostExecute(VideoClipContainer v) { listener.onDataDeserialized(v); } } static final String LOG = "CacheVideoUtil"; static final String VIDEO_CLIP_FILENAME = "video.json"; static final Gson gson = new Gson(); }
29a517c2674e9e99dacaaee4570bae709a7e9411
988c8a8ffa3afd74c9d523814993aabf2679b52a
/src/com/ximei/tiny/collector/CaiJiDanYuanActivity.java
da6b94ee15a0e39680d9f6c8f8be82fbd14aa32c
[]
no_license
MrYangWen/ZQjinka
1d4955c9faf4e04d26d17e9e22963c73462793d2
2619d3bd87eccd4204b69a96f6a598a51c5dbad8
refs/heads/master
2020-05-18T04:47:00.986565
2019-05-30T02:03:54
2019-05-30T02:03:54
184,181,703
1
0
null
null
null
null
UTF-8
Java
false
false
5,157
java
package com.ximei.tiny.collector; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import com.tiny.gasxm.R; import com.ximei.tiny.tools.ClearReportArray; import com.ximei.tiny.tools.Containstr; import com.ximei.tiny.tools.SubDong; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; /* * 和DanYuanActivity一样 * 把气表地址按单元分开 * */ public class CaiJiDanYuanActivity extends Activity { private TextView biaocelogin; ClearReportArray clearreport; ArrayList<String> danyuanlist; private String databasename; private String datatype; ArrayList<String> huxinglist; Intent intent; Intent intent1; Containstr contain; ListView myListView; private String overmsg; String[] qbdzlist,sendlist; SubDong subdong; List<String> tempqbdz = new ArrayList<String>(); protected void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); //取消标题状态栏 requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(1024, 1024); setContentView(R.layout.biaoce); this.intent1 = new Intent(); this.subdong = new SubDong(); this.contain = new Containstr(); this.clearreport = new ClearReportArray(); this.intent = getIntent(); //根据intent传输得到相应的数据 this.danyuanlist = this.intent.getStringArrayListExtra("danyuansing"); this.databasename = this.intent.getStringExtra("databasename"); this.datatype = this.intent.getStringExtra("datatype"); Log.e("test", datatype); this.qbdzlist = this.intent.getStringArrayExtra("qbdz"); this.overmsg = this.intent.getStringExtra("overmsg"); this.myListView = ((ListView) findViewById(R.id.myListView)); this.biaocelogin = ((TextView) findViewById(R.id.biaocelogin)); ArrayList<HashMap<String, String>> localArrayList = new ArrayList<HashMap<String, String>>(); // 遍历楼栋标识danyuanlist if (this.danyuanlist.size() == 0) { this.biaocelogin.setText("没有可选择的单元"); this.biaocelogin.setTextSize(25.0F); } else { this.biaocelogin.setText("所有单元"); this.biaocelogin.setTextSize(30.0F); // 存放到相应的localArrayList中形成数据源 for (int i = 0; i < this.danyuanlist.size(); i++) { HashMap<String, String> localHashMap = new HashMap<String, String>(); localHashMap.put("baioceTitle", (String) this.danyuanlist.get(i) + "单元"); localArrayList.add(localHashMap); } } // 设置适配器数据源 SimpleAdapter localSimpleAdapter = new SimpleAdapter( CaiJiDanYuanActivity.this, localArrayList, R.layout.list_biaoce, new String[] { "baioceTitle" }, new int[] { R.id.biaocename }); this.myListView.setAdapter(localSimpleAdapter); // 设置监听器 this.myListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub // 取得点击的String(02单元) String str1 = (String) ((HashMap) CaiJiDanYuanActivity.this.myListView .getItemAtPosition(arg2)).get("baioceTitle"); // 取得栋前的标识(多少单元) String dongflag = str1.substring(0, str1.indexOf("单元")); // 找出气表地址中包含该栋的地址tempqbdz for (int i = 0; i < qbdzlist.length; i++) { if (subdong.QueryDong(qbdzlist[i], "单元").equals(dongflag)) { //Toast.makeText(DanYuanActivity.this, qbdzlist[i],Toast.LENGTH_SHORT).show(); tempqbdz.add(qbdzlist[i]); } } // 把取得的气表地址tempqbdz转化为String数组qbdzlist sendlist = new String[tempqbdz.size()]; for (int i = 0; i < tempqbdz.size(); i++) { sendlist[i] = tempqbdz.get(i); } //判断qbdzlist是否有户型号 if (contain.isHave(sendlist, "号")) { String[] allhuxing = new String[sendlist.length]; for (int i = 0; i < sendlist.length; i++) { allhuxing[i] = subdong.QueryDong(sendlist[i], "号"); } Arrays.sort(allhuxing); huxinglist = clearreport.ClearReport(allhuxing); intent1.putStringArrayListExtra("huxingsing", huxinglist); intent1.putExtra("qbdz", sendlist); intent1.putExtra("overmsg", overmsg); intent1.putExtra("databasename", databasename); intent1.putExtra("datatype", datatype); intent1.setClass(CaiJiDanYuanActivity.this, CaiJiHuXingActivity.class); CaiJiDanYuanActivity.this.startActivity(intent1); } tempqbdz.clear(); } }); } }
[ "x@DESKTOP-6UEHRPM" ]
x@DESKTOP-6UEHRPM
97df1e8546d1e22031f7fba8271b9a3587f5de58
d9d7d5904bcd3c843d08b69fc4b1eccc7ce834fb
/src/br/com/mygame/classes/Criptografia.java
3b1536be81027ea1b4a084e527f474b606d0af4a
[]
no_license
nada-pont-com/Samuel
590a7fbf4f684e89d56538fb0761bcb7fe29a4a4
c549deb092f761766a4be5c348f31b552a38b6bb
refs/heads/master
2020-04-03T17:25:25.186855
2018-11-21T12:26:48
2018-11-21T12:26:48
155,443,959
0
0
null
2018-10-31T22:18:34
2018-10-30T19:25:42
Java
UTF-8
Java
false
false
588
java
package br.com.mygame.classes; import java.security.MessageDigest; public class Criptografia { static public String criptografaSenha(String senha) { String senhaCript = ""; try { MessageDigest algorithm = MessageDigest.getInstance("MD5"); byte messageDigest[] = algorithm.digest(senha.getBytes("UTF-8")); StringBuilder hexString = new StringBuilder(); for (byte b : messageDigest) { hexString.append(String.format("%02X", 0xFF & b)); } senhaCript = hexString.toString(); } catch (Exception e) { e.printStackTrace(); } return senhaCript; } }
5f27bad39ff22d3a5140d306506609f9474b6568
6be373d5d0b4e04f050850278ccc1d6a61bf5757
/src/com/dyy/binarytree/threadbinarytree/ThreadTreeNode.java
bed422ee2cb0016c5ba21bb26aab126e208ef9e1
[]
no_license
small-pebble/dataStructurePrimary
f9d5dc46ae134d0cd096b4049caf0166a442bf2c
a991440e90e93dc7ad4242cd5f7a490ecec956cf
refs/heads/master
2020-05-17T10:25:16.931499
2019-04-26T16:01:53
2019-04-26T16:01:53
183,656,555
0
0
null
null
null
null
UTF-8
Java
false
false
1,667
java
package com.dyy.binarytree.threadbinarytree; public class ThreadTreeNode { int value; ThreadTreeNode leftNode; ThreadTreeNode rightNode; //指针标识 int leftType; int rightType; public ThreadTreeNode(int value){ this.value = value; } public void setLeftNode(ThreadTreeNode leftNode) { this.leftNode = leftNode; } public void setRightNode(ThreadTreeNode rightNode) { this.rightNode = rightNode; } //前序遍历 public void frontShow() { System.out.println(value); if(leftNode!=null) leftNode.frontShow(); if(rightNode!=null) rightNode.frontShow(); } public void midShow() { if(leftNode!=null) leftNode.midShow(); System.out.println(value); if(rightNode!=null) rightNode.midShow(); } public void afterShow() { if(leftNode!=null) leftNode.afterShow(); if(rightNode!=null) rightNode.afterShow(); System.out.println(value); } // 前序查找 public ThreadTreeNode frontSearch(int value) { ThreadTreeNode target = null; if(this.value==value){ return this; }else{ if(leftNode!=null) target = leftNode.frontSearch(value); if(target!=null) return target; if(rightNode!=null) target = rightNode.frontSearch(value); } return target; } //删除节点 public void delete(int i) { ThreadTreeNode parent = this; if(parent.leftNode!=null && parent.leftNode.value==i){ parent.leftNode = null; return; } if(parent.rightNode!=null && parent.rightNode.value==i){ parent.rightNode = null; return; } parent = leftNode; if(parent != null){ parent.delete(i); } parent = rightNode; if(parent != null){ parent.delete(i); } } }
2d5810e2b84779803031305ccb86d2591906fd9b
d89e523eb5bdbefaab219e3fb48973cca87798dc
/BudgetMeter/BudgetMeter.Android/obj/Debug/110/android/src/androidx/viewpager2/R.java
e60d255b6a372016dac1eb1d974aa9ff4c98c3d6
[]
no_license
KristijanKuzmanovski/BugetMeter
6a26ef159994632b972609ff2bc3194f8c76d84e
df365c6cf16c1a867c808316be7f24b93c347310
refs/heads/master
2023-04-03T15:36:30.807022
2021-04-10T19:02:29
2021-04-10T19:02:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,657
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by * Xamarin.Android from the resource data it found. * It should not be modified by hand. */ package androidx.viewpager2; public final class R { public static final class attr { public static final int alpha = 0x7f030028; public static final int fastScrollEnabled = 0x7f030117; public static final int fastScrollHorizontalThumbDrawable = 0x7f030118; public static final int fastScrollHorizontalTrackDrawable = 0x7f030119; public static final int fastScrollVerticalThumbDrawable = 0x7f03011a; public static final int fastScrollVerticalTrackDrawable = 0x7f03011b; public static final int font = 0x7f03011e; public static final int fontProviderAuthority = 0x7f030120; public static final int fontProviderCerts = 0x7f030121; public static final int fontProviderFetchStrategy = 0x7f030122; public static final int fontProviderFetchTimeout = 0x7f030123; public static final int fontProviderPackage = 0x7f030124; public static final int fontProviderQuery = 0x7f030125; public static final int fontStyle = 0x7f030126; public static final int fontVariationSettings = 0x7f030127; public static final int fontWeight = 0x7f030128; public static final int layoutManager = 0x7f03016d; public static final int recyclerViewStyle = 0x7f0301d5; public static final int reverseLayout = 0x7f0301d6; public static final int spanCount = 0x7f0301f5; public static final int stackFromEnd = 0x7f0301fb; public static final int ttcIndex = 0x7f03027e; } public static final class color { public static final int notification_action_color_filter = 0x7f0500b5; public static final int notification_icon_bg_color = 0x7f0500b6; public static final int ripple_material_light = 0x7f0500c2; public static final int secondary_text_default_material_light = 0x7f0500c4; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f060055; public static final int compat_button_inset_vertical_material = 0x7f060056; public static final int compat_button_padding_horizontal_material = 0x7f060057; public static final int compat_button_padding_vertical_material = 0x7f060058; public static final int compat_control_corner_material = 0x7f060059; public static final int compat_notification_large_icon_max_height = 0x7f06005a; public static final int compat_notification_large_icon_max_width = 0x7f06005b; public static final int fastscroll_default_thickness = 0x7f06008e; public static final int fastscroll_margin = 0x7f06008f; public static final int fastscroll_minimum_range = 0x7f060090; public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f060098; public static final int item_touch_helper_swipe_escape_max_velocity = 0x7f060099; public static final int item_touch_helper_swipe_escape_velocity = 0x7f06009a; public static final int notification_action_icon_size = 0x7f060143; public static final int notification_action_text_size = 0x7f060144; public static final int notification_big_circle_margin = 0x7f060145; public static final int notification_content_margin_start = 0x7f060146; public static final int notification_large_icon_height = 0x7f060147; public static final int notification_large_icon_width = 0x7f060148; public static final int notification_main_column_padding_top = 0x7f060149; public static final int notification_media_narrow_margin = 0x7f06014a; public static final int notification_right_icon_size = 0x7f06014b; public static final int notification_right_side_padding_top = 0x7f06014c; public static final int notification_small_icon_background_padding = 0x7f06014d; public static final int notification_small_icon_size_as_large = 0x7f06014e; public static final int notification_subtext_size = 0x7f06014f; public static final int notification_top_pad = 0x7f060150; public static final int notification_top_pad_large_text = 0x7f060151; } public static final class drawable { public static final int notification_action_background = 0x7f0700a4; public static final int notification_bg = 0x7f0700a5; public static final int notification_bg_low = 0x7f0700a6; public static final int notification_bg_low_normal = 0x7f0700a7; public static final int notification_bg_low_pressed = 0x7f0700a8; public static final int notification_bg_normal = 0x7f0700a9; public static final int notification_bg_normal_pressed = 0x7f0700aa; public static final int notification_icon_background = 0x7f0700ab; public static final int notification_template_icon_bg = 0x7f0700ac; public static final int notification_template_icon_low_bg = 0x7f0700ad; public static final int notification_tile_bg = 0x7f0700ae; public static final int notify_panel_notification_icon_bg = 0x7f0700af; } public static final class id { public static final int accessibility_action_clickable_span = 0x7f08000a; public static final int accessibility_custom_action_0 = 0x7f08000b; public static final int accessibility_custom_action_1 = 0x7f08000c; public static final int accessibility_custom_action_10 = 0x7f08000d; public static final int accessibility_custom_action_11 = 0x7f08000e; public static final int accessibility_custom_action_12 = 0x7f08000f; public static final int accessibility_custom_action_13 = 0x7f080010; public static final int accessibility_custom_action_14 = 0x7f080011; public static final int accessibility_custom_action_15 = 0x7f080012; public static final int accessibility_custom_action_16 = 0x7f080013; public static final int accessibility_custom_action_17 = 0x7f080014; public static final int accessibility_custom_action_18 = 0x7f080015; public static final int accessibility_custom_action_19 = 0x7f080016; public static final int accessibility_custom_action_2 = 0x7f080017; public static final int accessibility_custom_action_20 = 0x7f080018; public static final int accessibility_custom_action_21 = 0x7f080019; public static final int accessibility_custom_action_22 = 0x7f08001a; public static final int accessibility_custom_action_23 = 0x7f08001b; public static final int accessibility_custom_action_24 = 0x7f08001c; public static final int accessibility_custom_action_25 = 0x7f08001d; public static final int accessibility_custom_action_26 = 0x7f08001e; public static final int accessibility_custom_action_27 = 0x7f08001f; public static final int accessibility_custom_action_28 = 0x7f080020; public static final int accessibility_custom_action_29 = 0x7f080021; public static final int accessibility_custom_action_3 = 0x7f080022; public static final int accessibility_custom_action_30 = 0x7f080023; public static final int accessibility_custom_action_31 = 0x7f080024; public static final int accessibility_custom_action_4 = 0x7f080025; public static final int accessibility_custom_action_5 = 0x7f080026; public static final int accessibility_custom_action_6 = 0x7f080027; public static final int accessibility_custom_action_7 = 0x7f080028; public static final int accessibility_custom_action_8 = 0x7f080029; public static final int accessibility_custom_action_9 = 0x7f08002a; public static final int action_container = 0x7f080033; public static final int action_divider = 0x7f080035; public static final int action_image = 0x7f080036; public static final int action_text = 0x7f08003c; public static final int actions = 0x7f08003d; public static final int async = 0x7f080044; public static final int blocking = 0x7f080048; public static final int chronometer = 0x7f080061; public static final int dialog_button = 0x7f080077; public static final int forever = 0x7f08008b; public static final int icon = 0x7f080096; public static final int icon_group = 0x7f080098; public static final int info = 0x7f08009b; public static final int italic = 0x7f08009c; public static final int item_touch_helper_previous_elevation = 0x7f08009d; public static final int line1 = 0x7f0800a7; public static final int line3 = 0x7f0800a8; public static final int normal = 0x7f0800d5; public static final int notification_background = 0x7f0800d6; public static final int notification_main_column = 0x7f0800d7; public static final int notification_main_column_container = 0x7f0800d8; public static final int right_icon = 0x7f0800e6; public static final int right_side = 0x7f0800e7; public static final int tag_accessibility_actions = 0x7f08011b; public static final int tag_accessibility_clickable_spans = 0x7f08011c; public static final int tag_accessibility_heading = 0x7f08011d; public static final int tag_accessibility_pane_title = 0x7f08011e; public static final int tag_screen_reader_focusable = 0x7f08011f; public static final int tag_transition_group = 0x7f080120; public static final int tag_unhandled_key_event_manager = 0x7f080121; public static final int tag_unhandled_key_listeners = 0x7f080122; public static final int text = 0x7f080128; public static final int text2 = 0x7f080129; public static final int time = 0x7f080137; public static final int title = 0x7f080138; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f090014; } public static final class layout { public static final int custom_dialog = 0x7f0b0022; public static final int notification_action = 0x7f0b0051; public static final int notification_action_tombstone = 0x7f0b0052; public static final int notification_template_custom_big = 0x7f0b0059; public static final int notification_template_icon_group = 0x7f0b005a; public static final int notification_template_part_chronometer = 0x7f0b005e; public static final int notification_template_part_time = 0x7f0b005f; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0e006a; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0f0160; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0161; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0163; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0166; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0168; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f024e; public static final int Widget_Compat_NotificationActionText = 0x7f0f024f; } public static final class styleable { public static final int[] ColorStateListItem = new int[] { 0x010101a5, 0x0101031f, 0x7f030028 }; public static final int ColorStateListItem_alpha = 2; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_android_color = 0; public static final int[] FontFamily = new int[] { 0x7f030120, 0x7f030121, 0x7f030122, 0x7f030123, 0x7f030124, 0x7f030125 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = new int[] { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f03011e, 0x7f030126, 0x7f030127, 0x7f030128, 0x7f03027e }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = new int[] { 0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2, 0x010101a3, 0x010101a4, 0x01010201, 0x0101020b, 0x01010510, 0x01010511, 0x01010512, 0x01010513 }; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_type = 2; public static final int[] GradientColorItem = new int[] { 0x010101a5, 0x01010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; public static final int[] RecyclerView = new int[] { 0x010100c4, 0x010100eb, 0x010100f1, 0x7f030117, 0x7f030118, 0x7f030119, 0x7f03011a, 0x7f03011b, 0x7f03016d, 0x7f0301d6, 0x7f0301f5, 0x7f0301fb }; public static final int RecyclerView_android_clipToPadding = 1; public static final int RecyclerView_android_descendantFocusability = 2; public static final int RecyclerView_android_orientation = 0; public static final int RecyclerView_fastScrollEnabled = 3; public static final int RecyclerView_fastScrollHorizontalThumbDrawable = 4; public static final int RecyclerView_fastScrollHorizontalTrackDrawable = 5; public static final int RecyclerView_fastScrollVerticalThumbDrawable = 6; public static final int RecyclerView_fastScrollVerticalTrackDrawable = 7; public static final int RecyclerView_layoutManager = 8; public static final int RecyclerView_reverseLayout = 9; public static final int RecyclerView_spanCount = 10; public static final int RecyclerView_stackFromEnd = 11; public static final int[] ViewPager2 = new int[] { 0x010100c4 }; public static final int ViewPager2_android_orientation = 0; } }
5aa53d8a0735f56d9df66c12cacc67623e63ba89
f6d4fcdb599247e3b811ff2f807e6b51d8f1a2d8
/AP Computer Science/isPalindrome/StringTest.java
79f1dab490b355fa079040fa3f766ad7c6b09b9b
[]
no_license
vaedprasad/Java-Projects
ef2a005e942d294e1629191b6482fb62b89de240
1354a89eb5c863a39d4b2db095505d0dc67cb611
refs/heads/master
2021-01-21T03:56:40.675165
2017-04-11T23:51:13
2017-04-11T23:51:13
59,215,334
1
0
null
null
null
null
UTF-8
Java
false
false
2,108
java
import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.Box; public class StringTest extends JFrame implements ActionListener { private JTextField input, result; public StringTest() { super("String Test"); Box box1 = Box.createVerticalBox(); box1.add(Box.createVerticalStrut(20)); box1.add(new JLabel("Input:")); box1.add(Box.createVerticalStrut(20)); box1.add(new JLabel("Result:")); input = new JTextField(20); input.setBackground(Color.YELLOW); input.addActionListener(this); input.selectAll(); result = new JTextField(20); result.setBackground(Color.WHITE); result.setEditable(false); Box box2 = Box.createVerticalBox(); box1.add(Box.createVerticalStrut(20)); box2.add(input); box2.add(Box.createVerticalStrut(20)); box2.add(result); Container c = getContentPane(); c.setLayout(new FlowLayout()); c.add(box1); c.add(box2); input.requestFocus(); } public boolean isPalindrome(String word) { String reverse = ""; int length = word.length(); for ( int i = length - 1; i >= 0; i-- ) reverse = reverse + word.charAt(i); if (word.equals(reverse)) return true; else return false; } public void actionPerformed(ActionEvent e) { String str = input.getText(); String result2 = ""; if (isPalindrome(str)) result2 = "true"; else result2 = "false"; result.setText(result2); input.selectAll(); } public static void main(String[] args) { StringTest window = new StringTest(); window.setBounds(100, 100, 360, 160); window.setDefaultCloseOperation(EXIT_ON_CLOSE); window.setVisible(true); } }
ec39c3bf26e3f2cbb2d55d478845c9b520328938
9559c081eaa950096e3edbf2304792a1f6f2f30c
/ditingrobot/backend/src/main/java/com/diting/util/Utils.java
84106ab438fae14ab99f73acdbf88d20ebed637a
[]
no_license
jarvisxiong/diting
f193d587b52e8be6d39425833fbcf735d24540ad
f6455fedbc4e087ab86bc5b7b645442b7037cb32
refs/heads/master
2021-06-23T22:47:48.364329
2017-05-11T07:33:36
2017-05-11T07:33:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
26,286
java
package com.diting.util; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.JSONSerializer; import com.alibaba.fastjson.serializer.PropertyFilter; import com.alibaba.fastjson.serializer.SerializeWriter; import com.alibaba.fastjson.serializer.SerializerFeature; import com.diting.error.AppErrors; import com.diting.model.options.PageableOptions; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.util.ISO8601DateFormat; import com.fasterxml.jackson.databind.util.ISO8601Utils; import com.fasterxml.jackson.datatype.guava.GuavaModule; import com.fasterxml.jackson.datatype.joda.JodaModule; import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import io.dropwizard.jackson.AnnotationSensitivePropertyNamingStrategy; import io.dropwizard.jackson.DiscoverableSubtypeResolver; import io.dropwizard.jackson.GuavaExtrasModule; import io.dropwizard.jackson.LogbackModule; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.apache.shiro.crypto.hash.SimpleHash; import org.apache.solr.common.SolrDocument; import org.json.JSONObject; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Entities; import org.jsoup.safety.Whitelist; import org.springframework.util.StringUtils; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; import java.io.*; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.security.MessageDigest; import java.text.DateFormat; import java.text.ParseException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Utils. */ public final class Utils { private static final Document.OutputSettings ESCAPE_SETTINGS = new Document.OutputSettings().prettyPrint(true).escapeMode(Entities.EscapeMode.xhtml).charset("UTF-8"); private static final Pattern MOBILE_PATTERN = Pattern.compile("^\\d{11}$"); private static final Pattern EMAIL_PATTERN = Pattern.compile("^([a-z0-9A-Z]+[_-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"); private static final Pattern INTEGER_PATTERN = Pattern.compile("^[-\\+]?[\\d]*$"); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); static { OBJECT_MAPPER.registerModule(new GuavaModule()); OBJECT_MAPPER.registerModule(new LogbackModule()); OBJECT_MAPPER.registerModule(new GuavaExtrasModule()); OBJECT_MAPPER.registerModule(new JodaModule()); OBJECT_MAPPER.registerModule(new AfterburnerModule()); //OBJECT_MAPPER.registerModule(new FuzzyEnumModule()); OBJECT_MAPPER.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy()); OBJECT_MAPPER.setSubtypeResolver(new DiscoverableSubtypeResolver()); OBJECT_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); OBJECT_MAPPER.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); OBJECT_MAPPER.setDateFormat(new ISO8601DateFormat()); } private Utils() { // private ctor } // ===== File ===== // public static String readFileContent(String fileName) { ClassLoader classLoader = Utils.class.getClassLoader(); InputStream inputStream = classLoader.getResourceAsStream(fileName); StringBuilder result = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { String line; while ((line = reader.readLine()) != null) { result.append(line).append(getLineSeparator()); } reader.close(); } catch (IOException e) { throw new RuntimeException("Error occurred during read file [" + fileName + "].", e); } return result.toString(); } public static void appendFile(File file, String content) { PrintWriter out = null; try { out = new PrintWriter(new BufferedWriter(new FileWriter(file, true))); out.print(content); } catch (Exception e) { //ignore silently } finally { if (out != null) { out.close(); } } } public static File createFile(String fileName) { File file = new File(fileName); if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { throw new RuntimeException(e); } } return file; } public static File createDir(String dirName) { File dir = new File(dirName); if (!dir.exists()) { dir.mkdir(); } return dir; } public static void writeFile(File file, String content) { OutputStreamWriter outputStreamWriter = null; BufferedWriter bufferedWriter = null; try { outputStreamWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); bufferedWriter = new BufferedWriter(outputStreamWriter); bufferedWriter.write(content); } catch (IOException e) { throw new RuntimeException(e); } finally { close(bufferedWriter); close(outputStreamWriter); } } // ===== JSON =====// public static String toJacksonJSON(Object input) { if (input == null) return null; try { return OBJECT_MAPPER.writeValueAsString(input); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } public static <T> T fromJacksonJson(String input, Class<T> clazz) { if (StringUtils.isEmpty(input)) { return null; } try { return OBJECT_MAPPER.readValue(input, clazz); } catch (IOException e) { throw new RuntimeException(e); } } public static String toJSON(Object input) { if (input == null) return null; return JSON.toJSONString(input, SerializerFeature.PrettyFormat); } public static String toJson(Object input, String[] filterProperties) { if (input == null) return null; SerializeWriter writer = new SerializeWriter(); JSONSerializer serializer = new JSONSerializer(writer); // apply filters if (filterProperties != null) { final Set<String> filters = new HashSet(Arrays.asList(filterProperties)); serializer.getPropertyFilters().add(new PropertyFilter() { public boolean apply(Object source, String name, Object value) { return !filters.contains(name); } }); } serializer.write(input); return writer.toString(); } public static <T> T fromJson(String input, Class<T> clazz) { return JSON.parseObject(input, clazz); } public static JSONObject str2json(String input){ if (input == null) return null; return new JSONObject(input); } // ===== Date =====// public static Date now() { return new Date(); } public static Long timeDifference(Date date,Date date1) { return date1.getTime()-date.getTime(); } public static Long nowTime() { return now().getTime(); } public static Date parseDate(String source, DateFormat format) { if (source == null) return null; try { return format.parse(source); } catch (ParseException e) { // ignore silently } return null; } public static String date2iso(Date date) { return date == null ? null : ISO8601Utils.format(date); } public static Date daysBefore(int days) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, -1 * days); return calendar.getTime(); } public static Date daysBefore(Date time, int days) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time.getTime()); calendar.add(Calendar.DATE, -1 * days); return calendar.getTime(); } public static Date daysAfter(int days) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, days); return calendar.getTime(); } public static Date daysAfter(Date time, int days) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time.getTime()); calendar.add(Calendar.DATE, days); return calendar.getTime(); } public static Date getDayStart(Date time){ Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); } public static Date minutesBefore(int minutes) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MINUTE, -1 * minutes); return calendar.getTime(); } public static Date minutesBefore(Date time, int minutes) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time.getTime()); calendar.add(Calendar.MINUTE, -1 * minutes); return calendar.getTime(); } public static Date minutesAfter(int minutes) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(now().getTime()); calendar.add(Calendar.MINUTE, minutes); return calendar.getTime(); } public static Date minutesAfter(Date time, int minutes) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time.getTime()); calendar.add(Calendar.MINUTE, minutes); return calendar.getTime(); } public static Date today() { Calendar calendar = new GregorianCalendar(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); } public static int differentDays(Date date1,Date date2){ int days = (int) ((date2.getTime() - date1.getTime()) / (1000*3600*24)); return days; } public static int daysOfTwo(Date fDate, Date oDate) { Calendar aCalendar = Calendar.getInstance(); aCalendar.setTime(fDate); int day1 = aCalendar.get(Calendar.DAY_OF_YEAR); aCalendar.setTime(oDate); int day2 = aCalendar.get(Calendar.DAY_OF_YEAR); return day2 - day1; } // ===== Check ===== // public static boolean validateMobile(String mobile) { Matcher m = MOBILE_PATTERN.matcher(mobile); return m.matches(); } public static boolean validateEmail(String email) { Matcher m = EMAIL_PATTERN.matcher(email); return m.matches(); } public static boolean validateInteger(String value) { Matcher m = INTEGER_PATTERN.matcher(value); return m.matches(); } public static <T> T checkNull(Object param, String paramName) { if (param == null) { throw AppErrors.INSTANCE.missingField(paramName).exception(); } return (T) param; } public static String checkString(String param, String paramName) { if (param == null || param.trim().length() == 0) { throw AppErrors.INSTANCE.missingField(paramName).exception(); } return param; } public static boolean equals(String a, String b) { if (a == null && b == null) return true; if ((a == null && b != null) || (a != null && b == null)) { return false; } return a.equalsIgnoreCase(b); } public static boolean equalsCaseSensitive(String a, String b) { if (a == null && b == null) return true; if ((a == null && b != null) || (a != null && b == null)) { return false; } return a.equals(b); } public static boolean equals(Integer a, Integer b) { if (a == null && b == null) return true; if (a == null || b == null) { return false; } return a.equals(b); } public static boolean isEmpty(String value) { return value == null || value.trim().length() == 0; } public static <T> boolean isCollectionEmpty(Collection<T> collection) { return collection == null || collection.isEmpty(); } public static boolean isArrayEmpty(Object[] objects) { return objects == null || (objects != null && objects.length == 0); } public static String nullIfEmpty(String value) { return isEmpty(value) ? null : value; } public static <T> List<T> nullIfEmpty(List<T> collections) { return isCollectionEmpty(collections) ? null : collections; } public static String isNull(String input, String defaultValue) { return input == null ? defaultValue : input; } public static Integer isNull(Integer input, Integer defaultValue) { return input == null ? defaultValue : input; } // ===== Convert ===== // public static String str(Object obj) { return obj == null ? null : String.valueOf(obj); } public static Integer str2int(String input) { try { return isEmpty(input) ? null : Integer.valueOf(input); } catch (Exception e) { return null; } } public static Long str2long(String input) { return isEmpty(input) ? null : Long.valueOf(input); } public static Double str2double(String input) { return isEmpty(input) ? null : Double.valueOf(input); } public static BigDecimal str2decimal(String input) { return isEmpty(input) ? null : new BigDecimal(input); } public static Date str2Date(String input) { try { return input == null ? null : Constants.DATE_FORMAT.parse(input); } catch (ParseException e) { throw new RuntimeException(e); } } public static Date str_Date(String input) { try { return input == null ? null : Constants.TIMESTAMP_FORMAT.parse(input); } catch (ParseException e) { throw new RuntimeException(e); } } public static Date str2Date(String input, DateFormat format) { try { return input == null ? null : format.parse(input); } catch (ParseException e) { throw new RuntimeException(e); } } // public static Date isoStr2date(String input) { // return StringUtils.isEmpty(input) ? null : ISO8601Utils.parse(input); // } public static Long date2long(Date date) { return date == null ? null : date.getTime(); } public static String date2str(Date date) { if (date == null) return null; return Constants.DATE_FORMAT.format(date); } public static String datetime2str(Date time) { if (time == null) return null; return Constants.DATETIME_FORMAT.format(time); } public static String timeRange2str(Date time) { if (time == null) return null; return Constants.TIME_RANGE_FORMAT.format(time); } public static String timeMsec2str(Date time) { if (time == null) return null; return Constants.TIME_MSEC_FORMAT.format(time); } public static String time2str(Date time) { if (time == null) return null; return Constants.TIMESTAMP_FORMAT.format(time); } public static String timeAPM2str(Date time) { if (time == null) return null; return Constants.TIME_APM_FORMAT.format(time); } public static List<Integer> str2int(Collection<String> input) { if (input == null) return null; List<Integer> results = new ArrayList<>(); for (String entry : input) { if (!isEmpty(entry)) { results.add(Integer.parseInt(entry)); } } return results; } public static String convertDecimalNCRToString(String ncr) { if (ncr == null) return null; ncr = ncr.replace("&#", ""); String[] split = ncr.split(";"); StringBuilder sb = new StringBuilder(); for (int i = 0; i < split.length; i++) { sb.append((char) Integer.parseInt(split[i])); } return sb.toString(); } // ===== Collection ===== // public static <T> T getUnique(List<T> list) { if (list == null || list.size() != 1) throw new RuntimeException("List is empty or contains more than one element."); return list.get(0); } public static <T> T getFirst(List<T> list) { if (list == null || list.isEmpty()) throw new RuntimeException("List is empty."); return list.get(0); } public static <T> T getLast(List<T> list) { if (list == null || list.isEmpty()) throw new RuntimeException("List is empty."); return list.get(list.size() - 1); } // ===== Misc ===== // public static String find(Pattern pattern, String content) { Matcher matcher = pattern.matcher(content); if (matcher.find()) { String text = matcher.group(1); return text == null ? null : text.trim().replaceAll("&nbsp;", ""); } else { return null; } } public static String find(Pattern pattern, String content, Integer index) { Matcher matcher = pattern.matcher(content); if (matcher.find()) { String text = matcher.group(index); return text == null ? null : text.trim().replaceAll("&nbsp;", ""); } else { return null; } } public static String getLineSeparator() { return System.getProperty("line.separator"); } public static String trim(String input) { if (input == null) return null; return input.trim(); } public static void buildPageableOptions(UriInfo uriInfo, PageableOptions options) { MultivaluedMap<String, String> params = uriInfo.getQueryParameters(); options.setPageNo(str2int(isNull(params.getFirst("pageNo"), "1"))); options.setPageSize(str2int(isNull(params.getFirst("pageSize"), "15"))); } public static BigDecimal divide(Integer a, Integer b) { return new BigDecimal(a).divide(new BigDecimal(b), 2, RoundingMode.HALF_UP); } public static String tidyHtml(String html) { if (html == null) return null; return Jsoup.clean(html, "", Whitelist.none(), ESCAPE_SETTINGS); } public static String hash(String input) { if (input == null) return null; try { MessageDigest m = MessageDigest.getInstance("MD5"); m.reset(); m.update(input.getBytes()); byte[] digest = m.digest(); BigInteger bigInt = new BigInteger(1, digest); String result = bigInt.toString(16); if (result.length() > 32) result = result.substring(0, 32); // forget to padding left 0 to len-32, which does not meet MD5 standard return result; } catch (Exception e) { throw new RuntimeException(e); } } public static String md5(String input) { try { return DigestUtils.md5Hex(input.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } public static String sha1(String input) { if (input == null) return null; try { MessageDigest crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(input.getBytes("UTF-8")); return byte2Hex(crypt.digest()); } catch (Exception e) { throw new RuntimeException(e); } } public static String sha1(String name, String password) { return new SimpleHash("SHA-1", name, password).toString(); } public static String byte2Hex(final byte[] hash) { Formatter formatter = new Formatter(); for (byte b : hash) { formatter.format("%02x", b); } String result = formatter.toString(); formatter.close(); return result; } public static String encryptBase64(String input) { if (input == null) return null; try { byte[] encryptByte = input.getBytes(); Base64 base64 = new Base64(); encryptByte = base64.encode(encryptByte); return new String(encryptByte); } catch (Exception e) { throw new RuntimeException(e); } } public static String decodeBase64(String input) { if (input == null) return null; try { byte[] decodeByte = input.getBytes(); Base64 base64 = new Base64(); decodeByte = base64.decode(decodeByte); return new String(decodeByte); } catch (Exception e) { throw new RuntimeException(e); } } public static void close(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException e) { // ignore silently } } } public static byte[] serialize(Object obj) { if (obj == null) return null; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(obj); return bos.toByteArray(); } catch (Exception e) { throw new RuntimeException(e); } finally { try { if (out != null) out.close(); } catch (IOException ex) { // silently ignore } try { bos.close(); } catch (IOException ex) { // silently ignore } } } public static byte[] toBytes(String string) { try { return string == null ? null : string.getBytes("utf-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } public static String toStr(byte[] bytes) { return bytes == null ? null : new String(bytes); } public static <T> T deserialize(byte[] bytes) { ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ObjectInput in = null; try { in = new ObjectInputStream(bis); return (T) in.readObject(); } catch (Exception e) { throw new RuntimeException(e); } finally { try { bis.close(); } catch (IOException ex) { // silently ignore } try { if (in != null) { in.close(); } } catch (IOException ex) { // silently ignore } } } public static <T> T coalesce(T... args) { for (T arg : args) { if (arg != null) { return arg; } } return null; } public static Class<?> guessComponentType(List list) { if (list == null) return null; for (Object element : list) { if (element == null) continue; return element.getClass(); } return null; } public static Field getField(Class clazz, String fieldName) { try { return clazz.getDeclaredField(fieldName); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } } public static void inject(Object instance, String fieldName, Object fieldValue) { checkNull(instance, "instance"); checkString(fieldName, "fieldName"); checkNull(fieldValue, "fieldValue"); try { Field field = getField(instance.getClass(), fieldName); field.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); field.set(instance, fieldValue); } catch (Exception e) { throw new RuntimeException(e); } } public static String safeString(String s) { return s == null ? "" : s; } public static String safeGet(SolrDocument doc, String key) { return doc.get(key) != null ? doc.get(key).toString() : null; } public static String get32UUID() { return UUID.randomUUID().toString().trim().replaceAll("-", ""); } public static String generateToken(int length) { //length表示生成字符串的长度 String base = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random random = new Random(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { int number = random.nextInt(base.length()); sb.append(base.charAt(number)); } return sb.toString(); } }
[ "liufei" ]
liufei
19aef7282e8d1815205b891350a3b7ee8d2b3a97
bfd6ac4633e27423633f5b90e7e0601dde6d21d7
/test/com/oathouse/ccm/cma/booking/TestChildBookingModel_getPredictedBilling.java
4c4763ff97b377cfb667fd1dc0cc3fdfff0a1af3
[]
no_license
Gigas64/oathouse-toddlenomics-api
2e9f4350d57670353fc7f44b0a10ead45e7b6729
298fccfea077e06d66b1afce4bbdf31d8917af6b
refs/heads/master
2021-06-17T22:47:32.773864
2017-06-12T14:49:15
2017-06-12T14:49:15
94,106,260
0
0
null
null
null
null
UTF-8
Java
false
false
2,041
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.oathouse.ccm.cma.booking; // common imports import static com.oathouse.ccm.cma.VABoolean.*; import com.oathouse.ccm.cos.bookings.BTFlagIdBits; import com.oathouse.ccm.cos.bookings.BTIdBits; import com.oathouse.oss.storage.objectstore.ObjectDBMS; import com.oathouse.oss.storage.objectstore.BeanBuilder; import com.oathouse.oss.storage.objectstore.ObjectBean; import com.oathouse.oss.server.OssProperties; import com.oathouse.oss.storage.valueholder.CalendarStatic; import java.io.File; import java.util.*; import static java.util.Arrays.*; // Test Imports import mockit.*; import org.junit.*; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; /** * * @author Darryl Oatridge */ public class TestChildBookingModel_getPredictedBilling { @Before public void setUp() throws Exception { String authority = ObjectBean.SYSTEM_OWNED; String sep = File.separator; String rootStorePath = "." + sep + "oss" + sep + "data"; OssProperties props = OssProperties.getInstance(); props.setConnection(OssProperties.Connection.FILE); props.setStorePath(rootStorePath); props.setAuthority(authority); props.setLogConfigFile(rootStorePath + sep + "conf" + sep + "oss_log4j.properties"); // reset ObjectDBMS.clearAuthority(authority); // global instances } /* * run through all the method */ @Test public void test01_runThrough() throws Exception { final int accountId = 13; final int startYwd = CalendarStatic.getRelativeYW(0) + 2; final int endYwd = CalendarStatic.getRelativeYW(1) + 2; // TODO ChildBookingModel.getPredictedBilling(accountId, startYwd, endYwd, INCLUDE_EDUCATION, INCLUDE_ADJUSTMENTS, INCLUDE_LOYALTY,INCLUDE_LIVE_BOOKINGS); fail("Not yet implemented"); } }
e3f1a374cf3c1395b3ee767c206ab5ed71834656
6b4296c982f6562613f0138db19965046cd2ae77
/Menu.java
450e3078a5eaae10ad4100fe6ed68a9f49f37a8b
[]
no_license
hassammurtaza27/Project
8862070fb06946ca8f13e4731ee1ed1d0350d130
223d540ac4a2455111a1d83bf147dd20d77603d3
refs/heads/main
2023-06-11T17:38:17.331515
2021-06-28T18:55:38
2021-06-28T18:55:38
381,132,834
0
0
null
null
null
null
UTF-8
Java
false
false
1,444
java
public class Menu { private static final String line = "Enter 1, 2, 3 etc to select below options: "; public static void loginPage() { System.out.println(line); System.out.println("1- Login" + "\n2- Signup" + "\n3- Exit"); } public static void invalidLogin() { System.out.println("1- Login again" + "\n2- Back" + "\n3- Exit"); } public static void invalidSignup(String str) { System.out.println("Invalid " + str + "\n1- Re-enter " + str + "\n2- Back" + "\n3- Exit"); } public static void homePage() { System.out.println(line); System.out.println("1- EasyLoad" + "\n2- Mobile Packages" + "\n3- Transfer Money" + "\n4- Deposit Money" + "\n5- View Current Balance" + "\n6- Exit"); } public static void operatorPage() { System.out.println("Select Operator: \n"); System.out.println("1- Jazz" + "\n2- Telenor" + "\n3- Ufone" + "\n4- Zong"); } public static void durationPage() { System.out.println("1- Daily Offers" + "\n2- Weekly Offers" + "\n3- Monthly Offers"); } }
3d13579281768ce3ab613bfb31bcd57ce28c2d7b
9836f5cccd50cd7e2c4856c21efc3915190cc5d0
/src/com/codecool/minipa/Comment.java
258d38cf57301b94a7af2bc1ac6096cf2e880387
[]
no_license
silviurdr/java-mini-pa
ca69f16aa6ba9989c00e68edcf091d982481bdc8
0684efd2cf704db4d9c48e467c379cf560a13fec
refs/heads/master
2022-11-15T06:44:09.939541
2020-07-13T10:00:19
2020-07-13T10:00:19
279,135,557
0
0
null
null
null
null
UTF-8
Java
false
false
948
java
package com.codecool.minipa; public class Comment extends Entry { private int id; private static int currentCommentId = 0; private boolean moderated = false; public String message; public Comment(String message) { super(message); this.id = generateNextId(); this.message = message; } public boolean isModerated() { return moderated; } public int generateNextId() { return currentCommentId++; } public void toggleModerated() { if (this.moderated == false) { this.moderated = true; } else this.moderated = false; } public String getMessage() { return this.message; } public int getId() { return id; } @Override public String toString() { return ("The comment with id " + this.getId() + ": '" + this.getMessage() + "', with creation date: " + this.getCreationDate()); } }
782633dacab9d71e89d4061e56f65b736a5505bb
06e5045708bf2963af408dd78f053519b3d855e2
/main/java/scs2682/philipyoung/finalproject/nutritioninfo/ui/PickpagePeople.java
1c59b887654696e6e3185df87ec05d6a3a66656d
[]
no_license
pthaack/nutritionInfoDB
b17aa69ebb0c74d28121cbb8e3307fd198ea4d08
1544e3ab3f3d7c25f447eaf9e772a4dcc30beb88
refs/heads/master
2021-01-20T20:08:47.787546
2016-07-12T00:45:13
2016-07-12T00:45:13
63,112,522
1
0
null
null
null
null
UTF-8
Java
false
false
12,474
java
package scs2682.philipyoung.finalproject.nutritioninfo.ui; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.List; import scs2682.philipyoung.finalproject.nutritioninfo.ApplicationActivity; import scs2682.philipyoung.finalproject.nutritioninfo.R; public class PickpagePeople extends Fragment { public static final String NAME = PickpagePeople.class.getSimpleName(); private static final String PERSONS_PAGE_KEY = "persons"; private static final String PERSONS_ARRAY_KEY = "persons"; private static final String PERSONS_ELEMENT_KEY = "person"; private static final String FOOD_GUIDE_FOOD_FRUIT_VEG = "fruitandveg"; private static final String FOOD_GUIDE_FOOD_GRAINS = "grains"; private static final String FOOD_GUIDE_FOOD_DAIRY = "dairy"; private static final String FOOD_GUIDE_FOOD_MEAT = "meat"; private static final String FOOD_GUIDE_AGE1 = "toddler"; private static final String FOOD_GUIDE_AGE2 = "child"; private static final String FOOD_GUIDE_AGE3 = "youth"; private static final String FOOD_GUIDE_AGE4F = "womanteen"; private static final String FOOD_GUIDE_AGE5F = "womanadult"; private static final String FOOD_GUIDE_AGE6F = "womanelderly"; private static final String FOOD_GUIDE_AGE4M = "manteen"; private static final String FOOD_GUIDE_AGE5M = "manadult"; private static final String FOOD_GUIDE_AGE6M = "manelderly"; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return super.onCreateView(inflater, container, savedInstanceState); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); } @Override public void onDestroy() { super.onDestroy(); } /** * A function to return the number of adults and children in an array * @return */ public void setPeopleCount(TextView textView) { Integer[] pc = {0,0}; textView.setText(getString(R.string.nutrition_facts_people_count,pc[0],pc[1])); return; } /** * A function to return the number of servings by food group in an array. * @return */ public void setServingCount(TextView textView) { // Double[] sc = {0d,0d,0d,0d}; final SharedPreferences preferences = getActivity().getSharedPreferences(ApplicationActivity.NAME, Context.MODE_PRIVATE); final String strJperson = preferences.getString(PERSONS_PAGE_KEY, "{persons:" + "[{\"person\":0},{\"person\":0},{\"person\":0}" +",{\"person\":0},{\"person\":0},{\"person\":0}" +",{\"person\":0},{\"person\":0},{\"person\":0}" +",{\"person\":0},{\"person\":0},{\"person\":0}]}"); final String strJfoodGuide = "{\"fruitandveg\":{\"toddler\":4,\"child\":5,\"youth\":6,\"womanteen\":7,\"manteen\":8,\"womanadult\":7.5,\"manadult\":9,\"womanelderly\":7,\"manelderly\":7}," + "\"grains\":{\"toddler\":3,\"child\":4,\"youth\":6,\"womanteen\":6,\"manteen\":7,\"womanadult\":6.5,\"manadult\":8,\"womanelderly\":6,\"manelderly\":7}," + "\"dairy\":{\"toddler\":2,\"child\":2,\"youth\":3.5,\"womanteen\":3.5,\"manteen\":3.5,\"womanadult\":2,\"manadult\":2,\"womanelderly\":3,\"manelderly\":3}," + "\"meat\":{\"toddler\":1,\"child\":1,\"youth\":1.5,\"womanteen\":2,\"manteen\":3,\"womanadult\":2,\"manadult\":3,\"womanelderly\":2,\"manelderly\":3}}"; final JSONObject jsonObject; JSONObject jsonFoodGuide = null; final Double[] arrFoodGuide = new Double[]{0d,0d,0d,0d}; JSONArray jsonArray = null; Integer arrayLength = 0; try { jsonObject = new JSONObject(strJperson); jsonFoodGuide = new JSONObject(strJfoodGuide); jsonArray = jsonObject.optJSONArray(PERSONS_ARRAY_KEY); if( arrayLength != (jsonArray != null ? jsonArray.length():0) ) { arrayLength = 0; } } catch (JSONException e) { e.printStackTrace(); arrayLength = 0; } if( arrayLength>0 ){ for (Integer intI = 0 ; intI < arrayLength; intI++ ){ JSONObject objElement = jsonArray.optJSONObject(intI); // Get food guide values, too Double dblFV = 0d; Double dblG = 0d; Double dblD = 0d; Double dblM = 0d; switch ( intI ){ case 0: case 6: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE1); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE1); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE1); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE1); } catch (JSONException e) { e.printStackTrace(); } break; case 1: case 7: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE2); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE2); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE2); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE2); } catch (JSONException e) { e.printStackTrace(); } break; case 2: case 8: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE3); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE3); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE3); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE3); } catch (JSONException e) { e.printStackTrace(); } break; case 3: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE4F); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE4F); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE4F); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE4F); } catch (JSONException e) { e.printStackTrace(); } break; case 4: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE5F); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE5F); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE5F); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE5F); } catch (JSONException e) { e.printStackTrace(); } break; case 5: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE6F); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE6F); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE6F); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE6F); } catch (JSONException e) { e.printStackTrace(); } break; case 9: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE4M); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE4M); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE4M); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE4M); } catch (JSONException e) { e.printStackTrace(); } break; case 10: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE5M); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE5M); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE5M); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE5M); } catch (JSONException e) { e.printStackTrace(); } break; case 11: try { dblFV = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_FRUIT_VEG).getDouble(FOOD_GUIDE_AGE6M); dblG = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_GRAINS).getDouble(FOOD_GUIDE_AGE6M); dblD = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_DAIRY).getDouble(FOOD_GUIDE_AGE6M); dblM = jsonFoodGuide.getJSONObject(FOOD_GUIDE_FOOD_MEAT).getDouble(FOOD_GUIDE_AGE6M); } catch (JSONException e) { e.printStackTrace(); } break; default: dblFV = 0d; dblG = 0d; dblD = 0d; dblM = 0d; break; } arrFoodGuide[0] += dblFV * objElement.optInt(PERSONS_ELEMENT_KEY); arrFoodGuide[1] += dblG * objElement.optInt(PERSONS_ELEMENT_KEY); arrFoodGuide[2] += dblD * objElement.optInt(PERSONS_ELEMENT_KEY); arrFoodGuide[3] += dblM * objElement.optInt(PERSONS_ELEMENT_KEY); // Toast.makeText(getContext(), String.valueOf(dblFV), Toast.LENGTH_SHORT).show(); } } textView.setText(getString(R.string.nutrition_facts_servings_count,arrFoodGuide[0],arrFoodGuide[1],arrFoodGuide[2],arrFoodGuide[3])); return; } }
4585ba093690d458f41b48c63bc18860d064f9a1
0a41161cc7abc1720bf6c39c1ac7287e7fe99a9a
/src/com/platypus/gameserver/GameRegistrator.java
a8d9ee2a0e1da9c1121785b4d28fb0de6a971f72
[]
no_license
PlatypusK/numeral-pursuit-server
4eb812d6cb6f35b01601374e2db3ec11c5fdb020
3dc8ad2bd51b85faf80ec32e5e9268cc86ee1516
refs/heads/master
2020-06-22T04:14:08.008350
2017-06-13T12:55:17
2017-06-13T12:55:17
94,210,510
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package com.platypus.gameserver; import com.google.appengine.api.users.User; public class GameRegistrator { public void registerForRandomGame(final User user, final UserProfile profile) { final MemCacheWorker cache=new MemCacheWorker(); cache.putRandomRegisteredNoTime(profile); } }
9d1430c83289a6f2b8218a9e19af7685713ea753
9176e685a54ca1217105b2a4766b64f6aab20ab1
/singleton/src/com/singleModel/SingletonLazy.java
fc2cb697e91a66e6696dbda9796cb8994aba8326
[]
no_license
ljtrycatch/item
cc41ab78db71738d6ddc3490cf2479ff6d7e9364
aa4efd9b8737b4942bea3facf22c66e48aafdb5d
refs/heads/master
2023-05-05T19:30:27.440894
2021-05-27T09:25:56
2021-05-27T09:25:56
368,026,517
0
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
package com.singleModel; public class SingletonLazy { public static void main(String[] args){ President president = President.getInstance(); president.getName(); //输出总统的名字 President president1 = President.getInstance(); president1.getName(); if(president == president1){ System.out.println("他们是同一个人!"); }else{ System.out.println("他们不是同一个人!"); } } } class President{ private static volatile President instance = null; //保正instance在所有线程中同步 //private 避免类在外部实例化 private President(){ System.out.println("产生一个总统"); } public static synchronized President getInstance(){ if(instance==null){ instance=new President(); }else{ System.out.println("已经有一个总统了,不用产生"); } return instance; } public void getName(){ System.out.println("我是美国总统:特朗普"); } }
a546565c9245ef530980aece7c03df476d43bd81
de0832d851af29a5446910f7da7c18506fae06b4
/app/src/main/java/com/mcdev/memery/Adapters/ViewpagerAdapter.java
8fe45172ab46dfc089197aa9d37eaef7f055c180
[]
no_license
kojofosu/Memery
56e6fac320505a2b3c941ac5bd5927fb9dca1b5e
cba8dd8d77efccfe2a0fd14a9f7c684e8b237717
refs/heads/master
2023-04-19T21:28:06.530649
2021-05-13T13:51:21
2021-05-13T13:51:21
253,793,034
0
0
null
null
null
null
UTF-8
Java
false
false
1,543
java
package com.mcdev.memery.Adapters; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import com.mcdev.memery.HomeFragment; import com.mcdev.memery.SaveFragment; import com.mcdev.memery.ProfileFragment; public class ViewpagerAdapter extends FragmentPagerAdapter { private String url; public ViewpagerAdapter(@NonNull FragmentManager fm, int behavior) { super(fm, behavior); } public ViewpagerAdapter(@NonNull FragmentManager fm, int behavior, String url) { super(fm, behavior); this.url = url; } @NonNull @Override public Fragment getItem(int position) { switch (position){ case 0: return new HomeFragment(); //creating instance of Home Fragment case 1: // return new SaveFragment(); //creating instance of Save Fragment SaveFragment saveFragment = new SaveFragment(); Bundle bundle = new Bundle(); bundle.putString("tweetURL", url); // set Fragmentclass Arguments saveFragment.setArguments(bundle); return saveFragment; case 2: return new ProfileFragment(); //creating instance of Profile Fragment } return null; } @Override public int getCount() { return 3; //Three fragments } }
30bc1e61dba73e7b2c652748952a44006e02e3c7
cf9b167b6d73305eb7cb37712bc70fb8b2f60175
/minecraft/net/minecraft/client/multiplayer/ServerList.java
faa9adac61ec1f8f60df49e7960b4f4d168eb305
[]
no_license
Capsar/Rapture
b1ef74dfceb005b291e695605f83839dc25d1c9e
b73f53f22eb1caed44e39e4a026eac5cda7b41fc
refs/heads/master
2021-06-12T20:06:53.100425
2020-04-09T14:13:47
2020-04-09T14:13:47
254,388,305
5
2
null
null
null
null
UTF-8
Java
false
false
4,229
java
package net.minecraft.client.multiplayer; import com.google.common.collect.Lists; import java.io.File; import java.util.Iterator; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class ServerList { private static final Logger logger = LogManager.getLogger(); /** The Minecraft instance. */ private final Minecraft mc; /** List of ServerData instances. */ private final List servers = Lists.newArrayList(); public ServerList(Minecraft mcIn) { this.mc = mcIn; this.loadServerList(); } /** * Loads a list of servers from servers.dat, by running ServerData.getServerDataFromNBTCompound on each NBT compound * found in the "servers" tag list. */ public void loadServerList() { try { this.servers.clear(); NBTTagCompound var1 = CompressedStreamTools.read(new File(this.mc.mcDataDir, "servers.dat")); if (var1 == null) { return; } NBTTagList var2 = var1.getTagList("servers", 10); for (int var3 = 0; var3 < var2.tagCount(); ++var3) { this.servers.add(ServerData.getServerDataFromNBTCompound(var2.getCompoundTagAt(var3))); } } catch (Exception var4) { logger.error("Couldn\'t load server list", var4); } } /** * Runs getNBTCompound on each ServerData instance, puts everything into a "servers" NBT list and writes it to * servers.dat. */ public void saveServerList() { try { NBTTagList var1 = new NBTTagList(); Iterator var2 = this.servers.iterator(); while (var2.hasNext()) { ServerData var3 = (ServerData)var2.next(); var1.appendTag(var3.getNBTCompound()); } NBTTagCompound var5 = new NBTTagCompound(); var5.setTag("servers", var1); CompressedStreamTools.safeWrite(var5, new File(this.mc.mcDataDir, "servers.dat")); } catch (Exception var4) { logger.error("Couldn\'t save server list", var4); } } /** * Gets the ServerData instance stored for the given index in the list. */ public ServerData getServerData(int p_78850_1_) { return (ServerData)this.servers.get(p_78850_1_); } /** * Removes the ServerData instance stored for the given index in the list. */ public void removeServerData(int p_78851_1_) { this.servers.remove(p_78851_1_); } /** * Adds the given ServerData instance to the list. */ public void addServerData(ServerData p_78849_1_) { this.servers.add(p_78849_1_); } /** * Counts the number of ServerData instances in the list. */ public int countServers() { return this.servers.size(); } /** * Takes two list indexes, and swaps their order around. */ public void swapServers(int p_78857_1_, int p_78857_2_) { ServerData var3 = this.getServerData(p_78857_1_); this.servers.set(p_78857_1_, this.getServerData(p_78857_2_)); this.servers.set(p_78857_2_, var3); this.saveServerList(); } public void func_147413_a(int p_147413_1_, ServerData p_147413_2_) { this.servers.set(p_147413_1_, p_147413_2_); } public static void func_147414_b(ServerData p_147414_0_) { ServerList var1 = new ServerList(Minecraft.getMinecraft()); var1.loadServerList(); for (int var2 = 0; var2 < var1.countServers(); ++var2) { ServerData var3 = var1.getServerData(var2); if (var3.serverName.equals(p_147414_0_.serverName) && var3.serverIP.equals(p_147414_0_.serverIP)) { var1.func_147413_a(var2, p_147414_0_); break; } } var1.saveServerList(); } }
217a59f13f5da21daa1d2e8293b097645f105e6d
9ad8856b34940a798221ff60fa55cb5dc55fe0ff
/src/main/java/com/devin/project/system/post/service/IPostService.java
2ba848f3b1cce36a381a20abb5099e5515ea25e3
[ "MIT" ]
permissive
devindage/devin
dd7521ce7eab109b880b8d648993e834e0899790
d167a300d1fe3ba1c67a03cfa34a0743059dfffe
refs/heads/master
2020-03-27T15:33:25.299845
2018-09-26T10:16:08
2018-09-26T10:16:08
138,721,272
2
0
null
null
null
null
UTF-8
Java
false
false
1,839
java
package com.devin.project.system.post.service; import java.util.List; import com.devin.project.system.post.domain.Post; /** * 岗位信息 服务层 * * @author devin */ public interface IPostService { /** * 查询岗位信息集合 * * @param post 岗位信息 * @return 岗位信息集合 */ public List<Post> selectPostList(Post post); /** * 查询所有岗位 * * @return 岗位列表 */ public List<Post> selectPostAll(); /** * 根据用户ID查询岗位 * * @param userId 用户ID * @return 岗位列表 */ public List<Post> selectPostsByUserId(Long userId); /** * 通过岗位ID查询岗位信息 * * @param postId 岗位ID * @return 角色对象信息 */ public Post selectPostById(Long postId); /** * 批量删除岗位信息 * * @param ids 需要删除的数据ID * @return 结果 * @throws Exception 异常 */ public int deletePostByIds(String ids) throws Exception; /** * 新增保存岗位信息 * * @param post 岗位信息 * @return 结果 */ public int insertPost(Post post); /** * 修改保存岗位信息 * * @param post 岗位信息 * @return 结果 */ public int updatePost(Post post); /** * 通过岗位ID查询岗位使用数量 * * @param postId 岗位ID * @return 结果 */ public int countUserPostById(Long postId); /** * 校验岗位名称 * * @param post 岗位信息 * @return 结果 */ public String checkPostNameUnique(Post post); /** * 校验岗位编码 * * @param post 岗位信息 * @return 结果 */ public String checkPostCodeUnique(Post post); }
4f003adf84b6e4d450e37ad9d288a9651c7ba32a
3a15a1e75ac7a03afbfb13674c684dae6d2c423e
/app/src/main/java/nl/hva/msi/bucketlist/BucketItemRoomDatabase.java
d438cd2a565ef9d6f7b7fc1494a559266e3da892
[]
no_license
Maicelicious/Level_4_Assignment_BucketList
0a4544fefa204eb171037707f0f1cadcb871d5aa
d59692411891436ad9f804102b6fe46b8160c4fe
refs/heads/master
2020-04-28T04:50:48.655753
2019-03-11T12:35:53
2019-03-11T12:35:53
174,996,343
0
0
null
null
null
null
UTF-8
Java
false
false
1,080
java
package nl.hva.msi.bucketlist; import android.arch.persistence.room.Database; import android.arch.persistence.room.Room; import android.arch.persistence.room.RoomDatabase; import android.content.Context; @Database(entities = {BucketListItem.class}, version = 1, exportSchema = false) public abstract class BucketItemRoomDatabase extends RoomDatabase { private final static String NAME_DATABASE = "item_database"; public abstract BucketItemDao itemDao(); private static volatile BucketItemRoomDatabase INSTANCE; protected static BucketItemRoomDatabase getDatabase(final Context context) { if (INSTANCE == null) { synchronized (BucketItemRoomDatabase.class) { if (INSTANCE == null) { // Create database here INSTANCE = Room.databaseBuilder(context.getApplicationContext(), BucketItemRoomDatabase.class, NAME_DATABASE).allowMainThreadQueries() .build(); } } } return INSTANCE; } }
6f54caf743286f5c5098b41371fd35b2e98d8be7
4f837f5842781a27144ee4a1d75569b258a945fe
/src/main/java/uk/ac/leeds/ccg/projects/fire/data/F_Data0.java
4cb99e0beba04ec62cc9ebb66fa150f2df65531d
[ "Apache-2.0" ]
permissive
agdturner/agdt-java-project-fire
8eb0ae3292cae49dfb9474553024aabb0b50dfc3
e849fa23e0cb6d950f892161dc9cd1db8c1994bb
refs/heads/main
2023-07-09T09:38:01.623526
2023-06-28T10:45:41
2023-06-28T10:45:41
315,899,502
0
0
null
null
null
null
UTF-8
Java
false
false
6,116
java
/* * Copyright 2021 Andy Turner, CCG, University of Leeds. * * 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 uk.ac.leeds.ccg.projects.fire.data; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import uk.ac.leeds.ccg.projects.fire.core.F_Environment; import uk.ac.leeds.ccg.projects.fire.core.F_Object; import uk.ac.leeds.ccg.projects.fire.core.F_Strings; import uk.ac.leeds.ccg.projects.fire.id.F_CollectionID; import uk.ac.leeds.ccg.projects.fire.id.F_RecordID; import uk.ac.leeds.ccg.generic.io.Generic_FileStore; import uk.ac.leeds.ccg.generic.io.Generic_IO; /** * F_Data * * @author Andy Turner * @version 1.0.0 */ public class F_Data0 extends F_Object { private static final long serialVersionUID = 1L; public final Generic_FileStore fs; /** * The main data store. Keys are Collection IDs. */ public Map<F_CollectionID, F_Collection0> data; /** * The main data store. Keys are Collection IDs. */ public Map<F_CollectionID, Set<F_RecordID>> cID2recIDs; /** * The main data store. Keys are Collection IDs. */ public Map<F_RecordID, F_CollectionID> recID2cID; /** * * @param cid * @return * @throws IOException * @throws ClassNotFoundException */ public F_Collection0 getCollection(F_CollectionID cid) throws IOException, ClassNotFoundException { F_Collection0 r = data.get(cid); if (r == null) { r = loadCollection(cid); data.put(cid, r); } return r; } public void clearCollection(F_CollectionID cid) { data.put(cid, null); } public F_Data0(F_Environment env) throws IOException, Exception { super(env); String name = "Collections0"; Path dir = env.files.getGeneratedDir(); Path p = Paths.get(dir.toString(), name); if (Files.exists(p)) { fs = new Generic_FileStore(p); } else { short n = 100; fs = new Generic_FileStore(p.getParent(), name, n); } data = new HashMap<>(); cID2recIDs = new HashMap<>(); recID2cID = new HashMap<>(); } public boolean clearSomeData() throws IOException { Iterator<F_CollectionID> ite = data.keySet().iterator(); while (ite.hasNext()) { F_CollectionID cid = ite.next(); F_Collection0 c = data.get(cid); cacheCollection(cid, c); data.put(cid, null); return true; } return false; } public int clearAllData() throws IOException { int r = 0; Iterator<F_CollectionID> ite = data.keySet().iterator(); while (ite.hasNext()) { F_CollectionID cid = ite.next(); F_Collection0 c = data.get(cid); cacheCollection(cid, c); data.put(cid, null); r++; } return r; } /** * * @param cid the F_CollectionID * @param c the F_Collection0 * @throws java.io.IOException */ public void cacheCollection(F_CollectionID cid, F_Collection0 c) throws IOException { cache(getCollectionPath(cid), c); } public Path getCollectionPath(F_CollectionID cid) throws IOException { return Paths.get(fs.getPath(cid.id).toString(), F_Strings.s_F + cid.id + F_Strings.symbol_dot + F_Strings.s_dat); } /** * * @param cid The F_CollectionID * @return * @throws java.io.IOException * @throws java.lang.ClassNotFoundException */ public F_Collection0 loadCollection(F_CollectionID cid) throws IOException, ClassNotFoundException { F_Collection0 r = (F_Collection0) load(getCollectionPath(cid)); r.env = env; return r; } /** * * @param f the Path to load from. * @return * @throws java.io.IOException If encountered. * @throws java.lang.ClassNotFoundException If encountered. */ protected Object load(Path f) throws IOException, ClassNotFoundException { String m = "load " + f.toString(); env.logStartTag(m); Object r = Generic_IO.readObject(f); env.logEndTag(m); return r; } /** * * @throws java.io.IOException */ public void swapCollections() throws IOException { data.keySet().stream().forEach(i -> { try { F_Collection0 c = data.get(i); if (c != null) { cacheCollection(i, data.get(i)); data.put(i, null); } } catch (IOException ex) { throw new RuntimeException(ex.getMessage()); } }); // Iterator<F_CollectionID> ite = data.keySet().iterator(); // while (ite.hasNext()) { // F_CollectionID cid = ite.next(); // F_Collection0 c = data.get(cid); // cacheCollection(cid, c); // data.put(cid, null); // } } /** * * @param f the value of cf * @param o the value of o * @throws java.io.IOException If encountered. */ protected void cache(Path f, Object o) throws IOException { String m = "cache " + f.toString(); env.logStartTag(m); Files.createDirectories(f.getParent()); Generic_IO.writeObject(o, f); env.logEndTag(m); } }
931ea190479a014b067eb28805b1d322cba7ebbb
399b5edc1186d6664996e0b2f71ac86c1b000a44
/java/admin/src/main/java/com/wangzhf/auth/security/config/auth/domain/AccountCredentials.java
bb38e54b8d1c377d5adc78fa197056db185ccaa2
[]
no_license
wangzhf/learning
9975a3e7454516cf663501be122eaf70a2881ea3
ad9fa876da8731b65ccb05b3fa8bcce3d3574596
refs/heads/master
2020-03-16T22:11:47.855918
2018-12-10T15:27:17
2018-12-10T15:27:17
133,030,187
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package com.wangzhf.auth.security.config.auth.domain; public class AccountCredentials { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
b6da91c87b4624849c6e566a64811b4ec9628f4d
c2b612719ead35bdaab4150f5286a9942c16077f
/ts-sys/tss.core/src/main/java/org/aming/config/ErrorConfig.java
7e29357c06d728e57e5f670e20a46cafe59f416e
[]
no_license
damingerdai/tss
924764fa49c7366275cd08d670bcf5ed5c475b0b
b14240f84424ee694551a3273225c795bb9c746a
refs/heads/master
2021-05-04T20:38:13.126132
2018-03-08T12:11:39
2018-03-08T12:11:39
119,828,482
0
0
null
null
null
null
UTF-8
Java
false
false
767
java
package org.aming.config; import org.aming.tss.base.props.ErrorProp; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PropertiesLoaderUtils; import java.io.IOException; import java.util.Properties; /** * @author daming * @version 2018/2/4. */ @Configuration public class ErrorConfig { @Bean public ErrorProp errorProp() throws IOException { Resource resource = new ClassPathResource("errorcode.properties"); Properties properties = PropertiesLoaderUtils.loadProperties(resource); return new ErrorProp(properties); } }
d762a8c6b48cc27dea894a45111a777b4bac7a18
c38ec27cacd004bc729a527308c0513350ddcbd7
/trunk/NG7qa/src/com/nextgen/qa/automation/toolbox/IOutils.java
670601217ebc2c22041fc68999361e6b036a2f33
[]
no_license
asujata-123/NG
ddf2f15600c8c5fbf038addfa47755ccae460799
a0e3edf545b976598b3c06c3c147b8571524a0e9
refs/heads/master
2021-01-01T05:04:57.527937
2016-05-23T16:37:47
2016-05-23T16:37:47
59,499,454
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
/* * generic class to get input stream and loading properties */ package com.nextgen.qa.automation.toolbox; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class IOutils { public IOutils() { } /* * */ public static InputStream getInputStream(String file) { InputStream input = null; try { input = new FileInputStream(file); } catch (IOException ex) { ex.printStackTrace(); } return input; } }
[ "Sujata Avirneni" ]
Sujata Avirneni
41bd76334f35927d2bb81814d07735d38206eb8c
0e583a6cdcc82eabec05149a75f5a6edae1ceaad
/demo4/SpringS3Amazon/src/main/java/com/grokonez/s3/services/S3Services.java
35778af7ea36f204f5daa35e3f12da42c75efb44
[]
no_license
hathienvan58770769/demo
6140c9df90fdd7b4cfa050b49b64998488aa066a
19cbd43031737ca83b4fc6983d9f86f4bc5b3dd8
refs/heads/master
2023-01-25T01:53:37.074755
2019-10-25T03:18:49
2019-10-25T03:18:49
204,607,873
0
0
null
2019-08-27T11:54:02
2019-08-27T03:00:17
null
UTF-8
Java
false
false
351
java
package com.grokonez.s3.services; import java.io.ByteArrayOutputStream; import java.util.List; import org.springframework.web.multipart.MultipartFile; public interface S3Services { public ByteArrayOutputStream downloadFile(String keyName); public void uploadFile(String keyName, MultipartFile file); public List<String> listFiles(); }
7875b003d4d60d8b256a796565d03df0b49ef90e
ecc72ed73b136200b24a5989ae3a75735be816fd
/src/edu/dlf/refactoring/change/calculator/statement/EnhancedForStatementChangeCalculator.java
50eab6ae18b4a2d4440cb22e078ee9a596f2b909
[]
no_license
DeveloperLiberationFront/edu.dlf.refactoring.review
cb7f38eff924d6cd229ccd268036b476e7f184f1
f7ff2131d8e64e010121484151cd21e77b59dbfa
refs/heads/master
2021-01-14T11:23:03.496681
2014-01-13T01:09:42
2014-01-13T01:09:42
27,999,670
0
0
null
null
null
null
UTF-8
Java
false
false
2,658
java
package edu.dlf.refactoring.change.calculator.statement; import org.apache.log4j.Logger; import org.eclipse.jdt.core.dom.EnhancedForStatement; import com.google.inject.Inject; import edu.dlf.refactoring.change.ChangeBuilder; import edu.dlf.refactoring.change.ChangeComponentInjector.EnhancedForStatementAnnotation; import edu.dlf.refactoring.change.ChangeComponentInjector.ExpressionAnnotation; import edu.dlf.refactoring.change.ChangeComponentInjector.SingleVariableDeclarationAnnotation; import edu.dlf.refactoring.change.ChangeComponentInjector.StatementAnnotation; import edu.dlf.refactoring.change.IASTNodeChangeCalculator; import edu.dlf.refactoring.change.SourceChangeUtils; import edu.dlf.refactoring.change.SubChangeContainer; import edu.dlf.refactoring.design.ASTNodePair; import edu.dlf.refactoring.design.ISourceChange; import fj.F; public class EnhancedForStatementChangeCalculator implements IASTNodeChangeCalculator{ private final Logger logger; private final ChangeBuilder changeBuilder; private final F<ASTNodePair, ISourceChange> statementCal; private final F<ASTNodePair, ISourceChange> expressionCal; private final F<ASTNodePair, ISourceChange> singleVariableCal; @Inject public EnhancedForStatementChangeCalculator( Logger logger, @EnhancedForStatementAnnotation String changeLV, @SingleVariableDeclarationAnnotation IASTNodeChangeCalculator singleVariableCal, @StatementAnnotation IASTNodeChangeCalculator statementCal, @ExpressionAnnotation IASTNodeChangeCalculator expressionCal) { this.logger = logger; this.changeBuilder = new ChangeBuilder(changeLV); this.singleVariableCal = ASTNodePair.splitPairFunc.andThen(SourceChangeUtils. getChangeCalculationFunc(singleVariableCal).tuple()); this.statementCal = ASTNodePair.splitPairFunc.andThen(SourceChangeUtils. getChangeCalculationFunc(statementCal).tuple()); this.expressionCal = ASTNodePair.splitPairFunc.andThen(SourceChangeUtils. getChangeCalculationFunc(expressionCal).tuple()); } @Override public ISourceChange CalculateASTNodeChange(ASTNodePair pair) { ISourceChange change = changeBuilder.buildSimpleChange(pair); if(change != null) return change; SubChangeContainer container = changeBuilder.createSubchangeContainer(pair); container.addSubChange(singleVariableCal.f(pair.selectByPropertyDescriptor (EnhancedForStatement.PARAMETER_PROPERTY))); container.addSubChange(expressionCal.f(pair.selectByPropertyDescriptor (EnhancedForStatement.EXPRESSION_PROPERTY))); container.addSubChange(statementCal.f(pair.selectByPropertyDescriptor (EnhancedForStatement.BODY_PROPERTY))); return container; } }
1aaf9bb8eb63c4ee25df261a3fae93d2e99538b9
ef3632a70d37cfa967dffb3ddfda37ec556d731c
/aws-java-sdk-guardduty/src/main/java/com/amazonaws/services/guardduty/model/transform/ServiceJsonUnmarshaller.java
00d9a91520ccd6443d19963557efb0320f7c20ad
[ "Apache-2.0" ]
permissive
ShermanMarshall/aws-sdk-java
5f564b45523d7f71948599e8e19b5119f9a0c464
482e4efb50586e72190f1de4e495d0fc69d9816a
refs/heads/master
2023-01-23T16:35:51.543774
2023-01-19T03:21:46
2023-01-19T03:21:46
134,658,521
0
0
Apache-2.0
2019-06-12T21:46:58
2018-05-24T03:54:38
Java
UTF-8
Java
false
false
5,513
java
/* * Copyright 2018-2023 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.guardduty.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.guardduty.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * Service JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ServiceJsonUnmarshaller implements Unmarshaller<Service, JsonUnmarshallerContext> { public Service unmarshall(JsonUnmarshallerContext context) throws Exception { Service service = new Service(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("action", targetDepth)) { context.nextToken(); service.setAction(ActionJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("evidence", targetDepth)) { context.nextToken(); service.setEvidence(EvidenceJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("archived", targetDepth)) { context.nextToken(); service.setArchived(context.getUnmarshaller(Boolean.class).unmarshall(context)); } if (context.testExpression("count", targetDepth)) { context.nextToken(); service.setCount(context.getUnmarshaller(Integer.class).unmarshall(context)); } if (context.testExpression("detectorId", targetDepth)) { context.nextToken(); service.setDetectorId(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("eventFirstSeen", targetDepth)) { context.nextToken(); service.setEventFirstSeen(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("eventLastSeen", targetDepth)) { context.nextToken(); service.setEventLastSeen(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("resourceRole", targetDepth)) { context.nextToken(); service.setResourceRole(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("serviceName", targetDepth)) { context.nextToken(); service.setServiceName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("userFeedback", targetDepth)) { context.nextToken(); service.setUserFeedback(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("additionalInfo", targetDepth)) { context.nextToken(); service.setAdditionalInfo(ServiceAdditionalInfoJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("featureName", targetDepth)) { context.nextToken(); service.setFeatureName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("ebsVolumeScanDetails", targetDepth)) { context.nextToken(); service.setEbsVolumeScanDetails(EbsVolumeScanDetailsJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return service; } private static ServiceJsonUnmarshaller instance; public static ServiceJsonUnmarshaller getInstance() { if (instance == null) instance = new ServiceJsonUnmarshaller(); return instance; } }
[ "" ]
bda1dd900e407c9762c9294e5c506f29b6bced25
fd2770bfda048a9f04c2c0f37dfece970a146343
/src/com/lawer/domain/SystemConfig.java
7acfc0d3d63c0c510be97d5dc8fbd706ffb87078
[]
no_license
bjzhaosq/YourCare
990c24e591c1bc6c45ab9b05253549ef0a8705ab
177f6df66410ced80bbc8eef5d25d19465b87d03
refs/heads/master
2021-07-15T00:40:31.595480
2017-10-20T08:14:09
2017-10-20T08:14:09
107,236,859
2
0
null
null
null
null
UTF-8
Java
false
false
1,434
java
package com.lawer.domain; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * The persistent class for the system database table. * */ @Entity @Table(name="system") public class SystemConfig implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id; private String name; private String nid; private String status; private int style; private int type; private String value; public SystemConfig() { } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getNid() { return this.nid; } public void setNid(String nid) { this.nid = nid; } public String getStatus() { return this.status; } public void setStatus(String status) { this.status = status; } public int getStyle() { return this.style; } public void setStyle(int style) { this.style = style; } public int getType() { return this.type; } public void setType(int type) { this.type = type; } public String getValue() { return this.value; } public void setValue(String value) { this.value = value; } }