blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10317b723a2e05f6e9491a508c494b6ec4c43094 | 1d05556e3a0acd193ad1328ea4b1df96d1df96ea | /src/utilities/PasswordService.java | 97435a90ef0d59b7b5c48b474324150382d4d355 | [] | no_license | caozhenxu/MIT_GolfCourse | a6542fcee1837842e67c84ca7ef904e654dd1bde | ba26d88d0b47c5e7d8ae6c9e9ff15d9489a5f600 | refs/heads/master | 2020-05-25T15:43:51.109214 | 2016-03-29T00:38:36 | 2016-03-29T00:38:36 | 50,884,559 | 0 | 1 | null | 2016-02-02T01:22:52 | 2016-02-02T01:22:52 | null | UTF-8 | Java | false | false | 628 | java | package utilities;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import sun.misc.BASE64Encoder;
public final class PasswordService {
public String encrypt(String pass) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
md.update(pass.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
}
}
| [
"ajones35@uga.edu"
] | ajones35@uga.edu |
0fb0a0837ece87581580aab6bc65cf890cdca042 | c55e83f91db20c89316ecaa7ff831cb8c1cbbfc7 | /SimpleProjectCorrection/src/com/tdh/zelink/servlet/GetUserBySearch.java | f821cd411e5c0ec8e56524c4b9a84d7c6d215a05 | [] | no_license | Sirius2214/JavaBase | f5b7c92e5412f0baac957fbdae147c1953214b7c | 8114a026e2e06d26cd15fd43cb78e569f126805c | refs/heads/master | 2023-05-05T10:04:45.785504 | 2021-05-19T01:35:21 | 2021-05-19T01:35:21 | 368,708,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,525 | java | package com.tdh.zelink.servlet;
import com.alibaba.fastjson.JSONArray;
import com.tdh.zelink.dao.TableInfoDao;
import com.tdh.zelink.datasource.SortTableInfo;
import com.tdh.zelink.entity.TableInfo;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
/**
* @author ZeLink
* @Description
* @date 2021/4/26 16:54
*/
public class GetUserBySearch extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 返回中文时的编码要求
resp.setContentType("text/html");
resp.setCharacterEncoding("utf-8");
TableInfoDao tableInfoDao = new TableInfoDao();
// 获取用户名/用户ID
String name = req.getParameter("name");
ArrayList<TableInfo> userByNameOrId=null;
// 用户名不为空时
if(!"".equals(name)){
// 调用根据ID查询的方法,并返回集合数据
userByNameOrId = tableInfoDao.getUserByNameOrId(name);
}
System.out.println(userByNameOrId);
// 将数据进行排序
SortTableInfo sortTableInfo = new SortTableInfo();
userByNameOrId = sortTableInfo.sortTableInfo(userByNameOrId);
// 返回数据给前端
resp.getWriter().write(String.valueOf(JSONArray.toJSON(userByNameOrId)));
}
}
| [
"2684071332@qq.com"
] | 2684071332@qq.com |
61f7a8843699bc78f1f98960e57724bcee68a618 | 543c9e480a33d72e8949b04558ba1d030925d2f3 | /Java/ProgrammingTeam/ShortestPath/ShortestPathTotalDistance.java | b14d55de2ff02578cae21c9107474469258e15af | [] | no_license | tonymajestro2/Programs | 987a76f2f658447b3bf651fedfdadfd3511251e0 | 576693faafd707a3710a31da70cd3c4aebd0949d | refs/heads/master | 2021-01-20T11:05:59.527355 | 2013-03-28T21:49:00 | 2013-03-28T21:49:00 | 5,548,393 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,187 | java | import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;
public class ShortestPathTotalDistance
{
public static void main(String[] args) throws IOException
{
Scanner in = new Scanner(new File("in.txt"));
while (in.hasNextInt()) {
int numVertices = in.nextInt();
int numEdges = in.nextInt();
Graph g = new Graph();
int[] dist = new int[numVertices];
MinNode[] minSpanTree = new MinNode[numVertices];
for (int i = 0; i < numVertices; i++) {
dist[i] = Integer.MAX_VALUE;
g.adjacencyList.add(new HashMap<Integer, Edge>());
minSpanTree[i] = new MinNode(i);
}
for (int i = 0; i < numEdges; i++) {
int v = in.nextInt();
int w = in.nextInt();
int weight = in.nextInt();
g.addEdge(v, w, new Edge(v, w, weight));
}
int start = 0;
shortestPath(g, start, -1, dist, minSpanTree);
System.out.println(minSpanTreeDistance(g, minSpanTree, start));
}
in.close();
}
static void shortestPath(Graph g, int start, int goal, int[] dist,
MinNode[] minSpanTree)
{
dist[start] = 0;
int[] pred = new int[dist.length];
boolean[] visited = new boolean[dist.length];
for (int i = 0; i < visited.length; i++) {
// Find unused vertex with shortest distance from start
int v = findMinVertex(dist, visited);
if (v == goal) {
return;
}
visited[v] = true;
// Add to min span tree graph
if (v != start)
minSpanTree[pred[v]].children.add(v);
int d = dist[v];
for (int w : g.adjacencyList.get(v).keySet()) {
Edge e = g.adjacencyList.get(v).get(w);
int newDist = d + e.weight;
if (newDist < dist[e.w]) {
dist[e.w] = newDist;
pred[e.w] = v;
}
}
}
System.out.println("Done");
}
static int findMinVertex(int[] dist, boolean[] visited)
{
int min = Integer.MAX_VALUE;
int index = -1;
for (int i = 0; i < dist.length; i++) {
int d = dist[i];
if (d < min && !visited[i]) {
min = d;
index = i;
}
}
return index;
}
static int minSpanTreeDistance(Graph g, MinNode[] minSpanTree, int start)
{
Stack<MinNode> nodes = new Stack<MinNode>();
nodes.add(minSpanTree[start]);
int distance = 0;
while (!nodes.isEmpty()) {
MinNode curr = nodes.pop();
for (int w : curr.children) {
int temp = g.adjacencyList.get(curr.num).get(w).weight;
System.out.println(curr.num + " " + w + ": " + temp);
distance += temp;
nodes.push(minSpanTree[w]);
}
}
return distance;
}
static class Graph
{
List<Map<Integer, Edge>> adjacencyList;
Graph() {
this.adjacencyList = new ArrayList<Map<Integer, Edge>>();
}
void addEdge(int v, int w, Edge e) {
this.adjacencyList.get(v).put(w, e);
}
}
static class Edge
{
int v;
int w;
int weight;
Edge(int v, int w, int weight) {
this.v = v; this.w = w; this.weight = weight;
}
}
static class MinNode
{
List<Integer> children;
int num;
MinNode(int num) {
this.children = new ArrayList<Integer>();
this.num = num;
}
}
} | [
"tmajest@vt.edu"
] | tmajest@vt.edu |
542d68c70eaa9bfd7b203007416f60ef82458c16 | 94138ba86d0dbf80b387064064d1d86269e927a1 | /group02/727171008/src/com/github/HarryHook/coding2017/jvm/attr/LineNumberTable.java | f3b8c91705692fbcf0ab4eb09d4f25305fac453b | [] | no_license | DonaldY/coding2017 | 2aa69b8a2c2990b0c0e02c04f50eef6cbeb60d42 | 0e0c386007ef710cfc90340cbbc4e901e660f01c | refs/heads/master | 2021-01-17T20:14:47.101234 | 2017-06-01T00:19:19 | 2017-06-01T00:19:19 | 84,141,024 | 2 | 28 | null | 2017-06-01T00:19:20 | 2017-03-07T01:45:12 | Java | UTF-8 | Java | false | false | 1,640 | java | package com.github.HarryHook.coding2017.jvm.attr;
import java.util.ArrayList;
import java.util.List;
import com.github.HarryHook.coding2017.jvm.loader.ByteCodeIterator;
public class LineNumberTable extends AttributeInfo {
List<LineNumberItem> items = new ArrayList<LineNumberItem>();
private static class LineNumberItem {
int startPC;
int lineNum;
public int getStartPC() {
return startPC;
}
public void setStartPC(int startPC) {
this.startPC = startPC;
}
public int getLineNum() {
return lineNum;
}
public void setLineNum(int lineNum) {
this.lineNum = lineNum;
}
}
public void addLineNumberItem(LineNumberItem item) {
this.items.add(item);
}
public LineNumberTable(int attrNameIndex, int attrLen) {
super(attrNameIndex, attrLen);
}
public static LineNumberTable parse(ByteCodeIterator iter) {
int attrNameIndex = iter.nextU2ToInt();
int attrLength = iter.nextU4ToInt();
LineNumberTable table = new LineNumberTable(attrNameIndex, attrLength);
int itemLength = iter.nextU2ToInt();
for (int i = 1; i <= itemLength; i++) {
LineNumberItem item = new LineNumberItem();
item.setStartPC(iter.nextU2ToInt());
item.setLineNum(iter.nextU2ToInt());
table.addLineNumberItem(item);
}
return table;
}
public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append("Line Number Table:\n");
for (LineNumberItem item : items) {
buffer.append("startPC:" + item.getStartPC()).append(",");
buffer.append("lineNum:" + item.getLineNum()).append("\n");
}
buffer.append("\n");
return buffer.toString();
}
} | [
"chenhaowei93@163.com"
] | chenhaowei93@163.com |
918c2a106d28df2511ca8434b67b3c58f48ed577 | feb4cedf7b132f12392c6150f6ca9c351ce20e62 | /Ebay/src/main/java/DataSource/DatabaseOperation.java | 114bdd7e3404624331c18e15760dba62fe9c4f68 | [] | no_license | EzCrash/GroupWork | 41aec7ccccdf29c443fd0b05e4f24ddcdf1cf79f | 16a1b3790150c586865872f178b97bcc4fdf26a9 | refs/heads/master | 2020-05-02T11:43:46.253765 | 2019-03-28T06:30:27 | 2019-03-28T06:30:27 | 177,937,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,345 | java | package DataSource;
import databases.ConnectToSqlDB;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class DatabaseOperation extends ConnectToSqlDB {
static ConnectToSqlDB connectToSqlDB = new ConnectToSqlDB();
public static void insertDataIntoDB(){
List<String> list = getItemValue();
connectToSqlDB = new ConnectToSqlDB();
//connectToSqlDB.insertStringDataFromArrayListToSqlTable(list,"ItemList","items");
}
public static List<String> getItemValue(){
List<String> itemsList = new ArrayList<String>();
itemsList.add("Books");
itemsList.add("Toys");
itemsList.add("Tools");
return itemsList;
}
public List<String> getItemsListFromDB()throws Exception, IOException, SQLException, ClassNotFoundException {
List<String> list = new ArrayList<>();
list = connectToSqlDB.readDataBase("ItemList", "items");
return list;
}
public static void main(String[] args) throws Exception {
//insertDataIntoDB();
ConnectToSqlDB connectToSqlDB = new ConnectToSqlDB();
insertDataIntoDB();
List<String> list = connectToSqlDB.readDataBase("ItemList","items");
for(String st:list){
System.out.println(st);
}
}
}
| [
"mustapha_ilahi@yahoo.com"
] | mustapha_ilahi@yahoo.com |
bef28ef015d7596ef98f61b534fcf3fbe207cff2 | cc359cf74c964597cdda913ea878453c3f597e14 | /src/datasafer/backup/dao/utility/Limpador.java | 8cba62c9b5e65b42a6a33677b40d636c10e4f187 | [
"MIT"
] | permissive | DatasaferSenai/datasafer-backend | 4a98d038884772792f5ca1a33730caba6fe7f5ea | add7dd3adce0833353a65d3735e7b0c4e2603724 | refs/heads/master | 2021-01-17T18:06:38.319566 | 2016-12-03T19:36:02 | 2016-12-03T19:36:02 | 70,985,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package datasafer.backup.dao.utility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import datasafer.backup.dao.AutorizacaoDao;
import datasafer.backup.dao.NotificacaoDao;
@Component
public class Limpador {
@Autowired
private NotificacaoDao notificacaoDao;
@Autowired
private AutorizacaoDao autorizacaoDao;
@Scheduled(cron = "0 0 12 * * *")
public void excecutaLimpeza() {
try {
notificacaoDao.limpaNotificacoes(15);
autorizacaoDao.limpaAutorizacoes(15);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"datasafer.senai@gmail.com"
] | datasafer.senai@gmail.com |
348a6f6b06f429ba31ae90bf7f3457d1e0e396eb | 90fb84ad7e742b1deb890d62eb48b0c489021e0e | /modulo1java/src/test/java/prj/com/it/AppTest.java | dbc7e50cb79b69c03250603d79becaf1a12aeca5 | [] | no_license | mastiffs1990/multiModule | 005909326930903832378e94ca7e8f952027f86f | ed135f30f2beb1dc94ad257be749fc698302b20d | refs/heads/master | 2021-04-27T01:01:04.287568 | 2018-02-27T20:46:00 | 2018-02-27T20:46:00 | 122,665,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package prj.com.it;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"lucaesp990@gmail.com"
] | lucaesp990@gmail.com |
9fbad0acbcfe32b6729e529e3d96ad798de04cb1 | a03a0a4af78042cce385da2deda6649c878ac0fd | /CMTJava-OLDmaster/src/stm/FieldInfo.java | 0f7bcbdbcce85e209902733007e4cc5b1bbe4c43 | [] | no_license | Mytocopero/CMTJava-Compiler | a7daac822db7aa21914188673dad54847d3d6e61 | 0f5b9fcb55c284d7f89e7456410698b34ae641fa | refs/heads/master | 2021-01-10T15:48:34.034846 | 2015-11-24T15:30:03 | 2015-11-24T15:30:03 | 46,738,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | package stm;
import java.util.*;
import java.util.concurrent.atomic.AtomicMarkableReference;
public class FieldInfo <A> {
public {A => void} updateField;
public AtomicMarkableReference<Long> wlock;
public AtomicMarkableReference<Long> rlock;
public Vector<Block> blockedThreads;
public String name;
public FieldInfo( String name, {A => void } uf ) {
this(uf);
this.name = name;
}
public FieldInfo( {A => void } uf ) {
updateField = uf;
blockedThreads = new Vector<Block>();
wlock = new AtomicMarkableReference(null, false);
rlock = new AtomicMarkableReference(0l, false);
}
public synchronized void addBlockedThread (Block s) {
blockedThreads.add(s);
}
public synchronized void wakeupBlockedThreads () {
for (int i=0; i < blockedThreads.size(); i++) {
blockedThreads.get(i).unblock();
}
blockedThreads = new Vector<Block>();
}
public synchronized String toString() {
return ("["+ name + " : wlock "+ wlock.isMarked() +"," +wlock.getReference()
+" : rlock "+ rlock.isMarked() +"," +rlock.getReference()+"]") ;
}
}
| [
"alvaro.mytoz@gmail.com"
] | alvaro.mytoz@gmail.com |
a2acd369c74fa0478169de946ee0e364c14e9a68 | 614ad6e97b9b45a485586f7c99275e901cba85cd | /src/test/java/com/example/cucumber/CucumberContextConfiguration.java | 37244c0c8324ce3714978e478743abde6a8a3d0e | [] | no_license | mitch-warrenburg/sample-app | 9bb8f427ed62673625748588811bd4609a8a1f7d | b3968aa22cbf4d51e9d17407f1fea473e173c54a | refs/heads/master | 2022-03-04T09:13:35.411193 | 2019-05-25T09:41:45 | 2019-05-25T09:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package com.example.cucumber;
import com.example.SampleApp;
import cucumber.api.java.Before;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;
@SpringBootTest
@WebAppConfiguration
@ContextConfiguration(classes = SampleApp.class)
public class CucumberContextConfiguration {
@Before
public void setup_cucumber_spring_context(){
// Dummy method so cucumber will recognize this class as glue
// and use its context configuration.
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
aef8d14bf3076f196e428b66b40523eb5b33489f | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/netty--netty/d4742bbe16bd4864bf824d5946de16382de72a73/before/DefaultChannelHandlerContext.java | 6ae62701aa485404408474e5a23066b64602d8ff | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 67,039 | java | /*
* Copyright 2012 The Netty Project
*
* The Netty Project 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 io.netty.channel;
import io.netty.buffer.Buf;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.MessageBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.DefaultAttributeMap;
import java.net.SocketAddress;
import java.nio.channels.ClosedChannelException;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import static io.netty.channel.DefaultChannelPipeline.*;
final class DefaultChannelHandlerContext extends DefaultAttributeMap implements ChannelHandlerContext {
private static final EnumSet<ChannelHandlerType> EMPTY_TYPE = EnumSet.noneOf(ChannelHandlerType.class);
volatile DefaultChannelHandlerContext next;
volatile DefaultChannelHandlerContext prev;
private final Channel channel;
private final DefaultChannelPipeline pipeline;
private final String name;
private final Set<ChannelHandlerType> type;
private final ChannelHandler handler;
private boolean needsLazyBufInit;
// Will be set to null if no child executor should be used, otherwise it will be set to the
// child executor.
final EventExecutor executor;
private MessageBuf<Object> inMsgBuf;
private ByteBuf inByteBuf;
private MessageBuf<Object> outMsgBuf;
private ByteBuf outByteBuf;
// When the two handlers run in a different thread and they are next to each other,
// each other's buffers can be accessed at the same time resulting in a race condition.
// To avoid such situation, we lazily creates an additional thread-safe buffer called
// 'bridge' so that the two handlers access each other's buffer only via the bridges.
// The content written into a bridge is flushed into the actual buffer by flushBridge().
//
// Note we use an AtomicReferenceFieldUpdater for atomic operations on these to safe memory. This will safe us
// 64 bytes per Bridge.
private volatile MessageBridge inMsgBridge;
private volatile MessageBridge outMsgBridge;
private volatile ByteBridge inByteBridge;
private volatile ByteBridge outByteBridge;
private static final AtomicReferenceFieldUpdater<DefaultChannelHandlerContext, MessageBridge> IN_MSG_BRIDGE_UPDATER
= AtomicReferenceFieldUpdater.newUpdater(DefaultChannelHandlerContext.class,
MessageBridge.class, "inMsgBridge");
private static final AtomicReferenceFieldUpdater<DefaultChannelHandlerContext, MessageBridge> OUT_MSG_BRIDGE_UPDATER
= AtomicReferenceFieldUpdater.newUpdater(DefaultChannelHandlerContext.class,
MessageBridge.class, "outMsgBridge");
private static final AtomicReferenceFieldUpdater<DefaultChannelHandlerContext, ByteBridge> IN_BYTE_BRIDGE_UPDATER
= AtomicReferenceFieldUpdater.newUpdater(DefaultChannelHandlerContext.class,
ByteBridge.class, "inByteBridge");
private static final AtomicReferenceFieldUpdater<DefaultChannelHandlerContext, ByteBridge> OUT_BYTE_BRIDGE_UPDATER
= AtomicReferenceFieldUpdater.newUpdater(DefaultChannelHandlerContext.class,
ByteBridge.class, "outByteBridge");
// Lazily instantiated tasks used to trigger events to a handler with different executor.
private Runnable invokeChannelRegisteredTask;
private Runnable invokeChannelUnregisteredTask;
private Runnable invokeChannelActiveTask;
private Runnable invokeChannelInactiveTask;
private Runnable invokeInboundBufferUpdatedTask;
private Runnable fireInboundBufferUpdated0Task;
private Runnable invokeInboundBufferSuspendedTask;
private Runnable invokeFreeInboundBuffer0Task;
private Runnable invokeFreeOutboundBuffer0Task;
private Runnable invokeRead0Task;
volatile boolean removed;
DefaultChannelHandlerContext(
DefaultChannelPipeline pipeline, EventExecutorGroup group,
String name, ChannelHandler handler) {
this(pipeline, group, name, handler, false);
}
@SuppressWarnings("unchecked")
DefaultChannelHandlerContext(
DefaultChannelPipeline pipeline, EventExecutorGroup group,
String name, ChannelHandler handler, boolean needsLazyBufInit) {
if (name == null) {
throw new NullPointerException("name");
}
if (handler == null) {
throw new NullPointerException("handler");
}
// Determine the type of the specified handler.
EnumSet<ChannelHandlerType> type = EMPTY_TYPE.clone();
if (handler instanceof ChannelStateHandler) {
type.add(ChannelHandlerType.STATE);
if (handler instanceof ChannelInboundHandler) {
type.add(ChannelHandlerType.INBOUND);
}
}
if (handler instanceof ChannelOperationHandler) {
type.add(ChannelHandlerType.OPERATION);
if (handler instanceof ChannelOutboundHandler) {
type.add(ChannelHandlerType.OUTBOUND);
}
}
this.type = Collections.unmodifiableSet(type);
channel = pipeline.channel;
this.pipeline = pipeline;
this.name = name;
this.handler = handler;
if (group != null) {
// Pin one of the child executors once and remember it so that the same child executor
// is used to fire events for the same channel.
EventExecutor childExecutor = pipeline.childExecutors.get(group);
if (childExecutor == null) {
childExecutor = group.next();
pipeline.childExecutors.put(group, childExecutor);
}
executor = childExecutor;
} else {
executor = null;
}
if (handler instanceof ChannelInboundHandler) {
Buf buf;
try {
buf = ((ChannelInboundHandler) handler).newInboundBuffer(this);
} catch (Exception e) {
throw new ChannelPipelineException("A user handler failed to create a new inbound buffer.", e);
}
if (buf == null) {
throw new ChannelPipelineException("A user handler's newInboundBuffer() returned null");
}
if (buf instanceof ByteBuf) {
inByteBuf = (ByteBuf) buf;
inByteBridge = null;
inMsgBuf = null;
inMsgBridge = null;
} else if (buf instanceof MessageBuf) {
inByteBuf = null;
inByteBridge = null;
inMsgBuf = (MessageBuf<Object>) buf;
inMsgBridge = null;
} else {
throw new Error();
}
} else {
inByteBridge = null;
inMsgBridge = null;
}
if (handler instanceof ChannelOutboundHandler) {
if (needsLazyBufInit) {
// Special case: it means this context is for HeadHandler.
// HeadHandler is an outbound handler instantiated by the constructor of DefaultChannelPipeline.
// Because Channel is not really fully initialized at this point, we should not call
// newOutboundBuffer() yet because it will usually lead to NPE.
// To work around this problem, we lazily initialize the outbound buffer for this special case.
} else {
initOutboundBuffer();
}
}
this.needsLazyBufInit = needsLazyBufInit;
}
void forwardBufferContent() {
if (hasOutboundByteBuffer() && outboundByteBuffer().isReadable()) {
nextOutboundByteBuffer().writeBytes(outboundByteBuffer());
flush();
}
if (hasOutboundMessageBuffer() && !outboundMessageBuffer().isEmpty()) {
if (outboundMessageBuffer().drainTo(nextOutboundMessageBuffer()) > 0) {
flush();
}
}
if (hasInboundByteBuffer() && inboundByteBuffer().isReadable()) {
nextInboundByteBuffer().writeBytes(inboundByteBuffer());
fireInboundBufferUpdated();
}
if (hasInboundMessageBuffer() && !inboundMessageBuffer().isEmpty()) {
if (inboundMessageBuffer().drainTo(nextInboundMessageBuffer()) > 0) {
fireInboundBufferUpdated();
}
}
}
void clearBuffer() {
if (hasOutboundByteBuffer()) {
outboundByteBuffer().clear();
}
if (hasOutboundMessageBuffer()) {
outboundMessageBuffer().clear();
}
if (hasInboundByteBuffer()) {
inboundByteBuffer().clear();
}
if (hasInboundMessageBuffer()) {
inboundMessageBuffer().clear();
}
}
private void lazyInitOutboundBuffer() {
if (needsLazyBufInit) {
if (outByteBuf == null && outMsgBuf == null) {
needsLazyBufInit = false;
EventExecutor exec = executor();
if (exec.inEventLoop()) {
initOutboundBuffer();
} else {
try {
getFromFuture(exec.submit(new Runnable() {
@Override
public void run() {
lazyInitOutboundBuffer();
}
}));
} catch (Exception e) {
throw new ChannelPipelineException("failed to initialize an outbound buffer lazily", e);
}
}
}
}
}
private void initOutboundBuffer() {
Buf buf;
try {
buf = ((ChannelOutboundHandler) handler()).newOutboundBuffer(this);
} catch (Exception e) {
throw new ChannelPipelineException("A user handler failed to create a new outbound buffer.", e);
}
if (buf == null) {
throw new ChannelPipelineException("A user handler's newOutboundBuffer() returned null");
}
if (buf instanceof ByteBuf) {
outByteBuf = (ByteBuf) buf;
outByteBridge = null;
outMsgBuf = null;
outMsgBridge = null;
} else if (buf instanceof MessageBuf) {
outByteBuf = null;
outByteBridge = null;
@SuppressWarnings("unchecked")
MessageBuf<Object> msgBuf = (MessageBuf<Object>) buf;
outMsgBuf = msgBuf;
outMsgBridge = null;
} else {
throw new Error();
}
}
private void fillBridge() {
if (inMsgBridge != null) {
MessageBridge bridge = inMsgBridge;
if (bridge != null) {
bridge.fill();
}
} else if (inByteBridge != null) {
ByteBridge bridge = inByteBridge;
if (bridge != null) {
bridge.fill();
}
}
if (outMsgBridge != null) {
MessageBridge bridge = outMsgBridge;
if (bridge != null) {
bridge.fill();
}
} else if (outByteBridge != null) {
ByteBridge bridge = outByteBridge;
if (bridge != null) {
bridge.fill();
}
}
}
private void flushBridge() {
if (inMsgBridge != null) {
MessageBridge bridge = inMsgBridge;
if (bridge != null) {
bridge.flush(inMsgBuf);
}
} else if (inByteBridge != null) {
ByteBridge bridge = inByteBridge;
if (bridge != null) {
bridge.flush(inByteBuf);
}
}
if (outMsgBridge != null) {
MessageBridge bridge = outMsgBridge;
if (bridge != null) {
bridge.flush(outMsgBuf);
}
} else if (outByteBridge != null) {
ByteBridge bridge = outByteBridge;
if (bridge != null) {
bridge.flush(outByteBuf);
}
}
}
void freeHandlerBuffersAfterRemoval() {
if (!removed) {
return;
}
final ChannelHandler handler = handler();
if (handler instanceof ChannelInboundHandler) {
try {
((ChannelInboundHandler) handler).freeInboundBuffer(this);
} catch (Exception e) {
pipeline.notifyHandlerException(e);
}
}
if (handler instanceof ChannelOutboundHandler) {
try {
((ChannelOutboundHandler) handler).freeOutboundBuffer(this);
} catch (Exception e) {
pipeline.notifyHandlerException(e);
}
}
}
@Override
public Channel channel() {
return channel;
}
@Override
public ChannelPipeline pipeline() {
return pipeline;
}
@Override
public ByteBufAllocator alloc() {
return channel().config().getAllocator();
}
@Override
public EventExecutor executor() {
if (executor == null) {
return channel().eventLoop();
} else {
return executor;
}
}
@Override
public ChannelHandler handler() {
return handler;
}
@Override
public String name() {
return name;
}
@Override
public Set<ChannelHandlerType> types() {
return type;
}
@Override
public boolean hasInboundByteBuffer() {
return inByteBuf != null;
}
@Override
public boolean hasInboundMessageBuffer() {
return inMsgBuf != null;
}
@Override
public ByteBuf inboundByteBuffer() {
if (inByteBuf == null) {
if (handler() instanceof ChannelInboundHandler) {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no inbound byte buffer; it implements %s, but " +
"its newInboundBuffer() method created a %s.",
name, ChannelInboundHandler.class.getSimpleName(),
MessageBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no inbound byte buffer; it does not implement %s.",
name, ChannelInboundHandler.class.getSimpleName()));
}
}
return inByteBuf;
}
@Override
@SuppressWarnings("unchecked")
public <T> MessageBuf<T> inboundMessageBuffer() {
if (inMsgBuf == null) {
if (handler() instanceof ChannelInboundHandler) {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no inbound message buffer; it implements %s, but " +
"its newInboundBuffer() method created a %s.",
name, ChannelInboundHandler.class.getSimpleName(),
ByteBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no inbound message buffer; it does not implement %s.",
name, ChannelInboundHandler.class.getSimpleName()));
}
}
return (MessageBuf<T>) inMsgBuf;
}
@Override
public boolean hasOutboundByteBuffer() {
return outByteBuf != null;
}
@Override
public boolean hasOutboundMessageBuffer() {
return outMsgBuf != null;
}
@Override
public ByteBuf outboundByteBuffer() {
if (outByteBuf == null) {
if (handler() instanceof ChannelOutboundHandler) {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no outbound byte buffer; it implements %s, but " +
"its newOutboundBuffer() method created a %s.",
name, ChannelOutboundHandler.class.getSimpleName(),
MessageBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no outbound byte buffer; it does not implement %s.",
name, ChannelOutboundHandler.class.getSimpleName()));
}
}
return outByteBuf;
}
@Override
@SuppressWarnings("unchecked")
public <T> MessageBuf<T> outboundMessageBuffer() {
if (outMsgBuf == null) {
if (handler() instanceof ChannelOutboundHandler) {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no outbound message buffer; it implements %s, but " +
"its newOutboundBuffer() method created a %s.",
name, ChannelOutboundHandler.class.getSimpleName(),
ByteBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the handler '%s' has no outbound message buffer; it does not implement %s.",
name, ChannelOutboundHandler.class.getSimpleName()));
}
}
return (MessageBuf<T>) outMsgBuf;
}
/**
* Executes a task on the event loop and waits for it to finish. If the task is interrupted, then the
* current thread will be interrupted and this will return {@code null}. It is expected that the task
* performs any appropriate locking.
* <p>
* If the {@link Callable#call()} call throws a {@link Throwable}, but it is not an instance of
* {@link Error}, {@link RuntimeException}, or {@link Exception}, then it is wrapped inside an
* {@link AssertionError} and that is thrown instead.</p>
*
* @param c execute this callable and return its value
* @param <T> the return value type
* @return the task's return value, or {@code null} if the task was interrupted.
* @see Callable#call()
* @see Future#get()
* @throws Error if the task threw this.
* @throws RuntimeException if the task threw this.
* @throws Exception if the task threw this.
* @throws ChannelPipelineException with a {@link Throwable} as a cause, if the task threw another type of
* {@link Throwable}.
*/
private <T> T executeOnEventLoop(Callable<T> c) throws Exception {
return getFromFuture(executor().submit(c));
}
/**
* Executes a task on the event loop and waits for it to finish. If the task is interrupted, then the
* current thread will be interrupted. It is expected that the task performs any appropriate locking.
* <p>
* If the {@link Runnable#run()} call throws a {@link Throwable}, but it is not an instance of
* {@link Error} or {@link RuntimeException}, then it is wrapped inside a
* {@link ChannelPipelineException} and that is thrown instead.</p>
*
* @param r execute this runnable
* @see Runnable#run()
* @see Future#get()
* @throws Error if the task threw this.
* @throws RuntimeException if the task threw this.
* @throws ChannelPipelineException with a {@link Throwable} as a cause, if the task threw another type of
* {@link Throwable}.
*/
void executeOnEventLoop(Runnable r) {
waitForFuture(executor().submit(r));
}
/**
* Waits for a future to finish and gets the result. If the task is interrupted, then the current thread
* will be interrupted and this will return {@code null}. It is expected that the task performs any
* appropriate locking.
* <p>
* If the internal call throws a {@link Throwable}, but it is not an instance of {@link Error},
* {@link RuntimeException}, or {@link Exception}, then it is wrapped inside an {@link AssertionError}
* and that is thrown instead.</p>
*
* @param future wait for this future
* @param <T> the return value type
* @return the task's return value, or {@code null} if the task was interrupted.
* @see Future#get()
* @throws Error if the task threw this.
* @throws RuntimeException if the task threw this.
* @throws Exception if the task threw this.
* @throws ChannelPipelineException with a {@link Throwable} as a cause, if the task threw another type of
* {@link Throwable}.
*/
private static <T> T getFromFuture(Future<T> future) throws Exception {
try {
return future.get();
} catch (ExecutionException ex) {
// In the arbitrary case, we can throw Error, RuntimeException, and Exception
Throwable t = ex.getCause();
if (t instanceof Error) { throw (Error) t; }
if (t instanceof RuntimeException) { throw (RuntimeException) t; }
if (t instanceof Exception) { throw (Exception) t; }
throw new ChannelPipelineException(t);
} catch (InterruptedException ex) {
// Interrupt the calling thread (note that this method is not called from the event loop)
Thread.currentThread().interrupt();
return null;
}
}
/**
* Waits for a future to finish. If the task is interrupted, then the current thread will be interrupted.
* It is expected that the task performs any appropriate locking.
* <p>
* If the internal call throws a {@link Throwable}, but it is not an instance of {@link Error} or
* {@link RuntimeException}, then it is wrapped inside a {@link ChannelPipelineException} and that is
* thrown instead.</p>
*
* @param future wait for this future
* @see Future#get()
* @throws Error if the task threw this.
* @throws RuntimeException if the task threw this.
* @throws ChannelPipelineException with a {@link Throwable} as a cause, if the task threw another type of
* {@link Throwable}.
*/
static void waitForFuture(Future<?> future) {
try {
future.get();
} catch (ExecutionException ex) {
// In the arbitrary case, we can throw Error, RuntimeException, and Exception
Throwable t = ex.getCause();
if (t instanceof Error) { throw (Error) t; }
if (t instanceof RuntimeException) { throw (RuntimeException) t; }
throw new ChannelPipelineException(t);
} catch (InterruptedException ex) {
// Interrupt the calling thread (note that this method is not called from the event loop)
Thread.currentThread().interrupt();
}
}
@Override
public ByteBuf replaceInboundByteBuffer(final ByteBuf newInboundByteBuf) {
if (newInboundByteBuf == null) {
throw new NullPointerException("newInboundByteBuf");
}
if (!executor().inEventLoop()) {
try {
return executeOnEventLoop(new Callable<ByteBuf>() {
@Override
public ByteBuf call() {
return replaceInboundByteBuffer(newInboundByteBuf);
}
});
} catch (Exception ex) {
throw new ChannelPipelineException("failed to replace an inbound byte buffer", ex);
}
}
ByteBuf currentInboundByteBuf = inboundByteBuffer();
inByteBuf = newInboundByteBuf;
return currentInboundByteBuf;
}
@Override
@SuppressWarnings("unchecked")
public <T> MessageBuf<T> replaceInboundMessageBuffer(final MessageBuf<T> newInboundMsgBuf) {
if (newInboundMsgBuf == null) {
throw new NullPointerException("newInboundMsgBuf");
}
if (!executor().inEventLoop()) {
try {
return executeOnEventLoop(new Callable<MessageBuf<T>>() {
@Override
public MessageBuf<T> call() {
return replaceInboundMessageBuffer(newInboundMsgBuf);
}
});
} catch (Exception ex) {
throw new ChannelPipelineException("failed to replace an inbound message buffer", ex);
}
}
MessageBuf<T> currentInboundMsgBuf = inboundMessageBuffer();
inMsgBuf = (MessageBuf<Object>) newInboundMsgBuf;
return currentInboundMsgBuf;
}
@Override
public ByteBuf replaceOutboundByteBuffer(final ByteBuf newOutboundByteBuf) {
if (newOutboundByteBuf == null) {
throw new NullPointerException("newOutboundByteBuf");
}
if (!executor().inEventLoop()) {
try {
return executeOnEventLoop(new Callable<ByteBuf>() {
@Override
public ByteBuf call() {
return replaceOutboundByteBuffer(newOutboundByteBuf);
}
});
} catch (Exception ex) {
throw new ChannelPipelineException("failed to replace an outbound byte buffer", ex);
}
}
ByteBuf currentOutboundByteBuf = outboundByteBuffer();
outByteBuf = newOutboundByteBuf;
return currentOutboundByteBuf;
}
@Override
@SuppressWarnings("unchecked")
public <T> MessageBuf<T> replaceOutboundMessageBuffer(final MessageBuf<T> newOutboundMsgBuf) {
if (newOutboundMsgBuf == null) {
throw new NullPointerException("newOutboundMsgBuf");
}
if (!executor().inEventLoop()) {
try {
return executeOnEventLoop(new Callable<MessageBuf<T>>() {
@Override
public MessageBuf<T> call() {
return replaceOutboundMessageBuffer(newOutboundMsgBuf);
}
});
} catch (Exception ex) {
throw new ChannelPipelineException("failed to replace an outbound message buffer", ex);
}
}
MessageBuf<T> currentOutboundMsgBuf = outboundMessageBuffer();
outMsgBuf = (MessageBuf<Object>) newOutboundMsgBuf;
return currentOutboundMsgBuf;
}
@Override
public boolean hasNextInboundByteBuffer() {
DefaultChannelHandlerContext ctx = next;
for (;;) {
if (ctx == null) {
return false;
}
if (ctx.hasInboundByteBuffer()) {
return true;
}
ctx = ctx.next;
}
}
@Override
public boolean hasNextInboundMessageBuffer() {
DefaultChannelHandlerContext ctx = next;
for (;;) {
if (ctx == null) {
return false;
}
if (ctx.hasInboundMessageBuffer()) {
return true;
}
ctx = ctx.next;
}
}
@Override
public boolean hasNextOutboundByteBuffer() {
DefaultChannelHandlerContext ctx = prev;
for (;;) {
if (ctx == null) {
return false;
}
if (ctx.hasOutboundByteBuffer()) {
return true;
}
ctx = ctx.prev;
}
}
@Override
public boolean hasNextOutboundMessageBuffer() {
DefaultChannelHandlerContext ctx = prev;
for (;;) {
if (ctx == null) {
return false;
}
if (ctx.hasOutboundMessageBuffer()) {
return true;
}
ctx = ctx.prev;
}
}
@Override
public ByteBuf nextInboundByteBuffer() {
DefaultChannelHandlerContext ctx = next;
for (;;) {
if (ctx == null) {
if (prev != null) {
throw new NoSuchBufferException(String.format(
"the handler '%s' could not find a %s whose inbound buffer is %s.",
name, ChannelInboundHandler.class.getSimpleName(),
ByteBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the pipeline does not contain a %s whose inbound buffer is %s.",
ChannelInboundHandler.class.getSimpleName(),
ByteBuf.class.getSimpleName()));
}
}
if (ctx.hasInboundByteBuffer()) {
if (ctx.executor().inEventLoop()) {
return ctx.inboundByteBuffer();
}
if (executor().inEventLoop()) {
ByteBridge bridge = ctx.inByteBridge;
if (bridge == null) {
bridge = new ByteBridge(ctx);
if (!IN_BYTE_BRIDGE_UPDATER.compareAndSet(ctx, null, bridge)) {
bridge = ctx.inByteBridge;
}
}
return bridge.byteBuf;
}
throw new IllegalStateException("nextInboundByteBuffer() called from outside the eventLoop");
}
ctx = ctx.next;
}
}
@Override
public MessageBuf<Object> nextInboundMessageBuffer() {
DefaultChannelHandlerContext ctx = next;
for (;;) {
if (ctx == null) {
if (prev != null) {
throw new NoSuchBufferException(String.format(
"the handler '%s' could not find a %s whose inbound buffer is %s.",
name, ChannelInboundHandler.class.getSimpleName(),
MessageBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the pipeline does not contain a %s whose inbound buffer is %s.",
ChannelInboundHandler.class.getSimpleName(),
MessageBuf.class.getSimpleName()));
}
}
if (ctx.hasInboundMessageBuffer()) {
if (ctx.executor().inEventLoop()) {
return ctx.inboundMessageBuffer();
}
if (executor().inEventLoop()) {
MessageBridge bridge = ctx.inMsgBridge;
if (bridge == null) {
bridge = new MessageBridge();
if (!IN_MSG_BRIDGE_UPDATER.compareAndSet(ctx, null, bridge)) {
bridge = ctx.inMsgBridge;
}
}
return bridge.msgBuf;
}
throw new IllegalStateException("nextInboundMessageBuffer() called from outside the eventLoop");
}
ctx = ctx.next;
}
}
@Override
public ByteBuf nextOutboundByteBuffer() {
DefaultChannelHandlerContext ctx = prev;
final DefaultChannelHandlerContext initialCtx = ctx;
for (;;) {
if (ctx.hasOutboundByteBuffer()) {
if (ctx.executor().inEventLoop()) {
return ctx.outboundByteBuffer();
}
if (executor().inEventLoop()) {
ByteBridge bridge = ctx.outByteBridge;
if (bridge == null) {
bridge = new ByteBridge(ctx);
if (!OUT_BYTE_BRIDGE_UPDATER.compareAndSet(ctx, null, bridge)) {
bridge = ctx.outByteBridge;
}
}
return bridge.byteBuf;
}
throw new IllegalStateException("nextOutboundByteBuffer() called from outside the eventLoop");
}
ctx = ctx.prev;
if (ctx == null) {
if (initialCtx != null && initialCtx.next != null) {
throw new NoSuchBufferException(String.format(
"the handler '%s' could not find a %s whose outbound buffer is %s.",
initialCtx.next.name(), ChannelOutboundHandler.class.getSimpleName(),
ByteBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the pipeline does not contain a %s whose outbound buffer is %s.",
ChannelOutboundHandler.class.getSimpleName(),
ByteBuf.class.getSimpleName()));
}
}
}
}
@Override
public MessageBuf<Object> nextOutboundMessageBuffer() {
DefaultChannelHandlerContext ctx = prev;
final DefaultChannelHandlerContext initialCtx = ctx;
for (;;) {
if (ctx.hasOutboundMessageBuffer()) {
if (ctx.executor().inEventLoop()) {
return ctx.outboundMessageBuffer();
}
if (executor().inEventLoop()) {
MessageBridge bridge = ctx.outMsgBridge;
if (bridge == null) {
bridge = new MessageBridge();
if (!OUT_MSG_BRIDGE_UPDATER.compareAndSet(ctx, null, bridge)) {
bridge = ctx.outMsgBridge;
}
}
return bridge.msgBuf;
}
throw new IllegalStateException("nextOutboundMessageBuffer() called from outside the eventLoop");
}
ctx = ctx.prev;
if (ctx == null) {
if (initialCtx.next != null) {
throw new NoSuchBufferException(String.format(
"the handler '%s' could not find a %s whose outbound buffer is %s.",
initialCtx.next.name(), ChannelOutboundHandler.class.getSimpleName(),
MessageBuf.class.getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the pipeline does not contain a %s whose outbound buffer is %s.",
ChannelOutboundHandler.class.getSimpleName(),
MessageBuf.class.getSimpleName()));
}
}
}
}
@Override
public void fireChannelRegistered() {
lazyInitOutboundBuffer();
final DefaultChannelHandlerContext next = findContextInbound();
if (next != null) {
EventExecutor executor = next.executor();
if (executor.inEventLoop()) {
next.invokeChannelRegistered();
} else {
Runnable task = next.invokeChannelRegisteredTask;
if (task == null) {
next.invokeChannelRegisteredTask = task = new Runnable() {
@Override
public void run() {
next.invokeChannelRegistered();
}
};
}
executor.execute(task);
}
}
}
private void invokeChannelRegistered() {
try {
((ChannelStateHandler) handler()).channelRegistered(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public void fireChannelUnregistered() {
final DefaultChannelHandlerContext next = findContextInbound();
if (next != null) {
EventExecutor executor = next.executor();
if (prev != null && executor.inEventLoop()) {
next.invokeChannelUnregistered();
} else {
Runnable task = next.invokeChannelUnregisteredTask;
if (task == null) {
next.invokeChannelUnregisteredTask = task = new Runnable() {
@Override
public void run() {
next.invokeChannelUnregistered();
}
};
}
executor.execute(task);
}
}
}
private void invokeChannelUnregistered() {
try {
((ChannelStateHandler) handler()).channelUnregistered(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
}
}
@Override
public void fireChannelActive() {
final DefaultChannelHandlerContext next = findContextInbound();
if (next != null) {
EventExecutor executor = next.executor();
if (executor.inEventLoop()) {
next.invokeChannelActive();
} else {
Runnable task = next.invokeChannelActiveTask;
if (task == null) {
next.invokeChannelActiveTask = task = new Runnable() {
@Override
public void run() {
next.invokeChannelActive();
}
};
}
executor.execute(task);
}
}
}
private void invokeChannelActive() {
try {
((ChannelStateHandler) handler()).channelActive(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public void fireChannelInactive() {
final DefaultChannelHandlerContext next = findContextInbound();
if (next != null) {
EventExecutor executor = next.executor();
if (prev != null && executor.inEventLoop()) {
next.invokeChannelInactive();
} else {
Runnable task = next.invokeChannelInactiveTask;
if (task == null) {
next.invokeChannelInactiveTask = task = new Runnable() {
@Override
public void run() {
next.invokeChannelInactive();
}
};
}
executor.execute(task);
}
}
}
private void invokeChannelInactive() {
try {
((ChannelStateHandler) handler()).channelInactive(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public void fireExceptionCaught(final Throwable cause) {
if (cause == null) {
throw new NullPointerException("cause");
}
final DefaultChannelHandlerContext next = this.next;
if (next != null) {
EventExecutor executor = next.executor();
if (prev != null && executor.inEventLoop()) {
next.invokeExceptionCaught(cause);
} else {
try {
executor.execute(new Runnable() {
@Override
public void run() {
next.invokeExceptionCaught(cause);
}
});
} catch (Throwable t) {
if (logger.isWarnEnabled()) {
logger.warn("Failed to submit an exceptionCaught() event.", t);
logger.warn("The exceptionCaught() event that was failed to submit was:", cause);
}
}
}
} else {
logger.warn(
"An exceptionCaught() event was fired, and it reached at the end of the " +
"pipeline. It usually means the last inbound handler in the pipeline did not " +
"handle the exception.", cause);
}
}
private void invokeExceptionCaught(Throwable cause) {
try {
handler().exceptionCaught(this, cause);
} catch (Throwable t) {
if (logger.isWarnEnabled()) {
logger.warn(
"An exception was thrown by a user handler's " +
"exceptionCaught() method while handling the following exception:", cause);
}
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public void fireUserEventTriggered(final Object event) {
if (event == null) {
throw new NullPointerException("event");
}
final DefaultChannelHandlerContext next = this.next;
if (next != null) {
EventExecutor executor = next.executor();
if (executor.inEventLoop()) {
next.invokeUserEventTriggered(event);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
next.invokeUserEventTriggered(event);
}
});
}
}
}
private void invokeUserEventTriggered(Object event) {
try {
handler().userEventTriggered(this, event);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public void fireInboundBufferUpdated() {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
fireInboundBufferUpdated0();
} else {
Runnable task = fireInboundBufferUpdated0Task;
if (task == null) {
fireInboundBufferUpdated0Task = task = new Runnable() {
@Override
public void run() {
fireInboundBufferUpdated0();
}
};
}
executor.execute(task);
}
}
private void fireInboundBufferUpdated0() {
final DefaultChannelHandlerContext next = findContextInbound();
if (next != null && !next.isInboundBufferFreed()) {
next.fillBridge();
// This comparison is safe because this method is always executed from the executor.
if (next.executor == executor) {
next.invokeInboundBufferUpdated();
} else {
Runnable task = next.invokeInboundBufferUpdatedTask;
if (task == null) {
next.invokeInboundBufferUpdatedTask = task = new Runnable() {
@Override
public void run() {
if (!next.isInboundBufferFreed()) {
next.invokeInboundBufferUpdated();
}
}
};
}
next.executor().execute(task);
}
}
}
private void invokeInboundBufferUpdated() {
ChannelStateHandler handler = (ChannelStateHandler) handler();
flushBridge();
try {
handler.inboundBufferUpdated(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
if (handler instanceof ChannelInboundByteHandler && !isInboundBufferFreed()) {
try {
((ChannelInboundByteHandler) handler).discardInboundReadBytes(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
}
}
freeHandlerBuffersAfterRemoval();
}
}
@Override
public void fireInboundBufferSuspended() {
final DefaultChannelHandlerContext next = findContextInbound();
if (next != null) {
EventExecutor executor = next.executor();
if (prev != null && executor.inEventLoop()) {
next.invokeInboundBufferSuspended();
} else {
Runnable task = next.invokeInboundBufferSuspendedTask;
if (task == null) {
next.invokeInboundBufferSuspendedTask = task = new Runnable() {
@Override
public void run() {
next.invokeInboundBufferSuspended();
}
};
}
executor.execute(task);
}
}
}
private void invokeInboundBufferSuspended() {
try {
((ChannelStateHandler) handler()).channelReadSuspended(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture bind(SocketAddress localAddress) {
return bind(localAddress, newPromise());
}
@Override
public ChannelFuture connect(SocketAddress remoteAddress) {
return connect(remoteAddress, newPromise());
}
@Override
public ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress) {
return connect(remoteAddress, localAddress, newPromise());
}
@Override
public ChannelFuture disconnect() {
return disconnect(newPromise());
}
@Override
public ChannelFuture close() {
return close(newPromise());
}
@Override
public ChannelFuture deregister() {
return deregister(newPromise());
}
@Override
public ChannelFuture flush() {
return flush(newPromise());
}
@Override
public ChannelFuture write(Object message) {
return write(message, newPromise());
}
@Override
public ChannelFuture bind(SocketAddress localAddress, ChannelPromise promise) {
if (localAddress == null) {
throw new NullPointerException("localAddress");
}
validateFuture(promise);
return findContextOutbound().invokeBind(localAddress, promise);
}
private ChannelFuture invokeBind(final SocketAddress localAddress, final ChannelPromise promise) {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeBind0(localAddress, promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokeBind0(localAddress, promise);
}
});
}
return promise;
}
private void invokeBind0(SocketAddress localAddress, ChannelPromise promise) {
try {
((ChannelOperationHandler) handler()).bind(this, localAddress, promise);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture connect(SocketAddress remoteAddress, ChannelPromise promise) {
return connect(remoteAddress, null, promise);
}
@Override
public ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) {
if (remoteAddress == null) {
throw new NullPointerException("remoteAddress");
}
validateFuture(promise);
return findContextOutbound().invokeConnect(remoteAddress, localAddress, promise);
}
private ChannelFuture invokeConnect(
final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise) {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeConnect0(remoteAddress, localAddress, promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokeConnect0(remoteAddress, localAddress, promise);
}
});
}
return promise;
}
private void invokeConnect0(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) {
try {
((ChannelOperationHandler) handler()).connect(this, remoteAddress, localAddress, promise);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture disconnect(ChannelPromise promise) {
validateFuture(promise);
// Translate disconnect to close if the channel has no notion of disconnect-reconnect.
// So far, UDP/IP is the only transport that has such behavior.
if (!channel().metadata().hasDisconnect()) {
return findContextOutbound().invokeClose(promise);
}
return findContextOutbound().invokeDisconnect(promise);
}
private ChannelFuture invokeDisconnect(final ChannelPromise promise) {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeDisconnect0(promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokeDisconnect0(promise);
}
});
}
return promise;
}
private void invokeDisconnect0(ChannelPromise promise) {
try {
((ChannelOperationHandler) handler()).disconnect(this, promise);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture close(ChannelPromise promise) {
validateFuture(promise);
return findContextOutbound().invokeClose(promise);
}
private ChannelFuture invokeClose(final ChannelPromise promise) {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeClose0(promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokeClose0(promise);
}
});
}
return promise;
}
private void invokeClose0(ChannelPromise promise) {
try {
((ChannelOperationHandler) handler()).close(this, promise);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture deregister(ChannelPromise promise) {
validateFuture(promise);
return findContextOutbound().invokeDeregister(promise);
}
private ChannelFuture invokeDeregister(final ChannelPromise promise) {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeDeregister0(promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokeDeregister0(promise);
}
});
}
return promise;
}
private void invokeDeregister0(ChannelPromise promise) {
try {
((ChannelOperationHandler) handler()).deregister(this, promise);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public void read() {
findContextOutbound().invokeRead();
}
private void invokeRead() {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeRead0();
} else {
Runnable task = invokeRead0Task;
if (task == null) {
invokeRead0Task = task = new Runnable() {
@Override
public void run() {
invokeRead0();
}
};
}
executor.execute(task);
}
}
private void invokeRead0() {
try {
((ChannelOperationHandler) handler()).read(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture flush(final ChannelPromise promise) {
validateFuture(promise);
EventExecutor executor = executor();
Thread currentThread = Thread.currentThread();
if (executor.inEventLoop(currentThread)) {
invokePrevFlush(promise, currentThread);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokePrevFlush(promise, Thread.currentThread());
}
});
}
return promise;
}
private void invokePrevFlush(ChannelPromise promise, Thread currentThread) {
DefaultChannelHandlerContext prev = findContextOutbound();
if (prev.isOutboundBufferFreed()) {
promise.setFailure(new ChannelPipelineException(
"Unable to flush as outbound buffer of next handler was freed already"));
return;
}
prev.fillBridge();
prev.invokeFlush(promise, currentThread);
}
private ChannelFuture invokeFlush(final ChannelPromise promise, Thread currentThread) {
EventExecutor executor = executor();
if (executor.inEventLoop(currentThread)) {
invokeFlush0(promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokeFlush0(promise);
}
});
}
return promise;
}
private void invokeFlush0(ChannelPromise promise) {
Channel channel = channel();
if (!channel.isRegistered() && !channel.isActive()) {
promise.setFailure(new ClosedChannelException());
return;
}
ChannelOperationHandler handler = (ChannelOperationHandler) handler();
try {
flushBridge();
handler.flush(this, promise);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
if (handler instanceof ChannelOutboundByteHandler && !isOutboundBufferFreed()) {
try {
((ChannelOutboundByteHandler) handler).discardOutboundReadBytes(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
}
}
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture sendFile(FileRegion region) {
return sendFile(region, newPromise());
}
@Override
public ChannelFuture sendFile(FileRegion region, ChannelPromise promise) {
if (region == null) {
throw new NullPointerException("region");
}
validateFuture(promise);
return findContextOutbound().invokeSendFile(region, promise);
}
private ChannelFuture invokeSendFile(final FileRegion region, final ChannelPromise promise) {
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeSendFile0(region, promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
invokeSendFile0(region, promise);
}
});
}
return promise;
}
private void invokeSendFile0(FileRegion region, ChannelPromise promise) {
try {
flushBridge();
((ChannelOperationHandler) handler()).sendFile(this, region, promise);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
} finally {
freeHandlerBuffersAfterRemoval();
}
}
@Override
public ChannelFuture write(final Object message, final ChannelPromise promise) {
if (message instanceof FileRegion) {
return sendFile((FileRegion) message, promise);
}
if (message == null) {
throw new NullPointerException("message");
}
validateFuture(promise);
DefaultChannelHandlerContext ctx = prev;
final DefaultChannelHandlerContext initialCtx = ctx;
EventExecutor executor;
boolean msgBuf = false;
for (;;) {
if (ctx.hasOutboundMessageBuffer()) {
msgBuf = true;
executor = ctx.executor();
break;
}
if (message instanceof ByteBuf && ctx.hasOutboundByteBuffer()) {
executor = ctx.executor();
break;
}
ctx = ctx.prev;
if (ctx == null) {
if (initialCtx.next != null) {
throw new NoSuchBufferException(String.format(
"the handler '%s' could not find a %s which accepts a %s, and " +
"the transport does not accept it as-is.",
initialCtx.next.name(),
ChannelOutboundHandler.class.getSimpleName(),
message.getClass().getSimpleName()));
} else {
throw new NoSuchBufferException(String.format(
"the pipeline does not contain a %s which accepts a %s, and " +
"the transport does not accept it as-is.",
ChannelOutboundHandler.class.getSimpleName(),
message.getClass().getSimpleName()));
}
}
}
if (executor.inEventLoop()) {
ctx.write0(message, promise, msgBuf);
return promise;
}
final boolean msgBuf0 = msgBuf;
final DefaultChannelHandlerContext ctx0 = ctx;
executor.execute(new Runnable() {
@Override
public void run() {
ctx0.write0(message, promise, msgBuf0);
}
});
return promise;
}
private void write0(Object message, ChannelPromise promise, boolean msgBuf) {
Channel channel = channel();
if (!channel.isRegistered() && !channel.isActive()) {
promise.setFailure(new ClosedChannelException());
return;
}
if (isOutboundBufferFreed()) {
promise.setFailure(new ChannelPipelineException(
"Unable to write as outbound buffer of next handler was freed already"));
return;
}
if (msgBuf) {
outboundMessageBuffer().add(message);
} else {
ByteBuf buf = (ByteBuf) message;
outboundByteBuffer().writeBytes(buf, buf.readerIndex(), buf.readableBytes());
}
invokeFlush0(promise);
}
void invokeFreeInboundBuffer() {
pipeline.inboundBufferFreed = true;
EventExecutor executor = executor();
if (prev != null && executor.inEventLoop()) {
invokeFreeInboundBuffer0();
} else {
Runnable task = invokeFreeInboundBuffer0Task;
if (task == null) {
invokeFreeInboundBuffer0Task = task = new Runnable() {
@Override
public void run() {
invokeFreeInboundBuffer0();
}
};
}
executor.execute(task);
}
}
private void invokeFreeInboundBuffer0() {
ChannelHandler handler = handler();
if (handler instanceof ChannelInboundHandler) {
ChannelInboundHandler h = (ChannelInboundHandler) handler;
try {
h.freeInboundBuffer(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
}
}
DefaultChannelHandlerContext nextCtx = findContextInbound();
if (nextCtx != null) {
nextCtx.invokeFreeInboundBuffer();
} else {
// Freed all inbound buffers. Free all outbound buffers in a reverse order.
pipeline.tail.findContextOutbound().invokeFreeOutboundBuffer();
}
}
/** Invocation initiated by {@link #invokeFreeInboundBuffer0()} after freeing all inbound buffers. */
private void invokeFreeOutboundBuffer() {
pipeline.outboundBufferFreed = true;
EventExecutor executor = executor();
if (executor.inEventLoop()) {
invokeFreeOutboundBuffer0();
} else {
Runnable task = invokeFreeOutboundBuffer0Task;
if (task == null) {
invokeFreeOutboundBuffer0Task = task = new Runnable() {
@Override
public void run() {
invokeFreeOutboundBuffer0();
}
};
}
executor.execute(task);
}
}
private void invokeFreeOutboundBuffer0() {
ChannelHandler handler = handler();
if (handler instanceof ChannelOutboundHandler) {
ChannelOutboundHandler h = (ChannelOutboundHandler) handler;
try {
h.freeOutboundBuffer(this);
} catch (Throwable t) {
pipeline.notifyHandlerException(t);
}
}
DefaultChannelHandlerContext nextCtx = findContextOutbound();
if (nextCtx != null) {
nextCtx.invokeFreeOutboundBuffer();
}
}
@Override
public ChannelPromise newPromise() {
return new DefaultChannelPromise(channel());
}
@Override
public ChannelFuture newSucceededFuture() {
return channel().newSucceededFuture();
}
@Override
public ChannelFuture newFailedFuture(Throwable cause) {
return channel().newFailedFuture(cause);
}
private boolean isInboundBufferFreed() {
return pipeline.inboundBufferFreed;
}
private boolean isOutboundBufferFreed() {
return pipeline.outboundBufferFreed;
}
private void validateFuture(ChannelFuture future) {
if (future == null) {
throw new NullPointerException("future");
}
if (future.channel() != channel()) {
throw new IllegalArgumentException(String.format(
"future.channel does not match: %s (expected: %s)", future.channel(), channel()));
}
if (future.isDone()) {
throw new IllegalArgumentException("future already done");
}
if (future instanceof ChannelFuture.Unsafe) {
throw new IllegalArgumentException("internal use only future not allowed");
}
}
private DefaultChannelHandlerContext findContextInbound() {
DefaultChannelHandlerContext ctx = this;
do {
ctx = ctx.next;
} while (ctx != null && !(ctx.handler() instanceof ChannelStateHandler));
return ctx;
}
private DefaultChannelHandlerContext findContextOutbound() {
DefaultChannelHandlerContext ctx = this;
do {
ctx = ctx.prev;
} while (ctx != null && !(ctx.handler() instanceof ChannelOperationHandler));
return ctx;
}
private static final class MessageBridge {
private final MessageBuf<Object> msgBuf = Unpooled.messageBuffer();
private final Queue<Object[]> exchangeBuf = new ConcurrentLinkedQueue<Object[]>();
private void fill() {
if (msgBuf.isEmpty()) {
return;
}
Object[] data = msgBuf.toArray();
msgBuf.clear();
exchangeBuf.add(data);
}
private void flush(MessageBuf<Object> out) {
for (;;) {
Object[] data = exchangeBuf.poll();
if (data == null) {
break;
}
Collections.addAll(out, data);
}
}
}
private static final class ByteBridge {
private final ByteBuf byteBuf;
private final Queue<ByteBuf> exchangeBuf = new ConcurrentLinkedQueue<ByteBuf>();
private final ChannelHandlerContext ctx;
ByteBridge(ChannelHandlerContext ctx) {
this.ctx = ctx;
// TODO Choose whether to use heap or direct buffer depending on the context's buffer type.
byteBuf = ctx.alloc().buffer();
}
private void fill() {
if (!byteBuf.isReadable()) {
return;
}
int dataLen = byteBuf.readableBytes();
ByteBuf data;
if (byteBuf.isDirect()) {
data = ctx.alloc().directBuffer(dataLen, dataLen);
} else {
data = ctx.alloc().buffer(dataLen, dataLen);
}
byteBuf.readBytes(data).discardSomeReadBytes();
exchangeBuf.add(data);
}
private void flush(ByteBuf out) {
while (out.isWritable()) {
ByteBuf data = exchangeBuf.peek();
if (data == null) {
break;
}
if (out.writerIndex() > out.maxCapacity() - data.readableBytes()) {
// The target buffer is not going to be able to accept all data in the bridge.
out.capacity(out.maxCapacity());
out.writeBytes(data, out.writableBytes());
} else {
exchangeBuf.remove();
try {
out.writeBytes(data);
} finally {
data.free();
}
}
}
}
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
e2b9264e0574b76a8bd068597f7135ee02ac0e69 | 9b11ab80013a2e74696c33249f32dfaf57e3e3f0 | /conversion-service/convert-pdf-to-img/src/main/java/com/liumapp/convert/img/pattern/SimplePdfPattern.java | ab8ad8dc31df688a7a94e75d9d63429f68f89181 | [
"Apache-2.0"
] | permissive | DespairYoke/spring-cloud-conversion-in-docker | 33356821e694b66f2a31ef9425b60efdae39e2ef | 0097a0feaf1dae94a130034cc4d7192e2fee3de1 | refs/heads/master | 2020-03-16T17:33:39.885051 | 2018-05-11T03:45:07 | 2018-05-11T03:45:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | package com.liumapp.convert.img.pattern;
import org.springframework.stereotype.Component;
import java.io.Serializable;
/**
* @author liumapp
* @file PdfPattern.java
* @email liumapp.com@gmail.com
* @homepage http://www.liumapp.com
* @date 5/7/18
*/
@Component
public class SimplePdfPattern implements Serializable {
/**
* pdf file path
*/
private String path;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public String toString() {
return "PdfPattern{" +
"path='" + path + '\'' +
'}';
}
}
| [
"810095178@qq.com"
] | 810095178@qq.com |
994efbdd186836c3bdfcc787d8c2cc01db3165df | 85b520b0b7d08f89770594ba69d248ba4bf95641 | /src/main/java/leetcode/RepeatedDnaSequence.java | 492d7af41aa3625b6b38488d76c5bc101119517e | [] | no_license | Nimish-Singh/Algos | 07e096ceea640713cd843f978abe486532b5d6e4 | c991c4c1654c39515b2a9dd13cf4ebf3de5c0b89 | refs/heads/master | 2023-08-17T03:06:51.507166 | 2023-08-05T19:25:36 | 2023-08-05T19:25:36 | 213,204,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package leetcode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
// https://leetcode.com/problems/repeated-dna-sequences/
public class RepeatedDnaSequence {
public List<String> findRepeatedDnaSequences(String s) {
if (s == null || s.length() < 10)
return Collections.emptyList();
Set<String> answer = new HashSet<>();
Set<String> seen = new HashSet<>();
// recursive(s, answer, seen);
iterative(s, answer, seen);
return new ArrayList<>(answer);
}
// No performance difference between either using a Set or a Map for "seen" logic
private void iterative(String input, Set<String> answer, Set<String> seen) {
for (int startIndex = 0; startIndex + 10 <= input.length(); startIndex++) {
String substring = input.substring(startIndex, startIndex + 10);
if (!seen.contains(substring)) {
seen.add(substring);
} else {
answer.add(substring);
}
}
}
// T=O(n) Space complexity is high because of recursion stack
private void recursive(String input, List<String> answer, Map<String, Boolean> seen) {
if (input.length() < 10)
return;
String substring = input.substring(0, 10);
if (!seen.containsKey(substring)) {
seen.put(substring, false);
} else {
if (!seen.get(substring)) {
answer.add(substring);
}
seen.put(substring, true);
}
recursive(input.substring(1), answer, seen);
}
}
| [
"nimishs@Nimishs-MacBook-Pro.local"
] | nimishs@Nimishs-MacBook-Pro.local |
5d4e4edd4f2c14542244359f5c4ada793888bb0a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/25/25_e8a02d227c945dba7e3fddae8baf16bcfc8610f9/FunctionCompilerTypeTest/25_e8a02d227c945dba7e3fddae8baf16bcfc8610f9_FunctionCompilerTypeTest_t.java | d87e6a44cf89d7ad7e37ff6beabce2d28f4d5f13 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,084 | java | package org.instructionexecutor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.suite.Binder;
import org.suite.Journal;
import org.suite.SuiteUtil;
import org.suite.doer.Generalizer;
import org.suite.node.Atom;
import org.suite.node.Node;
import org.suite.node.Reference;
public class FunctionCompilerTypeTest {
@Test
public void testBasic() {
assertEquals(SuiteUtil.parse("BOOLEAN") //
, getType("4 = 8"));
}
@Test
public void testDefineType() {
getType("define type t = number >> \n" //
+ "define v as t = 1 >> \n" //
+ "v = 99");
}
@Test
public void testFun() {
assertEquals(SuiteUtil.parse("FUN NUMBER NUMBER") //
, getType("a => a + 1"));
assertEquals(SuiteUtil.parse("NUMBER") //
, getType("define f = (a => a + 1) >> f {3}"));
assertTrue(Binder.bind(SuiteUtil.parse("FUN _ (CO-LIST-OF NUMBER)") //
, getType("define fib = (n => dummy => n/(fib {n + 1})) >> \n" //
+ "fib {1}") // Pretends co-recursion
, new Journal()));
}
@Test
public void testList() {
assertEquals(SuiteUtil.parse("LIST-OF NUMBER") //
, getType("1,"));
assertEquals(SuiteUtil.parse("LIST-OF STRING") //
, getType("\"a\", \"b\", \"c\", \"d\","));
}
@Test
public void testOneOf() {
getType("" //
+ "define type t = one of (NIL, BTREE t t,) >> \n" //
+ "define u as t = NIL >> \n" //
+ "define v as t = NIL >> \n" //
+ "v = BTREE (BTREE NIL NIL) NIL");
}
@Test
public void testTuple() {
getType("BTREE 2 3 = BTREE 4 6");
getTypeMustFail("T1 2 3 = T2 2 3");
getTypeMustFail("BTREE 2 3 = BTREE \"a\" 6");
}
@Test
public void testFail() {
String cases[] = { "1 + 'abc'" //
, "define fib = (i2 => dummy => 1, fib {i2}) >> ()" //
, "define type t = one of (BTREE t t,) >> \n" //
+ "define v as t = BTREE 2 3 >> \n" //
+ "1" };
// There is a problem in deriving type of 1:(fib {i2})...
// Rule specified that right hand side of CONS should be a list,
// however fib {i2} is a closure.
// Should actually use corecursive list type (cons-ed by '^').
for (String c : cases)
getTypeMustFail(c);
}
private static void getTypeMustFail(String c) {
try {
getType(c);
} catch (RuntimeException ex) {
return;
}
throw new RuntimeException("Cannot catch type error of: " + c);
}
private static Node getType(String f) {
Node program = SuiteUtil.parse(f);
Node node = SuiteUtil
.parse("fc-parse .program .p, infer-type .p ()/() .type");
Generalizer generalizer = new Generalizer();
node = generalizer.generalize(node);
Node variable = generalizer.getVariable(Atom.create(".program"));
Node type = generalizer.getVariable(Atom.create(".type"));
((Reference) variable).bound(program);
String[] imports = { "auto.sl", "fc.sl" };
if (SuiteUtil.getProver(imports).prove(node))
return type.finalNode();
else
throw new RuntimeException("Type inference error");
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
3e40e20af8a68b759cd63ca50902f7272c3dedb1 | 76eeeec3311e402679a17a0e345f1f3d9b71266e | /FirstLineOfAndroid/app/src/main/java/com/example/firstlineofandroid/MyRunnable.java | 94b3b86e9b2d4abdfc56dd80dfcbf07943c7cde5 | [] | no_license | wuhongxing/StudyAndroid | 97e38a4e7f992584dca32bfe8870f37750417834 | a8f04f7f78240909f6d170305937dd9d282d0ebf | refs/heads/master | 2023-01-14T10:44:57.806128 | 2020-11-26T02:27:06 | 2020-11-26T06:23:59 | 288,990,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.example.firstlineofandroid;
import android.util.Log;
public class MyRunnable implements Runnable {
@Override
public void run() {
Log.d("TAG", Thread.currentThread().getName());
}
}
| [
"wuhongxing@xiaoxingxing-2.local"
] | wuhongxing@xiaoxingxing-2.local |
f5e28b68d5ef45b0c8f42b3663bcc3f0902cfb62 | a93a26ab91e3b7c1523af5c20e288659f46146b3 | /Challenges/int to string/Solution.java | 1752d3488ad35153c906215ba7c8b7428ee89db2 | [] | no_license | tarnnummulani/HackerRank | 6e61d76a7b2eeac9ace9ac1a720dcbeb4c37046b | 8d59458f63ea9f92514b9d7ea18e48ee736356a0 | refs/heads/master | 2020-06-26T02:42:07.835483 | 2019-12-26T11:04:20 | 2019-12-26T11:04:20 | 199,501,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | import java.util.*;
import java.security.*;
public class Solution {
public static void main(String[] args) {
DoNotTerminate.forbidExit();
try {
Scanner in = new Scanner(System.in);
int n = in .nextInt();
in.close();
//String s=???; Complete this line below
/*first way
String s=Integer.toString(n);*/
/*second way
String s=String.valueOf(n);*/
/*4th way
String s=new Integer(n).toString();*/
String s=new StringBuffer().append(n).toString();
if (n == Integer.parseInt(s)) {
System.out.println("Good job");
} else {
System.out.println("Wrong answer.");
}
} catch (DoNotTerminate.ExitTrappedException e) {
System.out.println("Unsuccessful Termination!!");
}
}
}
//The following class will prevent you from terminating the code using exit(0)!
class DoNotTerminate {
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1;
}
public static void forbidExit() {
final SecurityManager securityManager = new SecurityManager() {
@Override
public void checkPermission(Permission permission) {
if (permission.getName().contains("exitVM")) {
throw new ExitTrappedException();
}
}
};
System.setSecurityManager(securityManager);
}
}
| [
"tarnnummulani@gmail.com"
] | tarnnummulani@gmail.com |
dcaf6c200da1f67edc943374c412bb2e1c50c507 | 5ce1502ecd4b5d52552c070f2d00df121c8bbbff | /app/src/main/java/com/inno/noteit/fragment/TopShowFragment.java | 32bd27f5f04fb3043fd81149f6c5afd2ce848ebc | [] | no_license | didikee/NoteIt | 15ca8052fb51eb30db721f4914e3510d0f4bfbe7 | a0921d101bf3657b93e09064c12fac1b8c9681cd | refs/heads/master | 2021-01-17T12:59:26.326332 | 2016-07-11T09:16:30 | 2016-07-11T09:16:30 | 62,391,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.inno.noteit.fragment;
import android.support.v4.app.Fragment;
import com.inno.noteit.R;
/**
* A simple {@link Fragment} subclass.
*
*/
public class TopShowFragment extends BaseFragment {
@Override
protected int setLayoutView() {
return R.layout.fragment_top_show;
}
@Override
protected void init() {
}
}
| [
"wg-dd@qq.com"
] | wg-dd@qq.com |
08d97ccf64c84c384c7d22a057334764d050790a | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /zuiyou/sources/com/google/protobuf/MapEntry.java | 606753fe05a3faeac73fc73819b25d6c373a3192 | [] | no_license | aheadlcx/analyzeApk | 050b261595cecc85790558a02d79739a789ae3a3 | 25cecc394dde4ed7d4971baf0e9504dcb7fabaca | refs/heads/master | 2020-03-10T10:24:49.773318 | 2018-04-13T09:44:45 | 2018-04-13T09:44:45 | 129,332,351 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 12,455 | java | package com.google.protobuf;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.EnumValueDescriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Descriptors.FieldDescriptor.JavaType;
import com.google.protobuf.Descriptors.FieldDescriptor.Type;
import com.google.protobuf.WireFormat.FieldType;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
public final class MapEntry<K, V> extends AbstractMessage {
private volatile int cachedSerializedSize;
private final K key;
private final Metadata<K, V> metadata;
private final V value;
public static class Builder<K, V> extends AbstractMessage$Builder<Builder<K, V>> {
private boolean hasKey;
private boolean hasValue;
private K key;
private final Metadata<K, V> metadata;
private V value;
private Builder(Metadata<K, V> metadata) {
this(metadata, metadata.defaultKey, metadata.defaultValue, false, false);
}
private Builder(Metadata<K, V> metadata, K k, V v, boolean z, boolean z2) {
this.metadata = metadata;
this.key = k;
this.value = v;
this.hasKey = z;
this.hasValue = z2;
}
public K getKey() {
return this.key;
}
public V getValue() {
return this.value;
}
public Builder<K, V> setKey(K k) {
this.key = k;
this.hasKey = true;
return this;
}
public Builder<K, V> clearKey() {
this.key = this.metadata.defaultKey;
this.hasKey = false;
return this;
}
public Builder<K, V> setValue(V v) {
this.value = v;
this.hasValue = true;
return this;
}
public Builder<K, V> clearValue() {
this.value = this.metadata.defaultValue;
this.hasValue = false;
return this;
}
public MapEntry<K, V> build() {
Object buildPartial = buildPartial();
if (buildPartial.isInitialized()) {
return buildPartial;
}
throw AbstractMessage$Builder.newUninitializedMessageException(buildPartial);
}
public MapEntry<K, V> buildPartial() {
return new MapEntry(this.metadata, this.key, this.value);
}
public Descriptor getDescriptorForType() {
return this.metadata.descriptor;
}
private void checkFieldDescriptor(FieldDescriptor fieldDescriptor) {
if (fieldDescriptor.getContainingType() != this.metadata.descriptor) {
throw new RuntimeException("Wrong FieldDescriptor \"" + fieldDescriptor.getFullName() + "\" used in message \"" + this.metadata.descriptor.getFullName());
}
}
public com.google.protobuf.Message.Builder newBuilderForField(FieldDescriptor fieldDescriptor) {
checkFieldDescriptor(fieldDescriptor);
if (fieldDescriptor.getNumber() == 2 && fieldDescriptor.getJavaType() == JavaType.MESSAGE) {
return ((Message) this.value).newBuilderForType();
}
throw new RuntimeException("\"" + fieldDescriptor.getFullName() + "\" is not a message value field.");
}
public Builder<K, V> setField(FieldDescriptor fieldDescriptor, Object obj) {
checkFieldDescriptor(fieldDescriptor);
if (fieldDescriptor.getNumber() == 1) {
setKey(obj);
} else {
if (fieldDescriptor.getType() == Type.ENUM) {
obj = Integer.valueOf(((EnumValueDescriptor) obj).getNumber());
} else if (!(fieldDescriptor.getType() != Type.MESSAGE || obj == null || this.metadata.defaultValue.getClass().isInstance(obj))) {
obj = ((Message) this.metadata.defaultValue).toBuilder().mergeFrom((Message) obj).build();
}
setValue(obj);
}
return this;
}
public Builder<K, V> clearField(FieldDescriptor fieldDescriptor) {
checkFieldDescriptor(fieldDescriptor);
if (fieldDescriptor.getNumber() == 1) {
clearKey();
} else {
clearValue();
}
return this;
}
public Builder<K, V> setRepeatedField(FieldDescriptor fieldDescriptor, int i, Object obj) {
throw new RuntimeException("There is no repeated field in a map entry message.");
}
public Builder<K, V> addRepeatedField(FieldDescriptor fieldDescriptor, Object obj) {
throw new RuntimeException("There is no repeated field in a map entry message.");
}
public Builder<K, V> setUnknownFields(UnknownFieldSet unknownFieldSet) {
return this;
}
public MapEntry<K, V> getDefaultInstanceForType() {
return new MapEntry(this.metadata, this.metadata.defaultKey, this.metadata.defaultValue);
}
public boolean isInitialized() {
return MapEntry.isInitialized(this.metadata, this.value);
}
public Map<FieldDescriptor, Object> getAllFields() {
Map treeMap = new TreeMap();
for (FieldDescriptor fieldDescriptor : this.metadata.descriptor.getFields()) {
if (hasField(fieldDescriptor)) {
treeMap.put(fieldDescriptor, getField(fieldDescriptor));
}
}
return Collections.unmodifiableMap(treeMap);
}
public boolean hasField(FieldDescriptor fieldDescriptor) {
checkFieldDescriptor(fieldDescriptor);
return fieldDescriptor.getNumber() == 1 ? this.hasKey : this.hasValue;
}
public Object getField(FieldDescriptor fieldDescriptor) {
checkFieldDescriptor(fieldDescriptor);
Object key = fieldDescriptor.getNumber() == 1 ? getKey() : getValue();
if (fieldDescriptor.getType() == Type.ENUM) {
return fieldDescriptor.getEnumType().findValueByNumberCreatingIfUnknown(((Integer) key).intValue());
}
return key;
}
public int getRepeatedFieldCount(FieldDescriptor fieldDescriptor) {
throw new RuntimeException("There is no repeated field in a map entry message.");
}
public Object getRepeatedField(FieldDescriptor fieldDescriptor, int i) {
throw new RuntimeException("There is no repeated field in a map entry message.");
}
public UnknownFieldSet getUnknownFields() {
return UnknownFieldSet.getDefaultInstance();
}
public Builder<K, V> clone() {
return new Builder(this.metadata, this.key, this.value, this.hasKey, this.hasValue);
}
}
private static final class Metadata<K, V> extends Metadata<K, V> {
public final Descriptor descriptor;
public final Parser<MapEntry<K, V>> parser = new AbstractParser<MapEntry<K, V>>() {
public MapEntry<K, V> parsePartialFrom(CodedInputStream codedInputStream, ExtensionRegistryLite extensionRegistryLite) throws InvalidProtocolBufferException {
return new MapEntry(Metadata.this, codedInputStream, extensionRegistryLite);
}
};
public Metadata(Descriptor descriptor, MapEntry<K, V> mapEntry, FieldType fieldType, FieldType fieldType2) {
super(fieldType, mapEntry.key, fieldType2, mapEntry.value);
this.descriptor = descriptor;
}
}
private MapEntry(Descriptor descriptor, FieldType fieldType, K k, FieldType fieldType2, V v) {
this.cachedSerializedSize = -1;
this.key = k;
this.value = v;
this.metadata = new Metadata(descriptor, this, fieldType, fieldType2);
}
private MapEntry(Metadata metadata, K k, V v) {
this.cachedSerializedSize = -1;
this.key = k;
this.value = v;
this.metadata = metadata;
}
private MapEntry(Metadata<K, V> metadata, CodedInputStream codedInputStream, ExtensionRegistryLite extensionRegistryLite) throws InvalidProtocolBufferException {
this.cachedSerializedSize = -1;
try {
this.metadata = metadata;
Entry parseEntry = MapEntryLite.parseEntry(codedInputStream, metadata, extensionRegistryLite);
this.key = parseEntry.getKey();
this.value = parseEntry.getValue();
} catch (InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (IOException e2) {
throw new InvalidProtocolBufferException(e2).setUnfinishedMessage(this);
}
}
public static <K, V> MapEntry<K, V> newDefaultInstance(Descriptor descriptor, FieldType fieldType, K k, FieldType fieldType2, V v) {
return new MapEntry(descriptor, fieldType, k, fieldType2, v);
}
public K getKey() {
return this.key;
}
public V getValue() {
return this.value;
}
public int getSerializedSize() {
if (this.cachedSerializedSize != -1) {
return this.cachedSerializedSize;
}
int computeSerializedSize = MapEntryLite.computeSerializedSize(this.metadata, this.key, this.value);
this.cachedSerializedSize = computeSerializedSize;
return computeSerializedSize;
}
public void writeTo(CodedOutputStream codedOutputStream) throws IOException {
MapEntryLite.writeTo(codedOutputStream, this.metadata, this.key, this.value);
}
public boolean isInitialized() {
return isInitialized(this.metadata, this.value);
}
public Parser<MapEntry<K, V>> getParserForType() {
return this.metadata.parser;
}
public Builder<K, V> newBuilderForType() {
return new Builder(this.metadata);
}
public Builder<K, V> toBuilder() {
return new Builder(this.metadata, this.key, this.value, true, true);
}
public MapEntry<K, V> getDefaultInstanceForType() {
return new MapEntry(this.metadata, this.metadata.defaultKey, this.metadata.defaultValue);
}
public Descriptor getDescriptorForType() {
return this.metadata.descriptor;
}
public Map<FieldDescriptor, Object> getAllFields() {
Map treeMap = new TreeMap();
for (FieldDescriptor fieldDescriptor : this.metadata.descriptor.getFields()) {
if (hasField(fieldDescriptor)) {
treeMap.put(fieldDescriptor, getField(fieldDescriptor));
}
}
return Collections.unmodifiableMap(treeMap);
}
private void checkFieldDescriptor(FieldDescriptor fieldDescriptor) {
if (fieldDescriptor.getContainingType() != this.metadata.descriptor) {
throw new RuntimeException("Wrong FieldDescriptor \"" + fieldDescriptor.getFullName() + "\" used in message \"" + this.metadata.descriptor.getFullName());
}
}
public boolean hasField(FieldDescriptor fieldDescriptor) {
checkFieldDescriptor(fieldDescriptor);
return true;
}
public Object getField(FieldDescriptor fieldDescriptor) {
checkFieldDescriptor(fieldDescriptor);
Object key = fieldDescriptor.getNumber() == 1 ? getKey() : getValue();
if (fieldDescriptor.getType() == Type.ENUM) {
return fieldDescriptor.getEnumType().findValueByNumberCreatingIfUnknown(((Integer) key).intValue());
}
return key;
}
public int getRepeatedFieldCount(FieldDescriptor fieldDescriptor) {
throw new RuntimeException("There is no repeated field in a map entry message.");
}
public Object getRepeatedField(FieldDescriptor fieldDescriptor, int i) {
throw new RuntimeException("There is no repeated field in a map entry message.");
}
public UnknownFieldSet getUnknownFields() {
return UnknownFieldSet.getDefaultInstance();
}
private static <V> boolean isInitialized(Metadata metadata, V v) {
if (metadata.valueType.getJavaType() == WireFormat.JavaType.MESSAGE) {
return ((MessageLite) v).isInitialized();
}
return true;
}
final Metadata<K, V> getMetadata() {
return this.metadata;
}
}
| [
"aheadlcxzhang@gmail.com"
] | aheadlcxzhang@gmail.com |
24c7275305b6ad6a89593fde505cc32662741987 | f888b9dc83f45245c1ba247893309f7287c7579a | /pet-clinic-data/src/main/java/spring/webapp/petclinic/servies/map/VetMapService.java | 6e318d781f753fe257b19589e0524e8c1ef325c9 | [] | no_license | behnamDehghannzhad/spring-pet-clinic | 06fb073c9a20a05b8d2956c3b7b163fbdd98b7d7 | 232eef7af0f27e6f29ef4e2f703e595738b61b0f | refs/heads/master | 2023-09-03T03:43:02.132157 | 2021-10-12T21:24:28 | 2021-10-12T21:24:28 | 401,461,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,523 | java | package spring.webapp.petclinic.servies.map;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import spring.webapp.petclinic.model.Speciality;
import spring.webapp.petclinic.model.Vet;
import spring.webapp.petclinic.servies.SpecialtyService;
import spring.webapp.petclinic.servies.VetService;
import java.util.Objects;
import java.util.Set;
@Service
@Profile({"default", "map"})
public class VetMapService extends AbstractMapService<Vet, Long> implements VetService {
private final SpecialtyService specialtyService;
public VetMapService(SpecialtyService specialtyService) {
this.specialtyService = specialtyService;
}
@Override
public Set<Vet>findAll() {
return super.findAll();
}
@Override
public Vet findById(Long id) {
return super.findById(id);
}
@Override
public Vet save(Vet vet) {
saveVetSpeciality(vet.getSpecialities());
return super.save(vet);
}
private void saveVetSpeciality(Set<Speciality> specialities) {
specialities.forEach(speciality -> {
if (Objects.nonNull(speciality.getId())) {
Speciality savedSpeciality = specialtyService.save(speciality);
savedSpeciality.setId(savedSpeciality.getId());
}
});
}
@Override
public void delete(Vet vet) {
super.delete(vet);
}
@Override
public void deleteById(Long id) {
super.deleteById(id);
}
}
| [
"b.dehghannezhad.gitHub@gmail.com"
] | b.dehghannezhad.gitHub@gmail.com |
4aff17cae1ac793b1d0911670899abf66f8bd10a | 0dc606aac4b49fff797256072331c53fbaaebbd6 | /src/com/atguigu/mtime/home/bean/ScrollImg.java | 2acb1ff82d729455e141d97f96cf5ba5fc2019d3 | [] | no_license | diaotongt/Try | e6ae4b2e17cff9bfeed9274dea56eed042b8b385 | 91ebc1d7c7d229357071a757e000a2d1fdff79ef | refs/heads/master | 2020-07-12T04:02:32.403081 | 2017-06-14T01:40:44 | 2017-06-14T01:40:44 | 94,275,605 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.atguigu.mtime.home.bean;
import java.util.List;
public class ScrollImg {
public List<Good> goods;
public class Good {
public String image;
public String url;
@Override
public String toString() {
return "Good [image=" + image + ", url=" + url + "]";
}
}
@Override
public String toString() {
return "ScrollImg [goods=" + goods + "]";
}
}
| [
"diaotongt@163.com"
] | diaotongt@163.com |
bf26bc580947ce2d666c29e23ec981e5b9e8c599 | 5ee8ed89f111b3d644ac3c933679f737b24d6b94 | /CoreJavaPrograms/src/com/tutorialspoint/designpattern/mvcdp/StudentController.java | ede41949bba7d5394c7e37d1f0ce9470d86af3d9 | [] | no_license | vidhurraj147/CoreJavaPrograms | 9132e0850ffe61dc8bd8d9e64e3bc996aa7c65af | 05957bd27c3e02fcb10f2c592a15c771e5250602 | refs/heads/master | 2020-04-10T10:24:56.132507 | 2018-12-29T05:36:19 | 2018-12-29T05:36:19 | 160,965,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.tutorialspoint.designpattern.mvcdp;
public class StudentController {
private Student model;
private StudentView view;
public StudentController(Student student, StudentView view) {
this.model = student;
this.view = view;
}
public void setStudentName(String name){
model.setName(name);
}
public String getStudentName(){
return model.getName();
}
public void setStudentRollNo(String rollNo){
model.setRollNo(rollNo);
}
public String getStudentRollNo(){
return model.getRollNo();
}
public void updateView(){
view.printStudentDetails();
view.printStudentDetails(getStudentName(), getStudentRollNo());
}
}
| [
"Lenovo@LAPTOP-KKISTNP1.lan1"
] | Lenovo@LAPTOP-KKISTNP1.lan1 |
bec736f66109bd3c161a618a52c8382e9db48d1a | ec2953753584e92ee6bb4208e2b5cb276f9adeca | /src/main/java/com/artbeatte/exercises/tests/RunLengthEncodingTest.java | 88b4cb57b795360b80d63c0d60bfc3138aaaf1de | [
"MIT"
] | permissive | abeatte/Exercises | 0f72aa7301f25045fdf4ff7bd6cf2bc6a5aa2f42 | 297a81760fb49b6ab9343a7561e7ea47ac77d7a7 | refs/heads/master | 2020-12-24T16:15:28.162696 | 2016-03-16T15:09:57 | 2016-03-16T15:09:57 | 35,170,700 | 0 | 1 | null | 2016-01-29T03:07:31 | 2015-05-06T16:36:49 | Java | UTF-8 | Java | false | false | 992 | java | package com.artbeatte.exercises.tests;
import com.artbeatte.exercises.strings.RunLengthEncoding;
import com.artbeatte.exercises.strings.RunLengthEncodingTestCase;
import com.artbeatte.testrunner.MethodParameterTestCase;
import com.artbeatte.testrunner.MethodTestCase;
import com.artbeatte.testrunner.SystemTestRunner;
import com.artbeatte.testrunner.TestRunner;
/**
* @author art.beatte
* @version 11/17/15
*/
public class RunLengthEncodingTest {
public static void main(String[] args) {
TestRunner testRunner = new SystemTestRunner();
for (String test : RunLengthEncodingTestCase.TESTS.keySet()) {
RunLengthEncoding rle = new RunLengthEncoding(test);
testRunner.addTestCase(new MethodTestCase<>(rle, "encode", RunLengthEncodingTestCase.TESTS.get(test)));
testRunner.addTestCase(
new MethodParameterTestCase<>(rle, "decode", String.class, rle.encode(), test));
}
testRunner.runTests();
}
}
| [
"art.beatte@docusign.com"
] | art.beatte@docusign.com |
e68d4d8c843e3f76192b256f15ce38b7e0aaca56 | bc5b4ba58d5bc5c5fa17c39d6e09cc30293c018d | /app/src/main/java/com/kaqi/niuniu/ireader/presenter/contract/BookShelfContract.java | 604e8dd901c61bd3389fd4f13829799a518f389d | [
"Apache-2.0"
] | permissive | nances/INNBook | 9bf533ff4a00e709952c0a3f16498636f5fff832 | 9729177ee5c9ee7153c6249bcea6b8d49d7a8842 | refs/heads/master | 2020-05-17T00:51:41.618413 | 2019-07-24T08:13:49 | 2019-07-24T08:13:49 | 183,406,972 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | package com.kaqi.niuniu.ireader.presenter.contract;
import com.kaqi.niuniu.ireader.model.bean.CollBookBean;
import com.kaqi.niuniu.ireader.ui.base.BaseContract;
import java.util.List;
/**
* Created by newbiechen on 17-5-8.
*/
public interface BookShelfContract {
interface View extends BaseContract.BaseView {
void finishRefresh(List<CollBookBean> collBookBeans);
void finishUpdate();
void showErrorTip(String error);
}
interface Presenter extends BaseContract.BasePresenter<View>{
void refreshCollBooks();
void createDownloadTask(CollBookBean collBookBean);
void updateCollBooks(List<CollBookBean> collBookBeans);
void loadRecommendBooks(String gender);
}
}
| [
"niqiao1111@163.com"
] | niqiao1111@163.com |
14226135bf58eedc4bd4bef0fbc8a349186ad7bb | ffd21b91062af1abab578a12b17c5bbde66c199c | /src/main/java/org/cmsideproject/log/MinervaLogImp.java | 4c5cfc1c9a5cf0b719106b294913b7ac7d1a660e | [] | no_license | RyanLin82/testEs | 1a843371857b86774c931b64f5ea91182e706b47 | 038fe5c56a11a057b2609be53edfd5e3aac66a1b | refs/heads/master | 2022-12-23T03:26:08.354922 | 2019-06-19T09:21:22 | 2019-06-19T09:21:22 | 163,148,838 | 2 | 0 | null | 2022-12-16T00:42:26 | 2018-12-26T07:11:40 | Java | UTF-8 | Java | false | false | 2,207 | java | package org.cmsideproject.log;
import java.util.Date;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.cmsideproject.minerva.entity.TicketSummary;
public class MinervaLogImp implements MinervaLog {
private Logger log;
public MinervaLogImp(Class clazz) {
log = LogManager.getLogger(clazz);
}
@Override
public void TicketInfo(String indexName, String ticketNumber, String method, String url, String data) {
log.info(
"\n Method name: [{}] \n timestamp: [{}] \n index name : [{}], \n ticket number: [{}] \n url: [{}] \n data: [{}]",
method, new Date(), indexName, ticketNumber, url, data);
}
@Override
public void TicketInfo(String indexName, String ticketNumber, String method, String url, String data, String msg) {
log.info(
"\n Method name: [{}] \n timestamp: [{}] \n index name : [{}], \n ticket number: [{}] \n url: [{}] \n data: [{}] \n message: [{}]",
method, new Date(), indexName, ticketNumber, url, data, msg);
}
@Override
public void TicketInfo(String indexName, String method, String url, Object data) {
log.info("\n timestamp: [{}] \n index name : [{}], \n method: [{}] \n url: [{}] \n data: [{}]", new Date(),
indexName, method, url, data);
}
@Override
public void TicketInfo(String indexName, String method, String url) {
log.info("\n timestamp: [{}] \n index name : [{}], \n method name: [{}] \n url: [{}] \n", new Date(), indexName,
method, url);
}
@Override
public void info(String title1, String value1, String title2, String value2, Object data) {
log.info("\n timestamp: [{}] \n [{}] : [{}], \n [{}] : [{}] \n data: [{}] \n", new Date(), title1, value1,
title2, value2, data);
}
@Override
public void info(String title1, String value1, String title2, String value2) {
log.info("\n timestamp: [{}] \n [{}] : [{}], \n [{}] : [{}] \n", new Date(), title1, value1, title2, value2);
}
@Override
public void info(String indexName, String method, Object data) {
log.info("\n timestamp: [{}] \n index name : [{}], \n method: [{}] \n data: [{}]", new Date(), indexName,
method, data);
}
@Override
public void info(String message) {
log.info(message);
}
}
| [
"ryan.lin8216@gmail.com"
] | ryan.lin8216@gmail.com |
973c25e3ec5c325fc901172a30ee49d414bcfd18 | ec5832cbf46f2ccb16e47eaf26e5b89303579b39 | /app/src/main/java/com/example/tpfinal/domain/RegisterUser.java | e393665672c22917cf9e8acbd31675479d56bcda | [] | no_license | ismailghedamsi/CatalogueAlbum | 2bbc93aeeed644f36b6522345357c7d5f7b94787 | a83cb2d564bd44b967d13e0e8b994735f38e65c9 | refs/heads/master | 2020-09-20T11:22:49.305237 | 2019-11-27T15:39:15 | 2019-11-27T15:39:15 | 224,462,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java | package com.example.tpfinal.domain;
public class RegisterUser {
private String id;
private String firstName;
private String lastName;
private String email;
private String password;
public RegisterUser(String firstName, String lastName, String email, String password) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.password = password;
}
public RegisterUser(String id,String firstName, String lastName, String email, String password) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.password = password;
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"ismailghedamsi@claurendeau.qc.ca"
] | ismailghedamsi@claurendeau.qc.ca |
569e33a7997d7079a54e7dbb0e023e08b8acfc76 | 3d030a2c50b7e3018d4f009c035a30ee212aced7 | /src/oo/polymorphism/demo11/DemoInterface2.java | 8a2133227040cd8f560ecb2ea97becc55cb33bec | [] | no_license | HandH1998/Java_learn | ef4738cc45c821731175c15045d01dc5d4e15743 | fdc25778d9b7443a856c24131125c7bba814372d | refs/heads/master | 2023-01-09T06:25:43.971558 | 2020-11-03T06:45:27 | 2020-11-03T06:45:27 | 297,592,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package oo.polymorphism.demo11;
import java.util.ArrayList;
import java.util.List;
public class DemoInterface2 {
public static void main(String[] args) {
//左边是接口名称,右边是实现类名称,这就是多态写法
ArrayList<String> list=new ArrayList<>();
List<String> result=addNames(list);
for (int i = 0; i < result.size(); i++) {
System.out.println(result.get(i));
}
}
public static List<String> addNames(List<String> list){
list.add("迪丽热巴");
list.add("古力娜扎");
return list;
}
}
| [
"1335248067@qq.com"
] | 1335248067@qq.com |
2944e8611619d0488dbdcbbb66b9b78df5bb3fdd | 22615eb5ee33a0dec58cab2be5454678e3ba2706 | /src/cs4248/build_tagger.java | f309a13cde81ea14bb72b7b8fec7d62afa1b9f49 | [] | no_license | ymichael/cs4248 | 40d8f652811bf15b3e4d585504192fae954f3b2c | c2472a48056fb704f5161abedacd158150b8d8d0 | refs/heads/master | 2016-08-04T12:51:33.053525 | 2014-10-16T13:14:20 | 2014-10-16T13:14:20 | 24,881,344 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,255 | java | package cs4248;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Arrays;
public class build_tagger {
public static void main(String[] args) throws IOException {
// Verify that the correct arguments are passed in.
if (args.length < 3) {
System.out.println("Expected 3 arguments <sents.train> <sents.devt> <model_file>");
System.out.println(String.format("Got: %s", Arrays.toString(args)));
return;
}
// Extract the various arguments to the program.
String trainingSentencesFilePath = args[0];
String developmentSentencesFilePath = args[1];
String modelFilePath = args[2];
// Create tagger and train it.
String[] trainingSentences = Utils.readLines(trainingSentencesFilePath);
String[] developmentSentences = Utils.readLines(developmentSentencesFilePath);
PosTagger tagger = new PosTagger(trainingSentences, developmentSentences);
// Train on the given sentences.
tagger.train();
// Serialize the tagger and save it in the modelFilePath.
FileOutputStream fileOut = new FileOutputStream(modelFilePath);
ObjectOutputStream objectOut = new ObjectOutputStream(fileOut);
objectOut.writeObject(tagger);
objectOut.close();
fileOut.close();
}
}
| [
"wrong92@gmail.com"
] | wrong92@gmail.com |
65852aaea9bb1d008820b1865a3aecaf909427a1 | 9a1730db5fe545f5d8967eeb80c3bc5c3bafd492 | /src/Model/KhachHangModel.java | e65f17d1804c70ea74a1322ad29eb8960be0e6d3 | [] | no_license | NortonBen/QuanLyKho_java | 5d9a2264f65d458e656d0d8ace4d66436bbc7850 | 2ac81a83cb82fa24bc397393e64c8d010dc5fb8d | refs/heads/master | 2021-06-15T17:01:23.882305 | 2017-01-13T09:56:44 | 2017-01-13T09:56:44 | 78,837,111 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,409 | java |
package Model;
import Libary.DataManager;
import static Model.Database.connect;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class KhachHangModel extends Model{
@Override
public void init() {
setTable("khachhang");
}
@Override
public ResultSet getData(){
ResultSet data = null;
data = getQuery("select * from "+table);
return data;
}
@Override
public boolean insert(DataManager data) {
String query = "Insert into `"+table+"` values(?,?,?,?)";
try {
PreparedStatement prsm = connect.prepareStatement(query);
prsm.setString(1, data.id.toString());
prsm.setString(2, data.data[0].toString());
prsm.setString(3, data.data[1].toString());
prsm.setString(4, data.data[2].toString());
return prsm.executeUpdate() != 0;
} catch (SQLException ex) {
System.out.println("loi: " + ex);
}
return false;
}
@Override
public boolean update(DataManager data) {
String query = "update `"+table+"` set tenKhach = ? , diaChi = ?, soDienThoai=? where maKhach= ?";
try {
PreparedStatement prsm = connect.prepareStatement(query);
prsm.setString(1, data.data[0].toString());
prsm.setString(2, data.data[1].toString());
prsm.setString(3, data.data[2].toString());
prsm.setString(4,data.id.toString());
return prsm.executeUpdate() != 0;
} catch (SQLException ex) {
System.out.println("loi: " + ex);
}
return false;
}
@Override
public boolean delete(DataManager data) {
String query = "delete from `"+table+"` where maKhach = ?";
try {
PreparedStatement prsm = connect.prepareStatement(query);
prsm.setString(1, (String) data.id);
return prsm.executeUpdate() != 0;
} catch (SQLException ex) {
System.out.println("loi: " + ex);
}
return false;
}
@Override
public ResultSet Search(String data)
{
ResultSet rows = null;
String query = "Select * From `"+table+"` Where `Makhach` LIKE '%"+data+"%' OR `TenKhach` LIKE '%"+data+"%'";
rows = getQuery(query);
return rows;
}
}
| [
"ben@joomexp.com"
] | ben@joomexp.com |
98cf89eac44d138a4e3da8c3c94004b576c76cdc | 6c36c505bfc2c51a6847dab8a0b353e61305db51 | /app/src/main/java/com/gopmgo/module/questionnaire/IQuestionnaireView.java | 7659687686b060620109bc2d0dd2d60695158800 | [] | no_license | aflahtaqiu/gopmgo | 9521adfc1ebfe786765c7e2bf4aed329c955261c | 4ee853a477375d1bb7a746fe8a25303aaee1c731 | refs/heads/master | 2022-12-15T06:16:39.067101 | 2020-09-08T07:46:17 | 2020-09-08T07:46:17 | 259,280,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package com.gopmgo.module.questionnaire;
import com.gopmgo.base.IBaseView;
import com.gopmgo.model.Questionnaire;
import java.util.List;
public interface IQuestionnaireView extends IBaseView {
void injectPresenter();
void setListQuestionnaires(List<Questionnaire> identifications);
void setMaxQuestionnaire(int maxValue);
void setFilledQuestionnaire(int value);
void setProgress(int progress);
void moveDoneQuestionnaire();
} | [
"aflahts98@gmail.com"
] | aflahts98@gmail.com |
16face49c9e45cd5aedd98aed32d9d0edeab8cf9 | 729a8e1904dde4ac3297a7ee851e32b1f9e2e91a | /src/main/java/com/example/hbhims/service/impl/HealthSportServiceImpl.java | 767349926862078b957a0acaf2833775900dd0a9 | [] | no_license | 1962247851/hbhims | 7a0083d4ff6db951980c0303cbc0010fedd3669f | f0667e313c1c0ae22b2d41f79c6f8d574ae23941 | refs/heads/master | 2022-12-06T10:03:02.362954 | 2020-08-22T04:56:29 | 2020-08-22T04:56:29 | 289,421,205 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,112 | java | package com.example.hbhims.service.impl;
import com.example.hbhims.dao.HealthSportDao;
import com.example.hbhims.entity.HealthSport;
import com.example.hbhims.service.HealthSportService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 运动记录表(HealthSport)表服务实现类
*
* @author qq1962247851
* @date 2020/4/20 11:42
*/
@Service
public class HealthSportServiceImpl implements HealthSportService {
private final HealthSportDao healthSportDao;
public HealthSportServiceImpl(HealthSportDao healthSportDao) {
this.healthSportDao = healthSportDao;
}
@Override
public HealthSport queryById(Long id) {
return healthSportDao.findById(id).orElse(null);
}
@Override
public List<HealthSport> queryAllByLimit(Long offset, Long limit) {
return healthSportDao.queryAllByLimit(offset, limit);
}
@Override
public List<HealthSport> queryAllByDateAndLimit(Long date, Long offset, Long limit) {
return healthSportDao.queryAllByDateAndLimit(date, offset, limit);
}
@Override
public List<HealthSport> queryAllByDate(Long date) {
return healthSportDao.findAllByDate(date);
}
@Override
public List<HealthSport> queryAll() {
return healthSportDao.findAll();
}
@Override
public HealthSport insert(HealthSport healthSport) {
return healthSportDao.save(healthSport);
}
@Override
public HealthSport update(HealthSport healthSport) {
return healthSportDao.saveAndFlush(healthSport);
}
@Override
public boolean deleteById(Long id) {
try {
healthSportDao.deleteById(id);
} catch (Exception e) {
return false;
}
return healthSportDao.findById(id).isEmpty();
}
@Override
public List<HealthSport> queryAllByUserId(Long userId) {
return healthSportDao.findAllByUserId(userId);
}
@Override
public HealthSport queryByUserIdAndDate(Long userId, Long date) {
return healthSportDao.findByUserIdAndDate(userId, date);
}
}
| [
"1962247851@qq.com"
] | 1962247851@qq.com |
5fa1e669319ed8abd9790dd238eb5ce94231ab0c | 2855e9d28a63e3d73e6f84dc8ff2b058bbf33ff5 | /enterpriseauth-service-oauth-client/src/main/java/cn/mldn/enterpriseauth/service/impl/ClientServiceImpl.java | b9b8ffb364544a1344a120f5048b29ab2cfbaed2 | [] | no_license | peng308979657/OAuth | b05599bd2ff9142aab1cc3eea6422d8901097491 | 672362f7a33b879fb476217a3978ebe3e31485f8 | refs/heads/master | 2021-08-11T09:25:00.012136 | 2017-11-13T13:37:13 | 2017-11-13T13:37:13 | 110,552,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package cn.mldn.enterpriseauth.service.impl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.mldn.enterpriseauth.dao.IClientDAO;
import cn.mldn.enterpriseauth.service.IClientService;
import cn.mldn.enterpriseauth.vo.Client;
@Service
public class ClientServiceImpl implements IClientService {
@Resource
private IClientDAO clientDAO;
@Override
public Client getByClientId(String clientId) {
return this.clientDAO.findByClientId(clientId);
}
}
| [
"mldnqa@163.com"
] | mldnqa@163.com |
3f87888fea3eede1f51a7549f72ac42484b3b422 | 6439160f3b2d5a64156d4a3ef1c0baab2acee015 | /src/main/java/com/publiccms/views/directive/sys/SysDeptCategoryDirective.java | 53eb177dcdd8058fea5eee07b1325f00815d3de5 | [] | no_license | puffershy/puffer-cms | c0c1c1bc4fc95cfedcca1b140146b48a6da6e252 | 69a0eeeab5fc8efa5dacb82cf73ef0de9d49b8b6 | refs/heads/master | 2020-04-05T18:01:40.022194 | 2018-11-11T15:05:23 | 2018-11-11T15:05:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,324 | java | package com.publiccms.views.directive.sys;
// Generated 2016-1-19 11:41:45 by com.sanluan.common.source.SourceMaker
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.publiccms.entities.sys.SysDept;
import com.publiccms.entities.sys.SysDeptCategory;
import com.publiccms.logic.service.sys.SysDeptCategoryService;
import com.publiccms.logic.service.sys.SysDeptService;
import com.publiccms.common.base.AbstractTemplateDirective;
import com.sanluan.common.handler.RenderHandler;
@Component
public class SysDeptCategoryDirective extends AbstractTemplateDirective {
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Integer deptId = handler.getInteger("deptId");
Integer categoryId = handler.getInteger("categoryId");
if (notEmpty(deptId)) {
if (notEmpty(categoryId)) {
handler.put("object", service.getEntity(deptId, categoryId)).render();
} else {
Integer[] categoryIds = handler.getIntegerArray("categoryIds");
if (notEmpty(categoryIds)) {
Map<String, Boolean> map = new LinkedHashMap<String, Boolean>();
SysDept entity = sysDeptService.getEntity(deptId);
if (notEmpty(entity)) {
if (entity.isOwnsAllCategory()) {
for (Integer id : categoryIds) {
map.put(String.valueOf(id), true);
}
} else {
for (Integer id : categoryIds) {
map.put(String.valueOf(id), false);
}
for (SysDeptCategory e : service.getEntitys(deptId, categoryIds)) {
map.put(String.valueOf(e.getCategoryId()), true);
}
}
}
handler.put("map", map).render();
}
}
}
}
@Autowired
private SysDeptCategoryService service;
@Autowired
private SysDeptService sysDeptService;
}
| [
"9440979@qq.com"
] | 9440979@qq.com |
8c5286a0bfd9cf628f1132d24d98aaf75476edd6 | b2518ce0e609c7aa5deb9e40f041a9e263137d7e | /Micro-Service-Login/src/main/java/br/com/myFood/Login/LoginApplication.java | 5153a4c9b9751721a3f01574c959e2ac6a99ec1e | [] | no_license | BrunoKayser/MicroService-RabbitMQ | a69aacb0ede6821593de19bc447e2920dd140620 | 92c8b75bbc1f85d801706985d90c3bb1dadbdbaa | refs/heads/master | 2023-03-05T19:19:02.933315 | 2021-02-19T03:16:42 | 2021-02-19T03:16:42 | 298,151,986 | 2 | 0 | null | 2021-02-19T03:16:43 | 2020-09-24T02:48:38 | Java | UTF-8 | Java | false | false | 494 | java | package br.com.myFood.Login;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@EnableEurekaClient
@EnableDiscoveryClient
@SpringBootApplication
public class LoginApplication {
public static void main(String[] args) {
SpringApplication.run(LoginApplication.class, args);
}
}
| [
"cwi.bschwertner@bv.com.br"
] | cwi.bschwertner@bv.com.br |
62c06b586524f9c915a3ebeefc083a6441792138 | fb84ceafa6f695c678cda9ea204dcb92e1ac4de0 | /src/main/java/com/research/demo/Repository/PersonRepository.java | 0e3187de5f5198c1e0a49f048924b6f7aada1302 | [] | no_license | fidelsouza/desafio-dev-api-rest1 | 89580d22608ef8631ea5116bbb479db334f7cf25 | 9629229c655264b5b0600126923cc0d8cef6e950 | refs/heads/main | 2023-01-31T02:13:19.881376 | 2020-12-11T03:29:06 | 2020-12-11T03:29:06 | 320,454,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.research.demo.Repository;
import org.springframework.data.repository.CrudRepository;
import com.research.demo.Entities.Person;
public interface PersonRepository extends CrudRepository<Person,Long>{
}
| [
"PICHAU@host.docker.internal"
] | PICHAU@host.docker.internal |
2515d2df86328a11a46d6c3849ce50f20b856662 | 208148fdb754cbc49ae57529772721c7f5742930 | /src/main/java/com/ilearnrw/common/rest/RestExceptionHandler.java | 170ee22c333cf8eb6e89955ca1875efbaae20fb3 | [
"BSD-3-Clause"
] | permissive | mpakarlsson/ilearnrw-service | 2fdc24e640936ccca892c6962b98f6f7203b9835 | 3d2e47f2967a99e7ea9ded2b9aa2a929f40d4fa0 | refs/heads/master | 2021-01-18T20:40:29.269784 | 2015-07-22T10:07:05 | 2015-07-22T10:07:05 | 13,671,951 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,831 | java | /*
* Copyright 2012 Stormpath, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ilearnrw.common.rest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
import org.springframework.web.util.WebUtils;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Renders a response with a RESTful Error representation based on the error format discussed in
* <a href="http://www.stormpath.com/blog/spring-mvc-rest-exception-handling-best-practices-part-1">
* Spring MVC Rest Exception Handling Best Practices.</a>
* <p/>
* At a high-level, this implementation functions as follows:
*
* <ol>
* <li>Upon encountering an Exception, the configured {@link RestErrorResolver} is consulted to resolve the
* exception into a {@link RestError} instance.</li>
* <li>The HTTP Response's Status Code will be set to the {@code RestError}'s
* {@link com.stormpath.spring.web.servlet.handler.RestError#getStatus() status} value.</li>
* <li>The {@code RestError} instance is presented to a configured {@link RestErrorConverter} to allow transforming
* the {@code RestError} instance into an object potentially more suitable for rendering as the HTTP response body.</li>
* <li>The
* {@link #setMessageConverters(org.springframework.http.converter.HttpMessageConverter[]) HttpMessageConverters}
* are consulted (in iteration order) with this object result for rendering. The first
* {@code HttpMessageConverter} instance that {@link HttpMessageConverter#canWrite(Class, org.springframework.http.MediaType) canWrite}
* the object based on the request's supported {@code MediaType}s will be used to render this result object as
* the HTTP response body.</li>
* <li>If no {@code HttpMessageConverter}s {@code canWrite} the result object, nothing is done, and this handler
* returns {@code null} to indicate other ExceptionResolvers potentially further in the resolution chain should
* handle the exception instead.</li>
* </ol>
*
* <h3>Defaults</h3>
* This implementation has the following property defaults:
* <table>
* <tr>
* <th>Property</th>
* <th>Instance</th>
* <th>Notes</th>
* </tr>
* <tr>
* <td>errorResolver</td>
* <td>{@link DefaultRestErrorResolver DefaultRestErrorResolver}</td>
* <td>Converts Exceptions to {@link RestError} instances. Should be suitable for most needs.</td>
* </tr>
* <tr>
* <td>errorConverter</td>
* <td>{@link MapRestErrorConverter}</td>
* <td>Converts {@link RestError} instances to {@code java.util.Map} instances to be used as the response body.
* Maps can then be trivially rendered as JSON by a (configured)
* {@link HttpMessageConverter HttpMessageConverter}. If you want the raw {@code RestError} instance to
* be presented to the {@code HttpMessageConverter} instead, set this property to {@code null}.</td>
* </tr>
* <tr>
* <td>messageConverters</td>
* <td>multiple instances</td>
* <td>Default collection are those automatically enabled by Spring as
* <a href="http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-config-enable">defined here</a> (specifically item #5)</td>
* </tr>
* </table>
*
* <h2>JSON Rendering</h2>
* This implementation comes pre-configured with Spring's typical default
* {@link HttpMessageConverter} instances; JSON will be enabled automatically if Jackson is in the classpath. If you
* want to match the JSON representation shown in the article above (recommended) but do not want to use Jackson
* (or the Spring's default Jackson config), you will need to
* {@link #setMessageConverters(org.springframework.http.converter.HttpMessageConverter[]) configure} a different
* JSON-capable {@link HttpMessageConverter}.
*
* @see DefaultRestErrorResolver
* @see MapRestErrorConverter
* @see HttpMessageConverter
* @see org.springframework.http.converter.json.MappingJacksonHttpMessageConverter MappingJacksonHttpMessageConverter
*
* @author Les Hazlewood
*/
public class RestExceptionHandler extends AbstractHandlerExceptionResolver implements InitializingBean {
private static final Logger log = LoggerFactory.getLogger(RestExceptionHandler.class);
private HttpMessageConverter<?>[] messageConverters = null;
private List<HttpMessageConverter<?>> allMessageConverters = null;
private RestErrorResolver errorResolver;
private RestErrorConverter<?> errorConverter;
public RestExceptionHandler() {
this.errorResolver = new DefaultRestErrorResolver();
this.errorConverter = new MapRestErrorConverter();
}
public void setMessageConverters(HttpMessageConverter<?>[] messageConverters) {
this.messageConverters = messageConverters;
}
public void setErrorResolver(RestErrorResolver errorResolver) {
this.errorResolver = errorResolver;
}
public RestErrorResolver getErrorResolver() {
return this.errorResolver;
}
public RestErrorConverter<?> getErrorConverter() {
return errorConverter;
}
public void setErrorConverter(RestErrorConverter<?> errorConverter) {
this.errorConverter = errorConverter;
}
@Override
public void afterPropertiesSet() throws Exception {
ensureMessageConverters();
}
@SuppressWarnings("unchecked")
private void ensureMessageConverters() {
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
//user configured values take precedence:
if (this.messageConverters != null && this.messageConverters.length > 0) {
converters.addAll(CollectionUtils.arrayToList(this.messageConverters));
}
//defaults next:
new HttpMessageConverterHelper().addDefaults(converters);
this.allMessageConverters = converters;
}
//leverage Spring's existing default setup behavior:
private static final class HttpMessageConverterHelper extends WebMvcConfigurationSupport {
public void addDefaults(List<HttpMessageConverter<?>> converters) {
addDefaultHttpMessageConverters(converters);
}
}
/**
* Actually resolve the given exception that got thrown during on handler execution, returning a ModelAndView that
* represents a specific error page if appropriate.
* <p/>
* May be overridden in subclasses, in order to apply specific
* exception checks. Note that this template method will be invoked <i>after</i> checking whether this resolved applies
* ("mappedHandlers" etc), so an implementation may simply proceed with its actual exception handling.
*
* @param request current HTTP request
* @param response current HTTP response
* @param handler the executed handler, or <code>null</code> if none chosen at the time of the exception (for example,
* if multipart resolution failed)
* @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to, or <code>null</code> for default processing
*/
@Override
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
ServletWebRequest webRequest = new ServletWebRequest(request, response);
RestErrorResolver resolver = getErrorResolver();
RestError error = resolver.resolveError(webRequest, handler, ex);
if (error == null) {
return null;
}
ModelAndView mav = null;
try {
mav = getModelAndView(webRequest, handler, error);
} catch (Exception invocationEx) {
log.error("Acquiring ModelAndView for Exception [" + ex + "] resulted in an exception.", invocationEx);
}
return mav;
}
protected ModelAndView getModelAndView(ServletWebRequest webRequest, Object handler, RestError error) throws Exception {
applyStatusIfPossible(webRequest, error);
Object body = error; //default the error instance in case they don't configure an error converter
RestErrorConverter converter = getErrorConverter();
if (converter != null) {
body = converter.convert(error);
}
return handleResponseBody(body, webRequest);
}
private void applyStatusIfPossible(ServletWebRequest webRequest, RestError error) {
if (!WebUtils.isIncludeRequest(webRequest.getRequest())) {
webRequest.getResponse().setStatus(error.getStatus().value());
}
//TODO support response.sendError ?
}
@SuppressWarnings("unchecked")
private ModelAndView handleResponseBody(Object body, ServletWebRequest webRequest) throws ServletException, IOException {
HttpInputMessage inputMessage = new ServletServerHttpRequest(webRequest.getRequest());
List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
if (acceptedMediaTypes.isEmpty()) {
acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
}
MediaType.sortByQualityValue(acceptedMediaTypes);
HttpOutputMessage outputMessage = new ServletServerHttpResponse(webRequest.getResponse());
Class<?> bodyType = body.getClass();
List<HttpMessageConverter<?>> converters = this.allMessageConverters;
if (converters != null) {
for (MediaType acceptedMediaType : acceptedMediaTypes) {
for (HttpMessageConverter messageConverter : converters) {
if (messageConverter.canWrite(bodyType, acceptedMediaType)) {
messageConverter.write(body, acceptedMediaType, outputMessage);
//return empty model and view to short circuit the iteration and to let
//Spring know that we've rendered the view ourselves:
return new ModelAndView();
}
}
}
}
if (logger.isWarnEnabled()) {
logger.warn("Could not find HttpMessageConverter that supports return type [" + bodyType +
"] and " + acceptedMediaTypes);
}
return null;
}
}
| [
"cantemir.mihu@gmail.com"
] | cantemir.mihu@gmail.com |
8bd3387a009ab1c4e6b1ceed23575fbed4f4dd85 | 7eb41e000121121f800b01bdcc99abeb1e7902f5 | /src/main/java/com/jstarcraft/rns/model/dl4j/rating/AutoRecModel.java | dc6a08ba7c11ccda16880ac6ded1cbf75cbaf81d | [
"Apache-2.0"
] | permissive | sunronsoft/jstarcraft-rns | dd723514986026a4260ee3b231fd85ebeffae58f | 4df4b78f4aac8a306fb0943de5c2c7475c05ba19 | refs/heads/master | 2021-05-18T03:30:47.397171 | 2020-03-25T07:08:09 | 2020-03-25T07:08:09 | 251,084,083 | 1 | 0 | Apache-2.0 | 2020-03-29T16:55:36 | 2020-03-29T16:55:35 | null | UTF-8 | Java | false | false | 3,158 | java | package com.jstarcraft.rns.model.dl4j.rating;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.layers.DenseLayer;
import org.deeplearning4j.nn.conf.layers.OutputLayer;
import org.deeplearning4j.nn.weights.WeightInit;
import org.nd4j.linalg.activations.Activation;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.learning.config.Nesterovs;
import com.jstarcraft.ai.data.DataInstance;
import com.jstarcraft.ai.data.DataModule;
import com.jstarcraft.ai.data.DataSpace;
import com.jstarcraft.ai.math.structure.matrix.MatrixScalar;
import com.jstarcraft.core.utility.Configurator;
import com.jstarcraft.rns.model.NeuralNetworkModel;
/**
*
* AutoRec学习器
*
* <pre>
* AutoRec: Autoencoders Meet Collaborative Filtering
* 参考LibRec团队
* </pre>
*
* @author Birdy
*
*/
//TODO 存档,以后需要基于DL4J重构.
@Deprecated
public class AutoRecModel extends NeuralNetworkModel {
/**
* the data structure that indicates which element in the user-item is non-zero
*/
private INDArray maskData;
@Override
protected int getInputDimension() {
return userSize;
}
@Override
protected MultiLayerConfiguration getNetworkConfiguration() {
NeuralNetConfiguration.ListBuilder factory = new NeuralNetConfiguration.Builder().seed(6).updater(new Nesterovs(learnRatio, momentum)).weightInit(WeightInit.XAVIER_UNIFORM).optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT).l2(weightRegularization).list();
factory.layer(0, new DenseLayer.Builder().nIn(inputDimension).nOut(hiddenDimension).activation(Activation.fromString(hiddenActivation)).build());
factory.layer(1, new OutputLayer.Builder(new AutoRecLearner(maskData)).nIn(hiddenDimension).nOut(inputDimension).activation(Activation.fromString(outputActivation)).build());
MultiLayerConfiguration configuration = factory.pretrain(false).backprop(true).build();
return configuration;
}
@Override
public void prepare(Configurator configuration, DataModule model, DataSpace space) {
super.prepare(configuration, model, space);
// transform the sparse matrix to INDArray
int[] matrixShape = new int[] { itemSize, userSize };
inputData = Nd4j.zeros(matrixShape);
maskData = Nd4j.zeros(matrixShape);
for (MatrixScalar term : scoreMatrix) {
if (term.getValue() > 0D) {
inputData.putScalar(term.getColumn(), term.getRow(), term.getValue());
maskData.putScalar(term.getColumn(), term.getRow(), 1D);
}
}
}
@Override
public void predict(DataInstance instance) {
int userIndex = instance.getQualityFeature(userDimension);
int itemIndex = instance.getQualityFeature(itemDimension);
instance.setQuantityMark(outputData.getFloat(itemIndex, userIndex));
}
}
| [
"Birdy@LAPTOP-QRG8T75T"
] | Birdy@LAPTOP-QRG8T75T |
4c86dbec186108c2a29efff47989792c08ee9c39 | a1385d076aba4a103e5973233c3425203c056a58 | /MyProject/BFUBChannels/src/com/trapedza/bankfusion/fatoms/FON_ValidateSelectedSupervisors.java | 4305ffa3435508856a175527546bf7ca17991a45 | [] | no_license | Singhmnish1947/java1.8 | 8ff0a83392b051e5614e49de06556c684ff4283e | 6b2d4dcf06c5fcbb13c2c2578706a825aaa4dc03 | refs/heads/master | 2021-07-10T17:38:55.581240 | 2021-04-08T12:36:02 | 2021-04-08T12:36:02 | 235,827,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,516 | java | /* ***********************************************************************************
* Copyright (c) 2007 Misys Financial Systems Ltd. All Rights Reserved.
*
* This software is the proprietary information of Misys Financial Systems Ltd.
* Use is subject to license terms.
* **********************************************************************************
* $Id: FON_ValidateSelectedSupervisors.java,v 1.9 2008/08/12 20:14:04 vivekr Exp $
* **********************************************************************************
*
* Revision 1.14 2008/02/16 14:37:17 Vinayachandrakantha.B.K
* JavaDoc Comments added : For all the attributes
*/
package com.trapedza.bankfusion.fatoms;
import java.util.HashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.misys.ub.channels.events.ChannelsEventCodes;
import com.trapedza.bankfusion.bo.refimpl.IBOMisTransactionCodes;
import com.trapedza.bankfusion.core.BankFusionException;
import com.trapedza.bankfusion.core.CommonConstants;
import com.trapedza.bankfusion.servercommon.commands.BankFusionEnvironment;
import com.trapedza.bankfusion.steps.refimpl.AbstractFON_ValidateSelectedSupervisors;
import com.trapedza.bankfusion.core.EventsHelper;
/**
* This Class contains methods for validating various conditions on the selected supervisor list & their levels
* such as duplicate supervisor entries, no levels assigned for a supervisor & level selected but not a supervisor etc.
* @author Vinayachandrakantha.B.K
*
*/
public class FON_ValidateSelectedSupervisors extends AbstractFON_ValidateSelectedSupervisors {
/**
* <code>svnRevision</code> = $Revision: 1.0 $
*/
public static final String svnRevision = "$Revision: 1.0 $";
static {
com.trapedza.bankfusion.utils.Tracer.register(svnRevision);
}
/**
* Logger instance
*/
private transient final static Log logger = LogFactory.getLog(FON_ValidateSelectedSupervisors.class.getName());
/**
* The default value in the supervisor field
*/
String defaultSupervisorValue = "None";
/**
* The default value in the supervisor level field
*/
int defaultSupervisorLevelValue = 0;
/**
* Constructor
* @param env
*/
public FON_ValidateSelectedSupervisors(BankFusionEnvironment env) {
super(env);
// TODO Auto-generated constructor stub
}
/**
* implements process(...) method in AbstractFON_ValidateSelectedSupervisors
*/
public void process(BankFusionEnvironment env) {
// Validate the Supervisors & Supervisor levels
/**
* TRUE if no supervisor specified, else FALSE
*/
boolean noSupervisor = true;
/**
* Supervisor level field values input
*/
int[] supervisorLevelList = { getF_IN_supervisorLevel1().intValue(), getF_IN_supervisorLevel2().intValue(),
getF_IN_supervisorLevel3().intValue(), getF_IN_supervisorLevel4().intValue(),
getF_IN_supervisorLevel5().intValue(), getF_IN_supervisorLevel6().intValue(),
getF_IN_supervisorLevel7().intValue(), getF_IN_supervisorLevel8().intValue(),
getF_IN_supervisorLevel9().intValue(), getF_IN_supervisorLevel10().intValue() };
/**
* Supervisor field values input
*/
String[] supervisorList = { getF_IN_supervisor1(), getF_IN_supervisor2(), getF_IN_supervisor3(),
getF_IN_supervisor4(), getF_IN_supervisor5(), getF_IN_supervisor6(), getF_IN_supervisor7(),
getF_IN_supervisor8(), getF_IN_supervisor9(), getF_IN_supervisor10() };
// Iterate for all the Supervisor values & their levels
for (int i = 0; i < supervisorList.length; i++) {
// Set noSupervisor flag to false if atleast 1 supervisor is specified
if (!supervisorList[i].trim().equalsIgnoreCase(defaultSupervisorValue)) {
noSupervisor = false;
}
// Check for Supervisor Level not assigned
if (!supervisorList[i].trim().equalsIgnoreCase(defaultSupervisorValue)
&& supervisorLevelList[i] == defaultSupervisorLevelValue) {
/*throw new BankFusionException(9007, new Object[] { supervisorList[i] }, logger, env);*/
EventsHelper.handleEvent(ChannelsEventCodes.E_AUTHORIZATION_LEVEL_NOT_SELECTED_FOR_SUPERVISOR,new Object[] {supervisorList[i] } , new HashMap(), env);
}
// Check for Supervisor not assigned
else if (supervisorList[i].trim().equalsIgnoreCase(defaultSupervisorValue)
&& supervisorLevelList[i] != defaultSupervisorLevelValue) {
/*throw new BankFusionException(9018, new Object[] { new Integer(i + 1) }, logger, env);*/
EventsHelper.handleEvent(ChannelsEventCodes.E_SET_SUPERVISOR_OR_ELSE_AUTHORIZATION_LEVEL_NONE,new Object[] {new Integer(i + 1)} , new HashMap(), env);
}
// Check for duplicate entries
for (int j = i + 1; j < supervisorList.length; j++) {
if (supervisorList[i].equalsIgnoreCase(supervisorList[j])
&& !supervisorList[i].trim().equalsIgnoreCase(defaultSupervisorValue)) {
/*throw new BankFusionException(9006, new Object[] { supervisorList[i] }, logger, env);*/
EventsHelper.handleEvent(ChannelsEventCodes.E_SUPERVISOR_HAS_MORE_THAN_ONE_AUTHORIZATION_LEVEL,new Object[] {supervisorList[i]} , new HashMap(), env);
}
}
}
// throw exception if no supervisor is specified
if (noSupervisor) {
/*throw new BankFusionException(9011, null, logger, env);*/
}
// NOT BEING USED SINCE Destination Sort Code FIELD IS NOT EDITABLE in UI. HOWEVER, CAN BE USED IF IT'S MADE EDITABLE IN FUTURE RELEASES.
// Validate the Destination Sort Code entered.
/*String destSortCode = getF_IN_destinationSortCode().substring(0, 2)
+ "-" + getF_IN_destinationSortCode().substring(2, 4)
+ "-" + getF_IN_destinationSortCode().substring(4, 6);
IBOBranch branchObj = null;
try
{
branchObj = (IBOBranch)env.getFactory().findByPrimaryKey(IBOBranch.BONAME, destSortCode);
}
catch(PersistenceException ex)
{
throw new BankFusionException(9015, new Object[] {destSortCode}, logger, env);
}
if(branchObj==null)
{
throw new BankFusionException(9016, new Object[] {destSortCode}, logger, env);
}*/
/**
* Numeric code of the transaction type selected
*/
int numericCode = 0;
try {
IBOMisTransactionCodes transCodeObj = (IBOMisTransactionCodes) env.getFactory().findByPrimaryKey(
IBOMisTransactionCodes.BONAME, getF_IN_transType());
numericCode = transCodeObj.getF_NUMERICTRANSCODE();
}
catch (Exception ex) {
/*throw new BankFusionException(9021, new Object[] { ex.getMessage() }, logger, env);*/
EventsHelper.handleEvent(ChannelsEventCodes.E_EXCEPTION_OCCURED,new Object[] {ex.getMessage() } , new HashMap(), env);
logger.error(ex);
}
// Checks whether the length of the Numeric Code provided is <= 2 digits, since this will be used in the
// generation of EFT file where transaction code must be of 2 digits in length.
if (numericCode > 99 || numericCode < -9) {
/*throw new BankFusionException(9022, new String[] { getF_IN_transType(),
CommonConstants.EMPTY_STRING + numericCode }, logger, env);*/
EventsHelper.handleEvent(ChannelsEventCodes.E_INVALID_NUMERIC_CODE_FOR_THE_TRANSACTION_TYPE,new Object[] {} , new HashMap(), env);
}
// Checks whether the Destination Sort Code field is empty.
if (getF_IN_destinationSortCode() == null
|| getF_IN_destinationSortCode().trim().equalsIgnoreCase(CommonConstants.EMPTY_STRING)) {
/*throw new BankFusionException(9016, null, logger, env);*/
EventsHelper.handleEvent(ChannelsEventCodes.E_DESTINATION_BRANCH_SORT_CODE_MUST_BE_ENTERED,new Object[] {} , new HashMap(), env);
}
}
}
| [
"manish.kumar1@finastra.com"
] | manish.kumar1@finastra.com |
4df4870d8c45492818c0bb17412c49fe0e2e26c3 | 8df6cbbc3a0a10147a17c7b699110a123c493ea3 | /Object Oriented Programming/NaturelLanguageProcessigWithPatterns/src/test/java/Test/GermanLanguageIdentifierTest.java | f5f4410402a5a0144b8a961afcf9936f0cee256e | [
"BSD-3-Clause"
] | permissive | tolgahanakgun/School-Projects | 7982cd3a3841f1509434c3342b1cafe807e28354 | 3aecfa3887bc69f3fff44bd9509ff355c99ab1f4 | refs/heads/master | 2021-03-19T07:44:58.181555 | 2018-07-08T11:26:39 | 2018-07-08T11:26:39 | 86,336,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | package Test;
import static org.junit.Assert.*;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import org.junit.Test;
import LanguageIdentifier.LanguageIdentifier;
import TextSources.TextFileReader;
public class GermanLanguageIdentifierTest {
@Test
public void test() {
LanguageIdentifier idenfier = new LanguageIdentifier();
TextFileReader reader = new TextFileReader();
try {
URL resource = GermanLanguageIdentifierTest.class.getResource("/germanExampleText.txt");
String string = Paths.get(resource.toURI()).toFile().getAbsolutePath();
String actual = idenfier.whichLanguage(reader.getText(string));
String expected = "German";
assertEquals(expected, actual);
} catch (URISyntaxException | IOException e) {
fail(e.getMessage());
}
}
}
| [
"tlghnakgn@gmail.com"
] | tlghnakgn@gmail.com |
9e6c2ddc1aad9bed46757f85e927e9cf3d76089d | 66d83ff6bfafca82e16f8db5492f8947d96a5aab | /src/main/java/br/com/soig/Application.java | 4b15c929909c988083bf30c169871be8ba48bdd6 | [] | no_license | leandroxt/authentication-service | 3861aec84a1daff2b56c7f6eea00f8a63f4c5fcb | 98ebb3520fd1d71491d69e3691e86bda195b3c69 | refs/heads/master | 2021-04-09T15:28:15.378744 | 2018-03-17T18:02:03 | 2018-03-17T18:02:03 | 125,655,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package br.com.soig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"thiers.leandro@gmail.com"
] | thiers.leandro@gmail.com |
8c231ed0ca083b408ab7c0706297f3b9f499f93a | 21b76ecac4dc2758c32b627d747177ca9ee6424e | /src/test/HeroTest.java | 82a2d9a77c06b0a2608a8135328be8ddbfbf1983 | [
"MIT"
] | permissive | abigailwambui/Hero-Squad | 692b23ddcbfb07e750b5cb1b753a1a6944688598 | b5be94c05bcdefbb12f338c591ec1a2249e80af9 | refs/heads/master | 2020-05-24T09:30:00.923549 | 2019-05-20T11:20:25 | 2019-05-20T11:20:25 | 187,207,732 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,087 | java | import org.junit.*;
import static org.junit.Assert.*;
public class HeroTest{
@Test
public void hero_instantiatesCorrectly_true() {
Hero hero = new Hero("Superman",30, "Extreme might","Ladies");
assertEquals(true, hero instanceof Hero);
}
@Test
public void hero_instantiatesWithName_String() {
Hero hero = new Hero("Superman",30, "Extreme might","Ladies");
assertEquals("Superman", hero.getName());
}
@Test
public void hero_instantiatesWithAge_Integer() {
Hero hero = new Hero("Superman", 30, "Extreme might","Ladies");
assertEquals(30, hero.getAge());
}
@Test
public void hero_instantiatesWithPower_String() {
Hero hero = new Hero("Superman", 30, "Extreme might","Ladies");
assertEquals("Extreme might", hero.getPower());
}
@Test
public void hero_instantiatesWithWeakness_String() {
Hero hero = new Hero("Superman", 30, "Extreme might","Ladies");
assertEquals("Ladies", hero.getWeakness());
}
@Test
public void all_returnsAllInstancesOfHero_true() {
Hero firstHero = new Hero("Superman",30, "Extreme might","Ladies");
Hero secondTask = new Task("Batman",35, "Fast car", "Sleep");
assertEquals(true, Hero.all().contains(firstHero));
assertEquals(true, Hero.all().contains(secondHero));
}
@Test
public void clear_emptiesAllHeroesFromArrayList_0() {
Hero myHero = new Hero("Superman",30, "Extreme might","Ladies");
Hero.clear();
assertEquals(Hero.all().size(), 0);
}
@Test
public void getId_heroesInstantiateWithAnID_1() {
Hero.clear();
Hero myHero = new Hero("Superman",30, "Extreme might","Ladies");
assertEquals(1, myHero.getId());
}
@Test
public void find_returnsHeroWithSmeId_secondHero() {
Hero firstHero = new Hero("Superman",30, "Extreme might","Ladies");
Task secondHero = new Hero("Batman",35, "Fast car", "Sleep");
assertEquals(Hero.find(secondHero.getId()), secondHero);
}
} | [
"abigailw15njuguna@gmail.com"
] | abigailw15njuguna@gmail.com |
0215f6133a0025391f6166b92169c4617e1191fc | f2c74ec4070d4bd69f0d16e5e6fbc6d43013a4e0 | /api/src/main/java/org/iton/messenger/api/photos/Photos.java | 3a98437cc1de5138d2624a39246c99cb2c0a8d64 | [
"MIT"
] | permissive | ITON-Solutions/messenger-server | 755764947b5e80f55638add81230007e761e46bf | 2dd14a37413540fe297903a7dc08190e72a09055 | refs/heads/master | 2022-06-30T15:50:59.077067 | 2020-04-26T14:11:11 | 2020-04-26T14:11:11 | 70,696,561 | 1 | 0 | MIT | 2022-06-20T23:51:49 | 2016-10-12T12:14:13 | Java | UTF-8 | Java | false | false | 796 | java | package org.iton.messenger.api.photos;
import org.iton.messenger.api.Photo;
import org.iton.messenger.api.User;
import org.iton.messenger.core.TLObject;
import org.iton.messenger.core.TLVector;
public abstract class Photos extends TLObject {
protected int count;
protected TLVector<Photo> photos;
protected TLVector<User> users;
public TLVector<Photo> getPhotos() {
return this.photos;
}
public void setPhotos(TLVector<Photo> photos) {
this.photos = photos;
}
public TLVector<User> getUsers() {
return this.users;
}
public void setUsers(TLVector<User> users) {
this.users = users;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
} | [
"vladimir.perez.gonzalez@gmail.com"
] | vladimir.perez.gonzalez@gmail.com |
3007d0f73d5a0720d6d0d2a6a7b3b08f43c6ce7c | 35ad36d0680f66f0a323902450952b01d68a2b95 | /springcloud/edas-business/edas-business-dingtalk/src/main/java/com/edas/business/dingtalk/entity/ShopwwiZtDingdingcorpid.java | 36c7e977cfe8108dbc209f1b655692ecfdbe699c | [] | no_license | hybin0325/hybin | 5317d8bb30de8d7c2618e21a39849884181d1c79 | eb410cef50f19cf7236200448c68e26b4091db75 | refs/heads/master | 2022-12-24T20:40:49.454581 | 2020-02-04T07:02:00 | 2020-02-04T07:02:00 | 119,921,417 | 0 | 1 | null | 2022-12-16T01:15:50 | 2018-02-02T02:34:02 | TSQL | UTF-8 | Java | false | false | 2,959 | java | package com.edas.business.dingtalk.entity;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
@Table(name = "shopwwi_zt_dingdingcorpid")
public class ShopwwiZtDingdingcorpid {
@Id
private String userid;
private String username;
private Integer id;
private String appkey;
private String appsecret;
@Column(name = "agent_id")
private String agentId;
private String dld;
private String clique;
@Column(name = "add_date")
private String addDate;
@Column(name = "userid_up")
private String useridUp;
@Column(name = "username_up")
private String usernameUp;
@Column(name = "upd_date")
private Date updDate;
private Integer status;
public Integer getStatus(){
return status;
}
public void setStatus(Integer status){
this.status = status ;
}
public Date getUpdDate() {
return updDate;
}
public void setUpdDate(Date updDate) {
this.updDate = updDate;
}
public String getUsernameUp() {
return usernameUp;
}
public void setUsernameUp(String usernameUp) {
this.usernameUp = usernameUp== null ? null : usernameUp.trim();
}
public String getUseridUp() {
return useridUp;
}
public void setUseridUp(String useridUp) {
this.useridUp = useridUp== null ? null : useridUp.trim();
}
public String getAddDate() {
return addDate;
}
public void setAddDate(String addDate) {
this.addDate = addDate== null ? null : addDate.trim();
}
public String getClique() {
return clique;
}
public void setClique(String clique) {
this.clique = clique== null ? null : clique.trim();
}
public String getDld() {
return dld;
}
public void setDld(String dld) {
this.dld = dld== null ? null : dld.trim();
}
public String getAgentId() {
return agentId;
}
public void setAgentId(String agentId) {
this.agentId = agentId == null ? null : agentId.trim();
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid == null ? null : userid.trim();
}
public String getUsername(){
return username;
}
public void setUsername(String username){
this.username = username == null ? null :username.trim();
}
public Integer getId(){
return id;
}
public void setId(Integer id){
this.id = id ;
}
public String getAppkey(){
return appkey;
}
public void setAppkey(String appkey){
this.appkey = appkey == null ? null :appkey.trim();
}
public String getAppsecret(){
return appsecret;
}
public void setAppsecret(String appsecret){
this.appsecret= appsecret== null ? null :appsecret.trim();
}
}
| [
"358969993@qq.com"
] | 358969993@qq.com |
6e32a22e21a851cbd278a0fac05fa7d724cc6fed | 5282e245ff6150de1aaa2c499bac028ac9f2e021 | /controlsfx/src/main/java/impl/org/controlsfx/spreadsheet/CellViewSkin.java | 9d364fc3764efc5d74e6f2a95a169be8d89a4a1c | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | besjb/stageAS | d058ebd4459ffcd28d46ba176d256310ed2c16be | dc6dedb28cd40f3f2fc6f9628d176f24a11218fa | refs/heads/master | 2022-11-21T09:16:21.253804 | 2020-07-27T08:50:42 | 2020-07-27T08:50:42 | 281,675,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,836 | java | /**
* Copyright (c) 2013, 2019 ControlsFX
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of ControlsFX, any associated website, nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package impl.org.controlsfx.spreadsheet;
import com.sun.javafx.scene.control.skin.TableCellSkin;
import java.util.UUID;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.beans.value.WeakChangeListener;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.event.WeakEventHandler;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.geometry.VPos;
import javafx.scene.Node;
import javafx.scene.control.MenuButton;
import javafx.scene.control.TableColumn;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Region;
import org.controlsfx.control.spreadsheet.Filter;
import org.controlsfx.control.spreadsheet.SpreadsheetCell;
import org.controlsfx.control.spreadsheet.SpreadsheetCell.CornerPosition;
/**
*
* This is the skin for the {@link CellView}.
*
* Its main goal is to draw an object (a triangle) on cells which have their
* {@link SpreadsheetCell#commentedProperty()} set to true.
*
*/
public class CellViewSkin extends TableCellSkin<ObservableList<SpreadsheetCell>, SpreadsheetCell> {
/**
* This EventType can be used with an {@link EventHandler} in order to catch
* when a SpreadsheetCell filter is activated/deactivated on this column.
*/
public static final EventType<Event> FILTER_EVENT_TYPE
= new EventType<>("FilterEventType" + UUID.randomUUID().toString()); //$NON-NLS-1$
private final static String TOP_LEFT_CLASS = "top-left"; //$NON-NLS-1$
private final static String TOP_RIGHT_CLASS = "top-right"; //$NON-NLS-1$
private final static String BOTTOM_RIGHT_CLASS = "bottom-right"; //$NON-NLS-1$
private final static String BOTTOM_LEFT_CLASS = "bottom-left"; //$NON-NLS-1$
/**
* The size of the edge of the triangle FIXME Handling of static variable
* will be changed.
*/
private static final int TRIANGLE_SIZE = 8;
/**
* The region we will add on the cell when necessary.
*/
private Region topLeftRegion = null;
private Region topRightRegion = null;
private Region bottomRightRegion = null;
private Region bottomLeftRegion = null;
private MenuButton filterButton = null;
public CellViewSkin(CellView tableCell) {
super(tableCell);
tableCell.itemProperty().addListener(weakItemChangeListener);
tableCell.tableColumnProperty().addListener(weakColumnChangeListener);
tableCell.getTableColumn().addEventHandler(FILTER_EVENT_TYPE, weakTriangleEventHandler);
if (tableCell.getItem() != null) {
tableCell.getItem().addEventHandler(SpreadsheetCell.CORNER_EVENT_TYPE, weakTriangleEventHandler);
}
}
@Override
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
Node graphic = getSkinnable().getGraphic();
/**
* If we have an Image in the Cell, its fitHeight will be affected by
* the cell height (see CellView). But during calculation for autofit
* option, we want to know the real prefHeight of this cell. Apparently,
* the fitHeight option is returned by default so we must override and
* return the Height of the image inside.
*/
if (graphic != null && graphic instanceof ImageView) {
ImageView view = (ImageView) graphic;
if (!((CellView) getSkinnable()).isOriginalCell()) {
view.setManaged(false);
double height = super.computePrefHeight(width, topInset, rightInset, bottomInset, leftInset);
view.setManaged(true);
return height;
} else if (view.getImage() != null) {
return view.getImage().getHeight();
}
}
return super.computePrefHeight(width, topInset, rightInset, bottomInset, leftInset);
}
@Override
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
/**
* We integrate the filter width into the total width for autosize. We
* do just like Excel.
*/
Filter filter = ((CellView) getSkinnable()).getFilter();
double cellWidth = super.computePrefWidth(height, topInset, rightInset, bottomInset, leftInset);
if (filter != null) {
double filterWidth = filter.getMenuButton().getWidth();
filterWidth = filterWidth == 0 ? 23.0 : filterWidth;
Pos alignement = getSkinnable().getAlignment();
switch (alignement) {
case BASELINE_LEFT:
case BOTTOM_LEFT:
case CENTER_LEFT:
case TOP_LEFT:
//Simply add the filter width.
return cellWidth + filterWidth;
case BASELINE_CENTER:
case BOTTOM_CENTER:
case TOP_CENTER:
case CENTER:
//Add twice the filter width in order to be well centered so the
//text is not hovered by the filter.
return cellWidth + (2 * filterWidth);
default:
return cellWidth + 10;
}
}
return cellWidth;
}
@Override
protected void layoutChildren(double x, final double y, final double w, final double h) {
super.layoutChildren(x, y, w, h);
if (getSkinnable().getItem() != null) {
layoutTriangle();
handleFilter(x, y, w, h);
}
}
private void layoutTriangle() {
SpreadsheetCell cell = getSkinnable().getItem();
handleTopLeft(cell);
handleTopRight(cell);
handleBottomLeft(cell);
handleBottomRight(cell);
getSkinnable().requestLayout();
}
private void handleFilter(double x, final double y, final double w, final double h) {
Filter filter = ((CellView) getSkinnable()).getFilter();
if (filter != null) {
//We first remove it.
removeMenuButton();
filterButton = filter.getMenuButton();
if (!getChildren().contains(filterButton)) {
getChildren().add(filterButton);
}
//We add the insets to really stick to the bottom-right even with padding.
layoutInArea(filterButton, x + snappedRightInset(), y + snappedBottomInset(), w, h, 0, new Insets(0), HPos.RIGHT, VPos.BOTTOM);
} else if (filterButton != null) {
removeMenuButton();
}
}
private void removeMenuButton() {
if (filterButton != null && getChildren().contains(filterButton)) {
getChildren().remove(filterButton);
filterButton = null;
}
}
private void handleTopLeft(SpreadsheetCell cell) {
if (cell.isCornerActivated(CornerPosition.TOP_LEFT)) {
if (topLeftRegion == null) {
topLeftRegion = getRegion(CornerPosition.TOP_LEFT);
}
//It's not always displayed if I don't remove it first.
getChildren().remove(topLeftRegion);
getChildren().add(topLeftRegion);
//We do not wants snappedTopInset because it takes the padding in consideration!
topLeftRegion.relocate(0, 0);
} else if (topLeftRegion != null) {
getChildren().remove(topLeftRegion);
topLeftRegion = null;
}
}
private void handleTopRight(SpreadsheetCell cell) {
if (cell.isCornerActivated(CornerPosition.TOP_RIGHT)) {
if (topRightRegion == null) {
topRightRegion = getRegion(CornerPosition.TOP_RIGHT);
}
//It's not always displayed if I don't remove it first.
getChildren().remove(topRightRegion);
getChildren().add(topRightRegion);
//We do not wants snappedTopInset because it takes the padding in consideration!
topRightRegion.relocate(getSkinnable().getWidth() - TRIANGLE_SIZE, 0);
} else if (topRightRegion != null) {
getChildren().remove(topRightRegion);
topRightRegion = null;
}
}
private void handleBottomRight(SpreadsheetCell cell) {
if (cell.isCornerActivated(CornerPosition.BOTTOM_RIGHT)) {
if (bottomRightRegion == null) {
bottomRightRegion = getRegion(CornerPosition.BOTTOM_RIGHT);
}
//It's not always displayed if I don't remove it first.
getChildren().remove(bottomRightRegion);
getChildren().add(bottomRightRegion);
bottomRightRegion.relocate(getSkinnable().getWidth() - TRIANGLE_SIZE, getSkinnable().getHeight() - TRIANGLE_SIZE);
} else if (bottomRightRegion != null) {
getChildren().remove(bottomRightRegion);
bottomRightRegion = null;
}
}
private void handleBottomLeft(SpreadsheetCell cell) {
if (cell.isCornerActivated(CornerPosition.BOTTOM_LEFT)) {
if (bottomLeftRegion == null) {
bottomLeftRegion = getRegion(CornerPosition.BOTTOM_LEFT);
}
//It's not always displayed if I don't remove it first.
getChildren().remove(bottomLeftRegion);
getChildren().add(bottomLeftRegion);
bottomLeftRegion.relocate(0, getSkinnable().getHeight() - TRIANGLE_SIZE);
} else if (bottomLeftRegion != null) {
getChildren().remove(bottomLeftRegion);
bottomLeftRegion = null;
}
}
private static Region getRegion(CornerPosition position) {
Region region = new Region();
region.resize(TRIANGLE_SIZE, TRIANGLE_SIZE);
region.getStyleClass().add("cell-corner"); //$NON-NLS-1$
switch (position) {
case TOP_LEFT:
region.getStyleClass().add(TOP_LEFT_CLASS);
break;
case TOP_RIGHT:
region.getStyleClass().add(TOP_RIGHT_CLASS);
break;
case BOTTOM_RIGHT:
region.getStyleClass().add(BOTTOM_RIGHT_CLASS);
break;
case BOTTOM_LEFT:
region.getStyleClass().add(BOTTOM_LEFT_CLASS);
break;
}
return region;
}
private final EventHandler<Event> triangleEventHandler = new EventHandler<Event>() {
@Override
public void handle(Event event) {
getSkinnable().requestLayout();
}
};
private final WeakEventHandler weakTriangleEventHandler = new WeakEventHandler(triangleEventHandler);
private final ChangeListener<SpreadsheetCell> itemChangeListener = new ChangeListener<SpreadsheetCell>() {
@Override
public void changed(ObservableValue<? extends SpreadsheetCell> arg0, SpreadsheetCell oldCell,
SpreadsheetCell newCell) {
if (oldCell != null) {
oldCell.removeEventHandler(SpreadsheetCell.CORNER_EVENT_TYPE, weakTriangleEventHandler);
}
if (newCell != null) {
newCell.addEventHandler(SpreadsheetCell.CORNER_EVENT_TYPE, weakTriangleEventHandler);
}
if (getSkinnable().getItem() != null) {
layoutTriangle();
}
}
};
private final WeakChangeListener<SpreadsheetCell> weakItemChangeListener = new WeakChangeListener<>(itemChangeListener);
private final ChangeListener<TableColumn> columnChangeListener = new ChangeListener<TableColumn>() {
@Override
public void changed(ObservableValue<? extends TableColumn> arg0, TableColumn oldCell,
TableColumn newCell) {
if (oldCell != null) {
oldCell.removeEventHandler(FILTER_EVENT_TYPE, weakTriangleEventHandler);
}
if (newCell != null) {
newCell.addEventHandler(FILTER_EVENT_TYPE, weakTriangleEventHandler);
}
}
};
private final WeakChangeListener<TableColumn> weakColumnChangeListener = new WeakChangeListener<>(columnChangeListener);
}
| [
"jean-baptiste.bes@etu.umontpellier.fr"
] | jean-baptiste.bes@etu.umontpellier.fr |
bfe60965e092d36083c031694d979976315398c4 | 66090c9eb2d90b59378cbd5cdfbe25f3d3775851 | /Interview/src/th/c/TreeProblem/GetHeight.java | 03e490c78ffa8fe30271097e52c610a294c568ac | [] | no_license | charansrirama/Interview | ee5db46a8f88a0d72fe4f4d51eaf7047afd12163 | 487b406a15e321f73078951726006c1c9d6f7924 | refs/heads/master | 2020-06-01T15:28:24.089029 | 2012-12-28T02:23:27 | 2012-12-28T02:23:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 604 | java | package th.c.TreeProblem;
import java.util.*;
public class GetHeight {
public int getHeight(Node node) {
if(node == null) return 0;
else
return Math.max(getHeight(node.left), getHeight(node.right))+1;
}
// Non-recursive version
public static int getHeight2(Node root) {
if(root == null) return 0;
int height = 0;
Queue<Node> q = new LinkedList<Node>();
q.offer(root);
while(!q.isEmpty()) {
height++;
for(int i = 0; i < q.size(); i++) {
Node t = q.poll();
if(t.left != null) q.offer(t.left);
if(t.right != null) q.offer(t.right);
}
}
return height;
}
}
| [
"chaceliang@gmail.com"
] | chaceliang@gmail.com |
a2286477f9927c5a838631df2d0622feea261db2 | 2d9525130a733e4d942e55ebf77604e5231a4394 | /src/main/java/duke/exceptions/InsufficientInputException.java | c427ab02e7fb2192542bf2992078f38ba1883577 | [] | no_license | yapdianhao/duke | c11d9ef3fb5f006f01ca9c019427473d2917a504 | 6b4fdd25ac8efe40a4b5bb48d377e24caf12f2d1 | refs/heads/master | 2020-12-15T07:39:38.054813 | 2020-04-13T09:25:35 | 2020-04-13T09:25:35 | 235,034,136 | 0 | 0 | null | 2020-02-12T03:40:30 | 2020-01-20T06:31:31 | Java | UTF-8 | Java | false | false | 264 | java | package duke.exceptions;
/**
* A Duke Exception which warns the users that arguments are not enough.
*/
public class InsufficientInputException extends DukeException {
public String toString() {
return "OOPS, the arguments are not enough!";
}
} | [
"yapdhao@gmail.com"
] | yapdhao@gmail.com |
54c55a5ba228a5e51335c68f60493956c9691fe8 | 7f2a84ba3dd6809c67291938394563df9dbbde45 | /TestSeqList.java | 1cc10f0b27e2d9890de210a52e141d2267ea5bc5 | [] | no_license | zhaoziheng-name/learnjava | 0c57aea7b8a0bff3456367742889028f1c2fb764 | 5fd0649ef09c290986e227138694f688814e6b93 | refs/heads/master | 2020-12-06T13:26:20.407850 | 2020-10-05T08:59:34 | 2020-10-05T08:59:34 | 232,474,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java | public class TestSeqList {
public static void main(String[] args) {
// testAdd();
// testSearch();
// testContains();
testRemove();
}
private static void testAdd() {
SeqList seqList = new SeqList();
seqList.add(0, 100);
seqList.add(0, 200);
seqList.add(0, 300);
seqList.add(0, 400);
seqList.display();
}
private static void testContains() {
SeqList seqList = new SeqList();
seqList.add(0, 1);
seqList.add(0, 2);
seqList.add(0, 3);
seqList.add(0, 4);
System.out.println(seqList.contains(2));
}
private static void testSearch() {
SeqList seqList = new SeqList();
seqList.add(0, 1);
seqList.add(0, 2);
seqList.add(0, 3);
seqList.add(0, 4);
seqList.display();
System.out.println(seqList.search(2));
}
private static void testRemove() {
SeqList seqList = new SeqList();
seqList.add(0, 1);
seqList.add(0, 2);
seqList.add(0, 3);
seqList.add(0, 4);
seqList.remove(2);
seqList.display();
}
} | [
"527492225@qq.com"
] | 527492225@qq.com |
26b8d0f84675eea115e09a84ddb052684cbd08a3 | ec57a2d53f7cbaeafa93f27d816930fd509639e2 | /Runescape 530 Client/source/Class67_Sub1_Sub24.java | 797793829b96afbc716a42b54e168eecdbfff577 | [] | no_license | rockseller2/runescape-server-csharp | 4464a97c3fbd083fbb06a83bbb957c34a5c1b7a6 | fae8dfb7f44474ed3b1528cecc0560530ca7c5cd | refs/heads/master | 2021-01-01T16:50:34.062126 | 2013-12-26T09:14:09 | 2013-12-26T09:14:09 | 33,208,230 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,706 | java | /* Class67_Sub1_Sub24 - Decompiled by JODE
* Visit http://jode.sourceforge.net/
*/
public class Class67_Sub1_Sub24 extends Class67_Sub1
{
public static int anInt4191 = 0;
public static int anInt4192;
public int anInt4193;
public int anInt4194;
public static int anInt4195;
public static int anInt4196;
public static RSString aRSString_4197;
public int anInt4198;
public static byte[][][] aByteArrayArrayArray4199;
public static int anInt4200;
public int anInt4201;
public int anInt4202;
public int anInt4203 = 0;
public int anInt4204;
public int anInt4205;
public static int anInt4206;
public int anInt4207;
public static RSString aRSString_4208;
public static RSString aRSString_4209
= Class134.method1914("Clientscript error in: ", (byte) 24);
public static int anInt4210;
public static int anInt4211;
public static int anInt4212;
public static int anInt4213;
public static RSString aRSString_4214
= Class134.method1914("M-Bmoire en cours d(Wattribution", (byte) 11);
public static RSString aRSString_4215;
public static int method730(int arg0, byte arg1, int arg2) {
if ((arg0 ^ 0xffffffff) > (arg2 ^ 0xffffffff)) {
int i = arg0;
arg0 = arg2;
arg2 = i;
}
anInt4212++;
if (arg1 != -97)
aRSString_4197 = null;
int i;
for (/**/; (arg2 ^ 0xffffffff) != -1; arg2 = i) {
i = arg0 % arg2;
arg0 = arg2;
}
return arg0;
}
public Class67_Sub1_Sub24() {
super(1, false);
anInt4202 = 0;
anInt4204 = 0;
}
public void method731(int arg0, int arg1, int arg2, int arg3) {
anInt4206++;
int i = arg1 > arg3 ? arg1 : arg3;
int i_0_ = arg3 > arg1 ? arg1 : arg3;
i = (arg0 ^ 0xffffffff) < (i ^ 0xffffffff) ? arg0 : i;
i_0_ = arg0 >= i_0_ ? i_0_ : arg0;
int i_1_ = i - i_0_;
anInt4207 = (i + i_0_) / 2;
if (anInt4207 > arg2 && anInt4207 < 4096)
anInt4205
= (i_1_ << -603207380) / (anInt4207 <= 2048 ? anInt4207 * 2
: -(anInt4207 * 2) + 8192);
else
anInt4205 = 0;
if (i_1_ > 0) {
int i_2_ = (i - arg3 << -841851700) / i_1_;
int i_3_ = (-arg1 + i << -1686436948) / i_1_;
int i_4_ = (-arg0 + i << -569567700) / i_1_;
if (arg1 != i) {
if ((arg3 ^ 0xffffffff) != (i ^ 0xffffffff))
anInt4193 = i_0_ != arg1 ? -i_3_ + 20480 : i_2_ + 12288;
else
anInt4193 = ((arg0 ^ 0xffffffff) != (i_0_ ^ 0xffffffff)
? 12288 + -i_4_ : i_3_ + 4096);
} else
anInt4193 = arg3 == i_0_ ? 20480 - -i_4_ : 4096 + -i_2_;
anInt4193 /= 6;
} else
anInt4193 = 0;
}
public static void method732(int arg0) {
aRSString_4214 = null;
aRSString_4209 = null;
aByteArrayArrayArray4199 = null;
aRSString_4215 = null;
aRSString_4208 = null;
if (arg0 == 0)
aRSString_4197 = null;
}
public int[][] method624(boolean arg0, int arg1) {
int[][] is = aClass103_2830.method1551(arg1, 112);
anInt4195++;
if (arg0 != true)
return null;
if (aClass103_2830.aBoolean2030) {
int[][] is_5_ = this.method609(arg1, !arg0, 0);
int[] is_6_ = is_5_[1];
int[] is_7_ = is_5_[0];
int[] is_8_ = is[0];
int[] is_9_ = is[2];
int[] is_10_ = is[1];
int[] is_11_ = is_5_[2];
for (int i = 0; i < Class67_Sub5_Sub7.anInt4569; i++) {
method731(is_11_[i], is_7_[i], 0, is_6_[i]);
anInt4207 += anInt4203;
if ((anInt4207 ^ 0xffffffff) > -1)
anInt4207 = 0;
anInt4193 += anInt4204;
if (anInt4207 > 4096)
anInt4207 = 4096;
anInt4205 += anInt4202;
if (anInt4205 < 0)
anInt4205 = 0;
for (/**/; anInt4193 < 0; anInt4193 += 4096) {
/* empty */
}
for (/**/; (anInt4193 ^ 0xffffffff) < -4097;
anInt4193 -= 4096) {
/* empty */
}
if ((anInt4205 ^ 0xffffffff) < -4097)
anInt4205 = 4096;
method735(anInt4205, -28837, anInt4193, anInt4207);
is_8_[i] = anInt4198;
is_10_[i] = anInt4194;
is_9_[i] = anInt4201;
}
}
return is;
}
public void method623(Stream arg0, boolean arg1, int arg2) {
anInt4211++;
if (arg1 == true) {
int i = arg2;
while_145_:
do {
do {
if (i != 0) {
if ((i ^ 0xffffffff) != -2) {
if ((i ^ 0xffffffff) == -3)
break;
break while_145_;
}
} else {
anInt4204 = arg0.readShort2((byte) 109);
return;
}
anInt4202 = (arg0.readByte2((byte) 1) << 99888012) / 100;
return;
} while (false);
anInt4203 = (arg0.readByte2((byte) 1) << 382779276) / 100;
} while (false);
}
}
public static int method733(boolean arg0, int arg1, int arg2) {
anInt4196++;
if ((arg2 ^ 0xffffffff) == 0)
return 12345678;
if (arg0 != false)
method730(31, (byte) -2, 121);
arg1 = (0x7f & arg2) * arg1 >> -1066467865;
if ((arg1 ^ 0xffffffff) <= -3) {
if ((arg1 ^ 0xffffffff) < -127)
arg1 = 126;
} else
arg1 = 2;
return arg1 + (0xff80 & arg2);
}
public static void method734(short[] arg0, int arg1, RSString[] arg2) {
try {
InputStream_Sub1.method52(arg2, arg0, 0, true, -1 + arg2.length);
if (arg1 == -4097)
anInt4210++;
} catch (RuntimeException runtimeexception) {
throw Class67_Sub1_Sub21.method718(runtimeexception,
("qe.J("
+ (arg0 != null ? "{...}"
: "null")
+ ',' + arg1 + ','
+ (arg2 != null ? "{...}"
: "null")
+ ')'));
}
}
public void method735(int arg0, int arg1, int arg2, int arg3) {
anInt4192++;
int i = ((arg3 ^ 0xffffffff) >= -2049
? arg3 * (arg0 + 4096) >> 1238451692
: -(arg3 * arg0 >> 1949070156) + (arg0 + arg3));
while_149_:
do {
if ((i ^ 0xffffffff) < -1) {
int i_12_ = arg3 + arg3 + -i;
int i_13_ = (-i_12_ + i << -789833908) / i;
arg2 *= 6;
int i_14_ = arg2 >> -1056200340;
int i_15_ = i;
i_15_ = i_15_ * i_13_ >> 1158093036;
int i_16_ = -(i_14_ << -967065012) + arg2;
i_15_ = i_15_ * i_16_ >> -587536948;
int i_17_ = -i_15_ + i;
int i_18_ = i_12_ - -i_15_;
int i_19_ = i_14_;
while_148_:
do {
while_147_:
do {
while_146_:
do {
do {
if ((i_19_ ^ 0xffffffff) != -1) {
if ((i_19_ ^ 0xffffffff) != -2) {
if (i_19_ != 2) {
if ((i_19_ ^ 0xffffffff) != -4) {
if (i_19_ != 4) {
if ((i_19_ ^ 0xffffffff)
!= -6)
break while_149_;
} else
break while_147_;
break while_148_;
}
} else
break;
break while_146_;
}
} else {
anInt4194 = i_18_;
anInt4198 = i;
anInt4201 = i_12_;
break while_149_;
}
anInt4198 = i_17_;
anInt4194 = i;
anInt4201 = i_12_;
break while_149_;
} while (false);
anInt4201 = i_18_;
anInt4198 = i_12_;
anInt4194 = i;
break while_149_;
} while (false);
anInt4198 = i_12_;
anInt4194 = i_17_;
anInt4201 = i;
break while_149_;
} while (false);
anInt4201 = i;
anInt4194 = i_12_;
anInt4198 = i_18_;
break while_149_;
} while (false);
anInt4198 = i;
anInt4194 = i_12_;
anInt4201 = i_17_;
} else
anInt4198 = anInt4194 = anInt4201 = arg3;
} while (false);
if (arg1 != -28837)
aRSString_4209 = null;
}
static {
aRSString_4208 = Class134.method1914(":duelstake:", (byte) 42);
aRSString_4215 = Class134.method1914("showingVideoAd", (byte) 12);
aRSString_4197 = Class134.method1914(")0", (byte) 49);
}
}
| [
"pkedpker@gmail.com@fd3b4ddb-cdad-e9e7-605d-ca100c99e9ed"
] | pkedpker@gmail.com@fd3b4ddb-cdad-e9e7-605d-ca100c99e9ed |
7c5e0ade0e14dbc388b29169e50181f86e65f579 | 07276defade104f778e07491eb1bc5412b2e67db | /src/main/java/local/nix/task/management/system/rest/config/security/SecurityConstants.java | 53e1bbed323161b983977a9c3c6853918a62d470 | [] | no_license | granichka/task-management-system | 678264826eef36f8f0050f88d71e1d39d5bcf4c1 | 8bb58e3fcd55ced7bd75fec431ebbd0d4750f8f1 | refs/heads/main | 2022-12-30T08:01:29.971523 | 2020-10-25T12:23:06 | 2020-10-25T12:23:06 | 305,309,585 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 277 | java | package local.nix.task.management.system.rest.config.security;
public final class SecurityConstants {
private SecurityConstants() {
}
public static final String AUTH_TOKEN_PREFIX = "Bearer ";
public static final String AUTHORITIES_CLAIM = "authorities";
}
| [
"rs@MacBook-Air-rs.lan"
] | rs@MacBook-Air-rs.lan |
55e1e1f824a1d5b5b6b91ffe43d1aeec2aaef4db | 6f74b6c91c97b3e18402fc5b2813275f094bf8aa | /rest-locations-service/src/main/java/su/svn/href/dao/LocationFullDao.java | 5eba5269c2a395e0735292b8bbd3d9642f4934ed | [
"Unlicense"
] | permissive | vskurikhin/href-on-spring | 60858b76a64a8689731a448b36d175bca682935d | d9f1da9b6f2524d939d6bddf566cf0b7efa131e5 | refs/heads/master | 2022-11-24T19:21:26.514327 | 2019-05-23T21:09:57 | 2019-05-23T21:09:57 | 179,799,829 | 0 | 0 | Unlicense | 2022-11-16T12:21:41 | 2019-04-06T07:00:25 | Java | UTF-8 | Java | false | false | 435 | java | package su.svn.href.dao;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import su.svn.href.models.dto.LocationDto;
public interface LocationFullDao
{
Mono<LocationDto> findById(long id);
Flux<LocationDto> findAll(int offset, int limit);
Flux<LocationDto> findAll(int offset, int limit, String sortBy);
Flux<LocationDto> findAll(int offset, int limit, String sortBy, boolean descending);
}
| [
"vskurikhin@gmail.com"
] | vskurikhin@gmail.com |
744ffb865c7f0fffa9dda520b5405cc881e1e8dd | f7dc38f0073ecb80948d1a14e2c7f880863b7cec | /src/java/com/android/internal/telephony/gsm/GsmInboundSmsHandler.java | bf3d8c3c5782c9cda695474c1e075dba60da1a33 | [] | no_license | gaokaidong/sms | d0197096508308eda5f5becac84dcb7c6849e3d0 | 71bc91d37537a0503b66a58aa69a458eab531c44 | refs/heads/master | 2020-03-16T08:45:21.279588 | 2018-05-09T11:21:33 | 2018-05-09T11:21:33 | 132,434,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,948 | java | /*
* Copyright (C) 2013 The Android Open Source Project
*
* 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.android.internal.telephony.gsm;
import android.app.Activity;
import android.content.Context;
import android.os.Message;
import android.provider.Telephony.Sms.Intents;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.InboundSmsHandler;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.SmsConstants;
import com.android.internal.telephony.SmsMessageBase;
import com.android.internal.telephony.SmsStorageMonitor;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UsimServiceTable;
/**
* This class broadcasts incoming SMS messages to interested apps after storing them in
* the SmsProvider "raw" table and ACKing them to the SMSC. After each message has been
*/
public class GsmInboundSmsHandler extends InboundSmsHandler {
/** Handler for SMS-PP data download messages to UICC. */
private final UsimDataDownloadHandler mDataDownloadHandler;
/**
* Create a new GSM inbound SMS handler.
*/
private GsmInboundSmsHandler(Context context, SmsStorageMonitor storageMonitor,
Phone phone) {
super("GsmInboundSmsHandler", context, storageMonitor, phone,
GsmCellBroadcastHandler.makeGsmCellBroadcastHandler(context, phone));
phone.mCi.setOnNewGsmSms(getHandler(), EVENT_NEW_SMS, null); //set NEW_SMS message to getHandler
mDataDownloadHandler = new UsimDataDownloadHandler(phone.mCi);
}
/**
* Unregister for GSM SMS.
*/
@Override
protected void onQuitting() {
mPhone.mCi.unSetOnNewGsmSms(getHandler());
mCellBroadcastHandler.dispose();
if (DBG) log("unregistered for 3GPP SMS");
super.onQuitting(); // release wakelock
}
/**
* Wait for state machine to enter startup state. We can't send any messages until then.
*/
public static GsmInboundSmsHandler makeInboundSmsHandler(Context context,
SmsStorageMonitor storageMonitor, Phone phone) {
GsmInboundSmsHandler handler = new GsmInboundSmsHandler(context, storageMonitor, phone);
handler.start();
return handler;
}
/**
* Return true if this handler is for 3GPP2 messages; false for 3GPP format.
* @return false (3GPP)
*/
@Override
protected boolean is3gpp2() {
return false;
}
/**
* Handle type zero, SMS-PP data download, and 3GPP/CPHS MWI type SMS. Normal SMS messages
* are handled by {@link #dispatchNormalMessage} in parent class.
*
* @param smsb the SmsMessageBase object from the RIL
* @return a result code from {@link android.provider.Telephony.Sms.Intents},
* or {@link Activity#RESULT_OK} for delayed acknowledgment to SMSC
*/
@Override
protected int dispatchMessageRadioSpecific(SmsMessageBase smsb) {
SmsMessage sms = (SmsMessage) smsb;
if (sms.isTypeZero()) {
// As per 3GPP TS 23.040 9.2.3.9, Type Zero messages should not be
// Displayed/Stored/Notified. They should only be acknowledged.
log("Received short message type 0, Don't display or store it. Send Ack");
return Intents.RESULT_SMS_HANDLED;
}
// Send SMS-PP data download messages to UICC. See 3GPP TS 31.111 section 7.1.1.
if (sms.isUsimDataDownload()) {
UsimServiceTable ust = mPhone.getUsimServiceTable();
return mDataDownloadHandler.handleUsimDataDownload(ust, sms);
}
boolean handled = false;
if (sms.isMWISetMessage()) {
updateMessageWaitingIndicator(sms.getNumOfVoicemails());
handled = sms.isMwiDontStore();
if (DBG) log("Received voice mail indicator set SMS shouldStore=" + !handled);
} else if (sms.isMWIClearMessage()) {
updateMessageWaitingIndicator(0);
handled = sms.isMwiDontStore();
if (DBG) log("Received voice mail indicator clear SMS shouldStore=" + !handled);
}
if (handled) {
return Intents.RESULT_SMS_HANDLED;
}
if (!mStorageMonitor.isStorageAvailable() &&
sms.getMessageClass() != SmsConstants.MessageClass.CLASS_0) {
// It's a storable message and there's no storage available. Bail.
// (See TS 23.038 for a description of class 0 messages.)
return Intents.RESULT_SMS_OUT_OF_MEMORY;
}
return dispatchNormalMessage(smsb);
}
private void updateMessageWaitingIndicator(int voicemailCount) {
// range check
if (voicemailCount < 0) {
voicemailCount = -1;
} else if (voicemailCount > 0xff) {
// TS 23.040 9.2.3.24.2
// "The value 255 shall be taken to mean 255 or greater"
voicemailCount = 0xff;
}
// update voice mail count in Phone
mPhone.setVoiceMessageCount(voicemailCount);
// store voice mail count in SIM & shared preferences
IccRecords records = UiccController.getInstance().getIccRecords(
mPhone.getPhoneId(), UiccController.APP_FAM_3GPP);
if (records != null) {
log("updateMessageWaitingIndicator: updating SIM Records");
records.setVoiceMessageWaiting(1, voicemailCount);
} else {
log("updateMessageWaitingIndicator: SIM Records not found");
}
}
/**
* Send an acknowledge message.
* @param success indicates that last message was successfully received.
* @param result result code indicating any error
* @param response callback message sent when operation completes.
*/
@Override
protected void acknowledgeLastIncomingSms(boolean success, int result, Message response) {
mPhone.mCi.acknowledgeLastIncomingGsmSms(success, resultToCause(result), response);
}
/**
* Called when the phone changes the default method updates mPhone
* mStorageMonitor and mCellBroadcastHandler.updatePhoneObject.
* Override if different or other behavior is desired.
*
* @param phone
*/
@Override
protected void onUpdatePhoneObject(Phone phone) {
super.onUpdatePhoneObject(phone);
log("onUpdatePhoneObject: dispose of old CellBroadcastHandler and make a new one");
mCellBroadcastHandler.dispose();
mCellBroadcastHandler = GsmCellBroadcastHandler
.makeGsmCellBroadcastHandler(mContext, phone);
}
/**
* Convert Android result code to 3GPP SMS failure cause.
* @param rc the Android SMS intent result value
* @return 0 for success, or a 3GPP SMS failure cause value
*/
private static int resultToCause(int rc) {
switch (rc) {
case Activity.RESULT_OK:
case Intents.RESULT_SMS_HANDLED:
// Cause code is ignored on success.
return 0;
case Intents.RESULT_SMS_OUT_OF_MEMORY:
return CommandsInterface.GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED;
case Intents.RESULT_SMS_GENERIC_ERROR:
default:
return CommandsInterface.GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR;
}
}
}
| [
"33141752+gaokaidong@users.noreply.github.com"
] | 33141752+gaokaidong@users.noreply.github.com |
3e94d0f4204917374887e141ac1115b8345470cf | 21e9a02e2af5a338aa8bf0fed81bf1cf57fc72af | /00_RPCServer/src/cn/cx/Services/Product.java | 92a99f29e2f4057e72175f7f038a3e43af0fd0a8 | [] | no_license | seuwan/RPC_in_Java | cd01d2b53c82d1052fa110217c819fbb46c6c66d | 5a1f7d28406aa10864682f7431133d4415020e4c | refs/heads/master | 2020-12-28T22:12:16.986596 | 2016-07-16T07:05:50 | 2016-07-16T07:05:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | package cn.cx.Services;
import java.io.Serializable;
public interface Product extends Serializable{
public String getProductID();
}
| [
"jobcoinx@163.com"
] | jobcoinx@163.com |
821ea2c9415f5ddbf994f9f114bd2ec9a947df37 | ef746c4cb30362f06e50af996a178b0c74202e28 | /src/test/AdminDao.java | dc732163ceec7f63e94f50a4c540ad2090c1f121 | [] | no_license | Hachi9528/SwingDemo | 4a4e597794411a5707db26f40cb7bdf62300d227 | 3dc1a96a7465b5af9260ac32d788e39528c611b9 | refs/heads/master | 2021-04-03T06:15:37.102957 | 2018-03-11T10:14:06 | 2018-03-11T10:14:06 | 124,744,825 | 0 | 0 | null | 2018-03-11T10:17:41 | 2018-03-11T10:17:41 | null | UTF-8 | Java | false | false | 3,417 | java | import main.java.model.StuEntity;
import main.java.util.DbUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class AdminDao {
public void AddStu(String xh, String xm, String xb, String csrq,
String jg, String mima) throws SQLException {
DbUtil dbUtil = new DbUtil();
String sql = "insert into stu values (?, ?, ?, ?, ?, ?)";
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
conn = dbUtil.getConn();
ps = conn.prepareStatement(sql);
ps.setString(1, xh);
ps.setString(2, xm);
ps.setString(3, xb);
ps.setString(4, csrq);
ps.setString(5, jg);
ps.setString(6, mima);
ps.execute();
} catch (Exception e) {
e.printStackTrace();
} finally {
conn.close();
}
}
public void DeleteStu(String xh) throws SQLException {
DbUtil dbUtil = new DbUtil();
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "DELETE FROM stu WHERE stu.xh=?";
try {
conn = dbUtil.getConn();
ps = conn.prepareStatement(sql);
ps.setString(1, xh);
ps.execute();
} catch (Exception e) {
e.printStackTrace();
} finally {
conn.close();
}
}
public StuEntity getStuInfo(String xh) {
StuEntity stuEntity = new StuEntity();
DbUtil dbUtil = new DbUtil();
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from stu where stu.xh=?";
try {
conn = dbUtil.getConn();
ps = conn.prepareStatement(sql);
ps.setString(1, xh);
rs = ps.executeQuery();
while (rs.next()) {
stuEntity.setXh(rs.getString(1));
stuEntity.setXm(rs.getString(2));
stuEntity.setXb(rs.getString(3));
stuEntity.setCsrq(rs.getString(4));
stuEntity.setJg(rs.getString(5));
}
} catch (Exception e) {
e.printStackTrace();
}
return stuEntity;
}
public List<StuEntity> getAllStuInfo() {
List<StuEntity> lst = new ArrayList<StuEntity>();
DbUtil dbUtil = new DbUtil();
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from stu";
try {
conn = dbUtil.getConn();
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
StuEntity stuEntity = new StuEntity();
stuEntity.setXh(rs.getString(1));
stuEntity.setXm(rs.getString(2));
stuEntity.setXb(rs.getString(3));
stuEntity.setCsrq(rs.getString(4));
stuEntity.setJg(rs.getString(5));
lst.add(stuEntity);
}
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return lst;
}
}
| [
"xiaoyuechuanz@163.com"
] | xiaoyuechuanz@163.com |
133674e497f2a22a9d2046c7288a769ae2f65de7 | 957789c8a78f727b52ed0b78ad8d2caf084bad2c | /lab3/PigletParserTokenManager.java | 8cb64aebc9b9c8dabe81556a921711c392874a97 | [] | no_license | headacheboy/minijava_compiler | a77d47a49511befd41303a50f756d6641b884878 | cbb40e856d4532e4f2a7ba64ae405980bba38c86 | refs/heads/master | 2020-03-09T06:59:49.357626 | 2018-11-06T16:29:19 | 2018-11-06T16:29:19 | 128,654,090 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 29,156 | java | /* PigletParserTokenManager.java */
/* Generated By:JavaCC: Do not edit this line. PigletParserTokenManager.java */
import syntaxtree.*;
import java.util.Vector;
/** Token Manager. */
@SuppressWarnings("unused")public class PigletParserTokenManager implements PigletParserConstants {
/** Debug output. */
public static java.io.PrintStream debugStream = System.out;
/** Set debug output. */
public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private static final int jjStopStringLiteralDfa_0(int pos, long active0){
switch (pos)
{
case 0:
if ((active0 & 0x3fffffff0000L) != 0L)
{
jjmatchedKind = 47;
return 4;
}
return -1;
case 1:
if ((active0 & 0x3ffffdc00000L) != 0L)
{
jjmatchedKind = 47;
jjmatchedPos = 1;
return 4;
}
if ((active0 & 0x23f0000L) != 0L)
return 4;
return -1;
case 2:
if ((active0 & 0x17ff78c00000L) != 0L)
{
jjmatchedKind = 47;
jjmatchedPos = 2;
return 4;
}
if ((active0 & 0x280085000000L) != 0L)
return 4;
return -1;
case 3:
if ((active0 & 0x77848800000L) != 0L)
{
jjmatchedKind = 47;
jjmatchedPos = 3;
return 4;
}
if ((active0 & 0x108730400000L) != 0L)
return 4;
return -1;
case 4:
if ((active0 & 0x53808800000L) != 0L)
return 4;
if ((active0 & 0x24040000000L) != 0L)
{
jjmatchedKind = 47;
jjmatchedPos = 4;
return 4;
}
return -1;
case 5:
if ((active0 & 0x24000000000L) != 0L)
return 4;
if ((active0 & 0x40000000L) != 0L)
{
jjmatchedKind = 47;
jjmatchedPos = 5;
return 4;
}
return -1;
case 6:
if ((active0 & 0x40000000L) != 0L)
{
jjmatchedKind = 47;
jjmatchedPos = 6;
return 4;
}
return -1;
case 7:
if ((active0 & 0x40000000L) != 0L)
{
jjmatchedKind = 47;
jjmatchedPos = 7;
return 4;
}
return -1;
default :
return -1;
}
}
private static final int jjStartNfa_0(int pos, long active0){
return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
}
static private int jjStopAtPos(int pos, int kind)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
return pos + 1;
}
static private int jjMoveStringLiteralDfa0_0(){
switch(curChar)
{
case 40:
return jjStopAtPos(0, 9);
case 41:
return jjStopAtPos(0, 10);
case 46:
return jjStopAtPos(0, 15);
case 65:
return jjMoveStringLiteralDfa1_0(0x200001000000L);
case 66:
return jjMoveStringLiteralDfa1_0(0x2000000000L);
case 67:
return jjMoveStringLiteralDfa1_0(0x10420000000L);
case 69:
return jjMoveStringLiteralDfa1_0(0x880200000L);
case 71:
return jjMoveStringLiteralDfa1_0(0xc0000L);
case 72:
return jjMoveStringLiteralDfa1_0(0x60040000000L);
case 74:
return jjMoveStringLiteralDfa1_0(0x8000000000L);
case 76:
return jjMoveStringLiteralDfa1_0(0x30000L);
case 77:
return jjMoveStringLiteralDfa1_0(0x80210800000L);
case 78:
return jjMoveStringLiteralDfa1_0(0x104100000L);
case 79:
return jjMoveStringLiteralDfa1_0(0x2000000L);
case 80:
return jjMoveStringLiteralDfa1_0(0x1000400000L);
case 82:
return jjMoveStringLiteralDfa1_0(0x4000000000L);
case 84:
return jjMoveStringLiteralDfa1_0(0x100008000000L);
case 91:
return jjStopAtPos(0, 13);
case 93:
return jjStopAtPos(0, 14);
case 123:
return jjStopAtPos(0, 11);
case 125:
return jjStopAtPos(0, 12);
default :
return jjMoveNfa_0(0, 0);
}
}
static private int jjMoveStringLiteralDfa1_0(long active0){
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(0, active0);
return 1;
}
switch(curChar)
{
case 65:
return jjMoveStringLiteralDfa2_0(active0, 0x450000000L);
case 69:
if ((active0 & 0x20000L) != 0L)
return jjStartNfaWithStates_0(1, 17, 4);
else if ((active0 & 0x80000L) != 0L)
return jjStartNfaWithStates_0(1, 19, 4);
else if ((active0 & 0x100000L) != 0L)
return jjStartNfaWithStates_0(1, 20, 4);
return jjMoveStringLiteralDfa2_0(active0, 0x186000000000L);
case 73:
return jjMoveStringLiteralDfa2_0(active0, 0x8800000L);
case 74:
return jjMoveStringLiteralDfa2_0(active0, 0x10000000000L);
case 76:
return jjMoveStringLiteralDfa2_0(active0, 0x40000400000L);
case 78:
return jjMoveStringLiteralDfa2_0(active0, 0x81000000L);
case 79:
return jjMoveStringLiteralDfa2_0(active0, 0x324000000L);
case 81:
if ((active0 & 0x200000L) != 0L)
return jjStartNfaWithStates_0(1, 21, 4);
break;
case 82:
if ((active0 & 0x2000000L) != 0L)
return jjStartNfaWithStates_0(1, 25, 4);
return jjMoveStringLiteralDfa2_0(active0, 0x201800000000L);
case 83:
return jjMoveStringLiteralDfa2_0(active0, 0x20000000000L);
case 84:
if ((active0 & 0x10000L) != 0L)
return jjStartNfaWithStates_0(1, 16, 4);
else if ((active0 & 0x40000L) != 0L)
return jjStartNfaWithStates_0(1, 18, 4);
break;
case 85:
return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L);
default :
break;
}
return jjStartNfa_0(0, active0);
}
static private int jjMoveStringLiteralDfa2_0(long old0, long active0){
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
return 2;
}
switch(curChar)
{
case 68:
if ((active0 & 0x1000000L) != 0L)
return jjStartNfaWithStates_0(2, 24, 4);
else if ((active0 & 0x80000000L) != 0L)
return jjStartNfaWithStates_0(2, 31, 4);
return jjMoveStringLiteralDfa3_0(active0, 0x20000000L);
case 71:
if ((active0 & 0x200000000000L) != 0L)
return jjStartNfaWithStates_0(2, 45, 4);
return jjMoveStringLiteralDfa3_0(active0, 0x2000000000L);
case 73:
return jjMoveStringLiteralDfa3_0(active0, 0x1010000000L);
case 76:
return jjMoveStringLiteralDfa3_0(active0, 0x440000000L);
case 77:
if ((active0 & 0x80000000000L) != 0L)
return jjStartNfaWithStates_0(2, 43, 4);
return jjMoveStringLiteralDfa3_0(active0, 0x108008000000L);
case 78:
return jjMoveStringLiteralDfa3_0(active0, 0x800000L);
case 79:
return jjMoveStringLiteralDfa3_0(active0, 0x40100000000L);
case 82:
return jjMoveStringLiteralDfa3_0(active0, 0x800000000L);
case 84:
if ((active0 & 0x4000000L) != 0L)
return jjStartNfaWithStates_0(2, 26, 4);
return jjMoveStringLiteralDfa3_0(active0, 0x24000000000L);
case 85:
return jjMoveStringLiteralDfa3_0(active0, 0x10000400000L);
case 86:
return jjMoveStringLiteralDfa3_0(active0, 0x200000000L);
default :
break;
}
return jjStartNfa_0(1, active0);
}
static private int jjMoveStringLiteralDfa3_0(long old0, long active0){
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
return 3;
}
switch(curChar)
{
case 65:
return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L);
case 69:
if ((active0 & 0x20000000L) != 0L)
return jjStartNfaWithStates_0(3, 29, 4);
else if ((active0 & 0x200000000L) != 0L)
return jjStartNfaWithStates_0(3, 33, 4);
return jjMoveStringLiteralDfa4_0(active0, 0x8000000L);
case 73:
return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L);
case 76:
if ((active0 & 0x400000000L) != 0L)
return jjStartNfaWithStates_0(3, 34, 4);
return jjMoveStringLiteralDfa4_0(active0, 0x40000000L);
case 77:
return jjMoveStringLiteralDfa4_0(active0, 0x10000000000L);
case 78:
if ((active0 & 0x10000000L) != 0L)
return jjStartNfaWithStates_0(3, 28, 4);
return jjMoveStringLiteralDfa4_0(active0, 0x1000000000L);
case 79:
return jjMoveStringLiteralDfa4_0(active0, 0x20800000000L);
case 80:
if ((active0 & 0x100000000L) != 0L)
return jjStartNfaWithStates_0(3, 32, 4);
else if ((active0 & 0x8000000000L) != 0L)
return jjStartNfaWithStates_0(3, 39, 4);
else if ((active0 & 0x100000000000L) != 0L)
return jjStartNfaWithStates_0(3, 44, 4);
break;
case 83:
if ((active0 & 0x400000L) != 0L)
return jjStartNfaWithStates_0(3, 22, 4);
break;
case 85:
return jjMoveStringLiteralDfa4_0(active0, 0x4000800000L);
default :
break;
}
return jjStartNfa_0(2, active0);
}
static private int jjMoveStringLiteralDfa4_0(long old0, long active0){
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
return 4;
}
switch(curChar)
{
case 68:
if ((active0 & 0x40000000000L) != 0L)
return jjStartNfaWithStates_0(4, 42, 4);
break;
case 78:
if ((active0 & 0x2000000000L) != 0L)
return jjStartNfaWithStates_0(4, 37, 4);
break;
case 79:
return jjMoveStringLiteralDfa5_0(active0, 0x40000000L);
case 80:
if ((active0 & 0x10000000000L) != 0L)
return jjStartNfaWithStates_0(4, 40, 4);
break;
case 82:
if ((active0 & 0x800000000L) != 0L)
return jjStartNfaWithStates_0(4, 35, 4);
return jjMoveStringLiteralDfa5_0(active0, 0x24000000000L);
case 83:
if ((active0 & 0x800000L) != 0L)
return jjStartNfaWithStates_0(4, 23, 4);
else if ((active0 & 0x8000000L) != 0L)
return jjStartNfaWithStates_0(4, 27, 4);
break;
case 84:
if ((active0 & 0x1000000000L) != 0L)
return jjStartNfaWithStates_0(4, 36, 4);
break;
default :
break;
}
return jjStartNfa_0(3, active0);
}
static private int jjMoveStringLiteralDfa5_0(long old0, long active0){
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(3, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0);
return 5;
}
switch(curChar)
{
case 67:
return jjMoveStringLiteralDfa6_0(active0, 0x40000000L);
case 69:
if ((active0 & 0x20000000000L) != 0L)
return jjStartNfaWithStates_0(5, 41, 4);
break;
case 78:
if ((active0 & 0x4000000000L) != 0L)
return jjStartNfaWithStates_0(5, 38, 4);
break;
default :
break;
}
return jjStartNfa_0(4, active0);
}
static private int jjMoveStringLiteralDfa6_0(long old0, long active0){
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(4, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(5, active0);
return 6;
}
switch(curChar)
{
case 65:
return jjMoveStringLiteralDfa7_0(active0, 0x40000000L);
default :
break;
}
return jjStartNfa_0(5, active0);
}
static private int jjMoveStringLiteralDfa7_0(long old0, long active0){
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0);
return 7;
}
switch(curChar)
{
case 84:
return jjMoveStringLiteralDfa8_0(active0, 0x40000000L);
default :
break;
}
return jjStartNfa_0(6, active0);
}
static private int jjMoveStringLiteralDfa8_0(long old0, long active0){
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(6, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0);
return 8;
}
switch(curChar)
{
case 69:
if ((active0 & 0x40000000L) != 0L)
return jjStartNfaWithStates_0(8, 30, 4);
break;
default :
break;
}
return jjStartNfa_0(7, active0);
}
static private int jjStartNfaWithStates_0(int pos, int kind, int state)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return pos + 1; }
return jjMoveNfa_0(state, pos + 1);
}
static final long[] jjbitVec0 = {
0x1ff00000fffffffeL, 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L
};
static final long[] jjbitVec2 = {
0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
};
static final long[] jjbitVec3 = {
0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static final long[] jjbitVec4 = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L
};
static final long[] jjbitVec5 = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0x0L, 0x0L
};
static final long[] jjbitVec6 = {
0x3fffffffffffL, 0x0L, 0x0L, 0x0L
};
static final long[] jjbitVec7 = {
0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static final long[] jjbitVec8 = {
0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static private int jjMoveNfa_0(int startState, int curPos)
{
int startsAt = 0;
jjnewStateCnt = 24;
int i = 1;
jjstateSet[0] = startState;
int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64)
{
long l = 1L << curChar;
do
{
switch(jjstateSet[--i])
{
case 0:
if ((0x3fe000000000000L & l) != 0L)
{
if (kind > 46)
kind = 46;
{ jjCheckNAdd(1); }
}
else if (curChar == 47)
{ jjAddStates(0, 2); }
else if (curChar == 36)
{
if (kind > 47)
kind = 47;
{ jjCheckNAdd(4); }
}
else if (curChar == 48)
{
if (kind > 46)
kind = 46;
}
break;
case 1:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 46)
kind = 46;
{ jjCheckNAdd(1); }
break;
case 2:
if (curChar == 48 && kind > 46)
kind = 46;
break;
case 3:
if (curChar != 36)
break;
if (kind > 47)
kind = 47;
{ jjCheckNAdd(4); }
break;
case 4:
if ((0x3ff001000000000L & l) == 0L)
break;
if (kind > 47)
kind = 47;
{ jjCheckNAdd(4); }
break;
case 5:
if (curChar == 47)
{ jjAddStates(0, 2); }
break;
case 6:
if (curChar == 47)
{ jjCheckNAddStates(3, 5); }
break;
case 7:
if ((0xffffffffffffdbffL & l) != 0L)
{ jjCheckNAddStates(3, 5); }
break;
case 8:
if ((0x2400L & l) != 0L && kind > 6)
kind = 6;
break;
case 9:
if (curChar == 10 && kind > 6)
kind = 6;
break;
case 10:
if (curChar == 13)
jjstateSet[jjnewStateCnt++] = 9;
break;
case 11:
if (curChar == 42)
{ jjCheckNAddTwoStates(12, 13); }
break;
case 12:
if ((0xfffffbffffffffffL & l) != 0L)
{ jjCheckNAddTwoStates(12, 13); }
break;
case 13:
if (curChar == 42)
{ jjCheckNAddStates(6, 8); }
break;
case 14:
if ((0xffff7bffffffffffL & l) != 0L)
{ jjCheckNAddTwoStates(15, 13); }
break;
case 15:
if ((0xfffffbffffffffffL & l) != 0L)
{ jjCheckNAddTwoStates(15, 13); }
break;
case 16:
if (curChar == 47 && kind > 7)
kind = 7;
break;
case 17:
if (curChar == 42)
jjstateSet[jjnewStateCnt++] = 11;
break;
case 18:
if (curChar == 42)
{ jjCheckNAddTwoStates(19, 20); }
break;
case 19:
if ((0xfffffbffffffffffL & l) != 0L)
{ jjCheckNAddTwoStates(19, 20); }
break;
case 20:
if (curChar == 42)
{ jjCheckNAddStates(9, 11); }
break;
case 21:
if ((0xffff7bffffffffffL & l) != 0L)
{ jjCheckNAddTwoStates(22, 20); }
break;
case 22:
if ((0xfffffbffffffffffL & l) != 0L)
{ jjCheckNAddTwoStates(22, 20); }
break;
case 23:
if (curChar == 47 && kind > 8)
kind = 8;
break;
default : break;
}
} while(i != startsAt);
}
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 0:
case 4:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
if (kind > 47)
kind = 47;
{ jjCheckNAdd(4); }
break;
case 7:
{ jjAddStates(3, 5); }
break;
case 12:
{ jjCheckNAddTwoStates(12, 13); }
break;
case 14:
case 15:
{ jjCheckNAddTwoStates(15, 13); }
break;
case 19:
{ jjCheckNAddTwoStates(19, 20); }
break;
case 21:
case 22:
{ jjCheckNAddTwoStates(22, 20); }
break;
default : break;
}
} while(i != startsAt);
}
else
{
int hiByte = (curChar >> 8);
int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 0:
case 4:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 47)
kind = 47;
{ jjCheckNAdd(4); }
break;
case 7:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
{ jjAddStates(3, 5); }
break;
case 12:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
{ jjCheckNAddTwoStates(12, 13); }
break;
case 14:
case 15:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
{ jjCheckNAddTwoStates(15, 13); }
break;
case 19:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
{ jjCheckNAddTwoStates(19, 20); }
break;
case 21:
case 22:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
{ jjCheckNAddTwoStates(22, 20); }
break;
default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break;
}
} while(i != startsAt);
}
if (kind != 0x7fffffff)
{
jjmatchedKind = kind;
jjmatchedPos = curPos;
kind = 0x7fffffff;
}
++curPos;
if ((i = jjnewStateCnt) == (startsAt = 24 - (jjnewStateCnt = startsAt)))
return curPos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
}
static final int[] jjnextStates = {
6, 17, 18, 7, 8, 10, 13, 14, 16, 20, 21, 23,
};
private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec2[i2] & l2) != 0L);
case 48:
return ((jjbitVec3[i2] & l2) != 0L);
case 49:
return ((jjbitVec4[i2] & l2) != 0L);
case 51:
return ((jjbitVec5[i2] & l2) != 0L);
case 61:
return ((jjbitVec6[i2] & l2) != 0L);
default :
if ((jjbitVec0[i1] & l1) != 0L)
return true;
return false;
}
}
private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec8[i2] & l2) != 0L);
default :
if ((jjbitVec7[i1] & l1) != 0L)
return true;
return false;
}
}
/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, "\50", "\51", "\173",
"\175", "\133", "\135", "\56", "\114\124", "\114\105", "\107\124", "\107\105",
"\116\105", "\105\121", "\120\114\125\123", "\115\111\116\125\123", "\101\116\104",
"\117\122", "\116\117\124", "\124\111\115\105\123", "\115\101\111\116",
"\103\117\104\105", "\110\101\114\114\117\103\101\124\105", "\105\116\104", "\116\117\117\120",
"\115\117\126\105", "\103\101\114\114", "\105\122\122\117\122", "\120\122\111\116\124",
"\102\105\107\111\116", "\122\105\124\125\122\116", "\112\125\115\120", "\103\112\125\115\120",
"\110\123\124\117\122\105", "\110\114\117\101\104", "\115\105\115", "\124\105\115\120", "\101\122\107",
null, null, null, null, };
static protected Token jjFillToken()
{
final Token t;
final String curTokenImage;
final int beginLine;
final int endLine;
final int beginColumn;
final int endColumn;
String im = jjstrLiteralImages[jjmatchedKind];
curTokenImage = (im == null) ? input_stream.GetImage() : im;
beginLine = input_stream.getBeginLine();
beginColumn = input_stream.getBeginColumn();
endLine = input_stream.getEndLine();
endColumn = input_stream.getEndColumn();
t = Token.newToken(jjmatchedKind, curTokenImage);
t.beginLine = beginLine;
t.endLine = endLine;
t.beginColumn = beginColumn;
t.endColumn = endColumn;
return t;
}
static int curLexState = 0;
static int defaultLexState = 0;
static int jjnewStateCnt;
static int jjround;
static int jjmatchedPos;
static int jjmatchedKind;
/** Get the next Token. */
public static Token getNextToken()
{
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(java.io.IOException e)
{
jjmatchedKind = 0;
jjmatchedPos = -1;
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
try { input_stream.backup(0);
while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
curChar = input_stream.BeginToken();
}
catch (java.io.IOException e1) { continue EOFLoop; }
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
else
{
if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
if (specialToken == null)
specialToken = matchedToken;
else
{
matchedToken.specialToken = specialToken;
specialToken = (specialToken.next = matchedToken);
}
}
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (java.io.IOException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
}
static private void jjCheckNAdd(int state)
{
if (jjrounds[state] != jjround)
{
jjstateSet[jjnewStateCnt++] = state;
jjrounds[state] = jjround;
}
}
static private void jjAddStates(int start, int end)
{
do {
jjstateSet[jjnewStateCnt++] = jjnextStates[start];
} while (start++ != end);
}
static private void jjCheckNAddTwoStates(int state1, int state2)
{
jjCheckNAdd(state1);
jjCheckNAdd(state2);
}
static private void jjCheckNAddStates(int start, int end)
{
do {
jjCheckNAdd(jjnextStates[start]);
} while (start++ != end);
}
/** Constructor. */
public PigletParserTokenManager(JavaCharStream stream){
if (input_stream != null)
throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR);
input_stream = stream;
}
/** Constructor. */
public PigletParserTokenManager (JavaCharStream stream, int lexState){
ReInit(stream);
SwitchTo(lexState);
}
/** Reinitialise parser. */
static public void ReInit(JavaCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;
curLexState = defaultLexState;
input_stream = stream;
ReInitRounds();
}
static private void ReInitRounds()
{
int i;
jjround = 0x80000001;
for (i = 24; i-- > 0;)
jjrounds[i] = 0x80000000;
}
/** Reinitialise parser. */
static public void ReInit(JavaCharStream stream, int lexState)
{
ReInit(stream);
SwitchTo(lexState);
}
/** Switch to specified lex state. */
static public void SwitchTo(int lexState)
{
if (lexState >= 1 || lexState < 0)
throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
else
curLexState = lexState;
}
/** Lexer state names. */
public static final String[] lexStateNames = {
"DEFAULT",
};
static final long[] jjtoToken = {
0xfffffffffe01L,
};
static final long[] jjtoSkip = {
0x1feL,
};
static final long[] jjtoSpecial = {
0x1c0L,
};
static protected JavaCharStream input_stream;
static private final int[] jjrounds = new int[24];
static private final int[] jjstateSet = new int[2 * 24];
static protected char curChar;
}
| [
"wukgdu365@yahoo.com"
] | wukgdu365@yahoo.com |
a3ae03b05020306e297768f997059e4d05bde2bb | 68e4d84433775e26caecbc2dd49ab18544250341 | /myMusicPlayer21/src/main/java/com/kojimahome/music21/ScanningProgress.java | 62f311c68a39376fe167dd2a3af3f7d5bce20bde | [
"Apache-2.0"
] | permissive | cojcoj/abrepeatplayer_androidstudio | 93933506830b949fa38dcdca2abfc41f0dff0d2a | 838ff2f90a7273dd98ea5b57e3dfdc0b1bf13edb | refs/heads/master | 2016-09-05T12:05:34.121772 | 2015-06-12T04:54:06 | 2015-06-12T04:54:06 | 29,945,260 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,062 | java | /*
* Copyright (C) 2008 The Android Open Source Project
*
* 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.kojimahome.music21;
import com.kojimahome.music21.R;
import com.kojimahome.music21.R.layout;
import android.app.Activity;
import android.database.Cursor;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.view.Window;
import android.view.WindowManager;
public class ScanningProgress extends Activity
{
private final static int CHECK = 0;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg)
{
if (msg.what == CHECK) {
String status = Environment.getExternalStorageState();
if (!status.equals(Environment.MEDIA_MOUNTED)) {
// If the card suddenly got unmounted again, there's
// really no need to keep waiting for the media scanner.
finish();
return;
}
Cursor c = MusicUtils.query(ScanningProgress.this,
MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
null, null, null, null);
if (c != null) {
// The external media database is now ready for querying
// (though it may still be in the process of being filled).
c.close();
setResult(RESULT_OK);
finish();
return;
}
Message next = obtainMessage(CHECK);
sendMessageDelayed(next, 3000);
}
}
};
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.scanning);
getWindow().setLayout(WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT);
setResult(RESULT_CANCELED);
Message msg = mHandler.obtainMessage(CHECK);
mHandler.sendMessageDelayed(msg, 1000);
}
@Override
public void onDestroy() {
mHandler.removeMessages(CHECK);
super.onDestroy();
}
}
| [
"support-032751@learnerstechlab.com"
] | support-032751@learnerstechlab.com |
2b1a5ebafd95021e3f4034675fc1e2c7f82a4f39 | fb8685fd6a853003ec0408ad850403e243d2e722 | /src/com/info/Scene.java | 7905bc64b4ca26a9eec0ef23d1fa2bf4f76caaf3 | [] | no_license | LKF123LKF/SosoDemo | 08d250be787d26028093c52135f77f4c2e69c3e9 | 5f1a16b19b0ad84f9e064842ed9a21a938dd6080 | refs/heads/master | 2020-04-25T03:02:52.389733 | 2019-02-25T08:11:36 | 2019-02-25T08:11:36 | 172,462,487 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 357 | java | package com.info;
// 使用场景
public class Scene {
public String type;//场景类型
public int data;//场景消费数据
public String description;//场景描述
public Scene() {
super();
}
public Scene(String type, int data, String description) {
super();
this.type = type;
this.data = data;
this.description = description;
}
}
| [
"31716525+3247361336@users.noreply.github.com"
] | 31716525+3247361336@users.noreply.github.com |
33bd2fecb2a456ec42806e0cc86cd413bd8bf39e | 5dab031213edcef60650c0aa409678bdaec3f015 | /app/src/main/java/com/vehicles/rainervieira/vehicles/ScreenSlidePagerActivity.java | d5e7644664cd6faf2e0ce024ac2078f237c87dc1 | [] | no_license | Rainermv/tarefavehicles | d13bd297b38670e61e138d870a2f39f7fd4f6609 | c23497a8420bed50087fca71f4ba4a95ae585f83 | refs/heads/master | 2021-01-20T22:34:33.484698 | 2016-07-05T13:25:38 | 2016-07-05T13:25:38 | 62,593,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,489 | java | package com.vehicles.rainervieira.vehicles;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
/**
* Created by Rainer on 05/07/2016.
*/
public class ScreenSlidePagerActivity extends FragmentActivity {
/**
* The number of pages (wizard steps) to show in this demo.
*/
private static final int NUM_PAGES = 2;
/**
* The pager widget, which handles animation and allows swiping horizontally to access previous
* and next wizard steps.
*/
private ViewPager mPager;
/**
* The pager adapter, which provides the pages to the view pager widget.
*/
private PagerAdapter mPagerAdapter;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_screen_slide);
// Instantiate a ViewPger and a PagerAdapter
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
}
@Override
public void onBackPressed(){
if (mPager.getCurrentItem() == 0){
// If the user is currently looking at the first step, allow the system to handle the
// Back button. This calls finish() on this activity and pops the back stack.
super.onBackPressed();
}
else {
// Otherwise, select the previous step.
mPager.setCurrentItem(mPager.getCurrentItem() -1);
}
}
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter{
public ScreenSlidePagerAdapter (FragmentManager fm){
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
return new ScreenSlidePageFragment();
case 1:
return new InsertFragment();
}
return new ScreenSlidePageFragment();
}
@Override
public int getCount() {
return NUM_PAGES;
}
}
}
/**
* A simple pager adapter that represents 5 ScreenSlidePageFragment objects, in
* sequence.
*/
| [
"rainermv@gmail.com"
] | rainermv@gmail.com |
93ba9cf16122b02c0857490620edec03e5470192 | 2dfc424bfe0406dc8e79836b48e24e71e2d23982 | /cl-service/src/main/java/com/checklod/service/FrontDTO.java | 95af1c7cd8fff5dc4a49a9c9ce4451a57c691489 | [] | no_license | netmaniarnd/cl-webapp | 83aa837aff3fcb8e1928dc27c40c6ef59cf1761f | dcc95c5d8bfdd4f4c2519ae40fedf60ae22eae69 | refs/heads/master | 2022-12-22T06:20:42.628309 | 2020-09-14T07:53:49 | 2020-09-14T07:53:49 | 290,421,578 | 0 | 1 | null | 2021-12-26T23:24:07 | 2020-08-26T07:02:42 | Java | UTF-8 | Java | false | false | 321 | java | package com.checklod.service;
import java.util.List;
import com.checklod.api_repo.VehicleSummary;
import lombok.Data;
@Data
public class FrontDTO {
private FrontSummary frontSummary;
private List<VehicleSummary> vehicleSummary;
private VehicleSummary dailySummary;
private List<Long> runAways;
}
| [
"jangmj@hanafos.com"
] | jangmj@hanafos.com |
3e1ae15016a7d64bc35c9be8293eb64615747066 | 3e3de0c2a7db4c6d80c046e6679a04b6199ae7c4 | /src/com/viacom/pagesVersion2/ShowsPageV2.java | 35c0b52d2caa559d8b1bdec63c9bdaa8c08e4b86 | [] | no_license | VinothTesting7/OTT | 99c9da497444b0ec1ae3fc1ae7288513403fc02d | 8a027add877301fd5651746796e773d41d6502c3 | refs/heads/master | 2022-11-24T16:34:12.313336 | 2020-08-05T08:50:23 | 2020-08-05T08:50:23 | 285,196,775 | 0 | 0 | null | 2020-08-05T08:50:24 | 2020-08-05T06:09:43 | Java | UTF-8 | Java | false | false | 15,543 | java | package com.viacom.pagesVersion2;
import java.util.List;
//import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.relevantcodes.extentreports.ExtentTest;
import io.appium.java_client.android.AndroidDriver;
public class ShowsPageV2 extends BasePageV2{
public ShowsPageV2(AndroidDriver driver,ExtentTest test){
super(driver,test);
PageFactory.initElements(driver, this);
}
@FindBy(xpath= "//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/tab_title' and @text='Live Now']")
public WebElement liveNowTab;
@FindBy(name= "All Shows")
public WebElement allShowsTab;
@FindBy(xpath="//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.view.ViewGroup")
//@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_live_logo']//ancestor::android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.view.ViewGroup")
public WebElement liveTabFirstVideoTitle;
@FindBy(id="com.viacom18.vootkids:id/textview_download_item_title")
public WebElement episodeTitleInDownloadEpisodesScreen;
@FindBy(xpath= "//android.widget.ImageView[@resource-id='com.viacom18.v18.viola:id/banner_image_hero_tray']")
public WebElement allShowsFeaturevideo;
@FindBy(xpath="//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.view.ViewGroup")
//@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_live_logo']//ancestor::android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.view.ViewGroup")
public WebElement liveTabFirstVideo;
@FindBy(xpath= "//android.widget.RadioButton[@text='Originals']")
public WebElement originalsTab;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @content-desc='NOT_ADDED']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_download_item_title']")
public List<WebElement> notAddedEpisodes;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @content-desc='DOWNLOAD_COMPLETE']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_download_item_title']")
public List<WebElement> downloadedEpisodes;
@FindBy(xpath= "//android.widget.TextView[@resource-id='com.viacom18.v18.viola:id/tv_series_title']")
public List<WebElement> allEpisodesList;
@FindBy(xpath= "//android.widget.ImageView[@resource-id='com.viacom18.v18.viola:id/banner_image_hero_tray']")
public WebElement originalsFeaturevideo;
@FindBy(id="com.viacom18.vootkids:id/imageview_media_state_button")
public WebElement downloadIconInDownloadsScreen;
@FindBy(id="com.viacom18.vootkids:id/imageview_media_state_button")
public List<WebElement> downloadIconsInDownloadsScreen;
@FindBy(id="com.viacom18.vootkids:id/textview_download_item_title")
public List<WebElement> downloadsScreenEpisodeTitles;
@FindBy(id="com.viacom18.vootkids:id/imageview_media_state_button")
public List<WebElement> downloadedEpisodeIcons;
@FindBy(xpath= "//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/header_text']")
public WebElement episodesPageTitle;
@FindBy(xpath= "//android.widget.TextView[@text='EPISODES']")
public WebElement episodesTray;
//@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.widget.TextView[@index='2' and @resource-id='com.viacom18.vootkids:id/grid_description']")
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_description']")
public List<WebElement> showDetailsEpisodes;
@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout' and @index='0']")
public WebElement showDetailsEpisode1;
@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout' and @index='0']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_description']")
public WebElement showDetailsEpisode1Title;
@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout' and @index='1']")
public WebElement showDetailsEpisode2;
@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout' and @index='1']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_description']")
public WebElement showDetailsEpisode2Title;
@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout' and @index='2']")
public WebElement showDetailsEpisode3;
@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout' and @index='2']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_description']")
public WebElement showDetailsEpisode3Title
;
//to be changed
@FindBy(id="com.viacom18.vootkids:id/imageview_media_state_button")
public WebElement downloadedEpisodeIcon;
@FindBy(name ="Most Popular")
public WebElement mostPopularTab;
@FindBy(xpath ="//android.widget.TextView[contains(@text,'Voot Shorts')]")
public WebElement vootShortsTab;
@FindBy(xpath ="//android.widget.TextView[@resource-id='com.viacom18.v18.viola:id/txt_related_title']")
public List<WebElement> vootShortsRelatedTitle;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/title' and contains(@text,'Cancel Download')]")
public WebElement cancelDownloadOption;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/header_dialog' and (contains(@text,'DELETE') or contains(@text,'Delete'))]")
public WebElement cancelDownloadPopup;
@FindBy(xpath="//android.widget.Button[@resource-id='com.viacom18.vootkids:id/positive_right_btn_dialog' and (contains(@text,'YES') or contains(@text,'Yes'))]")
public WebElement cancelDownloadPopupYesButton;
@FindBy(xpath="//android.widget.Button[@resource-id='com.viacom18.vootkids:id/negative_left_btn_dialog' and (contains(@text,'NO') or contains(@text,'No') or contains(@text,'Cancel'))]")
public WebElement cancelDownloadPopupNoButton;
//sHOW DETAIL TESTCASE
@FindBy(id="com.viacom18.vootkids:id/button_back")
public WebElement showDetailPageBackButton;
@FindBy(xpath="//android.widget.ImageView[@resource-id='com.viacom18.vootkids:id/imageview_media_image']")
public WebElement showDetailPageCharacterImage;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/button_preview' and @text='PLAY']")
public WebElement showDetailPagePlayButton;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_title']")
public WebElement showDetailPageShowTitle;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_description']")
public WebElement showDetailPageShowInfo;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/header_text' and (@text='DOWNLOAD EPISODES' or @text='Download Episodes')]")
public WebElement downloadEpisodesScreenTitle;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_available_langauges']")
public WebElement showDetailPageLanguagesAvailableInfo;
@FindBy(xpath="//android.widget.LinearLayout[@resource-id='com.viacom18.vootkids:id/btn_download_item']")
public WebElement showDetailPageDownlaodEpisodesButton;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='EPISODES']")
public WebElement showDetailPageEpisodesSection;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='EPISODES']//ancestor::android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.widget.ImageView")
public WebElement showDetailPageEpisodesSectionFirstVideo;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='EPISODES']//ancestor::android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.widget.ImageView")
public List<WebElement> showDetailPageEpisodesSectionVideos;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='EPISODES']//ancestor::android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_description']")
public List<WebElement> showDetailPageEpisodesSectionTitles;
@FindBy(xpath="//android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_description']")
public List<WebElement> showDetailPageEpisodesSectionTitlesWay2;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and ( @text='RELATED SHOWS' or @text='You May Also Like')]")
public WebElement showDetailPageEditorialSection;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='RELATED SHOWS']")
public WebElement showDetailPageEditorialSectionRelatedTray;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and ( @text='YOU MAY ALSO LIKE' or @text='You May Also Like')")
public WebElement showDetailPageEditorialSectionYouMayLikeTray;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='RELATED SHOWS']//ancestor::android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.widget.ImageView")
public WebElement showDetailPageEditorialSectionRelatedTrayFirstContent;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='RELATED SHOWS']//ancestor::android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/grid_title']")
public WebElement showDetailPageEditorialSectionRelatedTrayFirstContentTitle;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='You May Also Like']//ancestor::android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.widget.ImageView")
public WebElement showDetailPageEditorialSectionYouMayLikeTrayFirstContent;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @index='4']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_download_item_title']")
public WebElement notAddedEpisode4;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @index='4' and @content-desc='DOWNLOAD_COMPLETE']")
public WebElement downloadedEpisode4;
@FindBy(name ="A - Z")
public WebElement atozTab;
@FindBy(id ="com.viacom18.v18.viola:id/btn_filter_shows")
public WebElement filterTab;
@FindBy(id="com.viacom18.v18.viola:id/title_toolbar")
public WebElement toolBarTitle;
@FindBy(id="com.viacom18.v18.viola:id/title")
public WebElement playingVideoTitle;
@FindBy(id="com.viacom18.v18.viola:id/show_description")
public WebElement descriptionDetailText;
@FindBy(id="com.viacom18.v18.viola:id/more_btn")
public WebElement moreChevronBtn;
@FindBy(id="com.viacom18.v18.viola:id/meta_data")
public WebElement showMetaData;
@FindBy(xpath="//android.widget.CheckBox[@resource-id='com.viacom18.vootkids:id/checkbox_fav_selector']")
public WebElement favIconShowDetails;
@FindBy(xpath ="//android.widget.TextView[@text='Download Episodes']")
public WebElement downloadEpisodesText;
@FindBy(xpath="//android.widget.RelativeLayout[@resource-id='com.viacom18.vootkids:id/parent_download_item']/android.widget.LinearLayout[@index='1']/android.widget.TextView[@index='1']")
public List<WebElement> toDownloadEpisodes;
@FindBy(xpath="//android.widget.Button[@resource-id='com.viacom18.vootkids:id/positive_btn']")
public WebElement downloadButton;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @index='0']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_download_item_title']")
public WebElement notAddedEpisode;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @index='1']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_download_item_title']")
public WebElement notAddedEpisode2name;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @index='1']//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/textview_media_item_size']")
public WebElement notAddedEpisode2episode;
@FindBy(xpath="//android.widget.FrameLayout[@resource-id='com.viacom18.vootkids:id/parent_for_download_item' and @index='1' and @content-desc='DOWNLOAD_COMPLETE']")
public WebElement downloadedEpisode2;
@FindBy(xpath="//android.widget.TextView[@text='SEE ALL' or @text='see all' or @text='See All' or @text='See all']")
public WebElement episodesSeeAll;
@FindBy(xpath="//android.widget.TextView[@text='ADDED TO FAVORITES']")
public WebElement favIconPopup;
@FindBy(xpath="//android.widget.TextView[contains(@text,'All your favorites contents are available under My Stuff section')]")
public WebElement favIconPopupMessage;
@FindBy(id="com.viacom18.vootkids:id/positive_single_btn_dialog")
public WebElement favIconPopupOkButton;
@FindBy(xpath="//android.widget.TextView[@resource-id='com.viacom18.vootkids:id/recent_title_text' and @text='EPISODES']//ancestor::android.view.ViewGroup[@resource-id='com.viacom18.vootkids:id/parent_layout']//android.support.v7.widget.RecyclerView[@resource-id='com.viacom18.vootkids:id/recent_recycler_view']//android.view.ViewGroup[@index='1']//android.widget.ImageView")
public WebElement showDetailPageEpisodesSectionSecondVideo;
@FindBy(xpath="//android.widget.CheckBox[@resource-id='com.viacom18.vootkids:id/checkbox_fav_selector' and @checked='true']")
public WebElement favIconChecked;
@FindBy(xpath="//android.widget.CheckBox[@resource-id='com.viacom18.vootkids:id/checkbox_fav_selector' and @checked='false']")
public WebElement favIcon;
}
| [
"vinothtest1189@gmail.com"
] | vinothtest1189@gmail.com |
47e8a58fe747c86d7971a9a8e0f6df079aa9265c | c3f9e293f3f18c3673321372e9165ae4c74408bc | /app/src/main/java/fpt/isc/nshreport/models/posts/pump.java | 57aef3a1d1a779f98cb404eee8353923df6cf9f5 | [] | no_license | TriNM24/Demojava | 295e1ca0088146fdeaf1de2b79c02e126c0a1c5a | 5195c06812751e3e4ee663643125122c6ed179e3 | refs/heads/master | 2020-05-23T00:40:55.567290 | 2018-03-03T05:14:26 | 2018-03-03T05:14:26 | 33,921,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,409 | java | package fpt.isc.nshreport.models.posts;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by ADMIN on 7/29/2017.
*/
public class pump {
@SerializedName("fuel_filling_column_id")
@Expose
private Integer fuelFillingColumnId;
@SerializedName("pump_id")
@Expose
private Integer pumpId;
@SerializedName("product_id")
@Expose
private Integer productId;
@SerializedName("report_num")
@Expose
private Long reportNum;
@SerializedName("image")
@Expose
private String image;
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getFuelFillingColumnId() {
return fuelFillingColumnId;
}
public void setFuelFillingColumnId(Integer fuelFillingColumnId) {
this.fuelFillingColumnId = fuelFillingColumnId;
}
public Integer getPumpId() {
return pumpId;
}
public void setPumpId(Integer pumpId) {
this.pumpId = pumpId;
}
public Long getReportNum() {
return reportNum;
}
public void setReportNum(Long reportNum) {
this.reportNum = reportNum;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}
| [
"tri.nguyen833@gmail.com"
] | tri.nguyen833@gmail.com |
75b188d2b9eb6b2e5417e831a5b7a70f5c1e59dc | cb3dc043d36da5096acce8c495d5cf04f6704c6f | /my_tomcat/src/main/java/org/apache/catalina/util/CustomObjectInputStream.java | 913636309462e7c891e4beeb68c7a89b3bb70086 | [] | no_license | zhouwentong1993/wheel | 6f125692bb798d1914492a7708163ec957ec3835 | 4e29979da99a99a38745954c9d6046df3e34d536 | refs/heads/master | 2021-06-13T22:19:27.543598 | 2020-11-05T09:29:51 | 2020-11-05T09:29:51 | 177,745,000 | 1 | 0 | null | 2021-03-31T21:13:21 | 2019-03-26T08:27:21 | Java | UTF-8 | Java | false | false | 4,703 | java | /*
* CustomObjectInputStream.java
* $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/org.apache/catalina/util/CustomObjectInputStream.java,v 1.2 2001/07/22 20:25:13 pier Exp $
* $Revision: 1.2 $
* $Date: 2001/07/22 20:25:13 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact org.apache@@org.apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.catalina.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
/**
* Custom subclass of <code>ObjectInputStream</code> that loads from the
* class loader for this web application. This allows classes defined only
* with the web application to be found correctly.
*
* @@author Craig R. McClanahan
* @@author Bip Thelin
* @@version $Revision: 1.2 $, $Date: 2001/07/22 20:25:13 $
*/
public final class CustomObjectInputStream
extends ObjectInputStream {
/**
* The class loader we will use to resolve classes.
*/
private ClassLoader classLoader = null;
/**
* Construct a new instance of CustomObjectInputStream
*
* @@param stream The input stream we will read from
* @@param classLoader The class loader used to instantiate objects
*
* @@exception IOException if an input/output error occurs
*/
public CustomObjectInputStream(InputStream stream,
ClassLoader classLoader)
throws IOException {
super(stream);
this.classLoader = classLoader;
}
/**
* Load the local class equivalent of the specified stream class
* description, by using the class loader assigned to this Context.
*
* @@param classDesc Class description from the input stream
*
* @@exception ClassNotFoundException if this class cannot be found
* @@exception IOException if an input/output error occurs
*/
public Class resolveClass(ObjectStreamClass classDesc)
throws ClassNotFoundException, IOException {
return (classLoader.loadClass(classDesc.getName()));
}
}
| [
"zhouwentong1993@gmail.com"
] | zhouwentong1993@gmail.com |
02571a876193d69b867338461d4e8b672b74b229 | a555c47a5da1c5da300544964587e72d4818104c | /spring-security-authorize/src/main/java/com/spring/security/rbac/repository/support/AbstractConditionBuilder.java | 07e1785b9c9a0cbc967e284e55415d420fa6a784 | [] | no_license | timeday/spring-security | a357ca5b639e868c16ba7923def22913f78b1244 | 07fc7d5b591c78c528a6ca2119d5dac1b5241b49 | refs/heads/master | 2020-04-24T02:27:50.273454 | 2019-02-21T01:59:55 | 2019-02-21T01:59:55 | 171,637,402 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,877 | java | package com.spring.security.rbac.repository.support;
import java.util.Collection;
import java.util.Date;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
public abstract class AbstractConditionBuilder<T> {
/**
* 添加in条件
*
* @param queryWraper
* @param values
*/
protected void addInConditionToColumn(QueryWraper<T> queryWraper, String column, Object values) {
if (needAddCondition(values)) {
Path<?> fieldPath = getPath(queryWraper.getRoot(), column);
if(values.getClass().isArray()) {
queryWraper.addPredicate(fieldPath.in((Object[])values));
}else if(values instanceof Collection) {
queryWraper.addPredicate(fieldPath.in((Collection<?>)values));
}
}
}
/**
* 添加between条件查询
* @param queryWraper
* @param experssion
* @param minValue 范围下限
* @param maxValue 范围上限
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void addBetweenConditionToColumn(QueryWraper<T> queryWraper, String column, Comparable minValue, Comparable maxValue) {
if (minValue != null || maxValue != null) {
Path<? extends Comparable> fieldPath = getPath(queryWraper.getRoot(), column);
if(minValue != null && maxValue != null){
queryWraper.addPredicate(queryWraper.getCb().between(fieldPath, minValue, processMaxValueOnDate(maxValue)));
}else if(minValue != null){
queryWraper.addPredicate(queryWraper.getCb().greaterThanOrEqualTo(fieldPath, minValue));
}else if(maxValue != null){
queryWraper.addPredicate(queryWraper.getCb().lessThanOrEqualTo(fieldPath, processMaxValueOnDate(maxValue)));
}
}
}
/**
* 当范围查询的条件是小于,并且值的类型是Date时,将传入的Date值变为当天的夜里12点的值。
* @param maxValue
* @return
* @author zhailiang
* @since 2016年12月14日
*/
@SuppressWarnings("rawtypes")
private Comparable processMaxValueOnDate(Comparable maxValue) {
if(maxValue instanceof Date) {
maxValue = new DateTime(maxValue).withTimeAtStartOfDay().plusDays(1).plusSeconds(-1).toDate();
}
return maxValue;
}
/**
* 添加大于条件查询
* @param queryWraper
* @param experssion
* @param minValue
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void addGreaterThanConditionToColumn(QueryWraper<T> queryWraper, String column, Comparable minValue) {
if (minValue != null) {
Path<? extends Comparable> fieldPath = getPath(queryWraper.getRoot(), column);
queryWraper.addPredicate(queryWraper.getCb().greaterThan(fieldPath, minValue));
}
}
/**
* 添加大于等于条件查询
* @param queryWraper
* @param experssion
* @param minValue
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void addGreaterThanOrEqualConditionToColumn(QueryWraper<T> queryWraper, String column, Comparable minValue) {
if (minValue != null) {
Path<? extends Comparable> fieldPath = getPath(queryWraper.getRoot(), column);
queryWraper.addPredicate(queryWraper.getCb().greaterThanOrEqualTo(fieldPath, minValue));
}
}
/**
* 添加小于条件查询
* @param queryWraper
* @param experssion
* @param maxValue
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void addLessThanConditionToColumn(QueryWraper<T> queryWraper, String column, Comparable maxValue) {
if (maxValue != null) {
Path<? extends Comparable> fieldPath = getPath(queryWraper.getRoot(), column);
queryWraper.addPredicate(queryWraper.getCb().lessThan(fieldPath, processMaxValueOnDate(maxValue)));
}
}
/**
* 添加小于等于条件查询
* @param queryWraper
* @param experssion
* @param maxValue
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void addLessThanOrEqualConditionToColumn(QueryWraper<T> queryWraper, String column, Comparable maxValue) {
if (maxValue != null) {
Path<? extends Comparable> fieldPath = getPath(queryWraper.getRoot(), column);
queryWraper.addPredicate(queryWraper.getCb().lessThanOrEqualTo(fieldPath, processMaxValueOnDate(maxValue)));
}
}
/**
* <pre>
* 添加like条件
* <pre>
* @param queryWraper
* @param column
* @param value
* @author jojo 2014-8-12 下午3:13:44
*/
protected void addLikeConditionToColumn(QueryWraper<T> queryWraper, String column, String value) {
if (StringUtils.isNotBlank(value)) {
queryWraper.addPredicate(createLikeCondition(queryWraper, column, value));
}
}
/**
* @param queryWraper
* @param column
* @param value
* @return
* @author zhailiang
* @since 2016年12月13日
*/
@SuppressWarnings("unchecked")
protected Predicate createLikeCondition(QueryWraper<T> queryWraper, String column, String value) {
Path<String> fieldPath = getPath(queryWraper.getRoot(), column);
Predicate condition = queryWraper.getCb().like(fieldPath, "%" + value + "%");
return condition;
}
/**
* <pre>
* 添加like条件
* <pre>
* @param queryWraper
* @param column
* @param value
* @author jojo 2014-8-12 下午3:13:44
*/
@SuppressWarnings("unchecked")
protected void addStartsWidthConditionToColumn(QueryWraper<T> queryWraper, String column, String value) {
if (StringUtils.isNotBlank(value)) {
Path<String> fieldPath = getPath(queryWraper.getRoot(), column);
queryWraper.addPredicate(queryWraper.getCb().like(fieldPath, value + "%"));
}
}
/**
* 添加等于条件
* @param queryWraper
* @param column 指出要向哪个字段添加条件
* @param value 指定字段的值
*/
protected void addEqualsConditionToColumn(QueryWraper<T> queryWraper, String column, Object value) {
if(needAddCondition(value)) {
Path<?> fieldPath = getPath(queryWraper.getRoot(), column);
queryWraper.addPredicate(queryWraper.getCb().equal(fieldPath, value));
}
}
/**
* 添加不等于条件
* @param queryWraper
* @param column 指出要向哪个字段添加条件
* @param value 指定字段的值
*/
protected void addNotEqualsConditionToColumn(QueryWraper<T> queryWraper, String column, Object value) {
if(needAddCondition(value)) {
Path<?> fieldPath = getPath(queryWraper.getRoot(), column);
queryWraper.addPredicate(queryWraper.getCb().notEqual(fieldPath, value));
}
}
/**
* <pre>
*
* <pre>
* @param root
* @param property
* @return
* @author jojo 2014-8-12 下午3:06:58
*/
@SuppressWarnings("rawtypes")
protected Path getPath(Root root, String property){
String[] names = StringUtils.split(property, ".");
Path path = root.get(names[0]);
for (int i = 1; i < names.length; i++) {
path = path.get(names[i]);
}
return path;
}
/**
* <pre>
* 判断是否需要添加where条件
* <pre>
* @param value
* @return
* @author jojo 2014-8-12 下午3:07:00
*/
@SuppressWarnings("rawtypes")
protected boolean needAddCondition(Object value) {
boolean addCondition = false;
if (value != null) {
if(value instanceof String) {
if(StringUtils.isNotBlank(value.toString())) {
addCondition = true;
}
}else if(value.getClass().isArray()) {
if(ArrayUtils.isNotEmpty((Object[]) value)) {
addCondition = true;
}
}else if(value instanceof Collection) {
if(CollectionUtils.isNotEmpty((Collection) value)) {
addCondition = true;
}
}else {
addCondition = true;
}
}
return addCondition;
}
}
| [
"hongwei.zhang@maobc.com"
] | hongwei.zhang@maobc.com |
4dee50830817439ff4f5a9c667d2ccb058f2ed13 | 4e45815f8fef9b6ed0ffd97a9ec3db7c5623be01 | /Minesweeper/task/src/minesweeper/Main.java | a8bcf8ec9be29a7bb0132bb48ee024832dff05f8 | [] | no_license | GiulianoMonti/Hyperskill_Minesweeper | 0b1d7dd95fd74ff2e45dde3b6538a0a785e03bc6 | 4e52fd75363cc8bd78a343209a60fa038edcdd4c | refs/heads/master | 2022-12-25T05:51:02.228846 | 2020-10-06T19:39:43 | 2020-10-06T19:39:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,272 | java | package minesweeper;
import java.util.*;
public class Main {
static final int width = 9;
static final int height = 9;
static char[][] field = new char[width][height];
static char[][] userField = new char[width][height];
private static Scanner scanner = new Scanner(System.in);
static int minesNumber;
public static void main(String[] args) {
System.out.println("How many mines do you want on the field? ");
minesNumber = Integer.parseInt(scanner.nextLine());
fillBoard();
placeMines();
fillCountMines();
playGame();
}
static void fillBoard() {
for(int i = 0; i < width; i++) {
for(int j = 0; j < height; j++) {
field[i][j] = '.';
}
}
}
static void printBoard() {
System.out.println("\n |123456789|");
System.out.println("—│—————————│");
for(int i = 0; i < width; i++) {
System.out.printf("%d|%s|\n", i+1, new String(userField[i]));
}
System.out.println("—│—————————│");
}
static void placeMines() {
int count = 0;
Random r = new Random();
while (count < minesNumber) {
int x = r.nextInt(width);
int y = r.nextInt(height);
if(!isMine(field[x][y])) {
field[x][y] = '*';
count++;
}
}
}
static boolean isMine(char cell) {
return cell == '*';
}
static void fillCountMines() {
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
if (!isMine(field[i][j])) {
char mineNum = Character.forDigit(getNumberOfMines(i, j), 10);
field[i][j] = mineNum == '0' ? '.' : mineNum;
}
}
}
}
static int getNumberOfMines(int row, int col) {
int totalMines = 0;
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
try {
if (isMine(field[row + i][col + j])) {
totalMines++;
}
} catch (ArrayIndexOutOfBoundsException ignored) {
}
}
}
return totalMines;
}
static void createUserField() {
for(int i = 0; i < width; i++) {
for(int j = 0; j < height; j++) {
userField[i][j] = '.';
}
}
}
static boolean checkMines() {
for(int i = 0; i < width; i++) {
for(int j = 0; j < height; j++) {
if (isMine(userField[i][j]) && userField[i][j] != field[i][j]) {
}
}
}
return true;
}
static int freeCell(int y, int x) {
if (isMine(field[y][x])) {
return -1;
}
if (userField[y][x] != '.' && userField[y][x] != '*') {
return 0;
}
int freeCellsNumber = 1;
if (field[y][x] != '.') {
userField[y][x] = field[y][x];
} else {
userField[y][x] = '/';
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (y + i >= 0 && y + i < width && x + j >= 0 && x + j < height && (i != 0 || j != 0)) {
freeCellsNumber += freeCell(y + i, x + j);
}
}
}
}
return freeCellsNumber;
}
static void playGame() {
createUserField();
printBoard();
boolean gameEnd = false;
int mines = 0;
int freeCells = width * height;
do {
System.out.println("Set/unset mines marks or claim a cell as free:");
String[] command = scanner.nextLine().split("\\s+");
int x = Integer.parseInt(command[0]) - 1;
int y = Integer.parseInt(command[1]) - 1;
if (command[2].equals("free")) {
int fc = freeCell(y, x);
if (fc != -1) {
freeCells -= fc;
printBoard();
if (mines + freeCells == minesNumber) {
gameEnd = true;
}
} else {
System.out.println("You stepped on a mine and failed!");
return;
}
} else {
switch (userField[y][x]) {
case '.':
userField[y][x] = '*';
mines++;
printBoard();
break;
case '*':
userField[y][x] = '.';
mines--;
printBoard();
break;
default:
System.out.println("There is a number here!");
break;
}
if (mines == minesNumber && checkMines()) {
gameEnd = true;
}
}
} while(!gameEnd);
System.out.println("Congratulations! You found all mines!");
}
}
| [
"finntroll06@bk.ru"
] | finntroll06@bk.ru |
ef35d78983b0826c66e881c65d24bf62fbecac1b | 9ae280494fdcd23d929ef39e2e327e40e86d04b3 | /src/engine/Characters/playable_characters/playable_NPCs/playable_merchant.java | 989384e26e51076b7de42eced3f4d6335e31eb2c | [] | no_license | NatetheGrate06/Legends | 6246233e782002679cf5000fabb072754c779e3c | f2adeaa5443316a5b873c1f977f0bdafcd6bcbc4 | refs/heads/master | 2020-12-08T09:12:32.401954 | 2020-03-13T18:00:21 | 2020-03-13T18:00:21 | 232,942,872 | 3 | 1 | null | 2020-01-17T03:46:25 | 2020-01-10T01:49:24 | Java | UTF-8 | Java | false | false | 97 | java | package engine.Characters.playable_characters.playable_NPCs;
public class playable_merchant {
}
| [
"nathanvaughn06@gmail.com"
] | nathanvaughn06@gmail.com |
46932ef08476acdb5d2d5df32a03afb005664026 | a2df6764e9f4350e0d9184efadb6c92c40d40212 | /aliyun-java-sdk-sofa/src/main/java/com/aliyuncs/sofa/model/v20190815/QueryLinkefabricFabricUrlsaoneurlRequest.java | f06499e57bb07895183f5d30895b0d4bd683fd03 | [
"Apache-2.0"
] | permissive | warriorsZXX/aliyun-openapi-java-sdk | 567840c4bdd438d43be6bd21edde86585cd6274a | f8fd2b81a5f2cd46b1e31974ff6a7afed111a245 | refs/heads/master | 2022-12-06T15:45:20.418475 | 2020-08-20T08:37:31 | 2020-08-26T06:17:49 | 290,450,773 | 1 | 0 | NOASSERTION | 2020-08-26T09:15:48 | 2020-08-26T09:15:47 | null | UTF-8 | Java | false | false | 1,458 | java | /*
* 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.aliyuncs.sofa.model.v20190815;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.sofa.Endpoint;
/**
* @author auto create
* @version
*/
public class QueryLinkefabricFabricUrlsaoneurlRequest extends RpcAcsRequest<QueryLinkefabricFabricUrlsaoneurlResponse> {
public QueryLinkefabricFabricUrlsaoneurlRequest() {
super("SOFA", "2019-08-15", "QueryLinkefabricFabricUrlsaoneurl", "sofa");
setMethod(MethodType.POST);
try {
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
@Override
public Class<QueryLinkefabricFabricUrlsaoneurlResponse> getResponseClass() {
return QueryLinkefabricFabricUrlsaoneurlResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
4b25bc7fed8a38af41f36586d68dc65f5dd031b9 | 937b75a41a6d213285388587350e989bea04d20e | /src/quesitoQuatro/Ferramenta.java | 7eddef22c84a82fc431882218c2fbe4513351d1b | [] | no_license | chenrique13/AtividadePos2 | f76afc20fbc4d7a1665de6628819bcbad1e56b4f | 00a80107c669f7b1d5cadfccdde2ca3583a22d37 | refs/heads/master | 2022-12-06T01:31:24.828309 | 2020-09-05T02:26:50 | 2020-09-05T02:26:50 | 292,971,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package quesitoQuatro;
public class Ferramenta extends ItemDeLoja{
private String categoria;
private Integer serial;
public Ferramenta() {
super();
}
public Ferramenta(String categoria, Integer serial) {
super();
this.categoria = categoria;
this.serial = serial;
}
public Ferramenta(int codigoDoItem, String nomeDoItem, String descricaoDoItem, double valorDoItem, String categoria,
Integer serial) {
super(codigoDoItem, nomeDoItem, descricaoDoItem, valorDoItem);
this.categoria = categoria;
this.serial = serial;
}
public String getCategoria() {
return categoria;
}
public void setCategoria(String categoria) {
this.categoria = categoria;
}
public Integer getSerial() {
return serial;
}
public void setSerial(Integer serial) {
this.serial = serial;
}
@Override
public int getIdentificador() {
return this.getSerial();
}
public void separar() {
this.setCategoria("Outros");
}
public void separar(String valor) {
this.setCategoria(valor);
}
}
| [
"c.henrique1309@gmail.com"
] | c.henrique1309@gmail.com |
45b670c113faf1022e3c466e68c920c75abcc715 | 17b0313805f7549c60790047e57849f35c4cd7a1 | /src/main/java/com/tabeldata/resources/entity/ComponentMenu.java | d69d66e812490b92af232e7bbcc93c9ec8e38ef3 | [
"Apache-2.0"
] | permissive | arraisi/auth-server-blud | ff35a3bb591ac238df5f6f2d393ed4e64c1282e2 | aacd4da58ea2d3d611f7cd350ee403c7f2f472d7 | refs/heads/master | 2020-07-20T03:11:51.626488 | 2019-08-28T07:55:46 | 2019-08-28T07:55:46 | 206,561,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.tabeldata.resources.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ComponentMenu {
private String id;
private String title;
private String path;
private String iconId;
}
| [
"mail.secondson@gmail.com"
] | mail.secondson@gmail.com |
914d3ad916db7a8dc5af6abbdb29274fb03ceff0 | a5adeeecb9471423f0d6c6ad5993114c1e3d7774 | /app/src/main/java/com/whaletail/lite/litenavigationlibrary/fragment/LiteFragment.java | 9d606c31fc3b33d86b47514276f1ccd5d2d49f71 | [] | no_license | silentem/LiteNavigationLibrary | 008fa5a9a18088dd8fead3b60baaa413813ddfda | 019956833e46d633276240ab4c5bf0608c8504d0 | refs/heads/master | 2021-05-10T14:47:16.733410 | 2018-04-17T08:37:59 | 2018-04-17T08:37:59 | 118,531,205 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package com.whaletail.lite.litenavigationlibrary.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.whaletail.lite.litenavigationlibrary.R;
import java.util.Random;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* A simple {@link Fragment} subclass.
*/
public class LiteFragment extends Fragment {
@BindView(R.id.tv_test)
TextView testTextView;
public LiteFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_lite, container, false);
ButterKnife.bind(this, view);
testTextView.setText(new Random().nextInt() + " is new random value");
return view;
}
}
| [
"silentem1113@gmail.com"
] | silentem1113@gmail.com |
68c488bcabb89cf4eddcf635fb92d04612386f47 | 36149984d0ccf00fdc6aeacd1e35270dc226564a | /HelloWorld/src/classes/StudentExample.java | 4f45455fe3ab394fe82149625464b28187423186 | [] | no_license | cjchanjin/HelloWorld | 84fb597834b3c60d5ebadf001c1e8c8c88d86292 | 2066e4c28dc6804b58c9270c3c3a80c105cf85f9 | refs/heads/master | 2020-11-25T07:53:23.543655 | 2020-01-15T08:45:05 | 2020-01-15T08:45:05 | 228,564,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,458 | java | package classes;
public class StudentExample {
public static void main(String[] args) {
// 필드, 생성자, 메소드 3가지 꼭 있어야 한다 클래스 구성하기 위해서
String str = "Hello";
String str1 = new String("Hello"); //new 키워드는 인스턴스를 하나 만드는것
Student student = new Student(); //가운데 노란 student : 변수명
student.studentNo = "191234-1234"; //점 찍으면 우리가 정의한 메소드와 필드를 나타낸다 + 오브젝트가 가지고 있는것도 표시
student.studentName = "김철수";
student.age = 20;
student.major = "English";
student.university = "Yedam";
student.introduce(); //클래스에서 정의한 자기 소개 호출
Student student1 = new Student("Yedam", "921111-1111", "박철수"); //필드에 값 안넣고 생성자를 통해서 값을 넣음
student1.introduce();
System.out.println(student.major); //필드는 값을 가지고 있고 출력 할 수 잇다.
student.doHomework(); //메소드 호출 . 필드와 달리 () 포함.
System.out.println(student); //메모리에 가지고 있는 학생 변수의 주소
//학교도 나오게 호출
Student student2 = new Student();
student2.university = "yedam";
student2.studentNo = "19121212";
student2.studentName = "바가바";
student2.introduce2();
}
}
| [
"User@YD01-01"
] | User@YD01-01 |
9bed21dcc696299c4b8f0cc45e8d7f9f32431a54 | d763b31b9e7dcf71f07802d7a000aae72adbee43 | /src/day01/TextualEX.java | 0e96b78b35d4399bdab7face86775808a7ae5a00 | [] | no_license | bbongcat/java_study | 83374c8ae9dc889d0a4295852adc7a08be7df064 | a059065a4f7f310188b764cd2c864ed8ab85614c | refs/heads/master | 2023-03-22T12:41:31.993242 | 2021-03-23T12:15:41 | 2021-03-23T12:15:41 | 334,020,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 910 | java | package day01;
public class TextualEX {
public static void main(String[] args) {
//한 글자를 저장할 때는 홑따옴표를 사용
char c1 = 'A';
char c2 = 44032; //유니코드 아스키코드로 해석
System.out.println("c2 = " + c2);
char c3 = 0x43;
System.out.println("c3 = " + c3);
System.out.println("=======================");
//문장이나 단어를 저장할 때는 겹따옴표에 담아 저장함
String s1 = "My dream ";
String s2 = "is a Programmer!";
System.out.println(s1);
System.out.println(s2);
System.out.println(s1+s2);
System.out.println("100" + "200");
System.out.println(100 + "200");
System.out.println(10 + 20 + "hello");
System.out.println("hello" + 10 + 20);
System.out.println("hello" + '!');
}
}
| [
"lollolllo328@gmail.com"
] | lollolllo328@gmail.com |
f71f2cc708fbb9aaa26735f8008acaf4e7267157 | 4f3613a5f643862a604473010fe24dd3dc516a51 | /app/src/main/java/com/bber/company/android/widget/NotifyingScrollView.java | 80a96f2098ec2772cef5204c7b6930f4d714453f | [] | no_license | chenqian19911214/BberCole | c2bb89ff4bf76f03fe92fd159a3aac54257ea95e | 437da365938ee8c1e71ac428fce450ff284b4ea1 | refs/heads/master | 2020-03-23T10:39:18.226709 | 2018-07-18T15:38:46 | 2018-07-19T00:42:28 | 141,454,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,478 | java | package com.bber.company.android.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* Created by Administrator on 2015-08-07.
*/
public class NotifyingScrollView extends ScrollView {
private Context mContext;
private OnScrollChangedListener mOnScrollChangedListener;
public NotifyingScrollView(Context context) {
super(context);
this.mContext = context;
}
public NotifyingScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
this.mContext = context;
}
public NotifyingScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.mContext = context;
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mOnScrollChangedListener != null) {
mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt);
}
}
public void setOnScrollChangedListener(OnScrollChangedListener listener) {
mOnScrollChangedListener = listener;
}
public interface OnScrollChangedListener {
void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt);
}
/**阻尼**/
/**
* Finalize inflating a view from XML. This is called as the last phase of
* inflation, after all child views have been added.
*/
}
| [
"1096011884@qq.com"
] | 1096011884@qq.com |
9d7be51265b5250401eaecf6ae46319cbf5f4990 | 35fd0c335d1d5392b1f387f2b7d38dea168362f1 | /src/main/java/com/epic/epay/ipg/util/varlist/StatusCategoryVarList.java | 047da153df3260b677f52b4f9809c1b320379c83 | [] | no_license | chanuka/REWAMP_IPG_ADMIN | f725f55d2cc34747dde33df40490707029d702e2 | 5827e12b8e5ed3303ec837611574869e277cc698 | refs/heads/master | 2020-03-26T18:49:01.034607 | 2018-08-18T16:09:47 | 2018-08-18T16:09:47 | 145,232,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | 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.epic.epay.ipg.util.varlist;
/**
*
* @author asela
*/
public class StatusCategoryVarList {
public static final String TRANSACTION_CATEGORYCODE = "BATC"; //Transaction Category Code
public static final String FILE_UPLOAD_STATUS = "FLUP";
}
| [
"chanuka_g@epiclanka.net"
] | chanuka_g@epiclanka.net |
bc990b5d96e7bef9326dcfdac21d0286ad470003 | d0ff2e2d8276e22f44fcfddadf19552c059439cb | /src/Server/ServerInterfaceHolder.java | dad99c65a14a31b73b3c937729061b6216d3bd03 | [] | no_license | cheng-kun/Distributed-Class-Management-System | b3c0cfde158ce2207268efb8fe6bff034bd6e34a | 69d6a1d295b9c75184500f8f6e73fdb4ad775882 | refs/heads/master | 2021-10-10T14:22:52.486365 | 2019-01-11T21:56:49 | 2019-01-11T21:56:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 890 | java | package Server;
/**
* Server/ServerInterfaceHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from C:/java/workspace/0805/src/Server/Server.idl
* Sunday, August 6, 2017 5:16:50 o'clock PM EDT
*/
public final class ServerInterfaceHolder implements org.omg.CORBA.portable.Streamable
{
public Server.ServerInterface value = null;
public ServerInterfaceHolder ()
{
}
public ServerInterfaceHolder (Server.ServerInterface initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = Server.ServerInterfaceHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
Server.ServerInterfaceHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return Server.ServerInterfaceHelper.type ();
}
}
| [
"chengkunche@yahoo.com"
] | chengkunche@yahoo.com |
5d658b632830005edd5ff89faae078c82b7f880f | 6045518db77c6104b4f081381f61c26e0d19d5db | /datasets/file_version_per_commit_backup/jruby/256467c9c7163d27ab2ec331e6dab7b532570247.java | 43ad5d2d66c89710204133f2f3cfe74c0f58db50 | [] | no_license | edisutoyo/msr16_td_removal | 6e039da7fed166b81ede9b33dcc26ca49ba9259c | 41b07293c134496ba1072837e1411e05ed43eb75 | refs/heads/master | 2023-03-22T21:40:42.993910 | 2017-09-22T09:19:51 | 2017-09-22T09:19:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,999 | java | /***** BEGIN LICENSE BLOCK *****
* Version: EPL 1.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Eclipse Public
* License Version 1.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.eclipse.org/legal/epl-v10.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Copyright (C) 2001 Alan Moore <alan_moore@gmx.net>
* Copyright (C) 2001-2002 Jan Arne Petersen <jpetersen@uni-bonn.de>
* Copyright (C) 2002 Anders Bengtsson <ndrsbngtssn@yahoo.se>
* Copyright (C) 2004 Charles O Nutter <headius@headius.com>
* Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the EPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
package org.jruby;
import org.jruby.anno.JRubyMethod;
import org.jruby.anno.JRubyClass;
import org.jruby.internal.runtime.methods.AliasMethod;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.IRMethodArgs;
import org.jruby.internal.runtime.methods.ProcMethod;
import org.jruby.runtime.ArgumentDescriptor;
import org.jruby.runtime.Block;
import org.jruby.runtime.ClassIndex;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.MethodBlockBody;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.PositionAware;
import org.jruby.runtime.Signature;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
/**
* The RubyMethod class represents a RubyMethod object.
*
* You can get such a method by calling the "method" method of an object.
*
* Note: This was renamed from Method.java
*
* @author jpetersen
* @since 0.2.3
*/
@JRubyClass(name="Method")
public class RubyMethod extends AbstractRubyMethod {
protected IRubyObject receiver;
protected RubyMethod(Ruby runtime, RubyClass rubyClass) {
super(runtime, rubyClass);
}
/** Create the RubyMethod class and add it to the Ruby runtime.
*
*/
public static RubyClass createMethodClass(Ruby runtime) {
// TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here. Confirm. JRUBY-415
RubyClass methodClass = runtime.defineClass("Method", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
runtime.setMethod(methodClass);
methodClass.setClassIndex(ClassIndex.METHOD);
methodClass.setReifiedClass(RubyMethod.class);
methodClass.defineAnnotatedMethods(AbstractRubyMethod.class);
methodClass.defineAnnotatedMethods(RubyMethod.class);
return methodClass;
}
public static RubyMethod newMethod(
RubyModule implementationModule,
String methodName,
RubyModule originModule,
String originName,
DynamicMethod method,
IRubyObject receiver) {
Ruby runtime = implementationModule.getRuntime();
RubyMethod newMethod = new RubyMethod(runtime, runtime.getMethod());
newMethod.implementationModule = implementationModule;
newMethod.methodName = methodName;
newMethod.originModule = originModule;
newMethod.originName = originName;
newMethod.method = method;
newMethod.receiver = receiver;
return newMethod;
}
/** Call the method.
*
*/
@JRubyMethod(name = {"call", "[]"})
public IRubyObject call(ThreadContext context, Block block) {
return method.call(context, receiver, implementationModule, methodName, block);
}
@JRubyMethod(name = {"call", "[]"})
public IRubyObject call(ThreadContext context, IRubyObject arg, Block block) {
return method.call(context, receiver, implementationModule, methodName, arg, block);
}
@JRubyMethod(name = {"call", "[]"})
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return method.call(context, receiver, implementationModule, methodName, arg0, arg1, block);
}
@JRubyMethod(name = {"call", "[]"})
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {
return method.call(context, receiver, implementationModule, methodName, arg0, arg1, arg2, block);
}
@JRubyMethod(name = {"call", "[]"}, rest = true)
public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
return method.call(context, receiver, implementationModule, methodName, args, block);
}
/** Returns the number of arguments a method accepted.
*
* @return the number of arguments of a method.
*/
@JRubyMethod
public RubyFixnum arity() {
int value;
if (method instanceof IRMethodArgs) {
value = ((IRMethodArgs) method).getSignature().arityValue();
} else {
value = method.getArity().getValue();
}
return getRuntime().newFixnum(value);
}
@JRubyMethod(name = "==", required = 1)
@Override
public RubyBoolean op_equal(ThreadContext context, IRubyObject other) {
if (!(other instanceof RubyMethod)) {
return context.runtime.getFalse();
}
if (method instanceof ProcMethod) {
return context.runtime.newBoolean(((ProcMethod) method).isSame(((RubyMethod) other).getMethod()));
}
RubyMethod otherMethod = (RubyMethod)other;
return context.runtime.newBoolean(receiver == otherMethod.receiver &&
originModule == otherMethod.originModule &&
(isMethodMissingMatch(otherMethod.getMethod().getRealMethod()) || isSerialMatch(otherMethod.getMethod().getRealMethod()))
);
}
private boolean isMethodMissingMatch(DynamicMethod other) {
return (method.getRealMethod() instanceof RubyModule.RespondToMissingMethod) &&
((RubyModule.RespondToMissingMethod)method.getRealMethod()).equals(other);
}
private boolean isSerialMatch(DynamicMethod otherMethod) {
return method.getRealMethod().getSerialNumber() == otherMethod.getRealMethod().getSerialNumber();
}
@JRubyMethod(name = "eql?", required = 1)
public IRubyObject op_eql19(ThreadContext context, IRubyObject other) {
return op_equal(context, other);
}
@JRubyMethod(name = "clone")
@Override
public RubyMethod rbClone() {
return newMethod(implementationModule, methodName, originModule, originName, method, receiver);
}
/** Create a Proc object.
*
*/
@JRubyMethod
public IRubyObject to_proc(ThreadContext context) {
Ruby runtime = context.runtime;
MethodBlockBody body;
Signature signature;
ArgumentDescriptor[] argsDesc;
if (method instanceof IRMethodArgs) {
signature = ((IRMethodArgs) method).getSignature();
argsDesc = ((IRMethodArgs) method).getArgumentDescriptors();
} else {
signature = Signature.from(method.getArity());
argsDesc = Helpers.methodToArgumentDescriptors(method);
}
body = new MethodBlockBody(runtime.getStaticScopeFactory().getDummyScope(), signature, method, argsDesc, receiver, originModule, originName, getFilename(), getLine());
Block b = MethodBlockBody.createMethodBlock(body);
return RubyProc.newProc(runtime, b, Block.Type.LAMBDA);
}
@JRubyMethod
public RubyUnboundMethod unbind() {
RubyUnboundMethod unboundMethod =
RubyUnboundMethod.newUnboundMethod(implementationModule, methodName, originModule, originName, method);
unboundMethod.infectBy(this);
return unboundMethod;
}
@JRubyMethod(name = {"inspect", "to_s"})
@Override
public IRubyObject inspect() {
StringBuilder buf = new StringBuilder("#<");
char delimeter = '#';
buf.append(getMetaClass().getRealClass().getName()).append(": ");
if (implementationModule.isSingleton()) {
IRubyObject attached = ((MetaClass) implementationModule).getAttached();
if (receiver == null) {
buf.append(implementationModule.inspect().toString());
} else if (receiver == attached) {
buf.append(attached.inspect().toString());
delimeter = '.';
} else {
buf.append(receiver.inspect().toString());
buf.append('(').append(attached.inspect().toString()).append(')');
delimeter = '.';
}
} else {
buf.append(originModule.getName());
if (implementationModule != originModule) {
buf.append('(').append(implementationModule.getName()).append(')');
}
}
buf.append(delimeter).append(methodName).append('>');
RubyString str = getRuntime().newString(buf.toString());
str.setTaint(isTaint());
return str;
}
@JRubyMethod
public IRubyObject receiver(ThreadContext context) {
return receiver;
}
@JRubyMethod
public IRubyObject owner(ThreadContext context) {
return implementationModule;
}
@JRubyMethod
public IRubyObject source_location(ThreadContext context) {
Ruby runtime = context.runtime;
String filename = getFilename();
if (filename != null) {
return runtime.newArray(runtime.newString(filename), runtime.newFixnum(getLine()));
}
return context.runtime.getNil();
}
public String getFilename() {
DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
if (realMethod instanceof PositionAware) {
PositionAware poser = (PositionAware) realMethod;
return poser.getFile();
}
return null;
}
public int getLine() {
DynamicMethod realMethod = method.getRealMethod(); // Follow Aliases
if (realMethod instanceof PositionAware) {
PositionAware poser = (PositionAware) realMethod;
return poser.getLine() + 1;
}
return -1;
}
@JRubyMethod
public IRubyObject parameters(ThreadContext context) {
return Helpers.methodToParameters(context.runtime, this);
}
@JRubyMethod(optional = 1)
public IRubyObject curry(ThreadContext context, IRubyObject[] args) {
return to_proc(context).callMethod(context, "curry", args);
}
@JRubyMethod
public IRubyObject super_method(ThreadContext context) {
RubyModule superClass = Helpers.findImplementerIfNecessary(receiver.getMetaClass(), implementationModule).getSuperClass();
return super_method(context, receiver, superClass);
}
@JRubyMethod
public IRubyObject original_name(ThreadContext context) {
if (method instanceof AliasMethod) {
return context.runtime.newString(((AliasMethod)method).getOldName());
}
return name(context);
}
}
| [
"everton.maldonado@gmail.com"
] | everton.maldonado@gmail.com |
410fb8ef644d6bcc41e3b8253d63bf57a7ed260a | 3060c9f3674c2b859e880892b25ac8b89ae737a9 | /src/main/java/com/hunyiha/rocketmq/example/filter/SqlFilterConsumer.java | b1a70dc3065a91c149295bdc1439a3793ca0418f | [] | no_license | hunyiha/rocketmq-example | ab4d17939819e055b0d97b5de6d95fd99da8c366 | 082362c6ff31f96e2a00c3c005e82a7bdb55ecc4 | refs/heads/main | 2022-12-25T07:29:57.090086 | 2020-10-11T13:02:44 | 2020-10-11T13:02:44 | 303,079,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,155 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hunyiha.rocketmq.example.filter;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.MessageSelector;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import java.util.List;
/**
* SQL过滤基本语法:
* 数值比较,比如:>,>=,<,<=,BETWEEN,=;
* 字符比较,比如:=,<>,IN;
* IS NULL 或者 IS NOT NULL;
* 逻辑符号 AND,OR,NOT;
*
* 常量支持类型为:
* 数值,比如:123,3.1415;
* 字符,比如:'abc',必须用单引号包裹起来;
* NULL,特殊的常量
* 布尔值,TRUE 或 FALSE
*
* Broker一定要开启属性过滤, 即enablePropertyFilter=true
* 只有使用push模式的消费者并且在broker开启属性过滤(enablePropertyFilter=true)才能用使用SQL92标准的sql语句,
* 否则抛出异常:The broker does not support consumer to filter message by SQL92
*/
public class SqlFilterConsumer {
public static void main(String[] args) throws Exception {
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("please_rename_unique_group_name");
//设置NameServer地址
consumer.setNamesrvAddr("192.168.202.128:9876");
// Broker一定要开启属性过滤, 即enablePropertyFilter=true
consumer.subscribe("SqlFilterTest",
MessageSelector.bySql("(TAGS is not null and TAGS in ('TagA', 'TagB'))" +
"and (a is not null and a between 0 and 3)"));
consumer.registerMessageListener(new MessageListenerConcurrently() {
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
ConsumeConcurrentlyContext context) {
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
});
consumer.start();
System.out.printf("Consumer Started.%n");
}
}
| [
"hunyiha@gmail.com"
] | hunyiha@gmail.com |
ad66df3d8cef974424d7a1db8a1b9efc00ff694d | 233e63710e871ef841ff3bc44d3660a0c8f8564d | /trunk/gameserver/src/gameserver/network/chatserver/clientpackets/CM_CS_AUTH_RESPONSE.java | eca10d2c0d38bfa669cb9ea86801346d9f8393e6 | [] | no_license | Wankers/Project | 733b6a4aa631a18d28a1b5ba914c02eb34a9f4f6 | da6db42f127d5970522038971a8bebb76baa595d | refs/heads/master | 2016-09-06T10:46:13.768097 | 2012-08-01T23:19:49 | 2012-08-01T23:19:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,558 | java | /*
* This file is part of Aion Extreme Emulator <aion-core.net>.
*
* Aion Extreme Emulator is a 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.
*
* Aion Extreme Emulator 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 Aion Extreme Emulator. If not, see <http://www.gnu.org/licenses/>.
*/
package gameserver.network.chatserver.clientpackets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import commons.utils.ExitCode;
import gameserver.network.chatserver.ChatServerConnection.State;
import gameserver.network.chatserver.CsClientPacket;
import gameserver.network.chatserver.serverpackets.SM_CS_AUTH;
import gameserver.services.ChatService;
import gameserver.utils.ThreadPoolManager;
/**
* @author ATracer
*/
public class CM_CS_AUTH_RESPONSE extends CsClientPacket {
/**
* Logger for this class.
*/
protected static final Logger log = LoggerFactory.getLogger(CM_CS_AUTH_RESPONSE.class);
/**
* Response: 0=Authed,<br>
* 1=NotAuthed,<br>
* 2=AlreadyRegistered
*/
private int response;
private byte[] ip;
private int port;
/**
* @param opcode
*/
public CM_CS_AUTH_RESPONSE(int opcode) {
super(opcode);
}
@Override
protected void readImpl() {
response = readC();
ip = readB(4);
port = readH();
}
@Override
protected void runImpl() {
switch (response) {
case 0: // Authed
log.info("GameServer authed successfully IP : " + (ip[0] & 0xFF) + "." + (ip[1] & 0xFF) + "." + (ip[2] & 0xFF)
+ "." + (ip[3] & 0xFF) + " Port: " + port);
getConnection().setState(State.AUTHED);
ChatService.setIp(ip);
ChatService.setPort(port);
break;
case 1: // NotAuthed
log.error("GameServer is not authenticated at ChatServer side");
System.exit(ExitCode.CODE_ERROR);
break;
case 2: // AlreadyRegistered
log.info("GameServer is already registered at ChatServer side! trying again...");
ThreadPoolManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
CM_CS_AUTH_RESPONSE.this.getConnection().sendPacket(new SM_CS_AUTH());
}
}, 10000);
break;
}
}
}
| [
"sylvanodu14gmail.com"
] | sylvanodu14gmail.com |
03173041e1fd88a392e7c5a0b89954ce9deeda22 | 9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3 | /cab.snapp.passenger.play_184.apk-decompiled/sources/io/reactivex/internal/operators/b/b.java | 4754a80bb72fd51139a0c84594205e43991c3e7b | [] | no_license | BaseMax/PopularAndroidSource | a395ccac5c0a7334d90c2594db8273aca39550ed | bcae15340907797a91d39f89b9d7266e0292a184 | refs/heads/master | 2020-08-05T08:19:34.146858 | 2019-10-06T20:06:31 | 2019-10-06T20:06:31 | 212,433,298 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,344 | java | package io.reactivex.internal.operators.b;
import io.reactivex.g;
import io.reactivex.internal.disposables.DisposableHelper;
import io.reactivex.internal.subscriptions.SubscriptionHelper;
import io.reactivex.j;
import io.reactivex.o;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import org.b.c;
import org.b.d;
public final class b<R> extends j<R> {
/* renamed from: b reason: collision with root package name */
final g f7015b;
final org.b.b<? extends R> c;
static final class a<R> extends AtomicReference<d> implements io.reactivex.d, o<R>, d {
/* renamed from: a reason: collision with root package name */
final c<? super R> f7016a;
/* renamed from: b reason: collision with root package name */
org.b.b<? extends R> f7017b;
io.reactivex.b.c c;
final AtomicLong d = new AtomicLong();
a(c<? super R> cVar, org.b.b<? extends R> bVar) {
this.f7016a = cVar;
this.f7017b = bVar;
}
public final void onNext(R r) {
this.f7016a.onNext(r);
}
public final void onError(Throwable th) {
this.f7016a.onError(th);
}
public final void onComplete() {
org.b.b<? extends R> bVar = this.f7017b;
if (bVar == null) {
this.f7016a.onComplete();
return;
}
this.f7017b = null;
bVar.subscribe(this);
}
public final void request(long j) {
SubscriptionHelper.deferredRequest(this, this.d, j);
}
public final void cancel() {
this.c.dispose();
SubscriptionHelper.cancel(this);
}
public final void onSubscribe(io.reactivex.b.c cVar) {
if (DisposableHelper.validate(this.c, cVar)) {
this.c = cVar;
this.f7016a.onSubscribe(this);
}
}
public final void onSubscribe(d dVar) {
SubscriptionHelper.deferredSetOnce(this, this.d, dVar);
}
}
public b(g gVar, org.b.b<? extends R> bVar) {
this.f7015b = gVar;
this.c = bVar;
}
public final void subscribeActual(c<? super R> cVar) {
this.f7015b.subscribe(new a(cVar, this.c));
}
}
| [
"MaxBaseCode@gmail.com"
] | MaxBaseCode@gmail.com |
8f52aa7c144b43724e6c0aa7868c088ba1c59577 | 3169c503dfedb9c3f874a8c00621458d39182f73 | /src/cn/enncy/scs/pojo/Setting.java | f89d1b4ae1f83a51bdfce3f0cac91386ada0a79e | [
"Apache-2.0"
] | permissive | enncy/student-course-selection | 68c697766a6a004cfd2d63a53f6e9a81bf37619a | cebbb6d5343a507f33b266999e84bd6ad2a65290 | refs/heads/main | 2023-06-08T21:57:46.916091 | 2021-06-29T11:15:27 | 2021-06-29T11:15:27 | 358,104,145 | 10 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,340 | java | package cn.enncy.scs.pojo;
import cn.enncy.scs.pojo.annotation.Info;
/**
* //TODO
* <br/>Created in 21:16 2021/4/18
*
* @author: enncy
*/
public class Setting extends BaseObject{
@Info("键")
private String name;
@Info("值")
private String value;
@Info("设置描述")
private String description;
public Setting() { }
public Setting(String name, String value, String description) {
this.name = name;
this.value = value;
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "Setting{" +
"id=" + id +
", create_time=" + create_time +
", update_time=" + update_time +
", name='" + name + '\'' +
", value='" + value + '\'' +
", description='" + description + '\'' +
'}';
}
}
| [
"877526278@qq.com"
] | 877526278@qq.com |
38a50ffd268a5d69faf62b381707b45eb134403d | beef5e54ffc337dc59f7d0a869e756b76224341c | /product-api/src/main/java/microservices/core/api/product/composite/ProductCompositeService.java | 063d6bd6f7da5075a081a29f048e0dbdffdf134d | [] | no_license | hareesh996/product-application | 9e9759749b41a08c32fdee198b09e5239edb7ded | 5ca3a90393f2c5e47c0b60649de57e94f8daeb5b | refs/heads/master | 2021-01-05T03:34:12.403930 | 2020-02-16T09:27:11 | 2020-02-16T09:27:11 | 240,864,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package microservices.core.api.product.composite;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
public interface ProductCompositeService {
/**
* Sample usage: curl $HOST:$PORT/product-composite/1
*
* @param productId
* @return the composite product info, if found, else null
*/
@GetMapping(
value = "/product-composite/{productId}",
produces = "application/json")
ProductAggregate getProduct(@PathVariable int productId);
}
| [
"hareesh996@gmail.com"
] | hareesh996@gmail.com |
05d7a29afd79d746b5b1be68db1728c3a58cc757 | ffd8a2478f9708a83f0b4b19596c30a2ee43bb82 | /techproedsummer2020turkish/src/day20arrays/Alistirma11.java | dd86c74f8b63cbb892e1ecb8760afc21c810a794 | [] | no_license | ahmetyanik/JAVA | ce92ae9fbba6db586507b383a5d2c462e20e97a3 | 0bb2df57ac46a5fa46fd127ab9f134b24c2cd78e | refs/heads/master | 2023-05-31T05:44:19.123691 | 2021-07-01T18:04:12 | 2021-07-01T18:04:12 | 382,117,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package day20arrays;
import java.util.Arrays;
import java.util.Scanner;
public class Alistirma11 {
public static void main(String[] args) {
// length 5 olan bir int array giriyoruz, array.de 2 varsa ve
//bir sonraki değer 3 ise 3 değerini 0 ile değiştiriyoruz.
int arr[] = new int[5];
Scanner scanner = new Scanner(System.in);
System.out.print("5 elemanli arrayinize elemanlari gönderiniz: ");
for(int i=0;i<5;i++) {
arr[i] = scanner.nextInt();
}
System.out.println(Arrays.toString(arr));
Arrays.sort(arr);
System.out.println(Arrays.toString(arr));
Arrays.binarySearch(arr, 2);
System.out.println(Arrays.binarySearch(arr, 2));
//if(Arrays.binarySearch(arr, 2) && )
}
}
| [
"ahmetyank4242@gmail.com"
] | ahmetyank4242@gmail.com |
36f2120c76bd3287f83560d3c98d1b8d91fbdb31 | 3eca6278418d9eef7f5f850b23714a8356ef525f | /tumi/ServicioEJB/ejbModule/pe/com/tumi/servicio/solicitudPrestamo/facade/PrestamoFacadeRemote.java | f5c500838c96fd97c6e0e3c9b95d3e6720f419f5 | [] | no_license | cdelosrios88/tumiws-bizarq | 2728235b3f3239f12f14b586bb6349e2f9b8cf4f | 7b32fa5765a4384b8d219c5f95327b2e14dd07ac | refs/heads/master | 2021-01-23T22:53:21.052873 | 2014-07-05T05:19:58 | 2014-07-05T05:19:58 | 32,641,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,308 | java | package pe.com.tumi.servicio.solicitudPrestamo.facade;
import java.util.List;
import javax.ejb.Remote;
import pe.com.tumi.credito.socio.aperturaCuenta.core.domain.Cuenta;
import pe.com.tumi.framework.negocio.exception.BusinessException;
import pe.com.tumi.parametro.general.domain.Archivo;
import pe.com.tumi.persona.core.domain.CuentaBancaria;
import pe.com.tumi.persona.core.domain.Persona;
import pe.com.tumi.seguridad.login.domain.Usuario;
import pe.com.tumi.servicio.configuracion.domain.ConfServDetalleId;
import pe.com.tumi.servicio.solicitudPrestamo.domain.CancelacionCredito;
import pe.com.tumi.servicio.solicitudPrestamo.domain.CronogramaCredito;
import pe.com.tumi.servicio.solicitudPrestamo.domain.EgresoDetalleInterfaz;
import pe.com.tumi.servicio.solicitudPrestamo.domain.EstadoCredito;
import pe.com.tumi.servicio.solicitudPrestamo.domain.ExpedienteCredito;
import pe.com.tumi.servicio.solicitudPrestamo.domain.ExpedienteCreditoId;
import pe.com.tumi.servicio.solicitudPrestamo.domain.RequisitoCredito;
import pe.com.tumi.servicio.solicitudPrestamo.domain.composite.RequisitoCreditoComp;
import pe.com.tumi.servicio.solicitudPrestamo.domain.composite.RequisitoCreditoComp2;
import pe.com.tumi.tesoreria.banco.domain.Bancocuenta;
import pe.com.tumi.tesoreria.egreso.domain.ControlFondosFijos;
import pe.com.tumi.tesoreria.egreso.domain.Egreso;
@Remote
public interface PrestamoFacadeRemote {
public List<ExpedienteCredito> obtenerExpedientePorIdPersonayIdEmpresa(Integer intIdPersona, Integer intIdEmpresa) throws BusinessException;
public List<ExpedienteCredito> buscarExpedienteParaGiro(List<Persona> listaPersonaFiltro, Integer intTipoCreditoFiltro,
EstadoCredito estadoCreditoFiltro, Integer intItemExpedienteFiltro, Integer intTipoBusquedaSucursal,
Integer intIdSucursalFiltro, Integer intIdSubsucursalFiltro) throws BusinessException;
public List<CancelacionCredito> getListaCancelacionCreditoPorExpedienteCredito(ExpedienteCredito expedienteCredito) throws BusinessException;
public ExpedienteCredito grabarGiroPrestamo(ExpedienteCredito expedienteCredito) throws BusinessException;
public List<CronogramaCredito> getListaCronogramaCreditoPorExpedienteCredito(ExpedienteCredito expedienteCredito) throws BusinessException;
public EstadoCredito obtenerUltimoEstadoCredito(ExpedienteCredito expedienteCredito, Integer intTipoEstado) throws BusinessException;
public Cuenta getCuentaActualPorIdPersona(Integer intIdPersona, Integer intIdEmpresa) throws BusinessException;
public List<EgresoDetalleInterfaz> cargarListaEgresoDetalleInterfaz(ExpedienteCredito expedienteCredito) throws BusinessException;
public Egreso generarEgresoPrestamo(ExpedienteCredito expedienteCredito, ControlFondosFijos controlFondosFijos, Usuario usuario)
throws BusinessException;
public ExpedienteCredito getExpedienteCreditoPorId(ExpedienteCreditoId expedienteCreditoId) throws BusinessException;
public ExpedienteCredito obtenerExpedientePorEgreso(Egreso egreso)throws BusinessException;
public Egreso generarEgresoPrestamoCheque(ExpedienteCredito expedienteCredito, Bancocuenta bancoCuenta, Usuario usuario,
Integer intNumeroCheque, Integer intTipoDocumentoValidar)throws BusinessException;
public Egreso generarEgresoPrestamoTransferencia(ExpedienteCredito expedienteCredito, Bancocuenta bancoCuentaOrigen, Usuario usuario,
Integer intNumeroTransferencia, Integer intTipoDocumentoValidar, CuentaBancaria cuentaBancariaDestino)throws BusinessException;
//JCHAVEZ 31.01.2014
public List<RequisitoCreditoComp> getRequisitoGiroPrestamo(ExpedienteCredito expCred) throws BusinessException;
//JCHAVEZ 03.02.2014
public RequisitoCredito grabarRequisito(RequisitoCredito reqCred) throws BusinessException;
public List<RequisitoCredito> getListaPorPkExpedienteCreditoYRequisitoDetalle(ExpedienteCreditoId pId, ConfServDetalleId rId) throws BusinessException;
public Archivo getArchivoPorRequisitoCredito(RequisitoCredito reqCred)throws BusinessException;
//JCHAVEZ 11.02.2014
public List<RequisitoCreditoComp2> getRequisitoGiroPrestamoBanco(ExpedienteCredito expCred) throws BusinessException;
public ExpedienteCredito grabarGiroPrestamoPorTesoreria(ExpedienteCredito expedienteCredito) throws BusinessException;
}
| [
"cdelosrios@bizarq.com@b3a863b4-f5f8-5366-a268-df30542ed8c1"
] | cdelosrios@bizarq.com@b3a863b4-f5f8-5366-a268-df30542ed8c1 |
2e5a369344c3bfca31d21398ee28523a527b40eb | 59b8d2e90cbaeeca7b35d2ba210047ca5a38a3e3 | /week-3/day-2/Arrays and functions/src/AppendA.java | 1a9ef6eb3db93a5fdc519cb1e1d8ba51af4242ee | [] | no_license | green-fox-academy/deichlera | d4572253e4c2ba72787594fcf8156571ab068d10 | 5425592880c439d7065ead5439877bfd00b95f94 | refs/heads/master | 2020-03-10T09:48:57.580609 | 2018-06-13T21:35:52 | 2018-06-13T21:35:52 | 129,319,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | public class AppendA {
public static void main(String[] args) {
// - Create an array variable named `animals`
// with the following content: `["kuty", "macsk", "cic"]`
// - Add all elements an `"a"` at the end
String[] animals = new String[]{"kuty", "macsk", "cic"};
adda(animals);
for (int i = 0; i < animals.length; i++) {
System.out.printf("%s ", animals[i]);
}
System.out.println();
}
private static void adda(String[] animals) {
for (int i = 0; i < animals.length; i++) {
animals[i] += "a";
}
}
}
| [
"deichleradel@gmail.com"
] | deichleradel@gmail.com |
461026f71c0d7695522e48ca9b3c4189786aa350 | 394613b2aae97ff96b8b83d08878f6401bdef118 | /src/generic_libraries/Login.java | 7756026c3de5e1a6f1b8b2348a0cede9a1d9b145 | [] | no_license | selvirakchana/Gmail_Bat2 | d894fa9f9e5b96f6ad67bb4073102a7ce0a3e4f8 | aaad72681091f9bd1c9b2dfda68445dbcb7e4c1e | refs/heads/master | 2020-09-04T11:41:23.635841 | 2019-11-05T10:55:09 | 2019-11-05T10:55:09 | 219,722,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | package generic_libraries;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.openqa.selenium.WebDriver;
public class Login implements Auto_Const{
public static void login_url(WebDriver driver) throws EncryptedDocumentException, InvalidFormatException, IOException, InterruptedException
{
driver.manage().window().maximize();
/* String filename = "./data/Data.xlsx";
String sheetn="property";
ArrayList<String> nl = ReadData.Read_data(filename, sheetn);
String url=nl.get(0);
String wt=nl.get(1);
long w = Long.parseLong(wt);
driver.get(url);*/
/*Properties p = new Properties();
p.load(new FileInputStream("./property.properties"));*/
String url1 = ReadData.getproper(PROPERTY_FILE, "url");
driver.get(url1);
long wt = Long.parseLong(ReadData.getproper(PROPERTY_FILE, "iw"));
System.out.println(wt);
driver.manage().timeouts().implicitlyWait(wt, TimeUnit.SECONDS);
}
}
| [
"Selvi Nagappan@Selvi-VivoBook"
] | Selvi Nagappan@Selvi-VivoBook |
7c34e02db63342af03334b715aeaf8539d7e92f1 | 51388aef10e4ee3788983bd9eaab1b8d57b28078 | /src/main/java/me/olook/sdk/addiction/kernel/DefaultClient.java | f30652b228db7d5fd53043c93562597e06d8e6f1 | [] | no_license | vayci/anti-addiction-java-sdk | ca998800ad52a2c2eb2722fdbc21f759d7f82830 | c1e96e7fbe523f243c45fd94e37df0706b227c23 | refs/heads/master | 2023-03-31T03:33:44.878042 | 2021-03-23T06:06:19 | 2021-03-23T06:06:19 | 348,232,521 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,419 | java | package me.olook.sdk.addiction.kernel;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import me.olook.sdk.addiction.model.IClientRequest;
import me.olook.sdk.addiction.model.Response;
import me.olook.sdk.addiction.request.ClientHelper;
import me.olook.sdk.addiction.security.AES;
import me.olook.sdk.addiction.security.HMAC;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URL;
import java.util.Collections;
import java.util.Map;
/**
* @author Red
*/
public class DefaultClient {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultClient.class);
private ClientContext clientContext;
private Map<String,Object> clientConfigMap;
public DefaultClient(ClientContext clientContext) {
this.clientContext = clientContext;
}
public DefaultClient(ClientContext clientContext, IClientConfig clientConfig) {
this.clientContext = clientContext;
this.clientConfigMap = clientConfig.toConfigMap();
}
protected String encryptBody(IClientRequest clientRequest){
String encrypt = AES.gcmEncrypt(new Gson().toJson(clientRequest), clientContext.getSecretKey());
return "{\"data\":\""+encrypt+"\"}";
}
protected Response get(String uri, IClientRequest request) throws Exception {
URL url = new URL(uri);
OkHttpClient client = ClientHelper.getOkHttpClient(url.getHost(), url.getPort(), clientConfigMap);
Request.Builder requestBuilder = generateRequestWithHeader("GET", request, "");
okhttp3.Response response = client.newCall(requestBuilder.url(url+"?ai=")
.get()
.build()).execute();
if(response.isSuccessful()){
assert response.body() != null;
JsonElement jsonElement = JsonParser.parseString(response.body().string());
return new Gson().fromJson(jsonElement, Response.class);
}else{
LOGGER.error("error request to {} , response code: {}, message: {}",uri,response.code(),response.message());
return null;
}
}
protected Response post(String uri, IClientRequest request) throws Exception {
URL url = new URL(uri);
OkHttpClient client = ClientHelper.getOkHttpClient(url.getHost(), url.getPort(), clientConfigMap);
String encryptBody = encryptBody(request);
Request.Builder requestBuilder = generateRequestWithHeader("POST", request, encryptBody);
okhttp3.Response response = client.newCall(requestBuilder.url(url+"?ai=")
.post(RequestBody.create(MediaType.parse("application/json;charset=utf-8"),encryptBody))
.build()).execute();
if(response.isSuccessful()){
assert response.body() != null;
JsonElement jsonElement = JsonParser.parseString(response.body().string());
return new Gson().fromJson(jsonElement, Response.class);
}else{
LOGGER.error("error request to {} , response code: {}, message: {}",uri,response.code(),response.message());
return null;
}
}
protected Request.Builder generateRequestWithHeader(String httpMethod, IClientRequest request, String encryptBody){
Request.Builder requestBuilder = new Request.Builder();
requestBuilder.addHeader("Content-Type","application/json;charset=utf-8");
requestBuilder.addHeader("appId",clientContext.getAppId());
requestBuilder.addHeader("bizId",clientContext.getBizId());
String time = String.valueOf(System.currentTimeMillis());
requestBuilder.addHeader("timestamps",time);
if("POST".equals(httpMethod)){
requestBuilder.addHeader("sign",
HMAC.sign(clientContext.getAppId(),clientContext.getBizId(),
time,clientContext.getSecretKey(),
Collections.emptyMap(),encryptBody));
}
if("GET".equals(httpMethod)){
requestBuilder.addHeader("sign",
HMAC.sign(clientContext.getAppId(),clientContext.getBizId(),
time,clientContext.getSecretKey(),
request.toParamMap(),""));
}
return requestBuilder;
}
}
| [
"zhaohongwei@dragonest.com"
] | zhaohongwei@dragonest.com |
91641427f433359b7aeb42580f6fcb9b60e47cb6 | 678cbeb183595e64b9869268a0bf4caced683a07 | /2ano/LI3/projJava/src/src/Controller/IConverter.java | a41b1aebb6cabd31568d39770eea88c89553c032 | [] | no_license | ruiAzevedo19/UMinho | 056e8ef2e0028d52c4fe2bb70a06edc4e6502e12 | 37adef2754906d550d07b2a4851b7ce6aee284fd | refs/heads/master | 2022-09-17T20:06:57.005787 | 2021-05-26T09:34:02 | 2021-05-26T09:34:02 | 242,264,483 | 19 | 1 | null | 2022-09-08T01:13:27 | 2020-02-22T02:07:06 | Python | UTF-8 | Java | false | false | 872 | java | package Controller;
import Model.Answer.*;
import Model.Interface.IProduct;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
public interface IConverter {
List<List<Object>> q1Converter(List<IProduct> data);
Object[][] q2Converter(SalesClients sc);
Object[][] q3Converter(PurchProdsSpent pps);
Object[][] q4Converter(PurchClientsBillings pcb);
List<List<Object>> q5Converter(Set<QuantProd> mpp);
List<List<Object>> q6Converter(Set<QuantProd> mbp);
Object[][] q7Converter(List<List<AbstractMap.SimpleEntry<String,Double>>> result);
List<List<Object>> q8Converter(List<AbstractMap.SimpleEntry<String,Integer>> c);
List<List<Object>> q9Converter(List<ClientQuantBillings> cqb);
List<AbstractMap.SimpleEntry<Object,Object[][]>> q10Converter(Map<String,List<List<Double>>> result);
}
| [
"ruiazevedo@MBP-de-Rui.lan"
] | ruiazevedo@MBP-de-Rui.lan |
1918b537e313dfb7bc7c720fbeeb4fa18f0b839e | 4627d514d6664526f58fbe3cac830a54679749cd | /results/evosuite5/mockito-org.mockito.cglib.core.ClassEmitter-19/org/mockito/cglib/core/ClassEmitter_ESTest_scaffolding.java | 9c3cecf49f6dddf77411712c55e0ec8382eab80d | [] | no_license | STAMP-project/Cling-application | c624175a4aa24bb9b29b53f9b84c42a0f18631bd | 0ff4d7652b434cbfd9be8d8bb38cfc8d8eaa51b5 | refs/heads/master | 2022-07-27T09:30:16.423362 | 2022-07-19T12:01:46 | 2022-07-19T12:01:46 | 254,310,667 | 2 | 2 | null | 2021-07-12T12:29:50 | 2020-04-09T08:11:35 | null | UTF-8 | Java | false | false | 6,609 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Aug 13 14:00:11 GMT 2019
*/
package org.mockito.cglib.core;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class ClassEmitter_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.mockito.cglib.core.ClassEmitter";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.dir", "/home/pderakhshanfar/botsing-integration-experiment");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ClassEmitter_ESTest_scaffolding.class.getClassLoader() ,
"org.mockito.cglib.core.MethodInfo",
"org.mockito.cglib.core.CodeEmitter$State",
"org.mockito.cglib.core.TypeUtils",
"org.mockito.cglib.core.CodeEmitter",
"org.mockito.cglib.core.Block",
"org.mockito.cglib.core.Constants",
"org.mockito.asm.ClassReader",
"org.mockito.cglib.core.LocalVariablesSorter$1",
"org.mockito.cglib.core.LocalVariablesSorter",
"org.mockito.asm.Type",
"org.mockito.cglib.core.ClassEmitter$2",
"org.mockito.cglib.core.ClassEmitter$3",
"org.mockito.cglib.core.ClassInfo",
"org.mockito.asm.MethodWriter",
"org.mockito.asm.Opcodes",
"org.mockito.asm.AnnotationWriter",
"org.mockito.asm.Edge",
"org.mockito.cglib.core.ClassEmitter$FieldInfo",
"org.mockito.asm.Label",
"org.mockito.cglib.core.ClassEmitter$1",
"org.mockito.cglib.core.Signature",
"org.mockito.asm.Attribute",
"org.mockito.cglib.core.LocalVariablesSorter$State",
"org.mockito.asm.AnnotationVisitor",
"org.mockito.asm.ClassAdapter",
"org.mockito.cglib.core.Predicate",
"org.mockito.cglib.core.Local",
"org.mockito.asm.ByteVector",
"org.mockito.asm.Item",
"org.mockito.asm.ClassVisitor",
"org.mockito.cglib.core.ClassEmitter",
"org.mockito.asm.FieldVisitor",
"org.mockito.cglib.core.CodeGenerationException",
"org.mockito.asm.MethodVisitor",
"org.mockito.cglib.core.CollectionUtils",
"org.mockito.cglib.core.Transformer",
"org.mockito.asm.Frame",
"org.mockito.asm.MethodAdapter",
"org.mockito.asm.ClassWriter",
"org.mockito.cglib.core.ProcessSwitchCallback",
"org.mockito.asm.FieldWriter"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ClassEmitter_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.mockito.asm.ClassAdapter",
"org.mockito.cglib.core.ClassEmitter",
"org.mockito.cglib.core.ClassInfo",
"org.mockito.cglib.core.ClassEmitter$1",
"org.mockito.asm.MethodAdapter",
"org.mockito.cglib.core.ClassEmitter$2",
"org.mockito.cglib.core.LocalVariablesSorter",
"org.mockito.cglib.core.CollectionUtils",
"org.mockito.cglib.core.TypeUtils",
"org.mockito.cglib.core.Signature",
"org.mockito.cglib.core.CodeEmitter",
"org.mockito.cglib.core.ClassEmitter$3",
"org.mockito.cglib.core.ClassEmitter$FieldInfo",
"org.mockito.asm.Type",
"org.mockito.cglib.core.Constants",
"org.mockito.asm.ClassReader",
"org.mockito.asm.ClassWriter",
"org.mockito.asm.ByteVector",
"org.mockito.asm.Item",
"org.mockito.asm.MethodWriter",
"org.mockito.asm.Attribute",
"org.mockito.asm.FieldWriter",
"org.mockito.asm.AnnotationWriter",
"org.mockito.asm.Label",
"org.mockito.asm.Frame",
"org.mockito.cglib.core.LocalVariablesSorter$State",
"org.mockito.cglib.core.MethodInfo",
"org.mockito.cglib.core.CodeEmitter$State",
"org.mockito.asm.Edge"
);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
9c26763370f50c7845f8461e7435258b71d93c2a | 6e97a55c947a53c0a0499424a4b227edfca3fe44 | /backend/src/main/java/com/gabriel/dsvendas/dto/SaleDTO.java | 6887fd785a2dff98d0df1d986d79d7c999400ea3 | [] | no_license | gabrielduqueschiffner/SemanaSpringReact4 | 1101e244ed76c8015015509452f9f294e286ffa6 | f90e8a6b32ef3d0a0eee60782b4fa5447c02e36e | refs/heads/master | 2023-07-24T00:53:26.892816 | 2021-09-11T16:54:31 | 2021-09-11T16:54:31 | 403,591,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | package com.gabriel.dsvendas.dto;
import java.time.LocalDate;
import com.gabriel.dsvendas.entities.Sale;
public class SaleDTO {
private long id;
private Integer visited;
private Integer deals;
private Double amount;
private LocalDate date;
private SellerDTO seller;
public SaleDTO() {
}
public SaleDTO(long id, Integer visited, Integer deals, Double amount, LocalDate date, SellerDTO seller) {
this.id = id;
this.visited = visited;
this.deals = deals;
this.amount = amount;
this.date = date;
this.seller = seller;
}
public SaleDTO(Sale entity) {
id = entity.getId();
visited = entity.getVisited();
deals = entity.getDeals();
amount = entity.getAmount();
date = entity.getDate();
seller = new SellerDTO(entity.getSeller());
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Integer getVisited() {
return visited;
}
public void setVisited(Integer visited) {
this.visited = visited;
}
public Integer getDeals() {
return deals;
}
public void setDeals(Integer deals) {
this.deals = deals;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public SellerDTO getSeller() {
return seller;
}
public void setSeller(SellerDTO seller) {
this.seller = seller;
}
}
| [
"76018843+gabrielduqueschiffner@users.noreply.github.com"
] | 76018843+gabrielduqueschiffner@users.noreply.github.com |
d7adbed23dae63cef964ba480c3a9165450ba234 | a5a81138a252f33c4f18012ccdaf8b08f22c4d5f | /mugen-beanmodule/src/java/com/arexis/mugen/ontologies/doid/DoidDTO_ISA.java | 1834a92fa9d5eff8ee8b8b761da639fb3f4d2088 | [] | no_license | bioit/mugen | ce97e540d05af07f5b03df0e6ce411c8d828e332 | 8d96871be007d9ed79f1d61a6ea21d093375e780 | refs/heads/master | 2021-01-17T11:55:05.738117 | 2011-01-21T21:07:58 | 2011-01-21T21:07:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.arexis.mugen.ontologies.doid;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
public class DoidDTO_ISA implements Serializable {
private String is_a;
public DoidDTO_ISA(String passed_is_a) {
this.is_a = passed_is_a;
}
public String getIsA(){
return is_a;
}
public int getIsAInt(){
return new Integer(is_a).intValue();
}
}
| [
"discounix@Disco-Unixs-iMac.local"
] | discounix@Disco-Unixs-iMac.local |
d3fff6d2034762a1a067d135ab2f3a0f0e2c66cc | f13546d97df8655d7bd53da16969a401c7674e9a | /src/main/java/com/leinardi/pycharm/pylint/handlers/ScanFilesBeforeCheckinHandlerFactory.java | 16e3331d0da4b99595e6dce4ab6704048d385b62 | [
"Apache-2.0"
] | permissive | CyberFlameGO/pylint-pycharm | d9955ba7496df61da4a217a1905173e6214c588a | 3b8c28d40c8a127a12d8e8bc62852472d9eece41 | refs/heads/release | 2023-06-15T00:34:54.625271 | 2020-04-25T09:51:49 | 2020-04-25T09:51:49 | 384,015,699 | 0 | 0 | Apache-2.0 | 2021-07-08T05:53:32 | 2021-07-08T05:52:10 | null | UTF-8 | Java | false | false | 1,292 | java | /*
* Copyright 2018 Roberto Leinardi.
*
* 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.leinardi.pycharm.pylint.handlers;
import com.intellij.openapi.vcs.CheckinProjectPanel;
import com.intellij.openapi.vcs.changes.CommitContext;
import com.intellij.openapi.vcs.checkin.CheckinHandler;
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory;
import org.jetbrains.annotations.NotNull;
public class ScanFilesBeforeCheckinHandlerFactory extends CheckinHandlerFactory {
@NotNull
@Override
public CheckinHandler createHandler(@NotNull final CheckinProjectPanel checkinProjectPanel,
@NotNull final CommitContext commitContext) {
return new ScanFilesBeforeCheckinHandler(checkinProjectPanel);
}
}
| [
"leinardi@gmail.com"
] | leinardi@gmail.com |
2f95b4578425f9a32b8c23f912b0f008ea461085 | 14cbeb1b92e4ddb062f26529c1505db747819303 | /amp(0.0.8)/src/main/java/com/jj/amp/MessageController.java | 095374d560f2244149f4a4c44b44edfdce383bd5 | [] | no_license | leetaehyeon123/AMP | 6b18d2657d45e11a3da824d6d5ba00eb22f75706 | 8a444045a231a5b3c6e365f2344c2c1b903872f9 | refs/heads/main | 2023-04-14T19:15:42.951212 | 2021-05-03T08:04:27 | 2021-05-03T08:04:27 | 355,079,076 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,268 | java | package com.jj.amp;
import java.util.ArrayList;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.jj.dao.MessageDao;
import com.jj.vo.MessageVo;
/**
* Handles requests for the application home page.
*/
@Controller
public class MessageController {
@Autowired
MessageVo messageVo;
@Autowired
MessageDao messageDao;
@RequestMapping(value = "/message", method = RequestMethod.GET)
public String message(Locale locale, Model model) {
return "academy/message/message";
}
@RequestMapping(value = "/notice", method = RequestMethod.GET)
public String notice(Locale locale, Model model) {
return "academy/message/notice";
}
@RequestMapping(value = "/message_kit", method = RequestMethod.GET)
public String messagekit(Locale locale, Model model,String roomId) {
messageVo.setRoom(Integer.parseInt(roomId));
ArrayList<MessageVo> list=(ArrayList<MessageVo>)messageDao.selectMessage(messageVo);
model.addAttribute("list",list);
return "academy/message/message_kit";
}
}
| [
"harry7141@naver.com"
] | harry7141@naver.com |
c755cc7a04eca69522860bee859ca07bd0e8bf3e | 37ecd0aee15c43977f123172958c14d8cf1f3625 | /Java/ThreadMethods.java | 4f25974ff1e4e2228581a8e49cc10fc97c87442c | [] | no_license | gmsgit/TEMPORARY | d6d63b967772f62404a8fbffa549bde1447205c5 | cc80e76b0903c1ab21735609628c8e9fe8aa9e7f | refs/heads/master | 2023-06-26T18:39:52.375510 | 2021-07-29T03:15:55 | 2021-07-29T03:15:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 499 | java | import java.lang.*;
import java.util.*;
class ThreadMethod extends Thread
{
public ThreadMethod(String x)
{
super(x);
setPriority(ThreadMethod.MAX_PRIORITY);
}
public void run()
{
int i=1;
while(true)
{
System.out.println(i++);
}
}
}
public class ThreadMethods {
public static void main(String[] args) {
ThreadMethod TM=new ThreadMethod("LOOP");
TM.setDaemon(true);
TM.start();
}
}
| [
"madhusudhan.gms@outlook.com"
] | madhusudhan.gms@outlook.com |
bcf8b83a26a3fd9cc9a3dfcfe67ce0d5d03d4e38 | f2e5f0c74cca281000e5b0a47044a84b49d5cb87 | /Comp401/Comp 401 Workspace/lecture09/src/lec09/ex4/SubA.java | 423c6e5f59907348de5abe7be7d3289ec87465cb | [] | no_license | AaronZhangGitHub/Archive | 7ad351831c7d1d197471213a2b483696ee38f426 | e803443d5333f7f8f99e99e257735d5440ca8df7 | refs/heads/master | 2021-01-16T19:06:45.637250 | 2017-08-12T20:49:55 | 2017-08-12T20:49:55 | 100,136,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package lec09.ex4;
public class SubA extends A {
private int z;
public SubA(int x, int y, int z) {
super(x,y);
this.z = z;
}
public int methodInSubA() {
return methodInA() + z;
}
}
| [
"aaronz@live.unc.edu"
] | aaronz@live.unc.edu |
8166774c1c46b6632f391a568198ce4b36f7884b | 398e376f38a1a8b4623ab2cb191624ebdaf2efd5 | /src/main/java/yui/momoka/dao/BlogTypeDao.java | 1523e31068f45ce69d953b3d5c8b2bbefd738251 | [] | no_license | uchiyamakoki/momoka01 | af2e3fd9ae56a9b501a3747535147d2d2b74da2b | 644e9a0174121081d7f60e2cf3bae90a5e2f2a29 | refs/heads/master | 2021-04-03T10:13:24.444089 | 2018-03-10T15:35:46 | 2018-03-10T15:35:46 | 124,387,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package yui.momoka.dao;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import yui.momoka.entity.BlogType;
import java.util.List;
/*
博客类别信息
*/
@Repository
public interface BlogTypeDao {
/**
* 添加博客类别信息
* @param blogType
* @return
*/
Integer addBlogType(BlogType blogType);
/**
* 删除博客类别信息
* @param id
* @return
*/
Integer deleteBlogType(Integer id);
/**
* 更新博客类别信息
* @param blogType
* @return
*/
Integer updateBlogType(BlogType blogType);
/**
* 根据id查询博客类别信息
* @param id
* @return
*/
BlogType getById(Integer id);
/**
* 分页查询博客类别信息
* @param start
* @param end
* @return
*/
List<BlogType> listByPage(@Param("start") Integer start, @Param("end") Integer end);
/**
* 查询总记录数
* @return
*/
Long getTotal();
}
| [
"454768497@qq.com"
] | 454768497@qq.com |
e9cf52c86b14b1058a5e6c1a2b45318d297f2525 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/android/net/wifi/hotspot2/IProvisioningCallback.java | 87063aeccbbf9c5c376d3c335afa019e0182a120 | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,284 | java | package android.net.wifi.hotspot2;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
public interface IProvisioningCallback extends IInterface {
public static abstract class Stub extends Binder implements IProvisioningCallback {
private static final String DESCRIPTOR = "android.net.wifi.hotspot2.IProvisioningCallback";
static final int TRANSACTION_onProvisioningFailure = 1;
static final int TRANSACTION_onProvisioningStatus = 2;
private static class Proxy implements IProvisioningCallback {
private IBinder mRemote;
Proxy(IBinder remote) {
this.mRemote = remote;
}
public IBinder asBinder() {
return this.mRemote;
}
public String getInterfaceDescriptor() {
return Stub.DESCRIPTOR;
}
public void onProvisioningFailure(int status) throws RemoteException {
Parcel _data = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
_data.writeInt(status);
this.mRemote.transact(1, _data, null, 1);
} finally {
_data.recycle();
}
}
public void onProvisioningStatus(int status) throws RemoteException {
Parcel _data = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
_data.writeInt(status);
this.mRemote.transact(2, _data, null, 1);
} finally {
_data.recycle();
}
}
}
public Stub() {
attachInterface(this, DESCRIPTOR);
}
public static IProvisioningCallback asInterface(IBinder obj) {
if (obj == null) {
return null;
}
IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (iin == null || !(iin instanceof IProvisioningCallback)) {
return new Proxy(obj);
}
return (IProvisioningCallback) iin;
}
public IBinder asBinder() {
return this;
}
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (code != 1598968902) {
switch (code) {
case 1:
data.enforceInterface(DESCRIPTOR);
onProvisioningFailure(data.readInt());
return true;
case 2:
data.enforceInterface(DESCRIPTOR);
onProvisioningStatus(data.readInt());
return true;
default:
return super.onTransact(code, data, reply, flags);
}
} else {
reply.writeString(DESCRIPTOR);
return true;
}
}
}
void onProvisioningFailure(int i) throws RemoteException;
void onProvisioningStatus(int i) throws RemoteException;
}
| [
"dstmath@163.com"
] | dstmath@163.com |
77f50998385cd35840b8c6bafa7808bb33f1c0a4 | 628cf6fc211841dbb3f22e30e8b96562886c3724 | /src/api-learning/api-plugin/src/cn/edu/pku/rm/learnapi/Combinator.java | edcdd9b4e2b4cc41a49b623e68d63ef622c2fa26 | [] | no_license | DylanYu/smatrt | ef4c54bf187762bc22407ea4d6e2e6c879072949 | c85baa4255d2e6792c1ed9b1e7e184860cdac9ad | refs/heads/master | 2016-09-06T04:46:19.998706 | 2013-07-20T10:03:29 | 2013-07-20T10:03:29 | 33,805,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,068 | java | /**
*
*/
package cn.edu.pku.rm.learnapi;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.SourceTypeElementInfo;
import cn.edu.pku.sei.ra.dt.DtFactory;
import cn.edu.pku.sei.ra.dt.Place;
import cn.edu.pku.sei.ra.dt.Repository;
import cn.edu.pku.sei.ra.dt.Transition;
import cn.edu.pku.sei.ra.dt.TransitionType;
/**
* @author hubert
*
*/
public class Combinator {
List<Repository> origin;
Repository entry;
private class Candidate{
Repository master;
Repository slave;
Transition trans;
}
public Repository combine() throws JavaModelException{
int i=5;
while(true){
i--;
List<Candidate> candidates=new ArrayList<Candidate>();
if(entry==null)
entry=null;
for(Transition trans:entry.getTransition()){
IJavaElement je=trans.getJavaElement();
if(je==null || !(je instanceof IMethod))
continue;
for(Repository found:origin){
if(found==entry)
continue;
if(je.equals(found.getMethod())){
Candidate cd=new Candidate();
cd.master=entry;
cd.slave=found;
cd.trans=trans;
candidates.add(cd);
}
}
}
if(candidates.size()==0 || i==0)
return this.entry;
for(Candidate cd:candidates){
replaceTransition(cd.trans, cd.master, cd.slave);
}
}
}
public Combinator(List<Repository> origin, String entryName) throws JavaModelException{
this.origin=origin;
for(Repository rep:origin){
String temp=rep.getMethod().getElementName();
if(temp.endsWith(entryName))
entry=rep;
}
}
/**
* @throws JavaModelException
*
*/
public Combinator(List<Repository> origin, Repository entry) throws JavaModelException {
this.origin=origin;
this.entry=entry;
}
/***
* TODO be careful when there are multiple returns
* @param trans
* @param master
* @param slave
* @throws JavaModelException
*/
private void replaceTransition(Transition trans, Repository master, Repository orislave) throws JavaModelException{
List<Place> methodEnds=new ArrayList<Place>();
Repository slave=(Repository)EcoreUtil.copy(orislave);
if(trans.getSignature().equals("addProperties"))
System.out.println("for debug");
int start=0;
if(((IMethod)slave.getMethod()).getParameterNames().length<trans.getInput().size())
start=1;
for(Place para:slave.getPlace()){
if(para.getParaOrder()==0)
continue;
Transition intertrans=DtFactory.eINSTANCE.createTransition();
if(start+para.getParaOrder()-1 >= trans.getInput().size()){
System.out.println("for debug");
continue;
}
//String typesig=para.getTypefull();
//if(SourceSampleUtil.isForAPI(typesig)){
//intertrans.setSignature(typesig);
//intertrans.setInvolved(true);
//}
intertrans.getInput().add(trans.getInput().get(start+para.getParaOrder()-1));
intertrans.setType(TransitionType.INTERMEDIATE);
intertrans.setOutput(para);
master.getTransition().add(intertrans);
para.setParaOrder(0);
}
trans.getInput().clear();
for(Place place:slave.getPlace())
if("MethodEnd".equals(place.getName())){
Transition intertrans=DtFactory.eINSTANCE.createTransition();
intertrans.setType(TransitionType.INTERMEDIATE);
place.setName("inner return");
intertrans.getInput().add(place);
intertrans.setOutput(trans.getOutput());
master.getTransition().add(intertrans);
}
trans.getInput().clear();
trans.setOutput(null);
master.getPlace().addAll(slave.getPlace());
int i=master.getTransition().indexOf(trans);
master.getTransition().addAll(i,slave.getTransition());
master.getTransition().remove(trans);
}
}
| [
"fafeysong@fb895ce6-3987-11de-a15a-d1801d6fabe8"
] | fafeysong@fb895ce6-3987-11de-a15a-d1801d6fabe8 |
083594489d216f1b27d07f9b86dfa5d1fe47b841 | e44a5b0400ef74d4328b26f4f1ea540fe9b3d135 | /week-05/Wanderer/src/Boss.java | 0fce9ee95dd73e0aac2128116efd60c52e28a2b8 | [] | no_license | green-fox-academy/LSzelecsenyi | dd61c286f5498354dc6187da9a062092dfae0184 | de46ade561853ced3bed798e65a72dc61daa93e3 | refs/heads/master | 2021-09-04T11:47:05.078166 | 2018-01-18T12:02:45 | 2018-01-18T12:02:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | public class Boss extends Character {
String picBoss;
int bossLevel;
public Boss() {
super("Assets/boss.png", 1, 0);
// this.bossLevel = level;
maxHP = maxHP + d6.dice() + d6.dice() + d6.dice();
defend = d6.dice() + d6.dice();
strike = 5 + d6.dice();
this.posX = (int) (10.0 * Math.random());
this.posY = (int) (10.0 * Math.random());
this.picBoss = "Assets/boss.png";
}
}
| [
"szelelaci@gmail.com"
] | szelelaci@gmail.com |
983ce7e45804ff622a79d6f1475ddbc1bda43b05 | 812dbc150deb9c779514dc80fd521ca11fc428f4 | /code/com/jivesoftware/os/tasmo/tasmo-lib/src/main/java/com/jivesoftware/os/tasmo/lib/ingress/TasmoNotificationsIngress.java | bb662c911533a15cbd819825982de104be610a0d | [
"Apache-2.0"
] | permissive | jivesoftware/tasmo | 50d650262810c8744ff8e5b0817df16bc200a663 | 3de99a078de545f3c57f4876ba0fea1fcaa0fcf7 | refs/heads/master | 2021-03-19T07:14:50.144891 | 2014-08-08T00:19:04 | 2014-08-08T00:19:04 | 15,554,335 | 1 | 4 | null | 2017-03-08T00:58:55 | 2013-12-31T17:54:07 | Java | UTF-8 | Java | false | false | 4,466 | java | package com.jivesoftware.os.tasmo.lib.ingress;
import com.jivesoftware.os.jive.utils.base.interfaces.CallbackStream;
import com.jivesoftware.os.jive.utils.id.ObjectId;
import com.jivesoftware.os.jive.utils.id.TenantIdAndCentricId;
import com.jivesoftware.os.jive.utils.logger.MetricLogger;
import com.jivesoftware.os.jive.utils.logger.MetricLoggerFactory;
import com.jivesoftware.os.jive.utils.ordered.id.OrderIdProvider;
import com.jivesoftware.os.tasmo.id.ViewValue;
import com.jivesoftware.os.tasmo.lib.read.ReadMaterializerViewFields;
import com.jivesoftware.os.tasmo.lib.read.ViewFieldsResponse;
import com.jivesoftware.os.tasmo.lib.write.PathId;
import com.jivesoftware.os.tasmo.lib.write.ViewField;
import com.jivesoftware.os.tasmo.view.notification.api.ViewNotification;
import com.jivesoftware.os.tasmo.view.reader.api.ViewDescriptor;
import com.jivesoftware.os.tasmo.view.reader.service.writer.ViewValueWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
*
* @author jonathan.colt
*/
public class TasmoNotificationsIngress implements CallbackStream<List<ViewNotification>> {
private static final MetricLogger LOG = MetricLoggerFactory.getLogger();
private final OrderIdProvider threadTimestamp;
private final ReadMaterializerViewFields readMaterializer;
private final ViewValueWriter viewValueWriter;
public TasmoNotificationsIngress(OrderIdProvider threadTimestamp,
ReadMaterializerViewFields readMaterializer,
ViewValueWriter viewValueWriter) {
this.threadTimestamp = threadTimestamp;
this.readMaterializer = readMaterializer;
this.viewValueWriter = viewValueWriter;
}
@Override
public List<ViewNotification> callback(List<ViewNotification> viewNotifications) throws Exception {
List<ViewNotification> failedToProcess = new ArrayList<>();
if (viewNotifications == null) {
return failedToProcess;
}
Map<ViewDescriptor, ViewNotification> indexViewDescriptorToViewNotification = new HashMap<>();
List<ViewDescriptor> viewDescriptors = new ArrayList<>(viewNotifications.size());
for (ViewNotification viewNotification : viewNotifications) {
ViewDescriptor viewDescriptor = new ViewDescriptor(viewNotification.getTenantIdAndCentricId(),
viewNotification.getActorId(),
viewNotification.getViewId());
viewDescriptors.add(viewDescriptor);
indexViewDescriptorToViewNotification.put(viewDescriptor, viewNotification);
}
long threadTime = threadTimestamp.nextId();
Map<ViewDescriptor, ViewFieldsResponse> readMaterialized = readMaterializer.readMaterialize(viewDescriptors);
for (Entry<ViewDescriptor, ViewFieldsResponse> changeSets : readMaterialized.entrySet()) {
ViewDescriptor viewDescriptor = changeSets.getKey();
ViewFieldsResponse fieldsResponse = changeSets.getValue();
if (fieldsResponse.isOk()) {
TenantIdAndCentricId tenantIdAndCentricId = viewDescriptor.getTenantIdAndCentricId();
ViewValueWriter.Transaction transaction = viewValueWriter.begin(tenantIdAndCentricId);
for (ViewField change : fieldsResponse.getViewFields()) {
if (change.getType() == ViewField.ViewFieldChangeType.add) {
PathId[] modelPathInstanceIds = change.getModelPathInstanceIds();
ObjectId[] ids = new ObjectId[modelPathInstanceIds.length];
for (int i = 0; i < modelPathInstanceIds.length; i++) {
ids[i] = modelPathInstanceIds[i].getObjectId();
}
transaction.set(change.getViewObjectId(),
change.getModelPathIdHashcode(),
ids,
new ViewValue(change.getModelPathTimestamps(), change.getValue()),
threadTime);
}
}
viewValueWriter.commit(transaction);
viewValueWriter.clear(tenantIdAndCentricId, viewDescriptor.getViewId(), threadTime - 1);
} else {
failedToProcess.add(indexViewDescriptorToViewNotification.get(viewDescriptor));
}
}
return failedToProcess;
}
}
| [
"jonathan.colt@jivesoftware.com"
] | jonathan.colt@jivesoftware.com |
6fd65fed66880b8eab8e9f5aa6bd3bc2d2b155d3 | b4ddf172be01e33f5926c87e06ac9c9947842cb3 | /AppServiceNLD/app/src/main/java/lanazirot/com/appservicenld/User.java | 1a7d0aa168ca2828f6dcb9b6bd48d5a6efabebf4 | [] | no_license | lanazirot/AppService | 90ae4a6031b727476e3403a9d6e3e3dea1b21603 | 76a53b66de68f4d2bcb0fd79eb6270650aeb4692 | refs/heads/master | 2022-11-25T08:38:21.231880 | 2020-08-01T23:06:30 | 2020-08-01T23:06:30 | 284,238,136 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,859 | java | package lanazirot.com.appservicenld;
public class User {
public User(String id, String nombre, String correo, String contra, String edad, String ocupacion, String servicio, String tipousuario) {
this.id = id;
this.nombre = nombre;
this.correo = correo;
this.contra = contra;
this.edad = edad;
this.ocupacion = ocupacion;
this.servicio = servicio;
this.tipousuario = tipousuario;
}
public String nombre;
public void setNombre(String nombre) {
this.nombre = nombre;
}
public void setCorreo(String correo) {
this.correo = correo;
}
public void setContra(String contra) {
this.contra = contra;
}
public void setEdad(String edad) {
this.edad = edad;
}
public void setOcupacion(String ocupacion) {
this.ocupacion = ocupacion;
}
public void setServicio(String servicio) {
this.servicio = servicio;
}
public void setTipousuario(String tipousuario) {
this.tipousuario = tipousuario;
}
public void setId(String id) {
this.id = id;
}
public String correo;
public String contra;
public String edad;
public String ocupacion;
public String servicio;
public String tipousuario;
public String id;
public User() {
}
public String getNombre() {
return nombre;
}
public String getCorreo() {
return correo;
}
public String getContra() {
return contra;
}
public String getEdad() {
return edad;
}
public String getOcupacion() {
return ocupacion;
}
public String getServicio() {
return servicio;
}
public String getTipousuario() {
return tipousuario;
}
public String getId() {
return id;
}
}
| [
"lanazirot@users.noreply.github.com"
] | lanazirot@users.noreply.github.com |
bf65473a7e7c1fd0b76b8178b50038d1f3d31a21 | 19084e77fe8a0484df1f42e95c571cf64938b00c | /src/main/java/com/boot/cut_costs/repository/GroupRepository.java | 916322642b1fd93ec2ceffc298e2a432fb8172a0 | [] | no_license | arian-h/cut-costs | 52eb835a01f8ea8a48be670c55b43dcbb69e629f | 03de6af0e01a5f4084db1b6caace70ec1c235767 | refs/heads/master | 2021-01-18T15:46:07.860766 | 2018-06-24T02:33:45 | 2018-06-24T02:33:45 | 86,680,868 | 0 | 1 | null | 2018-12-09T10:58:51 | 2017-03-30T08:52:56 | Java | UTF-8 | Java | false | false | 606 | java | package com.boot.cut_costs.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.boot.cut_costs.model.Group;
public interface GroupRepository extends JpaRepository<Group, Long> {
public Group findById(long id);
//TODO this is wrong !!! it should take into account the username
@Query("SELECT COUNT(*) FROM Group where admin_id = :adminId AND name = :groupName")
public Long countByName(@Param("groupName") String groupName, @Param("adminId") long adminId);
} | [
"aryan.hosseinzadeh@gmail.com"
] | aryan.hosseinzadeh@gmail.com |
2da52743e75032daaa52c65ca43624c9126f9179 | 885cad298c396d7e87e55df51a7bd9d1fe4f2de7 | /DynamicProgramming/LongestPalindromicSubstringDp.java | 07d5bae5da9ff4b29728b87ec7510ae3056ce784 | [] | no_license | dj0894/LeetcodeProblem | 5c12ec5b5a85113f8131e7055e81d073e4e3ed9c | 318c85eacc5329c6f06274f13f7cbf8d8f717249 | refs/heads/main | 2023-03-21T09:55:10.541677 | 2021-03-11T07:34:18 | 2021-03-11T07:34:18 | 331,368,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | //https://www.geeksforgeeks.org/longest-palindrome-substring-set-1/
//https://www.youtube.com/watch?v=UflHuQj6MVA
public class LongestPalindromicSubstringDp {
public static void main(String[] args) {
String str = "cbbddbb";
System.out.println(longestPalSubstring(str));
}
private static int longestPalSubstring(String str) {
int n=str.length();
String output="";
boolean table[][]=new boolean[n][n];
//string of length=1 is plaindrom
int maxLength=1;
for(int i=0;i<n;i++){
table[i][i]=true;
}
//string of length 2 is plaindrom if s.charAt[i][0]=s.charAt[i][1] for example aa ,bb etc
int start=0;
for(int i=0;i<n-1;i++){
if(str.charAt(i)==str.charAt(i+1)){
table[i][i+1]=true;
start=i;
maxLength=2;
}
}
// Check for lengths greater than 2.
// k is length of substring
for(int k=3;k<=n;k++){
for(int i=0;i<n-k+1;++i){
int endIndex=i+k-1;
if(table[i+1][endIndex-1]&&str.charAt(i)==str.charAt(endIndex)){
table[i][endIndex]=true;
if(k>maxLength){
start=i;
System.out.println(str.substring(i,endIndex+1));
maxLength=k;
}
}
}
}
return maxLength;
}
}
| [
"Deepikajha0894@gmail.com"
] | Deepikajha0894@gmail.com |
a67ca145e300a41d84d6b558a3bdcb53cb47acf1 | b6cdd761513896fb6832d2ca45ae7ef5f9db7583 | /src/main/java/com/sunboyy/sblearn/controller/CoursesController.java | dbf48a5563a0f8e1898f4d825bfc038f04ff14ca | [] | permissive | sunboyy/sb-learn-2 | d0dee1614d90de282b3cbd3a1fbf1cceca70365f | 27083785865d03b1b0697e9b8a4333fa21e086a7 | refs/heads/master | 2023-07-19T12:40:35.647075 | 2021-01-17T14:32:33 | 2021-01-17T14:32:33 | 227,517,870 | 0 | 0 | MIT | 2020-04-05T14:41:05 | 2019-12-12T04:10:41 | TypeScript | UTF-8 | Java | false | false | 4,100 | java | package com.sunboyy.sblearn.controller;
import java.util.List;
import java.util.stream.Collectors;
import javax.transaction.Transactional;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sunboyy.sblearn.data.Result;
import com.sunboyy.sblearn.domain.recallcard.Course;
import com.sunboyy.sblearn.domain.recallcard.Lesson;
import com.sunboyy.sblearn.domain.recallcard.RecallcardService;
import com.sunboyy.sblearn.domain.user.User;
import lombok.Getter;
@RestController
@RequestMapping("/recallcard/courses")
public class CoursesController {
@Autowired
private RecallcardService recallcardService;
@GetMapping
public List<WebCourse> getCourses() {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
List<Course> courses = recallcardService.getCourses(username);
return courses.stream().map(WebCourse::new).collect(Collectors.toList());
}
@PostMapping
public WebCourse createNewCourse(@Valid @RequestBody CreateCourseDto createCourseDto) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Course course = recallcardService.createCourse(createCourseDto.getName(), username);
return new WebCourse(course);
}
@GetMapping("/{courseId}")
public WebCourse getCourse(@PathVariable int courseId) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Course course = recallcardService.getCourse(courseId, username);
return new WebCourse(course);
}
@Transactional
@PutMapping("/{courseId}")
public WebCourse editCourse(@PathVariable int courseId, @Valid @RequestBody EditCourseDto editCourseDto) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Course course = recallcardService.renameCourse(courseId, editCourseDto.getName(), username);
return new WebCourse(course);
}
@GetMapping("/{courseId}/lessons")
public Result<List<Lesson>> getLessons(@PathVariable int courseId) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return recallcardService.getLessons(courseId, username);
}
@GetMapping("/{courseId}/members")
public Result<List<User>> getMembers(@PathVariable int courseId) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return recallcardService.getCourseMembers(courseId, username);
}
@PostMapping("/{courseId}/add-member")
public Result<User> addMember(@PathVariable int courseId, @Valid @RequestBody ShareCourseDto shareCourseDto) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return recallcardService.addCourseMember(courseId, shareCourseDto.getUsername(), username);
}
@PostMapping("/{courseId}/remove-member")
public Result<Object> removeMember(@PathVariable int courseId, @Valid @RequestBody ShareCourseDto shareCourseDto) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return recallcardService.removeCourseMember(courseId, shareCourseDto.getUsername(), username);
}
private static class CreateCourseDto {
@NotBlank
private String name;
public String getName() {
return name;
}
}
private static class EditCourseDto {
@NotBlank
private String name;
public String getName() {
return name;
}
}
@Getter
private static class ShareCourseDto {
@NotBlank
private String username;
}
}
| [
"sura_sun@hotmail.com"
] | sura_sun@hotmail.com |
a8f5283c1511cf695f98839af61d17a7ba77e996 | ed937ff4e9dddff4e5ba8deaa95a6a0ed45fd57e | /src/main/java/com/labs/vsu/labProj/controller/ProductDescriptionController.java | 9d5a469b359e3fadbb0749d1a1ad71f7a2ef799c | [] | no_license | vishnyakovava/labProjA | 14fad5f606b2701eba4474603fbd0fe0fd4e19d2 | 0e711082e1e0e22473c295d8e13ce13f61f6a9ce | refs/heads/master | 2020-04-18T06:15:49.018362 | 2019-01-24T06:05:04 | 2019-01-24T06:05:04 | 167,312,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,395 | java | package com.labs.vsu.labProj.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.labs.vsu.labProj.entity.ListProduct;
import com.labs.vsu.labProj.entity.ProductDescription;
import com.labs.vsu.labProj.entity.TestEntity;
import com.labs.vsu.labProj.entity.User;
import com.labs.vsu.labProj.service.ProductDescriptionService;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
@CrossOrigin
@RestController
@RequestMapping(value="/rest/products")
public class ProductDescriptionController {
@Autowired
ProductDescriptionService productDescriptionService;
Logger logger = LoggerFactory.getLogger(ProductDescriptionController.class);
@RequestMapping(value = "/findall", method = RequestMethod.GET)
public List<ProductDescription> findAll(){
List<ProductDescription> products = productDescriptionService.findAll();
return products;
}
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ResponseBody
public String saveProduct(@RequestBody String productDescription) throws IOException {
ProductDescription requestProductDescription;
ObjectMapper mapper = new ObjectMapper();
logger.info(productDescription);
try {
requestProductDescription = mapper.readValue(productDescription, ProductDescription.class);
logger.info(requestProductDescription.toString());
productDescriptionService.save(requestProductDescription);
} catch (IOException e) {
e.printStackTrace();
}
return "ok";
}
@RequestMapping(value = "/update", method = RequestMethod.PUT, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ResponseBody
public String updateProduct(@RequestBody String product){
ProductDescription requestProductDescription;
ObjectMapper mapper = new ObjectMapper();
try {
requestProductDescription = mapper.readValue(product, ProductDescription.class);
logger.info(requestProductDescription.toString());
ProductDescription oldProduct = productDescriptionService.findByProductId(requestProductDescription.getProductId());
logger.info("found: " + oldProduct.toString());
oldProduct.setProductName(requestProductDescription.getProductName());
oldProduct.setPurchase(requestProductDescription.getPurchase());
productDescriptionService.save(oldProduct);
logger.info("updated: " + oldProduct.toString());
} catch (IOException e) {
e.printStackTrace();
}
return "{\"statusText\": \"OK\"}";
}
@RequestMapping(value = "/delete/{productId}", method = RequestMethod.DELETE, produces = { MediaType.APPLICATION_JSON_VALUE, //
MediaType.APPLICATION_XML_VALUE})
public String deleteProduct(@PathVariable("productId") long productId){
logger.info(""+productId);
productDescriptionService.deleteByProductId(productId);
return "User was deleted";
}
}
| [
"vishnyakova.valeria@gmail.com"
] | vishnyakova.valeria@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.