blob_id stringlengths 40 40 | __id__ int64 225 39,780B | directory_id stringlengths 40 40 | path stringlengths 6 313 | content_id stringlengths 40 40 | detected_licenses list | license_type stringclasses 2
values | repo_name stringlengths 6 132 | repo_url stringlengths 25 151 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 70 | visit_date timestamp[ns] | revision_date timestamp[ns] | committer_date timestamp[ns] | github_id int64 7.28k 689M ⌀ | star_events_count int64 0 131k | fork_events_count int64 0 48k | gha_license_id stringclasses 23
values | gha_fork bool 2
classes | gha_event_created_at timestamp[ns] | gha_created_at timestamp[ns] | gha_updated_at timestamp[ns] | gha_pushed_at timestamp[ns] | gha_size int64 0 40.4M ⌀ | gha_stargazers_count int32 0 112k ⌀ | gha_forks_count int32 0 39.4k ⌀ | gha_open_issues_count int32 0 11k ⌀ | gha_language stringlengths 1 21 ⌀ | gha_archived bool 2
classes | gha_disabled bool 1
class | content stringlengths 7 4.37M | src_encoding stringlengths 3 16 | language stringclasses 1
value | length_bytes int64 7 4.37M | extension stringclasses 24
values | filename stringlengths 4 174 | language_id stringclasses 1
value | entities list | contaminating_dataset stringclasses 0
values | malware_signatures list | redacted_content stringlengths 7 4.37M | redacted_length_bytes int64 7 4.37M | alphanum_fraction float32 0.25 0.94 | alpha_fraction float32 0.25 0.94 | num_lines int32 1 84k | avg_line_length float32 0.76 99.9 | std_line_length float32 0 220 | max_line_length int32 5 998 | is_vendor bool 2
classes | is_generated bool 1
class | max_hex_length int32 0 319 | hex_fraction float32 0 0.38 | max_unicode_length int32 0 408 | unicode_fraction float32 0 0.36 | max_base64_length int32 0 506 | base64_fraction float32 0 0.5 | avg_csv_sep_count float32 0 4 | is_autogen_header bool 1
class | is_empty_html bool 1
class | shard stringclasses 16
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9fd5ebe87f716f72973ed9e886c495a2220c9256 | 10,849,087,411,743 | 75b80962a754806ebbdcf7da3abbd73e5165ec9f | /springbootDemo/src/test/java/com/example/lf/springbootDemo/TestStrings.java | 414b27c4de192eac107d82ab1648a091bfc0522c | [] | no_license | tianya1991/learn | https://github.com/tianya1991/learn | 3722ad7cf62b15761df0ad4482828c7fbb2f6b20 | 9293095e65cb15b418bd2a4704cadd1bb7ef3787 | refs/heads/master | 2022-10-30T14:56:46.184000 | 2021-04-12T15:43:43 | 2021-04-12T15:43:43 | 270,900,547 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.lf.springbootDemo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.concurrent.TimeUnit;
/**
* @createTime:2021/03/28 0:44
* @author:luofeng30850
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = SpringbootDemoApplication.class)
public class TestStrings {
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Test
public void testStrings() {
String redisKey = "test:count";
redisTemplate.opsForValue().set(redisKey, 901);
System.out.println(redisTemplate.opsForValue().get(redisKey));
System.out.println(redisTemplate.opsForValue().increment(redisKey));
System.out.println(redisTemplate.opsForValue().decrement(redisKey));
}
@Test
public void testHashes() {
String redisKey = "test:user";
redisTemplate.opsForHash().put(redisKey, "id", 1);
redisTemplate.opsForHash().put(redisKey, "userName", "张三");
redisTemplate.opsForHash().put(redisKey, "address", "广州市");
System.out.println(redisTemplate.opsForHash().get(redisKey, "id"));
System.out.println(redisTemplate.opsForHash().get(redisKey, "userName"));
System.out.println(redisTemplate.opsForHash().get(redisKey, "address"));
}
@Test
public void testLists() {
String redisKey = "test:ids";
redisTemplate.opsForList().leftPush(redisKey, 101);
redisTemplate.opsForList().leftPush(redisKey, 102);
redisTemplate.opsForList().rightPush(redisKey, 103);
//
System.out.println(redisTemplate.opsForList().range(redisKey, 0, -1));
// System.out.println(redisTemplate.opsForList().size(redisKey));
// System.out.println(redisTemplate.opsForList().index(redisKey, 0));
// System.out.println(redisTemplate.opsForList().range(redisKey, 0, 2));
//
// System.out.println(redisTemplate.opsForList().leftPop(redisKey));
// System.out.println(redisTemplate.opsForList().leftPop(redisKey));
// System.out.println(redisTemplate.opsForList().leftPop(redisKey));
}
@Test
public void testSets() {
String redisKey = "test:teachers";
redisTemplate.opsForSet().add(redisKey, "关羽", "刘备", "张飞");
System.out.println(redisTemplate.opsForSet().size(redisKey));
System.out.println(redisTemplate.opsForSet().pop(redisKey));
System.out.println(redisTemplate.opsForSet().members(redisKey));
}
@Test
public void testSortedSets() {
String redisKey = "test:students";
redisTemplate.opsForZSet().add(redisKey, "唐僧", 80);
redisTemplate.opsForZSet().add(redisKey, "悟空", 90);
redisTemplate.opsForZSet().add(redisKey, "八戒", 50);
redisTemplate.opsForZSet().add(redisKey, "沙僧", 70);
redisTemplate.opsForZSet().add(redisKey, "白龙马", 60);
System.out.println(redisTemplate.opsForZSet().zCard(redisKey));
System.out.println(redisTemplate.opsForZSet().score(redisKey, "八戒"));
System.out.println(redisTemplate.opsForZSet().reverseRank(redisKey, "八戒"));
System.out.println(redisTemplate.opsForZSet().reverseRange(redisKey, 0, 2));
}
@Test
public void testKeys() {
redisTemplate.delete("test:user");
System.out.println(redisTemplate.hasKey("test:user"));
redisTemplate.expire("test:students", 10, TimeUnit.SECONDS);
}
@Test
public void testBoundOperations() {
String redisKey = "test:count";
BoundValueOperations operations = redisTemplate.boundValueOps(redisKey);
operations.increment();
operations.increment();
operations.increment();
operations.increment();
operations.increment();
operations.increment();
System.out.println(operations.get());
}
}
| UTF-8 | Java | 4,262 | java | TestStrings.java | Java | [
{
"context": "t;\n\n/**\n * @createTime:2021/03/28 0:44\n * @author:luofeng30850\n */\n@RunWith(SpringRunner.class)\n@SpringBootTest\n",
"end": 564,
"score": 0.9996547102928162,
"start": 552,
"tag": "USERNAME",
"value": "luofeng30850"
},
{
"context": " redisTemplate.opsForHash... | null | [] | package com.example.lf.springbootDemo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.concurrent.TimeUnit;
/**
* @createTime:2021/03/28 0:44
* @author:luofeng30850
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = SpringbootDemoApplication.class)
public class TestStrings {
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Test
public void testStrings() {
String redisKey = "test:count";
redisTemplate.opsForValue().set(redisKey, 901);
System.out.println(redisTemplate.opsForValue().get(redisKey));
System.out.println(redisTemplate.opsForValue().increment(redisKey));
System.out.println(redisTemplate.opsForValue().decrement(redisKey));
}
@Test
public void testHashes() {
String redisKey = "test:user";
redisTemplate.opsForHash().put(redisKey, "id", 1);
redisTemplate.opsForHash().put(redisKey, "userName", "张三");
redisTemplate.opsForHash().put(redisKey, "address", "广州市");
System.out.println(redisTemplate.opsForHash().get(redisKey, "id"));
System.out.println(redisTemplate.opsForHash().get(redisKey, "userName"));
System.out.println(redisTemplate.opsForHash().get(redisKey, "address"));
}
@Test
public void testLists() {
String redisKey = "test:ids";
redisTemplate.opsForList().leftPush(redisKey, 101);
redisTemplate.opsForList().leftPush(redisKey, 102);
redisTemplate.opsForList().rightPush(redisKey, 103);
//
System.out.println(redisTemplate.opsForList().range(redisKey, 0, -1));
// System.out.println(redisTemplate.opsForList().size(redisKey));
// System.out.println(redisTemplate.opsForList().index(redisKey, 0));
// System.out.println(redisTemplate.opsForList().range(redisKey, 0, 2));
//
// System.out.println(redisTemplate.opsForList().leftPop(redisKey));
// System.out.println(redisTemplate.opsForList().leftPop(redisKey));
// System.out.println(redisTemplate.opsForList().leftPop(redisKey));
}
@Test
public void testSets() {
String redisKey = "test:teachers";
redisTemplate.opsForSet().add(redisKey, "关羽", "刘备", "张飞");
System.out.println(redisTemplate.opsForSet().size(redisKey));
System.out.println(redisTemplate.opsForSet().pop(redisKey));
System.out.println(redisTemplate.opsForSet().members(redisKey));
}
@Test
public void testSortedSets() {
String redisKey = "test:students";
redisTemplate.opsForZSet().add(redisKey, "唐僧", 80);
redisTemplate.opsForZSet().add(redisKey, "悟空", 90);
redisTemplate.opsForZSet().add(redisKey, "八戒", 50);
redisTemplate.opsForZSet().add(redisKey, "沙僧", 70);
redisTemplate.opsForZSet().add(redisKey, "白龙马", 60);
System.out.println(redisTemplate.opsForZSet().zCard(redisKey));
System.out.println(redisTemplate.opsForZSet().score(redisKey, "八戒"));
System.out.println(redisTemplate.opsForZSet().reverseRank(redisKey, "八戒"));
System.out.println(redisTemplate.opsForZSet().reverseRange(redisKey, 0, 2));
}
@Test
public void testKeys() {
redisTemplate.delete("test:user");
System.out.println(redisTemplate.hasKey("test:user"));
redisTemplate.expire("test:students", 10, TimeUnit.SECONDS);
}
@Test
public void testBoundOperations() {
String redisKey = "test:count";
BoundValueOperations operations = redisTemplate.boundValueOps(redisKey);
operations.increment();
operations.increment();
operations.increment();
operations.increment();
operations.increment();
operations.increment();
System.out.println(operations.get());
}
}
| 4,262 | 0.686698 | 0.675059 | 114 | 35.929825 | 28.687279 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.868421 | false | false | 13 |
32c2d0bf419edbe8a4d4580c3b4d4f3a7e69a90e | 15,599,321,243,581 | 66222212876cd6cec3fa46822680693891783a8b | /lab2_1.java | 5d56f45937cea9b2be30ca65a0aa024d84a93c8c | [] | no_license | kengurenokRu/gsuLabs | https://github.com/kengurenokRu/gsuLabs | 16446f40619623c8206da90157239342bf4f7cf8 | 753344a505541928ac5e03942b5aec4d326cbe42 | refs/heads/master | 2022-04-15T17:38:14.070000 | 2020-04-16T16:33:19 | 2020-04-16T16:33:19 | 256,271,994 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*вариант 5
Дан массив A[n]. Найти порядковые номера двух соседних элементов массива, сумма которых максимальна.
Если таких пар элементов несколько, то найти номера всех элементов
*/
import java.util.Scanner;
public class lab2_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n;
System.out.print("Введите размерность вектора.\nn = ");
n = sc.nextInt();
while (n <= 0) {
System.out.print("Размерность введена неверно. Введите размерность вектора еще раз. n>=1.\nn = ");
n = sc.nextInt();
}
int[] A = new int[n];
for (int i = 0; i < n; i++) {
System.out.print("A[" + (i + 1) + "] = ");
A[i] = sc.nextInt();
}
int sum_max = A[0] + A[1];
for (int i = 2; i < n; i++) {
int temp = A[i] + A[i - 1];
if (temp > sum_max) {
sum_max = temp;
}
}
System.out.println("Максимальная сумма соседних элементов = " + sum_max);
for (int i = 1; i < n; i++) {
if ((A[i - 1] + A[i]) == sum_max) {
System.out.println("элемент " + (i - 1) + " и " + i);
}
}
}
}
| UTF-8 | Java | 1,511 | java | lab2_1.java | Java | [] | null | [] | /*вариант 5
Дан массив A[n]. Найти порядковые номера двух соседних элементов массива, сумма которых максимальна.
Если таких пар элементов несколько, то найти номера всех элементов
*/
import java.util.Scanner;
public class lab2_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n;
System.out.print("Введите размерность вектора.\nn = ");
n = sc.nextInt();
while (n <= 0) {
System.out.print("Размерность введена неверно. Введите размерность вектора еще раз. n>=1.\nn = ");
n = sc.nextInt();
}
int[] A = new int[n];
for (int i = 0; i < n; i++) {
System.out.print("A[" + (i + 1) + "] = ");
A[i] = sc.nextInt();
}
int sum_max = A[0] + A[1];
for (int i = 2; i < n; i++) {
int temp = A[i] + A[i - 1];
if (temp > sum_max) {
sum_max = temp;
}
}
System.out.println("Максимальная сумма соседних элементов = " + sum_max);
for (int i = 1; i < n; i++) {
if ((A[i - 1] + A[i]) == sum_max) {
System.out.println("элемент " + (i - 1) + " и " + i);
}
}
}
}
| 1,511 | 0.483923 | 0.472669 | 37 | 32.62162 | 26.605579 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621622 | false | false | 13 |
1f93d6c74301360cb769be5eb0f61e64f528807c | 7,653,631,745,575 | 0244630d93990e607bd2366a57ef7f66a7a01b15 | /src/main/java/fr/aven/bot/commands/music/JoinCommand.java | 29ed1faa67488058f00e4ee9cc2146e2d172dc28 | [] | no_license | lucastldn/AvenBot | https://github.com/lucastldn/AvenBot | a73437cdd5a2f88855d5636daed53ca7a09afeb3 | e591aefe52786807f5e3585446c2776cffa45e71 | refs/heads/master | 2023-08-28T21:58:05.067000 | 2021-09-21T06:23:47 | 2021-09-21T06:23:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.aven.bot.commands.music;
import fr.aven.bot.Constants;
import fr.aven.bot.Main;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.events.GenericEvent;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.managers.AudioManager;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class JoinCommand extends MusicCommands
{
@Override
public void handle(List<String> args, GuildMessageReceivedEvent event)
{
TextChannel channel = event.getChannel();
joinChannel(event);
channel.sendMessage(Main.getDatabase().getTextFor("join.success", event.getGuild())).queue();
}
public static void joinChannel(GuildMessageReceivedEvent event)
{
TextChannel channel = event.getChannel();
AudioManager audioManager = event.getGuild().getAudioManager();
GuildVoiceState memberVoiceState = event.getMember().getVoiceState();
if (!memberVoiceState.inVoiceChannel())
{
channel.sendMessage(Main.getDatabase().getTextFor("join.isNotInChannel", event.getGuild())).queue();
return;
}
VoiceChannel voiceChannel = memberVoiceState.getChannel();
Member selfMember = event.getGuild().getSelfMember();
if (!selfMember.hasPermission(voiceChannel, net.dv8tion.jda.api.Permission.VOICE_CONNECT))
{
channel.sendMessageFormat(Main.getDatabase().getTextFor("join.missingPerm", event.getGuild()), voiceChannel).queue();
return;
}
audioManager.openAudioConnection(voiceChannel);
audioManager.setSelfDeafened(true);
}
@Override
public MessageEmbed.Field getHelp()
{
return new MessageEmbed.Field("Makes the bot join your channel", "Usage: `" + Constants.PREFIX + getInvoke() + "`", false);
}
@Override
public boolean haveEvent() {
return false;
}
@Override
public void onEvent(GenericEvent event) {}
@Override
public String getInvoke()
{
return "join";
}
@Override
public Type getType() {
return super.getType();
}
@Override
public Permission getPermission()
{
return Permission.USER;
}
@Override
public Collection<net.dv8tion.jda.api.Permission> requiredDiscordPermission() {
return Arrays.asList(net.dv8tion.jda.api.Permission.VOICE_CONNECT, net.dv8tion.jda.api.Permission.MESSAGE_WRITE);
}
}
| UTF-8 | Java | 2,560 | java | JoinCommand.java | Java | [] | null | [] | package fr.aven.bot.commands.music;
import fr.aven.bot.Constants;
import fr.aven.bot.Main;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.events.GenericEvent;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.managers.AudioManager;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class JoinCommand extends MusicCommands
{
@Override
public void handle(List<String> args, GuildMessageReceivedEvent event)
{
TextChannel channel = event.getChannel();
joinChannel(event);
channel.sendMessage(Main.getDatabase().getTextFor("join.success", event.getGuild())).queue();
}
public static void joinChannel(GuildMessageReceivedEvent event)
{
TextChannel channel = event.getChannel();
AudioManager audioManager = event.getGuild().getAudioManager();
GuildVoiceState memberVoiceState = event.getMember().getVoiceState();
if (!memberVoiceState.inVoiceChannel())
{
channel.sendMessage(Main.getDatabase().getTextFor("join.isNotInChannel", event.getGuild())).queue();
return;
}
VoiceChannel voiceChannel = memberVoiceState.getChannel();
Member selfMember = event.getGuild().getSelfMember();
if (!selfMember.hasPermission(voiceChannel, net.dv8tion.jda.api.Permission.VOICE_CONNECT))
{
channel.sendMessageFormat(Main.getDatabase().getTextFor("join.missingPerm", event.getGuild()), voiceChannel).queue();
return;
}
audioManager.openAudioConnection(voiceChannel);
audioManager.setSelfDeafened(true);
}
@Override
public MessageEmbed.Field getHelp()
{
return new MessageEmbed.Field("Makes the bot join your channel", "Usage: `" + Constants.PREFIX + getInvoke() + "`", false);
}
@Override
public boolean haveEvent() {
return false;
}
@Override
public void onEvent(GenericEvent event) {}
@Override
public String getInvoke()
{
return "join";
}
@Override
public Type getType() {
return super.getType();
}
@Override
public Permission getPermission()
{
return Permission.USER;
}
@Override
public Collection<net.dv8tion.jda.api.Permission> requiredDiscordPermission() {
return Arrays.asList(net.dv8tion.jda.api.Permission.VOICE_CONNECT, net.dv8tion.jda.api.Permission.MESSAGE_WRITE);
}
}
| 2,560 | 0.682422 | 0.678906 | 85 | 29.117647 | 32.537548 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 13 |
d5c35712f4f877821e8fcd33fa59c11292d31d4c | 8,469,675,562,171 | 72d85b9e98193f9b64b3ceac4d90bc0ea56bbea7 | /src/main/java/com/e_lliam/app/video/server/controller/web/VideoUrlController.java | 3b3296cb06e9174185a9649f3785f9fc17e7ed00 | [] | no_license | willpyshan13/video-server | https://github.com/willpyshan13/video-server | 35ff421f22a6bb29eced0c745dd9c329305c2114 | da0888781cfbe56d0bf5638bfe9e14876df8bc03 | refs/heads/master | 2020-06-04T15:01:47.067000 | 2015-02-03T16:15:23 | 2015-02-03T16:15:23 | 30,251,720 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.e_lliam.app.video.server.controller.web;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
import com.e_lliam.app.video.server.utils.*;
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.e_lliam.app.video.server.dao.IVideoUrlDao;
import com.e_lliam.app.video.server.entity.VideoUrlEntity;
import com.e_lliam.app.video.server.pojo.extjs.ExtData;
import com.e_lliam.app.video.server.pojo.extjs.ExtGridData;
@Controller
@RequestMapping("/ext")
public class VideoUrlController {
private static final TypeReference<List<VideoUrlEntity>> VALUE_TYPE_REF = new TypeReference<List<VideoUrlEntity>>() {
};
private static final Log LOG = LogFactory.getLog(VideoUrlController.class);
@Resource
private IVideoUrlDao videoUrlDao;
@Resource
private ObjectMapper objectMapper;
@RequestMapping("/add/videoUrl")
@ResponseBody
public ExtData add(@RequestBody String body) throws JsonParseException,
JsonMappingException, IOException {
if (!body.startsWith("[")) {
body = "[" + body + "]";
}
List<VideoUrlEntity> entities = objectMapper.readValue(body, VALUE_TYPE_REF);
String urlFrom = entities.get(0).getVideoPlayUrl();
String htmlUrl = entities.get(0).getVideoWebUrl();
List<String> list = Lists.newArrayList();
if (urlFrom.equals("优酷")) {
list = GetYoukuMP4Path.getPath(htmlUrl);
} else if (urlFrom.equals("乐视")) {
try {
list = GetLeTVPath.GetLeTV(htmlUrl);
} catch (Exception e) {
e.printStackTrace();
}
} else if (urlFrom.equals("爱奇艺")) {
list = GetAiqiyiMp4Path.getIQIYIUrl(htmlUrl);
} else if (urlFrom.equals("搜狐")) {
list = GetSouhuVideoMp4Path.GetSohuTV(htmlUrl);
} else if (urlFrom.equals("腾讯")) {
list = GetTencentMp4Path.getTencentUrl(htmlUrl);
}
if (list.size() > 0) {
videoUrlDao.save(entities);
return new ExtGridData(true, entities.size(), entities);
} else {
ExtData extData = new ExtData();
extData.setSuccess(false);
extData.setErrors("");
return extData;
}
}
@RequestMapping("/remove/videoUrl")
@ResponseBody
public ExtData remove(
@RequestBody String body) throws JsonParseException,
JsonMappingException, IOException {
if (!body.startsWith("[")) {
body = "[" + body + "]";
}
List<VideoUrlEntity> list = objectMapper.readValue(body, VALUE_TYPE_REF);
videoUrlDao.delete(list);
return new ExtGridData(true, list.size(), list);
}
@RequestMapping("/update/videoUrl")
@ResponseBody
public ExtData update(
@RequestBody String body) throws JsonParseException,
JsonMappingException, IOException {
if (!body.startsWith("[")) {
body = "[" + body + "]";
}
List<VideoUrlEntity> entities = objectMapper.readValue(body, VALUE_TYPE_REF);
String urlFrom = entities.get(0).getVideoPlayUrl();
String htmlUrl = entities.get(0).getVideoWebUrl();
List<String> list = Lists.newArrayList();
if (urlFrom.equals("优酷")) {
list = GetYoukuMP4Path.getPath(htmlUrl);
} else if (urlFrom.equals("乐视")) {
try {
list = GetLeTVPath.GetLeTV(htmlUrl);
} catch (Exception e) {
e.printStackTrace();
}
} else if (urlFrom.equals("爱奇艺")) {
list = GetAiqiyiMp4Path.getIQIYIUrl(htmlUrl);
} else if (urlFrom.equals("搜狐")) {
list = GetSouhuVideoMp4Path.GetSohuTV(htmlUrl);
} else if (urlFrom.equals("腾讯")) {
list = GetTencentMp4Path.getTencentUrl(htmlUrl);
}
if (list.size() > 0) {
videoUrlDao.save(entities);
return new ExtGridData(true, entities.size(), entities);
} else {
ExtData extData = new ExtData();
extData.setSuccess(false);
extData.setErrors("");
return extData;
}
}
@RequestMapping("/load/videoUrl")
@ResponseBody
public ExtData load(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer currentPage,
@RequestParam(required = false, value = "limit", defaultValue = "10") Integer pageSize,
@RequestParam("videoId") Long videoId) {
Collection<VideoUrlEntity> datas = videoUrlDao.findByVideoIdOrderByVideoUrlIndexAsc(videoId);
return new ExtGridData(true, datas.size(), datas);
}
}
| UTF-8 | Java | 5,375 | java | VideoUrlController.java | Java | [] | null | [] | package com.e_lliam.app.video.server.controller.web;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
import com.e_lliam.app.video.server.utils.*;
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.e_lliam.app.video.server.dao.IVideoUrlDao;
import com.e_lliam.app.video.server.entity.VideoUrlEntity;
import com.e_lliam.app.video.server.pojo.extjs.ExtData;
import com.e_lliam.app.video.server.pojo.extjs.ExtGridData;
@Controller
@RequestMapping("/ext")
public class VideoUrlController {
private static final TypeReference<List<VideoUrlEntity>> VALUE_TYPE_REF = new TypeReference<List<VideoUrlEntity>>() {
};
private static final Log LOG = LogFactory.getLog(VideoUrlController.class);
@Resource
private IVideoUrlDao videoUrlDao;
@Resource
private ObjectMapper objectMapper;
@RequestMapping("/add/videoUrl")
@ResponseBody
public ExtData add(@RequestBody String body) throws JsonParseException,
JsonMappingException, IOException {
if (!body.startsWith("[")) {
body = "[" + body + "]";
}
List<VideoUrlEntity> entities = objectMapper.readValue(body, VALUE_TYPE_REF);
String urlFrom = entities.get(0).getVideoPlayUrl();
String htmlUrl = entities.get(0).getVideoWebUrl();
List<String> list = Lists.newArrayList();
if (urlFrom.equals("优酷")) {
list = GetYoukuMP4Path.getPath(htmlUrl);
} else if (urlFrom.equals("乐视")) {
try {
list = GetLeTVPath.GetLeTV(htmlUrl);
} catch (Exception e) {
e.printStackTrace();
}
} else if (urlFrom.equals("爱奇艺")) {
list = GetAiqiyiMp4Path.getIQIYIUrl(htmlUrl);
} else if (urlFrom.equals("搜狐")) {
list = GetSouhuVideoMp4Path.GetSohuTV(htmlUrl);
} else if (urlFrom.equals("腾讯")) {
list = GetTencentMp4Path.getTencentUrl(htmlUrl);
}
if (list.size() > 0) {
videoUrlDao.save(entities);
return new ExtGridData(true, entities.size(), entities);
} else {
ExtData extData = new ExtData();
extData.setSuccess(false);
extData.setErrors("");
return extData;
}
}
@RequestMapping("/remove/videoUrl")
@ResponseBody
public ExtData remove(
@RequestBody String body) throws JsonParseException,
JsonMappingException, IOException {
if (!body.startsWith("[")) {
body = "[" + body + "]";
}
List<VideoUrlEntity> list = objectMapper.readValue(body, VALUE_TYPE_REF);
videoUrlDao.delete(list);
return new ExtGridData(true, list.size(), list);
}
@RequestMapping("/update/videoUrl")
@ResponseBody
public ExtData update(
@RequestBody String body) throws JsonParseException,
JsonMappingException, IOException {
if (!body.startsWith("[")) {
body = "[" + body + "]";
}
List<VideoUrlEntity> entities = objectMapper.readValue(body, VALUE_TYPE_REF);
String urlFrom = entities.get(0).getVideoPlayUrl();
String htmlUrl = entities.get(0).getVideoWebUrl();
List<String> list = Lists.newArrayList();
if (urlFrom.equals("优酷")) {
list = GetYoukuMP4Path.getPath(htmlUrl);
} else if (urlFrom.equals("乐视")) {
try {
list = GetLeTVPath.GetLeTV(htmlUrl);
} catch (Exception e) {
e.printStackTrace();
}
} else if (urlFrom.equals("爱奇艺")) {
list = GetAiqiyiMp4Path.getIQIYIUrl(htmlUrl);
} else if (urlFrom.equals("搜狐")) {
list = GetSouhuVideoMp4Path.GetSohuTV(htmlUrl);
} else if (urlFrom.equals("腾讯")) {
list = GetTencentMp4Path.getTencentUrl(htmlUrl);
}
if (list.size() > 0) {
videoUrlDao.save(entities);
return new ExtGridData(true, entities.size(), entities);
} else {
ExtData extData = new ExtData();
extData.setSuccess(false);
extData.setErrors("");
return extData;
}
}
@RequestMapping("/load/videoUrl")
@ResponseBody
public ExtData load(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer currentPage,
@RequestParam(required = false, value = "limit", defaultValue = "10") Integer pageSize,
@RequestParam("videoId") Long videoId) {
Collection<VideoUrlEntity> datas = videoUrlDao.findByVideoIdOrderByVideoUrlIndexAsc(videoId);
return new ExtGridData(true, datas.size(), datas);
}
}
| 5,375 | 0.636841 | 0.633652 | 139 | 37.352516 | 24.023628 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.640288 | false | false | 13 |
bdebfda608aa2efb8bd5266958c58be95c92de25 | 6,631,429,518,596 | ac6126a1236336fd7ade3367120a39bc4a5a7ce5 | /sample/ar.com.oxen.nibiru.mobile.sample.mgwt/src/main/java/ar/com/oxen/nibiru/mobile/sample/mgwt/app/Module.java | 6aad4ff76c9bb0753a90233949e0654984ec267d | [] | no_license | lbrasseur/nibirumobile | https://github.com/lbrasseur/nibirumobile | b01080748ef2c364e2220f4d63d22d06237d8aa3 | 8a7f44e1cd9e8a2a56760cdc62ca7870ba45cdc1 | refs/heads/master | 2021-01-16T18:06:32.024000 | 2015-05-19T22:38:23 | 2015-05-19T22:38:23 | 32,324,392 | 5 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ar.com.oxen.nibiru.mobile.sample.mgwt.app;
import javax.inject.Provider;
import ar.com.oxen.nibiru.mobile.core.api.app.EntryPoint;
import ar.com.oxen.nibiru.mobile.core.api.config.AppName;
import ar.com.oxen.nibiru.mobile.core.api.config.AppVersion;
import ar.com.oxen.nibiru.mobile.core.api.config.BaseUrl;
import ar.com.oxen.nibiru.mobile.core.api.ui.mvp.PresenterMapper;
import ar.com.oxen.nibiru.mobile.gwt.app.DatabaseBootstrap;
import ar.com.oxen.nibiru.mobile.gwt.data.GwtMobileDatabaseBootstrap;
import ar.com.oxen.nibiru.mobile.sample.app.api.business.CustomerManager;
import ar.com.oxen.nibiru.mobile.sample.app.api.data.CustomerDao;
import ar.com.oxen.nibiru.mobile.sample.app.impl.SampleEntryPoint;
import ar.com.oxen.nibiru.mobile.sample.app.impl.business.CustomerManagerImpl;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.CustomerFormPresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.CustomerManagementPresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.MainMenuPresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SampleMessages;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SamplePresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SamplePresenterMapper;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SecondPresenter;
import ar.com.oxen.nibiru.mobile.sample.mgwt.data.GwtMobileCustomerDao;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.CustomerFormDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.CustomerManagementDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.GwtSampleMessages;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.MainMenuDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.SampleDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.SecondDisplay;
import com.google.gwt.core.client.GWT;
import com.google.gwt.inject.client.AbstractGinModule;
public class Module extends AbstractGinModule {
@Override
protected void configure() {
/* App bindings */
bind(String.class).annotatedWith(AppName.class).toProvider(
AppNameProvider.class);
bind(Integer.class).annotatedWith(AppVersion.class).toProvider(
AppVersionProvider.class);
bind(String.class).annotatedWith(BaseUrl.class).toProvider(
BaseUrlProvider.class);
bind(EntryPoint.class).to(SampleEntryPoint.class);
/* UI bindings */
bind(PresenterMapper.class).to(SamplePresenterMapper.class);
bind(MainMenuPresenter.Display.class).to(MainMenuDisplay.class);
bind(CustomerManagementPresenter.Display.class).to(
CustomerManagementDisplay.class);
bind(CustomerFormPresenter.Display.class).to(CustomerFormDisplay.class);
bind(SamplePresenter.Display.class).to(SampleDisplay.class);
bind(SecondPresenter.Display.class).to(SecondDisplay.class);
bind(SampleMessages.class).to(GwtSampleMessages.class);
/* Business bindings */
bind(CustomerManager.class).to(CustomerManagerImpl.class);
/* Database bindings */
bind(DatabaseBootstrap.class).to(GwtMobileDatabaseBootstrap.class);
bind(CustomerDao.class).to(GwtMobileCustomerDao.class);
}
public static class AppNameProvider implements Provider<String> {
@Override
public String get() {
return "NibiruSample";
}
}
public static class AppVersionProvider implements Provider<Integer> {
@Override
public Integer get() {
return 1;
}
}
public static class BaseUrlProvider implements Provider<String> {
@Override
public String get() {
return GWT.getHostPageBaseURL()
+ "../ar.com.oxen.nibiru.mobile.sample.server/";
}
}
}
| UTF-8 | Java | 3,536 | java | Module.java | Java | [] | null | [] | package ar.com.oxen.nibiru.mobile.sample.mgwt.app;
import javax.inject.Provider;
import ar.com.oxen.nibiru.mobile.core.api.app.EntryPoint;
import ar.com.oxen.nibiru.mobile.core.api.config.AppName;
import ar.com.oxen.nibiru.mobile.core.api.config.AppVersion;
import ar.com.oxen.nibiru.mobile.core.api.config.BaseUrl;
import ar.com.oxen.nibiru.mobile.core.api.ui.mvp.PresenterMapper;
import ar.com.oxen.nibiru.mobile.gwt.app.DatabaseBootstrap;
import ar.com.oxen.nibiru.mobile.gwt.data.GwtMobileDatabaseBootstrap;
import ar.com.oxen.nibiru.mobile.sample.app.api.business.CustomerManager;
import ar.com.oxen.nibiru.mobile.sample.app.api.data.CustomerDao;
import ar.com.oxen.nibiru.mobile.sample.app.impl.SampleEntryPoint;
import ar.com.oxen.nibiru.mobile.sample.app.impl.business.CustomerManagerImpl;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.CustomerFormPresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.CustomerManagementPresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.MainMenuPresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SampleMessages;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SamplePresenter;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SamplePresenterMapper;
import ar.com.oxen.nibiru.mobile.sample.app.impl.ui.SecondPresenter;
import ar.com.oxen.nibiru.mobile.sample.mgwt.data.GwtMobileCustomerDao;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.CustomerFormDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.CustomerManagementDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.GwtSampleMessages;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.MainMenuDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.SampleDisplay;
import ar.com.oxen.nibiru.mobile.sample.mgwt.ui.SecondDisplay;
import com.google.gwt.core.client.GWT;
import com.google.gwt.inject.client.AbstractGinModule;
public class Module extends AbstractGinModule {
@Override
protected void configure() {
/* App bindings */
bind(String.class).annotatedWith(AppName.class).toProvider(
AppNameProvider.class);
bind(Integer.class).annotatedWith(AppVersion.class).toProvider(
AppVersionProvider.class);
bind(String.class).annotatedWith(BaseUrl.class).toProvider(
BaseUrlProvider.class);
bind(EntryPoint.class).to(SampleEntryPoint.class);
/* UI bindings */
bind(PresenterMapper.class).to(SamplePresenterMapper.class);
bind(MainMenuPresenter.Display.class).to(MainMenuDisplay.class);
bind(CustomerManagementPresenter.Display.class).to(
CustomerManagementDisplay.class);
bind(CustomerFormPresenter.Display.class).to(CustomerFormDisplay.class);
bind(SamplePresenter.Display.class).to(SampleDisplay.class);
bind(SecondPresenter.Display.class).to(SecondDisplay.class);
bind(SampleMessages.class).to(GwtSampleMessages.class);
/* Business bindings */
bind(CustomerManager.class).to(CustomerManagerImpl.class);
/* Database bindings */
bind(DatabaseBootstrap.class).to(GwtMobileDatabaseBootstrap.class);
bind(CustomerDao.class).to(GwtMobileCustomerDao.class);
}
public static class AppNameProvider implements Provider<String> {
@Override
public String get() {
return "NibiruSample";
}
}
public static class AppVersionProvider implements Provider<Integer> {
@Override
public Integer get() {
return 1;
}
}
public static class BaseUrlProvider implements Provider<String> {
@Override
public String get() {
return GWT.getHostPageBaseURL()
+ "../ar.com.oxen.nibiru.mobile.sample.server/";
}
}
}
| 3,536 | 0.797229 | 0.796946 | 87 | 39.643677 | 27.694132 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.597701 | false | false | 13 |
25e8c071ecc249f8107bf84f93516d8b42f1ff16 | 27,419,071,225,663 | 8750abfaab0667464c19686b886d69fdb91b5d66 | /PrimeNumbers.java | cac4c3a3989731ac860673aa02bf39b86102a997 | [] | no_license | rihbyne/topCoderAlgos | https://github.com/rihbyne/topCoderAlgos | 064e6082311422ca45da9b5bb528e0541529de0f | 0c2b22eab68ff1f0ae18264dea4eb476c650f2fd | refs/heads/master | 2020-05-18T10:22:14.719000 | 2014-11-17T13:14:07 | 2014-11-17T13:14:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package topCoderAlgos; /**
* Prime class supports generation of customized numbers using
* built-in configuration
*/
import java.util.ArrayList;
public class PrimeNumbers {
private ArrayList<Integer> primeList;
public boolean checkForPrime(int number) throws ArithmeticException {
for (int i = 2; i <= number; i++) {
if (number % i == 0) {
if (number == i)
return true;
else
break;
}
}
return false;
}
public ArrayList<Integer> generatePrimeNumbers(int number) {
//Java 7 diamond syntax.Not supported in version > 1.6
//compute primes till the target number
primeList = new ArrayList<>();
for (int num = 2; num <= number; num++) {
if (checkForPrime(num)) {
primeList.add(num);
}
}
return primeList;
}
}
| UTF-8 | Java | 938 | java | PrimeNumbers.java | Java | [] | null | [] | package topCoderAlgos; /**
* Prime class supports generation of customized numbers using
* built-in configuration
*/
import java.util.ArrayList;
public class PrimeNumbers {
private ArrayList<Integer> primeList;
public boolean checkForPrime(int number) throws ArithmeticException {
for (int i = 2; i <= number; i++) {
if (number % i == 0) {
if (number == i)
return true;
else
break;
}
}
return false;
}
public ArrayList<Integer> generatePrimeNumbers(int number) {
//Java 7 diamond syntax.Not supported in version > 1.6
//compute primes till the target number
primeList = new ArrayList<>();
for (int num = 2; num <= number; num++) {
if (checkForPrime(num)) {
primeList.add(num);
}
}
return primeList;
}
}
| 938 | 0.54371 | 0.537313 | 34 | 26.588236 | 20.234097 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382353 | false | false | 13 |
08e3ac8a688dcf452d9fc32aad9b483f292c4e47 | 21,947,282,950,978 | f4e7486c89fa866957dae8cc5fc14854e970e575 | /src/uk/fls/h2n0/main/entitys/effects/Effect.java | f5a30c38cbad5fd035ac7e4093965056a3ccef6d | [] | no_license | h2n0/GB | https://github.com/h2n0/GB | bc0aa2429859efe35e58c78f614971f76b94165b | a8b21a93f9a9248820577be7bf5be222f429ca8e | refs/heads/master | 2021-01-10T11:01:46.301000 | 2016-03-20T12:13:36 | 2016-03-20T12:13:36 | 53,739,848 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package uk.fls.h2n0.main.entitys.effects;
import uk.fls.h2n0.main.entitys.Entity;
public abstract class Effect extends Entity{
protected int life = 0;
@Override
public void update() {
tick();
if(life-- <= 0)this.alive = false;
}
public abstract void tick();
}
| UTF-8 | Java | 277 | java | Effect.java | Java | [] | null | [] | package uk.fls.h2n0.main.entitys.effects;
import uk.fls.h2n0.main.entitys.Entity;
public abstract class Effect extends Entity{
protected int life = 0;
@Override
public void update() {
tick();
if(life-- <= 0)this.alive = false;
}
public abstract void tick();
}
| 277 | 0.693141 | 0.67148 | 17 | 15.294118 | 16.434414 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 |
f381df47cff18c79022506536f0b77c84a31ff82 | 20,615,843,058,678 | 61d5a7804138ecfb10cb7a094fb0afc3f5bd2368 | /aspectj/book/aspectj-in-action-code/appendixA/workspace/Commerce/src/test/java/ajia/service/impl/OrderServiceTest.java | 7a65a43949545063e6a0b5570d25eaa6ffb72b1e | [
"Apache-2.0"
] | permissive | paulnguyen/design | https://github.com/paulnguyen/design | 1585dbe661b8c223dd124ebd2f9723440edb0636 | cdb4da4f7ccb8735d8b4239d7db1a522305783ce | refs/heads/master | 2022-09-30T10:14:06.929000 | 2022-09-29T01:38:52 | 2022-09-29T01:38:52 | 45,923,498 | 8 | 53 | null | false | 2016-02-23T23:04:26 | 2015-11-10T16:09:11 | 2016-02-11T18:01:59 | 2016-02-23T23:00:59 | 21,272 | 1 | 5 | 0 | Java | null | null | /*
Copyright 2009 Ramnivas Laddad
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 ajia.service.impl;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
import static org.mockito.MockitoAnnotations.initMocks;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.springframework.test.util.ReflectionTestUtils;
import ajia.domain.Order;
import ajia.domain.Product;
import ajia.repository.OrderRepository;
import ajia.service.InventoryException;
import ajia.service.InventoryService;
public class OrderServiceTest {
private OrderServiceImpl testOrderService;
@Mock private Order order;
@Mock private Product product;
@Mock private InventoryService inventoryService;
@Mock private OrderRepository orderRepository;
@Before
public void setup() {
initMocks(this);
testOrderService = new OrderServiceImpl();
ReflectionTestUtils.setField(testOrderService, "inventoryService", inventoryService);
ReflectionTestUtils.setField(testOrderService, "orderRepository", orderRepository);
}
@Test(expected=InventoryException.class)
public void insufficientInventoryOrdering() {
doThrow(new InventoryException("")).when(inventoryService).removeProduct(product, 1);
testOrderService.addProduct(order, product, 1);
}
@Test
public void sufficientInventoryOrdering() {
testOrderService.addProduct(order, product, 1);
verify(inventoryService).removeProduct(product, 1);
}
}
| UTF-8 | Java | 2,113 | java | OrderServiceTest.java | Java | [
{
"context": "/*\r\nCopyright 2009 Ramnivas Laddad\r\n\r\nLicensed under the Apache License, Version 2.0",
"end": 34,
"score": 0.999852180480957,
"start": 19,
"tag": "NAME",
"value": "Ramnivas Laddad"
}
] | null | [] | /*
Copyright 2009 <NAME>
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 ajia.service.impl;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
import static org.mockito.MockitoAnnotations.initMocks;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.springframework.test.util.ReflectionTestUtils;
import ajia.domain.Order;
import ajia.domain.Product;
import ajia.repository.OrderRepository;
import ajia.service.InventoryException;
import ajia.service.InventoryService;
public class OrderServiceTest {
private OrderServiceImpl testOrderService;
@Mock private Order order;
@Mock private Product product;
@Mock private InventoryService inventoryService;
@Mock private OrderRepository orderRepository;
@Before
public void setup() {
initMocks(this);
testOrderService = new OrderServiceImpl();
ReflectionTestUtils.setField(testOrderService, "inventoryService", inventoryService);
ReflectionTestUtils.setField(testOrderService, "orderRepository", orderRepository);
}
@Test(expected=InventoryException.class)
public void insufficientInventoryOrdering() {
doThrow(new InventoryException("")).when(inventoryService).removeProduct(product, 1);
testOrderService.addProduct(order, product, 1);
}
@Test
public void sufficientInventoryOrdering() {
testOrderService.addProduct(order, product, 1);
verify(inventoryService).removeProduct(product, 1);
}
}
| 2,104 | 0.737814 | 0.732134 | 61 | 32.639343 | 26.12833 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.688525 | false | false | 13 |
224bb148a6dc2db55cef5fde45ab833e87015ce2 | 20,684,562,538,638 | 942fe0b0e229adda2b854e8898cc610d021dc3bc | /21PointsAndroid-master/app/src/main/java/com/alfredo/android/a21pointsandroid/activity/HomeActivity.java | e6cbd86a6387ebbc96d4d71463090ebeb941ee63 | [] | no_license | bcatala/AndroidSocialNetwork | https://github.com/bcatala/AndroidSocialNetwork | b6766d9c9d2b09d6b30a7a8d7c7626edda9f67b3 | 73c2cc6cf37e57c4887febe0849c868cd09a78d2 | refs/heads/master | 2020-05-18T05:53:03.645000 | 2019-07-26T14:34:58 | 2019-07-26T14:34:58 | 184,219,862 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.alfredo.android.a21pointsandroid.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.alfredo.android.a21pointsandroid.R;
public class HomeActivity extends Activity {
private static int SPASH_TIME_OUT = 4000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
/*new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent homeIntent = new Intent(HomeActivity.this, MainActivity.class);
startActivity(homeIntent);
finish();
}
}, SPASH_TIME_OUT);*/
Intent homeIntent = new Intent(HomeActivity.this, MainActivity.class);
startActivity(homeIntent);
}
}
| UTF-8 | Java | 904 | java | HomeActivity.java | Java | [] | null | [] | package com.alfredo.android.a21pointsandroid.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.alfredo.android.a21pointsandroid.R;
public class HomeActivity extends Activity {
private static int SPASH_TIME_OUT = 4000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
/*new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent homeIntent = new Intent(HomeActivity.this, MainActivity.class);
startActivity(homeIntent);
finish();
}
}, SPASH_TIME_OUT);*/
Intent homeIntent = new Intent(HomeActivity.this, MainActivity.class);
startActivity(homeIntent);
}
}
| 904 | 0.664823 | 0.655973 | 30 | 29.133333 | 23.126801 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 13 |
5fea514dffb8cd6be01208642b50adaed8e043b8 | 8,512,625,196,503 | ad80cda24dc018cdf43ee0855e63888bc0cc849c | /src/main/java/Deck.java | d1b2f994840a7e68b4f729b2520a9c73c36cd16d | [] | no_license | KyleJohnst/Java_cardGame | https://github.com/KyleJohnst/Java_cardGame | 5262a581d3416de8ff332d89d39c123626e253ba | 4538ffa46ff85eaa410ac2a26b6659594649fd1e | refs/heads/master | 2022-06-15T23:59:33.195000 | 2022-05-25T14:56:41 | 2022-05-25T14:56:41 | 176,977,907 | 0 | 0 | null | false | 2022-05-25T10:22:52 | 2019-03-21T15:51:59 | 2019-03-21T15:52:13 | 2022-05-25T10:22:52 | 19 | 0 | 0 | 1 | Java | false | false | import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
public class Deck {
private ArrayList<Card> cards;
public Deck() {
this.cards = new ArrayList<Card>();
this.getCards();
this.shuffle();
}
public int countCards() {
return cards.size();
}
public void getCards(){
SuitType[] suitTypes = SuitType.values();
CardRank[] cardRanks = CardRank.values();
for(SuitType suit : suitTypes){
for(CardRank rank : cardRanks){
this.cards.add(new Card(suit, rank));
}
}
}
// public void shuffle(){ TOO EASY, WE LIKE PAIN
// Collections.shuffle(cards);
// }
public void shuffle(){
Random rand = new Random();
for (int i = 0; i < countCards(); i++){
int j = rand.nextInt(countCards()-1);
Card tempCard = cards.get(i);
cards.set(i, cards.get(j));
cards.set(j, tempCard);
}
}
public Card dealCard() {
if (countCards() > 1){
return cards.remove(countCards()-1);
} else {
return null;
}
}
}
| UTF-8 | Java | 1,188 | java | Deck.java | Java | [] | null | [] | import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
public class Deck {
private ArrayList<Card> cards;
public Deck() {
this.cards = new ArrayList<Card>();
this.getCards();
this.shuffle();
}
public int countCards() {
return cards.size();
}
public void getCards(){
SuitType[] suitTypes = SuitType.values();
CardRank[] cardRanks = CardRank.values();
for(SuitType suit : suitTypes){
for(CardRank rank : cardRanks){
this.cards.add(new Card(suit, rank));
}
}
}
// public void shuffle(){ TOO EASY, WE LIKE PAIN
// Collections.shuffle(cards);
// }
public void shuffle(){
Random rand = new Random();
for (int i = 0; i < countCards(); i++){
int j = rand.nextInt(countCards()-1);
Card tempCard = cards.get(i);
cards.set(i, cards.get(j));
cards.set(j, tempCard);
}
}
public Card dealCard() {
if (countCards() > 1){
return cards.remove(countCards()-1);
} else {
return null;
}
}
}
| 1,188 | 0.524411 | 0.521044 | 50 | 22.76 | 17.162237 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
ded6681d9d85c20cf349e42ae1d1f0e8c679effc | 28,552,942,602,273 | e1f89a2c7559751dcbb3bafee6e0d62326f407ac | /src parts/module/movement/LongJumpMineplex.java | 73893b36a35b7e95f05e66ad43a677a225c72fa4 | [] | no_license | PlutoSolutions/Hitori-Client | https://github.com/PlutoSolutions/Hitori-Client | a804efe7e21934182904753316fd5cc966e451ca | 75ec1a5e02f0c5065f5360a33b35b375436f7651 | refs/heads/main | 2023-06-05T03:00:44.199000 | 2021-06-28T19:36:26 | 2021-06-28T19:36:26 | 365,179,676 | 13 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package client.module.movement;
import client.Client;
import client.event.EventTarget;
import client.event.events.EventPreMotionUpdate;
import client.event.events.EventUpdate;
import client.module.Category;
import client.module.Module;
import net.minecraft.client.Minecraft;
public class LongJumpMineplex extends Module {
private float air, groundTicks;
double motionY;
int count;
boolean collided, half;
private static Minecraft mc = Minecraft.getMinecraft();
public LongJumpMineplex() {
super("LongJumpMineplex", 0, Category.MOVEMENT);
}
@EventTarget
public void onUpdate(EventUpdate eventUpdate) {
if (!mc.thePlayer.onGround ) {
double speed = half ? 0.5 - air / 100 : 0.658 - air / 100;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
motionY -= 0.04000000000001;
if (air > 24) {
motionY -= 0.02;
}
if (air == 12) {
motionY = -0.005;
}
if (speed < 0.3)
speed = 0.3;
if (collided)
speed = 0.2873;
mc.thePlayer.motionY = motionY;
setMotion(speed);
}
if (mc.thePlayer.onGround && isOnGround(0.01) && mc.thePlayer.isCollidedVertically && (mc.thePlayer.moveForward != 0 || mc.thePlayer.moveStrafing != 0)) {
double groundspeed = 0;
collided = mc.thePlayer.isCollidedHorizontally;
groundTicks++;
mc.thePlayer.motionX *= groundspeed;
mc.thePlayer.motionZ *= groundspeed;
half = mc.thePlayer.posY != (int) mc.thePlayer.posY;
mc.thePlayer.motionY = 0.4299999;
air = 1;
motionY = mc.thePlayer.motionY;
}
}
public static boolean isOnGround(double height) {
if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0.0D, -height, 0.0D)).isEmpty()) {
return true;
} else {
return false;
}
}
public static void setMotion(double speed) {
double forward = mc.thePlayer.movementInput.moveForward;
double strafe = mc.thePlayer.movementInput.moveStrafe;
float yaw = mc.thePlayer.rotationYaw;
if ((forward == 0.0D) && (strafe == 0.0D)) {
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
} else {
if (forward != 0.0D) {
if (strafe > 0.0D) {
yaw += (forward > 0.0D ? -45 : 45);
} else if (strafe < 0.0D) {
yaw += (forward > 0.0D ? 45 : -45);
}
strafe = 0.0D;
if (forward > 0.0D) {
forward = 1;
} else if (forward < 0.0D) {
forward = -1;
}
}
mc.thePlayer.motionX = forward * speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0F));
mc.thePlayer.motionZ = forward * speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0F));
}
}
@Override
public void onEnable() {
super.onEnable();
}
@Override
public void onDisable() {
super.onDisable();
}
}
| UTF-8 | Java | 3,392 | java | LongJumpMineplex.java | Java | [] | null | [] | package client.module.movement;
import client.Client;
import client.event.EventTarget;
import client.event.events.EventPreMotionUpdate;
import client.event.events.EventUpdate;
import client.module.Category;
import client.module.Module;
import net.minecraft.client.Minecraft;
public class LongJumpMineplex extends Module {
private float air, groundTicks;
double motionY;
int count;
boolean collided, half;
private static Minecraft mc = Minecraft.getMinecraft();
public LongJumpMineplex() {
super("LongJumpMineplex", 0, Category.MOVEMENT);
}
@EventTarget
public void onUpdate(EventUpdate eventUpdate) {
if (!mc.thePlayer.onGround ) {
double speed = half ? 0.5 - air / 100 : 0.658 - air / 100;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
motionY -= 0.04000000000001;
if (air > 24) {
motionY -= 0.02;
}
if (air == 12) {
motionY = -0.005;
}
if (speed < 0.3)
speed = 0.3;
if (collided)
speed = 0.2873;
mc.thePlayer.motionY = motionY;
setMotion(speed);
}
if (mc.thePlayer.onGround && isOnGround(0.01) && mc.thePlayer.isCollidedVertically && (mc.thePlayer.moveForward != 0 || mc.thePlayer.moveStrafing != 0)) {
double groundspeed = 0;
collided = mc.thePlayer.isCollidedHorizontally;
groundTicks++;
mc.thePlayer.motionX *= groundspeed;
mc.thePlayer.motionZ *= groundspeed;
half = mc.thePlayer.posY != (int) mc.thePlayer.posY;
mc.thePlayer.motionY = 0.4299999;
air = 1;
motionY = mc.thePlayer.motionY;
}
}
public static boolean isOnGround(double height) {
if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0.0D, -height, 0.0D)).isEmpty()) {
return true;
} else {
return false;
}
}
public static void setMotion(double speed) {
double forward = mc.thePlayer.movementInput.moveForward;
double strafe = mc.thePlayer.movementInput.moveStrafe;
float yaw = mc.thePlayer.rotationYaw;
if ((forward == 0.0D) && (strafe == 0.0D)) {
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
} else {
if (forward != 0.0D) {
if (strafe > 0.0D) {
yaw += (forward > 0.0D ? -45 : 45);
} else if (strafe < 0.0D) {
yaw += (forward > 0.0D ? 45 : -45);
}
strafe = 0.0D;
if (forward > 0.0D) {
forward = 1;
} else if (forward < 0.0D) {
forward = -1;
}
}
mc.thePlayer.motionX = forward * speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0F));
mc.thePlayer.motionZ = forward * speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0F));
}
}
@Override
public void onEnable() {
super.onEnable();
}
@Override
public void onDisable() {
super.onDisable();
}
}
| 3,392 | 0.542158 | 0.508844 | 102 | 32.254902 | 29.83868 | 162 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.568627 | false | false | 13 |
cc3a2ab44decd5c43c0f982e87010f2920ef23c8 | 24,730,421,708,393 | 22169636c3bc9a00568a34ec03859af6b934a6d2 | /src/test/java/com/yammer/httptunnel/util/StringUtilsTest.java | 4f2de4591b195759dc0010ab2e78cb0e483ce5c4 | [
"Apache-2.0"
] | permissive | shanhe/httptunnel | https://github.com/shanhe/httptunnel | 67a1a6883d7f0bd3247f14213e8550269e0236a9 | 64078bf478e65b034c672c25b5e247a4c107a0e6 | refs/heads/master | 2021-01-14T11:17:32.123000 | 2013-05-31T08:39:15 | 2013-05-31T08:39:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yammer.httptunnel.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com.yammer.httptunnel.util.StringUtils;
public class StringUtilsTest {
@Test
public void testCapitalize() {
assertEquals("Hello world", StringUtils.capitalize("hello world"));
assertEquals("Hello world", StringUtils.capitalize("Hello world"));
assertEquals("Hello world", StringUtils.capitalize("Hello World"));
assertEquals("Hello world", StringUtils.capitalize("HELLO WORLD"));
assertEquals("Hello world?!", StringUtils.capitalize("hello world?!"));
}
@Test
public void testLeftPad() {
assertEquals("007", StringUtils.leftPad("7", 3, '0'));
assertEquals("777", StringUtils.leftPad("777", 3, '0'));
assertEquals("7777", StringUtils.leftPad("7777", 3, '0'));
assertEquals("000", StringUtils.leftPad("0", 3, '0'));
}
@Test
public void testInCharArray() {
assertTrue(StringUtils.inStringArray(new String[]{"hello", "world"}, "hello"));
assertTrue(StringUtils.inStringArray(new String[]{"hello", null}, "hello"));
assertFalse(StringUtils.inStringArray(new String[]{"goodbye", "world"}, "hello"));
assertFalse(StringUtils.inStringArray(new String[]{}, "hello"));
}
@Test
public void testInStringArray() {
assertTrue(StringUtils.inCharArray("abc".toCharArray(), 'a'));
assertFalse(StringUtils.inCharArray("bcd".toCharArray(), 'a'));
assertFalse(StringUtils.inCharArray("".toCharArray(), 'a'));
}
}
| UTF-8 | Java | 1,544 | java | StringUtilsTest.java | Java | [] | null | [] | package com.yammer.httptunnel.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com.yammer.httptunnel.util.StringUtils;
public class StringUtilsTest {
@Test
public void testCapitalize() {
assertEquals("Hello world", StringUtils.capitalize("hello world"));
assertEquals("Hello world", StringUtils.capitalize("Hello world"));
assertEquals("Hello world", StringUtils.capitalize("Hello World"));
assertEquals("Hello world", StringUtils.capitalize("HELLO WORLD"));
assertEquals("Hello world?!", StringUtils.capitalize("hello world?!"));
}
@Test
public void testLeftPad() {
assertEquals("007", StringUtils.leftPad("7", 3, '0'));
assertEquals("777", StringUtils.leftPad("777", 3, '0'));
assertEquals("7777", StringUtils.leftPad("7777", 3, '0'));
assertEquals("000", StringUtils.leftPad("0", 3, '0'));
}
@Test
public void testInCharArray() {
assertTrue(StringUtils.inStringArray(new String[]{"hello", "world"}, "hello"));
assertTrue(StringUtils.inStringArray(new String[]{"hello", null}, "hello"));
assertFalse(StringUtils.inStringArray(new String[]{"goodbye", "world"}, "hello"));
assertFalse(StringUtils.inStringArray(new String[]{}, "hello"));
}
@Test
public void testInStringArray() {
assertTrue(StringUtils.inCharArray("abc".toCharArray(), 'a'));
assertFalse(StringUtils.inCharArray("bcd".toCharArray(), 'a'));
assertFalse(StringUtils.inCharArray("".toCharArray(), 'a'));
}
}
| 1,544 | 0.724093 | 0.704663 | 45 | 33.311111 | 29.157673 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.066667 | false | false | 13 |
817707832f7516a22585aeff1a8824eddc5d8356 | 1,975,684,977,352 | 62299296f48b395dcb0e0c5500e3ce0e400bbcaa | /springbootrabbitmq/producer/src/main/java/com/master/mapper/BrokerMessageLogMapper.java | e70017a5caf7698503fb42474c3b0534bee2a582 | [
"MIT"
] | permissive | kevinlinit/SpringBoot-RabbitMq-MybatisPlus | https://github.com/kevinlinit/SpringBoot-RabbitMq-MybatisPlus | 55027531029a58890a633be2b70ca54f67fd6b9c | 6b911b817b570d66c3cd286c134bb3cf65d8c60e | refs/heads/master | 2022-06-28T10:49:27.240000 | 2020-03-07T09:18:39 | 2020-03-07T09:18:39 | 243,591,440 | 0 | 0 | MIT | false | 2022-06-17T02:58:18 | 2020-02-27T18:46:00 | 2020-03-07T09:18:53 | 2022-06-17T02:58:17 | 27,187 | 0 | 0 | 1 | Java | false | false | package com.master.mapper;
import com.master.SuperMapper;
import com.master.entity.BrokerMessageLog;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* BrokerMessageLogMapper 接口
*
* @author linqiyuan
* @since 2020-02-27
*/
public interface BrokerMessageLogMapper extends SuperMapper<BrokerMessageLog> {
/**
* 重新发送统计count发送次数 +1
*
* @param id
* @param updateTime
*/
void updateTryCount(@Param("id") String id, @Param("updateTime") Date updateTime);
}
| UTF-8 | Java | 564 | java | BrokerMessageLogMapper.java | Java | [
{
"context": "\n/**\r\n * BrokerMessageLogMapper 接口\r\n *\r\n * @author linqiyuan\r\n * @since 2020-02-27\r\n */\r\npublic interface Brok",
"end": 238,
"score": 0.9996442794799805,
"start": 229,
"tag": "USERNAME",
"value": "linqiyuan"
}
] | null | [] | package com.master.mapper;
import com.master.SuperMapper;
import com.master.entity.BrokerMessageLog;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* BrokerMessageLogMapper 接口
*
* @author linqiyuan
* @since 2020-02-27
*/
public interface BrokerMessageLogMapper extends SuperMapper<BrokerMessageLog> {
/**
* 重新发送统计count发送次数 +1
*
* @param id
* @param updateTime
*/
void updateTryCount(@Param("id") String id, @Param("updateTime") Date updateTime);
}
| 564 | 0.672222 | 0.655556 | 25 | 19.6 | 22.719154 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28 | false | false | 13 |
bb17b4f3a909aaa530903fe98c61f7bf836e5be4 | 6,158,983,125,035 | 843448c301b74e4ecebac3ab3f0f3df7c1ffec82 | /src/main/java/net/codejava/AppController.java | 8ca34e7c0ffc274dbc66a2af8fab05e5c20408bc | [] | no_license | carlosvela42/productManager | https://github.com/carlosvela42/productManager | 496da03da07e2b997d233faefed04e15cb19dab6 | fc23922c7821b8f78dfc248d0014d0edd824b165 | refs/heads/master | 2023-08-23T19:48:04.488000 | 2021-10-24T09:36:07 | 2021-10-24T09:36:07 | 400,819,772 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.codejava;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class AppController {
@Autowired
private ProductService service;
@RequestMapping("/")
public String viewHomePage(Model model) {
List<Packages> listPackages = service.listAllPackages();
LinkedHashMap<String, List<Packages>> hashMap = new LinkedHashMap<String, List<Packages>>();
for (Packages element : listPackages) {
if (!hashMap.containsKey(element.getCategory())) {
List<Packages> list = new ArrayList<Packages>();
list.add(element);
hashMap.put(element.getCategory(), list);
} else {
hashMap.get(element.getCategory()).add(element);
}
}
List<Code> listCode = service.listAllCode();
model.addAttribute("listPackages", hashMap);
model.addAttribute("listCode", listCode);
Product product = new Product();
model.addAttribute("product", product);
return "index";
}
@RequestMapping("/new")
public String showNewProductPage(Model model) {
Product product = new Product();
model.addAttribute("product", product);
return "new_product";
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
public ModelAndView saveProduct(@ModelAttribute("product") Product product, Model model) {
Date date = new Date();
DateFormat df = new SimpleDateFormat("yyyyMMddhhmmss");
String fullDate = df.format(date);
product.setInvoiceNo("EPAY000001" + fullDate);
service.insertUser(product);
product.setStatus("0");
//if(service.checkExist(product)) {
if(false) {
product.setErrorMsg("1");
List<Packages> listPackages = service.listAllPackages();
LinkedHashMap<String, List<Packages>> hashMap = new LinkedHashMap<String, List<Packages>>();
for (Packages element : listPackages) {
if (!hashMap.containsKey(element.getCategory())) {
List<Packages> list = new ArrayList<Packages>();
list.add(element);
hashMap.put(element.getCategory(), list);
} else {
hashMap.get(element.getCategory()).add(element);
}
}
List<Code> listCode = service.listAllCode();
model.addAttribute("listPackages", hashMap);
model.addAttribute("listCode", listCode);
model.addAttribute("product", product);
ModelAndView mav = new ModelAndView("index");
return mav;
} else {
service.insertMap(product);
service.updateUseCountCode(product.getCode());
if("0".equals(product.getPrice())) {
//if(true) {
product.setErrorMsg("0");
service.insertPayment(product);
List<Packages> listPackages = service.listAllPackages();
LinkedHashMap<String, List<Packages>> hashMap = new LinkedHashMap<String, List<Packages>>();
for (Packages element : listPackages) {
if (!hashMap.containsKey(element.getCategory())) {
List<Packages> list = new ArrayList<Packages>();
list.add(element);
hashMap.put(element.getCategory(), list);
} else {
hashMap.get(element.getCategory()).add(element);
}
if(product.getPackageId().equals(element.getId() + "")) {
service.sendEmail(element.getTemplate(), element.getSubject(), product.getEmail());
}
}
List<Code> listCode = service.listAllCode();
model.addAttribute("listPackages", hashMap);
model.addAttribute("listCode", listCode);
model.addAttribute("product", product);
ModelAndView mav = new ModelAndView("index");
return mav;
} else {
service.insertPayment(product);
List<Packages> listPackages = service.listAllPackages();
for (Packages element : listPackages) {
if(product.getPackageId().equals(element.getId() + "")) {
service.sendEmail(element.getTemplate(), element.getSubject(), product.getEmail());
}
}
ModelAndView mav = new ModelAndView("payment");
mav.addObject("product", product);
return mav;
}
}
}
@RequestMapping("/edit/{id}")
public ModelAndView showEditProductPage(@PathVariable(name = "id") int id) {
ModelAndView mav = new ModelAndView("edit_product");
Product product = service.get(id);
mav.addObject("product", product);
return mav;
}
@RequestMapping("/delete/{id}")
public String deleteProduct(@PathVariable(name = "id") int id) {
service.delete(id);
return "redirect:/";
}
@RequestMapping(value = "/callback")
public ModelAndView callback(HttpServletRequest request) throws Exception {
String requestDecode = URLDecoder.decode(request.getQueryString(), "UTF-8");
Map<String, String> requestMap = getQueryMap(requestDecode);
String resultMsg = requestMap.get("resultMsg");
String merchantToken = requestMap.get("merchantToken");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(requestMap.get("resultCd"));
stringBuilder.append(requestMap.get("timeStamp"));
stringBuilder.append(requestMap.get("merTrxId"));
stringBuilder.append(requestMap.get("trxId"));
stringBuilder.append(requestMap.get("merId"));
stringBuilder.append(requestMap.get("amount"));
if("ORDERFLOW2".equals(requestMap.get("merId"))){
stringBuilder.append("B9NmWS0lxV3AmgcbBmRWJ2maT3ew8S3en2MTxz4/TSRM0mDlHwUvjckYkGLI+yVgJfNx9/PxcARhFJQO+Wsd0w==");
}else{
stringBuilder.append(requestMap.get("payToken"));
stringBuilder.append("qxVTXsZIpyWu5FEm7Asmk6i+Pr8aeiMCxpb1KOyE1a94P1MBnFtgkJgxYLaxDoOgwdcVW1TG+cDLT5koJbjYqA==");
}
String result = encrypt(stringBuilder.toString());
ModelAndView mav = new ModelAndView("success");
Product product = new Product();
product.setPaymentLink("");
product.setErrorMsg(resultMsg);
if (result.equals(merchantToken)) {
service.updatePayment(requestMap.get("payToken"), requestMap.get("merTrxId"), requestMap.get("trxId"), requestMap.get("resultCd"), requestMap.get("invoiceNo"));
} else {
product.setErrorMsg("Merchant token không khớp");
}
mav.addObject("product", product);
return mav;
}
@RequestMapping(value = "/ipn")
public ModelAndView ipn(HttpServletRequest request) throws Exception {
//tuong lai code
String requestDecode = URLDecoder.decode(request.getQueryString(), "UTF-8");
Map<String, String> requestMap = getQueryMap(requestDecode);
String resultMsg = requestMap.get("resultMsg");
String link = "";
ModelAndView mav = new ModelAndView("success");
Product product = new Product();
product.setPaymentLink(link);
product.setErrorMsg(resultMsg);
mav.addObject("product", product);
return mav;
}
public static Map<String, String> getQueryMap(String query) {
String[] params = query.split("&");
Map<String, String> map = new HashMap<String, String>();
for (String param : params) {
String name = param.split("=")[0];
String value = "";
if(param.split("=").length > 1) {
value = param.split("=")[1];
}
map.put(name, value);
}
return map;
}
public static String encrypt(String str){
String SHA = "";
try{
MessageDigest sh = MessageDigest.getInstance("SHA-256");
sh.update(str.getBytes());
byte byteData[] = sh.digest();
StringBuffer sb = new StringBuffer();
for(int i = 0 ; i < byteData.length ; i++){
sb.append(Integer.toString((byteData[i]&0xff) + 0x100, 16).substring(1));
}
SHA = sb.toString();
}catch(NoSuchAlgorithmException e){
e.printStackTrace();
SHA = null;
}
return SHA;
}
}
| UTF-8 | Java | 8,378 | java | AppController.java | Java | [
{
"context": "questMap.get(\"merId\"))){\n\t\t\tstringBuilder.append(\"B9NmWS0lxV3AmgcbBmRWJ2maT3ew8S3en2MTxz4/TSRM0mDlHwUvjckYkGLI+yVgJfNx9/PxcARhFJQO+Wsd0w==\");\n\t\t}else{\n\t\t\tstringBuilder.append(requestMap.get",
"end": 6154,
"score": 0.7967407703399658,
"start": 6065,
"tag": "KEY",
... | null | [] | package net.codejava;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class AppController {
@Autowired
private ProductService service;
@RequestMapping("/")
public String viewHomePage(Model model) {
List<Packages> listPackages = service.listAllPackages();
LinkedHashMap<String, List<Packages>> hashMap = new LinkedHashMap<String, List<Packages>>();
for (Packages element : listPackages) {
if (!hashMap.containsKey(element.getCategory())) {
List<Packages> list = new ArrayList<Packages>();
list.add(element);
hashMap.put(element.getCategory(), list);
} else {
hashMap.get(element.getCategory()).add(element);
}
}
List<Code> listCode = service.listAllCode();
model.addAttribute("listPackages", hashMap);
model.addAttribute("listCode", listCode);
Product product = new Product();
model.addAttribute("product", product);
return "index";
}
@RequestMapping("/new")
public String showNewProductPage(Model model) {
Product product = new Product();
model.addAttribute("product", product);
return "new_product";
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
public ModelAndView saveProduct(@ModelAttribute("product") Product product, Model model) {
Date date = new Date();
DateFormat df = new SimpleDateFormat("yyyyMMddhhmmss");
String fullDate = df.format(date);
product.setInvoiceNo("EPAY000001" + fullDate);
service.insertUser(product);
product.setStatus("0");
//if(service.checkExist(product)) {
if(false) {
product.setErrorMsg("1");
List<Packages> listPackages = service.listAllPackages();
LinkedHashMap<String, List<Packages>> hashMap = new LinkedHashMap<String, List<Packages>>();
for (Packages element : listPackages) {
if (!hashMap.containsKey(element.getCategory())) {
List<Packages> list = new ArrayList<Packages>();
list.add(element);
hashMap.put(element.getCategory(), list);
} else {
hashMap.get(element.getCategory()).add(element);
}
}
List<Code> listCode = service.listAllCode();
model.addAttribute("listPackages", hashMap);
model.addAttribute("listCode", listCode);
model.addAttribute("product", product);
ModelAndView mav = new ModelAndView("index");
return mav;
} else {
service.insertMap(product);
service.updateUseCountCode(product.getCode());
if("0".equals(product.getPrice())) {
//if(true) {
product.setErrorMsg("0");
service.insertPayment(product);
List<Packages> listPackages = service.listAllPackages();
LinkedHashMap<String, List<Packages>> hashMap = new LinkedHashMap<String, List<Packages>>();
for (Packages element : listPackages) {
if (!hashMap.containsKey(element.getCategory())) {
List<Packages> list = new ArrayList<Packages>();
list.add(element);
hashMap.put(element.getCategory(), list);
} else {
hashMap.get(element.getCategory()).add(element);
}
if(product.getPackageId().equals(element.getId() + "")) {
service.sendEmail(element.getTemplate(), element.getSubject(), product.getEmail());
}
}
List<Code> listCode = service.listAllCode();
model.addAttribute("listPackages", hashMap);
model.addAttribute("listCode", listCode);
model.addAttribute("product", product);
ModelAndView mav = new ModelAndView("index");
return mav;
} else {
service.insertPayment(product);
List<Packages> listPackages = service.listAllPackages();
for (Packages element : listPackages) {
if(product.getPackageId().equals(element.getId() + "")) {
service.sendEmail(element.getTemplate(), element.getSubject(), product.getEmail());
}
}
ModelAndView mav = new ModelAndView("payment");
mav.addObject("product", product);
return mav;
}
}
}
@RequestMapping("/edit/{id}")
public ModelAndView showEditProductPage(@PathVariable(name = "id") int id) {
ModelAndView mav = new ModelAndView("edit_product");
Product product = service.get(id);
mav.addObject("product", product);
return mav;
}
@RequestMapping("/delete/{id}")
public String deleteProduct(@PathVariable(name = "id") int id) {
service.delete(id);
return "redirect:/";
}
@RequestMapping(value = "/callback")
public ModelAndView callback(HttpServletRequest request) throws Exception {
String requestDecode = URLDecoder.decode(request.getQueryString(), "UTF-8");
Map<String, String> requestMap = getQueryMap(requestDecode);
String resultMsg = requestMap.get("resultMsg");
String merchantToken = requestMap.get("merchantToken");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(requestMap.get("resultCd"));
stringBuilder.append(requestMap.get("timeStamp"));
stringBuilder.append(requestMap.get("merTrxId"));
stringBuilder.append(requestMap.get("trxId"));
stringBuilder.append(requestMap.get("merId"));
stringBuilder.append(requestMap.get("amount"));
if("ORDERFLOW2".equals(requestMap.get("merId"))){
stringBuilder.append("<KEY>);
}else{
stringBuilder.append(requestMap.get("payToken"));
stringBuilder.append("<KEY>);
}
String result = encrypt(stringBuilder.toString());
ModelAndView mav = new ModelAndView("success");
Product product = new Product();
product.setPaymentLink("");
product.setErrorMsg(resultMsg);
if (result.equals(merchantToken)) {
service.updatePayment(requestMap.get("payToken"), requestMap.get("merTrxId"), requestMap.get("trxId"), requestMap.get("resultCd"), requestMap.get("invoiceNo"));
} else {
product.setErrorMsg("Merchant token không khớp");
}
mav.addObject("product", product);
return mav;
}
@RequestMapping(value = "/ipn")
public ModelAndView ipn(HttpServletRequest request) throws Exception {
//tuong lai code
String requestDecode = URLDecoder.decode(request.getQueryString(), "UTF-8");
Map<String, String> requestMap = getQueryMap(requestDecode);
String resultMsg = requestMap.get("resultMsg");
String link = "";
ModelAndView mav = new ModelAndView("success");
Product product = new Product();
product.setPaymentLink(link);
product.setErrorMsg(resultMsg);
mav.addObject("product", product);
return mav;
}
public static Map<String, String> getQueryMap(String query) {
String[] params = query.split("&");
Map<String, String> map = new HashMap<String, String>();
for (String param : params) {
String name = param.split("=")[0];
String value = "";
if(param.split("=").length > 1) {
value = param.split("=")[1];
}
map.put(name, value);
}
return map;
}
public static String encrypt(String str){
String SHA = "";
try{
MessageDigest sh = MessageDigest.getInstance("SHA-256");
sh.update(str.getBytes());
byte byteData[] = sh.digest();
StringBuffer sb = new StringBuffer();
for(int i = 0 ; i < byteData.length ; i++){
sb.append(Integer.toString((byteData[i]&0xff) + 0x100, 16).substring(1));
}
SHA = sb.toString();
}catch(NoSuchAlgorithmException e){
e.printStackTrace();
SHA = null;
}
return SHA;
}
}
| 8,210 | 0.690269 | 0.684179 | 246 | 33.044716 | 26.246525 | 163 | false | false | 0 | 0 | 0 | 0 | 88 | 0.021015 | 2.784553 | false | false | 13 |
30730811551db77a750c31f239e6cb74506d2ebd | 13,623,636,282,647 | 90a3b8a7c2cd976f055eb43539b0d025f89c1551 | /src/model/bean/OrderReady.java | cd7123191445c84e8726d051e46df35ed1683cc1 | [] | no_license | josecumbe/Pharmancy_Manager | https://github.com/josecumbe/Pharmancy_Manager | c6124eb3143c532b8c3a02e61235d97a89923ca4 | e0011cd7378f87ed9b491ad4807320ad2f1718af | refs/heads/main | 2023-03-14T08:27:41.948000 | 2021-03-11T13:14:42 | 2021-03-11T13:14:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* */ package model.bean;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class OrderReady
/* */ {
/* */ private int bill_nr;
/* */ private double descount;
/* */ private double bill_total_paid;
/* */ private String drug_sold;
/* */ private double quantity_sold;
/* */ private double price_per_unit;
/* */ private double total_price;
/* */ private double money_paid;
/* */ private String method_of_payment;
/* */ private String sub_method_of_payment;
/* */ private String seller;
/* */ private String date;
/* */
/* */ public OrderReady() {}
/* */
/* */ public OrderReady(int bill_nr, double descount, double bill_total_paid, String drug_sold, double quantity_sold, double price_per_unit, double total_price, double money_paid, String method_of_payment, String sub_method_of_payment, String seller, String date) {
/* 32 */ this.bill_nr = bill_nr;
/* 33 */ this.descount = descount;
/* 34 */ this.bill_total_paid = bill_total_paid;
/* 35 */ this.drug_sold = drug_sold;
/* 36 */ this.quantity_sold = quantity_sold;
/* 37 */ this.price_per_unit = price_per_unit;
/* 38 */ this.total_price = total_price;
/* 39 */ this.money_paid = money_paid;
/* 40 */ this.method_of_payment = method_of_payment;
/* 41 */ this.sub_method_of_payment = sub_method_of_payment;
/* 42 */ this.seller = seller;
/* 43 */ this.date = date;
/* */ }
/* */
/* */
/* */
/* */ public int getBill_nr() {
/* 49 */ return this.bill_nr;
/* */ }
/* */
/* */ public double getDescount() {
/* 53 */ return this.descount;
/* */ }
/* */
/* */ public double getBill_total_paid() {
/* 57 */ return this.bill_total_paid;
/* */ }
/* */
/* */ public String getDrug_sold() {
/* 61 */ return this.drug_sold;
/* */ }
/* */
/* */ public double getQuantity_sold() {
/* 65 */ return this.quantity_sold;
/* */ }
/* */
/* */ public double getPrice_per_unit() {
/* 69 */ return this.price_per_unit;
/* */ }
/* */
/* */ public double getTotal_price() {
/* 73 */ return this.total_price;
/* */ }
/* */
/* */ public double getMoney_paid() {
/* 77 */ return this.money_paid;
/* */ }
/* */
/* */ public String getMethod_of_payment() {
/* 81 */ return this.method_of_payment;
/* */ }
/* */
/* */ public String getSub_method_of_payment() {
/* 85 */ return this.sub_method_of_payment;
/* */ }
/* */
/* */ public String getSeller() {
/* 89 */ return this.seller;
/* */ }
/* */
/* */ public String getDate() {
/* 93 */ return this.date;
/* */ }
/* */
/* */
/* */
/* */
/* */ public void setBill_nr(int bill_nr) {
/* 100 */ this.bill_nr = bill_nr;
/* */ }
/* */
/* */ public void setDescount(double descount) {
/* 104 */ this.descount = descount;
/* */ }
/* */
/* */ public void setBill_total_paid(double bill_total_paid) {
/* 108 */ this.bill_total_paid = bill_total_paid;
/* */ }
/* */
/* */ public void setDrug_sold(String drug_sold) {
/* 112 */ this.drug_sold = drug_sold;
/* */ }
/* */
/* */ public void setQuantity_sold(double quantity_sold) {
/* 116 */ this.quantity_sold = quantity_sold;
/* */ }
/* */
/* */ public void setPrice_per_unit(double price_per_unit) {
/* 120 */ this.price_per_unit = price_per_unit;
/* */ }
/* */
/* */ public void setTotal_price(double total_price) {
/* 124 */ this.total_price = total_price;
/* */ }
/* */
/* */ public void setMoney_paid(double money_paid) {
/* 128 */ this.money_paid = money_paid;
/* */ }
/* */
/* */ public void setMethod_of_payment(String method_of_payment) {
/* 132 */ this.method_of_payment = method_of_payment;
/* */ }
/* */
/* */ public void setSub_method_of_payment(String sub_method_of_payment) {
/* 136 */ this.sub_method_of_payment = sub_method_of_payment;
/* */ }
/* */
/* */ public void setSeller(String seller) {
/* 140 */ this.seller = seller;
/* */ }
/* */
/* */ public void setDate(String date) {
/* 144 */ this.date = date;
/* */ }
/* */ }
/* Location: /home/jose/Documents/FarSetUp/bin/PharmancyV2.jar!/model/bean/OrderReady.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | UTF-8 | Java | 4,789 | java | OrderReady.java | Java | [
{
"context": " }\n/* */ }\n\n\n/* Location: /home/jose/Documents/FarSetUp/bin/PharmancyV2.jar!/model/bea",
"end": 4650,
"score": 0.997814416885376,
"start": 4646,
"tag": "USERNAME",
"value": "jose"
}
] | null | [] | /* */ package model.bean;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class OrderReady
/* */ {
/* */ private int bill_nr;
/* */ private double descount;
/* */ private double bill_total_paid;
/* */ private String drug_sold;
/* */ private double quantity_sold;
/* */ private double price_per_unit;
/* */ private double total_price;
/* */ private double money_paid;
/* */ private String method_of_payment;
/* */ private String sub_method_of_payment;
/* */ private String seller;
/* */ private String date;
/* */
/* */ public OrderReady() {}
/* */
/* */ public OrderReady(int bill_nr, double descount, double bill_total_paid, String drug_sold, double quantity_sold, double price_per_unit, double total_price, double money_paid, String method_of_payment, String sub_method_of_payment, String seller, String date) {
/* 32 */ this.bill_nr = bill_nr;
/* 33 */ this.descount = descount;
/* 34 */ this.bill_total_paid = bill_total_paid;
/* 35 */ this.drug_sold = drug_sold;
/* 36 */ this.quantity_sold = quantity_sold;
/* 37 */ this.price_per_unit = price_per_unit;
/* 38 */ this.total_price = total_price;
/* 39 */ this.money_paid = money_paid;
/* 40 */ this.method_of_payment = method_of_payment;
/* 41 */ this.sub_method_of_payment = sub_method_of_payment;
/* 42 */ this.seller = seller;
/* 43 */ this.date = date;
/* */ }
/* */
/* */
/* */
/* */ public int getBill_nr() {
/* 49 */ return this.bill_nr;
/* */ }
/* */
/* */ public double getDescount() {
/* 53 */ return this.descount;
/* */ }
/* */
/* */ public double getBill_total_paid() {
/* 57 */ return this.bill_total_paid;
/* */ }
/* */
/* */ public String getDrug_sold() {
/* 61 */ return this.drug_sold;
/* */ }
/* */
/* */ public double getQuantity_sold() {
/* 65 */ return this.quantity_sold;
/* */ }
/* */
/* */ public double getPrice_per_unit() {
/* 69 */ return this.price_per_unit;
/* */ }
/* */
/* */ public double getTotal_price() {
/* 73 */ return this.total_price;
/* */ }
/* */
/* */ public double getMoney_paid() {
/* 77 */ return this.money_paid;
/* */ }
/* */
/* */ public String getMethod_of_payment() {
/* 81 */ return this.method_of_payment;
/* */ }
/* */
/* */ public String getSub_method_of_payment() {
/* 85 */ return this.sub_method_of_payment;
/* */ }
/* */
/* */ public String getSeller() {
/* 89 */ return this.seller;
/* */ }
/* */
/* */ public String getDate() {
/* 93 */ return this.date;
/* */ }
/* */
/* */
/* */
/* */
/* */ public void setBill_nr(int bill_nr) {
/* 100 */ this.bill_nr = bill_nr;
/* */ }
/* */
/* */ public void setDescount(double descount) {
/* 104 */ this.descount = descount;
/* */ }
/* */
/* */ public void setBill_total_paid(double bill_total_paid) {
/* 108 */ this.bill_total_paid = bill_total_paid;
/* */ }
/* */
/* */ public void setDrug_sold(String drug_sold) {
/* 112 */ this.drug_sold = drug_sold;
/* */ }
/* */
/* */ public void setQuantity_sold(double quantity_sold) {
/* 116 */ this.quantity_sold = quantity_sold;
/* */ }
/* */
/* */ public void setPrice_per_unit(double price_per_unit) {
/* 120 */ this.price_per_unit = price_per_unit;
/* */ }
/* */
/* */ public void setTotal_price(double total_price) {
/* 124 */ this.total_price = total_price;
/* */ }
/* */
/* */ public void setMoney_paid(double money_paid) {
/* 128 */ this.money_paid = money_paid;
/* */ }
/* */
/* */ public void setMethod_of_payment(String method_of_payment) {
/* 132 */ this.method_of_payment = method_of_payment;
/* */ }
/* */
/* */ public void setSub_method_of_payment(String sub_method_of_payment) {
/* 136 */ this.sub_method_of_payment = sub_method_of_payment;
/* */ }
/* */
/* */ public void setSeller(String seller) {
/* 140 */ this.seller = seller;
/* */ }
/* */
/* */ public void setDate(String date) {
/* 144 */ this.date = date;
/* */ }
/* */ }
/* Location: /home/jose/Documents/FarSetUp/bin/PharmancyV2.jar!/model/bean/OrderReady.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | 4,789 | 0.483608 | 0.464398 | 152 | 30.513159 | 27.421896 | 271 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.394737 | false | false | 13 |
f9c3c6667184914f2af8a326e9cc42c78119a76b | 10,316,511,468,540 | 80c0141c67d148eaeac1bbf3935aa73f8021b222 | /MultiWeaver/COOLPlugin/cool/frontend/ast/ASTReqVarRef.java | 0b6b9f48e13620d516b648e29085d9e7b6f97e90 | [] | no_license | OpenUniversity/AOP-Awesome-Legacy | https://github.com/OpenUniversity/AOP-Awesome-Legacy | 2487e26a070b8e0a4788f897517b27f24e89105b | 8131d2382be05e589fb3a12a0ffb9178a922f86a | refs/heads/master | 2021-01-01T19:48:10.409000 | 2017-07-29T07:43:22 | 2017-07-29T07:43:22 | 98,688,611 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* Generated By:JJTree: Do not edit this line. ASTReqVarRef.java */
package cool.frontend.ast;
public class ASTReqVarRef extends SimpleNode {
public ASTReqVarRef(int id) {
super(id);
}
public ASTReqVarRef(COOLParser p, int id) {
super(p, id);
}
}
| UTF-8 | Java | 281 | java | ASTReqVarRef.java | Java | [] | null | [] | /* Generated By:JJTree: Do not edit this line. ASTReqVarRef.java */
package cool.frontend.ast;
public class ASTReqVarRef extends SimpleNode {
public ASTReqVarRef(int id) {
super(id);
}
public ASTReqVarRef(COOLParser p, int id) {
super(p, id);
}
}
| 281 | 0.654804 | 0.654804 | 14 | 18.071428 | 21.042353 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 13 |
df7565c5fb62240eb71c598ce421ba2cdb8973cc | 3,848,290,724,837 | b9f932cd895f1630e0cd5a43a18224287b07b1f6 | /JavaWeb/src/com/bsl/servlet/MyLoginServletDemo.java | 76fdb3daafaa5baba1fc7f34c510c7f374fa05b7 | [] | no_license | Bianshilong/JavaBase | https://github.com/Bianshilong/JavaBase | 542852e8657ce37cf9d2aa8ab98fe0498e6b7684 | a43f8e0b68d845e1c6a68e379c7e8a2df22c7b43 | refs/heads/master | 2021-01-20T21:06:47.863000 | 2017-12-13T23:45:51 | 2017-12-13T23:45:51 | 101,748,354 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bsl.servlet;
//表单登录,测试get和post方法
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.jasper.tagplugins.jstl.core.Out;
@SuppressWarnings("all")
@WebServlet("/servlet/MyLoginServletDemo")
public class MyLoginServletDemo extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{
// //设置生成的文档类型
// response.setContentType("text/html;charset=UTF-8");
// //得到输出字符输出流
// PrintWriter out=response.getWriter();
// //输出相应的HTML文件
// out.println("<HTML>");
// out.println("<HEAD><Title>测试get和post方法</Title></HEAD>");
// out.println("<BODY>");
// out.println("<H2>调用了doGet()方法</H2>");
// out.println("<H2>用户输入信息如下:</H2>");
// String username=request.getParameter("username");
// if (username=="" || username==null) {
// username="未输入";
// }
// String passwd=request.getParameter("password");
// if (passwd==null || passwd=="") {
// passwd="未输入";
// }
// out.println("<H2>用户名:"+username+"</H2>");
// //可以测试空格能否输出
// out.println("<H2>密 码:"+passwd+"</H2>");
// out.println("</BODY>");
// out.println("</HTML");
// out.close();
doPost(request, response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{
//设置生成的文档类型
response.setContentType("text/html;charset=UTF-8");
//得到输出字符输出流
PrintWriter out=response.getWriter();
//输出相应的HTML文件
out.println("<HTML>");
out.println("<HEAD><Title>测试get和post方法</Title></HEAD>");
out.println("<BODY>");
out.println("<H2>调用了doPost()方法</H2>");
out.println("<H2>用户输入信息如下:</H2>");
request.setCharacterEncoding("UTF-8");
String username=request.getParameter("username");
if (username=="" || username==null) {
username="未输入";
}
String passwd=request.getParameter("password");
if (passwd==null || passwd=="") {
passwd="未输入";
}
out.println("<TABLE border='1'>");
//out.println("<H2>用户名:"+username+"</H2>");
//可以测试空格能否输出,经测试,可以输出
//out.println("<H2>密 码:"+passwd+"</H2>");
out.println("<TR><TD>用户名</TD><TD>"+username+"</TD></TR>");
out.println("<TR><TD>密 码</TD><TD>"+passwd+"</TD></TR>");
/*out.println("<tr>");
out.print("<td>");
out.print("用户名");
out.println("</td>");
out.print("<td>");
out.print(username);
out.println("</td>");
out.println("</tr>");
out.println("<tr>");
out.print("<td>");
out.print("密码");
out.println("</td>");
out.print("<td>");
out.print(passwd);
out.println("</td>");
out.println("</tr>");*/
out.println("</TABLE>");
out.println("</BODY>");
out.println("</HTML");
out.close();
}
} | UTF-8 | Java | 3,169 | java | MyLoginServletDemo.java | Java | [
{
"context": "\"UTF-8\");\n\t\tString username=request.getParameter(\"username\");\n\t\tif (username==\"\" || username==null) {\n\t\t\tuse",
"end": 1938,
"score": 0.9879062175750732,
"start": 1930,
"tag": "USERNAME",
"value": "username"
},
{
"context": ";\n\t\tif (passwd==null || pas... | null | [] | package com.bsl.servlet;
//表单登录,测试get和post方法
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.jasper.tagplugins.jstl.core.Out;
@SuppressWarnings("all")
@WebServlet("/servlet/MyLoginServletDemo")
public class MyLoginServletDemo extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{
// //设置生成的文档类型
// response.setContentType("text/html;charset=UTF-8");
// //得到输出字符输出流
// PrintWriter out=response.getWriter();
// //输出相应的HTML文件
// out.println("<HTML>");
// out.println("<HEAD><Title>测试get和post方法</Title></HEAD>");
// out.println("<BODY>");
// out.println("<H2>调用了doGet()方法</H2>");
// out.println("<H2>用户输入信息如下:</H2>");
// String username=request.getParameter("username");
// if (username=="" || username==null) {
// username="未输入";
// }
// String passwd=request.getParameter("password");
// if (passwd==null || passwd=="") {
// passwd="未输入";
// }
// out.println("<H2>用户名:"+username+"</H2>");
// //可以测试空格能否输出
// out.println("<H2>密 码:"+passwd+"</H2>");
// out.println("</BODY>");
// out.println("</HTML");
// out.close();
doPost(request, response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{
//设置生成的文档类型
response.setContentType("text/html;charset=UTF-8");
//得到输出字符输出流
PrintWriter out=response.getWriter();
//输出相应的HTML文件
out.println("<HTML>");
out.println("<HEAD><Title>测试get和post方法</Title></HEAD>");
out.println("<BODY>");
out.println("<H2>调用了doPost()方法</H2>");
out.println("<H2>用户输入信息如下:</H2>");
request.setCharacterEncoding("UTF-8");
String username=request.getParameter("username");
if (username=="" || username==null) {
username="未输入";
}
String passwd=request.getParameter("password");
if (passwd==null || passwd=="") {
passwd="未输入";
}
out.println("<TABLE border='1'>");
//out.println("<H2>用户名:"+username+"</H2>");
//可以测试空格能否输出,经测试,可以输出
//out.println("<H2>密 码:"+passwd+"</H2>");
out.println("<TR><TD>用户名</TD><TD>"+username+"</TD></TR>");
out.println("<TR><TD>密 码</TD><TD>"+passwd+"</TD></TR>");
/*out.println("<tr>");
out.print("<td>");
out.print("用户名");
out.println("</td>");
out.print("<td>");
out.print(username);
out.println("</td>");
out.println("</tr>");
out.println("<tr>");
out.print("<td>");
out.print("密码");
out.println("</td>");
out.print("<td>");
out.print(passwd);
out.println("</td>");
out.println("</tr>");*/
out.println("</TABLE>");
out.println("</BODY>");
out.println("</HTML");
out.close();
}
} | 3,169 | 0.652939 | 0.645899 | 96 | 28.604166 | 17.221279 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.46875 | false | false | 13 |
c07377e4600d2ef85cc0a262877532331a93177f | 13,683,765,832,322 | 3a0dd5a857138ccd67c202d51e00530faab1f84c | /Instagram/Instagram/src/main/java/org/kutty/giveaway/package-info.java | f79b9ed601e08029d7ce1dce0df9ac8a51dec0ce | [] | no_license | rupakc/Fashion-Analytics | https://github.com/rupakc/Fashion-Analytics | c1aef5dafa7d92f7e05d7f99fcc12dfb7333579d | 9707e49f2c25e53a68c4935330dfea74e10fc47f | refs/heads/master | 2021-10-07T15:49:27.240000 | 2015-08-06T19:53:10 | 2015-08-06T19:53:10 | 39,213,058 | 2 | 0 | null | false | 2021-09-30T15:48:11 | 2015-07-16T18:17:44 | 2016-02-01T23:40:15 | 2021-09-30T15:48:10 | 1,669 | 2 | 0 | 1 | Java | false | false | /**
*
*/
/**
* @author rupachak
*
*/
package org.kutty.giveaway; | UTF-8 | Java | 70 | java | package-info.java | Java | [
{
"context": "/**\n * \n */\n/**\n * @author rupachak\n *\n */\npackage org.kutty.giveaway;",
"end": 35,
"score": 0.9955248236656189,
"start": 27,
"tag": "USERNAME",
"value": "rupachak"
}
] | null | [] | /**
*
*/
/**
* @author rupachak
*
*/
package org.kutty.giveaway; | 70 | 0.528571 | 0.528571 | 8 | 7.875 | 8.964339 | 27 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | false | false | 13 |
f3c3b4f7ccd34921254fa7c670eb9b0c992c7ae8 | 8,134,668,082,120 | 7fa36ceb0cc198e9412c1ca0d16cb207d9df645e | /src/com/esoft/ischool/restservice/CorrespondenceBean.java | dea51b13c656c54a71d942aa67334772e2ce2be0 | [] | no_license | panawe/ischool | https://github.com/panawe/ischool | b362b086305bc62ad3a846f322421c3d5eb4e150 | bed9b0c2dbe0eb76add000388a63249a8f366ce7 | refs/heads/master | 2021-01-11T05:48:52.862000 | 2016-10-24T04:16:27 | 2016-10-24T04:16:27 | 71,744,115 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.esoft.ischool.restservice;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.esoft.ischool.model.BaseEntity;
import com.esoft.ischool.model.Receiver;
import com.esoft.ischool.model.SchoolYear;
import com.esoft.ischool.model.Student;
import com.esoft.ischool.model.Correspondence;
import com.esoft.ischool.model.Teacher;
import com.esoft.ischool.service.BaseService;
import com.esoft.ischool.util.MenuIdEnum;
import com.esoft.ischool.util.SimpleMail;
import com.mysql.jdbc.StringUtils;
@Component("correspondenceBean")
@Scope("session")
public class CorrespondenceBean extends BaseBean {
@Autowired
@Qualifier("baseService")
private BaseService baseService;
private Long rowCount;
private Long correspondanceCount;
private Long receivedCorrespondenceCount;
private List<BaseEntity> correspondences;
private List<Student> availableStudents = new ArrayList<Student>();
private List<Student> selectedStudents = new ArrayList<Student>();
private List<Teacher> availableTeachers = new ArrayList<Teacher>();
private List<Teacher> selectedTeachers = new ArrayList<Teacher>();
private Correspondence correspondence = new Correspondence();
private Receiver receivedCorrespondence = new Receiver();
private List<BaseEntity> receivedCorrespondences;
private String year;
private String className;
private boolean selectAllTeachers;
private boolean selectAllStudents;
private boolean boxChecked;
private boolean individual;
private boolean sendEmail;
private String selectedStudentTab="studentCorrespondenceDetails";
private String selectedTeacherTab="teacherCorrespondenceDetails";
public String getSelectedStudentTab() {
return selectedStudentTab;
}
public void setSelectedStudentTab(String selectedStudentTab) {
this.selectedStudentTab = selectedStudentTab;
}
public String getSelectedTeacherTab() {
return selectedTeacherTab;
}
public void setSelectedTeacherTab(String selectedTeacherTab) {
this.selectedTeacherTab = selectedTeacherTab;
}
private String selectedTab = "correspondanceDetails";
@Override
public String getSelectedTab() {
return selectedTab;
}
public Long getCorrespondanceCount() {
return correspondanceCount;
}
public void setCorrespondanceCount(Long correspondanceCount) {
this.correspondanceCount = correspondanceCount;
}
@Override
public void setSelectedTab(String selectedTab) {
this.selectedTab = selectedTab;
}
public boolean isBoxChecked() {
return boxChecked;
}
public void setBoxChecked(boolean boxChecked) {
this.boxChecked = boxChecked;
}
public boolean isSelectAllTeachers() {
return selectAllTeachers;
}
public void setSelectAllTeachers(boolean selectAllTeachers) {
this.selectAllTeachers = selectAllTeachers;
}
public boolean isSelectAllStudents() {
return selectAllStudents;
}
public void setSelectAllStudents(boolean selectAllStudents) {
this.selectAllStudents = selectAllStudents;
}
public boolean isSelectTeachers() {
return selectAllTeachers;
}
public void setSelectTeachers(boolean selectAllTeachers) {
this.selectAllTeachers = selectAllTeachers;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String validate() {
return "succes";
}
@Override
public String clear() {
correspondence = new Correspondence();
availableTeachers = null;
availableStudents = null;
selectedStudents=new ArrayList<Student>();
selectedTeachers=new ArrayList<Teacher>();
return "Success";
}
public String clearStudentCorrespondence() {
receivedCorrespondence = new Receiver();
return "Success";
}
public String clearTeacherCorrespondence() {
receivedCorrespondence = new Receiver();
return "Success";
}
public String getShowAll() {
getAll();
return "Success";
}
public String delete() {
clearMessages();
try {
baseService.delete(getIdParameter(), Correspondence.class);
getAll();
clear();
setSuccessMessage(getResourceBundle().getString("DELETE_SUCCESSFULLY"));
} catch (Exception ex) {
setErrorMessage(getResourceBundle().getString("DELETE_UNSUCCESSFULL"));
}
return "Success";
}
public String deleteStudentCorrespondence() {
clearMessages();
try {
baseService.delete(getIdParameter(), Receiver.class);
getStudentCorrespondences();
clear();
setSuccessMessage(getResourceBundle().getString("DELETE_SUCCESSFULLY"));
} catch (Exception ex) {
setErrorMessage(getResourceBundle().getString("DELETE_UNSUCCESSFULL"));
}
return "Success";
}
public String insert() {
clearMessages();
Long id = correspondence.getId();
correspondence.setCorrespondenceDate(new Date());
try {
if (id == null || id == 0) {
baseService.save(correspondence,getCurrentUser());
} else {
baseService.update(correspondence,getCurrentUser());
}
// Save Student
baseService.saveStudentsCorrespondance(correspondence,
selectedStudents,getCurrentUser());
baseService.saveTeachersCorrespondance(correspondence,
selectedTeachers,getCurrentUser());
// send e-mail
if (sendEmail){
correspondence.setSent((short) 1);
sendMail(selectedStudents, selectedTeachers);
}
setSuccessMessage(getResourceBundle().getString("SAVED_SUCCESSFULLY") + (sendEmail ? getResourceBundle().getString("aCopyHasBeenSent") : ""));
} catch (Exception ex) {
correspondence.setId(id);
setErrorMessage(ex, "Cette correspondence exist deja. ");
ex.printStackTrace();
}
clear();
getAll();
return "Success";
}
public String insertStudentCorrespondence() {
clearMessages();
Long id = receivedCorrespondence.getId();
correspondence = receivedCorrespondence.getCorrespondence();
if(correspondence == null || StringUtils.isNullOrEmpty(correspondence.getDescription()))
setErrorMessage(getResourceBundle().getString("NotNullMessage") + getResourceBundle().getString("message"));
if (!StringUtils.isNullOrEmpty(getErrorMessage()))
return "ERROR";
try {
if (id == null || id == 0) {
if (correspondence.getId() == null||correspondence.getId()==0) {
correspondence.setCorrespondenceDate(new Date());
baseService.save(correspondence,getCurrentUser());
}
}
else {
baseService.delete(receivedCorrespondence.getId(), Receiver.class);
correspondence.setId(null);
baseService.save(correspondence,getCurrentUser());
}
if (((String)getSessionParameter("link")).equals("student")) {
// Save Student
if (getSessionParameter("currentStudentId") != null) {
List<Student> students = new ArrayList<Student>();
students.add((Student) baseService.getById(Student.class,
new Long(getSessionParameter("currentStudentId")
.toString())));
baseService
.saveStudentsCorrespondance(correspondence, students,getCurrentUser());
// send e-mail
if (sendEmail){
correspondence.setSent((short) 1);
sendMail(students, new ArrayList<Teacher>());
}
}
}
else if (((String)getSessionParameter("link")).equals("teacher")) {
// Save Teacher
if (getSessionParameter("currentTeacherId") != null) {
List<Teacher> teachers = new ArrayList<Teacher>();
teachers.add((Teacher) baseService.getById(Teacher.class,
new Long(getSessionParameter("currentTeacherId")
.toString())));
baseService
.saveTeachersCorrespondance(correspondence, teachers,getCurrentUser());
if (sendEmail){
correspondence.setSent((short) 1);
sendMail(new ArrayList<Student>(), teachers);
}
}
}
setSuccessMessage(getResourceBundle().getString("SAVED_SUCCESSFULLY") + (sendEmail ? getResourceBundle().getString("aCopyHasBeenSent") : ""));
} catch (Exception ex) {
correspondence.setId(id);
setErrorMessage(ex, "Cette correspondence exist deja. ");
ex.printStackTrace();
}
clear();
getStudentCorrespondences();
return "Success";
}
public void sendMail(List<Student> selectedStudents,
List<Teacher> selectedTeachers) {
StringBuffer sb = new StringBuffer();
for (Student student : selectedStudents) {
setStudentEmail(student, sb);
}
for (Teacher teacher : selectedTeachers) {
setTeacherEmail(teacher, sb);
}
try {
if (sb.length() > 0) {
String to = sb.toString();
Map<String, String> config = (Map<String,String>) getSessionParameter("configuration");
if (config != null) {
SimpleMail.sendMail(correspondence.getSubject(),
correspondence.getDescription(), config.get("SCHOOL_SENDER_EMAIL"), to.substring(0, to
.length() - 1), config.get("SCHOOL_SMTP_SERVER"), config.get("SCHOOL_MAIL_SERVER_USER"),
config.get("SCHOOL_MAIL_SERVER_PASSWORD"));
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void setStudentEmail(Student st, StringBuffer sb) {
Student student= (Student) baseService.findByColumn(Student.class, "matricule", st.getMatricule(), getCurrentUser().getSchool());
if (student.getEmail() != null && !student.getEmail().equals(""))
sb.append(student.getEmail() + ",");
}
private void setTeacherEmail(Teacher teacher, StringBuffer sb) {
Teacher aTeacher= (Teacher) baseService.findByColumn(Teacher.class, "matricule", teacher.getMatricule(), getCurrentUser().getSchool());
if (aTeacher.getEmail() != null && !aTeacher.getEmail().equals("")) {
sb.append(aTeacher.getEmail() + ",");
}
}
public String edit() {
clearMessages();
correspondence = (Correspondence) baseService.getById(
Correspondence.class, getIdParameter());
selectedTab = "correspondanceDetails";
return "Success";
}
public String editStudentCorrespondence() {
clearMessages();
receivedCorrespondence = (Receiver) baseService.getById(Receiver.class, getIdParameter());
setSelectedTab();
return "Success";
}
private void setSelectedTab() {
if (((String)getSessionParameter("link")).equals("student"))
selectedStudentTab="studentCorrespondenceDetails";
else if (((String)getSessionParameter("link")).equals("teacher"))
selectedStudentTab="teacherCorrespondenceDetails";
}
public String editTeacherCorrespondence() {
clearMessages();
receivedCorrespondence = (Receiver) baseService.getById(Receiver.class, getIdParameter());
return "Success";
}
@PostConstruct
private void getAll() {
correspondences = baseService.loadAll(Correspondence.class,getCurrentUser().getSchool());
setCorrespondanceCount(new Long(correspondences.size()));
SchoolYear sy = baseService.getSchoolYear(new Date(),baseService.getDefaultSchool());
year=sy==null?year:sy.getYear();
}
public String getStudentCorrespondences() {
setIndividual(true);
if (((String)getSessionParameter("link")).equals("student")) {
if (getSessionParameter("currentStudentId") != null) {
receivedCorrespondences = baseService
.loadAllByParentId(Receiver.class, "student", "id",
new Long(getSessionParameter("currentStudentId")
.toString()));
setRowCount(new Long(receivedCorrespondences.size()));
}
}
else if (((String)getSessionParameter("link")).equals("teacher")) {
if (getSessionParameter("currentTeacherId") != null) {
receivedCorrespondences = baseService
.loadByParentsIds(Receiver.class, "teacher", new Long(getSessionParameter("currentTeacherId")
.toString()), "school", getCurrentUser().getSchool().getId());
setRowCount(new Long(receivedCorrespondences.size()));
}
}
return "Success";
}
public boolean isUserHasWriteAccess() {
if ( ((String)getSessionParameter("link")).equals("student")) {
return isUserHasWriteAccess(MenuIdEnum.STUDENT.getValue());
} else if ( ((String)getSessionParameter("link")).equals("teacher")) {
return isUserHasWriteAccess(MenuIdEnum.TEACHER.getValue());
} else if (((String)getSessionParameter("link")).equals("correspondance")) {
return isUserHasWriteAccess(MenuIdEnum.CORRESPONDENCE.getValue());
}
return false;
}
public BaseService getBaseService() {
return baseService;
}
public void setBaseService(BaseService baseService) {
this.baseService = baseService;
}
public Long getRowCount() {
return rowCount;
}
public void setRowCount(Long rowCount) {
this.rowCount = rowCount;
}
public List<BaseEntity> getCorrespondences() {
return correspondences;
}
public void setCorrespondences(List<BaseEntity> correspondences) {
this.correspondences = correspondences;
}
public Correspondence getCorrespondence() {
return correspondence;
}
public void setCorrespondence(Correspondence correspondence) {
this.correspondence = correspondence;
}
public List<Student> getAvailableStudents() {
return availableStudents;
}
public void setAvailableStudents(List<Student> availableStudents) {
this.availableStudents = availableStudents;
}
public List<Student> getSelectedStudents() {
return selectedStudents;
}
public void setSelectedStudents(List<Student> selectedStudents) {
this.selectedStudents = selectedStudents;
}
public List<Teacher> getAvailableTeachers() {
return availableTeachers;
}
public void setAvailableTeachers(List<Teacher> availableTeachers) {
this.availableTeachers = availableTeachers;
}
public List<Teacher> getSelectedTeachers() {
return selectedTeachers;
}
public void setSelectedTeachers(List<Teacher> selectedTeachers) {
this.selectedTeachers = selectedTeachers;
}
public String updateTeacherSelection() {
if (selectAllTeachers) {
selectAllStudents = false;
boxChecked = true;
} else {
boxChecked = false;
}
return "Success";
}
public String updateStudentSelection() {
if (selectAllStudents) {
selectAllTeachers = false;
boxChecked = true;
} else {
boxChecked = false;
}
return "Success";
}
public String search() {
availableTeachers = null;
availableStudents = null;
selectedStudents=new ArrayList<Student>();
selectedTeachers=new ArrayList<Teacher>();
if (boxChecked) {
if (selectAllStudents)
availableStudents = baseService.searchStudents(
selectAllStudents, className, year, getCurrentUser().getSchool());
else
availableTeachers = baseService.searchTeachers(
selectAllTeachers, className, year, getCurrentUser().getSchool());
} else {
availableStudents = baseService.searchStudents(selectAllStudents,
className, year, getCurrentUser().getSchool());
}
rowCount = new Long(availableTeachers != null ? availableTeachers
.size() : (availableStudents != null ? availableStudents.size()
: 0));
return "Success";
}
public String doNothing() {
return "Success";
}
public boolean isIndividual() {
return individual;
}
public void setIndividual(boolean individual) {
this.individual = individual;
}
public List<BaseEntity> getReceivedCorrespondences() {
return receivedCorrespondences;
}
public void setReceivedCorrespondences(
List<BaseEntity> receivedCorrespondences) {
this.receivedCorrespondences = receivedCorrespondences;
}
public Long getReceivedCorrespondenceCount() {
return receivedCorrespondenceCount;
}
public void setReceivedCorrespondenceCount(Long receivedCorrespondenceCount) {
this.receivedCorrespondenceCount = receivedCorrespondenceCount;
}
public boolean isSendEmail() {
return sendEmail;
}
public void setSendEmail(boolean sendEmail) {
this.sendEmail = sendEmail;
}
public Receiver getReceivedCorrespondence() {
return receivedCorrespondence;
}
public void setReceivedCorrespondence(Receiver receivedCorrespondence) {
this.receivedCorrespondence = receivedCorrespondence;
}
}
| UTF-8 | Java | 16,674 | java | CorrespondenceBean.java | Java | [] | null | [] | package com.esoft.ischool.restservice;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.esoft.ischool.model.BaseEntity;
import com.esoft.ischool.model.Receiver;
import com.esoft.ischool.model.SchoolYear;
import com.esoft.ischool.model.Student;
import com.esoft.ischool.model.Correspondence;
import com.esoft.ischool.model.Teacher;
import com.esoft.ischool.service.BaseService;
import com.esoft.ischool.util.MenuIdEnum;
import com.esoft.ischool.util.SimpleMail;
import com.mysql.jdbc.StringUtils;
@Component("correspondenceBean")
@Scope("session")
public class CorrespondenceBean extends BaseBean {
@Autowired
@Qualifier("baseService")
private BaseService baseService;
private Long rowCount;
private Long correspondanceCount;
private Long receivedCorrespondenceCount;
private List<BaseEntity> correspondences;
private List<Student> availableStudents = new ArrayList<Student>();
private List<Student> selectedStudents = new ArrayList<Student>();
private List<Teacher> availableTeachers = new ArrayList<Teacher>();
private List<Teacher> selectedTeachers = new ArrayList<Teacher>();
private Correspondence correspondence = new Correspondence();
private Receiver receivedCorrespondence = new Receiver();
private List<BaseEntity> receivedCorrespondences;
private String year;
private String className;
private boolean selectAllTeachers;
private boolean selectAllStudents;
private boolean boxChecked;
private boolean individual;
private boolean sendEmail;
private String selectedStudentTab="studentCorrespondenceDetails";
private String selectedTeacherTab="teacherCorrespondenceDetails";
public String getSelectedStudentTab() {
return selectedStudentTab;
}
public void setSelectedStudentTab(String selectedStudentTab) {
this.selectedStudentTab = selectedStudentTab;
}
public String getSelectedTeacherTab() {
return selectedTeacherTab;
}
public void setSelectedTeacherTab(String selectedTeacherTab) {
this.selectedTeacherTab = selectedTeacherTab;
}
private String selectedTab = "correspondanceDetails";
@Override
public String getSelectedTab() {
return selectedTab;
}
public Long getCorrespondanceCount() {
return correspondanceCount;
}
public void setCorrespondanceCount(Long correspondanceCount) {
this.correspondanceCount = correspondanceCount;
}
@Override
public void setSelectedTab(String selectedTab) {
this.selectedTab = selectedTab;
}
public boolean isBoxChecked() {
return boxChecked;
}
public void setBoxChecked(boolean boxChecked) {
this.boxChecked = boxChecked;
}
public boolean isSelectAllTeachers() {
return selectAllTeachers;
}
public void setSelectAllTeachers(boolean selectAllTeachers) {
this.selectAllTeachers = selectAllTeachers;
}
public boolean isSelectAllStudents() {
return selectAllStudents;
}
public void setSelectAllStudents(boolean selectAllStudents) {
this.selectAllStudents = selectAllStudents;
}
public boolean isSelectTeachers() {
return selectAllTeachers;
}
public void setSelectTeachers(boolean selectAllTeachers) {
this.selectAllTeachers = selectAllTeachers;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String validate() {
return "succes";
}
@Override
public String clear() {
correspondence = new Correspondence();
availableTeachers = null;
availableStudents = null;
selectedStudents=new ArrayList<Student>();
selectedTeachers=new ArrayList<Teacher>();
return "Success";
}
public String clearStudentCorrespondence() {
receivedCorrespondence = new Receiver();
return "Success";
}
public String clearTeacherCorrespondence() {
receivedCorrespondence = new Receiver();
return "Success";
}
public String getShowAll() {
getAll();
return "Success";
}
public String delete() {
clearMessages();
try {
baseService.delete(getIdParameter(), Correspondence.class);
getAll();
clear();
setSuccessMessage(getResourceBundle().getString("DELETE_SUCCESSFULLY"));
} catch (Exception ex) {
setErrorMessage(getResourceBundle().getString("DELETE_UNSUCCESSFULL"));
}
return "Success";
}
public String deleteStudentCorrespondence() {
clearMessages();
try {
baseService.delete(getIdParameter(), Receiver.class);
getStudentCorrespondences();
clear();
setSuccessMessage(getResourceBundle().getString("DELETE_SUCCESSFULLY"));
} catch (Exception ex) {
setErrorMessage(getResourceBundle().getString("DELETE_UNSUCCESSFULL"));
}
return "Success";
}
public String insert() {
clearMessages();
Long id = correspondence.getId();
correspondence.setCorrespondenceDate(new Date());
try {
if (id == null || id == 0) {
baseService.save(correspondence,getCurrentUser());
} else {
baseService.update(correspondence,getCurrentUser());
}
// Save Student
baseService.saveStudentsCorrespondance(correspondence,
selectedStudents,getCurrentUser());
baseService.saveTeachersCorrespondance(correspondence,
selectedTeachers,getCurrentUser());
// send e-mail
if (sendEmail){
correspondence.setSent((short) 1);
sendMail(selectedStudents, selectedTeachers);
}
setSuccessMessage(getResourceBundle().getString("SAVED_SUCCESSFULLY") + (sendEmail ? getResourceBundle().getString("aCopyHasBeenSent") : ""));
} catch (Exception ex) {
correspondence.setId(id);
setErrorMessage(ex, "Cette correspondence exist deja. ");
ex.printStackTrace();
}
clear();
getAll();
return "Success";
}
public String insertStudentCorrespondence() {
clearMessages();
Long id = receivedCorrespondence.getId();
correspondence = receivedCorrespondence.getCorrespondence();
if(correspondence == null || StringUtils.isNullOrEmpty(correspondence.getDescription()))
setErrorMessage(getResourceBundle().getString("NotNullMessage") + getResourceBundle().getString("message"));
if (!StringUtils.isNullOrEmpty(getErrorMessage()))
return "ERROR";
try {
if (id == null || id == 0) {
if (correspondence.getId() == null||correspondence.getId()==0) {
correspondence.setCorrespondenceDate(new Date());
baseService.save(correspondence,getCurrentUser());
}
}
else {
baseService.delete(receivedCorrespondence.getId(), Receiver.class);
correspondence.setId(null);
baseService.save(correspondence,getCurrentUser());
}
if (((String)getSessionParameter("link")).equals("student")) {
// Save Student
if (getSessionParameter("currentStudentId") != null) {
List<Student> students = new ArrayList<Student>();
students.add((Student) baseService.getById(Student.class,
new Long(getSessionParameter("currentStudentId")
.toString())));
baseService
.saveStudentsCorrespondance(correspondence, students,getCurrentUser());
// send e-mail
if (sendEmail){
correspondence.setSent((short) 1);
sendMail(students, new ArrayList<Teacher>());
}
}
}
else if (((String)getSessionParameter("link")).equals("teacher")) {
// Save Teacher
if (getSessionParameter("currentTeacherId") != null) {
List<Teacher> teachers = new ArrayList<Teacher>();
teachers.add((Teacher) baseService.getById(Teacher.class,
new Long(getSessionParameter("currentTeacherId")
.toString())));
baseService
.saveTeachersCorrespondance(correspondence, teachers,getCurrentUser());
if (sendEmail){
correspondence.setSent((short) 1);
sendMail(new ArrayList<Student>(), teachers);
}
}
}
setSuccessMessage(getResourceBundle().getString("SAVED_SUCCESSFULLY") + (sendEmail ? getResourceBundle().getString("aCopyHasBeenSent") : ""));
} catch (Exception ex) {
correspondence.setId(id);
setErrorMessage(ex, "Cette correspondence exist deja. ");
ex.printStackTrace();
}
clear();
getStudentCorrespondences();
return "Success";
}
public void sendMail(List<Student> selectedStudents,
List<Teacher> selectedTeachers) {
StringBuffer sb = new StringBuffer();
for (Student student : selectedStudents) {
setStudentEmail(student, sb);
}
for (Teacher teacher : selectedTeachers) {
setTeacherEmail(teacher, sb);
}
try {
if (sb.length() > 0) {
String to = sb.toString();
Map<String, String> config = (Map<String,String>) getSessionParameter("configuration");
if (config != null) {
SimpleMail.sendMail(correspondence.getSubject(),
correspondence.getDescription(), config.get("SCHOOL_SENDER_EMAIL"), to.substring(0, to
.length() - 1), config.get("SCHOOL_SMTP_SERVER"), config.get("SCHOOL_MAIL_SERVER_USER"),
config.get("SCHOOL_MAIL_SERVER_PASSWORD"));
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void setStudentEmail(Student st, StringBuffer sb) {
Student student= (Student) baseService.findByColumn(Student.class, "matricule", st.getMatricule(), getCurrentUser().getSchool());
if (student.getEmail() != null && !student.getEmail().equals(""))
sb.append(student.getEmail() + ",");
}
private void setTeacherEmail(Teacher teacher, StringBuffer sb) {
Teacher aTeacher= (Teacher) baseService.findByColumn(Teacher.class, "matricule", teacher.getMatricule(), getCurrentUser().getSchool());
if (aTeacher.getEmail() != null && !aTeacher.getEmail().equals("")) {
sb.append(aTeacher.getEmail() + ",");
}
}
public String edit() {
clearMessages();
correspondence = (Correspondence) baseService.getById(
Correspondence.class, getIdParameter());
selectedTab = "correspondanceDetails";
return "Success";
}
public String editStudentCorrespondence() {
clearMessages();
receivedCorrespondence = (Receiver) baseService.getById(Receiver.class, getIdParameter());
setSelectedTab();
return "Success";
}
private void setSelectedTab() {
if (((String)getSessionParameter("link")).equals("student"))
selectedStudentTab="studentCorrespondenceDetails";
else if (((String)getSessionParameter("link")).equals("teacher"))
selectedStudentTab="teacherCorrespondenceDetails";
}
public String editTeacherCorrespondence() {
clearMessages();
receivedCorrespondence = (Receiver) baseService.getById(Receiver.class, getIdParameter());
return "Success";
}
@PostConstruct
private void getAll() {
correspondences = baseService.loadAll(Correspondence.class,getCurrentUser().getSchool());
setCorrespondanceCount(new Long(correspondences.size()));
SchoolYear sy = baseService.getSchoolYear(new Date(),baseService.getDefaultSchool());
year=sy==null?year:sy.getYear();
}
public String getStudentCorrespondences() {
setIndividual(true);
if (((String)getSessionParameter("link")).equals("student")) {
if (getSessionParameter("currentStudentId") != null) {
receivedCorrespondences = baseService
.loadAllByParentId(Receiver.class, "student", "id",
new Long(getSessionParameter("currentStudentId")
.toString()));
setRowCount(new Long(receivedCorrespondences.size()));
}
}
else if (((String)getSessionParameter("link")).equals("teacher")) {
if (getSessionParameter("currentTeacherId") != null) {
receivedCorrespondences = baseService
.loadByParentsIds(Receiver.class, "teacher", new Long(getSessionParameter("currentTeacherId")
.toString()), "school", getCurrentUser().getSchool().getId());
setRowCount(new Long(receivedCorrespondences.size()));
}
}
return "Success";
}
public boolean isUserHasWriteAccess() {
if ( ((String)getSessionParameter("link")).equals("student")) {
return isUserHasWriteAccess(MenuIdEnum.STUDENT.getValue());
} else if ( ((String)getSessionParameter("link")).equals("teacher")) {
return isUserHasWriteAccess(MenuIdEnum.TEACHER.getValue());
} else if (((String)getSessionParameter("link")).equals("correspondance")) {
return isUserHasWriteAccess(MenuIdEnum.CORRESPONDENCE.getValue());
}
return false;
}
public BaseService getBaseService() {
return baseService;
}
public void setBaseService(BaseService baseService) {
this.baseService = baseService;
}
public Long getRowCount() {
return rowCount;
}
public void setRowCount(Long rowCount) {
this.rowCount = rowCount;
}
public List<BaseEntity> getCorrespondences() {
return correspondences;
}
public void setCorrespondences(List<BaseEntity> correspondences) {
this.correspondences = correspondences;
}
public Correspondence getCorrespondence() {
return correspondence;
}
public void setCorrespondence(Correspondence correspondence) {
this.correspondence = correspondence;
}
public List<Student> getAvailableStudents() {
return availableStudents;
}
public void setAvailableStudents(List<Student> availableStudents) {
this.availableStudents = availableStudents;
}
public List<Student> getSelectedStudents() {
return selectedStudents;
}
public void setSelectedStudents(List<Student> selectedStudents) {
this.selectedStudents = selectedStudents;
}
public List<Teacher> getAvailableTeachers() {
return availableTeachers;
}
public void setAvailableTeachers(List<Teacher> availableTeachers) {
this.availableTeachers = availableTeachers;
}
public List<Teacher> getSelectedTeachers() {
return selectedTeachers;
}
public void setSelectedTeachers(List<Teacher> selectedTeachers) {
this.selectedTeachers = selectedTeachers;
}
public String updateTeacherSelection() {
if (selectAllTeachers) {
selectAllStudents = false;
boxChecked = true;
} else {
boxChecked = false;
}
return "Success";
}
public String updateStudentSelection() {
if (selectAllStudents) {
selectAllTeachers = false;
boxChecked = true;
} else {
boxChecked = false;
}
return "Success";
}
public String search() {
availableTeachers = null;
availableStudents = null;
selectedStudents=new ArrayList<Student>();
selectedTeachers=new ArrayList<Teacher>();
if (boxChecked) {
if (selectAllStudents)
availableStudents = baseService.searchStudents(
selectAllStudents, className, year, getCurrentUser().getSchool());
else
availableTeachers = baseService.searchTeachers(
selectAllTeachers, className, year, getCurrentUser().getSchool());
} else {
availableStudents = baseService.searchStudents(selectAllStudents,
className, year, getCurrentUser().getSchool());
}
rowCount = new Long(availableTeachers != null ? availableTeachers
.size() : (availableStudents != null ? availableStudents.size()
: 0));
return "Success";
}
public String doNothing() {
return "Success";
}
public boolean isIndividual() {
return individual;
}
public void setIndividual(boolean individual) {
this.individual = individual;
}
public List<BaseEntity> getReceivedCorrespondences() {
return receivedCorrespondences;
}
public void setReceivedCorrespondences(
List<BaseEntity> receivedCorrespondences) {
this.receivedCorrespondences = receivedCorrespondences;
}
public Long getReceivedCorrespondenceCount() {
return receivedCorrespondenceCount;
}
public void setReceivedCorrespondenceCount(Long receivedCorrespondenceCount) {
this.receivedCorrespondenceCount = receivedCorrespondenceCount;
}
public boolean isSendEmail() {
return sendEmail;
}
public void setSendEmail(boolean sendEmail) {
this.sendEmail = sendEmail;
}
public Receiver getReceivedCorrespondence() {
return receivedCorrespondence;
}
public void setReceivedCorrespondence(Receiver receivedCorrespondence) {
this.receivedCorrespondence = receivedCorrespondence;
}
}
| 16,674 | 0.711227 | 0.710627 | 575 | 26.99826 | 26.277285 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.290435 | false | false | 13 |
ca44b27e0763b94939e2e99de2a0f422f167fd31 | 25,228,637,919,071 | 6921e00b26d8d3f29f5c220af62452c149500bd7 | /src/com/linkui/problems/PalindromeString.java | fcc429e69bdc1be42eca8123e8c55132a2d52c2c | [] | no_license | kevinlu323/JavaLearning | https://github.com/kevinlu323/JavaLearning | c46304b42f5645e5d049c0a496f61f95d48d5494 | 9aaa4845705be06ebfac3ee0f231888b4e0c1a2c | refs/heads/master | 2021-01-21T12:11:43.848000 | 2015-12-19T05:38:02 | 2015-12-19T05:38:02 | 37,619,352 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.linkui.problems;
import java.util.*;
public class PalindromeString {
public static void main(String[] args){
new PalindromeString().start();
}
public void start(){
String s1 = "A man, a plan, a canal: Panama";
String s2 = "1a2";
System.out.println(isPalindrome(s1));
System.out.println(isPalindrome(s2));
}
public boolean isPalindrome(String s) {
if (s == "") return false;
List<Character> list = new ArrayList<>();
s = s.toLowerCase();
for (int i = 0; i < s.length(); i++){
char c = s.charAt(i);
if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) list.add(c);
}
for (int i = 0; i < list.size() / 2; i++){
if(list.get(i) != list.get(list.size()-1-i)) return false;
}
return true;
}
}
| UTF-8 | Java | 776 | java | PalindromeString.java | Java | [] | null | [] | package com.linkui.problems;
import java.util.*;
public class PalindromeString {
public static void main(String[] args){
new PalindromeString().start();
}
public void start(){
String s1 = "A man, a plan, a canal: Panama";
String s2 = "1a2";
System.out.println(isPalindrome(s1));
System.out.println(isPalindrome(s2));
}
public boolean isPalindrome(String s) {
if (s == "") return false;
List<Character> list = new ArrayList<>();
s = s.toLowerCase();
for (int i = 0; i < s.length(); i++){
char c = s.charAt(i);
if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) list.add(c);
}
for (int i = 0; i < list.size() / 2; i++){
if(list.get(i) != list.get(list.size()-1-i)) return false;
}
return true;
}
}
| 776 | 0.563144 | 0.54768 | 30 | 23.866667 | 19.373062 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.166667 | false | false | 13 |
7246de260623e2673290b70dea78466157a1e41d | 12,721,693,156,509 | f024951ef421b906cad1d85483a5ff4418155ef6 | /confluence-plugin/src/main/java/com/jessamine/pdfreview/confluence/WatchPage.java | 75e061d9be4b624f0d8c4bc5a0138a6161a4678d | [
"BSD-3-Clause"
] | permissive | tied/pdfreview | https://github.com/tied/pdfreview | 0e08f1dff73c575d16e90b06f61403eb316a70a3 | e8a694848da9a99e78b9162f9d06c351d431a8de | refs/heads/master | 2022-12-14T20:55:41.495000 | 2020-09-22T08:36:17 | 2020-09-22T08:36:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jessamine.pdfreview.confluence;
import java.io.PrintWriter;
import java.io.StringWriter;
import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.confluence.core.ContentPropertyManager;
import com.atlassian.confluence.mail.notification.NotificationManager;
import com.atlassian.confluence.pages.Page;
import com.atlassian.confluence.pages.PageManager;
import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
import com.atlassian.user.User;
public class WatchPage extends ConfluenceActionSupport {
private static final long serialVersionUID = -7420092131908749335L;
private PageManager pageManager;
private NotificationManager notificationManager;
private ContentPropertyManager contentPropertyManager;
WatchPage(PageManager pageManager, NotificationManager notificationManager,
ContentPropertyManager contentPropertyManager) {
this.pageManager = pageManager;
this.notificationManager = notificationManager;
this.contentPropertyManager = contentPropertyManager;
}
private String page;
public String getPage() {
return page;
}
private Page thePage;
public void setPage(String s) {
page = s;
try {
thePage = pageManager.getPage(Long.parseLong(s));
} catch (Exception e) {
}
}
private String reviewId;
public void setId(String s) {
reviewId = s;
}
public String getError() {
return error;
}
private String error;
public String execute() {
// FIXME: ugly catch all
try {
if (thePage == null)
return "error";
User user = AuthenticatedUserThreadLocal.getUser();
if (user == null) {
error = "Not authenticated. Cannot proceed.";
return "error";
}
if (error == null || error.isEmpty()) {
notificationManager.addContentNotification(user, thePage);
String indexPageId = contentPropertyManager.getStringProperty(
thePage, "pdfreview.indexPageId");
if (indexPageId == null || indexPageId.isEmpty()) {
error = "<p><strong>Error:</strong> no review index associated.</p>";
return "error";
}
Page indexPage = (Page) pageManager.getPage(
Long.parseLong(indexPageId)).getLatestVersion();
if (indexPage == null) {
error = "<p><strong>Error:</strong> review index page '"
+ indexPageId + "' invalid.</p>";
return "error";
}
if (!ReviewStatus.updateStatus(contentPropertyManager,
indexPage, user, reviewId, ReviewStatus.UnderReview))
return "error";
return "success";
} else
return "error";
} catch (Exception e) {
StringWriter stack = new StringWriter();
e.printStackTrace(new PrintWriter(stack));
error = e.toString() + "\n" + stack.toString();
return "error";
}
}
}
| UTF-8 | Java | 2,707 | java | WatchPage.java | Java | [] | null | [] | package com.jessamine.pdfreview.confluence;
import java.io.PrintWriter;
import java.io.StringWriter;
import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.confluence.core.ContentPropertyManager;
import com.atlassian.confluence.mail.notification.NotificationManager;
import com.atlassian.confluence.pages.Page;
import com.atlassian.confluence.pages.PageManager;
import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
import com.atlassian.user.User;
public class WatchPage extends ConfluenceActionSupport {
private static final long serialVersionUID = -7420092131908749335L;
private PageManager pageManager;
private NotificationManager notificationManager;
private ContentPropertyManager contentPropertyManager;
WatchPage(PageManager pageManager, NotificationManager notificationManager,
ContentPropertyManager contentPropertyManager) {
this.pageManager = pageManager;
this.notificationManager = notificationManager;
this.contentPropertyManager = contentPropertyManager;
}
private String page;
public String getPage() {
return page;
}
private Page thePage;
public void setPage(String s) {
page = s;
try {
thePage = pageManager.getPage(Long.parseLong(s));
} catch (Exception e) {
}
}
private String reviewId;
public void setId(String s) {
reviewId = s;
}
public String getError() {
return error;
}
private String error;
public String execute() {
// FIXME: ugly catch all
try {
if (thePage == null)
return "error";
User user = AuthenticatedUserThreadLocal.getUser();
if (user == null) {
error = "Not authenticated. Cannot proceed.";
return "error";
}
if (error == null || error.isEmpty()) {
notificationManager.addContentNotification(user, thePage);
String indexPageId = contentPropertyManager.getStringProperty(
thePage, "pdfreview.indexPageId");
if (indexPageId == null || indexPageId.isEmpty()) {
error = "<p><strong>Error:</strong> no review index associated.</p>";
return "error";
}
Page indexPage = (Page) pageManager.getPage(
Long.parseLong(indexPageId)).getLatestVersion();
if (indexPage == null) {
error = "<p><strong>Error:</strong> review index page '"
+ indexPageId + "' invalid.</p>";
return "error";
}
if (!ReviewStatus.updateStatus(contentPropertyManager,
indexPage, user, reviewId, ReviewStatus.UnderReview))
return "error";
return "success";
} else
return "error";
} catch (Exception e) {
StringWriter stack = new StringWriter();
e.printStackTrace(new PrintWriter(stack));
error = e.toString() + "\n" + stack.toString();
return "error";
}
}
}
| 2,707 | 0.723679 | 0.71666 | 103 | 25.281553 | 22.980118 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.349514 | false | false | 13 |
f41193dd9dafaa08a22e20bc99db67f9f0a5d7bd | 14,405,320,376,949 | 11e04296918a1179b15c6c365298d07fa89d81ec | /app/src/main/java/com/akari/quark/entity/follow/Follow.java | e398592318d1e0e3baaaab69a37f9b4c3cc2da4c | [] | no_license | wangning13/AndroidAPP | https://github.com/wangning13/AndroidAPP | 246de571e213665e3acf3789228be9dab88dc6c6 | b7b594cad256626255f49a5b3b1a151ccedc80a6 | refs/heads/master | 2021-01-17T18:09:13.969000 | 2016-07-26T11:13:39 | 2016-07-26T11:13:39 | 64,112,947 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.akari.quark.entity.follow;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by Akari on 16/7/18.
*/
public class Follow {
/**
* status : 1
* error_code : null
* message : [{"id":12,"img_url":"default.png","name":"无名氏","introduction":null},{"id":8,"img_url":"default.png","name":"BOSS","introduction":null}]
*/
private int status;
private int error_code;
/**
* id : 12
* img_url : default.png
* name : 无名氏
* introduction : null
*/
@SerializedName("message")
private List<FollowMessage> followList;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getError_code() {
return error_code;
}
public void setError_code(int error_code) {
this.error_code = error_code;
}
public List<FollowMessage> getFollowList() {
return followList;
}
public void setFollowList(List<FollowMessage> followList) {
this.followList = followList;
}
}
| UTF-8 | Java | 1,126 | java | Follow.java | Java | [
{
"context": "edName;\n\nimport java.util.List;\n\n/**\n * Created by Akari on 16/7/18.\n */\npublic class Follow {\n /**\n ",
"end": 139,
"score": 0.9761592745780945,
"start": 134,
"tag": "NAME",
"value": "Akari"
}
] | null | [] | package com.akari.quark.entity.follow;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by Akari on 16/7/18.
*/
public class Follow {
/**
* status : 1
* error_code : null
* message : [{"id":12,"img_url":"default.png","name":"无名氏","introduction":null},{"id":8,"img_url":"default.png","name":"BOSS","introduction":null}]
*/
private int status;
private int error_code;
/**
* id : 12
* img_url : default.png
* name : 无名氏
* introduction : null
*/
@SerializedName("message")
private List<FollowMessage> followList;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getError_code() {
return error_code;
}
public void setError_code(int error_code) {
this.error_code = error_code;
}
public List<FollowMessage> getFollowList() {
return followList;
}
public void setFollowList(List<FollowMessage> followList) {
this.followList = followList;
}
}
| 1,126 | 0.601436 | 0.591562 | 52 | 20.423077 | 24.671961 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.365385 | false | false | 13 |
accb9ac57b1d6d6f9a8797e5f45fb15ed26de0f0 | 30,425,548,333,404 | dcf254aaae0673cb67d8b436b085142749d07eba | /unitunes/src/main/java/br/unisinos/unitunes/business/user/UserFacade.java | 5987dcd262954cfa65f48471b81915d914d37dcc | [] | no_license | gduranti/Unisinos | https://github.com/gduranti/Unisinos | 1b6b649d69476a3fb10cf9768cdbbe4595d4a891 | 9ebd8fb5e637b71b054fc60bf31d1c63243e538a | refs/heads/master | 2021-03-12T23:58:07.869000 | 2015-04-15T15:17:07 | 2015-04-15T15:17:07 | 14,075,946 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.unisinos.unitunes.business.user;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.hibernate.Hibernate;
import br.unisinos.unitunes.infra.exception.BusinessException;
import br.unisinos.unitunes.infra.impl.GenericFacade;
import br.unisinos.unitunes.model.Media;
import br.unisinos.unitunes.model.Status;
import br.unisinos.unitunes.model.User;
import br.unisinos.unitunes.model.UserType;
import br.unisinos.unitunes.model.event.MediaChangedEvent;
import br.unisinos.unitunes.model.event.UserInfoChangedEvent;
import br.unisinos.unitunes.model.event.UserMediaChangedEvent;
@Stateless
public class UserFacade extends GenericFacade<User> {
@Inject
private UserDAO userDAO;
@Inject
private Event<UserInfoChangedEvent> userInfoChangedEvent;
@Inject
private Event<UserMediaChangedEvent> userMediaChangedEvent;
@PostConstruct
public void init() {
super.setDao(userDAO);
}
@Override
public User add(User user) {
validateUniqueEmail(user);
user.setStatus(Status.ACTIVE);
user.setType(UserType.ACADEMIC);
user = super.add(user);
return user;
}
@Override
public User update(User user) {
user = super.update(user);
userInfoChangedEvent.fire(new UserInfoChangedEvent(user));
return user;
}
public User addPublishedMedia(Media media, User user) {
user.getPublishedMedias().add(media);
return updateUserMedia(media, user);
}
public User addPurchasedMedia(Media media, User user) {
user.getPurchasedMedias().add(media);
return updateUserMedia(media, user);
}
public User addFavoriteMedia(Media media, User user) {
user.getFavoritesMedias().add(media);
return updateUserMedia(media, user);
}
public User removeFavoriteMedia(Media media, User user) {
user.getFavoritesMedias().remove(media);
return updateUserMedia(media, user);
}
private User updateUserMedia(Media media, User user) {
user = update(user);
userMediaChangedEvent.fire(new UserMediaChangedEvent(media, user));
return user;
}
public void removeUserMedias(Media media) {
// TODO - Mudar regra para năo carregar todos os usuários...
List<User> allUsers = list(new User());
for (User user : allUsers) {
boolean removed = false;
removed |= user.getPurchasedMedias().remove(media);
removed |= user.getPublishedMedias().remove(media);
removed |= user.getFavoritesMedias().remove(media);
if (removed) {
user = update(user);
userMediaChangedEvent.fire(new UserMediaChangedEvent(media, user));
}
}
}
public User loggin(String email, String password) {
User example = new User();
example.setEmail(email);
example.setPassword(password);
List<User> list = userDAO.list(example);
if (!list.isEmpty()) {
User user = list.get(0);
if (user.getStatus() == Status.INACTIVE) {
throw new BusinessException("Este usuário está inativo.");
}
Hibernate.initialize(user.getPublishedMedias());
Hibernate.initialize(user.getFavoritesMedias());
Hibernate.initialize(user.getPurchasedMedias());
Hibernate.initialize(user.getPublishedAlbums());
return user;
}
throw new BusinessException("Usuário ou senha incorreta.");
}
public void observeMedias(@Observes MediaChangedEvent mediaChangedEvent) {
User user = mediaChangedEvent.getMedia().getAuthor();
if (user.getType() == UserType.ACADEMIC) {
user.setType(UserType.AUTHOR);
update(user);
}
}
private void validateUniqueEmail(User user) {
User example = new User();
example.setEmail(user.getEmail());
Long count = count(example);
if (count > 0) {
throw new BusinessException("Este e-mail já está cadastrado.");
}
}
@Override
public void remove(User user) {
user.setStatus(Status.INACTIVE);
update(user);
}
}
| ISO-8859-2 | Java | 3,856 | java | UserFacade.java | Java | [
{
"context": "\n\t\texample.setEmail(email);\n\t\texample.setPassword(password);\n\t\tList<User> list = userDAO.list(example);\n\n\t\ti",
"end": 2762,
"score": 0.9972013235092163,
"start": 2754,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | package br.unisinos.unitunes.business.user;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.hibernate.Hibernate;
import br.unisinos.unitunes.infra.exception.BusinessException;
import br.unisinos.unitunes.infra.impl.GenericFacade;
import br.unisinos.unitunes.model.Media;
import br.unisinos.unitunes.model.Status;
import br.unisinos.unitunes.model.User;
import br.unisinos.unitunes.model.UserType;
import br.unisinos.unitunes.model.event.MediaChangedEvent;
import br.unisinos.unitunes.model.event.UserInfoChangedEvent;
import br.unisinos.unitunes.model.event.UserMediaChangedEvent;
@Stateless
public class UserFacade extends GenericFacade<User> {
@Inject
private UserDAO userDAO;
@Inject
private Event<UserInfoChangedEvent> userInfoChangedEvent;
@Inject
private Event<UserMediaChangedEvent> userMediaChangedEvent;
@PostConstruct
public void init() {
super.setDao(userDAO);
}
@Override
public User add(User user) {
validateUniqueEmail(user);
user.setStatus(Status.ACTIVE);
user.setType(UserType.ACADEMIC);
user = super.add(user);
return user;
}
@Override
public User update(User user) {
user = super.update(user);
userInfoChangedEvent.fire(new UserInfoChangedEvent(user));
return user;
}
public User addPublishedMedia(Media media, User user) {
user.getPublishedMedias().add(media);
return updateUserMedia(media, user);
}
public User addPurchasedMedia(Media media, User user) {
user.getPurchasedMedias().add(media);
return updateUserMedia(media, user);
}
public User addFavoriteMedia(Media media, User user) {
user.getFavoritesMedias().add(media);
return updateUserMedia(media, user);
}
public User removeFavoriteMedia(Media media, User user) {
user.getFavoritesMedias().remove(media);
return updateUserMedia(media, user);
}
private User updateUserMedia(Media media, User user) {
user = update(user);
userMediaChangedEvent.fire(new UserMediaChangedEvent(media, user));
return user;
}
public void removeUserMedias(Media media) {
// TODO - Mudar regra para năo carregar todos os usuários...
List<User> allUsers = list(new User());
for (User user : allUsers) {
boolean removed = false;
removed |= user.getPurchasedMedias().remove(media);
removed |= user.getPublishedMedias().remove(media);
removed |= user.getFavoritesMedias().remove(media);
if (removed) {
user = update(user);
userMediaChangedEvent.fire(new UserMediaChangedEvent(media, user));
}
}
}
public User loggin(String email, String password) {
User example = new User();
example.setEmail(email);
example.setPassword(<PASSWORD>);
List<User> list = userDAO.list(example);
if (!list.isEmpty()) {
User user = list.get(0);
if (user.getStatus() == Status.INACTIVE) {
throw new BusinessException("Este usuário está inativo.");
}
Hibernate.initialize(user.getPublishedMedias());
Hibernate.initialize(user.getFavoritesMedias());
Hibernate.initialize(user.getPurchasedMedias());
Hibernate.initialize(user.getPublishedAlbums());
return user;
}
throw new BusinessException("Usuário ou senha incorreta.");
}
public void observeMedias(@Observes MediaChangedEvent mediaChangedEvent) {
User user = mediaChangedEvent.getMedia().getAuthor();
if (user.getType() == UserType.ACADEMIC) {
user.setType(UserType.AUTHOR);
update(user);
}
}
private void validateUniqueEmail(User user) {
User example = new User();
example.setEmail(user.getEmail());
Long count = count(example);
if (count > 0) {
throw new BusinessException("Este e-mail já está cadastrado.");
}
}
@Override
public void remove(User user) {
user.setStatus(Status.INACTIVE);
update(user);
}
}
| 3,858 | 0.746428 | 0.745908 | 144 | 25.729166 | 22.058073 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.833333 | false | false | 13 |
85f620a5dcb40acf88a9b4a8527dd64bea66877c | 28,527,172,782,381 | 4a35ae46608c39ec9ccf02b855b365379c34f938 | /src/utffix/TelaMeusChamados.java | 163e8b2596cc5d4512cdd90a0b3f48cfa37a0f0c | [
"MIT"
] | permissive | mariliafernandez/UTFfix | https://github.com/mariliafernandez/UTFfix | 9e8570aebb745bc84e1ffa770741958837daf52f | fab94fdd4c6e772312ef984244d0473045e83441 | refs/heads/master | 2020-06-18T10:01:21.942000 | 2019-07-10T19:28:57 | 2019-07-10T19:28:57 | 192,392,483 | 1 | 0 | null | false | 2019-07-02T22:17:37 | 2019-06-17T17:44:24 | 2019-07-02T22:16:02 | 2019-07-02T22:17:37 | 1,170 | 1 | 0 | 0 | Java | false | false | package utffix;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.ArrayList;
import javax.swing.DefaultListModel;
import java.time.LocalDate;
import java.sql.Date;
public class TelaMeusChamados extends javax.swing.JFrame {
private int w = 500;
private int h = 400;
private Usuario user;
private DefaultListModel list = new DefaultListModel();
public TelaMeusChamados(Usuario user) {
initComponents();
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
int x = (dim.width-w)/2;
int y = (dim.height-h)/2;
this.user = user;
this.setSize(w, h);
this.setTitle("UTFFix | Meus Chamados");
this.setLocation(x, y);
populateList();
labelTitulo.setText("Nenhum chamado selecionado");
labelLocal.setText("");
labelDesc.setText("");
labelData.setText("");
labelStatus.setText("");
labelEquip.setText("");
labelCodigo.setText("");
}
public void populateList() {
Chamado consulta = new Chamado();
ArrayList<Chamado> chamados = consulta.consultarChamadosUsuario(user);
for(Chamado chamado : chamados) {
list.addElement(chamado);
}
listChamados.setModel(list);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
listChamados = new javax.swing.JList<>();
jSeparator1 = new javax.swing.JSeparator();
labelTitulo = new javax.swing.JLabel();
labelLocal = new javax.swing.JLabel();
labelEquip = new javax.swing.JLabel();
labelDesc = new javax.swing.JLabel();
labelData = new javax.swing.JLabel();
labelStatus = new javax.swing.JLabel();
btnVoltar = new javax.swing.JButton();
btnSair = new javax.swing.JButton();
labelCodigo = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
listChamados.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
listChamados.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
listChamadosMouseClicked(evt);
}
});
jScrollPane1.setViewportView(listChamados);
labelTitulo.setText("jLabel1");
labelLocal.setText("jLabel2");
labelEquip.setText("jLabel3");
labelDesc.setText("jLabel4");
labelData.setText("jLabel5");
labelStatus.setText("jLabel6");
btnVoltar.setText("Voltar");
btnVoltar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnVoltarActionPerformed(evt);
}
});
btnSair.setText("Sair");
btnSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSairActionPerformed(evt);
}
});
labelCodigo.setText("jLabel1");
jLabel1.setText("Meus chamados");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnVoltar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(labelTitulo)
.addGap(43, 43, 43)
.addComponent(labelCodigo))
.addComponent(labelLocal)
.addComponent(labelEquip)
.addComponent(labelDesc)
.addComponent(labelData)
.addComponent(labelStatus))
.addGap(0, 109, Short.MAX_VALUE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(76, 76, 76)
.addComponent(btnSair, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelTitulo)
.addComponent(labelCodigo)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(labelLocal)
.addGap(18, 18, 18)
.addComponent(labelEquip)
.addGap(18, 18, 18)
.addComponent(labelDesc)
.addGap(16, 16, 16)
.addComponent(labelData)
.addGap(18, 18, 18)
.addComponent(labelStatus))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnVoltar)
.addComponent(btnSair))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void listChamadosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listChamadosMouseClicked
int index = listChamados.locationToIndex(evt.getPoint());
if(index >= 0) {
Object obj = listChamados.getModel().getElementAt(index);
System.out.println("clicked on " + obj.toString());
Chamado chamadoClick = (Chamado) obj;
if(chamadoClick != null) {
System.out.println(chamadoClick.getCodEquipamento());
labelTitulo.setText("Chamado ");
labelCodigo.setText(chamadoClick.getCodigo() + "");
labelLocal.setText("Local: " +chamadoClick.getLocal());
labelDesc.setText("Descrição: " +chamadoClick.getDefeito());
labelData.setText("Chamado aberto em: " +chamadoClick.getDataAbertura().getDayOfMonth() + " / " + chamadoClick.getDataAbertura().getMonthValue() + " / " + chamadoClick.getDataAbertura().getYear());
System.out.println(chamadoClick.getDataFechamento());
if(chamadoClick.getDataFechamento() == null)
labelStatus.setText("Status: Em aberto");
else
labelStatus.setText("Status: Finalizado");
chamadoClick.getCodEquipamento();
Equipamento equip = new Equipamento();
labelEquip.setText(equip.consultarEquipamento(chamadoClick.getCodEquipamento()).getNome() + " " + equip.consultarEquipamento(chamadoClick.getCodEquipamento()).getCodigo());
//labelEquip.setText(equip.consultarEquipamento(chamadoClick.getCodEquipamento()).setNome(nome) + " " + equip.consultarEquipamento(chamadoClick.getCodEquipamento()).getCodigo());
//labelEquip.setText(equip..getNome() +" "+ chamadoClick.getCodEquipamento());
}
}
}//GEN-LAST:event_listChamadosMouseClicked
private void btnVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVoltarActionPerformed
new TelaPrincipalSolicitante(user).setVisible(true);
dispose();
}//GEN-LAST:event_btnVoltarActionPerformed
private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
new TelaLogin().setVisible(true);
dispose();
}//GEN-LAST:event_btnSairActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnSair;
private javax.swing.JButton btnVoltar;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JLabel labelCodigo;
private javax.swing.JLabel labelData;
private javax.swing.JLabel labelDesc;
private javax.swing.JLabel labelEquip;
private javax.swing.JLabel labelLocal;
private javax.swing.JLabel labelStatus;
private javax.swing.JLabel labelTitulo;
private javax.swing.JList<String> listChamados;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 12,213 | java | TelaMeusChamados.java | Java | [] | null | [] | package utffix;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.ArrayList;
import javax.swing.DefaultListModel;
import java.time.LocalDate;
import java.sql.Date;
public class TelaMeusChamados extends javax.swing.JFrame {
private int w = 500;
private int h = 400;
private Usuario user;
private DefaultListModel list = new DefaultListModel();
public TelaMeusChamados(Usuario user) {
initComponents();
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
int x = (dim.width-w)/2;
int y = (dim.height-h)/2;
this.user = user;
this.setSize(w, h);
this.setTitle("UTFFix | Meus Chamados");
this.setLocation(x, y);
populateList();
labelTitulo.setText("Nenhum chamado selecionado");
labelLocal.setText("");
labelDesc.setText("");
labelData.setText("");
labelStatus.setText("");
labelEquip.setText("");
labelCodigo.setText("");
}
public void populateList() {
Chamado consulta = new Chamado();
ArrayList<Chamado> chamados = consulta.consultarChamadosUsuario(user);
for(Chamado chamado : chamados) {
list.addElement(chamado);
}
listChamados.setModel(list);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
listChamados = new javax.swing.JList<>();
jSeparator1 = new javax.swing.JSeparator();
labelTitulo = new javax.swing.JLabel();
labelLocal = new javax.swing.JLabel();
labelEquip = new javax.swing.JLabel();
labelDesc = new javax.swing.JLabel();
labelData = new javax.swing.JLabel();
labelStatus = new javax.swing.JLabel();
btnVoltar = new javax.swing.JButton();
btnSair = new javax.swing.JButton();
labelCodigo = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
listChamados.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
listChamados.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
listChamadosMouseClicked(evt);
}
});
jScrollPane1.setViewportView(listChamados);
labelTitulo.setText("jLabel1");
labelLocal.setText("jLabel2");
labelEquip.setText("jLabel3");
labelDesc.setText("jLabel4");
labelData.setText("jLabel5");
labelStatus.setText("jLabel6");
btnVoltar.setText("Voltar");
btnVoltar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnVoltarActionPerformed(evt);
}
});
btnSair.setText("Sair");
btnSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSairActionPerformed(evt);
}
});
labelCodigo.setText("jLabel1");
jLabel1.setText("Meus chamados");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnVoltar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(labelTitulo)
.addGap(43, 43, 43)
.addComponent(labelCodigo))
.addComponent(labelLocal)
.addComponent(labelEquip)
.addComponent(labelDesc)
.addComponent(labelData)
.addComponent(labelStatus))
.addGap(0, 109, Short.MAX_VALUE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(76, 76, 76)
.addComponent(btnSair, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelTitulo)
.addComponent(labelCodigo)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(labelLocal)
.addGap(18, 18, 18)
.addComponent(labelEquip)
.addGap(18, 18, 18)
.addComponent(labelDesc)
.addGap(16, 16, 16)
.addComponent(labelData)
.addGap(18, 18, 18)
.addComponent(labelStatus))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnVoltar)
.addComponent(btnSair))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void listChamadosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listChamadosMouseClicked
int index = listChamados.locationToIndex(evt.getPoint());
if(index >= 0) {
Object obj = listChamados.getModel().getElementAt(index);
System.out.println("clicked on " + obj.toString());
Chamado chamadoClick = (Chamado) obj;
if(chamadoClick != null) {
System.out.println(chamadoClick.getCodEquipamento());
labelTitulo.setText("Chamado ");
labelCodigo.setText(chamadoClick.getCodigo() + "");
labelLocal.setText("Local: " +chamadoClick.getLocal());
labelDesc.setText("Descrição: " +chamadoClick.getDefeito());
labelData.setText("Chamado aberto em: " +chamadoClick.getDataAbertura().getDayOfMonth() + " / " + chamadoClick.getDataAbertura().getMonthValue() + " / " + chamadoClick.getDataAbertura().getYear());
System.out.println(chamadoClick.getDataFechamento());
if(chamadoClick.getDataFechamento() == null)
labelStatus.setText("Status: Em aberto");
else
labelStatus.setText("Status: Finalizado");
chamadoClick.getCodEquipamento();
Equipamento equip = new Equipamento();
labelEquip.setText(equip.consultarEquipamento(chamadoClick.getCodEquipamento()).getNome() + " " + equip.consultarEquipamento(chamadoClick.getCodEquipamento()).getCodigo());
//labelEquip.setText(equip.consultarEquipamento(chamadoClick.getCodEquipamento()).setNome(nome) + " " + equip.consultarEquipamento(chamadoClick.getCodEquipamento()).getCodigo());
//labelEquip.setText(equip..getNome() +" "+ chamadoClick.getCodEquipamento());
}
}
}//GEN-LAST:event_listChamadosMouseClicked
private void btnVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVoltarActionPerformed
new TelaPrincipalSolicitante(user).setVisible(true);
dispose();
}//GEN-LAST:event_btnVoltarActionPerformed
private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
new TelaLogin().setVisible(true);
dispose();
}//GEN-LAST:event_btnSairActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnSair;
private javax.swing.JButton btnVoltar;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JLabel labelCodigo;
private javax.swing.JLabel labelData;
private javax.swing.JLabel labelDesc;
private javax.swing.JLabel labelEquip;
private javax.swing.JLabel labelLocal;
private javax.swing.JLabel labelStatus;
private javax.swing.JLabel labelTitulo;
private javax.swing.JList<String> listChamados;
// End of variables declaration//GEN-END:variables
}
| 12,213 | 0.611334 | 0.601343 | 257 | 46.513618 | 34.969814 | 213 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.622568 | false | false | 13 |
3903016b536d5984c4af4f4784f54030881ad851 | 11,536,282,163,471 | cbea2f0050c1d4f79a8e61e670ce8ec98446bcc0 | /samples/msa-weather-collection-eureka-feign/src/main/java/com/waylau/spring/cloud/weather/service/WeatherDataCollectionService.java | 96b4621bd30a1e4586b6aaed514118da93e82417 | [] | no_license | shinecanvas/spring-cloud-microservices-development | https://github.com/shinecanvas/spring-cloud-microservices-development | 51451f3dbef8a550fd3b30731c52048222a0794e | 406824ebe7ee74e00bff5fd4d4bbe8f1fcdcb901 | refs/heads/master | 2020-06-06T04:32:17.452000 | 2019-07-06T07:05:04 | 2019-07-06T07:05:04 | 192,638,492 | 1 | 0 | null | true | 2019-06-19T01:45:06 | 2019-06-19T01:45:06 | 2019-06-15T06:22:57 | 2018-06-14T11:28:17 | 516 | 0 | 0 | 0 | null | false | false | package com.waylau.spring.cloud.weather.service;
/**
* 天气数据采集服务.
*
* @since 1.0.0 2017年10月29日
* @author <a href="https://waylau.com">Way Lau</a>
*/
public interface WeatherDataCollectionService {
/**
* 根据城市ID同步天气数据
*
* @param cityId
* @return
*/
void syncDataByCityId(String cityId);
}
| UTF-8 | Java | 351 | java | WeatherDataCollectionService.java | Java | [
{
"context": "17年10月29日\n * @author <a href=\"https://waylau.com\">Way Lau</a>\n */\npublic interface WeatherDataCollectionSer",
"end": 146,
"score": 0.9994895458221436,
"start": 139,
"tag": "NAME",
"value": "Way Lau"
}
] | null | [] | package com.waylau.spring.cloud.weather.service;
/**
* 天气数据采集服务.
*
* @since 1.0.0 2017年10月29日
* @author <a href="https://waylau.com"><NAME></a>
*/
public interface WeatherDataCollectionService {
/**
* 根据城市ID同步天气数据
*
* @param cityId
* @return
*/
void syncDataByCityId(String cityId);
}
| 350 | 0.660194 | 0.624595 | 19 | 15.263158 | 17.392805 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false | 13 |
9fdfb5b6fc99947787b17e97a50578c428bcead9 | 18,975,165,530,968 | 73699c1f30fcc2a93a3bca02654757f44cff2d99 | /server-Market/src/com/mas/rave/main/vo/AppAlbumColumn.java | ab7692e4bf79c1301925b5a429c2a8a424b1e6f2 | [] | no_license | Unikince/game-center | https://github.com/Unikince/game-center | 4b3a6a38d925c55f710a9d96081fd7a5ebba1f35 | a359f959773d21c42e12fb4805c0440224f156c3 | refs/heads/master | 2020-06-17T11:37:03.668000 | 2017-01-19T08:50:48 | 2017-01-19T08:50:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mas.rave.main.vo;
import java.util.Date;
/**
* app对应专辑
*
* @author liwei.sz
*
*/
public class AppAlbumColumn {
private int columnId;
private AppAlbum appAlbum;// 大类别Id',
private String name;// 页签名称',
private String nameCn;// 页签中文名称',
private String icon;// 页签的小图标(列表显示)',
private String bigicon;// 专题大图(页签详情时要显示)',
private String description;// 页签描述',
private int sort;// 排序(按数字大小从大到小排序)',
private boolean state;// 状态',
private int flag;// 标识',
private Date createTime;// 创建时间',
private String operator;// 后台操作人',
private boolean checked;
public int getColumnId() {
return columnId;
}
public void setColumnId(int columnId) {
this.columnId = columnId;
}
public AppAlbum getAppAlbum() {
return appAlbum;
}
public void setAppAlbum(AppAlbum appAlbum) {
this.appAlbum = appAlbum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNameCn() {
return nameCn;
}
public void setNameCn(String nameCn) {
this.nameCn = nameCn;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getBigicon() {
return bigicon;
}
public void setBigicon(String bigicon) {
this.bigicon = bigicon;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
}
| UTF-8 | Java | 2,292 | java | AppAlbumColumn.java | Java | [
{
"context": "ort java.util.Date;\n\n/**\n * app对应专辑\n * \n * @author liwei.sz\n * \n */\npublic class AppAlbumColumn {\n\tprivate in",
"end": 93,
"score": 0.9983975291252136,
"start": 85,
"tag": "USERNAME",
"value": "liwei.sz"
}
] | null | [] | package com.mas.rave.main.vo;
import java.util.Date;
/**
* app对应专辑
*
* @author liwei.sz
*
*/
public class AppAlbumColumn {
private int columnId;
private AppAlbum appAlbum;// 大类别Id',
private String name;// 页签名称',
private String nameCn;// 页签中文名称',
private String icon;// 页签的小图标(列表显示)',
private String bigicon;// 专题大图(页签详情时要显示)',
private String description;// 页签描述',
private int sort;// 排序(按数字大小从大到小排序)',
private boolean state;// 状态',
private int flag;// 标识',
private Date createTime;// 创建时间',
private String operator;// 后台操作人',
private boolean checked;
public int getColumnId() {
return columnId;
}
public void setColumnId(int columnId) {
this.columnId = columnId;
}
public AppAlbum getAppAlbum() {
return appAlbum;
}
public void setAppAlbum(AppAlbum appAlbum) {
this.appAlbum = appAlbum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNameCn() {
return nameCn;
}
public void setNameCn(String nameCn) {
this.nameCn = nameCn;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getBigicon() {
return bigicon;
}
public void setBigicon(String bigicon) {
this.bigicon = bigicon;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
}
| 2,292 | 0.687675 | 0.687675 | 130 | 15.476923 | 14.880661 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.3 | false | false | 13 |
30db11b8faef9865a439796ed8f8274cd8903f27 | 29,686,813,958,844 | ffe4b7dddb48b99e6e53c0165bc0d0a648db7412 | /Spring Data Intro/src/main/java/services/implementation/UserServiceImpl.java | 95117d2131474229b115706ca38f79f096c2cf03 | [] | no_license | ivandanin/Softuni-Java-DB-Spring | https://github.com/ivandanin/Softuni-Java-DB-Spring | a3f017712ed22fef99695b3ca3f68f357eb56dc2 | f7115e092eb4bf26528aedc3fc120596dcdc156a | refs/heads/main | 2023-06-27T19:24:13.481000 | 2021-08-01T10:00:47 | 2021-08-01T10:00:47 | 379,180,403 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package services.implementation;
import entities.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repositories.UserRepository;
import services.UserService;
import javax.transaction.Transactional;
@Transactional
@Service
public class UserServiceImpl implements UserService {
private UserRepository userRepository;
@Autowired
public UserServiceImpl(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
public User register(User user) {
return userRepository.save(user);
}
}
| UTF-8 | Java | 626 | java | UserServiceImpl.java | Java | [] | null | [] | package services.implementation;
import entities.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repositories.UserRepository;
import services.UserService;
import javax.transaction.Transactional;
@Transactional
@Service
public class UserServiceImpl implements UserService {
private UserRepository userRepository;
@Autowired
public UserServiceImpl(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
public User register(User user) {
return userRepository.save(user);
}
}
| 626 | 0.78115 | 0.78115 | 26 | 23.076923 | 20.488127 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 13 |
dfc35b12535f53d4a8ecc80559317b93d442386d | 25,383,256,727,998 | 6dfc1cbe2413123253111d9307e1207b14829108 | /src/fr/univangers/ester/mongodb/Database.java | b779a09054e8fa04f2984c4653a05f401d6eced9 | [] | no_license | nordinaryguy/Projet_ESTER | https://github.com/nordinaryguy/Projet_ESTER | b9c15859e42c7e2fea5f47be15776150a412bd7f | 7f7948b87611ad026244bb8cce14de5be56f31a9 | refs/heads/master | 2020-03-28T14:21:28.081000 | 2018-12-07T17:07:37 | 2018-12-07T17:07:37 | 148,480,813 | 2 | 2 | null | false | 2018-11-28T21:49:00 | 2018-09-12T12:59:34 | 2018-10-24T07:00:41 | 2018-11-28T21:48:59 | 5,916 | 2 | 2 | 0 | HTML | false | null | package fr.univangers.ester.mongodb;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
import at.favre.lib.crypto.bcrypt.BCrypt;
public abstract class Database {
private static final String HOSTNAME = "localhost";
private static final int PORT = 27017;
private static final String DBNAME = "BDD_ESTER_DEV";
private static MongoDatabase mgdb;
public MongoDatabase db() {
if(mgdb == null) {
mgdb = MongoClients.create("mongodb://" + HOSTNAME + ":" + PORT).getDatabase(DBNAME);
}
return mgdb;
}
public String cryptPassword(String password) {
return BCrypt.withDefaults().hashToString(BCrypt.MIN_COST, password.toCharArray());
}
public boolean verifyPassword(String password, String passwordCrypt) {
return BCrypt.verifyer().verify(password.toCharArray(), passwordCrypt).verified;
}
}
| UTF-8 | Java | 855 | java | Database.java | Java | [] | null | [] | package fr.univangers.ester.mongodb;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
import at.favre.lib.crypto.bcrypt.BCrypt;
public abstract class Database {
private static final String HOSTNAME = "localhost";
private static final int PORT = 27017;
private static final String DBNAME = "BDD_ESTER_DEV";
private static MongoDatabase mgdb;
public MongoDatabase db() {
if(mgdb == null) {
mgdb = MongoClients.create("mongodb://" + HOSTNAME + ":" + PORT).getDatabase(DBNAME);
}
return mgdb;
}
public String cryptPassword(String password) {
return BCrypt.withDefaults().hashToString(BCrypt.MIN_COST, password.toCharArray());
}
public boolean verifyPassword(String password, String passwordCrypt) {
return BCrypt.verifyer().verify(password.toCharArray(), passwordCrypt).verified;
}
}
| 855 | 0.74269 | 0.736842 | 33 | 24.90909 | 27.727421 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.393939 | false | false | 13 |
cf2d209426e502801b525b89f3cfeab7aeca9cd7 | 11,647,951,315,290 | 02a7d8477ade9e35ebe5fb932d888474df186c5a | /main/src/com/smartgwt/client/widgets/form/validator/ContainsValidator.java | b8ba53ecf8f8cef4c7fb5dbdc6d02d1c44ecffea | [] | no_license | miunsi63/smartgwt | https://github.com/miunsi63/smartgwt | 39575568ac8d2184d49cbcfb2311999150619c49 | 36f21279de6fb5588ca8cbff6bf015871c65194b | refs/heads/master | 2020-06-14T15:29:31.789000 | 2019-03-25T03:40:15 | 2019-03-25T03:40:15 | 35,267,091 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.smartgwt.client.widgets.form.validator;
/**
* Determine whether a string value contains some substring specified via {@link #setSubstring(String) substring}.
*/
public class ContainsValidator extends Validator {
public ContainsValidator() {
setAttribute("type", "contains");
}
public void setSubstring(String substring) {
setAttribute("substring", substring);
}
public String getSubstring() {
return getAttribute("substring");
}
}
| UTF-8 | Java | 516 | java | ContainsValidator.java | Java | [] | null | [] | package com.smartgwt.client.widgets.form.validator;
/**
* Determine whether a string value contains some substring specified via {@link #setSubstring(String) substring}.
*/
public class ContainsValidator extends Validator {
public ContainsValidator() {
setAttribute("type", "contains");
}
public void setSubstring(String substring) {
setAttribute("substring", substring);
}
public String getSubstring() {
return getAttribute("substring");
}
}
| 516 | 0.668605 | 0.668605 | 19 | 25.157894 | 29.052155 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 13 |
a38b2b24029c8b66ac874bdbc9fedfcf26b86683 | 5,746,666,279,121 | 7ef841751c77207651aebf81273fcc972396c836 | /bstream/src/main/java/com/loki/bstream/stubs/SampleClass3955.java | 88c6e542ce6e660fcc216ad8410b8d8d4512a8df | [] | no_license | SergiiGrechukha/ModuleApp | https://github.com/SergiiGrechukha/ModuleApp | e28e4dd39505924f0d36b4a0c3acd76a67ed4118 | 00e22d51c8f7100e171217bcc61f440f94ab9c52 | refs/heads/master | 2022-05-07T13:27:37.704000 | 2019-11-22T07:11:19 | 2019-11-22T07:11:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.loki.bstream.stubs;
public class SampleClass3955 {
private SampleClass3956 sampleClass;
public SampleClass3955(){
sampleClass = new SampleClass3956();
}
public String getClassName() {
return sampleClass.getClassName();
}
} | UTF-8 | Java | 274 | java | SampleClass3955.java | Java | [] | null | [] | package com.loki.bstream.stubs;
public class SampleClass3955 {
private SampleClass3956 sampleClass;
public SampleClass3955(){
sampleClass = new SampleClass3956();
}
public String getClassName() {
return sampleClass.getClassName();
}
} | 274 | 0.686131 | 0.627737 | 14 | 18.642857 | 17.613337 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 13 |
0f290766116b4142d9d042669b63b328824e90c9 | 5,746,666,276,504 | 637f327c6ebf19d7fbb1b2e656327dece40bc8a7 | /SRL_28-20-2020morning/src/main/java/com/iteanz/srl/domain/WorkflowConfig.java | b764684e278ec7a5d479f805f438be842dabd18f | [] | no_license | prasunpatidar94/GitHub_Parsun_WorkSpace | https://github.com/prasunpatidar94/GitHub_Parsun_WorkSpace | af6adf9ba49dfca2dfc5012ca6c84b515f751a9d | 1c9d3e736fa4c446853ebedb00cbc6f1d6c85c47 | refs/heads/master | 2022-06-10T03:43:42.498000 | 2020-03-13T18:51:46 | 2020-03-13T18:51:46 | 247,139,708 | 0 | 0 | null | false | 2022-09-01T23:21:31 | 2020-03-13T18:42:50 | 2020-03-13T18:52:04 | 2022-09-01T23:21:29 | 46,559 | 0 | 0 | 2 | Java | false | false | package com.iteanz.srl.domain;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
@Entity
@Table(name="WorkflowConfig")
public class WorkflowConfig {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@SequenceGenerator(sequenceName = "WorkflowConfig_seq", allocationSize = 1, name = "WorkflowConfig_s")
@Column(name = "id")
private Long id;
@Column(name = "appid")
String appid;
/*@Column(name = "reqid")
String reqid;*/
@Column(name = "description")
String description;
@Column(name = "subprocess")
String subProcess;
@Column(name = "aprvLevels")
int aprvLevels;
@Column(name = "condition")
String condition;
/*@Column(name = "actstatus")
String actstatus;*/
@Column(name = "aprv1")
String aprv1;
@Column(name = "aprv2")
String aprv2;
@Column(name = "aprv3")
String aprv3;
@Column(name = "aprv4")
String aprv4;
@Column(name = "aprv5")
String aprv5;
@Column(name = "aprv6")
String aprv6;
@Column(name = "aprv7")
String aprv7;
@Column(name = "aprv8")
String aprv8;
@Column(name = "aprv9")
String aprv9;
@Column(name = "aprv10")
String aprv10;
@Column(name = "createdBy")
String createdBy;
@Column(name = "changeddBy")
String changeddBy;
@Column(name = "createdDate")
Date createdDate;
@Column(name = "changedDate")
Date changedDate;
@ManyToOne(fetch = FetchType.EAGER)
@Cascade(value = { CascadeType.MERGE, CascadeType.PERSIST })
@JoinColumn(name = "status")
private Status status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getAprvLevels() {
return aprvLevels;
}
public void setAprvLevels(int aprvLevels) {
this.aprvLevels = aprvLevels;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
/*public String getActstatus() {
return actstatus;
}
public void setActstatus(String actstatus) {
this.actstatus = actstatus;
}*/
public String getAprv1() {
return aprv1;
}
public void setAprv1(String aprv1) {
this.aprv1 = aprv1;
}
public String getAprv2() {
return aprv2;
}
public void setAprv2(String aprv2) {
this.aprv2 = aprv2;
}
public String getAprv3() {
return aprv3;
}
public void setAprv3(String aprv3) {
this.aprv3 = aprv3;
}
public String getAprv4() {
return aprv4;
}
public void setAprv4(String aprv4) {
this.aprv4 = aprv4;
}
public String getAprv5() {
return aprv5;
}
public void setAprv5(String aprv5) {
this.aprv5 = aprv5;
}
public String getAprv6() {
return aprv6;
}
public void setAprv6(String aprv6) {
this.aprv6 = aprv6;
}
public String getAprv7() {
return aprv7;
}
public void setAprv7(String aprv7) {
this.aprv7 = aprv7;
}
public String getAprv8() {
return aprv8;
}
public void setAprv8(String aprv8) {
this.aprv8 = aprv8;
}
public String getAprv9() {
return aprv9;
}
public void setAprv9(String aprv9) {
this.aprv9 = aprv9;
}
public String getAprv10() {
return aprv10;
}
public void setAprv10(String aprv10) {
this.aprv10 = aprv10;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public String getChangeddBy() {
return changeddBy;
}
public void setChangeddBy(String changeddBy) {
this.changeddBy = changeddBy;
}
public Date getChangedDate() {
return changedDate;
}
public void setChangedDate(Date changedDate) {
this.changedDate = changedDate;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getSubProcess() {
return subProcess;
}
public void setSubProcess(String subProcess) {
this.subProcess = subProcess;
}
/* public String getReqid() {
return reqid;
}
public void setReqid(String reqid) {
this.reqid = reqid;
}*/
}
| UTF-8 | Java | 4,750 | java | WorkflowConfig.java | Java | [] | null | [] | package com.iteanz.srl.domain;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
@Entity
@Table(name="WorkflowConfig")
public class WorkflowConfig {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@SequenceGenerator(sequenceName = "WorkflowConfig_seq", allocationSize = 1, name = "WorkflowConfig_s")
@Column(name = "id")
private Long id;
@Column(name = "appid")
String appid;
/*@Column(name = "reqid")
String reqid;*/
@Column(name = "description")
String description;
@Column(name = "subprocess")
String subProcess;
@Column(name = "aprvLevels")
int aprvLevels;
@Column(name = "condition")
String condition;
/*@Column(name = "actstatus")
String actstatus;*/
@Column(name = "aprv1")
String aprv1;
@Column(name = "aprv2")
String aprv2;
@Column(name = "aprv3")
String aprv3;
@Column(name = "aprv4")
String aprv4;
@Column(name = "aprv5")
String aprv5;
@Column(name = "aprv6")
String aprv6;
@Column(name = "aprv7")
String aprv7;
@Column(name = "aprv8")
String aprv8;
@Column(name = "aprv9")
String aprv9;
@Column(name = "aprv10")
String aprv10;
@Column(name = "createdBy")
String createdBy;
@Column(name = "changeddBy")
String changeddBy;
@Column(name = "createdDate")
Date createdDate;
@Column(name = "changedDate")
Date changedDate;
@ManyToOne(fetch = FetchType.EAGER)
@Cascade(value = { CascadeType.MERGE, CascadeType.PERSIST })
@JoinColumn(name = "status")
private Status status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getAprvLevels() {
return aprvLevels;
}
public void setAprvLevels(int aprvLevels) {
this.aprvLevels = aprvLevels;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
/*public String getActstatus() {
return actstatus;
}
public void setActstatus(String actstatus) {
this.actstatus = actstatus;
}*/
public String getAprv1() {
return aprv1;
}
public void setAprv1(String aprv1) {
this.aprv1 = aprv1;
}
public String getAprv2() {
return aprv2;
}
public void setAprv2(String aprv2) {
this.aprv2 = aprv2;
}
public String getAprv3() {
return aprv3;
}
public void setAprv3(String aprv3) {
this.aprv3 = aprv3;
}
public String getAprv4() {
return aprv4;
}
public void setAprv4(String aprv4) {
this.aprv4 = aprv4;
}
public String getAprv5() {
return aprv5;
}
public void setAprv5(String aprv5) {
this.aprv5 = aprv5;
}
public String getAprv6() {
return aprv6;
}
public void setAprv6(String aprv6) {
this.aprv6 = aprv6;
}
public String getAprv7() {
return aprv7;
}
public void setAprv7(String aprv7) {
this.aprv7 = aprv7;
}
public String getAprv8() {
return aprv8;
}
public void setAprv8(String aprv8) {
this.aprv8 = aprv8;
}
public String getAprv9() {
return aprv9;
}
public void setAprv9(String aprv9) {
this.aprv9 = aprv9;
}
public String getAprv10() {
return aprv10;
}
public void setAprv10(String aprv10) {
this.aprv10 = aprv10;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public String getChangeddBy() {
return changeddBy;
}
public void setChangeddBy(String changeddBy) {
this.changeddBy = changeddBy;
}
public Date getChangedDate() {
return changedDate;
}
public void setChangedDate(Date changedDate) {
this.changedDate = changedDate;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getSubProcess() {
return subProcess;
}
public void setSubProcess(String subProcess) {
this.subProcess = subProcess;
}
/* public String getReqid() {
return reqid;
}
public void setReqid(String reqid) {
this.reqid = reqid;
}*/
}
| 4,750 | 0.700421 | 0.681684 | 286 | 15.604895 | 15.576829 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.20979 | false | false | 13 |
2ce218e91c1140692ccd77cb7a8d34779ab378c8 | 8,985,071,612,089 | 572319efdce56afa3aec16287fd86380ddbf3d4a | /core/src/main/java/de/ck35/metricstore/fs/StoredObjectNodeReader.java | bb90d5733ef89087456323f771f7039052549d8d | [
"Apache-2.0"
] | permissive | CK35/metric-store | https://github.com/CK35/metric-store | f6c8196275f8bb704293b03af4455fa6e6a8c075 | 5fb9ecd4247e1948aa8f6c0dfef0aea67fbf2a1d | refs/heads/master | 2021-01-21T02:30:51.974000 | 2016-09-05T20:07:04 | 2016-09-05T20:07:04 | 34,624,932 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.ck35.metricstore.fs;
import java.io.Closeable;
import java.io.IOException;
import java.util.Objects;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Function;
import de.ck35.metricstore.MetricBucket;
import de.ck35.metricstore.StoredMetric;
import de.ck35.metricstore.util.io.ObjectNodeReader;
public class StoredObjectNodeReader implements Closeable {
private static final Logger LOG = LoggerFactory.getLogger(StoredObjectNodeReader.class);
private final MetricBucket bucket;
private final ObjectNodeReader reader;
private final Function<ObjectNode, DateTime> timestampFunction;
private int ignoredObjectsCount;
public StoredObjectNodeReader(MetricBucket bucket,
ObjectNodeReader reader,
Function<ObjectNode, DateTime> timestampFunction) {
this.bucket = bucket;
this.reader = reader;
this.timestampFunction = timestampFunction;
}
public StoredMetric read() {
ObjectNode objectNode = reader.read();
while(objectNode != null) {
try {
DateTime timestamp = Objects.requireNonNull(timestampFunction.apply(objectNode), "Timestamp must not be null!");
return storedObjectNode(bucket, timestamp, objectNode);
} catch(IllegalArgumentException e) {
ignoredObjectsCount++;
LOG.warn("Missing timestamp inside object node: '{}' in file: '{}'.", objectNode, reader.getPath());
}
objectNode = reader.read();
}
return null;
}
public int getIgnoredObjectsCount() {
return ignoredObjectsCount + reader.getIgnoredObjectsCount();
}
@Override
public void close() throws IOException {
this.reader.close();
}
public static StoredMetric storedObjectNode(MetricBucket bucket, DateTime timestamp, ObjectNode objectNode) {
return new ImmutableStoredObjectNode(bucket, timestamp, objectNode);
}
private static class ImmutableStoredObjectNode implements StoredMetric {
private final MetricBucket bucket;
private final DateTime timestamp;
private final ObjectNode objectNode;
public ImmutableStoredObjectNode(MetricBucket bucket, DateTime timestamp, ObjectNode objectNode) {
this.bucket = bucket;
this.timestamp = timestamp;
this.objectNode = objectNode;
}
@Override
public MetricBucket getMetricBucket() {
return bucket;
}
@Override
public DateTime getTimestamp() {
return timestamp;
}
@Override
public ObjectNode getObjectNode() {
return objectNode;
}
}
} | UTF-8 | Java | 2,572 | java | StoredObjectNodeReader.java | Java | [] | null | [] | package de.ck35.metricstore.fs;
import java.io.Closeable;
import java.io.IOException;
import java.util.Objects;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Function;
import de.ck35.metricstore.MetricBucket;
import de.ck35.metricstore.StoredMetric;
import de.ck35.metricstore.util.io.ObjectNodeReader;
public class StoredObjectNodeReader implements Closeable {
private static final Logger LOG = LoggerFactory.getLogger(StoredObjectNodeReader.class);
private final MetricBucket bucket;
private final ObjectNodeReader reader;
private final Function<ObjectNode, DateTime> timestampFunction;
private int ignoredObjectsCount;
public StoredObjectNodeReader(MetricBucket bucket,
ObjectNodeReader reader,
Function<ObjectNode, DateTime> timestampFunction) {
this.bucket = bucket;
this.reader = reader;
this.timestampFunction = timestampFunction;
}
public StoredMetric read() {
ObjectNode objectNode = reader.read();
while(objectNode != null) {
try {
DateTime timestamp = Objects.requireNonNull(timestampFunction.apply(objectNode), "Timestamp must not be null!");
return storedObjectNode(bucket, timestamp, objectNode);
} catch(IllegalArgumentException e) {
ignoredObjectsCount++;
LOG.warn("Missing timestamp inside object node: '{}' in file: '{}'.", objectNode, reader.getPath());
}
objectNode = reader.read();
}
return null;
}
public int getIgnoredObjectsCount() {
return ignoredObjectsCount + reader.getIgnoredObjectsCount();
}
@Override
public void close() throws IOException {
this.reader.close();
}
public static StoredMetric storedObjectNode(MetricBucket bucket, DateTime timestamp, ObjectNode objectNode) {
return new ImmutableStoredObjectNode(bucket, timestamp, objectNode);
}
private static class ImmutableStoredObjectNode implements StoredMetric {
private final MetricBucket bucket;
private final DateTime timestamp;
private final ObjectNode objectNode;
public ImmutableStoredObjectNode(MetricBucket bucket, DateTime timestamp, ObjectNode objectNode) {
this.bucket = bucket;
this.timestamp = timestamp;
this.objectNode = objectNode;
}
@Override
public MetricBucket getMetricBucket() {
return bucket;
}
@Override
public DateTime getTimestamp() {
return timestamp;
}
@Override
public ObjectNode getObjectNode() {
return objectNode;
}
}
} | 2,572 | 0.749222 | 0.745334 | 88 | 28.238636 | 27.871864 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.102273 | false | false | 13 |
9c72ff5e53387fea60d926b44f7ce92511f4767c | 8,985,071,614,119 | dbdf7d56f289b93e3f203e5110d85427b95b8c89 | /app/src/main/java/com/example/root/relicstest/Activity/MainActivity.java | e7e9312966fccff33e4aee339d71db1bce7e6e07 | [] | no_license | JarvistFth/hfAndroid | https://github.com/JarvistFth/hfAndroid | 07a37bf3a721f2861d97f4096a527ac1221d99cb | 37b386a9ad8a1f79c281f7ac934f83b2e4dd2cf9 | refs/heads/master | 2020-05-26T11:33:04.527000 | 2019-05-23T11:07:35 | 2019-05-23T11:07:35 | 188,217,776 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.root.relicstest.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.root.relicstest.R;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private Button query_btn,queryHistory_btn,buy_btn,showmore_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bindView();
setListner();
}
void bindView(){
query_btn = findViewById(R.id.Query);
queryHistory_btn = findViewById(R.id.QueryHistory);
buy_btn = findViewById(R.id.RelicsTransfer);
showmore_btn = findViewById(R.id.RelicsShow);
}
void setListner(){
query_btn.setOnClickListener(this);
queryHistory_btn.setOnClickListener(this);
buy_btn.setOnClickListener(this);
showmore_btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.Query:
break;
case R.id.QueryHistory:
break;
case R.id.RelicsTransfer:
toIntent(MainActivity.this,RelicsTransferActivity.class);
break;
case R.id.RelicsShow:
toIntent(MainActivity.this,RelicsAllActivity.class);
break;
}
}
void toIntent(Context packageContext, Class<?> cls){
Intent intent = new Intent(packageContext,cls);
startActivity(intent);
}
}
| UTF-8 | Java | 1,721 | java | MainActivity.java | Java | [] | null | [] | package com.example.root.relicstest.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.root.relicstest.R;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private Button query_btn,queryHistory_btn,buy_btn,showmore_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bindView();
setListner();
}
void bindView(){
query_btn = findViewById(R.id.Query);
queryHistory_btn = findViewById(R.id.QueryHistory);
buy_btn = findViewById(R.id.RelicsTransfer);
showmore_btn = findViewById(R.id.RelicsShow);
}
void setListner(){
query_btn.setOnClickListener(this);
queryHistory_btn.setOnClickListener(this);
buy_btn.setOnClickListener(this);
showmore_btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.Query:
break;
case R.id.QueryHistory:
break;
case R.id.RelicsTransfer:
toIntent(MainActivity.this,RelicsTransferActivity.class);
break;
case R.id.RelicsShow:
toIntent(MainActivity.this,RelicsAllActivity.class);
break;
}
}
void toIntent(Context packageContext, Class<?> cls){
Intent intent = new Intent(packageContext,cls);
startActivity(intent);
}
}
| 1,721 | 0.649041 | 0.64846 | 59 | 28.169491 | 21.863329 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.610169 | false | false | 13 |
777abf2f9fa84a1033556226c0731a1ff4983af7 | 1,271,310,378,549 | 763a76e85c7a368fcde77aeaae5e416407ae85a7 | /seba/app/models/Appl.java | f6065aefcd9d42b0e487e08f49d922262afcad16 | [] | no_license | AndreasWagner99/SEBA-Group-16 | https://github.com/AndreasWagner99/SEBA-Group-16 | e4f87ecc65642fd0a845358928c2aa6f3cd7baf8 | 9d547ae524ab15f6ef6d11bda828fe220e61483d | refs/heads/master | 2021-01-25T03:40:36.949000 | 2013-07-10T09:11:39 | 2013-07-10T09:11:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package models;
import java.io.File;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import play.db.jpa.Blob;
import play.db.jpa.Model;
/*
* Model for an Application
* @Author: Andreas Wagner
*/
@Entity
public class Appl extends Model {
@ManyToOne
public Designer designer;
@ManyToOne
public Project project;
public String explanation;
public boolean isActive;
public boolean isAccepted;
public Blob proposal;
public Appl(Designer designer, Project project, String explanation, Blob prop) {
super();
this.designer = designer;
this.project = project;
this.explanation = explanation;
this.isActive = true;
this.isAccepted = false;
this.proposal = prop;
}
}
| UTF-8 | Java | 716 | java | Appl.java | Java | [
{
"context": "Model;\n\n/*\n * Model for an Application\n * @Author: Andreas Wagner\n */\n@Entity\npublic class Appl extends Model {\n\n\t@",
"end": 218,
"score": 0.9998704195022583,
"start": 204,
"tag": "NAME",
"value": "Andreas Wagner"
}
] | null | [] | package models;
import java.io.File;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import play.db.jpa.Blob;
import play.db.jpa.Model;
/*
* Model for an Application
* @Author: <NAME>
*/
@Entity
public class Appl extends Model {
@ManyToOne
public Designer designer;
@ManyToOne
public Project project;
public String explanation;
public boolean isActive;
public boolean isAccepted;
public Blob proposal;
public Appl(Designer designer, Project project, String explanation, Blob prop) {
super();
this.designer = designer;
this.project = project;
this.explanation = explanation;
this.isActive = true;
this.isAccepted = false;
this.proposal = prop;
}
}
| 708 | 0.740223 | 0.740223 | 36 | 18.888889 | 15.802211 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.388889 | false | false | 13 |
c1577f87ffe43269de465afb03f5716da7940143 | 6,055,903,898,158 | 4f6fae1a7c3ab89f40b4771c16e42333c89cae37 | /PMovie/app/src/main/java/com/jam/pmovie/data/MovieContract.java | b79aa079c62d923664ef9a2ff3f373ecf1bbef2b | [
"Apache-2.0"
] | permissive | Ygowell/PMovie | https://github.com/Ygowell/PMovie | cad39a694a2e692599303bb60eae9a4be2c54a8f | 2334be08d26a4d9ea7fc4e6c7ca5bfa78170b202 | refs/heads/master | 2021-01-16T19:24:29.971000 | 2018-02-22T12:42:17 | 2018-02-22T12:42:17 | 100,163,983 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jam.pmovie.data;
import android.net.Uri;
import android.provider.BaseColumns;
/**
* Created by jam on 17/9/8.
*/
public class MovieContract {
public static final String AUTHORITY = "com.jam.pmovie";
public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY);
public static final String PATH_MOVIES = "movies";
public static final String PATH_NOTICES = "notices";
public static final String PATH_COMMENTS = "comments";
public static class MovieEntity implements BaseColumns{
public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
.appendPath(PATH_MOVIES).build();
public static final String TB_NAME = "tb_movies";
public static final String CL_VOTE_COUNT = "vote_count";
public static final String CL_MOVIE_ID ="movie_id";
public static final String CL_VIDEO ="video";
public static final String CL_VOTE_AVERAGE= "vote_average";
public static final String CL_TITLE= "title";
public static final String CL_POPULARITY = "popularity";
public static final String CL_POSTER_PATH = "poster_path";
public static final String CL_ORG_LANGUAGE = "org_language";
public static final String CL_ORG_TITLE = "org_title";
public static final String CL_BACKDROP_PATH = "backdrop_path";
public static final String CL_ADULT= "adult";
public static final String CL_OVERVIEW = "overview";
public static final String CL_RELEASE_DATE = "release_date";
public static final String CL_COLLECTED = "collected";
public static final String CL_SORT_TYPE = "sort_type";
}
}
| UTF-8 | Java | 1,677 | java | MovieContract.java | Java | [
{
"context": "t android.provider.BaseColumns;\n\n/**\n * Created by jam on 17/9/8.\n */\n\npublic class MovieContract {\n\n ",
"end": 113,
"score": 0.9994887709617615,
"start": 110,
"tag": "USERNAME",
"value": "jam"
}
] | null | [] | package com.jam.pmovie.data;
import android.net.Uri;
import android.provider.BaseColumns;
/**
* Created by jam on 17/9/8.
*/
public class MovieContract {
public static final String AUTHORITY = "com.jam.pmovie";
public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY);
public static final String PATH_MOVIES = "movies";
public static final String PATH_NOTICES = "notices";
public static final String PATH_COMMENTS = "comments";
public static class MovieEntity implements BaseColumns{
public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
.appendPath(PATH_MOVIES).build();
public static final String TB_NAME = "tb_movies";
public static final String CL_VOTE_COUNT = "vote_count";
public static final String CL_MOVIE_ID ="movie_id";
public static final String CL_VIDEO ="video";
public static final String CL_VOTE_AVERAGE= "vote_average";
public static final String CL_TITLE= "title";
public static final String CL_POPULARITY = "popularity";
public static final String CL_POSTER_PATH = "poster_path";
public static final String CL_ORG_LANGUAGE = "org_language";
public static final String CL_ORG_TITLE = "org_title";
public static final String CL_BACKDROP_PATH = "backdrop_path";
public static final String CL_ADULT= "adult";
public static final String CL_OVERVIEW = "overview";
public static final String CL_RELEASE_DATE = "release_date";
public static final String CL_COLLECTED = "collected";
public static final String CL_SORT_TYPE = "sort_type";
}
}
| 1,677 | 0.678593 | 0.676208 | 41 | 39.902439 | 27.796125 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.609756 | false | false | 13 |
09292c02b1fe6876ed1a14d198ddfad16b787747 | 13,271,449,000,447 | 114d66d62674cc22f906c7229d4b8a4d7f0d53a2 | /A.I/PruebaApp.java | 7ea8d7a6ed28cba5cb5533ed2975cb7a3b2b51fc | [] | no_license | stnavarrete/Homeworks | https://github.com/stnavarrete/Homeworks | 7b1b8ebaacd90acd2fc42ef38846b54a0d78e2f6 | 1e8f6c303dde736bb504a30a3c8d8033250a9fda | refs/heads/master | 2020-03-19T15:58:39.433000 | 2018-06-09T05:54:54 | 2018-06-09T05:54:54 | 136,694,194 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class PruebaApp {
public static void main(String[] args) {
String cadena="Solo se que no se nada";
System.out.println(cadena);
// ejemplo1: devolvera false, ya que la cadena tiene mas caracteres
System.out.println("cadena.matches('Solo'): "+cadena.matches("Solo"));
// ejemplo2: devolvera true, siempre y cuando no cambiemos la cadena Solo
System.out.println("cadena.matches('Solo.*'): "+cadena.matches("Solo.*"));
// ejemplo3: devolvera true, siempre que uno de los caracteres se cumpla
System.out.println("cadena.matches('.*[qnd].*')): "+cadena.matches(".*[qnd].*"));
// ejemplo3: devolvera false, ya que ninguno de esos caracteres estan
System.out.println("cadena.matches('.*[xyz].*'): "+cadena.matches(".*[xyz].*"));
// ejemplo4: devolvera true, ya que le indicamos que no incluya esos caracteres
System.out.println("cadena.matches('.*[^xyz].*') "+cadena.matches(".*[^xyz].*"));
// ejemplo5: devolvera true, si quitamos los caracteres delante de ? del STring original seguira devolviendo true
System.out.println("cadena.matches('So?lo se qu?e no se na?da'): "+cadena.matches("So?lo se qu?e no se na?da"));
// ejemplo6: devolvera false, ya que tenemos una S mayuscula empieza en el String
System.out.println("cadena.matches('[a-z].*'): "+cadena.matches("[a-z].*"));
// ejemplo7: devolvera true, ya que tenemos una S mayuscula empieza en el String
System.out.println("cadena.matches('[A-Z].*'): "+cadena.matches("[A-Z].*"));
String cadena2="abc1234";
System.out.println(cadena2);
// ejemplo8: devolvera true, ya que minimo debe repetirse alguno de los caracteres al menos una vez
System.out.println("cadena2.matches('[abc]+.*'): "+cadena2.matches("[abc]+.*"));
// ejemplo9: devolvera true, ya que, ademas del ejemplo anterior, indicamos que debe repetirse un valor numerico 4 veces
System.out.println("cadena2.matches('[abc]+\\d{4}') "+cadena2.matches("[abc]+\\d{4}"));
// ejemplo10: devolvera true, ya que, ademas del ejemplo anterior, indicamos que debe repetirse un valor numerico entre 1 y 10 veces
System.out.println("cadena2.matches('[abc]+\\d{1,10}'): "+cadena2.matches("[abc]+\\d{1,10}"));
}
}
| UTF-8 | Java | 2,400 | java | PruebaApp.java | Java | [] | null | [] |
public class PruebaApp {
public static void main(String[] args) {
String cadena="Solo se que no se nada";
System.out.println(cadena);
// ejemplo1: devolvera false, ya que la cadena tiene mas caracteres
System.out.println("cadena.matches('Solo'): "+cadena.matches("Solo"));
// ejemplo2: devolvera true, siempre y cuando no cambiemos la cadena Solo
System.out.println("cadena.matches('Solo.*'): "+cadena.matches("Solo.*"));
// ejemplo3: devolvera true, siempre que uno de los caracteres se cumpla
System.out.println("cadena.matches('.*[qnd].*')): "+cadena.matches(".*[qnd].*"));
// ejemplo3: devolvera false, ya que ninguno de esos caracteres estan
System.out.println("cadena.matches('.*[xyz].*'): "+cadena.matches(".*[xyz].*"));
// ejemplo4: devolvera true, ya que le indicamos que no incluya esos caracteres
System.out.println("cadena.matches('.*[^xyz].*') "+cadena.matches(".*[^xyz].*"));
// ejemplo5: devolvera true, si quitamos los caracteres delante de ? del STring original seguira devolviendo true
System.out.println("cadena.matches('So?lo se qu?e no se na?da'): "+cadena.matches("So?lo se qu?e no se na?da"));
// ejemplo6: devolvera false, ya que tenemos una S mayuscula empieza en el String
System.out.println("cadena.matches('[a-z].*'): "+cadena.matches("[a-z].*"));
// ejemplo7: devolvera true, ya que tenemos una S mayuscula empieza en el String
System.out.println("cadena.matches('[A-Z].*'): "+cadena.matches("[A-Z].*"));
String cadena2="abc1234";
System.out.println(cadena2);
// ejemplo8: devolvera true, ya que minimo debe repetirse alguno de los caracteres al menos una vez
System.out.println("cadena2.matches('[abc]+.*'): "+cadena2.matches("[abc]+.*"));
// ejemplo9: devolvera true, ya que, ademas del ejemplo anterior, indicamos que debe repetirse un valor numerico 4 veces
System.out.println("cadena2.matches('[abc]+\\d{4}') "+cadena2.matches("[abc]+\\d{4}"));
// ejemplo10: devolvera true, ya que, ademas del ejemplo anterior, indicamos que debe repetirse un valor numerico entre 1 y 10 veces
System.out.println("cadena2.matches('[abc]+\\d{1,10}'): "+cadena2.matches("[abc]+\\d{1,10}"));
}
}
| 2,400 | 0.62625 | 0.61125 | 43 | 53.720932 | 44.767265 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.744186 | false | false | 13 |
63665f127537264706230aa607cc065a349b7019 | 33,277,406,633,580 | 649f6cce62ec72c509e3ede126effe84f9dc18fb | /app/src/main/java/com/example/hxl/travel/model/bean/Scenic.java | 67b91c0586cba0582c3449668265a992197523ae | [
"Apache-2.0"
] | permissive | hxlzp/Travel | https://github.com/hxlzp/Travel | c5d69b85c869f893da41c0956f931897948d3bd1 | f33c264dfd19a8ba27258b645c1d5c7001f7375c | refs/heads/master | 2021-05-05T04:05:29.781000 | 2017-09-29T01:17:07 | 2017-09-29T01:17:07 | 105,214,569 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.hxl.travel.model.bean;
/**
* Created by hxl on 2017/6/9 at haiChou.
*/
public class Scenic {
private double scenic_right_bottom_latitude;
private double scenic_left_bottom_longitude;
private double scenic_left_top_latitude;
private double scenic_left_top_longitude;
private double scenic_right_bottom_longitude;
private double scenic_right_top_latitude;
private double scenic_right_top_longitude;
private double scenic_left_bottom_latitude;
private String scenic_id;
private String scenic_name;
private String scenic_map_url;
public double getScenic_right_bottom_latitude() {
return scenic_right_bottom_latitude;
}
public void setScenic_right_bottom_latitude(double scenic_right_bottom_latitude) {
this.scenic_right_bottom_latitude = scenic_right_bottom_latitude;
}
public double getScenic_left_bottom_longitude() {
return scenic_left_bottom_longitude;
}
public void setScenic_left_bottom_longitude(double scenic_left_bottom_longitude) {
this.scenic_left_bottom_longitude = scenic_left_bottom_longitude;
}
public double getScenic_left_top_latitude() {
return scenic_left_top_latitude;
}
public void setScenic_left_top_latitude(double scenic_left_top_latitude) {
this.scenic_left_top_latitude = scenic_left_top_latitude;
}
public double getScenic_left_top_longitude() {
return scenic_left_top_longitude;
}
public void setScenic_left_top_longitude(double scenic_left_top_longitude) {
this.scenic_left_top_longitude = scenic_left_top_longitude;
}
public double getScenic_right_bottom_longitude() {
return scenic_right_bottom_longitude;
}
public void setScenic_right_bottom_longitude(double scenic_right_bottom_longitude) {
this.scenic_right_bottom_longitude = scenic_right_bottom_longitude;
}
public double getScenic_right_top_latitude() {
return scenic_right_top_latitude;
}
public void setScenic_right_top_latitude(double scenic_right_top_latitude) {
this.scenic_right_top_latitude = scenic_right_top_latitude;
}
public double getScenic_right_top_longitude() {
return scenic_right_top_longitude;
}
public void setScenic_right_top_longitude(double scenic_right_top_longitude) {
this.scenic_right_top_longitude = scenic_right_top_longitude;
}
public double getScenic_left_bottom_latitude() {
return scenic_left_bottom_latitude;
}
public void setScenic_left_bottom_latitude(double scenic_left_bottom_latitude) {
this.scenic_left_bottom_latitude = scenic_left_bottom_latitude;
}
public String getScenic_id() {
return scenic_id;
}
public void setScenic_id(String scenic_id) {
this.scenic_id = scenic_id;
}
public String getScenic_name() {
return scenic_name;
}
public void setScenic_name(String scenic_name) {
this.scenic_name = scenic_name;
}
public String getScenic_map_url() {
return scenic_map_url;
}
public void setScenic_map_url(String scenic_map_url) {
this.scenic_map_url = scenic_map_url;
}
}
| UTF-8 | Java | 3,237 | java | Scenic.java | Java | [
{
"context": ".example.hxl.travel.model.bean;\n\n/**\n * Created by hxl on 2017/6/9 at haiChou.\n */\npublic class Scenic {",
"end": 65,
"score": 0.9995678663253784,
"start": 62,
"tag": "USERNAME",
"value": "hxl"
}
] | null | [] | package com.example.hxl.travel.model.bean;
/**
* Created by hxl on 2017/6/9 at haiChou.
*/
public class Scenic {
private double scenic_right_bottom_latitude;
private double scenic_left_bottom_longitude;
private double scenic_left_top_latitude;
private double scenic_left_top_longitude;
private double scenic_right_bottom_longitude;
private double scenic_right_top_latitude;
private double scenic_right_top_longitude;
private double scenic_left_bottom_latitude;
private String scenic_id;
private String scenic_name;
private String scenic_map_url;
public double getScenic_right_bottom_latitude() {
return scenic_right_bottom_latitude;
}
public void setScenic_right_bottom_latitude(double scenic_right_bottom_latitude) {
this.scenic_right_bottom_latitude = scenic_right_bottom_latitude;
}
public double getScenic_left_bottom_longitude() {
return scenic_left_bottom_longitude;
}
public void setScenic_left_bottom_longitude(double scenic_left_bottom_longitude) {
this.scenic_left_bottom_longitude = scenic_left_bottom_longitude;
}
public double getScenic_left_top_latitude() {
return scenic_left_top_latitude;
}
public void setScenic_left_top_latitude(double scenic_left_top_latitude) {
this.scenic_left_top_latitude = scenic_left_top_latitude;
}
public double getScenic_left_top_longitude() {
return scenic_left_top_longitude;
}
public void setScenic_left_top_longitude(double scenic_left_top_longitude) {
this.scenic_left_top_longitude = scenic_left_top_longitude;
}
public double getScenic_right_bottom_longitude() {
return scenic_right_bottom_longitude;
}
public void setScenic_right_bottom_longitude(double scenic_right_bottom_longitude) {
this.scenic_right_bottom_longitude = scenic_right_bottom_longitude;
}
public double getScenic_right_top_latitude() {
return scenic_right_top_latitude;
}
public void setScenic_right_top_latitude(double scenic_right_top_latitude) {
this.scenic_right_top_latitude = scenic_right_top_latitude;
}
public double getScenic_right_top_longitude() {
return scenic_right_top_longitude;
}
public void setScenic_right_top_longitude(double scenic_right_top_longitude) {
this.scenic_right_top_longitude = scenic_right_top_longitude;
}
public double getScenic_left_bottom_latitude() {
return scenic_left_bottom_latitude;
}
public void setScenic_left_bottom_latitude(double scenic_left_bottom_latitude) {
this.scenic_left_bottom_latitude = scenic_left_bottom_latitude;
}
public String getScenic_id() {
return scenic_id;
}
public void setScenic_id(String scenic_id) {
this.scenic_id = scenic_id;
}
public String getScenic_name() {
return scenic_name;
}
public void setScenic_name(String scenic_name) {
this.scenic_name = scenic_name;
}
public String getScenic_map_url() {
return scenic_map_url;
}
public void setScenic_map_url(String scenic_map_url) {
this.scenic_map_url = scenic_map_url;
}
}
| 3,237 | 0.690145 | 0.688292 | 106 | 29.537735 | 27.782909 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.320755 | false | false | 13 |
c802036034970b3784cbc783650bc1bd5634ab06 | 29,446,295,828,495 | d28396d9310ac833294528838f6943472e13a665 | /tallerFinal/serviciofactura/src/main/java/com/everis/serviciofactura/controllers/ComPagosController.java | b8e311cf43e0bef2e1fcf1fa30b4a433efb27835 | [] | no_license | raulacera96/talleresEveris | https://github.com/raulacera96/talleresEveris | 3bd1670c4541a157082730ee017f242dbf603050 | a9cf6b541adc7f9109aad2b6995ecc2dacc5ed5d | refs/heads/main | 2023-01-23T21:22:17.059000 | 2020-11-30T13:57:04 | 2020-11-30T13:57:04 | 315,749,548 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.everis.serviciofactura.controllers;
import com.everis.serviciofactura.domains.DTOPago;
import com.everis.serviciofactura.domains.Pago;
import com.everis.serviciofactura.services.ComPagosService;
import com.netflix.appinfo.InstanceInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class ComPagosController {
@Autowired
ComPagosService comPagosService;
@RequestMapping(value="/instances/{name}", method= RequestMethod.GET)
public List<InstanceInfo> getInstancesClient(@PathVariable("name") String name) {
if(name != null)
return this.comPagosService.getInstancesClient(name);
return null;
}
@RequestMapping(value="/instances/{name}/{id}", method=RequestMethod.GET)
public List<Pago> callService(@PathVariable("name") String name, @PathVariable("id") Integer facturaId) {
if(name != null)
return this.comPagosService.getPagosFactura(name, facturaId);
return null;
}
@RequestMapping(value="/instances/insert/{name}", method=RequestMethod.GET)
public Pago savePago(@PathVariable("name") String name, @RequestBody Pago pago) {
return this.comPagosService.savePago(name, pago);
}
}
| UTF-8 | Java | 1,364 | java | ComPagosController.java | Java | [] | null | [] | package com.everis.serviciofactura.controllers;
import com.everis.serviciofactura.domains.DTOPago;
import com.everis.serviciofactura.domains.Pago;
import com.everis.serviciofactura.services.ComPagosService;
import com.netflix.appinfo.InstanceInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class ComPagosController {
@Autowired
ComPagosService comPagosService;
@RequestMapping(value="/instances/{name}", method= RequestMethod.GET)
public List<InstanceInfo> getInstancesClient(@PathVariable("name") String name) {
if(name != null)
return this.comPagosService.getInstancesClient(name);
return null;
}
@RequestMapping(value="/instances/{name}/{id}", method=RequestMethod.GET)
public List<Pago> callService(@PathVariable("name") String name, @PathVariable("id") Integer facturaId) {
if(name != null)
return this.comPagosService.getPagosFactura(name, facturaId);
return null;
}
@RequestMapping(value="/instances/insert/{name}", method=RequestMethod.GET)
public Pago savePago(@PathVariable("name") String name, @RequestBody Pago pago) {
return this.comPagosService.savePago(name, pago);
}
}
| 1,364 | 0.743402 | 0.743402 | 36 | 36.888889 | 30.466537 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.611111 | false | false | 13 |
85c338ec8999b37fc261657fececdfe8830a8398 | 12,841,952,229,396 | 6c8b3d394779ca81b498d2789d390ca3f1a2f20c | /oracle_oca_jse7/ch01/memberAccessModifiers/Zoo.java | d992c092e3a332b9afb6bca85d425f5c29e42fe4 | [] | no_license | raywritescode/area-51-java | https://github.com/raywritescode/area-51-java | d221db7f5b2db9d98219356faf73dbc4250a637e | f44fa3489ea70eb53e165987c1b371a79fc8adbb | refs/heads/master | 2016-09-06T19:14:05.514000 | 2015-03-13T03:25:08 | 2015-03-13T03:25:08 | 18,042,126 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Zoo.java
//
class Zoo {
public String coolMethod() {
return "This is a cool method";
}
}
| UTF-8 | Java | 105 | java | Zoo.java | Java | [] | null | [] | // Zoo.java
//
class Zoo {
public String coolMethod() {
return "This is a cool method";
}
}
| 105 | 0.571429 | 0.571429 | 7 | 14 | 13.234155 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 13 |
db8e473467ae28512f593d8db0854f539429a0dd | 6,090,263,635,898 | e822979346dd504e1c31aeaa0e3fdea39fcf47ab | /day02/src/PrintSharp.java | 7452ea302d1d57b3d96aca0a2eb0e7793eb1cd6e | [] | no_license | cslu1314/cshomework | https://github.com/cslu1314/cshomework | 9d9b74ab03d6b3e5ad352b1d747bd0e4b97025cd | 45e51f1d05becf674c7694aadd5e7831842d65d0 | refs/heads/master | 2023-08-31T03:53:40.957000 | 2021-10-20T09:20:59 | 2021-10-20T09:20:59 | 414,038,518 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class PrintSharp {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("请输入行数:");
int row = Integer.parseInt(sc.next());
System.out.println("请输入列数:");
int line = Integer.parseInt(sc.next());
printSharp(row, line);
System.out.println("=====================");
printForm(line);
System.out.println();
}
}
private static void printForm(int line) {
for (int i = 1; i <= line; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(i + "×" + j + "=" + (i * j) + " ");
}
System.out.println();
}
}
private static void printSharp(int row, int line) {
for (int i = 0; i < row; i++) {
for (int j = 0; j < line; j++) {
System.out.print("# ");
}
System.out.println();
}
}
}
| UTF-8 | Java | 1,069 | java | PrintSharp.java | Java | [] | null | [] | import java.util.Scanner;
public class PrintSharp {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("请输入行数:");
int row = Integer.parseInt(sc.next());
System.out.println("请输入列数:");
int line = Integer.parseInt(sc.next());
printSharp(row, line);
System.out.println("=====================");
printForm(line);
System.out.println();
}
}
private static void printForm(int line) {
for (int i = 1; i <= line; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(i + "×" + j + "=" + (i * j) + " ");
}
System.out.println();
}
}
private static void printSharp(int row, int line) {
for (int i = 0; i < row; i++) {
for (int j = 0; j < line; j++) {
System.out.print("# ");
}
System.out.println();
}
}
}
| 1,069 | 0.436782 | 0.43295 | 37 | 27.216217 | 19.771854 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.648649 | false | false | 13 |
1d00edfe4237158c6a7bb945fd0eb5fa19576672 | 6,090,263,632,345 | 48b6d3673b4fad670ba92981a1e75b0b8811abac | /core/src/com/mygdx/game/Background.java | 2bcda1bb97355e9f9c8cb66d32eb49904b0bba31 | [
"MIT"
] | permissive | Jester565/Tropadom | https://github.com/Jester565/Tropadom | d49e1cb9a7389f0385dc8a9ce72e1c895d393601 | c709c1530520671cdaeb3947332ca95e37b13627 | refs/heads/master | 2020-03-28T01:08:55.802000 | 2018-09-15T06:17:55 | 2018-09-15T06:17:55 | 147,480,881 | 1 | 1 | null | false | 2018-09-15T06:17:56 | 2018-09-05T07:52:19 | 2018-09-11T06:46:25 | 2018-09-15T06:17:56 | 14,732 | 1 | 0 | 0 | Java | false | null | package com.mygdx.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
public class Background {
ShapeRenderer sr;
Background()
{
sr = new ShapeRenderer();
}
void draw(float type)
{
sr.begin(ShapeType.Filled);
sr.setColor(0,0,1,1);
sr.rect(0, 0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
sr.end();
}
}
| UTF-8 | Java | 422 | java | Background.java | Java | [] | null | [] | package com.mygdx.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
public class Background {
ShapeRenderer sr;
Background()
{
sr = new ShapeRenderer();
}
void draw(float type)
{
sr.begin(ShapeType.Filled);
sr.setColor(0,0,1,1);
sr.rect(0, 0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
sr.end();
}
}
| 422 | 0.748815 | 0.734597 | 20 | 20.1 | 20.317234 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.05 | false | false | 13 |
6e39ffa104fbe2e3144d2f9f788c69e7671c9b25 | 6,090,263,633,864 | b7e4181479b1947fbde68bb802df00589add7fd1 | /shop-sample/src/main/java/com/sample/config/SessionListener.java | 868e21b59d93ba59c54fbdde3d84e561d9c93589 | [
"Apache-2.0"
] | permissive | siwaxinwu/shop-final | https://github.com/siwaxinwu/shop-final | b41db827db7cc74c18b702dc5c8375981e86316e | d7cf505a8bde6b821ff66d002afdac9e35833604 | refs/heads/master | 2023-03-16T14:28:38.593000 | 2020-12-09T02:11:26 | 2020-12-09T02:11:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sample.config;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
public class SessionListener implements HttpSessionListener, HttpSessionAttributeListener, ServletContextListener {
@Override
public void attributeAdded(HttpSessionBindingEvent se) {
}
@Override
public void attributeRemoved(HttpSessionBindingEvent se) {
}
@Override
public void attributeReplaced(HttpSessionBindingEvent se) {
}
@Override
public void sessionCreated(HttpSessionEvent se) {
System.out.println("Session 创建: " + se.getSession().getId());
}
@Override
public void sessionDestroyed(HttpSessionEvent se) {
System.out.println("Session 销毁: " + se.getSession().getId());
}
@Override
public void contextInitialized(ServletContextEvent sce) {
System.out.println("系统启动");
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
System.out.println("系统停止");
}
}
| UTF-8 | Java | 1,148 | java | SessionListener.java | Java | [] | null | [] | package com.sample.config;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
public class SessionListener implements HttpSessionListener, HttpSessionAttributeListener, ServletContextListener {
@Override
public void attributeAdded(HttpSessionBindingEvent se) {
}
@Override
public void attributeRemoved(HttpSessionBindingEvent se) {
}
@Override
public void attributeReplaced(HttpSessionBindingEvent se) {
}
@Override
public void sessionCreated(HttpSessionEvent se) {
System.out.println("Session 创建: " + se.getSession().getId());
}
@Override
public void sessionDestroyed(HttpSessionEvent se) {
System.out.println("Session 销毁: " + se.getSession().getId());
}
@Override
public void contextInitialized(ServletContextEvent sce) {
System.out.println("系统启动");
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
System.out.println("系统停止");
}
}
| 1,148 | 0.795374 | 0.795374 | 43 | 25.139534 | 27.371332 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.976744 | false | false | 13 |
d567c7335a8415b3613c7d6ace98f7e11535ab3c | 19,885,698,640,144 | 2b4e9d999d575ca9924c7734998602e1bead072c | /src/main/java/com/acme/server/SocketInfo.java | ba8ab7aeb06e36c6b1986e14361f228d97afb3a6 | [
"Apache-2.0"
] | permissive | coderxj/socket-server | https://github.com/coderxj/socket-server | d7f7670eb35c8eabd23ec7d0c7ca41e1074f7286 | 2c66a9f45ea4d3f07b5c7ea2ffdd3b2a9c4e9a9f | refs/heads/master | 2020-07-24T06:58:31.484000 | 2019-09-19T15:12:23 | 2019-09-19T15:12:23 | 207,837,593 | 4 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.acme.server;
import com.acme.protocol.FrameInfo;
import lombok.Getter;
import lombok.Setter;
import java.net.Socket;
import java.util.LinkedList;
/**
* @author acme
* @date 2019/8/17 3:22 PM
*/
@Setter
@Getter
public class SocketInfo{
//客户端套接字
Socket socket;
//正常数据接收帧队列
LinkedList<FrameInfo> normFrameQueue;
//心跳数据接收帧队列
LinkedList<FrameInfo> heartBeatFrameQueue;
public SocketInfo(Socket socket){
this.socket = socket;
this.normFrameQueue = new LinkedList<>();
this.heartBeatFrameQueue = new LinkedList<>();
}
}
| UTF-8 | Java | 638 | java | SocketInfo.java | Java | [
{
"context": "cket;\nimport java.util.LinkedList;\n\n/**\n * @author acme\n * @date 2019/8/17 3:22 PM\n */\n@Setter\n@Getter\npu",
"end": 180,
"score": 0.9996436834335327,
"start": 176,
"tag": "USERNAME",
"value": "acme"
}
] | null | [] | package com.acme.server;
import com.acme.protocol.FrameInfo;
import lombok.Getter;
import lombok.Setter;
import java.net.Socket;
import java.util.LinkedList;
/**
* @author acme
* @date 2019/8/17 3:22 PM
*/
@Setter
@Getter
public class SocketInfo{
//客户端套接字
Socket socket;
//正常数据接收帧队列
LinkedList<FrameInfo> normFrameQueue;
//心跳数据接收帧队列
LinkedList<FrameInfo> heartBeatFrameQueue;
public SocketInfo(Socket socket){
this.socket = socket;
this.normFrameQueue = new LinkedList<>();
this.heartBeatFrameQueue = new LinkedList<>();
}
}
| 638 | 0.688136 | 0.671186 | 31 | 18.032259 | 15.838874 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387097 | false | false | 13 |
7bbeb83cf949c21fa7c32e2d3b70636b5adf92cf | 32,555,852,172,400 | e87655fff78aa2de946f171422f8823e836ca07f | /HappyTimesApp/app/src/main/java/com/example/hilary/happytimesapp/FragmentsTabAdapter.java | b5fed59970fcdde4c5394f063d577c84937a7568 | [] | no_license | safariH/SAFARI-AND-MOHAMAD | https://github.com/safariH/SAFARI-AND-MOHAMAD | 4b3c0c400fa2a92c7297e4b2a28e23924e387d06 | adca42c483d732e0d3ef6fe864a6e4dd2a98e67d | refs/heads/master | 2021-08-16T02:39:11.263000 | 2017-11-19T07:56:49 | 2017-11-19T07:56:49 | 111,238,788 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.hilary.happytimesapp;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
/**
* Created by HILARY on 11/18/2017.
*/
class FragmentsTabAdapter extends FragmentPagerAdapter {
public FragmentsTabAdapter(FragmentManager fm){
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
About first=new About();
return first;
case 1:
Events second=new Events();
return second;
case 2:
Services third=new Services();
return third;
}
return null;
}
@Override
public int getCount() {
return 3;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return false;
}
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "Tab1";
case 1:
return "tab2";
case 2:
return "Tab3";
}
return super.getPageTitle(position);
}
}
| UTF-8 | Java | 1,314 | java | FragmentsTabAdapter.java | Java | [
{
"context": "pter;\nimport android.view.View;\n\n/**\n * Created by HILARY on 11/18/2017.\n */\n\nclass FragmentsTabAdapter ext",
"end": 278,
"score": 0.998075544834137,
"start": 272,
"tag": "NAME",
"value": "HILARY"
}
] | null | [] | package com.example.hilary.happytimesapp;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
/**
* Created by HILARY on 11/18/2017.
*/
class FragmentsTabAdapter extends FragmentPagerAdapter {
public FragmentsTabAdapter(FragmentManager fm){
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
About first=new About();
return first;
case 1:
Events second=new Events();
return second;
case 2:
Services third=new Services();
return third;
}
return null;
}
@Override
public int getCount() {
return 3;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return false;
}
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "Tab1";
case 1:
return "tab2";
case 2:
return "Tab3";
}
return super.getPageTitle(position);
}
}
| 1,314 | 0.566971 | 0.550228 | 58 | 21.655172 | 17.672842 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.362069 | false | false | 13 |
6d0a710d49b55a9e2c157222fc9cd1fe55dff429 | 33,157,147,554,849 | e2bfa99782e264cfcdd86301f96e26a5bb2d1eae | /core/src/main/java/com/huawei/openstack4j/openstack/evs/v2_1/domain/BssParamExtend.java | fb19fbf04a1b758c8637d30e8ad7bca6dd6e695c | [
"Apache-2.0"
] | permissive | IamFive/sdk-java | https://github.com/IamFive/sdk-java | 2b0f3dd26fc5a8ee11cf84c818f3faf03d09c2fc | 229df13315d5fccd3081b247a107f4bead9c4a7b | refs/heads/master | 2020-03-30T04:24:56.703000 | 2018-12-22T13:59:17 | 2018-12-22T13:59:17 | 150,741,525 | 1 | 0 | null | true | 2018-09-28T13:03:09 | 2018-09-28T13:03:09 | 2018-08-27T11:16:07 | 2018-08-27T11:16:05 | 16,485 | 0 | 0 | 0 | null | false | null | package com.huawei.openstack4j.openstack.evs.v2_1.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonRootName;
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonRootName("bssParam")
public class BssParamExtend {
/**
* 功能说明:是否立即支付。chargingMode为PrePaid时该参数会生效。默认值为false。
取值范围
false:不立即支付,创建订单暂不支付
true:立即支付,从帐户余额中自动扣费
*/
private Boolean isAutoPay;
}
| UTF-8 | Java | 653 | java | BssParamExtend.java | Java | [] | null | [] | package com.huawei.openstack4j.openstack.evs.v2_1.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonRootName;
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonRootName("bssParam")
public class BssParamExtend {
/**
* 功能说明:是否立即支付。chargingMode为PrePaid时该参数会生效。默认值为false。
取值范围
false:不立即支付,创建订单暂不支付
true:立即支付,从帐户余额中自动扣费
*/
private Boolean isAutoPay;
}
| 653 | 0.792844 | 0.787194 | 31 | 16.129032 | 16.647661 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.709677 | false | false | 13 |
e14422d295660918bed91a99ba85887a368ca903 | 5,471,788,381,587 | a31808a0bf74b9d1896172c8924629fb43a5597a | /test1/src/test/java/com/a1qa/lkPage.java | a109ca0f4b4b838239861ad5f8fdd220e8ddd1ed | [] | no_license | Lenyx/testrep | https://github.com/Lenyx/testrep | 6a119289ca125489ce717ef5bdabf487463769f2 | 126837f033063ccc51d388d4927bf87a4396c5fc | refs/heads/master | 2023-07-07T20:07:22.815000 | 2021-08-19T14:16:18 | 2021-08-19T14:16:18 | 381,481,320 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.a1qa;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class lkPage {
public WebDriver driver;
public lkPage(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver; }
@FindBy(xpath = "//*[contains(text(), 'Мой профиль')]")
private WebElement profileButton;
public void clickProfileButton() {
profileButton.click();
}
}
| UTF-8 | Java | 549 | java | lkPage.java | Java | [] | null | [] | package com.a1qa;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class lkPage {
public WebDriver driver;
public lkPage(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver; }
@FindBy(xpath = "//*[contains(text(), 'Мой профиль')]")
private WebElement profileButton;
public void clickProfileButton() {
profileButton.click();
}
}
| 549 | 0.703154 | 0.701299 | 24 | 21.458334 | 19.373476 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
ba4e03380d4e874777844e29f245ea52171aeb14 | 14,061,722,968,510 | f326f9cddc08ca2084b5ffa245d16d1affb8b03b | /d126.java | fdd901c556549f5dbb80a11581ab61e40a0f2f2d | [] | no_license | fool0711/BFSJOA | https://github.com/fool0711/BFSJOA | 4ccaaffbf718b424dba5bf18614d7959cc8e5bfe | 37e47f260bcbc545f1e4e4def78c99e72b44e965 | refs/heads/master | 2016-08-07T20:04:04.155000 | 2013-06-11T06:20:42 | 2013-06-11T06:20:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class d126{
public static void main(String[] argv){
Scanner input = new Scanner(System.in);
while(input.hasNext()){
int a=input.nextInt();
int b=input.nextInt();
System.out.println((a+b)*2);
}
}
}
| UTF-8 | Java | 289 | java | d126.java | Java | [] | null | [] | import java.util.Scanner;
public class d126{
public static void main(String[] argv){
Scanner input = new Scanner(System.in);
while(input.hasNext()){
int a=input.nextInt();
int b=input.nextInt();
System.out.println((a+b)*2);
}
}
}
| 289 | 0.567474 | 0.553633 | 11 | 25.272728 | 14.510754 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 13 |
26f94af418325724dd1cd6344b57ab29b61d98e1 | 14,087,492,759,013 | 781e920184614e4dc0f28e6dfb048635c220abe5 | /src/by/epam/unit02/mas/Task05.java | 3de2a00e7e9ab5da9fe4cef5a52d228ffefc43b1 | [] | no_license | KevinPozitive/TasksIntroEpamUnit02 | https://github.com/KevinPozitive/TasksIntroEpamUnit02 | 43fe578c7c6439a88e0d6833c05761487c01f1b0 | b165cf99e6bb4d3ed67eae74b2cdafecebb18f12 | refs/heads/master | 2020-07-31T18:32:57.116000 | 2019-09-24T22:59:54 | 2019-09-24T22:59:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.epam.unit02.mas;
import java.util.Scanner;
public class Task05 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a[] = new int[n];
int size = 0;
for(int i = 0;i<n;i++){
a[i] = in.nextInt();
}
for(int i=0;i<n;i++){
if(a[i]%2==0){
size++;
}
}
int[]b=new int[size];
for(int i=0;i<n;i++)
{
int j=0;
if(size == 0){
System.out.println("no even numbers");
return;
}else {
if(a[i]%2==0){
b[j]=a[i];
j++;
}
}
}
}
}
| UTF-8 | Java | 784 | java | Task05.java | Java | [] | null | [] | package by.epam.unit02.mas;
import java.util.Scanner;
public class Task05 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a[] = new int[n];
int size = 0;
for(int i = 0;i<n;i++){
a[i] = in.nextInt();
}
for(int i=0;i<n;i++){
if(a[i]%2==0){
size++;
}
}
int[]b=new int[size];
for(int i=0;i<n;i++)
{
int j=0;
if(size == 0){
System.out.println("no even numbers");
return;
}else {
if(a[i]%2==0){
b[j]=a[i];
j++;
}
}
}
}
}
| 784 | 0.355867 | 0.33801 | 35 | 21.4 | 12.708153 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 13 |
9dcf358dc816488bc7d28680ae39caba43d9682e | 33,646,773,849,874 | 19d259635a70040fc29747415630a0c38e45e67c | /app/src/main/java/jiyun/com/doctorsixsixsix/view/DocShareView.java | aa1912b05e2229b10f7f678bf8db478466d4e7a6 | [] | no_license | zhangchao1215/DoctorSixSixSix | https://github.com/zhangchao1215/DoctorSixSixSix | d2c078c13a37c39dc901f2369e85901aab7e1118 | d3b341c3ea5e5e4fc136a99822c05606dfe154a8 | refs/heads/master | 2021-01-25T08:18:27.704000 | 2017-06-15T15:11:28 | 2017-06-15T15:11:28 | 93,743,325 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jiyun.com.doctorsixsixsix.view;
import java.util.List;
import jiyun.com.doctorsixsixsix.modle.bean.DoctorShareBean;
/**
* 项目名称: 血压卫士
* 类描述: 这是专家分享抽取的view接口
* 创建人: Administrator
* 创建时间: 2017/6/12 9:38
* 修改人: 张超
* 修改内容:
* 修改时间:
*/
public interface DocShareView {
void DocShare(List<DoctorShareBean.DataBean> lodaList);
}
| UTF-8 | Java | 430 | java | DocShareView.java | Java | [
{
"context": "人: Administrator\n * 创建时间: 2017/6/12 9:38\n * 修改人: 张超\n * 修改内容:\n * 修改时间:\n */\n\npublic interface DocShare",
"end": 225,
"score": 0.7467153668403625,
"start": 224,
"tag": "NAME",
"value": "张"
},
{
"context": ": Administrator\n * 创建时间: 2017/6/12 9:38\n * 修改人: 张超\n * 修... | null | [] | package jiyun.com.doctorsixsixsix.view;
import java.util.List;
import jiyun.com.doctorsixsixsix.modle.bean.DoctorShareBean;
/**
* 项目名称: 血压卫士
* 类描述: 这是专家分享抽取的view接口
* 创建人: Administrator
* 创建时间: 2017/6/12 9:38
* 修改人: 张超
* 修改内容:
* 修改时间:
*/
public interface DocShareView {
void DocShare(List<DoctorShareBean.DataBean> lodaList);
}
| 430 | 0.716763 | 0.687861 | 21 | 15.476191 | 18.196335 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | false | false | 13 |
e9fcf8301f9f7f21304ee8585a41d8213791c8b2 | 33,079,838,181,506 | 2e981c2c539efb176cef0b2dee5b6f06b099bf9d | /RHoffman_Password/src/Password.java | f01dab3039b6f586c8dc4bc98bf0805b1857db3e | [] | no_license | ryan2445/Java_Projects | https://github.com/ryan2445/Java_Projects | 1d28d6877e734ee42ce13615d0e6219576b26aae | eef3a4fa202c8560d5a0bdd647a49310474afa56 | refs/heads/master | 2020-03-29T11:00:14.389000 | 2018-09-26T19:11:35 | 2018-09-26T19:11:35 | 149,829,316 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Ryan Hoffman - Period 5 - Password Lab
import java.util.*;
public class Password {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int chances = 3;
System.out.print("Please enter your first and last name: ");
String fname = scan.next();
String lname = scan.next();
System.out.print("Enter \"1\" if you are an admin or \"2\" if you are a worker: ");
int numb = scan.nextInt();
System.out.print("Enter the first password: ");
String pass1 = scan.next();
System.out.print("Enter the second password: ");
String pass2 = scan.next();
if (numb == 1)
{
while (!pass1.equalsIgnoreCase("password1") && !pass2.equalsIgnoreCase("password2"))
{
System.out.print("Incorrect. Keep trying! \n");
System.out.print("Enter the first password: ");
pass1 = scan.next();
System.out.print("Enter the second password: ");
pass2 = scan.next();
}
if (pass1.equalsIgnoreCase("password1") || pass2.equalsIgnoreCase("password2"))
System.out.print("Welcome back " + fname + " " + lname + " " + "(admin)");
}
if (numb == 2)
{
while (!pass1.equals("password1") || !pass2.equals("password2"))
{
chances = chances - 1;
System.out.print("Incorrect. You have " + chances + " chances left.\n");
System.out.print("Enter the first password: ");
pass1 = scan.next();
System.out.print("Enter the second password: ");
pass2 = scan.next();
if (pass1.equals("password1") && pass2.equals("password2"))
System.out.print("Welcome back " + fname + " " + lname + " " + "(worker)");
if (pass1.equals("password1") && pass2.equals("password2"))
break;
if (chances == 1)
System.out.print("0 chances left.\nYou have been locked out.");
if (chances == 1)
break;
}
}
}
}
| UTF-8 | Java | 1,835 | java | Password.java | Java | [
{
"context": "// Ryan Hoffman - Period 5 - Password Lab\r\nimport java.util.*;\r\np",
"end": 15,
"score": 0.9998696446418762,
"start": 3,
"tag": "NAME",
"value": "Ryan Hoffman"
},
{
"context": "umb == 1)\r\n\t\t{\r\n\t\twhile (!pass1.equalsIgnoreCase(\"password1\") && !pass2.equalsIg... | null | [] | // <NAME> - Period 5 - Password Lab
import java.util.*;
public class Password {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int chances = 3;
System.out.print("Please enter your first and last name: ");
String fname = scan.next();
String lname = scan.next();
System.out.print("Enter \"1\" if you are an admin or \"2\" if you are a worker: ");
int numb = scan.nextInt();
System.out.print("Enter the first password: ");
String pass1 = scan.next();
System.out.print("Enter the second password: ");
String pass2 = scan.next();
if (numb == 1)
{
while (!pass1.equalsIgnoreCase("<PASSWORD>") && !pass2.equalsIgnoreCase("<PASSWORD>"))
{
System.out.print("Incorrect. Keep trying! \n");
System.out.print("Enter the first password: ");
pass1 = scan.next();
System.out.print("Enter the second password: ");
pass2 = scan.next();
}
if (pass1.equalsIgnoreCase("<PASSWORD>") || pass2.equalsIgnoreCase("<PASSWORD>"))
System.out.print("Welcome back " + fname + " " + lname + " " + "(admin)");
}
if (numb == 2)
{
while (!pass1.equals("<PASSWORD>") || !pass2.equals("<PASSWORD>"))
{
chances = chances - 1;
System.out.print("Incorrect. You have " + chances + " chances left.\n");
System.out.print("Enter the first password: ");
pass1 = scan.next();
System.out.print("Enter the second password: ");
pass2 = scan.next();
if (pass1.equals("<PASSWORD>") && pass2.equals("<PASSWORD>"))
System.out.print("Welcome back " + fname + " " + lname + " " + "(worker)");
if (pass1.equals("<PASSWORD>1") && pass2.equals("<PASSWORD>"))
break;
if (chances == 1)
System.out.print("0 chances left.\nYou have been locked out.");
if (chances == 1)
break;
}
}
}
}
| 1,840 | 0.607629 | 0.588011 | 54 | 31.981482 | 26.128946 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.888889 | false | false | 13 |
13608f157b079a2af30197c18b69d4e9e5b757a4 | 28,338,194,230,227 | f6c46d8324a4f121b4ec0659e98af06bb970896b | /src/main/java/org/ihtsdo/changeanalyzer/ReleaseFilesDiffInRefsetPlugin.java | 6abcbbc7c340bbb88e4cf15ffee69dfb00189432 | [
"Apache-2.0"
] | permissive | termMed/rf2-diff-generator | https://github.com/termMed/rf2-diff-generator | 9d11fdf70e7aa406297c368de1a3e610cc54331f | c1f28eaabcbea10da92de376fa85526e175119ab | refs/heads/master | 2020-12-31T00:18:24.720000 | 2016-02-02T19:13:09 | 2016-02-02T19:13:09 | 50,944,929 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.ihtsdo.changeanalyzer;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.ihtsdo.changeanalyzer.utils.Type5UuidFactory;
import org.ihtsdo.changeanalyzer.data.Rf2DescriptionRow;
import org.ihtsdo.changeanalyzer.data.Rf2LanguageRefsetRow;
import org.ihtsdo.changeanalyzer.file.*;
import org.ihtsdo.changeanalyzer.FileFilterAndSorter;
import org.ihtsdo.changeanalyzer.utils.CommonUtils;
import org.ihtsdo.changeanalyzer.utils.FileHelper;
import java.io.*;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
/**
* @goal report-differences-to-refset
* @phase install
*/
public class ReleaseFilesDiffInRefsetPlugin extends AbstractMojo {
public enum ReleaseFileTypes {
DESCRIPTION, CONCEPT, RELATIONSHIP, ATTRIBUTE_VALUE_REFSET, ASSOCIATION_REFSET, LANGUAGE_REFSET, SIMPLE_REFSET, STATED_RELATIONSHIP, TEXT_DEFINITION, SIMPLE_MAP
}
private static final String REFSET_CONCEPTS_TMP_FOLDER = "refsetConcepts";
private static final String SIMPLE_REFSET_TXT = "simpleRefset.txt";
private static final String REFSET_LANGUAGE_TXT = "refsetLanguage.txt";
private static final String REFSET_STATED_RELS_TXT = "refsetStatedRels.txt";
private static final String REFSET_RELATIONSHIPS_TXT = "refsetRelationships.txt";
private static final String REFSET_DESCRIPTIONS_TXT = "refsetDescriptions.txt";
private static final String REFSET_CONCEPTS_TXT = "refsetConcepts.txt";
private static final String REACTIVATED_CONCEPTS_REPORT = "reactivated_concepts.json";
public static final String NEW_CONCEPTS_FILE = "new_concepts.json";
public static final String NEW_RELATIONSHIPS_FILE = "new_relationships.json";
public static final String RETIRED_CONCEPT_REASON_FILE = "inactivated_concept_reason.json";
public static final String NEW_DESCRIPTIONS_FILE = "new_descriptions.json";
public static final String OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE = "old_concepts_new_descriptions.json";
public static final String OLD_CONCEPTS_NEW_RELATIONSHIPS_FILE = "old_concepts_new_relationships.json";
public static final String NEW_INACTIVE_CONCEPTS_FILE = "new_inactive_concepts.json";
public static final String REL_GROUP_CHANGED_FILE = "rel_group_changed_relationships.json";
private static final Logger logger = Logger.getLogger(ReleaseFilesDiffInRefsetPlugin.class);
private static final String RETIRED_DESCRIPTIONS_FILE = "inactivated_descriptions.json";
private static final String REACTIVATED_DESCRIPTIONS_FILE = "reactivated_descriptions.json";
private static final String CHANGED_FSN="changed_fsn.json";
private static final String SYN_ACCEPTABILITY_CHANGED = "acceptability_changed_on_synonym.json";
private static final String TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION = "active_language_references_to_now_inactive_descriptions.json";
/**
* Location of the directory of report files
*
* @parameter expression="${project.build.directory}"
* @required
*/
private File outputDirectory;
/**
* Location of the directory of the full release folder.
*
* @parameter expression="${project.build.directory}"
* @required
*/
private File inputFullDirectory;
/**
* Location of the directory of the snapshot release folder.
*
* @parameter
* @required
*/
private File inputSnapshotDirectory;
/**
* Start date for the reports.
*
* @parameter
* @required
*/
private String startDate;
/**
* End date for the reports.
*
* @parameter
* @required
*/
private String endDate;
/**
* Release date. in case there is more than one release in the release
* folder.
*
* @parameter
*/
private String releaseDate;
/**
* Target Language File
*
* @parameter
*/
private File targetLanguage;
private boolean langTargetCtrl=false;
private BufferedWriter bwsr;
private void fileConsolidate() throws IOException {
File tmpdir=new File(outputDirectory, REFSET_CONCEPTS_TMP_FOLDER);
tmpdir.mkdirs();
mergeFiles(ReleaseFileTypes.CONCEPT,REFSET_CONCEPTS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.DESCRIPTION,REFSET_DESCRIPTIONS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.RELATIONSHIP,REFSET_RELATIONSHIPS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.STATED_RELATIONSHIP,REFSET_STATED_RELS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.LANGUAGE_REFSET,REFSET_LANGUAGE_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.SIMPLE_REFSET,SIMPLE_REFSET_TXT, tmpdir);
copyReleaseFileToOutput(ReleaseFileTypes.TEXT_DEFINITION);
copyReleaseFileToOutput(ReleaseFileTypes.SIMPLE_MAP);
copyReleaseFileToOutput(ReleaseFileTypes.ASSOCIATION_REFSET);
copyReleaseFileToOutput(ReleaseFileTypes.ATTRIBUTE_VALUE_REFSET);
FileHelper.emptyFolder(tmpdir);
tmpdir.delete();
}
private void copyReleaseFileToOutput(ReleaseFileTypes fileType) throws IOException {
String rFilePath = getFilePath(fileType, inputSnapshotDirectory);
File releaseFile=new File(rFilePath);
File outputFile= new File(outputDirectory,releaseFile.getName());
FileHelper.copyTo(releaseFile, outputFile);
}
private void mergeFiles(ReleaseFileTypes fileType, String txtfile, File tmpDir) {
HashSet<File> hFile = new HashSet<File>();
String rFilePath = getFilePath(fileType, inputSnapshotDirectory);
File releaseFile=new File(rFilePath);
hFile.add(new File(tmpDir,txtfile));
hFile.add(releaseFile);
CommonUtils.MergeFile(hFile, new File(outputDirectory,releaseFile.getName()));
}
private void createRefsetConcepts() throws IOException {
File tmpdir=new File(outputDirectory, REFSET_CONCEPTS_TMP_FOLDER);
tmpdir.mkdirs();
File file=new File(tmpdir,REFSET_CONCEPTS_TXT);
BufferedWriter bwc=getWriter(file);
bwc.append("id effectiveTime active moduleId definitionStatusId");
bwc.append("\r\n");
bwc.append("1 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("2 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("3 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("4 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("5 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("6 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("7 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("8 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("9 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.close();
bwc=null;
File dfile=new File(tmpdir,REFSET_DESCRIPTIONS_TXT);
BufferedWriter bwd=getWriter(dfile);
bwd.append("id effectiveTime active moduleId conceptId languageCode typeId term caseSignificanceId");
bwd.append("\r\n");
bwd.append("1 " + endDate + " 1 900000000000207008 1 en 900000000000013009 New concepts for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("2 " + endDate + " 1 900000000000207008 1 en 900000000000003001 New concepts for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("3 " + endDate + " 1 900000000000207008 2 en 900000000000013009 Inactivated concepts for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("4 " + endDate + " 1 900000000000207008 2 en 900000000000003001 Inactivated concepts for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("5 " + endDate + " 1 900000000000207008 3 en 900000000000013009 Reactivated concepts for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("6 " + endDate + " 1 900000000000207008 3 en 900000000000003001 Reactivated concepts for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("7 " + endDate + " 1 900000000000207008 4 en 900000000000013009 Changed FSN for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("8 " + endDate + " 1 900000000000207008 4 en 900000000000003001 Changed FSN for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("9 " + endDate + " 1 900000000000207008 5 en 900000000000013009 Active language references to now inactive descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("10 " + endDate + " 1 900000000000207008 5 en 900000000000003001 Active language references to now inactive descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("11 " + endDate + " 1 900000000000207008 6 en 900000000000013009 Inactivated descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("12 " + endDate + " 1 900000000000207008 6 en 900000000000003001 Inactivated descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("13 " + endDate + " 1 900000000000207008 7 en 900000000000013009 Old concepts new descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("14 " + endDate + " 1 900000000000207008 7 en 900000000000003001 Old concepts new descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("15 " + endDate + " 1 900000000000207008 8 en 900000000000013009 Reactivated descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("16 " + endDate + " 1 900000000000207008 8 en 900000000000003001 Reactivated descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("17 " + endDate + " 1 900000000000207008 9 en 900000000000013009 Acceptability changed on synonym for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("18 " + endDate + " 1 900000000000207008 9 en 900000000000003001 Acceptability changed on synonym for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.close();
bwd=null;
File rfile=new File(tmpdir,REFSET_RELATIONSHIPS_TXT);
BufferedWriter bwr=getWriter(rfile);
bwr.append("id effectiveTime active moduleId sourceId destinationId relationshipGroup typeId characteristicTypeId modifierId");
bwr.append("\r\n");
bwr.append("1 " + endDate + " 1 900000000000012004 1 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("2 " + endDate + " 1 900000000000012004 2 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("3 " + endDate + " 1 900000000000012004 3 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("4 " + endDate + " 1 900000000000012004 4 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("5 " + endDate + " 1 900000000000012004 5 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("6 " + endDate + " 1 900000000000012004 6 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("7 " + endDate + " 1 900000000000012004 7 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("8 " + endDate + " 1 900000000000012004 8 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("9 " + endDate + " 1 900000000000012004 9 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.close();
bwr=null;
File sfile=new File(tmpdir,REFSET_STATED_RELS_TXT);
BufferedWriter bws=getWriter(sfile);
bws.append("id effectiveTime active moduleId sourceId destinationId relationshipGroup typeId characteristicTypeId modifierId");
bws.append("\r\n");
bws.append("11 " + endDate + " 1 900000000000012004 1 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("12 " + endDate + " 1 900000000000012004 2 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("13 " + endDate + " 1 900000000000012004 3 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("14 " + endDate + " 1 900000000000012004 4 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("15 " + endDate + " 1 900000000000012004 5 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("16 " + endDate + " 1 900000000000012004 6 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("17 " + endDate + " 1 900000000000012004 7 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("18 " + endDate + " 1 900000000000012004 8 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("19 " + endDate + " 1 900000000000012004 9 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.close();
bws=null;
File lfile=new File(tmpdir,REFSET_LANGUAGE_TXT);
BufferedWriter bwl=getWriter(lfile);
bwl.append("id effectiveTime active moduleId refsetId referencedComponentId acceptabilityId");
bwl.append("\r\n");
bwl.append("18685dc7-30e4-573d-891c-dc8f9f3e6861 " + endDate + " 1 900000000000207008 900000000000509007 1 900000000000548007");
bwl.append("\r\n");
bwl.append("d2db27d2-2656-5c69-b1db-0587998439a2 " + endDate + " 1 900000000000207008 900000000000508004 1 900000000000548007");
bwl.append("\r\n");
bwl.append("768d3d74-d155-54c2-b918-87e668d27983 " + endDate + " 1 900000000000207008 900000000000509007 2 900000000000548007");
bwl.append("\r\n");
bwl.append("c46a7d65-f5ed-551d-a378-5bd6c9a77754 " + endDate + " 1 900000000000207008 900000000000508004 2 900000000000548007");
bwl.append("\r\n");
bwl.append("f8a120d7-6690-5a61-aa43-0821e965f4a5 " + endDate + " 1 900000000000207008 900000000000509007 3 900000000000548007");
bwl.append("\r\n");
bwl.append("d26ff35c-0be3-560b-8ba4-631d43f7c826 " + endDate + " 1 900000000000207008 900000000000508004 3 900000000000548007");
bwl.append("\r\n");
bwl.append("7265c5f7-38a7-58e0-826c-e9e555bc0dd7 " + endDate + " 1 900000000000207008 900000000000509007 4 900000000000548007");
bwl.append("\r\n");
bwl.append("31ac1b26-1f0e-5b4e-bd52-9d2a2385a848 " + endDate + " 1 900000000000207008 900000000000508004 4 900000000000548007");
bwl.append("\r\n");
bwl.append("397a28b4-b05a-5589-b55a-ad792d1d28a9 " + endDate + " 1 900000000000207008 900000000000509007 5 900000000000548007");
bwl.append("\r\n");
bwl.append("22b79af2-d628-5cfa-ae89-851787f22490 " + endDate + " 1 900000000000207008 900000000000508004 5 900000000000548007");
bwl.append("\r\n");
bwl.append("480b53c4-ed84-5236-9023-a15c9801fc1a " + endDate + " 1 900000000000207008 900000000000509007 6 900000000000548007");
bwl.append("\r\n");
bwl.append("6d322dbe-e001-56ab-b369-2bf9fe19d2db " + endDate + " 1 900000000000207008 900000000000508004 6 900000000000548007");
bwl.append("\r\n");
bwl.append("79e5d418-da92-572d-9eb3-22c2ccf567ec " + endDate + " 1 900000000000207008 900000000000509007 7 900000000000548007");
bwl.append("\r\n");
bwl.append("44a63353-82b1-57d3-a41d-aad4d069bb8d " + endDate + " 1 900000000000207008 900000000000508004 7 900000000000548007");
bwl.append("\r\n");
bwl.append("bad0ffda-804c-5c90-a20d-1908090257de " + endDate + " 1 900000000000207008 900000000000509007 8 900000000000548007");
bwl.append("\r\n");
bwl.append("5f3da74c-195f-5ead-8a25-ba9c81da710f " + endDate + " 1 900000000000207008 900000000000508004 8 900000000000548007");
bwl.append("\r\n");
bwl.append("6238a3ec-e1bf-5268-94a5-4ba74dd35211 " + endDate + " 1 900000000000207008 900000000000509007 9 900000000000548007");
bwl.append("\r\n");
bwl.append("f612bba4-6c81-53e9-a784-71b1098a6a22 " + endDate + " 1 900000000000207008 900000000000508004 9 900000000000548007");
bwl.append("\r\n");
bwl.append("f6a801b3-1707-520e-8ec5-8ba6a9b4d533 " + endDate + " 1 900000000000207008 900000000000509007 10 900000000000548007");
bwl.append("\r\n");
bwl.append("7c17b526-79dd-50f6-bdf2-c0639d558044 " + endDate + " 1 900000000000207008 900000000000508004 10 900000000000548007");
bwl.append("\r\n");
bwl.append("8c01ac48-02ae-5994-83de-ba52e5bd2255 " + endDate + " 1 900000000000207008 900000000000509007 11 900000000000548007");
bwl.append("\r\n");
bwl.append("78b9018d-e6cd-52ee-a3d1-db5362bec266 " + endDate + " 1 900000000000207008 900000000000508004 11 900000000000548007");
bwl.append("\r\n");
bwl.append("0d7056f1-8871-53ca-8348-9195a407aa77 " + endDate + " 1 900000000000207008 900000000000509007 12 900000000000548007");
bwl.append("\r\n");
bwl.append("89766327-6ff9-5e73-b03f-44761850ea88 " + endDate + " 1 900000000000207008 900000000000508004 12 900000000000548007");
bwl.append("\r\n");
bwl.append("165c957d-5216-5931-bfd4-983efa413e99 " + endDate + " 1 900000000000207008 900000000000509007 13 900000000000548007");
bwl.append("\r\n");
bwl.append("fe3fe207-f366-5110-8a50-da559205bd00 " + endDate + " 1 900000000000207008 900000000000508004 13 900000000000548007");
bwl.append("\r\n");
bwl.append("8c0636fd-72d5-524b-a952-8652d706f333 " + endDate + " 1 900000000000207008 900000000000509007 14 900000000000548007");
bwl.append("\r\n");
bwl.append("69871d91-b537-5de4-b980-876920769444 " + endDate + " 1 900000000000207008 900000000000508004 14 900000000000548007");
bwl.append("\r\n");
bwl.append("62facd0a-08da-5ed4-b69e-30694e8022aa " + endDate + " 1 900000000000207008 900000000000509007 15 900000000000548007");
bwl.append("\r\n");
bwl.append("600caf82-decd-5831-b10f-ff65b62ff2bb " + endDate + " 1 900000000000207008 900000000000508004 15 900000000000548007");
bwl.append("\r\n");
bwl.append("55ddcbe1-f861-5771-93f6-80e2830ec7cc " + endDate + " 1 900000000000207008 900000000000509007 16 900000000000548007");
bwl.append("\r\n");
bwl.append("d8452236-4321-5ed4-8694-eeaa7e5667dd " + endDate + " 1 900000000000207008 900000000000508004 16 900000000000548007");
bwl.append("\r\n");
bwl.append("559a729c-188d-593c-adcd-1765c3252dee " + endDate + " 1 900000000000207008 900000000000509007 17 900000000000548007");
bwl.append("\r\n");
bwl.append("9d88128a-27ae-57fc-bdda-b9dea6e583ff " + endDate + " 1 900000000000207008 900000000000508004 17 900000000000548007");
bwl.append("\r\n");
bwl.append("a20c5ccb-c406-5921-b9e9-39ec899b7111 " + endDate + " 1 900000000000207008 900000000000509007 18 900000000000548007");
bwl.append("\r\n");
bwl.append("afffd990-6011-5766-80ed-b934e0dd5222 " + endDate + " 1 900000000000207008 900000000000508004 18 900000000000548007");
bwl.append("\r\n");
bwl.close();
bwl=null;
File srfile=new File(tmpdir,SIMPLE_REFSET_TXT);
bwsr=getWriter(srfile);
}
private void writeToRefsetFile(String componentId,String refsetId) throws IOException, NoSuchAlgorithmException {
UUID id=Type5UuidFactory.get("900000000000207008" + refsetId + componentId );
bwsr.append(id.toString());
bwsr.append("\t");
bwsr.append(releaseDate);
bwsr.append("\t");
bwsr.append("1");
bwsr.append("\t");
bwsr.append("900000000000207008");
bwsr.append("\t");
bwsr.append(refsetId);
bwsr.append("\t");
bwsr.append(componentId);
bwsr.append("\r\n");
}
private BufferedWriter getWriter(File file) throws FileNotFoundException, UnsupportedEncodingException {
FileOutputStream fos;
OutputStreamWriter osw;
BufferedWriter bw;
fos = new FileOutputStream(file);
logger.info("Generating " + file);
osw = new OutputStreamWriter(fos, "UTF-8");
bw = new BufferedWriter(osw);
return bw;
}
private ArrayList<Long> generateTargetDescriptionPointerToSource(
Rf2DescriptionFile rf2DescFile,
Rf2LanguageRefsetFile targetLangFile,
ArrayList<Long> repcomponents) throws Exception {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION));
logger.info("Generating " + TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> changedDesc = rf2DescFile.getChangedComponentIds(startDate, endDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : changedDesc) {
Rf2LanguageRefsetRow langRow = targetLangFile.getLastActiveRow(startDate, long1.toString());
if (langRow!=null && langRow.getActive()==1){
Rf2DescriptionRow rf2DescRow = rf2DescFile.getLastActiveRow(startDate,long1);
if (!repcomponents.contains(rf2DescRow.getConceptId()) &&
rf2DescRow.getActive()==0) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "5");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(long1.toString(), rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
}
// bw.append("]");
// bw.close();
// addFileChangeReport(TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION,count,"Active language references to now inactive descriptions.");
return repcomponents;
}
private ArrayList<Long> generateDescriptionAcceptabilityChanges(
Rf2LanguageRefsetFile sourceLangFile, Rf2DescriptionFile rf2DescFile,ArrayList<Long> repcomponents) throws Exception {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, SYN_ACCEPTABILITY_CHANGED));
logger.info("Generating " + SYN_ACCEPTABILITY_CHANGED);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<String> changedLang = sourceLangFile.getAcceptabilityIdChanged(startDate, endDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (String string : changedLang) {
Rf2DescriptionRow rf2DescRow = rf2DescFile.getLastActiveRow(startDate, Long.parseLong(string));
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getTypeId()!=900000000000003001L) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "9");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(string, rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
// bw.append("]");
// bw.close();
//
// addFileChangeReport(SYN_ACCEPTABILITY_CHANGED,count,"Acceptability changed in descriptions (no FSN)");
return repcomponents;
}
private String getFilePath(ReleaseFileTypes descriptions,File inputDir) {
String result = "";
switch (descriptions) {
case DESCRIPTION:
result = getFilePathRecursive(inputDir, "description");
break;
case CONCEPT:
result = getFilePathRecursive(inputDir, "concept");
break;
case RELATIONSHIP:
result = getFilePathRecursive(inputDir, "_relationship");
break;
case ASSOCIATION_REFSET:
result = getFilePathRecursive(inputDir, "associationreference");
break;
case ATTRIBUTE_VALUE_REFSET:
result = getFilePathRecursive(inputDir, "attributevalue");
break;
case LANGUAGE_REFSET:
result = getFilePathRecursive(inputDir, "refset_language");
break;
case SIMPLE_REFSET:
result = getFilePathRecursive(inputDir, "_refset_simple");
break;
case STATED_RELATIONSHIP:
result = getFilePathRecursive(inputDir, "_statedrelationship");
break;
case TEXT_DEFINITION:
result = getFilePathRecursive(inputDir, "_textdefinition");
break;
case SIMPLE_MAP:
result = getFilePathRecursive(inputDir, "_srefset_simplemap");
break;
default:
break;
}
return result;
}
public String getFilePathRecursive(File folder, String namePart) {
String result = "";
if (folder.isDirectory()) {
File[] files = folder.listFiles();
int i = 0;
while (i < files.length && result.equals("")) {
result = getFilePathRecursive(files[i], namePart);
i++;
}
} else {
if (folder.getName().toLowerCase().contains(namePart)) {
if (releaseDate != null && !releaseDate.equals("") && folder.getName().contains(releaseDate)) {
result = folder.getPath();
} else if (releaseDate == null || releaseDate.equals("")) {
result = folder.getPath();
}
}
}
return result;
}
private ArrayList<Long> reactivatedConceptsReport(Rf2DescriptionFile rf2DescFile, Rf2ConceptFile conceptFile) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, REACTIVATED_CONCEPTS_REPORT));
logger.info("Generating " + REACTIVATED_CONCEPTS_REPORT);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> reactConcepts = conceptFile.getReactivatedComponents(startDate, endDate);
// generateConceptReport(rf2DescFile, conceptFile, bw, reactConcepts);
for (Long long1 : reactConcepts) {
writeToRefsetFile(long1.toString(), "3");
}
// addFileChangeReport(REACTIVATED_CONCEPTS_REPORT,reactConcepts.size(),"Ractivated concepts");
return reactConcepts;
}
private ArrayList<Long> generatingExistingConceptsNewDescriptions(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE));
logger.info("Generating " + OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> newDescriptions = rf2DescFile.getNewComponentIds(startDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : newDescriptions) {
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, long1);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getTypeId()!=900000000000003001L) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "7");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(long1.toString() , rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
}
// bw.append("]");
// bw.close();
//
// addFileChangeReport(OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE,count,"New descriptions (no FSN) in existing concepts");
return repcomponents;
}
private ArrayList<Long> generatingChangedFSN(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, CHANGED_FSN));
logger.info("Generating " + CHANGED_FSN);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> descriptions = rf2DescFile.getChangedComponentIds(startDate, endDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : descriptions) {
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, long1);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getActive()==1
&& rf2DescRow.getTypeId()==900000000000003001L ) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "4");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(long1.toString() , rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
}
// bw.append("]");
// bw.close();
//
// addFileChangeReport(CHANGED_FSN,count,"Changed FSNs");
return repcomponents;
}
private ArrayList<Long> generateRetiredDescriptionsReport(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, RETIRED_DESCRIPTIONS_FILE));
logger.info("Generating " + RETIRED_DESCRIPTIONS_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> retiredDescriptions = rf2DescFile.getRetiredComponents(startDate, endDate);
// ArrayList<Long> filteredRetDesc=new ArrayList<Long>();
for(Long retiredDesc:retiredDescriptions){
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, retiredDesc);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getActive()==0
&& rf2DescRow.getTypeId()!=900000000000003001L ) {
// filteredRetDesc.add(retiredDesc);
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "6");
repcomponents.add(rf2DescRow.getConceptId());
}
}
}
// int count=writeDescriptionsFile(rf2DescFile, bw, filteredRetDesc);
//
// addFileChangeReport(RETIRED_DESCRIPTIONS_FILE,count,"Inactivated descriptions (no FSN)");
return repcomponents;
}
private ArrayList<Long> generateReactivatedDescriptionsReport(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, REACTIVATED_DESCRIPTIONS_FILE));
logger.info("Generating " + REACTIVATED_DESCRIPTIONS_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> reactivedDescriptions = rf2DescFile.getReactivatedComponents(startDate, endDate);
// ArrayList<Long> filteredReactDesc=new ArrayList<Long>();
for(Long retiredDesc:reactivedDescriptions){
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, retiredDesc);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getActive()==1 && rf2DescRow.getTypeId()!=900000000000003001L ) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "8");
// filteredReactDesc.add(retiredDesc);
}
}
}
// int count=writeDescriptionsFile(rf2DescFile, bw, filteredReactDesc);
//
// addFileChangeReport(REACTIVATED_DESCRIPTIONS_FILE,count,"Reactivated descriptions");
return repcomponents;
}
private ArrayList<Long> generatingRetiredConceptReasons(Rf2DescriptionFile rf2DescFile, Rf2ConceptFile conceptFile, Rf2AttributeValueRefsetFile attrValue, Rf2AssociationRefsetFile associationFile)
throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
ArrayList<Long> retiredConcepts = conceptFile.getRetiredComponents(startDate, endDate);
// fos = new FileOutputStream(new File(outputDirectory, RETIRED_CONCEPT_REASON_FILE));
logger.info("Generating " + RETIRED_CONCEPT_REASON_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : retiredConcepts) {
// Rf2AttributeValueRefsetRow refsetRow = attrValue.getRowByReferencedComponentId(long1);
// Rf2AssociationRefsetRow associationRow = associationFile.getLastRowByReferencedComponentId(long1);
//
// String fsn = rf2DescFile.getFsn(long1);
// Pattern p = Pattern.compile("\\((.*?)\\)", Pattern.DOTALL);
// String semanticTag = "";
// if (fsn != null) {
// Matcher matcher = p.matcher(fsn);
// while (matcher.find()) {
// semanticTag = matcher.group(1);
// }
// }
// if (associationRow!=null) {
// String assValue = associationRow.getTargetComponent();
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// if (refsetRow != null) {
// String value = refsetRow.getValueId();
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// rf2DescFile.getFsn(Long.parseLong(value)),rf2DescFile.getFsn(Long.parseLong(associationRow.getRefsetId())),
// rf2DescFile.getFsn(Long.parseLong(assValue)) ,String.valueOf(conceptFile.isNewComponent(long1, startDate)));
// bw.append(gson.toJson(concept).toString());
// concept=null;
// } else {
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// "no reason",rf2DescFile.getFsn(Long.parseLong(associationRow.getRefsetId())),
// rf2DescFile.getFsn(Long.parseLong(assValue)) ,String.valueOf(conceptFile.isNewComponent(long1, startDate)));
// bw.append(gson.toJson(concept).toString());
// concept=null;
// }
// bw.append(sep);
// count++;
// } else {
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// if (refsetRow != null) {
// String value = refsetRow.getValueId();
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// rf2DescFile.getFsn(Long.parseLong(value)),"no association","-" ,"-");
// bw.append(gson.toJson(concept).toString());
// concept=null;
// } else {
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// "no reason","no association","-" ,"-");
// bw.append(gson.toJson(concept).toString());
// concept=null;
// }
// bw.append(sep);
// }
writeToRefsetFile(long1.toString(), "2");
// count++;
}
// bw.append("]");
// bw.close();
// attrValue.releasePreciousMemory();
// associationFile.releasePreciousMemory();
// addFileChangeReport(RETIRED_CONCEPT_REASON_FILE,count,"Inactivated concepts");
return retiredConcepts;
}
private ArrayList<Long> generateNewConceptsReport(Rf2DescriptionFile rf2DescFile, Rf2ConceptFile conceptFile) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
logger.info("getting new conscpt ids");
ArrayList<Long> newcomponents = conceptFile.getNewComponentIds(startDate);
// FileOutputStream fos = new FileOutputStream(new File(outputDirectory, NEW_CONCEPTS_FILE));
logger.info("Generating " + NEW_CONCEPTS_FILE);
// OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
// BufferedWriter bw = new BufferedWriter(osw);
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : newcomponents) {
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// String fsn = rf2DescFile.getFsn(long1);
// Pattern p = Pattern.compile("\\((.*?)\\)", Pattern.DOTALL);
// String semanticTag = "";
// if (fsn != null) {
// Matcher matcher = p.matcher(fsn);
// while (matcher.find()) {
// semanticTag = matcher.group(1);
// }
// }
// Concept concept=new Concept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag);
// bw.append(gson.toJson(concept).toString());
writeToRefsetFile(long1.toString(), "1");
// concept=null;
// bw.append(sep);
}
// bw.append("]");
// bw.close();
// addFileChangeReport(NEW_CONCEPTS_FILE,newcomponents.size(),"New concepts");
return newcomponents;
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
createRefsetConcepts();
// changeSummary=new ChangeSummary();
logger.info("Loading descriptinos");
Rf2DescriptionFile rf2DescFile = new Rf2DescriptionFile(getFilePath(ReleaseFileTypes.DESCRIPTION,inputFullDirectory), startDate);
logger.info("Loading concepts");
Rf2ConceptFile conceptFile = new Rf2ConceptFile(getFilePath(ReleaseFileTypes.CONCEPT,inputFullDirectory), startDate);
logger.info("Loading attribute value refset");
Rf2AttributeValueRefsetFile attrValue = new Rf2AttributeValueRefsetFile(getFilePath(ReleaseFileTypes.ATTRIBUTE_VALUE_REFSET,inputFullDirectory));
logger.info("Loading association value refset");
Rf2AssociationRefsetFile associationFile = new Rf2AssociationRefsetFile(getFilePath(ReleaseFileTypes.ASSOCIATION_REFSET,inputFullDirectory));
logger.info("Loading source US language refset");
String langPath=getFilePath(ReleaseFileTypes.LANGUAGE_REFSET,inputFullDirectory);
File inputFile=new File(langPath);
File sourceUS=new File(outputDirectory,"tmpUSLang.txt");
File tempFolder=new File(outputDirectory,"tmpSorting");
if (!tempFolder.exists()) {
tempFolder.mkdirs();
}
FileFilterAndSorter ffs=new FileFilterAndSorter(inputFile, sourceUS, tempFolder, new int[]{4}, new Integer[]{4}, new String[]{"900000000000509007"});
ffs.execute();
ffs=null;
System.gc();
Rf2LanguageRefsetFile sourceUSLangFile = new Rf2LanguageRefsetFile(sourceUS.getAbsolutePath());
// Rf2LanguageRefsetFile sourceGBLangFile=null;
Rf2LanguageRefsetFile targetLangFile=null;
langTargetCtrl=false;
if (targetLanguage!=null){
if (targetLanguage.exists()){
langTargetCtrl=true;
// logger.info("Loading source GB language refset");
// File sourceGB=new File(outputDirectory,"tmpGBLang.txt");
//
// if (!tempFolder.exists()) {
// tempFolder.mkdirs();
// }
// ffs=new FileFilterAndSorter(inputFile, sourceGB, tempFolder, new int[]{4}, new Integer[]{4}, new String[]{"900000000000508004"});
// ffs.execute();
// ffs=null;
// System.gc();
// sourceGBLangFile = new Rf2LanguageRefsetFile(sourceGB.getAbsolutePath());
logger.info("Loading target language refset");
targetLangFile = new Rf2LanguageRefsetFile(targetLanguage.getAbsolutePath());
System.gc();
}else{
logger.info("Target language doesn't exist");
}
}else{
logger.info("Target language is null");
}
// logger.info("Loading relationships");
// Rf2RelationshipFile relFile = new Rf2RelationshipFile(getFilePath(ReleaseFileType.RELATIONSHIP), startDate);
ArrayList<Long> repcomponents = generateNewConceptsReport(rf2DescFile, conceptFile);
ArrayList<Long> concepts=generatingRetiredConceptReasons(rf2DescFile, conceptFile, attrValue, associationFile);
repcomponents.addAll(concepts);
concepts=null;
// relFile.releasePreciousMemory();
concepts=reactivatedConceptsReport(rf2DescFile, conceptFile);
repcomponents.addAll(concepts);
concepts=null;
conceptFile.releasePreciousMemory();
repcomponents=generatingChangedFSN(rf2DescFile, repcomponents);
if (langTargetCtrl){
repcomponents=generateTargetDescriptionPointerToSource(rf2DescFile,targetLangFile,repcomponents);
}
System.gc();
repcomponents=generateRetiredDescriptionsReport(rf2DescFile, repcomponents);
repcomponents=generatingExistingConceptsNewDescriptions(rf2DescFile, repcomponents);
System.gc();
repcomponents=generateReactivatedDescriptionsReport(rf2DescFile, repcomponents);
repcomponents=generateDescriptionAcceptabilityChanges(sourceUSLangFile, rf2DescFile, repcomponents);
//ver punteroalingles
// generateNewRelationshipsReport(rf2DescFile, relFile);
// generateOldConceptsNewRelationships(rf2DescFile, relFile, newcomponents);
//
// generateRelGroupChangedRelationships(rf2DescFile, relFile, startDate, endDate);
// generatingDefinedConceptsReport(rf2DescFile, conceptFile);
// generatingPrimitiveConceptsReport(rf2DescFile, conceptFile);
repcomponents=null;
if (sourceUS!=null && sourceUS.exists()){
sourceUS.delete();
}
if(tempFolder.exists()){
FileHelper.emptyFolder(tempFolder);
tempFolder.delete();
}
// saveSummary();
bwsr.close();
bwsr=null;
fileConsolidate();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 43,009 | java | ReleaseFilesDiffInRefsetPlugin.java | Java | [] | null | [] | package org.ihtsdo.changeanalyzer;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.ihtsdo.changeanalyzer.utils.Type5UuidFactory;
import org.ihtsdo.changeanalyzer.data.Rf2DescriptionRow;
import org.ihtsdo.changeanalyzer.data.Rf2LanguageRefsetRow;
import org.ihtsdo.changeanalyzer.file.*;
import org.ihtsdo.changeanalyzer.FileFilterAndSorter;
import org.ihtsdo.changeanalyzer.utils.CommonUtils;
import org.ihtsdo.changeanalyzer.utils.FileHelper;
import java.io.*;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
/**
* @goal report-differences-to-refset
* @phase install
*/
public class ReleaseFilesDiffInRefsetPlugin extends AbstractMojo {
public enum ReleaseFileTypes {
DESCRIPTION, CONCEPT, RELATIONSHIP, ATTRIBUTE_VALUE_REFSET, ASSOCIATION_REFSET, LANGUAGE_REFSET, SIMPLE_REFSET, STATED_RELATIONSHIP, TEXT_DEFINITION, SIMPLE_MAP
}
private static final String REFSET_CONCEPTS_TMP_FOLDER = "refsetConcepts";
private static final String SIMPLE_REFSET_TXT = "simpleRefset.txt";
private static final String REFSET_LANGUAGE_TXT = "refsetLanguage.txt";
private static final String REFSET_STATED_RELS_TXT = "refsetStatedRels.txt";
private static final String REFSET_RELATIONSHIPS_TXT = "refsetRelationships.txt";
private static final String REFSET_DESCRIPTIONS_TXT = "refsetDescriptions.txt";
private static final String REFSET_CONCEPTS_TXT = "refsetConcepts.txt";
private static final String REACTIVATED_CONCEPTS_REPORT = "reactivated_concepts.json";
public static final String NEW_CONCEPTS_FILE = "new_concepts.json";
public static final String NEW_RELATIONSHIPS_FILE = "new_relationships.json";
public static final String RETIRED_CONCEPT_REASON_FILE = "inactivated_concept_reason.json";
public static final String NEW_DESCRIPTIONS_FILE = "new_descriptions.json";
public static final String OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE = "old_concepts_new_descriptions.json";
public static final String OLD_CONCEPTS_NEW_RELATIONSHIPS_FILE = "old_concepts_new_relationships.json";
public static final String NEW_INACTIVE_CONCEPTS_FILE = "new_inactive_concepts.json";
public static final String REL_GROUP_CHANGED_FILE = "rel_group_changed_relationships.json";
private static final Logger logger = Logger.getLogger(ReleaseFilesDiffInRefsetPlugin.class);
private static final String RETIRED_DESCRIPTIONS_FILE = "inactivated_descriptions.json";
private static final String REACTIVATED_DESCRIPTIONS_FILE = "reactivated_descriptions.json";
private static final String CHANGED_FSN="changed_fsn.json";
private static final String SYN_ACCEPTABILITY_CHANGED = "acceptability_changed_on_synonym.json";
private static final String TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION = "active_language_references_to_now_inactive_descriptions.json";
/**
* Location of the directory of report files
*
* @parameter expression="${project.build.directory}"
* @required
*/
private File outputDirectory;
/**
* Location of the directory of the full release folder.
*
* @parameter expression="${project.build.directory}"
* @required
*/
private File inputFullDirectory;
/**
* Location of the directory of the snapshot release folder.
*
* @parameter
* @required
*/
private File inputSnapshotDirectory;
/**
* Start date for the reports.
*
* @parameter
* @required
*/
private String startDate;
/**
* End date for the reports.
*
* @parameter
* @required
*/
private String endDate;
/**
* Release date. in case there is more than one release in the release
* folder.
*
* @parameter
*/
private String releaseDate;
/**
* Target Language File
*
* @parameter
*/
private File targetLanguage;
private boolean langTargetCtrl=false;
private BufferedWriter bwsr;
private void fileConsolidate() throws IOException {
File tmpdir=new File(outputDirectory, REFSET_CONCEPTS_TMP_FOLDER);
tmpdir.mkdirs();
mergeFiles(ReleaseFileTypes.CONCEPT,REFSET_CONCEPTS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.DESCRIPTION,REFSET_DESCRIPTIONS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.RELATIONSHIP,REFSET_RELATIONSHIPS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.STATED_RELATIONSHIP,REFSET_STATED_RELS_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.LANGUAGE_REFSET,REFSET_LANGUAGE_TXT, tmpdir);
mergeFiles(ReleaseFileTypes.SIMPLE_REFSET,SIMPLE_REFSET_TXT, tmpdir);
copyReleaseFileToOutput(ReleaseFileTypes.TEXT_DEFINITION);
copyReleaseFileToOutput(ReleaseFileTypes.SIMPLE_MAP);
copyReleaseFileToOutput(ReleaseFileTypes.ASSOCIATION_REFSET);
copyReleaseFileToOutput(ReleaseFileTypes.ATTRIBUTE_VALUE_REFSET);
FileHelper.emptyFolder(tmpdir);
tmpdir.delete();
}
private void copyReleaseFileToOutput(ReleaseFileTypes fileType) throws IOException {
String rFilePath = getFilePath(fileType, inputSnapshotDirectory);
File releaseFile=new File(rFilePath);
File outputFile= new File(outputDirectory,releaseFile.getName());
FileHelper.copyTo(releaseFile, outputFile);
}
private void mergeFiles(ReleaseFileTypes fileType, String txtfile, File tmpDir) {
HashSet<File> hFile = new HashSet<File>();
String rFilePath = getFilePath(fileType, inputSnapshotDirectory);
File releaseFile=new File(rFilePath);
hFile.add(new File(tmpDir,txtfile));
hFile.add(releaseFile);
CommonUtils.MergeFile(hFile, new File(outputDirectory,releaseFile.getName()));
}
private void createRefsetConcepts() throws IOException {
File tmpdir=new File(outputDirectory, REFSET_CONCEPTS_TMP_FOLDER);
tmpdir.mkdirs();
File file=new File(tmpdir,REFSET_CONCEPTS_TXT);
BufferedWriter bwc=getWriter(file);
bwc.append("id effectiveTime active moduleId definitionStatusId");
bwc.append("\r\n");
bwc.append("1 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("2 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("3 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("4 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("5 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("6 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("7 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("8 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.append("9 " + endDate + " 1 900000000000207008 900000000000074008");
bwc.append("\r\n");
bwc.close();
bwc=null;
File dfile=new File(tmpdir,REFSET_DESCRIPTIONS_TXT);
BufferedWriter bwd=getWriter(dfile);
bwd.append("id effectiveTime active moduleId conceptId languageCode typeId term caseSignificanceId");
bwd.append("\r\n");
bwd.append("1 " + endDate + " 1 900000000000207008 1 en 900000000000013009 New concepts for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("2 " + endDate + " 1 900000000000207008 1 en 900000000000003001 New concepts for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("3 " + endDate + " 1 900000000000207008 2 en 900000000000013009 Inactivated concepts for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("4 " + endDate + " 1 900000000000207008 2 en 900000000000003001 Inactivated concepts for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("5 " + endDate + " 1 900000000000207008 3 en 900000000000013009 Reactivated concepts for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("6 " + endDate + " 1 900000000000207008 3 en 900000000000003001 Reactivated concepts for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("7 " + endDate + " 1 900000000000207008 4 en 900000000000013009 Changed FSN for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("8 " + endDate + " 1 900000000000207008 4 en 900000000000003001 Changed FSN for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("9 " + endDate + " 1 900000000000207008 5 en 900000000000013009 Active language references to now inactive descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("10 " + endDate + " 1 900000000000207008 5 en 900000000000003001 Active language references to now inactive descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("11 " + endDate + " 1 900000000000207008 6 en 900000000000013009 Inactivated descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("12 " + endDate + " 1 900000000000207008 6 en 900000000000003001 Inactivated descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("13 " + endDate + " 1 900000000000207008 7 en 900000000000013009 Old concepts new descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("14 " + endDate + " 1 900000000000207008 7 en 900000000000003001 Old concepts new descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("15 " + endDate + " 1 900000000000207008 8 en 900000000000013009 Reactivated descriptions for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("16 " + endDate + " 1 900000000000207008 8 en 900000000000003001 Reactivated descriptions for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.append("17 " + endDate + " 1 900000000000207008 9 en 900000000000013009 Acceptability changed on synonym for " + endDate + " release simple reference set 900000000000020002");
bwd.append("\r\n");
bwd.append("18 " + endDate + " 1 900000000000207008 9 en 900000000000003001 Acceptability changed on synonym for " + endDate + " release simple reference set (foundation metadata concept) 900000000000020002");
bwd.append("\r\n");
bwd.close();
bwd=null;
File rfile=new File(tmpdir,REFSET_RELATIONSHIPS_TXT);
BufferedWriter bwr=getWriter(rfile);
bwr.append("id effectiveTime active moduleId sourceId destinationId relationshipGroup typeId characteristicTypeId modifierId");
bwr.append("\r\n");
bwr.append("1 " + endDate + " 1 900000000000012004 1 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("2 " + endDate + " 1 900000000000012004 2 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("3 " + endDate + " 1 900000000000012004 3 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("4 " + endDate + " 1 900000000000012004 4 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("5 " + endDate + " 1 900000000000012004 5 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("6 " + endDate + " 1 900000000000012004 6 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("7 " + endDate + " 1 900000000000012004 7 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("8 " + endDate + " 1 900000000000012004 8 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.append("9 " + endDate + " 1 900000000000012004 9 446609009 0 116680003 900000000000011006 900000000000451002");
bwr.append("\r\n");
bwr.close();
bwr=null;
File sfile=new File(tmpdir,REFSET_STATED_RELS_TXT);
BufferedWriter bws=getWriter(sfile);
bws.append("id effectiveTime active moduleId sourceId destinationId relationshipGroup typeId characteristicTypeId modifierId");
bws.append("\r\n");
bws.append("11 " + endDate + " 1 900000000000012004 1 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("12 " + endDate + " 1 900000000000012004 2 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("13 " + endDate + " 1 900000000000012004 3 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("14 " + endDate + " 1 900000000000012004 4 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("15 " + endDate + " 1 900000000000012004 5 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("16 " + endDate + " 1 900000000000012004 6 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("17 " + endDate + " 1 900000000000012004 7 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("18 " + endDate + " 1 900000000000012004 8 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.append("19 " + endDate + " 1 900000000000012004 9 446609009 0 116680003 900000000000010007 900000000000451002");
bws.append("\r\n");
bws.close();
bws=null;
File lfile=new File(tmpdir,REFSET_LANGUAGE_TXT);
BufferedWriter bwl=getWriter(lfile);
bwl.append("id effectiveTime active moduleId refsetId referencedComponentId acceptabilityId");
bwl.append("\r\n");
bwl.append("18685dc7-30e4-573d-891c-dc8f9f3e6861 " + endDate + " 1 900000000000207008 900000000000509007 1 900000000000548007");
bwl.append("\r\n");
bwl.append("d2db27d2-2656-5c69-b1db-0587998439a2 " + endDate + " 1 900000000000207008 900000000000508004 1 900000000000548007");
bwl.append("\r\n");
bwl.append("768d3d74-d155-54c2-b918-87e668d27983 " + endDate + " 1 900000000000207008 900000000000509007 2 900000000000548007");
bwl.append("\r\n");
bwl.append("c46a7d65-f5ed-551d-a378-5bd6c9a77754 " + endDate + " 1 900000000000207008 900000000000508004 2 900000000000548007");
bwl.append("\r\n");
bwl.append("f8a120d7-6690-5a61-aa43-0821e965f4a5 " + endDate + " 1 900000000000207008 900000000000509007 3 900000000000548007");
bwl.append("\r\n");
bwl.append("d26ff35c-0be3-560b-8ba4-631d43f7c826 " + endDate + " 1 900000000000207008 900000000000508004 3 900000000000548007");
bwl.append("\r\n");
bwl.append("7265c5f7-38a7-58e0-826c-e9e555bc0dd7 " + endDate + " 1 900000000000207008 900000000000509007 4 900000000000548007");
bwl.append("\r\n");
bwl.append("31ac1b26-1f0e-5b4e-bd52-9d2a2385a848 " + endDate + " 1 900000000000207008 900000000000508004 4 900000000000548007");
bwl.append("\r\n");
bwl.append("397a28b4-b05a-5589-b55a-ad792d1d28a9 " + endDate + " 1 900000000000207008 900000000000509007 5 900000000000548007");
bwl.append("\r\n");
bwl.append("22b79af2-d628-5cfa-ae89-851787f22490 " + endDate + " 1 900000000000207008 900000000000508004 5 900000000000548007");
bwl.append("\r\n");
bwl.append("480b53c4-ed84-5236-9023-a15c9801fc1a " + endDate + " 1 900000000000207008 900000000000509007 6 900000000000548007");
bwl.append("\r\n");
bwl.append("6d322dbe-e001-56ab-b369-2bf9fe19d2db " + endDate + " 1 900000000000207008 900000000000508004 6 900000000000548007");
bwl.append("\r\n");
bwl.append("79e5d418-da92-572d-9eb3-22c2ccf567ec " + endDate + " 1 900000000000207008 900000000000509007 7 900000000000548007");
bwl.append("\r\n");
bwl.append("44a63353-82b1-57d3-a41d-aad4d069bb8d " + endDate + " 1 900000000000207008 900000000000508004 7 900000000000548007");
bwl.append("\r\n");
bwl.append("bad0ffda-804c-5c90-a20d-1908090257de " + endDate + " 1 900000000000207008 900000000000509007 8 900000000000548007");
bwl.append("\r\n");
bwl.append("5f3da74c-195f-5ead-8a25-ba9c81da710f " + endDate + " 1 900000000000207008 900000000000508004 8 900000000000548007");
bwl.append("\r\n");
bwl.append("6238a3ec-e1bf-5268-94a5-4ba74dd35211 " + endDate + " 1 900000000000207008 900000000000509007 9 900000000000548007");
bwl.append("\r\n");
bwl.append("f612bba4-6c81-53e9-a784-71b1098a6a22 " + endDate + " 1 900000000000207008 900000000000508004 9 900000000000548007");
bwl.append("\r\n");
bwl.append("f6a801b3-1707-520e-8ec5-8ba6a9b4d533 " + endDate + " 1 900000000000207008 900000000000509007 10 900000000000548007");
bwl.append("\r\n");
bwl.append("7c17b526-79dd-50f6-bdf2-c0639d558044 " + endDate + " 1 900000000000207008 900000000000508004 10 900000000000548007");
bwl.append("\r\n");
bwl.append("8c01ac48-02ae-5994-83de-ba52e5bd2255 " + endDate + " 1 900000000000207008 900000000000509007 11 900000000000548007");
bwl.append("\r\n");
bwl.append("78b9018d-e6cd-52ee-a3d1-db5362bec266 " + endDate + " 1 900000000000207008 900000000000508004 11 900000000000548007");
bwl.append("\r\n");
bwl.append("0d7056f1-8871-53ca-8348-9195a407aa77 " + endDate + " 1 900000000000207008 900000000000509007 12 900000000000548007");
bwl.append("\r\n");
bwl.append("89766327-6ff9-5e73-b03f-44761850ea88 " + endDate + " 1 900000000000207008 900000000000508004 12 900000000000548007");
bwl.append("\r\n");
bwl.append("165c957d-5216-5931-bfd4-983efa413e99 " + endDate + " 1 900000000000207008 900000000000509007 13 900000000000548007");
bwl.append("\r\n");
bwl.append("fe3fe207-f366-5110-8a50-da559205bd00 " + endDate + " 1 900000000000207008 900000000000508004 13 900000000000548007");
bwl.append("\r\n");
bwl.append("8c0636fd-72d5-524b-a952-8652d706f333 " + endDate + " 1 900000000000207008 900000000000509007 14 900000000000548007");
bwl.append("\r\n");
bwl.append("69871d91-b537-5de4-b980-876920769444 " + endDate + " 1 900000000000207008 900000000000508004 14 900000000000548007");
bwl.append("\r\n");
bwl.append("62facd0a-08da-5ed4-b69e-30694e8022aa " + endDate + " 1 900000000000207008 900000000000509007 15 900000000000548007");
bwl.append("\r\n");
bwl.append("600caf82-decd-5831-b10f-ff65b62ff2bb " + endDate + " 1 900000000000207008 900000000000508004 15 900000000000548007");
bwl.append("\r\n");
bwl.append("55ddcbe1-f861-5771-93f6-80e2830ec7cc " + endDate + " 1 900000000000207008 900000000000509007 16 900000000000548007");
bwl.append("\r\n");
bwl.append("d8452236-4321-5ed4-8694-eeaa7e5667dd " + endDate + " 1 900000000000207008 900000000000508004 16 900000000000548007");
bwl.append("\r\n");
bwl.append("559a729c-188d-593c-adcd-1765c3252dee " + endDate + " 1 900000000000207008 900000000000509007 17 900000000000548007");
bwl.append("\r\n");
bwl.append("9d88128a-27ae-57fc-bdda-b9dea6e583ff " + endDate + " 1 900000000000207008 900000000000508004 17 900000000000548007");
bwl.append("\r\n");
bwl.append("a20c5ccb-c406-5921-b9e9-39ec899b7111 " + endDate + " 1 900000000000207008 900000000000509007 18 900000000000548007");
bwl.append("\r\n");
bwl.append("afffd990-6011-5766-80ed-b934e0dd5222 " + endDate + " 1 900000000000207008 900000000000508004 18 900000000000548007");
bwl.append("\r\n");
bwl.close();
bwl=null;
File srfile=new File(tmpdir,SIMPLE_REFSET_TXT);
bwsr=getWriter(srfile);
}
private void writeToRefsetFile(String componentId,String refsetId) throws IOException, NoSuchAlgorithmException {
UUID id=Type5UuidFactory.get("900000000000207008" + refsetId + componentId );
bwsr.append(id.toString());
bwsr.append("\t");
bwsr.append(releaseDate);
bwsr.append("\t");
bwsr.append("1");
bwsr.append("\t");
bwsr.append("900000000000207008");
bwsr.append("\t");
bwsr.append(refsetId);
bwsr.append("\t");
bwsr.append(componentId);
bwsr.append("\r\n");
}
private BufferedWriter getWriter(File file) throws FileNotFoundException, UnsupportedEncodingException {
FileOutputStream fos;
OutputStreamWriter osw;
BufferedWriter bw;
fos = new FileOutputStream(file);
logger.info("Generating " + file);
osw = new OutputStreamWriter(fos, "UTF-8");
bw = new BufferedWriter(osw);
return bw;
}
private ArrayList<Long> generateTargetDescriptionPointerToSource(
Rf2DescriptionFile rf2DescFile,
Rf2LanguageRefsetFile targetLangFile,
ArrayList<Long> repcomponents) throws Exception {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION));
logger.info("Generating " + TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> changedDesc = rf2DescFile.getChangedComponentIds(startDate, endDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : changedDesc) {
Rf2LanguageRefsetRow langRow = targetLangFile.getLastActiveRow(startDate, long1.toString());
if (langRow!=null && langRow.getActive()==1){
Rf2DescriptionRow rf2DescRow = rf2DescFile.getLastActiveRow(startDate,long1);
if (!repcomponents.contains(rf2DescRow.getConceptId()) &&
rf2DescRow.getActive()==0) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "5");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(long1.toString(), rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
}
// bw.append("]");
// bw.close();
// addFileChangeReport(TARGET_POINTER_TO_CHANGED_SOURCE_DESCRIPTION,count,"Active language references to now inactive descriptions.");
return repcomponents;
}
private ArrayList<Long> generateDescriptionAcceptabilityChanges(
Rf2LanguageRefsetFile sourceLangFile, Rf2DescriptionFile rf2DescFile,ArrayList<Long> repcomponents) throws Exception {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, SYN_ACCEPTABILITY_CHANGED));
logger.info("Generating " + SYN_ACCEPTABILITY_CHANGED);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<String> changedLang = sourceLangFile.getAcceptabilityIdChanged(startDate, endDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (String string : changedLang) {
Rf2DescriptionRow rf2DescRow = rf2DescFile.getLastActiveRow(startDate, Long.parseLong(string));
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getTypeId()!=900000000000003001L) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "9");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(string, rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
// bw.append("]");
// bw.close();
//
// addFileChangeReport(SYN_ACCEPTABILITY_CHANGED,count,"Acceptability changed in descriptions (no FSN)");
return repcomponents;
}
private String getFilePath(ReleaseFileTypes descriptions,File inputDir) {
String result = "";
switch (descriptions) {
case DESCRIPTION:
result = getFilePathRecursive(inputDir, "description");
break;
case CONCEPT:
result = getFilePathRecursive(inputDir, "concept");
break;
case RELATIONSHIP:
result = getFilePathRecursive(inputDir, "_relationship");
break;
case ASSOCIATION_REFSET:
result = getFilePathRecursive(inputDir, "associationreference");
break;
case ATTRIBUTE_VALUE_REFSET:
result = getFilePathRecursive(inputDir, "attributevalue");
break;
case LANGUAGE_REFSET:
result = getFilePathRecursive(inputDir, "refset_language");
break;
case SIMPLE_REFSET:
result = getFilePathRecursive(inputDir, "_refset_simple");
break;
case STATED_RELATIONSHIP:
result = getFilePathRecursive(inputDir, "_statedrelationship");
break;
case TEXT_DEFINITION:
result = getFilePathRecursive(inputDir, "_textdefinition");
break;
case SIMPLE_MAP:
result = getFilePathRecursive(inputDir, "_srefset_simplemap");
break;
default:
break;
}
return result;
}
public String getFilePathRecursive(File folder, String namePart) {
String result = "";
if (folder.isDirectory()) {
File[] files = folder.listFiles();
int i = 0;
while (i < files.length && result.equals("")) {
result = getFilePathRecursive(files[i], namePart);
i++;
}
} else {
if (folder.getName().toLowerCase().contains(namePart)) {
if (releaseDate != null && !releaseDate.equals("") && folder.getName().contains(releaseDate)) {
result = folder.getPath();
} else if (releaseDate == null || releaseDate.equals("")) {
result = folder.getPath();
}
}
}
return result;
}
private ArrayList<Long> reactivatedConceptsReport(Rf2DescriptionFile rf2DescFile, Rf2ConceptFile conceptFile) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, REACTIVATED_CONCEPTS_REPORT));
logger.info("Generating " + REACTIVATED_CONCEPTS_REPORT);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> reactConcepts = conceptFile.getReactivatedComponents(startDate, endDate);
// generateConceptReport(rf2DescFile, conceptFile, bw, reactConcepts);
for (Long long1 : reactConcepts) {
writeToRefsetFile(long1.toString(), "3");
}
// addFileChangeReport(REACTIVATED_CONCEPTS_REPORT,reactConcepts.size(),"Ractivated concepts");
return reactConcepts;
}
private ArrayList<Long> generatingExistingConceptsNewDescriptions(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE));
logger.info("Generating " + OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> newDescriptions = rf2DescFile.getNewComponentIds(startDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : newDescriptions) {
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, long1);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getTypeId()!=900000000000003001L) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "7");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(long1.toString() , rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
}
// bw.append("]");
// bw.close();
//
// addFileChangeReport(OLD_CONCEPTS_NEW_DESCRIPTIONS_FILE,count,"New descriptions (no FSN) in existing concepts");
return repcomponents;
}
private ArrayList<Long> generatingChangedFSN(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, CHANGED_FSN));
logger.info("Generating " + CHANGED_FSN);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> descriptions = rf2DescFile.getChangedComponentIds(startDate, endDate);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : descriptions) {
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, long1);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getActive()==1
&& rf2DescRow.getTypeId()==900000000000003001L ) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "4");
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// Description desc=new Description(long1.toString() , rf2DescRow.getEffectiveTime() , String.valueOf(rf2DescRow.getActive()) , rf2DescRow.getConceptId().toString() ,
// rf2DescRow.getLanguageCode() , rf2DescFile.getFsn(rf2DescRow.getTypeId()) , rf2DescRow.getTerm() ,
// rf2DescFile.getFsn(rf2DescRow.getCaseSignificanceId()));
// bw.append(gson.toJson(desc).toString());
// desc=null;
// bw.append(sep);
// count++;
}
}
}
// bw.append("]");
// bw.close();
//
// addFileChangeReport(CHANGED_FSN,count,"Changed FSNs");
return repcomponents;
}
private ArrayList<Long> generateRetiredDescriptionsReport(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, RETIRED_DESCRIPTIONS_FILE));
logger.info("Generating " + RETIRED_DESCRIPTIONS_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> retiredDescriptions = rf2DescFile.getRetiredComponents(startDate, endDate);
// ArrayList<Long> filteredRetDesc=new ArrayList<Long>();
for(Long retiredDesc:retiredDescriptions){
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, retiredDesc);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getActive()==0
&& rf2DescRow.getTypeId()!=900000000000003001L ) {
// filteredRetDesc.add(retiredDesc);
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "6");
repcomponents.add(rf2DescRow.getConceptId());
}
}
}
// int count=writeDescriptionsFile(rf2DescFile, bw, filteredRetDesc);
//
// addFileChangeReport(RETIRED_DESCRIPTIONS_FILE,count,"Inactivated descriptions (no FSN)");
return repcomponents;
}
private ArrayList<Long> generateReactivatedDescriptionsReport(Rf2DescriptionFile rf2DescFile, ArrayList<Long> repcomponents) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
// fos = new FileOutputStream(new File(outputDirectory, REACTIVATED_DESCRIPTIONS_FILE));
logger.info("Generating " + REACTIVATED_DESCRIPTIONS_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
ArrayList<Long> reactivedDescriptions = rf2DescFile.getReactivatedComponents(startDate, endDate);
// ArrayList<Long> filteredReactDesc=new ArrayList<Long>();
for(Long retiredDesc:reactivedDescriptions){
ArrayList<Rf2DescriptionRow> rf2DescRows = rf2DescFile.getAllRows(startDate, retiredDesc);
for (Rf2DescriptionRow rf2DescRow : rf2DescRows) {
if (!repcomponents.contains(rf2DescRow.getConceptId())
&& rf2DescRow.getActive()==1 && rf2DescRow.getTypeId()!=900000000000003001L ) {
repcomponents.add(rf2DescRow.getConceptId());
writeToRefsetFile(rf2DescRow.getConceptId().toString(), "8");
// filteredReactDesc.add(retiredDesc);
}
}
}
// int count=writeDescriptionsFile(rf2DescFile, bw, filteredReactDesc);
//
// addFileChangeReport(REACTIVATED_DESCRIPTIONS_FILE,count,"Reactivated descriptions");
return repcomponents;
}
private ArrayList<Long> generatingRetiredConceptReasons(Rf2DescriptionFile rf2DescFile, Rf2ConceptFile conceptFile, Rf2AttributeValueRefsetFile attrValue, Rf2AssociationRefsetFile associationFile)
throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
// FileOutputStream fos;
// OutputStreamWriter osw;
// BufferedWriter bw;
ArrayList<Long> retiredConcepts = conceptFile.getRetiredComponents(startDate, endDate);
// fos = new FileOutputStream(new File(outputDirectory, RETIRED_CONCEPT_REASON_FILE));
logger.info("Generating " + RETIRED_CONCEPT_REASON_FILE);
// osw = new OutputStreamWriter(fos, "UTF-8");
// bw = new BufferedWriter(osw);
// int count=0;
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : retiredConcepts) {
// Rf2AttributeValueRefsetRow refsetRow = attrValue.getRowByReferencedComponentId(long1);
// Rf2AssociationRefsetRow associationRow = associationFile.getLastRowByReferencedComponentId(long1);
//
// String fsn = rf2DescFile.getFsn(long1);
// Pattern p = Pattern.compile("\\((.*?)\\)", Pattern.DOTALL);
// String semanticTag = "";
// if (fsn != null) {
// Matcher matcher = p.matcher(fsn);
// while (matcher.find()) {
// semanticTag = matcher.group(1);
// }
// }
// if (associationRow!=null) {
// String assValue = associationRow.getTargetComponent();
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// if (refsetRow != null) {
// String value = refsetRow.getValueId();
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// rf2DescFile.getFsn(Long.parseLong(value)),rf2DescFile.getFsn(Long.parseLong(associationRow.getRefsetId())),
// rf2DescFile.getFsn(Long.parseLong(assValue)) ,String.valueOf(conceptFile.isNewComponent(long1, startDate)));
// bw.append(gson.toJson(concept).toString());
// concept=null;
// } else {
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// "no reason",rf2DescFile.getFsn(Long.parseLong(associationRow.getRefsetId())),
// rf2DescFile.getFsn(Long.parseLong(assValue)) ,String.valueOf(conceptFile.isNewComponent(long1, startDate)));
// bw.append(gson.toJson(concept).toString());
// concept=null;
// }
// bw.append(sep);
// count++;
// } else {
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// if (refsetRow != null) {
// String value = refsetRow.getValueId();
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// rf2DescFile.getFsn(Long.parseLong(value)),"no association","-" ,"-");
// bw.append(gson.toJson(concept).toString());
// concept=null;
// } else {
// RetiredConcept concept=new RetiredConcept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag,
// "no reason","no association","-" ,"-");
// bw.append(gson.toJson(concept).toString());
// concept=null;
// }
// bw.append(sep);
// }
writeToRefsetFile(long1.toString(), "2");
// count++;
}
// bw.append("]");
// bw.close();
// attrValue.releasePreciousMemory();
// associationFile.releasePreciousMemory();
// addFileChangeReport(RETIRED_CONCEPT_REASON_FILE,count,"Inactivated concepts");
return retiredConcepts;
}
private ArrayList<Long> generateNewConceptsReport(Rf2DescriptionFile rf2DescFile, Rf2ConceptFile conceptFile) throws FileNotFoundException, UnsupportedEncodingException, IOException, NoSuchAlgorithmException {
logger.info("getting new conscpt ids");
ArrayList<Long> newcomponents = conceptFile.getNewComponentIds(startDate);
// FileOutputStream fos = new FileOutputStream(new File(outputDirectory, NEW_CONCEPTS_FILE));
logger.info("Generating " + NEW_CONCEPTS_FILE);
// OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
// BufferedWriter bw = new BufferedWriter(osw);
// boolean bPrim=true;
// bw.append("[");
for (Long long1 : newcomponents) {
// if (!bPrim){
// bw.append(",");
// }else{
// bPrim=false;
// }
// String fsn = rf2DescFile.getFsn(long1);
// Pattern p = Pattern.compile("\\((.*?)\\)", Pattern.DOTALL);
// String semanticTag = "";
// if (fsn != null) {
// Matcher matcher = p.matcher(fsn);
// while (matcher.find()) {
// semanticTag = matcher.group(1);
// }
// }
// Concept concept=new Concept(long1.toString() ,rf2DescFile.getFsn(conceptFile.getDefinitionStatusId(long1)) , fsn , semanticTag);
// bw.append(gson.toJson(concept).toString());
writeToRefsetFile(long1.toString(), "1");
// concept=null;
// bw.append(sep);
}
// bw.append("]");
// bw.close();
// addFileChangeReport(NEW_CONCEPTS_FILE,newcomponents.size(),"New concepts");
return newcomponents;
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
if (!outputDirectory.exists()) {
outputDirectory.mkdirs();
}
createRefsetConcepts();
// changeSummary=new ChangeSummary();
logger.info("Loading descriptinos");
Rf2DescriptionFile rf2DescFile = new Rf2DescriptionFile(getFilePath(ReleaseFileTypes.DESCRIPTION,inputFullDirectory), startDate);
logger.info("Loading concepts");
Rf2ConceptFile conceptFile = new Rf2ConceptFile(getFilePath(ReleaseFileTypes.CONCEPT,inputFullDirectory), startDate);
logger.info("Loading attribute value refset");
Rf2AttributeValueRefsetFile attrValue = new Rf2AttributeValueRefsetFile(getFilePath(ReleaseFileTypes.ATTRIBUTE_VALUE_REFSET,inputFullDirectory));
logger.info("Loading association value refset");
Rf2AssociationRefsetFile associationFile = new Rf2AssociationRefsetFile(getFilePath(ReleaseFileTypes.ASSOCIATION_REFSET,inputFullDirectory));
logger.info("Loading source US language refset");
String langPath=getFilePath(ReleaseFileTypes.LANGUAGE_REFSET,inputFullDirectory);
File inputFile=new File(langPath);
File sourceUS=new File(outputDirectory,"tmpUSLang.txt");
File tempFolder=new File(outputDirectory,"tmpSorting");
if (!tempFolder.exists()) {
tempFolder.mkdirs();
}
FileFilterAndSorter ffs=new FileFilterAndSorter(inputFile, sourceUS, tempFolder, new int[]{4}, new Integer[]{4}, new String[]{"900000000000509007"});
ffs.execute();
ffs=null;
System.gc();
Rf2LanguageRefsetFile sourceUSLangFile = new Rf2LanguageRefsetFile(sourceUS.getAbsolutePath());
// Rf2LanguageRefsetFile sourceGBLangFile=null;
Rf2LanguageRefsetFile targetLangFile=null;
langTargetCtrl=false;
if (targetLanguage!=null){
if (targetLanguage.exists()){
langTargetCtrl=true;
// logger.info("Loading source GB language refset");
// File sourceGB=new File(outputDirectory,"tmpGBLang.txt");
//
// if (!tempFolder.exists()) {
// tempFolder.mkdirs();
// }
// ffs=new FileFilterAndSorter(inputFile, sourceGB, tempFolder, new int[]{4}, new Integer[]{4}, new String[]{"900000000000508004"});
// ffs.execute();
// ffs=null;
// System.gc();
// sourceGBLangFile = new Rf2LanguageRefsetFile(sourceGB.getAbsolutePath());
logger.info("Loading target language refset");
targetLangFile = new Rf2LanguageRefsetFile(targetLanguage.getAbsolutePath());
System.gc();
}else{
logger.info("Target language doesn't exist");
}
}else{
logger.info("Target language is null");
}
// logger.info("Loading relationships");
// Rf2RelationshipFile relFile = new Rf2RelationshipFile(getFilePath(ReleaseFileType.RELATIONSHIP), startDate);
ArrayList<Long> repcomponents = generateNewConceptsReport(rf2DescFile, conceptFile);
ArrayList<Long> concepts=generatingRetiredConceptReasons(rf2DescFile, conceptFile, attrValue, associationFile);
repcomponents.addAll(concepts);
concepts=null;
// relFile.releasePreciousMemory();
concepts=reactivatedConceptsReport(rf2DescFile, conceptFile);
repcomponents.addAll(concepts);
concepts=null;
conceptFile.releasePreciousMemory();
repcomponents=generatingChangedFSN(rf2DescFile, repcomponents);
if (langTargetCtrl){
repcomponents=generateTargetDescriptionPointerToSource(rf2DescFile,targetLangFile,repcomponents);
}
System.gc();
repcomponents=generateRetiredDescriptionsReport(rf2DescFile, repcomponents);
repcomponents=generatingExistingConceptsNewDescriptions(rf2DescFile, repcomponents);
System.gc();
repcomponents=generateReactivatedDescriptionsReport(rf2DescFile, repcomponents);
repcomponents=generateDescriptionAcceptabilityChanges(sourceUSLangFile, rf2DescFile, repcomponents);
//ver punteroalingles
// generateNewRelationshipsReport(rf2DescFile, relFile);
// generateOldConceptsNewRelationships(rf2DescFile, relFile, newcomponents);
//
// generateRelGroupChangedRelationships(rf2DescFile, relFile, startDate, endDate);
// generatingDefinedConceptsReport(rf2DescFile, conceptFile);
// generatingPrimitiveConceptsReport(rf2DescFile, conceptFile);
repcomponents=null;
if (sourceUS!=null && sourceUS.exists()){
sourceUS.delete();
}
if(tempFolder.exists()){
FileHelper.emptyFolder(tempFolder);
tempFolder.delete();
}
// saveSummary();
bwsr.close();
bwsr=null;
fileConsolidate();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| 43,009 | 0.734195 | 0.595806 | 980 | 42.886734 | 45.531605 | 234 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.820408 | false | false | 13 |
aeb6bee8b6931446c0da3855867fa79000326c07 | 21,354,577,460,081 | dca60d80e3d83ead7853a68ff66672fad21f4bba | /JeuMenhir/src/fr/utt/projet/lo02/modele/Comportement_Defensif.java | 09e5c03d78a8409620f2849f72bf7d9a4fa06251 | [] | no_license | Clemouuche/petitgame | https://github.com/Clemouuche/petitgame | a3db84cdb8ee86ea5ed5194bea548c7cb1057d7c | 4f4ee4b1290b23dc96ad2cfa581ec1ee9c621f4d | refs/heads/master | 2016-08-13T02:05:47.681000 | 2015-12-21T15:52:58 | 2015-12-21T15:52:58 | 48,378,646 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.utt.projet.lo02.modele;
public class Comportement_Defensif implements Comportement {
public void jouer(Partie partie, JoueurVirtuel j){
CarteIngredient choixcarte = this.choisirCarteIngredient(j,partie);
System.out.println(j.nomJoueur+" choisit la carte : "+choixcarte.getNom()+choixcarte.toStringIngredient()+" ");
j.mainIngredient.remove(choixcarte);
this.choisirEffet(choixcarte, partie, j);
}
public CarteIngredient choisirCarteIngredient(JoueurVirtuel j, Partie partie){
int t[]=null;
int max=0;
int pos=0;
for (int i=0;i<j.mainIngredient.size();i++){
t=j.mainIngredient.get(i).getValeurGeant();//Récupérer la valeur geant en int[] de la carte
if(t[partie.saison]==Math.max(max, t[partie.saison])){
max=Math.max(max, t[partie.saison]);//on stock la valeur farfadet la plus grande
pos=i; //on garde la position de la carte dans la main
}
}
return j.mainIngredient.get(pos);
}
public void choisirEffet(CarteIngredient carteI, Partie partie, JoueurVirtuel j){
if(j.nbGraines>=2 && carteI.getValeurEngrais()[partie.saison]>0 ){
carteI.EffetEngrais();
}
else{
carteI.EffetGeant();
}
}
public void choisirAllieOuGraine(JoueurVirtuel j){
j.ajouterGraines(2);
}
public Joueur choisirJoueurTaupe(JoueurVirtuel j, Partie partie){
return j;
}
public int jouerCarteChien(JoueurVirtuel j, int forceAttaque){
return forceAttaque;
}
}
| ISO-8859-1 | Java | 1,439 | java | Comportement_Defensif.java | Java | [] | null | [] | package fr.utt.projet.lo02.modele;
public class Comportement_Defensif implements Comportement {
public void jouer(Partie partie, JoueurVirtuel j){
CarteIngredient choixcarte = this.choisirCarteIngredient(j,partie);
System.out.println(j.nomJoueur+" choisit la carte : "+choixcarte.getNom()+choixcarte.toStringIngredient()+" ");
j.mainIngredient.remove(choixcarte);
this.choisirEffet(choixcarte, partie, j);
}
public CarteIngredient choisirCarteIngredient(JoueurVirtuel j, Partie partie){
int t[]=null;
int max=0;
int pos=0;
for (int i=0;i<j.mainIngredient.size();i++){
t=j.mainIngredient.get(i).getValeurGeant();//Récupérer la valeur geant en int[] de la carte
if(t[partie.saison]==Math.max(max, t[partie.saison])){
max=Math.max(max, t[partie.saison]);//on stock la valeur farfadet la plus grande
pos=i; //on garde la position de la carte dans la main
}
}
return j.mainIngredient.get(pos);
}
public void choisirEffet(CarteIngredient carteI, Partie partie, JoueurVirtuel j){
if(j.nbGraines>=2 && carteI.getValeurEngrais()[partie.saison]>0 ){
carteI.EffetEngrais();
}
else{
carteI.EffetGeant();
}
}
public void choisirAllieOuGraine(JoueurVirtuel j){
j.ajouterGraines(2);
}
public Joueur choisirJoueurTaupe(JoueurVirtuel j, Partie partie){
return j;
}
public int jouerCarteChien(JoueurVirtuel j, int forceAttaque){
return forceAttaque;
}
}
| 1,439 | 0.718859 | 0.713292 | 53 | 26.113207 | 30.485172 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.188679 | false | false | 13 |
3e46f6229521cdaeb53d0ecb378e931a3c6f6162 | 29,618,094,524,167 | 48da56cd5a0dd0019951499034c79eed43a54cc7 | /src/com/codewithazam/BrokenLinksSelenium.java | ad7012b442fd781880d57b07dd2dbd0b1397a9d2 | [] | no_license | AzamGameChanger/MiscellaneousTopicsSelenium | https://github.com/AzamGameChanger/MiscellaneousTopicsSelenium | bbe2bb901ea3f6148f4a8baa97bec4f542e4139f | 64e09e6baad0f8816bc1f1a039a4cb81b7355a6a | refs/heads/master | 2023-02-17T20:43:25.290000 | 2021-01-18T22:02:23 | 2021-01-18T22:02:23 | 330,797,163 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.codewithazam;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.asserts.SoftAssert;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
public class BrokenLinksSelenium {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.chrome.driver", "/Users/codewithazam/Downloads/chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("https://www.rahulshettyacademy.com/AutomationPractice/");
//String url = driver.findElement(By.cssSelector("a[href*='appium']")).getAttribute("href");
List<WebElement> links = driver.findElements(By.cssSelector("li[class='gf-li'] a"));
SoftAssert softAssert = new SoftAssert();
for (WebElement link : links) {
String url = link.getAttribute("href");
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("HEAD");
conn.connect();
int respCode = conn.getResponseCode();
System.out.println(respCode);
softAssert.assertTrue(respCode<400,"Link" + link.getText() + " " + respCode + " is broken.");
/* if (respCode > 400) {
System.out.println("Link " + link.getText() + " " + respCode + " is broken.");
Assert.assertTrue(false);
}*/
}
softAssert.assertAll();
}
}
| UTF-8 | Java | 1,744 | java | BrokenLinksSelenium.java | Java | [] | null | [] | package com.codewithazam;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.asserts.SoftAssert;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
public class BrokenLinksSelenium {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.chrome.driver", "/Users/codewithazam/Downloads/chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("https://www.rahulshettyacademy.com/AutomationPractice/");
//String url = driver.findElement(By.cssSelector("a[href*='appium']")).getAttribute("href");
List<WebElement> links = driver.findElements(By.cssSelector("li[class='gf-li'] a"));
SoftAssert softAssert = new SoftAssert();
for (WebElement link : links) {
String url = link.getAttribute("href");
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("HEAD");
conn.connect();
int respCode = conn.getResponseCode();
System.out.println(respCode);
softAssert.assertTrue(respCode<400,"Link" + link.getText() + " " + respCode + " is broken.");
/* if (respCode > 400) {
System.out.println("Link " + link.getText() + " " + respCode + " is broken.");
Assert.assertTrue(false);
}*/
}
softAssert.assertAll();
}
}
| 1,744 | 0.655963 | 0.652523 | 43 | 39.55814 | 28.818035 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.744186 | false | false | 13 |
96d2a4dd11aeaf0c3ab1952193d67f4b7f921c1f | 5,334,349,384,396 | 727aed706056fa51f28af1c6c1cc60b348522c15 | /src/main/java/gsis/com/cms/thema/web/JewThemaInfoController.java | e2c2996d58fb2a816e4fac4bb81167edb49198d5 | [] | no_license | Immountain/gsis.kwdi.re.kr | https://github.com/Immountain/gsis.kwdi.re.kr | ccef05cc67d21e1f0e7a5643ce3ee9ebd694385d | a0ffed5a872afe273d3df22bb0f09b484e360c02 | refs/heads/master | 2023-09-01T05:24:19.284000 | 2021-10-01T09:36:01 | 2021-10-01T09:36:01 | 402,240,080 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gsis.com.cms.thema.web;
import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.annotation.IncludedInfo;
import egovframework.com.cmm.util.EgovUserDetailsHelper;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import gsis.com.cms.thema.service.JewThemaGroupService;
import gsis.com.cms.thema.vo.JewThemaGroupVO;
import infomind.com.cmm.api.ApiResponse;
import infomind.com.cmm.web.BaseAjaxController;
import infomind.com.cms.info.site.vo.InfoSiteStatsVO;
import infomind.com.ext.vo.AxGridDataVO;
import infomind.com.ext.vo.AxGridPageVO;
import infomind.com.utils.web.InfoViewUtils;
import gsis.com.cms.thema.service.JewThemaInfoService;
import gsis.com.cms.thema.vo.JewThemaInfoVO;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
@Controller
public class JewThemaInfoController extends BaseAjaxController {
@Resource(name="JewThemaInfoService")
private JewThemaInfoService jewThemaInfoService;
@Resource(name="JewThemaGroupService")
private JewThemaGroupService jewThemaGroupService;
private final String pagePath = "thema/";
/**테마통계관리 목록*/
@IncludedInfo(name="테마통계관리", listUrl = "/cms/gsis/thema/jewThemaInfoList.do", order = 1111, gid = 60)
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoList.do")
public String jewThemaInfoList(@ModelAttribute("searchVO") JewThemaInfoVO searchVO,ModelMap model)throws Exception{
JewThemaGroupVO jewThemaGroupVO = new JewThemaGroupVO();
model.addAttribute("jewGroupList",jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
System.out.println("MountainTest====================================="+jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
return InfoViewUtils.adminJsView(pagePath,"jewThemaInfoList","ax5ui");
}
/**테마통계관리 grid ajax */
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoListObject.do")
@ResponseBody
public Object jewThemaInfoListObject(@RequestBody JewThemaInfoVO searchVO) throws Exception{
searchVO.setPageIndex(searchVO.getPageIndex() + 1);
PaginationInfo paginationInfo = initPagination(searchVO, jewThemaInfoService.selectThemaInfoTotalCount(searchVO));
AxGridDataVO<JewThemaInfoVO> data = new AxGridDataVO();
data.setList((List<JewThemaInfoVO>) jewThemaInfoService.selectThemaInfoList(searchVO));
data.setPage(AxGridPageVO.builder()
.currentPage(searchVO.getPageIndex() - 1)
.pageSize(searchVO.getPageUnit())
.totalElements(paginationInfo.getTotalRecordCount())
.totalPages(paginationInfo.getTotalPageCount())
.build());
return data;
}
/** 테마통계관리 등록화면 */
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoRegistView.do")
public String jewThemaInfoRegistView(@ModelAttribute("searchVO") JewThemaInfoVO searchVO, ModelMap model) throws Exception{
JewThemaGroupVO jewThemaGroupVO = new JewThemaGroupVO();
model.addAttribute("jewThemaInfoVO", new JewThemaInfoVO());
model.addAttribute("jewGroupList",jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
return InfoViewUtils.adminJsView(pagePath,"jewThemaInfoRegist","axmodal");
}
@RequestMapping(value = "/cms/gsis/thema/jewThemaInfoRegist.do")
@ResponseBody
public ApiResponse jewThemaInfoRegist(JewThemaInfoVO jewThemaInfoVO)throws Exception{
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
jewThemaInfoVO.setRegId((user == null || user.getUniqId() == null) ? "" : user.getUniqId());
System.out.println("mountain"+jewThemaInfoVO);
jewThemaInfoService.insertThemaInfo(jewThemaInfoVO);
return ok();
}
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoUpdtView.do")
public String jewThemaInfoUpdtView(@ModelAttribute("searchVO")JewThemaInfoVO searchVO,ModelMap model)throws Exception{
JewThemaGroupVO jewThemaGroupVO = new JewThemaGroupVO();
model.addAttribute("jewThemaInfoVO",jewThemaInfoService.selectThemaInfo(searchVO));
model.addAttribute("jewGroupList",jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
return InfoViewUtils.adminJsView(pagePath,"jewThemaInfoUpdt","axmodal");
}
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoUpdt.do")
@ResponseBody
public ApiResponse jewThemaInfoUpdt(JewThemaInfoVO jewThemaInfoVO)throws Exception{
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
jewThemaInfoVO.setRegId((user == null || user.getUniqId() == null) ? "" : user.getUniqId());
jewThemaInfoService.updateThemaInfo(jewThemaInfoVO);
return ok();
}
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoDelete.do")
@ResponseBody
public ApiResponse jewThemaInfoDelete(JewThemaInfoVO jewThemaInfoVO)throws Exception {
jewThemaInfoService.deleteThemaInfo(jewThemaInfoVO);
return ok();
}
@RequestMapping(value = "/cms/gsis/thema/getDashBoardThemaInfo.do")
@ResponseBody
public Object getSiteMenuTotYear(JewThemaInfoVO vo) throws Exception {
//파인 차트
return jewThemaInfoService.getDashBoardThemaInfo(vo);
}
}
| UTF-8 | Java | 5,715 | java | JewThemaInfoController.java | Java | [] | null | [] | package gsis.com.cms.thema.web;
import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.annotation.IncludedInfo;
import egovframework.com.cmm.util.EgovUserDetailsHelper;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import gsis.com.cms.thema.service.JewThemaGroupService;
import gsis.com.cms.thema.vo.JewThemaGroupVO;
import infomind.com.cmm.api.ApiResponse;
import infomind.com.cmm.web.BaseAjaxController;
import infomind.com.cms.info.site.vo.InfoSiteStatsVO;
import infomind.com.ext.vo.AxGridDataVO;
import infomind.com.ext.vo.AxGridPageVO;
import infomind.com.utils.web.InfoViewUtils;
import gsis.com.cms.thema.service.JewThemaInfoService;
import gsis.com.cms.thema.vo.JewThemaInfoVO;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
@Controller
public class JewThemaInfoController extends BaseAjaxController {
@Resource(name="JewThemaInfoService")
private JewThemaInfoService jewThemaInfoService;
@Resource(name="JewThemaGroupService")
private JewThemaGroupService jewThemaGroupService;
private final String pagePath = "thema/";
/**테마통계관리 목록*/
@IncludedInfo(name="테마통계관리", listUrl = "/cms/gsis/thema/jewThemaInfoList.do", order = 1111, gid = 60)
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoList.do")
public String jewThemaInfoList(@ModelAttribute("searchVO") JewThemaInfoVO searchVO,ModelMap model)throws Exception{
JewThemaGroupVO jewThemaGroupVO = new JewThemaGroupVO();
model.addAttribute("jewGroupList",jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
System.out.println("MountainTest====================================="+jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
return InfoViewUtils.adminJsView(pagePath,"jewThemaInfoList","ax5ui");
}
/**테마통계관리 grid ajax */
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoListObject.do")
@ResponseBody
public Object jewThemaInfoListObject(@RequestBody JewThemaInfoVO searchVO) throws Exception{
searchVO.setPageIndex(searchVO.getPageIndex() + 1);
PaginationInfo paginationInfo = initPagination(searchVO, jewThemaInfoService.selectThemaInfoTotalCount(searchVO));
AxGridDataVO<JewThemaInfoVO> data = new AxGridDataVO();
data.setList((List<JewThemaInfoVO>) jewThemaInfoService.selectThemaInfoList(searchVO));
data.setPage(AxGridPageVO.builder()
.currentPage(searchVO.getPageIndex() - 1)
.pageSize(searchVO.getPageUnit())
.totalElements(paginationInfo.getTotalRecordCount())
.totalPages(paginationInfo.getTotalPageCount())
.build());
return data;
}
/** 테마통계관리 등록화면 */
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoRegistView.do")
public String jewThemaInfoRegistView(@ModelAttribute("searchVO") JewThemaInfoVO searchVO, ModelMap model) throws Exception{
JewThemaGroupVO jewThemaGroupVO = new JewThemaGroupVO();
model.addAttribute("jewThemaInfoVO", new JewThemaInfoVO());
model.addAttribute("jewGroupList",jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
return InfoViewUtils.adminJsView(pagePath,"jewThemaInfoRegist","axmodal");
}
@RequestMapping(value = "/cms/gsis/thema/jewThemaInfoRegist.do")
@ResponseBody
public ApiResponse jewThemaInfoRegist(JewThemaInfoVO jewThemaInfoVO)throws Exception{
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
jewThemaInfoVO.setRegId((user == null || user.getUniqId() == null) ? "" : user.getUniqId());
System.out.println("mountain"+jewThemaInfoVO);
jewThemaInfoService.insertThemaInfo(jewThemaInfoVO);
return ok();
}
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoUpdtView.do")
public String jewThemaInfoUpdtView(@ModelAttribute("searchVO")JewThemaInfoVO searchVO,ModelMap model)throws Exception{
JewThemaGroupVO jewThemaGroupVO = new JewThemaGroupVO();
model.addAttribute("jewThemaInfoVO",jewThemaInfoService.selectThemaInfo(searchVO));
model.addAttribute("jewGroupList",jewThemaGroupService.selectThemaGroupList(jewThemaGroupVO));
return InfoViewUtils.adminJsView(pagePath,"jewThemaInfoUpdt","axmodal");
}
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoUpdt.do")
@ResponseBody
public ApiResponse jewThemaInfoUpdt(JewThemaInfoVO jewThemaInfoVO)throws Exception{
LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
jewThemaInfoVO.setRegId((user == null || user.getUniqId() == null) ? "" : user.getUniqId());
jewThemaInfoService.updateThemaInfo(jewThemaInfoVO);
return ok();
}
@RequestMapping(value="/cms/gsis/thema/jewThemaInfoDelete.do")
@ResponseBody
public ApiResponse jewThemaInfoDelete(JewThemaInfoVO jewThemaInfoVO)throws Exception {
jewThemaInfoService.deleteThemaInfo(jewThemaInfoVO);
return ok();
}
@RequestMapping(value = "/cms/gsis/thema/getDashBoardThemaInfo.do")
@ResponseBody
public Object getSiteMenuTotYear(JewThemaInfoVO vo) throws Exception {
//파인 차트
return jewThemaInfoService.getDashBoardThemaInfo(vo);
}
}
| 5,715 | 0.752258 | 0.750664 | 126 | 43.817459 | 35.566036 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.626984 | false | false | 13 |
211b03008259beafceda24d3234e8b3ecaa079dc | 5,334,349,382,288 | f3cb4c290d9f2663f36bd497de169056a74ed8bc | /src/encapsulation/Bank.java | 1cfff71f7254b52cc115ddd015a2c9a828c9e48c | [] | no_license | DarrenSolanki/java | https://github.com/DarrenSolanki/java | 7b4e9a2103fafe7b16382449a29f0da10b00b699 | 83f25a621d7af0c2c1befa7c047e2cb16fc0ad5d | refs/heads/master | 2020-07-16T03:44:17.906000 | 2019-09-25T05:55:19 | 2019-09-25T05:55:19 | 205,711,376 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package encapsulation;
class Account{
private int balance = 1000;
int getBalance(){
return balance;
}
void setBalance(int damount) {
if(damount > 0) {
balance += damount;
System.out.println("Deposited amount is : "+damount);
}
else {
System.out.println("Invalid amount");
}
}
}
public class Bank {
public static void main(String[] args) {
Account a = new Account();
System.out.println("Balance is : "+a.getBalance());
a.setBalance(30000);
System.out.println("Balance is : "+ a.getBalance());
}
}
| UTF-8 | Java | 545 | java | Bank.java | Java | [] | null | [] | package encapsulation;
class Account{
private int balance = 1000;
int getBalance(){
return balance;
}
void setBalance(int damount) {
if(damount > 0) {
balance += damount;
System.out.println("Deposited amount is : "+damount);
}
else {
System.out.println("Invalid amount");
}
}
}
public class Bank {
public static void main(String[] args) {
Account a = new Account();
System.out.println("Balance is : "+a.getBalance());
a.setBalance(30000);
System.out.println("Balance is : "+ a.getBalance());
}
}
| 545 | 0.644037 | 0.625688 | 32 | 16.03125 | 17.263554 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.59375 | false | false | 13 |
45c80be7934ec8ac6b2152399056bbbd1fa03715 | 16,372,415,371,197 | 36da4e09c8ca1ea3396cfe2de832d1639f0c403e | /framework/gwt/src/cc/alcina/framework/gwt/client/logic/handshake/localstorage/StandardWithPersistenceSetupAfterObjectsPlayer.java | c527bfc598965b877d561c2ae8c133f7a5c42076 | [] | no_license | nevella/alcina | https://github.com/nevella/alcina | b1ed4cb006c96af566dcdd5d0bc5130f02df0a64 | fdde4bf59b1e1cfb4ac426efe192ccd0917b90fb | refs/heads/main | 2023-08-04T13:31:42.598000 | 2023-08-02T12:13:08 | 2023-08-02T12:18:31 | 32,334,578 | 2 | 3 | null | false | 2022-05-18T15:51:57 | 2015-03-16T15:31:02 | 2021-12-24T04:05:55 | 2022-05-18T15:51:56 | 47,756 | 1 | 2 | 11 | Java | false | false | package cc.alcina.framework.gwt.client.logic.handshake.localstorage;
import java.util.Arrays;
import com.google.gwt.user.client.rpc.AsyncCallback;
import cc.alcina.framework.common.client.consort.Consort;
import cc.alcina.framework.common.client.logic.permissions.PermissionsManager;
import cc.alcina.framework.common.client.logic.reflection.registry.Registry;
import cc.alcina.framework.common.client.util.AlcinaTopics;
import cc.alcina.framework.common.client.util.StringPair;
import cc.alcina.framework.common.client.util.TopicListener;
import cc.alcina.framework.gwt.client.entity.GeneralProperties;
import cc.alcina.framework.gwt.client.logic.DevCSSHelper;
import cc.alcina.framework.gwt.client.logic.handshake.SetupAfterObjectsPlayer;
import cc.alcina.framework.gwt.client.util.AsyncCallbackStd;
import cc.alcina.framework.gwt.persistence.client.DatabaseStatsObserver;
public abstract class StandardWithPersistenceSetupAfterObjectsPlayer
extends SetupAfterObjectsPlayer {
private SaveToLocalStorageConsort saveConsort;
DatabaseStatsObserver statsObserver = Registry
.impl(DatabaseStatsObserver.class);
protected AsyncCallback reportListener = new AsyncCallbackStd() {
@Override
public void onSuccess(Object result) {
AlcinaTopics.categorisedLogMessage
.publish(new StringPair(AlcinaTopics.LOG_CATEGORY_MESSAGE,
"After object serialization:\n"
+ statsObserver.getReport()));
statsObserver.installPersistenceListeners();
}
};
private TopicListener finishedListener = new TopicListener() {
@Override
public void topicPublished(Object message) {
statsObserver.recalcWithListener(reportListener);
saveConsort.deferredRemove(
Arrays.asList(Consort.TopicChannel.FINISHED),
finishedListener);
}
};
public StandardWithPersistenceSetupAfterObjectsPlayer() {
super();
}
@Override
public void run() {
DevCSSHelper.get().addCssListeners(GeneralProperties.get());
saveToLocalPersistenceAndStat();
}
protected void saveToLocalPersistenceAndStat() {
if (PermissionsManager.isOnline()) {
saveConsort = new SaveToLocalStorageConsort();
saveConsort.start();
saveConsort.listenerDelta(Consort.TopicChannel.FINISHED,
finishedListener, true);
}
}
} | UTF-8 | Java | 2,239 | java | StandardWithPersistenceSetupAfterObjectsPlayer.java | Java | [] | null | [] | package cc.alcina.framework.gwt.client.logic.handshake.localstorage;
import java.util.Arrays;
import com.google.gwt.user.client.rpc.AsyncCallback;
import cc.alcina.framework.common.client.consort.Consort;
import cc.alcina.framework.common.client.logic.permissions.PermissionsManager;
import cc.alcina.framework.common.client.logic.reflection.registry.Registry;
import cc.alcina.framework.common.client.util.AlcinaTopics;
import cc.alcina.framework.common.client.util.StringPair;
import cc.alcina.framework.common.client.util.TopicListener;
import cc.alcina.framework.gwt.client.entity.GeneralProperties;
import cc.alcina.framework.gwt.client.logic.DevCSSHelper;
import cc.alcina.framework.gwt.client.logic.handshake.SetupAfterObjectsPlayer;
import cc.alcina.framework.gwt.client.util.AsyncCallbackStd;
import cc.alcina.framework.gwt.persistence.client.DatabaseStatsObserver;
public abstract class StandardWithPersistenceSetupAfterObjectsPlayer
extends SetupAfterObjectsPlayer {
private SaveToLocalStorageConsort saveConsort;
DatabaseStatsObserver statsObserver = Registry
.impl(DatabaseStatsObserver.class);
protected AsyncCallback reportListener = new AsyncCallbackStd() {
@Override
public void onSuccess(Object result) {
AlcinaTopics.categorisedLogMessage
.publish(new StringPair(AlcinaTopics.LOG_CATEGORY_MESSAGE,
"After object serialization:\n"
+ statsObserver.getReport()));
statsObserver.installPersistenceListeners();
}
};
private TopicListener finishedListener = new TopicListener() {
@Override
public void topicPublished(Object message) {
statsObserver.recalcWithListener(reportListener);
saveConsort.deferredRemove(
Arrays.asList(Consort.TopicChannel.FINISHED),
finishedListener);
}
};
public StandardWithPersistenceSetupAfterObjectsPlayer() {
super();
}
@Override
public void run() {
DevCSSHelper.get().addCssListeners(GeneralProperties.get());
saveToLocalPersistenceAndStat();
}
protected void saveToLocalPersistenceAndStat() {
if (PermissionsManager.isOnline()) {
saveConsort = new SaveToLocalStorageConsort();
saveConsort.start();
saveConsort.listenerDelta(Consort.TopicChannel.FINISHED,
finishedListener, true);
}
}
} | 2,239 | 0.80259 | 0.80259 | 65 | 33.46154 | 25.990576 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.984615 | false | false | 13 |
033273dce3ab2a54742930acfc81b50e595dc61d | 22,179,211,145,511 | c8428e12cee100e301b17c300cdc308ad3e4a752 | /smsn-server/src/main/java/net/fortytwo/smsn/server/ActionContext.java | 95f02ca901bdf8332f89a356922aeefc88585b45 | [
"MIT"
] | permissive | synchrony/smsn | https://github.com/synchrony/smsn | 5efd33ef2d62bc5760a5c8cad2274e17e299449d | c45ca3b18ff2d55717c56d95d731918d03a13a24 | refs/heads/develop | 2023-08-16T20:06:26.333000 | 2023-07-18T16:54:40 | 2023-07-18T16:54:40 | 219,850 | 166 | 18 | NOASSERTION | false | 2023-08-06T05:00:19 | 2009-06-05T22:33:10 | 2023-04-12T07:25:45 | 2023-08-06T05:00:16 | 4,536 | 173 | 15 | 27 | Java | false | false | package net.fortytwo.smsn.server;
import net.fortytwo.smsn.brain.Brain;
import net.fortytwo.smsn.brain.io.json.JsonParser;
import net.fortytwo.smsn.brain.io.json.JsonPrinter;
import net.fortytwo.smsn.brain.io.wiki.WikiParser;
import net.fortytwo.smsn.brain.model.pg.GraphWrapper;
import net.fortytwo.smsn.brain.query.TreeViews;
import java.util.Map;
public class ActionContext {
private Map<String, Object> map;
private GraphWrapper graphWrapper;
private Brain brain;
private TreeViews queries;
private WikiParser wikiParser;
private JsonParser jsonParser;
private JsonPrinter jsonPrinter;
public GraphWrapper getGraphWrapper() {
return graphWrapper;
}
public void setGraphWrapper(GraphWrapper graphWrapper) {
this.graphWrapper = graphWrapper;
}
public Brain getBrain() {
return brain;
}
public void setBrain(Brain brain) {
this.brain = brain;
}
public Map<String, Object> getMap() {
return map;
}
public void setMap(Map<String, Object> map) {
this.map = map;
}
public TreeViews getQueries() {
return queries;
}
public void setQueries(TreeViews queries) {
this.queries = queries;
}
public JsonPrinter getJsonPrinter() {
return jsonPrinter;
}
public void setJsonPrinter(JsonPrinter jsonPrinter) {
this.jsonPrinter = jsonPrinter;
}
public JsonParser getJsonParser() {
return jsonParser;
}
public void setJsonParser(JsonParser jsonParser) {
this.jsonParser = jsonParser;
}
public WikiParser getWikiParser() {
return wikiParser;
}
public void setWikiParser(WikiParser wikiParser) {
this.wikiParser = wikiParser;
}
}
| UTF-8 | Java | 1,782 | java | ActionContext.java | Java | [] | null | [] | package net.fortytwo.smsn.server;
import net.fortytwo.smsn.brain.Brain;
import net.fortytwo.smsn.brain.io.json.JsonParser;
import net.fortytwo.smsn.brain.io.json.JsonPrinter;
import net.fortytwo.smsn.brain.io.wiki.WikiParser;
import net.fortytwo.smsn.brain.model.pg.GraphWrapper;
import net.fortytwo.smsn.brain.query.TreeViews;
import java.util.Map;
public class ActionContext {
private Map<String, Object> map;
private GraphWrapper graphWrapper;
private Brain brain;
private TreeViews queries;
private WikiParser wikiParser;
private JsonParser jsonParser;
private JsonPrinter jsonPrinter;
public GraphWrapper getGraphWrapper() {
return graphWrapper;
}
public void setGraphWrapper(GraphWrapper graphWrapper) {
this.graphWrapper = graphWrapper;
}
public Brain getBrain() {
return brain;
}
public void setBrain(Brain brain) {
this.brain = brain;
}
public Map<String, Object> getMap() {
return map;
}
public void setMap(Map<String, Object> map) {
this.map = map;
}
public TreeViews getQueries() {
return queries;
}
public void setQueries(TreeViews queries) {
this.queries = queries;
}
public JsonPrinter getJsonPrinter() {
return jsonPrinter;
}
public void setJsonPrinter(JsonPrinter jsonPrinter) {
this.jsonPrinter = jsonPrinter;
}
public JsonParser getJsonParser() {
return jsonParser;
}
public void setJsonParser(JsonParser jsonParser) {
this.jsonParser = jsonParser;
}
public WikiParser getWikiParser() {
return wikiParser;
}
public void setWikiParser(WikiParser wikiParser) {
this.wikiParser = wikiParser;
}
}
| 1,782 | 0.677329 | 0.677329 | 77 | 22.142857 | 19.140434 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.415584 | false | false | 13 |
674acf7dfe8b9357f8dd4e87db0267feceb69434 | 1,563,368,127,920 | a0f48d9840e13328b2518af29fe5dd1819ffe246 | /src/main/java/com/ewcms/publication/freemarker/error/EwcmsFreemarkerExceptionHandler.java | 4307a7a86b47dec106624bc1da503e11dd0acea1 | [] | no_license | eseawind/ewcms | https://github.com/eseawind/ewcms | ae496d41963e5db27532e126fda25ae208ecc17f | 25851497ebd6629ea9073c6d85932d4e9bd77a0c | refs/heads/master | 2021-01-16T00:36:57.945000 | 2012-12-04T06:48:49 | 2012-12-04T06:48:49 | 7,254,472 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright (c)2010-2011 Enterprise Website Content Management System(EWCMS), All rights reserved.
* EWCMS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
* http://www.ewcms.com
*/
package com.ewcms.publication.freemarker.error;
import java.io.IOException;
import java.io.Writer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import freemarker.core.Environment;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;
/**
* 处理freemarker模板错误
*
* @author wuzhijun
*/
public class EwcmsFreemarkerExceptionHandler implements TemplateExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(EwcmsFreemarkerExceptionHandler.class);
@Override
public void handleTemplateException(TemplateException te, Environment env, Writer out) throws TemplateException {
try {
out.write("Error: [" + te.getMessage() + "]");
logger.warn("Freemarker Error: [" + te.getMessage() + "]");
} catch (IOException e) {
logger.warn(e.getMessage());
throw new TemplateException("Failed to print error message. Cause: " + e, env);
}
}
}
| UTF-8 | Java | 1,183 | java | EwcmsFreemarkerExceptionHandler.java | Java | [
{
"context": "dler;\r\n\r\n/**\r\n * 处理freemarker模板错误\r\n * \r\n * @author wuzhijun\r\n */\r\npublic class EwcmsFreemarkerExceptionHandle",
"end": 562,
"score": 0.9991016387939453,
"start": 554,
"tag": "USERNAME",
"value": "wuzhijun"
}
] | null | [] | /**
* Copyright (c)2010-2011 Enterprise Website Content Management System(EWCMS), All rights reserved.
* EWCMS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
* http://www.ewcms.com
*/
package com.ewcms.publication.freemarker.error;
import java.io.IOException;
import java.io.Writer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import freemarker.core.Environment;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;
/**
* 处理freemarker模板错误
*
* @author wuzhijun
*/
public class EwcmsFreemarkerExceptionHandler implements TemplateExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(EwcmsFreemarkerExceptionHandler.class);
@Override
public void handleTemplateException(TemplateException te, Environment env, Writer out) throws TemplateException {
try {
out.write("Error: [" + te.getMessage() + "]");
logger.warn("Freemarker Error: [" + te.getMessage() + "]");
} catch (IOException e) {
logger.warn(e.getMessage());
throw new TemplateException("Failed to print error message. Cause: " + e, env);
}
}
}
| 1,183 | 0.734415 | 0.725875 | 37 | 29.648649 | 32.348789 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.081081 | false | false | 13 |
79dbe9853d5ef1b1531a3cad0fbab9ca51a77dc3 | 7,181,185,387,222 | fb60413b02cdf8a5c38d24b033d2900832ba9f19 | /core/src/com/pwrd/war/common/model/item/XinghunItem.java | 272aac84cd4688bc23036f7a39c5245f6584c5de | [] | no_license | tommyadan/webgame | https://github.com/tommyadan/webgame | 4729fc44617b9f104e0084d41763d98b3068f394 | 2117929e143e7498e524305ed529c4ee09163474 | refs/heads/master | 2021-05-27T04:59:34.506000 | 2012-08-20T14:30:07 | 2012-08-20T14:30:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pwrd.war.common.model.item;
import net.sf.json.JSONObject;
/**
* 物品信息
*
*/
public class XinghunItem {
protected String uuid;
protected String itemSn;//itemSn
protected int bagId;//所在背包
protected int index;//背包格子序号
protected int bind;//是否绑定
protected int num;//数量
protected String wearerUuid;//穿戴者uuid
protected int createTime;
/** 唯一类型 **/
private int identity;
/** feature字符串 **/
protected String feature;
/** 战斗属性 **/
protected String battleProps;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getItemSn() {
return itemSn;
}
public void setItemSn(String itemSn) {
this.itemSn = itemSn;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public void setBind(int bind) {
this.bind = bind;
}
public int getBind() {
return bind;
}
@Override
public String toString() {
return JSONObject.fromObject(this).toString();
}
public String getWearerUuid() {
return wearerUuid;
}
public void setWearerUuid(String wearerUuid) {
this.wearerUuid = wearerUuid;
}
public int getCreateTime() {
return createTime;
}
public void setCreateTime(int createTime) {
this.createTime = createTime;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getBagId() {
return bagId;
}
public void setBagId(int bagId) {
this.bagId = bagId;
}
public int getIdentity() {
return identity;
}
public void setIdentity(int identity) {
this.identity = identity;
}
public String getFeature() {
return feature;
}
public void setFeature(String feature) {
this.feature = feature;
}
public String getBattleProps() {
return battleProps;
}
public void setBattleProps(String battleProps) {
this.battleProps = battleProps;
}
// protected AttrDescBase[] baseAttrs;
// protected AttrDescAddon[] addonAttrs;
// protected AttrDescSpec[] specAttrs;
}
| UTF-8 | Java | 2,251 | java | XinghunItem.java | Java | [] | null | [] | package com.pwrd.war.common.model.item;
import net.sf.json.JSONObject;
/**
* 物品信息
*
*/
public class XinghunItem {
protected String uuid;
protected String itemSn;//itemSn
protected int bagId;//所在背包
protected int index;//背包格子序号
protected int bind;//是否绑定
protected int num;//数量
protected String wearerUuid;//穿戴者uuid
protected int createTime;
/** 唯一类型 **/
private int identity;
/** feature字符串 **/
protected String feature;
/** 战斗属性 **/
protected String battleProps;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getItemSn() {
return itemSn;
}
public void setItemSn(String itemSn) {
this.itemSn = itemSn;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public void setBind(int bind) {
this.bind = bind;
}
public int getBind() {
return bind;
}
@Override
public String toString() {
return JSONObject.fromObject(this).toString();
}
public String getWearerUuid() {
return wearerUuid;
}
public void setWearerUuid(String wearerUuid) {
this.wearerUuid = wearerUuid;
}
public int getCreateTime() {
return createTime;
}
public void setCreateTime(int createTime) {
this.createTime = createTime;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getBagId() {
return bagId;
}
public void setBagId(int bagId) {
this.bagId = bagId;
}
public int getIdentity() {
return identity;
}
public void setIdentity(int identity) {
this.identity = identity;
}
public String getFeature() {
return feature;
}
public void setFeature(String feature) {
this.feature = feature;
}
public String getBattleProps() {
return battleProps;
}
public void setBattleProps(String battleProps) {
this.battleProps = battleProps;
}
// protected AttrDescBase[] baseAttrs;
// protected AttrDescAddon[] addonAttrs;
// protected AttrDescSpec[] specAttrs;
}
| 2,251 | 0.637655 | 0.637655 | 141 | 13.482269 | 14.474043 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.148936 | false | false | 13 |
d2fbde251330f452f840b5c47d9168d92f3144d5 | 27,891,517,633,834 | f83d2bea300708419388d2476abf26e0e03a1bc0 | /src/main/java/com/dj/movie/service/MovieLikeService.java | b69b998073ee26d6f9df2e436c248c3d1cf56f14 | [] | no_license | tanbinh123/naughty_movie | https://github.com/tanbinh123/naughty_movie | 26acb0d2b9e28901930ea12a812ae10c1380a224 | 4e51f3deeafda767ef0a826c64b5cf2d92d7ff78 | refs/heads/master | 2022-11-21T14:46:59.699000 | 2020-07-27T03:11:22 | 2020-07-27T03:11:22 | 457,861,490 | 1 | 0 | null | true | 2022-02-10T16:36:29 | 2022-02-10T16:36:28 | 2020-07-27T03:12:17 | 2020-07-27T03:12:15 | 2,723 | 0 | 0 | 0 | null | false | false | package com.dj.movie.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dj.movie.pojo.MovieLike;
import org.springframework.dao.DataAccessException;
import java.math.BigDecimal;
public interface MovieLikeService extends IService<MovieLike> {
MovieLike findMovieLikeByUserIdAndMovieId(Integer userId, String MovieId) throws Exception;
void updateMovieLikeScore(Integer userId, String MovieId, Integer score) throws Exception;
void addMovieLike(Integer userId, String MovieId, Integer score) throws Exception;
void updateMovieLikeIsLike(Integer userId, String MovieId, Integer isLike) throws Exception;
void addMovieLikeByUserIdAndMovieId(Integer userId, String MovieId, Integer isLike) throws Exception;
BigDecimal markGrade(Integer id) throws Exception;
Integer isLike(Integer id) throws DataAccessException;
}
| UTF-8 | Java | 881 | java | MovieLikeService.java | Java | [] | null | [] | package com.dj.movie.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dj.movie.pojo.MovieLike;
import org.springframework.dao.DataAccessException;
import java.math.BigDecimal;
public interface MovieLikeService extends IService<MovieLike> {
MovieLike findMovieLikeByUserIdAndMovieId(Integer userId, String MovieId) throws Exception;
void updateMovieLikeScore(Integer userId, String MovieId, Integer score) throws Exception;
void addMovieLike(Integer userId, String MovieId, Integer score) throws Exception;
void updateMovieLikeIsLike(Integer userId, String MovieId, Integer isLike) throws Exception;
void addMovieLikeByUserIdAndMovieId(Integer userId, String MovieId, Integer isLike) throws Exception;
BigDecimal markGrade(Integer id) throws Exception;
Integer isLike(Integer id) throws DataAccessException;
}
| 881 | 0.810443 | 0.810443 | 27 | 31.629629 | 37.351334 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777778 | false | false | 13 |
d4f4e121b710fbbdb65765f9308404c48a59aff1 | 33,509,334,875,139 | 98f20ec801c8acddc757fa4339d21e83dcbb2a02 | /adpharma/adpharma.client/src/main/java/org/adorsys/adpharma/client/jpa/section/SectionLoadService.java | b4f64e3535556f9a9890ab110dcfa1702dc24a6a | [
"Apache-2.0"
] | permissive | francis-pouatcha/forgelab | https://github.com/francis-pouatcha/forgelab | f7e6bcc47621d4cab0f306c606e9a7dffbbe68e1 | fdcbbded852a985f3bd437b639a2284d92703e33 | refs/heads/master | 2021-03-24T10:37:26.819000 | 2014-10-08T13:22:29 | 2014-10-08T13:22:29 | 15,254,083 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.adorsys.adpharma.client.jpa.section;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javax.inject.Inject;
public class SectionLoadService extends Service<Section>
{
@Inject
private SectionService remoteService;
private Long id;
public SectionLoadService setId(Long id)
{
this.id = id;
return this;
}
@Override
protected Task<Section> createTask()
{
return new Task<Section>()
{
@Override
protected Section call() throws Exception
{
if (id == null)
return null;
return remoteService.findById(id);
}
};
}
}
| UTF-8 | Java | 683 | java | SectionLoadService.java | Java | [] | null | [] | package org.adorsys.adpharma.client.jpa.section;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javax.inject.Inject;
public class SectionLoadService extends Service<Section>
{
@Inject
private SectionService remoteService;
private Long id;
public SectionLoadService setId(Long id)
{
this.id = id;
return this;
}
@Override
protected Task<Section> createTask()
{
return new Task<Section>()
{
@Override
protected Section call() throws Exception
{
if (id == null)
return null;
return remoteService.findById(id);
}
};
}
}
| 683 | 0.619326 | 0.619326 | 36 | 17.972221 | 17.152075 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.305556 | false | false | 13 |
c848b093d81141e17f6cf1be158bb461e1dc171d | 33,509,334,874,911 | 0a316f48e161637f288f04ffd84321b5cfa92597 | /sample/bqmm-youyun-demo-android/app/src/main/java/com/youyun/bqmm/chat/mvp/ChatView.java | 559865a5bdab29134f88d353277fb6c45a5de46f | [] | no_license | youyundeveloper/bqmm-youyun-demo-android | https://github.com/youyundeveloper/bqmm-youyun-demo-android | d635839ddfe4b1a7874e21857f7b642a872348f9 | f398fab8d35cbcb7273e9ff9475db2aae1168f6b | refs/heads/master | 2021-01-24T15:44:08.246000 | 2016-10-21T09:48:56 | 2016-10-21T09:48:56 | 68,704,416 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.youyun.bqmm.chat.mvp;
import com.youyun.bqmm.chat.model.MessageEntity;
/**
* Created by 卫彪 on 2016/9/8.
*/
public interface ChatView {
/**
* 发送文本回调
*
* @param result
* @param text
* @param time
*/
void sendText(boolean result, String text, long time);
void sendEmoji(boolean result, String emojiJson, long time);
/**
* 收到消息
*
* @param message
*/
void receiveText(MessageEntity message);
}
| UTF-8 | Java | 502 | java | ChatView.java | Java | [
{
"context": "bqmm.chat.model.MessageEntity;\n\n/**\n * Created by 卫彪 on 2016/9/8.\n */\npublic interface ChatView {\n\n ",
"end": 105,
"score": 0.982119083404541,
"start": 103,
"tag": "NAME",
"value": "卫彪"
}
] | null | [] | package com.youyun.bqmm.chat.mvp;
import com.youyun.bqmm.chat.model.MessageEntity;
/**
* Created by 卫彪 on 2016/9/8.
*/
public interface ChatView {
/**
* 发送文本回调
*
* @param result
* @param text
* @param time
*/
void sendText(boolean result, String text, long time);
void sendEmoji(boolean result, String emojiJson, long time);
/**
* 收到消息
*
* @param message
*/
void receiveText(MessageEntity message);
}
| 502 | 0.60251 | 0.589958 | 27 | 16.703703 | 18.147165 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
3cd7704bdab08dce8150291480c62cd0b6bc3173 | 2,121,713,867,124 | 34ad419cedcd9ae979e02f247f6326e3c0e7b2e6 | /spring-boot-cache/src/main/java/com/demo/http/service/UserService.java | 6dfeea14c38fa8e703ae2e4cdd8fe5c49ef2a24d | [
"Apache-2.0"
] | permissive | CwmCwm/spring-boot-demo | https://github.com/CwmCwm/spring-boot-demo | e2ec34ef3fc7939ce0e8fbeb8015751d341dbabf | 4b1824b678d53c1a9f2f4439cc3aa887f67dfcd8 | refs/heads/master | 2022-07-23T16:49:01.027000 | 2021-07-14T05:59:33 | 2021-07-14T05:59:33 | 230,585,532 | 1 | 0 | Apache-2.0 | false | 2022-07-11T21:06:29 | 2019-12-28T09:04:05 | 2021-07-14T06:00:01 | 2022-07-11T21:06:29 | 12,361 | 0 | 0 | 2 | JavaScript | false | false | package com.demo.http.service;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
就相当于 user表的Service
假定user表结构
create table `user` (
`userId` bigint unsigned NOT NULL COMMENT '主键',
`userName` char(32) NOT NULL COMMENT '用户名',
PRIMARY KEY (`crm1Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COMMENT='user用户表';
* */
@Service
public class UserService {
/**
流程是:
第一次根据 userId=1 去redis中查找,redis中没记录,去mysql找到记录后,缓存入redis,并返回
第二次根据 userId=1 去redis中查找,redis中有记录,直接返回
cacheNames + key 拼接的字符串就是redis中的key值,可以对比selectOneFromRedis1 和 selectOneFromRedis2 调用后,查看redis中的数据得知
* */
@Cacheable(cacheNames = "redis1", cacheManager = "redisCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromRedis1 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入redisCacheManager缓存");
return user;
}
@Cacheable(cacheNames = "redis2", cacheManager = "redisCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromRedis2 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入redisCacheManager缓存");
return user;
}
/**
selectOneFromConcurrentMap1创建一个 ConcurrentMapCache, selectOneFromConcurrentMap2会创建一个新的 ConcurrentMapCache
切面类 CacheAspectSupport 会通过注解上的数据 cacheNames = "concurrentMap1" 和 key 去对应的 ConcurrentMapCache实例中操作数据(增查)
你可在 CacheAspectSupport类->820行 doPut(cache, this.key, result); 上debug看到 cache变量是哪个具体的 Cache(RedisCache,ConcurrentMapCache 等等)
* */
@Cacheable(cacheNames = "concurrentMap1", cacheManager = "concurrentMapCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromConcurrentMap1 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入concurrentMapCacheManager缓存");
return user;
}
@Cacheable(cacheNames = "concurrentMap2", cacheManager = "concurrentMapCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromConcurrentMap2 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入concurrentMapCacheManager缓存");
return user;
}
/**
* */
@Cacheable(cacheNames = "ehcache1", cacheManager = "ehCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromEhCacheManager1 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入ehCacheManager缓存");
return user;
}
@Cacheable(cacheNames = "ehcache2", cacheManager = "ehCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromEhCacheManager2 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入ehCacheManager缓存");
return user;
}
}
| UTF-8 | Java | 5,053 | java | UserService.java | Java | [
{
"context": "har(32) NOT NULL COMMENT '用户名',\n PRIMARY KEY (`crm1Id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4\n COMME",
"end": 363,
"score": 0.5413813591003418,
"start": 360,
"tag": "KEY",
"value": "1Id"
},
{
"context": "(\"userId\", userId);\n user.put(\"userName\", \"user... | null | [] | package com.demo.http.service;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
就相当于 user表的Service
假定user表结构
create table `user` (
`userId` bigint unsigned NOT NULL COMMENT '主键',
`userName` char(32) NOT NULL COMMENT '用户名',
PRIMARY KEY (`crm1Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COMMENT='user用户表';
* */
@Service
public class UserService {
/**
流程是:
第一次根据 userId=1 去redis中查找,redis中没记录,去mysql找到记录后,缓存入redis,并返回
第二次根据 userId=1 去redis中查找,redis中有记录,直接返回
cacheNames + key 拼接的字符串就是redis中的key值,可以对比selectOneFromRedis1 和 selectOneFromRedis2 调用后,查看redis中的数据得知
* */
@Cacheable(cacheNames = "redis1", cacheManager = "redisCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromRedis1 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入redisCacheManager缓存");
return user;
}
@Cacheable(cacheNames = "redis2", cacheManager = "redisCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromRedis2 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入redisCacheManager缓存");
return user;
}
/**
selectOneFromConcurrentMap1创建一个 ConcurrentMapCache, selectOneFromConcurrentMap2会创建一个新的 ConcurrentMapCache
切面类 CacheAspectSupport 会通过注解上的数据 cacheNames = "concurrentMap1" 和 key 去对应的 ConcurrentMapCache实例中操作数据(增查)
你可在 CacheAspectSupport类->820行 doPut(cache, this.key, result); 上debug看到 cache变量是哪个具体的 Cache(RedisCache,ConcurrentMapCache 等等)
* */
@Cacheable(cacheNames = "concurrentMap1", cacheManager = "concurrentMapCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromConcurrentMap1 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入concurrentMapCacheManager缓存");
return user;
}
@Cacheable(cacheNames = "concurrentMap2", cacheManager = "concurrentMapCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromConcurrentMap2 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入concurrentMapCacheManager缓存");
return user;
}
/**
* */
@Cacheable(cacheNames = "ehcache1", cacheManager = "ehCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromEhCacheManager1 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入ehCacheManager缓存");
return user;
}
@Cacheable(cacheNames = "ehcache2", cacheManager = "ehCacheManager", key = "'user' + #userId")
public Map<String, Object> selectOneFromEhCacheManager2 (Long userId) {
//这里就当模拟查询数据库,根据主键userId查找返回记录
System.out.println("根据主键userId在mysql中查找记录userId=" + userId);
Map<String, Object> user = new HashMap<>();
user.put("userId", userId);
user.put("userName", "userName" + userId);
System.out.println("将userId=" + userId + "放入ehCacheManager缓存");
return user;
}
}
| 5,053 | 0.672032 | 0.665734 | 110 | 37.972729 | 33.464352 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.754545 | false | false | 13 |
118421b99e9c7b7890e97f64aeec0483a0154159 | 20,675,972,630,399 | eee65bfc13837e04a22a3e8456492a04ad07e770 | /src/com/bivc/cimsmgs/dao/hibernate/NsiSmgsGngDAOHib.java | 806e243cf9dba67b1028f805f4512d16f3e0fedf | [] | no_license | dubrovsky/Wir | https://github.com/dubrovsky/Wir | 439bd7048b675b5c484a761a1841cced2da7f12d | cb9ea761e9f57def1f0f9c396e4a8f48558061bc | refs/heads/master | 2016-09-03T07:33:57.435000 | 2016-02-16T08:13:06 | 2016-02-16T08:13:06 | 27,714,530 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bivc.cimsmgs.dao.hibernate;
import java.util.*;
import com.bivc.cimsmgs.exceptions.InfrastructureException;
import org.hibernate.*;
import org.hibernate.criterion.*;
import com.bivc.cimsmgs.dao.*;
import com.bivc.cimsmgs.db.nsi.Gngcode;
import java.math.BigDecimal;
public class NsiSmgsGngDAOHib extends GenericHibernateDAO<Gngcode, BigDecimal> implements NsiSmgsGngDAO {
@SuppressWarnings("unchecked")
public List<Gngcode> findAll(Integer limit, Integer start, String query) throws InfrastructureException {
Criteria crit = getSession().createCriteria(getPersistentClass());
crit.setFirstResult(start).setMaxResults(limit == null || limit == 0 ? 10 : limit);
crit.add(Restrictions.eq("recState", "A"));
if (query != null && query.trim().length() > 0) {
crit.add(Restrictions.or(Restrictions.ilike("mlName", query.trim(), MatchMode.ANYWHERE),
Restrictions.ilike("code", query.trim(), MatchMode.ANYWHERE)));
}
List<Gngcode> list = crit.list();
getSession().clear();
return list;
}
public Long countAll(String query) {
Criteria crit = getSession().createCriteria(getPersistentClass());
crit.setProjection(Projections.rowCount());
crit.add(Restrictions.eq("recState", "A"));
if (query != null && query.trim().length() > 0) {
crit.add(Restrictions.or(Restrictions.ilike("mlName", query.trim(), MatchMode.ANYWHERE),
Restrictions.ilike("code", query.trim(), MatchMode.ANYWHERE)));
}
return (Long) crit.uniqueResult();
}
}
| UTF-8 | Java | 1,630 | java | NsiSmgsGngDAOHib.java | Java | [] | null | [] | package com.bivc.cimsmgs.dao.hibernate;
import java.util.*;
import com.bivc.cimsmgs.exceptions.InfrastructureException;
import org.hibernate.*;
import org.hibernate.criterion.*;
import com.bivc.cimsmgs.dao.*;
import com.bivc.cimsmgs.db.nsi.Gngcode;
import java.math.BigDecimal;
public class NsiSmgsGngDAOHib extends GenericHibernateDAO<Gngcode, BigDecimal> implements NsiSmgsGngDAO {
@SuppressWarnings("unchecked")
public List<Gngcode> findAll(Integer limit, Integer start, String query) throws InfrastructureException {
Criteria crit = getSession().createCriteria(getPersistentClass());
crit.setFirstResult(start).setMaxResults(limit == null || limit == 0 ? 10 : limit);
crit.add(Restrictions.eq("recState", "A"));
if (query != null && query.trim().length() > 0) {
crit.add(Restrictions.or(Restrictions.ilike("mlName", query.trim(), MatchMode.ANYWHERE),
Restrictions.ilike("code", query.trim(), MatchMode.ANYWHERE)));
}
List<Gngcode> list = crit.list();
getSession().clear();
return list;
}
public Long countAll(String query) {
Criteria crit = getSession().createCriteria(getPersistentClass());
crit.setProjection(Projections.rowCount());
crit.add(Restrictions.eq("recState", "A"));
if (query != null && query.trim().length() > 0) {
crit.add(Restrictions.or(Restrictions.ilike("mlName", query.trim(), MatchMode.ANYWHERE),
Restrictions.ilike("code", query.trim(), MatchMode.ANYWHERE)));
}
return (Long) crit.uniqueResult();
}
}
| 1,630 | 0.664417 | 0.66135 | 39 | 40.794872 | 33.264427 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.948718 | false | false | 13 |
e4bc6498c14b5bbe0ebaa5245f9fff847826f82e | 755,914,283,981 | e4cd35ad62d0dac48e74090bacb3e00277a0ab67 | /MaximumPathSum/test/MaximumPathSumTest.java | 92d083df91fa291eae6a510ef8e40b4439fb780e | [] | no_license | elisasol/ProjectEuler | https://github.com/elisasol/ProjectEuler | aacd6842cde4e46c63bbbc7c1ce6cde9ca3a807b | 8d70da313df70f92e44034018db2fd8a98bc6fc2 | refs/heads/master | 2021-01-10T12:36:13.224000 | 2016-01-28T21:10:58 | 2016-01-28T21:10:58 | 50,597,237 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package MaximumPathSum.test;
import MaximumPathSum.Problems;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class MaximumPathSumTest {
@Test
public void problem18ShouldBe1074(){
assertEquals(1074, Problems.problem18());
}
@Test
public void problem67ShouldBe7273(){
assertEquals(7273, Problems.problem67());
}
} | UTF-8 | Java | 382 | java | MaximumPathSumTest.java | Java | [] | null | [] | package MaximumPathSum.test;
import MaximumPathSum.Problems;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class MaximumPathSumTest {
@Test
public void problem18ShouldBe1074(){
assertEquals(1074, Problems.problem18());
}
@Test
public void problem67ShouldBe7273(){
assertEquals(7273, Problems.problem67());
}
} | 382 | 0.717277 | 0.65445 | 18 | 20.277779 | 18.359997 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 13 |
84939018cd882819da3a61216e7343fc45e953ba | 22,651,657,583,278 | 038466e4db726019f8194496df46ee0122fdc388 | /library/src/main/java/com/kince/widget/floatbubble/Bubble.java | 179cc9fec80c82436f8bc265bb9c3e4497c5a097 | [] | no_license | rohitnotes/FloatBubble | https://github.com/rohitnotes/FloatBubble | 16da783c36288d6fa1c364930ba1526465b836b8 | 3e79cd2567087ccb44f46b1a126addb39b538b36 | refs/heads/master | 2021-09-10T11:10:06.815000 | 2018-03-25T09:00:15 | 2018-03-25T09:00:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kince.widget.floatbubble;
import android.graphics.Paint;
/**
* 代表每个气泡
* 半径、x坐标、y坐标
*/
public class Bubble {
private Paint paint;
/**
* 气泡半径
*/
private float radius;
/**
* 上升速度
*/
private float speedY;
/**
* 平移速度
*/
private float speedX;
/**
* 气泡x坐标
*/
private float x;
/**
* 气泡y坐标
*/
private float y;
/**
* 纯色背景色
*/
private int originalColor;
/**
* 渐变背景色
*/
private int[] shaderColor;
private FloatType type;
public float getRadius() {
return radius;
}
public void setRadius(float radius) {
this.radius = radius;
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public float getSpeedY() {
return speedY;
}
public void setSpeedY(float speedY) {
this.speedY = speedY;
}
public float getSpeedX() {
return speedX;
}
public void setSpeedX(float speedX) {
this.speedX = speedX;
}
public FloatType getType() {
return type;
}
public void setType(FloatType type) {
this.type = type;
}
public Paint getPaint() {
return paint;
}
public void setPaint(Paint paint) {
this.paint = paint;
}
public int getOriginalColor() {
return originalColor;
}
public void setOriginalColor(int originalColor) {
this.originalColor = originalColor;
}
public int[] getShaderColor() {
return shaderColor;
}
public void setShaderColor(int[] shaderColor) {
this.shaderColor = shaderColor;
}
// 移动
// void move() {
// //向角度的方向移动,偏移圆心
// cx += vx;
// cy += vy;
// }
} | UTF-8 | Java | 2,044 | java | Bubble.java | Java | [] | null | [] | package com.kince.widget.floatbubble;
import android.graphics.Paint;
/**
* 代表每个气泡
* 半径、x坐标、y坐标
*/
public class Bubble {
private Paint paint;
/**
* 气泡半径
*/
private float radius;
/**
* 上升速度
*/
private float speedY;
/**
* 平移速度
*/
private float speedX;
/**
* 气泡x坐标
*/
private float x;
/**
* 气泡y坐标
*/
private float y;
/**
* 纯色背景色
*/
private int originalColor;
/**
* 渐变背景色
*/
private int[] shaderColor;
private FloatType type;
public float getRadius() {
return radius;
}
public void setRadius(float radius) {
this.radius = radius;
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public float getSpeedY() {
return speedY;
}
public void setSpeedY(float speedY) {
this.speedY = speedY;
}
public float getSpeedX() {
return speedX;
}
public void setSpeedX(float speedX) {
this.speedX = speedX;
}
public FloatType getType() {
return type;
}
public void setType(FloatType type) {
this.type = type;
}
public Paint getPaint() {
return paint;
}
public void setPaint(Paint paint) {
this.paint = paint;
}
public int getOriginalColor() {
return originalColor;
}
public void setOriginalColor(int originalColor) {
this.originalColor = originalColor;
}
public int[] getShaderColor() {
return shaderColor;
}
public void setShaderColor(int[] shaderColor) {
this.shaderColor = shaderColor;
}
// 移动
// void move() {
// //向角度的方向移动,偏移圆心
// cx += vx;
// cy += vy;
// }
} | 2,044 | 0.523364 | 0.523364 | 125 | 14.416 | 13.532292 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.248 | false | false | 13 |
437f89a6990775915bf74b86652dd38b856ebc19 | 30,451,318,186,402 | ee96f2bc35b2509b30293951a86829621aaa192f | /Source Code/DAG-MicroServer/target/DAG-MicroServer-0.0.1-SNAPSHOT/WEB-INF/classes/entity/BidDisplay.java | 2e95e610ba8b07d1dee3df73a2c48003322d364d | [] | no_license | LadDevendra/DAG_BiddingWebsite | https://github.com/LadDevendra/DAG_BiddingWebsite | f1e78d81b7bf310f9faee0647dcd8cf039b0f9e0 | c31b1bc63ba2ede3592cfe9bb7a61c3e45435d50 | refs/heads/master | 2021-01-20T08:00:49.297000 | 2017-05-02T21:54:00 | 2017-05-02T21:54:00 | 90,080,223 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package entity;
import java.util.Date;
public class BidDisplay {
private int bidId;
private int amount;
private int status;
private String customerName;
private String productName;
private Date productSellDate;
private int productStartBid;
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public Date getProductSellDate() {
return productSellDate;
}
public void setProductSellDate(Date productSellDate) {
this.productSellDate = productSellDate;
}
public int getProductStartBid() {
return productStartBid;
}
public void setProductStartBid(int startBid) {
this.productStartBid = startBid;
}
public int getBidId() {
return bidId;
}
public void setBidId(int bidId) {
this.bidId = bidId;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| UTF-8 | Java | 1,196 | java | BidDisplay.java | Java | [] | null | [] | package entity;
import java.util.Date;
public class BidDisplay {
private int bidId;
private int amount;
private int status;
private String customerName;
private String productName;
private Date productSellDate;
private int productStartBid;
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public Date getProductSellDate() {
return productSellDate;
}
public void setProductSellDate(Date productSellDate) {
this.productSellDate = productSellDate;
}
public int getProductStartBid() {
return productStartBid;
}
public void setProductStartBid(int startBid) {
this.productStartBid = startBid;
}
public int getBidId() {
return bidId;
}
public void setBidId(int bidId) {
this.bidId = bidId;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| 1,196 | 0.739967 | 0.739967 | 59 | 19.271187 | 15.440241 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.491525 | false | false | 13 |
dca74e7bff5d75af5890236e44fb05ef04423fcd | 19,155,554,209,842 | 0565817099c0813e3f36b42d6c7506006057bab1 | /app/src/main/java/neo/com/noibai_airport/Adapter/AdapterComment.java | 384f1fa22a29975108fe04e6e83721c0171181fa | [] | no_license | quochuy190/NoibaiAirport | https://github.com/quochuy190/NoibaiAirport | 2f8755658f003e07038badb66e0d598eb0aa7d9e | 2110de534282e81275bccb148757411f5870e426 | refs/heads/master | 2020-03-19T06:19:07.395000 | 2018-07-21T07:04:36 | 2018-07-21T07:04:36 | 136,009,733 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package neo.com.noibai_airport.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;
import neo.com.noibai_airport.Model.Comments;
import neo.com.noibai_airport.R;
import neo.com.noibai_airport.untils.ItemClickListener;
import neo.com.noibai_airport.untils.TimeUtils;
public class AdapterComment extends RecyclerView.Adapter<AdapterComment.LanguageViewHoder> {
private Context mContext;
private List<Comments> lisLanguage;
private ItemClickListener itemClickListener;
public AdapterComment(Context mContext, List<Comments> lisLanguage) {
this.mContext = mContext;
this.lisLanguage = lisLanguage;
}
public ItemClickListener getItemClickListener() {
return itemClickListener;
}
public void setItemClickListener(ItemClickListener itemClickListener) {
this.itemClickListener = itemClickListener;
}
@NonNull
@Override
public LanguageViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_comment, parent, false);
return new LanguageViewHoder(view);
}
@Override
public void onBindViewHolder(@NonNull LanguageViewHoder holder, int position) {
Comments language = lisLanguage.get(position);
if (language.getsCOMMENTS() != null) {
holder.txt_content_comment.setText(language.getsCOMMENTS());
}
if (language.getsCOMMENTTIME() != null) {
holder.txt_time_comment.setText(TimeUtils.convent_date(language.getsCOMMENTTIME(),
"yyyy-MM-dd hh:mm:ss", "EEE, dd/MM/yyyy"));
}
if (language.getsMEMBERID() != null) {
holder.txt_UserName.setText(language.getsMEMBERID());
}
if (position == lisLanguage.size() - 1) {
holder.view_bottom_comment.setVisibility(View.GONE);
} else holder.view_bottom_comment.setVisibility(View.VISIBLE);
}
@Override
public int getItemCount() {
return lisLanguage.size();
}
public class LanguageViewHoder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
@BindView(R.id.txt_content_comment)
TextView txt_content_comment;
@BindView(R.id.txt_time_comment)
TextView txt_time_comment;
@BindView(R.id.txt_UserName)
TextView txt_UserName;
@BindView(R.id.img_avata_comment)
CircleImageView img_avata_comment;
@BindView(R.id.view_bottom_comment)
View view_bottom_comment;
public LanguageViewHoder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
itemClickListener.onClickItem(getLayoutPosition(), lisLanguage.get(getLayoutPosition()));
}
@Override
public boolean onLongClick(View v) {
return false;
}
}
public void update_list(List<Comments> list) {
lisLanguage.clear();
lisLanguage.addAll(list);
notifyDataSetChanged();
}
}
| UTF-8 | Java | 3,541 | java | AdapterComment.java | Java | [
{
"context": "\nimport butterknife.ButterKnife;\nimport de.hdodenhof.circleimageview.CircleImageView;\nimport neo.com.n",
"end": 393,
"score": 0.7145429849624634,
"start": 391,
"tag": "USERNAME",
"value": "of"
}
] | null | [] | package neo.com.noibai_airport.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;
import neo.com.noibai_airport.Model.Comments;
import neo.com.noibai_airport.R;
import neo.com.noibai_airport.untils.ItemClickListener;
import neo.com.noibai_airport.untils.TimeUtils;
public class AdapterComment extends RecyclerView.Adapter<AdapterComment.LanguageViewHoder> {
private Context mContext;
private List<Comments> lisLanguage;
private ItemClickListener itemClickListener;
public AdapterComment(Context mContext, List<Comments> lisLanguage) {
this.mContext = mContext;
this.lisLanguage = lisLanguage;
}
public ItemClickListener getItemClickListener() {
return itemClickListener;
}
public void setItemClickListener(ItemClickListener itemClickListener) {
this.itemClickListener = itemClickListener;
}
@NonNull
@Override
public LanguageViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_comment, parent, false);
return new LanguageViewHoder(view);
}
@Override
public void onBindViewHolder(@NonNull LanguageViewHoder holder, int position) {
Comments language = lisLanguage.get(position);
if (language.getsCOMMENTS() != null) {
holder.txt_content_comment.setText(language.getsCOMMENTS());
}
if (language.getsCOMMENTTIME() != null) {
holder.txt_time_comment.setText(TimeUtils.convent_date(language.getsCOMMENTTIME(),
"yyyy-MM-dd hh:mm:ss", "EEE, dd/MM/yyyy"));
}
if (language.getsMEMBERID() != null) {
holder.txt_UserName.setText(language.getsMEMBERID());
}
if (position == lisLanguage.size() - 1) {
holder.view_bottom_comment.setVisibility(View.GONE);
} else holder.view_bottom_comment.setVisibility(View.VISIBLE);
}
@Override
public int getItemCount() {
return lisLanguage.size();
}
public class LanguageViewHoder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
@BindView(R.id.txt_content_comment)
TextView txt_content_comment;
@BindView(R.id.txt_time_comment)
TextView txt_time_comment;
@BindView(R.id.txt_UserName)
TextView txt_UserName;
@BindView(R.id.img_avata_comment)
CircleImageView img_avata_comment;
@BindView(R.id.view_bottom_comment)
View view_bottom_comment;
public LanguageViewHoder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
itemClickListener.onClickItem(getLayoutPosition(), lisLanguage.get(getLayoutPosition()));
}
@Override
public boolean onLongClick(View v) {
return false;
}
}
public void update_list(List<Comments> list) {
lisLanguage.clear();
lisLanguage.addAll(list);
notifyDataSetChanged();
}
}
| 3,541 | 0.682576 | 0.682011 | 107 | 32.093456 | 26.49159 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.523364 | false | false | 13 |
2b23a12323ff1b268eb20dbf0dfff43a78bba4d4 | 28,381,143,937,908 | c2fa12bac9051534bc21b1bf44d5138e24d8b433 | /mdd-vaadin/src/main/java/io/mateu/mdd/vaadin/views/ComponentView.java | 2da9a645bf5428b2ce916a87a7568a5d3f7e0d7b | [
"Beerware"
] | permissive | Evincere/mateu-mdd | https://github.com/Evincere/mateu-mdd | f66b91790e86d69271df875b8df64517920a3bc3 | af33f1e0fede5ba294966c965e890435cc20652e | refs/heads/master | 2023-08-15T01:48:31.267000 | 2020-12-01T15:25:07 | 2020-12-01T15:25:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.mateu.mdd.vaadin.views;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.ui.Component;
import io.mateu.mdd.vaadin.components.ComponentWrapper;
import io.mateu.mdd.vaadin.navigation.View;
import io.mateu.mdd.vaadin.navigation.ViewStack;
public class ComponentView extends View {
private String title;
@Override
public String toString() {
return title;
}
public ComponentView(ViewStack stack, String title, VaadinIcons icon, Component component) {
super(stack, getContent(icon, title, component));
this.title = title;
}
private static Component getContent(VaadinIcons icon, String title, Component component) {
return new ComponentWrapper(icon, title, component, false);
}
}
| UTF-8 | Java | 760 | java | ComponentView.java | Java | [] | null | [] | package io.mateu.mdd.vaadin.views;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.ui.Component;
import io.mateu.mdd.vaadin.components.ComponentWrapper;
import io.mateu.mdd.vaadin.navigation.View;
import io.mateu.mdd.vaadin.navigation.ViewStack;
public class ComponentView extends View {
private String title;
@Override
public String toString() {
return title;
}
public ComponentView(ViewStack stack, String title, VaadinIcons icon, Component component) {
super(stack, getContent(icon, title, component));
this.title = title;
}
private static Component getContent(VaadinIcons icon, String title, Component component) {
return new ComponentWrapper(icon, title, component, false);
}
}
| 760 | 0.730263 | 0.730263 | 26 | 28.23077 | 27.928904 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.846154 | false | false | 13 |
bc2e7adc9ed97dacefd28465d24199912a0bee00 | 28,381,143,940,536 | b98b2c208b697cc636537273409055f8a07aecbc | /app/src/main/java/com/example/fchataigner/pocket/books/BookFinder.java | 323e57349036872b993f0d809e855c25bbcc92d5 | [] | no_license | chataign/pocket | https://github.com/chataign/pocket | 05dad0e2974b168df031b1cece7a504345c744d4 | 787d820c6a61b6a79ba6b2107d2a253195f00ae9 | refs/heads/master | 2020-03-16T09:19:42.837000 | 2018-06-02T17:32:52 | 2018-06-02T17:32:52 | 132,613,135 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.fchataigner.pocket.books;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.Log;
import com.example.fchataigner.pocket.ItemFinder;
import com.example.fchataigner.pocket.Language;
import com.example.fchataigner.pocket.Utils;
import com.example.fchataigner.pocket.interfaces.AsyncResultsListener;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class BookFinder extends ItemFinder<Book>
{
private Language language;
private String type;
private String base_url;
BookFinder(@NonNull Context context,
@NonNull Language language,
@NonNull String type,
@NonNull AsyncResultsListener<Book> listener )
{
super( context, listener );
this.language = language;
this.type = type;
base_url = context.getString(com.example.fchataigner.pocket.R.string.book_api_url);
}
@Override
protected String createQueryUrl( String[] search_strings, String next_page_token )
{
String search_string = Utils.join( search_strings, "+" );
search_string = search_string.replaceAll( " ", "+" );
String query_url = base_url + search_string;
query_url += "&printType=" + type;
query_url += "&langRestrict=" + language.code;
query_url += "&maxResults=40";
return query_url;
}
@Override
protected List<Book> parseResponse( JSONObject response ) throws JSONException
{
JSONArray json_items = response.getJSONArray("items");
ArrayList<Book> books = new ArrayList<>();
for ( int i=0; i< json_items.length(); ++i )
{
JSONObject json = json_items.getJSONObject(i);
try
{
Book book = Book.fromGoogleJSON(json);
if ( book.language.equals(this.language.code) ) books.add(book);
}
catch( Exception ex )
{
Log.w( TAG, "Failed to parse book JSON, error=" + ex.getMessage() );
}
}
return books;
}
}
| UTF-8 | Java | 2,186 | java | BookFinder.java | Java | [] | null | [] | package com.example.fchataigner.pocket.books;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.Log;
import com.example.fchataigner.pocket.ItemFinder;
import com.example.fchataigner.pocket.Language;
import com.example.fchataigner.pocket.Utils;
import com.example.fchataigner.pocket.interfaces.AsyncResultsListener;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class BookFinder extends ItemFinder<Book>
{
private Language language;
private String type;
private String base_url;
BookFinder(@NonNull Context context,
@NonNull Language language,
@NonNull String type,
@NonNull AsyncResultsListener<Book> listener )
{
super( context, listener );
this.language = language;
this.type = type;
base_url = context.getString(com.example.fchataigner.pocket.R.string.book_api_url);
}
@Override
protected String createQueryUrl( String[] search_strings, String next_page_token )
{
String search_string = Utils.join( search_strings, "+" );
search_string = search_string.replaceAll( " ", "+" );
String query_url = base_url + search_string;
query_url += "&printType=" + type;
query_url += "&langRestrict=" + language.code;
query_url += "&maxResults=40";
return query_url;
}
@Override
protected List<Book> parseResponse( JSONObject response ) throws JSONException
{
JSONArray json_items = response.getJSONArray("items");
ArrayList<Book> books = new ArrayList<>();
for ( int i=0; i< json_items.length(); ++i )
{
JSONObject json = json_items.getJSONObject(i);
try
{
Book book = Book.fromGoogleJSON(json);
if ( book.language.equals(this.language.code) ) books.add(book);
}
catch( Exception ex )
{
Log.w( TAG, "Failed to parse book JSON, error=" + ex.getMessage() );
}
}
return books;
}
}
| 2,186 | 0.632662 | 0.63129 | 74 | 28.540541 | 25.272669 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.608108 | false | false | 13 |
3559bcabd528f71b0bdf95c730ee968e050ef07b | 6,932,077,248,873 | a61a942aba0dcf4d6705b0c966b6e188cc79a234 | /Homework280421/src/User.java | 87e2885c895927eb8d896eedc8a1683894ac268a | [] | no_license | muratsahar/Homework280421 | https://github.com/muratsahar/Homework280421 | c10d3876ba25fd8726b2796db7a4a9e713b4f546 | d9b2d8c31ba43cbede9e107d370b9eb8543572b2 | refs/heads/main | 2023-04-22T08:57:41.652000 | 2021-04-30T18:11:45 | 2021-04-30T18:11:45 | 362,974,206 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//All students and instructors are user
public class User {
//fields
private int id;
private String name;
private String surname;
private String nationalIdentity;
private int tuitionFee;
private String tamAdSoyad;
//constructor
public User() {
}
public User(int id, String name, String surname, String nationalIdentity) {
super();
this.id = id;
this.name = name;
this.surname = surname;
this.nationalIdentity = nationalIdentity;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname.toUpperCase();
}
public String getNationalIdentity() {
return nationalIdentity;
}
public void setNationalIdentity(String nationalIdentity) {
this.nationalIdentity = nationalIdentity;
}
public String getTamAdSoyad() {
return this.name+" "+this.surname ;
}
}
| UTF-8 | Java | 1,129 | java | User.java | Java | [] | null | [] |
//All students and instructors are user
public class User {
//fields
private int id;
private String name;
private String surname;
private String nationalIdentity;
private int tuitionFee;
private String tamAdSoyad;
//constructor
public User() {
}
public User(int id, String name, String surname, String nationalIdentity) {
super();
this.id = id;
this.name = name;
this.surname = surname;
this.nationalIdentity = nationalIdentity;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname.toUpperCase();
}
public String getNationalIdentity() {
return nationalIdentity;
}
public void setNationalIdentity(String nationalIdentity) {
this.nationalIdentity = nationalIdentity;
}
public String getTamAdSoyad() {
return this.name+" "+this.surname ;
}
}
| 1,129 | 0.654562 | 0.654562 | 67 | 14.820895 | 16.654455 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.343284 | false | false | 13 |
a32119aeebfe0ff885e98d9939b80262046cbaf1 | 35,682,588,315,957 | 41b23db741b6009819774e06bfec5885b6aae164 | /src/main/java/com/gdpi/aspect/Logger.java | 93a4a3105ac333fad713f2cee6cae931d06c9f22 | [] | no_license | cfuncode/dormitories_system | https://github.com/cfuncode/dormitories_system | e1a3c4a70bd78df7b2be38259d468a322be8050a | b5669a303618be074214622d8952cb82ddf1190e | refs/heads/master | 2023-01-24T02:12:43.268000 | 2020-11-21T16:09:08 | 2020-11-21T16:09:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gdpi.aspect;
import com.alibaba.fastjson.JSON;
import com.gdpi.entity.Log;
import com.gdpi.jwt.JwtUtils;
import com.gdpi.mapper.LogMapper;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* 用于记录日志的工具类,它里面提供了公共的代码
*/
@Component("logger")
@Aspect//表示当前类是一个切面类
public class Logger {
@Autowired
private JwtUtils jwtUtils;
@Resource
private LogMapper logMapper;
@Pointcut("!execution(* com.gdpi.controller.*.*(..)) && execution(* com.gdpi.controller.*.*(..))")
private void myPointcut() {
}
@Around("myPointcut()")
public Object aroundPringLog(ProceedingJoinPoint pjp) throws Throwable {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();//获取request
//HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();//获取response
Object[] args = pjp.getArgs();
Object result = pjp.proceed();//明确调用业务层方法(切入点方法)
System.out.println(">>>>保存请求日志到数据库<<<<");
//获取前端传来的token
String token = request.getHeader("token");
//解析token,获取用户名
String username = jwtUtils.getUsernameFromToken(token);
Log log = new Log();
log.setLogUser(username);
System.out.println(">>>>保存请求日志到数据库<<<<"+request.getContentType());
Map<String, String[]> parameterMap = request.getParameterMap();
if (parameterMap.keySet().size() > 0) log.setLogParameter(JSON.toJSONString(parameterMap));
if (request.getContentType()!=null) {
String s = request.getContentType().split(";")[0];
if (!s.equals("multipart/form-data")) {
if (args.length > 0) log.setLogParameter(JSON.toJSONString(args));
}else{
log.setLogParameter("{上传文件}");
}
}
String url = request.getRequestURI().split("/")[1];
log.setLogTable(url);
String method = request.getMethod().toUpperCase();
switch (method) {
case "GET":
log.setLogType(0);
break;
case "POST":
log.setLogType(1);
break;
case "PUT":
log.setLogType(2);
break;
case "DELETE":
log.setLogType(3);
break;
}
logMapper.insert(log);
return result;
}
}
| UTF-8 | Java | 3,117 | java | Logger.java | Java | [] | null | [] | package com.gdpi.aspect;
import com.alibaba.fastjson.JSON;
import com.gdpi.entity.Log;
import com.gdpi.jwt.JwtUtils;
import com.gdpi.mapper.LogMapper;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* 用于记录日志的工具类,它里面提供了公共的代码
*/
@Component("logger")
@Aspect//表示当前类是一个切面类
public class Logger {
@Autowired
private JwtUtils jwtUtils;
@Resource
private LogMapper logMapper;
@Pointcut("!execution(* com.gdpi.controller.*.*(..)) && execution(* com.gdpi.controller.*.*(..))")
private void myPointcut() {
}
@Around("myPointcut()")
public Object aroundPringLog(ProceedingJoinPoint pjp) throws Throwable {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();//获取request
//HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();//获取response
Object[] args = pjp.getArgs();
Object result = pjp.proceed();//明确调用业务层方法(切入点方法)
System.out.println(">>>>保存请求日志到数据库<<<<");
//获取前端传来的token
String token = request.getHeader("token");
//解析token,获取用户名
String username = jwtUtils.getUsernameFromToken(token);
Log log = new Log();
log.setLogUser(username);
System.out.println(">>>>保存请求日志到数据库<<<<"+request.getContentType());
Map<String, String[]> parameterMap = request.getParameterMap();
if (parameterMap.keySet().size() > 0) log.setLogParameter(JSON.toJSONString(parameterMap));
if (request.getContentType()!=null) {
String s = request.getContentType().split(";")[0];
if (!s.equals("multipart/form-data")) {
if (args.length > 0) log.setLogParameter(JSON.toJSONString(args));
}else{
log.setLogParameter("{上传文件}");
}
}
String url = request.getRequestURI().split("/")[1];
log.setLogTable(url);
String method = request.getMethod().toUpperCase();
switch (method) {
case "GET":
log.setLogType(0);
break;
case "POST":
log.setLogType(1);
break;
case "PUT":
log.setLogType(2);
break;
case "DELETE":
log.setLogType(3);
break;
}
logMapper.insert(log);
return result;
}
}
| 3,117 | 0.643028 | 0.6403 | 80 | 35.662498 | 27.911442 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 13 |
ddde3f68b5258ec6ee288197b0dd5c1ca3f269fc | 19,353,122,646,946 | 40f7205ffa174d6bd622cc4db280b4d25dcb1731 | /src/main/java/com/rts/kafka/newconsumer/demo2/multithreads/KafkaMultiProcessorTest.java | 26104befcf3e7904ca375089d10642cea88fd444 | [
"Apache-2.0"
] | permissive | William0423/KafkaApiDemo | https://github.com/William0423/KafkaApiDemo | 5c36886ee9f8a57e01222df2bc7db4d92c28bc5c | 68cdde98f7e6c8396b738b1083d2e573501733b1 | refs/heads/master | 2020-03-27T21:35:05.258000 | 2018-09-13T03:17:25 | 2018-09-13T03:17:25 | 147,158,733 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rts.kafka.newconsumer.demo2.multithreads;
import com.google.common.collect.ImmutableMap;
import com.rts.kafka.newconsumer.demo2.service.MsgReceiverThread;
import org.apache.kafka.common.TopicPartition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.List;
public class KafkaMultiProcessorTest {
private static final Logger logger = LoggerFactory.getLogger(KafkaMultiProcessorTest.class);
//订阅的topic
private String alarmTopic;
//brokers地址
private String servers;
//消费group
private String group;
//kafka消费者配置
private Map<String, Object> consumerConfig;
// private Thread[] threads;
private List<MsgReceiverThread> consumerThreadList = new ArrayList<MsgReceiverThread>();
/**
* 按照分区划分:
*/
//保存处理任务和线程的map
private ConcurrentHashMap<TopicPartition, RecordProcessor> recordProcessorTasks = new ConcurrentHashMap<>();
private ConcurrentHashMap<TopicPartition, Thread> recordProcessorThreads = new ConcurrentHashMap<>();
public static void main(String[] args) {
KafkaMultiProcessorTest test = new KafkaMultiProcessorTest();
test.setAlarmTopic("newapi_topic");
// test.setGroup("newapi_consumer_groupid_v1");
test.setGroup("newapi_consumer_groupid");
test.setServers("localhost:9092");
//....省略设置topic和group的代码
test.init();
}
public void init() {
consumerConfig = getConsumerConfig();
logger.debug("get kafka consumerConfig: " + consumerConfig.toString());
//创建threadsNum个线程用于读取kafka消息, 且位于同一个group中, 这个topic有12个分区, 最多12个consumer进行读取
int threadsNum = 3;
logger.debug("create " + threadsNum + " threads to consume kafka warn msg");
// threads = new Thread[threadsNum];
for (int i = 0; i < threadsNum; i++) {
/**
* 此处启动三个线程,相当于三个消费中; 每个线程内部,即每个消费中内容,又有新的线程,这些线程是根据分区划分的。
*/
MsgReceiverThread msgReceiver = new MsgReceiverThread(consumerConfig, alarmTopic, recordProcessorTasks, recordProcessorThreads);
// Thread thread = new Thread(msgReceiver);
// threads[i] = thread;
// thread.setName("alarm msg consumer " + i);
consumerThreadList.add(msgReceiver);
}
//启动这几个线程
for (int i = 0; i < threadsNum; i++) {
consumerThreadList.get(i).start();
}
logger.debug("finish creating" + threadsNum + " threads to consume kafka warn msg");
}
//销毁启动的线程
public void destroy() {
closeRecordProcessThreads();
closeKafkaConsumer();
}
private void closeRecordProcessThreads() {
logger.debug("start to interrupt record process threads");
// for (Map.Entry<TopicPartition, Thread> entry : recordProcessorThreads.entrySet()) {
// Thread thread = entry.getValue();
// thread.interrupt();
// }
for (Map.Entry<TopicPartition, RecordProcessor> entry : recordProcessorTasks.entrySet()) {
RecordProcessor task = entry.getValue();
task.stopRecordProcessor();
}
logger.debug("finish interrupting record process threads");
}
private void closeKafkaConsumer() {
logger.debug("start to interrupt kafka consumer threads");
//使用interrupt中断线程, 在线程的执行方法中已经设置了响应中断信号
for (int i = 0; i < consumerThreadList.size(); i++) {
consumerThreadList.get(i).exit();
}
logger.debug("finish interrupting consumer threads");
}
//kafka consumer配置
private Map<String, Object> getConsumerConfig() {
return ImmutableMap.<String, Object>builder()
.put("bootstrap.servers", servers)
.put("group.id", group)
.put("auto.offset.reset", "earliest")
.put("enable.auto.commit", "false")
.put("session.timeout.ms", "30000")
.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer")
.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer")
.put("max.poll.records", 1000)
.build();
}
public void setAlarmTopic(String alarmTopic) {
this.alarmTopic = alarmTopic;
}
public void setServers(String servers) {
this.servers = servers;
}
public void setGroup(String group) {
this.group = group;
}
}
| UTF-8 | Java | 4,894 | java | KafkaMultiProcessorTest.java | Java | [] | null | [] | package com.rts.kafka.newconsumer.demo2.multithreads;
import com.google.common.collect.ImmutableMap;
import com.rts.kafka.newconsumer.demo2.service.MsgReceiverThread;
import org.apache.kafka.common.TopicPartition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.List;
public class KafkaMultiProcessorTest {
private static final Logger logger = LoggerFactory.getLogger(KafkaMultiProcessorTest.class);
//订阅的topic
private String alarmTopic;
//brokers地址
private String servers;
//消费group
private String group;
//kafka消费者配置
private Map<String, Object> consumerConfig;
// private Thread[] threads;
private List<MsgReceiverThread> consumerThreadList = new ArrayList<MsgReceiverThread>();
/**
* 按照分区划分:
*/
//保存处理任务和线程的map
private ConcurrentHashMap<TopicPartition, RecordProcessor> recordProcessorTasks = new ConcurrentHashMap<>();
private ConcurrentHashMap<TopicPartition, Thread> recordProcessorThreads = new ConcurrentHashMap<>();
public static void main(String[] args) {
KafkaMultiProcessorTest test = new KafkaMultiProcessorTest();
test.setAlarmTopic("newapi_topic");
// test.setGroup("newapi_consumer_groupid_v1");
test.setGroup("newapi_consumer_groupid");
test.setServers("localhost:9092");
//....省略设置topic和group的代码
test.init();
}
public void init() {
consumerConfig = getConsumerConfig();
logger.debug("get kafka consumerConfig: " + consumerConfig.toString());
//创建threadsNum个线程用于读取kafka消息, 且位于同一个group中, 这个topic有12个分区, 最多12个consumer进行读取
int threadsNum = 3;
logger.debug("create " + threadsNum + " threads to consume kafka warn msg");
// threads = new Thread[threadsNum];
for (int i = 0; i < threadsNum; i++) {
/**
* 此处启动三个线程,相当于三个消费中; 每个线程内部,即每个消费中内容,又有新的线程,这些线程是根据分区划分的。
*/
MsgReceiverThread msgReceiver = new MsgReceiverThread(consumerConfig, alarmTopic, recordProcessorTasks, recordProcessorThreads);
// Thread thread = new Thread(msgReceiver);
// threads[i] = thread;
// thread.setName("alarm msg consumer " + i);
consumerThreadList.add(msgReceiver);
}
//启动这几个线程
for (int i = 0; i < threadsNum; i++) {
consumerThreadList.get(i).start();
}
logger.debug("finish creating" + threadsNum + " threads to consume kafka warn msg");
}
//销毁启动的线程
public void destroy() {
closeRecordProcessThreads();
closeKafkaConsumer();
}
private void closeRecordProcessThreads() {
logger.debug("start to interrupt record process threads");
// for (Map.Entry<TopicPartition, Thread> entry : recordProcessorThreads.entrySet()) {
// Thread thread = entry.getValue();
// thread.interrupt();
// }
for (Map.Entry<TopicPartition, RecordProcessor> entry : recordProcessorTasks.entrySet()) {
RecordProcessor task = entry.getValue();
task.stopRecordProcessor();
}
logger.debug("finish interrupting record process threads");
}
private void closeKafkaConsumer() {
logger.debug("start to interrupt kafka consumer threads");
//使用interrupt中断线程, 在线程的执行方法中已经设置了响应中断信号
for (int i = 0; i < consumerThreadList.size(); i++) {
consumerThreadList.get(i).exit();
}
logger.debug("finish interrupting consumer threads");
}
//kafka consumer配置
private Map<String, Object> getConsumerConfig() {
return ImmutableMap.<String, Object>builder()
.put("bootstrap.servers", servers)
.put("group.id", group)
.put("auto.offset.reset", "earliest")
.put("enable.auto.commit", "false")
.put("session.timeout.ms", "30000")
.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer")
.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer")
.put("max.poll.records", 1000)
.build();
}
public void setAlarmTopic(String alarmTopic) {
this.alarmTopic = alarmTopic;
}
public void setServers(String servers) {
this.servers = servers;
}
public void setGroup(String group) {
this.group = group;
}
}
| 4,894 | 0.644766 | 0.639071 | 127 | 34.952755 | 29.637138 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.629921 | false | false | 13 |
aaf4eced29720ab743dbb0de319e96baf7dff7c5 | 6,992,206,810,677 | 331fa22374c7c9e88cfba5da77f6b8f23c144480 | /src/main/java/ru/mail/server/WebApp.java | 08cc0ec44d2675a296f597b46bdd4989dab3e0ae | [] | no_license | Savage-E/WebServer2 | https://github.com/Savage-E/WebServer2 | 8bade0d8b1b91330cc2a47af3bf777c92a6e3132 | d84577a2dda6334db89150957062e4f701a66ea5 | refs/heads/main | 2023-01-15T23:35:56.145000 | 2020-11-29T12:51:54 | 2020-11-29T12:51:54 | 316,712,788 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.mail.server;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.resource.Resource;
import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher;
import ru.mail.server.core.DefaultServer;
import ru.mail.server.security.SecurityHandlerBuilder;
import java.net.URL;
import static java.util.Arrays.asList;
@SuppressWarnings({"Duplicates", "NotNullNullableValidation"})
public class WebApp {
public static void main(String[] args) throws Exception {
final Server server = new DefaultServer().build();
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
context.addServlet(HttpServletDispatcher.class, "/");
context.addEventListener(new GuiceListener());
final String hashConfig = WebApp.class.getResource("/hash_config").toExternalForm();
final HashLoginService hashLoginService = new HashLoginService("login", hashConfig);
final ConstraintSecurityHandler securityHandler = new SecurityHandlerBuilder().build(hashLoginService);
server.addBean(hashLoginService);
securityHandler.setHandler(context);
HandlerCollection collection = new HandlerCollection();
collection.setHandlers(new Handler[]{securityHandler, context});
server.setHandler(collection);
server.start();
server.join();
}
}
| UTF-8 | Java | 1,767 | java | WebApp.java | Java | [] | null | [] | package ru.mail.server;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.resource.Resource;
import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher;
import ru.mail.server.core.DefaultServer;
import ru.mail.server.security.SecurityHandlerBuilder;
import java.net.URL;
import static java.util.Arrays.asList;
@SuppressWarnings({"Duplicates", "NotNullNullableValidation"})
public class WebApp {
public static void main(String[] args) throws Exception {
final Server server = new DefaultServer().build();
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
context.addServlet(HttpServletDispatcher.class, "/");
context.addEventListener(new GuiceListener());
final String hashConfig = WebApp.class.getResource("/hash_config").toExternalForm();
final HashLoginService hashLoginService = new HashLoginService("login", hashConfig);
final ConstraintSecurityHandler securityHandler = new SecurityHandlerBuilder().build(hashLoginService);
server.addBean(hashLoginService);
securityHandler.setHandler(context);
HandlerCollection collection = new HandlerCollection();
collection.setHandlers(new Handler[]{securityHandler, context});
server.setHandler(collection);
server.start();
server.join();
}
}
| 1,767 | 0.767402 | 0.767402 | 52 | 32.98077 | 31.22098 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.634615 | false | false | 13 |
3e81d9dd0cddbb6a56285437ca22297f31496601 | 1,967,095,086,426 | b47579723d268610bdb7d46f968a367e1784771e | /HappyBrackets/src/main/java/net/happybrackets/core/OSCUDPSender.java | 1cbacf8e7116b931e3202c7ce74ee6e279ccc13d | [
"Apache-2.0"
] | permissive | orsjb/HappyBrackets | https://github.com/orsjb/HappyBrackets | 0efd77a65ca02c126fe5723167ecd058e082f959 | 6b152eb3ab83da3039085a2fae775cda1b8584db | refs/heads/master | 2023-08-04T20:32:27.678000 | 2022-06-24T04:00:04 | 2022-06-24T04:00:04 | 41,141,646 | 37 | 2 | null | false | 2016-10-27T01:21:35 | 2015-08-21T07:21:47 | 2016-09-19T16:52:38 | 2016-10-27T01:21:34 | 63,048 | 3 | 0 | 11 | HTML | null | null | package net.happybrackets.core;
import de.sciss.net.OSCChannel;
import de.sciss.net.OSCMessage;
import de.sciss.net.OSCPacket;
import de.sciss.net.OSCPacketCodec;
import java.io.IOException;
import java.net.*;
import java.nio.ByteBuffer;
/**
* Class for encoding OSC Messages and sending via a UDP Port
* Removes all the unnecessary server implementation
*/
public class OSCUDPSender {
ByteBuffer byteBuf = ByteBuffer.allocateDirect(OSCChannel.DEFAULTBUFSIZE);
OSCPacketCodec codec = new OSCPacketCodec();
DatagramSocket sendingSocket = null;
private String lastError = "";
/**
* Get the last error caused by an action
* @return the last error
*/
public String getLastError(){return lastError;}
/**
* Send OSC given a OSC Message or packet and Socket address
* @param msg OSC Message
* @param inetSocketAddress SocketAddress
* @return true on success. If failed, call getLastError
*/
public synchronized boolean send(OSCPacket msg, InetSocketAddress inetSocketAddress) {
boolean ret = false;
byteBuf.clear();
try {
codec.encode(msg, byteBuf);
byteBuf.flip();
byte[] buff = new byte[byteBuf.limit()];
byteBuf.get(buff);
DatagramPacket packet = new DatagramPacket(buff, buff.length, inetSocketAddress.getAddress(), inetSocketAddress.getPort());
if (sendingSocket == null){
sendingSocket = new DatagramSocket();
}
sendingSocket.send(packet);
ret = true;
} catch (IOException e) {
lastError = e.getMessage();
}
return ret;
}
/**
* Send OSC given a OSC Message or packet and iNetAddress and port
* @param msg OSC Message
* @param inetAddress iNetAddress
* @param port UDP Port
* @return true on success. If failed, call getLastError
*/
public synchronized boolean send(OSCPacket msg, InetAddress inetAddress, int port){
InetSocketAddress osc_target = new InetSocketAddress(inetAddress, port);
return send(msg, osc_target);
}
/**
* Send OSC given a OSC Message or packet and iNetAddress and port
* @param msg OSC Message
* @param hostaddress host address
* @param port UDP Port
* @return true on success. If failed, call getLastError
*/
public synchronized boolean send(OSCPacket msg, String hostaddress, int port) {
boolean ret = false;
InetSocketAddress osc_target = null;
try {
osc_target = new InetSocketAddress(InetAddress.getByName(hostaddress), port);
ret = send(msg, osc_target);
} catch (UnknownHostException e) {
lastError = e.getMessage();
}
return ret;
}
}
| UTF-8 | Java | 2,829 | java | OSCUDPSender.java | Java | [] | null | [] | package net.happybrackets.core;
import de.sciss.net.OSCChannel;
import de.sciss.net.OSCMessage;
import de.sciss.net.OSCPacket;
import de.sciss.net.OSCPacketCodec;
import java.io.IOException;
import java.net.*;
import java.nio.ByteBuffer;
/**
* Class for encoding OSC Messages and sending via a UDP Port
* Removes all the unnecessary server implementation
*/
public class OSCUDPSender {
ByteBuffer byteBuf = ByteBuffer.allocateDirect(OSCChannel.DEFAULTBUFSIZE);
OSCPacketCodec codec = new OSCPacketCodec();
DatagramSocket sendingSocket = null;
private String lastError = "";
/**
* Get the last error caused by an action
* @return the last error
*/
public String getLastError(){return lastError;}
/**
* Send OSC given a OSC Message or packet and Socket address
* @param msg OSC Message
* @param inetSocketAddress SocketAddress
* @return true on success. If failed, call getLastError
*/
public synchronized boolean send(OSCPacket msg, InetSocketAddress inetSocketAddress) {
boolean ret = false;
byteBuf.clear();
try {
codec.encode(msg, byteBuf);
byteBuf.flip();
byte[] buff = new byte[byteBuf.limit()];
byteBuf.get(buff);
DatagramPacket packet = new DatagramPacket(buff, buff.length, inetSocketAddress.getAddress(), inetSocketAddress.getPort());
if (sendingSocket == null){
sendingSocket = new DatagramSocket();
}
sendingSocket.send(packet);
ret = true;
} catch (IOException e) {
lastError = e.getMessage();
}
return ret;
}
/**
* Send OSC given a OSC Message or packet and iNetAddress and port
* @param msg OSC Message
* @param inetAddress iNetAddress
* @param port UDP Port
* @return true on success. If failed, call getLastError
*/
public synchronized boolean send(OSCPacket msg, InetAddress inetAddress, int port){
InetSocketAddress osc_target = new InetSocketAddress(inetAddress, port);
return send(msg, osc_target);
}
/**
* Send OSC given a OSC Message or packet and iNetAddress and port
* @param msg OSC Message
* @param hostaddress host address
* @param port UDP Port
* @return true on success. If failed, call getLastError
*/
public synchronized boolean send(OSCPacket msg, String hostaddress, int port) {
boolean ret = false;
InetSocketAddress osc_target = null;
try {
osc_target = new InetSocketAddress(InetAddress.getByName(hostaddress), port);
ret = send(msg, osc_target);
} catch (UnknownHostException e) {
lastError = e.getMessage();
}
return ret;
}
}
| 2,829 | 0.641216 | 0.641216 | 92 | 29.75 | 26.620369 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.532609 | false | false | 13 |
a283058e21da618229f623cb5fcd14d55d070045 | 36,223,754,186,793 | 87c8d3569a16b398625022009cdcb8c0d11554b8 | /src/com/cosmogame/BetterParser.java | 45fd7e613e615d26b6c62a48899c9d6e225c12fd | [] | no_license | Sevastopol06/Captured_Cosmonaut | https://github.com/Sevastopol06/Captured_Cosmonaut | 0043f5315dbfade74dd3d1c7a2d755d3cfc66805 | facfb9d53e02114fcb20b842d19332a4dbfd1a33 | refs/heads/TheRealMain | 2022-12-19T20:43:45.147000 | 2020-10-19T18:02:37 | 2020-10-19T18:02:37 | 301,834,046 | 0 | 1 | null | false | 2020-10-19T18:06:45 | 2020-10-06T19:30:47 | 2020-10-19T17:32:55 | 2020-10-19T18:02:45 | 276 | 0 | 1 | 0 | Java | false | false |
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.io.*;
import java.util.*;
public class BetterParser {
public static ArrayList<ArrayList> rooms = new ArrayList<>();
public void betterParser(){
ArrayList<HashMap> room = new ArrayList<>();
HashMap<String, String> insideRoom = new HashMap<>();
try{
//Get Document Builder
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
//Build the document from xml file
Document document = builder.parse(new File("./src/com/cosmogame/spaceship.xml"));
//Normalize
document.getDocumentElement().normalize();
//Get the root of the document and print it
Element root = document.getDocumentElement();
//Get all the rooms in the document
NodeList allRooms = document.getElementsByTagName("room");
for (int i = 0; i<allRooms.getLength(); i++){
Node node = allRooms.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
insideRoom.put("name", element.getElementsByTagName("name").item(0).getTextContent());
insideRoom.put("description", element.getElementsByTagName("description").item(0).getTextContent().replaceAll("NL", "\n"));
insideRoom.put("items", element.getElementsByTagName("items").item(0).getTextContent());
insideRoom.put("north", element.getElementsByTagName("north").item(0).getTextContent());
insideRoom.put("east", element.getElementsByTagName("east").item(0).getTextContent());
insideRoom.put("west", element.getElementsByTagName("west").item(0).getTextContent());
insideRoom.put("south", element.getElementsByTagName("south").item(0).getTextContent());
insideRoom.put("usable", element.getElementsByTagName("usable").item(0).getTextContent());
insideRoom.put("challenge", element.getElementsByTagName("challenge").item(0).getTextContent());
//add all room attributes inside the room array list
room.add(insideRoom);
//add that room with attributes inside the rooms array
rooms.add(room);
//create new data structures for a new room
insideRoom = new HashMap<>();
room = new ArrayList<>();
}
}
}
catch(Exception e){
System.out.println(e);
}
}
}
| UTF-8 | Java | 2,738 | java | BetterParser.java | Java | [] | null | [] |
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.io.*;
import java.util.*;
public class BetterParser {
public static ArrayList<ArrayList> rooms = new ArrayList<>();
public void betterParser(){
ArrayList<HashMap> room = new ArrayList<>();
HashMap<String, String> insideRoom = new HashMap<>();
try{
//Get Document Builder
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
//Build the document from xml file
Document document = builder.parse(new File("./src/com/cosmogame/spaceship.xml"));
//Normalize
document.getDocumentElement().normalize();
//Get the root of the document and print it
Element root = document.getDocumentElement();
//Get all the rooms in the document
NodeList allRooms = document.getElementsByTagName("room");
for (int i = 0; i<allRooms.getLength(); i++){
Node node = allRooms.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
insideRoom.put("name", element.getElementsByTagName("name").item(0).getTextContent());
insideRoom.put("description", element.getElementsByTagName("description").item(0).getTextContent().replaceAll("NL", "\n"));
insideRoom.put("items", element.getElementsByTagName("items").item(0).getTextContent());
insideRoom.put("north", element.getElementsByTagName("north").item(0).getTextContent());
insideRoom.put("east", element.getElementsByTagName("east").item(0).getTextContent());
insideRoom.put("west", element.getElementsByTagName("west").item(0).getTextContent());
insideRoom.put("south", element.getElementsByTagName("south").item(0).getTextContent());
insideRoom.put("usable", element.getElementsByTagName("usable").item(0).getTextContent());
insideRoom.put("challenge", element.getElementsByTagName("challenge").item(0).getTextContent());
//add all room attributes inside the room array list
room.add(insideRoom);
//add that room with attributes inside the rooms array
rooms.add(room);
//create new data structures for a new room
insideRoom = new HashMap<>();
room = new ArrayList<>();
}
}
}
catch(Exception e){
System.out.println(e);
}
}
}
| 2,738 | 0.586194 | 0.582177 | 55 | 48.763638 | 36.817467 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.763636 | false | false | 13 |
b41f9e08b554b776c8abbdd70770107b8ae69a03 | 38,671,885,538,972 | b2866d46c1a1ddeca8563928f15ef32da9eb8df5 | /RepositoryCore/src/main/java/com/eliasmohammadi/repository/core/factory/DaoFactory.java | de4d2cca22f952f9700083e25750eb81da921116 | [] | no_license | eliasmohammadi/Shopitoo | https://github.com/eliasmohammadi/Shopitoo | 37748aefee03714d8f2edaff941a07b4d7c2a557 | 14f2e49df71b4279958c7b335ad77855c27faf5c | refs/heads/master | 2020-09-09T09:53:59.658000 | 2019-12-01T22:03:33 | 2019-12-01T22:03:33 | 221,416,413 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.eliasmohammadi.repository.core.factory;
import com.eliasmohammadi.repository.core.model.DataSource;
public class DaoFactory extends DataSourceFactory {
@Override
public <T extends DataSource> T create(Class<T> model) {
return null;
}
}
| UTF-8 | Java | 273 | java | DaoFactory.java | Java | [] | null | [] | package com.eliasmohammadi.repository.core.factory;
import com.eliasmohammadi.repository.core.model.DataSource;
public class DaoFactory extends DataSourceFactory {
@Override
public <T extends DataSource> T create(Class<T> model) {
return null;
}
}
| 273 | 0.739927 | 0.739927 | 13 | 20 | 24.30258 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | false | false | 13 |
a5769732ecf4d1c3a29c3b6bbb72932229fcaa8b | 15,109,695,016,477 | 66c005661a10076fd9921db2afafd33f32162876 | /src/test/java/com/mikea/concrete/impl/AmortizedDequeTest.java | 176d4f9b58a3704ae3b8c46057bba0d6364fbde5 | [
"Apache-2.0"
] | permissive | mikea/concrete | https://github.com/mikea/concrete | 8a18fbf96d99b0795f9e9bc06ec81b714241b653 | 496e981ed7af5c89749253005bd3ac98604b168c | refs/heads/master | 2021-06-28T16:50:07.639000 | 2016-11-14T06:34:59 | 2016-11-14T06:34:59 | 4,227,887 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mikea.concrete.impl;
import com.mikea.concrete.PDeque;
import com.mikea.concrete.PDequeTestCase;
public class AmortizedDequeTest extends PDequeTestCase {
@Override
protected PDeque<String> newDeque() {
return PDeque.newAmortizedDeque();
}
}
| UTF-8 | Java | 265 | java | AmortizedDequeTest.java | Java | [] | null | [] | package com.mikea.concrete.impl;
import com.mikea.concrete.PDeque;
import com.mikea.concrete.PDequeTestCase;
public class AmortizedDequeTest extends PDequeTestCase {
@Override
protected PDeque<String> newDeque() {
return PDeque.newAmortizedDeque();
}
}
| 265 | 0.781132 | 0.781132 | 11 | 23.09091 | 19.449022 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 13 |
8141e76e263badc295f6131c1b096eea6913e7f1 | 18,494,129,179,041 | 26911aad8e0f744f6b9dd77508c160b1f15f9d6d | /src/main/java/de/jgroeneveld/mentor/managers/entity/Manager.java | 0fe70e09dbf00185f11c5f9c29d235e12c281139 | [] | no_license | jgroeneveld/mentor | https://github.com/jgroeneveld/mentor | e1e20b251afa9beeaed11ab7db3795a7dc857199 | 5ac93c08f3a7ee6d050e4849b9b7f829ac01b318 | refs/heads/master | 2020-03-24T00:34:49.896000 | 2018-08-08T14:05:18 | 2018-08-08T14:05:18 | 142,297,644 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.jgroeneveld.mentor.managers.entity;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
@Entity
@Table(name = "MANAGERS")
public class Manager {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@NotBlank
private String firstName;
@NotBlank
private String lastName;
public Manager() {
}
public Manager(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public long getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
}
| UTF-8 | Java | 706 | java | Manager.java | Java | [
{
"context": "tName, String lastName) {\n this.firstName = firstName;\n this.lastName = lastName;\n }\n\n pub",
"end": 476,
"score": 0.7043465971946716,
"start": 467,
"tag": "NAME",
"value": "firstName"
}
] | null | [] | package de.jgroeneveld.mentor.managers.entity;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
@Entity
@Table(name = "MANAGERS")
public class Manager {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@NotBlank
private String firstName;
@NotBlank
private String lastName;
public Manager() {
}
public Manager(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public long getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
}
| 706 | 0.647309 | 0.647309 | 39 | 17.102564 | 16.331181 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 13 |
4a83f161c36344f0b7901c9da1f37b904932f818 | 18,494,129,177,935 | 1b2f787e82573027b71bc6cd0753f29161ad099f | /hw04-0036505371/src/main/java/hr/fer/zemris/demo/Primjer.java | 5535770da2d3f80dc4afdd4b31ce952d550bd016 | [] | no_license | mradocaj/java-course-fer-2019 | https://github.com/mradocaj/java-course-fer-2019 | 98b829cbc882da072983f1d7158e6b0784b3084e | 20d45b792c102a57cbce469d259cbdfb9f627ebf | refs/heads/master | 2023-02-19T15:47:00.921000 | 2020-05-30T23:48:04 | 2020-05-30T23:48:04 | 268,145,920 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hr.fer.zemris.demo;
import hr.fer.zemris.java.custom.collections.SimpleHashtable;
/**
* Razred koji demonstrira uporabu mape SimpleHashtable.
*
* @author Maja Radočaj
*
*/
public class Primjer {
/**
* Glavni program.
*
* @param args argumenti naredbenog retka
*/
public static void main(String[] args) {
// create collection:
SimpleHashtable<String,Integer> examMarks = new SimpleHashtable<>(2);
// fill data:
examMarks.put("Ivana", 2);
examMarks.put("Ante", 2);
examMarks.put("Jasna", 2);
examMarks.put("Kristina", 5);
examMarks.put("Ivana", 5); // overwrites old grade for Ivana
for(SimpleHashtable.TableEntry<String,Integer> pair : examMarks) {
System.out.printf("%s => %d%n", pair.getKey(), pair.getValue());
}
}
}
| UTF-8 | Java | 783 | java | Primjer.java | Java | [
{
"context": "trira uporabu mape SimpleHashtable.\n * \n * @author Maja Radočaj\n *\n */\npublic class Primjer {\n\n\t/**\n\t * Glavni pr",
"end": 180,
"score": 0.9998612403869629,
"start": 168,
"tag": "NAME",
"value": "Maja Radočaj"
},
{
"context": "eHashtable<>(2);\n\t\t// fill dat... | null | [] | package hr.fer.zemris.demo;
import hr.fer.zemris.java.custom.collections.SimpleHashtable;
/**
* Razred koji demonstrira uporabu mape SimpleHashtable.
*
* @author <NAME>
*
*/
public class Primjer {
/**
* Glavni program.
*
* @param args argumenti naredbenog retka
*/
public static void main(String[] args) {
// create collection:
SimpleHashtable<String,Integer> examMarks = new SimpleHashtable<>(2);
// fill data:
examMarks.put("Ivana", 2);
examMarks.put("Ante", 2);
examMarks.put("Jasna", 2);
examMarks.put("Kristina", 5);
examMarks.put("Ivana", 5); // overwrites old grade for Ivana
for(SimpleHashtable.TableEntry<String,Integer> pair : examMarks) {
System.out.printf("%s => %d%n", pair.getKey(), pair.getValue());
}
}
}
| 776 | 0.671355 | 0.663683 | 35 | 21.342857 | 23.043987 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.571429 | false | false | 13 |
4ab65f1190f61218ea97d25dcab5c0a14daa1a10 | 24,378,234,439,033 | fca77cf264a6d2f9436165f38b12e56e18b95597 | /vediSoftPractice/Matrix.java | 17c31f174b246d4d475347a65c6cea92890559ed | [] | no_license | piyush1999/random-codes | https://github.com/piyush1999/random-codes | 928539a465c08ffbe78a12edc6a8ef8e49f3ffb4 | be33ca9acf6f43c59e96eca852baa1114aba3c36 | refs/heads/main | 2023-01-20T16:24:55.296000 | 2020-12-04T08:54:22 | 2020-12-04T08:54:22 | 318,455,582 | 0 | 0 | null | false | 2020-12-04T08:54:24 | 2020-12-04T08:43:35 | 2020-12-04T08:43:40 | 2020-12-04T08:54:23 | 0 | 0 | 0 | 0 | null | false | false | package vediSoftPractice;
import java.util.Scanner;
public class Matrix {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.println("enter row and col");
int row = kb.nextInt();
int col = kb.nextInt();
int[][] mat = new int[row][col];
int[][] arr = new int[row][col];
System.out.println("enter elements...");
for(int i=0;i<row;i++) {
for(int j=0;j<col;j++) {
mat[i][j] = kb.nextInt();
}
}
for(int i=0;i<row;i++) {
for(int j=0;j<col;j++) {
if(i!=j) {
arr[j][i] = mat[i][j];
}
else {
arr[i][j] = mat[i][j];
}
}
}
for(int i=0;i<row;i++) {
for(int j=0;j<col;j++) {
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
}
}
| UTF-8 | Java | 1,041 | java | Matrix.java | Java | [] | null | [] | package vediSoftPractice;
import java.util.Scanner;
public class Matrix {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.println("enter row and col");
int row = kb.nextInt();
int col = kb.nextInt();
int[][] mat = new int[row][col];
int[][] arr = new int[row][col];
System.out.println("enter elements...");
for(int i=0;i<row;i++) {
for(int j=0;j<col;j++) {
mat[i][j] = kb.nextInt();
}
}
for(int i=0;i<row;i++) {
for(int j=0;j<col;j++) {
if(i!=j) {
arr[j][i] = mat[i][j];
}
else {
arr[i][j] = mat[i][j];
}
}
}
for(int i=0;i<row;i++) {
for(int j=0;j<col;j++) {
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
}
}
| 1,041 | 0.382325 | 0.376561 | 34 | 28.617647 | 13.047458 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764706 | false | false | 13 |
afeacd5738d35c73478c856d73a1eb6cc347cd9b | 9,955,734,233,424 | fb5444a71f362cf7c960435f2571b6577eca4838 | /commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/product_discount/ProductDiscountValueAbsoluteDraft.java | 23f55742aa7a8246c5e907714c9e9f09892dfbf9 | [
"Apache-2.0"
] | permissive | bogste/commercetools-sdk-java-v2 | https://github.com/bogste/commercetools-sdk-java-v2 | 1a406f57a509282d3eb33579510377d045f7bb8b | e95dd94d90c1eb582a526c42f917df0972dd5ac9 | refs/heads/main | 2023-07-19T07:02:31.589000 | 2021-09-14T07:08:35 | 2021-09-14T07:08:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.commercetools.api.models.product_discount;
import java.time.*;
import java.util.*;
import java.util.function.Function;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.commercetools.api.models.common.Money;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import io.vrap.rmf.base.client.utils.Generated;
@Generated(value = "io.vrap.rmf.codegen.rendring.CoreCodeGenerator", comments = "https://github.com/vrapio/rmf-codegen")
@JsonDeserialize(as = ProductDiscountValueAbsoluteDraftImpl.class)
public interface ProductDiscountValueAbsoluteDraft extends ProductDiscountValueDraft {
String ABSOLUTE = "absolute";
@NotNull
@Valid
@JsonProperty("money")
public List<Money> getMoney();
@JsonIgnore
public void setMoney(final Money... money);
public void setMoney(final List<Money> money);
public static ProductDiscountValueAbsoluteDraft of() {
return new ProductDiscountValueAbsoluteDraftImpl();
}
public static ProductDiscountValueAbsoluteDraft of(final ProductDiscountValueAbsoluteDraft template) {
ProductDiscountValueAbsoluteDraftImpl instance = new ProductDiscountValueAbsoluteDraftImpl();
instance.setMoney(template.getMoney());
return instance;
}
public static ProductDiscountValueAbsoluteDraftBuilder builder() {
return ProductDiscountValueAbsoluteDraftBuilder.of();
}
public static ProductDiscountValueAbsoluteDraftBuilder builder(final ProductDiscountValueAbsoluteDraft template) {
return ProductDiscountValueAbsoluteDraftBuilder.of(template);
}
default <T> T withProductDiscountValueAbsoluteDraft(Function<ProductDiscountValueAbsoluteDraft, T> helper) {
return helper.apply(this);
}
}
| UTF-8 | Java | 1,828 | java | ProductDiscountValueAbsoluteDraft.java | Java | [
{
"context": "oreCodeGenerator\", comments = \"https://github.com/vrapio/rmf-codegen\")\n@JsonDeserialize(as = ProductDiscou",
"end": 512,
"score": 0.9954796433448792,
"start": 506,
"tag": "USERNAME",
"value": "vrapio"
}
] | null | [] |
package com.commercetools.api.models.product_discount;
import java.time.*;
import java.util.*;
import java.util.function.Function;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.commercetools.api.models.common.Money;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import io.vrap.rmf.base.client.utils.Generated;
@Generated(value = "io.vrap.rmf.codegen.rendring.CoreCodeGenerator", comments = "https://github.com/vrapio/rmf-codegen")
@JsonDeserialize(as = ProductDiscountValueAbsoluteDraftImpl.class)
public interface ProductDiscountValueAbsoluteDraft extends ProductDiscountValueDraft {
String ABSOLUTE = "absolute";
@NotNull
@Valid
@JsonProperty("money")
public List<Money> getMoney();
@JsonIgnore
public void setMoney(final Money... money);
public void setMoney(final List<Money> money);
public static ProductDiscountValueAbsoluteDraft of() {
return new ProductDiscountValueAbsoluteDraftImpl();
}
public static ProductDiscountValueAbsoluteDraft of(final ProductDiscountValueAbsoluteDraft template) {
ProductDiscountValueAbsoluteDraftImpl instance = new ProductDiscountValueAbsoluteDraftImpl();
instance.setMoney(template.getMoney());
return instance;
}
public static ProductDiscountValueAbsoluteDraftBuilder builder() {
return ProductDiscountValueAbsoluteDraftBuilder.of();
}
public static ProductDiscountValueAbsoluteDraftBuilder builder(final ProductDiscountValueAbsoluteDraft template) {
return ProductDiscountValueAbsoluteDraftBuilder.of(template);
}
default <T> T withProductDiscountValueAbsoluteDraft(Function<ProductDiscountValueAbsoluteDraft, T> helper) {
return helper.apply(this);
}
}
| 1,828 | 0.77407 | 0.77407 | 53 | 33.471699 | 34.680538 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433962 | false | false | 13 |
a57eeebbc7500452d23bb6d36284b969aecefbf1 | 4,587,025,084,877 | 15bcb4ca18ea36f91b0c7d5c137937f397ccfb8f | /week-03/day-02/Graphics/src/Triangles.java | 9bd172a96c45855d17fe6144eca776943a8c601b | [] | no_license | green-fox-academy/Garlyle | https://github.com/green-fox-academy/Garlyle | 2a40d79ff671bc7ec66a4ff405cfe1869a1b1cce | 0dc8a2629d8f7515f7b592ce5d587e595dbea21f | refs/heads/master | 2021-06-19T11:39:28.411000 | 2017-07-11T11:08:03 | 2017-07-11T11:08:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javax.swing.*;
import java.awt.*;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
public class Triangles {
public static void mainDraw(Graphics graphics){
// reproduce this:
// [https://github.com/greenfox-academy/teaching-materials/blob/master/exercises/drawing/triangles/r5.png]
graphics.setColor(Color.black);
int size = 10;
int startX = 50;
int startY = 300;
int height = size * 2;
double vert_distance = height * 3 / 4;
double horz_distance = height * Math.sqrt(3) / 2;
for (int i = 0; i < 20; i++)
{
drawTriangle(graphics, startX + i * horz_distance, startY, size);
for (int j = 0; j < 19 - i; j++)
{
double x = startX + j * horz_distance + horz_distance * (i + 1) / 2;
double y = startY - (i + 1) * vert_distance;
drawTriangle(graphics, x, y, size);
}
}
}
private static void drawTriangle(Graphics graphics, double x, double y, int size) {
double [][] corners = new double[3][2];
for (int i = 0; i < 3; i++)
{
corners[i][0] = x + size * Math.cos(Math.PI / 180 * (30 + i * 120));
corners[i][1] = y + size * Math.sin(Math.PI / 180 * (30 + i * 120));
}
graphics.drawLine((int)corners[0][0], (int)corners[0][1], (int)corners[1][0], (int)corners[1][1]);
graphics.drawLine((int)corners[0][0], (int)corners[0][1], (int)corners[2][0], (int)corners[2][1]);
graphics.drawLine((int)corners[1][0], (int)corners[1][1], (int)corners[2][0], (int)corners[2][1]);
}
// Don't touch the code below
public static void main(String[] args) {
JFrame jFrame = new JFrame("Triangles");
jFrame.setSize(new Dimension(300, 300));
jFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
jFrame.add(new ImagePanel());
jFrame.setLocationRelativeTo(null);
jFrame.setVisible(true);
}
static class ImagePanel extends JPanel{
@Override
protected void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
mainDraw(graphics);
}
}
} | UTF-8 | Java | 2,031 | java | Triangles.java | Java | [
{
"context": " // reproduce this:\n // [https://github.com/greenfox-academy/teaching-materials/blob/master/exercises/drawing/",
"end": 234,
"score": 0.9764228463172913,
"start": 218,
"tag": "USERNAME",
"value": "greenfox-academy"
}
] | null | [] | import javax.swing.*;
import java.awt.*;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
public class Triangles {
public static void mainDraw(Graphics graphics){
// reproduce this:
// [https://github.com/greenfox-academy/teaching-materials/blob/master/exercises/drawing/triangles/r5.png]
graphics.setColor(Color.black);
int size = 10;
int startX = 50;
int startY = 300;
int height = size * 2;
double vert_distance = height * 3 / 4;
double horz_distance = height * Math.sqrt(3) / 2;
for (int i = 0; i < 20; i++)
{
drawTriangle(graphics, startX + i * horz_distance, startY, size);
for (int j = 0; j < 19 - i; j++)
{
double x = startX + j * horz_distance + horz_distance * (i + 1) / 2;
double y = startY - (i + 1) * vert_distance;
drawTriangle(graphics, x, y, size);
}
}
}
private static void drawTriangle(Graphics graphics, double x, double y, int size) {
double [][] corners = new double[3][2];
for (int i = 0; i < 3; i++)
{
corners[i][0] = x + size * Math.cos(Math.PI / 180 * (30 + i * 120));
corners[i][1] = y + size * Math.sin(Math.PI / 180 * (30 + i * 120));
}
graphics.drawLine((int)corners[0][0], (int)corners[0][1], (int)corners[1][0], (int)corners[1][1]);
graphics.drawLine((int)corners[0][0], (int)corners[0][1], (int)corners[2][0], (int)corners[2][1]);
graphics.drawLine((int)corners[1][0], (int)corners[1][1], (int)corners[2][0], (int)corners[2][1]);
}
// Don't touch the code below
public static void main(String[] args) {
JFrame jFrame = new JFrame("Triangles");
jFrame.setSize(new Dimension(300, 300));
jFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
jFrame.add(new ImagePanel());
jFrame.setLocationRelativeTo(null);
jFrame.setVisible(true);
}
static class ImagePanel extends JPanel{
@Override
protected void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
mainDraw(graphics);
}
}
} | 2,031 | 0.613491 | 0.577056 | 64 | 30.75 | 29.448578 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.828125 | false | false | 13 |
b4472cf5826db7ba211c1b06f09150374dac5d50 | 19,842,748,916,621 | d1f1a8ddf9ed6953d4f932eddd9a418707618b46 | /milton-cloud-server-api/src/main/java/io/milton/cloud/server/apps/website/SettingsMap.java | 3cdb8ef3127384383f8b2a209b161e0cce21489e | [] | no_license | FullMetal210/milton-cloud-1 | https://github.com/FullMetal210/milton-cloud-1 | ca18ade8dddeab514698886caa4eecb1b3563051 | fd1d0202cf9df63682398c8c0bd3563cb57788d6 | refs/heads/master | 2021-01-21T22:26:12.212000 | 2012-09-01T03:08:10 | 2012-09-01T03:08:10 | 5,464,046 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2012 McEvoy Software Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.milton.cloud.server.apps.website;
import io.milton.vfs.db.NvPair;
import io.milton.vfs.db.Repository;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
*
* @author brad
*/
public class SettingsMap implements Map<String, String> {
private final Repository repository;
public SettingsMap(Repository repository) {
this.repository = repository;
}
@Override
public String get(Object key) {
String s = repository.getAttribute(key.toString());
return s;
}
@Override
public int size() {
if (repository.getNvPairs() != null) {
return repository.getNvPairs().size();
} else {
return 0;
}
}
@Override
public boolean isEmpty() {
return size() == 0;
}
@Override
public boolean containsKey(Object key) {
return get(key) != null;
}
@Override
public boolean containsValue(Object value) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String put(String key, String value) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String remove(Object key) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void putAll(Map<? extends String, ? extends String> m) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void clear() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<String> keySet() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Collection<String> values() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<Entry<String, String>> entrySet() {
Set<Entry<String, String>> set = new HashSet<>();
if (repository.getNvPairs() != null) {
for (NvPair nv : repository.getNvPairs()) {
final NvPair pair = nv;
Entry<String, String> e = new Entry<String, String>() {
@Override
public String getKey() {
return pair.getName();
}
@Override
public String getValue() {
return pair.getPropValue();
}
@Override
public String setValue(String value) {
throw new UnsupportedOperationException("Not supported yet.");
}
};
set.add(e);
}
}
return set;
}
}
| UTF-8 | Java | 3,518 | java | SettingsMap.java | Java | [
{
"context": "util.Map;\nimport java.util.Set;\n\n/**\n *\n * @author brad\n */\npublic class SettingsMap implements Map<Strin",
"end": 925,
"score": 0.987284779548645,
"start": 921,
"tag": "USERNAME",
"value": "brad"
}
] | null | [] | /*
* Copyright 2012 McEvoy Software Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.milton.cloud.server.apps.website;
import io.milton.vfs.db.NvPair;
import io.milton.vfs.db.Repository;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
*
* @author brad
*/
public class SettingsMap implements Map<String, String> {
private final Repository repository;
public SettingsMap(Repository repository) {
this.repository = repository;
}
@Override
public String get(Object key) {
String s = repository.getAttribute(key.toString());
return s;
}
@Override
public int size() {
if (repository.getNvPairs() != null) {
return repository.getNvPairs().size();
} else {
return 0;
}
}
@Override
public boolean isEmpty() {
return size() == 0;
}
@Override
public boolean containsKey(Object key) {
return get(key) != null;
}
@Override
public boolean containsValue(Object value) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String put(String key, String value) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String remove(Object key) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void putAll(Map<? extends String, ? extends String> m) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void clear() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<String> keySet() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Collection<String> values() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<Entry<String, String>> entrySet() {
Set<Entry<String, String>> set = new HashSet<>();
if (repository.getNvPairs() != null) {
for (NvPair nv : repository.getNvPairs()) {
final NvPair pair = nv;
Entry<String, String> e = new Entry<String, String>() {
@Override
public String getKey() {
return pair.getName();
}
@Override
public String getValue() {
return pair.getPropValue();
}
@Override
public String setValue(String value) {
throw new UnsupportedOperationException("Not supported yet.");
}
};
set.add(e);
}
}
return set;
}
}
| 3,518 | 0.601194 | 0.599204 | 124 | 27.370968 | 24.282433 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.33871 | false | false | 13 |
526567b333c81553297f5bc501edf4b907fb7882 | 29,858,612,648,292 | 4619f11e317f0613a577cf5b770a3b46c022c12f | /lww_blog/src/com/stx/web/servlet/UserServlet.java | ce8b34d295fbf80d74b533c6991790f7526814c2 | [] | no_license | weijian-jianzhang/blog | https://github.com/weijian-jianzhang/blog | 7b3359b0bdf2d81b10357b767fed5cbb1260d9ee | e8edbb093d9bc7008641d9980f46d691b5ebf8b0 | refs/heads/master | 2020-12-01T16:21:47.613000 | 2019-12-29T03:10:21 | 2019-12-29T03:19:49 | 230,696,460 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.stx.web.servlet;
import com.stx.dao.impl.UserDaoImpl;
import com.stx.entity.User;
import com.stx.service.UserService;
import com.stx.service.impl.UserServiceImpl;
import com.stx.utils.MyDateConverter;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.Map;
@WebServlet("/userServlet")
public class UserServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("utf-8");
String cast = request.getParameter("cast");
User user=new User();
//获取所有请求参数
Map<String, String[]> map = request.getParameterMap();
UserService us = new UserServiceImpl();
UserDaoImpl ud = new UserDaoImpl();
switch (cast){
case "register":
System.out.println(request.getParameter("birthday"));
ConvertUtils.register(new MyDateConverter(), Date.class);
try {
BeanUtils.populate(user, map);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
System.out.println(user);
try {
us.register(user);
response.getWriter().print("<script>alert('注册成功,即将跳到登录页面');window.location.href='/blogsystem/login.jsp'</script>");
} catch (Exception e) {
e.printStackTrace();
response.getWriter().print("<script>alert('注册失败!请重新注册');window.location.href='/blogsystem/register.jsp'</script>");
}
break;
case "login":
try {
BeanUtils.populate(user,map);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
User loginUser = us.login(user);
if (loginUser!=null){
request.getSession().setAttribute("user",loginUser);
response.sendRedirect("/blogsystem/menu.jsp");
}else {
response.getWriter().print("<script>alert('用户名或密码错误!');window.location.href='/blogsystem/login.jsp'</script>");
}
break;
case "forget":
HttpSession session = request.getSession();
String userName = request.getParameter("userName");
user.setUserName(userName);
User forget = us.forget(user);
if (forget!= null) {
session.setAttribute("user", forget);
request.getRequestDispatcher("/blogsystem/forget2.jsp").forward(request, response);
} else {
response.getWriter().print("<script>alert('没有此用户!');window.location.href='/blogsystem/forget.jsp'</script>");
}
break;
case "forget2":
User user2 = (User)request.getSession().getAttribute("user");
System.out.println(user2);
userName = user2.getUserName();
String answer = request.getParameter("answer");
String passWord = request.getParameter("passWord");
user.setUserName(userName);
user.setAnswer(answer);
ud=new UserDaoImpl();
User user1 = us.forgetAnswer(user);
System.out.println(user1);
if (user1 != null) {
user1.setPassWord(passWord);
ud.forget(user1);
response.sendRedirect("/blogsystem/login.jsp");
} else {
response.getWriter().print("<script>alert('密保问题错误!');window.location.href='/blogsystem/forget.jsp'</script>");
}
break;
case "ajax":
String name=request.getParameter("name");
user = new User();
user.setUserName(name);
User u = ud.selectByUserName(user);
System.out.println(u);
if (u!=null){
response.getWriter().print("1");
}else {
response.getWriter().print("0");
}
break;
case "exit":
request.getSession().removeAttribute("user");
response.sendRedirect("/blogsystem/login.jsp");
break;
case "query":
Integer id = Integer.parseInt(request.getParameter("userid"));
User user3 = new UserDaoImpl().selectByUserId(new User(id));
request.setAttribute("user",user3);
request.getRequestDispatcher("/blogsystem/peoplecenter.jsp").forward(request,response);
break;
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
}
| UTF-8 | Java | 5,833 | java | UserServlet.java | Java | [
{
"context": "ter(\"userName\");\n user.setUserName(userName);\n User forget = us.forget(user);\n",
"end": 3170,
"score": 0.7960600256919861,
"start": 3162,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | package com.stx.web.servlet;
import com.stx.dao.impl.UserDaoImpl;
import com.stx.entity.User;
import com.stx.service.UserService;
import com.stx.service.impl.UserServiceImpl;
import com.stx.utils.MyDateConverter;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.Map;
@WebServlet("/userServlet")
public class UserServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("utf-8");
String cast = request.getParameter("cast");
User user=new User();
//获取所有请求参数
Map<String, String[]> map = request.getParameterMap();
UserService us = new UserServiceImpl();
UserDaoImpl ud = new UserDaoImpl();
switch (cast){
case "register":
System.out.println(request.getParameter("birthday"));
ConvertUtils.register(new MyDateConverter(), Date.class);
try {
BeanUtils.populate(user, map);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
System.out.println(user);
try {
us.register(user);
response.getWriter().print("<script>alert('注册成功,即将跳到登录页面');window.location.href='/blogsystem/login.jsp'</script>");
} catch (Exception e) {
e.printStackTrace();
response.getWriter().print("<script>alert('注册失败!请重新注册');window.location.href='/blogsystem/register.jsp'</script>");
}
break;
case "login":
try {
BeanUtils.populate(user,map);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
User loginUser = us.login(user);
if (loginUser!=null){
request.getSession().setAttribute("user",loginUser);
response.sendRedirect("/blogsystem/menu.jsp");
}else {
response.getWriter().print("<script>alert('用户名或密码错误!');window.location.href='/blogsystem/login.jsp'</script>");
}
break;
case "forget":
HttpSession session = request.getSession();
String userName = request.getParameter("userName");
user.setUserName(userName);
User forget = us.forget(user);
if (forget!= null) {
session.setAttribute("user", forget);
request.getRequestDispatcher("/blogsystem/forget2.jsp").forward(request, response);
} else {
response.getWriter().print("<script>alert('没有此用户!');window.location.href='/blogsystem/forget.jsp'</script>");
}
break;
case "forget2":
User user2 = (User)request.getSession().getAttribute("user");
System.out.println(user2);
userName = user2.getUserName();
String answer = request.getParameter("answer");
String passWord = request.getParameter("passWord");
user.setUserName(userName);
user.setAnswer(answer);
ud=new UserDaoImpl();
User user1 = us.forgetAnswer(user);
System.out.println(user1);
if (user1 != null) {
user1.setPassWord(passWord);
ud.forget(user1);
response.sendRedirect("/blogsystem/login.jsp");
} else {
response.getWriter().print("<script>alert('密保问题错误!');window.location.href='/blogsystem/forget.jsp'</script>");
}
break;
case "ajax":
String name=request.getParameter("name");
user = new User();
user.setUserName(name);
User u = ud.selectByUserName(user);
System.out.println(u);
if (u!=null){
response.getWriter().print("1");
}else {
response.getWriter().print("0");
}
break;
case "exit":
request.getSession().removeAttribute("user");
response.sendRedirect("/blogsystem/login.jsp");
break;
case "query":
Integer id = Integer.parseInt(request.getParameter("userid"));
User user3 = new UserDaoImpl().selectByUserId(new User(id));
request.setAttribute("user",user3);
request.getRequestDispatcher("/blogsystem/peoplecenter.jsp").forward(request,response);
break;
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
}
| 5,833 | 0.5573 | 0.554509 | 133 | 42.105263 | 28.545509 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.781955 | false | false | 13 |
1656c9843a99b56360f8332a63f02215737ff520 | 19,533,511,290,620 | 3a484a48762ca7f75ec4ccead7ff227f59b5114e | /demo3/src/main/java/com/cg/NGOPortalCrudApplication.java | 9f93c66df9b97a3c14cd9c18affbd23fbd6e47a6 | [] | no_license | harsha123e/NGOPortal | https://github.com/harsha123e/NGOPortal | a9851d60e7a326f65d6ca22de7063383cd37000a | e2398985063d6859608a361b350a3f7063972baf | refs/heads/master | 2023-05-08T19:28:12.896000 | 2021-05-25T14:37:22 | 2021-05-25T14:37:22 | 370,712,855 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cg;
import java.util.List;
import java.util.logging.Logger;
import org.hibernate.annotations.common.util.impl.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.cg.dao.AddressDao;
import com.cg.dao.AdminDao;
import com.cg.dao.DonorDao;
import com.cg.dao.EmployeeDao;
import com.cg.dao.NeedyPeopleDao;
import com.cg.model.Address;
import com.cg.model.Admin;
import com.cg.model.Donor;
import com.cg.model.Employee;
import com.cg.model.NeedyPeople;
@SpringBootApplication
public class NGOPortalCrudApplication implements CommandLineRunner {
@Autowired
AdminDao adminDao;
@Autowired
DonorDao donorDao;
@Autowired
EmployeeDao employeeDao;
@Autowired
NeedyPeopleDao needyPeopleDao;
@Autowired
AddressDao addressDao;
public static void main(String[] args) {
SpringApplication.run(NGOPortalCrudApplication.class, args);
}
public void run(String... args) throws Exception{
//System.out.println("Values getting inserted");
Admin a=new Admin();
a.setAdminId(1001);
a.setAdminUsername("Lavanya");
a.setAdminPassword("root");
//System.out.println("values inserted");
Admin a1=new Admin();
a1.setAdminId(1002);
a1.setAdminUsername("Akanksha");
a1.setAdminPassword("Bhaiyya");
adminDao.save(a);
adminDao.save(a1);
Address ad=new Address();
ad.setAddressId(101);
ad.setCity("Hyderabad");
ad.setLandmark("GVK");
ad.setPin("5091008");
ad.setState("Telangana");
addressDao.save(ad);
Address ad1=new Address();
ad1.setAddressId(102);
ad1.setCity("Kurnool");
ad1.setLandmark("N.R.Pet");
ad1.setPin("645749");
ad1.setState("AndhraPradesh");
addressDao.save(ad1);
Donor d=new Donor();
d.setDonorId(1);
d.setDonorName("Shaheen");
d.setDonorUsername("Shaheen Sheik");
d.setDonorEmail("ShaheenSheik@gmail.com");
d.setDonorPassword("sheik");
d.setDonorPhone("7013579142");
d.setAddress(ad);
donorDao.save(d);
Donor d1=new Donor();
d1.setDonorId(2);
d1.setDonorName("Srija");
d1.setDonorUsername("Srija Somavarapu");
d1.setDonorEmail("srisrija@gmail.com");
d1.setDonorPassword("siri");
d1.setDonorPhone("7013579145");
d1.setAddress(ad1);
donorDao.save(d1);
Employee emp=new Employee();
emp.setAddress(ad);
emp.setEmail("lavanya@gmail.com");
emp.setEmployeeId(501);
emp.setEmployeeName("Lavanya Pyatla");
emp.setUsername("lavanya");
emp.setPhone("9581942330");
emp.setPassword("pyatla");
employeeDao.save(emp);
Employee emp1=new Employee();
emp1.setAddress(ad1);
emp1.setEmail("hema@gmail.com");
emp1.setEmployeeId(502);
emp1.setEmployeeName("Hema Reddy");
emp1.setUsername("Hema");
emp1.setPhone("8498939728");
emp1.setPassword("siddu");
employeeDao.save(emp1);
NeedyPeople np=new NeedyPeople();
np.setFamilyIncome(15000);
np.setNeedyPersonId(201);
np.setNeedyPersonName("Anil");
np.setPhone("9885726295");
np.setAddress(ad1);
needyPeopleDao.save(np);
Admin adm=adminDao.findById(((int) 1001)).get();
System.out.println(adm);
Donor don=donorDao.findById((int) 1).get();
System.out.println(don);
Address add=addressDao.findById(101).get();
System.out.println(add);
adminDao.deleteById(1002);
List<Employee> employee=employeeDao.findAll();
System.out.println(employee);
Employee ep=employeeDao.findById(501).get();
ep.setUsername("Siri");
employeeDao.save(ep);
}
}
| UTF-8 | Java | 3,755 | java | NGOPortalCrudApplication.java | Java | [
{
"context": "\n\t\t\r\n\t\ta.setAdminId(1001);\r\n\t\ta.setAdminUsername(\"Lavanya\");\r\n\t\ta.setAdminPassword(\"root\");\r\n\t\t//System.out",
"end": 1290,
"score": 0.9996821880340576,
"start": 1283,
"tag": "USERNAME",
"value": "Lavanya"
},
{
"context": "tAdminUsername(\"Lavanya\... | null | [] | package com.cg;
import java.util.List;
import java.util.logging.Logger;
import org.hibernate.annotations.common.util.impl.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.cg.dao.AddressDao;
import com.cg.dao.AdminDao;
import com.cg.dao.DonorDao;
import com.cg.dao.EmployeeDao;
import com.cg.dao.NeedyPeopleDao;
import com.cg.model.Address;
import com.cg.model.Admin;
import com.cg.model.Donor;
import com.cg.model.Employee;
import com.cg.model.NeedyPeople;
@SpringBootApplication
public class NGOPortalCrudApplication implements CommandLineRunner {
@Autowired
AdminDao adminDao;
@Autowired
DonorDao donorDao;
@Autowired
EmployeeDao employeeDao;
@Autowired
NeedyPeopleDao needyPeopleDao;
@Autowired
AddressDao addressDao;
public static void main(String[] args) {
SpringApplication.run(NGOPortalCrudApplication.class, args);
}
public void run(String... args) throws Exception{
//System.out.println("Values getting inserted");
Admin a=new Admin();
a.setAdminId(1001);
a.setAdminUsername("Lavanya");
a.setAdminPassword("<PASSWORD>");
//System.out.println("values inserted");
Admin a1=new Admin();
a1.setAdminId(1002);
a1.setAdminUsername("Akanksha");
a1.setAdminPassword("<PASSWORD>");
adminDao.save(a);
adminDao.save(a1);
Address ad=new Address();
ad.setAddressId(101);
ad.setCity("Hyderabad");
ad.setLandmark("GVK");
ad.setPin("5091008");
ad.setState("Telangana");
addressDao.save(ad);
Address ad1=new Address();
ad1.setAddressId(102);
ad1.setCity("Kurnool");
ad1.setLandmark("N.R.Pet");
ad1.setPin("645749");
ad1.setState("AndhraPradesh");
addressDao.save(ad1);
Donor d=new Donor();
d.setDonorId(1);
d.setDonorName("Shaheen");
d.setDonorUsername("Shaheen Sheik");
d.setDonorEmail("<EMAIL>");
d.setDonorPassword("<PASSWORD>");
d.setDonorPhone("7013579142");
d.setAddress(ad);
donorDao.save(d);
Donor d1=new Donor();
d1.setDonorId(2);
d1.setDonorName("Srija");
d1.setDonorUsername("Srija Somavarapu");
d1.setDonorEmail("<EMAIL>");
d1.setDonorPassword("<PASSWORD>");
d1.setDonorPhone("7013579145");
d1.setAddress(ad1);
donorDao.save(d1);
Employee emp=new Employee();
emp.setAddress(ad);
emp.setEmail("<EMAIL>");
emp.setEmployeeId(501);
emp.setEmployeeName("<NAME>");
emp.setUsername("lavanya");
emp.setPhone("9581942330");
emp.setPassword("<PASSWORD>");
employeeDao.save(emp);
Employee emp1=new Employee();
emp1.setAddress(ad1);
emp1.setEmail("<EMAIL>");
emp1.setEmployeeId(502);
emp1.setEmployeeName("<NAME>");
emp1.setUsername("Hema");
emp1.setPhone("8498939728");
emp1.setPassword("<PASSWORD>");
employeeDao.save(emp1);
NeedyPeople np=new NeedyPeople();
np.setFamilyIncome(15000);
np.setNeedyPersonId(201);
np.setNeedyPersonName("Anil");
np.setPhone("9885726295");
np.setAddress(ad1);
needyPeopleDao.save(np);
Admin adm=adminDao.findById(((int) 1001)).get();
System.out.println(adm);
Donor don=donorDao.findById((int) 1).get();
System.out.println(don);
Address add=addressDao.findById(101).get();
System.out.println(add);
adminDao.deleteById(1002);
List<Employee> employee=employeeDao.findAll();
System.out.println(employee);
Employee ep=employeeDao.findById(501).get();
ep.setUsername("Siri");
employeeDao.save(ep);
}
}
| 3,729 | 0.69747 | 0.65992 | 144 | 24.076389 | 15.448876 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.243056 | false | false | 13 |
a9b80c3a1e7b5d055e444342509b7a8be9ca6a35 | 17,497,696,775,928 | d7e7897bc96f5194c47c52d5877e9419ab623947 | /src/exercise14.java | 4f260987f62993335d1746a7a343fca04077ad54 | [] | no_license | alexvorak/Vorakrajangthiti-cop3330-ex14 | https://github.com/alexvorak/Vorakrajangthiti-cop3330-ex14 | a52a17140ba36d0c41e97e34672e7ed6b9827778 | 7bf41018334bd2098cd45e41d2bdf5264fdfcd95 | refs/heads/master | 2023-07-27T19:37:55.116000 | 2021-09-14T01:26:56 | 2021-09-14T01:26:56 | 406,179,219 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* UCF COP3330 FALL 2021 Assignment 1 Solution
* Copyright 2021 Alex Vorakrajangthiti
*/
import java.util.Scanner;
public class exercise14 {
public static void main(String[] args) {
System.out.printf("What is the order amount? ");
Scanner scanner = new Scanner(System.in);
String amount = scanner.nextLine();
float newPrin = Float.parseFloat(amount);
System.out.print("What is the state? ");
Scanner scanner1 = new Scanner(System.in);
String state = scanner1.nextLine();
double WITAX = (0.055 * newPrin) + newPrin;
if (state.equals("WI")) {
System.out.printf("The subtotal is $%s.\nThe tax is $0.55.\nThe total is $%.2f.",amount,WITAX);
System.exit(0);
}
System.out.printf("The total is $%.2f.", newPrin);
}
} | UTF-8 | Java | 844 | java | exercise14.java | Java | [
{
"context": " FALL 2021 Assignment 1 Solution\n * Copyright 2021 Alex Vorakrajangthiti\n */\n\nimport java.util.Scanner;\n\npublic class exer",
"end": 89,
"score": 0.9998856782913208,
"start": 68,
"tag": "NAME",
"value": "Alex Vorakrajangthiti"
}
] | null | [] | /*
* UCF COP3330 FALL 2021 Assignment 1 Solution
* Copyright 2021 <NAME>
*/
import java.util.Scanner;
public class exercise14 {
public static void main(String[] args) {
System.out.printf("What is the order amount? ");
Scanner scanner = new Scanner(System.in);
String amount = scanner.nextLine();
float newPrin = Float.parseFloat(amount);
System.out.print("What is the state? ");
Scanner scanner1 = new Scanner(System.in);
String state = scanner1.nextLine();
double WITAX = (0.055 * newPrin) + newPrin;
if (state.equals("WI")) {
System.out.printf("The subtotal is $%s.\nThe tax is $0.55.\nThe total is $%.2f.",amount,WITAX);
System.exit(0);
}
System.out.printf("The total is $%.2f.", newPrin);
}
} | 829 | 0.60545 | 0.57346 | 28 | 29.178572 | 26.22438 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.535714 | false | false | 13 |
1013b95cd0ba4f344e4a4cee0e8b9e776603eef9 | 17,497,696,773,123 | 069bdab8fa50655e8d1d0f0e09edc7ca5b116595 | /ap/ExerciciosN1/src/bll/Exercicio10.java | 6a85f57c118fa0105402fff2cfc90ccc5481e6f3 | [
"MIT"
] | permissive | Viniciusalopes/ads20192-modulo1 | https://github.com/Viniciusalopes/ads20192-modulo1 | 02db61eb0b50d24898d88c5eb5948606e55646a6 | 006d1d589092059446c73c0da62c804ff9f9846b | refs/heads/master | 2022-04-04T22:04:13.783000 | 2020-02-11T22:54:42 | 2020-02-11T22:54:42 | 206,060,197 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* ---------------------------------------------------------------------------------------
* Licença : MIT - Copyright 2019 Viniciusalopes (Vovolinux) <suporte@vovolinux.com.br>
* Criado em : 19/09/2019
* Projeto : ExerciciosN1
* Finalidade: N1
* ---------------------------------------------------------------------------------------
*/
package bll;
import java.util.Scanner;
/**
* 10. Ler uma temperatura em graus Fahrenheit e apresentá-la convertida em
* graus Celsius. A fórmula de conversão de temperatura a ser utilizada é C = (F
* - 32) * 5 / 9, em que a variável F é a temperatura em graus Fahrenheit e a
* variável C é a temperatura em graus Celsius.
*/
public class Exercicio10 {
public static void main(String[] args) {
vai();
}
public static void vai() {
// Variaveis
Scanner sc = new Scanner(System.in);
double f, c;
// Entrada
System.out.println();
System.out.print("Digite uma temperatura em graus Fahrenheit (°F): ");
f = sc.nextDouble();
// Processamento
c = (f - 32.0) * 5 / 9.0;
// Saída
System.out.println();
System.out.printf("%.1f°F correspondem a %.1f°C.\n", f, c);
}
}
| UTF-8 | Java | 1,251 | java | Exercicio10.java | Java | [
{
"context": " MIT - Copyright 2019 Viniciusalopes (Vovolinux) <suporte@vovolinux.com.br>\n * Criado em : 19/09/2019\n * Projeto : Exercic",
"end": 182,
"score": 0.9999209642410278,
"start": 158,
"tag": "EMAIL",
"value": "suporte@vovolinux.com.br"
}
] | null | [] | /*
* ---------------------------------------------------------------------------------------
* Licença : MIT - Copyright 2019 Viniciusalopes (Vovolinux) <<EMAIL>>
* Criado em : 19/09/2019
* Projeto : ExerciciosN1
* Finalidade: N1
* ---------------------------------------------------------------------------------------
*/
package bll;
import java.util.Scanner;
/**
* 10. Ler uma temperatura em graus Fahrenheit e apresentá-la convertida em
* graus Celsius. A fórmula de conversão de temperatura a ser utilizada é C = (F
* - 32) * 5 / 9, em que a variável F é a temperatura em graus Fahrenheit e a
* variável C é a temperatura em graus Celsius.
*/
public class Exercicio10 {
public static void main(String[] args) {
vai();
}
public static void vai() {
// Variaveis
Scanner sc = new Scanner(System.in);
double f, c;
// Entrada
System.out.println();
System.out.print("Digite uma temperatura em graus Fahrenheit (°F): ");
f = sc.nextDouble();
// Processamento
c = (f - 32.0) * 5 / 9.0;
// Saída
System.out.println();
System.out.printf("%.1f°F correspondem a %.1f°C.\n", f, c);
}
}
| 1,234 | 0.51454 | 0.490307 | 42 | 28.476191 | 28.639166 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 13 |
521fd2e6a38aa42fe3b70c051741ec38195b24a2 | 13,271,448,973,264 | 073523ce9f4743010dc133a18fa934887aee82f5 | /src/test/java/com/bretpatterson/schemagen/graphql/relay/controller/UserDTO.java | b88e6f0648823e95c5a1f7c5536420da3b7d07f1 | [
"MIT"
] | permissive | shawn-liu-rft/schemagen-graphql | https://github.com/shawn-liu-rft/schemagen-graphql | b7556ca69fef59f12c3b7c25950ccff53d685383 | 6f16fac5e01bfe97deeebb00bd2726bb5c3403f5 | refs/heads/master | 2021-09-22T19:20:53.288000 | 2018-09-14T12:49:08 | 2018-09-14T12:49:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bretpatterson.schemagen.graphql.relay.controller;
import com.bretpatterson.schemagen.graphql.relay.INode;
import com.bretpatterson.schemagen.graphql.annotations.GraphQLName;
/**
* Created by bpatterson on 1/30/16.
*/
@GraphQLName(name="User")
public class UserDTO implements INode {
private String id;
private String name;
private String email;
@Override
public String getId() {
return id;
}
public UserDTO setId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public UserDTO setName(String name) {
this.name = name;
return this;
}
public String getEmail() {
return email;
}
public UserDTO setEmail(String email) {
this.email = email;
return this;
}
}
| UTF-8 | Java | 748 | java | UserDTO.java | Java | [
{
"context": "raphql.annotations.GraphQLName;\n\n/**\n * Created by bpatterson on 1/30/16.\n */\n@GraphQLName(name=\"User\")\npublic ",
"end": 217,
"score": 0.9994845986366272,
"start": 207,
"tag": "USERNAME",
"value": "bpatterson"
}
] | null | [] | package com.bretpatterson.schemagen.graphql.relay.controller;
import com.bretpatterson.schemagen.graphql.relay.INode;
import com.bretpatterson.schemagen.graphql.annotations.GraphQLName;
/**
* Created by bpatterson on 1/30/16.
*/
@GraphQLName(name="User")
public class UserDTO implements INode {
private String id;
private String name;
private String email;
@Override
public String getId() {
return id;
}
public UserDTO setId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public UserDTO setName(String name) {
this.name = name;
return this;
}
public String getEmail() {
return email;
}
public UserDTO setEmail(String email) {
this.email = email;
return this;
}
}
| 748 | 0.715241 | 0.708556 | 47 | 14.914893 | 17.266165 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.042553 | false | false | 13 |
90a484f347547ccbbd5c491af96cd346a4a6fdca | 7,284,264,536,962 | 38ed2a3f66d64e43c16f7a120726945b1eb0f06b | /geekbrains_java_beginners/block2/src/classwork/ZeroToN.java | 8b51b751d34e8a57a884632c6301561122153991 | [] | no_license | mursigkeit22/java_study | https://github.com/mursigkeit22/java_study | b970dc6ea785f0c4a3ddf45d717a1b987a051ad4 | e981fc21c8414a904908bd6900d7f3fb7b97d32b | refs/heads/master | 2022-12-28T20:21:50.443000 | 2020-04-25T15:30:17 | 2020-04-25T15:30:17 | 258,808,900 | 0 | 0 | null | false | 2020-10-13T21:30:09 | 2020-04-25T15:26:36 | 2020-04-25T15:30:40 | 2020-10-13T21:30:07 | 97 | 0 | 0 | 1 | Java | false | false | package classwork;
import java.util.Scanner;
public class ZeroToN {
public static void main(String[] args) {
Scanner userInput = new Scanner(System.in);
System.out.println("Enter last number: ");
int limit = userInput.nextInt();
userInput.close();
int counter = 0;
System.out.println("Even numbers: ");
while (counter <= limit){
if (counter % 2 == 0) {
System.out.println(counter);
}
counter++;
}
}
}
| UTF-8 | Java | 528 | java | ZeroToN.java | Java | [] | null | [] | package classwork;
import java.util.Scanner;
public class ZeroToN {
public static void main(String[] args) {
Scanner userInput = new Scanner(System.in);
System.out.println("Enter last number: ");
int limit = userInput.nextInt();
userInput.close();
int counter = 0;
System.out.println("Even numbers: ");
while (counter <= limit){
if (counter % 2 == 0) {
System.out.println(counter);
}
counter++;
}
}
}
| 528 | 0.537879 | 0.532197 | 21 | 24.142857 | 17.066496 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 13 |
027672295ea83eb76fc3641a79c42d5baca71189 | 21,500,606,290,477 | 2543a62c4274a1d5632e8d494d190d02476ddb13 | /app/src/main/java/com/exchange/client/welcome/WelcomeActivity.java | abe3122369cd8c4df0313672660b29bae3b419e7 | [] | no_license | spykjl/client | https://github.com/spykjl/client | f2d42dfae8c32596b215ec75c6ff8b9b88b25c90 | bbfcd8e9a0e885aa73aafd63b4c5a9212b1a1786 | refs/heads/master | 2021-01-10T03:38:54.155000 | 2016-03-17T02:43:59 | 2016-03-17T02:43:59 | 54,016,772 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.exchange.client.welcome;
import android.os.Bundle;
import com.exchange.client.R;
import com.exchange.client.ui.BaseActivity;
/**
* 欢迎页面(新手引导)
*/
public class WelcomeActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
initView();
initListener();
}
@Override
protected void initView() {
}
@Override
protected void initListener() {
}
@Override
protected void onDestroy(){
super.onDestroy();
}
}
| UTF-8 | Java | 642 | java | WelcomeActivity.java | Java | [] | null | [] | package com.exchange.client.welcome;
import android.os.Bundle;
import com.exchange.client.R;
import com.exchange.client.ui.BaseActivity;
/**
* 欢迎页面(新手引导)
*/
public class WelcomeActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
initView();
initListener();
}
@Override
protected void initView() {
}
@Override
protected void initListener() {
}
@Override
protected void onDestroy(){
super.onDestroy();
}
}
| 642 | 0.658147 | 0.658147 | 36 | 16.388889 | 17.243803 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 13 |
9da558ba9543b672f13000db77c2d5e123745558 | 21,500,606,293,319 | 3dd19a17ffef91061df6f17a2c2994b653ba9293 | /forceful-ascension/src/org/usfirst/frc/team2035/robot/commands/auto/AutoValues.java | 0ca5111a20e651f2cb65c6fb2e4b0e99908f4703 | [] | no_license | CarmelRobotics/forceful-ascension | https://github.com/CarmelRobotics/forceful-ascension | ae4686442b08ffabfa2b2bd66deb548c9566f9e4 | 4579fe8e31395eff72adfc4d125cfa8ee4eff816 | refs/heads/master | 2021-05-12T11:33:12.630000 | 2019-10-11T18:40:43 | 2019-10-11T18:40:43 | 117,376,393 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc.team2035.robot.commands.auto;
/**
* the best
* System: STARTSFROM_GOESTO_VALUETYPE (START_BRIDGE_SPD stores the speed for the movement going from the starting positions to the "bridge" area)
* bridge: the small area between the starting positions and the switches
*/
public class AutoValues {
public static final boolean COMPLEX_AUTO = false;
public static final double ENCODER_ADJUSTMENT = .32; //.1155, current is .32
public static final double DEFAULT_TURN_SPEED = 0.5;
public static final double DEFAULT_MOVE_SPEED = 0.7;
public static final double SLOW_MOVE_SPEED = 0.6;
public static final double TURN90_RIGHT_INCHES = (28.75/2)*(Math.PI); //20, current is (28.75/2)*Math.PI
//public static final double TURN90_RIGHT_SPEED = 0.7;
public static final double TURN90_LEFT_INCHES = -1*(28.75/2)*(Math.PI);
//public static final double TURN90_LEFT_SPEED = 0.7;
public static final double STARTPOS_SWITCHSIDE_INCHES = 168+10; //168
//public static final double STARTPOS_SWITCHSIDE_SPEED = 0.8;
//public static final double SWITCHSIDE_APPROACH_INCHES = 150; //10'
//public static final double SWITCHSIDE_APPROACH_SPEED = 0.5;
public static final double STARTPOS2_RIGHTSWITCHFRONT_INCHES = 60; //right-switch-front
//public static final double STARTPOS2_RIGHTSWITCHFRONT_SPEED = 0.8;
public static final double SWITCHFRONT_APPROACH_INCHES = 60; //right-switch-front
//public static final double SWITCHFRONT_APPROACH_SPEED = 0.5;
public static final double RIGHTSWITCHFRONT_LEFTSWITCHFRONT_INCHES = 135; //right-switch-front
//public static final double RIGHTSWITCHFRONT_LEFTSWITCHFRONT_SPEED = 0.8;
public static final double POSITIONFRONT_OPPOSITESWITCHFRONT_INCHES = 180;
} | UTF-8 | Java | 2,234 | java | AutoValues.java | Java | [] | null | [] | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc.team2035.robot.commands.auto;
/**
* the best
* System: STARTSFROM_GOESTO_VALUETYPE (START_BRIDGE_SPD stores the speed for the movement going from the starting positions to the "bridge" area)
* bridge: the small area between the starting positions and the switches
*/
public class AutoValues {
public static final boolean COMPLEX_AUTO = false;
public static final double ENCODER_ADJUSTMENT = .32; //.1155, current is .32
public static final double DEFAULT_TURN_SPEED = 0.5;
public static final double DEFAULT_MOVE_SPEED = 0.7;
public static final double SLOW_MOVE_SPEED = 0.6;
public static final double TURN90_RIGHT_INCHES = (28.75/2)*(Math.PI); //20, current is (28.75/2)*Math.PI
//public static final double TURN90_RIGHT_SPEED = 0.7;
public static final double TURN90_LEFT_INCHES = -1*(28.75/2)*(Math.PI);
//public static final double TURN90_LEFT_SPEED = 0.7;
public static final double STARTPOS_SWITCHSIDE_INCHES = 168+10; //168
//public static final double STARTPOS_SWITCHSIDE_SPEED = 0.8;
//public static final double SWITCHSIDE_APPROACH_INCHES = 150; //10'
//public static final double SWITCHSIDE_APPROACH_SPEED = 0.5;
public static final double STARTPOS2_RIGHTSWITCHFRONT_INCHES = 60; //right-switch-front
//public static final double STARTPOS2_RIGHTSWITCHFRONT_SPEED = 0.8;
public static final double SWITCHFRONT_APPROACH_INCHES = 60; //right-switch-front
//public static final double SWITCHFRONT_APPROACH_SPEED = 0.5;
public static final double RIGHTSWITCHFRONT_LEFTSWITCHFRONT_INCHES = 135; //right-switch-front
//public static final double RIGHTSWITCHFRONT_LEFTSWITCHFRONT_SPEED = 0.8;
public static final double POSITIONFRONT_OPPOSITESWITCHFRONT_INCHES = 180;
} | 2,234 | 0.66607 | 0.625336 | 48 | 45.5625 | 37.792145 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.145833 | false | false | 13 |
d46f283b4fa91fa54245ac6b4675adc0793435e5 | 21,500,606,294,311 | 144ffe43bd1243ca0ec18dc5e1ba4a11ff2bcfa1 | /src/main/java/com/subwaytrip/app/model/domain/StarRatingPK.java | c043d8259a0feef6377e309900b2ecad54f66a7f | [] | no_license | bh-96/subway-trip | https://github.com/bh-96/subway-trip | 2f58344091c51e9fcbacaf89277428cdb33c92c6 | 949c6a6769f85b1241eace2fc1c66b2e9685b09f | refs/heads/master | 2023-03-30T19:28:51.395000 | 2021-04-06T00:38:21 | 2021-04-06T00:38:21 | 324,959,005 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.subwaytrip.app.model.domain;
import lombok.Data;
import javax.persistence.Column;
import java.io.Serializable;
@Data
public class StarRatingPK implements Serializable {
@Column(name = "LINE_NAME")
private String lineName;
@Column(name = "STATION_NAME")
private String stationName;
} | UTF-8 | Java | 316 | java | StarRatingPK.java | Java | [] | null | [] | package com.subwaytrip.app.model.domain;
import lombok.Data;
import javax.persistence.Column;
import java.io.Serializable;
@Data
public class StarRatingPK implements Serializable {
@Column(name = "LINE_NAME")
private String lineName;
@Column(name = "STATION_NAME")
private String stationName;
} | 316 | 0.743671 | 0.743671 | 17 | 17.647058 | 17.087805 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 13 |
b81a05a17b4e32624bf7e98a5f66d36d7e012231 | 8,332,236,586,013 | 1bdd00ee0f7106610bae5fae25d85ea3cb1cb6a1 | /khialeRahat_androidApp/app/src/main/java/com/example/khialerahat/experts_khialerahat/MPlayer_CounterDown.java | bac611458c90add942da6ecc84d93659a84eb6fc | [] | no_license | yarzamanmilad/androidApp | https://github.com/yarzamanmilad/androidApp | 8f7e164c4a10fb4821553b7b8499f4204f8aeb8c | 0c894b4023135cbd565e037386dc6aa86fade875 | refs/heads/main | 2023-01-22T21:52:19.416000 | 2020-11-17T11:46:41 | 2020-11-17T11:46:41 | 313,590,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.khialerahat.experts_khialerahat;
import android.media.MediaPlayer;
import android.os.CountDownTimer;
public class MPlayer_CounterDown
{
public static long current_time_sms_recive;
public static MediaPlayer mediaPlayer,mediaPlayer_security_panel;
public static CountDownTimer countDownTimer,counterdown_when_user_not_response,counterdown_security_panel;
}
| UTF-8 | Java | 387 | java | MPlayer_CounterDown.java | Java | [
{
"context": "package com.example.khialerahat.experts_khialerahat;\n\nimport android.media.MediaP",
"end": 31,
"score": 0.8216748237609863,
"start": 20,
"tag": "USERNAME",
"value": "khialerahat"
}
] | null | [] | package com.example.khialerahat.experts_khialerahat;
import android.media.MediaPlayer;
import android.os.CountDownTimer;
public class MPlayer_CounterDown
{
public static long current_time_sms_recive;
public static MediaPlayer mediaPlayer,mediaPlayer_security_panel;
public static CountDownTimer countDownTimer,counterdown_when_user_not_response,counterdown_security_panel;
}
| 387 | 0.829457 | 0.829457 | 11 | 34.18182 | 32.71035 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 13 |
55c153dd961388d4968c204173e79028965951d9 | 34,900,904,247,897 | a20f252103fcdf2772dfcfd5abb4e27d83870d31 | /app/src/main/java/com/example/pindahfragment/MainFragment.java | eed5a9793b0b87e977301fca7c5e658c98e5bca2 | [] | no_license | fandofastest/PindahFragment | https://github.com/fandofastest/PindahFragment | 7634564e1a85d1ab1e0270b9d104677e6f01f0c3 | dfe9fd2bc56c9c27ea86e9d1572d996f65649983 | refs/heads/master | 2023-04-01T14:30:39.655000 | 2021-04-09T09:16:29 | 2021-04-09T09:16:29 | 355,136,224 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.pindahfragment;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
/**
* A simple {@link Fragment} subclass.
* Use the {@link MainFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MainFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
Button pindahaktifiti,pindahfragment,pindahobjek;
EditText inputdata;
public MainFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment MainFragment.
*/
// TODO: Rename and change types and number of parameters
public static MainFragment newInstance(String param1, String param2) {
MainFragment fragment = new MainFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
pindahaktifiti=view.findViewById(R.id.bpindah);
pindahfragment=view.findViewById(R.id.bpindahfragment);
inputdata=view.findViewById(R.id.inputdata);
pindahobjek=view.findViewById(R.id.pindahobjek);
pindahaktifiti.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent= new Intent(getContext(),SecondActivity.class);
intent.putExtra("data1",inputdata.getText().toString());
startActivity(intent);
}
});
pindahfragment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.frame, BlankFragment.newInstance(inputdata.getText().toString()));
ft.addToBackStack(null);
ft.commit();
}
});
pindahobjek.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Mahasiswa mahasiswa = new Mahasiswa();
mahasiswa.setNama(inputdata.getText().toString());
mahasiswa.setNohp("000000");
mahasiswa.setAlamat("jalan todak");
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.frame, ObjectFragment.newInstance(mahasiswa));
ft.addToBackStack(null);
ft.commit();
}
});
}
} | UTF-8 | Java | 4,098 | java | MainFragment.java | Java | [] | null | [] | package com.example.pindahfragment;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
/**
* A simple {@link Fragment} subclass.
* Use the {@link MainFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MainFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
Button pindahaktifiti,pindahfragment,pindahobjek;
EditText inputdata;
public MainFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment MainFragment.
*/
// TODO: Rename and change types and number of parameters
public static MainFragment newInstance(String param1, String param2) {
MainFragment fragment = new MainFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
pindahaktifiti=view.findViewById(R.id.bpindah);
pindahfragment=view.findViewById(R.id.bpindahfragment);
inputdata=view.findViewById(R.id.inputdata);
pindahobjek=view.findViewById(R.id.pindahobjek);
pindahaktifiti.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent= new Intent(getContext(),SecondActivity.class);
intent.putExtra("data1",inputdata.getText().toString());
startActivity(intent);
}
});
pindahfragment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.frame, BlankFragment.newInstance(inputdata.getText().toString()));
ft.addToBackStack(null);
ft.commit();
}
});
pindahobjek.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Mahasiswa mahasiswa = new Mahasiswa();
mahasiswa.setNama(inputdata.getText().toString());
mahasiswa.setNohp("000000");
mahasiswa.setAlamat("jalan todak");
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.frame, ObjectFragment.newInstance(mahasiswa));
ft.addToBackStack(null);
ft.commit();
}
});
}
} | 4,098 | 0.650561 | 0.643973 | 120 | 33.158333 | 25.449295 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.566667 | false | false | 13 |
a3c32cafafb0c13d190d0b1a81eebe5b201ad63e | 15,229,954,050,255 | 7665caee2ef5df11e7a62bb1a4174dac3b2c0e8f | /Test1/src/Main/CTomasTest1.java | 2e9ba9d3de2ec2c9fd772e9df75e3655c5826bce | [] | no_license | ninfarave/Test1 | https://github.com/ninfarave/Test1 | dc1a6a615fa1c6d1ef76a670c652cda19aabd132 | 2e5714121ed4e8ba7e6bc77ab7c7749aed2444fa | refs/heads/master | 2021-01-01T20:48:19.868000 | 2013-06-03T02:58:23 | 2013-06-03T02:58:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Main;
public class CTomasTest1 {
void Show() {
System.out.println( "Show Tomás Test1" );
}
}
| WINDOWS-1250 | Java | 127 | java | CTomasTest1.java | Java | [] | null | [] | package Main;
public class CTomasTest1 {
void Show() {
System.out.println( "Show Tomás Test1" );
}
}
| 127 | 0.563492 | 0.547619 | 11 | 9.454545 | 13.214067 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 |
7f06f9bb24877bcbbfb136c1a780aa616c551b36 | 34,909,494,182,664 | c411348df6650fea43d1ec2f2897e92bdd9af944 | /src/models/ProjectList.java | 688aafa664cd68eaf1fe889754c98536ed2251df | [] | no_license | ehltmn/Individual-Project | https://github.com/ehltmn/Individual-Project | f5514f50c033952e169e44cae13da91e905341bf | e8060b309a09210ee50e5303ae7d2abe71ba1ae7 | refs/heads/master | 2020-08-24T03:04:08.871000 | 2019-10-11T15:16:09 | 2019-10-11T15:16:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package models;
import java.util.ArrayList;
public class ProjectList {
private ArrayList<Project> proList;
public ProjectList() {
setproList(new ArrayList<Project>());
}
public ArrayList<Project>getproList() {
return proList;
}
public void setproList(ArrayList<Project> proList) {
this.proList = proList;
}
}
| UTF-8 | Java | 334 | java | ProjectList.java | Java | [] | null | [] | package models;
import java.util.ArrayList;
public class ProjectList {
private ArrayList<Project> proList;
public ProjectList() {
setproList(new ArrayList<Project>());
}
public ArrayList<Project>getproList() {
return proList;
}
public void setproList(ArrayList<Project> proList) {
this.proList = proList;
}
}
| 334 | 0.718563 | 0.718563 | 22 | 14.181818 | 16.364141 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.045455 | false | false | 13 |
607e0a46cd346b9727088c4fce2079e1ed91be9a | 5,325,759,509,918 | 908c78c138aa054679672bb3cba3286beb263595 | /CodingInterview.Java | da9e10f95d5ab90fedff10eabf6e5a5bcc103f3b | [] | no_license | micbentz/Code-Prep | https://github.com/micbentz/Code-Prep | 6384e1da1cc845fac2609252efad03c36f1f3f7c | 582ad06779e5d1ea027a9c43bf2a15b8830567bb | refs/heads/master | 2017-01-06T08:11:03.474000 | 2015-10-06T17:38:03 | 2015-10-06T17:38:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class CodingInterview{
public static void main(String[] args){
boolean done = false;
int choice;
Scanner sc = new Scanner(System.in);
ArraysAndStrings arrayNstrings = new ArraysAndStrings();
arrayNstrings.hello();
while(!done){
System.out.println("\n" + "Pick from the following menu: ");
System.out.println("1: Unique Characters test");
System.out.println("2: Permutation test");
System.out.println("3: Replace Spaces");
System.out.println("4: Quit");
choice = sc.nextInt();
switch(choice){
case 1: arrayNstrings.uniqueCharTest();
break;
case 2: arrayNstrings.permutationTest();
break;
case 3: arrayNstrings.replaceSpacesTest();
break;
case 4: arrayNstrings.quit();
done = true;
break;
default: System.out.println("Invalid choice");
break;
}
}
}
}
| UTF-8 | Java | 884 | java | CodingInterview.Java | Java | [] | null | [] | import java.util.Scanner;
public class CodingInterview{
public static void main(String[] args){
boolean done = false;
int choice;
Scanner sc = new Scanner(System.in);
ArraysAndStrings arrayNstrings = new ArraysAndStrings();
arrayNstrings.hello();
while(!done){
System.out.println("\n" + "Pick from the following menu: ");
System.out.println("1: Unique Characters test");
System.out.println("2: Permutation test");
System.out.println("3: Replace Spaces");
System.out.println("4: Quit");
choice = sc.nextInt();
switch(choice){
case 1: arrayNstrings.uniqueCharTest();
break;
case 2: arrayNstrings.permutationTest();
break;
case 3: arrayNstrings.replaceSpacesTest();
break;
case 4: arrayNstrings.quit();
done = true;
break;
default: System.out.println("Invalid choice");
break;
}
}
}
}
| 884 | 0.659502 | 0.650452 | 34 | 25 | 18.256344 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.411765 | false | false | 13 |
eb7783e33bf27c2006f248018bad317c12fdd4f2 | 33,852,932,234,881 | bd667ae597288a86706046bb54b4b15b1a40f893 | /src/main/java/fsoc/ApparatusHelper.java | 29fe1fc8dae6b6bdb8af52e94a8b9a49b8c7f47c | [] | no_license | fsoc/Apparatus | https://github.com/fsoc/Apparatus | 93f3155661f3be187385bba18ebe5d948bf0bebf | 8460691eb8e3d3f9d8422c05f0aa04231f636418 | refs/heads/master | 2022-04-30T01:45:40.435000 | 2016-04-11T15:00:52 | 2016-04-11T15:00:52 | 55,603,157 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Helper functions for the Apparatus class.
*/
package fsoc;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
public class ApparatusHelper {
static final int MOD = 1000003;
/**
* Multiplies the factorials of the different sets based of the number of them found.
*/
public static long multiply(Map<String, Integer> setCounter) {
// Make an error check of the pictures, if an error is found 0 wirings match all pictures.
long wirings = 1;
Iterator<Map.Entry<String, Integer>> it = setCounter.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Integer> pair = it.next();
// Only add values >1 since 0! = 1! = 1
if (pair.getValue() > 1) {
wirings = (wirings * moduloFactorial(pair.getValue(), MOD)) % MOD;
}
}
return wirings;
}
/**
* Factorial using modulo.
*/
public static long moduloFactorial(int n, int modulo) {
long result = 1;
while (n != 0) {
result = (result * n) % modulo;
n--;
}
return result;
}
/**
* Only flips the first n bits of the number
*/
public static String flippedBits(BigInteger number, int n) {
for (int i = 0; i < n; i++) {
number = number.flipBit(i);
}
String bitFlippedPicture = number.toString(2);
// Pad the string with enough zeros
while ((n - bitFlippedPicture.length()) > 0) {
bitFlippedPicture = "0" + bitFlippedPicture;
}
return bitFlippedPicture;
}
/**
* Transpose picture data to make it easier to find if the n-th bit is set in which pictures. We
* do this in order to keep track of how many bits each distinct "set" in order to later multiply
* the factorials of each number of sets together to reach the answer.
*/
public static char[][] transposeMatrix(char[][] arr) {
char[][] transposed = new char[arr[0].length][arr.length];
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[0].length; j++) {
transposed[j][i] = arr[i][j];
}
}
return transposed;
}
}
| UTF-8 | Java | 2,105 | java | ApparatusHelper.java | Java | [] | null | [] | /**
* Helper functions for the Apparatus class.
*/
package fsoc;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
public class ApparatusHelper {
static final int MOD = 1000003;
/**
* Multiplies the factorials of the different sets based of the number of them found.
*/
public static long multiply(Map<String, Integer> setCounter) {
// Make an error check of the pictures, if an error is found 0 wirings match all pictures.
long wirings = 1;
Iterator<Map.Entry<String, Integer>> it = setCounter.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Integer> pair = it.next();
// Only add values >1 since 0! = 1! = 1
if (pair.getValue() > 1) {
wirings = (wirings * moduloFactorial(pair.getValue(), MOD)) % MOD;
}
}
return wirings;
}
/**
* Factorial using modulo.
*/
public static long moduloFactorial(int n, int modulo) {
long result = 1;
while (n != 0) {
result = (result * n) % modulo;
n--;
}
return result;
}
/**
* Only flips the first n bits of the number
*/
public static String flippedBits(BigInteger number, int n) {
for (int i = 0; i < n; i++) {
number = number.flipBit(i);
}
String bitFlippedPicture = number.toString(2);
// Pad the string with enough zeros
while ((n - bitFlippedPicture.length()) > 0) {
bitFlippedPicture = "0" + bitFlippedPicture;
}
return bitFlippedPicture;
}
/**
* Transpose picture data to make it easier to find if the n-th bit is set in which pictures. We
* do this in order to keep track of how many bits each distinct "set" in order to later multiply
* the factorials of each number of sets together to reach the answer.
*/
public static char[][] transposeMatrix(char[][] arr) {
char[][] transposed = new char[arr[0].length][arr.length];
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[0].length; j++) {
transposed[j][i] = arr[i][j];
}
}
return transposed;
}
}
| 2,105 | 0.622328 | 0.610926 | 79 | 25.645569 | 26.720797 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.443038 | false | false | 13 |
e309316c52047cb00b4d3f90fbd0e2a9f3606c12 | 1,537,598,335,927 | 79d2382f04f412118218510d7f549f741e3c393d | /P01Mod3Ventas/test/modelo/TestSubTotal.java | 25da0dcf2f979f121bce008a40d9c1621284408d | [] | no_license | RocioD/P01Mod3Ventas | https://github.com/RocioD/P01Mod3Ventas | bd7c8211f3d83cde97b5633e91bee742aef82842 | aa34a5bd9554c2a7ddccc1a53357534c9c7a1734 | refs/heads/master | 2020-08-02T11:36:13.568000 | 2019-09-27T14:17:17 | 2019-09-27T14:17:17 | 211,337,267 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package modelo;
import org.junit.Assert;
import org.junit.Test;
public class TestSubTotal {
public TestSubTotal() {
}
@Test
public void testSubTotal() {
System.out.println("subTotal");
Venta venta = new Venta("V01", 1000, 2);
ColeccionVentas instance = new ColeccionVentas();
int esperado = 2000;
instance.Agregar(venta);
int obtenido = instance.subTotal(venta);
Assert.assertTrue(esperado == obtenido);
}
}
| UTF-8 | Java | 492 | java | TestSubTotal.java | Java | [] | null | [] | package modelo;
import org.junit.Assert;
import org.junit.Test;
public class TestSubTotal {
public TestSubTotal() {
}
@Test
public void testSubTotal() {
System.out.println("subTotal");
Venta venta = new Venta("V01", 1000, 2);
ColeccionVentas instance = new ColeccionVentas();
int esperado = 2000;
instance.Agregar(venta);
int obtenido = instance.subTotal(venta);
Assert.assertTrue(esperado == obtenido);
}
}
| 492 | 0.626016 | 0.603659 | 21 | 22.428572 | 18.049065 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.