blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4745643bf52dd6e87d28da10becb4c938ff49306
|
81cda7f3f8d7a0ca307a606a65b243bc08d8eb88
|
/siy-user-api/src/main/java/org/siy/shop/user/query/CommentQuery.java
|
e7c2e572b29c4016d3201b82c6c86adab9b9a77b
|
[
"Apache-2.0"
] |
permissive
|
SiY2OS/SiY
|
b92d2cb00db0ea8c6aac83aac4b827466d244ece
|
afd285d25d986c499fd288c5c0c3049e535c142d
|
refs/heads/master
| 2020-07-11T22:43:20.990833
| 2019-08-29T05:26:21
| 2019-08-29T05:26:21
| 204,659,335
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,358
|
java
|
package org.siy.shop.user.query;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
public class CommentQuery {
@NotNull
private Integer typeId;
@NotNull
private Integer valueId;
private boolean requirePicture;
/**
* 页码,从1开始
*/
@ApiModelProperty("页码,从1开始")
private int pageNum;
/**
* 页面大小
*/
@ApiModelProperty("页面大小")
private int pageSize;
public Integer getTypeId() {
return typeId;
}
public CommentQuery setTypeId(Integer typeId) {
this.typeId = typeId;
return this;
}
public Integer getValueId() {
return valueId;
}
public CommentQuery setValueId(Integer valueId) {
this.valueId = valueId;
return this;
}
public boolean getRequirePicture() {
return requirePicture;
}
public CommentQuery setRequirePicture(boolean requirePicture) {
this.requirePicture = requirePicture;
return this;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
}
|
[
"zhao@kkqb.cn"
] |
zhao@kkqb.cn
|
c352106ffe928caf15f8d9c8dc9d8b8c45687e56
|
0188d06f299a3a80f4fa7fc6e424dd121b04e751
|
/chapter_001/src/test/java/ru/job4j/condition/DummyBotTest.java
|
4cda614a426b3cb24d860525a3c718872eca0326
|
[
"Apache-2.0"
] |
permissive
|
pr0zt0/job4j
|
c7f779f48df61119ae58d23a73b5555f7c5b613a
|
5991829a778ace95522b29969c67e6a1f0a8352c
|
refs/heads/master
| 2020-04-02T15:11:10.043655
| 2019-01-22T00:46:06
| 2019-01-22T00:46:06
| 154,556,470
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 949
|
java
|
package ru.job4j.condition;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* @author MKG
* @version $Id$
* @since 0.1
*/
public class DummyBotTest {
@Test
public void whenGreetBot() {
DummyBot bot = new DummyBot();
assertThat(
bot.answer("Привет, Бот."),
is("Привет, умник.")
);
}
@Test
public void whenByuBot() {
DummyBot bot = new DummyBot();
assertThat(
bot.answer("Пока."),
is("До скорой встречи.")
);
}
@Test
public void whenUnknownBot() {
DummyBot bot = new DummyBot();
assertThat(
bot.answer("Сколько будет 2 + 2?"),
is("Это ставит меня в тупик. Спросите другой вопрос.")
);
}
}
|
[
"MKGumenyuk@yandex.ru"
] |
MKGumenyuk@yandex.ru
|
0848bb51a8760556f19d12cacfb31ea80a256b63
|
6f7c73a42f98be7617b9d3637679183ab78bf735
|
/src/sudokuSolver/tasks/SolveSudoku.java
|
fe712b54d12bec0f053d09872ef87e2d9980b3c7
|
[] |
no_license
|
MaartenBoodts/OsBot
|
0fa1277fa2971b5bc9d50ad7a9d28f4d8dcc21c7
|
789a695cf105edd1e83a850934fcf49fcc8d4a06
|
refs/heads/master
| 2021-08-08T21:44:36.707495
| 2017-11-11T10:44:09
| 2017-11-11T10:44:09
| 110,164,312
| 0
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,814
|
java
|
package sudokuSolver.tasks;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.MethodProvider;
import sudokuSolver.model.Rune;
import sudokuSolver.model.Tile;
import sudokuSolver.util.BasicInformation;
import sudokuSolver.util.DetectRuneType;
import sudokuSolver.util.Sudoku;
import util.Sleep;
import util.Task;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public class SolveSudoku extends Task {
private final Map<Tile, Rune> matrix;
private final ArrayList<Rune> sudokuRunes;
private final int rootWidgetId = 288;
private final int minSleepTime, maxSleepTime;
private final boolean randomPlacement;
public SolveSudoku(MethodProvider api, int minSleepTime, int maxSleepTime, boolean randomPlacement) {
super(api);
this.minSleepTime = minSleepTime;
this.maxSleepTime = maxSleepTime;
this.randomPlacement = randomPlacement;
matrix = new HashMap<>();
sudokuRunes = new ArrayList<>(Arrays.asList(Rune.FIRE, Rune.WATER, Rune.AIR, Rune.EARTH, Rune.MIND, Rune.BODY, Rune.DEATH, Rune.CHAOS, Rune.LAW));
}
@Override
public boolean canProcess() {
return api.getWidgets().get(rootWidgetId, 10) != null;
}
@Override
public void process() {
BasicInformation.status = "Solving sudoku";
if (matrix.size() == 0) {
detectProblem();
if (matrix.containsValue(Rune.UNDEFINED) || runeOnWrongPlace()) {
closeSudoku(false);
}
} else {
solveSudoku();
//boolean error = runeOnWrongPlace();
boolean error = false;
if (!error) {
BasicInformation.solved++;
closeSudoku(true);
} else {
closeSudoku(false);
}
}
}
private void solveSudoku() {
Collections.shuffle(sudokuRunes);
for (Rune rune : sudokuRunes) {
//Select correct rune to put into sudoku
RS2Widget runeWidget = api.widgets.get(rootWidgetId, rune.getWidgetId());
if (runeWidget != null) {
runeWidget.interact("Ok");
//We're not checking if rune is selected, but we're sleeping a random time
Sleep.sleepUntil(() -> false, maxSleepTime + 1, ThreadLocalRandom.current().nextInt(minSleepTime, maxSleepTime + 1));
List<Tile> list = Arrays.asList(Tile.values());
if (randomPlacement)
Collections.shuffle(list);
for (Tile tile : list) {
Rune correctRune = matrix.get(tile);
if (correctRune.equals(rune)) {
RS2Widget tileWidget = api.widgets.get(rootWidgetId, tile.getWidgetChildId());
//If tile doesn't already contains this rune
if (tileWidget != null && !getRuneFromWidget(tileWidget).equals(rune)) {
//Put rune in correct tile
tileWidget.interact("Ok");
//Sleep until we detect the rune with minimum sleep
Sleep.sleepUntil(() -> getRuneFromWidget(tileWidget).equals(rune), maxSleepTime + 1, ThreadLocalRandom.current().nextInt(minSleepTime, maxSleepTime + 1));
}
}
}
}
}
}
private void detectProblem() {
ArrayList<String> args = new ArrayList<>();
for (Tile tile : Tile.values()) {
RS2Widget tileWidget = api.widgets.get(rootWidgetId, tile.getWidgetChildId());
Rune rune = getRuneFromWidget(tileWidget);
if (!rune.equals(Rune.UNDEFINED)) {
args.add(getArgForSudoku(tile.getX(), tile.getY(), rune.getSudokuId()));
}
}
int[][] numberMatrix = Sudoku.solveSudoku(args);
setMatrix(numberMatrix);
}
private boolean runeOnWrongPlace() {
for (Tile tile : Tile.values()) {
Rune correctRune = matrix.get(tile);
RS2Widget tileWidget = api.widgets.get(rootWidgetId, tile.getWidgetChildId());
Rune placedRune = getRuneFromWidget(tileWidget);
if (placedRune != Rune.UNDEFINED) {
if (!placedRune.equals(correctRune)) {
return true;
}
}
}
return false;
}
private String getArgForSudoku(int X, int Y, int id) {
//Y + X for sudoku class
return "" + Y + X + id;
}
private void setMatrix(int[][] numberMatrix) {
int tileCount = 1;
for (int[] aNumberMatrix : numberMatrix) {
for (int solution : aNumberMatrix) {
for (Rune rune : Rune.values()) {
if (solution == rune.getSudokuId()) {
matrix.put(Tile.valueOf("T" + tileCount++), rune);
break;
}
}
}
}
}
private void closeSudoku(boolean forReward) {
if (forReward) {
api.widgets.get(rootWidgetId, 8).interact("Ok");
} else {
api.widgets.get(rootWidgetId, 132).interact("Close");
}
matrix.clear();
Sleep.sleepUntil(() -> api.getWidgets().get(rootWidgetId, 10) == null, 3000);
}
private Rune getRuneFromWidget(RS2Widget widget) {
int X = widget.getPosition().x + 16;
int Y = widget.getPosition().y + 21;
Color color = api.colorPicker.colorAt(X, Y);
return DetectRuneType.getRuneType(color);
}
public Map<Tile, Rune> getMatrix() {
return matrix;
}
}
|
[
"maarten.boodts@hotmail.com"
] |
maarten.boodts@hotmail.com
|
ea0b22e4a7e8efaf48db4bd68b7580a8474409bc
|
4ac26112ff4d6872d46144cfe97538ad6b5be675
|
/app/src/main/java/com/bingo/wanandroid/core/bean/project/ProjectListData.java
|
d183bb7ca73941f987d284ab519c1ac016c5c650
|
[] |
no_license
|
xwbbingo/WanAndroid-master
|
3df6b486e15ae116bf316f5eed691ac34114374f
|
1ad41e45c9a452032e96d47af993d146270e4386
|
refs/heads/master
| 2021-06-12T17:02:22.577027
| 2021-01-04T16:35:11
| 2021-01-04T16:35:11
| 254,366,280
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 15,805
|
java
|
package com.bingo.wanandroid.core.bean.project;
import com.bingo.wanandroid.core.bean.mainpager.article.FeedArticleData;
import java.util.List;
/**
* author bingo
* date 2020/1/22
*/
public class ProjectListData {
/**
* curPage : 1
* datas : [{"apkLink":"","audit":1,"author":"gs666","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"一个模仿企鹅 FM 界面的Android 应用—喜马拉雅Kotlin。完全使用 Kotlin 开发。有声资源和播放器由喜马拉雅 SDK 提供。 主要功能:\r\n\r\n1,在线播放专辑点播\r\n2,在线播放国家/省/市广播电台\r\n3,最近收听\r\n4,搜索节目/专辑/广播(包括热搜词)","envelopePic":"https://wanandroid.com/blogimgs/2baa4b4b-acfe-473c-b534-9d672423e564.png","fresh":false,"id":10135,"link":"https://www.wanandroid.com/blog/show/2703","niceDate":"2019-11-07 10:43","niceShareDate":"2019-11-07 10:43","origin":"","prefix":"","projectLink":"https://github.com/gs666/XimalayaKotlin","publishTime":1573094591000,"selfVisible":0,"shareDate":1573094591000,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"一个模仿企鹅 FM 界面的 Android 应用—喜马拉雅Kotlin。完全使用 Kotlin 开发。","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"jsyjst","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"随心音乐,是一款基于MVP+Retrofit+EventBus+Glide的应用,有兴趣的盆友欢迎Star,Fork!","envelopePic":"https://www.wanandroid.com/blogimgs/025c4573-38d9-4cdc-a591-685a73ac7163.png","fresh":false,"id":9867,"link":"https://www.wanandroid.com/blog/show/2698","niceDate":"2019-10-21 23:31","niceShareDate":"2019-10-21 23:29","origin":"","prefix":"","projectLink":"https://github.com/jsyjst/YuanMusicPlay","publishTime":1571671914000,"selfVisible":0,"shareDate":1571671756000,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"随心音乐,让心跟着跳动起来","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"ShowMeThe","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"利用wanandroid ApI实现,基于AAC的玩安卓客户端\r\n网络请求利用Retrofit2 + Coroutines,抛弃了RxJava的怀抱完成网络请求部分\r\n已完成\r\n#主页,公众号,知识体系,项目,收藏,登录注册等基本功能\r\n另外为了实现ROOM的应用,本地添加数据,完成基本的登录和数据展示功能\r\n#剩余功能尚未完善,开发中","envelopePic":"https://www.wanandroid.com/blogimgs/1534e4e3-456e-40dd-8f77-2328ce72a388.png","fresh":false,"id":9863,"link":"https://www.wanandroid.com/blog/show/2694","niceDate":"2019-10-21 23:21","niceShareDate":"2019-10-21 23:21","origin":"","prefix":"","projectLink":"https://github.com/ShowMeThe/WanAndroid","publishTime":1571671303000,"selfVisible":0,"shareDate":1571671303000,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"基于AAC架构玩安卓客户端","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"laishujie","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"开源漫画项目,部分界面仿有妖气,Kotlin+MVVM+LiveData+协程+Retrofit。一起加油努力\r\n","envelopePic":"https://wanandroid.com/blogimgs/e2270cce-cc0b-4971-b382-b1c9f359bec3.png","fresh":false,"id":9841,"link":"https://www.wanandroid.com/blog/show/2691","niceDate":"2019-10-20 20:10","niceShareDate":"2019-10-20 20:10","origin":"","prefix":"","projectLink":"https://github.com/laishujie/ComicMTC_v2","publishTime":1571573435000,"selfVisible":0,"shareDate":1571573435000,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"开源漫画项目,部分界面仿有妖气","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"xing16","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"WanAndroid-Kotlin是基于 Kotlin + MVP + RxJava + OkHttp 实现好用好看的学习阅读类客户端, 包括首页,项目,体系,干货,搜索,收藏,妹子等功能","envelopePic":"https://www.wanandroid.com/blogimgs/b4714e97-deb4-4cd4-bf63-e365afe60189.png","fresh":false,"id":9656,"link":"https://www.wanandroid.com/blog/show/2684","niceDate":"2019-10-13 23:40","niceShareDate":"2019-10-13 23:40","origin":"","prefix":"","projectLink":"https://github.com/xing16/WanAndroid-Kotlin","publishTime":1570981232000,"selfVisible":0,"shareDate":1570981232000,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"Kotlin 实现美观好用的 WanAndroid 客户端","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"xuexiangjys","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"一个简洁而又优雅的Android原生UI框架,解放你的双手!还不赶紧点击使用说明文档,体验一下吧!","envelopePic":"https://wanandroid.com/blogimgs/df78f4d6-94c6-4ed8-8b96-999f57a84262.png","fresh":false,"id":9494,"link":"https://www.wanandroid.com/blog/show/2680","niceDate":"2019-10-05 13:09","niceShareDate":"2019-10-05 13:09","origin":"","prefix":"","projectLink":"https://github.com/xuexiangjys/XUI","publishTime":1570252145000,"selfVisible":0,"shareDate":1570252145000,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"XUI 一个简洁而优雅的Android原生UI框架,解放你的双手!","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"kbz066","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"时光序 Flutter 版是仿照Android版本的时光序,从开始自学dart到基本完成开发历时一个多月,项目中基本使用到了flutter大部分基础widget,完成了大部分炫酷的特效交互,项目使用flutter 官方推荐的provider进行状态管理.\r\n\r\n","envelopePic":"https://www.wanandroid.com/blogimgs/1c73d4b3-9cff-4c8e-818a-e14e44b00988.png","fresh":false,"id":9111,"link":"https://www.wanandroid.com/blog/show/2675","niceDate":"2019-09-10 00:05","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/kbz066/flutter_shiguangxu","publishTime":1568045114000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"Flutter 时光序 新鲜出炉 欢迎大家品尝","type":0,"userId":-1,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"xiangcman","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"仿苹果版小黄车菜单弹出效果","envelopePic":"https://www.wanandroid.com/blogimgs/8f82a5e5-57e9-4d62-9c94-f1ff2c277802.png","fresh":false,"id":9099,"link":"https://www.wanandroid.com/blog/show/2668","niceDate":"2019-09-09 23:34","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/xiangcman/OfoMenuView-master","publishTime":1568043245000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"苹果版小黄车(ofo)app主页菜单效果","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"iamyours","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"适配掘金/简书/CSDN/公众号/玩Android这些站点文章的黑夜模式,去除广告,专注文章内容,给你不一样的阅读体验。","envelopePic":"https://www.wanandroid.com/blogimgs/fad5f9dd-31b5-4328-80b2-8d1fef3dd11d.png","fresh":false,"id":9100,"link":"https://www.wanandroid.com/blog/show/2669","niceDate":"2019-09-09 23:30","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/iamyours/Wandroid","publishTime":1568043020000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"一款全黑夜玩Android客户端,给你不一样的阅读体验","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"hegaojian","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"一位练习长达两年半的安卓练习生根据鸿神提供的WanAndroid开放Api来制作的产品级App,基本实现了所有的功能,采用Kotlin语言,基于Material Design + AndroidX + MVP + RxJava + Retrofit等优秀的开源框架开发","envelopePic":"https://wanandroid.com/blogimgs/39749be0-f875-48c8-a1b6-c349d286d594.png","fresh":false,"id":9093,"link":"https://www.wanandroid.com/blog/show/2666","niceDate":"2019-09-05 21:12","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/hegaojian/WanAndroid","publishTime":1567689172000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"一位练习长达两年半的安卓练习生根据鸿神提供的WanAndroid开放Api来制作的产品级App","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"goweii","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"开发初期主要是为了试水一些自己开发的开源框架,但是后面发现本人对这个APP的使用频率还是挺高的,在坐地铁的时候都会拿出来刷一刷文章。所以决定把这个APP做好看,做好用,不至于影响刷文章的心情。\r\n\r\n如果你也觉得好用,欢迎给个star,谢谢。","envelopePic":"https://wanandroid.com/blogimgs/eb948f06-8895-4b67-8bf9-1aa41dea75cb.png","fresh":false,"id":8501,"link":"https://www.wanandroid.com/blog/show/2577","niceDate":"2019-09-01 23:17","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/goweii/WanAndroid","publishTime":1567351026000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"简洁美观的WanAndroid客户端","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"binaryshao","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"玩 Android 客户端,采用 kotlin 语言,Material Design 风格,根据 MVVM 架构使用 Jetpack 架构组件搭建了整套框架\r\n","envelopePic":"https://www.wanandroid.com/blogimgs/10491b74-b534-48b1-a5fe-d2ac00e20d2d.png","fresh":false,"id":8996,"link":"https://www.wanandroid.com/blog/show/2658","niceDate":"2019-08-20 00:47","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/binaryshao/WanAndroid-MVVM","publishTime":1566233222000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"玩 Android 客户端 MVVM 架构使用 Jetpack 架构组件 ","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"binaryshao","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"玩安卓客户端 Flutter 版,几乎对接了玩安卓的所有 API,内容比较完整\r\n","envelopePic":"https://www.wanandroid.com/blogimgs/f381b3aa-932e-47d6-af54-3abd7b4c48c8.png","fresh":false,"id":8995,"link":"https://www.wanandroid.com/blog/show/2657","niceDate":"2019-08-20 00:46","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/binaryshao/WanAndroid_Flutter","publishTime":1566233179000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"玩安卓客户端 Flutter 版","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"maoqitian","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"这是一款Android原生的开源玩Android客户端App,提供更丰富的功能,更好体验,旨在更好的浏览www.wanandroid.com网站内容,更好的在手机上进行学习,做项目的同时也能提升自我。项目使用Retrofit2 + RxJava2 + Dagger2 +MVP+RxBus架构。","envelopePic":"https://wanandroid.com/blogimgs/0a606e9b-45a2-4800-a4d5-3a1abc25cf67.png","fresh":false,"id":8977,"link":"https://www.wanandroid.com/blog/show/2650","niceDate":"2019-08-16 00:36","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/maoqitian/MaoWanAndoidClient","publishTime":1565886970000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"一款有较好体验的WanAndroid客户端","type":0,"userId":-1,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"asjqkkkk","chapterId":294,"chapterName":"完整项目","collect":false,"courseId":13,"desc":"完全使用Flutter编写的TodoList app,是一个小巧、简洁而又漂亮的app,它可以帮你随手记录日常的各项计划,如果你恰好有写任务计划的习惯,那么它一定非常适合你。\r\n","envelopePic":"https://wanandroid.com/blogimgs/6718c2cd-695c-4eb7-b24a-ccbb10d4dd47.png","fresh":false,"id":8882,"link":"https://www.wanandroid.com/blog/show/2640","niceDate":"2019-08-11 20:45","niceShareDate":"未知时间","origin":"","prefix":"","projectLink":"https://github.com/asjqkkkk/flutter-todos","publishTime":1565527536000,"selfVisible":0,"shareDate":null,"shareUser":"","superChapterId":294,"superChapterName":"开源项目主Tab","tags":[{"name":"项目","url":"/project/list/1?cid=294"}],"title":"一个非常精美的Flutter Todo-List项目","type":0,"userId":-1,"visible":1,"zan":0}]
* offset : 0
* over : false
* pageCount : 12
* size : 15
* total : 166
*/
private int curPage;
private int offset;
private boolean over;
private int pageCount;
private int size;
private int total;
private List<FeedArticleData> datas;
public int getCurPage() {
return curPage;
}
public void setCurPage(int curPage) {
this.curPage = curPage;
}
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
public boolean isOver() {
return over;
}
public void setOver(boolean over) {
this.over = over;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<FeedArticleData> getDatas() {
return datas;
}
public void setDatas(List<FeedArticleData> datas) {
this.datas = datas;
}
}
|
[
"401917941@qq.com"
] |
401917941@qq.com
|
1fa65e0fc78ab9c69957e0f3c8a9589423d39009
|
d950c583ffd61034dbb72de21209e28adf57ce68
|
/p5/.history/files/ast_20210407045908.java
|
b6d950e1b11931e285bd8a7d60d5ade060cb3623
|
[] |
no_license
|
jsong96/CS536
|
681251ea9e52f35b7c9e231cebca61165e1eadbb
|
91f9db81534d8d140ce06936408f193d4435505f
|
refs/heads/master
| 2023-04-16T00:37:18.964965
| 2021-05-01T02:50:24
| 2021-05-01T02:50:24
| 351,865,772
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 49,276
|
java
|
import java.io.*;
import java.util.*;
// **********************************************************************
// The ASTnode class defines the nodes of the abstract-syntax tree that
// represents a C-- program.
//
// Internal nodes of the tree contain pointers to children, organized
// either in a list (for nodes that may have a variable number of
// children) or as a fixed set of fields.
//
// The nodes for literals and ids contain line and character number
// information; for string literals and identifiers, they also contain a
// string; for integer literals, they also contain an integer value.
//
// Here are all the different kinds of AST nodes and what kinds of children
// they have. All of these kinds of AST nodes are subclasses of "ASTnode".
// Indentation indicates further subclassing:
//
// Subclass Kids
// ---------- ------
// ProgramNode DeclListNode
// DeclListNode linked list of DeclNode
// DeclNode:
// VarDeclNode TypeNode, IdNode, int
// FnDeclNode TypeNode, IdNode, FormalsListNode, FnBodyNode
// FormalDeclNode TypeNode, IdNode
// StructDeclNode IdNode, DeclListNode
//
// FormalsListNode linked list of FormalDeclNode
// FnBodyNode DeclListNode, StmtListNode
// StmtListNode linked list of StmtNode
// ExpListNode linked list of ExpNode
//
// TypeNode:
// IntNode -- none --
// BoolNode -- none --
// VoidNode -- none --
// StructNode IdNode
//
// StmtNode:
// AssignStmtNode AssignNode
// PostIncStmtNode ExpNode
// PostDecStmtNode ExpNode
// ReadStmtNode ExpNode
// WriteStmtNode ExpNode
// IfStmtNode ExpNode, DeclListNode, StmtListNode
// IfElseStmtNode ExpNode, DeclListNode, StmtListNode,
// DeclListNode, StmtListNode
// WhileStmtNode ExpNode, DeclListNode, StmtListNode
// RepeatStmtNode ExpNode, DeclListNode, StmtListNode
// CallStmtNode CallExpNode
// ReturnStmtNode ExpNode
//
// ExpNode:
// IntLitNode -- none --
// StrLitNode -- none --
// TrueNode -- none --
// FalseNode -- none --
// IdNode -- none --
// DotAccessNode ExpNode, IdNode
// AssignNode ExpNode, ExpNode
// CallExpNode IdNode, ExpListNode
// UnaryExpNode ExpNode
// UnaryMinusNode
// NotNode
// BinaryExpNode ExpNode ExpNode
// PlusNode
// MinusNode
// TimesNode
// DivideNode
// AndNode
// OrNode
// EqualsNode
// NotEqualsNode
// LessNode
// GreaterNode
// LessEqNode
// GreaterEqNode
//
// Here are the different kinds of AST nodes again, organized according to
// whether they are leaves, internal nodes with linked lists of kids, or
// internal nodes with a fixed number of kids:
//
// (1) Leaf nodes:
// IntNode, BoolNode, VoidNode, IntLitNode, StrLitNode,
// TrueNode, FalseNode, IdNode
//
// (2) Internal nodes with (*possibly empty*) linked lists of children:
// DeclListNode, FormalsListNode, StmtListNode, ExpListNode
//
// (3) Internal nodes with fixed numbers of kids:
// ProgramNode, VarDeclNode, FnDeclNode, FormalDeclNode,
// StructDeclNode, FnBodyNode, StructNode, AssignStmtNode,
// PostIncStmtNode, PostDecStmtNode, ReadStmtNode, WriteStmtNode
// IfStmtNode, IfElseStmtNode, WhileStmtNode, CallStmtNode
// ReturnStmtNode, DotAccessNode, AssignExpNode, CallExpNode,
// UnaryExpNode, BinaryExpNode, UnaryMinusNode, NotNode,
// PlusNode, MinusNode, TimesNode, DivideNode,
// AndNode, OrNode, EqualsNode, NotEqualsNode,
// LessNode, GreaterNode, LessEqNode, GreaterEqNode
//
// **********************************************************************
// **********************************************************************
// ASTnode class (base class for all other kinds of nodes)
// **********************************************************************
abstract class ASTnode {
// every subclass must provide an unparse operation
abstract public void unparse(PrintWriter p, int indent);
// this method can be used by the unparse methods to do indenting
protected void addIndentation(PrintWriter p, int indent) {
for (int k = 0; k < indent; k++)
p.print(" ");
}
}
// **********************************************************************
// ProgramNode, DeclListNode, FormalsListNode, FnBodyNode,
// StmtListNode, ExpListNode
// **********************************************************************
class ProgramNode extends ASTnode {
public ProgramNode(DeclListNode L) {
myDeclList = L;
}
/**
* nameAnalysis Creates an empty symbol table for the outermost scope, then
* processes all of the globals, struct defintions, and functions in the
* program.
*/
public void nameAnalysis() {
SymTable symTab = new SymTable();
myDeclList.nameAnalysis(symTab);
}
/**
* typeCheck
*/
public void typeCheck() {
myDeclList.typeCheck();
}
public void unparse(PrintWriter p, int indent) {
myDeclList.unparse(p, indent);
}
// 1 kid
private DeclListNode myDeclList;
}
class DeclListNode extends ASTnode {
public DeclListNode(List<DeclNode> S) {
myDecls = S;
}
/**
* nameAnalysis Given a symbol table symTab, process all of the decls in the
* list.
*/
public void nameAnalysis(SymTable symTab) {
nameAnalysis(symTab, symTab);
}
/**
* nameAnalysis Given a symbol table symTab and a global symbol table globalTab
* (for processing struct names in variable decls), process all of the decls in
* the list.
*/
public void nameAnalysis(SymTable symTab, SymTable globalTab) {
for (DeclNode node : myDecls) {
if (node instanceof VarDeclNode) {
((VarDeclNode) node).nameAnalysis(symTab, globalTab);
} else {
node.nameAnalysis(symTab);
}
}
}
public boolean typeCheck() {
for (DeclNode node : myDecls) {
if (node instanceof FnDeclNode) {
if (((FnDeclNode) node).typeCheck() == false) {
return false;
}
}
}
return true;
}
public void unparse(PrintWriter p, int indent) {
Iterator it = myDecls.iterator();
try {
while (it.hasNext()) {
((DeclNode) it.next()).unparse(p, indent);
}
} catch (NoSuchElementException ex) {
System.err.println("unexpected NoSuchElementException in DeclListNode.print");
System.exit(-1);
}
}
// list of kids (DeclNodes)
private List<DeclNode> myDecls;
}
class FormalsListNode extends ASTnode {
public FormalsListNode(List<FormalDeclNode> S) {
myFormals = S;
}
/**
* nameAnalysis Given a symbol table symTab, do: for each formal decl in the
* list process the formal decl if there was no error, add type of formal decl
* to list
*/
public List<Type> nameAnalysis(SymTable symTab) {
List<Type> typeList = new LinkedList<Type>();
for (FormalDeclNode node : myFormals) {
TSym sym = node.nameAnalysis(symTab);
if (sym != null) {
typeList.add(sym.getType());
}
}
return typeList;
}
/**
* Return the number of formals in this list.
*/
public int length() {
return myFormals.size();
}
public void unparse(PrintWriter p, int indent) {
Iterator<FormalDeclNode> it = myFormals.iterator();
if (it.hasNext()) { // if there is at least one element
it.next().unparse(p, indent);
while (it.hasNext()) { // print the rest of the list
p.print(", ");
it.next().unparse(p, indent);
}
}
}
// list of kids (FormalDeclNodes)
private List<FormalDeclNode> myFormals;
}
class FnBodyNode extends ASTnode {
public FnBodyNode(DeclListNode declList, StmtListNode stmtList) {
myDeclList = declList;
myStmtList = stmtList;
}
/**
* nameAnalysis Given a symbol table symTab, do: - process the declaration list
* - process the statement list
*/
public void nameAnalysis(SymTable symTab) {
myDeclList.nameAnalysis(symTab);
myStmtList.nameAnalysis(symTab);
}
public void unparse(PrintWriter p, int indent) {
myDeclList.unparse(p, indent);
myStmtList.unparse(p, indent);
}
// 2 kids
private DeclListNode myDeclList;
private StmtListNode myStmtList;
}
class StmtListNode extends ASTnode {
public StmtListNode(List<StmtNode> S) {
myStmts = S;
}
/**
* nameAnalysis Given a symbol table symTab, process each statement in the list.
*/
public void nameAnalysis(SymTable symTab) {
for (StmtNode node : myStmts) {
node.nameAnalysis(symTab);
}
}
public void unparse(PrintWriter p, int indent) {
Iterator<StmtNode> it = myStmts.iterator();
while (it.hasNext()) {
it.next().unparse(p, indent);
}
}
// list of kids (StmtNodes)
private List<StmtNode> myStmts;
}
class ExpListNode extends ASTnode {
public ExpListNode(List<ExpNode> S) {
myExps = S;
}
/**
* nameAnalysis Given a symbol table symTab, process each exp in the list.
*/
public void nameAnalysis(SymTable symTab) {
for (ExpNode node : myExps) {
node.nameAnalysis(symTab);
}
}
public void unparse(PrintWriter p, int indent) {
Iterator<ExpNode> it = myExps.iterator();
if (it.hasNext()) { // if there is at least one element
it.next().unparse(p, indent);
while (it.hasNext()) { // print the rest of the list
p.print(", ");
it.next().unparse(p, indent);
}
}
}
// list of kids (ExpNodes)
private List<ExpNode> myExps;
}
// **********************************************************************
// DeclNode and its subclasses
// **********************************************************************
abstract class DeclNode extends ASTnode {
/**
* Note: a formal decl needs to return a sym
*/
abstract public TSym nameAnalysis(SymTable symTab);
}
class VarDeclNode extends DeclNode {
public VarDeclNode(TypeNode type, IdNode id, int size) {
myType = type;
myId = id;
mySize = size;
}
/**
* nameAnalysis (*overloaded*) Given a symbol table symTab, do: if this name is
* declared void, then error else if the declaration is of a struct type, lookup
* type name (globally) if type name doesn't exist, then error if no errors so
* far, if name has already been declared in this scope, then error else add
* name to local symbol table
*
* symTab is local symbol table (say, for struct field decls) globalTab is
* global symbol table (for struct type names) symTab and globalTab can be the
* same
*/
public TSym nameAnalysis(SymTable symTab) {
return nameAnalysis(symTab, symTab);
}
public TSym nameAnalysis(SymTable symTab, SymTable globalTab) {
boolean badDecl = false;
String name = myId.name();
TSym sym = null;
IdNode structId = null;
if (myType instanceof VoidNode) { // check for void type
ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Non-function declared void");
badDecl = true;
}
else if (myType instanceof StructNode) {
structId = ((StructNode) myType).idNode();
try {
sym = globalTab.lookupGlobal(structId.name());
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis");
}
// if the name for the struct type is not found,
// or is not a struct type
if (sym == null || !(sym instanceof StructDefSym)) {
ErrMsg.fatal(structId.lineNum(), structId.charNum(), "Invalid name of struct type");
badDecl = true;
} else {
structId.link(sym);
}
}
TSym symCheckMul = null;
try {
symCheckMul = symTab.lookupLocal(name);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis");
}
if (symCheckMul != null) {
ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier");
badDecl = true;
}
if (!badDecl) { // insert into symbol table
try {
if (myType instanceof StructNode) {
sym = new StructSym(structId);
} else {
sym = new TSym(myType.type());
}
symTab.addDecl(name, sym);
myId.link(sym);
} catch (DuplicateSymException ex) {
System.err.println("Unexpected DuplicateSymException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
} catch (IllegalArgumentException ex) {
System.err.println("Unexpected IllegalArgumentException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
}
}
return sym;
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
myType.unparse(p, 0);
p.print(" ");
p.print(myId.name());
p.println(";");
}
// 3 kids
private TypeNode myType;
private IdNode myId;
private int mySize; // use value NOT_STRUCT if this is not a struct type
public static int NOT_STRUCT = -1;
}
class FnDeclNode extends DeclNode {
public FnDeclNode(TypeNode type, IdNode id, FormalsListNode formalList, FnBodyNode body) {
myType = type;
myId = id;
myFormalsList = formalList;
myBody = body;
}
/**
* nameAnalysis Given a symbol table symTab, do: if this name has already been
* declared in this scope, then error else add name to local symbol table in any
* case, do the following: enter new scope process the formals if this function
* is not multiply declared, update symbol table entry with types of formals
* process the body of the function exit scope
*/
public TSym nameAnalysis(SymTable symTab) {
String name = myId.name();
FnSym sym = null;
TSym symCheckMul = null;
try {
symCheckMul = symTab.lookupLocal(name);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis");
}
if (symCheckMul != null) {
ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier");
}
else { // add function name to local symbol table
try {
sym = new FnSym(myType.type(), myFormalsList.length());
symTab.addDecl(name, sym);
myId.link(sym);
} catch (DuplicateSymException ex) {
System.err.println("Unexpected DuplicateSymException " + " in FnDeclNode.nameAnalysis");
System.exit(-1);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in FnDeclNode.nameAnalysis");
System.exit(-1);
} catch (IllegalArgumentException ex) {
System.err.println("Unexpected IllegalArgumentException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
}
}
symTab.addScope(); // add a new scope for locals and params
// process the formals
List<Type> typeList = myFormalsList.nameAnalysis(symTab);
if (sym != null) {
sym.addFormals(typeList);
}
myBody.nameAnalysis(symTab); // process the function body
try {
symTab.removeScope(); // exit scope
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in FnDeclNode.nameAnalysis");
System.exit(-1);
}
return null;
}
public boolean typeCheck() {
return false;
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
myType.unparse(p, 0);
p.print(" ");
p.print(myId.name());
p.print("(");
myFormalsList.unparse(p, 0);
p.println(") {");
myBody.unparse(p, indent + 4);
p.println("}\n");
}
// 4 kids
private TypeNode myType;
private IdNode myId;
private FormalsListNode myFormalsList;
private FnBodyNode myBody;
}
class FormalDeclNode extends DeclNode {
public FormalDeclNode(TypeNode type, IdNode id) {
myType = type;
myId = id;
}
/**
* nameAnalysis Given a symbol table symTab, do: if this formal is declared
* void, then error else if this formal is already in the local symble table,
* then issue multiply declared error message and return null else add a new
* entry to the symbol table and return that Sym
*/
public TSym nameAnalysis(SymTable symTab) {
String name = myId.name();
boolean badDecl = false;
TSym sym = null;
if (myType instanceof VoidNode) {
ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Non-function declared void");
badDecl = true;
}
TSym symCheckMul = null;
try {
symCheckMul = symTab.lookupLocal(name);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis");
}
if (symCheckMul != null) {
ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier");
badDecl = true;
}
if (!badDecl) { // insert into symbol table
try {
sym = new TSym(myType.type());
symTab.addDecl(name, sym);
myId.link(sym);
} catch (DuplicateSymException ex) {
System.err.println("Unexpected DuplicateSymException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
} catch (IllegalArgumentException ex) {
System.err.println("Unexpected IllegalArgumentException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
}
}
return sym;
}
public void unparse(PrintWriter p, int indent) {
myType.unparse(p, 0);
p.print(" ");
p.print(myId.name());
}
// 2 kids
private TypeNode myType;
private IdNode myId;
}
class StructDeclNode extends DeclNode {
public StructDeclNode(IdNode id, DeclListNode declList) {
myId = id;
myDeclList = declList;
}
/**
* nameAnalysis Given a symbol table symTab, do: if this name is already in the
* symbol table, then multiply declared error (don't add to symbol table) create
* a new symbol table for this struct definition process the decl list if no
* errors add a new entry to symbol table for this struct
*/
public TSym nameAnalysis(SymTable symTab) {
String name = myId.name();
boolean badDecl = false;
TSym symCheckMul = null;
try {
symCheckMul = symTab.lookupLocal(name);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis");
}
if (symCheckMul != null) {
ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier");
badDecl = true;
}
if (!badDecl) {
try { // add entry to symbol table
SymTable structSymTab = new SymTable();
myDeclList.nameAnalysis(structSymTab, symTab);
StructDefSym sym = new StructDefSym(structSymTab);
symTab.addDecl(name, sym);
myId.link(sym);
} catch (DuplicateSymException ex) {
System.err.println("Unexpected DuplicateSymException " + " in StructDeclNode.nameAnalysis");
System.exit(-1);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in StructDeclNode.nameAnalysis");
System.exit(-1);
} catch (IllegalArgumentException ex) {
System.err.println("Unexpected IllegalArgumentException " + " in VarDeclNode.nameAnalysis");
System.exit(-1);
}
}
return null;
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("struct ");
p.print(myId.name());
p.println("{");
myDeclList.unparse(p, indent + 4);
addIndentation(p, indent);
p.println("};\n");
}
// 2 kids
private IdNode myId;
private DeclListNode myDeclList;
}
// **********************************************************************
// TypeNode and its Subclasses
// **********************************************************************
abstract class TypeNode extends ASTnode {
/* all subclasses must provide a type method */
abstract public Type type();
}
class IntNode extends TypeNode {
public IntNode() {
}
/**
* type
*/
public Type type() {
return new IntType();
}
public void unparse(PrintWriter p, int indent) {
p.print("int");
}
}
class BoolNode extends TypeNode {
public BoolNode() {
}
/**
* type
*/
public Type type() {
return new BoolType();
}
public void unparse(PrintWriter p, int indent) {
p.print("bool");
}
}
class VoidNode extends TypeNode {
public VoidNode() {
}
/**
* type
*/
public Type type() {
return new VoidType();
}
public void unparse(PrintWriter p, int indent) {
p.print("void");
}
}
class StructNode extends TypeNode {
public StructNode(IdNode id) {
myId = id;
}
public IdNode idNode() {
return myId;
}
/**
* type
*/
public Type type() {
return new StructType(myId);
}
public void unparse(PrintWriter p, int indent) {
p.print("struct ");
p.print(myId.name());
}
// 1 kid
private IdNode myId;
}
// **********************************************************************
// StmtNode and its subclasses
// **********************************************************************
abstract class StmtNode extends ASTnode {
abstract public void nameAnalysis(SymTable symTab);
}
class AssignStmtNode extends StmtNode {
public AssignStmtNode(AssignNode assign) {
myAssign = assign;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child
*/
public void nameAnalysis(SymTable symTab) {
myAssign.nameAnalysis(symTab);
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
myAssign.unparse(p, -1); // no parentheses
p.println(";");
}
// 1 kid
private AssignNode myAssign;
}
class PostIncStmtNode extends StmtNode {
public PostIncStmtNode(ExpNode exp) {
myExp = exp;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
myExp.unparse(p, 0);
p.println("++;");
}
// 1 kid
private ExpNode myExp;
}
class PostDecStmtNode extends StmtNode {
public PostDecStmtNode(ExpNode exp) {
myExp = exp;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
myExp.unparse(p, 0);
p.println("--;");
}
// 1 kid
private ExpNode myExp;
}
class ReadStmtNode extends StmtNode {
public ReadStmtNode(ExpNode e) {
myExp = e;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("cin >> ");
myExp.unparse(p, 0);
p.println(";");
}
// 1 kid (actually can only be an IdNode or an ArrayExpNode)
private ExpNode myExp;
}
class WriteStmtNode extends StmtNode {
public WriteStmtNode(ExpNode exp) {
myExp = exp;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("cout << ");
myExp.unparse(p, 0);
p.println(";");
}
// 1 kid
private ExpNode myExp;
}
class IfStmtNode extends StmtNode {
public IfStmtNode(ExpNode exp, DeclListNode dlist, StmtListNode slist) {
myDeclList = dlist;
myExp = exp;
myStmtList = slist;
}
/**
* nameAnalysis Given a symbol table symTab, do: - process the condition - enter
* a new scope - process the decls and stmts - exit the scope
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
symTab.addScope();
myDeclList.nameAnalysis(symTab);
myStmtList.nameAnalysis(symTab);
try {
symTab.removeScope();
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis");
System.exit(-1);
}
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("if (");
myExp.unparse(p, 0);
p.println(") {");
myDeclList.unparse(p, indent + 4);
myStmtList.unparse(p, indent + 4);
addIndentation(p, indent);
p.println("}");
}
// e kids
private ExpNode myExp;
private DeclListNode myDeclList;
private StmtListNode myStmtList;
}
class IfElseStmtNode extends StmtNode {
public IfElseStmtNode(ExpNode exp, DeclListNode dlist1, StmtListNode slist1, DeclListNode dlist2,
StmtListNode slist2) {
myExp = exp;
myThenDeclList = dlist1;
myThenStmtList = slist1;
myElseDeclList = dlist2;
myElseStmtList = slist2;
}
/**
* nameAnalysis Given a symbol table symTab, do: - process the condition - enter
* a new scope - process the decls and stmts of then - exit the scope - enter a
* new scope - process the decls and stmts of else - exit the scope
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
symTab.addScope();
myThenDeclList.nameAnalysis(symTab);
myThenStmtList.nameAnalysis(symTab);
try {
symTab.removeScope();
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis");
System.exit(-1);
}
symTab.addScope();
myElseDeclList.nameAnalysis(symTab);
myElseStmtList.nameAnalysis(symTab);
try {
symTab.removeScope();
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis");
System.exit(-1);
}
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("if (");
myExp.unparse(p, 0);
p.println(") {");
myThenDeclList.unparse(p, indent + 4);
myThenStmtList.unparse(p, indent + 4);
addIndentation(p, indent);
p.println("}");
addIndentation(p, indent);
p.println("else {");
myElseDeclList.unparse(p, indent + 4);
myElseStmtList.unparse(p, indent + 4);
addIndentation(p, indent);
p.println("}");
}
// 5 kids
private ExpNode myExp;
private DeclListNode myThenDeclList;
private StmtListNode myThenStmtList;
private StmtListNode myElseStmtList;
private DeclListNode myElseDeclList;
}
class WhileStmtNode extends StmtNode {
public WhileStmtNode(ExpNode exp, DeclListNode dlist, StmtListNode slist) {
myExp = exp;
myDeclList = dlist;
myStmtList = slist;
}
/**
* nameAnalysis Given a symbol table symTab, do: - process the condition - enter
* a new scope - process the decls and stmts - exit the scope
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
symTab.addScope();
myDeclList.nameAnalysis(symTab);
myStmtList.nameAnalysis(symTab);
try {
symTab.removeScope();
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis");
System.exit(-1);
}
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("while (");
myExp.unparse(p, 0);
p.println(") {");
myDeclList.unparse(p, indent + 4);
myStmtList.unparse(p, indent + 4);
addIndentation(p, indent);
p.println("}");
}
// 3 kids
private ExpNode myExp;
private DeclListNode myDeclList;
private StmtListNode myStmtList;
}
class RepeatStmtNode extends StmtNode {
public RepeatStmtNode(ExpNode exp, DeclListNode dlist, StmtListNode slist) {
myExp = exp;
myDeclList = dlist;
myStmtList = slist;
}
/**
* nameAnalysis Given a symbol table symTab, do: - process the condition - enter
* a new scope - process the decls and stmts - exit the scope
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
symTab.addScope();
myDeclList.nameAnalysis(symTab);
myStmtList.nameAnalysis(symTab);
try {
symTab.removeScope();
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis");
System.exit(-1);
}
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("repeat (");
myExp.unparse(p, 0);
p.println(") {");
myDeclList.unparse(p, indent + 4);
myStmtList.unparse(p, indent + 4);
addIndentation(p, indent);
p.println("}");
}
// 3 kids
private ExpNode myExp;
private DeclListNode myDeclList;
private StmtListNode myStmtList;
}
class CallStmtNode extends StmtNode {
public CallStmtNode(CallExpNode call) {
myCall = call;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child
*/
public void nameAnalysis(SymTable symTab) {
myCall.nameAnalysis(symTab);
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
myCall.unparse(p, indent);
p.println(";");
}
// 1 kid
private CallExpNode myCall;
}
class ReturnStmtNode extends StmtNode {
public ReturnStmtNode(ExpNode exp) {
myExp = exp;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child, if it has one
*/
public void nameAnalysis(SymTable symTab) {
if (myExp != null) {
myExp.nameAnalysis(symTab);
}
}
public void unparse(PrintWriter p, int indent) {
addIndentation(p, indent);
p.print("return");
if (myExp != null) {
p.print(" ");
myExp.unparse(p, 0);
}
p.println(";");
}
// 1 kid
private ExpNode myExp; // possibly null
}
// **********************************************************************
// ExpNode and its subclasses
// **********************************************************************
abstract class ExpNode extends ASTnode {
/**
* Default version for nodes with no names
*/
public void nameAnalysis(SymTable symTab) {
}
}
class IntLitNode extends ExpNode {
public IntLitNode(int lineNum, int charNum, int intVal) {
myLineNum = lineNum;
myCharNum = charNum;
myIntVal = intVal;
}
public IntType typeCheck() {
return new IntType();
}
public void unparse(PrintWriter p, int indent) {
p.print(myIntVal);
}
private int myLineNum;
private int myCharNum;
private int myIntVal;
}
class StringLitNode extends ExpNode {
public StringLitNode(int lineNum, int charNum, String strVal) {
myLineNum = lineNum;
myCharNum = charNum;
myStrVal = strVal;
}
public void unparse(PrintWriter p, int indent) {
p.print(myStrVal);
}
private int myLineNum;
private int myCharNum;
private String myStrVal;
}
class TrueNode extends ExpNode {
public TrueNode(int lineNum, int charNum) {
myLineNum = lineNum;
myCharNum = charNum;
}
public void unparse(PrintWriter p, int indent) {
p.print("true");
}
private int myLineNum;
private int myCharNum;
}
class FalseNode extends ExpNode {
public FalseNode(int lineNum, int charNum) {
myLineNum = lineNum;
myCharNum = charNum;
}
public void unparse(PrintWriter p, int indent) {
p.print("false");
}
private int myLineNum;
private int myCharNum;
}
class IdNode extends ExpNode {
public IdNode(int lineNum, int charNum, String strVal) {
myLineNum = lineNum;
myCharNum = charNum;
myStrVal = strVal;
}
/**
* Link the given symbol to this ID.
*/
public void link(TSym sym) {
mySym = sym;
}
/**
* Return the name of this ID.
*/
public String name() {
return myStrVal;
}
/**
* Return the symbol associated with this ID.
*/
public TSym sym() {
return mySym;
}
/**
* Return the line number for this ID.
*/
public int lineNum() {
return myLineNum;
}
/**
* Return the char number for this ID.
*/
public int charNum() {
return myCharNum;
}
/**
* nameAnalysis Given a symbol table symTab, do: - check for use of undeclared
* name - if ok, link to symbol table entry
*/
public void nameAnalysis(SymTable symTab) {
TSym sym = null;
try {
sym = symTab.lookupGlobal(myStrVal);
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in IdNode.nameAnalysis");
System.exit(-1);
}
if (sym == null) {
ErrMsg.fatal(myLineNum, myCharNum, "Undeclared identifier");
} else {
link(sym);
}
}
public Type typeCheck() {
return mySym.getType();
}
public void unparse(PrintWriter p, int indent) {
p.print(myStrVal);
if (mySym != null) {
p.print("(" + mySym + ")");
}
}
private int myLineNum;
private int myCharNum;
private String myStrVal;
private TSym mySym;
}
class DotAccessExpNode extends ExpNode {
public DotAccessExpNode(ExpNode loc, IdNode id) {
myLoc = loc;
myId = id;
mySym = null;
}
/**
* Return the symbol associated with this dot-access node.
*/
public TSym sym() {
return mySym;
}
/**
* Return the line number for this dot-access node. The line number is the one
* corresponding to the RHS of the dot-access.
*/
public int lineNum() {
return myId.lineNum();
}
/**
* Return the char number for this dot-access node. The char number is the one
* corresponding to the RHS of the dot-access.
*/
public int charNum() {
return myId.charNum();
}
/**
* nameAnalysis Given a symbol table symTab, do: - process the LHS of the
* dot-access - process the RHS of the dot-access - if the RHS is of a struct
* type, set the sym for this node so that a dot-access "higher up" in the AST
* can get access to the symbol table for the appropriate struct definition
*/
public void nameAnalysis(SymTable symTab) {
badAccess = false;
SymTable structSymTab = null; // to lookup RHS of dot-access
TSym sym = null;
myLoc.nameAnalysis(symTab); // do name analysis on LHS
// if myLoc is really an ID, then sym will be a link to the ID's symbol
if (myLoc instanceof IdNode) {
IdNode id = (IdNode) myLoc;
sym = id.sym();
// check ID has been declared to be of a struct type
if (sym == null) { // ID was undeclared
badAccess = true;
} else if (sym instanceof StructSym) {
// get symbol table for struct type
TSym tempSym = ((StructSym) sym).getStructType().sym();
structSymTab = ((StructDefSym) tempSym).getSymTable();
} else { // LHS is not a struct type
ErrMsg.fatal(id.lineNum(), id.charNum(), "Dot-access of non-struct type");
badAccess = true;
}
}
// if myLoc is really a dot-access (i.e., myLoc was of the form
// LHSloc.RHSid), then sym will either be
// null - indicating RHSid is not of a struct type, or
// a link to the TSym for the struct type RHSid was declared to be
else if (myLoc instanceof DotAccessExpNode) {
DotAccessExpNode loc = (DotAccessExpNode) myLoc;
if (loc.badAccess) { // if errors in processing myLoc
badAccess = true; // don't continue proccessing this dot-access
} else { // no errors in processing myLoc
sym = loc.sym();
if (sym == null) { // no struct in which to look up RHS
ErrMsg.fatal(loc.lineNum(), loc.charNum(), "Dot-access of non-struct type");
badAccess = true;
} else { // get the struct's symbol table in which to lookup RHS
if (sym instanceof StructDefSym) {
structSymTab = ((StructDefSym) sym).getSymTable();
} else {
System.err.println("Unexpected TSym type in DotAccessExpNode");
System.exit(-1);
}
}
}
}
else { // don't know what kind of thing myLoc is
System.err.println("Unexpected node type in LHS of dot-access");
System.exit(-1);
}
// do name analysis on RHS of dot-access in the struct's symbol table
if (!badAccess) {
try {
sym = structSymTab.lookupGlobal(myId.name()); // lookup
} catch (EmptySymTableException ex) {
System.err.println("Unexpected EmptySymTableException " + " in DotAccessExpNode.nameAnalysis");
}
if (sym == null) { // not found - RHS is not a valid field name
ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Invalid struct field name");
badAccess = true;
}
else {
myId.link(sym); // link the symbol
// if RHS is itself as struct type, link the symbol for its struct
// type to this dot-access node (to allow chained dot-access)
if (sym instanceof StructSym) {
mySym = ((StructSym) sym).getStructType().sym();
}
}
}
}
public void unparse(PrintWriter p, int indent) {
myLoc.unparse(p, 0);
p.print(".");
myId.unparse(p, 0);
}
// 2 kids
private ExpNode myLoc;
private IdNode myId;
private TSym mySym; // link to TSym for struct type
private boolean badAccess; // to prevent multiple, cascading errors
}
class AssignNode extends ExpNode {
public AssignNode(ExpNode lhs, ExpNode exp) {
myLhs = lhs;
myExp = exp;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's two children
*/
public void nameAnalysis(SymTable symTab) {
myLhs.nameAnalysis(symTab);
myExp.nameAnalysis(symTab);
}
public void typeCheck() {
}
public void unparse(PrintWriter p, int indent) {
if (indent != -1)
p.print("(");
myLhs.unparse(p, 0);
p.print(" = ");
myExp.unparse(p, 0);
if (indent != -1)
p.print(")");
}
// 2 kids
private ExpNode myLhs;
private ExpNode myExp;
}
class CallExpNode extends ExpNode {
public CallExpNode(IdNode name, ExpListNode elist) {
myId = name;
myExpList = elist;
}
public CallExpNode(IdNode name) {
myId = name;
myExpList = new ExpListNode(new LinkedList<ExpNode>());
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's two children
*/
public void nameAnalysis(SymTable symTab) {
myId.nameAnalysis(symTab);
myExpList.nameAnalysis(symTab);
}
// ** unparse **
public void unparse(PrintWriter p, int indent) {
myId.unparse(p, 0);
p.print("(");
if (myExpList != null) {
myExpList.unparse(p, 0);
}
p.print(")");
}
// 2 kids
private IdNode myId;
private ExpListNode myExpList; // possibly null
}
abstract class UnaryExpNode extends ExpNode {
public UnaryExpNode(ExpNode exp) {
myExp = exp;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's child
*/
public void nameAnalysis(SymTable symTab) {
myExp.nameAnalysis(symTab);
}
// one child
protected ExpNode myExp;
}
abstract class BinaryExpNode extends ExpNode {
public BinaryExpNode(ExpNode exp1, ExpNode exp2) {
myExp1 = exp1;
myExp2 = exp2;
}
/**
* nameAnalysis Given a symbol table symTab, perform name analysis on this
* node's two children
*/
public void nameAnalysis(SymTable symTab) {
myExp1.nameAnalysis(symTab);
myExp2.nameAnalysis(symTab);
}
// two kids
protected ExpNode myExp1;
protected ExpNode myExp2;
}
// **********************************************************************
// Subclasses of UnaryExpNode
// **********************************************************************
class UnaryMinusNode extends UnaryExpNode {
public UnaryMinusNode(ExpNode exp) {
super(exp);
}
public void unparse(PrintWriter p, int indent) {
p.print("(-");
myExp.unparse(p, 0);
p.print(")");
}
}
class NotNode extends UnaryExpNode {
public NotNode(ExpNode exp) {
super(exp);
}
public void unparse(PrintWriter p, int indent) {
p.print("(!");
myExp.unparse(p, 0);
p.print(")");
}
}
// **********************************************************************
// Subclasses of BinaryExpNode
// **********************************************************************
class PlusNode extends BinaryExpNode {
public PlusNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" + ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class MinusNode extends BinaryExpNode {
public MinusNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" - ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class TimesNode extends BinaryExpNode {
public TimesNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" * ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class DivideNode extends BinaryExpNode {
public DivideNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" / ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class AndNode extends BinaryExpNode {
public AndNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" && ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class OrNode extends BinaryExpNode {
public OrNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" || ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class EqualsNode extends BinaryExpNode {
public EqualsNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public boolean typeCheck() {
this.myExp1
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" == ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class NotEqualsNode extends BinaryExpNode {
public NotEqualsNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" != ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class LessNode extends BinaryExpNode {
public LessNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" < ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class GreaterNode extends BinaryExpNode {
public GreaterNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" > ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class LessEqNode extends BinaryExpNode {
public LessEqNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" <= ");
myExp2.unparse(p, 0);
p.print(")");
}
}
class GreaterEqNode extends BinaryExpNode {
public GreaterEqNode(ExpNode exp1, ExpNode exp2) {
super(exp1, exp2);
}
public void unparse(PrintWriter p, int indent) {
p.print("(");
myExp1.unparse(p, 0);
p.print(" >= ");
myExp2.unparse(p, 0);
p.print(")");
}
}
|
[
"woon7743@gmail.com"
] |
woon7743@gmail.com
|
2e647bf5dc0a083f704c4e9748cd4a2c571e007f
|
8f447092708dca22ba533541960c8ecd008907b7
|
/src/main/java/solutions/OpenTheLock.java
|
39eac9a4a88e257704716f10e3640853e1efcce9
|
[
"MIT"
] |
permissive
|
chyuck/leet-code
|
35e9b9ce809c426d23591de7477dfd386dfaa3dc
|
a45a8e9c377cc141f7ecb7f9f454f623f3cc696b
|
refs/heads/master
| 2021-07-03T06:35:21.968355
| 2020-10-21T01:28:29
| 2020-10-21T01:28:29
| 188,590,365
| 2
| 1
|
MIT
| 2020-06-25T01:35:52
| 2019-05-25T16:44:44
|
Java
|
UTF-8
|
Java
| false
| false
| 2,295
|
java
|
package solutions;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;
/**
* Solution for https://leetcode.com/problems/open-the-lock/ problem with
* Time complexity: O(n * a ^ n + d)
* Space complexity: O(a ^ n + d)
* where n (=4) - number of lock digits, a (=10) - number of digit alphabet (0-9), d - number of dead ends
*/
public class OpenTheLock {
public int openLock(String[] deadends, String target) {
Set<String> blockSet = new HashSet<>(deadends.length);
for (String deadend : deadends) {
blockSet.add(deadend);
}
if (blockSet.contains("0000") || blockSet.contains(target)) {
return -1;
}
if (target.equals("0000")) {
return 0;
}
int result = 1;
Set<String> visited = new HashSet<>();
visited.add("0000");
Queue<String> bfs = new LinkedList<>();
bfs.add("0000");
while (!bfs.isEmpty()) {
int size = bfs.size();
for (int i = 0; i < size; i++) {
String code = bfs.remove();
for (String nextCode : getNextCodes(code)) {
if (blockSet.contains(nextCode)) {
continue;
}
if (visited.contains(nextCode)) {
continue;
}
if (target.equals(nextCode)) {
return result;
}
bfs.add(nextCode);
visited.add(nextCode);
}
}
result++;
}
return -1;
}
private static List<String> getNextCodes(String code) {
List<String> results = new ArrayList<>();
for (int i = 0; i < code.length(); i++) {
char c = code.charAt(i);
String pre = code.substring(0, i);
String post = code.substring(i + 1);
char next1 = c == '9' ? '0' : (char)(c + 1);
results.add(pre + next1 + post);
char next2 = c == '0' ? '9' : (char)(c - 1);
results.add(pre + next2 + post);
}
return results;
}
}
|
[
"andrey@chyuck.com"
] |
andrey@chyuck.com
|
77c0c090e337d1507e7c75a05d3f824bf9c7261d
|
4fe3737c10e9f30d5a791bf4784bac1ff4db74cb
|
/OOP-Java-6/src/Controller/Controller.java
|
8ee9da3d8face257ae0327f35dabd46c5cdfc2cd
|
[] |
no_license
|
fatmemahmud/OOP-Java
|
a9bc68b14d6e13fbb10e1d75f5cff7de76ea98ec
|
5dea821376f52f63dc4931070e9feaa9ad434271
|
refs/heads/master
| 2020-12-10T14:44:33.497303
| 2020-03-09T18:45:51
| 2020-03-09T18:45:51
| 233,622,593
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,455
|
java
|
package Controller;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.MouseListener;
import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import org.w3c.dom.events.MouseEvent;
import ChessBoard.TraditionalBoard;
import ChessGame.GameViewer;
import Pieces.Pair;
import Pieces.Piece;
public class Controller {
static GameViewer viewer; // User interaction
public static TraditionalBoard board;
Controller()
{
board = new TraditionalBoard();
}
public static void main(String[] args) throws InterruptedException
{
Controller c = new Controller();
viewer = new GameViewer(c);
}
public static JMenuBar getMenu() {
JMenuBar menuBar;
JMenu menu;
ActionListener actionlistener = new ActionListener(){
public void actionPerformed(ActionEvent e) {
String s = e.getActionCommand();
char command =s.charAt(0);
switch(command)
{
case 'N':
viewer.updateScore(board.turn);
board = new TraditionalBoard();
viewer.pause = false;
viewer.repaint();
break;
case 'R':
board = new TraditionalBoard();
viewer.pause = false;
viewer.repaint();
break;
case 'P':
viewer.pause = !viewer.pause;
break;
case 'U':
board.undo();
viewer.repaint();
System.out.println("Undo !!!!"); //undo
break;
case 'Q':
board.forfeit();
viewer.updateScore(board.turn);
System.out.println("Quit!!");
break;
}
}
};
//Create the menu bar.
menuBar = new JMenuBar();
//Build the first menu.
menu = new JMenu("Board");
JMenuItem menuitem = new JMenuItem("Settings");
menuitem = new JMenuItem("New Game");
menuitem.setActionCommand("N");
menuitem.addActionListener(actionlistener);
menu.add(menuitem);
menuitem = new JMenuItem("Restart");
menuitem.setActionCommand("R");
menuitem.addActionListener(actionlistener);
menu.add(menuitem);
JCheckBoxMenuItem cbMenuItem = new JCheckBoxMenuItem("Pause");
cbMenuItem.setActionCommand("P");
cbMenuItem.addActionListener(actionlistener);
menu.add(cbMenuItem);
menuitem = new JMenuItem("Quit");
menuitem.setActionCommand("Q");
menuitem.addActionListener(actionlistener);
menu.add(menuitem);
menuBar.add(menu);
menu = new JMenu("Edit");
menuitem = new JMenuItem("Settings");
menuitem = new JMenuItem("Undo");
menuitem.setActionCommand("U");
menuitem.addActionListener(actionlistener);
menu.add(menuitem);
menuBar.add(menu);
return menuBar;
}
public static MouseListener getMouse() {
MouseListener mouselistener = new MouseListener(){
public void mouseClicked(MouseEvent e) {
if(!viewer.pause)
{
//gets the x and y coordinates on the board
int newx = (int) ((board.getWidth() * ((JComponent) e).getX()) / viewer.getWidth() ) ;
int newy = (int) ((board.getHeight() * (((JComponent) e).getY()-40)) / viewer.getHeight() );
boolean movePiece = ((InputEvent) e).isShiftDown();
if(movePiece)
{
board.moveSelectedPiece(newx, newy);
movePiece = false;
}
else
{
viewer.mouseX=newx;
viewer.mouseY=newy;
board.mouseX=newx;
board.mouseY=newy;
Vector<Pair> moves = board.getValidMoves();
viewer.addMoves(moves);
viewer.repaint();
}
}
//pause is true
else
{
viewer.pause = true;
}
}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseClicked(java.awt.event.MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(java.awt.event.MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(java.awt.event.MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(java.awt.event.MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(java.awt.event.MouseEvent e) {
// TODO Auto-generated method stub
}
};
return mouselistener;
}
public Piece getPieces(int player, char name, int index )
{
if(player ==1)
return board.getPieces(board.player1, name, index, null );
else
return board.getPieces(board.player2, name, index, null);
}
public int getW()
{ return board.getWidth(); }
public int getH()
{ return board.getHeight(); }
public int gameOver()
{
if(board.player1.king.isEaten)
{
return 1;
}
else if(board.player2.king.isEaten)
{
return 2;
}
else
return -1;
}
}
|
[
"noreply@github.com"
] |
fatmemahmud.noreply@github.com
|
a7b75589113ccf983fd623958dc7c7e582febaef
|
4e0753251b3edc4828f8219ad949d36234e50034
|
/app/src/main/java/com/example/specialcalendartest/MySelectorDecorator.java
|
659dad51701864edb2361846c345786d0afb9a6e
|
[] |
no_license
|
alfayu6799/SpecialCalendarTest
|
01889266bdaf638a2e51641aa603aa5615b8bca7
|
a0960bd9d26e47dfe102c9bc230b4e634712f8bf
|
refs/heads/master
| 2023-03-09T08:52:00.867502
| 2021-02-26T01:19:15
| 2021-02-26T01:19:15
| 341,855,480
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 856
|
java
|
package com.example.specialcalendartest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import com.prolificinteractive.materialcalendarview.CalendarDay;
import com.prolificinteractive.materialcalendarview.DayViewDecorator;
import com.prolificinteractive.materialcalendarview.DayViewFacade;
public class MySelectorDecorator implements DayViewDecorator {
private final Drawable drawable;
@SuppressLint("UseCompatLoadingForDrawables")
public MySelectorDecorator(Activity context) {
drawable = context.getResources().getDrawable(R.drawable.my_selector);
}
@Override
public boolean shouldDecorate(CalendarDay day) {
return true;
}
@Override
public void decorate(DayViewFacade view) {
view.setSelectionDrawable(drawable);
}
}
|
[
"lala@yhcyhc.com"
] |
lala@yhcyhc.com
|
09e9afa5a9770a0f2a6e0f4bfbbd7e9b12c9e7ff
|
5077430e8fa31f6166b22e91559a6ec9353f5fc2
|
/src/main/java/com/example/datajpa/entity/Team.java
|
4250cb60d84880fa151ecddcf6c98274c009f383
|
[] |
no_license
|
KimSungShin/inflearn-data-jpa
|
b60fa09c29a94fce0d3d918e60a7037f4b1e5c15
|
4578095a25c71055224fcdb25dbb3c80c1ffea84
|
refs/heads/master
| 2023-05-28T21:30:04.812721
| 2021-06-12T08:56:03
| 2021-06-12T08:56:03
| 376,244,149
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 515
|
java
|
package com.example.datajpa.entity;
import lombok.*;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Getter @Setter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@ToString(of= {"id", "name"})
public class Team {
@Id @GeneratedValue
@Column(name= "team_id")
private Long id;
private String name;
@OneToMany(mappedBy = "team")
private List<Member> members = new ArrayList<>();
public Team(String name) {
this.name = name;
}
}
|
[
"sungsin323@gmail.com"
] |
sungsin323@gmail.com
|
c2c2c16c84ba7536e11ca279e17efe0c6491b52d
|
d433f9885bb31ba9fde5020ecfd8938f4a8bfeff
|
/demo/src/main/java/org/opencdnunion/media/streamer/demo/DemoApplication.java
|
b981439458a76d1227b4b937462dc05671cc355a
|
[
"Apache-2.0"
] |
permissive
|
yelllowhat/UnionMobileStreaming_Android
|
52b61402d079611514e842b8bdef03758ceda8ca
|
4386569cacc1edf3c4b9f673d411e6824880a122
|
refs/heads/master
| 2021-04-13T18:44:17.360945
| 2017-12-14T08:23:39
| 2017-12-14T08:23:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 710
|
java
|
package org.opencdnunion.media.streamer.demo;
import android.app.Application;
import com.facebook.drawee.backends.pipeline.Fresco;
import org.opencdnunion.media.streamer.util.device.DeviceInfoTools;
/**
* demo for deviceTools
* 建议在app加载时对DeviceInfoTools进行初始化,以便最快拿到设备信息
*/
public class DemoApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// 初始化本地存储,若本地无信息或者信息已经过期,会向服务器发起请求
DeviceInfoTools.getInstance().init(this);
// 初始化fresco库,用来支持动态水印功能
Fresco.initialize(this);
}
}
|
[
"chengle@kingsoft.com"
] |
chengle@kingsoft.com
|
a058f089e649840cea97b6b844ae4814f954635d
|
69c8f884651ff7d0f937ac8d67326fe2bec6e52e
|
/demo-lock/src/main/java/com/example/demo/lock/OrderService.java
|
cd9794d54fb0a21b8792505b11025a53873ca607
|
[] |
no_license
|
zheng0918/all-demos
|
e1a05cf29beb9d56083e7dde2f3e0d21f4293a57
|
fe1bb9d78f28597af6370cf87ec6d5e94da0e07a
|
refs/heads/master
| 2022-07-07T01:44:57.914756
| 2019-10-12T06:40:49
| 2019-10-12T06:40:49
| 201,192,392
| 0
| 0
| null | 2022-06-17T02:20:53
| 2019-08-08T06:26:05
|
Java
|
UTF-8
|
Java
| false
| false
| 1,103
|
java
|
package com.example.demo.lock;
import java.nio.channels.Selector;
import java.util.concurrent.locks.ReentrantLock;
/**
* @annotation:
* @author: Zhengx
* @create: 2019-06-17 16:30
*/
public class OrderService {
/**使用static,这样每个线程拿到的是同一把锁,当然,spring中service默认就是单例**/
private static ReentrantLock reentrantLock = new ReentrantLock(true);
public void doSomething(String arg){
// 比如我们同一时间,只允许一个线程创建订单
reentrantLock.lock();
// 通常,lock 之后紧跟着 try 语句
try {
// 这块代码同一时间只能有一个线程进来(获取到锁的线程),
// 其他的线程在lock()方法上阻塞,等待获取到锁,再进来
// 执行代码...
// 执行代码...
// 执行代码...
}catch (Exception e){
// TODO
e.printStackTrace();
}finally {
//释放锁,synchronize不需要释放锁
reentrantLock.unlock();
}
}
}
|
[
"zhengxuan@xx.com"
] |
zhengxuan@xx.com
|
b3cab28bfc83a15dd271febf04bdf1abcb2834ed
|
344357a71a771e16e0e2b08b1766e973dcca667b
|
/src/main/java/com/jk/utils/QrCode.java
|
addc13d32234e0e4df4fb54d0a2bfd2def55627f
|
[] |
no_license
|
yingjingxiaomu/springboot-house
|
0fdb3426a2ab7e394631d6889cebf4bf8f871a83
|
9e9bbc7027b7ef95318bdab2205611e6b64c11b1
|
refs/heads/master
| 2021-04-09T12:58:59.193204
| 2018-03-17T00:05:54
| 2018-03-17T00:05:54
| 125,317,996
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,526
|
java
|
package com.jk.utils;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
public class QrCode {
public static void testEncode(String content , String shortCode) throws WriterException, IOException {
String filePath = ConstantsBean.QRCODE_PATH;
String fileName = shortCode+".png";
int width = 300; // 图像宽度
int height = 300; // 图像高度
String format = "png";// 图像类型
Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
BarcodeFormat.QR_CODE, width, height, hints);// 生成矩阵
Path path = FileSystems.getDefault().getPath(filePath, fileName);
MatrixToImageWriter.writeToPath(bitMatrix, format, path);// 输出图像
String qrcode = filePath+fileName;
BufferedReader bre = new BufferedReader(new FileReader(qrcode));//此时获取到的bre就是整个文件的缓存流
bre.close();
System.out.println("输出成功.");
}
}
|
[
"1161728641@qq.com"
] |
1161728641@qq.com
|
6af2eebe9ccf09f5311963955db170740b481fcd
|
11c5f92653a24fa5de56da91c58d04645617e7cf
|
/java/AST/P1.java
|
5928810dad0b504817c80851507238c01893e192
|
[] |
no_license
|
javibr/Compiler
|
a47d9338d9869e2258e887ad35ea8395977ab002
|
30fcfc9ff0bef7a661baf2eff3e51b55279fef58
|
refs/heads/master
| 2021-01-18T21:06:28.203140
| 2017-10-31T18:06:26
| 2017-10-31T18:06:26
| 87,005,256
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 427
|
java
|
package AST;
import java.io.*;
import Errors.*;
import Compiler.*;
public class P1 implements Print{
Exp s;
public P1(Exp s){
this.s=s;
}
public void computeAH1()throws CompilerExc{
int a=s.computeType();
if(a != Typ.tstring){
throw new PrintExc(a);
}
}
public void CodeGenerator(BufferedWriter w, String indent)throws IOException{
w.write(indent+"System.out.println("+s.CodeGenerator()+")");
}
}
|
[
"Javi@MacBook-Pro-de-Javier-2.local"
] |
Javi@MacBook-Pro-de-Javier-2.local
|
25d004343a4fa98e8e5a853ae032880505bbbe6a
|
52c7029d28574fe8f72ffd5e371c1a98b55e00a6
|
/src/ca/spaz/sql/SQLRow.java
|
505cd4bcaa5c8f6d2a925411c1025f6e8645dd59
|
[] |
no_license
|
trman/cronometer
|
f680b6b603f00c4094c3f6a7ef48d88257f15f86
|
7b7c13d179687188ec5a4fcf6c68ba3669d48f15
|
refs/heads/master
| 2020-09-30T09:45:43.682533
| 2019-06-30T15:52:44
| 2019-06-30T15:52:44
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,145
|
java
|
package ca.spaz.sql;
import java.sql.*;
import java.util.HashMap;
import java.util.Iterator;
/**
* @TODO: rename, enhance.
*
* A super-simple relational-object mapping system.
*
* @author adavidson
*/
public class SQLRow {
private String name;
private HashMap rows = new HashMap();
public class SQLCol {
int type;
String name;
Object value;
}
public SQLRow(String name) {
this.name = name;
}
public void addColumn(String name, int type) {
SQLCol col = new SQLCol();
col.type = type;
col.name = name;
rows.put(name, col);
}
public void setValue(String name, Object val) {
SQLCol col = (SQLCol)rows.get(name);
assert (col != null);
if (col != null) {
col.value = val;
}
}
private String getDatabaseTypeName(int colType) {
switch (colType) {
case Types.TINYINT: {
return "TINYINT";
}
case Types.SMALLINT: {
return "SMALLINT";
}
case Types.INTEGER: {
return "INTEGER";
}
case Types.BIGINT: {
return "BIGINT";
}
case Types.VARCHAR: {
return "VARCHAR";
}
case Types.TIMESTAMP: {
return "TIMESTAMP";
}
case Types.DOUBLE: {
return "DOUBLE";
}
default: {
return null;
}
}
}
public void createTable(Connection conn) throws SQLException {
StringBuffer sql = new StringBuffer();
sql.append("CREATE TABLE ");
sql.append(name);
sql.append(" ( ");
int count = 0;
Iterator iter = rows.values().iterator();
while (iter.hasNext()) {
SQLCol col = (SQLCol) iter.next();
sql.append(col.name);
sql.append(" ");
sql.append(getDatabaseTypeName(col.type));
if (++count < rows.size()) {
sql.append(", ");
}
}
sql.append(" ); ");
conn.createStatement().execute(sql.toString());
}
}
|
[
"git@stevenmyint.com"
] |
git@stevenmyint.com
|
461af7c0b2c1a3b5fc887d2733799f481fa4b3fc
|
d5c61b7a1e9375c2b8af51662015c01442a3b540
|
/config/config-api/src/com/thoughtworks/go/config/merge/MergePipelineConfigs.java
|
8303abc4720671b5dbbd1a2678e438271d9f3214
|
[
"Apache-2.0"
] |
permissive
|
feluraschi/gocd
|
d81c8cf95dd4e4c8b8906250ace0e51e1ec365a3
|
1dd40f12e73b643bec6c26866ef52337a0b0e331
|
refs/heads/master
| 2021-01-18T05:15:49.674631
| 2015-09-10T06:55:48
| 2015-09-10T06:55:48
| 42,272,251
| 0
| 0
| null | 2015-09-10T21:43:34
| 2015-09-10T21:43:33
| null |
UTF-8
|
Java
| false
| false
| 17,714
|
java
|
/*************************GO-LICENSE-START*********************************
* Copyright 2014 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*************************GO-LICENSE-END***********************************/
package com.thoughtworks.go.config.merge;
import com.thoughtworks.go.config.*;
import com.thoughtworks.go.config.remote.ConfigOrigin;
import com.thoughtworks.go.config.remote.FileConfigOrigin;
import com.thoughtworks.go.config.validation.NameTypeValidator;
import com.thoughtworks.go.domain.ConfigErrors;
import com.thoughtworks.go.domain.PiplineConfigVisitor;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import static com.thoughtworks.go.util.ExceptionUtils.bomb;
/**
* @understands pipeline group configuration in many parts.
*
* Composite of many pipeline configuration parts.
*/
public class MergePipelineConfigs implements PipelineConfigs {
private List<PipelineConfigs> parts = new ArrayList<PipelineConfigs>();
private final ConfigErrors configErrors = new ConfigErrors();
public MergePipelineConfigs(PipelineConfigs... parts)
{
this.parts.addAll(Arrays.asList(parts));
validateGroupNameUniqueness(this.parts);
}
public MergePipelineConfigs(List<PipelineConfigs> parts)
{
this.parts = parts;
validateGroupNameUniqueness(this.parts);
}
private void validateGroupNameUniqueness(List<PipelineConfigs> parts) {
String name = parts.get(0).getGroup();
for (PipelineConfigs part : parts) {
String otherName = part.getGroup();
if (!StringUtils.equals(otherName, name))
throw new IllegalArgumentException("Group names must be the same in merge");
}
}
public PipelineConfigs getAuthorizationPart()
{
PipelineConfigs found = this.getAuthorizationPartOrNull();
if(found == null)
throw bomb("No valid configuration part to store authorization");
return found;
}
public PipelineConfigs getAuthorizationPartOrNull()
{
for(PipelineConfigs part : parts)
{
if(part.getOrigin() != null && part.getOrigin().isLocal())
return part;
}
return null;
}
public PipelineConfigs getPartWithPipeline(CaseInsensitiveString pipelineName)
{
for(PipelineConfigs part : parts)
{
if(part.hasPipeline(pipelineName))
return part;
}
return null;
}
public PipelineConfigs getFirstEditablePartOrNull()
{
for(PipelineConfigs part : parts)
{
if(isEditable(part))
return part;
}
return null;
}
public PipelineConfigs getFirstEditablePart()
{
PipelineConfigs found = getFirstEditablePartOrNull();
if(found == null)
throw bomb("No editable configuration part");
return found;
}
@Override
public void validate(ValidationContext validationContext) {
String group = this.getGroup();
if (StringUtils.isBlank(group) || !new NameTypeValidator().isNameValid(group)) {
this.configErrors.add(GROUP, NameTypeValidator.errorMessage("group", group));
}
for(PipelineConfigs part : this.parts)
{
part.validate(validationContext);
}
verifyPipelineNameUniqueness();
}
private void verifyPipelineNameUniqueness() {
HashMap<String, PipelineConfig> hashMap = new HashMap<String, PipelineConfig>();
for(PipelineConfig pipelineConfig : this){
pipelineConfig.validateNameUniqueness(hashMap);
}
}
@Override
public void validateNameUniqueness(Map<String, PipelineConfigs> groupNameMap) {
String currentName = sanitizedGroupName(this.getGroup()).toLowerCase();
PipelineConfigs groupWithSameName = groupNameMap.get(currentName);
if (groupWithSameName == null) {
groupNameMap.put(currentName, this);
} else {
groupWithSameName.addError(GROUP, createNameConflictError());
this.nameConflictError();
}
}
private void nameConflictError() {
this.configErrors.add(GROUP, createNameConflictError());
}
private String createNameConflictError() {
return String.format("Group with name '%s' already exists", this.getGroup());
}
public static String sanitizedGroupName(String group) {
return StringUtils.isBlank(group) ? DEFAULT_GROUP : group;
}
@Override
public ConfigOrigin getOrigin() {
throw new RuntimeException("Not implemented");
}
@Override
public void setOrigins(ConfigOrigin origins) {
throw bomb("Cannot set origins on merged config");
}
@Override
public PipelineConfig findBy(CaseInsensitiveString pipelineName) {
for (PipelineConfigs part : this.parts)
{
PipelineConfig found = part.findBy(pipelineName);
if(found != null)
return found;
}
return null;
}
@Override
public int size() {
int count = 0;
for (PipelineConfigs part : this.parts)
{
count += part.size();
}
return count;
}
@Override
public boolean isEmpty() {
return size() == 0;
}
@Override
public boolean contains(PipelineConfig o) {
for (PipelineConfigs part : this.parts)
{
if(part.contains(o))
return true;
}
return false;
}
@Override
public void remove(PipelineConfig pipelineConfig) {
PipelineConfigs part = this.getPartWithPipeline(pipelineConfig.name());
if(!isEditable(part))
throw bomb("Cannot remove pipeline fron non-editable configuration source");
part.remove(pipelineConfig);
}
@Override
public PipelineConfig remove(int i) {
if(i < 0)
throw new IndexOutOfBoundsException();
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
if(i < end)
return part.remove(i - start);
start = end;
}
throw new IndexOutOfBoundsException();
}
@Override
public boolean add(PipelineConfig pipelineConfig) {
verifyUniqueName(pipelineConfig);
PipelineConfigs part = this.getFirstEditablePartOrNull();
if(part == null)
throw bomb("No editable configuration sources");
return part.add(pipelineConfig);
}
private void verifyUniqueName(PipelineConfig pipelineConfig) {
if (alreadyContains(pipelineConfig)) {
throw bomb("You have defined multiple pipelines called '" + pipelineConfig.name() + "'. Pipeline names must be unique.");
}
}
private boolean alreadyContains(PipelineConfig pipelineConfig) {
for (PipelineConfigs part : this.parts)
{
if(part.hasPipeline(pipelineConfig.name()))
return true;
}
return false;
}
public PipelineConfigs getPartWithIndex(int i)
{
if(i < 0)
throw new IndexOutOfBoundsException();
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
if(i < end)
return part;
start = end;
}
throw new IndexOutOfBoundsException();
}
public PipelineConfigs getPartWithIndexForInsert(int i)
{
if(i < 0)
throw new IndexOutOfBoundsException();
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
if(i < end)
return part;
start = end;
}
return this.parts.get(this.parts.size() -1);
}
@Override
public PipelineConfig get(int i) {
if(i < 0)
throw new IndexOutOfBoundsException();
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
if(i < end)
return part.get(i - start);
start = end;
}
throw new IndexOutOfBoundsException();
}
@Override
public boolean addWithoutValidation(PipelineConfig pipelineConfig) {
PipelineConfigs part = this.getFirstEditablePartOrNull();
if(part == null)
throw bomb("No editable configuration sources");
return part.addWithoutValidation(pipelineConfig);
}
@Override
public PipelineConfig set(int i, PipelineConfig pipelineConfig) {
if(i < 0)
throw new IndexOutOfBoundsException();
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
if(i < end) {
if(isEditable(part)) {
return part.set(i - start, pipelineConfig);
}
else {
throw bomb(String.format("Cannot edit pipeline %s", pipelineConfig.name()));
}
}
start = end;
}
throw new IndexOutOfBoundsException();
}
@Override
public void addToTop(PipelineConfig pipelineConfig) {
PipelineConfigs part = this.getFirstEditablePart();
part.addToTop(pipelineConfig);
}
@Override
public void add(int index, PipelineConfig pipelineConfig) {
PipelineConfigs part = getPartWithIndexForInsert(index);
if(!isEditable(part))
throw bomb("Cannot add pipeline to non-editable configuration part");
int start = getFirstIndexInPart(part);
part.add(index - start, pipelineConfig);
}
private int getFirstIndexInPart(PipelineConfigs p) {
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
if(part.equals(p))
return start;
start = end;
}
return -1;
}
@Override
public int indexOf(PipelineConfig o) {
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
int internalIndex = part.indexOf(o);
if(internalIndex > 0)
return start + internalIndex;
start = end;
}
return -1;
}
@Override
public Iterator<PipelineConfig> iterator() {
return new Iterator<PipelineConfig>() {
private int currentIndex = 0;
private int count = size();
@Override
public boolean hasNext() {
return currentIndex < count;
}
@Override
public PipelineConfig next() {
return get(currentIndex++);
}
@Override
public void remove() {
}
};
}
@Override
public String getGroup() {
return this.parts.get(0).getGroup();
}
@Override
public void setGroup(String group) {
if(group.equals(this.getGroup()))
{
return;
}
for(PipelineConfigs part : this.parts)
{
if(!isEditable(part))
{
throw bomb("Cannot update group name because there are non-editable parts");
}
}
for(PipelineConfigs part : this.parts)
{
part.setGroup(group);
}
}
private boolean isEditable(PipelineConfigs part) {
return part.getOrigin() != null && part.getOrigin().canEdit();
}
@Override
public boolean isNamed(String groupName) {
return this.isSameGroup(groupName);
}
public void update(String groupName, PipelineConfig pipeline, String pipelineName) {
if (!isSameGroup(groupName)) {
return;
}
this.set(getIndex(pipelineName), pipeline);
}
private boolean isSameGroup(String groupName) {
return StringUtils.equals(groupName, this.getGroup());
}
private int getIndex(String pipelineName) {
CaseInsensitiveString caseName = new CaseInsensitiveString(pipelineName);
int start =0;
for (PipelineConfigs part : this.parts)
{
int end = start + part.size();
if(part.hasPipeline(caseName))
{
int internalIndex = part.indexOf(part.findBy(caseName));
return start + internalIndex;
}
start = end;
}
return -1;
}
@Override
public boolean save(PipelineConfig pipeline, String groupName) {
if (isSameGroup(groupName)) {
this.addToTop(pipeline);
return true;
} else {
return false;
}
}
@Override
public void add(List<String> allGroup) {
allGroup.add(this.getGroup());
}
@Override
public boolean exist(int pipelineIndex) {
return false;
}
@Override
public boolean hasPipeline(CaseInsensitiveString pipelineName) {
for (PipelineConfigs part : this.parts)
{
if(part.hasPipeline(pipelineName))
return true;
}
return false;
}
@Override
public void accept(PiplineConfigVisitor visitor) {
for (PipelineConfig pipelineConfig : this) {
visitor.visit(pipelineConfig);
}
}
@Override
public boolean hasTemplate() {
for(PipelineConfigs part : this.parts)
{
if(part.hasTemplate())
return true;
}
return false;
}
@Override
public PipelineConfigs getCopyForEditing() {
List<PipelineConfigs> parts = new ArrayList<PipelineConfigs>();
for(PipelineConfigs part : this.parts)
{
parts.add(part.getCopyForEditing());
}
return new MergePipelineConfigs(parts);
}
@Override
public boolean isUserAnAdmin(CaseInsensitiveString userName, List<Role> memberRoles) {
return this.getAuthorizationPart().isUserAnAdmin(userName,memberRoles);
}
@Override
public ConfigErrors errors() {
return configErrors;
}
@Override
public List<PipelineConfig> getPipelines() {
List<PipelineConfig> list = new ArrayList<PipelineConfig>();
for(PipelineConfig pipe : this)
{
list.add(pipe);
}
return list;
}
@Override
public void addError(String fieldName, String message) {
configErrors.add(fieldName, message);
}
@Override
public void setConfigAttributes(Object attributes) {
Map attributeMap = (Map) attributes;
if (attributeMap == null) {
return;
}
if (attributeMap.containsKey(GROUP)) {
String group = (String) attributeMap.get(GROUP);
this.setGroup(group);
}
if (attributeMap.containsKey(AUTHORIZATION) || attributeMap.isEmpty()) {
PipelineConfigs authorizationPart = this.getAuthorizationPart();
authorizationPart.setConfigAttributes(attributes);
}
}
@Override
public List<AdminUser> getOperateUsers() {
return this.getAuthorizationPart().getOperateUsers();
}
@Override
public List<AdminRole> getOperateRoles() {
return this.getAuthorizationPart().getOperateRoles();
}
@Override
public List<String> getOperateRoleNames() {
return this.getAuthorizationPart().getOperateRoleNames();
}
@Override
public List<String> getOperateUserNames() {
return this.getAuthorizationPart().getOperateUserNames();
}
@Override
public void cleanupAllUsagesOfRole(Role roleToDelete) {
this.getAuthorizationPart().cleanupAllUsagesOfRole(roleToDelete);
}
@Override
public boolean hasAuthorizationDefined() {
return this.getAuthorizationPart().hasAuthorizationDefined();
}
@Override
public Authorization getAuthorization() {
return this.getAuthorizationPart().getAuthorization();
}
@Override
public void setAuthorization(Authorization authorization) {
this.getAuthorizationPart().setAuthorization(authorization);
}
@Override
public boolean hasViewPermission(CaseInsensitiveString username, UserRoleMatcher userRoleMatcher) {
return this.getAuthorizationPart().hasViewPermission(username,userRoleMatcher);
}
@Override
public boolean hasViewPermissionDefined() {
return this.getAuthorizationPart().hasViewPermissionDefined();
}
@Override
public boolean hasOperationPermissionDefined() {
return this.getAuthorizationPart().hasOperationPermissionDefined();
}
@Override
public boolean hasOperatePermission(CaseInsensitiveString username, UserRoleMatcher userRoleMatcher) {
return this.getAuthorizationPart().hasOperatePermission(username,userRoleMatcher);
}
}
|
[
"tom@ai-traders.com"
] |
tom@ai-traders.com
|
ac6030b0c0b1648d1de04bda890fe0ebfc0c26e0
|
ca5de73de380892e5269d178238572ffc1e09a48
|
/study-platform-api/src/main/java/com/yxgy/controller/RegisterLoginController.java
|
5a407c9ca3bf0b8b2c6a0dfe24891281f8e3e4f4
|
[] |
no_license
|
RNGTAO/study-platform
|
42a10e652b581930a2d82e36974b96ce06a408ac
|
38de3ec12511e07b13972d0ff6ff60cda7c2aba1
|
refs/heads/master
| 2022-11-29T18:16:47.630515
| 2020-08-10T08:18:39
| 2020-08-10T08:18:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,386
|
java
|
package com.yxgy.controller;
import com.yxgy.pojo.Users;
import com.yxgy.pojo.vo.UsersVO;
import com.yxgy.service.UserService;
import com.yxgy.utils.JSONResult;
import com.yxgy.utils.MD5Utils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@RestController
@Api(value = "用户注册和登陆的接口", tags = {"登陆和注册的Controller"})
public class RegisterLoginController extends BasicController {
@Autowired
private UserService userService;
@PostMapping("/register")
@ApiOperation(value = "用户注册", notes = "用户注册的接口")
public JSONResult register(@RequestBody Users user) throws Exception {
if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) {
return JSONResult.errorMsg("用户名和密码不能为空");
}
if (!userService.queryUsernameIsExist(user.getUsername())) {
user.setNickname(user.getUsername());
user.setPassword(MD5Utils.getMD5Str(user.getPassword()));
user.setFansCounts(0);
user.setReceiveLikeCounts(0);
user.setFollowCounts(0);
userService.saveUser(user);
} else {
//已经存在
return JSONResult.errorMsg("用户名已存在,请换一个重试");
}
user.setPassword("");
UsersVO userVO = setUserRedisSessionToken(user);
return JSONResult.ok(userVO);
}
public UsersVO setUserRedisSessionToken(Users userModel) {
String uniqueToken = UUID.randomUUID().toString();
redis.set(USER_REDIS_SESSION + ":" + userModel.getId(), uniqueToken, 1000 * 60 * 30);
UsersVO userVO = new UsersVO();
BeanUtils.copyProperties(userModel, userVO);
userVO.setUserToken(uniqueToken);
return userVO;
}
@PostMapping("/login")
@ApiOperation(value = "用户登陆", notes = "用户登陆的接口")
public JSONResult login(@RequestBody Users user) throws Exception {
if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) {
return JSONResult.errorMsg("用户名和密码不能为空");
}
Users result = userService.queryUserForLogin(user.getUsername(), MD5Utils.getMD5Str(user.getPassword()));
if (result != null) {
result.setPassword("");
UsersVO userVO = setUserRedisSessionToken(result);
return JSONResult.ok(userVO);
} else {
return JSONResult.errorMsg("用户名或密码错误");
}
}
@ApiOperation(value="用户注销", notes="用户注销的接口")
@ApiImplicitParam(name="userId", value="用户id", required=true,
dataType="String", paramType="query")
@PostMapping("/logout")
public JSONResult logout(String userId) throws Exception {
redis.del(USER_REDIS_SESSION + ":" + userId);
return JSONResult.ok();
}
}
|
[
"781978481@qq.com"
] |
781978481@qq.com
|
faa4442f0130b8638daac4d024a4ce0446c0bd2e
|
29c5be7038ac7dd756344ab12e5ce9c71730764d
|
/src/main/java/com/victor/playground/domain/util/FixedH2Dialect.java
|
3a75a11db88cf3772d6875cd8f70e76b5b5af4e8
|
[] |
no_license
|
sradhakr/mygatewayapp
|
ba21dd802dbf2403d5f24ab79c784645157614d6
|
51f2d48fba05b36aaf392da88147f0a056a5591a
|
refs/heads/master
| 2021-05-31T12:40:43.377216
| 2016-05-21T10:53:32
| 2016-05-21T10:53:32
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 262
|
java
|
package com.victor.playground.domain.util;
import java.sql.Types;
import org.hibernate.dialect.H2Dialect;
public class FixedH2Dialect extends H2Dialect {
public FixedH2Dialect() {
super();
registerColumnType(Types.FLOAT, "real");
}
}
|
[
"vgil@switch.com.uy"
] |
vgil@switch.com.uy
|
737baa8b0c8e21a49c92f6b9e08f11bf5291e421
|
ca9f38a23cbf173d1648252828af3ce4952bad02
|
/src/Aula06_APS/PessoaFisica.java
|
f73ec769fdac4c6a75afa5f7bfab6f4d1c447407
|
[] |
no_license
|
TiagoPires-92/S091-TP
|
5fd9ff0e159a81abbac00a066370c10a2a855ec9
|
6ea7a013375f2685041ed2fd9fca453862e62d95
|
refs/heads/master
| 2023-08-10T19:50:00.420378
| 2021-09-26T15:45:10
| 2021-09-26T15:45:10
| 398,134,215
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 334
|
java
|
package Aula06_APS;
public class PessoaFisica extends Pessoa {
private String cpf;
private Float salario;
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public Float getSalario() {
return salario;
}
public void setSalario(Float salario) {
this.salario = salario;
}
}
|
[
"tiago_pires@live.com"
] |
tiago_pires@live.com
|
2bd774b9802e276b79f3975c9990fac98b8fa78f
|
62a10adb804bddb33c1b295cb4346883cc044ea4
|
/1.12/src/main/java/stevekung/mods/indicatorutils/gui/GuiNewSleepMP.java
|
a095fabe1b524121008b2688ddf2bf0beaef636f
|
[] |
no_license
|
SteveKunG/IndicatorUtils
|
be0ac9bf785a82cbdce1c9cdb85791e5dbd6003a
|
51615246c3b1806dde485a075116b973842a554f
|
refs/heads/master
| 2021-04-15T12:32:54.577546
| 2017-07-19T10:53:49
| 2017-07-19T10:53:49
| 94,578,085
| 1
| 0
| null | 2017-06-16T20:16:58
| 2017-06-16T20:16:58
| null |
UTF-8
|
Java
| false
| false
| 1,960
|
java
|
package stevekung.mods.indicatorutils.gui;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.resources.I18n;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import stevekung.mods.indicatorutils.config.ExtendedModSettings;
@SideOnly(Side.CLIENT)
public class GuiNewSleepMP extends GuiNewChatIU
{
@Override
public void initGui()
{
super.initGui();
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height - 40, I18n.format("multiplayer.stopSleeping")));
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
if (keyCode == 1)
{
this.wakeFromSleep();
}
else if (keyCode != 28 && keyCode != 156)
{
super.keyTyped(typedChar, keyCode);
}
else
{
String s = this.inputField.getText().trim();
if (!s.isEmpty())
{
if (ExtendedModSettings.CHAT_MODE.equalsIgnoreCase("mineplex_party_chat"))
{
s = "@" + s;
}
this.sendChatMessage(s);
}
this.inputField.setText("");
this.mc.ingameGUI.getChatGUI().resetScroll();
}
}
@Override
protected void actionPerformed(GuiButton button)
{
if (button.id == 1)
{
this.wakeFromSleep();
}
else
{
super.actionPerformed(button);
}
}
private void wakeFromSleep()
{
NetHandlerPlayClient nethandlerplayclient = this.mc.player.connection;
nethandlerplayclient.sendPacket(new CPacketEntityAction(this.mc.player, CPacketEntityAction.Action.STOP_SLEEPING));
}
}
|
[
"mccommander_minecraft@hotmail.com"
] |
mccommander_minecraft@hotmail.com
|
db71b1918f3a765b16446c7a7eca56929581285c
|
b5695905d93af4d942d48054258fe7e0b4e8fe45
|
/module/nvt-converter/converter-main/src/main/java/nerve/network/converter/model/po/ConfirmWithdrawalPO.java
|
7f171b5abddfbcea32fe54d471f21a5c70a568f1
|
[
"MIT"
] |
permissive
|
arkDelphi/nerve
|
d4cddb6916e380afff71adc551dc3bbf679cb518
|
b0950a2f882e7858db7f75beb4cf12f130f098a3
|
refs/heads/master
| 2022-04-20T10:22:20.442901
| 2020-04-09T09:20:44
| 2020-04-09T09:20:44
| 255,826,499
| 0
| 1
|
MIT
| 2020-04-15T06:33:21
| 2020-04-15T06:33:20
| null |
UTF-8
|
Java
| false
| false
| 4,137
|
java
|
/**
* MIT License
* <p>
Copyright (c) 2019-2020 nerve.network
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package nerve.network.converter.model.po;
import io.nuls.base.data.NulsHash;
import nerve.network.converter.model.bo.HeterogeneousAddress;
import nerve.network.converter.model.txdata.ConfirmWithdrawalTxData;
import java.io.Serializable;
import java.util.List;
/**
* NERVE网络中确认提现交易状态的交易 确认的业务数据
* @author: Chino
* @date: 2020-03-06
*/
public class ConfirmWithdrawalPO implements Serializable {
private int heterogeneousChainId;
/**
* 异构链中对应的提现交易确认高度
*/
private long heterogeneousHeight;
/**
* 异构链中对应的提现交易hash
*/
private String heterogeneousTxHash;
/**
* NERVE网络中对应的提现交易hash
*/
private NulsHash withdrawalTxHash;
/**
* NERVE网络中对应的确认提现交易状态的交易hash
*/
private NulsHash confirmWithdrawalTxHash;
/**
* 需要分发提现手续费的节点异构链地址
*/
private List<HeterogeneousAddress> listDistributionFee;
public ConfirmWithdrawalPO() {
}
public ConfirmWithdrawalPO(ConfirmWithdrawalTxData txData, NulsHash confirmWithdrawalTxHash) {
this.heterogeneousChainId = txData.getHeterogeneousChainId();
this.heterogeneousHeight = txData.getHeterogeneousHeight();
this.heterogeneousTxHash = txData.getHeterogeneousTxHash();
this.withdrawalTxHash = txData.getWithdrawalTxHash();
this.listDistributionFee = txData.getListDistributionFee();
this.confirmWithdrawalTxHash = confirmWithdrawalTxHash;
}
public int getHeterogeneousChainId() {
return heterogeneousChainId;
}
public void setHeterogeneousChainId(int heterogeneousChainId) {
this.heterogeneousChainId = heterogeneousChainId;
}
public NulsHash getConfirmWithdrawalTxHash() {
return confirmWithdrawalTxHash;
}
public void setConfirmWithdrawalTxHash(NulsHash confirmWithdrawalTxHash) {
this.confirmWithdrawalTxHash = confirmWithdrawalTxHash;
}
public long getHeterogeneousHeight() {
return heterogeneousHeight;
}
public void setHeterogeneousHeight(long heterogeneousHeight) {
this.heterogeneousHeight = heterogeneousHeight;
}
public String getHeterogeneousTxHash() {
return heterogeneousTxHash;
}
public void setHeterogeneousTxHash(String heterogeneousTxHash) {
this.heterogeneousTxHash = heterogeneousTxHash;
}
public NulsHash getWithdrawalTxHash() {
return withdrawalTxHash;
}
public void setWithdrawalTxHash(NulsHash withdrawalTxHash) {
this.withdrawalTxHash = withdrawalTxHash;
}
public List<HeterogeneousAddress> getListDistributionFee() {
return listDistributionFee;
}
public void setListDistributionFee(List<HeterogeneousAddress> listDistributionFee) {
this.listDistributionFee = listDistributionFee;
}
}
|
[
"jideas@163.com"
] |
jideas@163.com
|
1b1e8db9584af2154de40247942a702755489c35
|
37a9a0f386bfc4467d1cd34b19c9162d19d25d04
|
/app/src/main/java/com/websarva/wings/android/menusample/MenuThanksActivity.java
|
16ee889ac2398072cfa84fde548798ed4b72a7a1
|
[] |
no_license
|
ShimadaMari/MenuSample
|
75aaee123ba668217ef111b78639dd56a7e2af48
|
4663dc505da6078709f381f78c512c7a4f3912bf
|
refs/heads/master
| 2020-04-05T18:05:23.453765
| 2018-11-12T13:33:03
| 2018-11-12T13:33:03
| 157,088,347
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,022
|
java
|
package com.websarva.wings.android.menusample;
import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
public class MenuThanksActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_thanks);
//インテントオブジェクトを取得。
Intent intent = getIntent();
//リスト画面から渡されたデータを取得。
String menuName = intent.getStringExtra("menuName");
String menuPrice = intent.getStringExtra("menuPrice");
//定食名と金額を表示させるTextViewを取得。
TextView tvMenuName = findViewById(R.id.tvMenuName);
TextView tvMenuPrice = findViewById(R.id.tvMenuPrice);
//TextViewに定食名と金額を表示。output
tvMenuName.setText(menuName);
tvMenuPrice.setText(menuPrice);
//戻るメニューの表示 アクションバーを取得
ActionBar actionBar = getSupportActionBar();
//アクションバーの戻るボタンを有効に設定
actionBar.setDisplayHomeAsUpEnabled(true);
}
/**
* 戻るボタンをタップした時の処理。
* @param view 画面部品。
*/
//public void onBackButtonClick(View view) {
// finish();
//}
//アクションバーの戻るメニュー選択時の処理
@Override
public boolean onOptionsItemSelected(MenuItem item) {
//選択されたメニューIDを取得
int itemId = item.getItemId();
//選択されたメニューが「戻る」の場合、アクティビティを終了
if(itemId == android.R.id.home){
finish();
}
return super.onOptionsItemSelected(item);
}
}
|
[
"washan0527@gmail.com"
] |
washan0527@gmail.com
|
a3ddba92d2c46bc30d9b8e356fe88885c1af4dec
|
7f223ec1ddfc88fd1e8732fe227a88fddc054926
|
/app/androidF/application/src/main/java/com/freebookqy/application/view/readview/utils/TypeFaceUtils.java
|
f4ac90cfff7e9cf10e990c5cfc49dae55f3694fb
|
[] |
no_license
|
sengeiou/qy_book_free
|
93da8933e0b1bd584bf974f97ed65063615917c4
|
42e35f88c24ce864de61d9f4f6921ca7df2970b7
|
refs/heads/master
| 2022-04-07T11:28:18.472504
| 2019-06-25T07:57:58
| 2019-06-25T07:57:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 789
|
java
|
package com.freebookqy.application.view.readview.utils;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.support.v4.content.res.ResourcesCompat;
import android.widget.TextView;
import com.freebookqy.application.R;
import com.freebookqy.application.app.QYApplication;
public class TypeFaceUtils {
public static void bindTypeFace_SourceHanSerifCN_Regular(TextView tv) {
Typeface tf = ResourcesCompat.getFont(tv.getContext(), R.font.hs_regular);
tv.setIncludeFontPadding(false);
tv.setTypeface(tf);
}
public static void bindTypeFace_SourceHanSerifCN_Regular(Paint paint) {
Typeface tf = ResourcesCompat.getFont(QYApplication.cxt(), R.font.hs_regular);
paint.setTypeface(tf);
}
}
|
[
"chenchendedefeng@126.com"
] |
chenchendedefeng@126.com
|
fbf376500590e9a03e17b5cfa0a49c8150a8c9b4
|
30e5bf1db26f0c5e6bddfe6e8d3e44ff8e038657
|
/src/com/sc/domain/List.java
|
5a5d531069b4d57dafc731e145db72ec4c6a0693
|
[] |
no_license
|
anilasj/FatButler
|
a7e5f80ac23d106bd54117991092379c48f985b5
|
41ece84bc9236a56e0979c53b290bf2606a32e1f
|
refs/heads/master
| 2016-09-05T17:26:21.946751
| 2012-08-04T23:24:54
| 2012-08-04T23:24:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,387
|
java
|
package com.sc.domain;
import java.util.Date;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class List {
public static final String STATUS_ACTIVE = "A";
private Integer id;
private Integer parentId;
private String name;
private Integer createdUid;
private String status;
private Date modified;
private Integer itemCount;
private java.util.List<List> items;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCreatedUid() {
return createdUid;
}
public void setCreatedUid(Integer createUid) {
this.createdUid = createUid;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public java.util.List<List> getItems() {
return items;
}
public void setItems(java.util.List<List> items) {
this.items = items;
}
public Integer getItemCount() {
return itemCount;
}
public void setItemCount(Integer itemCount) {
this.itemCount = itemCount;
}
}
|
[
"anilasj@hotmail.com"
] |
anilasj@hotmail.com
|
d17b48b094f0be76a7e0809b837372c2eec7e472
|
95cb740f32da06cac7581912019256861d3c631c
|
/demo/src/main/java/com/yzy/demo/test/vo/RedisHashVo.java
|
58f9fc22a31b47cc7f397911d79953b3341e7fd7
|
[] |
no_license
|
xyxbc-git/springCloud
|
f8470ddc7b0872ce8014c303c80a2a9eff5c3304
|
343ac77af4e046b7722a688baad93e1ebcddec19
|
refs/heads/main
| 2023-06-02T18:48:01.281898
| 2021-06-25T06:27:36
| 2021-06-25T06:27:36
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,066
|
java
|
package com.yzy.demo.test.vo;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* Redis 哈希 案例测试vo
* */
public class RedisHashVo {
@ApiModelProperty(" 学生 检索ID")
private String sIndex;
@ApiModelProperty(" 学生 存储缓存内容")
private List<Student> sList;
@ApiModelProperty(" 老师 检索ID")
private String tIndex;
@ApiModelProperty(" 老师 存储缓存内容")
private List<Teacher> tList;
public String getsIndex() {
return sIndex;
}
public void setsIndex(String sIndex) {
this.sIndex = sIndex;
}
public List<Student> getsList() {
return sList;
}
public void setsList(List<Student> sList) {
this.sList = sList;
}
public String gettIndex() {
return tIndex;
}
public void settIndex(String tIndex) {
this.tIndex = tIndex;
}
public List<Teacher> gettList() {
return tList;
}
public void settList(List<Teacher> tList) {
this.tList = tList;
}
}
|
[
"22"
] |
22
|
961e9f8edf19c679bb6da4675496985a2912b008
|
f4dcb6ab4cc24a47fba7edcd6c5fa3b126a26c32
|
/lp2/src/projetofinal_aed2_lp2/RedeEletrica.java
|
c421194a73baa0296b06974dffb67debfaf572bf
|
[] |
no_license
|
35365/Faculdade
|
6b7feaf4f5437ec2b1d0f11d4d68ad3a38d81885
|
32d42df3f8236e798c6838b55b6b37cbb401bfe2
|
refs/heads/master
| 2022-12-30T19:13:57.671529
| 2020-10-16T09:58:48
| 2020-10-16T09:58:48
| 284,710,035
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,043
|
java
|
package projetofinal_aed2_lp2;
import projetofinal_aed2_lp2.aux.SeparateChainingHash_ST_AED2;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serializable;
public class RedeEletrica implements Serializable{
private String nome;
private Double alimentacao;
private Integer centralID;
/**
*
* @element-type Contador
*/
private SeparateChainingHash_ST_AED2<Integer,Contador > contadores;
/**
*
* @element-type FonteEnergiaG
*/
private SeparateChainingHash_ST_AED2<Integer,FonteEnergiaG > fontes;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Double getAlimentacao() {
return alimentacao;
}
public void setAlimentacao(Double alimentacao) {
this.alimentacao = alimentacao;
}
public Integer getCentralID() {
return centralID;
}
public void setCentralID(Integer centralID) {
this.centralID = centralID;
}
public SeparateChainingHash_ST_AED2<Integer, Contador> getContadores() {
return contadores;
}
public SeparateChainingHash_ST_AED2<Integer,FonteEnergiaG> getFontes() {
return fontes;
}
/**
* O construtor inicializa as SeparateChainingHash de contadores e fontes
* @param nome
* @param alimentacao
* @param centralID
*/
public RedeEletrica(String nome, Double alimentacao, Integer centralID) {
this.nome = nome;
this.alimentacao = alimentacao;
this.centralID = centralID;
contadores = new SeparateChainingHash_ST_AED2<>();// inicialização da separateChaining
fontes = new SeparateChainingHash_ST_AED2<>();
}
/**
* Insere na SeparateChainingHash o contador, se já existir imprime a mensagem para a consola:"Já existe esse contador\n".
* @param c Contador
* @author patricia
*/
public void inserirContador(Contador c){
Contador aux = this.contadores.get(c.getContadorID());
if(aux != null){// se já existir nao se insere
System.out.println("Já existe esse contador");
return;
}
this.contadores.put(c.getContadorID(), c);
}
/**
* Remove da SeparateChainingHash o contador.
* @param c Contador
* @return c Contador removido
*/
public Contador removerContador(Contador c){//@author patricia
this.contadores.delete(c.getContadorID());
return c;
}
/**
* Lista o contador c que pertence á rede elétrica.
* @param c Contador
* @author patricia
*/
public void listarContador(Contador c){
System.out.println(this.contadores.get(c.getContadorID()));
}
/**
* Altera as caracteristicas do contador com contadorIDAntigo para as caracteristicas novas.
* Esta alteração é feita em todo o sitema, isto é, volta a gravar o contador com as informações alteradas.
* Se não existir imprime a mensagem para a consola "Nao existe esse contador!".
* @param contadorIDAntigo
* @param contadorIDNovo
* @author patricia
*/
public void EditarContador(Integer contadorIDAntigo,Integer contadorIDNovo) {
Contador c = this.contadores.get(contadorIDAntigo);
if(c==null){
System.out.println("Nao existe esse contador!");
return;
}
//Eliminar ficheiros com os dados antigos
File diretorioc = new File(".//data//Contador"+c.getContadorID().toString()+".txt");
diretorioc.delete();
File diretorioR = new File(".//data//"+this.getNome()+".txt");
diretorioR.delete();
c.setContadorID(contadorIDNovo);
this.contadores.delete(contadorIDAntigo);
this.inserirContador(c);
//Guardar os novos ficheiros com as alterações feitas
this.gravarRedeEletrica(this.getNome());
c.gravarContador(c.getContadorID().toString());
}
/**
* Insere na SeparateChainingHash a FonteEnergiaG, se já existir imprime a mensagem para a consola:"Já existe essa Fonte de energia".
* @param f FonteEnergiaG
* @author patricia
*/
public void inserirFonteEnergiaG(FonteEnergiaG f){
FonteEnergiaG faux = this.fontes.get(f.getFonteID());
if(faux != null){// se já existir nao se insere
System.out.println("Já existe essa Fonte de energia");
return;
}
this.fontes.put(f.getFonteID(), f);
}
/**
* Remove da SeparateChainingHash a FonteEnergiaG.
* @param f FonteEnergiaG
* @return FonteEnergiaG removida
*/
public FonteEnergiaG removerFonteEnergiaG(FonteEnergiaG f){//@author patricia
this.fontes.delete(f.getFonteID());
return f;
}
/**
* Lista a FonteEnergiaG que pertence á rede.
* @param f FonteEnergiaG
* @author patricia
*/
public void listarFonteEnergiaG(FonteEnergiaG f){
System.out.println(this.fontes.get(f.getFonteID()));
}
/**
* Altera as caracteristicas da FonteEnergiaG com fonteIDAntigo para as caracteristicas novas.
* Esta alteração é feita em todo o sitema, isto é, volta a gravar a FonteEnergiaG com as informações alteradas.
* Se não existir imprime a mensagem para a consola "Não existe essa Fonte de energia".
* @param fonteIDAntigo
* @param fonteIDNovo
* @param tipoNovo
* @param EnergiaProduzidaNova
* @author patricia
*/
public void EditarFonteEnergiaG(Integer fonteIDAntigo, Integer fonteIDNovo,String tipoNovo, Double EnergiaProduzidaNova){
FonteEnergiaG e = this.fontes.get(fonteIDAntigo);
if (e == null){
System.out.println("Não existe essa Fonte de energia");
return;
}
//Eliminar ficheiros com os dados antigos
File diretorioF = new File(".//data//FonteEnergiaG"+e.getFonteID().toString()+".txt");
diretorioF.delete();
File diretorioR = new File(".//data//"+this.getNome()+".txt");
diretorioR.delete();
e.setFonteID(fonteIDNovo);
e.setEnergiaProduzida(EnergiaProduzidaNova);
e.setTipo(tipoNovo);
if(fonteIDAntigo != fonteIDNovo){
this.fontes.delete(fonteIDAntigo);
this.inserirFonteEnergiaG(e);
}
//Guardar os novos ficheiros com as alterações feitas
this.gravarRedeEletrica(this.getNome());
e.gravarFonteEnergiaG(e.getFonteID().toString());
}
/**
* Grava para um ficheiro de texto as informações do equipamento
* @param fileName Nome do ficheiro
* @author rita
*/
public void gravarRedeEletrica(String fileName){//@author rita
try{
String file = ".//data//"+fileName+".txt";
File fc = new File(file);
if(!fc.exists()){
fc.createNewFile();
}
PrintWriter pw = new PrintWriter(fc);
String nome = "Nome:" + this.nome;
String alimentacao = "Alimentação:" + this.alimentacao;
String centralId= "CentralID: "+this.centralID;
pw.println(nome);
pw.println(alimentacao);
pw.println(centralId);
pw.println("Fontes Energia Grandes: \n");
Iterable<Integer> st = this.fontes.keys();
for (Integer key : st){
String fontes ="\t"+ this.fontes.get(key).toString();
pw.println(fontes);
}
pw.println("Contadores: \n");
Iterable<Integer> st2 = this.contadores.keys();
for (Integer key : st2){
String contadores ="\t"+ this.contadores.get(key).toString();
pw.println(contadores);
}
pw.close();
}catch (IOException e){
e.printStackTrace();
}
}
@Override
public String toString() {
return "RedeEletrica{" + "nome=" + nome + ", alimentacao=" + alimentacao + ", centralID=" + centralID + '}';
}
}
|
[
"35365@ufp.edu.pt"
] |
35365@ufp.edu.pt
|
8e00d3b1a4aaff4a5ad5626f82332875be96340e
|
81d245ec6d7c8c11e9399e42063a3d3392d442d3
|
/src/main/java/com/qa/data/Users.java
|
40d64e36e347a6cfa52295bf976ade5ea91fdd5d
|
[] |
no_license
|
Rhea09/RestAPIGet
|
b54744e53a154dab7a7062f8eb94285b51f9ad81
|
527e4f9a0548050377f8d613eadb22221f3ddae0
|
refs/heads/master
| 2020-05-01T18:30:09.254746
| 2019-03-27T17:39:31
| 2019-03-27T17:39:31
| 177,625,621
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 706
|
java
|
package com.qa.data;
//pojo-plain old java obj
public class Users {
String name;
String job;
String id;
String createdAt;
public Users(){
}
public Users(String name,String job) {
this.name=name;
this.job=job;
}
//getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
}
|
[
"rhea9dsouza@gmail.com"
] |
rhea9dsouza@gmail.com
|
ef1101c212fa38de73fd3b2b0f55e4ad2fda9a19
|
9b9c3236cc1d970ba92e4a2a49f77efcea3a7ea5
|
/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/FriendlyMobInstance.java
|
d90c3e3e260b38947f3be13ce38d2652784387e8
|
[] |
no_license
|
BETAJIb/ikol
|
73018f8b7c3e1262266b6f7d0a7f6bbdf284621d
|
f3709ea10be2d155b0bf1dee487f53c723f570cf
|
refs/heads/master
| 2021-01-05T10:37:17.831153
| 2019-12-24T22:23:02
| 2019-12-24T22:23:02
| 240,993,482
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,655
|
java
|
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.model.actor.instance;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
/**
* This class represents Friendly Mobs lying over the world.<br>
* These friendly mobs should only attack players with karma > 0 and it is always aggro, since it just attacks players with karma.
*/
public class FriendlyMobInstance extends Attackable
{
public FriendlyMobInstance(NpcTemplate template)
{
super(template);
setInstanceType(InstanceType.FriendlyMobInstance);
}
@Override
public boolean isAutoAttackable(Creature attacker)
{
if (attacker.isPlayer())
{
return ((PlayerInstance) attacker).getReputation() < 0;
}
return super.isAutoAttackable(attacker);
}
@Override
public boolean isAggressive()
{
return true;
}
}
|
[
"mobius@cyber-wizard.com"
] |
mobius@cyber-wizard.com
|
41563bd94d7b58a86b4f6ffa0636ecaa6fd012e9
|
0bc475c1f72036d44e0fc8f4530ebbe2cbef8b70
|
/src/java/br/com/siscultbook/model/command/EditarNivelAcesso.java
|
09df6f905be4e5e1ce00a298790b1031aaa85320
|
[] |
no_license
|
carlosanders/siscultbookapp
|
d70d1523739cb14c8ffa6ef10ace445f19534b71
|
c546586dce8b511545fba4658785139d707a24bd
|
refs/heads/master
| 2021-01-22T17:48:55.537348
| 2017-08-18T19:01:50
| 2017-08-18T19:01:50
| 100,732,170
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,638
|
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.siscultbook.model.command;
import br.com.siscultbook.bean.Acesso;
import br.com.siscultbook.model.dao.NivelDeAcessoDAO;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Carlos
*/
public class EditarNivelAcesso implements InterfaceCommand {
private NivelDeAcessoDAO acessoDAO;
public EditarNivelAcesso(NivelDeAcessoDAO acessoDAO) {
super();
this.acessoDAO = acessoDAO;
}
public String execute(HttpServletRequest request, HttpServletResponse response) {
String codigo;
codigo = request.getParameter("codigo");
String titulo = "";
if (codigo == null) {
titulo = titulo + "Cadastro - Acesso";
request.setAttribute("titulo", titulo);
return "restrito/cadastroNivelAcesso.jsp";
}
try {
titulo = titulo + "Atualização - Acesso";
request.setAttribute("titulo", titulo);
request.setAttribute("nivel", acessoDAO.retornarUmAcesso(Integer.parseInt(codigo)));
} catch (NumberFormatException e) {
request.setAttribute("mensagem", "Valor do código inválido" + codigo);
} catch (SQLException e) {
request.setAttribute("mensagem", "<font color=\"#ff0000\">Problemas com acesso a base de dados: </font>" + e.getMessage());
e.printStackTrace();
}
return "restrito/atualizaNivelDeAcesso.jsp";
}
}
|
[
"anders@marinha.mil.br"
] |
anders@marinha.mil.br
|
856c0598ab7b7478984fa76da99493aa3ce6d8f6
|
b59f5a4fa9c6151ee1f757a0d265543eea7331dc
|
/examples/fuml/language_workbench/org.modelexecution.xmof.examples.fuml.trace/src/fumlConfigurationTrace/Steps/FumlConfiguration_Classes_Kernel_Object_Destroy_Object_ImplicitStep.java
|
68077395acfd6bcbf180f2f5f8b7010edfa211c2
|
[] |
no_license
|
vatmi/moliz.gemoc
|
a8b7a6ac5d7bafb6b331655010975f2a44206d95
|
471f3128608986ddee1a7c4722d3620446e3726d
|
refs/heads/master
| 2020-03-30T23:32:19.818605
| 2017-10-20T09:20:17
| 2017-10-20T09:21:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 702
|
java
|
/**
*/
package fumlConfigurationTrace.Steps;
import org.eclipse.gemoc.trace.commons.model.trace.SmallStep;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Fuml Configuration Classes Kernel Object Destroy Object Implicit Step</b></em>'.
* <!-- end-user-doc -->
*
*
* @see fumlConfigurationTrace.Steps.StepsPackage#getFumlConfiguration_Classes_Kernel_Object_Destroy_Object_ImplicitStep()
* @model
* @generated
*/
public interface FumlConfiguration_Classes_Kernel_Object_Destroy_Object_ImplicitStep extends FumlConfiguration_Classes_Kernel_Object_Destroy_Object_AbstractSubStep, SmallStep {
} // FumlConfiguration_Classes_Kernel_Object_Destroy_Object_ImplicitStep
|
[
"ebousse@users.noreply.github.com"
] |
ebousse@users.noreply.github.com
|
19b083cfde4c04da9199fc217b12de9c09d0a961
|
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
|
/sources/com/avito/android/location_picker/providers/AvitoAddressGeoCoder.java
|
0d54fb352525af9f0c35eb5a73986f0746ba2c6e
|
[] |
no_license
|
Auch-Auch/avito_source
|
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
|
76fdcc5b7e036c57ecc193e790b0582481768cdc
|
refs/heads/master
| 2023-05-06T01:32:43.014668
| 2021-05-25T10:19:22
| 2021-05-25T10:19:22
| 370,650,685
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 17,443
|
java
|
package com.avito.android.location_picker.providers;
import androidx.collection.SimpleArrayMap;
import com.avito.android.avito_map.AvitoMapBounds;
import com.avito.android.avito_map.AvitoMapPoint;
import com.avito.android.remote.LocationApi;
import com.avito.android.remote.auth.AuthSource;
import com.avito.android.remote.error.ErrorResult;
import com.avito.android.remote.model.TypedResult;
import com.avito.android.remote.model.location_picker.AddressByCoordinatesResult;
import com.avito.android.remote.model.location_picker.AddressCoordinatesByQueryResult;
import com.avito.android.remote.model.location_picker.AddressSuggestionResult;
import com.avito.android.remote.model.location_picker.CoordinatesCurrentResult;
import com.avito.android.remote.model.location_picker.CoordinatesVerificationResult;
import com.avito.android.remote.model.location_picker.CurrentCoordinates;
import com.avito.android.util.rx3.Maybies;
import com.google.android.gms.maps.model.LatLngBounds;
import io.reactivex.rxjava3.core.Maybe;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.functions.Function;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000^\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001B\u0011\b\u0007\u0012\u0006\u0010'\u001a\u00020\"¢\u0006\u0004\b(\u0010)J\u0015\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u0002H\u0016¢\u0006\u0004\b\u0004\u0010\u0005J'\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\n0\u00022\u0006\u0010\u0007\u001a\u00020\u00062\b\u0010\t\u001a\u0004\u0018\u00010\bH\u0016¢\u0006\u0004\b\u000b\u0010\fJ\u001d\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\r0\u00022\u0006\u0010\u0007\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\u000e\u0010\u000fJ%\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00130\u00022\u0006\u0010\u0010\u001a\u00020\b2\u0006\u0010\u0012\u001a\u00020\u0011H\u0016¢\u0006\u0004\b\u0014\u0010\u0015J%\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00130\u00022\u0006\u0010\u0010\u001a\u00020\b2\u0006\u0010\u0012\u001a\u00020\u0016H\u0016¢\u0006\u0004\b\u0014\u0010\u0017J\u001d\u0010\u001a\u001a\b\u0012\u0004\u0012\u00020\u00190\u00022\u0006\u0010\u0018\u001a\u00020\bH\u0016¢\u0006\u0004\b\u001a\u0010\u001bR\"\u0010\u001f\u001a\u000e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u00020\u00130\u001c8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b\u001d\u0010\u001eR\"\u0010!\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\r0\u001c8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b \u0010\u001eR\u0019\u0010'\u001a\u00020\"8\u0006@\u0006¢\u0006\f\n\u0004\b#\u0010$\u001a\u0004\b%\u0010&¨\u0006*"}, d2 = {"Lcom/avito/android/location_picker/providers/AvitoAddressGeoCoder;", "Lcom/avito/android/location_picker/providers/AddressGeoCoder;", "Lio/reactivex/rxjava3/core/Single;", "Lcom/avito/android/remote/model/location_picker/CoordinatesCurrentResult;", "getCurrentCoordinates", "()Lio/reactivex/rxjava3/core/Single;", "Lcom/avito/android/avito_map/AvitoMapPoint;", "latLng", "", "itemId", "Lcom/avito/android/remote/model/location_picker/CoordinatesVerificationResult;", "verifyCoordinates", "(Lcom/avito/android/avito_map/AvitoMapPoint;Ljava/lang/String;)Lio/reactivex/rxjava3/core/Single;", "Lcom/avito/android/remote/model/location_picker/AddressByCoordinatesResult;", "getAddressByLatLng", "(Lcom/avito/android/avito_map/AvitoMapPoint;)Lio/reactivex/rxjava3/core/Single;", "searchQuery", "Lcom/google/android/gms/maps/model/LatLngBounds;", "visibleRegion", "Lcom/avito/android/remote/model/location_picker/AddressSuggestionResult;", "getSuggestions", "(Ljava/lang/String;Lcom/google/android/gms/maps/model/LatLngBounds;)Lio/reactivex/rxjava3/core/Single;", "Lcom/avito/android/avito_map/AvitoMapBounds;", "(Ljava/lang/String;Lcom/avito/android/avito_map/AvitoMapBounds;)Lio/reactivex/rxjava3/core/Single;", "addressQuery", "Lcom/avito/android/remote/model/location_picker/AddressCoordinatesByQueryResult;", "getCoordinatesByAddress", "(Ljava/lang/String;)Lio/reactivex/rxjava3/core/Single;", "Landroidx/collection/SimpleArrayMap;", AuthSource.BOOKING_ORDER, "Landroidx/collection/SimpleArrayMap;", "suggestionsCache", AuthSource.SEND_ABUSE, "addressCache", "Lcom/avito/android/remote/LocationApi;", "c", "Lcom/avito/android/remote/LocationApi;", "getApi", "()Lcom/avito/android/remote/LocationApi;", "api", "<init>", "(Lcom/avito/android/remote/LocationApi;)V", "location-picker_release"}, k = 1, mv = {1, 4, 2})
public final class AvitoAddressGeoCoder implements AddressGeoCoder {
public final SimpleArrayMap<AvitoMapPoint, AddressByCoordinatesResult> a = new SimpleArrayMap<>();
public final SimpleArrayMap<String, AddressSuggestionResult> b = new SimpleArrayMap<>();
@NotNull
public final LocationApi c;
public static final class a<T> implements Consumer<AddressByCoordinatesResult> {
public final /* synthetic */ AvitoAddressGeoCoder a;
public final /* synthetic */ AvitoMapPoint b;
public a(AvitoAddressGeoCoder avitoAddressGeoCoder, AvitoMapPoint avitoMapPoint) {
this.a = avitoAddressGeoCoder;
this.b = avitoMapPoint;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Consumer
public void accept(AddressByCoordinatesResult addressByCoordinatesResult) {
AddressByCoordinatesResult addressByCoordinatesResult2 = addressByCoordinatesResult;
if (addressByCoordinatesResult2 instanceof AddressByCoordinatesResult.Ok) {
this.a.a.put(this.b, addressByCoordinatesResult2);
}
}
}
public static final class b<T, R> implements Function<TypedResult<AddressCoordinatesByQueryResult>, AddressCoordinatesByQueryResult> {
public static final b a = new b();
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Function
public AddressCoordinatesByQueryResult apply(TypedResult<AddressCoordinatesByQueryResult> typedResult) {
TypedResult<AddressCoordinatesByQueryResult> typedResult2 = typedResult;
if (typedResult2 instanceof TypedResult.OfResult) {
return (AddressCoordinatesByQueryResult) ((TypedResult.OfResult) typedResult2).getResult();
}
if (typedResult2 instanceof TypedResult.OfError) {
TypedResult.OfError ofError = (TypedResult.OfError) typedResult2;
if (ofError.getError() instanceof ErrorResult.NetworkIOError) {
return new AddressCoordinatesByQueryResult.NetworkError();
}
return new AddressCoordinatesByQueryResult.NotFoundError(ofError.getError().getMessage());
}
throw new NoWhenBranchMatchedException();
}
}
public static final class c<T, R> implements Function<Throwable, AddressCoordinatesByQueryResult> {
public static final c a = new c();
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Function
public AddressCoordinatesByQueryResult apply(Throwable th) {
return new AddressCoordinatesByQueryResult.NetworkError();
}
}
public static final class d<T, R> implements Function<TypedResult<CurrentCoordinates>, CoordinatesCurrentResult> {
public static final d a = new d();
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Function
public CoordinatesCurrentResult apply(TypedResult<CurrentCoordinates> typedResult) {
TypedResult<CurrentCoordinates> typedResult2 = typedResult;
if (typedResult2 instanceof TypedResult.OfResult) {
return new CoordinatesCurrentResult.Ok((CurrentCoordinates) ((TypedResult.OfResult) typedResult2).getResult());
}
if (typedResult2 instanceof TypedResult.OfError) {
TypedResult.OfError ofError = (TypedResult.OfError) typedResult2;
if (ofError.getError() instanceof ErrorResult.NetworkIOError) {
return new CoordinatesCurrentResult.NetWorkError();
}
return new CoordinatesCurrentResult.UnknownError(ofError.getError().getMessage());
}
throw new NoWhenBranchMatchedException();
}
}
public static final class e<T, R> implements Function<Throwable, CoordinatesCurrentResult> {
public static final e a = new e();
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Function
public CoordinatesCurrentResult apply(Throwable th) {
return new CoordinatesCurrentResult.NetWorkError();
}
}
public static final class f<T> implements Consumer<AddressSuggestionResult> {
public final /* synthetic */ AvitoAddressGeoCoder a;
public final /* synthetic */ String b;
public final /* synthetic */ AvitoMapBounds c;
public f(AvitoAddressGeoCoder avitoAddressGeoCoder, String str, AvitoMapBounds avitoMapBounds) {
this.a = avitoAddressGeoCoder;
this.b = str;
this.c = avitoMapBounds;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Consumer
public void accept(AddressSuggestionResult addressSuggestionResult) {
AddressSuggestionResult addressSuggestionResult2 = addressSuggestionResult;
if (addressSuggestionResult2 instanceof AddressSuggestionResult.Ok) {
SimpleArrayMap simpleArrayMap = this.a.b;
simpleArrayMap.put(this.b + ' ' + this.c, addressSuggestionResult2);
}
}
}
public static final class g<T, R> implements Function<TypedResult<CoordinatesVerificationResult>, CoordinatesVerificationResult> {
public static final g a = new g();
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Function
public CoordinatesVerificationResult apply(TypedResult<CoordinatesVerificationResult> typedResult) {
TypedResult<CoordinatesVerificationResult> typedResult2 = typedResult;
if (typedResult2 instanceof TypedResult.OfResult) {
return (CoordinatesVerificationResult) ((TypedResult.OfResult) typedResult2).getResult();
}
if (typedResult2 instanceof TypedResult.OfError) {
TypedResult.OfError ofError = (TypedResult.OfError) typedResult2;
if (ofError.getError() instanceof ErrorResult.NetworkIOError) {
return new CoordinatesVerificationResult.NetworkError();
}
return new CoordinatesVerificationResult.UnknownError(ofError.getError().getMessage());
}
throw new NoWhenBranchMatchedException();
}
}
public static final class h<T, R> implements Function<Throwable, CoordinatesVerificationResult> {
public static final h a = new h();
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Function
public CoordinatesVerificationResult apply(Throwable th) {
return new CoordinatesVerificationResult.NetworkError();
}
}
@Inject
public AvitoAddressGeoCoder(@NotNull LocationApi locationApi) {
Intrinsics.checkNotNullParameter(locationApi, "api");
this.c = locationApi;
}
@Override // com.avito.android.location_picker.providers.AddressGeoCoder
@NotNull
public Single<AddressByCoordinatesResult> getAddressByLatLng(@NotNull AvitoMapPoint avitoMapPoint) {
Intrinsics.checkNotNullParameter(avitoMapPoint, "latLng");
Maybe maybe = Maybies.toMaybe(this.a.get(avitoMapPoint));
Single<R> onErrorReturn = this.c.getAddressByCoordinates(avitoMapPoint.getLatitude(), avitoMapPoint.getLongitude()).firstOrError().map(a2.a.a.n1.w0.b.a).onErrorReturn(a2.a.a.n1.w0.c.a);
Intrinsics.checkNotNullExpressionValue(onErrorReturn, "api\n .getAddressB…esResult.NetworkError() }");
Single<AddressByCoordinatesResult> single = maybe.switchIfEmpty(onErrorReturn.doOnSuccess(new a(this, avitoMapPoint)).toMaybe()).toSingle();
Intrinsics.checkNotNullExpressionValue(single, "addressCache[latLng]\n …)\n .toSingle()");
return single;
}
@NotNull
public final LocationApi getApi() {
return this.c;
}
@Override // com.avito.android.location_picker.providers.AddressGeoCoder
@NotNull
public Single<AddressCoordinatesByQueryResult> getCoordinatesByAddress(@NotNull String str) {
Intrinsics.checkNotNullParameter(str, "addressQuery");
Single<R> onErrorReturn = this.c.getCoordsByAddress(str).firstOrError().map(b.a).onErrorReturn(c.a);
Intrinsics.checkNotNullExpressionValue(onErrorReturn, "api\n .getCoordsBy…ryResult.NetworkError() }");
return onErrorReturn;
}
@Override // com.avito.android.location_picker.providers.AddressGeoCoder
@NotNull
public Single<CoordinatesCurrentResult> getCurrentCoordinates() {
Single<R> onErrorReturn = this.c.getCurrentCoordinates().firstOrError().map(d.a).onErrorReturn(e.a);
Intrinsics.checkNotNullExpressionValue(onErrorReturn, "api\n .getCurrentC….NetWorkError()\n }");
return onErrorReturn;
}
@Override // com.avito.android.location_picker.providers.AddressGeoCoder
@NotNull
public Single<AddressSuggestionResult> getSuggestions(@NotNull String str, @NotNull LatLngBounds latLngBounds) {
Intrinsics.checkNotNullParameter(str, "searchQuery");
Intrinsics.checkNotNullParameter(latLngBounds, "visibleRegion");
return getSuggestions(str, AvitoMapBounds.CREATOR.fromLatLngBounds(latLngBounds));
}
@Override // com.avito.android.location_picker.providers.AddressGeoCoder
@NotNull
public Single<CoordinatesVerificationResult> verifyCoordinates(@NotNull AvitoMapPoint avitoMapPoint, @Nullable String str) {
Intrinsics.checkNotNullParameter(avitoMapPoint, "latLng");
Single<R> onErrorReturn = this.c.verifyCoordinates(avitoMapPoint.getLatitude(), avitoMapPoint.getLongitude(), str).firstOrError().map(g.a).onErrorReturn(h.a);
Intrinsics.checkNotNullExpressionValue(onErrorReturn, "api.verifyCoordinates(la…onResult.NetworkError() }");
return onErrorReturn;
}
@Override // com.avito.android.location_picker.providers.AddressGeoCoder
@NotNull
public Single<AddressSuggestionResult> getSuggestions(@NotNull String str, @NotNull AvitoMapBounds avitoMapBounds) {
Intrinsics.checkNotNullParameter(str, "searchQuery");
Intrinsics.checkNotNullParameter(avitoMapBounds, "visibleRegion");
SimpleArrayMap<String, AddressSuggestionResult> simpleArrayMap = this.b;
Maybe maybe = Maybies.toMaybe(simpleArrayMap.get(str + ' ' + avitoMapBounds));
Single<R> onErrorReturn = this.c.getAddressSuggestions(str, Double.valueOf(avitoMapBounds.getTopLeft().getLongitude()), Double.valueOf(avitoMapBounds.getBottomRight().getLatitude()), Double.valueOf(avitoMapBounds.getBottomRight().getLongitude()), Double.valueOf(avitoMapBounds.getTopLeft().getLatitude())).firstOrError().map(a2.a.a.n1.w0.d.a).onErrorReturn(a2.a.a.n1.w0.e.a);
Intrinsics.checkNotNullExpressionValue(onErrorReturn, "api\n .getAddressS…onResult.NetworkError() }");
Single<AddressSuggestionResult> single = maybe.switchIfEmpty(onErrorReturn.doOnSuccess(new f(this, str, avitoMapBounds)).toMaybe()).toSingle();
Intrinsics.checkNotNullExpressionValue(single, "suggestionsCache[\"$searc…)\n .toSingle()");
return single;
}
}
|
[
"auchhunter@gmail.com"
] |
auchhunter@gmail.com
|
a00d93fad25523fd164805b1b648111efe394c98
|
d58827464cfc9b06f467acee554a0e94c7c2837d
|
/src/test/java/ru/job4j/html/SqlRuParseTest.java
|
57033391028bcd74c9192c9454e7a843fed5abab
|
[] |
no_license
|
coffeeturbo/job4j_grabber
|
bccbaec68df179cb669af1c74c91bc91389e0941
|
1330cd7a396f6a486038cf380ac886826cc30806
|
refs/heads/master
| 2022-12-18T00:58:59.988351
| 2020-09-14T09:36:12
| 2020-09-14T09:36:12
| 287,753,657
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,077
|
java
|
package ru.job4j.html;
import org.junit.Test;
import java.util.Calendar;
import java.util.Date;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.is;
public class SqlRuParseTest {
@Test
public void whenParseDateWithStringMonthShort2() {
String inputDate = "4 сен 20, 17:14";
Date actualDate = SqlRuParse.parseDate(inputDate);
String expectedDate = "Fri Sep 04 17:14:00 MSK 2020";
assertThat(actualDate.toString(), is(expectedDate));
}
@Test
public void whenParseDateWithStringMonthShort() {
String inputDate = "22 авг 20, 07:44";
Date actualDate = SqlRuParse.parseDate(inputDate);
String expectedDate = "Sat Aug 22 07:44:00 MSK 2020";
assertThat(actualDate.toString(), is(expectedDate));
}
@Test
public void whenParseDateWithStringMonthShortMay() {
String inputDate = "13 май 20, 19:23";
Date actualDate = SqlRuParse.parseDate(inputDate);
String expectedDate = "Wed May 13 19:23:00 MSK 2020";
assertThat(actualDate.toString(), is(expectedDate));
}
@Test
public void whenParseDateWithStringYeasterday() {
String inputDate = "вчера, 22:35";
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
cal.set(Calendar.HOUR_OF_DAY, 22);
cal.set(Calendar.MINUTE, 35);
cal.set(Calendar.SECOND, 0);
Date actualDate = SqlRuParse.parseDate(inputDate);
String expectedDate = cal.getTime().toString();
assertThat(actualDate.toString(), is(expectedDate));
}
@Test
public void whenParseDateWithStringToday() {
String inputDate = "сегодня, 14:51";
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 14);
cal.set(Calendar.MINUTE, 51);
cal.set(Calendar.SECOND, 0);
Date actualDate = SqlRuParse.parseDate(inputDate);
String expectedDate = cal.getTime().toString();
assertThat(actualDate.toString(), is(expectedDate));
}
}
|
[
"coffeeturbo@gmail.com"
] |
coffeeturbo@gmail.com
|
61e5f5c4576569f534750241458a94ffafca4c23
|
a81d99e66effd24029503628998c2e45556c2025
|
/UF2/storage_InterrnalStorage/src/com/javapassion/InternalStorageActivity.java
|
e7247c13c6cc9dad2511a327971b1a645f5debfd
|
[] |
no_license
|
BullDrako/Android-Studio-Projects
|
d1edd92d4e0e4399dcff6ef69f5104f30614003d
|
f42763083041b69637b9ff8a98211c8eff6042a5
|
refs/heads/master
| 2021-06-16T10:51:16.044859
| 2017-05-31T12:48:22
| 2017-05-31T12:48:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,066
|
java
|
package com.javapassion;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
// This application shows how to use internal storage. By default,
// files saved to the internal storage are private to your application
// and other applications cannot access them (nor can the user).
// When the user uninstalls your application, these files are
// removed.
public class InternalStorageActivity extends Activity {
private static final String FILENAME = "hello_file";
private static final String test_string = "Life is good!";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Create Button objects from layout definition file.
Button buttonWrite = (Button) findViewById(R.id.button1);
Button buttonRead = (Button) findViewById(R.id.button2);
// Event handler - when this button is clicked, write to a file
buttonWrite.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
FileOutputStream fos = openFileOutput(FILENAME,
Context.MODE_PRIVATE);
fos.write(test_string.getBytes());
fos.close();
Toast.makeText(getApplicationContext(),
test_string + " is written to " + FILENAME,
Toast.LENGTH_SHORT).show();
} catch (Exception e) {
}
}
});
// Event handler - when this button is clicked, read the file
buttonRead.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
FileInputStream fis = openFileInput(FILENAME);
byte[] buffer = new byte[20];
fis.read(buffer);
fis.close();
Toast.makeText(getApplicationContext(), new String(buffer) + " is read",
Toast.LENGTH_LONG).show();
} catch (Exception e) {
}
}
});
}
}
|
[
"ecf_06@hotmail.com"
] |
ecf_06@hotmail.com
|
6a55f8efd868fe1376b3d1e78f6607939386285b
|
86858fd818fc2b44b1613287e7b8f2691afda7f6
|
/Session2/MyApplication/app/src/test/java/neduet2/sarahsga/com/myapplication/ExampleUnitTest.java
|
202f522e663591915686a33d76381dedb87c934e
|
[] |
no_license
|
sarahsga/Hybrid-Mobile-App-Development-2016
|
de269aa060ca875ebb2b99a268177ed5e8086ecd
|
6ba4963e90346bdf22b23aa1f5145b2d8d8a9224
|
refs/heads/master
| 2021-01-01T05:17:17.115067
| 2016-06-05T18:51:32
| 2016-06-05T18:51:32
| 59,757,619
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 327
|
java
|
package neduet2.sarahsga.com.myapplication;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"sarahsga4@gmail.com"
] |
sarahsga4@gmail.com
|
547e2e7dc742d367a2bd26c1c04978284c3556f6
|
e149c74a00e92fa52377c1e2483cfb3ca6b6e510
|
/src/main/java/tot/log/logconsole/websocket/ServerWebChildInitializer.java
|
091435615d94bbd04a0efc8e378de9c95322f1d3
|
[] |
no_license
|
lingduliudu/log-console
|
16987bc4f6a5c4ae4d6013e738d924b3a0a84777
|
528de81041b9d727598dc8cfc350225ee73ac2bc
|
refs/heads/master
| 2023-06-16T23:44:45.481654
| 2021-07-16T06:02:25
| 2021-07-16T06:02:25
| 334,085,900
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,000
|
java
|
package tot.log.logconsole.websocket;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
import io.netty.handler.stream.ChunkedWriteHandler;
public class ServerWebChildInitializer extends ChannelInitializer<SocketChannel> {
@Override
protected void initChannel(SocketChannel sc) throws Exception {
ChannelPipeline pipeline = sc.pipeline();
pipeline.addLast("HttpServerCodec",new HttpServerCodec());
pipeline.addLast("ChunkedWriteHandler",new ChunkedWriteHandler());
pipeline.addLast("HttpObjectAggregator",new HttpObjectAggregator(8192));
pipeline.addLast("WebSocketServerProtocolHandler",new WebSocketServerProtocolHandler("/ws"));
pipeline.addLast("ServerWebChildHandler",new ServerWebChildHandler());
}
}
|
[
"lingduliudu@163.com"
] |
lingduliudu@163.com
|
143b940fb4eacf97940b231878c1e1eed162198a
|
0f4c06544f725349f1b08919923ba78e56a50fe5
|
/test-commons/src/main/java/com/njust/utils/AddressUtils.java
|
2ed3b9793684787147e02f99fe73650ebe2b10fa
|
[] |
no_license
|
Tellsealu/testManage
|
6ab3300ae2003f3fb630e6534a0df9bcac81da81
|
86f418607b143e1ea275df3bd824399a7569e014
|
refs/heads/master
| 2023-03-09T09:03:46.292804
| 2021-02-24T12:19:45
| 2021-02-24T12:19:45
| 341,231,864
| 1
| 0
| null | 2021-02-24T12:19:46
| 2021-02-22T14:42:20
|
Java
|
UTF-8
|
Java
| false
| false
| 1,144
|
java
|
package com.njust.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 根据IP地址获取真实地址工具类
* @Author: 尚学堂 雷哥
*/
public class AddressUtils {
private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
public static final String IP_URL = "http://ip.taobao.com/service/getIpInfo.php";
public static String getRealAddressByIP(String ip) {
String address = "XX XX";
// 内网不查询
if (IpUtils.internalIp(ip)) {
return "内网IP";
}
String rspStr = HttpUtils.sendPost(IP_URL, "ip=" + ip);
if (StringUtils.isEmpty(rspStr)) {
log.error("获取地理位置异常 {}", ip);
return address;
}
JSONObject obj = JSONObject.parseObject(rspStr);
JSONObject data = obj.getObject("data", JSONObject.class);
String region = data.getString("region");
String city = data.getString("city");
address = region + " " + city;
return address;
}
}
|
[
"4381265@qq.com"
] |
4381265@qq.com
|
02109584c2b2178cb9de75aedccb2b9541b001d6
|
676e05cff9f89f02a6c4659cbefd16178c35459d
|
/src/main/java/oit/is/inudaisuki/springboot_samples/model/FruitMapper.java
|
534fe4a2dd47422ce8aef1e13385d31114e36412
|
[] |
no_license
|
igakilab/springboot_samples
|
93ff2f5de674fcb7d099c2fa236c9c85237c8e8d
|
b3cf94a85e2b10c3fb9c8b9f47cfeaade86c0d6a
|
refs/heads/master
| 2022-12-29T18:22:32.945027
| 2022-09-09T08:23:50
| 2022-09-09T08:23:50
| 218,972,347
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,236
|
java
|
package oit.is.inudaisuki.springboot_samples.model;
import java.util.ArrayList;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@Mapper
public interface FruitMapper {
@Select("SELECT ID, NAME,PRICE FROM FRUIT")
ArrayList<Fruit> selectAllFruit();
@Select("select ID, NAME,PRICE from FRUIT WHERE ID = #{id}")
Fruit selectById(int id);
/**
* update, insert, deleteでは抽象メソッドの返り値は (1)boolean:テーブルに1レコード以上何らかの変更が合ったかどうか
* (2)void:返り値なし (3)int:テーブルに変更があったときの変更があったレコードの件数, のいずれかを設定できる
*
* @param id
* @return
*/
@Delete("DELETE FROM FRUIT WHERE ID =#{id}")
boolean deleteById(int id);
/**
* 入力されたFruit Beanの値でDBを更新する {}内のフィールド名指定時には大文字小文字を間違えないようにすること (カラム名はOK)
*
* @param fruit
*/
@Update("UPDATE FRUIT SET NAME=#{name}, PRICE=#{price} WHERE ID = #{id}")
void updateById(Fruit fruit);
}
|
[
"igaki@github.com"
] |
igaki@github.com
|
9bd96146785799db2834d82c6a54960dbc3b8664
|
521fbbcb9570e455184200d3035ff17e897029dd
|
/src/main/java/by/jrr/learn/lecture16lambdas/src/main/java/lambdas/MyFunctional.java
|
63ea98aa2ae7d3c7148af77333885fffed4b336d
|
[] |
no_license
|
ArtikTico/JIS7
|
01d213638fb345b35b319bb8b3bef17558351d42
|
f247f8d8493122238b41b49168f827337ac9971f
|
refs/heads/release
| 2023-06-22T18:23:12.558579
| 2021-07-17T09:39:34
| 2021-07-17T09:39:34
| 350,488,257
| 0
| 2
| null | 2021-07-23T09:40:54
| 2021-03-22T21:01:14
|
Java
|
UTF-8
|
Java
| false
| false
| 127
|
java
|
package lambdas;
@FunctionalInterface
public interface MyFunctional {
Integer multiplyTwoNumbers(Integer a, Integer b);
}
|
[
"articzander@mail.ru"
] |
articzander@mail.ru
|
f2e4251320da8fd634e26cd22e4d01dd8f6946ed
|
341ef329544215c4eeaf92416ef358a943b7db7f
|
/ts3_sdk_3.0.4.4/examples/client_android/app/src/main/java/com/teamspeak/ts3sdkclient/connection/ConnectionHandler.java
|
3baa38e5eb9ec5cf7dcd6bd5407fad02e3e96415
|
[] |
no_license
|
adamk33n3r/chumspeak-server
|
fabbb287365ab19bb9ede22dae5f63fbea40d441
|
557b8e523dccf817683ae0339bad911f3c31a3a7
|
refs/heads/master
| 2021-07-04T20:58:54.569342
| 2020-08-19T23:34:49
| 2020-08-19T23:34:49
| 150,354,201
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,557
|
java
|
package com.teamspeak.ts3sdkclient.connection;
import android.content.Context;
import android.graphics.Color;
import android.media.AudioManager;
import android.os.Handler;
import android.util.Log;
import com.teamspeak.ts3sdkclient.TS3Application;
import com.teamspeak.ts3sdkclient.helper.Info;
import com.teamspeak.ts3sdkclient.ts3sdk.Native;
import com.teamspeak.ts3sdkclient.ts3sdk.states.ConnectStatus;
import static com.teamspeak.ts3sdkclient.Constants.PRE_PROCESSOR_VALUE_AGC;
import static com.teamspeak.ts3sdkclient.Constants.PRE_PROCESSOR_VALUE_DENOISE;
import static com.teamspeak.ts3sdkclient.Constants.PRE_PROCESSOR_VALUE_VOICE_ACTIVATION_LEVEL_DB;
import static com.teamspeak.ts3sdkclient.Constants.TS3_DEFAULT_SERVERPORT;
import static com.teamspeak.ts3sdkclient.ts3sdk.states.PublicError.ERROR_ok;
/**
* TeamSpeak 3 sdk client sample
*
* Copyright (c) 2007-2017 TeamSpeak-Systems
*
* @author Anna
* Creation date: 08.02.17
*
* Class that holds all data for one server connection
*/
public class ConnectionHandler {
public static final String TAG = ConnectionHandler.class.getSimpleName();
private long serverConnectionHandlerId;
private ConnectionParams mParams;
private Info mInfo;
private TS3Application application;
private Native nativeInterface;
@ConnectStatus
private int currentState = ConnectStatus.STATUS_DISCONNECTED;
private boolean captureDeviceOpen;
private boolean playbackDeviceOpen;
public ConnectionHandler(TS3Application app) {
mInfo = Info.getInstance();
application = app;
nativeInterface = app.getNativeInstance();
serverConnectionHandlerId = nativeInterface.ts3client_spawnNewServerConnectionHandler();
}
public int startConnection(ConnectionParams params) {
mParams = params;
prepareAudio();
String ip = params.getServerAddress();
int port = params.getPort() != 0 ? params.getPort() : TS3_DEFAULT_SERVERPORT;
String nickname = params.getNickname();
String defaultChannelPassword = "";
String serverPassword = "secret";
String[] defaultChannelArray = new String[]{""};
//Connect to server on the given ip address with the given nickname, no default channel, no default channel password and server password "secret"
return nativeInterface.ts3client_startConnection(serverConnectionHandlerId, params.getIdentity(), ip, port, nickname,
defaultChannelArray, defaultChannelPassword, serverPassword);
}
/**
* Stop the actual server connection and destroys the server connection handler in the teamspeak library
*/
public void disconnect(){
//Disconnect from server
nativeInterface.ts3client_stopConnection(serverConnectionHandlerId, "leaving");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
//Destroy server connection handler
nativeInterface.ts3client_destroyServerConnectionHandler(serverConnectionHandlerId);
}
}, 200);
}
public void configurePreProcessor(){
// Set the speech preprocessor values
nativeInterface.ts3client_setPreProcessorConfigValue(serverConnectionHandlerId, PRE_PROCESSOR_VALUE_VOICE_ACTIVATION_LEVEL_DB, "-30");
nativeInterface.ts3client_setPreProcessorConfigValue(serverConnectionHandlerId, PRE_PROCESSOR_VALUE_DENOISE, "true");
nativeInterface.ts3client_setPreProcessorConfigValue(serverConnectionHandlerId, PRE_PROCESSOR_VALUE_AGC, "true");
}
/**
* Routes the audio to the earpiece speaker and sets the audio mode MODE_IN_COMMUNICATION for voice communication and
* echo cancellation if supported by the device
*/
private void prepareAudio() {
AudioManager audioManager = (AudioManager) application.getSystemService(Context.AUDIO_SERVICE);
if (audioManager != null) {
audioManager.setSpeakerphoneOn(false);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
}
}
/**
* registers an audio device if no audio device has been registered before and opens the capture and playback device.
*/
public void openAudioDevices() {
if (!captureDeviceOpen)
{
Log.d(TAG, "Opening capture device for server connection handler " + serverConnectionHandlerId);
// Open capture device we created earlier
captureDeviceOpen = nativeInterface.ts3client_openCaptureDevice(serverConnectionHandlerId, "", "")
== ERROR_ok;
}
if (!playbackDeviceOpen)
{
//Open playback device we created earlier
Log.d(TAG, "Opening playback device for server connection handler " + serverConnectionHandlerId);
playbackDeviceOpen = nativeInterface.ts3client_openPlaybackDevice(serverConnectionHandlerId, "", "")
== ERROR_ok;
}
}
/**
* closes the capture and playback device and unregisters the audio device if a audio device has been registered before.
* Destroys the native audio Engine, audio player and audio recorder
*/
public void closeAudioDevices() {
if (captureDeviceOpen)
{
Log.d(TAG, "Closing capture device for server connection handler "+serverConnectionHandlerId );
/* Close capture device we created earlier */
if(nativeInterface.ts3client_closeCaptureDevice(serverConnectionHandlerId) == ERROR_ok){
captureDeviceOpen = false;
}
}
if (playbackDeviceOpen)
{
Log.d(TAG, "Closing playback device for server connection handler "+serverConnectionHandlerId );
/* Close playback device we created earlier */
if(nativeInterface.ts3client_closePlaybackDevice(serverConnectionHandlerId) == ERROR_ok){
playbackDeviceOpen = false;
}
}
}
public long getServerConnectionHandlerId() {
return serverConnectionHandlerId;
}
@ConnectStatus
public int getCurrentState() {
return currentState;
}
public boolean isCaptureDeviceOpen() {
return captureDeviceOpen;
}
public void setCurrentState(int currentState) {
this.currentState = currentState;
}
public ConnectionParams getParams() {
return mParams;
}
public void printConnectionInfo() {
int myID = nativeInterface.ts3client_getClientID(serverConnectionHandlerId);
if (myID == -1)
return;
double ping = nativeInterface.ts3client_getConnectionVariableAsDouble(serverConnectionHandlerId, myID, Native.ConnectionProperties.CONNECTION_PING);
double pingDeviation = nativeInterface.ts3client_getConnectionVariableAsDouble(serverConnectionHandlerId, myID, Native.ConnectionProperties.CONNECTION_PING_DEVIATION);
double totalServerToClientPacketLoss = nativeInterface.ts3client_getConnectionVariableAsDouble(serverConnectionHandlerId, myID, Native.ConnectionProperties.CONNECTION_SERVER2CLIENT_PACKETLOSS_TOTAL);
String message = "Connection Info -";
message += " Ping: " + (new Double(ping).toString());
message += " +/- " + (new Double(pingDeviation).toString());
message += " Total Server To Client Packetloss: " + (new Double(totalServerToClientPacketLoss).toString());
mInfo.addMessage(message, Color.parseColor("#4169E1"));
}
}
|
[
"adam.g.keenan@gmail.com"
] |
adam.g.keenan@gmail.com
|
dc551efae273dd872af0aca4557a8b60f4e0d3e0
|
38a6ff365ac205c79d5c72e16e3e273ec7d99b69
|
/src/week5/homework5/ShellSorter.java
|
0f42ce3dde95b2d1bad1a19f4f7022ec84e963c6
|
[] |
no_license
|
RuslanLizogub/Base23
|
94d10ecb496f7cb6080d2b00f526ae0d74c3543e
|
f06cd11ad8a5631bec18a4ccf4991a180a93b73b
|
refs/heads/master
| 2021-01-17T05:25:29.317182
| 2015-07-05T17:21:49
| 2015-07-05T17:21:49
| 34,651,528
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,260
|
java
|
package week5.homework5;
import java.util.Arrays;
/*
Пользователь вводит количество сортируемых чисел, затем вводит числа.
Отсортировать введенные числа методом Шелла и вывести на экран пары индексов обмениваемых элементов.
Метод void sortShell(int[] vector)
Класс задания: ShellSorter
Пример:
sortShell([6, 2, 5, 4, 6, 5])
3 0
1 0
5 4
4 3
*/
public class ShellSorter {
public static void main(String[] args) {
int[] vector = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
sortShell(vector);
System.out.println(Arrays.toString(vector));
}
public static void sortShell(int[] vector) {
int part = 1;
while (part < vector.length)
part = 2 * part + 1;
while (part > 0) {
part = part / 2;
for (int k = 0; k < part; k++) {
for (int i = part + k; i < vector.length; i += part) {
int temp = vector[i];
int j = i - part;
while (j >= 0 && vector[j] > temp) {
System.out.println(j + part + " " + j);
vector[j + part] = vector[j];
j -= part;
}
vector[j + part] = temp;
}
}
}
}
}
|
[
"ruslanlizogub0201@gmail.com"
] |
ruslanlizogub0201@gmail.com
|
abe316ac6d894ee5077efcbfd05d783190196ec3
|
aa8b9254414322168521bdada9706a56931fa9f5
|
/api/src/test/java/org/openmrs/module/cloudattachments/CloudAttachmentsServiceTest.java
|
bcf86ce132bbfd182510117f887c0f6dfc0aa762
|
[] |
no_license
|
yp19/openmrs-module-cloudattachments
|
76e59846a04a76bf97b2f239b5070c4c9d10bd62
|
8a03925f11b043698e4bb3b227bfa656be831f2e
|
refs/heads/master
| 2022-12-29T22:06:09.163367
| 2020-09-26T22:34:31
| 2020-09-26T22:34:31
| 298,905,741
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,856
|
java
|
/**
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
*
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.module.cloudattachments.api;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openmrs.User;
import org.openmrs.api.UserService;
import org.openmrs.module.cloudattachments.Item;
import org.openmrs.module.cloudattachments.api.dao.CloudAttachmentsDao;
import org.openmrs.module.cloudattachments.api.impl.CloudAttachmentsServiceImpl;
import static org.mockito.Mockito.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
/**
* This is a unit test, which verifies logic in CloudAttachmentsService. It doesn't extend
* BaseModuleContextSensitiveTest, thus it is run without the in-memory DB and Spring context.
*/
public class CloudAttachmentsServiceTest {
@InjectMocks
CloudAttachmentsServiceImpl basicModuleService;
@Mock
CloudAttachmentsDao dao;
@Mock
UserService userService;
@Before
public void setupMocks() {
MockitoAnnotations.initMocks(this);
}
@Test
public void saveItem_shouldSetOwnerIfNotSet() {
//Given
Item item = new Item();
item.setDescription("some description");
when(dao.saveItem(item)).thenReturn(item);
User user = new User();
when(userService.getUser(1)).thenReturn(user);
//When
basicModuleService.saveItem(item);
//Then
assertThat(item, hasProperty("owner", is(user)));
}
}
|
[
"padmaja@srellik.com"
] |
padmaja@srellik.com
|
9cd87937b341c4c150fb66c6feb65cd10cdee82f
|
8340f89e4aa42a0a88305e1b2b914cf7ce7abb97
|
/src/main/java/com/patterns2/observer/forum/ForumTopic.java
|
72fd77912604052b6fcaf939e03fa043ca0678be
|
[] |
no_license
|
asjco/course-patterns2
|
b60d8433edbb7479e6c33483f4c9c8d356917328
|
ea4a010534363fd3f66ebdd393435d31abeff7f3
|
refs/heads/master
| 2022-11-21T19:32:33.213116
| 2020-07-23T19:50:58
| 2020-07-23T19:50:58
| 281,197,602
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 999
|
java
|
package com.patterns2.observer.forum;
import java.util.ArrayList;
import java.util.List;
public class ForumTopic implements Observable {
private final List<Observer> observers;
private final List<String> messages;
private final String name;
public ForumTopic(String name) {
observers = new ArrayList<>();
messages = new ArrayList<>();
this.name = name;
}
public void addPost(String post) {
messages.add(post);
notifyObservers();
}
@Override
public void registerObserver(Observer observer) {
observers.add(observer);
}
@Override
public void notifyObservers() {
for (Observer observer : observers){
observer.update(this);
}
}
@Override
public void removeObserver(Observer observer) {
observers.remove(observer);
}
public List<String> getMessages() {
return messages;
}
public String getName() {
return name;
}
}
|
[
"adriansionek95@gmail\\.com"
] |
adriansionek95@gmail\.com
|
2793070586b8a9247f4c987b301419610350412c
|
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
|
/data_defect4j/preprossed_method_corpus/Chart/4/org/jfree/chart/block/LineBorder_LineBorder_96.java
|
a6cf4aef1e1b59e9876b27d3961c51aa69579ec9
|
[] |
no_license
|
hvdthong/NetML
|
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
|
9bb103da21327912e5a29cbf9be9ff4d058731a5
|
refs/heads/master
| 2021-06-30T15:03:52.618255
| 2020-10-07T01:58:48
| 2020-10-07T01:58:48
| 150,383,588
| 1
| 1
| null | 2018-09-26T07:08:45
| 2018-09-26T07:08:44
| null |
UTF-8
|
Java
| false
| false
| 814
|
java
|
org jfree chart block
line border link abstract block abstractblock
line border linebord block frame blockfram serializ
creat border color
param paint color code code permit
param stroke border stroke code code permit
param inset inset code code permit
line border linebord paint paint stroke stroke rectangl inset rectangleinset inset
paint
illeg argument except illegalargumentexcept null 'paint' argument
stroke
illeg argument except illegalargumentexcept null 'stroke' argument
inset
illeg argument except illegalargumentexcept null 'insets' argument
paint paint
stroke stroke
inset inset
|
[
"hvdthong@gmail.com"
] |
hvdthong@gmail.com
|
69c71225f96e81c1e910a54794e0e96dce3bb72d
|
725929d70610766ad5ad7148cb61326a0cafe440
|
/DBMS_Proj1/DBMS_Proj1/WEB-INF/classes/ncsu/dao/ProfDao.java
|
ab351508422c8a7754396bb56e67becd0dd3bbc5
|
[] |
no_license
|
karthikvaidesh/DBMS_Proj
|
33e22799a59ccadb11f2da859d567ca4a8b4b6bc
|
428a8b22bed014dbd04f9973485969db88134504
|
refs/heads/master
| 2021-03-19T18:36:45.889485
| 2018-01-20T01:46:35
| 2018-01-20T01:46:35
| 118,198,401
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 22,999
|
java
|
package ncsu.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import ncsu.util.DBUtil;
public class ProfDao {
static Connection conn = null;
static ResultSet rs = null;
static ResultSet rs1 = null;
static PreparedStatement ps = null;
public ResultSet fetchDetails(String username) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
if (conn != null) {
// String sql = "select USER_TYPE from USERS where USER_ID='kogan' and
// PASSWD='kogan'";
String sql = "select * from TEACHES T, COURSES C where T.USER_ID=? and C.COURSE_ID = T.COURSE_ID";
try {
ps = conn.prepareStatement(sql);
ps.setString(1, username);
rs = ps.executeQuery();
if (rs != null) {
return rs;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public boolean createCourse(String userid, String courseid, String coursename, String startdate, String enddate,
String topicArray[], String maxStudents, String taArray[]) {
conn = DBUtil.getConnection();
System.out.print("COMING INTO createCourse" + (conn == null));
if (conn != null) {
System.out.println("CONNECTION IS NOT NULL");
String sql = "INSERT INTO COURSES VALUES (?,?,?,?,?)";
try {
ps = conn.prepareStatement(sql);
ps.setString(1, courseid);
ps.setString(2, coursename);
ps.setDate(3, java.sql.Date.valueOf(startdate));
ps.setDate(4, java.sql.Date.valueOf(enddate));
ps.setInt(5, Integer.parseInt(maxStudents));
int rows = ps.executeUpdate();
Integer next_id = 0;
if (rows > 0) {
System.out.println("INSERTED INTO COURSES");
String sql2 = "INSERT INTO TEACHES VALUES (?,?)";
ps = conn.prepareStatement(sql2);
ps.setString(1, userid);
ps.setString(2, courseid);
int rows1 = ps.executeUpdate();
if (rows1 > 0) {
System.out.println("INSERTED INTO TEACHES");
String sql3 = "SELECT MAX(CAST(TOPIC_ID AS INT)) FROM TOPICS";
ps = conn.prepareStatement(sql3);
rs = ps.executeQuery();
if (rs.next()) {
next_id = Integer.parseInt(rs.getString(1));
System.out.println("next_id=" + next_id);
}
for (String topicName : topicArray) {
next_id++;
String sql4 = "INSERT INTO TOPICS VALUES(?,?)";
ps = conn.prepareStatement(sql4);
System.out.println(Integer.toString((next_id)));
ps.setString(1, Integer.toString((next_id)));
ps.setString(2, topicName);
int rows4 = ps.executeUpdate();
if (rows4 > 0) {
System.out.println("INSERTED INTO TOPICS");
String sql5 = "INSERT INTO COURSES_TOPICS VALUES(?,?)";
ps = conn.prepareStatement(sql5);
ps.setString(1, Integer.toString((next_id)));
ps.setString(2, courseid);
int rows5 = ps.executeUpdate();
if (rows5 > 0) {
System.out.println("INSERTED INTO COURSES_TOPICS");
String sql6 = "UPDATE STUDENTS SET IS_TA = 1, TA_COURSE_ID = ? WHERE USER_ID = ?";
ps = conn.prepareStatement(sql6);
for (String ta : taArray) {
ps.setString(1, courseid);
ps.setString(2, ta);
int rows6 = ps.executeUpdate();
}
}
}
}
}
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
public boolean enrollStudent(String studentID, String courseID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
if (conn != null) {
String sql = "INSERT INTO ENROLLED_IN VALUES (?,?)";
try {
ps = conn.prepareStatement(sql);
ps.setString(1, studentID);
ps.setString(2, courseID);
int rows = ps.executeUpdate();
if (rows > 0) {
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
public boolean dropStudent(String studentID, String courseID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
if (conn != null) {
String sql = "DELETE FROM ENROLLED_IN WHERE USER_ID=? AND COURSE_ID=?";
try {
//conn.setAutoCommit(true);
ps = conn.prepareStatement(sql);
ps.setString(1, studentID);
ps.setString(2, courseID);
int rows = ps.executeUpdate();
System.out.println("rowsssssssssss"+rows);
if (rows > 0) {
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
public String addTA(String studentID, String courseID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String msg="";
if (conn != null) {
String sql1 = "SELECT * FROM ENROLLED_IN where USER_ID=? AND COURSE_ID=?";
String sql = "UPDATE STUDENTS SET IS_TA = 1, TA_COURSE_ID = ? WHERE USER_ID = ? ";
String sql2="Select * from students where USER_ID = ? and type_id=0 ";
try {
ps = conn.prepareStatement(sql1);
ps.setString(1, studentID);
ps.setString(2, courseID);
ResultSet rs = ps.executeQuery();
if (!rs.next()) {
ps=conn.prepareStatement(sql2);
ps.setString(1, studentID);
rs = ps.executeQuery();
if(rs.next()) {
msg="Undergraduate Student.Therefore can't be made TA.";
return msg;
}
ps = conn.prepareStatement(sql);
ps.setString(2, studentID);
ps.setString(1, courseID);
int rows = ps.executeUpdate();
if (rows > 0) {
msg="TA Added";
return msg;
}
} else {
msg="Student enrolled in course.Therefore can't be made TA.";
return msg;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public boolean addQuestion(String value1, String value2, String parameter1v1, String parameter2v1,
String parameter3v1, String parameter4v1, String parameter5v1, String parameter1v2, String parameter2v2,
String parameter3v2, String parameter4v2, String parameter5v2, String qid, String qtype, String qtext,
String hint, String diff, String topic, String ansid1, String ansid2, String ansid3, String ansid4,
String ansid5, String ansid6, String ansid7, String ansid8, String anstext1, String anstext2,
String anstext3, String anstext4, String anstext5, String anstext6, String anstext7, String anstext8,
String iscorrectans1, String iscorrectans2, String iscorrectans3, String iscorrectans4,
String iscorrectans5, String iscorrectans6, String iscorrectans7, String iscorrectans8) {
conn = DBUtil.getConnection();
String answer[] = new String[8], isCorrect[] = new String[8], ansText[] = new String[8],
parameter1[] = new String[5], parameter2[] = new String[5], pid[] = new String[2];
System.out.println("Ansid1 = " + ansid1);
answer[0] = ansid1;
answer[1] = ansid2;
answer[2] = ansid3;
answer[3] = ansid4;
answer[4] = ansid5;
answer[5] = ansid6;
answer[6] = ansid7;
answer[7] = ansid8;
isCorrect[0] = iscorrectans1;
isCorrect[1] = iscorrectans2;
isCorrect[2] = iscorrectans3;
isCorrect[3] = iscorrectans4;
isCorrect[4] = iscorrectans5;
isCorrect[5] = iscorrectans6;
isCorrect[6] = iscorrectans7;
isCorrect[7] = iscorrectans8;
ansText[0] = anstext1;
ansText[2] = anstext3;
ansText[1] = anstext2;
ansText[3] = anstext4;
ansText[4] = anstext5;
ansText[5] = anstext6;
ansText[6] = anstext7;
ansText[7] = anstext8;
pid[0] = "v1";
pid[1] = "v2";
if (conn != null) {
String sql = "insert into QBANK (Q_ID,DETAILED_ANSWER,DIFFICULTY_LEVEL,HINT) VALUES (?,?,?,?)";
try {
ps = conn.prepareStatement(sql);
ps.setString(1, qid);
ps.setString(2, hint);
ps.setString(3, diff);
ps.setString(4, hint);
int rows = ps.executeUpdate();
int rows1 = 0;
if (rows > 0) {
String sql2 = "insert into ANSWERS (Q_ID,ANS_ID,IS_CORRECT,ANSWER_TEXT) VALUES (?,?,?,?)";
try {
ps = conn.prepareStatement(sql2);
ps.setString(1, qid);
for (int i = 0; i < 8; i++) {
System.out.println("answer[i] = " + i + " " + answer[i]);
System.out.println(answer[i] != "" && answer[i] != null);
if (answer[i] != "" && answer[i] != null) {
ps.setString(2, answer[i]);
System.out.println("before insertion" + answer[i]);
ps.setString(3, isCorrect[i]);
ps.setString(4, ansText[i]);
rows1 = ps.executeUpdate();
}
}
if (rows1 > 0) {
String sql3 = "insert into QBANK_TOPICS (Q_ID,TOPIC_ID) VALUES (?,?)";
ps = conn.prepareStatement(sql3);
ps.setString(1, qid);
ps.setString(2, topic);
int rows2 = ps.executeUpdate();
}
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (qtype.equals("standard")) {
String sql4 = "insert into STD_QUESTIONS (Q_ID,Q_TEXT) VALUES (?,?)";
try {
ps = conn.prepareStatement(sql4);
ps.setString(1, qid);
ps.setString(2, qtext);
int rows4 = ps.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
else {
String sql5 = "insert into PARAM_QUESTIONS (Q_ID,Q_TEXT) VALUES (?,?)";
try {
ps = conn.prepareStatement(sql5);
ps.setString(1, qid);
ps.setString(2, qtext);
int rows5 = ps.executeUpdate();
if (rows5 > 0) {
String sql6 = "insert into QPARAMETERS (Q_ID,P_ID,P1,P2,P3,P4,P5) VALUES (?,?,?,?,?,?,?)";
ps = conn.prepareStatement(sql6);
ps.setString(1, qid);
for (int i = 0; i < 2; i++) {
if (i == 0) {
System.out.println("test parameter " + parameter1v1);
ps.setString(2, pid[i]);
ps.setString(3, parameter1v1);
ps.setString(4, parameter2v1);
ps.setString(5, parameter3v1);
ps.setString(6, parameter4v1);
ps.setString(7, parameter5v1);
} else {
ps.setString(2, pid[i]);
ps.setString(3, parameter1v2);
ps.setString(4, parameter2v2);
ps.setString(5, parameter3v2);
ps.setString(6, parameter4v2);
ps.setString(7, parameter5v2);
}
ps.executeUpdate();
}
}
return true;
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// TODO Auto-generated method stub
}
return false;
}
public static HashMap<String, String> fetchtopics() {
conn = DBUtil.getConnection();
HashMap<String, String> topics = new HashMap<String, String>();
if (conn != null) {
String sql1 = "SELECT * FROM Topics";
try {
ps = conn.prepareStatement(sql1);
ResultSet rs = ps.executeQuery();
if (rs != null) {
while (rs.next()) {
topics.put(rs.getString(1), rs.getString(2));
}
return topics;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public static HashMap<String, String> getQuestions(String topicID) {
// TODO Auto-generated method stub
String sql = "select * from QBANK_TOPICS qt,STD_QUESTIONS sq where qt.q_id=sq.q_id and qt.topic_id=?";
String sql1 = "select * from QBANK_TOPICS qt,PARAM_QUESTIONS pq where qt.q_id=pq.q_id and qt.topic_id=?";
conn = DBUtil.getConnection();
HashMap<String, String> qList = new HashMap();
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, topicID);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
qList.put(rs.getString("q_id"), rs.getString("q_text"));
}
ps = conn.prepareStatement(sql1);
ps.setString(1, topicID);
rs = ps.executeQuery();
while (rs.next()) {
qList.put(rs.getString("q_id"), rs.getString("q_text"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return qList;
}
return null;
}
public boolean existsInHWTable(String hwID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "select * from HOMEWORKS where hw_id=?";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
public void insertHWTable(String hwID, String hwName, String startDate, String endDate, String noOfRetries,
String penaltyPerQues, String pointsPerQues, int noOfQues, String hwType) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "insert into HOMEWORKS values(?,?,?,?,?,?,?,?,?)";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
ps.setString(2, hwName);
ps.setDate(3, java.sql.Date.valueOf(startDate));
ps.setDate(4, java.sql.Date.valueOf(endDate));
ps.setInt(5, Integer.parseInt(noOfRetries));
ps.setFloat(6, Float.parseFloat(penaltyPerQues));
ps.setInt(7, Integer.parseInt(pointsPerQues));
ps.setInt(8, noOfQues);
ps.setString(9, hwType);
int rows = ps.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void insertCourseHWTable(String hwID, String courseID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "insert into COURSES_HOMEWORKS values(?,?)";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
ps.setString(2, courseID);
int rows = ps.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public int fetchMaxQsetID(String hwID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "select MAX(QSET_ID) from QSET where HW_ID=?";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt(1);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return -1;
}
public void insertQsetTable(String hwID, int maxQsetNo) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "insert into QSET values(?,?)";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
ps.setInt(2, maxQsetNo);
int rows = ps.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void insertHWQsetQbank(String hwID, int maxQsetNo, String qid) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "insert into HW_QSET_QBANK values(?,?,?)";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
ps.setInt(2, maxQsetNo);
ps.setString(3, qid);
int rows = ps.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public ArrayList<String> fetchHW(String courseID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "select * from COURSES_HOMEWORKS where COURSE_ID=?";
System.out.println("COURSE ID : "+courseID);
ArrayList<String> hwID = new ArrayList<String>();
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, courseID);
System.out.println("ANUPPPPPPPPPPPPPP");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
System.out.println("HWID : "+rs.getString(1));
hwID.add(rs.getString(1));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (hwID.isEmpty()) {
return null;
} else
return hwID;
}
public ArrayList<String> fetchQSets(String hwID) {
// TODO Auto-generated method stub
conn = DBUtil.getConnection();
String sql = "select QSET_ID from QSET where HW_ID=?";
ArrayList<String> qsetID = new ArrayList<String>();
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
qsetID.add(rs.getString(1));
}
if (!qsetID.isEmpty()) {
return qsetID;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public ArrayList<String> fetchQuestions(String qSetId, String hwID) {
conn = DBUtil.getConnection();
String sql1 = "select a.Q_TEXT from PARAM_QUESTIONS a, HW_QSET_QBANK b where a.Q_ID=b.Q_ID and b.QSET_ID=? and b.HW_ID=?";
ArrayList<String> qtext = new ArrayList<String>();
if (conn != null) {
try {
ps = conn.prepareStatement(sql1);
ps.setString(1, qSetId);
ps.setString(2, hwID);
ResultSet rs1 = ps.executeQuery();
while (rs1.next()) {
System.out.println("qtext : "+rs1.getString(1));
qtext.add(rs1.getString(1));
}
String sql2 = "select a.Q_TEXT from STD_QUESTIONS a, HW_QSET_QBANK b where a.Q_ID=b.Q_ID and b.QSET_ID=? and b.HW_ID=?";
if (conn != null) {
ps = conn.prepareStatement(sql2);
ps.setString(1, qSetId);
ps.setString(2, hwID);
ResultSet rs2 = ps.executeQuery();
while (rs2.next()) {
System.out.println("qtext : "+rs2.getString(1));
qtext.add(rs2.getString(1));
}
}
} catch (Exception e) {
}
// TODO Auto-generated method stub
return qtext;
}
return null;
}
public ResultSet viewEnrolledStudents(String c_id) {
conn = DBUtil.getConnection();
String sql = "select u.user_id,u.f_name,u.l_name,e.course_id from ENROLLED_IN e,users u where u.user_id=e.user_id and e.course_id=?";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, c_id);
ResultSet rs = ps.executeQuery();
if (rs.isBeforeFirst()) {
return rs;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public ResultSet viewStudentReport(String u_id, String c_id) {
conn = DBUtil.getConnection();
String sql ="select r.hw_id, h.hw_name,r.attempt_no,sum(r.POINTS_SCORED_PER_QUESTION) as \"Marks_Obtained\" from RESPONSES r ,ENROLLED_IN e, COURSES_HOMEWORKS ch, HOMEWORKS h where e.user_id=r.user_id and r.hw_id=h.hw_id and e.course_id=ch.course_id and h.hw_id=ch.hw_id and e.user_id=? and e.course_id=? group by r.hw_id,h.hw_name,r.attempt_no order by hw_id asc";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1,u_id);
ps.setString(2,c_id);
System.out.println("before");
ResultSet rs = ps.executeQuery();
if (rs.isBeforeFirst()) {
return rs;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public ResultSet viewHomeworks(String c_id) {
conn = DBUtil.getConnection();
String sql ="select h.* from homeworks h,courses_homeworks ch where h.hw_id=ch.hw_id and ch.course_id=? ";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1,c_id);
System.out.println("before");
ResultSet rs = ps.executeQuery();
if (rs.isBeforeFirst()) {
return rs;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
private ResultSet fetchQueSet(String hwID) {
// TODO Auto-generated method stub
String sql = "select QSET_ID from QSET where HW_ID=?";
conn = DBUtil.getConnection();
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hwID);
rs = ps.executeQuery();
if (rs != null) {
return rs;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
public ArrayList<ResultSet> fetchHWQuestions(String hw_id) {
System.out.println("hhhhhwid"+hw_id);
ResultSet quesSetID = fetchQueSet(hw_id);
ArrayList<Integer> al = new ArrayList<>();
int random_id = 0;
ArrayList<ResultSet> results = new ArrayList();
try {
while (quesSetID.next()) {
al.add(quesSetID.getInt("QSET_ID"));
}
System.out.println("allllllllllllll"+al);
Object a[]=al.toArray();
random_id=(int) a[(int) Math.floor(Math.random() *a.length)];
System.out.println("random_id"+random_id);
// int max = 0, min = Integer.MAX_VALUE;
//
// if (quesSetID != null) {
// while (quesSetID.next()) {
// int temp = quesSetID.getInt("QSET_ID");
// if (temp < min)
// min = temp;
// if (temp > max)
// max = temp;
// }
// }
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//
// Random random = new Random();
int qsetID = random_id;
String sql = "select s.Q_ID,s.Q_TEXT,qs.HW_ID,qs.QSET_ID,ans.ANS_ID,ans.IS_CORRECT,ans.ANSWER_TEXT,qb.difficulty_level from STD_QUESTIONS s,HW_QSET_QBANK hqq, QSET qs, ANSWERS ans,Qbank qb where s.q_id=hqq.q_id and s.q_id=qb.q_id and hqq.hw_id=qs.hw_id and hqq.hw_id=? AND qs.qset_id=? and hqq.q_id=ans.Q_ID";
if (conn != null) {
try {
ps = conn.prepareStatement(sql);
ps.setString(1, hw_id);
ps.setInt(2, qsetID);
rs = ps.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String sql1 = "select distinct hqq.hw_id,qs.qset_id,p.q_id,p.q_text,qp.p_id,qp.p1,qp.p2,qp.p3,qp.p4,qp.p5,ans.ans_id,ans.answer_text,ans.is_correct,qb.difficulty_level from PARAM_QUESTIONS p,HW_QSET_QBANK hqq , QSET qs, QPARAMETERS qp, ANSWERS ans,Qbank qb where p.q_id=hqq.q_id and p.q_id=qb.q_id and UPPER(qp.p_id)=UPPER('v1') and hqq.hw_id=qs.hw_id and qs.hw_id=? AND qs.qset_id=? and hqq.q_id=qp.q_id and ans.q_id=hqq.q_id";
try {
ps = conn.prepareStatement(sql1);
ps.setString(1, hw_id);
ps.setInt(2, qsetID);
rs1 = ps.executeQuery();
// while(rs1.next()) {
// System.out.println("rs1"+rs1.getString(1));
// }
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("before");
results.add(rs);
System.out.println("b/w");
results.add(rs1);
System.out.println("after");
System.out.println("ADITYA" + results.size());
}
return results;
}
}
|
[
"kvaides@ncsu.edu"
] |
kvaides@ncsu.edu
|
f9f6a3febc5fcb96f49f0764696ebce900194e62
|
2eb6af5a8607592f787e007a74a3df08bb9052bc
|
/springboot-p2-security-cache-monitoring/src/main/java/br/com/alura/forum/controller/dto/AnswerResponse.java
|
6fcc05d736277062b4dd9cf722a6e2ac23c81fe0
|
[
"MIT"
] |
permissive
|
jether2011/alura-classes
|
34b9c868a718e88da43ecdf04cf527057091977d
|
09ab8d39d948688a4e6962a59c5ddc3494806974
|
refs/heads/master
| 2023-01-12T02:24:32.211582
| 2020-04-06T12:14:09
| 2020-04-06T12:14:09
| 197,442,733
| 1
| 0
|
MIT
| 2023-01-07T08:10:39
| 2019-07-17T18:31:45
|
Java
|
UTF-8
|
Java
| false
| false
| 811
|
java
|
package br.com.alura.forum.controller.dto;
import java.time.LocalDateTime;
import br.com.alura.forum.modelo.Answer;
public final class AnswerResponse {
private Long id;
private String message;
private LocalDateTime created;
private String actorName;
public AnswerResponse(final Answer answer) {
this.id = answer.getId();
this.message = answer.getMessage();
this.created = answer.getCreated();
this.actorName = answer.getActorName();
}
public static AnswerResponse from(final Answer answer) {
return new AnswerResponse(answer);
}
public Long getId() {
return id;
}
public String getMensagem() {
return message;
}
public LocalDateTime getDataCriacao() {
return created;
}
public String getNomeAutor() {
return actorName;
}
}
|
[
"jetherrodrigues@gmail.com"
] |
jetherrodrigues@gmail.com
|
8717c8379d41ee33fec61bd407e83199076a9e28
|
40466299acca6bb57449527fa2f003f3d01bcf06
|
/google-guice/src/main/java/io/hari/googleguice/simple2/MyShapeRequest.java
|
4004471961b9b6723fa4b3d70be025ded55e6db5
|
[] |
no_license
|
tanbinh123/java-spring-boot-2021
|
4e239cd93bdeeb3e888ea4e3fe66fc0d16bbaf7b
|
e3a36c664e99e4c5d6632bffbcadff341272d799
|
refs/heads/master
| 2023-06-20T07:31:54.752654
| 2021-07-15T11:57:23
| 2021-07-15T11:57:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 570
|
java
|
package io.hari.googleguice.simple2;
import com.google.inject.Inject;
import io.hari.googleguice.simple2.impl.IShape;
public class MyShapeRequest {
IShape shape;
@Inject//this will go to AbstractModule class to see if binding is present or not for this interface : https://www.youtube.com/watch?v=tjHjHWNANGo&list=PLp0ed20U4R4jknb4xYdhx3yJn5RhWECxn&index=8
public MyShapeRequest(IShape shape) {
this.shape = shape;
}
public void makeRequest() {
System.out.println("MyShapeRequest.makeRequest");
this.shape.draw();
}
}
|
[
"yadav.hariom@BLRETV-C02F52AP.local"
] |
yadav.hariom@BLRETV-C02F52AP.local
|
8ba8ac31f820476d93a17fa8b719b16eec48feac
|
2c63bd0ad467fecfe3550f9c8253a166ebd938bc
|
/src/main/java/seedu/address/model/person/ExpectedGraduationYear.java
|
91bd6df11a22f180d2097a17989b71b46a539759
|
[
"MIT"
] |
permissive
|
CS2103JAN2018-W14-B3/main
|
2b8671ee8798cade7bee06f12ed2221103d1b7a0
|
c111af683a384d5b1df87bff9701d64adfbe8b0c
|
refs/heads/master
| 2021-04-27T07:15:30.337441
| 2018-04-21T04:17:47
| 2018-04-21T04:17:47
| 122,627,892
| 1
| 4
| null | 2018-04-21T04:07:31
| 2018-02-23T13:56:06
|
Java
|
UTF-8
|
Java
| false
| false
| 2,286
|
java
|
package seedu.address.model.person;
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.AppUtil.checkArgument;
//@@author mhq199657
/**
* Represents a Person's expectedGraduationYear in the address book.
* Guarantees: immutable; is valid as declared in {@link #isValidExpectedGraduationYear(String)}
*/
public class ExpectedGraduationYear {
public static final String MESSAGE_EXPECTED_GRADUATION_YEAR_CONSTRAINTS =
"Expected graduation year can only contain numbers, and should be between 2017 to 2025.";
private static final String EXPECTED_GRADUATION_YEAR_VALIDATION_REGEX = "\\d{4}";
private static final int YEAR_LOWER_BOUND = 2017;
private static final int YEAR_UPPER_BOUND = 2025;
public final String value;
/**
* Constructs a {@code expectedGraduationYear}.
*
* @param expectedGraduationYear A valid expectedGraduationYear.
*/
public ExpectedGraduationYear(String expectedGraduationYear) {
requireNonNull(expectedGraduationYear);
checkArgument(isValidExpectedGraduationYear(expectedGraduationYear),
MESSAGE_EXPECTED_GRADUATION_YEAR_CONSTRAINTS);
this.value = expectedGraduationYear;
}
/**
* Returns true if a given string is a valid expectedGraduationYear.
*/
public static boolean isValidExpectedGraduationYear(String test) {
return test.matches(EXPECTED_GRADUATION_YEAR_VALIDATION_REGEX) && isInValidRange(test);
}
/**
*
* @param test An expected graduation year matching regex
* @return whether the graduation year is in valid range
*/
private static boolean isInValidRange(String test) {
int year = Integer.parseInt(test);
return year >= YEAR_LOWER_BOUND && year <= YEAR_UPPER_BOUND;
}
@Override
public String toString() {
return value;
}
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof ExpectedGraduationYear // instanceof handles nulls
&& this.value.equals(((ExpectedGraduationYear) other).value)); // state check
}
@Override
public int hashCode() {
return value.hashCode();
}
}
|
[
"mhq199657@163.com"
] |
mhq199657@163.com
|
29d8e8194fc059bc3247ef58de907c2ad8eb81b7
|
e6850dfe48e031a97bf624791fd03e597d51ef5e
|
/src/main/java/com/example/planb/Client.java
|
d57aaeee62fe278cc1d9d0abf2c744ea354737ce
|
[] |
no_license
|
buryakovEduard/plan
|
b0a6100dc52c430846b19c0d27b883cab5dda8df
|
b4702e43313c1304166513abca446904a7efb4c9
|
refs/heads/master
| 2020-03-28T10:44:43.116033
| 2018-09-10T21:56:01
| 2018-09-10T21:56:01
| 148,140,924
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 650
|
java
|
package com.example.planb;
public class Client {
private int id;
private String name;
private int purchases = 0;
public Client(){
}
public Client(int id, String name) {
this.id = id;
this.name = name;
}
public int getPurchases() {
return purchases;
}
public void setPurchases(int purchases) {
this.purchases = purchases;
}
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;
}
}
|
[
"sator.b@hotmail.com"
] |
sator.b@hotmail.com
|
3f6f5e3cb4ce45231d0187ab15f584457b23ed8c
|
d07a407a76e239bbf0300a0e4ff0173ed05c0171
|
/src/main/java/org/v4/atomicintarray/File.java
|
2173551e4585d68d45039f5039f23bded6529434
|
[] |
no_license
|
zont163/CountUniqueIP
|
feb5f393d7c819b84b18402e202003242af301d4
|
da511af6a1e7384f20d6bc1930e7a14efd0b391d
|
refs/heads/master
| 2023-04-25T09:02:11.339554
| 2021-05-22T06:42:55
| 2021-05-22T06:42:55
| 369,735,826
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 599
|
java
|
package org.v4.atomicintarray;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
public class File {
public void getReader(String path) throws IOException {
Logger logger = Logger.getLogger(Solution.class.getName());
Path pathFile = Paths.get(path);
if (!pathFile.toFile().isFile()) {
logger.log(Level.WARNING, String.format("Specified file %s is not a file or does not exist.",pathFile.toFile().toString()));
System.exit(-1);
}
}
}
|
[
"ubitaia@gmail.com"
] |
ubitaia@gmail.com
|
9fc92175857278b03c9aa70c24a00405492a842b
|
87c616e8dbfd2b95393029245682535620ef0b45
|
/Mage.Tests/src/test/java/org/mage/test/cards/modal/OneOrBothTest.java
|
52aef300aaf9f0ca2de5faf768f60268af919cf0
|
[] |
no_license
|
PedroTav/mage
|
c625378af8d966b3c0852dfd66dcaf9171a33f23
|
2e551a971cb3fe71bf73e9b01766b1caf394ef10
|
refs/heads/master
| 2021-01-24T11:44:18.685749
| 2016-12-18T15:08:00
| 2016-12-18T15:08:00
| 70,226,202
| 1
| 2
| null | 2016-10-14T08:09:23
| 2016-10-07T07:55:50
|
Java
|
UTF-8
|
Java
| false
| false
| 4,558
|
java
|
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.modal;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class OneOrBothTest extends CardTestPlayerBase {
@Test
public void testSubtleStrikeFirstMode() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
// Choose one or both —
// • Target creature gets -1/-1 until end of turn.
// • Put a +1/+1 counter on target creature.
addCard(Zone.HAND, playerA, "Subtle Strike"); // Instant {1}{B}
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Subtle Strike", "Pillarfield Ox");
setModeChoice(playerA, "1");
setModeChoice(playerA, null);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, "Silvercoat Lion", 2, 2);
assertPowerToughness(playerB, "Pillarfield Ox", 1, 3);
}
@Test
public void testSubtleStrikeSecondMode() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
// Choose one or both —
// • Target creature gets -1/-1 until end of turn.
// • Put a +1/+1 counter on target creature.
addCard(Zone.HAND, playerA, "Subtle Strike"); // Instant {1}{B}
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Subtle Strike", "Pillarfield Ox");
setModeChoice(playerA, "2");
setModeChoice(playerA, null);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, "Silvercoat Lion", 2, 2);
assertPowerToughness(playerB, "Pillarfield Ox", 3, 5);
}
@Test
public void testSubtleStrikeBothModes() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
// Choose one or both —
// • Target creature gets -1/-1 until end of turn.
// • Put a +1/+1 counter on target creature.
addCard(Zone.HAND, playerA, "Subtle Strike"); // Instant {1}{B}
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Subtle Strike", "Pillarfield Ox");
addTarget(playerA, "Silvercoat Lion");
setModeChoice(playerA, "1");
setModeChoice(playerA, "2");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, "Silvercoat Lion", 3, 3);
assertPowerToughness(playerB, "Pillarfield Ox", 1, 3);
}
}
|
[
"ludwig.hirth@online.de"
] |
ludwig.hirth@online.de
|
42c380a0a063ea229337bd3f8f8193eae7fdf923
|
a3fa588202f1e47b05bdc501499a93569c6c485b
|
/app/src/main/java/com/example/xbree/listparticip.java
|
f5df17eb57bfb2cf4e123bd787ffd7aa422ad0b8
|
[] |
no_license
|
aymennegra/Sporty-android
|
32f7d689878bde7ae2bd758bf3bcff62922ad761
|
1444524cc6dfd084aab34179b3308c6360ab7042
|
refs/heads/main
| 2023-07-02T11:05:16.612034
| 2021-07-29T22:27:01
| 2021-07-29T22:27:01
| 390,864,451
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,605
|
java
|
package com.example.xbree;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.airbnb.lottie.LottieAnimationView;
import com.example.xbree.HomeAdapter.EvenementAdapter;
import com.example.xbree.HomeAdapter.EvenementUserAdapter;
import com.example.xbree.Entities.Evenement;
import com.example.xbree.Retrofit.INodeJS;
import com.example.xbree.Retrofit.RetrofitClient;
import com.example.xbree.Utils.database.AppDataBase;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class listparticip extends AppCompatActivity {
ImageView acceuil1, profileuser, favori;
List<Evenement> evenementsList;
RecyclerView recyclerView;
public static INodeJS iNodeJS;
Context mContext;
SharedPreferences sharedPreferencesU;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_part);
recyclerView = findViewById(R.id.eventss);
favori = findViewById(R.id.favori);
iNodeJS = RetrofitClient.getInstance().create(INodeJS.class);
GetListEvenement();
}
public void GetListEvenement() {
sharedPreferencesU = getApplicationContext().getSharedPreferences("CurrentUser", Context.MODE_PRIVATE);
int idu = sharedPreferencesU.getInt("idUser", 0);
System.out.println(idu);
Call<List<Evenement>> call = iNodeJS.getparticipList(idu);
call.enqueue(new Callback<List<Evenement>>() {
@Override
public void onResponse(Call<List<Evenement>> call, Response<List<Evenement>> response) {
evenementsList = response.body();
Log.d("test2", String.valueOf(response.body()));
EvenementUserAdapter adapter = new EvenementUserAdapter(mContext, evenementsList);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
}
@Override
public void onFailure(Call<List<Evenement>> call, Throwable t) {
}
});
}
}
|
[
"aymen.negra@esprit.tn"
] |
aymen.negra@esprit.tn
|
36ee891ee564f2cf226f89ec95f295dd105debae
|
9b7903ca406f83dabf7094f89b06077db24a96ca
|
/src/main/java/com/example/storeapi/api/StoreApi.java
|
a3ed7daa8adb375f96a2064219a7cbd6dae358ff
|
[
"Apache-2.0"
] |
permissive
|
ArturAdamczyk/StoreApi
|
7b5dae9f30f96e011fa105f1ad7a37f75faa348d
|
f1270ffb2c38464919938c3ca3c31c06ebb62866
|
refs/heads/master
| 2020-03-29T14:10:51.084584
| 2018-09-23T17:04:13
| 2018-09-23T17:04:13
| 150,003,260
| 0
| 0
|
Apache-2.0
| 2018-09-23T17:04:14
| 2018-09-23T16:30:07
| null |
UTF-8
|
Java
| false
| false
| 395
|
java
|
package com.example.storeapi.api;
import java.util.List;
public interface StoreApi {
void addItem(String serialNumber, String itemType, String warrantyExpirationDate);
void removeItem(String serialNumber);
boolean isItemInWarehouse(String serialNumber);
int countAllItems();
int countByItemType(String itemType);
List<String> findExpiredWarrantyItemsSerialNumbers();
}
|
[
"arta.ada@wp.pl"
] |
arta.ada@wp.pl
|
1f46ce4b9ecf426a727cd1403b949cc649f0dc8c
|
050ba1210acac071a51e03060717cb72aa7c4d28
|
/src/main/java/com/awei/tank/AbstractGameObject.java
|
ec423a495433cb1da17022fd665585572e8a4ae9
|
[] |
no_license
|
zhouyouwei-0127/tank2
|
f992c9bd4117f2b138d04d26e053c46e4f51680a
|
a189619c881ae9e04370c7c7c95bf37230d0e343
|
refs/heads/master
| 2023-04-20T04:05:56.129155
| 2021-05-03T13:17:08
| 2021-05-03T13:17:08
| 356,795,265
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 225
|
java
|
package com.awei.tank;
import java.awt.*;
import java.io.Serializable;
public abstract class AbstractGameObject implements Serializable {
public abstract void paint(Graphics g);
public abstract boolean isLive();
}
|
[
"zyw01271314@163.com"
] |
zyw01271314@163.com
|
7f20b29fdb8aca624c1047d9637e5c76a8674c3a
|
3e7534d1eb2ba794f09b9318c4561d02b6b63eb7
|
/src/main/java/de/uniba/dsg/jaxrs/model/dto/OrderStatusDTO.java
|
9536aba7ad0772738491596761acb90b4c9b282f
|
[] |
no_license
|
Gobinath-Ganesan/Beverage-Order-Management-System
|
b161966b3e6495cebf432ab586f2d038cdf2d384
|
b713d7fe960ac640fb6ddca80bef1b4fb3fa8ea2
|
refs/heads/master
| 2022-11-17T23:04:05.632524
| 2020-07-20T07:08:37
| 2020-07-20T07:08:37
| 280,890,184
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 635
|
java
|
package de.uniba.dsg.jaxrs.model.dto;
import de.uniba.dsg.jaxrs.model.logic.OrderStatus;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
@XmlType(name = "OrderStatus")
@XmlEnum
public enum OrderStatusDTO {
SUBMITTED, PROCESSED,CANCELLED;
static OrderStatusDTO getDTO(OrderStatus orderStatus) {
switch (orderStatus) {
case SUBMITTED:
return SUBMITTED;
case PROCESSED:
return PROCESSED;
case CANCELLED:
return CANCELLED;
default:
return null;
}
}
}
|
[
"gobinath.ganesan@stud.uni-bamberg.de"
] |
gobinath.ganesan@stud.uni-bamberg.de
|
6471edb648c1b4d9da07d883e1fb1d98a2bd02f8
|
e35812ddb710e43c8ae6355ecc05575f9cf2f15d
|
/UTS/src/main/java/com/joonggo/pro/board/dto/boardPhotoList.java
|
b9f2eb607ee86000d80e53caa30d941ac75ec030
|
[] |
no_license
|
qkrekf9133/utd
|
3ac242569b7f1ad5ac30524636e826992ba5f74d
|
4949ac93ba80da2040d590751d2bf5901c4a8d19
|
refs/heads/master
| 2023-06-13T07:43:26.558405
| 2021-07-01T08:49:14
| 2021-07-01T08:49:14
| 364,272,444
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 279
|
java
|
package com.joonggo.pro.board.dto;
import java.sql.Timestamp;
import lombok.Data;
@Data
public class boardPhotoList {
private int bno;
private String title;
private String content;
private Timestamp reg_date;
private String writer;
private String pphotoname;
}
|
[
"qkrekf9133@naver.com"
] |
qkrekf9133@naver.com
|
ea727e2127c169f75627d4a608204087cda4e438
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/2/2_d20b543798413c08db7b747d329c09871c066add/APIEndpoint/2_d20b543798413c08db7b747d329c09871c066add_APIEndpoint_t.java
|
f9aa009c35ae9142bb519162e77db2094d1a4af9
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692
| 2023-06-22T07:55:56
| 2023-06-22T07:55:56
| 259,613,157
| 6
| 2
| null | 2023-06-22T07:55:57
| 2020-04-28T11:07:49
| null |
UTF-8
|
Java
| false
| false
| 12,432
|
java
|
package com.brotherlogic.booser.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DateFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.brotherlogic.booser.Config;
import com.brotherlogic.booser.atom.Atom;
import com.brotherlogic.booser.atom.Beer;
import com.brotherlogic.booser.atom.Drink;
import com.brotherlogic.booser.atom.FoursquareVenue;
import com.brotherlogic.booser.atom.User;
import com.brotherlogic.booser.atom.Venue;
import com.brotherlogic.booser.storage.AssetManager;
import com.brotherlogic.booser.storage.db.Database;
import com.brotherlogic.booser.storage.db.DatabaseFactory;
import com.brotherlogic.booser.storage.web.Downloader;
import com.brotherlogic.booser.storage.web.WebLayer;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
public class APIEndpoint extends UntappdBaseServlet
{
private static final String baseURL = "http://localhost:8080/";
// private static final String baseURL =
// "http://booser-beautiful.rhcloud.com/";
private static final int COOKIE_AGE = 60 * 60 * 24 * 365;
private static final String COOKIE_NAME = "untappdpicker_cookie";
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException
{
if (req.getParameter("action") != null && req.getParameter("action").equals("version"))
{
write(resp, "0.4");
return;
}
String token = null;
if (req.getParameter("notoken") == null)
{
token = req.getParameter("access_token");
if (token == null)
token = getUserToken(req, resp);
}
// If we're not logged in, server will redirect
if (token != "not_logged_in")
{
AssetManager manager = AssetManager.getManager(token);
String action = req.getParameter("action");
if (action == null)
{
resp.sendRedirect("/");
return;
}
if (action.equals("getVenue"))
{
double lat = Double.parseDouble(req.getParameter("lat"));
double lon = Double.parseDouble(req.getParameter("lon"));
List<Atom> venues = getFoursquareVenues(manager, lat, lon);
processJson(resp, venues);
}
else if (action.equals("venueDetails"))
{
Database db = DatabaseFactory.getInstance().getDatabase();
db.reset();
Venue v = manager.getVenue(req.getParameter("vid"));
List<JsonObject> retList = new LinkedList<JsonObject>();
for (Entry<Beer, Integer> count : v.getBeerCounts().entrySet())
{
JsonObject nObj = new JsonObject();
nObj.add("beer_name", new JsonPrimitive(count.getKey().getBeerName()));
nObj.add("beer_style", new JsonPrimitive(count.getKey().getBeerStyle()));
nObj.add("brewery_name", new JsonPrimitive(count.getKey().getBrewery()
.getBreweryName()));
nObj.add("count", new JsonPrimitive(count.getValue()));
retList.add(nObj);
}
// Simple sorting for now
Collections.sort(retList, new Comparator<JsonObject>()
{
@Override
public int compare(JsonObject arg0, JsonObject arg1)
{
return -(arg0.get("count").getAsInt() - arg1.get("count").getAsInt());
}
});
JsonArray retArr = new JsonArray();
for (JsonObject obj : retList)
retArr.add(obj);
write(resp, retArr);
}
else if (action.equals("getNumberOfDrinks"))
{
Database db = DatabaseFactory.getInstance().getDatabase();
db.reset();
User u = manager.getUser();
List<Drink> beers = u.getDrinks();
JsonObject obj = new JsonObject();
obj.add("drinks", new JsonPrimitive(beers.size()));
obj.add("username", new JsonPrimitive(u.getId()));
write(resp, obj);
}
else if (action.equals("getDrinks"))
{
Database db = DatabaseFactory.getInstance().getDatabase();
db.reset();
User u = manager.getUser();
List<Drink> drinks = u.getDrinks();
Map<Beer, Integer> counts = new TreeMap<Beer, Integer>();
Map<Beer, Double> beers = new TreeMap<Beer, Double>();
for (Drink d : drinks)
{
if (!counts.containsKey(d.getBeer()))
counts.put(d.getBeer(), 1);
else
counts.put(d.getBeer(), counts.get(d.getBeer()) + 1);
beers.put(d.getBeer(), d.getRating_score());
}
Gson gson = new Gson();
JsonArray arr = new JsonArray();
for (Beer b : beers.keySet())
{
JsonObject obj = gson.toJsonTree(b).getAsJsonObject();
obj.add("rating", new JsonPrimitive(beers.get(b)));
obj.add("drunkcount", new JsonPrimitive(counts.get(b)));
arr.add(obj);
}
write(resp, arr);
}
else if (action.equals("getStyle"))
{
String style = req.getParameter("style");
if (style.equals("null"))
style = "";
Database db = DatabaseFactory.getInstance().getDatabase();
db.reset();
User u = manager.getUser();
List<Drink> drinks = u.getDrinks();
Map<Beer, Integer> counts = new TreeMap<Beer, Integer>();
Map<Beer, Double> rating = new TreeMap<Beer, Double>();
for (Drink d : drinks)
if (style.length() == 0 || d.getBeer().getBeerStyle().equals(style))
{
if (!counts.containsKey(d.getBeer()))
counts.put(d.getBeer(), 1);
else
counts.put(d.getBeer(), counts.get(d.getBeer()) + 1);
rating.put(d.getBeer(), d.getRating_score());
}
Gson gson = new Gson();
JsonArray arr = new JsonArray();
for (Beer b : counts.keySet())
{
JsonObject obj = gson.toJsonTree(b).getAsJsonObject();
obj.add("drunkcount", new JsonPrimitive(counts.get(b)));
obj.add("rating", new JsonPrimitive(rating.get(b)));
arr.add(obj);
}
write(resp, arr);
}
else if (action.equals("getBeer"))
{
String beerId = req.getParameter("beer");
DateFormat df = DateFormat.getInstance();
Database db = DatabaseFactory.getInstance().getDatabase();
db.reset();
User u = manager.getUser();
List<Drink> drinks = u.getDrinks();
List<Drink> show = new LinkedList<Drink>();
for (Drink d : drinks)
if (d.getBeer().getId().equals(beerId))
show.add(d);
Gson gson = new Gson();
JsonArray arr = new JsonArray();
for (Drink d : show)
{
JsonObject obj = gson.toJsonTree(d.getBeer()).getAsJsonObject();
obj.add("date", new JsonPrimitive(df.format(d.getCreated_at().getTime())));
if (d.getPhoto_url() != null)
obj.add("photo", new JsonPrimitive(d.getPhoto_url()));
obj.add("rating", new JsonPrimitive(d.getRating_score()));
arr.add(obj);
}
write(resp, arr);
}
else if (action.equals("users"))
{
Database db = DatabaseFactory.getInstance().getDatabase();
db.reset();
List<Atom> users = manager.getUsers();
JsonArray arr = new JsonArray();
for (Atom user : users)
arr.add(new JsonPrimitive(user.getId()));
write(resp, arr);
}
}
}
public List<Atom> getFoursquareVenues(AssetManager manager, double lat, double lon)
{
try
{
WebLayer layer = new WebLayer(manager);
List<Atom> atoms = layer.getLocal(FoursquareVenue.class,
new URL("https://api.foursquare.com/v2/venues/search?ll=" + lat + "," + lon
+ "&client_id=" + Config.getFoursquareClientId() + "&" + "client_secret="
+ Config.getFoursquareSecret() + "&v=20130118"), false);
return atoms;
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
return new LinkedList<Atom>();
}
public String getUserDetails(String userToken) throws IOException
{
User u = AssetManager.getManager(userToken).getUser();
return u.getJson();
}
/**
* Gets the user token from the request
*
* @param req
* The servlet request object
* @return The User Token
*/
private String getUserToken(final HttpServletRequest req, final HttpServletResponse resp)
{
if (req.getCookies() != null)
for (Cookie cookie : req.getCookies())
if (cookie.getName().equals(COOKIE_NAME))
return cookie.getValue();
// Forward the thingy on to the login point
try
{
// Check we're not in the login process
if (req.getParameter("code") != null)
{
String response = Downloader.getInstance().download(
new URL("https://untappd.com/oauth/authorize/?client_id="
+ Config.getUntappdClient() + "&client_secret=" + Config.getUntappdSecret()
+ "&response_type=code&redirect_url=" + baseURL + "API&code="
+ req.getParameter("code")));
// Get the access token
JsonParser parser = new JsonParser();
String nToken = parser.parse(response).getAsJsonObject().get("response")
.getAsJsonObject().get("access_token").getAsString();
// Set the cookie
Cookie cookie = new Cookie(COOKIE_NAME, nToken);
cookie.setMaxAge(COOKIE_AGE);
cookie.setPath("/");
resp.addCookie(cookie);
return nToken;
}
else
resp.sendRedirect("http://untappd.com/oauth/authenticate/?client_id="
+ Config.getUntappdClient() + "&client_secret=" + Config.getUntappdSecret()
+ "&response_type=code&redirect_url=" + baseURL + "API");
}
catch (IOException e)
{
e.printStackTrace();
}
return "not_logged_in";
}
private void processJson(HttpServletResponse resp, List<Atom> atoms) throws IOException
{
StringBuffer ret = new StringBuffer("[");
if (atoms.size() > 0)
{
ret.append(atoms.get(0).getJson());
for (Atom atom : atoms.subList(1, atoms.size()))
ret.append("," + atom.getJson());
}
ret.append("]");
write(resp, ret.toString());
}
private void write(HttpServletResponse resp, JsonElement obj) throws IOException
{
write(resp, obj.toString());
}
private void write(HttpServletResponse resp, String jsonString) throws IOException
{
resp.setContentType("application/json");
PrintWriter out = resp.getWriter();
out.print(jsonString);
out.close();
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
1876089be6539dcacd83e248dc3ae23645179b03
|
f930dc2e0fad0e7a1cf8c02c22a0b25158cb74b8
|
/src/main/java/com/patres/ownframework/step2a/application/model/Company.java
|
254e9bd4b11c04643b5a215f3361610bb120f7bf
|
[] |
no_license
|
ksaturn/Java-Own-Framework---step-by-step
|
dd6f07be624792c93e017de5f1660d64825dd2d1
|
0844be3f0ecedfb1aa76c683f23bb61680c1d2ef
|
refs/heads/main
| 2023-07-13T12:34:59.284213
| 2021-08-22T20:49:19
| 2021-08-22T20:49:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 84
|
java
|
package com.patres.ownframework.step2a.application.model;
public class Company {
}
|
[
"patryk.piechaczek@bottomline.com"
] |
patryk.piechaczek@bottomline.com
|
b81baeb55755ad213e0f437e6e9a59b60c439d9e
|
8a93446a4e0aa2e8cc521679596ceef4ff3878d0
|
/minecraft/net/optifine/SmartAnimations.java
|
1c45c5e1501aad502d80a205268e56ed21d6a898
|
[] |
no_license
|
itscola/1.8.10-old
|
3a2b21cb8f1d55a31951c7de18b94a8db91a9ab9
|
5b91c2b529ed33795bc0e9e1ea028dda2f1b13a0
|
refs/heads/master
| 2023-04-07T22:33:22.838085
| 2021-04-12T18:56:04
| 2021-04-12T18:56:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,292
|
java
|
package net.optifine;
import java.util.BitSet;
import net.minecraft.src.Config;
import net.optifine.shaders.Shaders;
public class SmartAnimations {
private static boolean active;
private static BitSet spritesRendered = new BitSet();
private static BitSet texturesRendered = new BitSet();
public static boolean isActive() { return active && !Shaders.isShadowPass; }
public static void update() { active = Config.getGameSettings().ofSmartAnimations; }
public static void spriteRendered(final int animationIndex) {
if (animationIndex >= 0) {
spritesRendered.set(animationIndex);
}
}
public static void spritesRendered(final BitSet animationIndexes) {
if (animationIndexes != null) {
spritesRendered.or(animationIndexes);
}
}
public static boolean isSpriteRendered(final int animationIndex) { return animationIndex < 0 ? false : spritesRendered.get(animationIndex); }
public static void resetSpritesRendered() { spritesRendered.clear(); }
public static void textureRendered(final int textureId) {
if (textureId >= 0) {
texturesRendered.set(textureId);
}
}
public static boolean isTextureRendered(final int texId) { return texId < 0 ? false : texturesRendered.get(texId); }
public static void resetTexturesRendered() { texturesRendered.clear(); }
}
|
[
"69243988+deadghost2173@users.noreply.github.com"
] |
69243988+deadghost2173@users.noreply.github.com
|
e8238915367dcb5fd45c8b4fb57a64ed3055322b
|
c003579730c49139b6d689728fc54a982e279754
|
/escalade-consumer/src/main/java/fr/alardon/escalade/consumer/contract/dao/PhotoDao.java
|
c87feaacc8434b3b1d1d899843b543dc9651f711
|
[] |
no_license
|
aquel69/Projet6_OC_Escalade_2
|
aeafb39293518f18e74052ffa497abd54505570e
|
04503262fdcfd9c7d440bddf54573c76c5e30645
|
refs/heads/master
| 2022-12-05T12:23:15.922508
| 2020-08-20T17:58:10
| 2020-08-20T17:58:10
| 288,099,551
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 763
|
java
|
package fr.alardon.escalade.consumer.contract.dao;
import fr.alardon.escalade.bean.photo.UrlPhoto;
import java.util.List;
public interface PhotoDao {
/**
*
* @param idPhoto
* @return la photo suivant son id
*/
public UrlPhoto read(int idPhoto);
/**
*
* @param idSite
* @return la liste des photos par site
*/
public List<UrlPhoto> readAllPhotoParSite(int idSite);
/**
*
* @param pUrlPhoto
* @return ajoute une photo
*/
public Integer ajouterUnePhoto(UrlPhoto pUrlPhoto);
/**
*
* @return toutes les photos
*/
public List<UrlPhoto> readAllPhoto();
/**
*
* @return l'id de la dernière photo
*/
public int idDernierePhoto();
}
|
[
"alexandre.lardon@yahoo.fr"
] |
alexandre.lardon@yahoo.fr
|
c2d1dfcd3e0e8ea3770c0610412e0747b6aea992
|
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
|
/sources/com/avito/android/viewed_items/ViewedItemsPresenterImpl.java
|
84aa090065e0cb4471570ae8e88ded7d28361f74
|
[] |
no_license
|
Auch-Auch/avito_source
|
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
|
76fdcc5b7e036c57ecc193e790b0582481768cdc
|
refs/heads/master
| 2023-05-06T01:32:43.014668
| 2021-05-25T10:19:22
| 2021-05-25T10:19:22
| 370,650,685
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 24,562
|
java
|
package com.avito.android.viewed_items;
import a2.a.a.t3.d;
import a2.g.r.g;
import android.os.Bundle;
import com.avito.android.analytics.provider.TreeStateIdGenerator;
import com.avito.android.analytics.provider.clickstream.ScreenIdField;
import com.avito.android.analytics.provider.clickstream.TreeClickStreamParent;
import com.avito.android.deep_linking.links.AdvertDetailsLink;
import com.avito.android.deep_linking.links.DeepLink;
import com.avito.android.favorite.FavoriteActionSource;
import com.avito.android.favorite.FavoriteAdvertsEventInteractor;
import com.avito.android.favorite.FavoriteAdvertsInteractor;
import com.avito.android.favorite.FavoriteModel;
import com.avito.android.favorites.adapter.FavoriteListItem;
import com.avito.android.favorites.adapter.advert.FavoriteAdvertItem;
import com.avito.android.preferences.UserFavoritesStorage;
import com.avito.android.remote.auth.AuthSource;
import com.avito.android.remote.model.Image;
import com.avito.android.serp.adapter.FavorableItem;
import com.avito.android.util.LoadingState;
import com.avito.android.util.SchedulersFactory3;
import com.avito.android.viewed_items.ViewedItemsPresenter;
import com.avito.android.viewed_items.ViewedItemsView;
import com.avito.android.viewed_items.adapter.LoadingItem;
import com.avito.android.viewed_items.di.ViewedItems;
import com.avito.android.viewed_items.model.ViewedItemsModel;
import com.avito.konveyor.adapter.AdapterPresenter;
import com.avito.konveyor.data_source.ListDataSource;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.functions.Function;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000 \u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u0001BK\b\u0007\u0012\u0006\u00104\u001a\u000201\u0012\u0006\u0010V\u001a\u00020S\u0012\b\b\u0001\u0010f\u001a\u00020c\u0012\u0006\u0010<\u001a\u000209\u0012\u0006\u0010@\u001a\u00020=\u0012\u0006\u0010M\u001a\u00020J\u0012\u0006\u00108\u001a\u000205\u0012\u0006\u0010D\u001a\u00020A¢\u0006\u0004\bg\u0010hJ\u0017\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\u0005\u0010\u0006J\u000f\u0010\u0007\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0007\u0010\bJ\u0017\u0010\t\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\t\u0010\u0006J\u0017\u0010\f\u001a\u00020\u00042\u0006\u0010\u000b\u001a\u00020\nH\u0016¢\u0006\u0004\b\f\u0010\rJ\u000f\u0010\u000e\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u000e\u0010\bJ\u001f\u0010\u0012\u001a\u00020\u00042\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0011\u001a\u00020\u000fH\u0016¢\u0006\u0004\b\u0012\u0010\u0013J\u000f\u0010\u0014\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0014\u0010\bJ\u000f\u0010\u0015\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0015\u0010\bJ'\u0010\u001a\u001a\u00020\u00042\u0006\u0010\u0017\u001a\u00020\u00162\u0006\u0010\u0018\u001a\u00020\u00162\u0006\u0010\u0019\u001a\u00020\u0016H\u0016¢\u0006\u0004\b\u001a\u0010\u001bJ\u000f\u0010\u001d\u001a\u00020\u001cH\u0016¢\u0006\u0004\b\u001d\u0010\u001eJ\u0019\u0010 \u001a\u00020\u00042\b\u0010\u001f\u001a\u0004\u0018\u00010\u001cH\u0016¢\u0006\u0004\b \u0010!J!\u0010&\u001a\u00020\u00042\u0006\u0010#\u001a\u00020\"2\b\u0010%\u001a\u0004\u0018\u00010$H\u0016¢\u0006\u0004\b&\u0010'J\u0017\u0010(\u001a\u00020\u00042\u0006\u0010#\u001a\u00020\"H\u0016¢\u0006\u0004\b(\u0010)J\u0017\u0010,\u001a\u00020\u00042\u0006\u0010+\u001a\u00020*H\u0016¢\u0006\u0004\b,\u0010-J\u001f\u0010/\u001a\u00020\u00042\u0006\u0010+\u001a\u00020*2\u0006\u0010.\u001a\u00020\u000fH\u0016¢\u0006\u0004\b/\u00100R\u0016\u00104\u001a\u0002018\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b2\u00103R\u0016\u00108\u001a\u0002058\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b6\u00107R\u0016\u0010<\u001a\u0002098\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b:\u0010;R\u0016\u0010@\u001a\u00020=8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b>\u0010?R\u0016\u0010D\u001a\u00020A8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\bB\u0010CR\u0018\u0010G\u001a\u0004\u0018\u00010*8\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\bE\u0010FR\u0018\u0010\u000b\u001a\u0004\u0018\u00010\n8\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\bH\u0010IR\u0016\u0010M\u001a\u00020J8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\bK\u0010LR\u001c\u0010R\u001a\b\u0012\u0004\u0012\u00020O0N8\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\bP\u0010QR\u0016\u0010V\u001a\u00020S8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\bT\u0010UR\u0016\u0010Z\u001a\u00020W8\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\bX\u0010YR\u0016\u0010]\u001a\u00020\u000f8\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\b[\u0010\\R\u0018\u0010`\u001a\u0004\u0018\u00010\u00028\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\b^\u0010_R\u0016\u0010b\u001a\u00020W8\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\ba\u0010YR\u0016\u0010f\u001a\u00020c8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\bd\u0010e¨\u0006i"}, d2 = {"Lcom/avito/android/viewed_items/ViewedItemsPresenterImpl;", "Lcom/avito/android/viewed_items/ViewedItemsPresenter;", "Lcom/avito/android/viewed_items/ViewedItemsView;", "view", "", "attachView", "(Lcom/avito/android/viewed_items/ViewedItemsView;)V", "onResume", "()V", "detachView", "Lcom/avito/android/viewed_items/ViewedItemsPresenter$Router;", "router", "attachRouter", "(Lcom/avito/android/viewed_items/ViewedItemsPresenter$Router;)V", "detachRouter", "", "showLoader", "loadNextPage", "loadContent", "(ZZ)V", "onErrorStateRefreshButtonClicked", "onSwipeToRefresh", "", "visibleItemCount", "totalItemCount", "firstVisibleItemPosition", "onScrolled", "(III)V", "Landroid/os/Bundle;", "onSaveState", "()Landroid/os/Bundle;", "savedInstanceState", "onRestoreState", "(Landroid/os/Bundle;)V", "Lcom/avito/android/favorites/adapter/advert/FavoriteAdvertItem;", "item", "Lcom/avito/android/remote/model/Image;", "image", "onFavoriteItemClicked", "(Lcom/avito/android/favorites/adapter/advert/FavoriteAdvertItem;Lcom/avito/android/remote/model/Image;)V", "onRemoveItemClicked", "(Lcom/avito/android/favorites/adapter/advert/FavoriteAdvertItem;)V", "", "itemId", "onClickMoreItemActions", "(Ljava/lang/String;)V", "isShop", "onClickSimilar", "(Ljava/lang/String;Z)V", "Lcom/avito/android/viewed_items/ViewedItemsInteractor;", "h", "Lcom/avito/android/viewed_items/ViewedItemsInteractor;", "viewedItemsInteractor", "Lcom/avito/android/favorite/FavoriteAdvertsEventInteractor;", "n", "Lcom/avito/android/favorite/FavoriteAdvertsEventInteractor;", "eventInteractor", "Lcom/avito/android/preferences/UserFavoritesStorage;", "k", "Lcom/avito/android/preferences/UserFavoritesStorage;", "favoritesStorage", "Lcom/avito/android/util/SchedulersFactory3;", "l", "Lcom/avito/android/util/SchedulersFactory3;", "schedulers", "Lcom/avito/android/analytics/provider/TreeStateIdGenerator;", "o", "Lcom/avito/android/analytics/provider/TreeStateIdGenerator;", "treeStateIdGenerator", "f", "Ljava/lang/String;", "nextPage", "e", "Lcom/avito/android/viewed_items/ViewedItemsPresenter$Router;", "Lcom/avito/android/favorite/FavoriteAdvertsInteractor;", AuthSource.OPEN_CHANNEL_LIST, "Lcom/avito/android/favorite/FavoriteAdvertsInteractor;", "interactor", "", "Lcom/avito/android/favorites/adapter/FavoriteListItem;", "d", "Ljava/util/List;", "viewedItems", "Lcom/avito/android/viewed_items/ViewedItemsCountInteractor;", "i", "Lcom/avito/android/viewed_items/ViewedItemsCountInteractor;", "viewedItemsCountInteractor", "Lio/reactivex/rxjava3/disposables/CompositeDisposable;", "c", "Lio/reactivex/rxjava3/disposables/CompositeDisposable;", "loadDisposable", g.a, "Z", "firstLoading", AuthSource.SEND_ABUSE, "Lcom/avito/android/viewed_items/ViewedItemsView;", "viewedItemsView", AuthSource.BOOKING_ORDER, "disposable", "Lcom/avito/konveyor/adapter/AdapterPresenter;", "j", "Lcom/avito/konveyor/adapter/AdapterPresenter;", "adapterPresenter", "<init>", "(Lcom/avito/android/viewed_items/ViewedItemsInteractor;Lcom/avito/android/viewed_items/ViewedItemsCountInteractor;Lcom/avito/konveyor/adapter/AdapterPresenter;Lcom/avito/android/preferences/UserFavoritesStorage;Lcom/avito/android/util/SchedulersFactory3;Lcom/avito/android/favorite/FavoriteAdvertsInteractor;Lcom/avito/android/favorite/FavoriteAdvertsEventInteractor;Lcom/avito/android/analytics/provider/TreeStateIdGenerator;)V", "favorites_release"}, k = 1, mv = {1, 4, 2})
public final class ViewedItemsPresenterImpl implements ViewedItemsPresenter {
public ViewedItemsView a;
public CompositeDisposable b = new CompositeDisposable();
public CompositeDisposable c = new CompositeDisposable();
public List<FavoriteListItem> d = new ArrayList();
public ViewedItemsPresenter.Router e;
public String f;
public boolean g = true;
public final ViewedItemsInteractor h;
public final ViewedItemsCountInteractor i;
public final AdapterPresenter j;
public final UserFavoritesStorage k;
public final SchedulersFactory3 l;
public final FavoriteAdvertsInteractor m;
public final FavoriteAdvertsEventInteractor n;
public final TreeStateIdGenerator o;
public static final class a<T, R> implements Function<LoadingState<? super ViewedItemsModel>, LoadingState<? super List<? extends FavoriteAdvertItem>>> {
public final /* synthetic */ ViewedItemsPresenterImpl a;
public a(ViewedItemsPresenterImpl viewedItemsPresenterImpl) {
this.a = viewedItemsPresenterImpl;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Function
public LoadingState<? super List<? extends FavoriteAdvertItem>> apply(LoadingState<? super ViewedItemsModel> loadingState) {
LoadingState<? super ViewedItemsModel> loadingState2 = loadingState;
if (loadingState2 instanceof LoadingState.Loaded) {
LoadingState.Loaded loaded = (LoadingState.Loaded) loadingState2;
this.a.f = ((ViewedItemsModel) loaded.getData()).getNextPage();
ArrayList arrayList = new ArrayList();
for (FavoriteModel favoriteModel : ((ViewedItemsModel) loaded.getData()).getItems()) {
arrayList.add(FavoriteAdvertItem.Companion.fromFavoriteModel(favoriteModel));
}
ViewedItemsPresenterImpl.access$setFavoriteStateToModels(this.a, arrayList);
return new LoadingState.Loaded(arrayList);
} else if (loadingState2 instanceof LoadingState.Error) {
return new LoadingState.Error(((LoadingState.Error) loadingState2).getError());
} else {
if (loadingState2 instanceof LoadingState.Loading) {
return LoadingState.Loading.INSTANCE;
}
throw new NoWhenBranchMatchedException();
}
}
}
public static final class b<T> implements Consumer<LoadingState<? super List<? extends FavoriteAdvertItem>>> {
public final /* synthetic */ ViewedItemsPresenterImpl a;
public final /* synthetic */ boolean b;
public b(ViewedItemsPresenterImpl viewedItemsPresenterImpl, boolean z) {
this.a = viewedItemsPresenterImpl;
this.b = z;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // io.reactivex.rxjava3.functions.Consumer
public void accept(LoadingState<? super List<? extends FavoriteAdvertItem>> loadingState) {
ViewedItemsView viewedItemsView;
LoadingState<? super List<? extends FavoriteAdvertItem>> loadingState2 = loadingState;
if (loadingState2 instanceof LoadingState.Loaded) {
LoadingState.Loaded loaded = (LoadingState.Loaded) loadingState2;
if (((List) loaded.getData()).size() == 0) {
ViewedItemsView viewedItemsView2 = this.a.a;
if (viewedItemsView2 != null) {
viewedItemsView2.setScreenState(ViewedItemsView.ScreenState.EMPTY);
return;
}
return;
}
ViewedItemsPresenterImpl.access$mergeNewItemsToCurrentData(this.a, (List) loaded.getData());
ViewedItemsPresenterImpl viewedItemsPresenterImpl = this.a;
List list = viewedItemsPresenterImpl.d;
ArrayList arrayList = new ArrayList();
for (T t : list) {
if (!(t instanceof LoadingItem)) {
arrayList.add(t);
}
}
viewedItemsPresenterImpl.d = CollectionsKt___CollectionsKt.toMutableList((Collection) arrayList);
if (this.a.f != null) {
this.a.d.add(new LoadingItem());
}
this.a.j.onDataSourceChanged(new ListDataSource(this.a.d));
ViewedItemsView viewedItemsView3 = this.a.a;
if (viewedItemsView3 != null) {
viewedItemsView3.notifyDatasetChanged();
}
ViewedItemsView viewedItemsView4 = this.a.a;
if (viewedItemsView4 != null) {
viewedItemsView4.setScreenState(ViewedItemsView.ScreenState.CONTENT);
}
} else if (loadingState2 instanceof LoadingState.Error) {
ViewedItemsView viewedItemsView5 = this.a.a;
if (viewedItemsView5 != null) {
viewedItemsView5.setScreenState(ViewedItemsView.ScreenState.ERROR);
}
} else if ((loadingState2 instanceof LoadingState.Loading) && this.b && (viewedItemsView = this.a.a) != null) {
viewedItemsView.setScreenState(ViewedItemsView.ScreenState.LOADING);
}
}
}
@Inject
public ViewedItemsPresenterImpl(@NotNull ViewedItemsInteractor viewedItemsInteractor, @NotNull ViewedItemsCountInteractor viewedItemsCountInteractor, @ViewedItems @NotNull AdapterPresenter adapterPresenter, @NotNull UserFavoritesStorage userFavoritesStorage, @NotNull SchedulersFactory3 schedulersFactory3, @NotNull FavoriteAdvertsInteractor favoriteAdvertsInteractor, @NotNull FavoriteAdvertsEventInteractor favoriteAdvertsEventInteractor, @NotNull TreeStateIdGenerator treeStateIdGenerator) {
Intrinsics.checkNotNullParameter(viewedItemsInteractor, "viewedItemsInteractor");
Intrinsics.checkNotNullParameter(viewedItemsCountInteractor, "viewedItemsCountInteractor");
Intrinsics.checkNotNullParameter(adapterPresenter, "adapterPresenter");
Intrinsics.checkNotNullParameter(userFavoritesStorage, "favoritesStorage");
Intrinsics.checkNotNullParameter(schedulersFactory3, "schedulers");
Intrinsics.checkNotNullParameter(favoriteAdvertsInteractor, "interactor");
Intrinsics.checkNotNullParameter(favoriteAdvertsEventInteractor, "eventInteractor");
Intrinsics.checkNotNullParameter(treeStateIdGenerator, "treeStateIdGenerator");
this.h = viewedItemsInteractor;
this.i = viewedItemsCountInteractor;
this.j = adapterPresenter;
this.k = userFavoritesStorage;
this.l = schedulersFactory3;
this.m = favoriteAdvertsInteractor;
this.n = favoriteAdvertsEventInteractor;
this.o = treeStateIdGenerator;
}
public static final void access$changeAdvertsFavorite(ViewedItemsPresenterImpl viewedItemsPresenterImpl, List list, boolean z) {
int i2 = 0;
for (T t : viewedItemsPresenterImpl.d) {
int i3 = i2 + 1;
if (i2 < 0) {
CollectionsKt__CollectionsKt.throwIndexOverflow();
}
T t2 = t;
if ((t2 instanceof FavorableItem) && list.contains(t2.getStringId())) {
t2.setFavorite(z);
ViewedItemsView viewedItemsView = viewedItemsPresenterImpl.a;
if (viewedItemsView != null) {
viewedItemsView.notifyItemAtPositionChanged(i2);
}
}
i2 = i3;
}
}
public static final void access$mergeNewItemsToCurrentData(ViewedItemsPresenterImpl viewedItemsPresenterImpl, List list) {
T t;
Objects.requireNonNull(viewedItemsPresenterImpl);
Iterator it = list.iterator();
while (it.hasNext()) {
FavoriteAdvertItem favoriteAdvertItem = (FavoriteAdvertItem) it.next();
Iterator<T> it2 = viewedItemsPresenterImpl.d.iterator();
while (true) {
if (!it2.hasNext()) {
t = null;
break;
}
t = it2.next();
if (Intrinsics.areEqual(t.getStringId(), favoriteAdvertItem.getStringId())) {
break;
}
}
if (t == null) {
viewedItemsPresenterImpl.d.add(favoriteAdvertItem);
}
}
}
public static final List access$setFavoriteStateToModels(ViewedItemsPresenterImpl viewedItemsPresenterImpl, List list) {
Objects.requireNonNull(viewedItemsPresenterImpl);
ArrayList arrayList = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext()) {
arrayList.add(((FavoriteAdvertItem) it.next()).getStringId());
}
Map<String, Boolean> savedFavoriteStatusesSync = viewedItemsPresenterImpl.m.getSavedFavoriteStatusesSync(arrayList);
Iterator it2 = list.iterator();
while (it2.hasNext()) {
FavoriteAdvertItem favoriteAdvertItem = (FavoriteAdvertItem) it2.next();
if (savedFavoriteStatusesSync.containsKey(favoriteAdvertItem.getStringId())) {
Boolean bool = savedFavoriteStatusesSync.get(favoriteAdvertItem.getStringId());
favoriteAdvertItem.setFavorite(bool != null ? bool.booleanValue() : false);
}
}
return list;
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void attachRouter(@NotNull ViewedItemsPresenter.Router router) {
Intrinsics.checkNotNullParameter(router, "router");
this.e = router;
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void attachView(@NotNull ViewedItemsView viewedItemsView) {
Intrinsics.checkNotNullParameter(viewedItemsView, "view");
this.a = viewedItemsView;
this.b.add(this.n.favoritesEvents().observeOn(this.l.mainThread()).subscribe(new d(this)));
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void detachRouter() {
this.e = null;
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void detachView(@NotNull ViewedItemsView viewedItemsView) {
Intrinsics.checkNotNullParameter(viewedItemsView, "view");
this.b.clear();
this.c.clear();
this.a = null;
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void loadContent(boolean z, boolean z2) {
this.c.clear();
this.c.add(this.h.getViewedItems(z2 ? this.f : null).observeOn(this.l.mainThread()).map(new a(this)).subscribe(new b(this, z)));
}
@Override // com.avito.android.favorites.adapter.advert.FavoriteAdvertItemPresenter.Listener
public void onClickMoreItemActions(@NotNull String str) {
Intrinsics.checkNotNullParameter(str, "itemId");
}
@Override // com.avito.android.favorites.adapter.advert.FavoriteAdvertItemPresenter.Listener
public void onClickSimilar(@NotNull String str, boolean z) {
Intrinsics.checkNotNullParameter(str, "itemId");
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void onErrorStateRefreshButtonClicked() {
this.f = null;
this.d = new ArrayList();
loadContent(true, false);
}
@Override // com.avito.android.favorites.adapter.advert.FavoriteAdvertItemPresenter.Listener
public void onFavoriteItemClicked(@NotNull FavoriteAdvertItem favoriteAdvertItem, @Nullable Image image) {
ViewedItemsPresenter.Router router;
Intrinsics.checkNotNullParameter(favoriteAdvertItem, "item");
DeepLink deepLink = favoriteAdvertItem.getDeepLink();
String str = null;
if (!(deepLink instanceof AdvertDetailsLink)) {
deepLink = null;
}
if (((AdvertDetailsLink) deepLink) != null && (router = this.e) != null) {
String stringId = favoriteAdvertItem.getStringId();
DeepLink deepLink2 = favoriteAdvertItem.getDeepLink();
if (!(deepLink2 instanceof AdvertDetailsLink)) {
deepLink2 = null;
}
AdvertDetailsLink advertDetailsLink = (AdvertDetailsLink) deepLink2;
if (advertDetailsLink != null) {
str = advertDetailsLink.getContext();
}
router.openFastAdvertDetails(stringId, str, favoriteAdvertItem.getTitle(), favoriteAdvertItem.getPrice(), favoriteAdvertItem.getPreviousPrice(), image, new TreeClickStreamParent(this.o.nextStateId(), ScreenIdField.FAVORITE_ITEMS.name(), null, null));
}
}
@Override // com.avito.android.favorites.adapter.advert.FavoriteAdvertItemPresenter.Listener
public void onRemoveItemClicked(@NotNull FavoriteAdvertItem favoriteAdvertItem) {
Intrinsics.checkNotNullParameter(favoriteAdvertItem, "item");
String str = null;
AdvertDetailsLink advertDetailsLink = (AdvertDetailsLink) (!(favoriteAdvertItem instanceof AdvertDetailsLink) ? null : favoriteAdvertItem);
if (advertDetailsLink != null) {
str = advertDetailsLink.getContext();
}
this.m.toggleFavoriteStatus(favoriteAdvertItem.getStringId(), new FavoriteActionSource.Favorites(str), favoriteAdvertItem.isFavorite()).observeOn(this.l.mainThread()).subscribe();
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void onRestoreState(@Nullable Bundle bundle) {
this.f = bundle != null ? bundle.getString("next_page_key") : null;
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void onResume() {
this.k.setViewedItemsTabWasOpened(true);
this.i.resetCount();
if (this.g) {
loadContent(true, false);
this.g = false;
return;
}
loadContent(false, false);
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
@NotNull
public Bundle onSaveState() {
Bundle bundle = new Bundle();
bundle.putString("next_page_key", this.f);
return bundle;
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void onScrolled(int i2, int i3, int i4) {
if ((i2 + i4 >= i3) && this.f != null) {
loadContent(false, true);
}
}
@Override // com.avito.android.viewed_items.ViewedItemsPresenter
public void onSwipeToRefresh() {
this.f = null;
this.d = new ArrayList();
loadContent(false, false);
}
}
|
[
"auchhunter@gmail.com"
] |
auchhunter@gmail.com
|
8317a7a34062bff77a27cc9cef2e398db6a145d3
|
8bf554ec53f4e6d2c56106c33852c281b96ff9cf
|
/src/main/java/br/unioeste/trymanualDB/config/ContaTableModel.java
|
67a592aa488abc6705e4119990747be88a8ae413
|
[
"WTFPL"
] |
permissive
|
gnomex/TryManualDB_HomeBanking
|
173e2176e87db9eb52e1d139229041be4c91f343
|
387c504e0c13d7384301796a63a0b75135d5530f
|
refs/heads/master
| 2021-01-21T11:45:48.664610
| 2013-07-29T10:35:06
| 2013-07-29T10:35:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,369
|
java
|
package br.unioeste.trymanualDB.config;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import br.unioeste.base.BankAccount;
import br.unioeste.trymanualDB.controller.UCMaintainBankAccountManager;
public class ContaTableModel extends AbstractTableModel{
private static final long serialVersionUID = 1L;
private Object[] columns = {"Numero", "Agência", "Data Adesão", "Data Encerramento", "Saldo", "Tipo", "Cliente"};
private List list;
public ContaTableModel(){
list = new ArrayList<BankAccount>();
}
public int getColumnCount() {
return columns.length;
}
public int getRowCount() {
return list.size();
}
public Object getValueAt(int rowIndex, int columnIndex) {
BankAccount account = (BankAccount)list.get(rowIndex);
switch(columnIndex){
case 0: return account.getAccountNumber();
case 1: return account.getBankBranch();
case 2: return account.getStartAccountDate();
case 3: return account.getClosingAccountDate();
case 4: return account.getSaldoCorrente();
case 5: return account.getTipo().getId();
case 6: return account.getClient().getName();
}
return null;
}
public Class<?> getColumnClass(int columnIndex) {
return String.class;
}
public String getColumnName(int column) {
return columns[column].toString();
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
public BankAccount setAccount(BankAccount account){
UCMaintainBankAccountManager manager = new UCMaintainBankAccountManager();
try {
account = manager.findAccount(account);
if(account != null) {
list.add(account);
fireTableRowsInserted(list.size()-1, list.size()-1);
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return account;
}
}
|
[
"hismahilepd@gmail.com"
] |
hismahilepd@gmail.com
|
4a3af035a4143a18427b704294fd43d2197aeccf
|
cf59723275fabe4537cbf6f848639f38ba1ba430
|
/RealEstateProject/src/main/java/fi/amiedu/realestateproject/repository/PictureRepository.java
|
4b791efa20823205a3029811fe94b3407931219a
|
[] |
no_license
|
MikkoJo/TaMiHe
|
514afc179396a992fa3d3e3d48c5733818b73599
|
c77176d0843de53e4bed1d37f0b20344011c1a1d
|
refs/heads/master
| 2020-11-26T10:18:41.215675
| 2020-02-27T23:54:44
| 2020-02-27T23:54:44
| 229,040,613
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 241
|
java
|
package fi.amiedu.realestateproject.repository;
import org.springframework.data.repository.CrudRepository;
import fi.amiedu.realestateproject.domain.Picture;
public interface PictureRepository extends CrudRepository<Picture, Integer>{
}
|
[
"mikko.johansson2@gmail.com"
] |
mikko.johansson2@gmail.com
|
c33967b6e6af54c688726a56e9a0cf5d7d9741c2
|
c80a1dfa658679b8c4a0e017c0432dafd5ce6002
|
/src/main/java/ru/arlen/mongo/B_MongoDbInsertDocument.java
|
21696d9fc9f42e43c35ef5c11d6d089411d4798a
|
[] |
no_license
|
arlengur/MongoDb
|
09e1586f831658d3fca8e0682203decad140f5fd
|
91d0da3698ec50adc08fb295eaf46238161b93bc
|
refs/heads/master
| 2021-01-04T02:37:30.619115
| 2014-10-07T09:45:04
| 2014-10-07T09:45:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,627
|
java
|
package ru.arlen.mongo;
import com.mongodb.*;
import java.net.UnknownHostException;
import java.util.Arrays;
/**
* @author Alexey Galin <arlengur@rambler.ru>
*/
public class B_MongoDbInsertDocument {
public static void main(String[] args) throws UnknownHostException {
// Creates MongoDB client instance.
MongoClient client = new MongoClient(
new ServerAddress("localhost", 27017));
// Gets the school database from the MongoDB instance.
DB database = client.getDB("peopledb");
// Gets the teachers collection from the database.
DBCollection collection = database.getCollection("persons");
collection.drop();
// Creates a document to be stored in the teachers collections.
DBObject person1 = new BasicDBObject("firstName", "John")
.append("lastName", "Doe")
.append("cityOfBirth", "New York");
DBObject person2 = new BasicDBObject("firstName", "Julia")
.append("lastName", "Roberts")
.append("movieTitles", Arrays.asList("Pretty Woman", "Nothing Hill", "Runaway Bride"));
// Prints the value of the document.
System.out.println("person1 = " + person1);
System.out.println("person2 = " + person2);
// Inserts the document into the collection in the database.
collection.insert(person1);
collection.insert(person2);
// Prints the value of the document after inserted in the collection.
System.out.println("person1 = " + person1);
System.out.println("person2 = " + person2);
}
}
|
[
"alexey.galin@symphonyteleca.com"
] |
alexey.galin@symphonyteleca.com
|
028958a60c82eaa636d9263daa34e1597ebf8d65
|
5d49e39b3d6473b01b53b1c50397b2ab3e2c47b3
|
/Enterprise Projects/ips-outward-producer/src/main/java/com/combank/ips/outward/producer/model/camt_056_001/GenericOrganisationIdentification1.java
|
2f15b835c24a84311a9b405c513290eef456786f
|
[] |
no_license
|
ThivankaWijesooriya/Developer-Mock
|
54524e4319457fddc1050bfdb0b13c39c54017aa
|
3acbaa98ff4b64fe226bcef0f3e69d6738bdbf65
|
refs/heads/master
| 2023-03-02T04:14:18.253449
| 2023-01-28T05:54:06
| 2023-01-28T05:54:06
| 177,391,319
| 0
| 0
| null | 2020-01-08T17:26:30
| 2019-03-24T08:56:29
|
CSS
|
UTF-8
|
Java
| false
| false
| 3,453
|
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.08.22 at 12:41:17 AM IST
//
package com.combank.ips.outward.producer.model.camt_056_001;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import iso.std.iso._20022.tech.xsd.camt_056_001.OrganisationIdentificationSchemeName1Choice;
/**
* <p>Java class for GenericOrganisationIdentification1 complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="GenericOrganisationIdentification1">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Id" type="{urn:iso:std:iso:20022:tech:xsd:camt.056.001.09}Max35Text"/>
* <element name="SchmeNm" type="{urn:iso:std:iso:20022:tech:xsd:camt.056.001.09}OrganisationIdentificationSchemeName1Choice" minOccurs="0"/>
* <element name="Issr" type="{urn:iso:std:iso:20022:tech:xsd:camt.056.001.09}Max35Text" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GenericOrganisationIdentification1", propOrder = {
"id",
"schmeNm",
"issr"
})
public class GenericOrganisationIdentification1 {
@XmlElement(name = "Id", required = true)
protected String id;
@XmlElement(name = "SchmeNm")
protected OrganisationIdentificationSchemeName1Choice schmeNm;
@XmlElement(name = "Issr")
protected String issr;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the schmeNm property.
*
* @return
* possible object is
* {@link OrganisationIdentificationSchemeName1Choice }
*
*/
public OrganisationIdentificationSchemeName1Choice getSchmeNm() {
return schmeNm;
}
/**
* Sets the value of the schmeNm property.
*
* @param value
* allowed object is
* {@link OrganisationIdentificationSchemeName1Choice }
*
*/
public void setSchmeNm(OrganisationIdentificationSchemeName1Choice value) {
this.schmeNm = value;
}
/**
* Gets the value of the issr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIssr() {
return issr;
}
/**
* Sets the value of the issr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIssr(String value) {
this.issr = value;
}
}
|
[
"thivankawijesooriya@gmail.com"
] |
thivankawijesooriya@gmail.com
|
2ea1affb85a1263287618e961a0e361d1e14ae4b
|
6a4753fa0558dcfd7fe16792d73396f56a237647
|
/app/src/androidTest/java/testing/example/kitchen/ExampleInstrumentedTest.java
|
d385cd589f653259fb4ed81bde63fdd20258a83b
|
[] |
no_license
|
vincentjodice155/Kitchen_Inventory_Management
|
77ff1f4d359cf6a9afa4c1b366684d06857a6b68
|
959773a28530a349761fb2888d73d8d92c87d7eb
|
refs/heads/master
| 2023-07-13T05:18:20.460082
| 2021-08-03T01:39:39
| 2021-08-03T01:39:39
| 377,545,639
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 760
|
java
|
package testing.example.kitchen;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("testing.example.kitchen", appContext.getPackageName());
}
}
|
[
"jodicev@wit.edu"
] |
jodicev@wit.edu
|
e50309f248a963391281996c416f79da458fa167
|
f399d03859da650e109239ba62f59972fb928dbb
|
/Phonebook/out/artifacts/untitled/util/DBWorker.java
|
8cb54f19366c9c83e2dadb2c4f4092e9858a08c7
|
[] |
no_license
|
Druuuz/HT1
|
d33673fcfaf23ff188b6a6c1fe2e347c61f5c702
|
2d194db122eec1e2e3cec6fbccf4819b93486330
|
refs/heads/master
| 2020-03-21T07:15:32.231820
| 2018-07-15T09:39:57
| 2018-07-15T09:39:57
| 138,270,215
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,176
|
java
|
package util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DBWorker {
// Количество рядов таблицы, затронутых последним запросом.
private Integer affected_rows = 0;
// Значение автоинкрементируемого первичного ключа, полученное после
// добавления новой записи.
private Integer last_insert_id = 0;
// Указатель на экземпляр класса.
private static DBWorker instance = null;
// Метод для получения экземпляра класса (реализован Singleton).
public static DBWorker getInstance() {
if (instance == null) {
instance = new DBWorker();
}
return instance;
}
// "Заглушка", чтобы экземпляр класса нельзя было получить напрямую.
private DBWorker() {
// Просто "заглушка".
}
// Выполнение запросов на выборку данных.
public ResultSet getDBData(String query) {
Statement statement;
Connection connect;
try {
String url = "jdbc:mysql://localhost:3306/phonebook";
Class.forName("com.mysql.jdbc.Driver").newInstance();
connect = DriverManager.getConnection(url, "root", "");
statement = connect.createStatement();
ResultSet resultSet = statement.executeQuery(query);
return resultSet;
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
System.out.println("null on getDBData()!");
return null;
}
// Выполнение запросов на модификацию данных.
public Integer changeDBData(String query) {
Statement statement;
Connection connect;
try {
String url = "jdbc:mysql://localhost:3306/phonebook";
Class.forName("com.mysql.jdbc.Driver").newInstance();
connect = DriverManager.getConnection(url, "root", "");
statement = connect.createStatement();
this.affected_rows = statement.executeUpdate(query, Statement.RETURN_GENERATED_KEYS);
// Получаем last_insert_id() для операции вставки.
ResultSet rs = statement.getGeneratedKeys();
if (rs.next()) {
this.last_insert_id = rs.getInt(1);
}
return this.affected_rows;
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
System.out.println("null on changeDBData()!");
return null;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++
// Геттеры и сеттеры.
public Integer getAffectedRowsCount() {
return this.affected_rows;
}
public Integer getLastInsertId() {
return this.last_insert_id;
}
public int getInsertIdForPhone() {
Statement statement;
Connection connect;
try {
String url = "jdbc:mysql://localhost:3306/phonebook";
Class.forName("com.mysql.jdbc.Driver").newInstance();
connect = DriverManager.getConnection(url, "root", "");
statement = connect.createStatement();
String query = "SELECT id from phone order by id desc limit 1";
ResultSet resultSet = statement.executeQuery(query);
resultSet.next();
return resultSet.getInt("id") + 1;
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
System.out.println("null on getDBData()!");
return -1;
}
// Геттеры и сеттеры.
// -------------------------------------------------
}
|
[
"olesov198@gmail.com"
] |
olesov198@gmail.com
|
ee2878453933ba34740aad4dec828d98b6d7be19
|
a4af8d27f6e2072e4c0f01bf09f558a9462de319
|
/SmartHomeSystemApplication/app/src/androidTest/java/com/smarthomesystem/ju/smarthomesystemapplication/ExampleInstrumentedTest.java
|
8e7d556a63b374fb1ffe6a22234ca6319f2796fb
|
[] |
no_license
|
ismithpasha/SmartHome
|
d6328ccc4e5dff1995a389d6d28b2365e8a05d2e
|
8db7d42bde92ca07f742ab0abecb94d59185a3e1
|
refs/heads/master
| 2020-04-17T06:01:55.587687
| 2019-06-22T22:57:32
| 2019-06-22T22:57:32
| 166,309,190
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 782
|
java
|
package com.smarthomesystem.ju.smarthomesystemapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.smarthomesystem.ju.smarthomesystemapplication", appContext.getPackageName());
}
}
|
[
"ismithpasha@gmail.com"
] |
ismithpasha@gmail.com
|
0a546b47ec2fb9b88b63f17253711404bed93fd6
|
83a410fdca93f43bb387edec8b5112ed90c88626
|
/crawler/src/main/java/com/datagenio/crawler/browser/RemoteHttpRequest.java
|
a6fde835b155115405f56101183b4ba5078bb58e
|
[] |
no_license
|
bcerban/datagenio
|
a20f57ff6eb37fbac49a6c42b97b0cd6ca353901
|
29dcd2eda8a0a3c1ff5cab5803e0e5f42c70b239
|
refs/heads/develop
| 2020-04-03T21:38:52.893954
| 2019-03-05T13:45:59
| 2019-03-05T13:45:59
| 155,576,801
| 0
| 0
| null | 2019-03-05T13:46:00
| 2018-10-31T15:04:46
|
Java
|
UTF-8
|
Java
| false
| false
| 3,587
|
java
|
package com.datagenio.crawler.browser;
import com.datagenio.crawler.api.RemoteRequest;
import com.datagenio.crawler.api.RemoteRequestBody;
import net.lightbody.bmp.core.har.HarPostData;
import net.lightbody.bmp.core.har.HarRequest;
import java.util.HashMap;
import java.util.Map;
public class RemoteHttpRequest implements RemoteRequest {
private String method;
private String url;
private String protocol;
private String version;
private RemoteRequestBody body;
private Map<String, String> headers;
private Map<String, String> cookies;
private int sortOrder;
public RemoteHttpRequest() {
headers = new HashMap<>();
cookies = new HashMap<>();
}
public RemoteHttpRequest(HarRequest harRequest) {
this();
method = harRequest.getMethod();
url = harRequest.getUrl();
version = harRequest.getHttpVersion();
harRequest.getHeaders().forEach(header -> {
headers.put(header.getName(), header.getValue());
});
harRequest.getCookies().forEach(cookie -> {
cookies.put(cookie.getName(), cookie.getValue());
});
if (harRequest.getPostData() != null) {
body = new RemoteHttpRequestBody(harRequest.getPostData());
}
}
private void parseBody(HarPostData postData) {
body = new RemoteHttpRequestBody();
body.setMimeType(postData.getMimeType());
if (postData.getParams() != null) {
postData.getParams().forEach(param -> {
body.addPart(new RemoteHttpRequestBodyPart(param));
});
}
if (postData.getText() != null) {
String[] mimeTypeParts = postData.getMimeType().split("boundary=");
if (mimeTypeParts.length >= 2) {
body.setMimeType(mimeTypeParts[0]);
String boundary = mimeTypeParts[1];
String[] textParts = postData.getText().split(boundary);
if (textParts.length > 0) {
}
}
}
}
@Override
public String getMethod() {
return method;
}
@Override
public String getUrl() {
return url;
}
@Override
public String getProtocol() {
return protocol;
}
@Override
public String getVersion() {
return version;
}
@Override
public RemoteRequestBody getBody() {
return body;
}
@Override
public Map<String, String> getHeaders() {
return headers;
}
@Override
public Map<String, String> getCookies() {
return cookies;
}
@Override
public int getSortOrder() {
return sortOrder;
}
@Override
public boolean hasBody() {
return body != null;
}
@Override
public void setMethod(String method) {
this.method = method;
}
@Override
public void setUrl(String url) {
this.url = url;
}
@Override
public void setProtocol(String protocol) {
this.protocol = protocol;
}
@Override
public void setVersion(String version) {
this.version = version;
}
@Override
public void setBody(RemoteRequestBody body) {
this.body = body;
}
@Override
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
@Override
public void setCookies(Map<String, String> cookies) {
this.cookies = cookies;
}
@Override
public void setSortOrder(int order) {
this.sortOrder = order;
}
}
|
[
"bettinacerban@gmail.com"
] |
bettinacerban@gmail.com
|
e5d126d3c64c75cf9b269e8b6f60fefb23885eb0
|
00cbb5419f7c26120637db86a93761392d059ac1
|
/springview/src/main/java/com/gq/springview/Demo7Activity.java
|
2d876e9911180af46803825b8fc1db64d9456d65
|
[] |
no_license
|
gqgithub/gangqinggit
|
4ce267986d0c194490b8ae39affee359d3be852e
|
4108a1f960d1b466942dc7f029999197c19cf4f1
|
refs/heads/master
| 2021-05-13T20:33:24.832282
| 2018-01-10T06:44:30
| 2018-01-10T06:44:30
| 116,914,253
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,091
|
java
|
package com.gq.springview;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import com.liaoinstan.springview.container.MeituanFooter;
import com.liaoinstan.springview.container.MeituanHeader;
import com.liaoinstan.springview.widget.SpringView;
/**
* 仿美团小人
*/
public class Demo7Activity extends AppCompatActivity {
private SpringView springView;
private int[] pullAnimSrcs = new int[]{R.drawable.mt_pull, R.drawable.mt_pull01, R.drawable.mt_pull02, R.drawable.mt_pull03, R.drawable.mt_pull04, R.drawable.mt_pull05};
private int[] refreshAnimSrcs = new int[]{R.drawable.mt_refreshing01, R.drawable.mt_refreshing02, R.drawable.mt_refreshing03, R.drawable.mt_refreshing04, R.drawable.mt_refreshing05, R.drawable.mt_refreshing06};
private int[] loadingAnimSrcs = new int[]{R.drawable.mt_loading01, R.drawable.mt_loading02};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo7);
setTitle("仿美团小人");
springView = (SpringView) findViewById(R.id.springview);
springView.setType(SpringView.Type.FOLLOW);
springView.setListener(new SpringView.OnFreshListener() {
@Override
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
springView.onFinishFreshAndLoad();
}
}, 2000);
}
@Override
public void onLoadmore() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
springView.onFinishFreshAndLoad();
}
}, 2000);
}
});
springView.setHeader(new MeituanHeader(this, pullAnimSrcs, refreshAnimSrcs));
springView.setFooter(new MeituanFooter(this, loadingAnimSrcs));
}
}
|
[
"zgxxdxgq@126.com"
] |
zgxxdxgq@126.com
|
6d44ce94a039c8aac08de3c9c620fb565c7e6c56
|
dcc874386d084063e64286ecbcb1e92f12e79c0f
|
/springmvc/src/main/java/com/tyss/springmvc/dao/EmployeeDAO.java
|
a650fd4c99886ec0df972d5105ac2fa392485cd7
|
[] |
no_license
|
dmfullstack/TY_CAPGEMINI_JAVACloud_10thFEB_TARUSHIVERMA
|
ae020a7ee47a65c00fcb4c6bf66067adb8e7bd78
|
42ab83db0315bd5f38229e78f455e9850bf1e63a
|
refs/heads/master
| 2022-11-17T07:36:48.437940
| 2020-06-18T05:16:55
| 2020-06-18T05:16:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 401
|
java
|
package com.tyss.springmvc.dao;
import java.util.List;
import com.tyss.springmvc.beans.EmployeeDetails;
import com.tyss.springmvc.beans.Login;
public interface EmployeeDAO {
Boolean validateLogin(Login user);
void add(EmployeeDetails employeeDetails);
List<EmployeeDetails> list();
EmployeeDetails get(Integer id);
void delete(Integer id);
void edit(EmployeeDetails employeeDetails);
}
|
[
"tarushiverma6159@gmail.com"
] |
tarushiverma6159@gmail.com
|
cd0c5daee35935a29e55273ef39c9ad4f41e7d98
|
dfc530e867a3432ff4c63ac502c1fd406f08d064
|
/auth-server-common/src/main/java/com/anilallewar/microservices/auth/config/OauthUserApprovalHandler.java
|
3819962a3c91b4c031ed3ee18d2aa3a229077f47
|
[
"Apache-2.0"
] |
permissive
|
mingt/neoframework-cloud-demo
|
fca39f6d663f5ec5e5607ea6d402ab7c3ebdce99
|
43d32e67696c5734ae1f9363f8a5b4db89c13ca2
|
refs/heads/master
| 2022-12-08T21:08:54.965640
| 2020-09-11T02:35:39
| 2020-09-11T02:35:39
| 290,128,659
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,699
|
java
|
package com.anilallewar.microservices.auth.config;
// import com.monkeyk.sos.domain.oauth.OauthClientDetails;
// import com.monkeyk.sos.service.OauthService;
import com.anilallewar.microservices.auth.model.OauthClientDetails;
import com.anilallewar.microservices.auth.service.OauthService;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.approval.TokenStoreUserApprovalHandler;
/**
* The type Oauth user approval handler.
*
* @author Shengzhao Li
*/
public class OauthUserApprovalHandler extends TokenStoreUserApprovalHandler {
private OauthService oauthService;
/**
* Instantiates a new Oauth user approval handler.
*/
public OauthUserApprovalHandler() {}
/**
* Whether is approved.
*
* @param authorizationRequest AuthorizationRequest
* @param userAuthentication Authentication
* @return
*/
public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
if (super.isApproved(authorizationRequest, userAuthentication)) {
return true;
}
if (!userAuthentication.isAuthenticated()) {
return false;
}
OauthClientDetails clientDetails = oauthService.loadOauthClientDetails(authorizationRequest.getClientId());
return clientDetails != null && clientDetails.trusted();
}
/**
* Sets oauth service.
*
* @param oauthService the oauth service
*/
public void setOauthService(OauthService oauthService) {
this.oauthService = oauthService;
}
}
|
[
"toahming@126.com"
] |
toahming@126.com
|
9603b5f66fd105587d59e676a512bcae69ad77b8
|
89d1748631562430caf0559b035466a6e38336c8
|
/src/main/java/com/cookieschen/course/lftp/service/ReceiveThread.java
|
6251fd37145b46882b7b726659ea2b940ec4fe3b
|
[] |
no_license
|
CookiesChen/LFTP
|
36da8ce3b993af24fac56be4f53d7bb0917008ea
|
394b3a5693f905e82d96ff6387a3cbb0c5ce2a72
|
refs/heads/master
| 2020-04-08T20:32:57.501906
| 2018-12-04T15:31:51
| 2018-12-04T15:31:51
| 159,704,383
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,263
|
java
|
package com.cookieschen.course.lftp.service;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
public class ReceiveThread implements Runnable {
private InetAddress IP; // 发送方IP
private int port; // 发送方端口
DatagramSocket datagramSocket; // socket
private final int RevBuff = 20000; // 接收缓存
private volatile int rwnd = RevBuff; // 接收窗口
private volatile int expectedSeqNum = 0; // GBN控制
String filename;
long startTime;
int packageTotal;
public ReceiveThread(DatagramSocket datagramSocket, InetAddress IP, int port, String filename, int packageTotal){
this.datagramSocket = datagramSocket;
this.IP = IP;
this.port = port;
this.filename = filename;
this.packageTotal = packageTotal;
}
@Override
public void run() {
List<byte[]> datas = new ArrayList<>();
TCPPackage replyACK = null;
FileOutputStream outputStream = null;
try {
outputStream = new FileOutputStream(new File("./" + filename));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
startTime = System.currentTimeMillis();
while(true) {
TCPPackage receivePackage = null;
try {
receivePackage = receivePackage();
} catch (IOException e) {
e.printStackTrace();
}
assert receivePackage != null;
if (receivePackage.FIN()){
replyACK = new TCPPackage(expectedSeqNum, true, 0, true, Convert.intToByteArray(rwnd));
try {
sendPackage(replyACK);
} catch (IOException e) {
e.printStackTrace();
}
try {
FileIO.byteToFile(outputStream, datas);
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("\n[Success] Receive File.");
break;
}
if(receivePackage.Seq() == expectedSeqNum) {
rwnd--;
System.out.print("\rSeep: " + expectedSeqNum*1024/(System.currentTimeMillis() - startTime + 1) + "KB/s, Finished: "
+ String.format("%.2f", ((float)(expectedSeqNum+1)/(float) packageTotal * 100)) + "%"
+ ", in " + (System.currentTimeMillis() - startTime + 1)/1000 + "s");
datas.add(receivePackage.Data());
replyACK = new TCPPackage(expectedSeqNum, false, 0, true, Convert.intToByteArray(rwnd));
expectedSeqNum++;
try {
replyACK.setData(Convert.intToByteArray(rwnd));
sendPackage(replyACK);
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
assert replyACK != null;
replyACK.setData(Convert.intToByteArray(rwnd));
sendPackage(replyACK);
} catch (IOException e) {
e.printStackTrace();
}
}
// 接收窗口已满 阻塞
if (rwnd == 0){
FileIO.byteToFile(outputStream, datas);
datas.clear();
rwnd = RevBuff;
}
}
}
private void sendPackage(TCPPackage tcpPackage) throws IOException {
byte[] bytes = Convert.PackageToByte(tcpPackage);
DatagramPacket packet = new DatagramPacket(bytes, bytes.length, IP , port);
datagramSocket.send(packet);
}
private TCPPackage receivePackage() throws IOException {
byte[] buf = new byte[1400];
DatagramPacket datagramPacket = new DatagramPacket(buf, buf.length); // 1024
datagramSocket.receive(datagramPacket);
return Convert.ByteToPackage(buf);
}
}
|
[
"1109349604@qq.com"
] |
1109349604@qq.com
|
033c9418dc32332644af8b207033969940dc478e
|
ada3126246d0822ad31984822bd47dd22c728020
|
/app/src/main/java/tereshchenko/androidlessons/LessonControls/ButtonControl/ButtonControl.java
|
2b723112652e10c3d049f923c8b53f8fc1e79e4d
|
[] |
no_license
|
igortereshchenko/AndroidLessons
|
bcbc953f3f3ec947033c6254f1a6424158f714d2
|
013c440340d3995723300e601a56139386150f4b
|
refs/heads/master
| 2021-01-20T06:47:19.102510
| 2017-05-22T06:11:22
| 2017-05-22T06:11:22
| 89,927,537
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,893
|
java
|
package tereshchenko.androidlessons.LessonControls.ButtonControl;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import tereshchenko.androidlessons.Lesson;
import tereshchenko.androidlessons.R;
/**
* Created by Igor on 4/30/2017.
*/
public class ButtonControl extends Lesson {
@Override
public View btnLessonOpen(View sender){
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.lesson_controls_button, null, false);
return layout;
}
public void btnListener(View sender){
Toast toast = Toast.makeText(this, "Обработка btnListener",Toast.LENGTH_SHORT);
toast.show();
}
//------------------------------------------------------
@Override
public View btnLessonCodeOpen(View sender){
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.VERTICAL);
Button button1 = new Button(this);
button1.setText("Обраторка OnClickListener");
final TextView textView = new TextView(this);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Обработка нажатия
textView.setText("Обраторка OnClickListener");
}
});
View.OnClickListener btnListener = new ButtonListener(textView);
Button button2 = new Button(this);
button2.setText("Внешний OnClickListener");
button2.setOnClickListener(btnListener);
linearLayout.addView(button1);
linearLayout.addView(button2);
linearLayout.addView(textView);
return linearLayout;
}
}
|
[
"tereshchenko.igor@gmail.com"
] |
tereshchenko.igor@gmail.com
|
458e269dcd505e6ea78da53634c4c393b851e0b1
|
bc794d54ef1311d95d0c479962eb506180873375
|
/kerencourrier/kerencourrier-dao/src/main/java/com/keren/courrier/dao/ifaces/referentiel/TypeCourrierDAORemote.java
|
06fb038eab60aab8bd6c3e3f01f5e9b8fa30afbf
|
[] |
no_license
|
Teratech2018/Teratech
|
d1abb0f71a797181630d581cf5600c50e40c9663
|
612f1baf9636034cfa5d33a91e44bbf3a3f0a0cb
|
refs/heads/master
| 2021-04-28T05:31:38.081955
| 2019-04-01T08:35:34
| 2019-04-01T08:35:34
| 122,177,253
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 267
|
java
|
package com.keren.courrier.dao.ifaces.referentiel;
import javax.ejb.Remote;
/**
* Interface remote de la DAO
* @since Wed Jul 18 10:58:41 GMT+01:00 2018
*
*/
@Remote
public interface TypeCourrierDAORemote
extends TypeCourrierDAO
{
}
|
[
"bekondo_dieu@yahoo.fr"
] |
bekondo_dieu@yahoo.fr
|
6d7f287e5eb79c92b884295274c2823a4523d3fd
|
290e05dc7cd4fccc01056e577adaf38d99c77720
|
/app/src/main/java/com/example/solom/managmentgame/AvatarChoiceActivity.java
|
848eb54ff12120c8940458a2ddac1494ec3df11c
|
[] |
no_license
|
Strawely/ManagmentGameClient
|
9a1275b5cd66f7d6924690e477973d86ac1445a0
|
e1e53c592e8ccfedebbddac96f4f1955e6e8b71f
|
refs/heads/master
| 2020-04-10T18:23:53.601297
| 2018-12-27T07:20:51
| 2018-12-27T07:20:51
| 161,202,964
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,506
|
java
|
package com.example.solom.managmentgame;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.Toast;
import com.example.solom.managmentgame.dataLayer.GameStateHandler;
import com.example.solom.managmentgame.dataLayer.Player;
public class AvatarChoiceActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_avatar_choice);
}
public void onSaveClick(View view) {
CheckBox[] checkBoxes = {findViewById(R.id.avatar0CheckBox), findViewById(R.id.avatar1CheckBox),
findViewById(R.id.avatar2CheckBox), findViewById(R.id.avatar3CheckBox),
findViewById(R.id.avatar4CheckBox), findViewById(R.id.avatar5CheckBox),
findViewById(R.id.avatar6CheckBox), findViewById(R.id.avatar7CheckBox)};
int result = -1;
for (int i = 0; i < checkBoxes.length; i++){
if(checkBoxes[i].isChecked()){
if(result != -1){
result = -1;
break;
}
else {
result = i;
}
}
}
if(result == -1){
Toast.makeText(this, "Ошибка", Toast.LENGTH_SHORT).show();
return;
}
GameStateHandler.setPlayer(new Player(0, "", result));
finish();
}
}
|
[
"solomyanniy63@gmail.com"
] |
solomyanniy63@gmail.com
|
961df26e5a796c04fe59a609e5be7ce2fbf6db6e
|
bc0570681e18c2377e838bb2ce47ceceb22851a7
|
/src/main/java/Model/Enums/Effect.java
|
3ab6271fe750d0fae0bbe35111f0f12c31dcf974
|
[] |
no_license
|
Advanced-Programming-2021/project-team-62
|
693c87e2d6a143885248ba0ea096cf2bf17bd9cf
|
2d0104f7df3436b95ff21379615fd2d1ac7d6236
|
refs/heads/main
| 2023-04-29T15:10:20.791628
| 2021-05-19T23:55:48
| 2021-05-19T23:55:48
| 356,638,265
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 104
|
java
|
package Model.Enums;
public enum Effect {
CONTINUOUS,
SPARK,
FAST,
TRIGGER,
FLIP
}
|
[
"mohamadrza.pr@gmail.com"
] |
mohamadrza.pr@gmail.com
|
c6dce11f462c3b3a6b090003debcceeef0446f44
|
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
|
/genny_JavaWithLambdas/applicationModule/src/main/java/applicationModulepackageJava3/Foo674.java
|
d9d6fea12ddb7764f8f3d63e7f47a04aa4669def
|
[] |
no_license
|
NikitaKozlov/generated-project-for-desugaring
|
0bc1443ab3ddc84cd289331c726761585766aea7
|
81506b3711004185070ca4bb9a93482b70011d36
|
refs/heads/master
| 2020-03-20T00:35:06.996525
| 2018-06-12T09:30:37
| 2018-06-12T09:30:37
| 137,049,317
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 575
|
java
|
package applicationModulepackageJava3;
public class Foo674 {
public void foo0() {
final Runnable anything0 = () -> System.out.println("anything");
new applicationModulepackageJava3.Foo673().foo9();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
public void foo7() {
foo6();
}
public void foo8() {
foo7();
}
public void foo9() {
foo8();
}
}
|
[
"nikita.e.kozlov@gmail.com"
] |
nikita.e.kozlov@gmail.com
|
11d01a58d24c4e405fbdb4f2cb5e69e56b8f1959
|
75912f117da3c622d1b2cb001a9a1f8a32f01154
|
/super-pc/src/main/java/cn/hlvan/pc/security/permission/PermissionEnum.java
|
41ded748793e9969ce8e3eacfe12b2f7b6e60c7f
|
[] |
no_license
|
yyandlxb/super
|
0c491dff2daed9cc09ec5199f117886ea4b1619d
|
0f29f28cda434bc189ff33e0f1b02f1f9a8f2913
|
refs/heads/master
| 2020-04-04T22:19:04.173115
| 2018-11-30T11:03:46
| 2018-11-30T11:03:46
| 156,319,356
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 381
|
java
|
package cn.hlvan.pc.security.permission;
public enum PermissionEnum {
DEPART("部门管理"),
ROLE("角色管理"),
ACCOUNT("账户管理");
private String name;
PermissionEnum(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
[
"yaoyuan@hlvan.cn"
] |
yaoyuan@hlvan.cn
|
41a4c5bd1068fc87dc1cc465ea88b2bc7f2c895f
|
be73270af6be0a811bca4f1710dc6a038e4a8fd2
|
/crash-reproduction-moho/results/XWIKI-14227-10-28-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/migration/AbstractDataMigrationManager_ESTest_scaffolding.java
|
828bf3781103e397fc273779ad24768b643eb2a4
|
[] |
no_license
|
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
|
cf118b23ecb87a8bf59643e42f7556b521d1f754
|
3bb39683f9c343b8ec94890a00b8f260d158dfe3
|
refs/heads/master
| 2022-07-29T14:44:00.774547
| 2020-08-10T15:14:49
| 2020-08-10T15:14:49
| 285,804,495
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 462
|
java
|
/**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sun Jan 19 17:53:54 UTC 2020
*/
package com.xpn.xwiki.store.migration;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class AbstractDataMigrationManager_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
|
[
"pouria.derakhshanfar@gmail.com"
] |
pouria.derakhshanfar@gmail.com
|
5c3719706220f3549bb1467b0a9d5a0bf665cf77
|
94307a4c953cb76a40c27ed10f2861117e433b2f
|
/cathode-jobs/src/main/java/net/simonvt/cathode/trakt/UserList.java
|
8c7503bbf48b750de122e4dd23905e76dc7516b5
|
[
"Apache-2.0"
] |
permissive
|
thiagocard/cathode
|
8c4b1bb8b8dc33fb37a2476641424ec616fed0a8
|
246879849e79068f8b4eaca5dbf6b95c59424360
|
refs/heads/master
| 2021-06-20T01:47:38.578346
| 2017-08-11T21:37:04
| 2017-08-11T21:37:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,744
|
java
|
/*
* Copyright (C) 2017 Simon Vig Therkildsen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.simonvt.cathode.trakt;
import android.content.Context;
import java.io.IOException;
import javax.inject.Inject;
import net.simonvt.cathode.Injector;
import net.simonvt.cathode.api.body.ListInfoBody;
import net.simonvt.cathode.api.entity.CustomList;
import net.simonvt.cathode.api.enumeration.Privacy;
import net.simonvt.cathode.api.service.UsersService;
import net.simonvt.cathode.common.event.ErrorEvent;
import net.simonvt.cathode.jobqueue.JobManager;
import net.simonvt.cathode.jobs.R;
import net.simonvt.cathode.provider.ListWrapper;
import net.simonvt.cathode.remote.sync.SyncUserActivity;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
import timber.log.Timber;
public class UserList {
@Inject Context context;
@Inject UsersService usersServie;
@Inject JobManager jobManager;
public UserList() {
Injector.inject(this);
}
public boolean create(String name, String description, Privacy privacy, boolean displayNumbers,
boolean allowComments) {
try {
Call<CustomList> call = usersServie.createList(ListInfoBody.name(name)
.description(description)
.privacy(privacy)
.displayNumbers(displayNumbers)
.allowComments(allowComments));
Response<CustomList> response = call.execute();
if (response.isSuccessful()) {
CustomList userList = response.body();
ListWrapper.updateOrInsert(context.getContentResolver(), userList);
jobManager.addJob(new SyncUserActivity());
return true;
}
} catch (IOException e) {
Timber.d(e, "Unable to create list %s", name);
}
ErrorEvent.post(context.getString(R.string.list_create_error, name));
return false;
}
public boolean update(long traktId, String name, String description, Privacy privacy,
boolean displayNumbers, boolean allowComments) {
try {
Call<CustomList> call = usersServie.updateList(traktId, ListInfoBody.name(name)
.description(description)
.privacy(privacy)
.displayNumbers(displayNumbers)
.allowComments(allowComments));
Response<CustomList> response = call.execute();
if (response.isSuccessful()) {
CustomList userList = response.body();
ListWrapper.updateOrInsert(context.getContentResolver(), userList);
jobManager.addJob(new SyncUserActivity());
return true;
}
} catch (IOException e) {
Timber.d(e, "Unable to create list %s", name);
}
ErrorEvent.post(context.getString(R.string.list_update_error, name));
return false;
}
public boolean delete(long traktId, String name) {
try {
Call<ResponseBody> call = usersServie.deleteList(traktId);
Response<ResponseBody> response = call.execute();
if (response.isSuccessful()) {
ResponseBody body = response.body();
jobManager.addJob(new SyncUserActivity());
return true;
}
} catch (IOException e) {
Timber.d(e, "Unable to delete list %s", name);
}
ErrorEvent.post(context.getString(R.string.list_delete_error, name));
return false;
}
}
|
[
"simonvt@gmail.com"
] |
simonvt@gmail.com
|
044463fe6d5af1dcb42378994222efca8c83275a
|
0fa32b676647209d1562755b121e9e89db63fdeb
|
/src/main/java/com/pan/springboot/utils/FileUtil.java
|
ac5a73bf80f8545423a24b9f80de354cdcb25c86
|
[] |
no_license
|
Abnerpanpan/spring-boot
|
e41b77233d3ac547de5bd386d6e6a955eb5279b2
|
e8e691cf84e053deaf4f7ee0d032257bf8f84012
|
refs/heads/master
| 2020-03-18T17:10:19.343677
| 2018-05-27T03:19:19
| 2018-05-27T03:19:38
| 135,010,482
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,186
|
java
|
package com.pan.springboot.utils;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
public class FileUtil extends Thread{
private byte[] file;
private File targetDayPath;
private String uploadName;
public FileUtil(byte[] file, File targetDayPath, String uploadName) {
this.file = file;
this.targetDayPath = targetDayPath;
this.uploadName = uploadName;
}
public static void uploadFile(byte[] file, File targetDayPath, String uploadName) throws Exception {
//以每天创建一个文件夹,一个文件夹内文件过多会性能下降
//文件名以时间加UUID命名,解决并发时文件名重复
if(!targetDayPath.exists()){
targetDayPath.mkdirs();
}
BufferedOutputStream buff = new BufferedOutputStream(new FileOutputStream(targetDayPath +"/"+ uploadName));
buff.write(file);
buff.flush();
buff.close();
}
@Override
public void run() {
try {
FileUtil.uploadFile(file, targetDayPath, uploadName);
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
[
"panpan61803@gmail.com"
] |
panpan61803@gmail.com
|
1db56681900910e5b1a05b6d226b0cfd7033d3a7
|
6424da9b4666eb1be27ac73766d5e360a4255cea
|
/HaoZhongCai/src/com/haozan/caipiao/activity/FeedBackList.java
|
52f3f32c924864741175005579112d1bb89cef5a
|
[] |
no_license
|
liveqmock/HZC
|
7ec28ad5966fc0960497dc19490518621ac3951e
|
57fac851f05133b490eca0deb53b40ef904a5ae9
|
refs/heads/master
| 2020-12-26T04:55:19.210929
| 2014-07-31T06:18:00
| 2014-07-31T06:18:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,237
|
java
|
package com.haozan.caipiao.activity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.flurry.android.FlurryAgent;
import com.haozan.caipiao.R;
import com.haozan.caipiao.adapter.FeedBackAdapter;
import com.haozan.caipiao.netbasic.ConnectService;
import com.haozan.caipiao.netbasic.JsonAnalyse;
import com.haozan.caipiao.types.FeedBackMessageData;
import com.haozan.caipiao.util.HttpConnectUtil;
import com.haozan.caipiao.util.LotteryUtils;
import com.haozan.caipiao.util.ViewUtil;
import com.haozan.caipiao.widget.AutoLoadExpandableListView;
import com.haozan.caipiao.widget.AutoLoadExpandableListView.LoadDataListener;
import com.umeng.analytics.MobclickAgent;
/**
* 留言板
*
* @author peter_feng
* @create-time 2013-3-25 下午2:26:46
*/
public class FeedBackList
extends ContainTipsPageBasicActivity
implements LoadDataListener {
private static final String NODATA = "没有留言记录\n您的留言,我们会择优回复到这里..";
private static final int SIZE = 10;
private int page = 1;
private TextView title;
private TextView subTitle;
private ArrayList<FeedBackMessageData> feedbackListData;
private FeedBackAdapter adapter;
private AutoLoadExpandableListView feedbackListView;
private boolean ifMyadvice = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.feedback_list);
setupViews();
initData();
init();
}
public void initData() {
feedbackListData = new ArrayList<FeedBackMessageData>();
feedbackListView = (AutoLoadExpandableListView) findViewById(R.id.feedback_list);
feedbackListView.setOnLoadDataListener(this);
feedbackListView.addLoadingFootView();
Bundle bundle = getIntent().getExtras();
ifMyadvice = bundle.getBoolean("if_my_advice");
}
public void setupViews() {
title = (TextView) findViewById(R.id.title);
subTitle = (TextView) findViewById(R.id.feedback_list_tips);
}
public void init() {
if (ifMyadvice == true) {
title.setText("我的反馈");
subTitle.setVisibility(View.GONE);
}
else {
title.setText("留言板");
}
adapter = new FeedBackAdapter(FeedBackList.this, feedbackListData);
feedbackListView.setAdapter(adapter);
loadData();
}
// 判断是否登录
private boolean checkLogin() {
String userid = appState.getSessionid();
if (userid == null) {
return false;
}
else {
return true;
}
}
private void lottery(String flag) {
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putString("forwardFlag", flag);
bundle.putBoolean("ifStartSelf", false);
intent.putExtras(bundle);
// intent.setClass(FeedBackList.this, StartUp.class);
intent.setClass(FeedBackList.this, Login.class);
startActivity(intent);
}
@Override
protected void onStart() {
super.onStart();
Map<String, String> map = new HashMap<String, String>();
map.put("inf", "username [" + appState.getUsername() + "]: open feedback feedbackList");
String eventName = "v2 open feedback feedbackList";
FlurryAgent.onEvent(eventName, map);
besttoneEventCommint(eventName);
}
private void showFail() {
showFail(failTips);
}
private void showFail(String failInf) {
if (feedbackListData.size() == 0) {
showTipsPage(failInf);
feedbackListView.setVisibility(View.GONE);
}
else {
ViewUtil.showTipsToast(this, failInf);
}
feedbackListView.removeLoadingFootView();
}
private void showNoData() {
if (feedbackListData.size() == 0) {
showTipsPage(NODATA);
feedbackListView.setVisibility(View.GONE);
}
feedbackListView.removeLoadingFootView();
}
class FeedBackTask
extends AsyncTask<Void, Void, String> {
private HashMap<String, String> iniHashMap() {
HashMap<String, String> parameter = new HashMap<String, String>();
parameter.put("service", "feedback_list");
parameter.put("pid", LotteryUtils.getPid(FeedBackList.this));
parameter.put("page_no", "" + page);
parameter.put("page_size", "" + SIZE);
parameter.put("", "");
return parameter;
}
@Override
protected String doInBackground(Void... params) {
ConnectService connectNet = new ConnectService(FeedBackList.this);
String json = null;
try {
if (ifMyadvice == true) {
json = connectNet.getJsonGet(1, true, iniHashMap());
}
else {
json = connectNet.getJsonGet(1, false, iniHashMap());
}
}
catch (Exception e) {
e.printStackTrace();
}
return json;
}
@Override
protected void onPostExecute(String json) {
super.onPostExecute(json);
dismissProgress();
if (json == null) {
showFail();
}
else {
JsonAnalyse analyse = new JsonAnalyse();
String status = analyse.getStatus(json);
if (status.equals("200")) {
String data = analyse.getData(json, "response_data");
if (data.equals("[]") == false) {
int lastSize = feedbackListData.size();
feedbackListResponseData(data);
int preSize = feedbackListData.size();
if (preSize - lastSize < 10) {
feedbackListView.removeLoadingFootView();
}
else {
feedbackListView.addLoadingFootView();
feedbackListView.readyToLoad();
}
page++;
adapter.notifyDataSetChanged();
}
else {
showNoData();
}
}
else {
showFail();
}
}
}
@Override
protected void onPreExecute() {
super.onPreExecute();
showProgress();
}
}
private void feedbackListResponseData(String json) {
if (json != null) {
JSONArray hallArray;
try {
hallArray = new JSONArray(json);
for (int i = 0; i < hallArray.length(); i++) {
FeedBackMessageData message = new FeedBackMessageData();
JSONObject jo = hallArray.getJSONObject(i);
message.setName(jo.getString("nickname"));
message.setTime(jo.getString("issue_date"));
message.setContent(jo.getString("msg_content"));
message.setHuifu(jo.getString("reply_content"));
feedbackListData.add(message);
}
}
catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
protected void submitData() {
String eventName = "open_feedbacklist";
MobclickAgent.onEvent(this, eventName);
besttoneEventCommint(eventName);
}
@Override
public void loadData() {
if (HttpConnectUtil.isNetworkAvailable(this)) {
FeedBackTask feedbackTask = new FeedBackTask();
feedbackTask.execute();
}
else {
showFail(noNetTips);
}
}
}
|
[
"1281110961@qq.com"
] |
1281110961@qq.com
|
16122c5dafe893396a150d4ab9ff10fc0e9c2931
|
d1d1c14b0485955412418d5927e070c04746674b
|
/src/main/java/org/mariadb/r2dbc/message/server/PrepareResultPacket.java
|
0beb6673c200fabd9a15e2d2f455bf09a21c7ebb
|
[
"Apache-2.0"
] |
permissive
|
mirromutth/mariadb-connector-r2dbc
|
1821b83edf1d7f1eaaef02bb706ee03f7df736d3
|
3c63df75a9b2df4d6c38a7bf3e3c52aba097da55
|
refs/heads/master
| 2022-07-10T02:21:55.458527
| 2020-05-08T20:18:56
| 2020-05-08T20:18:56
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,640
|
java
|
/*
* Copyright 2020 MariaDB Ab.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mariadb.r2dbc.message.server;
import io.netty.buffer.ByteBuf;
import org.mariadb.r2dbc.client.ConnectionContext;
import org.mariadb.r2dbc.util.constants.Capabilities;
public final class PrepareResultPacket implements ServerMessage {
private final int statementId;
private final int numColumns;
private final int numParams;
private final boolean eofDeprecated;
private Sequencer sequencer;
private PrepareResultPacket(
final Sequencer sequencer,
final int statementId,
final int numColumns,
final int numParams,
final boolean eofDeprecated) {
this.sequencer = sequencer;
this.statementId = statementId;
this.numColumns = numColumns;
this.numParams = numParams;
this.eofDeprecated = eofDeprecated;
}
@Override
public boolean ending() {
return numParams == 0 && numColumns == 0 && eofDeprecated;
}
public static PrepareResultPacket decode(
Sequencer sequencer, ByteBuf buffer, ConnectionContext context) {
/* Prepared Statement OK */
buffer.readByte(); /* skip field count */
final int statementId = buffer.readIntLE();
final int numColumns = buffer.readUnsignedShortLE();
final int numParams = buffer.readUnsignedShortLE();
return new PrepareResultPacket(
sequencer,
statementId,
numColumns,
numParams,
((context.getServerCapabilities() & Capabilities.CLIENT_DEPRECATE_EOF) > 0));
}
public int getStatementId() {
return statementId;
}
public int getNumColumns() {
return numColumns;
}
public int getNumParams() {
return numParams;
}
public boolean isEofDeprecated() {
return eofDeprecated;
}
@Override
public String toString() {
return "PrepareResultPacket{"
+ "statementId="
+ statementId
+ ", numColumns="
+ numColumns
+ ", numParams="
+ numParams
+ ", sequencer="
+ sequencer
+ '}';
}
@Override
public Sequencer getSequencer() {
return sequencer;
}
}
|
[
"diego.dupin@gmail.com"
] |
diego.dupin@gmail.com
|
cdcb665020d4b24a0403a175d39b8fe34e55de37
|
a5295569592c8ea3b4f27dcc27f81ca3c690e849
|
/s2_biblioteca-back/src/test/java/co/edu/uniandes/csw/biblioteca/test/logic/PrestamoLogicTest.java
|
85494e52b1529ef2226810536dd81b214d458844
|
[
"MIT"
] |
permissive
|
Uniandes-ISIS2603-backup/s2_Bibiloteca
|
253bad41b8b6f9676d2d4ade92fc4d979a5bd32e
|
028c1566564abea46ab40c1c3b5e3e6b1d1dac71
|
refs/heads/master
| 2020-03-26T11:53:44.170273
| 2018-11-29T06:20:26
| 2018-11-29T06:20:26
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,973
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package co.edu.uniandes.csw.biblioteca.test.logic;
import co.edu.uniandes.csw.bibilioteca.entities.LibroEntity;
import co.edu.uniandes.csw.bibilioteca.entities.PrestamoEntity;
import co.edu.uniandes.csw.bibilioteca.entities.ReservaEntity;
import co.edu.uniandes.csw.bibilioteca.entities.SalaEntity;
import co.edu.uniandes.csw.bibilioteca.entities.VideoEntity;
import co.edu.uniandes.csw.biblioteca.ejb.PrestamoLogic;
import co.edu.uniandes.csw.biblioteca.exceptions.BusinessLogicException;
import co.edu.uniandes.csw.biblioteca.persistence.PrestamoPersistence;
import java.time.Clock;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.UserTransaction;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import uk.co.jemos.podam.api.PodamFactory;
import uk.co.jemos.podam.api.PodamFactoryImpl;
/**
* Pruebas de logica de la relacion Prestamo
* @author estudiante
*/
@RunWith(Arquillian.class)
public class PrestamoLogicTest
{
private PodamFactory factory = new PodamFactoryImpl();
@Inject
private PrestamoLogic prestamoLogic;
@PersistenceContext
private EntityManager em;
@Inject
private UserTransaction utx;
private List<PrestamoEntity> dataPrestamo = new ArrayList<PrestamoEntity>();
private List<LibroEntity> dataLibro= new ArrayList<LibroEntity>();
private List<SalaEntity> dataSala= new ArrayList<SalaEntity>();
private List<VideoEntity> dataVideo= new ArrayList<VideoEntity>();
/**
* @return Devuelve el jar que Arquillian va a desplegar en Payara embebido.
* El jar contiene las clases, el descriptor de la base de datos y el
* archivo beans.xml para resolver la inyección de dependencias.
*/
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class)
.addPackage(PrestamoEntity.class.getPackage())
.addPackage(PrestamoLogic.class.getPackage())
.addPackage(PrestamoPersistence.class.getPackage())
.addAsManifestResource("META-INF/persistence.xml", "persistence.xml")
.addAsManifestResource("META-INF/beans.xml", "beans.xml");
}
/**
* Configuración inicial de la prueba.
*/
@Before
public void configTest() {
try {
utx.begin();
clearData();
insertData();
utx.commit();
} catch (Exception e) {
e.printStackTrace();
try {
utx.rollback();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
/**
* Limpia las tablas que están implicadas en la prueba.
*/
private void clearData() {
em.createQuery("delete from PrestamoEntity").executeUpdate();
em.createQuery("delete from LibroEntity").executeUpdate();
em.createQuery("delete from SalaEntity").executeUpdate();
em.createQuery("delete from VideoEntity").executeUpdate();
}
/**
* Inserta los datos iniciales para el correcto funcionamiento de las
* pruebas.
*/
private void insertData() {
for (int i = 0; i < 3; i++) {
PrestamoEntity prestamo = factory.manufacturePojo(PrestamoEntity.class);
em.persist(prestamo);
dataPrestamo.add(prestamo);
}
for (int i = 0; i < 3; i++) {
LibroEntity libro = factory.manufacturePojo(LibroEntity.class);
em.persist(libro);
dataLibro.add(libro);
}
for (int i = 0; i < 3; i++) {
SalaEntity sala = factory.manufacturePojo(SalaEntity.class);
em.persist(sala);
dataSala.add(sala);
}
for (int i = 0; i < 3; i++) {
VideoEntity video = factory.manufacturePojo(VideoEntity.class);
em.persist(video);
dataVideo.add(video);
}
}
/**
* Prueba para crear un Prestamo
*
* @throws co.edu.uniandes.csw.biblioteca.exceptions.BusinessLogicException
*/
@Test
public void createPrestamoTest() throws BusinessLogicException
{
// Probar un prestamo para Un libro
PrestamoEntity newEntity = factory.manufacturePojo(PrestamoEntity.class);
dataLibro.get(0).setUnidadesDisponibles(1);
newEntity.setLibro(dataLibro.get(0));
PrestamoEntity result = prestamoLogic.createPrestamo(newEntity);
Assert.assertNotNull(result);
System.out.println(newEntity.getFechaDeEntrega()+ " "+ result.getFechaDeEntrega()+ "/n /n /n /n /n /n /n /n /n /n" );
PrestamoEntity entity = em.find(PrestamoEntity.class, result.getId());
System.out.println(newEntity.getFechaDeEntrega()+ " "+ entity.getFechaDeEntrega()+ "/n /n /n /n /n /n /n /n /n /n" );
Assert.assertEquals(newEntity.getId(), entity.getId());
Assert.assertEquals(newEntity.getLibro(), entity.getLibro());
// Probar un prestamo para un video
PrestamoEntity newEntity1 = factory.manufacturePojo(PrestamoEntity.class);
dataVideo.get(0).setUnidadesDis(1);
newEntity1.setVideo(dataVideo.get(0));
PrestamoEntity result1 = prestamoLogic.createPrestamo(newEntity1);
Assert.assertNotNull(result1);
PrestamoEntity entity1 = em.find(PrestamoEntity.class, result1.getId());
Assert.assertEquals(newEntity1.getId(), entity1.getId());
Assert.assertEquals(newEntity1.getLibro(), entity1.getLibro());
// Probar un prestamo para una Sala
PrestamoEntity newEntity2 = factory.manufacturePojo(PrestamoEntity.class);
dataSala.get(0).setDisponibilidad(true);
newEntity2.setSala(dataSala.get(0));
PrestamoEntity result2 = prestamoLogic.createPrestamo(newEntity2);
Assert.assertNotNull(result2);
PrestamoEntity entity2 = em.find(PrestamoEntity.class, result2.getId());
Assert.assertEquals(newEntity2.getId(), entity2.getId());
Assert.assertEquals(newEntity2.getLibro(), entity2.getLibro());
}
/**
* Prueba para consultar la lista de Prestamos.
*
* @throws co.edu.uniandes.csw.biblioteca.exceptions.BusinessLogicException
*/
@Test
public void getPrestamosTest() throws BusinessLogicException {
List<PrestamoEntity> list = prestamoLogic.getPrestamos();
Assert.assertEquals(dataPrestamo.size(), list.size());
for (PrestamoEntity entity : list) {
boolean found = false;
for (PrestamoEntity storedEntity : dataPrestamo) {
if (entity.getId().equals(storedEntity.getId())) {
found = true;
}
}
Assert.assertTrue(found);
}
}
/**
* Prueba para consultar un Prestamo.
*/
@Test
public void getPrestamoTest() {
PrestamoEntity entity = dataPrestamo.get(0);
PrestamoEntity resultEntity = prestamoLogic.getPrestamo(entity.getId());
Assert.assertNotNull(resultEntity);
Assert.assertEquals(entity.getId(), resultEntity.getId());
}
/**
* Prueba para actualizar un Prestamo.
*/
@Test
public void updatePrestamoTest() {
PrestamoEntity entity = dataPrestamo.get(0);
PrestamoEntity pojoEntity = factory.manufacturePojo(PrestamoEntity.class);
pojoEntity.setId(entity.getId());
prestamoLogic.updatePrestamo(pojoEntity.getId(),pojoEntity);
PrestamoEntity resp = em.find(PrestamoEntity.class, entity.getId());
Assert.assertEquals(pojoEntity.getId(), resp.getId());
}
/**
* Prueba para eliminar un Prestamo.
*
* @throws co.edu.uniandes.csw.biblioteca.exceptions.BusinessLogicException
*/
@Test
public void deletePrestamoTest() throws BusinessLogicException {
PrestamoEntity entity = dataPrestamo.get(0);
prestamoLogic.deletePrestamo( entity.getId());
PrestamoEntity deleted = em.find(PrestamoEntity.class, entity.getId());
Assert.assertNull(deleted);
}
/**
* Prueba para crear un Prestamo sin disponibilidad
*
* @throws co.edu.uniandes.csw.biblioteca.exceptions.BusinessLogicException
*/
@Test (expected = BusinessLogicException.class)
public void createPrestamoConLibroSinDisponibilidadTest() throws BusinessLogicException
{
// Probar un prestamo para Un libro
PrestamoEntity newEntity = factory.manufacturePojo(PrestamoEntity.class);
dataLibro.get(0).setUnidadesDisponibles(0);
newEntity.setLibro(dataLibro.get(0));
PrestamoEntity result = prestamoLogic.createPrestamo(newEntity);
}
/**
* Prueba para crear un Prestamo sin disponibilidad
*
* @throws co.edu.uniandes.csw.biblioteca.exceptions.BusinessLogicException
*/
@Test (expected = BusinessLogicException.class)
public void createPrestamoConVideoSinDisponibilidadTest() throws BusinessLogicException
{
// Probar un prestamo para un video
PrestamoEntity newEntity1 = factory.manufacturePojo(PrestamoEntity.class);
dataVideo.get(0).setUnidadesDis(0);
newEntity1.setVideo(dataVideo.get(0));
PrestamoEntity result1 = prestamoLogic.createPrestamo(newEntity1);
}
/**
* Prueba para crear un Prestamo sin disponibilidad
*
* @throws co.edu.uniandes.csw.biblioteca.exceptions.BusinessLogicException
*/
@Test (expected = BusinessLogicException.class)
public void createPrestamoConSalaSinDisponibilidadTest() throws BusinessLogicException
{
// Probar un prestamo para una Sala
PrestamoEntity newEntity2 = factory.manufacturePojo(PrestamoEntity.class);
dataSala.get(0).setDisponibilidad(false);
newEntity2.setSala(dataSala.get(0));
PrestamoEntity result2 = prestamoLogic.createPrestamo(newEntity2);
}
}
|
[
"de.saavedra@uniandes.edu.co"
] |
de.saavedra@uniandes.edu.co
|
8cc62ec40694ee858b1c6e18cdbd37002a7339de
|
be564767eff43775bd298d09c7336365a517c467
|
/SpeziDSP/src/main/java/at/jku/cp/spezi/dsp/Processor.java
|
7cfdf899dc9adf5bd43c793e8501f2e49a7ac36c
|
[] |
no_license
|
stgasser/AMP2017
|
97a5ad14c3194a7e4656144e9ecc71468a31c10c
|
5619c481ae74d992f68913b2e2dbae1097bc9324
|
refs/heads/master
| 2021-01-23T12:25:24.093710
| 2017-06-21T19:40:06
| 2017-06-21T19:40:06
| 93,158,109
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 197
|
java
|
package at.jku.cp.spezi.dsp;
import java.util.List;
public interface Processor {
void process(String filename);
List<Double> getOnsets();
List<Double> getTempo();
List<Double> getBeats();
}
|
[
"stefandotgasser@gmail.com"
] |
stefandotgasser@gmail.com
|
85929e062ff5f60dbe80cfdbad8666ae2cf0efff
|
7180670aff354166c0cfddff8af4d64f64a24274
|
/src/main/java/com/tissue/pipes/AnswerCommentPipeFunction.java
|
6d5a4df5f923b7c8fb17e3bc0e600ea736b4ff0b
|
[] |
no_license
|
guoyingshou/tissue-coreutils
|
a40c6a12063c67fd84a864b315d9c696186ec90a
|
b981b0d8ec1b5103400597dbb6df8b378e56a95b
|
refs/heads/master
| 2021-01-16T18:46:21.027736
| 2013-07-03T06:01:18
| 2013-07-03T06:01:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,200
|
java
|
package com.tissue.pipes;
import com.tissue.social.Activity;
import com.tissue.social.ActivityObject;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.tinkerpop.pipes.PipeFunction;
import java.util.List;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AnswerCommentPipeFunction extends ActivityPipeFunction {
private static Logger logger = LoggerFactory.getLogger(AnswerCommentPipeFunction.class);
public AnswerCommentPipeFunction(List<Activity> activities) {
super(activities);
}
public List<Activity> compute(ODocument doc) {
String category = doc.field("action.category", String.class);
if("answerComment".equals(category)) {
Activity activity = init(doc);
activity.setLabel(category);
ODocument questionDoc = doc.field("action.in.in_Contains.in_Contains");
activity.getWhat().setId(questionDoc.getIdentity().toString());
String title = questionDoc.field("title", String.class);
activity.getWhat().setDisplayName(title);
activities.add(activity);
}
return null;
}
}
|
[
"guoyingshou@tianji.com"
] |
guoyingshou@tianji.com
|
1aad0c5bff7f98f4c9fd494154410e273f9c9319
|
1c2da53c0da19b1a387d8b2380f5c07a38616c50
|
/src/org/jeecgframework/core/compartor/commonCompartor.java
|
181ca3b98e0362405fadeb33601057ff79f284e9
|
[] |
no_license
|
yuzhongfeixia/jiance
|
17fdf9960306926d2f084ddd964a1522351ecfff
|
ee111a18df9ff5e778fff0d46a742431c365e801
|
refs/heads/master
| 2023-08-05T22:50:56.774784
| 2023-07-22T02:29:20
| 2023-07-22T02:29:20
| 115,367,159
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 358
|
java
|
package org.jeecgframework.core.compartor;
import java.util.Comparator;
import org.jeecgframework.core.annotation.excel.Excel;
public class commonCompartor implements Comparator<Object> {
@Override
public int compare(Object o1, Object o2) {
if(o1 instanceof Excel){
return ((Excel) o1).sortNum() - ((Excel) o2).sortNum();
}
return 0;
}
}
|
[
"chengen1982@163.com"
] |
chengen1982@163.com
|
4cb22a9764afa6d6037bf8d09a4da19eb926da73
|
d1f9215a00a199d8832e5664e546dbb4383e00bf
|
/src/com/product/sale/service/service/UserService.java
|
dd1d52cb615e40c4ef414e32ca85102bfd4a3f86
|
[] |
no_license
|
ekosal2014/abc
|
97adc54b981872e12f38a71216c80a6ac3aa268d
|
05bcdca15ab630935a1beffcd173fe57947cb5cb
|
refs/heads/master
| 2021-01-11T17:27:18.734862
| 2017-06-01T05:57:46
| 2017-06-01T05:57:46
| 79,770,941
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 668
|
java
|
package com.product.sale.service.service;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.product.sale.model.Users;
public interface UserService {
public Users findByEmail(String email);
public Users findByEmail(String email,String password);
public Boolean CreateUserInformation(Users users);
public Users SearchUserInformationById(Integer uId);
public Boolean UpdateUserInformation(Users users,HttpServletRequest request);
public Boolean DeleteUserInormation(Integer uId);
public Boolean UpdateUserImage(Users users,HttpServletRequest request);
public List<Map> listUser();
}
|
[
"ekosal2014@gmail.com"
] |
ekosal2014@gmail.com
|
53102fa690dc9a640b94d2084f55a0f4d8355145
|
96a6ca2459cb2e50303cfcc307d77e02810b80e6
|
/net.sf.jmoney.property/src/net/sf/jmoney/property/resources/Messages.java
|
7f00b8d600bfb88a51042409567fc62d86e5d053
|
[] |
no_license
|
p07r0457/jmoney
|
3618ff7169c9ae9c613170f69102207ed754fe6d
|
c9db28b82ca7f5cd3c2d54ba3ecfc5c61fbc7013
|
refs/heads/master
| 2021-01-01T17:37:25.109488
| 2012-10-16T10:17:47
| 2012-10-16T10:17:47
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 546
|
java
|
package net.sf.jmoney.property.resources;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "net.sf.jmoney.property.resources.messages"; //$NON-NLS-1$
public static String NavigationTreeNode_stocks;
public static String NavigationTree_realPropertyDescription;
public static String SecuritiesActionProvider_DeleteSecurity;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
// Private constructor
}
}
|
[
"westbury@b97006a3-7e3d-0410-986d-ea81e883d316"
] |
westbury@b97006a3-7e3d-0410-986d-ea81e883d316
|
a36e37b39faee21edbca844dc6e4ad0dd4d7032f
|
6a3491c253b34d591c4cf9d0df5bfe88b828b3ce
|
/src/main/java/de/decoit/simu/cbor/ifmap/deserializer/identifier/MacAddressDeserializer.java
|
fb8f585e14352bf13803f3c278250e801d4b51e0
|
[
"Apache-2.0"
] |
permissive
|
decoit/cbor-if-map-tnc-base
|
623d0cf74f12c4273c31470ef062f0c98af7940d
|
5bcfe8eea981e07dee288b63baa267fe24903192
|
refs/heads/master
| 2021-01-10T11:58:01.040392
| 2015-11-04T12:22:04
| 2015-11-04T12:22:04
| 45,532,931
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,629
|
java
|
/*
* Copyright 2015 DECOIT GmbH
*
* 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 de.decoit.simu.cbor.ifmap.deserializer.identifier;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.DataItem;
import de.decoit.simu.cbor.ifmap.deserializer.IdentifierDeserializerManager;
import de.decoit.simu.cbor.ifmap.enums.CBORTags;
import de.decoit.simu.cbor.ifmap.exception.CBORDeserializationException;
import de.decoit.simu.cbor.ifmap.identifier.CBORMacAddress;
import de.decoit.simu.cbor.xml.dictionary.DictionarySimpleElement;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* The singleton instance of this class may be used to deserialize identifiers of type {@link CBORMacAddress}.
*
* @author Thomas Rix (rix@decoit.de)
*/
@Slf4j
public class MacAddressDeserializer implements InternalIdentifierDeserializer<CBORMacAddress> {
private static MacAddressDeserializer instance;
/**
* Get the singleton instance of this deserializer.
*
* @return Deserializer instance
*/
public static MacAddressDeserializer getInstance() {
if(instance == null) {
instance = new MacAddressDeserializer();
}
return instance;
}
/**
* Private constructor, this is a singleton class.
*/
private MacAddressDeserializer() {}
@Override
public CBORMacAddress deserialize(final Array attributes,
final Array nestedTags,
final DictionarySimpleElement elementDictEntry) throws CBORDeserializationException {
if(log.isDebugEnabled()) {
log.debug("Attributes array: " + attributes);
log.debug("Nested tags array: " + nestedTags);
log.debug("Dictionary entry: " + elementDictEntry);
}
// Initially define the required variables to build the target object
byte[] value = null;
String administrativeDomain = null;
// Get list of all attribute data items
List<DataItem> attributesDataItems = attributes.getDataItems();
// Iterate over the data items in steps of 2
for(int i=0; i<attributesDataItems.size(); i=i+2) {
// Get name and value data items
DataItem attrName = attributesDataItems.get(i);
DataItem attrValue = attributesDataItems.get(i+1);
String attrNameStr = IdentifierDeserializerManager.getAttributeXmlName(attrName, elementDictEntry);
// Process the attribute value
switch(attrNameStr) {
case CBORMacAddress.VALUE:
if(!attrValue.hasTag()) {
log.warn("'value' attribute of 'mac-address' is not tagged, deserializartion outcome may be undefined");
}
else if(!attrValue.getTag().equals(CBORTags.MAC_ADDRESS.getTagDataItem())) {
log.warn("'value' attribute of 'mac-address' has unknown tag, deserializartion outcome may be undefined");
}
value = IdentifierDeserializerManager.processByteStringItem(attrValue, true);
break;
case CBORMacAddress.ADMINISTRATIVE_DOMAIN:
administrativeDomain = IdentifierDeserializerManager.processUnicodeStringItem(attrValue, true);
break;
}
}
// Build return value object
CBORMacAddress rv = new CBORMacAddress(value);
rv.setAdministrativeDomain(administrativeDomain);
return rv;
}
}
|
[
"rix@decoit.de"
] |
rix@decoit.de
|
68f8368b82a79436c2fc2829d69b8be64dcc95d4
|
96cd3e17732fd17568023a0238b26e9893fa2aa7
|
/LMS/src/com/ss/lms/models/LibraryBranch.java
|
27abacb6732c3d64a25ca0e33f1c26b1c34f06c1
|
[] |
no_license
|
trevorhuis-smoothstack/Library-Management-System
|
4fc2f4cda9204b0bee16b509d7c24c2edbfc3294
|
9deb2762f2df5dd5f0525004e2e3cc4385e960b9
|
refs/heads/master
| 2022-04-26T09:16:04.200085
| 2020-04-27T23:47:22
| 2020-04-27T23:47:22
| 256,316,235
| 0
| 0
| null | 2020-04-27T23:47:23
| 2020-04-16T19:55:46
|
Java
|
UTF-8
|
Java
| false
| false
| 2,758
|
java
|
package com.ss.lms.models;
import java.io.Serializable;
public class LibraryBranch implements Serializable{
/**
*
*/
private static final long serialVersionUID = -6798149166979262131L;
private Integer branchId;
private String branchName;
private String branchAddress;
public LibraryBranch(Integer branchId, String branchName, String branchAddress) {
this.branchId = branchId;
this.branchName = branchName;
this.branchAddress = branchAddress;
}
public LibraryBranch() {
}
public LibraryBranch(String branchName, String branchAddress) {
this.branchName = branchName;
this.branchAddress = branchAddress;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public Integer getBranchId() {
return branchId;
}
public void setBranchId(Integer branchId) {
this.branchId = branchId;
}
public String getBranchName() {
return branchName;
}
public void setBranchName(String branchName) {
this.branchName = branchName;
}
public String getBranchAddress() {
return branchAddress;
}
public void setBranchAddress(String branchAddress) {
this.branchAddress = branchAddress;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((branchAddress == null) ? 0 : branchAddress.hashCode());
result = prime * result + ((branchId == null) ? 0 : branchId.hashCode());
result = prime * result + ((branchName == null) ? 0 : branchName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LibraryBranch other = (LibraryBranch) obj;
if (branchAddress == null) {
if (other.branchAddress != null)
return false;
} else if (!branchAddress.equals(other.branchAddress))
return false;
if (branchId == null) {
if (other.branchId != null)
return false;
} else if (!branchId.equals(other.branchId))
return false;
if (branchName == null) {
if (other.branchName != null)
return false;
} else if (!branchName.equals(other.branchName))
return false;
return true;
}
@Override
public String toString() {
return "LibraryBranch [branchAddress=" + branchAddress + ", branchId=" + branchId + ", branchName=" + branchName
+ "]";
}
}
|
[
"trevor.huis@Smoothstack.com"
] |
trevor.huis@Smoothstack.com
|
26d78b7257f40a691e86f7e205f77911b4237cd0
|
021e418ac3eb4a4bebbf39a2bb21c07fbc3f46c6
|
/app/src/test/java/com/wecode/letstalk/ExampleUnitTest.java
|
c3e5e7a54c325fc02b5222362fa42011c947bc02
|
[] |
no_license
|
TeoDimitrov/LetsTalk
|
e5c208448ab79e003fcc2e23d4e7fe400bacc4ef
|
7743e725e79757fabc045082cfd98b11dd0e485e
|
refs/heads/master
| 2020-04-09T17:32:51.888251
| 2017-08-13T13:54:50
| 2017-08-13T13:54:50
| 68,179,841
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 323
|
java
|
package com.wecode.letstalk;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"Teodor Dimitrov"
] |
Teodor Dimitrov
|
a0c7050df6ee452637c3fbdb681e19cf97205989
|
fc9b739b831425b501974d9a913adc97d1c92a95
|
/src/com/class07/DoOrWhile.java
|
271515b3b42f7e58af364f17b182c12037a409cd
|
[] |
no_license
|
YarinaBereza/Eclipse
|
da88693b814e48b1e013633dcb3a623261ffbee4
|
765d7feef726054ac7c4020dc0e96fb240ed9060
|
refs/heads/main
| 2023-03-21T17:41:27.389149
| 2021-03-14T18:11:29
| 2021-03-14T18:11:29
| 347,715,477
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 573
|
java
|
package com.class07;
import java.util.Scanner;
public class DoOrWhile {
public static void main(String[] args) {
/*
* we play lottery and have a win number which is 17
* we need to keeps asking a user to enter any number from 1 to 100
* UNTILL correct number is entered
*/
Scanner sc = new Scanner(System.in);
int lotteryNumber=17;
int num;
do {
System.out.println("Please enter the number from 1 to 100 to win the lottary");
num = sc.nextInt();
}while(num!=lotteryNumber);
System.out.println("Congratulations!!!");
}
}
|
[
"yarinabereza@gmail.com"
] |
yarinabereza@gmail.com
|
c9918ae645ea2b5eee8104860322ef8d1e31e5f8
|
872147bec4452dbdc6786cc04010a1455e08590d
|
/JavaBase/Practice/src/基础语法练习/继承和多态/Test.java
|
722689622a539bbc0863b40fcb32e85226f3cc89
|
[] |
no_license
|
yuanyyb/JavaStudy
|
f3eb26bf0383c9f8a327322987bd711cd7544319
|
5595b7ad893d11212a59e5c6c2d5ce12d0e91a3f
|
refs/heads/master
| 2022-12-02T00:42:21.787688
| 2020-07-30T10:15:10
| 2020-07-30T10:15:10
| 283,765,631
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 200
|
java
|
package 基础语法练习.继承和多态;
public class Test {
public static void main(String[] args) {
Animal a = new Cat();
System.out.println(a.age);
a.eat();
}
}
|
[
"yuanyyb@hotmail.com"
] |
yuanyyb@hotmail.com
|
30b190a9c0a3634271563d3df9f00c4f6fca97d2
|
c6b7c67008504ee9805ee72e9618ebc2bcc56cee
|
/stock/src/main/java/com/sun/pipeline/stock/Time.java
|
7a84222d390b846060799a4d5e6e1867afee6b84
|
[] |
no_license
|
zksun/pipeline
|
d66dd319ffd56c9ad21648f7be6432b009a1efd3
|
9961e829f91ecf2192522acdb187302c9bacb3c2
|
refs/heads/master
| 2020-12-30T14:19:06.134821
| 2017-11-16T08:57:39
| 2017-11-16T08:57:39
| 91,300,382
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 124
|
java
|
package com.sun.pipeline.stock;
/**
* Created by zksun on 13/06/2017.
*/
public interface Time {
String getTime();
}
|
[
"zhikun.szk@alibaba-inc.com"
] |
zhikun.szk@alibaba-inc.com
|
ac95ea3f665ced71d04b83b59cbab71f11520388
|
b04399e1aa7e4633c7a0d4579db2b49bbb59970e
|
/nas/src/com/nas/msc/pdtm/typedivers_propositiontype/dao/impl/TypediversPropositiontypeDao.java
|
133b435e82b64ed5975e64b58d46f9651ba5572e
|
[] |
no_license
|
molosNas/naspj
|
b4a6a4e5d66d4e183999e771239667abbc9a0250
|
81e5ff6044dd66a73c60909f40f695b4eeb38c07
|
refs/heads/master
| 2016-09-10T18:29:26.477852
| 2014-01-20T08:37:22
| 2014-01-20T08:37:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 731
|
java
|
package com.nas.msc.pdtm.typedivers_propositiontype.dao.impl;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.nas.msc.pdtm.typedivers_propositiontype.dao.ITypediversPropositiontypeDao;
import com.nas.msc.basemvc.dao.impl.NASDao;
import com.nas.beans.TypediversPropositiontype;
@Repository
public class TypediversPropositiontypeDao extends
NASDao<TypediversPropositiontype> implements
ITypediversPropositiontypeDao {
@SuppressWarnings("unchecked")
@Override
public List<TypediversPropositiontype> queryAllName4Map() {
String hql = "select new TypediversPropositiontype(id,name) from TypediversPropositiontype";
return current().createQuery(hql).list();
}
}
|
[
"380224447@qq.com"
] |
380224447@qq.com
|
2487c57d6bd3c3b368af46bea21c427887c44f79
|
a71c20d9df288f31b3732faa579aada0d50082ce
|
/staff_room/src/kkweb/beans/B_Jido_Keisan.java
|
f025e7bab9a8f42d6507231022722041c0e6c6ac
|
[] |
no_license
|
lucentsquare2014/staff_room
|
2a34432d8b31d4136f08def0603cb72942d18f30
|
0e08dba68d0274dfcd3991270e6f665a4151305f
|
refs/heads/master
| 2021-01-18T19:25:57.249069
| 2014-07-18T08:41:55
| 2014-07-18T08:41:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 947
|
java
|
package kkweb.beans;
public class B_Jido_Keisan {
private String[] PROJECTcode;
private String[] KINMUcode;
private String[] startTIME;
private String[] endTIME;
private String[] restTIME;
public void clear(){
}
public String[] getPROJECTcode(){
return PROJECTcode;
}
public void setPROJECTcode(String[] PROJECTcode){
this.PROJECTcode = PROJECTcode;
}
public String[] getKINMUcode(){
return KINMUcode;
}
public void setKINMUcode(String[] KINMUcode){
this.KINMUcode = KINMUcode;
}
public String[] getStartTIME(){
return startTIME;
}
public void setStartTIME(String[] startTIME){
this.startTIME = startTIME;
}
public String[] getEndTIME(){
return endTIME;
}
public void setEndTIME(String[] endTIME){
this.endTIME = endTIME;
}
public String[] getRestTIME(){
return restTIME;
}
public void setRestTIME(String[] restTIME){
this.restTIME = restTIME;
}
}
|
[
"s11013@std.it-college.ac.jp"
] |
s11013@std.it-college.ac.jp
|
1b429e011dcd6fc9dbe488148412d2452db108be
|
bbe9621fc135f08c40018d274edf0659cc72a05e
|
/AmapLibrary/src/main/java/com/yisingle/amap/lib/utils/DistanceUtils.java
|
c70de141b3b8628816d6e27e4a78e8d9e1f54771
|
[] |
no_license
|
ooozxv2/CustomNaviByGaode
|
47806f46c7ee1839a2d9d0badae72eb377efa869
|
860d6eee76e02c64e7a0b4021366f96a01578cf0
|
refs/heads/master
| 2020-05-20T05:25:13.215667
| 2019-02-18T08:56:49
| 2019-02-18T08:56:49
| 185,404,632
| 0
| 2
| null | 2019-05-07T13:10:45
| 2019-05-07T13:10:45
| null |
UTF-8
|
Java
| false
| false
| 624
|
java
|
package com.yisingle.amap.lib.utils;
import java.math.BigDecimal;
public class DistanceUtils {
/**
* 将米装换公里
* 如果小于1000米 则装换为米
*
* @param rice
* @return
*/
public static String getDistance(int rice) {
String info = "";
if (rice > 1000) {
double ditance = rice * 0.001;
BigDecimal b = new BigDecimal(ditance);
double f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
info = f1 + "公里";
} else {
info = rice + "米";
}
return info;
}
}
|
[
"j314815101@qq.com"
] |
j314815101@qq.com
|
e905a1fcce9796d4cd5abece2e9274fbec7910c2
|
185461a4e1e647918ba491742e27d617072108fd
|
/DataProvider/src/main/java/mx/edu/itt/provider/service/impl/ProductServiceImpl.java
|
178df59b87da0239127f2cfd8c1de8a92dfa4df3
|
[] |
no_license
|
haxdai/JavaFXExampleApp
|
a8a97421754ef1673c565c0522de4083cc0eaab7
|
77f13f3166ffd4037b08db9e8caf706681a95659
|
refs/heads/master
| 2020-04-07T22:27:20.729176
| 2018-11-30T16:24:44
| 2018-11-30T16:24:44
| 158,770,970
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,260
|
java
|
package mx.edu.itt.provider.service.impl;
import java.util.List;
import mx.edu.itt.model.Product;
import mx.edu.itt.provider.repository.ProductRepository;
import mx.edu.itt.provider.repository.impl.SQLProductRepository;
import mx.edu.itt.provider.service.ProductService;
/**
* Implementación de servicio de gestión de productos con SQL por defecto.
* @author hasdai
*
*/
public class ProductServiceImpl implements ProductService {
private ProductRepository repository;
public ProductServiceImpl() {
repository = SQLProductRepository.getInstance();
((SQLProductRepository)repository).connect("jdbc:mysql://localhost/inventariodb?useSSL=false", "root", "");
}
public ProductServiceImpl(ProductRepository repo) {
this.repository = repo;
}
@Override
public Product save(Product sample) {
return repository.save(sample);
}
@Override
public List<Product> findAll() {
return repository.findAll();
}
@Override
public Product remove(Product sample) {
return repository.remove(sample);
}
@Override
public Product removeById(int id) {
return repository.removeById(id);
}
@Override
public Product findById(int id) {
return repository.findById(id);
}
@Override
public void clear() {
repository.clear();
}
}
|
[
"me@hasdaipacheco.com"
] |
me@hasdaipacheco.com
|
345778f75a1ff5452f297f03fa666c1c68261de1
|
f37a433dcbd6e4a88a7492bf2412767dd330c7a9
|
/src/com/example/simpletalk/GoogleRecognizer.java
|
af516d4e00eba3eacc8c73de3c4a3e5073feec31
|
[] |
no_license
|
mogimo/simpletalk
|
a3ac50a11c87fd31e717efc15db2c835cb4d8cdc
|
b21b27772d96e408ba6b842e366fab09c6739740
|
refs/heads/master
| 2020-04-05T22:51:09.009879
| 2014-11-19T10:55:59
| 2014-11-19T10:55:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,846
|
java
|
package com.example.simpletalk;
import java.util.ArrayList;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.speech.RecognitionListener;
import android.speech.RecognizerIntent;
import android.speech.SpeechRecognizer;
import android.util.Log;
public class GoogleRecognizer implements Recognizer {
private final static boolean DEBUG = BuildConfig.DEBUG;
private final static String TAG = "SimpleTalk:GoogleRecognizer";
private final static float SCORE_THRESHOLD = 0.0f;
private Context mContext;
private SpeechRecognizer mSpeechRecognizer;
private RecognitionServiceListener mListener;
private RecognizerListener mClient;
private class RecognitionServiceListener implements RecognitionListener {
@Override
public void onBeginningOfSpeech() {
if (DEBUG) Log.d(TAG, "onBeginningOfSpeech");
}
@Override
public void onBufferReceived(byte[] buffer) {
if (DEBUG) Log.d(TAG, "onBufferReceived");
}
@Override
public void onEndOfSpeech() {
if (DEBUG) Log.d(TAG, "onEndOfSpeech");
}
@Override
public void onError(int error) {
if (mClient != null) {
if (DEBUG) Log.d(TAG, "onError: " + error);
mClient.onError(error);
}
}
@Override
public void onEvent(int eventType, Bundle params) {
if (DEBUG) Log.d(TAG, "onEvent: type=" + eventType);
}
@Override
public void onPartialResults(Bundle partialResults) {
if (DEBUG) Log.d(TAG, "onPartialResults");
}
@Override
public void onReadyForSpeech(Bundle params) {
if (mClient != null) {
if (DEBUG) Log.d(TAG, "onReadyForSpeech");
mClient.onReady();
}
}
private String getTopScoredText(ArrayList<String> results, float[] scores) {
int i = 0;
for (String text : results) {
if (DEBUG) Log.d(TAG, "[" + scores[i] + "] " + text);
i++;
}
return (Float.compare(scores[0], SCORE_THRESHOLD) >= 0) ?
results.get(0) : null;
}
@Override
public void onResults(Bundle results) {
if (DEBUG) Log.d(TAG, "onResults");
ArrayList<String> texts =
results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
float[] scores = results.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES);
String msg = getTopScoredText(texts, scores);
mClient.onRecognize(msg, scores[0]);
}
@Override
public void onRmsChanged(float rmsdB) {
//Log.d(TAG, "onRmsChanged");
}
}
public GoogleRecognizer(Context context) {
this.mContext = context;
}
public void init() {
mListener = new RecognitionServiceListener();
mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(mContext);
if (mSpeechRecognizer != null && mListener != null) {
mSpeechRecognizer.setRecognitionListener(mListener);
}
}
public void start() {
if (mSpeechRecognizer != null) {
startSpeechRecognize();
}
}
public void stop() {
if (mSpeechRecognizer != null) {
stopSpeechRecognize();
}
}
public void release() {
if (mSpeechRecognizer != null) {
mSpeechRecognizer.setRecognitionListener(null);
mSpeechRecognizer = null;
}
}
public void setRecognizerListener(RecognizerListener listener) {
if (mClient == null) {
mClient = listener;
} else {
Log.i(TAG, "already registered listener");
}
}
private void startSpeechRecognize() {
if (DEBUG) Log.d(TAG, "start recognize!");
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_CONFIDENCE_SCORES, "");
if (mSpeechRecognizer != null) {
mSpeechRecognizer.startListening(intent);
}
}
private void stopSpeechRecognize() {
if (mSpeechRecognizer != null) {
//mSpeechRecognizer.stopListening();
//mSpeechRecognizer.cancel();
// SpeechRecognier bind when startListening, then unbind when destroy.
mSpeechRecognizer.destroy();
}
}
}
|
[
"ogino.masanori@sharp.co.jp"
] |
ogino.masanori@sharp.co.jp
|
229a0c4fcf4006c2a38ecf2d6a59da76acd21ca8
|
ed5159d056e98d6715357d0d14a9b3f20b764f89
|
/test/irvine/oeis/a006/A006346Test.java
|
a4e03850a2c32ca68f350397a29bcfe060b70bf7
|
[] |
no_license
|
flywind2/joeis
|
c5753169cf562939b04dd246f8a2958e97f74558
|
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
|
refs/heads/master
| 2020-09-13T18:34:35.080552
| 2019-11-19T05:40:55
| 2019-11-19T05:40:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 195
|
java
|
package irvine.oeis.a006;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A006346Test extends AbstractSequenceTest {
}
|
[
"sairvin@gmail.com"
] |
sairvin@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.