blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f9c63b03e37a3eb7b15e598ac29e06b555b398c4 | 2c199d88ff3ecc2f029a2ca6a5572620c1e005a2 | /examples/com.mycorp.examples.student.remoteservice.host/src/com/mycorp/examples/student/remoteservice/host/StudentServiceImpl2.java | 8fb55a811b4776cba940aaf002859aadd62fec5a | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | harshana05/JaxRSProviders | 374b6f1af67a5431bc93ed00d5cfab8d9c0142c5 | 39194df66236685f515f525e406cc65318f2f202 | refs/heads/master | 2020-04-21T08:12:58.345665 | 2019-02-05T06:18:14 | 2019-02-05T06:18:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,978 | java | /*******************************************************************************
* Copyright (c) 2015 Composent, Inc. and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Composent, Inc. - initial API and implementation
******************************************************************************/
package com.mycorp.examples.student.remoteservice.host;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.osgi.service.component.annotations.Component;
import com.mycorp.examples.student.Address;
import com.mycorp.examples.student.Student;
import com.mycorp.examples.student.StudentService;
import com.mycorp.examples.student.Students;
// The jax-rs path annotation for this service
@Path("/studentservice")
// The OSGi DS (declarative services) component annotation.
//@Component(immediate = true, property = { "service.exported.interfaces=*", "service.exported.intents=osgi.async",
// "service.exported.intents=jaxrs","osgi.basic.timeout=50000" })
public class StudentServiceImpl2 implements StudentService {
// Provide a map-based storage of students
private static Map<String, Student> students = Collections.synchronizedMap(new HashMap<String, Student>());
// Create a single student and add to students map
static {
Student s = new Student("Joe Senior");
s.setId(UUID.randomUUID().toString());
s.setGrade("First");
Address a = new Address();
a.setCity("New York");
a.setState("NY");
a.setPostalCode("11111");
a.setStreet("111 Park Ave");
s.setAddress(a);
students.put(s.getId(), s);
}
// Implementation of StudentService based upon the students map
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/students")
public Students getStudents() {
Students result = new Students();
result.setStudents(new ArrayList<Student>(students.values()));
return result;
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/studentscf")
public CompletableFuture<Students> getStudentsCF() {
CompletableFuture<Students> cf = new CompletableFuture<Students>();
cf.complete(getStudents());
return cf;
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/students/{studentId}")
public Student getStudent(@PathParam("studentId") String id) {
return students.get(id);
}
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/students/{studentName}")
public Student createStudent(@PathParam("studentName") String studentName) {
if (studentName == null)
return null;
synchronized (students) {
Student s = new Student(studentName);
s.setId(UUID.randomUUID().toString());
students.put(s.getId(), s);
return s;
}
}
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/students")
public Student updateStudent(Student student) {
Student result = null;
if (student != null) {
String id = student.getId();
if (id != null) {
synchronized (students) {
result = students.get(student.getId());
if (result != null) {
String newName = student.getName();
if (newName != null)
result.setName(newName);
result.setGrade(student.getGrade());
result.setAddress(student.getAddress());
}
}
}
}
return result;
}
@DELETE
@Path("/students/{studentId}")
@Produces(MediaType.APPLICATION_JSON)
public Student deleteStudent(@PathParam("studentId") String studentId) {
return students.remove(studentId);
}
}
| [
"slewis@composent.com"
] | slewis@composent.com |
7d689f2850a2058efd717e1d55f05fccfe896841 | 16d65d418594eb28f9fdccb820d1812a95df2ea1 | /src/main/java/com/player/Player/AudioPlayer.java | 89cab01e62b6f76a5c5205d47b98040233d07136 | [] | no_license | wang-kui-die/MediaPlayer | 6a11d7b8e8e3777e26975fd83ba70c764af6bc11 | 3c4e191f5bfce1a5aeabeff7c30fe91f84204d21 | refs/heads/master | 2023-04-15T13:53:26.916349 | 2021-04-25T08:00:59 | 2021-04-25T08:00:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,235 | java | package com.player.Player;
import com.player.MainFrame;
import com.player.UI.Bottom.BottomLeft;
import com.player.UI.View.ViewPanel;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.audio.exceptions.CannotReadException;
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
import org.jaudiotagger.audio.mp3.MP3File;
import org.jaudiotagger.tag.TagException;
import org.jaudiotagger.tag.id3.AbstractID3v2Frame;
import org.jaudiotagger.tag.id3.AbstractID3v2Tag;
import org.jaudiotagger.tag.id3.framebody.FrameBodyAPIC;
import javax.imageio.ImageIO;
import javax.imageio.stream.FileImageInputStream;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Objects;
import java.util.Vector;
import java.util.logging.Level;
public class AudioPlayer {
private boolean isPlaying = false; // 正在播放
private static String fileName = ""; // 当前处理的文件名
private static byte[] musicBytes; // 音乐文件流字节
private BufferedInputStream bufferedInputStream;// 音乐缓冲流,播放流
private static PlayMusicThread playMusicThread; // 播放线程对象
private static EndThread endThread;// 播放结束线程
private static int length; // 播放歌曲的长度
private static BufferedImage cover; // 封面图片
private static AudioPlayer audioPlayer = new AudioPlayer();
public static AudioPlayer getInstance() {
return audioPlayer;
}
public static PlayMusicThread getPlayMusicThread() {
return playMusicThread;
}
public boolean isPlaying() {
return isPlaying;
}
// 启动时初始化,显示第一首歌
public void init() throws ReadOnlyFileException, CannotReadException, TagException, InvalidAudioFrameException, IOException {
Vector v = getFileList("src/music/");
String path = "src/music/" + v.get(0);
this.endThread = new EndThread(); //监听事件结束
this.endThread.start();
prepare(path); //初始化文件流
this.playMusicThread = new PlayMusicThread(this.bufferedInputStream);
this.playMusicThread.start();
this.playMusicThread.suspend();
Process.getInstance().init();
}
private Vector getFileList(String path) {
File rootDirectory = new File(path);
String[] fileList = rootDirectory.list();
Vector list = new Vector();
assert fileList != null;
for (String file : fileList)
if (file.endsWith(".mp3"))
list.add(file);
return list;
}
// 播放歌曲之前预先做好:准备好播放流、设置左下方标题
private void prepare(String path) throws ReadOnlyFileException, IOException, TagException, InvalidAudioFrameException, CannotReadException {
// AudioFileIO.logger.setLevel(Level.OFF);
// AbstractID3v2Tag.logger.setLevel(Level.OFF);
// AbstractID3v2Frame.logger.setLevel(Level.OFF);
// FrameBodyAPIC.logger.setLevel(Level.OFF);
this.fileName = path.substring(path.lastIndexOf('/') + 1);
String musicName = this.fileName.substring(0, this.fileName.lastIndexOf('.'));
BottomLeft left = (BottomLeft) MainFrame.getBottom().getFileName();
left.setTitle(musicName);
this.length = mp3Length(path);
byte[] coverByte = getMp3Img(path);
ByteArrayInputStream bais = new ByteArrayInputStream(coverByte);
cover = ImageIO.read(bais);
ViewPanel view = MainFrame.getView();
view.getCover().setCover(cover);
File mp3 = new File(path);
FileInputStream fileInputStream = new FileInputStream(mp3);//音乐文件流
this.musicBytes = streamToByte(fileInputStream); //音乐字节数组
this.bufferedInputStream = new BufferedInputStream(Objects.requireNonNull(byteToStream(this.musicBytes)));
}
// 根据文件路径得到mp3音乐播放时长
private int mp3Length(String path) throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException {
File file = new File(path);
AudioFile mp3 = AudioFileIO.read(file);
return mp3.getAudioHeader().getTrackLength();
}
// 获取mp3封面
private byte[] getMp3Img(String path) throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException {
File file = new File(path);
AudioFile mp3 = AudioFileIO.read(file);
MP3File mp3File = (MP3File) mp3;
AbstractID3v2Tag tag = mp3File.getID3v2Tag();
AbstractID3v2Frame frame = (AbstractID3v2Frame) tag.getFrame("APIC");
byte[] imageData;
if (frame == null) {
FileImageInputStream unknown = new FileImageInputStream(new File("src/icon/unknown.png"));
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int numBytesRead = 0;
while ((numBytesRead = unknown.read(buf)) != -1) {
output.write(buf, 0, numBytesRead);
}
imageData = output.toByteArray();
output.close();
unknown.close();
} else {
FrameBodyAPIC body = (FrameBodyAPIC) frame.getBody();
imageData = body.getImageData();
}
return imageData;
}
// 从头开始播放歌曲,可以认为是新的歌曲
public void playMusic(String path) throws ReadOnlyFileException, CannotReadException, TagException, InvalidAudioFrameException, IOException {
if (this.playMusicThread != null) {
this.playMusicThread.stop();
}
prepare(path);
this.isPlaying = true;
this.playMusicThread = new PlayMusicThread(this.bufferedInputStream);
this.playMusicThread.start();
Process.getInstance().changeMusic(this.length);
}
private byte[] streamToByte(FileInputStream fs) throws IOException {
BufferedInputStream all = new BufferedInputStream(fs);
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[1024 * 50];
int n;
while ((n = all.read(buffer)) != -1)
output.write(buffer, 0, n);
return output.toByteArray();
}
private FileInputStream byteToStream(byte[] bytes) {
File file = new File("src/cache");
FileInputStream fileInputStream;
try {
OutputStream output = new FileOutputStream(file);
BufferedOutputStream bufferedOutput = new BufferedOutputStream(output);
bufferedOutput.write(bytes);
fileInputStream = new FileInputStream(file);
// bufferedOutput.close();
// fileInputStream.close();
file.deleteOnExit();
return fileInputStream;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
private void playEnd() throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException {
isPlaying = false;
fileName = getMusicName(1);
playMusic("src/music/" + fileName);
Process.getInstance().changeMusic(this.length);
}
public void playNext() throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException {
playEnd();
}
public void playPrev() throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException {
isPlaying = false;
fileName = getMusicName(-1);
playMusic("src/music/" + fileName);
Process.getInstance().changeMusic(this.length);
}
/**
* @param flag 小于零得到上一首,大于零得到下一首
* @return 得到音乐文件名
*/
public String getMusicName(int flag) {
Vector v = getFileList("src/music");
int length = v.size();
String now = fileName;
if (flag < 0) { // 上一首
for (int i = 1; i < length; i++) {
if (v.get(i).toString().equals(now))
return v.get(i - 1).toString();
}
return v.get(length - 1).toString();
} else { // 下一首
for (int i = 0; i < length - 1; i++) {
if (v.get(i).toString().equals(now))
return v.get(i + 1).toString();
}
return v.get(0).toString();
}
}
// 获得当前音乐时长
public int getLength() {
return this.length;
}
// 设置进度,percent是百分比
public void setProcess(double percent, double time) {
byte[] bytes = this.musicBytes;
int index = (int) (bytes.length * percent);
byte[] b = new byte[(int) (bytes.length * (1 - percent))];
System.arraycopy(bytes, index, b, 0, b.length);
InputStream bs = new ByteArrayInputStream(b);
this.bufferedInputStream = new BufferedInputStream(bs);
this.playMusicThread.stop(); // 重新设置设置进度后,将线程销毁,重新创建线程
this.playMusicThread = new PlayMusicThread(this.bufferedInputStream);
if (isPlaying) {
this.playMusicThread.start();
}
Process.getInstance().setProcess((int) time);
}
// 跳转,用于快进快退
public void jump(double percent, boolean forward) {
double distance = 4.0; // 设置三秒的跳跃间隔
double rate = distance / length;
if (forward) {
percent += rate;
if (percent > 1) {
percent = 1;
}
} else {
percent -= rate;
if (percent < 0) {
percent = 0;
}
}
double time = percent * length;
setProcess(percent, time);
}
// 暂停播放
public void pause() {
this.isPlaying = false;
this.playMusicThread.suspend();
Process.getInstance().pause();
}
// 继续播放
public void go_on() {
this.isPlaying = true;
this.playMusicThread.resume();
Process.getInstance().go_on();
}
class PlayMusicThread extends Thread {
private BufferedInputStream bis;
public PlayMusicThread(BufferedInputStream bis) {
this.bis = bis;
}
@Override
public void run() {
try {
Player player = new Player(this.bis);
player.play();
endThread.resume();
} catch (JavaLayerException e) {
e.printStackTrace();
}
}
}
class EndThread extends Thread {
@Override
public void run() {
while (true) {
suspend();
try {
Thread.sleep(1000);
playEnd();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
| [
"1056317718@qq.com"
] | 1056317718@qq.com |
fdfe60255d8b397341aa036431c3df7e601f0cf1 | 8581e3b9c956e042f6ae0a35a928fdee5d7041c6 | /src/main/java/com/gmail/mxwild/mealcalories/repository/UserRepository.java | 8e15b8d0e30656d957fe2925a92252f56f0d0858 | [] | no_license | MxWild/MealCalories | 26d7f20e9337cce9064e7be900556015d8de10a1 | b630f6360026eab8e0834d81a3e80f6f1f26a807 | refs/heads/develop | 2023-07-14T19:46:28.650787 | 2021-08-20T11:15:26 | 2021-08-20T11:15:26 | 386,525,386 | 0 | 1 | null | 2021-08-20T11:15:26 | 2021-07-16T05:52:57 | Java | UTF-8 | Java | false | false | 311 | java | package com.gmail.mxwild.mealcalories.repository;
import com.gmail.mxwild.mealcalories.model.User;
import java.util.List;
public interface UserRepository {
User save(User user);
boolean delete(Integer id);
User get(Integer id);
User getByEmail(String email);
List<User> getAll();
}
| [
"mxwild@gmail.com"
] | mxwild@gmail.com |
af3114b72324b7c6d6797db8df08f813790daeb5 | ed321d5d7134be92256a1e83beebd763d5242840 | /chap02/src/code02_06/Main.java | b23391db579a71acbc06e4d77ce0953a40b3b61c | [] | no_license | tttttt-mam/workspace02 | b55ec7459dcaf0008dbc89c7e588bc609be08f34 | 2ff9cb117c7101b226953eabbbb87a43370b9fda | refs/heads/master | 2023-03-27T00:24:34.248449 | 2021-03-16T05:10:57 | 2021-03-16T05:10:57 | 348,216,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package code02_06;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
int i = 3.2;
System.out.println(i);
}
}
| [
"tttttt005@blue.ocn.ne.jp"
] | tttttt005@blue.ocn.ne.jp |
d5cd3ba3b84cd6d3b24357f287df1b8e3dded9b0 | 3029337aae2416423c26ba45ed1d273a8e27f4f3 | /api/src/main/java/com/honeybeedev/exclusiveprison/api/util/Clearable.java | b90e53563454542f78b6efe4c3be238e9073fc01 | [] | no_license | OOP-778/exclusive-prison | 083c390842a1e572145038383e34fecf7a3f5080 | cf159c0e1b53c24c21d395949b2a85978559e307 | refs/heads/master | 2023-03-01T15:14:58.615642 | 2021-02-05T09:47:00 | 2021-02-05T09:47:00 | 326,151,438 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | package com.honeybeedev.exclusiveprison.api.util;
import java.util.function.Consumer;
import java.util.function.Function;
public class Clearable<T> {
protected T object;
public Clearable(T object) {
this.object = object;
}
public void clear() {
object = null;
}
public T get() {
return object;
}
public void set(T object) {
this.object = object;
}
public void ifPresent(Consumer<T> consumer) {
if (object != null)
consumer.accept(object);
}
public void consumeAndClear(Consumer<T> consumer) {
if (object != null) {
consumer.accept(object);
object = null;
}
}
public <O> O produce(Function<T, O> function) {
if (object != null) {
return function.apply(object);
}
return null;
}
}
| [
"oskardhavel@gmail.com"
] | oskardhavel@gmail.com |
8efb3d93cdb24783b06b7a5e7939c0d8213955f9 | 9b3ecd7983a3264bc87365ff686f36e80e19320a | /src/main/common/utils/CookieUtils.java | 8b1a99c0e9126a67b11795a7c009ed00586facad | [] | no_license | 568792513/video_end | a224a701bc8462955f505830bf9edd8de3def94a | 0dde099177107fc664d65436b6d277221d2a0873 | refs/heads/master | 2022-12-11T07:52:36.467072 | 2019-07-03T08:19:46 | 2019-07-03T08:19:51 | 128,072,216 | 0 | 0 | null | 2022-12-05T23:51:10 | 2018-04-04T14:14:47 | Java | UTF-8 | Java | false | false | 1,233 | java | package com.hui.user_service.common.utils;
import com.alibaba.fastjson.JSONArray;
import com.hui.user_service.entity.User;
import com.hui.user_service.service.UserService;
import com.mysql.jdbc.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Component
public class CookieUtils {
private static UserService userService;
@Resource
private UserService userServiceTmp;
@PostConstruct
public void init() {
userService = this.userServiceTmp;
}
// 从header获取user
public static User getUserByToken(HttpServletRequest request){
String token = request.getHeader("Authorization");
if (StringUtils.isNullOrEmpty(token)){
return null;
} else {
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(token);
String id = m.replaceAll("").trim();
Long Id = Long.valueOf(id);
return userService.findUserById(Id);
}
}
}
| [
"568792513@qq.com"
] | 568792513@qq.com |
8bd95ec36a041daeaeb7bc32e6dd7db7fc767066 | 3f5c0437489b129eaf48cd10bb139acac1555202 | /java_src/HarvestAlgorithm.java | 6994fb5b607fb3ad3241596c52632063e24b7254 | [] | no_license | pjsavola/doe | 41b897a310a0034d3441c381eb46b7f92d23766e | e7915f68232a547230aa1ce1d07527ed8ed9026f | refs/heads/master | 2021-01-20T18:33:43.125350 | 2017-07-16T18:55:46 | 2017-07-16T18:56:49 | 61,939,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,461 | java | import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class HarvestAlgorithm {
public static boolean isValid(final Set<Tile> selectedTiles, final Set<TownSite> townSites) {
final Map<TownSite, List<Tile>> matching = new HashMap<>();
for (final TownSite townSite : townSites) {
matching.put(townSite, new ArrayList<>());
}
for (final Tile tile : selectedTiles) {
final Set<TownSite> visited = new HashSet<>();
if (!bpm(tile, visited, matching)) {
return false;
}
}
return true;
}
private static boolean bpm(final Tile tile, final Set<TownSite> visited, final Map<TownSite, List<Tile>> matching) {
for (final TownSite neighbor : tile.getTownSites()) {
if (visited.add(neighbor)) {
final List<Tile> assigned = matching.get(neighbor);
if (assigned == null) {
// Town site does not belong to the player
continue;
}
if (assigned.size() < neighbor.size()) {
assigned.add(tile);
return true;
}
// Attempt re-assigning any of the already assigned sites
for (final Tile assignedTile : assigned) {
if (bpm(assignedTile, visited, matching)) {
assigned.remove(assignedTile);
assigned.add(tile);
return true;
}
}
}
}
return false;
}
}
| [
"petri@netcore.fi"
] | petri@netcore.fi |
f39f4149af21cdd767d8f6a46da632c5d42f5a6a | da711cbdfbf900c39b6d1c5ba168af0bcbd78058 | /app/src/test/java/com/binerid/imagegridview/ExampleUnitTest.java | 0932e12ec9a7e8d4105a10bc04ffed81856d4ae2 | [] | no_license | fauzighozali/ImageGridView | ec278cfba89c8c543bd1160cf217dc7f0abd7ba9 | 006253d37f4cc9e1fcb467f6dfd1a69f206ee834 | refs/heads/master | 2021-05-02T10:44:10.836959 | 2018-02-08T13:14:19 | 2018-02-08T13:14:19 | 120,762,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.binerid.imagegridview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"fauzighoozali18@gmail.com"
] | fauzighoozali18@gmail.com |
295c3e63b5b41d13dd929eec96d4476190b7ff6d | 4c550ddac09a854cae2d01ea27a2939012fc362c | /src/com/company/cherry.java | 5771fd377e4514c67b2d710543ed8f804030830f | [] | no_license | przeman90/laboratorium | ff03366e788bc0ed87db40371b544df90867e32e | 0f997348331714d983dbcd5047b1dd2d51b7be30 | refs/heads/main | 2023-03-31T04:01:26.927367 | 2021-03-28T10:11:39 | 2021-03-28T10:11:39 | 352,277,383 | 0 | 0 | null | 2021-03-28T10:11:40 | 2021-03-28T08:25:44 | Java | UTF-8 | Java | false | false | 47 | java | package com.company;
public class cherry {
}
| [
"przeman90@gmail.com"
] | przeman90@gmail.com |
f4c75d6ef9a5e4202bc01c4d44ff308ad01bb36b | 5752a92f29685b13a2e839ba85510953a08b48da | /BaseSmartFrame/src/com/basesmartframe/filecache/cache/DownloadListItems.java | e908bbf940fa5dd0240b71edadf3581daaf803c6 | [] | no_license | xieningtao/new_sflib | 3728054a79f9d4a2493ec2c0ff8d5681cdf97a32 | 0a301b7273e58caca5f24aebc5789c3966d2f70a | refs/heads/master | 2022-06-02T23:57:03.881868 | 2016-09-10T06:14:33 | 2016-09-10T06:14:33 | 47,156,546 | 2 | 0 | null | 2022-05-20T20:49:30 | 2015-12-01T01:13:39 | Java | UTF-8 | Java | false | false | 3,485 | java | package com.basesmartframe.filecache.cache;
import com.sf.utils.baseutil.SFBus;
import com.basesmartframe.filecache.BaseFileCacheMessage;
import com.sf.loglib.L;
import com.google.gson.Gson;
import com.sf.httpclient.core.AjaxParams;
import com.sflib.reflection.core.SFMsgId;
/**
* Created by xieningtao on 15-5-21.
*/
public class DownloadListItems<T> extends DownloadTask {
protected final RequestPullListEntity mEntity;
/**
* @param url
* @param entity
* @throws Exception if entity is null
*/
public DownloadListItems(String url, RequestPullListEntity entity) throws Exception {
super(url,null);
if (null == entity) {
throw new IllegalArgumentException("entity is null");
}
this.mEntity = entity;
}
public void excuteGet() {
realRunGet(mEntity.params);
}
public void excutePost() {
realRunPost(mEntity.params);
}
@Override
public void onResponse(boolean success, AjaxParams params, String response) {
Object result = null;
boolean isIncrement = false;
if (success) {
try {
Gson gson = new Gson();
result = gson.fromJson(response, mEntity.mResult);
if (null != result) {
isIncrement = isIncrement(response);
} else {
L.error(this, "result.data is null");
}
} catch (Exception e) {
L.error(TAG, "parse data fail : " + e);
}
}
ResponsePullListEntity responsePullListEntity = new ResponsePullListEntity.
ResponsePullListEntityBuilder(mEntity.type, success)
.setIncrement(isIncrement)
.setParams(params)
.builder();
sendResult(result, responsePullListEntity);
}
private void sendResult(Object result, ResponsePullListEntity responsePullListEntity) {
Class message_class = mEntity.mMessage;
if (message_class != null) {
try {
BaseFileCacheMessage message_instance = (BaseFileCacheMessage) message_class.newInstance();
message_instance.setResponsePullListEntity(responsePullListEntity);
message_instance.setResult(result);
SFBus.send(SFMsgId.CacheMessage.CACHE_MESSAGE_ID,message_instance);
} catch (InstantiationException e) {
e.printStackTrace();
//TODO
} catch (IllegalAccessException e) {
e.printStackTrace();
//TODO
}
} else {
//TODO
}
}
private Boolean isRelIncrement(String result) {
RequestPullListEntity.PaggingEvent paggingEvent = mEntity.mPaggingEvent;
if (null == paggingEvent) return false;
final int curOffset = paggingEvent.getOffSet(mEntity.params);
final int pageSize = paggingEvent.getPageSize(mEntity.params);
final int total = paggingEvent.getTotalPage(result);
final int curTotalNum = pageSize * curOffset;
return total > curTotalNum ? Boolean.TRUE : Boolean.FALSE;
}
protected boolean isIncrement(String result) {
boolean isIncrement = false;
if (null != result) {
isIncrement = isRelIncrement(result);
} else {
L.error(this, "result.data is null");
}
return isIncrement;
}
}
| [
"389124248@qq.com"
] | 389124248@qq.com |
2091b586715309db8fc2a1f263ed0730c622fd31 | 231b53cb10d326623ff6cbde0806260448452926 | /15-Jumlahkan-Tugas/Gabung.java | c4cc070f355a18451204db6d9bbd4bc75caf9578 | [] | no_license | RayhanYulanda/StrukturData-2015 | c6c6bc49ee64d85f469996c84babdcb27df74781 | 79600adf99422957736160a8a1c32dd937795f85 | refs/heads/master | 2021-01-10T16:14:43.334009 | 2016-01-11T16:44:26 | 2016-01-11T16:44:26 | 45,236,367 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java |
/**
* Write a description of class Gabung here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Gabung
{
private double data [];
private Kelompok [] kelompok = new Kelompok[5];
public Gabung(double data[])
{
this.data=data;
for (int i=0; i<5 ; i++){
int awal=(i*data.length/5);
int akhir=awal+((data.length/5)-1);
kelompok[i]=new Kelompok(awal,akhir,data);
}
Thread thread1 = new Thread(kelompok[0]);
Thread thread2 = new Thread(kelompok[1]);
Thread thread3 = new Thread(kelompok[2]);
Thread thread4 = new Thread(kelompok[3]);
Thread thread5 = new Thread(kelompok[4]);
thread1.start();
thread2.start();
thread3.start();
thread4.start();
thread5.start();
}
public double hasil()
{
try {
Thread.sleep(1000);
}
catch(InterruptedException e) {
}
double hasil=0;
for(int i=0;i<5;i++){
hasil=hasil+kelompok[i].hasil();
}
return hasil;
}
}
| [
"RayhanYulanda@gmail.com"
] | RayhanYulanda@gmail.com |
636278f27ca36262bec234f3bf2eb0fb8d5630a6 | 146a30bee123722b5b32c0022c280bbe7d9b6850 | /depsWorkSpace/bc-java-master/pg/src/main/java/org/mightyfish/openpgp/operator/bc/BcPGPContentVerifierBuilderProvider.java | 481e05bbb81c69b3b81c66dcbb0585e24e5aefb0 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | GLC-Project/java-experiment | 1d5aa7b9974c8ae572970ce6a8280e6a65417837 | b03b224b8d5028dd578ca0e7df85d7d09a26688e | refs/heads/master | 2020-12-23T23:47:57.341646 | 2016-02-13T16:20:45 | 2016-02-13T16:20:45 | 237,313,620 | 0 | 1 | null | 2020-01-30T21:56:54 | 2020-01-30T21:56:53 | null | UTF-8 | Java | false | false | 2,233 | java | package org.mightyfish.openpgp.operator.bc;
import java.io.OutputStream;
import org.mightyfish.crypto.Signer;
import org.mightyfish.openpgp.PGPException;
import org.mightyfish.openpgp.PGPPublicKey;
import org.mightyfish.openpgp.operator.PGPContentVerifier;
import org.mightyfish.openpgp.operator.PGPContentVerifierBuilder;
import org.mightyfish.openpgp.operator.PGPContentVerifierBuilderProvider;
public class BcPGPContentVerifierBuilderProvider
implements PGPContentVerifierBuilderProvider
{
private BcPGPKeyConverter keyConverter = new BcPGPKeyConverter();
public BcPGPContentVerifierBuilderProvider()
{
}
public PGPContentVerifierBuilder get(int keyAlgorithm, int hashAlgorithm)
throws PGPException
{
return new BcPGPContentVerifierBuilder(keyAlgorithm, hashAlgorithm);
}
private class BcPGPContentVerifierBuilder
implements PGPContentVerifierBuilder
{
private int hashAlgorithm;
private int keyAlgorithm;
public BcPGPContentVerifierBuilder(int keyAlgorithm, int hashAlgorithm)
{
this.keyAlgorithm = keyAlgorithm;
this.hashAlgorithm = hashAlgorithm;
}
public PGPContentVerifier build(final PGPPublicKey publicKey)
throws PGPException
{
final Signer signer = BcImplProvider.createSigner(keyAlgorithm, hashAlgorithm);
signer.init(false, keyConverter.getPublicKey(publicKey));
return new PGPContentVerifier()
{
public int getHashAlgorithm()
{
return hashAlgorithm;
}
public int getKeyAlgorithm()
{
return keyAlgorithm;
}
public long getKeyID()
{
return publicKey.getKeyID();
}
public boolean verify(byte[] expected)
{
return signer.verifySignature(expected);
}
public OutputStream getOutputStream()
{
return new SignerOutputStream(signer);
}
};
}
}
}
| [
"a.eslampanah@live.com"
] | a.eslampanah@live.com |
e2f1bbfcc2a44a153bc6aa57278ce0d48bb44b2e | 9863738e52fc6b869f688904d6231823f671cdcc | /java/josehp.java | a65d71614b48aa8c58a71c4f86a369f6d3937afc | [] | no_license | mihawkeyes/practice-pro | b5fedc9c16c921a1495441b57b397044beb2464f | c1db284f62fa037b70dfaf61e4ade11a2020c75e | refs/heads/master | 2023-06-23T22:08:41.335383 | 2021-07-21T11:04:45 | 2021-07-21T11:04:45 | 314,197,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | // java.util.*;
public class josehp{
static int jos(int n,int k)
{
if(n==1)
{
return 0;
}
else
{
return(jos(n-1,k)+k)%n;
}
}
public static void main(String[] args) {
int n=5,k=3;
System.out.println(jos(n,k));
}
} | [
"rutvikvachhani718@gmail.com"
] | rutvikvachhani718@gmail.com |
58f61d27f1249ad16e8ab262148e8a1af6f2d38a | 39bef83f3a903f49344b907870feb10a3302e6e4 | /Android Studio Projects/bf.io.openshop/src/android/support/v7/widget/ListPopupWindow$ForwardingListener$DisallowIntercept.java | 82f62e751d2f816642e074c62c8613204c6b80cc | [] | no_license | Killaker/Android | 456acf38bc79030aff7610f5b7f5c1334a49f334 | 52a1a709a80778ec11b42dfe9dc1a4e755593812 | refs/heads/master | 2021-08-19T06:20:26.551947 | 2017-11-24T22:27:19 | 2017-11-24T22:27:19 | 111,960,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package android.support.v7.widget;
private class DisallowIntercept implements Runnable
{
@Override
public void run() {
ForwardingListener.access$900(ForwardingListener.this).getParent().requestDisallowInterceptTouchEvent(true);
}
}
| [
"ema1986ct@gmail.com"
] | ema1986ct@gmail.com |
6eabaa4ae22882f8c7865830923e362a899b6953 | ad9d5c1f216039444c713f1e26fa05aa8e7bce60 | /src/main/java/net/mcreator/scriptor/ScriptorMod.java | b8947f1d92facb33742d7eaf511f352c3a8d8c33 | [] | no_license | shadowforce78/ScriptorMod | 43bd2ac3db7a993c234e5565dc80787a31eb1e21 | 3083bdf70e960a88458619c7c425dda18a48250d | refs/heads/master | 2023-06-01T01:05:39.099062 | 2021-06-28T18:17:21 | 2021-06-28T18:17:21 | 377,334,338 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,973 | java | /*
* MCreator note:
*
* If you lock base mod element files, you can edit this file and the proxy files
* and they won't get overwritten. If you change your mod package or modid, you
* need to apply these changes to this file MANUALLY.
*
* Settings in @Mod annotation WON'T be changed in case of the base mod element
* files lock too, so you need to set them manually here in such case.
*
* Keep the ScriptorModElements object in this class and all calls to this object
* INTACT in order to preserve functionality of mod elements generated by MCreator.
*
* If you do not lock base mod element files in Workspace settings, this file
* will be REGENERATED on each build.
*
*/
package net.mcreator.scriptor;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import net.minecraftforge.fml.network.simple.SimpleChannel;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.util.ResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.entity.EntityType;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.block.Block;
import java.util.function.Supplier;
@Mod("scriptor")
public class ScriptorMod {
public static final Logger LOGGER = LogManager.getLogger(ScriptorMod.class);
private static final String PROTOCOL_VERSION = "1";
public static final SimpleChannel PACKET_HANDLER = NetworkRegistry.newSimpleChannel(new ResourceLocation("scriptor", "scriptor"),
() -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals);
public ScriptorModElements elements;
public ScriptorMod() {
elements = new ScriptorModElements();
FMLJavaModLoadingContext.get().getModEventBus().register(this);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientLoad);
MinecraftForge.EVENT_BUS.register(new ScriptorModFMLBusEvents(this));
}
private void init(FMLCommonSetupEvent event) {
elements.getElements().forEach(element -> element.init(event));
}
public void clientLoad(FMLClientSetupEvent event) {
elements.getElements().forEach(element -> element.clientLoad(event));
}
@SubscribeEvent
public void registerBlocks(RegistryEvent.Register<Block> event) {
event.getRegistry().registerAll(elements.getBlocks().stream().map(Supplier::get).toArray(Block[]::new));
}
@SubscribeEvent
public void registerItems(RegistryEvent.Register<Item> event) {
event.getRegistry().registerAll(elements.getItems().stream().map(Supplier::get).toArray(Item[]::new));
}
@SubscribeEvent
public void registerEntities(RegistryEvent.Register<EntityType<?>> event) {
event.getRegistry().registerAll(elements.getEntities().stream().map(Supplier::get).toArray(EntityType[]::new));
}
@SubscribeEvent
public void registerEnchantments(RegistryEvent.Register<Enchantment> event) {
event.getRegistry().registerAll(elements.getEnchantments().stream().map(Supplier::get).toArray(Enchantment[]::new));
}
@SubscribeEvent
public void registerSounds(RegistryEvent.Register<net.minecraft.util.SoundEvent> event) {
elements.registerSounds(event);
}
private static class ScriptorModFMLBusEvents {
private final ScriptorMod parent;
ScriptorModFMLBusEvents(ScriptorMod parent) {
this.parent = parent;
}
@SubscribeEvent
public void serverLoad(FMLServerStartingEvent event) {
this.parent.elements.getElements().forEach(element -> element.serverLoad(event));
}
}
}
| [
"planque.adam@gmail.com"
] | planque.adam@gmail.com |
d749d6bcbfc1e9bb66a97e911c7bc4fb08aa94f4 | b8296b7173d044ba824d0d9a492aae89bb9924c9 | /Exercise03/app/src/main/java/com/example/anas/exercise03/Music.java | 4b6edf7cb3210b1c723fba0e714776f083208924 | [] | no_license | anas9244/mis-2017-exercise-3-sensors-context | 917caf415f150dd90f48ce35346e84bc1b52fea6 | 052c2e44995d78d33e496df39b0eba2dc12e9b22 | refs/heads/master | 2020-12-30T13:22:19.759698 | 2017-05-18T23:36:54 | 2017-05-18T23:36:54 | 91,211,931 | 0 | 0 | null | 2017-05-14T01:12:50 | 2017-05-14T01:12:50 | null | UTF-8 | Java | false | false | 7,996 | java | package com.example.anas.exercise03;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.io.IOException;
public class Music extends AppCompatActivity implements SensorEventListener, MediaPlayer.OnPreparedListener, android.location.LocationListener {
private SensorManager mSensorManager;
private Sensor mAccelerometer;
private MediaPlayer mediaPlayerJog, mediaPlayerBike;
private Button pickRunFile, pickBikeFile;
private TextView tSpeed;
private boolean buttonRun;
private LocationManager mLocationClient;
boolean runPressed;
int speed;
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_music);
mLocationClient = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
mLocationClient.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this);
// Init Media players for both activities
mediaPlayerJog = new MediaPlayer();
mediaPlayerBike = new MediaPlayer();
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
pickRunFile = (Button) findViewById(R.id.btnRun);
pickRunFile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
runPressed=true;
mediaPlayerJog.release();
mediaPlayerJog = new MediaPlayer();
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 10);
}
});
pickBikeFile = (Button) findViewById(R.id.btnBike);
pickBikeFile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonRun = false;
/*
Release and initialize Media Player every time the button is pressed in order to allow the user to change the song.
*/
mediaPlayerBike.release();
mediaPlayerBike = new MediaPlayer();
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 10);
}
});
textView= (TextView) findViewById(R.id.textView2);
}
@Override
public void onLocationChanged(Location location) {
// edit the speed when locationn changes, Speed is in Km per hour
if (location != null) {
speed = (int) ((location.getSpeed() * 3600) / 1000);
Log.d("Speed: ", String.valueOf(speed));
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
//Check if user is moving in the first plcae
if ((getAccelerometer(event) > 0.9 && getAccelerometer(event) < 1.1)) {
//not moving, then stop music
mediaPlayerBike.pause();
mediaPlayerJog.pause();
textView.setText("No music, GET MOVIN'!!");
} else {
//moving, then we use the speed detected from location to determine the activity
if (speed > 1.9 && speed <= 10) {
//running, Speed > 1.5 and <= 11 km/h
mediaPlayerBike.pause();
mediaPlayerJog.start();
textView.setText("Playing jogging track. Your speed "+ speed+" Km/h");
}
if (speed > 10 && speed <= 20) {
//cycling, Speed > 10 and <= 20 km/h
mediaPlayerJog.pause();
mediaPlayerBike.start();
textView.setText("Playing cycling track. Your speed "+ speed+" Km/h");
}
if (speed > 20) {
// in a moving vehicle
mediaPlayerBike.pause();
mediaPlayerJog.pause();
textView.setText("No need for music, you'r in car");
}
}
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
private void playRun(Context context, Uri uri) {
try {
mediaPlayerJog.setDataSource(context, uri);
mediaPlayerJog.setOnPreparedListener(this);
mediaPlayerJog.prepareAsync();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void playBike(Context context, Uri uri) {
try {
mediaPlayerBike.setDataSource(context, uri);
mediaPlayerBike.setOnPreparedListener(this);
mediaPlayerBike.prepareAsync();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
mp.pause();
}
public double getAccelerometer(SensorEvent event) {
float[] values = event.values;
// Movement
float x = values[0];
float y = values[1];
float z = values[2];
//Log.d("Values", "x: " + x + " y: " + y + " z: " + z);
float accelerationSQRT = (float) ((x * x + y * y + z * z)
/ (9.8 * 9.8));
return Math.sqrt(accelerationSQRT);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == 10) {
Uri uriSound = data.getData();
if (buttonRun)
playRun(this, uriSound);
else
playBike(this, uriSound);
}
}
}
| [
"anas9244@hotmail.com"
] | anas9244@hotmail.com |
c93e4ea67579ff7c1bf6355f7600f421e5ccc42c | 63686942df1e1e8b3bb6545f6ea68ca846adc19a | /app/src/main/java/tylorgarrett/xyz/twistedtipper/MainActivity.java | b67d0d9a5fc0e42c82d17c035fe95bcfcfacf570 | [] | no_license | garr741/TwistedTipper | 738cb1d31750e5c1fd0a70dcfe858ba18bfa5d46 | 4bff52521e79549514761cfee06656e34318b1c8 | refs/heads/master | 2021-05-01T01:13:05.117138 | 2016-09-09T01:06:32 | 2016-09-09T01:06:32 | 67,752,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package tylorgarrett.xyz.twistedtipper;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"tylorgarrett@gmail.com"
] | tylorgarrett@gmail.com |
dbff05832ab5c2a8f7d6c12b2870df68de8ead0f | 9cd7569e22faac1aab44f93478879f1e3f8ad2b0 | /gogo-start/src/main/java/com/lhj/gogo/start/SampleWebFreeMarkerApplication.java | 1c907caa57f0767903e62c6ee3ef4625ba997d7c | [] | no_license | heartlhj/spring-boot-mybatis | 1c4c76fda4314c038020b3825682f13f0634ca20 | c87f1d8560ff4f258a82590d994261aa8c52cc1c | refs/heads/master | 2018-08-29T11:57:22.404427 | 2018-06-03T14:38:49 | 2018-06-03T14:43:01 | 117,174,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,943 | java | /*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.lhj.gogo.start;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
@Configuration
@ServletComponentScan
@SpringBootApplication
@ImportResource("classpath:dubbo.xml")
@MapperScan("com.lhj.gogo.**.dao")
@PropertySource(value = { "classpath:env.properties","classpath:httpclient.properties" })
@ComponentScan(basePackages = "com.lhj.gogo")
public class SampleWebFreeMarkerApplication extends SpringBootServletInitializer{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(SampleWebFreeMarkerApplication.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWebFreeMarkerApplication.class, args);
}
}
| [
"75449@LAPTOP-UQITVP5U"
] | 75449@LAPTOP-UQITVP5U |
d7ae66e8b68f8751b9fcda8d390c7e9c6cc793fa | 25dd102dc1816f3009a17a54f61277947018dce4 | /src/main/java/com/ritesh/movierental/Movie.java | d71564c8fb9d73a4b47e2bad436b6428950301cf | [] | no_license | ritesh705/clean-code | 10963159ae815963a707a1697842fb9200500d37 | 4004c62d1d6cdb796aa8403639e59c91b57624fb | refs/heads/master | 2020-05-24T17:29:13.044369 | 2019-07-28T09:42:08 | 2019-07-28T09:42:08 | 187,387,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,575 | java | package com.ritesh.movierental;
public class Movie
{
public static final int CHILDRENS = 2;
public static final int REGULAR = 0;
public static final int NEW_RELEASE = 1;
public static final int REGULAR_MOVIE_RATE = 2;
public static final int REGULAR_MOVIE_THRESHOLD_DAYS = 2;
private String title;
private int priceCode;
public Movie(String title, int priceCode)
{
this.title = title;
this.priceCode = priceCode;
}
public int getPriceCode()
{
return priceCode;
}
public void setPriceCode(int arg) {
priceCode = arg;
}
public String getTitle()
{
return title;
}
boolean isNewRelease()
{
return this.getPriceCode() == NEW_RELEASE;
}
double amount(int daysRented)
{
double currentRentalAmount = 0;
switch (this.getPriceCode())
{
case REGULAR:
currentRentalAmount = new RegularMovieCalculator().amount(daysRented, currentRentalAmount);
break;
case NEW_RELEASE:
currentRentalAmount = new NewMovieCalculator().amount(daysRented, currentRentalAmount);
break;
case CHILDRENS:
currentRentalAmount = new ChildrenMovieCalculator().amount(daysRented, currentRentalAmount);
break;
}
return currentRentalAmount;
}
boolean isBonusApplicable(int daysRented)
{
return isNewRelease()
&& daysRented > 1;
}
public int frequentRenterPoints(int daysRented)
{
int frequentRenterPoints = 1;
if (isBonusApplicable(daysRented))
frequentRenterPoints++;
return frequentRenterPoints;
}
}
| [
"ritesh705@gmail.com"
] | ritesh705@gmail.com |
17ffceaeb39cbd5b0ba15ed7b3f75baeeb303921 | c3ac8acb072a54f49c6fa0f7b9880e59efb642ed | /HSTest/app/src/main/java/com/example/windows_7/hstest/io/response/ValidateUserResponse.java | 1d8e2a4bb94c02e746e6a11f48bf147eebf32ddf | [] | no_license | jonathanTaberna/AndroidStudioProjects | 696257058eeecf15bf56b7967e037ecf96da0ae7 | a495f183c40f7d35e35a7e8af292dd80fe20d298 | refs/heads/master | 2021-07-25T21:45:10.685834 | 2020-04-15T12:00:21 | 2020-04-15T12:00:21 | 141,704,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.example.windows_7.hstest.io.response;
import com.example.windows_7.hstest.model.User;
import com.google.gson.annotations.Expose;
public class ValidateUserResponse {
@Expose
private Integer salida;
private User usuario;
private String msj;
public Integer getSalida() { return salida; }
public User getUsuario() { return usuario; }
public String getMsj() { return msj; }
}
| [
"hellsing952@gmail.com"
] | hellsing952@gmail.com |
14db238c531a578e07432fe1896db63e82b42a03 | 7eb9582ba37787a3d9a41b58da728ae8f1a5570e | /src/main/java/com/v2maestros/spark/bda/common/SparkConnection.java | 76d237d0a442be29391e5fddc1c5ad576f110ec1 | [] | no_license | manojbhosale/sparkDemo | 78caabca2cfba6130f36640801409b87fcf04d99 | 2c0748b981ac2607814a96bfa1c83ef387012c69 | refs/heads/master | 2020-03-19T01:11:55.713074 | 2018-05-31T03:55:52 | 2018-05-31T03:55:52 | 135,529,119 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,916 | java | /** File provided by V2 Maestros for its students for education purposes only
* Copyright @2016 All rights reserved.
*/
package com.v2maestros.spark.bda.common;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.sql.SparkSession ;
import java.util.List;
import org.apache.spark.SparkConf;
public class SparkConnection {
//A name for the spark instance. Can be any string
private static String appName = "V2 Maestros";
//Pointer / URL to the Spark instance - embedded
private static String sparkMaster = "local[2]";
private static JavaSparkContext spContext = null;
private static SparkSession sparkSession = null;
private static String tempDir = "file:///C:/Manoj/Progamming/MachineLearning/Udemy/Spark_Java/spark-warehouse";
private static void getConnection() {
if ( spContext == null) {
//Setup Spark configuration
SparkConf conf = new SparkConf()
.setAppName(appName)
.setMaster(sparkMaster);
//Make sure you download the winutils binaries into this directory
//from https://github.com/srccodes/hadoop-common-2.2.0-bin/archive/master.zip
System.setProperty("hadoop.home.dir", "C:\\Manoj\\Progamming\\MachineLearning\\Udemy\\Spark_Java\\winUtils\\hadoop-common-2.2.0-bin-master");
//Create Spark Context from configuration
spContext = new JavaSparkContext(conf);
sparkSession = SparkSession
.builder()
.appName(appName)
.master(sparkMaster)
.config("spark.sql.warehouse.dir", tempDir)
.getOrCreate();
}
}
public static JavaSparkContext getContext() {
if ( spContext == null ) {
getConnection();
}
return spContext;
}
public static SparkSession getSession() {
if ( sparkSession == null) {
getConnection();
}
return sparkSession;
}
}
| [
"manoj.bhosale31@gmail.com"
] | manoj.bhosale31@gmail.com |
05f81c473dc1df261194c5c504e74e5d249851ad | 024432535e7e7a1c0699e2d70f70450d7c5428a2 | /rx_test/src/main/java/com/sky/test/net/Urls.java | d85292a65bc8942265bf9b2a403b249e983324b4 | [] | no_license | paperscz/LazyCat | a5b400dcde66ae6df5d96bd80ba5b3889a1ed0cf | 70d877a740e1d929137e44f31cd9ee3252bf92fd | refs/heads/master | 2020-04-13T03:33:03.614360 | 2018-12-21T03:07:08 | 2018-12-21T03:07:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package com.sky.test.net;
/**
* 类名称:
* 类功能:
* 类作者:Administrator
* 类日期:2018/12/11 0011.
**/
public class Urls {
// 干货集中营base
public static final String GANK_API_BASE = "http://gank.io/api/";
}
| [
"zk827083320@qq.com"
] | zk827083320@qq.com |
eb582229a76e564af40f773500710435cd78ac2f | e39ccbd083c289f1a9d23dab2beeca79ea1b1ff3 | /src/animals/Heart.java | ed80bb879626d395e75df4c298317fd4b9b5e910 | [] | no_license | juanalbarracinprados/java_martin | 18c97c0c95a7035cc9294527948a58e6b3a42003 | bb009548d9dca871104e980144fd529863e68ce4 | refs/heads/master | 2023-06-03T03:08:52.959346 | 2021-06-15T17:18:21 | 2021-06-15T17:18:21 | 377,228,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package animals;
final class Heart {
public int bpm;
Heart(int bpm) {
this.bpm = bpm;
}
void beat() {
this.bpm++;
}
} | [
"juan.albarracin@prokom.es"
] | juan.albarracin@prokom.es |
7e9965907b6ef20c6f30549cbbdc5e4477b68311 | b7762f1540d79a82ec41aac083ce48d15689bc21 | /blades-dal/src/main/java/com/iusofts/blades/sys/dao/UserOrgMapper.java | 7c29661f6083af00845fd24e11d16f7483d70a78 | [] | no_license | iusofts/blades-dev | be12f86a7fbe65ea99f51a9fae5b0a877254cd40 | adb54df55f1d6b7f078077dc8891ac8496e03db1 | refs/heads/master | 2021-06-17T01:05:35.707018 | 2017-05-16T06:18:19 | 2017-05-16T06:18:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package com.iusofts.blades.sys.dao;
import com.iusofts.blades.sys.model.UserOrgExample;
import com.iusofts.blades.sys.model.UserOrg;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface UserOrgMapper {
int countByExample(UserOrgExample example);
int deleteByExample(UserOrgExample example);
int deleteByPrimaryKey(String id);
int insert(UserOrg record);
int insertSelective(UserOrg record);
List<UserOrg> selectByExample(UserOrgExample example);
UserOrg selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") UserOrg record, @Param("example") UserOrgExample example);
int updateByExample(@Param("record") UserOrg record, @Param("example") UserOrgExample example);
int updateByPrimaryKeySelective(UserOrg record);
int updateByPrimaryKey(UserOrg record);
/**
* 根据用户ID获取用户岗位信息
*
* @param uid
* @return
* @author:Ivan
* @date:2016年3月7日 下午5:30:19
*/
List<Map<String, String>> selectByUid(String uid);
/**
*
* 描述:根据用户id批量删除
*
* @param userIds
* @return
* @author Asker_lve
* @date 2016年3月10日 下午2:40:59
*/
int deleteByUserIds(@Param("userIds")List<String> userIds);
/**
*
* 描述: 根据用户id删除
* @param userId
* @return
* @author Asker_lve
* @date 2016年3月10日 下午2:58:22
*/
int deleteByUserId(@Param("userId") String userId);
} | [
"iusoft@sina.com"
] | iusoft@sina.com |
71c94c3f4c277491198637b54359e4c317a84f4f | 54bfdbe6c1a249f00f87cafacccb65f8a32d40fc | /dspace-server-webapp/src/main/java/org/dspace/app/rest/model/IdentifierRest.java | 6cfb147ea3141fe2aff2b227891b97e188765cda | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"MPL-1.0",
"W3C",
"GPL-1.0-or-later",
"LicenseRef-scancode-unicode",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"CDDL-1.0",
"MIT",
"Apache-2.0",
"JSON",
"EPL-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unicode-icu-58"
] | permissive | 4Science/DSpace | 55fb70023af8e742191b3f6dd0a06a061bc8dfc9 | 0c4ee1a65dca7b0bc3382c1a6a642ac94a0a4fba | refs/heads/dspace-cris-7 | 2023-08-16T05:22:17.382990 | 2023-08-11T10:00:00 | 2023-08-11T10:00:00 | 63,231,221 | 43 | 96 | BSD-3-Clause | 2023-09-08T15:54:48 | 2016-07-13T09:02:10 | Java | UTF-8 | Java | false | false | 3,267 | java | /**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.rest.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.dspace.app.rest.RestResourceController;
/**
* Implementation of IdentifierRest REST resource, representing some DSpace identifier
* for use with the REST API
*
* @author Kim Shepherd <kim@shepherd.nz>
*/
public class IdentifierRest extends BaseObjectRest<String> implements RestModel {
// Set names used in component wiring
public static final String NAME = "identifier";
public static final String PLURAL_NAME = "identifiers";
private String value;
private String identifierType;
private String identifierStatus;
// Empty constructor
public IdentifierRest() {
}
/**
* Constructor that takes a value, type and status for an identifier
* @param value the identifier value eg. https://doi.org/123/234
* @param identifierType identifier type eg. doi
* @param identifierStatus identifier status eg. TO_BE_REGISTERED
*/
public IdentifierRest(String value, String identifierType, String identifierStatus) {
this.value = value;
this.identifierType = identifierType;
this.identifierStatus = identifierStatus;
}
/**
* Return name for getType() - this is the section name
* and not the type of identifier, see: identifierType string
* @return
*/
@Override
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
public String getType() {
return NAME;
}
@Override
public String getTypePlural() {
return PLURAL_NAME;
}
/**
* Get the identifier value eg full DOI URL
* @return identifier value eg. https://doi.org/123/234
*/
public String getValue() {
return value;
}
/**
* Set the identifier value
* @param value identifier value, eg. https://doi.org/123/234
*/
public void setValue(String value) {
this.value = value;
}
/**
* Get type of identifier eg 'doi' or 'handle'
* @return type string
*/
public String getIdentifierType() {
return identifierType;
}
/**
* Set type of identifier
* @param identifierType type string eg 'doi'
*/
public void setIdentifierType(String identifierType) {
this.identifierType = identifierType;
}
/**
* Get status of identifier, if relevant
* @return identifierStatus eg. null or TO_BE_REGISTERED
*/
public String getIdentifierStatus() {
return identifierStatus;
}
/**
* Set status of identifier, if relevant
* @param identifierStatus eg. null or TO_BE_REGISTERED
*/
public void setIdentifierStatus(String identifierStatus) {
this.identifierStatus = identifierStatus;
}
@Override
public String getCategory() {
return "pid";
}
@Override
public String getId() {
return getValue();
}
@Override
public Class getController() {
return RestResourceController.class;
}
}
| [
"kim@shepherd.nz"
] | kim@shepherd.nz |
d38e23a9847568bffb690c7844e69088d00d3c39 | 2294d375c2d28c74447cdfeb5f452d74ec6f9a28 | /dungeoncrawler/src/main/java/whatexe/dungeoncrawler/entities/behavior/overlap/ItemCaseOverlapBehavior.java | 3d1b242326c65ae09f9865015c4a00f36478e2ab | [] | no_license | Russell-Newton/NotMalware-Game | f035f1341b45e514a5b50db92e12d478d5d52321 | 5e30eecfeaacb7546df5bb8b10acdc7d65906dcc | refs/heads/master | 2023-07-18T07:41:39.489150 | 2021-04-27T02:36:21 | 2021-04-27T02:36:21 | 399,507,704 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package whatexe.dungeoncrawler.entities.behavior.overlap;
import whatexe.dungeoncrawler.entities.Entity;
import whatexe.dungeoncrawler.entities.items.Item;
import whatexe.dungeoncrawler.entities.player.Player;
import java.util.List;
public class ItemCaseOverlapBehavior extends OverlapBehavior<Item> {
public ItemCaseOverlapBehavior(Item owningEntity) {
super(owningEntity);
}
@Override
public void handleOverlap(Entity otherEntity) {
Player other = (Player) otherEntity;
if (!other.isInventoryFull()) {
if (other.getMoney() >= owningEntity.getPrice()) {
owningEntity.getOwningRoom().removeEntity(owningEntity);
owningEntity.setEntityPosition(0, 0);
other.addItem(owningEntity);
other.adjustMoney(-owningEntity.getPrice());
}
}
}
@Override
public List<? extends Entity> getPossibleOverlapTargets() {
if (owningEntity.getOwningRoom().getPlayer() != null
&& owningEntity.getNoPickupTimer() == 0) {
return List.of(owningEntity.getOwningRoom().getPlayer());
}
return List.of();
}
}
| [
"gchen337@gatech.edu"
] | gchen337@gatech.edu |
56d07c37c8159f73a723129c9135962c81116d88 | 11c4237370e98f6acb97965b1ada63acd1a021a9 | /Genetik-Springboot/src/main/java/sopra/formation/repository/IParametresGenetiquesRepository.java | 692039820871195569ebfdd0b42e415b8ade49a3 | [] | no_license | Granscythe/Genetik-Final | a8bc08446e437a15aeb87cfd0864080a2b347151 | 368927b0e521cd1c411bfd19e617d452ac04d226 | refs/heads/main | 2023-07-17T08:19:20.475118 | 2021-08-19T15:16:31 | 2021-08-19T15:16:31 | 397,878,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 255 | java | package sopra.formation.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import sopra.formation.model.ParametresGenetiques;
public interface IParametresGenetiquesRepository extends JpaRepository<ParametresGenetiques, Long>{
}
| [
"pierre.grandcoin@gadz.org"
] | pierre.grandcoin@gadz.org |
987e93038c0c429d05d6073d5aea00b50a0aa190 | 94c838307292a417a27d0fd9a9c3fa1f1100bf89 | /src/main/java/com/haotian/controller/UserspaceController.java | e4e62d0895e1c8425de4f6b4068ec7acb847f850 | [] | no_license | haotianya/spring-boot-blog | e99a60df0a9c8c72358144fe21c8b47b77dcd66f | 0621096facb1e57ce011f685f41ca2f642aa4e17 | refs/heads/master | 2020-04-17T17:23:26.249992 | 2019-01-21T08:53:12 | 2019-01-21T08:53:12 | 166,780,460 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package com.haotian.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.haotian.service.UserService;
@RestController
@RequestMapping("/u")
public class UserspaceController {
@Autowired
private UserService userService;
@GetMapping("/{username}")
public ModelAndView toBlog(@PathVariable("username")String username){
return new ModelAndView("userspace/blog.html");
}
}
| [
"hao@qq.com"
] | hao@qq.com |
4c79f647128171b8f8d9952765eb34738211d672 | f4b9031798dd84fdc4c3b5d74914db43f951fd9a | /Zettelkasten/app/src/main/java/space/lopstory/zettelkasten/Helper.java | d2f9d4795ef959fe2cf4f45f634a2652892b47f3 | [] | no_license | NikitaVladimirov2003/Samsung | 4fb7dd773b17c8423e7041386a357add6290d96c | bb54a4986b76b81d205ac0efb7e4ebd8e409601f | refs/heads/main | 2023-05-07T06:01:09.165134 | 2021-05-28T18:14:31 | 2021-05-28T18:14:31 | 295,140,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,827 | java | package space.lopstory.zettelkasten;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.provider.Settings;
import android.telephony.CellSignalStrength;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ThrowOnExtraProperties;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.EventListener;
import space.lopstory.zettelkasten.NoteData.Note;
public class Helper {
public static Context context;
public static void flush( String strHead, String strContent){
String[] params = new String[] { strHead,strContent};
MyAsyncTask myAsyncTask = new MyAsyncTask();
myAsyncTask.execute( params );
}
private static class MyAsyncTask extends AsyncTask<String, Void, Void>{
private static DatabaseReference myDataBase = FirebaseDatabase.getInstance().getReference().child(constant.User).child(constant.Email);
private Integer GlobalNoteID;
private static ArrayList<String> convert_tags(String strContent){
ArrayList<String> tags = new ArrayList<>();
String words[] = strContent.replace( '\n', ' ' ).split( " " );
for(String s : words){
if(s.charAt( 0 ) == '#'){
s = s.replace( '.',' ' );
s = s.replace( "#", "" );
s = s.toLowerCase();
tags.add( s );
}
}
return tags;
}
@Override //TODO
protected Void doInBackground(String... strings) {
myDataBase.child( constant.GlobalNoteID ).get().addOnCompleteListener( new OnCompleteListener<DataSnapshot>() {
@Override
public void onComplete(@NonNull Task<DataSnapshot> task) {
if(task.isSuccessful() && task.getResult().getValue(Integer.class) != null)
GlobalNoteID = task.getResult().getValue(Integer.class).intValue();
else {
myDataBase.child( constant.GlobalNoteID ).setValue( 1 );
GlobalNoteID = 1;
}
//Todo
String strHead = strings[0],
strContent = strings[1];
ArrayList<String> tags = convert_tags( strContent );
Note newNote = new Note(GlobalNoteID, strHead,strContent );
myDataBase.child( constant.notes ).push().setValue( newNote );
for(String tag : tags) {
if (tag.equals( "" )) {
myDataBase.child( constant.tags ).child( "EmptyTag" ).child( constant.id ).push().setValue(GlobalNoteID );
} else {
myDataBase.child( constant.tags ).child( tag.trim() ).push().setValue(GlobalNoteID );
}
}
GlobalNoteID++;
myDataBase.child( constant.GlobalNoteID ).setValue( GlobalNoteID );
}
} );
return null;
}
@Override
protected void onPreExecute() {
Toast.makeText( context,"Saving" , Toast.LENGTH_SHORT).show();
}
@Override
protected void onPostExecute(Void aVoid) { }
}
}
| [
"krakazabratnikita@mail.ru"
] | krakazabratnikita@mail.ru |
968e6e01cb0f02b30b817fba0699abc9bfe7ff35 | 68f8e95c8e3b8bbd6b5458e3adcde0bb8a4e15bc | /VOPServer.java | a9d5034871b53b159b4a4e038f38d3bd1abd37f5 | [] | no_license | ronidee/ViewOnPhone | 50d95aae7737ab59932cf85ef177f5817d08ea29 | c51b75ec514568dc8a0aafb406ec11bc6fb700f7 | refs/heads/master | 2021-07-17T15:25:52.359676 | 2017-10-25T00:55:15 | 2017-10-25T00:55:15 | 108,201,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,664 | java | package ronidea.viewonphone;
import android.app.KeyguardManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.os.StrictMode;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Random;
/**
* TCP server that accepts links and openes them
*/
public class VOPServer extends Service {
final static String REQUEST_DISCONNECT = "RQ_DC";
TCPServer server;
private static boolean isRunning = false;
Thread serverThread;
PhoneUnlockedReceiver unlockListener;
@Override
public void onCreate() {
Log.d("VOPServer", "onCreate()");
unlockListener = new PhoneUnlockedReceiver(this);
serverThread = new Thread(r_server);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
Log.d("VOPServer", "onStartCommand()");
new Prefs(this);
// the server could maybe started twice accidentally. So make sure
// the thread is only launched once.
if (isRunning) {
stopSelf();
return START_STICKY;
}
serverThread.start();
isRunning = true;
registerReceiver(unlockListener, new IntentFilter("android.intent.action.USER_PRESENT"));
VOPUtils.disableNougatFileRestrictions();
return START_STICKY;
}
private Runnable r_server = new Runnable() {
@Override
public void run() {
String input;
server = new TCPServer();
while (isRunning) {
try {
/* RECEIVING INPUT */
server.waitForClient(); // wait for a client to connect
if (serverThread.isInterrupted()) break; // if thread is interrupted exit loop
input = server.getInputLine(); // get the input from that client
input = VOPUtils.decrypt(input); // decrypt the input
/* HANDLING THE INPUT */
// shortest possible input: $PW$1234€PW€$URL$www.x.x€URL€ (29 chars)
// so this acts as an early filter
if (input != null && input.length() >= 29) {
processInput(input);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
private void processInput(String input) {
// create dropping object
Dropping dropping;
// generate dropping object from server input
dropping = VOPUtils.unwrapDelivery(input);
Log.d("VOPServer r_server", "dropped: " + dropping.getURL());
// validate password
if (dropping.getPw().equals(Prefs.getPassword())) {
// save the clients IPAddress for both-side communication
Prefs.saveString(Prefs.KEY_IP_ADR, server.getConnectedIPAddress());
switch (dropping.getType()) {
// TYPE_NULL = input from computer wasn't valid
case Dropping.TYPE_NULL:
Log.d("VOPServer", "input invalid: " + input);
break;
// TYPE_URL = an URL was sent to be opened on the phone
case Dropping.TYPE_URL:
VOPUtils.openUrl(dropping.getURL(), this);
break;
// TYPE_IMG = an IMG was sent to be opened on the phone
case Dropping.TYPE_IMG:
String filepath = VOPUtils.saveImage(dropping.getImage());
VOPUtils.openImg(filepath, this);
break;
}
}
}
// get the status of this service
static boolean isRunning() {
return isRunning;
}
@Override
public IBinder onBind(Intent intent) {
//We don't want to bind
return null;
}
@Override
public void onDestroy() {
Log.d("VOPServer", "closed");
unregisterReceiver(unlockListener); // unregister the unlockListener
serverThread.interrupt(); // stopping the server manually (just in case ...)
server.close(); // close the server
isRunning = false; // updating the service's status
}
} | [
"roni-96@live.de"
] | roni-96@live.de |
0d284cad7eb10d14505f54666663996d360929af | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/java-msf4j/generated/src/gen/java/org/openapitools/model/ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties.java | 4a308d8883d80c70573d5aaa4c8421f5d39918f0 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | Java | false | false | 2,337 | java | package org.openapitools.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.model.ConfigNodePropertyArray;
/**
* ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaMSF4JServerCodegen", date = "2019-08-05T00:54:29.762Z[GMT]")
public class ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties {
@JsonProperty("hc.tags")
private ConfigNodePropertyArray hcTags = null;
public ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties hcTags(ConfigNodePropertyArray hcTags) {
this.hcTags = hcTags;
return this;
}
/**
* Get hcTags
* @return hcTags
**/
@ApiModelProperty(value = "")
public ConfigNodePropertyArray getHcTags() {
return hcTags;
}
public void setHcTags(ConfigNodePropertyArray hcTags) {
this.hcTags = hcTags;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties comAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties = (ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties) o;
return Objects.equals(this.hcTags, comAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties.hcTags);
}
@Override
public int hashCode() {
return Objects.hash(hcTags);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties {\n");
sb.append(" hcTags: ").append(toIndentedString(hcTags)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"cliffano@gmail.com"
] | cliffano@gmail.com |
8e2edc82dd45ad0acc0da9f9f0d5595dd4339d98 | c2117e863c8159af4a0506ac90425bf6ccf24933 | /src/main/java/com/ajman/utils/AjaxFilter.java | 930b73c59af04e48e668410d738834ce4ed23a65 | [] | no_license | GoodAjman/ajmanShop | b79b7e4b2662da8a476eadd506c3e31dbf8853b5 | 3e58af0223a6c719d4ab469f001f6131fd1d8d1f | refs/heads/master | 2022-12-30T21:44:28.760085 | 2020-09-06T02:43:27 | 2020-09-06T02:43:27 | 245,779,166 | 0 | 0 | null | 2022-12-16T06:23:54 | 2020-03-08T08:36:40 | Java | UTF-8 | Java | false | false | 1,245 | java | package com.ajman.utils;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class AjaxFilter implements Filter {
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
//禁止首页访问
String url = request.getRequestURI();
if("/".equals(url)){
return;
}
// 指定允许其他域名访问
response.setHeader("Access-Control-Allow-Origin", "*");
// 响应类型
response.setHeader("Access-Control-Allow-Methods", "POST, GET, DELETE, OPTIONS, DELETE");
// 响应头设置
response.setHeader("Access-Control-Allow-Headers", "Content-Type, x-requested-with, X-Custom-Header, HaiYi-Access-Token");
chain.doFilter(req, res);
}
@Override
public void init(FilterConfig arg0) throws ServletException {
}
} | [
"1473606179@qq.com"
] | 1473606179@qq.com |
ca038d6cbf9b90908e8a89a7ac357f01b7734daa | c9f808b3316a96a4d0a1555a36d6ec47ccb8fd9b | /src/com/javahis/ui/sys/SysFeeExaSheetQuote.java | 6b840877ccce9139bb2bdeb2dde305ee7de22864 | [] | no_license | levonyang/proper-his | f4c19b4ce46b213bf637be8e18bffa3758c64ecd | 2fdcb956b0c61e8be35e056d52a97d4890cbea3f | refs/heads/master | 2022-01-05T09:17:14.716629 | 2018-04-08T01:04:21 | 2018-04-08T01:04:21 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,366 | java | package com.javahis.ui.sys;
import jdo.sys.SYSRuleTool;
import com.dongyang.control.TControl;
import com.dongyang.data.TParm;
import com.dongyang.jdo.TJDODBTool;
import com.dongyang.ui.TTable;
import com.dongyang.util.RunClass;
import com.dongyang.util.TypeTool;
/**
*
* <p>Title: 引用表单控制类</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2008</p>
*
* <p>Company: JavaHis</p>
*
* @author ehui 2009.05.11
* @version 1.0
*/
public class SysFeeExaSheetQuote extends TControl {
TTable table;
Object main;
/**
* 初始化
*/
public void onInit() {
super.onInit();
getInitParameter();
initTable();
}
/**
* 初始化TABLE
*/
public void initTable(){
TParm t0=SYSRuleTool.getExaRoot();
String tCode=t0.getValue("CATEGORY_CODE",0);
TParm t1=SYSRuleTool.getExaMid(tCode);
table=(TTable)this.getComponent("MENU");
table.setParmValue(t1);
int count=t1.getCount();
String[] names=t1.getNames();
TParm t2=new TParm();
for(int i=0;i<count;i++){
TParm temp=SYSRuleTool.getExaDetail(t1.getValue("CATEGORY_CODE",i));
int countTemp=temp.getCount();
for(int k=0;k<countTemp;k++){
for(int j=0;j<names.length;j++){
t2.addData(names[j], temp.getValue(names[j],k));
}
}
}
table.setParmValue(t2);
}
/**
* 行点击事件
*/
public void onClick(){
int row=table.getSelectedRow();
TParm tableParm=table.getParmValue();
String code="'"+tableParm.getValue("CATEGORY_CODE",row)+"%'";
TParm sysFee=this.queryExa(code);
int count=sysFee.getCount();
TParm parm1=new TParm();
TParm parm2=new TParm();
String[] names=sysFee.getNames();
for(int i=0;i<count;i+=2){
if(i>=count)
break;
for(int j=0;j<names.length;j++){
parm1.addData(names[j], sysFee.getValue(names[j],i));
}
}
for(int i=1;i<count;i+=2){
if(i>=count)
break;
for(int j=0;j<names.length;j++){
parm2.addData(names[j], sysFee.getValue(names[j],i));
}
}
//System.out.println("parm1========"+parm1);
//System.out.println("parm2========"+parm2);
TTable table1=(TTable)this.getComponent("TABLE1");
TTable table2=(TTable)this.getComponent("TABLE2");
table1.setParmValue(parm1);
table2.setParmValue(parm2);
}
/**
*
* @param code String
* @return 查询sys_fee
*/
public TParm queryExa(String code){
String sql=
"SELECT 'N' AS EXEC ,ORDER_CODE,ORDER_DESC,PY1,PY2," +
" SEQ,DESCRIPTION,TRADE_ENG_DESC,GOODS_DESC,GOODS_PYCODE," +
" ALIAS_DESC,ALIAS_PYCODE,SPECIFICATION,NHI_FEE_DESC,HABITAT_TYPE," +
" MAN_CODE,HYGIENE_TRADE_CODE,ORDER_CAT1_CODE,CHARGE_HOSP_CODE,OWN_PRICE,NHI_PRICE," +
" GOV_PRICE,UNIT_CODE,LET_KEYIN_FLG,DISCOUNT_FLG,EXPENSIVE_FLG," +
" OPD_FIT_FLG,EMG_FIT_FLG,IPD_FIT_FLG,HRM_FIT_FLG,DR_ORDER_FLG," +
" INTV_ORDER_FLG,LCS_CLASS_CODE,TRANS_OUT_FLG,TRANS_HOSP_CODE,USEDEPT_CODE," +
" EXEC_ORDER_FLG,EXEC_DEPT_CODE,INSPAY_TYPE,ADDPAY_RATE,ADDPAY_AMT," +
" NHI_CODE_O,NHI_CODE_E,NHI_CODE_I,CTRL_FLG,CLPGROUP_CODE," +
" ORDERSET_FLG,INDV_FLG,SUB_SYSTEM_CODE,RPTTYPE_CODE,DEV_CODE," +
" OPTITEM_CODE,MR_CODE,DEGREE_CODE,CIS_FLG,OPT_USER," +
" OPT_DATE,OPT_TERM,CAT1_TYPE " +
" FROM SYS_FEE " +
" WHERE ORDER_CODE LIKE " +code;
//System.out.println("SQL=============="+sql);
TParm result = new TParm(TJDODBTool.getInstance().select(sql));
//System.out.println("RESULT==============="+result);
return result;
}
/**
* 回传事件
*/
public void onFetchBack(String tableName){
TTable table=(TTable)this.getComponent(tableName);
int row=table.getSelectedRow();
int column=table.getSelectedColumn();
if("ORDER_DESC".equalsIgnoreCase(table.getParmMap(column))){
return;
}
table.setValueAt("Y", row, column);
TParm parm=table.getParmValue().getRow(row);
String code=TypeTool.getString(parm.getValue("ORDER_CODE"));
boolean result=TypeTool.getBoolean(RunClass.runMethod(main, "onQuoteSheet", new Object[]{parm}));
if(result){
table.setValueAt("N", row, column);
}
}
/**
* 初始化参数
*/
public void getInitParameter(){
main=this.getParameter();
}
/**
* 关闭
*/
public boolean onClosing(){
this.setReturnValue("Y");
return true;
}
}
| [
"licx@ACA803A0.ipt.aol.com"
] | licx@ACA803A0.ipt.aol.com |
b1c18dbd156bd61ba7947d15e3925311c5ce2e45 | a704b82eed7ecc267ee598550faf74083bd86adb | /j21/collaborate/src/main/java/com/collaborate/service/UsersServiceImpl.java | df8782cb150e1ab172d875be6310f3361fcc8d3e | [] | no_license | aganguly04/dt2016p2 | 61c4934c0edd4ad1ea7dd8c895470f545a537f12 | 1ab9f701eac1cc2c51ecbef5f72593b003bad6e5 | refs/heads/master | 2021-01-15T08:14:54.885268 | 2016-09-09T12:11:32 | 2016-09-09T12:11:32 | 61,863,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,021 | java | package com.collaborate.service;
import java.util.List;
import javax.persistence.PersistenceContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.collaborate.dao.UsersDao;
import com.collaborate.model.Users;
@Service("usersService")
@Transactional
@PersistenceContext
public class UsersServiceImpl implements UsersService {
@Autowired
UsersDao usersDao;
@Transactional
public void addUsers(Users users) {
// TODO Auto-generated method stub
usersDao.addUsers(users);
}
public Users getUsersById(int userId) {
// TODO Auto-generated method stub
return usersDao.getUsersById(userId);
}
public List<Users> getAllUsers() {
// TODO Auto-generated method stub
return usersDao.getAllUsers();
}
public Users getUsersByUsername(String userName) {
// TODO Auto-generated method stub
return usersDao.getUsersByUsername(userName);
}
}
| [
"aganguly04@gmail.com"
] | aganguly04@gmail.com |
2a4342ab2006a7e0977051f8f0601ab7a1c8ed99 | 7f364689fc4d0eff8bf32a2805f70e4eee98425e | /framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java | 8a29d08f11728da1d18d19444e7296162624f19a | [
"Apache-2.0"
] | permissive | mukulashokjoshi/apache-isis | 3c0fc7d4366a7f9fb8151c3229b9a0c18dfcc59e | f5ed969c82c0f334b5c4a67ca3b57846ab13b56c | refs/heads/master | 2021-01-17T11:09:18.879033 | 2012-09-26T16:38:32 | 2012-09-26T16:38:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,620 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.isis.viewer.dnd.table;
import org.apache.log4j.Logger;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.core.commons.ensure.Assert;
import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
import org.apache.isis.core.commons.exceptions.UnknownTypeException;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.isis.core.progmodel.facets.value.booleans.BooleanValueFacet;
import org.apache.isis.core.progmodel.facets.value.image.ImageValueFacet;
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
import org.apache.isis.viewer.dnd.field.CheckboxField;
import org.apache.isis.viewer.dnd.view.Axes;
import org.apache.isis.viewer.dnd.view.Content;
import org.apache.isis.viewer.dnd.view.GlobalViewFactory;
import org.apache.isis.viewer.dnd.view.ObjectContent;
import org.apache.isis.viewer.dnd.view.Toolkit;
import org.apache.isis.viewer.dnd.view.View;
import org.apache.isis.viewer.dnd.view.ViewRequirement;
import org.apache.isis.viewer.dnd.view.ViewSpecification;
import org.apache.isis.viewer.dnd.view.base.BlankView;
import org.apache.isis.viewer.dnd.view.base.FieldErrorView;
import org.apache.isis.viewer.dnd.view.composite.AbstractViewBuilder;
import org.apache.isis.viewer.dnd.view.content.TextParseableContent;
import org.apache.isis.viewer.dnd.view.field.OneToOneFieldImpl;
import org.apache.isis.viewer.dnd.view.field.TextParseableFieldImpl;
import org.apache.isis.viewer.dnd.viewer.basic.UnlinedTextFieldSpecification;
class TableCellBuilder extends AbstractViewBuilder {
private static final Logger LOG = Logger.getLogger(TableCellBuilder.class);
// REVIEW: should provide this rendering context, rather than hardcoding.
// the net effect currently is that class members annotated with
// @Hidden(where=Where.ALL_TABLES) will indeed be hidden from all tables
// but will be shown (perhaps incorrectly) if annotated with Where.PARENTED_TABLE
// or Where.STANDALONE_TABLE
private final Where where = Where.ALL_TABLES;
private void addField(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field) {
final ObjectAdapter value = field.get(object);
View fieldView;
fieldView = createFieldView(view, axes, object, field, value);
if (fieldView != null) {
view.addView(decorateSubview(axes, fieldView));
} else {
view.addView(new FieldErrorView("No field for " + value));
}
}
@Override
public void build(final View view, final Axes axes) {
Assert.assertEquals("ensure the view is complete decorated view", view.getView(), view);
final Content content = view.getContent();
final ObjectAdapter object = ((ObjectContent) content).getObject();
if (view.getSubviews().length == 0) {
initialBuild(object, view, axes);
} else {
updateBuild(object, view, axes);
}
}
private void updateBuild(final ObjectAdapter object, final View view, final Axes axes) {
final TableAxis viewAxis = axes.getAxis(TableAxis.class);
LOG.debug("update view " + view + " for " + object);
final View[] subviews = view.getSubviews();
final ObjectSpecification spec = object.getSpecification();
for (int i = 0; i < subviews.length; i++) {
final ObjectAssociation field = fieldFromActualSpec(spec, viewAxis.getFieldForColumn(i));
final View subview = subviews[i];
final ObjectAdapter value = field.get(object);
// if the field is parseable then it may have been modified; we need
// to replace what was
// typed in with the actual title.
if (field.getSpecification().isParseable()) {
final boolean visiblityChange = !field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() ^ (subview instanceof BlankView);
final ObjectAdapter adapter = subview.getContent().getAdapter();
final boolean valueChange = value != null && value.getObject() != null && !value.getObject().equals(adapter.getObject());
if (visiblityChange || valueChange) {
final View fieldView = createFieldView(view, axes, object, field, value);
view.replaceView(subview, decorateSubview(axes, fieldView));
}
subview.refresh();
} else if (field.isOneToOneAssociation()) {
final ObjectAdapter existing = ((ObjectContent) subviews[i].getContent()).getObject();
final boolean changedValue = value != existing;
if (changedValue) {
View fieldView;
fieldView = createFieldView(view, axes, object, field, value);
if (fieldView != null) {
view.replaceView(subview, decorateSubview(axes, fieldView));
} else {
view.addView(new FieldErrorView("No field for " + value));
}
}
}
}
}
private ObjectAssociation fieldFromActualSpec(final ObjectSpecification spec, final ObjectAssociation field) {
final String fieldName = field.getId();
return spec.getAssociation(fieldName);
}
private void initialBuild(final ObjectAdapter object, final View view, final Axes axes) {
final TableAxis viewAxis = axes.getAxis(TableAxis.class);
LOG.debug("build view " + view + " for " + object);
final int len = viewAxis.getColumnCount();
final ObjectSpecification spec = object.getSpecification();
for (int f = 0; f < len; f++) {
if (f > 3) {
continue;
}
final ObjectAssociation field = fieldFromActualSpec(spec, viewAxis.getFieldForColumn(f));
addField(view, axes, object, field);
}
}
private View createFieldView(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field, final ObjectAdapter value) {
if (field == null) {
throw new NullPointerException();
}
final GlobalViewFactory factory = Toolkit.getViewFactory();
ViewSpecification cellSpec;
Content content;
if (field instanceof OneToManyAssociation) {
throw new UnexpectedCallException("no collections allowed");
} else if (field instanceof OneToOneAssociation) {
final ObjectSpecification fieldSpecification = field.getSpecification();
if (fieldSpecification.isParseable()) {
content = new TextParseableFieldImpl(object, value, (OneToOneAssociation) field);
// REVIEW how do we deal with IMAGES?
if (content.getAdapter() instanceof ImageValueFacet) {
return new BlankView(content);
}
if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
return new BlankView(content);
}
if (((TextParseableContent) content).getNoLines() > 0) {
/*
* TODO remove this after introducing constraints into view
* specs that allow the parent view to specify what kind of
* subviews it can deal
*/
if (fieldSpecification.containsFacet(BooleanValueFacet.class)) {
cellSpec = new CheckboxField.Specification();
} else {
cellSpec = new UnlinedTextFieldSpecification();
}
} else {
return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED));
}
} else {
content = new OneToOneFieldImpl(object, value, (OneToOneAssociation) field);
if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
return new BlankView(content);
}
return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED | ViewRequirement.SUBVIEW));
}
} else {
throw new UnknownTypeException(field);
}
return cellSpec.createView(content, axes, -1);
}
}
| [
"danhaywood@13f79535-47bb-0310-9956-ffa450edef68"
] | danhaywood@13f79535-47bb-0310-9956-ffa450edef68 |
47b18591ec349afa7db46b845bdf3b2564d00614 | 69a13dd83a4cced3e334fe0dac5675f06c49f654 | /test_modul_9/src/test_modul_9/Shape.java | e7d832ea383a1ee1d6e4b62cb83d15960cebe13a | [] | no_license | NoobEjby/Programerings_Opgaver_1.semester | 88fdffcc645005b61c4e536761397fcc0b819752 | 3a4c92bf872b427faadf176875e15a7358cfa8f4 | refs/heads/master | 2020-03-28T20:43:31.127238 | 2018-11-05T12:57:46 | 2018-11-05T12:57:46 | 149,096,389 | 0 | 0 | null | 2018-10-01T12:18:30 | 2018-09-17T08:53:09 | Java | UTF-8 | Java | false | false | 619 | 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 test_modul_9;
import java.awt.Color;
/**
*
* @author Noob
*/
public class Shape {
private Color c;
double area;
public void redraw() {
System.out.println("Can´t draw shape");
}
public void setC(Color c) {
this.c = c;
}
public Color getC() {
return c;
}
@Override
public String toString() {
return this.c.toString() + " " + this.area;
}
}
| [
"kasper.ejby@gmail.com"
] | kasper.ejby@gmail.com |
e5ddae91eda254e76d40e97ed10cb3586c378361 | ca83f813322a3276367c8b2c13b771e4a953b438 | /ManagingSoftware/src/application/AddComment.java | edc4ce3ea213d744bfdceaa58a3baa1c201ae4a4 | [] | no_license | Mahamudrahat/ManagingSoftware | 691f6bcf677e1a9bc6251cd754319cde2a2f6993 | 442571fefe09dbcb419a75ce8f6a68cd4acd47af | refs/heads/master | 2021-08-22T07:34:00.240763 | 2017-11-29T16:39:33 | 2017-11-29T16:39:33 | 112,496,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,604 | java | package application;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import application.UpdateTask.UpdateTask1;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class AddComment {
int i=1,j=1;
Text text=new Text("Add Comment");
Label l1=new Label("Select Project");
Label l2=new Label("Select task");
Label l3=new Label("Comment");
Label l4=new Label("Comment by");
ComboBox<String> cb1=new ComboBox();
ComboBox<String> cb2=new ComboBox();
TextField t1=new TextField();
TextField t2=new TextField();
Button b1=new Button("Save");
Pane pane=new Pane();
Stage stage=new Stage();
String JDBC_DRIVER="com.mysql.jdbc.Driver";
String DB_URL="jdbc:mysql://localhost/managingsoft";
Connection conn=null;
Statement stmt=null;
public void Comment(){
text.setFont(Font.font("o",FontWeight.NORMAL,30));
text.setFill(Color.BLACK);
text.relocate(100, 50);
l1.relocate(20,150 );
l1.setPrefSize(200, 30);
l1.setFont(Font.font("o",FontWeight.NORMAL,20));
cb1.relocate(170, 150);
cb1.setPrefSize(200, 30);
l2.relocate(20,200 );
l2.setPrefSize(200, 30);
l2.setFont(Font.font("o",FontWeight.NORMAL,20));
cb2.relocate(170, 200);
cb2.setPrefSize(200, 30);
l3.relocate(20,250 );
l3.setPrefSize(150, 30);
l3.setFont(Font.font("o",FontWeight.NORMAL,20));
t1.relocate(170, 250);
t1.setPrefSize(200, 100);
l4.relocate(20,350 );
l4.setPrefSize(200, 100);
l4.setFont(Font.font("o",FontWeight.NORMAL,20));
t2.relocate(170, 380);
t2.setPrefSize(200, 30);
b1.relocate(250, 500);
b1.setPrefSize(100, 30);
pane.getChildren().addAll(l1,l2,l3,l4,cb1,cb2,text,b1,t1,t2);
try{
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,"root","");
System.out.println("Successfully connected");
stmt=conn.createStatement();
String query="select Name from updateproject ";
ResultSet rset = stmt.executeQuery(query);
while(rset.next()){
String s=rset.getString(i);
cb1.getItems().addAll(s);
}i++;
}catch
(Exception ex){
ex.printStackTrace();
}
try{
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,"root","");
System.out.println("Successfully connected");
stmt=conn.createStatement();
String query="select Select_task from updateproject ";
ResultSet rset = stmt.executeQuery(query);
while(rset.next()){
String s=rset.getString(j);
cb2.getItems().addAll(s);
}j++;
}catch
(Exception ex){
ex.printStackTrace();
}
b1.setOnAction(e1->{
AddComment1 a=new AddComment1();
a.Comment1();
});
pane.setPrefSize(650, 650);
Scene scene=new Scene(pane);
stage.setScene(scene);
stage.show();
}
public class AddComment1 extends Button{
public void Comment1(){
try{
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,"root","");
System.out.println("Successfully connected");
stmt=conn.createStatement();
String query="insert into addcomment values('"+cb1.getValue()+"','"+cb2.getValue()+"','"+t1.getText()+"','"+t2.getText()+"')";
stmt.executeUpdate(query);
System.out.println("Successfully connected");
}catch
(Exception ex){
ex.printStackTrace();
}
}
}
}
| [
"rahat.ruet@gmail.com"
] | rahat.ruet@gmail.com |
f9e2a3a74208a14693990ae4ee3416ecc22c58f3 | 77623d6dd90f2d1a401ee720adb41c3c0c264715 | /DiffTGen-result/output/Chart_11_1_capgen/patch/instru1/ShapeUtilities.java | cd2f024b49587210a1d5e7f0815acc328abba144 | [] | no_license | wuhongjun15/overfitting-study | 40be0f062bbd6716d8de6b06454b8c73bae3438d | 5093979e861cda6575242d92ca12355a26ca55e0 | refs/heads/master | 2021-04-17T05:37:48.393527 | 2020-04-11T01:53:53 | 2020-04-11T01:53:53 | 249,413,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,465 | java | /* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library 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 Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* -------------------
* ShapeUtilities.java
* -------------------
* (C)opyright 2003-2008, by Object Refinery Limited and Contributors.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): -;
*
* Changes
* -------
* 13-Aug-2003 : Version 1 (DG);
* 16-Mar-2004 : Moved rotateShape() from RefineryUtilities.java to here (DG);
* 13-May-2004 : Added new shape creation methods (DG);
* 30-Sep-2004 : Added createLineRegion() method (DG);
* Moved drawRotatedShape() method from RefineryUtilities class
* to this class (DG);
* 04-Oct-2004 : Renamed ShapeUtils --> ShapeUtilities (DG);
* 26-Oct-2004 : Added a method to test the equality of two Line2D
* instances (DG);
* 10-Nov-2004 : Added new translateShape() and equal(Ellipse2D, Ellipse2D)
* methods (DG);
* 11-Nov-2004 : Renamed translateShape() --> createTranslatedShape() (DG);
* 07-Jan-2005 : Minor Javadoc fix (DG);
* 11-Jan-2005 : Removed deprecated code in preparation for 1.0.0 release (DG);
* 21-Jan-2005 : Modified return type of RectangleAnchor.coordinates()
* method (DG);
* 22-Feb-2005 : Added equality tests for Arc2D and GeneralPath (DG);
* 16-Mar-2005 : Fixed bug where equal(Shape, Shape) fails for two Polygon
* instances (DG);
* 20-Jun-2007 : Copied from JCommon (DG);
* 02-Jun-2008 : Fixed bug in equal(GeneralPath, GeneralPath) (DG);
*
*/
package org.jfree.chart.util;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import myprinter.FieldPrinter;
/**
* Utility methods for {@link Shape} objects.
*/
public class ShapeUtilities {
public static int eid_ShapeUtilities_7au3e = 0;
public static int eid_clone_Shape_7au3e = 0;
public static int eid_equal_Shape_Shape_7au3e = 0;
public static int eid_equal_Line2D_Line2D_7au3e = 0;
public static int eid_equal_Ellipse2D_Ellipse2D_7au3e = 0;
public static int eid_equal_Arc2D_Arc2D_7au3e = 0;
public static int eid_equal_Polygon_Polygon_7au3e = 0;
public static int eid_equal_GeneralPath_GeneralPath_7au3e = 0;
public static int eid_createTranslatedShape_Shape_double_double_7au3e = 0;
public static int eid_createTranslatedShape_Shape_RectangleAnchor_double_double_7au3e = 0;
public static int eid_rotateShape_Shape_double_float_float_7au3e = 0;
public static int eid_drawRotatedShape_Graphics2D_Shape_double_float_float_7au3e = 0;
public static int eid_createDiagonalCross_float_float_7au3e = 0;
public static int eid_createRegularCross_float_float_7au3e = 0;
public static int eid_createDiamond_float_7au3e = 0;
public static int eid_createUpTriangle_float_7au3e = 0;
public static int eid_createDownTriangle_float_7au3e = 0;
public static int eid_createLineRegion_Line2D_float_7au3e = 0;
public static int eid_getPointInRectangle_double_double_Rectangle2D_7au3e = 0;
public static int eid_contains_Rectangle2D_Rectangle2D_7au3e = 0;
public static int eid_intersects_Rectangle2D_Rectangle2D_7au3e = 0;
public static Map oref_map = new HashMap();
public static void addToORefMap(String msig, Object obj) {
List l = (List) oref_map.get(msig);
if (l == null) {
l = new ArrayList();
oref_map.put(msig, l);
}
l.add(obj);
}
public static void clearORefMap() {
oref_map.clear();
eid_ShapeUtilities_7au3e = 0;
eid_clone_Shape_7au3e = 0;
eid_equal_Shape_Shape_7au3e = 0;
eid_equal_Line2D_Line2D_7au3e = 0;
eid_equal_Ellipse2D_Ellipse2D_7au3e = 0;
eid_equal_Arc2D_Arc2D_7au3e = 0;
eid_equal_Polygon_Polygon_7au3e = 0;
eid_equal_GeneralPath_GeneralPath_7au3e = 0;
eid_createTranslatedShape_Shape_double_double_7au3e = 0;
eid_createTranslatedShape_Shape_RectangleAnchor_double_double_7au3e = 0;
eid_rotateShape_Shape_double_float_float_7au3e = 0;
eid_drawRotatedShape_Graphics2D_Shape_double_float_float_7au3e = 0;
eid_createDiagonalCross_float_float_7au3e = 0;
eid_createRegularCross_float_float_7au3e = 0;
eid_createDiamond_float_7au3e = 0;
eid_createUpTriangle_float_7au3e = 0;
eid_createDownTriangle_float_7au3e = 0;
eid_createLineRegion_Line2D_float_7au3e = 0;
eid_getPointInRectangle_double_double_Rectangle2D_7au3e = 0;
eid_contains_Rectangle2D_Rectangle2D_7au3e = 0;
eid_intersects_Rectangle2D_Rectangle2D_7au3e = 0;
}
/**
* Prevents instantiation.
*/
private ShapeUtilities() {
}
/**
* Returns a clone of the specified shape, or <code>null</code>. At the
* current time, this method supports cloning for instances of
* <code>Line2D</code>, <code>RectangularShape</code>, <code>Area</code>
* and <code>GeneralPath</code>.
* <p>
* <code>RectangularShape</code> includes <code>Arc2D</code>,
* <code>Ellipse2D</code>, <code>Rectangle2D</code>,
* <code>RoundRectangle2D</code>.
*
* @param shape the shape to clone (<code>null</code> permitted,
* returns <code>null</code>).
*
* @return A clone or <code>null</code>.
*/
public static Shape clone(Shape shape) {
if (shape instanceof Cloneable) {
try {
return (Shape) ObjectUtilities.clone(shape);
}
catch (CloneNotSupportedException cnse) {
}
}
Shape result = null;
return result;
}
/**
* Tests two shapes for equality. If both shapes are <code>null</code>,
* this method will return <code>true</code>.
* <p>
* In the current implementation, the following shapes are supported:
* <code>Ellipse2D</code>, <code>Line2D</code> and <code>Rectangle2D</code>
* (implicit).
*
* @param s1 the first shape (<code>null</code> permitted).
* @param s2 the second shape (<code>null</code> permitted).
*
* @return A boolean.
*/
public static boolean equal(Shape s1, Shape s2) {
if (s1 instanceof Line2D && s2 instanceof Line2D) {
return equal((Line2D) s1, (Line2D) s2);
}
else if (s1 instanceof Ellipse2D && s2 instanceof Ellipse2D) {
return equal((Ellipse2D) s1, (Ellipse2D) s2);
}
else if (s1 instanceof Arc2D && s2 instanceof Arc2D) {
return equal((Arc2D) s1, (Arc2D) s2);
}
else if (s1 instanceof Polygon && s2 instanceof Polygon) {
return equal((Polygon) s1, (Polygon) s2);
}
else if (s1 instanceof GeneralPath && s2 instanceof GeneralPath) {
return equal((GeneralPath) s1, (GeneralPath) s2);
}
else {
// this will handle Rectangle2D...
return ObjectUtilities.equal(s1, s2);
}
}
/**
* Compares two lines are returns <code>true</code> if they are equal or
* both <code>null</code>.
*
* @param l1 the first line (<code>null</code> permitted).
* @param l2 the second line (<code>null</code> permitted).
*
* @return A boolean.
*/
public static boolean equal(Line2D l1, Line2D l2) {
if (l1 == null) {
return (l2 == null);
}
if (l2 == null) {
return false;
}
if (!l1.getP1().equals(l2.getP1())) {
return false;
}
if (!l1.getP2().equals(l2.getP2())) {
return false;
}
return true;
}
/**
* Compares two ellipses and returns <code>true</code> if they are equal or
* both <code>null</code>.
*
* @param e1 the first ellipse (<code>null</code> permitted).
* @param e2 the second ellipse (<code>null</code> permitted).
*
* @return A boolean.
*/
public static boolean equal(Ellipse2D e1, Ellipse2D e2) {
if (e1 == null) {
return (e2 == null);
}
if (e2 == null) {
return false;
}
if (!e1.getFrame().equals(e2.getFrame())) {
return false;
}
return true;
}
/**
* Compares two arcs and returns <code>true</code> if they are equal or
* both <code>null</code>.
*
* @param a1 the first arc (<code>null</code> permitted).
* @param a2 the second arc (<code>null</code> permitted).
*
* @return A boolean.
*/
public static boolean equal(Arc2D a1, Arc2D a2) {
if (a1 == null) {
return (a2 == null);
}
if (a2 == null) {
return false;
}
if (!a1.getFrame().equals(a2.getFrame())) {
return false;
}
if (a1.getAngleStart() != a2.getAngleStart()) {
return false;
}
if (a1.getAngleExtent() != a2.getAngleExtent()) {
return false;
}
if (a1.getArcType() != a2.getArcType()) {
return false;
}
return true;
}
/**
* Tests two polygons for equality. If both are <code>null</code> this
* method returns <code>true</code>.
*
* @param p1 polygon 1 (<code>null</code> permitted).
* @param p2 polygon 2 (<code>null</code> permitted).
*
* @return A boolean.
*/
public static boolean equal(Polygon p1, Polygon p2) {
if (p1 == null) {
return (p2 == null);
}
if (p2 == null) {
return false;
}
if (p1.npoints != p2.npoints) {
return false;
}
if (!Arrays.equals(p1.xpoints, p2.xpoints)) {
return false;
}
if (!Arrays.equals(p1.ypoints, p2.ypoints)) {
return false;
}
return true;
}
/**
* Tests two polygons for equality. If both are <code>null</code> this
* method returns <code>true</code>.
*
* @param p1 path 1 (<code>null</code> permitted).
* @param p2 path 2 (<code>null</code> permitted).
*
* @return A boolean.
*/
public static boolean equal_7au3e(GeneralPath p1, GeneralPath p2) {
if (p1 == null) {
return (p2 == null);
}
if (p2 == null) {
return false;
}
if (p1.getWindingRule() != p2.getWindingRule()) {
return false;
}
PathIterator iterator1 = p2.getPathIterator(null);
PathIterator iterator2 = p1.getPathIterator(null);
double[] d1 = new double[6];
double[] d2 = new double[6];
boolean done = iterator1.isDone() && iterator2.isDone();
while (!done) {
if (iterator1.isDone() != iterator2.isDone()) {
return false;
}
int seg1 = iterator1.currentSegment(d1);
int seg2 = iterator2.currentSegment(d2);
if (seg1 != seg2) {
return false;
}
if (!Arrays.equals(d1, d2)) {
return false;
}
iterator1.next();
iterator2.next();
done = iterator1.isDone() && iterator2.isDone();
}
return true;
}
/**
* Creates and returns a translated shape.
*
* @param shape the shape (<code>null</code> not permitted).
* @param transX the x translation (in Java2D space).
* @param transY the y translation (in Java2D space).
*
* @return The translated shape.
*/
public static Shape createTranslatedShape(Shape shape,
double transX,
double transY) {
if (shape == null) {
throw new IllegalArgumentException("Null 'shape' argument.");
}
AffineTransform transform = AffineTransform.getTranslateInstance(
transX, transY);
return transform.createTransformedShape(shape);
}
/**
* Translates a shape to a new location such that the anchor point
* (relative to the rectangular bounds of the shape) aligns with the
* specified (x, y) coordinate in Java2D space.
*
* @param shape the shape (<code>null</code> not permitted).
* @param anchor the anchor (<code>null</code> not permitted).
* @param locationX the x-coordinate (in Java2D space).
* @param locationY the y-coordinate (in Java2D space).
*
* @return A new and translated shape.
*/
public static Shape createTranslatedShape(Shape shape,
RectangleAnchor anchor,
double locationX,
double locationY) {
if (shape == null) {
throw new IllegalArgumentException("Null 'shape' argument.");
}
if (anchor == null) {
throw new IllegalArgumentException("Null 'anchor' argument.");
}
Point2D anchorPoint = RectangleAnchor.coordinates(shape.getBounds2D(),
anchor);
AffineTransform transform = AffineTransform.getTranslateInstance(
locationX - anchorPoint.getX(), locationY - anchorPoint.getY());
return transform.createTransformedShape(shape);
}
/**
* Rotates a shape about the specified coordinates.
*
* @param base the shape (<code>null</code> permitted, returns
* <code>null</code>).
* @param angle the angle (in radians).
* @param x the x coordinate for the rotation point (in Java2D space).
* @param y the y coordinate for the rotation point (in Java2D space).
*
* @return the rotated shape.
*/
public static Shape rotateShape(Shape base, double angle,
float x, float y) {
if (base == null) {
return null;
}
AffineTransform rotate = AffineTransform.getRotateInstance(angle, x, y);
Shape result = rotate.createTransformedShape(base);
return result;
}
/**
* Draws a shape with the specified rotation about <code>(x, y)</code>.
*
* @param g2 the graphics device (<code>null</code> not permitted).
* @param shape the shape (<code>null</code> not permitted).
* @param angle the angle (in radians).
* @param x the x coordinate for the rotation point.
* @param y the y coordinate for the rotation point.
*/
public static void drawRotatedShape(Graphics2D g2, Shape shape,
double angle, float x, float y) {
AffineTransform saved = g2.getTransform();
AffineTransform rotate = AffineTransform.getRotateInstance(angle, x, y);
g2.transform(rotate);
g2.draw(shape);
g2.setTransform(saved);
}
/** A useful constant used internally. */
private static final float SQRT2 = (float) Math.pow(2.0, 0.5);
/**
* Creates a diagonal cross shape.
*
* @param l the length of each 'arm'.
* @param t the thickness.
*
* @return A diagonal cross shape.
*/
public static Shape createDiagonalCross(float l, float t) {
GeneralPath p0 = new GeneralPath();
p0.moveTo(-l - t, -l + t);
p0.lineTo(-l + t, -l - t);
p0.lineTo(0.0f, -t * SQRT2);
p0.lineTo(l - t, -l - t);
p0.lineTo(l + t, -l + t);
p0.lineTo(t * SQRT2, 0.0f);
p0.lineTo(l + t, l - t);
p0.lineTo(l - t, l + t);
p0.lineTo(0.0f, t * SQRT2);
p0.lineTo(-l + t, l + t);
p0.lineTo(-l - t, l - t);
p0.lineTo(-t * SQRT2, 0.0f);
p0.closePath();
return p0;
}
/**
* Creates a diagonal cross shape.
*
* @param l the length of each 'arm'.
* @param t the thickness.
*
* @return A diagonal cross shape.
*/
public static Shape createRegularCross(float l, float t) {
GeneralPath p0 = new GeneralPath();
p0.moveTo(-l, t);
p0.lineTo(-t, t);
p0.lineTo(-t, l);
p0.lineTo(t, l);
p0.lineTo(t, t);
p0.lineTo(l, t);
p0.lineTo(l, -t);
p0.lineTo(t, -t);
p0.lineTo(t, -l);
p0.lineTo(-t, -l);
p0.lineTo(-t, -t);
p0.lineTo(-l, -t);
p0.closePath();
return p0;
}
/**
* Creates a diamond shape.
*
* @param s the size factor (equal to half the height of the diamond).
*
* @return A diamond shape.
*/
public static Shape createDiamond(float s) {
GeneralPath p0 = new GeneralPath();
p0.moveTo(0.0f, -s);
p0.lineTo(s, 0.0f);
p0.lineTo(0.0f, s);
p0.lineTo(-s, 0.0f);
p0.closePath();
return p0;
}
/**
* Creates a triangle shape that points upwards.
*
* @param s the size factor (equal to half the height of the triangle).
*
* @return A triangle shape.
*/
public static Shape createUpTriangle(float s) {
GeneralPath p0 = new GeneralPath();
p0.moveTo(0.0f, -s);
p0.lineTo(s, s);
p0.lineTo(-s, s);
p0.closePath();
return p0;
}
/**
* Creates a triangle shape that points downwards.
*
* @param s the size factor (equal to half the height of the triangle).
*
* @return A triangle shape.
*/
public static Shape createDownTriangle(float s) {
GeneralPath p0 = new GeneralPath();
p0.moveTo(0.0f, s);
p0.lineTo(s, -s);
p0.lineTo(-s, -s);
p0.closePath();
return p0;
}
/**
* Creates a region surrounding a line segment by 'widening' the line
* segment. A typical use for this method is the creation of a
* 'clickable' region for a line that is displayed on-screen.
*
* @param line the line (<code>null</code> not permitted).
* @param width the width of the region.
*
* @return A region that surrounds the line.
*/
public static Shape createLineRegion(Line2D line, float width) {
GeneralPath result = new GeneralPath();
float x1 = (float) line.getX1();
float x2 = (float) line.getX2();
float y1 = (float) line.getY1();
float y2 = (float) line.getY2();
if ((x2 - x1) != 0.0) {
double theta = Math.atan((y2 - y1) / (x2 - x1));
float dx = (float) Math.sin(theta) * width;
float dy = (float) Math.cos(theta) * width;
result.moveTo(x1 - dx, y1 + dy);
result.lineTo(x1 + dx, y1 - dy);
result.lineTo(x2 + dx, y2 - dy);
result.lineTo(x2 - dx, y2 + dy);
result.closePath();
}
else {
// special case, vertical line
result.moveTo(x1 - width / 2.0f, y1);
result.lineTo(x1 + width / 2.0f, y1);
result.lineTo(x2 + width / 2.0f, y2);
result.lineTo(x2 - width / 2.0f, y2);
result.closePath();
}
return result;
}
/**
* Returns a point based on (x, y) but constrained to be within the bounds
* of a given rectangle.
*
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param area the constraining rectangle (<code>null</code> not
* permitted).
*
* @return A point within the rectangle.
*
* @throws NullPointerException if <code>area</code> is <code>null</code>.
*/
public static Point2D getPointInRectangle(double x, double y,
Rectangle2D area) {
x = Math.max(area.getMinX(), Math.min(x, area.getMaxX()));
y = Math.max(area.getMinY(), Math.min(y, area.getMaxY()));
return new Point2D.Double(x, y);
}
/**
* Checks, whether the given rectangle1 fully contains rectangle 2
* (even if rectangle 2 has a height or width of zero!).
*
* @param rect1 the first rectangle.
* @param rect2 the second rectangle.
*
* @return A boolean.
*/
public static boolean contains(Rectangle2D rect1, Rectangle2D rect2) {
double x0 = rect1.getX();
double y0 = rect1.getY();
double x = rect2.getX();
double y = rect2.getY();
double w = rect2.getWidth();
double h = rect2.getHeight();
return ((x >= x0) && (y >= y0)
&& ((x + w) <= (x0 + rect1.getWidth()))
&& ((y + h) <= (y0 + rect1.getHeight())));
}
/**
* Checks, whether the given rectangle1 fully contains rectangle 2
* (even if rectangle 2 has a height or width of zero!).
*
* @param rect1 the first rectangle.
* @param rect2 the second rectangle.
*
* @return A boolean.
*/
public static boolean intersects(Rectangle2D rect1, Rectangle2D rect2) {
double x0 = rect1.getX();
double y0 = rect1.getY();
double x = rect2.getX();
double width = rect2.getWidth();
double y = rect2.getY();
double height = rect2.getHeight();
return (x + width >= x0 && y + height >= y0 && x <= x0 + rect1.getWidth()
&& y <= y0 + rect1.getHeight());
}
/**
* Tests two polygons for equality. If both are <code>null</code> this method returns <code>true</code>.
* @param p1 path 1 (<code>null</code> permitted).
* @param p2 path 2 (<code>null</code> permitted).
* @return A boolean.
*/
public static boolean equal(GeneralPath p1, GeneralPath p2) {
Object o_7au3e = null;
String c_7au3e = "org.jfree.chart.util.ShapeUtilities";
String msig_7au3e = "equal(GeneralPath$GeneralPath)"
+ eid_equal_GeneralPath_GeneralPath_7au3e;
try {
o_7au3e = equal_7au3e(p1, p2);
addToORefMap(msig_7au3e, o_7au3e);
addToORefMap(msig_7au3e, null);
addToORefMap(msig_7au3e, p1);
addToORefMap(msig_7au3e, p2);
} catch (Throwable t7au3e) {
addToORefMap(msig_7au3e, t7au3e);
throw t7au3e;
} finally {
eid_equal_GeneralPath_GeneralPath_7au3e++;
}
return (boolean) o_7au3e;
}
}
| [
"375882286@qq.com"
] | 375882286@qq.com |
563f993f273bddef7f0708b230de88b9e7c64d8b | 5d4c220927a9c429e078fb5ef43e15ce666d49d8 | /ch04-mvc-code-authentication-chain-ajax/src/main/java/config/MvcConfig.java | e625e6a71d400d7ed83fe0a7244d1f1880574849 | [] | no_license | wang-chunlin/springsecurity-teaching-parent | cba5e37b56bbe8440489c65a2dce10554bd9a796 | c9c9be37cc9565d863770f1853caba316b1f9f48 | refs/heads/master | 2022-12-21T23:39:29.613990 | 2020-01-04T03:22:32 | 2020-01-04T03:22:32 | 231,701,929 | 0 | 0 | null | 2022-12-15T23:25:38 | 2020-01-04T03:17:58 | Java | UTF-8 | Java | false | false | 964 | java | package config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.web.servlet.config.annotation.*;
/**
* @author cj
* @date 2019/11/25
*/
@Configuration
@EnableWebMvc
@ComponentScan({"com.controller"})
public class MvcConfig implements WebMvcConfigurer {
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
registry.jsp("/WEB-INF/views/", ".jsp");
}
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addFormatter(new DateFormatter("yyyy-MM-dd"));
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**")
.addResourceLocations("classpath:/static/");
}
}
| [
"417278483@qq.com"
] | 417278483@qq.com |
9b0cba1e32fd9b858b3c2f521487ffa7f796ab3c | 94b22a34c3fcf908fa549931c4aa8bf01f346eb5 | /Task_Manager/src/java/controller/Admin_ReadAllTasksServlet.java | 213e3ca71445795b21c22a7000def80a59fb21ab | [] | no_license | kate-anderson/TaskManager | cee3de9d1d65aa7d33f3edefa2557c1aa71f8a98 | fe4f6fea81da6225c4a8204b5c3c1db5d4fc513e | refs/heads/master | 2021-04-27T11:14:20.740714 | 2018-02-23T01:36:30 | 2018-02-23T01:36:30 | 122,557,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,716 | 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 controller;
import dbHelper.Admin_ReadAllTasksQuery;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author colbert
*/
@WebServlet(name = "ReadServlet", urlPatterns = {"/admin/readAllTasks"})
public class Admin_ReadAllTasksServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ReadServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet ReadServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Pass execution on to doPost
doPost(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//Create a ReadQuery helper object
Admin_ReadAllTasksQuery rq = new Admin_ReadAllTasksQuery();
//Get the HTML table from the ReadQuery object
rq.doRead();
String table = rq.makeHtmlTable();
//Pass execution control to read.jsp along with the table.
request.setAttribute("table", table);
String url = "./adminRead.jsp";
RequestDispatcher dispatcher = request.getRequestDispatcher(url);
dispatcher.forward(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
} | [
"kate-anderson@uiowa.edu"
] | kate-anderson@uiowa.edu |
4c2bbf3496e413e2a4224b2449337adc6ee956a3 | 48616d876699965b727d0be3cbae843f3f435f15 | /shardingsphere-sql-parser/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/visitor/impl/PostgreSQLDMLVisitor.java | 622eb3e1be3f826a7e0cf2d8a972770d47f7128a | [
"Apache-2.0"
] | permissive | avalon566/incubator-shardingsphere | 4bb107a247335fa03ceea66e5f5e0e2a6fa37c68 | 303b81d385e8ea1fa18a7e5f631f575c0b8be709 | refs/heads/master | 2020-09-10T15:32:50.163756 | 2020-03-15T13:59:08 | 2020-03-15T13:59:08 | 221,735,878 | 0 | 0 | Apache-2.0 | 2019-11-14T16:02:28 | 2019-11-14T16:02:27 | null | UTF-8 | Java | false | false | 28,767 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.visitor.impl;
import org.apache.shardingsphere.sql.parser.api.visitor.DMLVisitor;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.AliasContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.AssignmentContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.AssignmentValueContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.AssignmentValuesContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ColumnNamesContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.DeleteContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.DuplicateSpecificationContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ExprContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.FromClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.GroupByClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.InsertContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.InsertValuesClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.JoinSpecificationContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.JoinedTableContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.LimitClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.LimitOffsetContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.LimitRowCountContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.MultipleTableNamesContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.MultipleTablesClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.OrderByItemContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ProjectionContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ProjectionsContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.QualifiedShorthandContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SelectClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SelectContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SetAssignmentsClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SingleTableClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.TableFactorContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.TableNameContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.TableReferenceContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.TableReferencesContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.UnionClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.UpdateContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.WhereClauseContext;
import org.apache.shardingsphere.sql.parser.sql.ASTNode;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.assignment.AssignmentSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.assignment.InsertValuesSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.assignment.SetAssignmentSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.column.ColumnSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.column.InsertColumnsSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.ExpressionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.complex.CommonExpressionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.LiteralExpressionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.subquery.SubquerySegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.AggregationProjectionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ColumnProjectionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ExpressionProjectionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ProjectionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ProjectionsSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ShorthandProjectionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.SubqueryProjectionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.GroupBySegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.OrderBySegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.item.OrderByItemSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.limit.LimitSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.limit.LimitValueSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.limit.NumberLiteralLimitValueSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.limit.ParameterMarkerLimitValueSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.AndPredicate;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.OrPredicateSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.PredicateSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.WhereSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.generic.AliasSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.generic.OwnerSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.generic.TableSegment;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.DeleteStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.InsertStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.sql.value.collection.CollectionValue;
import org.apache.shardingsphere.sql.parser.sql.value.identifier.IdentifierValue;
import org.apache.shardingsphere.sql.parser.sql.value.literal.impl.BooleanLiteralValue;
import org.apache.shardingsphere.sql.parser.sql.value.literal.impl.NumberLiteralValue;
import org.apache.shardingsphere.sql.parser.sql.value.parametermarker.ParameterMarkerValue;
import org.apache.shardingsphere.sql.parser.visitor.PostgreSQLVisitor;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* DML visitor for PostgreSQL.
*/
public final class PostgreSQLDMLVisitor extends PostgreSQLVisitor implements DMLVisitor {
@Override
public ASTNode visitInsert(final InsertContext ctx) {
// TODO :FIXME, since there is no segment for insertValuesClause, InsertStatement is created by sub rule.
// TODO deal with insert select
InsertStatement result = (InsertStatement) visit(ctx.insertValuesClause());
result.setTable((TableSegment) visit(ctx.tableName()));
result.setParameterCount(getCurrentParameterIndex());
return result;
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitInsertValuesClause(final InsertValuesClauseContext ctx) {
InsertStatement result = new InsertStatement();
if (null != ctx.columnNames()) {
ColumnNamesContext columnNames = ctx.columnNames();
CollectionValue<ColumnSegment> columnSegments = (CollectionValue<ColumnSegment>) visit(columnNames);
result.setInsertColumns(new InsertColumnsSegment(columnNames.start.getStartIndex(), columnNames.stop.getStopIndex(), columnSegments.getValue()));
} else {
result.setInsertColumns(new InsertColumnsSegment(ctx.start.getStartIndex() - 1, ctx.start.getStartIndex() - 1, Collections.emptyList()));
}
result.getValues().addAll(createInsertValuesSegments(ctx.assignmentValues()));
return result;
}
private Collection<InsertValuesSegment> createInsertValuesSegments(final Collection<AssignmentValuesContext> assignmentValuesContexts) {
Collection<InsertValuesSegment> result = new LinkedList<>();
for (AssignmentValuesContext each : assignmentValuesContexts) {
result.add((InsertValuesSegment) visit(each));
}
return result;
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitUpdate(final UpdateContext ctx) {
UpdateStatement result = new UpdateStatement();
result.getTables().addAll(((CollectionValue<TableSegment>) visit(ctx.tableReferences())).getValue());
result.setSetAssignment((SetAssignmentSegment) visit(ctx.setAssignmentsClause()));
if (null != ctx.whereClause()) {
result.setWhere((WhereSegment) visit(ctx.whereClause()));
}
result.setParameterCount(getCurrentParameterIndex());
return result;
}
@Override
public ASTNode visitSetAssignmentsClause(final SetAssignmentsClauseContext ctx) {
Collection<AssignmentSegment> assignments = new LinkedList<>();
for (AssignmentContext each : ctx.assignment()) {
assignments.add((AssignmentSegment) visit(each));
}
return new SetAssignmentSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), assignments);
}
@Override
public ASTNode visitAssignmentValues(final AssignmentValuesContext ctx) {
List<ExpressionSegment> segments = new LinkedList<>();
for (AssignmentValueContext each : ctx.assignmentValue()) {
segments.add((ExpressionSegment) visit(each));
}
return new InsertValuesSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), segments);
}
@Override
public ASTNode visitAssignment(final AssignmentContext ctx) {
ColumnSegment column = (ColumnSegment) visitColumnName(ctx.columnName());
ExpressionSegment value = (ExpressionSegment) visit(ctx.assignmentValue());
return new AssignmentSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), column, value);
}
@Override
public ASTNode visitAssignmentValue(final AssignmentValueContext ctx) {
ExprContext expr = ctx.expr();
if (null != expr) {
return visit(expr);
}
return new CommonExpressionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDelete(final DeleteContext ctx) {
DeleteStatement result = new DeleteStatement();
if (null != ctx.multipleTablesClause()) {
result.getTables().addAll(((CollectionValue<TableSegment>) visit(ctx.multipleTablesClause())).getValue());
} else {
result.getTables().add((TableSegment) visit(ctx.singleTableClause()));
}
if (null != ctx.whereClause()) {
result.setWhere((WhereSegment) visit(ctx.whereClause()));
}
result.setParameterCount(getCurrentParameterIndex());
return result;
}
@Override
public ASTNode visitSingleTableClause(final SingleTableClauseContext ctx) {
TableSegment result = (TableSegment) visit(ctx.tableName());
if (null != ctx.alias()) {
result.setAlias((AliasSegment) visit(ctx.alias()));
}
return result;
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitMultipleTablesClause(final MultipleTablesClauseContext ctx) {
CollectionValue<TableSegment> result = new CollectionValue<>();
result.combine((CollectionValue<TableSegment>) visit(ctx.multipleTableNames()));
result.combine((CollectionValue<TableSegment>) visit(ctx.tableReferences()));
return result;
}
@Override
public ASTNode visitMultipleTableNames(final MultipleTableNamesContext ctx) {
CollectionValue<TableSegment> result = new CollectionValue<>();
for (TableNameContext each : ctx.tableName()) {
result.getValue().add((TableSegment) visit(each));
}
return result;
}
@Override
public ASTNode visitSelect(final SelectContext ctx) {
// TODO : Unsupported for withClause.
SelectStatement result = (SelectStatement) visit(ctx.unionClause());
result.setParameterCount(getCurrentParameterIndex());
return result;
}
@Override
public ASTNode visitUnionClause(final UnionClauseContext ctx) {
// TODO : Unsupported for union SQL.
return visit(ctx.selectClause(0));
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitSelectClause(final SelectClauseContext ctx) {
SelectStatement result = new SelectStatement();
result.setProjections((ProjectionsSegment) visit(ctx.projections()));
if (null != ctx.duplicateSpecification()) {
result.getProjections().setDistinctRow(isDistinct(ctx));
}
if (null != ctx.fromClause()) {
result.getTables().addAll(((CollectionValue<TableSegment>) visit(ctx.fromClause())).getValue());
}
if (null != ctx.whereClause()) {
result.setWhere((WhereSegment) visit(ctx.whereClause()));
}
if (null != ctx.groupByClause()) {
result.setGroupBy((GroupBySegment) visit(ctx.groupByClause()));
}
if (null != ctx.orderByClause()) {
result.setOrderBy((OrderBySegment) visit(ctx.orderByClause()));
}
if (null != ctx.limitClause()) {
result.setLimit((LimitSegment) visit(ctx.limitClause()));
}
return result;
}
@SuppressWarnings("unchecked")
private Collection<TableSegment> getTableSegments(final Collection<TableSegment> tableSegments, final JoinedTableContext joinedTable) {
Collection<TableSegment> result = new LinkedList<>();
for (TableSegment tableSegment : ((CollectionValue<TableSegment>) visit(joinedTable)).getValue()) {
if (isTable(tableSegment, tableSegments)) {
result.add(tableSegment);
}
}
return result;
}
private boolean isTable(final TableSegment owner, final Collection<TableSegment> tableSegments) {
for (TableSegment each : tableSegments) {
if (owner.getTableName().getIdentifier().getValue().equals(each.getAlias().orElse(null))) {
return false;
}
}
return true;
}
private boolean isDistinct(final SelectClauseContext ctx) {
return ((BooleanLiteralValue) visit(ctx.duplicateSpecification())).getValue();
}
@Override
public ASTNode visitDuplicateSpecification(final DuplicateSpecificationContext ctx) {
return new BooleanLiteralValue(null != ctx.DISTINCT());
}
@Override
public ASTNode visitProjections(final ProjectionsContext ctx) {
Collection<ProjectionSegment> projections = new LinkedList<>();
if (null != ctx.unqualifiedShorthand()) {
projections.add(
new ShorthandProjectionSegment(ctx.unqualifiedShorthand().getStart().getStartIndex(), ctx.unqualifiedShorthand().getStop().getStopIndex(), ctx.unqualifiedShorthand().getText()));
}
for (ProjectionContext each : ctx.projection()) {
projections.add((ProjectionSegment) visit(each));
}
ProjectionsSegment result = new ProjectionsSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex());
result.getProjections().addAll(projections);
return result;
}
@Override
public ASTNode visitProjection(final ProjectionContext ctx) {
// FIXME: The stop index of project is the stop index of projection, instead of alias.
if (null != ctx.qualifiedShorthand()) {
QualifiedShorthandContext shorthand = ctx.qualifiedShorthand();
ShorthandProjectionSegment result = new ShorthandProjectionSegment(shorthand.getStart().getStartIndex(), shorthand.getStop().getStopIndex(), shorthand.getText());
IdentifierValue identifier = new IdentifierValue(shorthand.identifier().getText());
result.setOwner(new OwnerSegment(shorthand.identifier().getStart().getStartIndex(), shorthand.identifier().getStop().getStopIndex(), identifier));
return result;
}
AliasSegment alias = null == ctx.alias() ? null : (AliasSegment) visit(ctx.alias());
if (null != ctx.columnName()) {
ColumnSegment column = (ColumnSegment) visit(ctx.columnName());
ColumnProjectionSegment result = new ColumnProjectionSegment(ctx.columnName().getText(), column);
result.setAlias(alias);
return result;
}
return createProjection(ctx, alias);
}
@Override
public ASTNode visitAlias(final AliasContext ctx) {
if (null != ctx.identifier()) {
return new AliasSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), (IdentifierValue) visit(ctx.identifier()));
}
return new AliasSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), new IdentifierValue(ctx.STRING_().getText()));
}
private ASTNode createProjection(final ProjectionContext ctx, final AliasSegment alias) {
ASTNode projection = visit(ctx.expr());
if (projection instanceof AggregationProjectionSegment) {
((AggregationProjectionSegment) projection).setAlias(alias);
return projection;
}
if (projection instanceof ExpressionProjectionSegment) {
((ExpressionProjectionSegment) projection).setAlias(alias);
return projection;
}
if (projection instanceof CommonExpressionSegment) {
CommonExpressionSegment segment = (CommonExpressionSegment) projection;
ExpressionProjectionSegment result = new ExpressionProjectionSegment(segment.getStartIndex(), segment.getStopIndex(), segment.getText());
result.setAlias(alias);
return result;
}
// FIXME :For DISTINCT()
if (projection instanceof ColumnSegment) {
ExpressionProjectionSegment result = new ExpressionProjectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ctx.getText());
result.setAlias(alias);
return result;
}
if (projection instanceof SubquerySegment) {
SubqueryProjectionSegment result = new SubqueryProjectionSegment(
new SubquerySegment(((SubquerySegment) projection).getStartIndex(), ((SubquerySegment) projection).getStopIndex(), ((SubquerySegment) projection).getText()));
result.setAlias(alias);
return result;
}
LiteralExpressionSegment column = (LiteralExpressionSegment) projection;
ExpressionProjectionSegment result = null == alias ? new ExpressionProjectionSegment(column.getStartIndex(), column.getStopIndex(), String.valueOf(column.getLiterals()))
: new ExpressionProjectionSegment(column.getStartIndex(), ctx.alias().stop.getStopIndex(), String.valueOf(column.getLiterals()));
result.setAlias(alias);
return result;
}
@Override
public ASTNode visitFromClause(final FromClauseContext ctx) {
return visit(ctx.tableReferences());
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitTableReferences(final TableReferencesContext ctx) {
CollectionValue<TableSegment> result = new CollectionValue<>();
for (TableReferenceContext each : ctx.tableReference()) {
result.combine((CollectionValue<TableSegment>) visit(each));
}
return result;
}
@Override
public ASTNode visitTableReference(final TableReferenceContext ctx) {
CollectionValue<TableSegment> result = new CollectionValue<>();
if (null != ctx.tableFactor()) {
ASTNode tableFactor = visit(ctx.tableFactor());
if (tableFactor instanceof TableSegment) {
result.getValue().add((TableSegment) tableFactor);
}
}
if (null != ctx.joinedTable()) {
for (JoinedTableContext each : ctx.joinedTable()) {
result.getValue().addAll(getTableSegments(result.getValue(), each));
}
}
return result;
}
@Override
public ASTNode visitTableFactor(final TableFactorContext ctx) {
if (null != ctx.tableName()) {
TableSegment result = (TableSegment) visit(ctx.tableName());
if (null != ctx.alias()) {
result.setAlias((AliasSegment) visit(ctx.alias()));
}
return result;
}
if (null != ctx.tableReferences()) {
return visit(ctx.tableReferences());
}
return new SubquerySegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitJoinedTable(final JoinedTableContext ctx) {
CollectionValue<TableSegment> result = new CollectionValue<>();
TableSegment tableSegment = (TableSegment) visit(ctx.tableFactor());
result.getValue().add(tableSegment);
if (null != ctx.joinSpecification()) {
Collection<TableSegment> tableSegments = new LinkedList<>();
for (TableSegment each : ((CollectionValue<TableSegment>) visit(ctx.joinSpecification())).getValue()) {
if (isTable(each, Collections.singleton(tableSegment))) {
tableSegments.add(each);
}
}
result.getValue().addAll(tableSegments);
}
return result;
}
@Override
public ASTNode visitJoinSpecification(final JoinSpecificationContext ctx) {
CollectionValue<TableSegment> result = new CollectionValue<>();
if (null == ctx.expr()) {
return result;
}
ASTNode expr = visit(ctx.expr());
if (expr instanceof PredicateSegment) {
PredicateSegment predicate = (PredicateSegment) expr;
if (predicate.getColumn().getOwner().isPresent()) {
result.getValue().add(createTableSegment(predicate.getColumn().getOwner().get()));
}
if (predicate.getRightValue() instanceof ColumnSegment && ((ColumnSegment) predicate.getRightValue()).getOwner().isPresent()) {
result.getValue().add(createTableSegment(((ColumnSegment) predicate.getRightValue()).getOwner().get()));
}
}
return result;
}
private TableSegment createTableSegment(final OwnerSegment ownerSegment) {
return new TableSegment(ownerSegment.getStartIndex(), ownerSegment.getStopIndex(), ownerSegment.getIdentifier());
}
@Override
public ASTNode visitWhereClause(final WhereClauseContext ctx) {
WhereSegment result = new WhereSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex());
ASTNode segment = visit(ctx.expr());
if (segment instanceof OrPredicateSegment) {
result.getAndPredicates().addAll(((OrPredicateSegment) segment).getAndPredicates());
} else if (segment instanceof PredicateSegment) {
AndPredicate andPredicate = new AndPredicate();
andPredicate.getPredicates().add((PredicateSegment) segment);
result.getAndPredicates().add(andPredicate);
}
return result;
}
@Override
public ASTNode visitGroupByClause(final GroupByClauseContext ctx) {
Collection<OrderByItemSegment> items = new LinkedList<>();
for (OrderByItemContext each : ctx.orderByItem()) {
items.add((OrderByItemSegment) visit(each));
}
return new GroupBySegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), items);
}
@Override
public ASTNode visitLimitClause(final LimitClauseContext ctx) {
if (null != ctx.limitRowCountSyntax() && null != ctx.limitOffsetSyntax()) {
return isRowCountBeforeOffset(ctx) ? createLimitSegmentWhenRowCountBeforeOffset(ctx) : createLimitSegmentWhenRowCountAfterOffset(ctx);
}
return createLimitSegmentWhenRowCountOrOffsetAbsent(ctx);
}
private boolean isRowCountBeforeOffset(final LimitClauseContext ctx) {
return ctx.limitRowCountSyntax().getStart().getStartIndex() < ctx.limitOffsetSyntax().getStart().getStartIndex();
}
private LimitSegment createLimitSegmentWhenRowCountBeforeOffset(final LimitClauseContext ctx) {
LimitValueSegment rowCount = null == ctx.limitRowCountSyntax().limitRowCount() ? null : (LimitValueSegment) visit(ctx.limitRowCountSyntax().limitRowCount());
LimitValueSegment offset = (LimitValueSegment) visit(ctx.limitOffsetSyntax().limitOffset());
return new LimitSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), offset, rowCount);
}
private LimitSegment createLimitSegmentWhenRowCountAfterOffset(final LimitClauseContext ctx) {
LimitValueSegment offset = (LimitValueSegment) visit(ctx.limitOffsetSyntax().limitOffset());
LimitValueSegment rowCount = null == ctx.limitRowCountSyntax().limitRowCount() ? null : (LimitValueSegment) visit(ctx.limitRowCountSyntax().limitRowCount());
return new LimitSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), offset, rowCount);
}
private LimitSegment createLimitSegmentWhenRowCountOrOffsetAbsent(final LimitClauseContext ctx) {
LimitValueSegment rowCount = null == ctx.limitRowCountSyntax() || null == ctx.limitRowCountSyntax().limitRowCount()
? null : (LimitValueSegment) visit(ctx.limitRowCountSyntax().limitRowCount());
LimitValueSegment offset = null == ctx.limitOffsetSyntax() ? null : (LimitValueSegment) visit(ctx.limitOffsetSyntax().limitOffset());
return new LimitSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), offset, rowCount);
}
@Override
public ASTNode visitLimitRowCount(final LimitRowCountContext ctx) {
if (null != ctx.numberLiterals()) {
return new NumberLiteralLimitValueSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ((NumberLiteralValue) visit(ctx.numberLiterals())).getValue().longValue());
}
return new ParameterMarkerLimitValueSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ((ParameterMarkerValue) visit(ctx.parameterMarker())).getValue());
}
@Override
public ASTNode visitLimitOffset(final LimitOffsetContext ctx) {
if (null != ctx.numberLiterals()) {
return new NumberLiteralLimitValueSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ((NumberLiteralValue) visit(ctx.numberLiterals())).getValue().longValue());
}
return new ParameterMarkerLimitValueSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ((ParameterMarkerValue) visit(ctx.parameterMarker())).getValue());
}
}
| [
"noreply@github.com"
] | avalon566.noreply@github.com |
98ce601565bb937aa326e602497450f79ec4463b | 3d242b5e81e75fb82edb27fecd64f0222f50c3f3 | /templates/griffon-pivot-java-templates/templates/subtmpl-artifact/View.java | 507f626ba8c9ae6e379dbd5ff8119eec57cc706a | [
"Apache-2.0"
] | permissive | pgremo/griffon | d7105330ad5c3969bfa56d84d632a9d5bbcb9f59 | 4c19a3cc2af3dbb8e489e64f82bde99ff7e773e8 | refs/heads/master | 2022-12-07T02:42:49.102745 | 2018-11-06T13:12:10 | 2018-11-06T13:12:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,315 | java | package ${project_package};
import griffon.core.artifact.GriffonView;
import griffon.inject.MVCMember;
import griffon.metadata.ArtifactProviderFor;
import griffon.pivot.support.PivotAction;
import org.apache.pivot.serialization.SerializationException;
import org.codehaus.griffon.runtime.pivot.artifact.AbstractPivotGriffonView;
import org.apache.pivot.wtk.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collections;
import javax.annotation.Nonnull;
import static java.util.Arrays.asList;
@ArtifactProviderFor(GriffonView.class)
public class ${project_class_name}View extends AbstractPivotGriffonView {
private ${project_class_name}Model model;
private ${project_class_name}Controller controller;
@MVCMember
public void setModel(@Nonnull ${project_class_name}Model model) {
this.model = model;
}
@MVCMember
public void setController(@Nonnull ${project_class_name}Controller controller) {
this.controller = controller;
}
@Override
public void initUI() {
Window window = (Window) getApplication()
.createApplicationContainer(Collections.<String, Object>emptyMap());
window.setTitle(getApplication().getConfiguration().getAsString("application.title"));
window.setMaximized(true);
getApplication().getWindowManager().attach("${name}", window);
BoxPane vbox = new BoxPane(Orientation.VERTICAL);
try {
vbox.setStyles("{horizontalAlignment:'center', verticalAlignment:'center'}");
} catch (SerializationException e) {
// ignore
}
final Label clickLabel = new Label(String.valueOf(model.getClickCount()));
vbox.add(clickLabel);
PivotAction clickAction = toolkitActionFor(controller, "click");
final Button button = new PushButton(clickAction.getName());
button.setName("clickButton");
button.setAction(clickAction);
vbox.add(button);
model.addPropertyChangeListener("clickCount", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
clickLabel.setText(String.valueOf(evt.getNewValue()));
}
});
window.setContent(vbox);
}
} | [
"aalmiray@gmail.com"
] | aalmiray@gmail.com |
a07e91a5e827d02e1f8df656521e26bfcb812a0e | d6894765c7e4bca52ccbf85aa50b3121941a1fcb | /src/main/java/org/jeecgframework/web/superquery/entity/SuperQueryHistoryEntity.java | 1e9f195a42eb506572f0d248f4e8180adebbdba0 | [] | no_license | 289222346/dianshang | 46b6b0173546112cccee9cca6202eac4d0da14f8 | 60e929615c6e59d48851e81ae5ff54d2c0b26af6 | refs/heads/master | 2022-12-28T08:28:08.585073 | 2020-01-16T13:20:03 | 2020-01-16T13:21:03 | 233,261,806 | 0 | 0 | null | 2022-12-16T04:24:56 | 2020-01-11T16:30:44 | JavaScript | UTF-8 | Java | false | false | 6,284 | java | package org.jeecgframework.web.superquery.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title: Entity
* @Description: 高级查询历史记录
* @author onlineGenerator
* @date
* @version V1.0
*
*/
@Entity
@Table(name = "super_query_history", schema = "")
@SuppressWarnings("serial")
public class SuperQueryHistoryEntity implements java.io.Serializable {
/**主键*/
private String id;
/**创建人名称*/
private String createName;
/**创建人登录名称*/
private String createBy;
/**创建日期*/
private java.util.Date createDate;
/**更新人名称*/
private String updateName;
/**更新人登录名称*/
private String updateBy;
/**更新日期*/
private java.util.Date updateDate;
/**所属部门*/
private String sysOrgCode;
/**所属公司*/
private String sysCompanyCode;
/**用户id*/
@Excel(name="用户id",width=15)
private String userId;
/**查询规则编码*/
@Excel(name="查询规则编码",width=15)
private String queryCode;
/**查询类型*/
@Excel(name="查询类型",width=15,dicCode="sel_type")
private String queryType;
/**说明*/
@Excel(name="记录",width=15)
private String record;
@Excel(name="名称",width=15)
private String historyName;
/**
*方法: 取得java.lang.String
*@return: java.lang.String 主键
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public String getId(){
return this.id;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 主键
*/
public void setId(String id){
this.id = id;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 创建人名称
*/
@Column(name ="CREATE_NAME",nullable=true,length=50)
public String getCreateName(){
return this.createName;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 创建人名称
*/
public void setCreateName(String createName){
this.createName = createName;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 创建人登录名称
*/
@Column(name ="CREATE_BY",nullable=true,length=50)
public String getCreateBy(){
return this.createBy;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 创建人登录名称
*/
public void setCreateBy(String createBy){
this.createBy = createBy;
}
/**
*方法: 取得java.util.Date
*@return: java.util.Date 创建日期
*/
@Column(name ="CREATE_DATE",nullable=true,length=20)
public java.util.Date getCreateDate(){
return this.createDate;
}
/**
*方法: 设置java.util.Date
*@param: java.util.Date 创建日期
*/
public void setCreateDate(java.util.Date createDate){
this.createDate = createDate;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 更新人名称
*/
@Column(name ="UPDATE_NAME",nullable=true,length=50)
public String getUpdateName(){
return this.updateName;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 更新人名称
*/
public void setUpdateName(String updateName){
this.updateName = updateName;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 更新人登录名称
*/
@Column(name ="UPDATE_BY",nullable=true,length=50)
public String getUpdateBy(){
return this.updateBy;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 更新人登录名称
*/
public void setUpdateBy(String updateBy){
this.updateBy = updateBy;
}
/**
*方法: 取得java.util.Date
*@return: java.util.Date 更新日期
*/
@Column(name ="UPDATE_DATE",nullable=true,length=50)
public java.util.Date getUpdateDate(){
return this.updateDate;
}
/**
*方法: 设置java.util.Date
*@param: java.util.Date 更新日期
*/
public void setUpdateDate(java.util.Date updateDate){
this.updateDate = updateDate;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 所属部门
*/
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
public String getSysOrgCode(){
return this.sysOrgCode;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 所属部门
*/
public void setSysOrgCode(String sysOrgCode){
this.sysOrgCode = sysOrgCode;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 所属公司
*/
@Column(name ="SYS_COMPANY_CODE",nullable=true,length=50)
public String getSysCompanyCode(){
return this.sysCompanyCode;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 所属公司
*/
public void setSysCompanyCode(String sysCompanyCode){
this.sysCompanyCode = sysCompanyCode;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 查询规则编码
*/
@Column(name ="QUERY_CODE",nullable=true,length=50)
public String getQueryCode(){
return this.queryCode;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 查询规则编码
*/
public void setQueryCode(String queryCode){
this.queryCode = queryCode;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 查询类型
*/
@Column(name ="QUERY_TYPE",nullable=true,length=50)
public String getQueryType(){
return this.queryType;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 查询类型
*/
public void setQueryType(String queryType){
this.queryType = queryType;
}
@Column(name ="user_id",nullable=true,length=50)
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
@Column(name ="record",nullable=true,length=255)
public String getRecord() {
return record;
}
public void setRecord(String record) {
this.record = record;
}
@Column(name ="history_name",nullable=true,length=255)
public String getHistoryName() {
return historyName;
}
public void setHistoryName(String historyName) {
this.historyName = historyName;
}
}
| [
"289222346@qq.com"
] | 289222346@qq.com |
34f436daa675d66ad357998e4298a8043bb2be3a | be7255eeb02b1a4426d9526180269d87d949664e | /app/src/main/java/com/uranus/economy/base/BaseFragment.java | 73994408b09eb6f71e81a83a650517bc200c5cdc | [] | no_license | uranusTian/economy | 65776dc30a252ea4669b9ce0434be3915c169cf3 | a7abf642053abe48aac0a50e7fbba82d20749805 | refs/heads/master | 2023-03-12T00:17:50.687110 | 2020-11-04T13:20:23 | 2020-11-04T13:20:23 | 249,207,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,999 | java | package com.uranus.economy.base;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import com.uranus.economy.util.EventBusUtils;
import java.io.Serializable;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public abstract class BaseFragment extends Fragment {
protected Context mContext;
protected View mRoot;
protected Bundle mBundle;
protected Router router;
protected LayoutInflater mInflater;
private Unbinder bind;
@Override
public void onAttach(Context context) {
super.onAttach(context);
mContext = context;
}
@Override
public void onDetach() {
super.onDetach();
mContext = null;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBundle = getArguments();
initBundle(mBundle);
if (router == null) {
router = new Router((AppCompatActivity) getActivity());
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (mRoot != null) {
ViewGroup parent = (ViewGroup) mRoot.getParent();
if (parent != null)
parent.removeView(mRoot);
} else {
mRoot = inflater.inflate(getLayoutId(), container, false);
mInflater = inflater;
// Do something
onBindViewBefore(mRoot);
// Bind view
bind = ButterKnife.bind(this, mRoot);
// Get savedInstanceState
if (savedInstanceState != null)
onRestartInstance(savedInstanceState);
// Init
initWidget(mRoot);
initData();
}
return mRoot;
}
protected void onBindViewBefore(View root) {
// ...
}
@Override
public void onDestroy() {
super.onDestroy();
if (bind != null) {
bind.unbind();
bind = null;
}
EventBusUtils.unregister(this);
mBundle = null;
}
protected abstract int getLayoutId();
protected void initBundle(Bundle bundle) {
}
protected void initWidget(View root) {
}
protected void initData() {
}
protected <T extends View> T findView(int viewId) {
return (T) mRoot.findViewById(viewId);
}
protected <T extends Serializable> T getBundleSerializable(String key) {
if (mBundle == null) {
return null;
}
return (T) mBundle.getSerializable(key);
}
protected void setText(int viewId, String text) {
TextView textView = findView(viewId);
if (TextUtils.isEmpty(text)) {
return;
}
textView.setText(text);
}
protected void setText(int viewId, String text, String emptyTip) {
TextView textView = findView(viewId);
if (TextUtils.isEmpty(text)) {
textView.setText(emptyTip);
return;
}
textView.setText(text);
}
protected void setTextEmptyGone(int viewId, String text) {
TextView textView = findView(viewId);
if (TextUtils.isEmpty(text)) {
textView.setVisibility(View.GONE);
return;
}
textView.setText(text);
}
protected <T extends View> T setGone(int id) {
T view = findView(id);
view.setVisibility(View.GONE);
return view;
}
protected <T extends View> T setVisibility(int id) {
T view = findView(id);
view.setVisibility(View.VISIBLE);
return view;
}
protected void setInVisibility(int id) {
findView(id).setVisibility(View.INVISIBLE);
}
protected void onRestartInstance(Bundle bundle) {
}
protected void setStatusBarPadding() {
mRoot.setPadding(0, getStatusHeight(mContext), 0, 0);
}
@SuppressLint("ObsoleteSdkInt,PrivateApi")
private static int getStatusHeight(Context context) {
int statusHeight = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
try {
Class<?> clazz = Class.forName("com.android.internal.R$dimen");
Object object = clazz.newInstance();
int height = Integer.parseInt(clazz.getField("status_bar_height")
.get(object).toString());
statusHeight = context.getResources().getDimensionPixelSize(height);
} catch (Exception e) {
e.printStackTrace();
}
}
return statusHeight;
}
}
| [
"1657513085@qq.com"
] | 1657513085@qq.com |
8c606a8e9842aded2053e80b69b449f9edfc8db2 | 7791b07a11d714345a3c847e3387d3e4fb012ec0 | /PDOnlineConfig/app/src/main/java/com/pd/config/pdonlineconfig/net/UDPSender.java | 3e230ad6502548deb530bcd56a6eeb78a947ef0a | [] | no_license | SheStealsMyPenta/test | 6262dfef527259f6b2020ec88dbd645b0713623f | 286c1621cbe9d716b743ce5e87ab4fd5188cd7f5 | refs/heads/master | 2020-06-13T19:22:44.762210 | 2019-07-02T01:35:53 | 2019-07-02T01:35:53 | 194,764,936 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,546 | java | package com.pd.config.pdonlineconfig.net;
import android.os.Message;
import com.pd.config.pdonlineconfig.constants.Command;
import com.pd.config.pdonlineconfig.interfaces.InternetManager;
import com.pd.config.pdonlineconfig.pojo.LightParams;
import com.pd.config.pdonlineconfig.pojo.PdParamsAA;
import com.pd.config.pdonlineconfig.pojo.PdParamsUHF;
import com.pd.config.pdonlineconfig.pojo.TestParams;
public class UDPSender implements UDPSenderInterface {
private String typeOfCommand;
private ControlUnitMessager messager;
private InternetManager manager;
private int notifyNumber;
private NetHandler netHandler;
public UDPSender setNetHandler(NetHandler netHandler) {
this.netHandler = netHandler;
return this;
}
public UDPSender setMessager(ControlUnitMessager messager) {
this.messager = messager;
return this;
}
public UDPSender setManager(InternetManager manager) {
this.manager = manager;
messager.setManager(manager);
return this;
}
public UDPSender setNotifyNumber(int notifyNumber) {
this.notifyNumber = notifyNumber;
return this;
}
public UDPSender setCommandType(String type) {
messager.setTypeOfCommand(type);
return this;
}
@Override
public void send() {
if (checkNull()) {
messager.start();
startNotifyThread();
}
}
private void startNotifyThread() {
new Thread(() -> {
try {
Thread.sleep(Command.OVERTIME);
Message msg = Message.obtain();
msg.what = notifyNumber;
netHandler.sendMessage(msg);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
private boolean checkNull() {
if (messager == null) return false;
return manager != null;
}
public UDPSender setUHFParams(PdParamsUHF pdUHf) {
messager.setPdParamsUHF(pdUHf);
return this;
}
public UDPSender setAAParams(PdParamsAA paramsAA) {
messager.setPdParamsAA(paramsAA);
return this;
}
public UDPSender setRunTimeConfig(TestParams values) {
messager.setParams(values);
return this;
}
public UDPSender setDeviceSn(String s) {
messager.setDeviceSN(s);
return this;
}
public UDPSender setLightParams(LightParams data) {
messager.setLightParams(data);
return this;
}
}
| [
"707713012@qq.com"
] | 707713012@qq.com |
4aa8ec21de76712c4cdc3cf8ee95ae7124463328 | 0369b14ce460ef76f9e53f00de09e8c26b7bc4cc | /transaction/src/main/java/org/wildfly/httpclient/transaction/XidProvider.java | 32baec1ce010cf4d0a014fc807c0cea9d17480d2 | [
"Apache-2.0"
] | permissive | fl4via/wildfly-http-client | b4da9fcbb076358bbeb737270834934251393714 | af5843c906a886954fbb7b6ad7f6c19994d065de | refs/heads/master | 2023-08-10T23:35:47.361032 | 2022-08-15T09:24:35 | 2022-08-15T09:24:35 | 180,651,077 | 1 | 0 | Apache-2.0 | 2019-04-10T19:35:06 | 2019-04-10T19:35:06 | null | UTF-8 | Java | false | false | 932 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2017 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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.wildfly.httpclient.transaction;
import javax.transaction.xa.Xid;
/**
* Gets the Xid of the associated transaction handle
*
* @author Stuart Douglas
*/
public interface XidProvider {
Xid getXid();
}
| [
"stuart.w.douglas@gmail.com"
] | stuart.w.douglas@gmail.com |
50634bd0b4fadcab8222141383450774c48263f8 | d11aa492a18777cda3f109ea601abf0a70e14dba | /ClassGame/src/com/teamgthree/gamestate/PlayingState.java | cb2084f063ef481c5feb2932bf5e9a128071cba7 | [] | no_license | KyleKoschak/javagame | 6cddb626878c7d4003d4720a447c07b9240e8576 | e8532dbe0fbfdf4baaff0b4b25fa85657ed1c614 | refs/heads/master | 2021-09-06T22:03:14.592865 | 2018-02-12T10:30:25 | 2018-02-12T10:30:25 | 106,973,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,045 | java | package com.teamgthree.gamestate;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import com.teamgthree.control.Boundries;
import com.teamgthree.control.LevelUp;
import com.teamgthree.game.Game;
import com.teamgthree.game.Model.AttackAction;
import com.teamgthree.game.Model.IdleAction;
import com.teamgthree.game.Model.TravelAction;
import com.teamgthree.game.View.Direction;
public class PlayingState extends GameState {
private static boolean moveLeft;
private static boolean moveRight;
private static boolean moveUp;
private static boolean moveDown;
private static int speed = 10;
private Font font = new Font("helvetica", Font.BOLD, 100);
private LevelUp levelUp = new LevelUp();
private Boundries boundry = new Boundries();
public PlayingState(GameStateManager gsm) {
super(gsm);
moveLeft = false;
moveRight = false;
moveUp = false;
moveDown = false;
}
@Override
public void update() {
move();
levelUp.levelUp();
boundry.doBoundries();
}
@Override
public void draw(Graphics g) {
levelUp.drawLevelBar(g);
//Draw life at top
for (int i = 0; i < Game.player.getHealth(); i++) {
g.setColor(Color.RED);
g.fillRect(i * 50 + 15, 20, 40, 20);
}
//Draw Gameover
if (Game.player.getHealth() <= 0) {
g.setFont(font);
g.setColor(Color.WHITE);
g.drawString("GAME OVER", 85, 100);
}
}
@Override
public void keyPressed(int e) {
//Only do key input if player is alive
if (!Game.player.isDead()) {
//Move Left
if (e == KeyEvent.VK_LEFT || e == KeyEvent.VK_A) {
moveLeft = true;
moveRight = false;
if (!(Game.player.getAction() instanceof TravelAction) &&
!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new TravelAction(Direction.WEST));
Game.player.setCurrentDirection(Direction.WEST);
}
}
//Move Right
if (e == KeyEvent.VK_RIGHT || e == KeyEvent.VK_D) {
moveLeft = false;
moveRight = true;
if (!(Game.player.getAction() instanceof TravelAction) &&
!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new TravelAction(Direction.EAST));
Game.player.setCurrentDirection(Direction.EAST);
}
}
//Move Up
if (e == KeyEvent.VK_UP || e == KeyEvent.VK_W) {
moveUp = true;
moveDown = false;
if (!(Game.player.getAction() instanceof TravelAction) &&
!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new TravelAction(Direction.NORTH));
Game.player.setCurrentDirection(Direction.NORTH);
}
}
//Move Down
if (e == KeyEvent.VK_DOWN || e == KeyEvent.VK_S) {
moveUp = false;
moveDown = true;
if (!(Game.player.getAction() instanceof TravelAction) &&
!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new TravelAction(Direction.SOUTH));
Game.player.setCurrentDirection(Direction.SOUTH);
}
}
//Attack
if (e == KeyEvent.VK_SPACE) {
Game.player.setActionChanged(true);
Game.player.setAction(new AttackAction(Game.player.getCurrentDirection()));
}
//Sprint
if (e == KeyEvent.VK_SHIFT) {
speed = 15;
}
}//End if not dead
//Pause
if (e == KeyEvent.VK_ESCAPE) {
//Stop all movement
moveLeft = false;
moveRight = false;
moveUp = false;
moveDown = false;
//Become idle if not dead
if (!Game.player.isDead()) {
Game.player.setActionChanged(true);
Game.player.setAction(new IdleAction(Game.player
.getCurrentDirection()));
}
//Go to paused state
gsm.setCurrentState(GameStateManager.PAUSEDSTATE);
}
}
@Override
public void keyReleased(int e) {
if (!Game.player.isDead()) {
if (e == KeyEvent.VK_LEFT || e == KeyEvent.VK_A) {
moveLeft = false;
if (!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new IdleAction(Game.player.getCurrentDirection()));
}
}
if (e == KeyEvent.VK_RIGHT || e == KeyEvent.VK_D) {
moveRight = false;
if (!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new IdleAction(Game.player.getCurrentDirection()));
}
}
if (e == KeyEvent.VK_UP || e == KeyEvent.VK_W) {
moveUp = false;
if (!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new IdleAction(Game.player.getCurrentDirection()));
}
}
if (e == KeyEvent.VK_DOWN || e == KeyEvent.VK_S) {
moveDown = false;
if (!(Game.player.getAction() instanceof AttackAction)) {
Game.player.setActionChanged(true);
Game.player.setAction(new IdleAction(Game.player.getCurrentDirection()));
}
}
if (e == KeyEvent.VK_SPACE) {
Game.player.setActionChanged(true);
Game.player.setAction(new IdleAction(Game.player
.getCurrentDirection()));
}
//Sprint
if (e == KeyEvent.VK_SHIFT) {
speed = 10;
}
}
}
private void move () {
if (!Game.player.isDead()) {
if (moveLeft && !moveRight) {
Game.player.getSprite()
.setX(Game.player.getSprite().getX() - speed);
}
if (!moveLeft && moveRight) {
Game.player.getSprite()
.setX(Game.player.getSprite().getX() + speed);
}
if (!moveUp && moveDown) {
Game.player.getSprite()
.setY(Game.player.getSprite().getY() + speed);
}
if (moveUp && !moveDown) {
Game.player.getSprite()
.setY(Game.player.getSprite().getY() - speed);
}
}
}
}
| [
"noreply@github.com"
] | KyleKoschak.noreply@github.com |
6f8dcd43d33a3cf41d87806af10c286041305b16 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/67/org/apache/commons/math/util/ResizableDoubleArray_getValues_619.java | 52ac4d7dcb496d4c60c459f9bdfda6333eb569a6 | [] | 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 | 3,164 | java |
org apach common math util
variabl length link doubl arrai doublearrai implement automat
handl expand contract intern storag arrai element
ad remov
intern storag arrai start capac determin
code initi capac initialcapac code properti set constructor
initi capac ad element
link add element addel append element end arrai
open entri end intern storag arrai
arrai expand size expand arrai depend
code expans mode expansionmod code code expans factor expansionfactor code properti
code expans mode expansionmod code determin size arrai
multipli code expans factor expansionfactor code multipl mode
expans addit addit mode code expans factor expansionfactor code
storag locat ad code expans mode expansionmod code
multipl mode code expans factor expansionfactor code
link add element roll addelementrol method add element end
intern storag arrai adjust usabl window
intern arrai forward posit effect make
element repeat activ method
activ link discard front element discardfrontel effect orphan
storag locat begin intern storag arrai
reclaim storag time method activ size
intern storag arrai compar number address
element code num element numel code properti differ
larg intern arrai contract size
code num element numel code determin intern
storag arrai larg depend code expans mode expansionmod code
code contract factor contractionfactor code properti code expans mode expansionmod code
code multipl mode code contract trigger
ratio storag arrai length code num element numel code exce
code contract factor contractionfactor code code expans mode expansionmod code
code addit mode code number excess storag locat
compar code contract factor contractionfactor code
avoid cycl expans contract
code expans factor expansionfactor code exce
code contract factor contractionfactor code constructor mutat
properti enforc requir throw illeg argument except illegalargumentexcept
violat
version revis date
resiz doubl arrai resizabledoublearrai doubl arrai doublearrai serializ
return intern storag arrai note method return
refer intern storag arrai copi correctli
address element arrai code start index startindex code
requir link start method method
case copi intern arrai practic
link element getel method case
intern storag arrai object
deprec replac link intern valu getinternalvalu
deprec
valu getvalu
intern arrai internalarrai
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
df9efec052714b39da0d84157330b3b184273f5f | 22c97755cb7c69352064957e69a0d5c0ea52f60f | /src/main/java/com/oskarro/soccerbank/entity/clubData/ClubDataBaseUpdate.java | b452a8eca6d7467766145792f48f25d5279c272b | [] | no_license | Oskarovsky/SoccerBank | edd0b72dfa629ef2b1975db684a32c9c3b4f4cb4 | 7582eba1e37f39c8fc1bcad959b6aa9c27e9153b | refs/heads/master | 2023-09-01T12:20:56.646180 | 2021-10-10T19:25:30 | 2021-10-10T19:25:30 | 415,057,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package com.oskarro.soccerbank.entity.clubData;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ClubDataBaseUpdate extends ClubDataUpdate {
private final String name;
private final int yearOfFoundation;
public ClubDataBaseUpdate(long clubId, String name, int yearOfFoundation) {
super(clubId);
this.name = name;
this.yearOfFoundation = yearOfFoundation;
}
}
| [
"oskar.slyk@gmail.com"
] | oskar.slyk@gmail.com |
e60ab1c2f2b165f6e2be2a64dd515a0300bc60b6 | 674c5de646ba135a55837c43090dd6686fb67717 | /Login/src/com/nectarinfotel/prashant/SecondServlet.java | e453513d5b5dab9fe4f507e31de53eeb747410b1 | [] | no_license | PrashantAnand1/spring | f6e33bef280d7d9fb74a0b864d69bf0c0d59fffd | a87c379b1be7c0e79a58b5b0227c3cde5fe79806 | refs/heads/main | 2023-02-25T07:10:09.106450 | 2021-02-02T11:39:31 | 2021-02-02T11:39:31 | 331,869,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package com.nectarinfotel.prashant;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
public class SecondServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String n=request.getParameter("EMAIL");
@SuppressWarnings("unused")
String p=request.getParameter("PASS");
out.print("Welcome "+n);
out.close();
}
} | [
"prasant.anand@nectarinfotel.com"
] | prasant.anand@nectarinfotel.com |
9e99078c6b7dbe782de455702e37bc8e95dd72bb | 8864c896a31c44e7e14f5fe5b074eedcccee182e | /app/src/main/java/com/fang/hay/base/BasePresenter.java | 892f850cafb35a4b2537cc46be4cfc28db4c4b39 | [] | no_license | haolinfang/hay | 511e41532fabe0bb2dd31e5006ad0454264f3077 | b1797bec38dd6a7f750fb2e2c93df9a6e8a66cbd | refs/heads/master | 2020-03-30T05:50:09.314770 | 2018-09-29T03:49:06 | 2018-09-29T03:49:06 | 150,822,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package com.fang.hay.base;
/**
* @author fanglh
* @date 2018/9/13
*/
public interface BasePresenter {
void subscribe();
void unSubscribe();
}
| [
"291633527@qq.com"
] | 291633527@qq.com |
2ec40b87d5f5192f2eb5153953765c9baf4e1025 | 26ea9290e902d27eda5348a807c988afa80b3711 | /src/main/java/com/sfuentes/Voting.java | 8fa9838b9a677d3e0b07716c47bd2ecab8f338ef | [] | no_license | x1928/BeginnerExercises | abe96421f0029c26b79e850de68ad1bce3808eda | a88bb11409f2212fdb54b43bbd0433858a047a2a | refs/heads/master | 2023-06-23T17:53:43.775221 | 2021-07-30T03:59:49 | 2021-07-30T03:59:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package com.sfuentes;
import lombok.RequiredArgsConstructor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RequiredArgsConstructor
public class Voting {
private final List<String> votes;
public Map<String, Integer> getNumberOfVotesPerSection() {
int northCount = 0;
int southCount = 0;
int centerCount = 0;
Map<String, Integer> sections = new HashMap<>();
for (String vote : votes) {
switch (vote.toLowerCase()) {
case "north" -> northCount++;
case "south" -> southCount++;
case "center" -> centerCount++;
}
}
sections.put("North: ", northCount);
sections.put("South: ", southCount);
sections.put("Center: ", centerCount);
return sections;
}
public Map<String, Integer> getMax() {
Map<String, Integer> total = new HashMap<>();
int maxValue = 0;
String maxKey = "";
for (Map.Entry<String, Integer> section : getNumberOfVotesPerSection().entrySet()) {
if (section.getValue() > maxValue) {
maxValue = section.getValue();
maxKey = section.getKey();
}
}
total.put(maxKey, maxValue);
return total;
}
}
| [
"sara.fuentes3025@gmail.com"
] | sara.fuentes3025@gmail.com |
8383480b76256dd1e103e62c03b86a161277a139 | 8a7f88f1c77e81e383afa152669ede2ef80f0540 | /src/main/java/com/tw/study/springboot/config/JerseyConfig.java | d39d78f26481f55850ec2d898e2f1a5b27c5b342 | [] | no_license | yourwafer/spring-boot-study | 64bfe7ae7f7c035ca2544a39b83ceb9af5172f73 | 6619bfe47660624d47e0da56e5927c33bdaf78d9 | refs/heads/master | 2020-12-24T06:13:13.451195 | 2016-11-16T15:38:03 | 2016-11-16T15:38:03 | 73,166,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | package com.tw.study.springboot.config;
import jersey.repackaged.com.google.common.base.Joiner;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.message.filtering.EntityFilteringFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.internal.process.Endpoint;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import javax.ws.rs.ApplicationPath;
@Configuration
@ApplicationPath("api")
public class JerseyConfig extends ResourceConfig {
private static final String[] MODULE_PACKAGES = new String[]{
"com.tw.study.sprintboot.endpoint",
};
public JerseyConfig() {
// common packages
this.packages(
"com.tw.study.springboot.endpoint.handlerr"
);
// module packages
this.packages(
MODULE_PACKAGES
);
this.registerClasses(
EntityFilteringFeature.class,
JacksonFeature.class
);
}
} | [
"hwwei@wei-hongwei.local"
] | hwwei@wei-hongwei.local |
0d1ec3b22fa1afab827caac7bb4da5d942bc2eec | e3cd6fb337bdf9ae8775e543ebf9ce7c9d82a274 | /Bioinformatica_Lab01/src/java/com/biolab01/entities/ClusterObj.java | aa844c408bdc4b8338a7038ac44a30fc41858893 | [] | no_license | aledev/bioinformatica_lab01 | 0f005487ce9dc000e6c4a1e4b88864f3da3a4945 | 57a2759c9dc18e39f120540ca0ad7b56c292710e | refs/heads/master | 2021-01-12T11:37:06.259441 | 2016-12-20T11:43:01 | 2016-12-20T11:43:01 | 72,232,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,950 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.biolab01.entities;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author aialiagam
*/
public class ClusterObj implements Serializable{
//<editor-fold defaultstate="collapsed" desc="propiedades privadas">
private int nroSolucion;
private int nroCluster;
private ArrayList<String> listaGenes;
private ArrayList<GenDictionary> diccionarioGenes;
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="constructores">
public ClusterObj(){
}
public ClusterObj(int nroSolucion, int nroCluster, ArrayList<String> listaGenes, ArrayList<GenDictionary> diccionarioGenes){
this.nroSolucion = nroSolucion;
this.nroCluster = nroCluster;
this.listaGenes = listaGenes;
this.diccionarioGenes = diccionarioGenes;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="metodos accesores">
public int getNroSolucion(){
return this.nroSolucion;
}
public int getNroCluster(){
return this.nroCluster;
}
/**
* @return the diccionarioGenes
*/
public ArrayList<GenDictionary> getDiccionarioGenes() {
return this.diccionarioGenes;
}
public ArrayList<String> getListaGenes(){
return this.listaGenes;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="metodos mutadores">
public void setNroSolucion(int nroSolucion){
this.nroSolucion = nroSolucion;
}
public void setNroCluster(int nroCluster){
this.nroCluster = nroCluster;
}
public void setListaGenes(ArrayList<String> listaGenes){
this.listaGenes = listaGenes;
}
public void addGenLista(String gen){
if(this.listaGenes == null){
this.listaGenes = new ArrayList();
this.listaGenes.add(gen);
}
else{
if(!this.listaGenes.contains(gen)){
this.listaGenes.add(gen);
}
}
}
/**
* @param diccionarioGenes the diccionarioGenes to set
*/
public void setDiccionarioGenes(ArrayList<GenDictionary> diccionarioGenes) {
this.diccionarioGenes = diccionarioGenes;
}
public void addDiccionarioGenLista(GenDictionary gen){
if(this.diccionarioGenes == null){
this.diccionarioGenes = new ArrayList();
this.diccionarioGenes.add(gen);
}
else{
if(!this.diccionarioGenes.contains(gen)){
this.diccionarioGenes.add(gen);
}
}
}
//</editor-fold>
}
| [
"amartinezaliaga@gmail.com"
] | amartinezaliaga@gmail.com |
740fe099ccaaeb485f1736581d7e57e16ded0c2c | fe2e63df37c3b8da81ea4758bcbc73a83752bd01 | /vlethyme/src/in/kmbs/vlethyme/security/VlethymeUserService.java | 33de08db406d67420075ed0b46d67d86022a7a6a | [] | no_license | roxolan/vlethyme | 119abae451e592a439019ed8cc492b7f9c78c8a1 | e32d05b01dd886022bd3cd526ec55d7e4a833714 | refs/heads/master | 2021-01-18T05:21:15.872933 | 2014-03-25T18:13:18 | 2014-03-25T18:13:18 | 17,607,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,150 | java | package in.kmbs.vlethyme.security;
import in.kmbs.vlethyme.converter.EntityToVOConverter;
import in.kmbs.vlethyme.model.User;
import in.kmbs.vlethyme.service.UserService;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Transactional;
public class VlethymeUserService implements UserDetailsService {
@Autowired
UserService userService;
@Transactional
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
// Declare a null Spring UserLogin
in.kmbs.vlethyme.security.User userDetails = null;
try {
// Search database for a user that matches the specified username
// get the user view object
User ldapUser = userService.getLdapUser(username);
User loginUser = EntityToVOConverter.convert(userService.findUserByUsername(username));
loginUser.setPassword(ldapUser.getPassword());
userDetails = new in.kmbs.vlethyme.security.User(loginUser, true, true, true, true, getAuthorities(loginUser));
} catch (Exception e) {
e.printStackTrace();
throw new UsernameNotFoundException("Error in retrieving user", e);
}
// Return user to Spring for processing. the actual authentication is
// done by spring
return userDetails;
}
private Collection<GrantedAuthority> getAuthorities(User user) {
// Create a list of grants for this user
List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>();
if (user.getRole() != null) {
authList.add(new SimpleGrantedAuthority(user.getRole().getName()));
} else {
authList.add(new SimpleGrantedAuthority("guest"));
}
return authList;
}
}
| [
"agabhi@gmail.com"
] | agabhi@gmail.com |
87c6d4b94ade306a668a793f312565c92dd7649b | 0eb5f3612b968d47f9da72a7d02e8b9905780fb3 | /src/main/java/com/bjpowernode/activemq/receive/QueueListenerReceiver.java | d212e0d80be8b472e970ba3929869fce9d8a6720 | [] | no_license | liuguanjia456/sadasdasdsda | 313f51413355ee390f0b08b3416b0ee2825d85bd | 25e80ba2d87c09d30b90c9fba62c8140256e3007 | refs/heads/master | 2020-04-26T18:07:35.177363 | 2019-03-08T04:02:06 | 2019-03-08T04:02:06 | 173,734,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,872 | java | package com.bjpowernode.activemq.receive;
import com.bjpowernode.activemq.model.User;
import org.apache.activemq.ActiveMQConnectionFactory;
import javax.jms.*;
import java.util.ArrayList;
import java.util.List;
/**
* ClassName:QueueReceiver
* Package:com.bjpowernode.activemq.receive
* Description:
*
* @date:2019/3/4 16:04
* @author:Felix
*/
//使用监听器异步接收接收点对点消息
public class QueueListenerReceiver {
private static String BROKER_URL = "tcp://192.168.144.128:61616";
private static String DESTINATION = "myQueue";
public static final String USER_NAME = "system";
public static final String PASSWORD = "123456";
public static void main(String[] args) {
receiveMessage();
}
public static void receiveMessage() {
Connection connection = null;
Session session = null;
MessageConsumer messageConsumer = null;
try {
//1.创建连接工厂
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(USER_NAME,PASSWORD,BROKER_URL);
List<String> trustedPackages = new ArrayList<String>();
trustedPackages.add("com.bjpowernode.activemq.model");
//设置受信任的包
connectionFactory.setTrustedPackages(trustedPackages);
//2.创建连接
connection = connectionFactory.createConnection();
//消息的消费者,必须显示调用start方法之后,才会对消息进行消费
connection.start();
//3.创建session
session = connection.createSession(Boolean.FALSE,Session.AUTO_ACKNOWLEDGE);
//4.创建目的地对象
Destination destination = session.createQueue(DESTINATION);
//5.创建消息的接收者
/*String selector = "author='felix' and version = 1";
messageConsumer = session.createConsumer(destination,selector);*/
messageConsumer = session.createConsumer(destination);
//6.消费消息
messageConsumer.setMessageListener(new MessageListener() {
public void onMessage(Message message){
try {
//7.判断接收到的消息类型
if(message instanceof TextMessage){
String text = ((TextMessage) message).getText();
System.out.println("接收到的消息为:" + text);
}else if(message instanceof ObjectMessage){
User user = (User) ((ObjectMessage) message).getObject();
System.out.println("接收到的用户名字为:" + user.getName() +",年龄:" + user.getAge());
}else if(message instanceof MapMessage){
System.out.println("学校" + ((MapMessage) message).getString("school")
+",年龄:" + ((MapMessage) message).getInt("age"));
}else if(message instanceof BytesMessage){
boolean flag = ((BytesMessage) message).readBoolean();
String text = ((BytesMessage) message).readUTF();
System.out.println(text + "::::" + flag);
}else if(message instanceof StreamMessage){
Long lo = ((StreamMessage) message).readLong();
String s = ((StreamMessage) message).readString();
System.out.println(s + "::::" + lo);
}
} catch (JMSException e) {
e.printStackTrace();
}
}
});
} catch (JMSException e) {
e.printStackTrace();
}
}
}
| [
"bj@126.com"
] | bj@126.com |
cd8c991b2790dc6037ba333bf4123cdb6d70e6a9 | ff884f6be46b7f550a725ed56748b914e27bf85d | /jdbc/src/test/java/com/becomejavasenior/dao/jdbc/impl/TagDaoImplTest.java | 81cf91127d244bd89831928ee1c4be9f8a6ed46a | [] | no_license | borntowinn/CRM | 79f5f3e69e81dcca44fd79690447c9f416ff277c | ddc1493c1aa9b8cea309cde60def328508defda2 | refs/heads/master | 2021-01-10T14:17:46.140070 | 2016-03-28T12:13:22 | 2016-03-28T12:13:22 | 53,863,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,531 | java | package com.becomejavasenior.dao.jdbc.impl;
import com.becomejavasenior.Tag;
import com.becomejavasenior.dao.TagDao;
import com.becomejavasenior.dao.exception.PersistException;
import com.becomejavasenior.dao.jdbc.factory.DaoFactory;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.List;
public class TagDaoImplTest {
private static Tag tag;
private List<Tag> tags;
private static TagDao<Tag> tagDao;
@BeforeClass
public static void setupAndConnection()
{
tagDao = DaoFactory.getTagDao();
tag = new Tag();
tag.setTag("one");
}
@Test
public void createDbEntry_Phase_PhaseFromDb()
{
Assert.assertEquals(tag.getTag(), tagDao.create(tag).getTag());
}
@Test
public void getRecordByPK()
{
//when
Integer id = tagDao.create(tag).getId();
//then
Assert.assertEquals(tag.getTag(), tagDao.getByPK(id).getTag());
tagDao.delete(id);
}
@Test
public void getAllRecordsTest()
{
//when
tags = tagDao.getAll();
//then
Assert.assertNotNull(tags);
Assert.assertTrue(tags.size() > 0);
}
@Test(expected=PersistException.class)
public void deleteRecord()
{
//when
Integer id = tagDao.create(tag).getId();
tagDao.delete(id);
//then -> exception must be thrown == the record was successfully deleted and can't be accessed anymore
tagDao.getByPK(id);
}
} | [
"svetavv90@i.ua"
] | svetavv90@i.ua |
960291936db72c3d4a17c5612c10bc14519de6eb | 84accba0a7d9c2115b10dde52aa077c42b1d4c87 | /qrphase/src/main/java/com/cn/guojinhu/MainActivity.java | a35d44c1d711632e2521c4e926e67702cb643815 | [] | no_license | Vo7ice/CountDown | 46a80c1449f36ddc36fad6cc82dd7be011eafd79 | 936ca7ec89553ce0984f6c28d312b56aaada5027 | refs/heads/master | 2020-05-21T20:00:06.355217 | 2016-12-13T01:46:22 | 2016-12-13T01:46:22 | 60,959,924 | 0 | 0 | null | 2016-09-06T10:50:22 | 2016-06-12T09:54:48 | Java | UTF-8 | Java | false | false | 2,121 | java | package com.cn.guojinhu;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import abe.no.seimei.qrphase.R;
public class MainActivity extends AppCompatActivity {
private Button mButtonNormal;
private Button mButtonURL;
private Button mButtonContact;
private static final String code_contact =
"BEGIN:VCARD\n" +
"VERSION:3.0\n" +
"N:Tort\n" +
"TEL;TYPE=home:222\n" +
"TEL;TYPE=home:2525\n" +
"END:VCARD";
private static final String code_url_right = "http://weibo.cn/qr/userinfo?uid=1665356464";
private static final String code_url_error = "this is a test string";
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_main);
setSupportActionBar(toolbar);
mButtonNormal = (Button) findViewById(R.id.button_normal);
mButtonURL = (Button) findViewById(R.id.button_url);
mButtonContact = (Button) findViewById(R.id.button_contact);
mButtonNormal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Utils.startActionPhase(MainActivity.this, code_url_error);
}
});
mButtonURL.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Utils.startActionPhase(MainActivity.this, code_url_right);
}
});
mButtonContact.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Utils.startActionPhase(MainActivity.this, code_contact);
}
});
}
}
| [
"Vo7ice@outlook.com"
] | Vo7ice@outlook.com |
ea03801ddc7e2d3dee32e039436ff2ae70ee6a1b | 8dd25a266d7dafbec3acd0c4d326d4a228551b19 | /app/src/androidTest/java/com/nougat/learnjava/ExampleInstrumentedTest.java | 8bca02174435e646417e390d57daa5936422de41 | [] | no_license | Hardikganatra01/LearnJava | 9907a1d9e6402c8288a673a3f80d87fc57933ea4 | 3f9d6c2a821aadecb857abe012d417960a05b15d | refs/heads/master | 2021-01-11T16:32:29.899107 | 2017-01-26T10:52:56 | 2017-01-26T10:52:56 | 80,105,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.nougat.learnjava;
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.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.nougat.learnjava", appContext.getPackageName());
}
}
| [
"hardikganatra01@gmail.com"
] | hardikganatra01@gmail.com |
108915d135e2f15addf14779935852ab0701fde3 | 4d25f18fec1e353143fb43224e20d10252587866 | /src/main/java/com/molinari/utility/io/URLUTF8Encoder.java | 51d200daac1cf3d141e5678dabb55ce7ffcbee16 | [] | no_license | marcouio/utility | 755857d691bb6132867f2331dfc93783d0cc9b77 | ff8f143007d0f0a37400558b9f58cc95eb362db5 | refs/heads/master | 2023-06-01T08:18:07.688972 | 2023-05-24T08:22:51 | 2023-05-24T08:22:51 | 50,748,378 | 0 | 0 | null | 2023-05-24T08:22:52 | 2016-01-30T22:40:37 | Java | UTF-8 | Java | false | false | 6,993 | java | package com.molinari.utility.io;
/**
* Provides a method to encode any string into a URL-safe
* form.
* Non-ASCII characters are first encoded as sequences of
* two or three bytes, using the UTF-8 algorithm, before being
* encoded as %HH escapes.
*
* Created: 17 April 1997
* Author: Bert Bos <bert@w3.org>
*
* URLUTF8Encoder: http://www.w3.org/International/URLUTF8Encoder.java
*
* Copyright © 1997 World Wide Web Consortium, (Massachusetts
* Institute of Technology, European Research Consortium for
* Informatics and Mathematics, Keio University). All Rights Reserved.
* This work is distributed under the W3C® Software License [1] 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.
*
* [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
public class URLUTF8Encoder
{
final static String[] hex = {
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
"%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f",
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
"%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f",
"%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27",
"%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f",
"%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37",
"%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f",
"%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47",
"%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f",
"%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57",
"%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f",
"%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67",
"%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f",
"%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77",
"%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f",
"%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87",
"%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f",
"%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97",
"%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f",
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7",
"%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af",
"%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7",
"%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf",
"%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7",
"%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf",
"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
"%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df",
"%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7",
"%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef",
"%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
"%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff"
};
/**
* Encode a string to the "x-www-form-urlencoded" form, enhanced
* with the UTF-8-in-URL proposal. This is what happens:
*
* <ul>
* <li><p>The ASCII characters 'a' through 'z', 'A' through 'Z',
* and '0' through '9' remain the same.
*
* <li><p>The unreserved characters - _ . ! ~ * ' ( ) remain the same.
*
* <li><p>The space character ' ' is converted into a plus sign '+'.
*
* <li><p>All other ASCII characters are converted into the
* 3-character string "%xy", where xy is
* the two-digit hexadecimal representation of the character
* code
*
* <li><p>All non-ASCII characters are encoded in two steps: first
* to a sequence of 2 or 3 bytes, using the UTF-8 algorithm;
* secondly each of these bytes is encoded as "%xx".
* </ul>
*
* @param s The string to be encoded
* @return The encoded string
*/
public static String encode(String s)
{
StringBuffer sbuf = new StringBuffer();
int len = s.length();
for (int i = 0; i < len; i++) {
int ch = s.charAt(i);
if ('A' <= ch && ch <= 'Z') { // 'A'..'Z'
sbuf.append((char)ch);
} else if ('a' <= ch && ch <= 'z') { // 'a'..'z'
sbuf.append((char)ch);
} else if ('0' <= ch && ch <= '9') { // '0'..'9'
sbuf.append((char)ch);
} else if (ch == ' ') { // space
sbuf.append('+');
} else if (ch == '-' || ch == '_' // unreserved
|| ch == '.' || ch == '!'
|| ch == '~' || ch == '*'
|| ch == '\'' || ch == '('
|| ch == ')') {
sbuf.append((char)ch);
} else if (ch <= 0x007f) { // other ASCII
sbuf.append(hex[ch]);
} else if (ch <= 0x07FF) { // non-ASCII <= 0x7FF
sbuf.append(hex[0xc0 | (ch >> 6)]);
sbuf.append(hex[0x80 | (ch & 0x3F)]);
} else { // 0x7FF < ch <= 0xFFFF
sbuf.append(hex[0xe0 | (ch >> 12)]);
sbuf.append(hex[0x80 | ((ch >> 6) & 0x3F)]);
sbuf.append(hex[0x80 | (ch & 0x3F)]);
}
}
return sbuf.toString();
}
public static String unescape(String s) {
StringBuilder sbuf = new StringBuilder() ;
int l = s.length() ;
int ch = -1 ;
int b, sumb = 0;
for (int i = 0, more = -1 ; i < l ; i++) {
/* Get next byte b from URL segment s */
switch (ch = s.charAt(i)) {
case '%':
ch = s.charAt (++i) ;
int hb = (Character.isDigit ((char) ch)
? ch - '0'
: 10+Character.toLowerCase((char) ch) - 'a') & 0xF ;
ch = s.charAt (++i) ;
int lb = (Character.isDigit ((char) ch)
? ch - '0'
: 10+Character.toLowerCase((char) ch) - 'a') & 0xF ;
b = (hb << 4) | lb ;
break ;
case '+':
b = ' ' ;
break ;
default:
b = ch ;
}
/* Decode byte b as UTF-8, sumb collects incomplete chars */
if ((b & 0xc0) == 0x80) { // 10xxxxxx (continuation byte)
sumb = (sumb << 6) | (b & 0x3f) ; // Add 6 bits to sumb
if (--more == 0) sbuf.append((char) sumb) ; // Add char to sbuf
} else if ((b & 0x80) == 0x00) { // 0xxxxxxx (yields 7 bits)
sbuf.append((char) b) ; // Store in sbuf
} else if ((b & 0xe0) == 0xc0) { // 110xxxxx (yields 5 bits)
sumb = b & 0x1f;
more = 1; // Expect 1 more byte
} else if ((b & 0xf0) == 0xe0) { // 1110xxxx (yields 4 bits)
sumb = b & 0x0f;
more = 2; // Expect 2 more bytes
} else if ((b & 0xf8) == 0xf0) { // 11110xxx (yields 3 bits)
sumb = b & 0x07;
more = 3; // Expect 3 more bytes
} else if ((b & 0xfc) == 0xf8) { // 111110xx (yields 2 bits)
sumb = b & 0x03;
more = 4; // Expect 4 more bytes
} else /*if ((b & 0xfe) == 0xfc)*/ { // 1111110x (yields 1 bit)
sumb = b & 0x01;
more = 5; // Expect 5 more bytes
}
/* No need to test if the UTF-8 encoding is well-formed */
}
return sbuf.toString() ;
}
} | [
"marco.molinari1980@gmail.com"
] | marco.molinari1980@gmail.com |
379b8e68ea8b09c212b5f69d9deefc4408bae5fa | 2f7ed85390e6d07fbceb52c3097c14f5c65d52a4 | /src/by/it/dziomin/jd01_02/Test_jd01_02.java | e1a5dd4f00225eff12ae1ea9acb7cb7e75f2bf22 | [] | no_license | migeniya/JD2018-12-10 | 4def3baf833eb0d9450baff7588f096dc44ce4ae | bf227c0e1b3c4da93d41b3beb1fa2d3ea04dab6e | refs/heads/master | 2020-04-12T09:47:01.862944 | 2019-06-24T07:44:47 | 2019-06-24T07:44:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,067 | java | package by.it.dziomin.jd01_02;
import org.junit.Test;
import java.io.*;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import static org.junit.Assert.*;
@SuppressWarnings("all")
//поставьте курсор на следующую строку и нажмите Ctrl+Shift+F10
public class Test_jd01_02 {
@Test(timeout = 5000)
public void testTaskA() throws Exception {
System.out.println("\n\nПроверка на минимум и максимум");
checkMethod("TaskA", "static step1", int[].class);
run("-1 2 3 4 567 567 4 3 2 -1 4 4").include("-1 567");
System.out.println("\n\nПроверка на вывод значений меньше среднего");
checkMethod("TaskA", "static step2", int[].class);
run("-1 22 33 44 567 567 44 33 22 -1 4 4")
.include("-1").include("22").include("33").include("44");
System.out.println("\n\nПроверка на индексы минимума");
checkMethod("TaskA", "static step3", int[].class);
run("-1 22 33 44 567 567 44 33 22 -1 4 4").include("9 0");
}
@Test(timeout = 5000)
public void testTaskAstep1_MinMax__TaskA() throws Exception {
Test_jd01_02 ok = run("", false);
Method m = checkMethod(ok.aClass.getSimpleName(), "static step1", int[].class);
System.out.println("Проверка на массиве -1, 2, 3, 4, 567, 567, 4, 3, 2, -1, 4, 4");
m.invoke(null, new int[]{-1, 2, 3, 4, 567, 567, 4, 3, 2, -1, 4, 4});
ok.include("").include("-1 567");
}
@Test(timeout = 5000)
public void testTaskAstep2_Avg__TaskA() throws Exception {
Test_jd01_02 ok = run("", false);
Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int[].class);
System.out.println("Проверка на массиве -1, 22, 30+3, 44, 500+67, 500+67, 44, 30+3, 22, -1, 4, 4");
m.invoke(null, new int[]{-1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4});
ok.include("").include("-1")
.include("1").include("2").include("3").include("4")
.include("22").include("33").include("44").exclude("567");
}
@Test(timeout = 5000)
public void testTaskAstep3_IndexMinMax__TaskA() throws Exception {
Test_jd01_02 ok = run("", false);
Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", int[].class);
System.out.println("Проверка на массиве -1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4");
m.invoke(null, new int[]{-1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4});
ok.include("").include("9 0");
}
@Test(timeout = 5000)
public void testTaskB() throws Exception {
System.out.println("\n\nПроверка на вывод матрицы 5 x 5");
checkMethod("TaskB", "step1");
run("0 1 2 3")
.include("11 12 13 14 15").include("16 17 18 19 20")
.include("21 22 23 24 25");
;
System.out.println("\n\nПроверка на ввод номера месяца");
checkMethod("TaskB", "step2", int.class);
run("0 2 3 4").include("нет такого месяца");
run("1 2 3 4").include("январь");
run("2 2 3 4").include("февраль");
run("3 2 3 4").include("март");
run("4 2 3 4").include("апрель");
run("5 2 3 4").include("май");
run("6 2 3 4").include("июнь");
run("7 2 3 4").include("июль");
run("8 2 3 4").include("август");
run("9 2 3 4").include("сентябрь");
run("10 2 3 4").include("октябрь");
run("11 2 3 4").include("ноябрь");
run("12 2 3 4").include("декабрь");
run("13 2 3 4").include("нет такого месяца");
System.out.println("\n\nПроверка на решение квадратного уравнения");
checkMethod("TaskB", "step3", double.class, double.class, double.class);
run("0 2 4 2").include("-1");
run("0 2 4 0").include("0.0").include("-2.0");
run("0 2 4 4").include("корней нет");
}
@Test(timeout = 5000)
public void testTaskBstep1_Loop__TaskB() throws Exception {
Test_jd01_02 ok = run("", false);
Method m = checkMethod(ok.aClass.getSimpleName(), "static step1");
m.invoke(null);
ok.include("11 12 13 14 15").include("16 17 18 19 20").include("21 22 23 24 25");
}
@Test(timeout = 5000)
public void testTaskBstep2_Switch__TaskB() throws Exception {
Test_jd01_02 ok = run("", false);
Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int.class);
m.invoke(null, 0);
ok.include("нет такого месяца");
m.invoke(null, 1);
ok.include("январь");
m.invoke(null, 2);
ok.include("февраль");
m.invoke(null, 3);
ok.include("март");
m.invoke(null, 4);
ok.include("апрель");
m.invoke(null, 5);
ok.include("май");
m.invoke(null, 6);
ok.include("июнь");
m.invoke(null, 7);
ok.include("июль");
m.invoke(null, 8);
ok.include("август");
m.invoke(null, 9);
ok.include("сентябрь");
m.invoke(null, 10);
ok.include("октябрь");
m.invoke(null, 11);
ok.include("ноябрь");
m.invoke(null, 12);
ok.include("декабрь");
m.invoke(null, 13);
ok.include("нет такого месяца");
}
@Test(timeout = 5000)
public void testTaskBstep3_QEquation__TaskB() throws Exception {
Test_jd01_02 ok = run("", false);
Method m = checkMethod(ok.aClass.getSimpleName(), "static step3",
double.class, double.class, double.class);
System.out.println("Квадратное уравление:");
System.out.println("для a=2, для b=4, для c=2, ожидается один корень: минус 1");
m.invoke(null, 2, 4, 2);
ok.include("-1");
System.out.println("для a=1, для b=-1, для c=-2, ожидается два корня: минус один и два ");
m.invoke(null, 1, -1, -2);
ok.include("-1").include("2");
System.out.println("для a=2, для b=4, для c=4, ожидается решение без корней");
m.invoke(null, 2, 4, 4);
ok.include("корней нет");
}
@Test(timeout = 5000)
public void testTaskC() throws Exception {
System.out.println("\n\nПроверка на создание массива TaskC.step1");
checkMethod("TaskC", "step1", int.class);
run("3").include("-3").include("3");
run("4").include("-4").include("4");
Test_jd01_02 ok = run("5").include("-5").include("5");
System.out.println("\nПроверка на сумму элементов TaskC.step2");
checkMethod("TaskC", "step2", int[][].class);
int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}};
Method m = ok.aClass.getDeclaredMethod("step2", m4.getClass());
int sum = (int) ok.invoke(m, null, new Object[]{m4});
assertEquals("Неверная сумма в step2", -6, sum);
System.out.println("\nПроверка на удаление максимума TaskC.step3");
checkMethod("TaskC", "step3", int[][].class);
m = ok.aClass.getDeclaredMethod("step3", int[][].class);
int[][] res = (int[][]) ok.invoke(m, null, new Object[]{m4});
int[][] expectmas = {{-1, 2, -2}, {-2, -2, -6}};
assertArrayEquals("Не найден ожидаемый массив {{-1,2,-2},{-2,-2,-6}}", expectmas, res);
}
@Test(timeout = 5000)
public void testTaskCstep1_IndexMinMax__TaskC() throws Exception {
Test_jd01_02 ok = run("", false);
Method m = checkMethod(ok.aClass.getSimpleName(), "static step1", int.class);
int[][] mas = (int[][]) m.invoke(null, 5);
boolean min = false;
boolean max = false;
for (int[] row : mas)
for (int i : row) {
if (i == -5) min = true;
if (i == 5) max = true;
}
if (!max || !min) {
fail("В массиве нет максимума 5 или минимума -5");
}
}
@Test(timeout = 5000)
public void testTaskCstep2_Sum__TaskC() throws Exception {
Test_jd01_02 ok = run("", false);
int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}};
Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int[][].class);
int sum = (int) ok.invoke(m, null, new Object[]{m4});
assertEquals("Неверная сумма в step2", -6, sum);
}
@Test(timeout = 5000)
public void testTaskCstep3_DeleteMax__TaskC() throws Exception {
Test_jd01_02 ok = run("", false);
int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}};
Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", int[][].class);
int[][] actualmas = (int[][]) ok.invoke(m, null, new Object[]{m4});
int[][] expectmas = {{-1, 2, -2}, {-2, -2, -6}};
for (int i = 0; i < actualmas.length; i++) {
System.out.println("Проверка строки " + i);
System.out.println(" Ожидается: " + Arrays.toString(expectmas[i]));
System.out.println("Из метода получено: " + Arrays.toString(actualmas[i]));
assertArrayEquals("Метод работает некорректно", expectmas[i], actualmas[i]);
}
System.out.println("Проверка завершена успешно!");
}
/*
===========================================================================================================
НИЖЕ ВСПОМОГАТЕЛЬНЫЙ КОД ТЕСТОВ. НЕ МЕНЯЙТЕ В ЭТОМ ФАЙЛЕ НИЧЕГО.
Но изучить как он работает - можно, это всегда будет полезно.
===========================================================================================================
*/
//------------------------------- методы ----------------------------------------------------------
private Class findClass(String SimpleName) {
String full = this.getClass().getName();
String dogPath = full.replace(this.getClass().getSimpleName(), SimpleName);
try {
return Class.forName(dogPath);
} catch (ClassNotFoundException e) {
fail("\nERROR:Тест не пройден. Класс " + SimpleName + " не найден.");
}
return null;
}
private Method checkMethod(String className, String methodName, Class<?>... parameters) throws Exception {
Class aClass = this.findClass(className);
try {
methodName = methodName.trim();
Method m;
if (methodName.startsWith("static")) {
methodName = methodName.replace("static", "").trim();
m = aClass.getDeclaredMethod(methodName, parameters);
if ((m.getModifiers() & Modifier.STATIC) != Modifier.STATIC) {
fail("\nERROR:Метод " + m.getName() + " должен быть статическим");
}
} else
m = aClass.getDeclaredMethod(methodName, parameters);
m.setAccessible(true);
return m;
} catch (NoSuchMethodException e) {
System.err.println("\nERROR:Не найден метод " + methodName + " либо у него неверная сигнатура");
System.err.println("ERROR:Ожидаемый класс: " + className);
System.err.println("ERROR:Ожидаемый метод: " + methodName);
return null;
}
}
private Method findMethod(Class<?> cl, String name, Class... param) {
try {
return cl.getDeclaredMethod(name, param);
} catch (NoSuchMethodException e) {
fail("\nERROR:Тест не пройден. Метод " + cl.getName() + "." + name + " не найден\n");
}
return null;
}
private Object invoke(Method method, Object o, Object... value) {
try {
method.setAccessible(true);
return method.invoke(o, value);
} catch (Exception e) {
System.out.println(e.toString());
fail("\nERROR:Не удалось вызвать метод " + method.getName() + "\n");
}
return null;
}
//метод находит и создает класс для тестирования
//по имени вызывающего его метода, testTaskA1 будет работать с TaskA1
private static Test_jd01_02 run(String in) {
return run(in, true);
}
private static Test_jd01_02 run(String in, boolean runMain) {
Throwable t = new Throwable();
StackTraceElement trace[] = t.getStackTrace();
StackTraceElement element;
int i = 0;
do {
element = trace[i++];
}
while (!element.getMethodName().contains("test"));
String[] path = element.getClassName().split("\\.");
String nameTestMethod = element.getMethodName();
String clName = nameTestMethod.replace("test", "");
clName = clName.replaceFirst(".+__", "");
clName = element.getClassName().replace(path[path.length - 1], clName);
System.out.println("\n---------------------------------------------");
System.out.println("Старт теста для " + clName);
if (!in.isEmpty()) System.out.println("input:" + in);
System.out.println("---------------------------------------------");
return new Test_jd01_02(clName, in, runMain);
}
//------------------------------- тест ----------------------------------------------------------
public Test_jd01_02() {
//Конструктор тестов
}
//переменные теста
private String className;
private Class<?> aClass;
private PrintStream oldOut = System.out; //исходный поток вывода
private PrintStream newOut; //поле для перехвата потока вывода
private StringWriter strOut = new StringWriter(); //накопитель строки вывода
//Основной конструктор тестов
private Test_jd01_02(String className, String in, boolean runMain) {
//this.className = className;
aClass = null;
try {
aClass = Class.forName(className);
this.className = className;
} catch (ClassNotFoundException e) {
fail("ERROR:Не найден класс " + className + "/n");
}
InputStream reader = new ByteArrayInputStream(in.getBytes());
System.setIn(reader); //перехват стандартного ввода
System.setOut(newOut); //перехват стандартного вывода
if (runMain) //если нужно запускать, то запустим, иначе оставим только вывод
try {
Class[] argTypes = new Class[]{String[].class};
Method main = aClass.getDeclaredMethod("main", argTypes);
main.invoke(null, (Object) new String[]{});
System.setOut(oldOut); //возврат вывода, нужен, только если был запуск
} catch (Exception x) {
x.printStackTrace();
}
}
//проверка вывода
private Test_jd01_02 is(String str) {
assertTrue("ERROR:Ожидается такой вывод:\n<---начало---->\n" + str + "<---конец--->",
strOut.toString().equals(str));
return this;
}
private Test_jd01_02 include(String str) {
assertTrue("ERROR:Строка не найдена: " + str + "\n", strOut.toString().contains(str));
return this;
}
private Test_jd01_02 exclude(String str) {
assertTrue("ERROR:Лишние данные в выводе: " + str + "\n", !strOut.toString().contains(str));
return this;
}
//логический блок перехвата вывода
{
newOut = new PrintStream(new OutputStream() {
private byte bytes[] = new byte[1];
private int pos = 0;
@Override
public void write(int b) throws IOException {
if (pos==0 && b=='\r') //пропуск \r (чтобы win mac и linux одинаково работали
return;
if (pos == 0) { //определим кодировку https://ru.wikipedia.org/wiki/UTF-8
if ((b & 0b11110000) == 0b11110000) bytes = new byte[4];
else if ((b & 0b11100000) == 0b11100000) bytes = new byte[3];
else if ((b & 0b11000000) == 0b11000000) bytes = new byte[2];
else bytes = new byte[1];
}
bytes[pos++] = (byte) b;
if (pos == bytes.length) { //символ готов
String s = new String(bytes); //соберем весь символ
strOut.append(s); //запомним вывод для теста
oldOut.append(s); //копию в обычный вывод
pos = 0; //готовим новый символ
}
}
});
}
}
| [
"DziominPavel@gmail.com"
] | DziominPavel@gmail.com |
8ecbcdb27c1cfef83e99ba032a090e8ee2f270bf | dcbecc3c80dd109b1d5928c722ad32a7d59b7017 | /CouponSystemMavenWeb/src/main/java/couponsystem/serviceImps/LoginServiceImpl.java | d40e59f3f4ffdb63aa9d4ae889228c30c146cb1c | [] | no_license | davidagr/mavencoupsysjava | 1cac88de45d3f3d3804196bc9947fd12af073635 | 97f53ae9bfb616cc9bc853df670cceeb9a444989 | refs/heads/master | 2020-07-24T06:40:42.262869 | 2019-09-11T14:37:31 | 2019-09-11T14:37:31 | 207,832,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,952 | java | package couponsystem.serviceImps;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import couponsystem.entities.Company;
import couponsystem.entities.Customer;
import couponsystem.enums.ClientType;
import couponsystem.repositories.CompanyRepository;
import couponsystem.repositories.CustomerRepository;
@RestController
@RequestMapping("coupon-system")
public class LoginServiceImpl {
@Autowired
private CompanyRepository companyRepository;
@Autowired
private CustomerRepository customerRepository;
@RequestMapping("login/{name}/{password}/{clientType}")
public boolean login(@PathVariable String name, @PathVariable String password, @PathVariable ClientType clientType,
HttpSession session) {
switch (clientType) {
case ADMIN:
if (name.equals("admin") && password.equals("1234")) {
session.setAttribute("user", "admin");
System.out.println("Admin is logged in");
return true;
}
System.out.println("username or password incorrect");
return false;
case COMPANY:
Company company = companyRepository.findByCompNameAndPassword(name, password);
if (company != null) {
session.setAttribute("user", company);
System.out.println(name + " is logged in");
return true;
}
System.out.println("username or password incorrect");
return false;
case CUSTOMER:
Customer customer = customerRepository.findByCustNameAndPassword(name, password);
if (customer != null) {
session.setAttribute("user", customer);
System.out.println(name + " is logged in");
return true;
}
System.out.println("username or password incorrect");
return false;
}
return false;
}
}
| [
"noreply@github.com"
] | davidagr.noreply@github.com |
69d1db3ff4cfde770b70585c0705b72d3b82238a | e7a0c73b4fd8a2292302f0132cbc1d430cd06085 | /app/src/main/java/com/brainyapps/footprints/admins/AdminReportedUsersActivity.java | 1be1e9a1bb2a9d1bebd05f7c344b03ab99295473 | [] | no_license | lggg123/Android_Social_Sharing_Footprints | a1c86469f8ae39f3cb8f5da7a664e35dcaf2a0cb | 99cc5e32d3fca8c64180d38b7d41fbfb3f67334c | refs/heads/master | 2020-05-07T20:44:30.093636 | 2019-04-11T21:14:25 | 2019-04-11T21:14:25 | 180,875,608 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,550 | java | package com.brainyapps.footprints.admins;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.brainyapps.footprints.R;
import com.brainyapps.footprints.adapters.AdminReportyRecyclerAdapter;
import com.brainyapps.footprints.constants.DBInfo;
import com.brainyapps.footprints.constants.IntentExtra;
import com.brainyapps.footprints.models.Report;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import com.walnutlabs.android.ProgressHUD;
import java.util.ArrayList;
public class AdminReportedUsersActivity extends AppCompatActivity implements View.OnClickListener, AdminReportyRecyclerAdapter.OnClickItemListener{
private ArrayList<Report> reportList = new ArrayList<>();
private RecyclerView recyclerView;
private AdminReportyRecyclerAdapter adminReportRecyclerAdapter;
private DatabaseReference report_info;
private ImageView btn_back;
private ProgressHUD mProgressDialog;
private void showProgressHUD(String text) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
}
mProgressDialog = ProgressHUD.show(this, text, true);
mProgressDialog.show();
}
private void hideProgressHUD() {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_reported_users);
btn_back = (ImageView)findViewById(R.id.admin_reported_users_btn_back);
btn_back.setOnClickListener(this);
adminReportRecyclerAdapter = new AdminReportyRecyclerAdapter(reportList);
recyclerView = (RecyclerView) findViewById(R.id.admin_reported_user_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
recyclerView.setAdapter(adminReportRecyclerAdapter);
adminReportRecyclerAdapter.setOnClickItemListener(this);
}
private ValueEventListener getReportInfoListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
TextView no_result = (TextView) findViewById(R.id.admin_report_no_user);
if(dataSnapshot.exists()){
no_result.setVisibility(View.GONE);
for (DataSnapshot reportInfo : dataSnapshot.getChildren()) {
Report report = reportInfo.getValue(Report.class);
reportList.add(report);
}
adminReportRecyclerAdapter.notifyDataSetChanged();
hideProgressHUD();
}
else {
no_result.setVisibility(View.VISIBLE);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.admin_reported_users_btn_back:
super.onBackPressed();
break;
default:
break;
}
}
@Override
public void onSelectProfile(int index, String reportId) {
Intent process_report_intent = new Intent(this, AdminProcessReportActivity.class);
Bundle bundle = new Bundle();
bundle.putString(IntentExtra.REPORT_ID, reportId);
process_report_intent.putExtras(bundle);
startActivity(process_report_intent);
}
@Override
public void onResume() {
super.onResume();
adminReportRecyclerAdapter.clear();
report_info = FirebaseDatabase.getInstance().getReference().child(DBInfo.TBL_REPORT);
report_info.addValueEventListener(getReportInfoListener);
}
@Override
public void onDestroy() {
super.onDestroy();
report_info.removeEventListener(getReportInfoListener);
}
}
| [
"noreply@github.com"
] | lggg123.noreply@github.com |
116324acc8e6271aa88e40453c91021d746fca1d | 0c2a32da501e4d0fd10e8573515ba053412ac670 | /src/main/java/example/pattern/abstractfactory/Article.java | 70d675ad0131c2904606e28da16c9e39e69f361c | [] | no_license | rainzhao/datastruct | 73bd6e94729edcd2997c08ae1ecfa0584240ea98 | 124092b447f40214dbeb3d5a2df187a9803d501f | refs/heads/master | 2022-12-21T10:17:40.850144 | 2019-12-02T17:05:27 | 2019-12-02T17:05:27 | 195,538,837 | 0 | 0 | null | 2022-12-10T05:27:27 | 2019-07-06T12:48:40 | Java | UTF-8 | Java | false | false | 158 | java | package example.pattern.abstractfactory;
/**
* @author zhaoyu
* @date 2019-02-20
*/
public abstract class Article {
public abstract void produce();
}
| [
"zhaoyu06984@hellobike.com"
] | zhaoyu06984@hellobike.com |
7b5b9e054d81904802e0c49f088099ce372bb25a | 01a2135e657b8bd2fcbd9c5d53e5b110d0364c6f | /ServeurBillets/src/Server/Requete.java | ee0a6aea31bcff7f13f147c11bb404d09c1afb5f | [] | no_license | Syric420/ReseauxVilvens | 5979374fed0c705fc619bc9dcfed0538cbe70d95 | dad16ee3ea4b8e23f69009948c6dd84251aa663d | refs/heads/Master | 2018-11-16T17:17:47.212153 | 2018-09-09T15:02:29 | 2018-09-09T15:02:29 | 106,200,952 | 1 | 2 | null | 2018-09-09T15:02:29 | 2017-10-08T18:49:21 | Java | UTF-8 | Java | false | false | 417 | 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 Server;
import java.net.*;
import java.security.PublicKey;
/**
*
* @author Vince
*/
public interface Requete {
public Runnable createRunnable (Socket s, ConsoleServeur cs,PublicKey cléPublique);
}
| [
"tibhault145@gmail.com"
] | tibhault145@gmail.com |
1730c95ed063210f430f7c0a40059516b6d8511b | 98afa6b600ca438c04f4084dc56e61f871c8bcb9 | /hms-service/src/main/java/com/urt/service/manager/interfaces/subscription/SubscriptionManager.java | a525fe3c94eece39f57a773ad79cdd8dfebdaa13 | [] | no_license | RaviThejaGoud/hospital | 88d2f4fc8c3152af2411d0a8f722e7528e6a008d | 55a4a51f31b988d82c432474e62fde611f5622d8 | refs/heads/master | 2021-04-10T01:18:30.174761 | 2018-03-19T15:47:09 | 2018-03-19T15:47:09 | 125,875,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package com.urt.service.manager.interfaces.subscription;
import java.util.List;
import com.urt.persistence.model.customer.Customer;
import com.urt.service.manager.interfaces.base.UniversalManager;
/**
* Business Service Interface to handle communication between web and
* persistence layer.
*
* <p><a href="SubscriptionManager.java.html"><i>View Source</i></a></p>
*/
public interface SubscriptionManager extends UniversalManager {
List<Customer> findExistCustomer(String keyWord);
}
| [
"ravisiva523@gmail.com"
] | ravisiva523@gmail.com |
66e45f260df5795e5e2c50ca6fac007d6493d26b | 44c0165fc75622939862bf21be60f05ffaac77d3 | /src/main/java/Illuminated/Source Code/Chapter_11/Programming Activity 2/Deposit.java | c3a52ea86bd876a2c4617f70ef3f3bd462e10738 | [] | no_license | jestivalv/Java-Training | cd05a8e87322c88c2b7d7bb2810717e7c94c97a9 | dae69dbf60788771897a8d623bffb953ff0b984a | refs/heads/master | 2021-05-01T11:07:47.132171 | 2018-02-23T12:22:54 | 2018-02-23T12:22:54 | 121,112,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,438 | java | /* Deposit class
Anderson, Franceschi
*/
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import java.text.DecimalFormat;
import javafx.scene.text.Font;
public class Deposit extends Transaction
{
public Deposit( double p )
{
super( p );
}
public void draw( GraphicsContext gc, Color background )
{
drawAccountBalance( gc );
String display1 = "Deposit: Amount = " + money.format( amount );
// set color to blue
gc.setFill( Color.BLUE );
gc.fillText( display1, 20, 50 );
// set color to black
gc.setFill( Color.BLACK );
gc.fillText( display2, 20, 75 );
// set color to blue
gc.setFill( Color.BLUE );
gc.fillText( "Deposit", startX + 3, startY - 44 );
// draw Work, Internet, Bank
gc.setStroke( Color.BLUE );
gc.strokeLine( startX, startY - 2 * digitSide / 3, endX, startY - 2 * digitSide / 3 );
gc.strokeLine( startX, startY + digitSide + digitSide / 3, endX, startY + 4 * digitSide / 3 );
gc.fillText( "Work", startX - digitSide - digitSide / 3, startY + 2 * digitSide / 3 );
gc.fillText( "ABC Bank", endX + digitSide / 3, startY + 2 * digitSide / 3 );
// Draw a dollar bill
gc.setFill ( Color.rgb( 0, 255, 0 ) );// green
gc.fillRect( x, startY - digitSide / 4, 2 * digitSide, digitSide );
gc.setFill ( Color.rgb( 0, 0, 0 ) );
gc.fillText( "$$$", x + digitSide / 5, startY + 2 * digitSide / 3 );
}
}
| [
"jestival@gmail.com"
] | jestival@gmail.com |
aa1aceb62bf23092fd46fd93a0989907ae0734d2 | b664bae5e4d2d752aeee2c275590dabfa659b786 | /AppTemplate/src/main/java/rs/android/util/Type.java | 701bcf5f39ba0cc4a9cae382eb622fe44d5a4141 | [] | no_license | netssrmrz/coralracer | 60bb0804bac6565b57d70f8d3dd88bbed8fe53fe | bf81baaedbadfc90c72c1375ef8dd370c421f05e | refs/heads/master | 2021-07-04T15:23:27.511120 | 2020-09-04T04:32:27 | 2020-09-04T04:32:27 | 169,189,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,759 | java | package rs.android.util;
public class Type
{
public static Class<?> Class_For_Name(String name)
{
Class<?> res=null;
try {res=Class.forName(name);}
catch (java.lang.ClassNotFoundException e) {res=null;}
return res;
}
public static Object GetObjFieldValue(Object obj, String field_name)
{
Object res=null;
java.lang.reflect.Method method;
java.lang.reflect.Field field;
Class<? extends Object> class_type;
if (obj!=null && rs.android.Util.NotEmpty(field_name))
{
class_type=obj.getClass();
field=FindClassField(class_type, field_name);
if (rs.android.Util.NotEmpty(field))
{
try
{
res=field.get(obj);
}
catch (java.lang.Exception e)
{
res=null;
e.printStackTrace();
}
}
else
{
method=FindClassMethod(class_type, "get"+field_name);
if (rs.android.Util.NotEmpty(method))
{
try
{
res=method.invoke(obj, (Object[])null);
}
catch (java.lang.Exception e)
{
res=null;
e.printStackTrace();
}
}
}
}
return res;
}
public static boolean SetObjFieldValue(Object obj,
String field_name, Object val)
{
java.lang.reflect.Method method;
java.lang.reflect.Field field;
Class<? extends Object> class_type;
Object[] params;
boolean res=false;
if (obj!=null && rs.android.Util.NotEmpty(field_name))
{
class_type=obj.getClass();
field=FindClassField(class_type, field_name);
if (rs.android.Util.NotEmpty(field))
{
try {field.set(obj, val); res=true;}
catch (Exception e) { res=false; }
}
else
{
method=FindClassMethod(class_type, "set"+field_name);
if (rs.android.Util.NotEmpty(method))
{
params=new Object[1];
params[0]=val;
try {method.invoke(obj, params); res=true;}
catch (Exception e) {res=false;}
}
}
}
return res;
}
public static java.lang.reflect.Method FindClassMethod(Class<? extends Object> obj_class, String name)
{
java.lang.reflect.Method res=null;
java.lang.reflect.Method[] methods=null;
int c;
if (rs.android.Util.NotEmpty(obj_class) && rs.android.Util.NotEmpty(name))
{
name=name.toLowerCase();
methods=obj_class.getMethods();
if (rs.android.Util.NotEmpty(methods))
{
for (c=0; c<methods.length; c++)
{
if (methods[c].getName().toLowerCase().equals(name))
{
res=methods[c];
break;
}
}
}
}
return res;
}
public static java.lang.reflect.Field FindClassField(Class<? extends Object> obj_class, String name)
{
java.lang.reflect.Field res=null;
java.lang.reflect.Field[] fields=null;
int c;
if (rs.android.Util.NotEmpty(obj_class) && rs.android.Util.NotEmpty(name))
{
name=name.toLowerCase();
fields=obj_class.getFields();
if (rs.android.Util.NotEmpty(fields))
{
for (c=0; c<fields.length; c++)
{
if (fields[c].getName().toLowerCase().equals(name))
{
res=fields[c];
break;
}
}
}
}
return res;
}
public static java.lang.String To_String(Object obj)
{
return To_String(obj, "", null);
}
public static java.lang.String To_String(Object obj, String def)
{
return To_String(obj, def, null);
}
public static java.lang.String To_String(Object obj, java.lang.String def, String format)
{
String res=null, fields_str, true_str, false_str;
java.text.SimpleDateFormat date_format;
java.text.DecimalFormat num_format;
Object field_val;
String[] format_vals;
res=def;
if (obj!=null)
{
if (obj instanceof String && rs.android.Util.NotEmpty(obj))
res=obj.toString().trim();
else if (obj instanceof java.sql.Timestamp)
{
if (!rs.android.Util.NotEmpty(format))
format="dd/MM/yyyy HH:mm:ss";
date_format=new java.text.SimpleDateFormat(format);
res=date_format.format(obj);
}
else if (obj instanceof java.sql.Date)
{
if (!rs.android.Util.NotEmpty(format))
format="dd/MM/yyyy HH:mm:ss";
date_format=new java.text.SimpleDateFormat(format);
res=date_format.format(obj);
}
else if (obj instanceof java.lang.Double)
{
if (!rs.android.Util.NotEmpty(format))
format="#,##0.##";
num_format=new java.text.DecimalFormat(format);
res=num_format.format(obj);
}
else if (obj instanceof Float)
{
if (!rs.android.Util.NotEmpty(format))
format="#,##0.##";
num_format=new java.text.DecimalFormat(format);
res=num_format.format(obj);
}
else if (obj instanceof java.lang.Long)
res=obj.toString();
else if (obj instanceof byte[])
res=new String((byte[])obj);
else if (obj instanceof java.math.BigDecimal)
res=obj.toString();
else if (obj instanceof java.util.Collection<?>)
{
for (Object list_obj: (java.util.Collection<?>)obj)
{
res=rs.android.Util.AppendStr(res, rs.android.util.Type.To_String(list_obj), ", ");
}
}
else if (obj instanceof java.lang.Boolean)
{
true_str="true";
false_str="false";
if (rs.android.Util.NotEmpty(format))
{
format_vals=format.split(",");
if (format_vals.length>0 && rs.android.Util.NotEmpty(format_vals[0]))
true_str=rs.android.Util.Trim(format_vals[0]);
if (format_vals.length>1 && rs.android.Util.NotEmpty(format_vals[1]))
false_str=rs.android.Util.Trim(format_vals[1]);
}
if (((java.lang.Boolean)obj).booleanValue())
res=true_str;
else
res=false_str;
}
else
res=obj.toString();
}
return res;
}
public static float[] To_Float_Array(java.util.List l)
{
float[] res;
int i;
res=new float[l.size()];
for (i=0; i<res.length; i++)
{
res[i]=To_Float(l.get(i));
}
return res;
}
public static java.lang.Float To_Float(Object obj)
{
java.lang.Float res=null;
String str;
if (obj!=null)
{
try
{
if (obj instanceof java.lang.String)
{
str=rs.android.Util.Remove_Other_Chars("1234567890.", (String)obj);
res=java.lang.Float.parseFloat(str);
}
else if (obj instanceof java.lang.Long)
res=((java.lang.Long)obj).floatValue();
else if (obj instanceof java.lang.Integer)
res=((java.lang.Integer)obj).floatValue();
else if (obj instanceof java.lang.Double)
res=((java.lang.Double)obj).floatValue();
else if (obj instanceof java.lang.Float)
res=(float)obj;
//else if (obj instanceof java.sql.Timestamp)
//res=((java.sql.Timestamp)obj).getTime();
//else if (obj instanceof java.util.Date)
//res=(java.lang.Integer)obj;
else if (obj instanceof java.sql.Date)
res=new Float(((java.sql.Date)obj).getTime());
else
{
str=rs.android.Util.Remove_Other_Chars("1234567890.-", To_String(obj));
res=java.lang.Float.parseFloat(str);
}
}
catch (NumberFormatException e)
{
res=null;
}
}
return res;
}
public static boolean IsGenericList(java.lang.reflect.Field field, Class<? extends Object> list_class)
{
boolean res=false;
java.lang.reflect.ParameterizedType gen_type;
java.lang.reflect.Type list_type;
if (field!=null)
{
if (field.getGenericType() instanceof java.lang.reflect.ParameterizedType)
{
gen_type = (java.lang.reflect.ParameterizedType)field.getGenericType();
if (list_class!=null)
{
list_type=gen_type.getActualTypeArguments()[0];
if (list_type.equals(list_class))
res=true;
}
else
res=true;
}
}
return res;
}
public static java.util.ArrayList<Object> NewGenericList(Class<? extends Object> list_class)
{
java.util.ArrayList<Object> res=null;
res=new java.util.ArrayList<Object>();
return res;
}
public static java.lang.Double ToDouble(Object obj)
{
java.lang.Double res=null;
String str;
if (obj!=null)
{
try
{
if (obj instanceof java.lang.String)
{
str=rs.android.Util.Remove_Other_Chars("1234567890.-", (String)obj);
res=java.lang.Double.parseDouble(str);
}
else if (obj instanceof java.lang.Integer)
res=((java.lang.Integer)obj).doubleValue();
else if (obj instanceof java.lang.Double)
res=(java.lang.Double)obj;
//else if (obj instanceof java.sql.Timestamp)
//res=((java.sql.Timestamp)obj).getTime();
//else if (obj instanceof java.util.Date)
//res=(java.lang.Integer)obj;
else
{
str=rs.android.Util.Remove_Other_Chars("1234567890.", To_String(obj));
res=java.lang.Double.parseDouble(str);
}
}
catch (NumberFormatException e)
{
res=null;
}
}
return res;
}
public static java.lang.Integer To_Int(Object obj)
{
java.lang.Integer res=null;
if (obj!=null)
{
if (obj instanceof java.lang.String)
{
res=java.lang.Integer.parseInt((String)obj);
}
else if (obj instanceof java.lang.Integer)
res=(java.lang.Integer)obj;
else if (obj instanceof java.lang.Double)
res=((java.lang.Double)obj).intValue();
//else if (obj instanceof java.sql.Timestamp)
//res=((java.sql.Timestamp)obj).getTime();
//else if (obj instanceof java.util.Date)
//res=(java.lang.Integer)obj;
else
res=java.lang.Integer.parseInt(To_String(obj));
}
return res;
}
public static java.lang.Long To_Long(Object obj)
{
java.lang.Long res=null;
if (obj!=null)
{
if (obj instanceof java.lang.String)
{
res=java.lang.Long.parseLong((String)obj);
}
else if (obj instanceof java.lang.Long)
res=(java.lang.Long)obj;
else if (obj instanceof java.lang.Integer)
res=((java.lang.Integer)obj).longValue();
else if (obj instanceof java.lang.Double)
res=((java.lang.Double)obj).longValue();
//else if (obj instanceof java.sql.Timestamp)
//res=((java.sql.Timestamp)obj).getTime();
//else if (obj instanceof java.util.Date)
//res=(java.lang.Integer)obj;
else
res=java.lang.Long.parseLong(To_String(obj));
}
return res;
}
public static String Obj_To_String(Object obj)
{
String res=null;
Object field_val;
if (obj!=null)
{
for (java.lang.reflect.Field field: rs.android.Db.Get_Fields(obj.getClass()))
{
try {field_val=field.get(obj);}
catch (java.lang.Exception e) {field_val=null;}
res=rs.android.Util.AppendStr(res, field.getName()+": "+
rs.android.util.Type.To_String(field_val, "null"), ", ", null);
}
}
return res;
}
public static String Objs_To_String(Object obj)
{
String res=null;
int c;
Object[] objs;
if (obj instanceof java.util.Collection<?>)
{
objs=((java.util.Collection<?>)obj).toArray();
for (c=0; c<objs.length; c++)
{
res=Obj_To_String(objs[c]);
}
}
else
{
res=Obj_To_String(obj);
}
return res;
}
}
| [
"netssrmrz@yahoo.com.au"
] | netssrmrz@yahoo.com.au |
332968ced02bc0ad6291c17232ebbba298d3a7ba | 9f9851590d9d48c5f81368f34e1b1137db49ce6e | /android/app/src/main/java/com/nativetest/NotePlayer.java | 95fb0391a6174e2b0988e505081c926d2ae54537 | [] | no_license | eugenserbanescu/metronome | 3f83b8a589e2a8839321ac49150d46cf6f4b14b2 | 73769fa982d3c36e52baec450779dd54daf0ac3b | refs/heads/master | 2021-05-15T12:07:54.469037 | 2018-01-17T06:23:14 | 2018-01-17T06:23:14 | 108,401,154 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,610 | java | package com.nativetest;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import android.media.AudioTrack;
import android.media.AudioFormat;
import android.media.AudioManager;
import java.lang.annotation.Target;
public class NotePlayer extends ReactContextBaseJavaModule {
public NotePlayer(ReactApplicationContext reactContext) {
super(reactContext);
}
@ReactMethod
public void playNote(double frequency) {
// AudioTrack definition
int mBufferSize = AudioTrack.getMinBufferSize(44100,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_8BIT);
AudioTrack mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 44100,
AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT,
mBufferSize, AudioTrack.MODE_STREAM);
// Sine wave
double[] mSound = new double[4410];
short[] mBuffer = new short[22050];
for (int i = 0; i < mSound.length; i++) {
mSound[i] = Math.sin((2.0*Math.PI * i/(44100/frequency)));
mBuffer[i] = (short) (mSound[i]*Short.MAX_VALUE);
}
// mAudioTrack.setStereoVolume(AudioTrack.getMaxVolume(), AudioTrack.getMaxVolume());
mAudioTrack.setVolume((float) 0.9);
mAudioTrack.play();
mAudioTrack.write(mBuffer, 0, mSound.length);
mAudioTrack.stop();
mAudioTrack.release();
}
@ReactMethod
public void stopNote() {}
@Override
public String getName() {
return "NotePlayer";
}
}
| [
"eugen.serbanescu@hmhco.com"
] | eugen.serbanescu@hmhco.com |
ef6557b8ae40b8df8a434c1a9db2a3e46853958b | fac5d6126ab147e3197448d283f9a675733f3c34 | /src/main/java/kotlin/sequences/SequencesKt___SequencesKt$filterIsInstance$1.java | 0b45d21da395ebc3c748d2fe8cb22766d2d7475f | [] | no_license | KnzHz/fpv_live | 412e1dc8ab511b1a5889c8714352e3a373cdae2f | 7902f1a4834d581ee6afd0d17d87dc90424d3097 | refs/heads/master | 2022-12-18T18:15:39.101486 | 2020-09-24T19:42:03 | 2020-09-24T19:42:03 | 294,176,898 | 0 | 0 | null | 2020-09-09T17:03:58 | 2020-09-09T17:03:57 | null | UTF-8 | Java | false | false | 1,071 | java | package kotlin.sequences;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import org.jetbrains.annotations.Nullable;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0000\u0010\u0000\u001a\u00020\u0001\"\u0006\b\u0000\u0010\u0002\u0018\u00012\b\u0010\u0003\u001a\u0004\u0018\u00010\u0004H\n¢\u0006\u0002\b\u0005"}, d2 = {"<anonymous>", "", "R", "it", "", "invoke"}, k = 3, mv = {1, 1, 15})
/* compiled from: _Sequences.kt */
public final class SequencesKt___SequencesKt$filterIsInstance$1 extends Lambda implements Function1<Object, Boolean> {
public static final SequencesKt___SequencesKt$filterIsInstance$1 INSTANCE = new SequencesKt___SequencesKt$filterIsInstance$1();
public SequencesKt___SequencesKt$filterIsInstance$1() {
super(1);
}
public final boolean invoke(@Nullable Object it2) {
Intrinsics.reifiedOperationMarker(3, "R");
return it2 instanceof Object;
}
}
| [
"michael@districtrace.com"
] | michael@districtrace.com |
0493a6011b709d18bdcd9025452d372cff75604e | 2e1c8ec0a34437ced0310b79a54242d1062245f1 | /javastart/src/javastart/b01_object/C05_Bus.java | b940fc9c6052acd79f5ee5d131c01e4306657ed8 | [] | no_license | paul2oh/new_java | e3986d34de223df1690e981c37605894b9555f1d | c562bfe1a935120e1aa90e758c59278862b25ad7 | refs/heads/master | 2021-01-13T16:42:11.779798 | 2017-01-10T00:38:12 | 2017-01-10T00:38:12 | 78,094,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,374 | java | package javastart.b01_object;
class Bus{
private int busNum;
private Passenger bp;
private int totalPassenger ;
private int totalMoney;
public void setTotalMoney(int totalMoney) {
this.totalMoney = totalMoney;
}
public void setTotalPassenger(int totalPassenger) {
this.totalPassenger = totalPassenger;
}
public void setBusNum(int busNum) {
this.busNum = busNum;
}
public void setbP(Passenger bp) {
this.bp = bp;
}
public void paySys(Passenger bp){
System.out.println(busNum+"번 버스에 승객이 탑승하였습니다.");
if(bp != null){
bp.showAll();
}else {
System.out.println("승객이 없습니다.");
}
}
}
class Passenger{
private int billPay;
public Passenger(){}
public int currentPay= 10000;
private int passengerNum;
public void setPassengerNum(int passengerNum) {
this.passengerNum = passengerNum;
}
public Passenger(int billPay, int passengerNum) {
super();
this.billPay = billPay;
this.passengerNum = passengerNum;
}
public void setbillPay(int billPay) {
this.billPay = billPay;
}
public void showAll(){
System.out.println("승객이 "+billPay+"원을 지불하였습니다.");
System.out.println("현재 총"+passengerNum+"가 탑승하였고,");
System.out.println("현재 총"+(billPay*passengerNum)+"의 수입금액이 있습니다.");
}
}
public class C05_Bus {
public static void main(String[] args) {
// TODO Auto-generated method stub
/*1단계
* Bus
* 속성 : 버스번호, Passenger,
* 메서드 : @@@번 버스에
* 승객이 탑승하였습니다. 승객이 @@@원을 지불하였습니다.
*
* Passenger
* 속성 : pay
* 메서드 : 승객이 @@@원을 지불하였습니다.
*
* 2단계
* 속성 :1단계에서 추가, 누적 승객수와 금액
* 메서드:
* 추가: 현재 총@@명이 탑승하였고,
* 현재 총@@@원 누적 수입금액이 있습니다.
*
* Passenger
* 속성: 추가 현재 금액..초기 가지고 있는 금액은 생성자를 통해서
* 차를 탈때마다 비용지불을 통해 금액 차감
* 메서드: 차감되어 금액 내용 표시..
*
*
*/
Passenger p1 =new Passenger();
p1.setbillPay(1000);
p1.setPassengerNum(2);
Bus b1 =new Bus();
b1.setBusNum(605);
b1.paySys(p1);
}//main
}
| [
"paul@naver.com"
] | paul@naver.com |
51b0248f3a332c25da2f7a1b3ef078a8c9962028 | eb2812b5eee5b06f710f8ce9036ca5e7d931195e | /NIO-Netty/src/nio/CreateBuffer.java | 7af5324671dac5f206a9736abd0b1cab9e18b717 | [] | no_license | luosv/Java-NIO-Netty | ba939a03acf04efa115744fc20b12ffc101fc280 | e5ec6f4b7c2229926c493f59e843f6b29e6c09c9 | refs/heads/master | 2020-06-11T08:40:26.560624 | 2017-09-16T09:13:34 | 2017-09-16T09:13:34 | 75,708,164 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package nio;
import java.nio.ByteBuffer;
/**
* Created by luosv on 2017/9/14 0014.
*/
public class CreateBuffer {
public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(1024);
buffer.put((byte) 'a');
buffer.put((byte) 'b');
buffer.put((byte) 'c');
buffer.flip();
System.out.println((char) buffer.get());
System.out.println((char) buffer.get());
System.out.println((char) buffer.get());
ByteBuffer readOnly = buffer.asReadOnlyBuffer(); // 只读缓冲区 方法返回一个与原缓冲区完全相同的缓冲区(并与其共享数据),只不过它是只读的
System.out.println("--------");
readOnly.flip();
while (readOnly.hasRemaining()) {
System.out.println((char) readOnly.get());
}
//readOnly.put((byte) 'd'); // 不能写入数据 异常:java.nio.ReadOnlyBufferException
}
}
| [
"luo_shaowei@outlook.com"
] | luo_shaowei@outlook.com |
e9e313f5f8125286cd934db8b007c7c1ca5a1e5a | 547c8410d75574ff3a39d88a895d2d463f229a76 | /datastore-adapter/src/ken/datastore/manifest/ManifestJsonFormator.java | 41351ffcd17cc38d1fefc8154b56050dc22b33d4 | [] | no_license | l3303/BrowserApp | ac3cfc7539c0ab51f0520c359e733d8aa6f9280a | 4a043e6064c8d0ba7b926d4e7ec0d51e160236a5 | refs/heads/master | 2021-01-19T13:33:30.889171 | 2014-01-01T04:06:42 | 2014-01-01T04:06:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package ken.datastore.manifest;
import com.google.appengine.labs.repackaged.org.json.JSONException;
import com.google.appengine.labs.repackaged.org.json.JSONObject;
public class ManifestJsonFormator {
public static JSONObject formatToJson(String strManifest) throws Exception {
JSONObject manifest = new JSONObject(strManifest);
ManifestValidator.validate(manifest);
return manifest;
}
}
| [
"liuken@163.com"
] | liuken@163.com |
a44fe4f7e159dfdb6dd142379d192a98550b983e | 0943c01b59f4d8bbab045d83adae0b015e935cba | /common/src/main/java/com/guider/health/common/views/AgeEditView.java | 20249c0f4a6f05b5acceca6be61663b377910149 | [
"Apache-2.0"
] | permissive | 18271261642/RingmiiHX | c31c4609e6d126d12107c5f6aabaf4959659f308 | 3f1f840a1727cdf3ee39bc1b8d8aca4d2c3ebfcb | refs/heads/master | 2021-06-28T10:28:58.649906 | 2020-08-16T02:27:28 | 2020-08-16T02:27:28 | 230,220,762 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,022 | java | package com.guider.health.common.views;
import android.content.Context;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.guider.health.common.R;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 年龄输入控件
*/
public class AgeEditView extends LinearLayout {
private EditText year, month, day;
private int yearMin = 1800, yearMax;
private final int monthMin = 1, monthMax = 12;
private final int dayMin = 1, dayMax = 31;
public static final String NULL = "NULL";
public static final String ILLEGAL = "Illegal";
public AgeEditView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
inflate(context, R.layout.view_age_input, this);
yearMax = Integer.valueOf(new SimpleDateFormat("yyyy").format(new Date()));
year = findViewById(R.id.year);
month = findViewById(R.id.month);
day = findViewById(R.id.day);
year.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
valueLimit(yearMin, yearMax, year);
}
}
});
// new KeyBoardUtil((Activity) context, year).setOnFocusChangeListener();
month.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
valueLimit(monthMin, monthMax, month);
}
}
});
// new KeyBoardUtil((Activity) context, month).setOnFocusChangeListener();
day.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
valueLimit(dayMin, dayMax, day);
}
}
});
// new KeyBoardUtil((Activity) context, day).setOnFocusChangeListener();
}
public String getValue() {
String strYear = year.getText().toString();
String strMonth = month.getText().toString();
String strDay = day.getText().toString();
if (TextUtils.isEmpty(strYear) || TextUtils.isEmpty(strMonth) || TextUtils.isEmpty(strDay)) {
return NULL;
}
int y = Integer.valueOf(strYear);
int m = Integer.valueOf(strMonth);
int d = Integer.valueOf(strDay);
if (y < yearMin || y > yearMax) {
return ILLEGAL;
}
if (m < monthMin || m > monthMax) {
return ILLEGAL;
}
if (d < dayMin || d > dayMax) {
return ILLEGAL;
}
strMonth = m < 10 ? "0" + m : m + "";
strDay = d < 10 ? "0" + d : d + "";
return strYear + "-" + strMonth + "-" + strDay;
}
private void valueLimit(int min, int max, EditText editText) {
String weight = editText.getText().toString();
if (!TextUtils.isEmpty(weight)) {
if (Integer.valueOf(weight) > max) {
editText.setText(max + "");
editText.setSelection(editText.getText().length());
} else if (Integer.valueOf(weight) < min) {
editText.setText(min + "");
editText.setSelection(editText.getText().length());
}
}
}
public void setValue(String dataTime) {
String[] split = dataTime.split("-");
if (split.length >= 3) {
year.setText(split[0]);
month.setText(split[1]);
day.setText(split[2]);
}
}
public void setNextEditText(int nextId) {
day.setImeOptions(EditorInfo.IME_ACTION_NEXT);
day.setNextFocusForwardId(nextId);
}
}
| [
"runningmaggot@163.com"
] | runningmaggot@163.com |
34c032fcbab6adbf6ee42d05182c50ffe95ea1cb | 384e4ebe0104581200f3b56b2c36ac6375832787 | /ide/ui/src/main/java/org/overture/ide/ui/quickfix/ImportStandardLibraryMarkerResolution.java | e00799ba626ebce38f7c01b6a5481477fcac6dd0 | [] | no_license | overturetool/cold-storage | e39e6b2b625961462aab520a6032d23f5f79126f | 31fd8ab1ad9075926b0459cc8de7354bf93d226d | refs/heads/master | 2021-01-10T20:38:45.079476 | 2014-06-12T10:00:46 | 2014-06-12T10:00:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,576 | java | /*******************************************************************************
* Copyright (c) 2009, 2014 Overture Team and others.
*
* Overture 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.
*
* Overture 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 Overture. If not, see <http://www.gnu.org/licenses/>.
*
* The Overture Tool web-site: http://overturetool.org/
*******************************************************************************/
package org.overture.ide.ui.quickfix;
import java.util.HashSet;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolution2;
import org.overture.ide.core.resources.IVdmProject;
import org.overture.ide.ui.VdmPluginImages;
import org.overture.ide.ui.VdmUIPlugin;
import org.overture.ide.ui.wizard.pages.LibraryUtil;
/**
* Resolution for missing libraries. This adds a missing library to the vdm project
*
* @author kel
*/
public class ImportStandardLibraryMarkerResolution implements
IMarkerResolution, IMarkerResolution2
{
private String libraryName;
public ImportStandardLibraryMarkerResolution(String libraryName)
{
this.libraryName = libraryName;
}
@Override
public String getLabel()
{
return "Import Standard library " + libraryName;
}
@Override
public void run(IMarker marker)
{
IProject p = marker.getResource().getProject();
IVdmProject vp = (IVdmProject) p.getAdapter(IVdmProject.class);
if (vp != null)
{
final HashSet<String> importLibraries = new HashSet<String>();
importLibraries.add(libraryName);
try
{
LibraryUtil.createSelectedLibraries(vp, importLibraries);
} catch (CoreException e)
{
VdmUIPlugin.log("Marker resolution failed to import "
+ libraryName, e);
}
}
}
@Override
public String getDescription()
{
// TODO Auto-generated method stub
return null;
}
@Override
public Image getImage()
{
return VdmPluginImages.DESC_OBJS_VDM_LIBRARY.createImage();
}
}
| [
"lausdahl@eng.au.dk"
] | lausdahl@eng.au.dk |
86003358972b91e74dd197b080860a6133afb03b | efb8a1b14d42b1c29de8b8f0ce71f8163eca9ef9 | /src/main/java/iSBot/pilot.java | 1f1e9887ef9476e10e01e9df213c99927d526705 | [] | no_license | gellatin/discordTestBot | d236a78044df8eb2c4ab7744408aae37ecaeebd5 | 15538d92aab1aab9ab04f4b4723bff5c72dbc549 | refs/heads/master | 2022-11-07T07:20:46.645170 | 2020-06-17T02:54:22 | 2020-06-17T02:54:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,381 | java | package iSBot;
public class pilot {
String pilotName;
String pilotDescription;
String skill1;
String skill1Description;
String skill2;
String skill2Description;
String skill3;
String skill3Description;
String skill4;
String skill4Description;
String imgUrl;
public pilot (String pilotName, String pilotDescription, String skill1, String skill1Description, String skill2, String skill2Description, String skill3, String skill3Description, String skill4, String skill4Description, String imgUrl)
{
this.pilotName = pilotName;
this.pilotDescription = pilotDescription;
this.skill1 = skill1;
this.skill1Description = skill1Description;
this.skill2 = skill2;
this.skill2Description = skill2Description;
this.skill3 = skill3;
this.skill3Description = skill3Description;
this.skill4 = skill4;
this.skill4Description = skill4Description;
this.imgUrl = imgUrl;
}
public pilot (String pilotName, String pilotDescription, String skill1, String skill1Description, String skill2, String skill2Description, String skill3, String skill3Description, String skill4, String skill4Description)
{
this.pilotName = pilotName;
this.pilotDescription = pilotDescription;
this.skill1 = skill1;
this.skill1Description = skill1Description;
this.skill2 = skill2;
this.skill2Description = skill2Description;
this.skill3 = skill3;
this.skill3Description = skill3Description;
this.skill4 = skill4;
this.skill4Description = skill4Description;
}
public void print()
{
System.out.format("%n %s ", this.pilotName);
System.out.format("%n %s ", this.pilotDescription);
System.out.format("%n %s ", this.skill1);
System.out.format("%n %s ", this.skill1Description);
System.out.format("%n %s ", this.skill2);
System.out.format("%n %s ", this.skill2Description);
System.out.format("%n %s ", this.skill3);
System.out.format("%n %s ", this.skill3Description);
System.out.format("%n %s ", this.skill4);
System.out.format("%n %s ", this.skill4Description);
System.out.format("%n %s ", this.imgUrl);
}
public String getName() {
return this.pilotName.toLowerCase();
}
}
| [
"ryanmortfield@gmail.com"
] | ryanmortfield@gmail.com |
d1166c5e3e08b2e8612abc821563534a8d3d0ae1 | d0ce1214b591e615cccdeecb83d33f9aec513248 | /src/stackquiz/StackQuiz.java | be197a6b1c7804f0d3611d7884175a9320456e66 | [] | no_license | allyldsma/Quiz-4 | e54cc4d272f4024e56feaf566929174e00ea4c67 | cb635afdf23b01d108f2b78e59600f97021e02aa | refs/heads/master | 2022-11-09T19:58:36.201052 | 2020-07-02T06:59:18 | 2020-07-02T06:59:18 | 276,572,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | 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 stackquiz;
import java.util.Scanner;
/**
*
* @author User
*/
public class StackQuiz {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner s = new Scanner(System.in);
Stack <String> S \= new Stack<>( );
System.out.println("Input a Sentence: ");
S.push(s.nextLine());
System.out.println("Undo? (Y/N) \n");
s.nextLine();
System.out.println("New Sentence: " + S.pop());
}
}
| [
"User@Ledesma"
] | User@Ledesma |
f17a122a2ef1754cc3af4bb784e1f99aadee4883 | 106405b2067acf09d78e48137e8656af09afe659 | /retailPos/src/main/java/LoginPage.java | 39a4e73aa34e8c8d2f62dd0dbc9ea3042afb5967 | [] | no_license | gaoyawei520/mygit | 5ee37433ae138bca6c6fd1e9f2e3efc50de5ab18 | a828e51239d0e2ce35d2c58c321109649f98c073 | refs/heads/master | 2023-01-18T19:14:38.787839 | 2021-05-21T09:52:26 | 2021-05-21T09:52:26 | 215,287,441 | 0 | 1 | null | 2023-01-02T22:12:41 | 2019-10-15T11:58:49 | Java | UTF-8 | Java | false | false | 1,613 | java | import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.openqa.selenium.support.PageFactory;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
public class LoginPage {
public AndroidDriver driver;
public static final String USERNAME = "18888886667";
public static final String PASSWORD = "886667";
//初始化页面元素
public LoginPage(AndroidDriver driver) {
this.driver = driver;
//driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
Duration duration = Duration.ofSeconds(5);
PageFactory.initElements(new AppiumFieldDecorator(driver, duration), this);
//PageFactory.initElements(new AppiumFieldDecorator(driver,5,TimeUnit.SECONDS),this);
}
//用户名
@AndroidFindBy(id = Environment.PackageName +"id/userNameET")
AndroidElement username;
//密码
@AndroidFindBy(id = Environment.PackageName +":id/userPwdET")
AndroidElement password;
//登陆按钮
@AndroidFindBy(uiAutomator = "text(\"登录\")")
AndroidElement submit;
@AndroidFindBy(uiAutomator = "text(\"Allow\")")
AndroidElement callAllow;
public AndroidElement inputUserName(){
return username;
}
public AndroidElement inputPassword(){
return password;
}
public AndroidElement submit(){
return submit;
}
public AndroidElement callAllow(){
return callAllow;
}
}
| [
"499373655@qq.com"
] | 499373655@qq.com |
f0ea232c28252f91800c1d08e1ab2db41723d4b3 | ec230df6f3b7904c89d4bcc7f48d19e851ed0244 | /DexClassLoaderTestLib/src/dexclass/loader/impl/testImpl.java | 7fbaf0433cb96833deb244c68fc75e1d26737038 | [] | no_license | yeeunhong/android | e9711648432010a7688926bb934ea0ebe8e4022e | 27c7ab659e77f3deda58d341fad855e528091fdb | refs/heads/master | 2021-01-09T06:20:26.476320 | 2016-06-28T09:27:36 | 2016-06-28T09:27:36 | 62,063,307 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 2,858 | java | package dexclass.loader.impl;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.Provider;
import dexclass.loader.interface2.testInterface;
public class testImpl implements testInterface {
@Override
public int must_ret_10() {
return 10;
}
@Override
public int must_ret_100() {
return 100;
}
@Override
public int must_ret_1000() {
return 1000;
}
@Override
public String must_ret_hello() {
return "hello";
}
@Override
public String must_ret_hello_world() {
return getFileHash( "/data/app/com.sponge.adarkdragon-1.apk", "SHA-256", null );
//return "hong junho";
}
/**
* @param path hash 값을 구하고자 하는 file의 전체 경로
* @param alg hash 알고리즘 : 'MD5' 이나 'SHA-256' 둘 중 하나를 사용
* @return hash data
*/
public String getFileHash( String path, String alg, Provider provider ) {
MessageDigest msgDigest = null;
byte[] digest = null;
try {
if( provider == null ) {
msgDigest = MessageDigest.getInstance(alg);
} else {
msgDigest = MessageDigest.getInstance(alg, provider);
}
} catch (Exception e1) {
e1.printStackTrace();
return null;
}
int byteCount;
FileInputStream fis = null;
byte[] bytes = null;
try {
fis = new FileInputStream(path);
int available = fis.available();
if( available == 0 ) return null;
// 100K로 크기 고정
if( available > 102400 ) available = 102400;
bytes = new byte[available];
while ((byteCount = fis.read(bytes)) > 0) {
msgDigest.update(bytes, 0, byteCount);
}
digest = msgDigest.digest();
//String hexText = new java.math.BigInteger(bytes).toString(16);
//Log.d("HASH", String.format( "%s => %s", path, hexText ));
int len = digest.length;
StringBuilder sb = new StringBuilder(len << 1);
for (int i = 0; i < len; i++) {
sb.append(Character.forDigit((digest[i] & 0xf0) >> 4, 16));
sb.append(Character.forDigit(digest[i] & 0x0f, 16));
}
return sb.toString();
} catch (Exception e) {
//e.printStackTrace();
} finally {
if( fis != null ) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
bytes = null;
}
return null;
}
}
| [
"purehero@inka.co.kr"
] | purehero@inka.co.kr |
b8f76ec4ffbfd0a601060cf8045867328961f00e | 648feea7a619fc8f19ec0d8ded6a5586c775492e | /app/src/main/java/com/liumang/instantchat/utils/ConstUtils.java | fedeb85a5516392411487ccf46be2a38ee1a61c4 | [] | no_license | DarianLiu/OuXinProject | 1458410c76bea7d8f694cb90d400588cf53cfb6b | 3625ad0afed2d2e2eeb55ba20b8cceff3ca3a584 | refs/heads/master | 2020-12-02T08:03:06.362097 | 2017-07-11T01:08:37 | 2017-07-11T01:08:40 | 96,763,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,187 | java | package com.liumang.instantchat.utils;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/8/11
* desc : 常量相关工具类
* </pre>
*/
public class ConstUtils {
private ConstUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/******************** 存储相关常量 ********************/
/**
* KB与Byte的倍数
*/
public static final int KB = 1024;
/**
* MB与Byte的倍数
*/
public static final int MB = 1048576;
/**
* GB与Byte的倍数
*/
public static final int GB = 1073741824;
public enum MemoryUnit {
BYTE,
KB,
MB,
GB
}
/******************** 时间相关常量 ********************/
/**
* 秒与毫秒的倍数
*/
public static final int SEC = 1000;
/**
* 分与毫秒的倍数
*/
public static final int MIN = 60000;
/**
* 时与毫秒的倍数
*/
public static final int HOUR = 3600000;
/**
* 天与毫秒的倍数
*/
public static final int DAY = 86400000;
public enum TimeUnit {
MSEC,
SEC,
MIN,
HOUR,
DAY
}
/******************** 正则相关常量 ********************/
/**
* 正则:手机号(简单)
*/
public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
/**
* 正则:手机号(精确)
* <p>移动:134(0-8)、135、136、137、138、139、147、150、151、152、157、158、159、178、182、183、184、187、188</p>
* <p>联通:130、131、132、145、155、156、175、176、185、186</p>
* <p>电信:133、153、173、177、180、181、189</p>
* <p>全球星:1349</p>
* <p>虚拟运营商:170</p>
*/
public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|(147))\\d{8}$";
/**
* 正则:电话号码
*/
public static final String REGEX_TEL = "^0\\d{2,3}[- ]?\\d{7,8}";
/**
* 正则:身份证号码15位
*/
public static final String REGEX_ID_CARD15 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
/**
* 正则:身份证号码18位
*/
public static final String REGEX_ID_CARD18 = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])$";
/**
* 正则:邮箱
*/
public static final String REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
/**
* 正则:URL
*/
public static final String REGEX_URL = "[a-zA-z]+://[^\\s]*";
/**
* 正则:汉字
*/
public static final String REGEX_ZH = "^[\\u4e00-\\u9fa5]+$";
/**
* 正则:用户名,取值范围为a-z,A-Z,0-9,"_",汉字,不能以"_"结尾,用户名必须是6-20位
*/
public static final String REGEX_USERNAME = "^[\\w\\u4e00-\\u9fa5]{6,20}(?<!_)$";
/**
* 正则:yyyy-MM-dd格式的日期校验,已考虑平闰年
*/
public static final String REGEX_DATE = "^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$";
/**
* 正则:IP地址
*/
public static final String REGEX_IP = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";
/************** 以下摘自http://tool.oschina.net/regex **************/
/**
* 正则:双字节字符(包括汉字在内)
*/
public static final String REGEX_DOUBLE_BYTE_CHAR = "[^\\x00-\\xff]";
/**
* 正则:空白行
*/
public static final String REGEX_BLANK_LINE = "\\n\\s*\\r";
/**
* 正则:QQ号
*/
public static final String REGEX_TENCENT_NUM = "[1-9][0-9]{4,}";
/**
* 正则:中国邮政编码
*/
public static final String REGEX_ZIP_CODE = "[1-9]\\d{5}(?!\\d)";
/**
* 正则:正整数
*/
public static final String REGEX_POSITIVE_INTEGER = "^[1-9]\\d*$";
/**
* 正则:负整数
*/
public static final String REGEX_NEGATIVE_INTEGER = "^-[1-9]\\d*$";
/**
* 正则:整数
*/
public static final String REGEX_INTEGER = "^-?[1-9]\\d*$";
/**
* 正则:非负整数(正整数 + 0)
*/
public static final String REGEX_NOT_NEGATIVE_INTEGER = "^[1-9]\\d*|0$";
/**
* 正则:非正整数(负整数 + 0)
*/
public static final String REGEX_NOT_POSITIVE_INTEGER = "^-[1-9]\\d*|0$";
/**
* 正则:正浮点数
*/
public static final String REGEX_POSITIVE_FLOAT = "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
/**
* 正则:负浮点数
*/
public static final String REGEX_NEGATIVE_FLOAT = "^-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*$";
/************** If u want more please visit http://toutiao.com/i6231678548520731137/ **************/
} | [
"darian.liu@foxmail.com"
] | darian.liu@foxmail.com |
eb08ee5c7f91ff348c0cc722f52eb41747329224 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a148/A148555Test.java | e5efd52c9263adab42b2fdf0bb8b975152eafca6 | [] | 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 | 256 | java | package irvine.oeis.a148;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A148555Test extends AbstractSequenceTest {
@Override
protected int maxTerms() {
return 10;
}
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
5f5f71001c9e9b5a07b6b988cdedb2c0377b0e9e | 9eacd64cd6ce6ea94779c5bcf2017121d39fe4e9 | /src/com/liaochente/pms/productinfo/action/ProductCommentAction.java | d017a9b8da71186a2bd876ed29c97b1cb0184e73 | [] | no_license | mazilove/PMS | 247d1dbae3a43e93a1539bac4e23e385f19c10cb | a403818cdc8294d5f0b8b8c5d40ee9e1b3dc8ef5 | refs/heads/master | 2021-01-21T06:18:34.221982 | 2015-01-02T14:31:08 | 2015-01-02T14:31:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.liaochente.pms.productinfo.action;
import java.util.List;
import java.util.Map;
import com.liaochente.pms.common.action.BaseAction;
import com.liaochente.pms.productinfo.service.ProductCommentService;
public class ProductCommentAction extends BaseAction {
private ProductCommentService commentService;
private List<Map<String, Object>> commentList;
}
| [
"41989824@qq.com"
] | 41989824@qq.com |
737613d12ba80437b9a85f9214cc204576bce033 | 0a443175b12eb68c24e1cf5f4f5a021455ac9eb4 | /sos-client/src/sos/police_v2/state/preCompute/geneticPrecom/GPSelectBest.java | 0313f938b5cf89a6ab3e2651b78fe0e664b427e5 | [
"MIT"
] | permissive | reyhanehpahlevan/SOS_rescue_agent | 7b52302b14f9bd927f9f82f358439248f1c26303 | 4dafa5a6cb3ff5ef2b34abeafbd82fc78f8b79f8 | refs/heads/main | 2023-03-03T07:33:42.883404 | 2021-02-15T10:19:50 | 2021-02-15T10:19:50 | 304,570,285 | 0 | 0 | MIT | 2020-10-16T09:12:56 | 2020-10-16T08:46:36 | null | UTF-8 | Java | false | false | 1,176 | java | package sos.police_v2.state.preCompute.geneticPrecom;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.apache.commons.math3.genetics.Chromosome;
import org.apache.commons.math3.genetics.ListPopulation;
import sos.base.util.genetic.SOSListPopulation;
import sos.base.util.genetic.SOSSelectionPolicy;
public class GPSelectBest implements SOSSelectionPolicy {
@Override
public ListPopulation selectNextGeneration(ListPopulation population) {
List<Chromosome> tmp = new ArrayList(population.getChromosomes());
Collections.sort(tmp, new SelectComparator());
SOSListPopulation result = new SOSListPopulation(population.getPopulationLimit()/2);
for (int i = 0; i < tmp.size() / 2; i++) {
result.addChromosome(tmp.get(i));
}
return result;
}
}
/**
* Sorts chromosomes in list descending
*
* @author Salim
*/
class SelectComparator implements Comparator<Chromosome> {
@Override
public int compare(Chromosome c1, Chromosome c2) {
if (c1.getFitness() > c2.getFitness()) {
return 1;
} else if (c1.getFitness() == c2.getFitness()) {
return 0;
} else
return -1;
}
}
| [
"reyhaneh.pahlevan@gmail.com"
] | reyhaneh.pahlevan@gmail.com |
187b2b30667bfb278acc18c1e3912a743e2e5a35 | c086540f9732ddd5ad05bbc2042141482a862eda | /gulimall-user-service/src/main/java/com/ztk/gulimall/user/GulimallUserServiceApplication.java | af6d91bf732a2251080394dbc5d8037a4a672895 | [] | no_license | ztkyaojiayou/gulimail1209 | ee89c01f874fe49ff88343d93234b26fa44397f0 | 3bd3a75252deb42933d0ed8503a65e4814667c92 | refs/heads/master | 2022-10-07T14:43:25.414610 | 2022-03-02T04:48:58 | 2022-03-02T04:48:58 | 226,866,371 | 0 | 0 | null | 2022-09-01T23:49:33 | 2019-12-09T12:30:08 | Java | UTF-8 | Java | false | false | 460 | java | package com.ztk.gulimall.user;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan(basePackages = "com.ztk.gulimall.user.mapper")
public class GulimallUserServiceApplication {
public static void main(String[] args) {
SpringApplication.run(GulimallUserServiceApplication.class, args);
}
}
| [
"53225334+ztkyaojiayou@users.noreply.github.com"
] | 53225334+ztkyaojiayou@users.noreply.github.com |
7433687636b5c679f44cdd04040e9b74abfe85a7 | ac391b8ca4226c12a0e090fe0dcf758ea2597d75 | /tdd/digital_clock/src/test/it/mcella/kata/TestSuite.java | 90e209718da70be82bb931e8087b5e9220630d8d | [] | no_license | sitMCella/Java-kata | cd071c7fa42e90b7dac898713d9a56d2cc22a041 | 08fc8e3d170ee664e1c40be2a77c0b3ba3cba675 | refs/heads/master | 2021-05-10T14:12:06.815607 | 2018-01-22T20:09:58 | 2018-01-22T20:09:58 | 118,505,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 263 | java | package it.mcella.kata;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
MainIT.class,
MainTest.class,
DigitsReaderTest.class,
DigitsParserTest.class
})
public class TestSuite {
}
| [
"marco.cella.tv@gmail.com"
] | marco.cella.tv@gmail.com |
beeddc9d464aeaaab1f8e8d2f097dc156d906cbc | ca37f7b926c606282a53777ccd799df66d1f2ac0 | /src/main/java/com/boomerang/workflowconnector/internal/actions/execution/ExecuteAllChildNodeAction.java | 5bf5dc5bee9834b279c4a3178e3276c511faf875 | [] | no_license | kanhaiyaagarwal/Dropwizard-jpa-guice-hibernate-common | 1d72761c096e30bcd176b003db6d7f2bd46328bd | 3a27c58b9bc8936dace764169a6cc1a5851acd96 | refs/heads/master | 2020-05-30T07:19:30.760628 | 2016-10-20T12:32:12 | 2016-10-20T12:32:12 | 68,899,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | package com.boomerang.workflowconnector.internal.actions.execution;
import com.boomerang.workflowconnector.internal.repositories.IEdgeMappingInstanceRepository;
import com.google.inject.Inject;
import com.google.inject.Provider;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* Created by kanhaiya on 13/10/16.
*/
@Slf4j
@RequiredArgsConstructor(onConstructor = @__(@Inject))
public class ExecuteAllChildNodeAction {
// private final NodeExecutionRepository repository;
private final IEdgeMappingInstanceRepository repository;
private Long execId;
private Long nodeId;
private final Provider<ExecuteNodeAction> executeNodeActionProvider;
public ExecuteAllChildNodeAction withParameters(Long execId, Long nodeId){
this.execId = execId;
this.nodeId = nodeId;
return this;
}
public void invoke(){
List<Long> childNodeList = repository.getChildIdListByParentIdandExecId(nodeId,execId);
for(Long nodeId : childNodeList){
executeNodeActionProvider.get().withParameters(execId,nodeId).invoke();
}
}
}
| [
"kanhaiya@boomerangcommerce.com"
] | kanhaiya@boomerangcommerce.com |
3a28ddcc052b99d2cf89ab8c2793aee1bc482568 | 77c21c6617707500a559a45c686a5cf061b425a1 | /apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java | f8f51066ea5b5e18c585feb36d8399096c37d841 | [
"Apache-2.0"
] | permissive | taotao419/apollo | aa7339f163ac6eab73e3adaba6ebd051a585b7f6 | b9bfa126412d7478bdef68f63fa40eb2293fe787 | refs/heads/master | 2022-07-10T16:55:45.548581 | 2020-02-17T09:28:22 | 2020-02-17T09:28:22 | 240,217,094 | 0 | 0 | Apache-2.0 | 2022-05-20T22:00:13 | 2020-02-13T09:00:40 | Java | UTF-8 | Java | false | false | 3,009 | java | package com.ctrip.framework.apollo.biz.service;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.repository.AppRepository;
import com.ctrip.framework.apollo.common.entity.App;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.ServiceException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Service
public class AppService {
private final AppRepository appRepository;
private final AuditService auditService;
public AppService(final AppRepository appRepository, final AuditService auditService) {
this.appRepository = appRepository;
this.auditService = auditService;
}
public boolean isAppIdUnique(String appId) {
Objects.requireNonNull(appId, "AppId must not be null");
return Objects.isNull(appRepository.findByAppId(appId));
}
@Transactional
public void delete(long id, String operator) {
App app = appRepository.findById(id).orElse(null);
if (app == null) {
return;
}
app.setDeleted(true);
app.setDataChangeLastModifiedBy(operator);
appRepository.save(app);
auditService.audit(App.class.getSimpleName(), id, Audit.OP.DELETE, operator);
}
public List<App> findAll(Pageable pageable) {
Page<App> page = appRepository.findAll(pageable);
return page.getContent();
}
public List<App> findByName(String name) {
return appRepository.findByName(name);
}
public App findOne(String appId) {
return appRepository.findByAppId(appId);
}
@Transactional
public App save(App entity) {
if (!isAppIdUnique(entity.getAppId())) {
throw new ServiceException("appId not unique");
}
//保护代码,避免App对象中,已经有id属性. (我还是没搞懂?)
entity.setId(0);//protection
App app = appRepository.save(entity);
//记录Audit到数据库中
auditService.audit(App.class.getSimpleName(), app.getId(), Audit.OP.INSERT,
app.getDataChangeCreatedBy());
return app;
}
@Transactional
public void update(App app) {
String appId = app.getAppId();
App managedApp = appRepository.findByAppId(appId);
if (managedApp == null) {
throw new BadRequestException(String.format("App not exists. AppId = %s", appId));
}
managedApp.setName(app.getName());
managedApp.setOrgId(app.getOrgId());
managedApp.setOrgName(app.getOrgName());
managedApp.setOwnerName(app.getOwnerName());
managedApp.setOwnerEmail(app.getOwnerEmail());
managedApp.setDataChangeLastModifiedBy(app.getDataChangeLastModifiedBy());
managedApp = appRepository.save(managedApp);
auditService.audit(App.class.getSimpleName(), managedApp.getId(), Audit.OP.UPDATE,
managedApp.getDataChangeLastModifiedBy());
}
}
| [
"carrier.zhang@ef.com"
] | carrier.zhang@ef.com |
6b9b74e929c682722053f526f74efd95deadfe83 | 337b4678b39f92f75b4e87e20bbebec969788bef | /app/src/main/java/com/example/javanotebook/MainActivity.java | 9e9468f984369376fdae9f37fd9b3781e0195c0e | [] | no_license | dev2033/Java_notebook | 61188a395113c27ecf669317d705b59dbce0242b | 16a291a0bc13452be0db0c1dde20b3a296d0a45f | refs/heads/master | 2023-03-08T01:40:35.562585 | 2021-02-23T14:43:03 | 2021-02-23T14:43:03 | 340,898,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,312 | java | package com.example.javanotebook;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.SearchView;
import android.widget.TextView;
import com.example.javanotebook.adapter.MainAdapter;
import com.example.javanotebook.db.MyDbManager;
public class MainActivity extends AppCompatActivity {
private MyDbManager myDbManager;
private EditText edTitle, edDesc;
private RecyclerView rcView;
private MainAdapter mainAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
/*Редактироване меню, добален поиск по элементам списка*/
getMenuInflater().inflate(R.menu.main_menu, menu);
MenuItem item = menu.findItem(R.id.id_search);
SearchView sv = (SearchView) item.getActionView();
// setOnQueryTextListener - слушатель нажатий
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
// данная функция делает поиск только по нажатию на клавишу поиск на клавиатуре
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
// данная функция делает поиск сразу по введенным данным в строку поиска
@Override
public boolean onQueryTextChange(String newText) {
mainAdapter.updateAdapter(myDbManager.getFromDb(newText));
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
private void init() {
/*Инициализирует компоненты*/
myDbManager = new MyDbManager(this);
edTitle = findViewById(R.id.edTitle);
edDesc = findViewById(R.id.edDesc);
rcView = findViewById(R.id.rcView);
mainAdapter = new MainAdapter(this);
rcView.setLayoutManager(new LinearLayoutManager(this));
getItemTouchHelper().attachToRecyclerView(rcView);
rcView.setAdapter(mainAdapter);
}
@Override
protected void onResume() {
super.onResume();
myDbManager.openDb();
// запрос идет по всем словам, а функции onQueryTextChange(), по буквам
mainAdapter.updateAdapter(myDbManager.getFromDb(""));
}
public void onClickAdd(View view) {
Intent intent = new Intent(MainActivity.this, EditActivity.class);
startActivity(intent);
}
@Override
protected void onDestroy() {
super.onDestroy();
myDbManager.closeDb();
}
private ItemTouchHelper getItemTouchHelper() {
/*
* Свайп по элементу (RecyclerView) списка с записями (ЛЕВО и ПРАВО)
* */
return new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
/*
* Удаление элементов по свайпу
* */
// передаем сюда функцию адаптера и сам менеджер
// через viewHolder мы передается id элемента
mainAdapter.removeItem(viewHolder.getAdapterPosition(), myDbManager);
}
});
}
} | [
"dev.elop.02@mail.ru"
] | dev.elop.02@mail.ru |
c4e56be4ee2171eea0ab228d8e7b8b18a665de8b | f55e0f08bbbbde3bbf06b83c822a93d54819b1e8 | /app/src/main/java/com/jqsoft/nursing/bean/grassroots_civil_administration/LngLatCount.java | 04b528b7c6a3a70691162315e480470f92edbd87 | [] | no_license | moshangqianye/nursing | 27e58e30a51424502f1b636ae47b60b81a3b2ca0 | 20cd5aace59555ef9d708df0fb03639b2fc843d0 | refs/heads/master | 2020-09-08T13:39:55.939252 | 2020-03-20T09:55:34 | 2020-03-20T09:55:34 | 221,147,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package com.jqsoft.nursing.bean.grassroots_civil_administration;
/**
* Created by Administrator on 2018-02-02.
*/
public class LngLatCount {
private String count;//该地图点的困难群众数量
private String lng;//经度
private String lat;//纬度
public LngLatCount() {
super();
}
public LngLatCount(String count, String lng, String lat) {
this.count = count;
this.lng = lng;
this.lat = lat;
}
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
public String getLng() {
return lng;
}
public void setLng(String lng) {
this.lng = lng;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
}
| [
"123456"
] | 123456 |
815cc18041b594d004f6b55d824389850154203f | 993da9eb8c7c96804279c89424cd49e34cc9f6fa | /src/ch01/c1_9_e6.java | 4aa15670030c4b6c29e6659246718eb0ec67eaa3 | [] | no_license | roya57/CrackingCoding | 55f66de322bb2a2c92d7eb931392be3f04bcb600 | c7c9716713b8b93fbe07cb254bfd1709ab0ef9fc | refs/heads/master | 2020-04-05T22:54:54.062223 | 2016-08-29T23:14:40 | 2016-08-29T23:14:40 | 40,556,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package ch01;
/* Assume you have a method isSubstring which checks if one word is a substring
* of another. Given two strings, s1 and s2, write code to check if s2 is a rotation
* of s1 using only one call to isSubstring.
*/
public class c1_9_e6 {
public static boolean stringRotation(String s1, String s2) {
return isSubstring(s1, s2 + s2);
}
public static boolean isSubstring(String s1, String s2) {
return s2.indexOf(s1) != -1;
}
public static void main(String[] args) {
System.out.println(stringRotation("waterbottle", "erbottelewat"));
}
}
| [
"roya@royaa.net"
] | roya@royaa.net |
3c873a506d2124414af44cc3c1459ba9981e7495 | ea9a396f555cc4e31011ca58459bdd58f3ee7c0b | /assignments/EnterpriseComponentDevelopment/assignment2/src/main/java/doconnor/jpa/dao/CompanyDAO.java | 6ae385d2182c271b02a6016debbe0131360a9c18 | [] | no_license | mdreeling/Masters-2012 | 204c0d42cd65dbac3f71ee27548c38f065c095c4 | c12ece1580884d8b4093a0291f45a9a8b632b1da | refs/heads/master | 2016-09-05T22:34:49.987902 | 2014-09-01T03:57:24 | 2014-09-01T03:57:24 | 3,423,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package doconnor.jpa.dao;
import java.util.List;
import doconnor.jpa.domain.Company;
import doconnor.jpa.domain.Sponsorship;
public interface CompanyDAO {
void reattach(Company company);
List<Company> getAll();
void save(Company c);
void save(Sponsorship s) ;
}
| [
"mdreeling@gmail.com"
] | mdreeling@gmail.com |
ade782f03e1c93dc56decc027a74cace6e00f9be | a67f83572f13ea0f71cb3e783ed6d6f30d712039 | /src/com/symantec/eloqua/assetMigrator/Form/Models/Size.java | 72fc0badeb3a59fff4d5b2845e341c5959503371 | [] | no_license | ronitc/AssetMigrator | fb5f39fdd4f16b3aebd339f772b6655ea6982176 | 2f59807ffaee9e687d40bf75ce8295fdafe4d6b9 | refs/heads/master | 2020-03-19T19:55:04.836498 | 2018-06-11T05:56:19 | 2018-06-11T05:56:19 | 136,879,305 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.symantec.eloqua.assetMigrator.Form.Models;
public class Size
{
private String height;
private String width;
private String type;
public String getHeight ()
{
return height;
}
public void setHeight (String height)
{
this.height = height;
}
public String getWidth ()
{
return width;
}
public void setWidth (String width)
{
this.width = width;
}
public String getType ()
{
return type;
}
public void setType (String type)
{
this.type = type;
}
@Override
public String toString()
{
return "ClassPojo [height = "+height+", width = "+width+", type = "+type+"]";
}
}
| [
"Ronit_Chougule@symantec.com"
] | Ronit_Chougule@symantec.com |
ee458b4ff37074e1ae170786b9a47910e1134a27 | 068733ca010595bae9d405ccdba5bbd7c7913885 | /txtToXML/src/FileNotReadableException.java | 600c8f9a6075ed0d63f7f9eb9e855864d5eb37a2 | [
"MIT"
] | permissive | TomerArzu/Fixed-Structured-txt-To-XML | 41cf89b946d69fe121d70101e4811865f25694b3 | eb7a25023055e0ed18fe3e6dcf1e4f5c55b23a92 | refs/heads/master | 2020-09-29T23:17:54.146674 | 2019-12-12T19:49:33 | 2019-12-12T19:49:33 | 227,146,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java |
public class FileNotReadableException extends Exception {
public FileNotReadableException(String msg)
{
super("Error: The file isn't found in the path you have provided\nThe path " + msg+" .");
}
}
| [
"noreply@github.com"
] | TomerArzu.noreply@github.com |
153af6d4441fe84bbafb61faaa28d8104a0ba6f0 | 2e9b871872bfd0af6dc60e552c0169334459334f | /src/Entrada_ejemplo2.java | 7a32e88ea9390be14c63f40fbd7daeb1292a05f3 | [] | no_license | ftrabucco/java-primeros-pasos | b72540e1da42b0062386982aa572176f32835b50 | 7b7e5f852a9cdbc3cf343c9580ef1d005ff3b32b | refs/heads/master | 2023-08-13T04:53:42.291476 | 2021-09-28T20:28:12 | 2021-09-28T20:28:12 | 385,384,058 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 507 | java | import javax.swing.JOptionPane;
public class Entrada_ejemplo2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
String nombre_usuario = JOptionPane.showInputDialog("Introduce tu nombre, por favor");
String edad = JOptionPane.showInputDialog("Introduce la edad, por favor");
int edad_usuario=Integer.parseInt(edad);
edad_usuario++;
System.out.println("Hola "+ nombre_usuario + ". El año que viene tendrás " + edad_usuario + " años");
}
}
| [
"trabucco.francisco@gmail.com"
] | trabucco.francisco@gmail.com |
b75f392ed821cef06fd18dbd9e03f893c699c0fb | da7d094ccdb2c0ece1e2e258d82942535bb69641 | /app/src/main/java/com/example/cookbook/FoodModel.java | be3bb1ff8dc8fb117617b95d5ca79a15b3d238d0 | [] | no_license | raksha-s/cookbook | e2fef5b4b1f3e42b4e94965a85c9ddae99a6a1de | b6c4f879800428a8140c8ebf9587bcf991eefd9d | refs/heads/main | 2023-05-29T03:00:58.588642 | 2021-06-09T16:39:18 | 2021-06-09T16:39:18 | 374,894,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,383 | java | package com.example.cookbook;
public class FoodModel {
private Integer id;
private String dish_name, dish_desc, image;
public FoodModel(String dish_name, String dish_desc, String image) {
this.dish_name = dish_name;
this.dish_desc = dish_desc;
this.image = image;
}
public FoodModel(Integer id, String dish_name, String dish_desc, String image) {
this.id = id;
this.dish_name = dish_name;
this.dish_desc = dish_desc;
this.image = image;
}
@Override
public String toString() {
return "FoodModel{" +
"id=" + id +
", dish_name='" + dish_name + '\'' +
", dish_desc='" + dish_desc + '\'' +
", image='" + image + '\'' +
'}';
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDish_name() {
return dish_name;
}
public void setDish_name(String dish_name) {
this.dish_name = dish_name;
}
public String getDish_desc() {
return dish_desc;
}
public void setDish_desc(String dish_desc) {
this.dish_desc = dish_desc;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}
| [
"rakshakaranth.s@gmail.com"
] | rakshakaranth.s@gmail.com |
e0f5a42c51a39243f135df325867f53f78032065 | df3a5821f78212082843954028f0b1043815e68a | /droolsPrototypeSources/src/test/java/de/bernhardunger/drools/RuleLogicalAndFireRuleImmediatlyAfterInsertTest.java | 787214ac1f0beab36ccf4ddb839b38beb468c54e | [] | no_license | bernhardunger/DroolsRHQPrototype | c159a761151c2369ee3d78d5fd42c142d600bcc1 | 83db29f8ea463611358bddf8143caeb1c0f1ca4f | refs/heads/master | 2021-01-10T19:55:23.900692 | 2012-12-16T10:50:48 | 2012-12-16T10:50:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,282 | java | package de.bernhardunger.drools;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.management.MBeanServerConnection;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.conf.EventProcessingOption;
import org.drools.io.impl.ClassPathResource;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.runtime.KnowledgeSessionConfiguration;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.conf.ClockTypeOption;
import org.drools.runtime.rule.FactHandle;
import org.drools.time.SessionPseudoClock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.bernhardunger.drools.model.EventComposite;
import de.bernhardunger.drools.util.Statistic;
import static de.bernhardunger.drools.util.EventFatory.*;
/**
* Rule mass test with many boolean and conjunction in the when clauses of the rules.
*
* @author Bernhard Unger
*
*/
public class RuleLogicalAndFireRuleImmediatlyAfterInsertTest {
Logger logger = LoggerFactory.getLogger(RuleLogicalAndFireRuleImmediatlyAfterInsertTest.class);
private StatefulKnowledgeSession ksession;
private KnowledgeRuntimeLogger knwlgLogger;
private long startTime;
private long endTime;
private List<Statistic> statistics = new ArrayList<Statistic>();
int noOfEvents = 1000000;
int totalEvents = 0;
int eventId = 0;
@Before
public void prepare() throws IOException, InterruptedException {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("Jconsole -interval=1");
Thread.sleep(5000);
}
@Test
public void start() {
startTime = new Date().getTime();
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
// Load rules from file
// Other rules might be added...
kbuilder.add(new ClassPathResource("testRuleLogicalAnd200.drl", getClass()), ResourceType.DRL);
if (kbuilder.hasErrors()) {
if (kbuilder.getErrors().size() > 0) {
for (KnowledgeBuilderError kerror : kbuilder.getErrors()) {
System.err.println(kerror);
}
}
}
KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
// Drools Fusion needs STREAMING
config.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
KnowledgeSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
// Control the clock for test instead of system time
conf.setOption(ClockTypeOption.get("pseudo"));
ksession = kbase.newStatefulKnowledgeSession(conf, null);
// Logging is a performance issue, so disabling for exhaustive tests is
// neccessary
//knwlgLogger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "logs/myKnowledgeLogfile");
for (int i = 1; i <= noOfEvents; i++) {
insertEvent("eventDetail", i);
endTime = new Date().getTime();
saveStatisticEntry(i);
ksession.fireAllRules();
if ( i % 100000 == 0 ) {
System.out.println("Event: " + i);
}
}
ksession.fireAllRules();
}
/**
* Will be executed when the last test has been finished
*/
@After
public void release() {
//knwlgLogger.close();
ksession.halt();
ksession.dispose();
printStatistics();
}
/**
* Insert the events facts into the knowledge session
*
*/
private FactHandle insertEvent(String eventDetail, int stepId) {
SessionPseudoClock clock = ksession.getSessionClock();
EventComposite event;
long timestamp = clock.advanceTime(1, TimeUnit.MILLISECONDS);
event = makeSimpleEvent(eventDetail+stepId, stepId, eventId, timestamp);
FactHandle handle = ksession.insert(event);
eventId++;
totalEvents++;
return handle;
}
/**
* Save the statistic entry
*
* @param step
*/
private void saveStatisticEntry(int step) {
long execTime = endTime - startTime;
MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer();
OperatingSystemMXBean osMBean = null;
try {
osMBean = ManagementFactory.newPlatformMXBeanProxy(mbsc, ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
OperatingSystemMXBean.class);
} catch (IOException e) {
e.printStackTrace();
}
double systemLoadAverage = osMBean.getSystemLoadAverage();
Statistic statistic = new Statistic(step, totalEvents, execTime, systemLoadAverage);
statistics.add(statistic);
}
/**
* Log statistics
*/
private void printStatistics() {
logger.debug("Step;" + "Total Events;" + "Events/ms;" + "Execution Time;" + "Max CPU usage");
for (Statistic stat : statistics) {
logger.debug(stat.getStep() + ";" + stat.getNoOfEvents() + ";" + (double) stat.getEventsPerSecond() + ";"
+ stat.getExecTime() + ";" + stat.getAverageCpuLoad());
}
}
}
| [
"mail@bernhardunger.de"
] | mail@bernhardunger.de |
2545bc493265308f782cfb8058bfe0bd7dc21f4c | c1ba21bf10eb6a56601ea132663096867c14a6eb | /services/ecommerceadmin/src/main/java/com/technokryon/ecommerce/admin/pojo/User.java | 84861c958aa6bb5fb765d745b6ca9d7b921bc692 | [] | no_license | alwintechnokryon/D-Commerce | fa302d82087938f3f3c0b98da8d106af942270a5 | 6fe445e287ba6488453b3dd56521f4554af24ebd | refs/heads/master | 2020-09-16T20:02:53.038025 | 2020-03-10T13:24:00 | 2020-03-10T13:24:00 | 223,875,024 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package com.technokryon.ecommerce.admin.pojo;
import java.math.BigInteger;
import java.time.OffsetDateTime;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class User {
String uId;
String uName;
String uRegType;
String uMail;
int uOtp;
OffsetDateTime uOtpExp;
String uHashKey;
String uPassword;
OffsetDateTime uCreatedDate;
BigInteger uPhone;
Integer uPhoneCode;
String uOtpStatus;
String uStatus;
OffsetDateTime uModifideDate;
String oldPassword;
String apiKey;
}
| [
"vinoth.kryon@gmail.com"
] | vinoth.kryon@gmail.com |
625de4179af0a8b55bf170a9c6b6db4d15f9fe2d | c524f830b026b380b05010228e696de0558cfc0f | /Week_01/src/homework/L_26_Remove_Duplicates_From_Sort_Array.java | ddc9f74d0fc4d83a208dbc506d142e6c3409c17d | [] | no_license | miserydx/AlgorithmCHUNZHAO | f8cb62ca50affa7ea69886149f4941ffc769182f | ffdc4d57fdf935904902c53db818651a44438b35 | refs/heads/main | 2023-03-22T12:11:50.831474 | 2021-03-21T11:25:26 | 2021-03-21T11:25:26 | 332,264,355 | 0 | 0 | null | 2021-01-23T17:10:38 | 2021-01-23T17:10:38 | null | UTF-8 | Java | false | false | 1,856 | java | package homework;
//给定一个排序数组,你需要在 原地 删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
//
// 不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。
//
//
//
// 示例 1:
//
// 给定数组 nums = [1,1,2],
//
//函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。
//
//你不需要考虑数组中超出新长度后面的元素。
//
// 示例 2:
//
// 给定 nums = [0,0,1,1,1,2,2,3,3,4],
//
//函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。
//
//你不需要考虑数组中超出新长度后面的元素。
//
//
//
//
// 说明:
//
// 为什么返回数值是整数,但输出的答案是数组呢?
//
// 请注意,输入数组是以「引用」方式传递的,这意味着在函数里修改输入数组对于调用者是可见的。
//
// 你可以想象内部操作如下:
//
// // nums 是以“引用”方式传递的。也就是说,不对实参做任何拷贝
//int len = removeDuplicates(nums);
//
//// 在函数里修改输入数组对于调用者是可见的。
//// 根据你的函数返回的长度, 它会打印出数组中该长度范围内的所有元素。
//for (int i = 0; i < len; i++) {
// print(nums[i]);
//}
//
// Related Topics 数组 双指针
public class L_26_Remove_Duplicates_From_Sort_Array {
/**
* 双指针 后指针向后推,前后指针值不等时,前指针++位置赋值
* 类似移动0
*/
public int removeDuplicates(int[] nums) {
int i = 0;
for (int j = 0; j < nums.length; j++) {
if (nums[i] != nums[j]) {
nums[++i] = nums[j];
}
}
return i + 1;
}
}
| [
"miserydx@163.com"
] | miserydx@163.com |
1b3579b7b8472d954456b3258a2a0e82e6e4829e | 3cd69da4d40f2d97130b5bf15045ba09c219f1fa | /sources/com/fasterxml/jackson/databind/introspect/BasicClassIntrospector.java | c4a8a5fa62ad60ef9da49a0b5527732121061ebc | [] | no_license | TheWizard91/Album_base_source_from_JADX | 946ea3a407b4815ac855ce4313b97bd42e8cab41 | e1d228fc2ee550ac19eeac700254af8b0f96080a | refs/heads/master | 2023-01-09T08:37:22.062350 | 2020-11-11T09:52:40 | 2020-11-11T09:52:40 | 311,927,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,839 | java | package com.fasterxml.jackson.databind.introspect;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.ClassIntrospector;
import com.fasterxml.jackson.databind.type.SimpleType;
import java.io.Serializable;
public class BasicClassIntrospector extends ClassIntrospector implements Serializable {
protected static final BasicBeanDescription BOOLEAN_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(Boolean.TYPE), AnnotatedClass.constructWithoutSuperTypes(Boolean.TYPE, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null));
protected static final BasicBeanDescription INT_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(Integer.TYPE), AnnotatedClass.constructWithoutSuperTypes(Integer.TYPE, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null));
protected static final BasicBeanDescription LONG_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(Long.TYPE), AnnotatedClass.constructWithoutSuperTypes(Long.TYPE, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null));
protected static final BasicBeanDescription STRING_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(String.class), AnnotatedClass.constructWithoutSuperTypes(String.class, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null));
public static final BasicClassIntrospector instance = new BasicClassIntrospector();
private static final long serialVersionUID = 1;
public BasicBeanDescription forSerialization(SerializationConfig serializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) {
BasicBeanDescription _findCachedDesc = _findCachedDesc(javaType);
if (_findCachedDesc == null) {
return BasicBeanDescription.forSerialization(collectProperties(serializationConfig, javaType, mixInResolver, true, "set"));
}
return _findCachedDesc;
}
public BasicBeanDescription forDeserialization(DeserializationConfig deserializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) {
BasicBeanDescription _findCachedDesc = _findCachedDesc(javaType);
if (_findCachedDesc == null) {
return BasicBeanDescription.forDeserialization(collectProperties(deserializationConfig, javaType, mixInResolver, false, "set"));
}
return _findCachedDesc;
}
public BasicBeanDescription forDeserializationWithBuilder(DeserializationConfig deserializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) {
return BasicBeanDescription.forDeserialization(collectPropertiesWithBuilder(deserializationConfig, javaType, mixInResolver, false));
}
public BasicBeanDescription forCreation(DeserializationConfig deserializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) {
BasicBeanDescription _findCachedDesc = _findCachedDesc(javaType);
if (_findCachedDesc == null) {
return BasicBeanDescription.forDeserialization(collectProperties(deserializationConfig, javaType, mixInResolver, false, "set"));
}
return _findCachedDesc;
}
public BasicBeanDescription forClassAnnotations(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) {
return BasicBeanDescription.forOtherUse(mapperConfig, javaType, AnnotatedClass.construct(javaType.getRawClass(), mapperConfig.isAnnotationProcessingEnabled() ? mapperConfig.getAnnotationIntrospector() : null, mixInResolver));
}
public BasicBeanDescription forDirectClassAnnotations(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) {
boolean isAnnotationProcessingEnabled = mapperConfig.isAnnotationProcessingEnabled();
AnnotationIntrospector annotationIntrospector = mapperConfig.getAnnotationIntrospector();
Class<?> rawClass = javaType.getRawClass();
if (!isAnnotationProcessingEnabled) {
annotationIntrospector = null;
}
return BasicBeanDescription.forOtherUse(mapperConfig, javaType, AnnotatedClass.constructWithoutSuperTypes(rawClass, annotationIntrospector, mixInResolver));
}
/* access modifiers changed from: protected */
public POJOPropertiesCollector collectProperties(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver, boolean z, String str) {
return constructPropertyCollector(mapperConfig, AnnotatedClass.construct(javaType.getRawClass(), mapperConfig.isAnnotationProcessingEnabled() ? mapperConfig.getAnnotationIntrospector() : null, mixInResolver), javaType, z, str).collect();
}
/* access modifiers changed from: protected */
public POJOPropertiesCollector collectPropertiesWithBuilder(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver, boolean z) {
JsonPOJOBuilder.Value value = null;
AnnotationIntrospector annotationIntrospector = mapperConfig.isAnnotationProcessingEnabled() ? mapperConfig.getAnnotationIntrospector() : null;
AnnotatedClass construct = AnnotatedClass.construct(javaType.getRawClass(), annotationIntrospector, mixInResolver);
if (annotationIntrospector != null) {
value = annotationIntrospector.findPOJOBuilderConfig(construct);
}
return constructPropertyCollector(mapperConfig, construct, javaType, z, value == null ? "with" : value.withPrefix).collect();
}
/* access modifiers changed from: protected */
public POJOPropertiesCollector constructPropertyCollector(MapperConfig<?> mapperConfig, AnnotatedClass annotatedClass, JavaType javaType, boolean z, String str) {
return new POJOPropertiesCollector(mapperConfig, z, javaType, annotatedClass, str);
}
/* access modifiers changed from: protected */
public BasicBeanDescription _findCachedDesc(JavaType javaType) {
Class<?> rawClass = javaType.getRawClass();
if (rawClass == String.class) {
return STRING_DESC;
}
if (rawClass == Boolean.TYPE) {
return BOOLEAN_DESC;
}
if (rawClass == Integer.TYPE) {
return INT_DESC;
}
if (rawClass == Long.TYPE) {
return LONG_DESC;
}
return null;
}
}
| [
"agiapong@gmail.com"
] | agiapong@gmail.com |
06946c8e4a2fb17ea583577366e0e78e0ece32f5 | 99500a71b03db3596b5b85afa201fdaf93eea9d5 | /src/org/alansaudiotagger/tag/id3/framebody/FrameBodyTIPL.java | c4d479c1f42a48176b995df42986ec7552254609 | [] | no_license | aljordan/JPlaylistEditor | fba172f3954cd9ee29d9329e4d0075dd42f5f121 | 68f82e630ce36155010f7ad31e91c9493929f611 | refs/heads/master | 2021-01-20T10:42:44.857483 | 2014-12-07T19:51:16 | 2014-12-07T19:51:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,387 | java | /**
* @author : Paul Taylor
* @author : Eric Farng
*
* Version @version:$Id: FrameBodyTIPL.java,v 1.12 2008/07/21 10:45:44 paultaylor Exp $
*
* MusicTag Copyright (C)2003,2004
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
* General Public License as published by the Free Software Foundation; either version 2.1 of the License,
* or (at your option) any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not,
* you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Description:
* People List
*
*/
package org.alansaudiotagger.tag.id3.framebody;
import org.alansaudiotagger.tag.InvalidTagException;
import org.alansaudiotagger.tag.datatype.DataTypes;
import org.alansaudiotagger.tag.datatype.PairedTextEncodedStringNullTerminated;
import org.alansaudiotagger.tag.id3.ID3v24Frames;
import java.nio.ByteBuffer;
/**
* The 'Involved people list' is intended as a mapping between functions like producer and names. Every odd field is a
* function and every even is an name or a comma delimited list of names.
* <p/>
* TODO currently just reads the first String when directly from file, this will be fixed when we add support for
* multiple Strings for all ID3v24Frames
* <p/>
* TODO currently just reads all the values when converted from the corresponding ID3v23 Frame IPLS as a single value
* (the individual fields from the IPLS frame will be seperated by commas)
*/
public class FrameBodyTIPL extends AbstractFrameBodyTextInfo implements ID3v24FrameBody
{
/**
* Creates a new FrameBodyTIPL datatype.
*/
public FrameBodyTIPL()
{
}
public FrameBodyTIPL(FrameBodyTIPL body)
{
super(body);
}
/**
* Convert from V3 to V4 Frame
*/
public FrameBodyTIPL(FrameBodyIPLS body)
{
setObjectValue(DataTypes.OBJ_TEXT_ENCODING, body.getTextEncoding());
PairedTextEncodedStringNullTerminated.ValuePairs value = (PairedTextEncodedStringNullTerminated.ValuePairs) body.getObjectValue(DataTypes.OBJ_TEXT);
setObjectValue(DataTypes.OBJ_TEXT, value.toString());
}
/**
* Creates a new FrameBodyTIPL datatype.
*
* @param textEncoding
* @param text
*/
public FrameBodyTIPL(byte textEncoding, String text)
{
super(textEncoding, text);
}
/**
* Creates a new FrameBodyTIPL datatype.
*
* @throws InvalidTagException
*/
public FrameBodyTIPL(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException
{
super(byteBuffer, frameSize);
}
/**
* The ID3v2 frame identifier
*
* @return the ID3v2 frame identifier for this frame type
*/
public String getIdentifier()
{
return ID3v24Frames.FRAME_ID_INVOLVED_PEOPLE;
}
}
| [
"aljordan@gmail.com"
] | aljordan@gmail.com |