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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1477ad61a2b16f5c6650a4e14db4218c0237a673 | d4c27ce25dc4c1132852ed64bdb9f4176d5c3fd3 | /leetcode/src/main/java/com/wy/leetcode/question701/Solution.java | 7b9010149de594b3119b9b714b6e5f6d7fee0a43 | [] | no_license | hammerwy/datastructure_and_algorithm | d198e48a38b99f405908507e3c3f43908b1e6ef7 | 2b3b951ef302ea74fe846575d7e823aa13944c7c | refs/heads/master | 2022-11-27T23:14:22.273558 | 2020-08-04T12:03:26 | 2020-08-04T12:03:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,115 | java | package com.wy.leetcode.question701;
/**
* @author wangyong
* @date 2019/5/30
* @description 例如,
* <p>
* 给定二叉搜索树:
* <p>
* 4
* / \
* 2 7
* / \
* 1 3
* <p>
* 和 插入的值: 5
* 你可以返回这个二叉搜索树:
* <p>
* 4
* / \
* 2 7
* / \ /
* 1 3 5
* 或者这个树也是有效的:
* <p>
* 5
* / \
* 2 7
* / \
* 1 3
* \
* 4
*/
public class Solution {
public TreeNode insertIntoBST(TreeNode root, int val) {
if (root == null) {
return root;
}
insert(root, val);
return root;
}
/**
* 深度优先遍历
*
* @param root
* @param val
*/
public void insert(TreeNode root, int val) {
if (val > root.val) {
if (root.right == null) {
root.right = new TreeNode(val);
return;
}
insert(root.right, val);
}
if (val < root.val) {
if (root.left == null) {
root.left = new TreeNode(val);
return;
}
insert(root.left, val);
}
}
/**
* 别人的解法
*
* @param root
* @param val
* @return
*/
public TreeNode insertIntoBST1(TreeNode root, int val) {
TreeNode y = null;
TreeNode x = root;
/*
同样是深度优先遍历,找到合适的位置,x作为深度遍历的临时变量,y记录x的父节点
*/
while (x != null) {
y = x;
if (val < x.val)
x = x.left;
else
x = x.right;
}
TreeNode node = new TreeNode(val);
/*
把val插入到相对于y的合适的位置,如果y为null,则说明root为null
*/
if (y == null)
return node;
else if (val < y.val)
y.left = node;
else
y.right = node;
return root;
}
}
class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
| [
"autumnimagery@outlook.com"
] | autumnimagery@outlook.com |
4738eecff519bdce5bfa589012f13e83457ee566 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/23/23_f14624e849e739ed35b148cca9c65f3ae983b555/FigureFactory/23_f14624e849e739ed35b148cca9c65f3ae983b555_FigureFactory_s.java | 1853c41ed2f1be1c10378a4f69941d174971a172 | [] | 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 | 10,444 | java | /*******************************************************************************
* Copyright (c) 2009-2011 CWI
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* * Paul Klint - Paul.Klint@cwi.nl - CWI
* * Arnold Lankamp - Arnold.Lankamp@cwi.nl
*******************************************************************************/
package org.rascalmpl.library.vis;
import java.util.HashMap;
import org.eclipse.imp.pdb.facts.IConstructor;
import org.eclipse.imp.pdb.facts.IInteger;
import org.eclipse.imp.pdb.facts.IList;
import org.eclipse.imp.pdb.facts.IString;
import org.eclipse.imp.pdb.facts.IValueFactory;
import org.rascalmpl.interpreter.IEvaluatorContext;
import org.rascalmpl.interpreter.utils.RuntimeExceptionFactory;
import org.rascalmpl.library.vis.compose.Grid;
import org.rascalmpl.library.vis.compose.HCat;
import org.rascalmpl.library.vis.compose.HVCat;
import org.rascalmpl.library.vis.compose.Overlay;
import org.rascalmpl.library.vis.compose.Pack;
import org.rascalmpl.library.vis.compose.Place;
import org.rascalmpl.library.vis.compose.Shape;
import org.rascalmpl.library.vis.compose.VCat;
import org.rascalmpl.library.vis.compose.Vertex;
import org.rascalmpl.library.vis.containers.Box;
import org.rascalmpl.library.vis.containers.Chart;
import org.rascalmpl.library.vis.containers.Ellipse;
import org.rascalmpl.library.vis.containers.Space;
import org.rascalmpl.library.vis.containers.Wedge;
import org.rascalmpl.library.vis.graph.lattice.LatticeGraph;
import org.rascalmpl.library.vis.graph.lattice.LatticeGraphEdge;
import org.rascalmpl.library.vis.graph.layered.LayeredGraph;
import org.rascalmpl.library.vis.graph.layered.LayeredGraphEdge;
import org.rascalmpl.library.vis.graph.spring.SpringGraph;
import org.rascalmpl.library.vis.graph.spring.SpringGraphEdge;
import org.rascalmpl.library.vis.interaction.Button;
import org.rascalmpl.library.vis.interaction.Checkbox;
import org.rascalmpl.library.vis.interaction.Choice;
import org.rascalmpl.library.vis.interaction.ComputeFigure;
import org.rascalmpl.library.vis.interaction.TextField;
import org.rascalmpl.library.vis.properties.IPropertyValue;
import org.rascalmpl.library.vis.properties.PropertyManager;
import org.rascalmpl.library.vis.properties.PropertyParsers;
import org.rascalmpl.library.vis.properties.descriptions.StrProp;
import org.rascalmpl.library.vis.tree.Tree;
import org.rascalmpl.library.vis.tree.TreeMap;
import org.rascalmpl.values.ValueFactoryFactory;
/**
*
* FigureFactory: factory for creating visual elements.
*
* @author paulk
*
*/
@SuppressWarnings("serial")
public class FigureFactory {
static IValueFactory vf = ValueFactoryFactory.getValueFactory();
static IList emptyList = vf.list();
enum Primitives {
BOX,
BUTTON,
CHECKBOX,
CHOICE,
COMPUTEFIGURE,
CONTROLON,
CONTROLOFF,
CHART,
EDGE,
ELLIPSE,
GRAPH,
GRID,
HCAT,
HVCAT,
OUTLINE,
OVERLAY,
PACK,
PLACE,
ROTATE,
SCALE,
SHAPE,
SPACE,
TEXT,
TEXTFIELD,
TREE,
TREEMAP,
USE,
VCAT,
VERTEX,
WEDGE,
XAXIS
}
static HashMap<String,Primitives> pmap = new HashMap<String,Primitives>() {
{
put("_box", Primitives.BOX);
put("_button", Primitives.BUTTON);
put("_checkbox", Primitives.CHECKBOX);
put("_chart", Primitives.CHART);
put("_choice", Primitives.CHOICE);
put("_computeFigure",Primitives.COMPUTEFIGURE);
put("_edge", Primitives.EDGE);
put("_ellipse", Primitives.ELLIPSE);
put("_graph", Primitives.GRAPH);
put("_grid", Primitives.GRID);
put("_hcat", Primitives.HCAT);
put("_hvcat", Primitives.HVCAT);
put("_outline", Primitives.OUTLINE);
put("_overlay", Primitives.OVERLAY);
put("_pack", Primitives.PACK);
put("_place", Primitives.PLACE);
put("_rotate", Primitives.ROTATE);
put("_scale", Primitives.SCALE);
put("_shape", Primitives.SHAPE);
put("_space", Primitives.SPACE);
put("_text", Primitives.TEXT);
put("_textfield", Primitives.TEXTFIELD);
put("_tree", Primitives.TREE);
put("_treemap", Primitives.TREEMAP);
put("_use", Primitives.USE);
put("_vcat", Primitives.VCAT);
put("_vertex", Primitives.VERTEX);
put("_wedge", Primitives.WEDGE);
put("_xaxis", Primitives.XAXIS);
}};
@SuppressWarnings("incomplete-switch")
public static Figure make(IFigureApplet fpa, IConstructor c, PropertyManager properties, IList childProps, IEvaluatorContext ctx){
String ename = c.getName();
System.err.print(ename);
properties = PropertyManager.extendProperties(fpa, c, properties, childProps, ctx);
IList childPropsNext = PropertyManager.getChildProperties((IList) c.get(c.arity()-1));
if(childProps != null){
IList childchildProps = PropertyManager.getChildProperties(childProps);
if(childchildProps != null){
if(childPropsNext != null){
childPropsNext = childchildProps.concat(childPropsNext);
} else {
childPropsNext = childchildProps;
}
}
}
switch(pmap.get(ename)){
case BOX:
return new Box(fpa, properties, c.arity() == 2 ? (IConstructor) c.get(0) : null, childPropsNext, ctx);
case BUTTON:
return new Button(fpa, properties, (IString) c.get(0), c.get(1), ctx);
case CHART:
return new Chart(fpa, properties, c.arity() == 2 ? (IConstructor) c.get(0) : null, childPropsNext, ctx);
case CHECKBOX:
return new Checkbox(fpa, properties, (IString) c.get(0), c.get(1), ctx);
case CHOICE:
return new Choice(fpa, properties, (IList) c.get(0), c.get(1), ctx);
case COMPUTEFIGURE:
return new ComputeFigure(fpa, properties, c.get(0), ctx);
case ELLIPSE:
return new Ellipse(fpa, properties, c.arity() == 2 ? (IConstructor) c.get(0) : null, childPropsNext,ctx);
case GRAPH:
if(properties.getStringProperty(StrProp.HINT).contains("lattice"))
return new LatticeGraph(fpa, properties, (IList) c.get(0), (IList)c.get(1), ctx);
if(properties.getStringProperty(StrProp.HINT).contains("layered"))
return new LayeredGraph(fpa, properties, (IList) c.get(0), (IList)c.get(1), ctx);
return new SpringGraph(fpa, properties, (IList) c.get(0), (IList)c.get(1), ctx);
case GRID:
return new Grid(fpa, properties, (IList) c.get(0), childPropsNext, ctx);
case HCAT:
return new HCat(fpa, properties, (IList) c.get(0), childPropsNext, ctx);
case HVCAT:
return new HVCat(fpa, properties, (IList) c.get(0), childPropsNext, ctx);
case OUTLINE:
return new Outline(fpa, properties, (IList)c.get(0), (IInteger) c.get(1));
case OVERLAY:
return new Overlay(fpa, properties, (IList) c.get(0), childPropsNext, ctx);
case PACK:
return new Pack(fpa, properties, (IList) c.get(0), childPropsNext, ctx);
case PLACE:
return new Place(fpa, properties, (IConstructor) c.get(0), (IString) c.get(1), (IConstructor) c.get(2), ctx);
case ROTATE:
//TODO
return new Rotate(fpa, properties, c.get(0), (IConstructor) c.get(1), ctx);
case SCALE:
//TODO
if(c.arity() == 3)
return new Scale(fpa, properties, c.get(0), c.get(0), (IConstructor) c.get(1), ctx);
return new Scale(fpa, properties, c.get(0), c.get(1), (IConstructor) c.get(2), ctx);
case SHAPE:
return new Shape(fpa, properties, (IList) c.get(0), childPropsNext, ctx);
case SPACE:
return new Space(fpa, properties, c.arity() == 2 ? (IConstructor) c.get(0) : null, childPropsNext, ctx);
case TEXT:
IPropertyValue<String> txt = new PropertyParsers.StringArgParser().parseProperty(StrProp.TEXT, c, null, 0, fpa, ctx);
//return new Text(fpa, properties, (IString) c.get(0), ctx); // TODO: check this
return new Text(fpa, properties,txt);
case TEXTFIELD:
if(c.arity() > 3)
return new TextField(fpa, properties, (IString) c.get(0), c.get(1), c.get(2), ctx);
return new TextField(fpa, properties, (IString) c.get(0), c.get(1), null, ctx);
case TREE:
return new Tree(fpa,properties, (IList) c.get(0), (IList)c.get(1), ctx);
case TREEMAP:
return new TreeMap(fpa,properties, (IList) c.get(0), (IList)c.get(1), ctx);
case USE:
return new Use(fpa, properties, (IConstructor) c.get(0), ctx);
case VCAT:
return new VCat(fpa, properties, (IList) c.get(0), childPropsNext, ctx);
case VERTEX:
return new Vertex(fpa, properties, c.get(0), c.get(1), c.arity() == 4 ? (IConstructor) c.get(2) : null, ctx);
case WEDGE:
return new Wedge(fpa, properties, c.arity() == 2 ? (IConstructor) c.get(0) : null, childPropsNext, ctx);
}
throw RuntimeExceptionFactory.illegalArgument(c, ctx.getCurrentAST(), ctx.getStackTrace());
}
public static SpringGraphEdge makeSpringGraphEdge(SpringGraph G, IFigureApplet fpa, IConstructor c,
PropertyManager properties, IEvaluatorContext ctx) {
IString from = (IString)c.get(0);
IString to = (IString)c.get(1);
IConstructor toArrow = c.arity() > 3 ? (IConstructor) c.get(2) : null;
IConstructor fromArrow = c.arity() > 4 ? (IConstructor) c.get(3) : null;
return new SpringGraphEdge(G, fpa, properties, from, to, toArrow, fromArrow,ctx);
}
public static LayeredGraphEdge makeLayeredGraphEdge(LayeredGraph G, IFigureApplet fpa, IConstructor c,
PropertyManager properties, IEvaluatorContext ctx) {
IString from = (IString)c.get(0);
IString to = (IString)c.get(1);
IConstructor toArrow = c.arity() > 3 ? (IConstructor) c.get(2) : null;
IConstructor fromArrow = c.arity() > 4 ? (IConstructor) c.get(3) : null;
return new LayeredGraphEdge(G, fpa, properties, from, to, toArrow, fromArrow, ctx);
}
public static LatticeGraphEdge makeLatticeGraphEdge(LatticeGraph G, IFigureApplet fpa, IConstructor c,
PropertyManager properties, IEvaluatorContext ctx) {
IString from = (IString)c.get(0);
IString to = (IString)c.get(1);
return new LatticeGraphEdge(G, fpa, properties, from, to, ctx);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
c3ba3c05543eba442081c345a73d4a5a9f4e5974 | 33eaec8e6d451000fb726b86b0890e4e076c010a | /bookmanagement/src/main/java/in/bushansirgur/bookmanagement/dao/BookDAOImpl.java | fde478d65e80a615d3d9f3f3c82e533d60b41275 | [] | no_license | sridharreddych/book-management-system | 043b22e4ef6f5d2b4826e3f7ae725a896db352bd | d899df21eb96d4d20498a2dba71d8d4b2ea168a2 | refs/heads/master | 2022-01-08T17:20:58.306362 | 2018-09-30T13:42:10 | 2018-09-30T13:42:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package in.bushansirgur.bookmanagement.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import in.bushansirgur.bookmanagement.model.Book;
@Repository
public class BookDAOImpl implements BookDAO{
@Autowired
private SessionFactory sessionFactory;
@Override
public void save(Book book) {
sessionFactory.getCurrentSession().saveOrUpdate(book);
}
@Override
public Book get(int id) {
Book book = (Book)sessionFactory.getCurrentSession().get(Book.class, id);
return book;
}
@Override
public void delete(int id) {
Session session = sessionFactory.getCurrentSession();
Book book = session.get(Book.class, id);
session.delete(book);
}
@Override
public List<Book> get() {
return sessionFactory.getCurrentSession().createQuery("from Book").list();
}
}
| [
"sc.bushan.05@gmail.com"
] | sc.bushan.05@gmail.com |
ebbf1e0e13fc7335085de4f4cbc42b3d5c17ed74 | f86938ea6307bf6d1d89a07b5b5f9e360673d9b8 | /CodeComment_Data/Code_Jam/train/Counting_Sheep/S/CSheep(4).java | 7f0487d52ffc59cef82a2b3cf00650c9f36235b5 | [] | no_license | yxh-y/code_comment_generation | 8367b355195a8828a27aac92b3c738564587d36f | 2c7bec36dd0c397eb51ee5bd77c94fa9689575fa | refs/heads/master | 2021-09-28T18:52:40.660282 | 2018-11-19T14:54:56 | 2018-11-19T14:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,742 | java | package methodEmbedding.Counting_Sheep.S.LYD1652;
import java.io.*;
import java.util.HashSet;
/**
* Created by asthiwanka on 9/4/16.
*/
public class CSheep {
public static void main(String[] args) {
BufferedReader br = null;
File file = new File("/Users/asthiwanka/Desktop/out.txt");
try {
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
br = new BufferedReader(new FileReader("/Users/asthiwanka/Desktop/test.txt"));
int T = Integer.parseInt(br.readLine());
for (int i = 1 ; i <= T ; i++) {
int v = Integer.parseInt(br.readLine());
HashSet<String> set = new HashSet<>();
for (int x = 1 ; x < 1001 ; x++) {
String xV = String.valueOf(v*x);
for (int y = 0 ; y < xV.length() ; y++) {
set.add(xV.charAt(y) + "");
}
if (set.size() == 10) {
bw.write("Case #"+ i +": " + xV + "\n");
break;
}
if (x == 1000) {
bw.write("Case #"+ i +": " + "INSOMNIA\n");
}
}
}
bw.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null)br.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
| [
"liangyuding@sjtu.edu.cn"
] | liangyuding@sjtu.edu.cn |
16ed3814935eded0dabf56be7e27d586ed8db90f | 47da275d6b10915cc60d6fc3238b5bc243d6c5c1 | /de.rcenvironment.core.utils.cluster/src/main/java/de/rcenvironment/core/utils/cluster/ClusterQueuingSystemConstants.java | ffa61229f4cdf3d299db424231af1d17350f2195 | [] | no_license | rcenvironment/rce-test | aa325877be8508ee0f08181304a50bd97fa9f96c | 392406e8ca968b5d8168a9dd3155d620b5631ab6 | HEAD | 2016-09-06T03:35:58.165632 | 2015-01-16T10:45:50 | 2015-01-16T10:45:50 | 29,299,206 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | /*
* Copyright (C) 2006-2014 DLR, Germany
*
* All rights reserved
*
* http://www.rcenvironment.de/
*/
package de.rcenvironment.core.utils.cluster;
/**
* Constants related to cluster queuing systems.
*
* @author Doreen Seider
*/
public final class ClusterQueuingSystemConstants {
/** Command string. */
public static final String COMMAND_QSUB = "qsub";
/** Command string. */
public static final String COMMAND_QSTAT = "qstat";
/** Command string. */
public static final String COMMAND_QDEL = "qdel";
/** Command string. */
public static final String COMMAND_SHOWQ = "showq";
private ClusterQueuingSystemConstants() { }
}
| [
"robert.mischke@dlr.de"
] | robert.mischke@dlr.de |
538d943d72d792b8ed0d2739fc0d9bfe8bfa4a5d | cd148bb9318cd7d3336165fa0131ee6e0d2beb5c | /demo-api/src/main/java/com/example/demoapi/repository/CategoryRepo.java | c2b9e3611e6db469032f6d6bf56d25507fbb5e7e | [] | no_license | hanh01/JavaWeb | e3ee693f75c8eba6a765347786fa9677d286d534 | e1e2aa75c202cb1101255b445d8c83751a6abc6b | refs/heads/master | 2023-06-07T13:13:02.756380 | 2021-07-08T12:59:38 | 2021-07-08T12:59:38 | 364,837,135 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package com.example.demoapi.repository;
import com.example.demoapi.entity.CategoryEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CategoryRepo extends JpaRepository<CategoryEntity,Integer> {
}
| [
"dohonghanh2101@gmail.com"
] | dohonghanh2101@gmail.com |
7f44a70c4b9eb10e0e341682c27905b8d89483f7 | d1020bcd8291155ed4ad2c88395928af9844912c | /src/main/java/com/theironyard/utlis/PasswordStorage.java | 7d734825a93b504115405e66687da656b08194b8 | [] | no_license | ericweidman/GameTrackerSpring | 9192475b1aec95eaeaa4de25e2ba46edb5d03319 | 7185002f3fcb423576e32266b53cce3424f43a00 | refs/heads/master | 2021-01-10T11:50:13.209635 | 2016-03-13T21:37:27 | 2016-03-13T21:37:27 | 53,427,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,566 | java | package com.theironyard.utlis;
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import javax.xml.bind.DatatypeConverter;
public class PasswordStorage
{
@SuppressWarnings("serial")
static public class InvalidHashException extends Exception {
public InvalidHashException(String message) {
super(message);
}
public InvalidHashException(String message, Throwable source) {
super(message, source);
}
}
@SuppressWarnings("serial")
static public class CannotPerformOperationException extends Exception {
public CannotPerformOperationException(String message) {
super(message);
}
public CannotPerformOperationException(String message, Throwable source) {
super(message, source);
}
}
public static final String PBKDF2_ALGORITHM = "PBKDF2WithHmacSHA1";
// These constants may be changed without breaking existing hashes.
public static final int SALT_BYTE_SIZE = 24;
public static final int HASH_BYTE_SIZE = 18;
public static final int PBKDF2_ITERATIONS = 64000;
// These constants define the encoding and may not be changed.
public static final int HASH_SECTIONS = 5;
public static final int HASH_ALGORITHM_INDEX = 0;
public static final int ITERATION_INDEX = 1;
public static final int HASH_SIZE_INDEX = 2;
public static final int SALT_INDEX = 3;
public static final int PBKDF2_INDEX = 4;
public static String createHash(String password)
throws CannotPerformOperationException
{
return createHash(password.toCharArray());
}
public static String createHash(char[] password)
throws CannotPerformOperationException
{
// Generate a random salt
SecureRandom random = new SecureRandom();
byte[] salt = new byte[SALT_BYTE_SIZE];
random.nextBytes(salt);
// Hash the password
byte[] hash = pbkdf2(password, salt, PBKDF2_ITERATIONS, HASH_BYTE_SIZE);
int hashSize = hash.length;
// format: algorithm:iterations:hashSize:salt:hash
String parts = "sha1:" +
PBKDF2_ITERATIONS +
":" + hashSize +
":" +
toBase64(salt) +
":" +
toBase64(hash);
return parts;
}
public static boolean verifyPassword(String password, String correctHash)
throws CannotPerformOperationException, InvalidHashException
{
return verifyPassword(password.toCharArray(), correctHash);
}
public static boolean verifyPassword(char[] password, String correctHash)
throws CannotPerformOperationException, InvalidHashException
{
// Decode the hash into its parameters
String[] params = correctHash.split(":");
if (params.length != HASH_SECTIONS) {
throw new InvalidHashException(
"Fields are missing from the password hash."
);
}
// Currently, Java only supports SHA1.
if (!params[HASH_ALGORITHM_INDEX].equals("sha1")) {
throw new CannotPerformOperationException(
"Unsupported hash type."
);
}
int iterations = 0;
try {
iterations = Integer.parseInt(params[ITERATION_INDEX]);
} catch (NumberFormatException ex) {
throw new InvalidHashException(
"Could not parse the iteration count as an integer.",
ex
);
}
if (iterations < 1) {
throw new InvalidHashException(
"Invalid number of iterations. Must be >= 1."
);
}
byte[] salt = null;
try {
salt = fromBase64(params[SALT_INDEX]);
} catch (IllegalArgumentException ex) {
throw new InvalidHashException(
"Base64 decoding of salt failed.",
ex
);
}
byte[] hash = null;
try {
hash = fromBase64(params[PBKDF2_INDEX]);
} catch (IllegalArgumentException ex) {
throw new InvalidHashException(
"Base64 decoding of pbkdf2 output failed.",
ex
);
}
int storedHashSize = 0;
try {
storedHashSize = Integer.parseInt(params[HASH_SIZE_INDEX]);
} catch (NumberFormatException ex) {
throw new InvalidHashException(
"Could not parse the hash size as an integer.",
ex
);
}
if (storedHashSize != hash.length) {
throw new InvalidHashException(
"Hash length doesn't match stored hash length."
);
}
// Compute the hash of the provided password, using the same salt,
// iteration count, and hash length
byte[] testHash = pbkdf2(password, salt, iterations, hash.length);
// Compare the hashes in constant time. The password is correct if
// both hashes match.
return slowEquals(hash, testHash);
}
private static boolean slowEquals(byte[] a, byte[] b)
{
int diff = a.length ^ b.length;
for(int i = 0; i < a.length && i < b.length; i++)
diff |= a[i] ^ b[i];
return diff == 0;
}
private static byte[] pbkdf2(char[] password, byte[] salt, int iterations, int bytes)
throws CannotPerformOperationException
{
try {
PBEKeySpec spec = new PBEKeySpec(password, salt, iterations, bytes * 8);
SecretKeyFactory skf = SecretKeyFactory.getInstance(PBKDF2_ALGORITHM);
return skf.generateSecret(spec).getEncoded();
} catch (NoSuchAlgorithmException ex) {
throw new CannotPerformOperationException(
"Hash algorithm not supported.",
ex
);
} catch (InvalidKeySpecException ex) {
throw new CannotPerformOperationException(
"Invalid key spec.",
ex
);
}
}
private static byte[] fromBase64(String hex)
throws IllegalArgumentException
{
return DatatypeConverter.parseBase64Binary(hex);
}
private static String toBase64(byte[] array)
{
return DatatypeConverter.printBase64Binary(array);
}
}
| [
"ericweidman@gmail.com"
] | ericweidman@gmail.com |
dd0b8e6e06ecef355074b6ace4aef556453e5491 | c7f0b854cdde82cf116ecc56eda2a435f5105bf1 | /subo/src/main/java/aid/Clothes.java | 011a71a6ce4987501a64215abcb9b0219d852382 | [] | no_license | invoker333/suboStudio | e50e61a8e4d78b7909606a864d6621ea2c28de60 | a6807c18597cd52761bc80f83d63dbacf6f428c1 | refs/heads/master | 2021-09-02T08:16:41.953254 | 2017-12-31T21:08:20 | 2017-12-31T21:08:20 | 109,478,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package aid;
import Element.Animation;
import Mankind.Player;
public class Clothes extends Animation{
protected void equiped(Player player){
// android.R.style.Widget_DeviceDefault_Light
}
}
| [
"1541158185@qq.com"
] | 1541158185@qq.com |
bede2f9a69162e3337e259ba8306d86735f01124 | 25c423428df591859f7d61e2143863078382230c | /VetClinic/src/main/java/com/softuni/vetpet/service/services/implementation/ValidationServiceImpl.java | f9ca4b465fe1f65e846228b40c6fbdbc75fbb7c5 | [] | no_license | ivanyordanov67/JAVA-WEB | 0f0188fe778ffb3e797e3e46b7a7488f9e07caa6 | 0eefe61b74b8890a2498b5fcc9e5b4423decefeb | refs/heads/master | 2023-08-07T15:50:10.581433 | 2019-11-25T11:25:33 | 2019-11-25T11:25:33 | 210,565,874 | 0 | 0 | null | 2023-07-22T17:01:54 | 2019-09-24T09:38:23 | HTML | UTF-8 | Java | false | false | 1,427 | java | package com.softuni.vetpet.service.services.implementation;
import com.softuni.vetpet.data.models.User;
import com.softuni.vetpet.service.models.LoginServiceModel;
import com.softuni.vetpet.service.models.UserServiceModel;
import com.softuni.vetpet.service.services.UserService;
import com.softuni.vetpet.service.services.ValidationService;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.regex.Matcher;
@Service
public class ValidationServiceImpl implements ValidationService {
private final UserService userService;
private final ModelMapper modelMapper;
@Autowired
public ValidationServiceImpl(UserService userService, ModelMapper modelMapper) {
this.userService = userService;
this.modelMapper = modelMapper;
}
@Override
public boolean isValid(String password, String confirmPassword) {
return isConfirmPassword(password, confirmPassword);
}
private boolean isExistUser(String name) {
return this.userService.isExistUserByUsername(name);
}
private boolean isConfirmPassword(String password, String confirmPassword) {
return password.equals(confirmPassword);
}
private boolean isValidEmail(String email){
String pattern = "^[A-Za-z0-9+_.-]+@(.+)$";
return pattern.matches(email);
}
}
| [
"40793776+ivanyordanov67@users.noreply.github.com"
] | 40793776+ivanyordanov67@users.noreply.github.com |
21cd9ef2dc4f6787c240432163335d82a5c57fa6 | 4ad17f7216a2838f6cfecf77e216a8a882ad7093 | /clbs/src/main/java/com/zw/platform/util/common/JsonResultBean.java | f7ca9ffb39226b22f3281d526d208d4f9b8d500b | [
"MIT"
] | permissive | djingwu/hybrid-development | b3c5eed36331fe1f404042b1e1900a3c6a6948e5 | 784c5227a73d1e6609b701a42ef4cdfd6400d2b7 | refs/heads/main | 2023-08-06T22:34:07.359495 | 2021-09-29T02:10:11 | 2021-09-29T02:10:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,055 | java | package com.zw.platform.util.common;
import com.zw.platform.util.JsonUtil;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
public class JsonResultBean implements Serializable {
private static final long serialVersionUID = 1L;
public static final boolean SUCCESS = true;
public static final boolean FAULT = false;
private boolean success;
private String msg;
private String exceptionDetailMsg;
private Object obj;
public JsonResultBean() {
this.success = true;
}
public JsonResultBean(String message) {
this.success = true;
this.msg = message;
}
public JsonResultBean(Object object) {
this.success = true;
this.obj = object;
}
public JsonResultBean(String message, Object object) {
this.success = true;
this.msg = message;
this.obj = object;
}
public JsonResultBean(boolean suc) {
this.success = suc;
}
public JsonResultBean(boolean suc, String message) {
this.success = suc;
this.msg = message;
}
public JsonResultBean(Throwable exceptionMessage) {
exceptionMessage.printStackTrace(new PrintWriter(new StringWriter()));
this.success = false;
this.msg = exceptionMessage.getMessage();
}
public JsonResultBean(Throwable exceptionMessage, boolean detailMsg) {
exceptionMessage.printStackTrace(new PrintWriter(new StringWriter()));
this.success = false;
this.msg = exceptionMessage.getMessage();
if (detailMsg) {
this.exceptionDetailMsg = exceptionMessage.toString();
}
}
public boolean isSuccess() {
return this.success;
}
public String getMsg() {
return this.msg;
}
public Object getObj() {
return this.obj;
}
public String getExceptionDetailMsg() {
return this.exceptionDetailMsg;
}
@Override
public String toString() {
return JsonUtil.object2Json(this);
}
} | [
"wuxuetao@zwlbs.com"
] | wuxuetao@zwlbs.com |
14f252edc599e0bc96316c2919708e54615fe951 | 9a9d00775f4b03dfe1648d5c2907c6b80d91e57b | /src/states/DashingInTheAir.java | e08423dbecbaaf2c1eb3314ca56a8e9b5a52b421 | [] | no_license | ryanchen34057/platformerGame | 5873f1bd2bcba4807531a8fb5f87200df9b55810 | 45985256df9a7178e12ddebe1fbf00b07dc59a18 | refs/heads/master | 2020-05-14T18:02:49.734269 | 2019-04-17T17:15:11 | 2019-04-17T17:15:11 | 181,903,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package states;
import character.Player;
import input.Input;
import java.util.List;
public class DashingInTheAir implements StateMachine{
private float dashTimer = Player.DASH_TIMER;
@Override
public void handleKeyInput(Player player, List<Input.Key> keys) {
}
@Override
public void update(Player player) {
player.setVelX(player.CURRENT_DASH_SPEED * player.getFacing());
dashTimer -= (60.0f / 1000.0f);
player.CURRENT_DASH_SPEED -= Player.DASH_SPEED_BUMP;
if(dashTimer <= 0) {
//Reset timer
dashTimer = Player.DASH_TIMER;
player.setGravity(Player.FALLING_GRAVITY_VEL);
player.currentState = PlayerState.falling;
player.CURRENT_DASH_SPEED = Player.DASH_SPEED;
}
}
@Override
public String toString() {
return "DashingInTheAir";
}
}
| [
"ryanchen34057@gmail.com"
] | ryanchen34057@gmail.com |
4b0be393a95c0a400a4899c4e9e0824280ed8f74 | d1970587e1b1889388c288202c835e96e8c25e90 | /9.Validation_Data_Binding_and_Type_Conversion/9.2.Validation_using_Spring_s_Validator_interface/src/main/java/com/qiaogh/domain/Person.java | 3a4b5833d12d45dacf82176e9af8d46452487af2 | [] | no_license | Qiaogh/Spring | fb3225e050e96dba50b7998809c2ed9204d08926 | b894dd3c47af489ba88f29bdd959bd4607de697f | refs/heads/master | 2021-08-07T07:08:34.880225 | 2018-02-22T13:48:59 | 2018-02-22T13:48:59 | 95,947,202 | 0 | 1 | null | 2017-07-05T08:31:18 | 2017-07-01T06:44:01 | Java | UTF-8 | Java | false | false | 645 | java | package com.qiaogh.domain;
public class Person {
private String id;
private String name;
private Integer age;
public Person( String id, String name, Integer age ) {
this.id = id;
this.name = name;
this.age = age;
}
public String getId() {
return id;
}
public void setId( String id ) {
this.id = id;
}
public String getName() {
return name;
}
public void setName( String name ) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge( Integer age ) {
this.age = age;
}
}
| [
"qq892525597qq@163.com"
] | qq892525597qq@163.com |
b3c015c5fc4033169ec944bf868ab45066bc66f4 | 4bf144e89fbf5b6746c324560f6628877abdb81b | /src/main/java/com/danxx/micro/servlet/DeleteBatchServlet.java | 22efc136128a34922e054002b5b76c3502420975 | [] | no_license | Dawish/micro_message | 9e9da6cc1afc87ee469f178b6b28ed969b8d5c85 | 4f0d253659ff0b92cfa770087d206015e0d9ab80 | refs/heads/master | 2020-03-18T23:24:16.250826 | 2018-06-11T13:37:02 | 2018-06-11T13:37:02 | 135,400,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,576 | java | package com.danxx.micro.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverAction;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import com.danxx.micro.service.MaintainService;
/**
* 批量删除
* @author danxx
* @Date 2018.5.31
*
*/
public class DeleteBatchServlet extends HttpServlet{
Logger logger = Logger.getLogger(DeleteBatchServlet.class);
/**
* http://localhost:8080/micro_message/list.do
*/
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
logger.info("DeleteBatchServlet invoke!");
req.setCharacterEncoding("UTF-8");
//接受页面值
String[] ids = req.getParameterValues("id");
if(ids!=null) {
logger.info("DeleteBatchServlet id size : "+ids.length);
}
//查询数据库并传值给页面
MaintainService maintainService = new MaintainService();
maintainService.deleteBatch(ids);
/**控制跳转到控制器*/
req.getRequestDispatcher("/list.do").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
this.doGet(req, resp);
}
}
| [
"danxx@yanhuamedia.com"
] | danxx@yanhuamedia.com |
0716fede305184e6557272a6f13f5a2f50d7e5a8 | e8c022176e541e0de41683bc7ca767cc513eb69a | /src/main/java/horstman/core/java/vol1/ch12/IllegalMonitorStateExceptionTest.java | c13050fa8a38220a295af41a40704fe7394c4112 | [] | no_license | alex-krav/javacorevol1 | 07c6534197024c510c23ac07b53518c0ff3b8808 | 6e8ca7723548f131462cb1dba9ef5ec2f2da50eb | refs/heads/master | 2022-08-10T00:07:32.748133 | 2019-08-30T13:48:10 | 2019-08-30T13:48:10 | 195,194,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package horstman.core.java.vol1.ch12;
public class IllegalMonitorStateExceptionTest {
public static void main(String[] args) throws InterruptedException {
Thread thread1 = new Thread(() -> {
System.out.println("Thread1 running...");
});
// thread1.start();
// thread1.wait();
thread1.notifyAll();
}
}
| [
"akravchuk89@gmail.com"
] | akravchuk89@gmail.com |
11f74c1d057aa451c848347f3edb6a02282fd761 | 1e0579d3ec7e325ad88c324dc7f38967317ebd65 | /app/src/main/java/com/android/styy/common/util/MD5Util.java | 0471ec9e143804169cb876a7955113f83bc02f44 | [] | no_license | chunleizhangxin/HFrame | b89da2d77922ce0c7b80ff0745c4f74a8cfebdbd | a89027a78e5432f9d49e770ea56d9f5f3cc38cc0 | refs/heads/master | 2021-01-14T16:20:56.529464 | 2020-02-27T06:07:06 | 2020-02-27T06:07:06 | 242,677,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 902 | java | package com.android.styy.common.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Util {
public static String toMD5(String sourceStr) {
String result = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(sourceStr.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
result = buf.toString();
} catch (NoSuchAlgorithmException e) {
System.out.println(e);
}
return result;
}
}
| [
"chunleizhangxin@users.noreply.github.com"
] | chunleizhangxin@users.noreply.github.com |
dc2b9ce43e382ec043ef409ca08b2212538fc115 | 687eb85b656f79999986dc53625a02ad8b7e3b19 | /app/src/main/java/com/pyb/trackme/selectMultipleContacts/contact/ContactSection.java | f3cb555361896712af336b5b97c88cca050362ee | [] | no_license | prashant21GITHUB/Track-me-app | 7a4382797a4f2e24a49c2b913b571f1a991ca08c | 9bafaa3a193138ad34645b5888086fe62afcc471 | refs/heads/master | 2020-05-05T08:46:39.409484 | 2019-07-27T16:36:33 | 2019-07-27T16:36:33 | 179,877,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java |
package com.pyb.trackme.selectMultipleContacts.contact;
public class ContactSection {
private final char mLetter;
private final int mSectionPos;
private final int mContactPos;
ContactSection(char letter, int sectionPos, int contactPos) {
mLetter = letter;
mSectionPos = sectionPos;
mContactPos = contactPos;
}
public char getLetter() {
return mLetter;
}
public int getSectionPos() {
return mSectionPos;
}
public int getContactPos() {
return mContactPos;
}
}
| [
"prashant.bajpai21@gmail.com"
] | prashant.bajpai21@gmail.com |
89c391cb52e32659fe19b5127d0900d43dbe7a03 | 7996f534582a8a2923a5329d7a148f20dc76dfdc | /kissy-1.4.9/tools/module-compiler/tests/com/google/javascript/jscomp/ObjectPropertyStringPreprocessTest.java | 6e481c0902fff981d9bd6bfac75f07ba59746b71 | [
"MIT"
] | permissive | tedyhy/SCI | a538705520c3a010a6f3249b9a7344cd27c9b6f9 | 38b2259e4a6c9a884c4ef8a4aa6d3715f434acef | refs/heads/master | 2020-12-22T22:52:43.343635 | 2017-03-29T08:55:18 | 2017-03-29T08:55:18 | 25,193,031 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,172 | java | /*
* Copyright 2009 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.javascript.jscomp;
/**
* Tests for {@link ObjectPropertyStringPreprocess}
*
*/
public class ObjectPropertyStringPreprocessTest extends CompilerTestCase {
@Override
protected CompilerPass getProcessor(final Compiler compiler) {
return new ObjectPropertyStringPreprocess(compiler);
}
@Override
protected int getNumRepetitions() {
return 1;
}
public void testDeclaration() {
test("goog.testing.ObjectPropertyString = function() {}",
"JSCompiler_ObjectPropertyString = function() {}");
}
public void testFooBar() {
test("new goog.testing.ObjectPropertyString(foo, 'bar')",
"new JSCompiler_ObjectPropertyString(goog.global, foo.bar)");
}
public void testFooPrototypeBar() {
test("new goog.testing.ObjectPropertyString(foo.prototype, 'bar')",
"new JSCompiler_ObjectPropertyString(goog.global, " +
"foo.prototype.bar)");
}
public void testInvalidNumArgumentsError() {
testSame(new String[] {"new goog.testing.ObjectPropertyString()"},
ObjectPropertyStringPreprocess.INVALID_NUM_ARGUMENTS_ERROR);
}
public void testQualifedNameExpectedError() {
testSame(
new String[] {
"new goog.testing.ObjectPropertyString(foo[a], 'bar')"
},
ObjectPropertyStringPreprocess.QUALIFIED_NAME_EXPECTED_ERROR);
}
public void testStringLiteralExpectedError() {
testSame(new String[] {"new goog.testing.ObjectPropertyString(foo, bar)"},
ObjectPropertyStringPreprocess.STRING_LITERAL_EXPECTED_ERROR);
}
}
| [
"916610351@qq.com"
] | 916610351@qq.com |
73076c11d9cff7603b6051886dc3033048d7da44 | b992259d58de4e94dbf2daca93f52863e682420f | /app/src/main/java/org/lntorrent/libretorrent/ui/main/TorrentListItem.java | 84a8e3f960041a5f02159dece4dc5a92df161a5a | [] | no_license | hamzadevc/LNTorrentApp | 4b82e95b836b456a43731a9df49fc4c4dc2f9efb | 8ac52ced62028f97628bef06b0d3a6f684830885 | refs/heads/master | 2022-12-03T20:05:40.921623 | 2020-08-25T13:32:01 | 2020-08-25T13:32:01 | 290,222,079 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,357 | java |
package org.lntorrent.libretorrent.ui.main;
import androidx.annotation.NonNull;
import org.lntorrent.libretorrent.core.model.data.TorrentInfo;
/*
* Wrapper of TorrentInfo class for TorrentListAdapter, that override Object::equals method
* Necessary for other behavior in case if item was selected (see SelectionTracker).
*/
public class TorrentListItem extends TorrentInfo
{
public TorrentListItem(@NonNull TorrentInfo state)
{
super(state.torrentId, state.name, state.stateCode, state.progress,
state.receivedBytes, state.uploadedBytes, state.totalBytes,
state.downloadSpeed, state.uploadSpeed, state.ETA, state.dateAdded,
state.totalPeers, state.peers, state.error, state.sequentialDownload,
state.filePriorities);
}
@Override
public int hashCode()
{
return torrentId.hashCode();
}
/*
* Compare objects by their content
*/
public boolean equalsContent(TorrentListItem item)
{
return super.equals(item);
}
/*
* Compare objects by torrent id
*/
@Override
public boolean equals(Object o)
{
if (!(o instanceof TorrentListItem))
return false;
if (o == this)
return true;
return torrentId.equals(((TorrentListItem)o).torrentId);
}
}
| [
"hamza.tahir@startupgrind.com"
] | hamza.tahir@startupgrind.com |
e5d64389fb012364ea1c2585d105b9641ebd6569 | ee77fe233f8fd7a3cc9520836195076f4b1cc9ea | /app/src/main/java/com/algonquinlive/tohm0011/omar/doorsopenottawa/DetailsActivity.java | 307a4dfbd496037647488bbbaef46bb08512f608 | [] | no_license | omartohme/DoorsOpenOttawa | 04b3c0bb39fa4ce2ccaf66185da2337d5908eed6 | fb84692fff57852953fce085999ca610f15b26a5 | refs/heads/master | 2020-06-27T07:03:56.862931 | 2016-12-13T23:53:20 | 2016-12-13T23:53:20 | 74,529,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,993 | java | package com.algonquinlive.tohm0011.omar.doorsopenottawa;
import android.app.Activity;
import android.app.DialogFragment;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.SearchView;
import android.widget.TextView;
import android.widget.Toast;
import com.algonquinlive.tohm0011.omar.doorsopenottawa.model.Building;
import com.algonquinlive.tohm0011.omar.doorsopenottawa.utils.HttpMethod;
import com.algonquinlive.tohm0011.omar.doorsopenottawa.utils.RequestPackage;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;
public class DetailsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private Geocoder mGeocoder;
private TextView detailsName;
private TextView detailsDescription;
private TextView detailsAddress;
private Integer buildingID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.details_activity);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
mGeocoder = new Geocoder( this, Locale.CANADA);
detailsName = (TextView) findViewById(R.id.detailsName);
detailsDescription = (TextView) findViewById(R.id.detailsDescription);
detailsAddress = (TextView) findViewById(R.id.detailsAddress);
// Get the bundle of extras that was sent to this activity
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
String displayedNameBuilding = bundle.getString("name");
String displayedDescriptionBuilding = bundle.getString("description");
String displayedAddressBuilding = bundle.getString("address");
Integer BuildingIDthatIuse = bundle.getInt("buildingID");
buildingID = BuildingIDthatIuse;
detailsName.setText(displayedNameBuilding);
detailsDescription.setText(displayedDescriptionBuilding);
detailsAddress.setText(displayedAddressBuilding);
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
String mapAddress = bundle.getString("address");
pin(mapAddress);
}
}
private void pin(String locationName) {
try {
Address address = mGeocoder.getFromLocationName(locationName, 1).get(0);
LatLng ll = new LatLng(address.getLatitude(), address.getLongitude());
mMap.addMarker(new MarkerOptions().position(ll).title(locationName));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll,14f));
Toast.makeText(this, "Pinned: " + locationName, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(this, "Not found: " + locationName, Toast.LENGTH_SHORT).show();
}
}
private void deleteBuilding(View uri) {
RequestPackage pkg = new RequestPackage();
pkg.setMethod( HttpMethod.DELETE );
pkg.setUri( uri + "/" + buildingID );
DoTask deleteTask = new DoTask();
deleteTask.execute( pkg );
}
private class DoTask extends AsyncTask<RequestPackage, String, String> {
@Override
protected String doInBackground(RequestPackage ... params) {
String content = HttpManager.getData(params[0]);
return content;
}
@Override
protected void onPostExecute(String result) {
if (result == null) {
Toast.makeText(DetailsActivity.this, "Web service not available", Toast.LENGTH_LONG).show();
return;
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.details_menu, menu);
deleteBuilding(findViewById(R.id.details_delete));
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
} | [
"tohm0011@algonquinlive.com"
] | tohm0011@algonquinlive.com |
e5067879cdb647c5872193d562bd906bcd9ffa34 | 6f0ee6dd91c7ddd1312ece32c5d08bf48b4c7070 | /src/CircleCustomScoreQuery.java | 512ce3ee232e703b3dcbcddf4327ba5c767e8cfb | [] | no_license | darouwan/Search | 0285698a37d1a22f714582b43dc6b45d3ff12908 | ad376b6c0f810a2703d1d45e44cef541115d69da | refs/heads/master | 2020-05-27T07:13:00.811446 | 2012-10-10T15:54:32 | 2012-10-10T15:54:32 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,358 | java | import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.function.CustomScoreProvider;
import org.apache.lucene.search.function.CustomScoreQuery;
public class CircleCustomScoreQuery extends CustomScoreQuery {
float x_center;
float y_center;
float r;
ArrayList<String> filesIncircle;
ArrayList<String> terms;
float alpha;
HashMap<String,Integer> docFreq;
public CircleCustomScoreQuery(Query subQuery, float x_center,
float y_center, float r, float alpha, ArrayList<String> filesIncircle, ArrayList<String> terms2, HashMap<String, Integer> docFreq) {
super(subQuery);
this.x_center = x_center;
this.y_center = y_center;
this.r = r;
this.filesIncircle = filesIncircle;
this.terms = terms2;
this.alpha = alpha;
this.docFreq = docFreq;
// TODO Auto-generated constructor stub
}
@Override
protected CustomScoreProvider getCustomScoreProvider(IndexReader reader)
throws IOException {
// 默认情况评分是根据原有的评分*传入进来的评分
// return super.getCustomScoreProvider(reader);
return new CircleCustomScoreProvider(reader, this.x_center,
this.y_center, this.r, this.alpha, this.filesIncircle,this.terms,this.docFreq);
}
}
| [
"k-2feng@hotmail.com"
] | k-2feng@hotmail.com |
d9d2d1c198e2589ac1baf55e6758ff4b58da4bc0 | e6cb57315b73e0ee5a8b667f951c3fb76e73321c | /app/src/main/java/com/example/gaojunhui/textworld/pullzoomview/PullWebViewActivity.java | d5b01fc48f781f689b1eab5d801df4d0a4c95db4 | [] | no_license | gaojunhuiBS/FamilyMealsAndroid | 04eb2365e574be4e94fd1e3645f44bf241f29d3d | fc7cf99c335f75671a44336bd2a38cb465657166 | refs/heads/dev | 2021-01-11T13:41:24.285542 | 2017-06-23T03:10:06 | 2017-06-23T03:10:06 | 95,082,397 | 0 | 0 | null | 2017-06-23T03:13:40 | 2017-06-22T06:30:34 | Java | UTF-8 | Java | false | false | 2,310 | java | package com.example.gaojunhui.textworld.pullzoomview;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebView;
import com.example.gaojunhui.textworld.R;
import com.example.gaojunhui.textworld.pullzoomview.weight.PullZoomView;
public class PullWebViewActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pull_webview);
WebView webView = (WebView) findViewById(R.id.webView);
webView.loadUrl("https://github.com/jeasonlzy0216");
Intent intent = getIntent();
float sensitive = intent.getFloatExtra("sensitive", 1.5f);
int zoomTime = intent.getIntExtra("zoomTime", 500);
boolean isParallax = intent.getBooleanExtra("isParallax", true);
boolean isZoomEnable = intent.getBooleanExtra("isZoomEnable", true);
PullZoomView pzv = (PullZoomView) findViewById(R.id.pzv);
pzv.setIsParallax(isParallax);
pzv.setIsZoomEnable(isZoomEnable);
pzv.setSensitive(sensitive);
pzv.setZoomTime(zoomTime);
pzv.setOnScrollListener(new PullZoomView.OnScrollListener() {
@Override
public void onScroll(int l, int t, int oldl, int oldt) {
System.out.println("onScroll t:" + t + " oldt:" + oldt);
}
@Override
public void onHeaderScroll(int currentY, int maxY) {
System.out.println("onHeaderScroll currentY:" + currentY + " maxY:" + maxY);
}
@Override
public void onContentScroll(int l, int t, int oldl, int oldt) {
System.out.println("onContentScroll t:" + t + " oldt:" + oldt);
}
});
pzv.setOnPullZoomListener(new PullZoomView.OnPullZoomListener() {
@Override
public void onPullZoom(int originHeight, int currentHeight) {
System.out.println("onPullZoom originHeight:" + originHeight + " currentHeight:" + currentHeight);
}
@Override
public void onZoomFinish() {
System.out.println("onZoomFinish");
}
});
}
}
| [
"275907983@qq.com"
] | 275907983@qq.com |
8f51c89e5fbc6365e35f212ee659ff0b4829fdb6 | 3571602e06ae6398c7b0825847812245ba1131cc | /src/main/java/br/com/capco/vo/SpecieVo.java | 4f521362b00d202489933258888691e84e82af21 | [] | no_license | anderltda/api-capco-starwars | e586a69f03b092d41928a5c01e706d94097035bf | 5f2f1d34bd2615046551b9f51e87c1ba0db0a49e | refs/heads/master | 2023-05-10T20:51:06.875728 | 2019-09-17T19:11:33 | 2019-09-17T19:11:33 | 209,136,201 | 0 | 1 | null | 2023-05-09T18:33:14 | 2019-09-17T19:09:10 | Java | UTF-8 | Java | false | false | 1,138 | java | package br.com.capco.vo;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class SpecieVo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
private Double media;
private List<String> people;
public SpecieVo() {
super();
}
public SpecieVo(String name, Double media, List<String> people) {
super();
this.name = name;
this.media = media;
this.people = people;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the media
*/
public Double getMedia() {
return media;
}
/**
* @param media the media to set
*/
public void setMedia(Double media) {
this.media = media;
}
/**
* @return the people
*/
public List<String> getPeople() {
return people;
}
/**
* @param people the people to set
*/
public void setPeople(List<String> people) {
this.people = people;
}
}
| [
"anderson.silva@esx.com.br"
] | anderson.silva@esx.com.br |
39c36ba5e19bc71971b5c72641f80515e8a8d9bf | a6f6f8fb5d6d3c01fad7f2aaf79ede8987462209 | /src/main/java/com/manniwood/cl4pg/v1/exceptions/Cl4pgIOException.java | 90a73743ea6e545c54ba10a133929700eb617941 | [
"MIT"
] | permissive | manniwood/cl4pg | 843d08520690b2b1d3b7b6670254a8a4b71bc7f7 | 1d832eb1d8917004bff4dc188b8e65218a37a3b1 | refs/heads/master | 2021-06-15T02:48:36.630744 | 2021-04-16T13:32:53 | 2021-04-16T13:32:53 | 21,470,065 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,745 | java | /*
The MIT License (MIT)
Copyright (c) 2014 Manni Wood
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package com.manniwood.cl4pg.v1.exceptions;
public class Cl4pgIOException extends Cl4pgException {
private static final long serialVersionUID = 1L;
public Cl4pgIOException() {
super();
}
public Cl4pgIOException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public Cl4pgIOException(String message, Throwable cause) {
super(message, cause);
}
public Cl4pgIOException(String message) {
super(message);
}
public Cl4pgIOException(Throwable cause) {
super(cause);
}
}
| [
"manni.lee.wood@gmail.com"
] | manni.lee.wood@gmail.com |
ba81db8679133ef45faf1078fe5b5d89101a976c | b5af57faea05185c13e69677c36b32c800012dd3 | /src/prathamesh/gui/listener.java | 6ed40ca346c8c72daedd8347de36e397d3dc8fce | [] | no_license | prathamesh-a/PasswordGeneratorGUI | d931acef4155cdacd47bdee41c3d7ecf68203c95 | 89822081440f78d699b9ce54935adaaf7ee4fee3 | refs/heads/main | 2023-08-26T20:02:55.564129 | 2021-11-04T04:56:34 | 2021-11-04T04:56:34 | 424,475,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,630 | java | package prathamesh.gui;
import prathamesh.generator.generator;
import prathamesh.generator.input;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class listener implements ActionListener {
private checkBox checkBox;
private frame frame;
private input input;
public listener(checkBox checkBox, frame frame){
this.checkBox = checkBox;
this.frame = frame;
this.input = new input();
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == frame.getGenButton()){
if (frame.getLength().equalsIgnoreCase("")){
frame.getOutput().setText("Enter a value.");
return;
}
try {
input.length = Integer.parseInt(frame.getLength());
}
catch (NumberFormatException exception){frame.getOutput().setText("Enter a numeric value.");return;}
if (input.length==0){
frame.getOutput().setText("Length cannot be 0!");
return;
}
input.includeSymbols = checkBox.getSymbol().isSelected();
input.includeNumbers = checkBox.getNumber().isSelected();
input.includeLowercase = checkBox.getLowerCase().isSelected();
input.includeUppercase = checkBox.getUpperCase().isSelected();
check();
}
if (e.getSource() == frame.getCopyButton()){
if (frame.isGenerated){
StringSelection selection = new StringSelection(frame.getOutput().getText());
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(selection, null);
frame.success.setVisible(true);
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
executorService.schedule(frame::setSuccessText, 1, TimeUnit.SECONDS);
}
}
}
private void check(){
if (!(input.includeSymbols || input.includeNumbers || input.includeLowercase || input.includeUppercase)){
frame.getOutput().setText("Select at least one option!");
}
else {
frame.getOutput().setText(new generator(input).getPassword());
frame.isGenerated = true;
}
}
}
| [
"89336149+prathamesh-a@users.noreply.github.com"
] | 89336149+prathamesh-a@users.noreply.github.com |
642f34670aee94c1c1d2e9fbed7d8688581c57e3 | c3347d2b2dc57b92b034a6754125f6aa70c4e2c7 | /src/musicmaker/level/entity/gui/StopButton.java | 249ddae042a3c5ec0b5b361cf56b2754da3118b3 | [] | no_license | keelimeguy/MusicMaker | 6bd796de6d4250d20f34c67cff251db8eeee2966 | 8d72ca190883b726ce5fc3e3c905660edb84fbf6 | refs/heads/master | 2020-12-21T17:33:17.838563 | 2020-05-08T20:48:37 | 2020-05-08T20:48:37 | 64,574,098 | 2 | 1 | null | 2016-08-02T04:08:16 | 2016-07-31T02:57:03 | Java | UTF-8 | Java | false | false | 751 | java | package musicmaker.level.entity.gui;
import musicmaker.graphics.Sprite;
import musicmaker.MusicMaker;
public class StopButton extends Button {
protected MusicMaker game;
public StopButton(int x, int y, int width, int height, int color, MusicMaker game) {
super(x, y, width, height, color);
setText("Stop");
this.game = game;
}
public StopButton(int x, int y, Sprite sprite, MusicMaker game) {
super(x, y, sprite);
setText("Stop");
this.game = game;
}
public StopButton(int x, int y, int width, int height, Sprite sprite, MusicMaker game) {
super(x, y, width, height, sprite);
setText("Stop");
this.game = game;
}
public void press() {
game.stopPlayer();
}
}
| [
"keelin.becker-wheeler@uconn.edu"
] | keelin.becker-wheeler@uconn.edu |
61ce94dd3e017e9f189ef397970eee9e53022efe | f4fc6069155b1e8c765c0cb9ef19195cbee3c18e | /Week_02/day04/78.subsets1.java | cb02a244fe938b1e9c9f4c1024d57c4b1dd114c6 | [] | no_license | jiayouxujin/AlgorithmQIUZHAO | 18962b0299d7b113fc20b749a31dcee66aec8b15 | 5b92e3c1dffda21147a9611f82479e2ae2f98b08 | refs/heads/master | 2022-12-17T00:12:07.935694 | 2020-09-18T11:22:44 | 2020-09-18T11:22:44 | 279,088,950 | 0 | 0 | null | 2020-07-12T15:07:21 | 2020-07-12T15:07:20 | null | UTF-8 | Java | false | false | 629 | java | /*
* @lc app=leetcode id=78 lang=java
*
* [78] Subsets
*/
// @lc code=start
class Solution {
public List<List<Integer>> subsets(int[] nums) {
List<List<Integer>> res=new ArrayList<>();
Arrays.sort(nums);
backtrack(res,new ArrayList<>(),nums,0);
return res;
}
public void backtrack(List<List<Integer>> res,List<Integer> temp,int[] nums,int start){
res.add(new ArrayList<>(temp));
for(int i=start;i<nums.length;i++){
temp.add(nums[i]);
backtrack(res,temp,nums,i+1);
temp.remove(temp.size()-1);
}
}
}
// @lc code=end
| [
"1319039722@qq.com"
] | 1319039722@qq.com |
839e1a26dd71e07eb84247165191027854ee0547 | e05b8fad0823984a156ab566c98948494676184e | /src/ToDo.java | 91f950c7fd0b4fab6d2d838152d02995fc862695 | [] | no_license | RusherRG/Personal-Planner-Java | 7fb535161cec4f8cacaec83884e2b08a29a56da3 | 45ba04548269fc9d5550793d4271c2f19d0edabf | refs/heads/master | 2020-04-01T06:27:24.327549 | 2018-11-12T18:49:43 | 2018-11-12T18:49:43 | 152,948,396 | 6 | 0 | null | 2018-10-14T07:06:24 | 2018-10-14T07:06:24 | null | UTF-8 | Java | false | false | 2,600 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.io.FileWriter;
public class ToDo {
public static void main(String args[]) {
ToDo td = new ToDo();
td.DisplayTasks("RusherRG");
}
public void AddToDo(String username, String todo) {
Date dt = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String currentTime = sdf.format(dt);
sdf = new SimpleDateFormat("ddMMyyyyHHmmss");
String id = sdf.format(dt);
try {
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/", "root", ""); //Creates a Connection with MYSQL Database
Statement st = con.createStatement();
st.execute("USE test");
st.execute("INSERT INTO todo (username,time,todo,status) VALUE ('"+username+"','"+currentTime+"','"+todo+"','"+0+"')");
System.out.println(' '+username+','+currentTime+','+todo+','+0);
}
catch(Exception ec) {System.out.println(ec);}
}
public void DisplayTasks(String username) {
try {
System.out.println(username);
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/", "root", ""); //Creates a Connection with MYSQL Database
Statement st = con.createStatement();
st.execute("USE test");
ResultSet res = st.executeQuery("SELECT * FROM todo WHERE username = '"+username+"' && status = 0");
FileWriter fw = new FileWriter("D://GitHub Repository//Personal-Planner-Java//src//mail_content.txt");
String task;
int id;
while(res.next()) {
task = res.getString("todo");
id = res.getInt("id");
System.out.print(task+" "+id+"\n");
fw.write(task+" "+id+"\n");
}
fw.close();
}
catch(Exception ec) {System.out.println(ec);}
}
public void DeleteTask(String username,int id) {
try{
Connection c = DriverManager.getConnection("jdbc:mysql://localhost:3306/", "root", ""); //Creates a Connection with MYSQL Database
Statement st = c.createStatement();
st.execute("USE test");
st.execute("UPDATE todo SET status=-1 WHERE id="+id+" AND status=0");
}catch(Exception exc){System.out.println(exc+"Delete");}
}
public void CompleteTask(String username,int id) {
try{
Connection c = DriverManager.getConnection("jdbc:mysql://localhost:3306/", "root", ""); //Creates a Connection with MYSQL Database
Statement st = c.createStatement();
st.execute("USE test");
st.execute("UPDATE todo SET status=1 WHERE id="+id+" AND status=0");
}catch(Exception exc){System.out.println(exc+"Complete");}
}
}
| [
"rushang101@gmail.com"
] | rushang101@gmail.com |
f460e7d4d888c9a5b146dbb0ae74a39937d8686b | 5d0908fef13dc56a627929d58c0c9cffe6e6c45b | /src/main/java/com/imooc/repository/SellerInfoRepository.java | 838aa100586ecccf1be89614cbf0916cf7a70ba2 | [] | no_license | NnnLillian/SellSystem | 624d40c908ed055973ac4e4b5d501327db5f734f | cc01c4d668a63e1af61099aec7f96af3f275b1c0 | refs/heads/master | 2020-04-09T23:52:34.166945 | 2019-11-27T07:21:48 | 2019-11-27T07:21:48 | 160,286,943 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.imooc.repository;
import com.imooc.dataobject.SellerInfo;
import org.springframework.data.jpa.repository.JpaRepository;
public interface SellerInfoRepository extends JpaRepository<SellerInfo, String> {
SellerInfo findByOpenid(String openId);
}
| [
"weijingwen35@foxmail.com"
] | weijingwen35@foxmail.com |
0a3d0511473891c14dc7f82502ab7e663dcc175e | 5c60705ed2c079e62664b3552d1bf5752af1b648 | /temp/src/main/java/com/he/maven/module/excel/Bean.java | 4a97812fc845dff892fa186fad3dfdbeedf1a9d0 | [] | no_license | heyanjing/mavenmodule | 721eaf071b60e112736e52cd9d588b99bc40c576 | 81fce47903a3a16d420958d4a3cc5fc81dccf5b3 | refs/heads/master | 2021-09-03T03:48:00.480416 | 2018-01-05T09:23:05 | 2018-01-05T09:23:05 | 107,094,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 989 | java | package com.he.maven.module.excel;
import java.util.Date;
/**
* Created by heyanjing on 2017/12/1 15:56.
*/
public class Bean {
private String id;
private Integer age;
@Override
public String toString() {
return "Bean{" +
"id='" + id + '\'' +
", age=" + age +
", birthday=" + birthday +
'}';
}
public Bean(String id, Integer age, Date birthday) {
this.id = id;
this.age = age;
this.birthday = birthday;
}
public Bean() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
private Date birthday;
}
| [
"1366162208@qq.com"
] | 1366162208@qq.com |
7384b9231a7a08d7d8393e25e3bb66aebf67c5e3 | 3ad48fa30d85ba2c083af58bd69cb6f2f3ba3949 | /src/beans/StockBean.java | 4690e5e21ca229edb4dc00aa615fa988f5456def | [] | no_license | drabchuk/breakfast_hotel | 1ce0323edfa618f146ee944f2d771b20104ca2c1 | 775f603830e515b1bdfa4ced86946c1ed788c04b | refs/heads/master | 2021-01-12T06:05:33.087971 | 2016-12-28T21:26:00 | 2016-12-28T21:26:00 | 77,297,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package beans;
import db.dao.DAOSingleton;
import db.dao.DishDAO;
import model.ProductSalesCount;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import java.sql.SQLException;
import java.util.List;
/**
* Created by Denis on 25.12.2016.
*/
@ManagedBean(name = "stock")
@RequestScoped
public class StockBean {
DishDAO dishDAO;
List<ProductSalesCount> dishes;
public StockBean() {
dishDAO = DAOSingleton.getInstance().getDishDAO();
try {
this.dishes = dishDAO.getStockAccount();
} catch (SQLException e) {
e.printStackTrace();
}
}
public List<ProductSalesCount> getDishes() {
return dishes;
}
}
| [
"denis,drabchuck@gmail.com"
] | denis,drabchuck@gmail.com |
aff9459546b413201cb0f9fa3a48cbb6b7ddef07 | 8265f00a9dc405147936045c06cece7a29b0f254 | /src/main/java/com/diviso/graeshoppe/customerappgateway/client/offer/model/UserDTO.java | d86afb2fbc7af26472930aeea6d6812a4f5999b0 | [] | no_license | Karthikeyanpk/customerAppGateway | 5dc86e88351cafa0a1cf9dd23637d9d3c9d57472 | fbcddb1031b9fd8bffdae5f8b06ad6bf6455f3b5 | refs/heads/master | 2022-12-22T14:50:49.123754 | 2020-02-01T06:44:17 | 2020-02-01T06:44:17 | 232,064,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,988 | java | package com.diviso.graeshoppe.customerappgateway.client.offer.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
/**
* UserDTO
*/
@Validated
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-08-15T16:47:08.654128+05:30[Asia/Kolkata]")
public class UserDTO {
@JsonProperty("activated")
private Boolean activated = null;
@JsonProperty("authorities")
@Valid
private List<String> authorities = null;
@JsonProperty("createdBy")
private String createdBy = null;
@JsonProperty("createdDate")
private OffsetDateTime createdDate = null;
@JsonProperty("email")
private String email = null;
@JsonProperty("firstName")
private String firstName = null;
@JsonProperty("id")
private String id = null;
@JsonProperty("imageUrl")
private String imageUrl = null;
@JsonProperty("langKey")
private String langKey = null;
@JsonProperty("lastModifiedBy")
private String lastModifiedBy = null;
@JsonProperty("lastModifiedDate")
private OffsetDateTime lastModifiedDate = null;
@JsonProperty("lastName")
private String lastName = null;
@JsonProperty("login")
private String login = null;
public UserDTO activated(Boolean activated) {
this.activated = activated;
return this;
}
/**
* Get activated
* @return activated
**/
@ApiModelProperty(value = "")
public Boolean isActivated() {
return activated;
}
public void setActivated(Boolean activated) {
this.activated = activated;
}
public UserDTO authorities(List<String> authorities) {
this.authorities = authorities;
return this;
}
public UserDTO addAuthoritiesItem(String authoritiesItem) {
if (this.authorities == null) {
this.authorities = new ArrayList<String>();
}
this.authorities.add(authoritiesItem);
return this;
}
/**
* Get authorities
* @return authorities
**/
@ApiModelProperty(value = "")
public List<String> getAuthorities() {
return authorities;
}
public void setAuthorities(List<String> authorities) {
this.authorities = authorities;
}
public UserDTO createdBy(String createdBy) {
this.createdBy = createdBy;
return this;
}
/**
* Get createdBy
* @return createdBy
**/
@ApiModelProperty(value = "")
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public UserDTO createdDate(OffsetDateTime createdDate) {
this.createdDate = createdDate;
return this;
}
/**
* Get createdDate
* @return createdDate
**/
@ApiModelProperty(value = "")
@Valid
public OffsetDateTime getCreatedDate() {
return createdDate;
}
public void setCreatedDate(OffsetDateTime createdDate) {
this.createdDate = createdDate;
}
public UserDTO email(String email) {
this.email = email;
return this;
}
/**
* Get email
* @return email
**/
@ApiModelProperty(value = "")
@Size(min=5,max=254)
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public UserDTO firstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* Get firstName
* @return firstName
**/
@ApiModelProperty(value = "")
@Size(min=0,max=50)
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public UserDTO id(String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
**/
@ApiModelProperty(value = "")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public UserDTO imageUrl(String imageUrl) {
this.imageUrl = imageUrl;
return this;
}
/**
* Get imageUrl
* @return imageUrl
**/
@ApiModelProperty(value = "")
@Size(min=0,max=256)
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public UserDTO langKey(String langKey) {
this.langKey = langKey;
return this;
}
/**
* Get langKey
* @return langKey
**/
@ApiModelProperty(value = "")
@Size(min=2,max=6)
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public UserDTO lastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
return this;
}
/**
* Get lastModifiedBy
* @return lastModifiedBy
**/
@ApiModelProperty(value = "")
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public UserDTO lastModifiedDate(OffsetDateTime lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
return this;
}
/**
* Get lastModifiedDate
* @return lastModifiedDate
**/
@ApiModelProperty(value = "")
@Valid
public OffsetDateTime getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(OffsetDateTime lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public UserDTO lastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* Get lastName
* @return lastName
**/
@ApiModelProperty(value = "")
@Size(min=0,max=50)
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public UserDTO login(String login) {
this.login = login;
return this;
}
/**
* Get login
* @return login
**/
@ApiModelProperty(value = "")
@Pattern(regexp="^[_.@A-Za-z0-9-]*$") @Size(min=1,max=50)
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UserDTO userDTO = (UserDTO) o;
return Objects.equals(this.activated, userDTO.activated) &&
Objects.equals(this.authorities, userDTO.authorities) &&
Objects.equals(this.createdBy, userDTO.createdBy) &&
Objects.equals(this.createdDate, userDTO.createdDate) &&
Objects.equals(this.email, userDTO.email) &&
Objects.equals(this.firstName, userDTO.firstName) &&
Objects.equals(this.id, userDTO.id) &&
Objects.equals(this.imageUrl, userDTO.imageUrl) &&
Objects.equals(this.langKey, userDTO.langKey) &&
Objects.equals(this.lastModifiedBy, userDTO.lastModifiedBy) &&
Objects.equals(this.lastModifiedDate, userDTO.lastModifiedDate) &&
Objects.equals(this.lastName, userDTO.lastName) &&
Objects.equals(this.login, userDTO.login);
}
@Override
public int hashCode() {
return Objects.hash(activated, authorities, createdBy, createdDate, email, firstName, id, imageUrl, langKey, lastModifiedBy, lastModifiedDate, lastName, login);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UserDTO {\n");
sb.append(" activated: ").append(toIndentedString(activated)).append("\n");
sb.append(" authorities: ").append(toIndentedString(authorities)).append("\n");
sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n");
sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n");
sb.append(" langKey: ").append(toIndentedString(langKey)).append("\n");
sb.append(" lastModifiedBy: ").append(toIndentedString(lastModifiedBy)).append("\n");
sb.append(" lastModifiedDate: ").append(toIndentedString(lastModifiedDate)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" login: ").append(toIndentedString(login)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"karthikeyan.p.k@lxisoft.com"
] | karthikeyan.p.k@lxisoft.com |
62e79d0bafd45728ee62e0609184d8c010ab8219 | 90f17cd659cc96c8fff1d5cfd893cbbe18b1240f | /src/main/java/com/facebook/imagepipeline/platform/KitKatPurgeableDecoder.java | 3389af4a31310a500cd3e40680d922ac7da50f9c | [] | no_license | redpicasso/fluffy-octo-robot | c9b98d2e8745805edc8ddb92e8afc1788ceadd08 | b2b62d7344da65af7e35068f40d6aae0cd0835a6 | refs/heads/master | 2022-11-15T14:43:37.515136 | 2020-07-01T22:19:16 | 2020-07-01T22:19:16 | 276,492,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,761 | java | package com.facebook.imagepipeline.platform;
import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import com.facebook.common.internal.Preconditions;
import com.facebook.common.memory.PooledByteBuffer;
import com.facebook.common.references.CloseableReference;
import com.facebook.imagepipeline.memory.FlexByteArrayPool;
import com.facebook.imagepipeline.nativecode.DalvikPurgeableDecoder;
import javax.annotation.concurrent.ThreadSafe;
@TargetApi(19)
@ThreadSafe
public class KitKatPurgeableDecoder extends DalvikPurgeableDecoder {
private final FlexByteArrayPool mFlexByteArrayPool;
public KitKatPurgeableDecoder(FlexByteArrayPool flexByteArrayPool) {
this.mFlexByteArrayPool = flexByteArrayPool;
}
protected Bitmap decodeByteArrayAsPurgeable(CloseableReference<PooledByteBuffer> closeableReference, Options options) {
PooledByteBuffer pooledByteBuffer = (PooledByteBuffer) closeableReference.get();
int size = pooledByteBuffer.size();
CloseableReference closeableReference2 = this.mFlexByteArrayPool.get(size);
try {
byte[] bArr = (byte[]) closeableReference2.get();
pooledByteBuffer.read(0, bArr, 0, size);
Bitmap bitmap = (Bitmap) Preconditions.checkNotNull(BitmapFactory.decodeByteArray(bArr, 0, size, options), "BitmapFactory returned null");
return bitmap;
} finally {
CloseableReference.closeSafely(closeableReference2);
}
}
protected Bitmap decodeJPEGByteArrayAsPurgeable(CloseableReference<PooledByteBuffer> closeableReference, int i, Options options) {
byte[] bArr = DalvikPurgeableDecoder.endsWithEOI(closeableReference, i) ? null : EOI;
PooledByteBuffer pooledByteBuffer = (PooledByteBuffer) closeableReference.get();
Preconditions.checkArgument(i <= pooledByteBuffer.size());
int i2 = i + 2;
CloseableReference closeableReference2 = this.mFlexByteArrayPool.get(i2);
try {
byte[] bArr2 = (byte[]) closeableReference2.get();
pooledByteBuffer.read(0, bArr2, 0, i);
if (bArr != null) {
putEOI(bArr2, i);
i = i2;
}
Bitmap bitmap = (Bitmap) Preconditions.checkNotNull(BitmapFactory.decodeByteArray(bArr2, 0, i, options), "BitmapFactory returned null");
return bitmap;
} finally {
CloseableReference.closeSafely(closeableReference2);
}
}
private static void putEOI(byte[] bArr, int i) {
bArr[i] = (byte) -1;
bArr[i + 1] = (byte) -39;
}
}
| [
"aaron@goodreturn.org"
] | aaron@goodreturn.org |
a8909bc6260d2341872f4eb79c75fdb278b6b278 | 70245c3bb22d0dca2b12ba9f9f228365f0c64c61 | /src/StructuralPatterns/Facade/ProgramNode.java | 5d7c74779c37c2b69dacde84fb52050ec8eda736 | [] | no_license | IvanMtze/Design-Patterns | c72f39babe7e3691620e262f1b9b1977ef8d03f8 | e1062d767aa73fe39321587f12a9860b655e2e51 | refs/heads/master | 2022-12-19T20:34:59.851914 | 2020-10-14T03:05:14 | 2020-10-14T03:05:14 | 298,027,286 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package StructuralPatterns.Facade;
public class ProgramNode {
protected ProgramNode() {
}
public void getSourcePosition(int line, int index) {
}
public void add(ProgramNode node) {
}
public void remove(ProgramNode node) {
}
public void traverse(CodeGenerator codeGenerator) {
}
}
| [
"ivanmtze96@gmail.com"
] | ivanmtze96@gmail.com |
35f7e2ece31ff4bfd3d6604d9dfaf99084d7034f | a13009409e8e06947536891e4c62c3fd7a29b63f | /test6-messages/src/test/java/com/superwind/test6messages/MessageServiceTest.java | b439c90c4738e301b4e3610beb0a0bef769e373e | [] | no_license | janesgit/spring-test | 2ab6d651b6d806cf9d852be0d6bbb7a804c46d26 | ce2f7bbb50a2ec49c2a7be23b5021e2b708e02c5 | refs/heads/master | 2020-03-23T18:59:48.725932 | 2018-05-19T03:31:58 | 2018-05-19T03:31:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package com.superwind.test6messages;
import com.superwind.Test6MessagesApplication;
import com.superwind.service.MessageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* Created by jiangxj on 2018/4/2.
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Test6MessagesApplication.class)
public class MessageServiceTest {
@Autowired
MessageService messageService;
@Test
public void testGetI18nMessage() throws Exception{
Object[] msgParams = null;
System.out.println(messageService.getI18nMessage("en_US","COMMON_ERROR_MSG",msgParams));
System.out.println(messageService.getI18nMessage("zh_CN","COMMON_ERROR_MSG",msgParams));
System.out.println(messageService.getI18nMessage("zh_TW","COMMON_ERROR_MSG",msgParams));
}
}
| [
"jiangxj@wenwen-tech.com"
] | jiangxj@wenwen-tech.com |
99846da7708bf9324a2d9dea61f4541a110bf1d5 | 7c56a2bc7ceb1ff405380c4cd6cee3ef5ff4e984 | /core/src/main/java/com/github/lizhiwei88/easyevent/core/EventObserver.java | 864caa6cdf0c754ae290147e2f36009ae87a65a4 | [
"Apache-2.0"
] | permissive | lizhiwei88/easyevent | 8bec09ac892d4c4e4ee1e064903fb7a862bdf377 | 3768f4736c4991d4881446c4d02c66f95f4f09f8 | refs/heads/develop | 2023-02-10T22:08:34.137505 | 2021-01-05T09:00:20 | 2021-01-05T09:00:20 | 321,827,743 | 4 | 0 | Apache-2.0 | 2021-01-06T00:56:56 | 2020-12-16T00:52:31 | Java | UTF-8 | Java | false | false | 817 | java | package com.github.lizhiwei88.easyevent.core;
/**
* @author lizhiwei
**/
public interface EventObserver<E> {
/**
* 将监听者加入到容器中开始监听
*
* @param name name
* @param object 监听者
*/
void subscribe(String name, E object);
/**
* 将监听者加入到容器中开始监听,并分组
*
* @param name name
* @param group group
* @param object 监听者
*/
void subscribe(String name, String group, E object);
/**
* 取消监听者
*
* @param name name
* @return object
*/
E unsubscribe(String name);
/**
* 取消指定组的监听者
*
* @param name name
* @param group group
* @return object
*/
E unsubscribe(String name, String group);
}
| [
"lizhiwei@troila.com"
] | lizhiwei@troila.com |
77f87ee3f7c3dd350b124978b9a42597e6c39930 | 608917a71076f07e46d643b738b85688018e83c2 | /Coba/animal/Kelinci.java | 3f3237cbd2c8e7516e5b4ccefdf7a0a209bb6a94 | [] | no_license | PratamaAgung/Tubes3OOP | 56ed691c8929799b2c70b514b8f886069fe2fc55 | 6293604866f8f2b12c083b146c872874fd65b16e | refs/heads/master | 2021-01-19T23:08:22.807007 | 2017-04-26T09:56:56 | 2017-04-26T09:56:56 | 88,930,287 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | /**
* Created by nim_13515090 on 23/04/17.
*/
public class Kelinci extends Animal {
public Kelinci(int id, int absis, int ordinat, String behaviour) {
super(id, 4, absis, ordinat, 'L', behaviour);
}
}
| [
"a.muzdalifa@gmail.com"
] | a.muzdalifa@gmail.com |
8bf46d79d9359080d0ba647a924bb36d010b4867 | 51d05106ddd3494f0b6098cc97653ffac4896b70 | /motorMain/src/main/java/util/ComPortutils.java | 9bf0400aeaf46b06d4b0c1bd3021e4ba5df2468d | [] | no_license | cyf120209/motor | f6ed18d334abba370f5794d20a0328f0f56188de | c3f2a0c83439e5447c77bb0966744654d849d899 | refs/heads/master | 2021-09-22T14:33:26.528610 | 2018-08-30T08:26:46 | 2018-08-30T08:26:46 | 103,228,108 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package util;
import gnu.io.CommPortIdentifier;
import java.util.Enumeration;
import java.util.LinkedList;
/**
* Created by Administrator on 2016/9/23 0023.
*/
public class ComPortutils {
public static LinkedList<String> listPort() {
LinkedList<String> listName=new LinkedList<String>();
Enumeration enumeration= CommPortIdentifier.getPortIdentifiers();
CommPortIdentifier portId;
while(enumeration.hasMoreElements()){
portId=(CommPortIdentifier)enumeration.nextElement();
if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) {
listName.add( portId.getName());
}
}
return listName;
}
}
| [
"2445940439@qq.com"
] | 2445940439@qq.com |
15181aaa2715cb32303877f5943014da3a67bdea | 9e6ef1b1763563626921926f530299e45cda946c | /localizationalgorithm/src/main/java/com/cra/princess/localizationalgorithm/LocalizationAlgorithm.java | fa8a166b558284d30849261d7f9b4e4339a1c8af | [] | no_license | TF-185/cra-princess-cp3 | fc39e0ab503fd5b0e8df13a74968cad6bb21e751 | 3f762c85efa5b91cb7080fd17d88c5b6f4c6d529 | refs/heads/master | 2023-05-28T23:29:06.407627 | 2019-10-24T15:53:08 | 2019-10-24T15:53:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 619 | java | package com.cra.princess.localizationalgorithm;
import com.cra.princess.localizationalgorithm.components.*;
import org.apache.commons.math3.linear.RealMatrix;
public interface LocalizationAlgorithm {
LocalizationOutput runAlgorithm(ComponentState state,
ActuatorVector actuators,
SensorVector sensorValues,
RealMatrix p_prev);
ComponentState getPredictedState(ComponentState state, UUVReading reading);
long getSamplingPeriod();
RealMatrix getTransitionMatrix();
String toString();
}
| [
"mreposa@cra.com"
] | mreposa@cra.com |
0337efb4a32d5abed2a5040791b1dbad6a2f1721 | d41f9fe2ab95accf4572e5e6e96de42b4c188ccf | /src/main/java/com/dayuanit/dy9/springboot/atm/springbootatm/task/TransferTask.java | ded8f1f885afede19417fc129fc489615bd55a6c | [] | no_license | fateted123/springboot-atm | 0afcb7eb2ceb22608309b420bdffdc0e7a1642a8 | 63b268650b4f482242c97c17082817c6cce35279 | refs/heads/master | 2020-03-31T20:55:55.235590 | 2018-10-11T08:53:25 | 2018-10-11T08:53:25 | 152,560,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,936 | java | package com.dayuanit.dy9.springboot.atm.springbootatm.task;
import com.dayuanit.dy9.springboot.atm.springbootatm.entity.Transfer;
import com.dayuanit.dy9.springboot.atm.springbootatm.enums.TransferEnum;
import com.dayuanit.dy9.springboot.atm.springbootatm.mapper.TransferMapper;
import com.dayuanit.dy9.springboot.atm.springbootatm.service.BankCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
@Component
public class TransferTask {
@Autowired
private TransferMapper transferMapper;
@Autowired
private BankCardService bankCardService;
@Scheduled(cron = "0/5 * * * * ?")
// @Async 支持并发操作
public void process() {
final Calendar instance = Calendar.getInstance();
instance.add(Calendar.SECOND, -30);
int offset = 0;
int prePageNum = 2;
int currentPage = 1;
List<Transfer> transfers = Collections.EMPTY_LIST;
do {
transfers = transferMapper.listTransfer(TransferEnum.待处理.getK(), instance.getTime(), 0, prePageNum);
//处理转账订单
doTransfer(transfers);
currentPage ++;
// offset = (currentPage - 1) * prePageNum;
} while(transfers.size() > 0);
}
private void doTransfer(List<Transfer> transfers) {
for (Transfer transfer : transfers) {
try {
bankCardService.processTransferOrder(transfer);
} catch (Exception e) {
e.printStackTrace();
//TODO 修改转账订单为失败
bankCardService.processTransferFaild(transfer);
}
}
}
}
| [
"704353965@qq.com"
] | 704353965@qq.com |
7c693dad987beed2bff880c2a419d0b48ea5c121 | e3f6f3f084a09677bc7dd5049be667dfbf4eff7e | /src/main/java/com/util/vo/ItripSearchPolicyHotelVO.java | 172f862a0962eef0183353bdc7bdfdbe3487cafe | [] | no_license | lyjGitTest/lvxing--biz | cfdc3559c223fd7118f60a570d6e12dac5035594 | 57b8b01ec71ad55e6b94a71870711d45415f3db7 | refs/heads/master | 2023-02-08T18:52:33.839198 | 2020-12-25T09:32:55 | 2020-12-25T09:32:55 | 319,582,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.util.vo;
/**
* 返回前端-酒店政策VO(酒店详情页)
* Created by donghai on 2017/5/11.
*/
/*@ApiModel(value = "ItripSearchPolicyHotelVO",description = "查询酒店的政策")*/
public class ItripSearchPolicyHotelVO {
/*@ApiModelProperty("[必填] 酒店政策")*/
private String hotelPolicy;
public String getHotelPolicy() {
return hotelPolicy;
}
public void setHotelPolicy(String hotelPolicy) {
this.hotelPolicy = hotelPolicy;
}
}
| [
"3035195148@qq.com"
] | 3035195148@qq.com |
8f3f521be393276e5c1d3ff01769621c36a3662a | e26a014955d059247eb1900d0b6d672676d41143 | /spring-app/src/main/java/com/valtech/spring/beans/creation/AuthService.java | 904e462f205211c074e862869dc1bf5afe87a965 | [] | no_license | GreenwaysTechnology/ValTech-Spring-Boot-Aug-21 | ec70e873315e95c2cc103a71b2a402143a2c4d22 | d47e2abc87c8001abd1e4a04b001eab32a37146e | refs/heads/main | 2023-07-11T07:18:54.644156 | 2021-08-21T10:23:04 | 2021-08-21T10:23:04 | 395,925,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package com.valtech.spring.beans.creation;
public class AuthService {
private String userName = "admin";
private String password = "admin";
private AuthService() {
}
// Factory Api
public static AuthService getInstance() {
return new AuthService();
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
// Biz Api
public boolean login(String userName, String password) {
if (this.getUserName().equals(userName) && this.getPassword().equals(password)) {
return true;
}
return false;
}
}
| [
"sasubramanian_md@hotmail.com"
] | sasubramanian_md@hotmail.com |
eb81d58be6e15bf04d98bedd6ee819aac87032b7 | ba6df130bfcbfd33c78a1049295dfea7aaafcb95 | /guest_model2_mybatis/src/com/itwill/guest/GuestService.java | 3e23ab854e7a77607183e53c9e916d6641f0e7ec | [] | no_license | kgarguri/spring | e1774e14c82994a0ef550c7cd24f65bbef608348 | 0000b186f358612335a0a385f181a6323fa58485 | refs/heads/master | 2023-01-10T12:15:04.640060 | 2020-11-16T08:08:39 | 2020-11-16T08:08:39 | 305,322,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | package com.itwill.guest;
import java.util.ArrayList;
public class GuestService {
private GuestDao guestDao;
public GuestService() throws Exception {
//guestDao=new GuestDaoImplMyBatis();
guestDao=new GuestDaoImplMyBatisMapperInterface();
}
/*
* Create
*/
public int insertGuest(Guest guest) throws Exception{
return guestDao.insertGuest(guest);
}
/*
* Read
*/
public Guest selectByNo(int no) throws Exception{
return guestDao.selectByNo(no);
}
public ArrayList<Guest> selectAll() throws Exception{
return guestDao.selectAll();
}
/*
* Update
*/
public int updateGuest(Guest guest) throws Exception{
return guestDao.updateGuest(guest);
}
/*
* Delete
*/
public int deleteGuest(int no) throws Exception{
return guestDao.deleteGuest(no);
}
}
| [
"robert.kim819@gmail.com"
] | robert.kim819@gmail.com |
66e732014dd3b13097cff24a5d5d9aa9e36f2865 | 5d89161a35f53db95c1e9661cb036fc59f9ff38d | /src/main/java/com/zhaojun/weichat/entity/response/NewsResponse.java | 840651bf15c9e96c9e9a0a9ed50bfa6b2eef4b1d | [] | no_license | ZhaoJun03/weichat | 905868b400744f896a62311aa6c32cff2e2fbf7f | e42f53c9bde4f2aa42aa725b6f81e6977ceee8c2 | refs/heads/master | 2023-08-09T06:34:19.371430 | 2021-09-07T09:02:55 | 2021-09-07T09:02:55 | 203,973,524 | 0 | 0 | null | 2023-07-22T14:20:13 | 2019-08-23T10:02:44 | Java | UTF-8 | Java | false | false | 424 | java | package com.zhaojun.weichat.entity.response;
import com.zhaojun.weichat.entity.MessageType;
import lombok.Data;
import java.util.List;
/**
* @author ZhaoJun
* @date 2019/8/22 14:58
*/
@Data
public class NewsResponse extends BaseResponse {
private List<Articles> articles;
private int articleCount;
@Override
public String getMsgType() {
return MessageType.RESPONSE_NEWS.getMsgType();
}
}
| [
"302563746@qq.com"
] | 302563746@qq.com |
8f1b4f9cd5ada5a58d345bf9b98d86e4961f590e | 936054003500ee38fa92598a5e6ee86b3e5b4f94 | /src/characteristic/positionnable/GravityAffected.java | 938ae47b63804e08d7d45c9016b852a666667513 | [] | no_license | the-zucc/coureur-de-bois | 098aa8baa632094f85b8ab9b77cdbdeebbb45953 | 8018398167fc38f6b3f4f78d3d5208d5a578a033 | refs/heads/master | 2020-04-18T08:30:19.989348 | 2019-02-09T03:13:18 | 2019-02-09T03:13:18 | 167,398,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package characteristic.positionnable;
import javafx.geometry.Point3D;
public interface GravityAffected extends Moveable {
public Point3D getGravity();
public void updateGravityVector(double secondsPassed);
public void resetGravityVector();
public void addForceToGravity(Point3D force);
}
| [
"laurier.lg@gmail.com"
] | laurier.lg@gmail.com |
a1c1fa66b59bf85402e2da8d5a05367a5e8edc77 | 4ac63f993a9a317ab8ad88e0ce660576ecefbb9a | /src/main/java/ua/com/jarvis/domain/Role.java | defb36a689d2617995e86d853e329709b69a451e | [] | no_license | Mazuruk-O/jarvis-service | 370d794366c7d3b1b4490d63a35ad4d4ffa74f62 | 250b1995da9a999e97430f324c953ee9f89a3599 | refs/heads/master | 2021-03-15T00:32:10.245408 | 2020-03-13T10:17:43 | 2020-03-13T10:17:43 | 246,808,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package ua.com.jarvis.domain;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
/**
* INSERT INTO role (NAME) VALUES
* ('ROLE_ADMIN'),('ROLE_TEACHER'),('ROLE_STUDENT');
*/
@Data
@Entity
@Table(name = "role")
public class Role implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "name_role")
private String name;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "permission_role", joinColumns = {
@JoinColumn(name = "role_id", referencedColumnName = "id")}, inverseJoinColumns = {
@JoinColumn(name = "permission_id", referencedColumnName = "id")})
private List<Permission> permissions;
}
| [
"mbeta75@gmail.com"
] | mbeta75@gmail.com |
b826085dac4f703979200f7ea86073cfb33a7b4b | 87d9ff503765d11b2c84cc556bdb4fd36b60a232 | /src/main/java/ru/xpendence/annotations/ServletInitializer.java | e755c4f180f8dbeafa45fc45a00dc86a2a5a49ba | [] | no_license | promoscow/annotations | 1920a3b738a5f62679e13f007f1b6aab10fb1a4d | 79231a50bd80334bcc9532313ed73ea30b2cc2d0 | refs/heads/master | 2020-04-21T14:22:35.353624 | 2019-02-13T15:15:03 | 2019-02-13T15:15:03 | 169,632,949 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package ru.xpendence.annotations;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AnnotationsApplication.class);
}
}
| [
"chernyshov@bakapp.ru"
] | chernyshov@bakapp.ru |
b7d75217628ce1b1e4abf53f7f7d271e75e29763 | eba5c15cf7cc4c0daee781dd0604b59cb4861f25 | /src/cn/edu/gdmec/servicebinddemo/MainActivity.java | 7324a3c0e1655d64bac00bcff1ed45dfed0a94cb | [] | no_license | gdmec07131032/ServiceBindDemo | c5cb0622619dba823b97c3c1d1d5730d2a451a62 | d182f58e275a5d076a7527fe8192f17779270979 | refs/heads/master | 2016-09-05T09:27:40.617191 | 2014-11-09T05:14:02 | 2014-11-09T05:14:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,877 | java | package cn.edu.gdmec.servicebinddemo;
import android.support.v7.app.ActionBarActivity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
Button btn1,btn2,btn3,btn4;
TextView mytv;
Intent myit = new Intent("cn.edu.gdmec.boundservice");
boolean isbound =false;
BoundService myboundservice;
ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName arg0) {
isbound = false;
}
@Override
public void onServiceConnected(ComponentName arg0, IBinder arg1) {
myboundservice = ((BoundService.LocalBinder)arg1).getService();
isbound = true;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mytv = (TextView) findViewById(R.id.textView1);
btn1 = (Button) findViewById(R.id.button1);
btn2 = (Button) findViewById(R.id.button2);
btn3 = (Button) findViewById(R.id.button3);
btn4 = (Button) findViewById(R.id.button4);
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
bindService(myit,mConnection,Context.BIND_AUTO_CREATE);
}
});
btn2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
unbindService(mConnection);
}
});
btn3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
long a =Math.round(Math.random()*100);
long b =Math.round(Math.random()*100);
if(isbound){
long avg = myboundservice.Avg(a, b);
mytv.setText("("+String.valueOf(a)+"+"+String.valueOf(b)+")/2="+String.valueOf(avg));
}
}
});
btn4.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(isbound){
String str = String.valueOf(myboundservice.PI);
mytv.setText(str);
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"59276487@qq.com"
] | 59276487@qq.com |
15f0402404bbf2d1cf1ff281fb9a247d39e78484 | 1bb9267865bacf2c12bc843c1843dd0e3ef00089 | /being_bigtyno/src/main/java/com/bigtyno/being/service/InteriorAskServiceImpl.java | cd347428c9b9d78e9d224d5285f0b971de1320a9 | [] | no_license | bigtyno/being | 6803be3fd42340ffe4572144523961d75bca3dfd | db784367a8764f890097812b39819c7a16028e82 | refs/heads/master | 2023-07-05T08:10:13.713020 | 2021-08-17T15:13:56 | 2021-08-17T15:13:56 | 375,733,730 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,960 | java | package com.bigtyno.being.service;
import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.bigtyno.being.common.Criteria;
import com.bigtyno.being.domain.InteriorAskVO;
import com.bigtyno.being.mapper.InteriorAskMapper;
@Service
public class InteriorAskServiceImpl implements InteriorAskService {
@Autowired
private InteriorAskMapper interiorAskMapper;
@Override
@Transactional
public void create(InteriorAskVO interiorAsk) throws Exception {
interiorAskMapper.create(interiorAsk);
}
@Override
@Transactional
public List<InteriorAskVO> selectInteriorAskList() throws Exception {
return interiorAskMapper.selectInteriorAskList();
}
@Override
public List<InteriorAskVO> listPage(HashMap<String, Integer> param) throws Exception {
/*
* int page = param.get("page");
*
* if (page <= 0) { page = 1; } page = (page - 1) * 10;
*/
return interiorAskMapper.listPage(param);
}
@Override
public List<InteriorAskVO> listCriteria(Criteria cri) throws Exception {
return interiorAskMapper.listCriteria(cri);
}
@Override
public int listCountCriteria(Criteria cri) throws Exception {
return interiorAskMapper.countPaging(cri);
}
@Override
@Transactional
public InteriorAskVO read(Integer num) throws Exception {
return interiorAskMapper.read(num);
}
@Override
public void modify(InteriorAskVO interiorAsk) throws Exception {
interiorAskMapper.update(interiorAsk);
}
@Override
public void modify2(InteriorAskVO interiorAsk) throws Exception {
interiorAskMapper.update(interiorAsk);
}
@Override
public void remove(Integer num) throws Exception {
interiorAskMapper.delete(num);
}
@Override
public List<InteriorAskVO> selectByEmail(String email) throws Exception {
return interiorAskMapper.selectByEmail(email);
}
}
| [
"bigtyno2@gmail.com"
] | bigtyno2@gmail.com |
cedbba0ded545ebf2db8b62c4d0c008398a48868 | 1725c0ab1831adc07a91826fdd9596299f363bb8 | /src/main/java/com/outfittery/challenge/repositories/VAvailableTimeSlotRepo.java | 35826f6eebb37200ccfbd1878f12a8bab07fee10 | [] | no_license | eabdullayev/outfittery-code-challenge | e5722abba31f07e55cf1bc2b4b493657020caa5b | 90fffa63e48572855928accc736b1edbcf460513 | refs/heads/master | 2020-03-25T09:02:04.032803 | 2019-03-15T08:30:53 | 2019-03-15T08:30:53 | 143,644,005 | 0 | 0 | null | 2019-03-15T08:30:54 | 2018-08-05T20:04:47 | Java | UTF-8 | Java | false | false | 515 | java | package com.outfittery.challenge.repositories;
import com.outfittery.challenge.models.VAvailableTimeSlot;
import org.springframework.data.jpa.repository.JpaRepository;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
public interface VAvailableTimeSlotRepo extends JpaRepository<VAvailableTimeSlot, String> {
List<VAvailableTimeSlot> findAllFreeTimeSlotsByDate(LocalDate date);
Optional<VAvailableTimeSlot> findAllFreeTimeSlotsByDateAndTime(LocalDate date, String time);
}
| [
"elchin.abdullayev@accenture.com"
] | elchin.abdullayev@accenture.com |
91c6bfe37796b428545e1c3cdc56fe47fce4261a | 86b84607acab5fbd4aa5c06b59e5a61ce51e975c | /playerlib/src/main/java/com/warm/playerlib/custom/TitleBar.java | 7c6265dc0b9eaaf1693069a22fc10ce28e886603 | [] | no_license | AWarmHug/Player | 2c330968c57c5172d186bf88657ee38f1292d389 | 0a844d41ce2cf57e988a9b88e43e1cf146f8582c | refs/heads/master | 2021-05-05T22:45:00.751334 | 2018-01-04T05:44:23 | 2018-01-04T05:44:23 | 116,213,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,966 | java | package com.warm.playerlib.custom;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.warm.playerlib.R;
import java.util.Formatter;
import java.util.Locale;
/**
* Created by warm on 17/5/6.
*/
public class TitleBar extends LinearLayout {
private TextView tv_title, tv_totalTime;
public TitleBar(Context context) {
this(context, null);
}
public TitleBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TitleBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initView(context, attrs, defStyle);
}
private void initView(Context context, AttributeSet attrs, int defStyle) {
inflate(context, R.layout.bar_title, this);
tv_title = (TextView) findViewById(R.id.tv_title);
tv_totalTime = (TextView) findViewById(R.id.tv_totalTime);
}
public void setTitle(String title) {
tv_title.setText(title);
}
public void setTotalTime(int m) {
tv_totalTime.setText(stringForTime(m));
}
private String stringForTime(int timeMs) {
StringBuilder mFormatBuilder = new StringBuilder();
Formatter mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
int totalSeconds = timeMs / 1000;
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
mFormatBuilder.setLength(0);
if (hours > 0) {
return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
} else {
return mFormatter.format("%02d:%02d", minutes, seconds).toString();
}
}
public void setTitle(CharSequence title) {
tv_title.setText(title);
}
public CharSequence getTitle() {
return tv_title.getText();
}
}
| [
"865741452@qq.com"
] | 865741452@qq.com |
066e1896cb67ba0174ea9a7624b0386c256c6fb8 | fcc9381855258d45e281b37ae9319ef70c750b5a | /app/src/main/java/com/example/android_tp01/Ecouteur.java | f004172f069215b65c388476040a33ac1ec14545 | [] | no_license | SamuelMaugard/Poo-TP2-Samuel-Maugard | 51b697930bffce73ed194c3a2d04f68f66a896a1 | ca170fd07d626044a69fd34b1ab4fee24cb76a4a | refs/heads/master | 2022-04-11T18:46:34.306255 | 2020-03-19T17:27:35 | 2020-03-19T17:27:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,979 | java | package com.example.android_tp01;
import android.graphics.Color;
import android.view.View;
import android.widget.CompoundButton;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.URISyntaxException;
import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import io.socket.engineio.client.transports.WebSocket;
public class Ecouteur implements View.OnClickListener, CompoundButton.OnCheckedChangeListener, Emitter.Listener {
Chat chat;
Preference preferences;
Socket mSocket;
public Ecouteur(Chat c,Preference p) {
this.chat = c;
this.preferences = p;
try {
mSocket = IO.socket("http://78.243.124.47:10101");
mSocket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
@Override
public void call(Object... args) { System.out.println("Connnecté");
}
});
mSocket.on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
@Override
public void call(Object... args) { System.out.println("Déconnecté");
}
});
mSocket.on("chatevent", new Emitter.Listener() {
@Override
public void call(Object... args) {
String userName = "";
String message = "";
System.out.println(args[0].toString());
try {
JSONObject obj = new JSONObject(args[0].toString());
userName = obj.getString("userName");
message = obj.getString("message");
} catch (JSONException e) {
e.printStackTrace();
}
chat.ajouterMessage(userName, message);
}
});
mSocket.on("connected list", new Emitter.Listener() {
@Override
public void call(Object... args) {
JSONObject data = (JSONObject) args[0];
try {
JSONArray connected = data.getJSONArray("connected");
chat.ajouterMessage("-------Liste des Participants -------",Color.RED);
System.out.println(args[0].toString());
for (int i = 0; i < connected.length() ; i++) {
chat.ajouterMessage(connected.get(i).toString(), Color.RED);
}
chat.ajouterMessage("-------Fin de la Liste des Participants -------",Color.RED);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
@Override
public void onClick(View v) {
if(mSocket.connected()) {
JSONObject msg = new JSONObject();
try {
msg.accumulate("userName", preferences.obtenirSurnom());
msg.accumulate("message", chat.obtenirTextTape());
} catch (JSONException e) {
e.printStackTrace();
}
mSocket.emit("chatevent", msg);
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {connexion();
} else { deconnexion(); }
}
void connexion() {
mSocket.connect();
}
void deconnexion() {
mSocket.disconnect();
}
void emitMessage(String msg) {
mSocket.emit("chatevent", msg);
}
@Override
public void call(Object... args) {
}
public void demandeListesConnectés() {
JSONObject msg = new JSONObject();
mSocket.emit("queryconnected", msg);
}
}
| [
"zachari.maki@gmail.com"
] | zachari.maki@gmail.com |
b84340af71e400cb0bba3623f04ea3296217deef | b863479f00471986561c57291edb483fc5f4532c | /src/main/java/nom/bdezonia/zorbage/algebra/GetAsShortArrayExact.java | 3cfaa31e92c52c6be970e7e86eaea4763f043e0e | [] | permissive | bdezonia/zorbage | 6da6cbdc8f9fcb6cde89d39aca9687e2eee08c9b | 651625e60b7d6ca9273ffc1a282b6a8af5c2d925 | refs/heads/master | 2023-09-01T08:32:59.157936 | 2023-08-08T00:57:18 | 2023-08-08T00:57:18 | 74,696,586 | 11 | 0 | BSD-2-Clause | 2020-11-09T03:01:42 | 2016-11-24T18:24:55 | Java | UTF-8 | Java | false | false | 1,777 | java | /*
* Zorbage: an algebraic data hierarchy for use in numeric processing.
*
* Copyright (c) 2016-2022 Barry DeZonia 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 the <copyright holder> 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 <COPYRIGHT HOLDER> 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 nom.bdezonia.zorbage.algebra;
/**
*
* @author Barry DeZonia
*
*/
public interface GetAsShortArrayExact {
short[] getAsShortArrayExact();
}
| [
"bdezonia@gmail.com"
] | bdezonia@gmail.com |
25e1fdfc720992316a10f5b535d655b028f31ff4 | f630c7237f9be22c332ac10a594e668e2ccdb768 | /src/main/java/com/developcenter/broker/oracle/common/Constants.java | 0a403ea2ef490ba0f45c4b78dcbba6267021e53c | [] | no_license | datianshi/cloudfoundry-oracle-service-broker | f8120d7d611fb2b94e14c48ac2f2e17911ba2acc | 70e99b6418ddddbb13bf3ac120e895852206250d | refs/heads/master | 2021-01-21T05:54:23.771856 | 2014-11-20T16:27:42 | 2014-11-20T16:27:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.developcenter.broker.oracle.common;
public class Constants {
public static final int MAX_ACTIVE_CONN = 5;
public static final String DB2_VALIDATE_SQL = "SELECT COUNT(*) FROM SYSIBM.SYSTABLES";
public static final String ORACLE_VALIDATE_SQL = "SELECT 1 FROM DUAL";
public static final String DEFAULT_VALIDATE_SQL = "SELECT 1";
}
| [
"wangdk789@163.com"
] | wangdk789@163.com |
435011484e123fb4966071f86da4755fbc0ac63e | a6c60f8fa492d793fc4eb6ec0392d6dbd5b08cd6 | /SpringSample/src/main/java/com/example/demo/login/aspect/ErrorAspect.java | 946ec01242acf45596b63e1ce0eef932723c43df | [] | no_license | IwaiSumire/trial | e6b53c0eded78ced6eb04b92a20f58eb4fdec196 | f86b281f72a16e795f12965b8808816b7a0f6e17 | refs/heads/main | 2023-03-08T01:22:44.792957 | 2021-02-18T12:11:14 | 2021-02-18T12:11:14 | 314,762,645 | 0 | 1 | null | 2021-02-18T12:11:14 | 2020-11-21T08:02:06 | Java | UTF-8 | Java | false | false | 825 | java | package com.example.demo.login.aspect;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class ErrorAspect {
//全てのクラスを対象
@AfterThrowing(value="execution(* *..*..*(..))"
+ " && (bean(*Controller) || bean(*Service) || bean(*Repository))"
, throwing="ex")
public void throwingNull(DataAccessException ex) {
//例外処理の内容(ログ出力)
System.out.println("===========================================");
System.out.println("DataAccessExceptionが発生しました。 : " + ex);
System.out.println("===========================================");
}
}
| [
"opz09966@gmail.com"
] | opz09966@gmail.com |
4188e08b06a41e31bf4d3d401ebb725c4522e5ae | 85d27a06e12b635ab4a7c20d998fc69393a68113 | /src/main/java/com/swkj/zebra/service/VpnGpsService.java | 15acfac84bd1048057cfe61850ae8a1cb5b09f84 | [] | no_license | juxian/shiweikongjian | 4dd4a992effa28a0ff41c44c37ebe9790b28d7db | 58661f41211ba748a603ddb76bd023c6729aa8eb | refs/heads/master | 2021-01-13T03:33:48.232671 | 2016-12-28T06:53:35 | 2016-12-28T06:53:35 | 77,509,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.swkj.zebra.service;
import com.amaz.core.orm.CommonRepository;
import com.amaz.core.service.BaseService;
import com.swkj.zebra.dao.VpnGpsDao;
import com.swkj.zebra.entity.Vpn;
import com.swkj.zebra.entity.VpnGps;
import com.swkj.zebra.web.view.FakeLocationView;
import javax.inject.Inject;
import javax.inject.Named;
/**
* Created by sunbaoliang on 2016/12/13 0013.
*/
@Named
public class VpnGpsService extends BaseService<VpnGps, Long> {
@Inject
private VpnGpsDao vpnGpsDao;
@Override
protected CommonRepository<VpnGps, Long> getEntityRepository() {
return vpnGpsDao;
}
public FakeLocationView getParamsFakeLocation(Vpn vpn) {
// TODO Auto-generated method stub
return null;
}
public Integer getRandomIdByVpnId(Long vpnId) {
return null;
}
}
| [
"279910068@qq.com"
] | 279910068@qq.com |
e58ecd5d30491a7b7bf2c702172414372a362424 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/protocal/protobuf/cwo.java | 80fc017b8c7b0af3ccd35b650754a4b7bf1d61fb | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 4,895 | java | package com.tencent.mm.protocal.protobuf;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.LinkedList;
public final class cwo extends bsr
{
public LinkedList<cwt> xsk;
public brr xsl;
public cwo()
{
AppMethodBeat.i(96326);
this.xsk = new LinkedList();
AppMethodBeat.o(96326);
}
public final int op(int paramInt, Object[] paramArrayOfObject)
{
int i = 0;
AppMethodBeat.i(96327);
if (paramInt == 0)
{
paramArrayOfObject = (e.a.a.c.a)paramArrayOfObject[0];
if (this.BaseRequest != null)
{
paramArrayOfObject.iy(1, this.BaseRequest.computeSize());
this.BaseRequest.writeFields(paramArrayOfObject);
}
paramArrayOfObject.e(2, 8, this.xsk);
if (this.xsl != null)
{
paramArrayOfObject.iy(3, this.xsl.computeSize());
this.xsl.writeFields(paramArrayOfObject);
}
AppMethodBeat.o(96327);
paramInt = i;
return paramInt;
}
if (paramInt == 1)
if (this.BaseRequest == null)
break label627;
label627: for (paramInt = e.a.a.a.ix(1, this.BaseRequest.computeSize()) + 0; ; paramInt = 0)
{
i = paramInt + e.a.a.a.c(2, 8, this.xsk);
paramInt = i;
if (this.xsl != null)
paramInt = i + e.a.a.a.ix(3, this.xsl.computeSize());
AppMethodBeat.o(96327);
break;
if (paramInt == 2)
{
paramArrayOfObject = (byte[])paramArrayOfObject[0];
this.xsk.clear();
paramArrayOfObject = new e.a.a.a.a(paramArrayOfObject, unknownTagHandler);
for (paramInt = bsr.getNextFieldNumber(paramArrayOfObject); paramInt > 0; paramInt = bsr.getNextFieldNumber(paramArrayOfObject))
if (!super.populateBuilderWithField(paramArrayOfObject, this, paramInt))
paramArrayOfObject.ems();
AppMethodBeat.o(96327);
paramInt = i;
break;
}
if (paramInt == 3)
{
Object localObject1 = (e.a.a.a.a)paramArrayOfObject[0];
cwo localcwo = (cwo)paramArrayOfObject[1];
paramInt = ((Integer)paramArrayOfObject[2]).intValue();
int j;
Object localObject2;
boolean bool;
switch (paramInt)
{
default:
paramInt = -1;
AppMethodBeat.o(96327);
break;
case 1:
paramArrayOfObject = ((e.a.a.a.a)localObject1).Vh(paramInt);
j = paramArrayOfObject.size();
for (paramInt = 0; paramInt < j; paramInt++)
{
localObject2 = (byte[])paramArrayOfObject.get(paramInt);
localObject1 = new hl();
localObject2 = new e.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((hl)localObject1).populateBuilderWithField((e.a.a.a.a)localObject2, (com.tencent.mm.bt.a)localObject1, bsr.getNextFieldNumber((e.a.a.a.a)localObject2)));
localcwo.BaseRequest = ((hl)localObject1);
}
AppMethodBeat.o(96327);
paramInt = i;
break;
case 2:
paramArrayOfObject = ((e.a.a.a.a)localObject1).Vh(paramInt);
j = paramArrayOfObject.size();
for (paramInt = 0; paramInt < j; paramInt++)
{
localObject2 = (byte[])paramArrayOfObject.get(paramInt);
localObject1 = new cwt();
localObject2 = new e.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = ((cwt)localObject1).populateBuilderWithField((e.a.a.a.a)localObject2, (com.tencent.mm.bt.a)localObject1, bsr.getNextFieldNumber((e.a.a.a.a)localObject2)));
localcwo.xsk.add(localObject1);
}
AppMethodBeat.o(96327);
paramInt = i;
break;
case 3:
localObject1 = ((e.a.a.a.a)localObject1).Vh(paramInt);
j = ((LinkedList)localObject1).size();
for (paramInt = 0; paramInt < j; paramInt++)
{
localObject2 = (byte[])((LinkedList)localObject1).get(paramInt);
paramArrayOfObject = new brr();
localObject2 = new e.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (bool = true; bool; bool = paramArrayOfObject.populateBuilderWithField((e.a.a.a.a)localObject2, paramArrayOfObject, bsr.getNextFieldNumber((e.a.a.a.a)localObject2)));
localcwo.xsl = paramArrayOfObject;
}
AppMethodBeat.o(96327);
paramInt = i;
break;
}
}
paramInt = -1;
AppMethodBeat.o(96327);
break;
}
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes4-dex2jar.jar
* Qualified Name: com.tencent.mm.protocal.protobuf.cwo
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
4da1b41349b4ca22aca736aa42b2240a402d2d18 | a6a88cad8be2ffdc32711c9d6b00b7a4fae2fd26 | /src/main/java/br/com/fiap/guto/web/rest/UsuarioResource.java | c99616c6173fb31bd699f74a29e278c16e711d36 | [] | no_license | paulogrillo/jhipster-App | 505c8537d6f792bfb64a3bfeb0df61ae2df65865 | 2754dc2ed427b6e0e13c8314c17a07a7a08e7148 | refs/heads/main | 2023-04-01T11:05:50.217257 | 2021-03-28T08:37:54 | 2021-03-28T08:37:54 | 352,210,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,835 | java | package br.com.fiap.guto.web.rest;
import br.com.fiap.guto.domain.Usuario;
import br.com.fiap.guto.repository.UsuarioRepository;
import br.com.fiap.guto.service.UsuarioService;
import br.com.fiap.guto.web.rest.errors.BadRequestAlertException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import tech.jhipster.web.util.HeaderUtil;
import tech.jhipster.web.util.PaginationUtil;
import tech.jhipster.web.util.ResponseUtil;
/**
* REST controller for managing {@link br.com.fiap.guto.domain.Usuario}.
*/
@RestController
@RequestMapping("/api")
public class UsuarioResource {
private final Logger log = LoggerFactory.getLogger(UsuarioResource.class);
private static final String ENTITY_NAME = "usuario";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final UsuarioService usuarioService;
private final UsuarioRepository usuarioRepository;
public UsuarioResource(UsuarioService usuarioService, UsuarioRepository usuarioRepository) {
this.usuarioService = usuarioService;
this.usuarioRepository = usuarioRepository;
}
/**
* {@code POST /usuarios} : Create a new usuario.
*
* @param usuario the usuario to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new usuario, or with status {@code 400 (Bad Request)} if the usuario has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/usuarios")
public ResponseEntity<Usuario> createUsuario(@RequestBody Usuario usuario) throws URISyntaxException {
log.debug("REST request to save Usuario : {}", usuario);
if (usuario.getId() != null) {
throw new BadRequestAlertException("A new usuario cannot already have an ID", ENTITY_NAME, "idexists");
}
Usuario result = usuarioService.save(usuario);
return ResponseEntity
.created(new URI("/api/usuarios/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /usuarios/:id} : Updates an existing usuario.
*
* @param id the id of the usuario to save.
* @param usuario the usuario to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated usuario,
* or with status {@code 400 (Bad Request)} if the usuario is not valid,
* or with status {@code 500 (Internal Server Error)} if the usuario couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/usuarios/{id}")
public ResponseEntity<Usuario> updateUsuario(@PathVariable(value = "id", required = false) final Long id, @RequestBody Usuario usuario)
throws URISyntaxException {
log.debug("REST request to update Usuario : {}, {}", id, usuario);
if (usuario.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, usuario.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!usuarioRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
Usuario result = usuarioService.save(usuario);
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuario.getId().toString()))
.body(result);
}
/**
* {@code PATCH /usuarios/:id} : Partial updates given fields of an existing usuario, field will ignore if it is null
*
* @param id the id of the usuario to save.
* @param usuario the usuario to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated usuario,
* or with status {@code 400 (Bad Request)} if the usuario is not valid,
* or with status {@code 404 (Not Found)} if the usuario is not found,
* or with status {@code 500 (Internal Server Error)} if the usuario couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PatchMapping(value = "/usuarios/{id}", consumes = "application/merge-patch+json")
public ResponseEntity<Usuario> partialUpdateUsuario(
@PathVariable(value = "id", required = false) final Long id,
@RequestBody Usuario usuario
) throws URISyntaxException {
log.debug("REST request to partial update Usuario partially : {}, {}", id, usuario);
if (usuario.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, usuario.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!usuarioRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
Optional<Usuario> result = usuarioService.partialUpdate(usuario);
return ResponseUtil.wrapOrNotFound(
result,
HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuario.getId().toString())
);
}
/**
* {@code GET /usuarios} : get all the usuarios.
*
* @param pageable the pagination information.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of usuarios in body.
*/
@GetMapping("/usuarios")
public ResponseEntity<List<Usuario>> getAllUsuarios(Pageable pageable) {
log.debug("REST request to get a page of Usuarios");
Page<Usuario> page = usuarioService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* {@code GET /usuarios/:id} : get the "id" usuario.
*
* @param id the id of the usuario to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the usuario, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/usuarios/{id}")
public ResponseEntity<Usuario> getUsuario(@PathVariable Long id) {
log.debug("REST request to get Usuario : {}", id);
Optional<Usuario> usuario = usuarioService.findOne(id);
return ResponseUtil.wrapOrNotFound(usuario);
}
/**
* {@code DELETE /usuarios/:id} : delete the "id" usuario.
*
* @param id the id of the usuario to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/usuarios/{id}")
public ResponseEntity<Void> deleteUsuario(@PathVariable Long id) {
log.debug("REST request to delete Usuario : {}", id);
usuarioService.delete(id);
return ResponseEntity
.noContent()
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
.build();
}
}
| [
"paulodigitalart@gmail.com"
] | paulodigitalart@gmail.com |
06361bede6e418be5b4a1845af36ea6338c5f078 | 4bb83687710716d91b5da55054c04f430474ee52 | /dsrc/sku.0/sys.server/compiled/game/script/systems/missions/dynamic/bounty_probot.java | bd9b7c856be42a35863c4d3bc929890c0649adb5 | [] | no_license | geralex/SWG-NGE | 0846566a44f4460c32d38078e0a1eb115a9b08b0 | fa8ae0017f996e400fccc5ba3763e5bb1c8cdd1c | refs/heads/master | 2020-04-06T11:18:36.110302 | 2018-03-19T15:42:32 | 2018-03-19T15:42:32 | 157,411,938 | 1 | 0 | null | 2018-11-13T16:35:01 | 2018-11-13T16:35:01 | null | UTF-8 | Java | false | false | 2,949 | java | package script.systems.missions.dynamic;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.utils;
public class bounty_probot extends script.systems.missions.base.mission_dynamic_base
{
public bounty_probot()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
setInvulnerable(self, true);
messageTo(self, "destroySelf", null, 180, true);
if (!hasScript(self, "conversation.bounty_probot"))
{
attachScript(self, "conversation.bounty_probot");
}
return SCRIPT_CONTINUE;
}
public int setup_Droid(obj_id self, dictionary params) throws InterruptedException
{
obj_id objWaypoint = params.getObjId("objWaypoint");
obj_id objPlayer = params.getObjId("objPlayer");
obj_id objMission = params.getObjId("objMission");
int intTrackType = params.getInt("intTrackType");
int intDroidType = params.getInt("intDroidType");
setObjVar(self, "objPlayer", objPlayer);
setObjVar(self, "objMission", objMission);
setObjVar(self, "intTrackType", intTrackType);
setObjVar(self, "intDroidType", intDroidType);
setObjVar(self, "objWaypoint", objWaypoint);
return SCRIPT_CONTINUE;
}
public int destroySelf(obj_id self, dictionary params) throws InterruptedException
{
obj_id[] objPlayers = getAllPlayers(getLocation(self), 64);
if (objPlayers != null && objPlayers.length > 0)
{
playClientEffectLoc(objPlayers[0], "clienteffect/combat_explosion_lair_large.cef", getLocation(self), 0);
}
obj_id objMission = getObjIdObjVar(self, "objMission");
messageTo(objMission, "stopTracking", null, 0, true);
messageTo(self, "delete_Self", null, 0, true);
return SCRIPT_CONTINUE;
}
public int delete_Self(obj_id self, dictionary params) throws InterruptedException
{
obj_id objWaypoint = getObjIdObjVar(self, "objWaypoint");
destroyObject(objWaypoint);
destroyObject(self);
return SCRIPT_CONTINUE;
}
public int take_Off(obj_id self, dictionary params) throws InterruptedException
{
doAnimationAction(self, "sp_13");
dictionary dctParams = new dictionary();
obj_id objMission = getObjIdObjVar(self, "objMission");
int intTrackType = getIntObjVar(self, "intTrackType");
int intDroidType = getIntObjVar(self, "intDroidType");
dctParams.put("intDroidType", intDroidType);
dctParams.put("intTrackType", DROID_FIND_TARGET);
messageTo(objMission, "findTarget", dctParams, 10, true);
utils.sendPostureChange(self, POSTURE_SITTING);
messageTo(self, "delete_Self", null, 10, true);
return SCRIPT_CONTINUE;
}
}
| [
"tmoflash@gmail.com"
] | tmoflash@gmail.com |
258a6629eeca18870d65c654499bbbb569dd267f | e2863284ddda12ad67cd77e0f643d63babf9d67c | /src/main/java/com/clarazheng/controller/NewsController.java | 07abbca0b60d77cdbfd2c247c0be74ebab08a610 | [] | no_license | clarazheng/zixun | 06ec3a8a42f954ef050c49c9a51f23d03f1d9a8a | e9aead75c7f27c8b44fb1362ee1c126cac78eaca | refs/heads/master | 2021-01-01T19:16:53.241818 | 2017-07-27T15:28:26 | 2017-07-27T15:28:26 | 98,552,530 | 1 | 0 | null | 2017-07-27T15:51:09 | 2017-07-27T15:28:33 | CSS | UTF-8 | Java | false | false | 5,024 | java | package com.clarazheng.controller;
import com.clarazheng.model.*;
import com.clarazheng.service.*;
import com.clarazheng.util.ZixunUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by clara on 2017/5/6.
*/
@Controller
public class NewsController {
private static final Logger logger= LoggerFactory.getLogger(NewsController.class);
@Autowired
NewsService newsService;
@Autowired
UserService userService;
@Autowired
CommentService commentService;
@Autowired
LikeService likeService;
@Autowired
SensitiveService sensitiveService;
@Autowired
HostHolder hostHolder;
@RequestMapping(path = {"/addImage"},method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public String saveImage(@RequestParam("file")MultipartFile file){
try{
String imageDir= newsService.addImage(file);
return ZixunUtil.getJSONString(0,imageDir);
}catch (Exception e){
logger.error("上传图片失败"+e.getMessage());
return ZixunUtil.getJSONString(1,"上传图片失败");
}
}
@RequestMapping(path = {"/image"},method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public void getImage(@RequestParam("name")String name, HttpServletResponse response){
try {
response.setContentType("image/jpeg");
StreamUtils.copy(new FileInputStream(ZixunUtil.imageDir + name), response.getOutputStream());
}catch (Exception e){
logger.error("显示图片失败"+e.getMessage());
}
}
@RequestMapping(path="/news/{newsId}",method = {RequestMethod.POST,RequestMethod.GET})
public String newsDetail(@PathVariable("newsId")int newsId, Model model){
News news=newsService.getById(newsId);
User owner=userService.selectById(news.getUserId());
model.addAttribute("news",news);
model.addAttribute("owner",owner);
if(hostHolder.getUser()==null){
model.addAttribute("like",0);
}else {
model.addAttribute("like", likeService.getLikeStatus(hostHolder.getUser().getId(),news.getId(), EntityType.Entity_News));
}
List<Comment> commentList=commentService.getByEntity(newsId, EntityType.Entity_News);
List<ViewObject> comments=new ArrayList<ViewObject>();
for(Comment comment:commentList){
ViewObject vo=new ViewObject();
vo.set("comment",comment);
vo.set("user",userService.selectById(comment.getUserId()));
comments.add(vo);
}
model.addAttribute("comments",comments);
return "detail";
}
@RequestMapping(path="/addNews",method = {RequestMethod.POST})
@ResponseBody
public String addNews(@RequestParam("image") String image,
@RequestParam("title") String title,
@RequestParam("link") String link){
try {
News news =new News();
if (hostHolder.getUser() == null) {
news.setUserId(ZixunUtil.ANONYMOUS_USER);
}else{
news.setUserId(hostHolder.getUser().getId());
}
news.setImage(image);
news.setTitle(sensitiveService.filter(title));
news.setLink(sensitiveService.filter(link));
news.setCreatedDate(new Date());
news.setLikeCount(0);
news.setCommentCount(0);
newsService.addNews(news);
return ZixunUtil.getJSONString(0);
}catch (Exception e){
logger.error("增加资讯失败"+e.getMessage());
return ZixunUtil.getJSONString(1,"failed");
}
}
@RequestMapping(path="/addComment",method = {RequestMethod.POST})
public String addComment(@RequestParam("newsId")int newsId,@RequestParam("content")String content){
try {
Comment comment=new Comment();
if (hostHolder.getUser() == null) {
return "redirect:/?pop=1";
} else {
comment.setUserId(hostHolder.getUser().getId());
}
comment.setEntityType(EntityType.Entity_News);
comment.setEntityId(newsId);
comment.setContent(content);
comment.setCreatedDate(new Date());
comment.setStatus(0);
commentService.addComment(comment);
}catch (Exception e){
logger.error("增加评论失败"+e.getMessage());
}
return "redirect:/news/"+newsId;
}
}
| [
"844359796@qq.com"
] | 844359796@qq.com |
33700c5fc6476a5203f98fd2a46cf1feb7911f39 | 6b2e1f5fdd3668b32c471ff872f03f043b18d5f7 | /mutants/dataset/lcs_length/3367/LCS_LENGTH.java | e77550a515139dc93ed2d8c9bbfd315c288b7d89 | [] | no_license | mou23/Impact-of-Similarity-on-Repairing-Small-Programs | 87e58676348f1b55666171128ecced3571979d44 | 6704d78b2bc9c103d97bcf55ecd5c12810ba2851 | refs/heads/master | 2023-03-25T10:42:17.464870 | 2021-03-20T04:55:17 | 2021-03-20T04:55:17 | 233,513,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,965 | java | package buggy_java_programs;
import java.util.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author derricklin
*/
public class LCS_LENGTH {
public static Integer lcs_length(String s, String t) {
// make a Counter
// pair? no! just hashtable to a hashtable.. woo.. currying
Map<Integer, Map<Integer,Integer>> dp = new HashMap<Integer,Map<Integer,Integer>>();
// just set all the internal maps to 0
for (int i=0; i < s.length(); i++) {
Map<Integer,Integer> initialize = new HashMap<Integer,Integer>();
dp.put(i, initialize);
for (int j=0; j < t.length(); j++) {
Map<Integer,Integer> internal_map = dp.java.util(i);
internal_map.put(j,0);
dp.put(i, internal_map);
}
}
// now the actual code
for (int i=0; i < s.length(); i++) {
for (int j=0; j < t.length(); j++) {
if (s.charAt(i) == t.charAt(j)) {
if (dp.containsKey(i-1)) {
Map<Integer, Integer> internal_map = dp.get(i);
int insert_value = dp.get(i-1).get(j) + 1;
internal_map.put(j, insert_value);
dp.put(i,internal_map);
} else {
Map<Integer, Integer> internal_map = dp.get(i);
internal_map.put(j,1);
dp.put(i,internal_map);
}
}
}
}
if (!dp.isEmpty()) {
List<Integer> ret_list = new ArrayList<Integer>();
for (int i=0; i<s.length(); i++) {
ret_list.add(!dp.get(i).isEmpty() ? Collections.max(dp.get(i).values()) : 0);
}
return Collections.max(ret_list);
} else {
return 0;
}
}
}
| [
"bsse0731@iit.du.ac.bd"
] | bsse0731@iit.du.ac.bd |
23b6694d01b5b1e26970dfc7b632f11034d04da3 | 132b9367ed0b34da570e54e09d7f6791fe513d5c | /src/main/java/org/wso2/external_contributions/httpClient/HttpHandler.java | 08b7a3259d400919b7c8c960f1f309c8bd225f36 | [] | no_license | vithu30/Staging | 550b406af9b06c41120566f39758560a803656fc | e706cb63de4de625c5b2f67f62fa322606964f8d | refs/heads/master | 2020-03-06T21:40:33.658686 | 2018-04-10T05:40:43 | 2018-04-10T05:40:43 | 127,083,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,189 | java | /*
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.external_contributions.httpClient;
import com.google.common.io.BaseEncoding;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
/*
* Handle get request to backend
*/
public class HttpHandler {
private static final Logger logger = Logger.getLogger(HttpHandler.class);
private static final PropertyReader propertyReader = new PropertyReader();
private String backendUrl;
private String backendUsername;
private String backendPassword;
public HttpHandler() {
this.backendUrl = propertyReader.getBackendUrl();
this.backendPassword = propertyReader.getBackendPassword();
this.backendUsername = propertyReader.getBackendUsername();
}
public String httpsGet(String url) throws IOException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException {
InputStream file = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(propertyReader.getTrustStoreFile());
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(file, propertyReader.getTrustStorePassword().toCharArray());
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(keyStore,null).build();
// HostnameVerifier allowAllHosts = new NoopHostnameVerifier();
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext);
CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build();
HttpGet request = new HttpGet(this.backendUrl + url);
request.addHeader("Accept", "application/json");
String encodedCredentials = this.encode(this.backendUsername + ":" + this.backendPassword);
request.addHeader("Authorization", "Basic " + encodedCredentials);
String responseString = null;
try {
HttpResponse response = httpClient.execute(request);
if (logger.isDebugEnabled()) {
logger.debug("Request successful for " + url);
}
responseString = EntityUtils.toString(response.getEntity(), "UTF-8");
} catch (IllegalStateException e) {
logger.error("The response is empty ");
} catch (NullPointerException e) {
logger.error("Bad request to the URL");
} catch (IOException e) {
logger.error("mke");
}
return responseString;
}
private String encode(String text) {
String returnString = null;
try {
returnString = BaseEncoding.base64().encode(text.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return returnString;
}
}
| [
"vithu30@hotmail.com"
] | vithu30@hotmail.com |
c1127466030611200d0287f6fb0c3eee28e63355 | 7ee29a02eec7e550353d4ceb17d13a14ac600816 | /languages/Natlab/src/natlab/tame/valueanalysis/advancedMatrix/AdvancedMatrixValue.java | 615f6fd7e83c8ec8d82a86838f7d2752cc531421 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | specs-feup/mclab-core | 793e760feddc39557d93d2a941efcf87cdc3a438 | 4943d3c1f67dddf2171adfef7520ce9de7978b70 | refs/heads/master | 2021-01-16T21:40:15.354592 | 2015-05-31T17:20:46 | 2015-05-31T17:20:46 | 36,613,574 | 0 | 0 | null | 2015-05-31T17:16:45 | 2015-05-31T17:16:45 | null | UTF-8 | Java | false | false | 13,948 | java | package natlab.tame.valueanalysis.advancedMatrix;
import natlab.tame.classes.reference.PrimitiveClassReference; //class component
import natlab.tame.valueanalysis.ValueSet;
import natlab.tame.valueanalysis.aggrvalue.AggrValue;
import natlab.tame.valueanalysis.aggrvalue.MatrixValue;
//import natlab.tame.valueanalysis.AdvancedMatrix.AdvancedMatrixValue;
//import natlab.tame.valueanalysis.AdvancedMatrix.AdvancedMatrixValueFactory;
import natlab.tame.valueanalysis.basicmatrix.BasicMatrixValue;
import natlab.tame.valueanalysis.components.constant.Constant;
import natlab.tame.valueanalysis.components.constant.HasConstant; //constant component
import natlab.tame.valueanalysis.components.isComplex.HasisComplexInfo;
import natlab.tame.valueanalysis.components.isComplex.isComplexInfo;
import natlab.tame.valueanalysis.components.isComplex.isComplexInfoFactory;
import natlab.tame.valueanalysis.components.rangeValue.HasRangeValue;
import natlab.tame.valueanalysis.components.rangeValue.RangeValue;
import natlab.tame.valueanalysis.components.shape.HasShape; //shape component
import natlab.tame.valueanalysis.components.shape.Shape;
import natlab.tame.valueanalysis.components.shape.ShapeFactory;
import natlab.tame.valueanalysis.components.shape.ShapePropagator;
import natlab.tame.valueanalysis.value.Args;
import natlab.tame.valueanalysis.value.Res;
/**
* represents a MatrixValue that is instantiable. It stores a constant, on top
* of the matlab class
*/
public class AdvancedMatrixValue extends MatrixValue<AdvancedMatrixValue>
implements HasConstant,
HasisComplexInfo<AggrValue<AdvancedMatrixValue>>,
HasShape<AggrValue<AdvancedMatrixValue>>,
HasRangeValue<AggrValue<AdvancedMatrixValue>>{
static boolean Debug = false;
static AdvancedMatrixValueFactory factory = new AdvancedMatrixValueFactory();
Constant constant;
Shape<AggrValue<AdvancedMatrixValue>> shape;
isComplexInfo<AggrValue<AdvancedMatrixValue>> iscomplex;
RangeValue<AggrValue<AdvancedMatrixValue>> rangeValue;
static ShapePropagator<AggrValue<AdvancedMatrixValue>> shapePropagator =
ShapePropagator.getInstance();
public AdvancedMatrixValue(String symbolic, PrimitiveClassReference aClass) {
super(symbolic, aClass);
}
public AdvancedMatrixValue(String symbolic, PrimitiveClassReference aClass, String isComplex) {
super(symbolic, aClass);
this.iscomplex = (new isComplexInfoFactory<AggrValue<AdvancedMatrixValue>>(
factory)).newisComplexInfoFromConst(isComplex);
}
/**
* XU add this method to support initial input shape info. svcn
*
* @25th,Jul,2012
*
* @param aClass
* @param shapeInfo
* @param isComplex
*/
public AdvancedMatrixValue(String symbolic,
PrimitiveClassReference aClass,
String shapeInfo,
String isComplex) {
super(symbolic, aClass);
this.iscomplex = (new isComplexInfoFactory<AggrValue<AdvancedMatrixValue>>(
factory)).newisComplexInfoFromConst(isComplex);
this.shape = (new ShapeFactory<AggrValue<AdvancedMatrixValue>>())
.newShapeFromInputString(shapeInfo);
}
public AdvancedMatrixValue(String symbolic, AdvancedMatrixValue onlyClassInfo,
Shape<AggrValue<AdvancedMatrixValue>> shape) {
super(symbolic, onlyClassInfo.classRef);
this.shape = shape;
}
public AdvancedMatrixValue(String symbolic, AdvancedMatrixValue onlyClassInfo,
Shape<AggrValue<AdvancedMatrixValue>> shape,
isComplexInfo<AggrValue<AdvancedMatrixValue>> iscomplex) {
super(symbolic, onlyClassInfo.classRef);
this.shape = shape;
this.iscomplex = iscomplex;
}
public AdvancedMatrixValue(String symbolic, AdvancedMatrixValue onlyClassInfo,
isComplexInfo<AggrValue<AdvancedMatrixValue>> iscomplex) {
super(symbolic, onlyClassInfo.classRef);
this.iscomplex = iscomplex;
}
/**
* how to deal with a constant
*/
public AdvancedMatrixValue(String symbolic, Constant constant) {
super(symbolic, constant.getMatlabClass());
shape = (new ShapeFactory<AggrValue<AdvancedMatrixValue>>())
.newShapeFromIntegers(constant.getShape());
iscomplex = (new isComplexInfoFactory<AggrValue<AdvancedMatrixValue>>(
factory))
.newisComplexInfoFromConst(constant.getisComplexInfo());// TODO
this.constant = constant;
}
/**
* Use this constructor if mclass and constant value is provided by the user
*/
public AdvancedMatrixValue(String symbolic, PrimitiveClassReference aClass, Constant constant) {
super(symbolic, aClass);
shape = (new ShapeFactory<AggrValue<AdvancedMatrixValue>>())
.newShapeFromIntegers(constant.getShape());
iscomplex = (new isComplexInfoFactory<AggrValue<AdvancedMatrixValue>>(
factory))
.newisComplexInfoFromConst(constant.getisComplexInfo());// TODO
this.constant = constant;
}
public AdvancedMatrixValue(String symbolic, PrimitiveClassReference matlabClass,
Shape<AggrValue<AdvancedMatrixValue>> shape,
RangeValue range,
isComplexInfo<AggrValue<AdvancedMatrixValue>> iscomplex) {
super(symbolic, matlabClass);
this.shape = shape;
this.iscomplex = iscomplex;
this.rangeValue = range;
}
/**
* returns true if the represented data is a constant
*/
public boolean isConstant() {
return constant != null;
}
public boolean hasConstant() {
return constant != null;
}
@Override
/**
* returns the constant represented by this data, or null if it is not constant
*/
public Constant getConstant() {
return constant;
}
public isComplexInfo<AggrValue<AdvancedMatrixValue>> getisComplexInfo() {
return iscomplex;
}
public void setConstantNull() {
this.constant = null;
}
@Override
public AdvancedMatrixValue merge(AggrValue<AdvancedMatrixValue> other) {
//
// if (!(other instanceof AdvancedMatrixValue))
// throw new UnsupportedOperationException(
// "can only merge a Matrix Value with another Matrix Value");
// if (!other.getMatlabClass().equals(classRef))
// throw new UnsupportedOperationException(
// "only Values with the same class can be merged, trying to merge :"
// + this + ", " + other);
// System.out.println("this constant is ~" + constant + " " + other);
//
// if (constant == null) {
//
// if (((AdvancedMatrixValue) other).constant == null) {
//
// if (iscomplex == null) {
// return this;
// }
// if (iscomplex.equals(((AdvancedMatrixValue) other)
// .getisComplexInfo()) != true) {
//
// return new AdvancedMatrixValue(this.symbolic, new AdvancedMatrixValue(this.symbolic,
// this.classRef),this.shape.merge(((AdvancedMatrixValue) other)
// .getShape()),
// this.iscomplex.merge(((AdvancedMatrixValue) other)
// .getisComplexInfo()));
// }
// else{
// return new AdvancedMatrixValue(this.symbolic, new AdvancedMatrixValue(this.symbolic,
// this.classRef),this.shape.merge(((AdvancedMatrixValue) other)
// .getShape()), this.iscomplex.merge(((AdvancedMatrixValue) other)
// .getisComplexInfo()));
// }
//
// }
//
// return this;
//
// }
// if (constant.equals(((AdvancedMatrixValue) other).constant)) {
//
// return this;
// }
// AdvancedMatrixValue newMatrix = new AdvancedMatrixValue(this.symbolic,
// new AdvancedMatrixValue(this.symbolic, this.classRef),this.shape.merge(((AdvancedMatrixValue) other)
// .getShape()),
// this.iscomplex.merge(((AdvancedMatrixValue) other)
// .getisComplexInfo()));
//
// System.out.println(newMatrix);
//
// return newMatrix;
if (Debug) System.out.println("inside BasicMatrixValue merge!");
if (!(other instanceof AdvancedMatrixValue))
throw new UnsupportedOperationException(
"can only merge a Basic Matrix Value with another Basic Matrix Value");
/**
* TODO, currently, we cannot merge two matrix value with different class
* information. i.e.
* if
* c='a';
* else
* c=12;
* end
* what we have at the merge point is a c=[(double,12.0,[1, 1]), (char,a,[1, 1])]
*/
else if (!other.getMatlabClass().equals(this.getMatlabClass()))
throw new UnsupportedOperationException(
"only Values with the same class can be merged, trying to merge :"
+ this + ", " + other + " has failed");
else if (this.constant!=null&&((AdvancedMatrixValue)other).getConstant()!=null) {
Constant result = this.constant.merge(((AdvancedMatrixValue)other).getConstant());
if (result!=null) return factory.newMatrixValue(this.getSymbolic(), result);
}
AdvancedMatrixValue newMatrix = factory.newMatrixValueFromClassShapeRange(
getSymbolic()
, getMatlabClass()
, null
, null
, null);
if (hasShape()) {
newMatrix.shape = shape.merge(((AdvancedMatrixValue)other).getShape());
}
if (hasRangeValue()) {
newMatrix.rangeValue = rangeValue.merge(((AdvancedMatrixValue)other).getRangeValue());
}
if (hasisComplexInfo()) {
if (((AdvancedMatrixValue)other).getisComplexInfo() != null) {
newMatrix.iscomplex = iscomplex.merge(((AdvancedMatrixValue)other).getisComplexInfo());
}
}
return newMatrix;
}
private boolean hasShape() {
// TODO Auto-generated method stub
return shape !=null;
}
public boolean hasRangeValue() {
return rangeValue != null;
}
public boolean hasisComplexInfo() {
return iscomplex != null;
}
@Override
public boolean equals(Object obj) {
// if (obj == null)
// return false;
// if (!(obj instanceof AdvancedMatrixValue))
// return false;
// AdvancedMatrixValue m = (AdvancedMatrixValue) obj;
// if (isConstant())
// return constant.equals(m.constant);
// if (Debug)
// System.out.println(m.getMatlabClass());
//
// if ((shape == null)
// && (((HasShape) ((AdvancedMatrixValue) obj)).getShape() == null)) {
// return (classRef.equals(m.getMatlabClass())) && true;
// }
// boolean bs = (classRef.equals(m.getMatlabClass()) && shape
// .equals(((HasShape) ((AdvancedMatrixValue) obj)).getShape()));
//
// // TODO NOW - complex part
//
// if ((iscomplex == null)
// && (((HasisComplexInfo) ((AdvancedMatrixValue) obj))
// .getisComplexInfo() == null)) {
// return (classRef.equals(m.getMatlabClass())) && true;
// }
// return ((classRef.equals(m.getMatlabClass()) && iscomplex
// .equals(((HasisComplexInfo) ((AdvancedMatrixValue) obj))
// .getisComplexInfo())) && bs);
if (obj == null) {
return false;
}
else if (obj instanceof AdvancedMatrixValue) {
if (Debug) System.out.println("inside check whether BasicMatrixValue equals!");
BasicMatrixValue o = (BasicMatrixValue)obj;
if (hasConstant()) {
return constant.equals(o.getConstant());
}
else {
boolean shapeResult, rangeResult, complexResult;
// test shape
if (shape == null) {
return o.getShape() == null;
}
else {
shapeResult = shape.equals(o.getShape());
}
// test range value
if (rangeValue == null) {
rangeResult = o.getRangeValue() == null;
}
else {
rangeResult = rangeValue.equals(o.getRangeValue());
}
// test complex
if (iscomplex == null) {
complexResult = o.getisComplexInfo() == null;
}
else {
complexResult = iscomplex.equals(o.getisComplexInfo());
}
return shapeResult && rangeResult && complexResult;
}
}
else {
return false;
}
}
@Override
public String toString() {
return "(" + (hasSymbolic()? (symbolic + ",") : "")
+ (hasMatlabClass()? classRef : ",[mclass propagation fails]")
+ (hasConstant()? ("," + constant) : "")
+ (hasShape()? ("," + shape) : ",[shape propagation fails]")
+ (hasRangeValue()? ("," + rangeValue) : "")
+ (hasisComplexInfo()? ("," + iscomplex) : "") + ")";
}
private boolean hasMatlabClass() {
// TODO Auto-generated method stub
return classRef != null;
}
private boolean hasSymbolic() {
// TODO Auto-generated method stub
return symbolic != null;
}
public static final AdvancedMatrixValueFactory FACTORY = new AdvancedMatrixValueFactory();
// static ShapePropagator<AggrValue<AdvancedMatrixValue>> shapePropagator = ShapePropagator
// .getInstance();
@Override
public ValueSet<AggrValue<AdvancedMatrixValue>> arraySubsref(
Args<AggrValue<AdvancedMatrixValue>> indizes) {
return ValueSet.<AggrValue<AdvancedMatrixValue>> newInstance(
factory.newMatrixValueFromClassShapeRange(
getSymbolic()
, getMatlabClass()
, shapePropagator.arraySubsref(shape, indizes)
, null
, iscomplex)
);
}
@Override
public ValueSet<AggrValue<AdvancedMatrixValue>> dotSubsref(String field) {
throw new UnsupportedOperationException("cannot dot-access a matrix");
// return
// ValueSet.newInstance(factory.newErrorValue("cannot dot-access a matrix"));
}
@Override
public Res<AggrValue<AdvancedMatrixValue>> cellSubsref(
Args<AggrValue<AdvancedMatrixValue>> indizes) {
throw new UnsupportedOperationException(); // TODO
}
@Override
public AggrValue<AdvancedMatrixValue> cellSubsasgn(
Args<AggrValue<AdvancedMatrixValue>> indizes,
Args<AggrValue<AdvancedMatrixValue>> values) {
throw new UnsupportedOperationException(); // TODO
}
@Override
public AggrValue<AdvancedMatrixValue> arraySubsasgn(
Args<AggrValue<AdvancedMatrixValue>> indizes,
AggrValue<AdvancedMatrixValue> value) {
return factory.newMatrixValueFromClassShapeRange(
getSymbolic()
, getMatlabClass()
, shapePropagator.arraySubsasgn(shape, indizes, value)
, null
, iscomplex);
}
@Override
public AggrValue<AdvancedMatrixValue> toFunctionArgument(boolean recursive) {
return this; // FIXME !!!!!
}
@Override
public AggrValue<AdvancedMatrixValue> dotSubsasgn(String field,
AggrValue<AdvancedMatrixValue> value) {
throw new UnsupportedOperationException(); // TODO
}
@Override
public Shape<AggrValue<AdvancedMatrixValue>> getShape() {
return this.shape;
}
@Override
public RangeValue<AggrValue<AdvancedMatrixValue>> getRangeValue() {
// TODO Auto-generated method stub
return this.rangeValue;
}
} | [
"sameer.jagdale@mail.mcgill.ca"
] | sameer.jagdale@mail.mcgill.ca |
4464d9bacf743465138c56f9a708afa3c1c93bb7 | 5122a4619b344c36bfc969283076c12419f198ea | /src/test/java/com/snapwiz/selenium/tests/staf/learningspaces/apphelper/AttemptDiagnosticQuestion.java | a13c1d7e5264ddf9605286dc87ef70f0a6fb051e | [] | no_license | mukesh89m/automation | 0c1e8ff4e38e8e371cc121e64aacc6dc91915d3a | a0b4c939204af946cf7ca7954097660b2a0dfa8d | refs/heads/master | 2020-05-18T15:30:22.681006 | 2018-06-09T15:14:11 | 2018-06-09T15:14:11 | 32,666,214 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,616 | java | package com.snapwiz.selenium.tests.staf.learningspaces.apphelper;
/*
* Created by Sumit on 9/25/2014.
*/
import com.snapwiz.selenium.tests.staf.framework.controller.Driver;
import com.snapwiz.selenium.tests.staf.framework.utility.WebDriverUtil;
import com.snapwiz.selenium.tests.staf.learningspaces.uihelper.Click;
import com.snapwiz.selenium.tests.staf.learningspaces.uihelper.UIElement;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import java.util.List;
public class AttemptDiagnosticQuestion extends Driver {
public void attemptTrueFalse(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex)
{
WebDriver driver=Driver.getWebDriver();
try
{
/*String corranswer= driver.findElement(By.id("show-debug-correct-answer-block")).getText();
char correctanswer=corranswer.charAt(17);
String correctchoice=Character.toString(correctanswer);*/
System.out.println("Attempting Truer false type");
String correctchoice = "A";
List<WebElement> answer = driver.findElements(By.className("true-false-student-answer-label"));
for (WebElement answerchoice : answer) {
if (answerchoice.getText().trim().equals(correctchoice)) {
((JavascriptExecutor) driver).executeScript("arguments[0].click();", answerchoice);
System.out.println("Attempted");
break;
}
}
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
}
catch (Exception e)
{
Assert.fail("Exception in apphelper attemptTrueFalse on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptMultipleChoice(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex)
{
WebDriver driver=Driver.getWebDriver();
try
{
/*String corranswer=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
char correctanswer=corranswer.charAt(17);
String correctchoice=Character.toString(correctanswer);*/
System.out.println("Attempting Multiple choice type");
String correctchoice = "A";
new UIElement().waitAndFindElement(By.xpath("//span[text() = 'A']"));
WebDriverUtil.clickOnElementUsingJavascript(driver.findElement(By.xpath("//span[text() = 'A']")));
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
}
catch (Exception e)
{
Assert.fail("Exception in apphelper attemptMultipleChoice on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptMultipleSelection(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex)
{
WebDriver driver=Driver.getWebDriver();
try{
/*String corranswer=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
char correctanswer;
if(corranswer.charAt(17) == '(')
correctanswer=corranswer.charAt(18);
else
correctanswer=corranswer.charAt(17);
String correctchoice=Character.toString(correctanswer);
String corranswer1=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
char correctanswer1=corranswer1.charAt(22);
String correctchoice1=Character.toString(correctanswer1);*/
System.out.println("Attempting Multiple selection");
String correctchoice = "A";
String correctchoice1 = "B";
List<WebElement> answer = driver.findElements(By.className("choice-value"));
for (WebElement answerchoice : answer) {
if (answerchoice.getText().trim().equals(correctchoice)) {
((JavascriptExecutor) driver).executeScript("arguments[0].click();", answerchoice);
System.out.println("Attempted 1st choice");
break;
}
}
List<WebElement> answer1 = driver.findElements(By.className("choice-value"));
for (WebElement answerchoice1 : answer1) {
if (answerchoice1.getText().trim().equals(correctchoice1)) {
((JavascriptExecutor) driver).executeScript("arguments[0].click();", answerchoice1);
System.out.println("Attempted 2nd choice");
break;
}
}
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
}
catch (Exception e)
{
Assert.fail("Exception in apphelper attemptMultipleSelection on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptTextEntry(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex)
{
WebDriver driver=Driver.getWebDriver();
try {
/*String corranswertext=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
int lastindex=corranswertext.length();
String corrcttextanswer=corranswertext.substring(16, lastindex);*/
System.out.println("Attempting text entry");
String corrcttextanswer = "answer";
driver.findElement(By.cssSelector("input[class='visible_redactor_input bg-color-white']")).sendKeys(corrcttextanswer);
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
}
catch (Exception e)
{
Assert.fail("Exception in apphelper attemptTextEntry on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptTextDropDown(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex)
{
WebDriver driver=Driver.getWebDriver();
try
{
/*String corranswertext=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
int lastindex=corranswertext.length();
String corrcttextanswer=corranswertext.substring(16, lastindex);*/
System.out.println("Attempting text dropdown");
String corrcttextanswer = "ghi";
//new Click().clickByclassname("question-raw-content-dropdown");
new Select(driver.findElement(By.className("question-raw-content-dropdown"))).selectByIndex(1);
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
}
catch (Exception e)
{
Assert.fail("Exception in apphelper attemptTextDropDown on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptNumericEntryWithUnits(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex)
{
WebDriver driver=Driver.getWebDriver();
try
{
/*String corranswertext=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
int lastindex=corranswertext.length();
String corrcttextanswer=corranswertext.substring(16, lastindex);*/
String corrcttextanswer = "10";
String correctUnit = "feet";
System.out.println("Attempting numeric entry with units");
driver.findElement(By.className("numeric_entry_student_input")).sendKeys(corrcttextanswer);
Thread.sleep(2000);
new Select(driver.findElement(By.cssSelector("select[class='question-raw-content-dropdown numeric-unit-preview-selectbox']"))).selectByVisibleText(correctUnit);//select unit
//driver.findElement(By.linkText(correctUnit)).click();//select unit
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
}
catch (Exception e)
{
Assert.fail("Exception in apphelper attemptNumericEntryWithUnits on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptAdvancedNumeric(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex) {
try {
WebDriver driver=Driver.getWebDriver();
/*String corranswertext=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
int lastindex=corranswertext.length();
String corrcttextanswer=corranswertext.substring(16, lastindex);*/
System.out.println("Attempting Advanced Numeric");
String corrcttextanswer = "answer";
driver.findElement(By.cssSelector("input[class='visible_redactor_input bg-color-white']")).sendKeys(corrcttextanswer);
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
} catch (Exception e) {
Assert.fail("Exception in apphelper attemptAdvancedNumeric on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptExpressionEvaluator(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex) {
try {
WebDriver driver=Driver.getWebDriver();
/*String corranswertext=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
int lastindex=corranswertext.length();
String corrcttextanswer=corranswertext.substring(16, lastindex);*/
System.out.println("Attempting Expression Evaluator");
String corrcttextanswer = "5";
new Click().clickByclassname("symb-notation-math-edit-icon-preview");//click on
new QuestionCreate().enterValueInMathMLEditor("Square root","5");
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
} catch (Exception e) {
Assert.fail("Exception in apphelper attemptExpressionEvaluator on class AttemptDiagnosticQuestion.", e);
}
}
public void attemptEssayType(String answerValue, boolean hint, boolean solution, String confidenceLevel, String dataIndex) {
try {
WebDriver driver=Driver.getWebDriver();
/*String corranswertext=driver.findElement(By.id("show-debug-correct-answer-block")).getText();
int lastindex=corranswertext.length();
String corrcttextanswer=corranswertext.substring(16, lastindex);*/
String corrcttextanswer = "5";
System.out.println("Attempting Essay type");
driver.findElement(By.id("html-editor-non-draggable")).click();
driver.findElement(By.id("html-editor-non-draggable")).sendKeys(corrcttextanswer);
String classAttribute=null;
int confidenselevelIndex=Integer.parseInt(confidenceLevel);
if(confidenceLevel != null && confidenselevelIndex>=1 && confidenselevelIndex<=4 )
{
if(confidenceLevel.equals("1"))
classAttribute="confidence-level-guess";
if(confidenceLevel.equals("2"))
classAttribute="confidence-level-somewhat";
if(confidenceLevel.equals("3"))
classAttribute="confidence-level-almost";
if(confidenceLevel.equals("4"))
classAttribute="confidence-level-i-know-it";
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath("//a[@id='"+confidenceLevel+"' and @class='"+classAttribute+"']")));
}
} catch (Exception e) {
Assert.fail("Exception in apphelper attemptExpressionEvaluator on class AttemptDiagnosticQuestion.", e);
}
}
}
| [
"mukesh.mandal@github.com"
] | mukesh.mandal@github.com |
f16a0af5ab9ed62d50b2ebe507ba29c18b19460e | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/dbeaver/2017/12/DB2ConnectionPage.java | e24906db41a9bb33b5786c5065f78e00b783fcba | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 8,264 | java | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.db2.views;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.jkiss.dbeaver.ext.db2.Activator;
import org.jkiss.dbeaver.ext.db2.DB2Messages;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.ui.ICompositeDialogPage;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract;
import org.jkiss.dbeaver.ui.dialogs.connection.DriverPropertiesDialogPage;
import org.jkiss.utils.CommonUtils;
import java.util.Locale;
/**
* DB2ConnectionPage
*/
public class DB2ConnectionPage extends ConnectionPageAbstract implements ICompositeDialogPage {
private Text hostText;
private Text portText;
private Text dbText;
private Text usernameText;
private Text passwordText;
private static ImageDescriptor logoImage = Activator.getImageDescriptor("icons/db2_logo.png");
@Override
public void dispose()
{
super.dispose();
}
@Override
public void createControl(Composite composite)
{
//Composite group = new Composite(composite, SWT.NONE);
//group.setLayout(new GridLayout(1, true));
setImageDescriptor(logoImage);
Composite control = new Composite(composite, SWT.NONE);
control.setLayout(new GridLayout(1, false));
control.setLayoutData(new GridData(GridData.FILL_BOTH));
ModifyListener textListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e)
{
saveSettings(site.getActiveDataSource());
site.updateButtons();
}
};
{
Composite addrGroup = UIUtils.createControlGroup(control, "Database", 4, 0, 0);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
addrGroup.setLayoutData(gd);
Label hostLabel = UIUtils.createControlLabel(addrGroup, DB2Messages.dialog_connection_host);
hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hostText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
hostText.setLayoutData(gd);
hostText.addModifyListener(textListener);
Label portLabel = UIUtils.createControlLabel(addrGroup, DB2Messages.dialog_connection_port);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
portLabel.setLayoutData(gd);
portText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
gd.widthHint = 40;
portText.setLayoutData(gd);
portText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.getDefault()));
portText.addModifyListener(textListener);
Label dbLabel = UIUtils.createControlLabel(addrGroup, DB2Messages.dialog_connection_database);
dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
dbText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 3;
dbText.setLayoutData(gd);
dbText.addModifyListener(textListener);
}
{
Composite addrGroup = UIUtils.createControlGroup(control, "Security", 2, 0, 0);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
addrGroup.setLayoutData(gd);
Label usernameLabel = UIUtils.createControlLabel(addrGroup, DB2Messages.dialog_connection_user_name);
usernameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
usernameText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 200;
usernameText.setLayoutData(gd);
usernameText.addModifyListener(textListener);
Label passwordLabel = UIUtils.createControlLabel(addrGroup, DB2Messages.dialog_connection_password);
passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
passwordText = new Text(addrGroup, SWT.BORDER | SWT.PASSWORD);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 200;
passwordText.setLayoutData(gd);
passwordText.addModifyListener(textListener);
}
createDriverPanel(control);
setControl(control);
}
@Override
public boolean isComplete()
{
return hostText != null && portText != null &&
!CommonUtils.isEmpty(hostText.getText()) &&
!CommonUtils.isEmpty(portText.getText());
}
@Override
public void loadSettings()
{
super.loadSettings();
// Load values from new connection info
DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
if (hostText != null) {
hostText.setText(CommonUtils.notEmpty(connectionInfo.getHostName()));
}
if (portText != null) {
if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
portText.setText(String.valueOf(connectionInfo.getHostPort()));
} else if (site.getDriver().getDefaultPort() != null) {
portText.setText(site.getDriver().getDefaultPort());
} else {
portText.setText("");
}
}
if (dbText != null) {
dbText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName()));
}
if (usernameText != null) {
usernameText.setText(CommonUtils.notEmpty(connectionInfo.getUserName()));
}
if (passwordText != null) {
passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword()));
}
}
@Override
public void saveSettings(DBPDataSourceContainer dataSource)
{
DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
if (hostText != null) {
connectionInfo.setHostName(hostText.getText().trim());
}
if (portText != null) {
connectionInfo.setHostPort(portText.getText().trim());
}
if (dbText != null) {
connectionInfo.setDatabaseName(dbText.getText().trim());
}
if (usernameText != null) {
connectionInfo.setUserName(usernameText.getText().trim());
}
if (passwordText != null) {
connectionInfo.setUserPassword(passwordText.getText());
}
super.saveSettings(dataSource);
}
@Override
public IDialogPage[] getSubPages()
{
return new IDialogPage[]{
new DB2ConnectionTracePage(),
new DriverPropertiesDialogPage(this),
};
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
c87cd1982124b3825a56cedc1b6eadd56e2e8fbf | 1b86af3205f1b9285f647afe8fe7888416f47dc3 | /src/java/servlets/LoginServlet.java | c8e6cf348c0ee3c8b3ebc5f2c1443f350be7cb4d | [] | no_license | sauravsuthar/Week-10-Lab | c8043c72e343da8f624581e89af341b812c8bb3e | 45621b39a7f81c048b6c322f3b90ebc70753ffef | refs/heads/master | 2023-01-25T03:06:27.060021 | 2020-11-16T02:30:59 | 2020-11-16T02:30:59 | 313,171,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,530 | java | package servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import models.User;
import services.AccountService;
public class LoginServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
session.invalidate();
getServletContext().getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String email = request.getParameter("email");
String password = request.getParameter("password");
AccountService as = new AccountService();
User user = as.login(email, password);
if (user == null) {
getServletContext().getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
return;
}
HttpSession session = request.getSession();
session.setAttribute("email", email);
if (user.getRole().getRoleId() == 1) {
response.sendRedirect("admin");
} else {
response.sendRedirect("notes");
}
}
}
| [
"808735@SAIT222319.ACDM.DS.SAIT.CA"
] | 808735@SAIT222319.ACDM.DS.SAIT.CA |
a837b86f34116e911be921205e1e7f180a72840e | a7b72f8acf65d18bb012a35a2c8ce3570f30b34d | /point-node-java-runtime-core/src/main/java/com/github/iceant/point/core/utils/page/PageFunction.java | 647d3d4d3c16b3abeed6030e9ee19e9cd6fecc69 | [
"MIT"
] | permissive | iceant/point-node-java-runtime | a54b2802c9a0053eb2486f425853888ca615d6fc | 3b68a2c0887219949cc215e424251d7f74e5f647 | refs/heads/main | 2023-03-17T21:23:30.679005 | 2021-02-28T17:15:55 | 2021-02-28T17:15:55 | 341,573,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | package com.github.iceant.point.core.utils.page;
public interface PageFunction {
<T> Page<T> getPage(PageRequest pageRequest);
} | [
"pizer.chen@gmail.com"
] | pizer.chen@gmail.com |
0176d667130dedb37968470d33db421341e1eb5f | a464211147d0fd47d2be533a5f0ced0da88f75f9 | /EvoSuiteTests/evosuite_5/evosuite-tests/org/mozilla/javascript/IRFactory_ESTest.java | 996197e645c9034b12949e76b41cb86b136074b0 | [
"MIT"
] | permissive | LASER-UMASS/Swami | 63016a6eccf89e4e74ca0ab775e2ef2817b83330 | 5bdba2b06ccfad9d469f8122c2d39c45ef5b125f | refs/heads/master | 2022-05-19T12:22:10.166574 | 2022-05-12T13:59:18 | 2022-05-12T13:59:18 | 170,765,693 | 11 | 5 | NOASSERTION | 2022-05-12T13:59:19 | 2019-02-14T22:16:01 | HTML | UTF-8 | Java | false | false | 25,730 | java | /*
* This file was automatically generated by EvoSuite
* Thu Aug 02 21:47:43 GMT 2018
*/
package org.mozilla.javascript;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
import org.mozilla.javascript.CompilerEnvirons;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextFactory;
import org.mozilla.javascript.DefaultErrorReporter;
import org.mozilla.javascript.ErrorReporter;
import org.mozilla.javascript.IRFactory;
import org.mozilla.javascript.Node;
import org.mozilla.javascript.ast.ArrayComprehension;
import org.mozilla.javascript.ast.ArrayLiteral;
import org.mozilla.javascript.ast.Assignment;
import org.mozilla.javascript.ast.AstRoot;
import org.mozilla.javascript.ast.BreakStatement;
import org.mozilla.javascript.ast.ConditionalExpression;
import org.mozilla.javascript.ast.ContinueStatement;
import org.mozilla.javascript.ast.DoLoop;
import org.mozilla.javascript.ast.ElementGet;
import org.mozilla.javascript.ast.EmptyExpression;
import org.mozilla.javascript.ast.ErrorNode;
import org.mozilla.javascript.ast.ForLoop;
import org.mozilla.javascript.ast.FunctionCall;
import org.mozilla.javascript.ast.FunctionNode;
import org.mozilla.javascript.ast.GeneratorExpression;
import org.mozilla.javascript.ast.InfixExpression;
import org.mozilla.javascript.ast.LabeledStatement;
import org.mozilla.javascript.ast.LetNode;
import org.mozilla.javascript.ast.Name;
import org.mozilla.javascript.ast.NewExpression;
import org.mozilla.javascript.ast.NumberLiteral;
import org.mozilla.javascript.ast.ObjectLiteral;
import org.mozilla.javascript.ast.PropertyGet;
import org.mozilla.javascript.ast.ReturnStatement;
import org.mozilla.javascript.ast.StringLiteral;
import org.mozilla.javascript.ast.SwitchStatement;
import org.mozilla.javascript.ast.ThrowStatement;
import org.mozilla.javascript.ast.VariableDeclaration;
import org.mozilla.javascript.ast.WhileLoop;
import org.mozilla.javascript.ast.WithStatement;
import org.mozilla.javascript.ast.XmlElemRef;
import org.mozilla.javascript.ast.XmlLiteral;
import org.mozilla.javascript.ast.XmlPropRef;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class IRFactory_ESTest extends IRFactory_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
XmlPropRef xmlPropRef0 = new XmlPropRef(65536);
// Undeclared exception!
try {
iRFactory0.transform(xmlPropRef0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test01() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
ContinueStatement continueStatement0 = new ContinueStatement();
Node node0 = iRFactory0.transform(continueStatement0);
assertSame(node0, continueStatement0);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
XmlLiteral xmlLiteral0 = new XmlLiteral();
// Undeclared exception!
try {
iRFactory0.transform(xmlLiteral0);
fail("Expecting exception: IndexOutOfBoundsException");
} catch(IndexOutOfBoundsException e) {
//
// Index: 0, Size: 0
//
verifyException("java.util.ArrayList", e);
}
}
@Test(timeout = 4000)
public void test03() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, (ErrorReporter) null);
ErrorNode errorNode0 = new ErrorNode((-1178));
// Undeclared exception!
try {
iRFactory0.transform(errorNode0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Can't transform: -1
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test04() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
LetNode letNode0 = new LetNode(65536, (-2823));
// Undeclared exception!
try {
iRFactory0.transform(letNode0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.Parser", e);
}
}
@Test(timeout = 4000)
public void test05() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
LabeledStatement labeledStatement0 = new LabeledStatement();
// Undeclared exception!
try {
iRFactory0.transform(labeledStatement0);
fail("Expecting exception: IndexOutOfBoundsException");
} catch(IndexOutOfBoundsException e) {
//
// Index: 0, Size: 0
//
verifyException("java.util.ArrayList", e);
}
}
@Test(timeout = 4000)
public void test06() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ContextFactory contextFactory0 = new ContextFactory();
Context context0 = new Context(contextFactory0);
ErrorReporter errorReporter0 = context0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
VariableDeclaration variableDeclaration0 = new VariableDeclaration(65536);
VariableDeclaration variableDeclaration1 = (VariableDeclaration)iRFactory0.transform(variableDeclaration0);
assertTrue(variableDeclaration1.isVar());
}
@Test(timeout = 4000)
public void test07() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
InfixExpression infixExpression0 = new InfixExpression();
// Undeclared exception!
try {
iRFactory0.transform(infixExpression0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test08() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
ErrorReporter errorReporter0 = compilerEnvirons0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
Assignment assignment0 = new Assignment();
// Undeclared exception!
try {
iRFactory0.transform(assignment0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test09() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
WithStatement withStatement0 = new WithStatement();
// Undeclared exception!
try {
iRFactory0.transform(withStatement0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test10() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
WhileLoop whileLoop0 = new WhileLoop((-284), 0);
// Undeclared exception!
try {
iRFactory0.transform(whileLoop0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.Parser", e);
}
}
@Test(timeout = 4000)
public void test11() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
ThrowStatement throwStatement0 = new ThrowStatement(65536);
// Undeclared exception!
try {
iRFactory0.transform(throwStatement0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test12() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
DefaultErrorReporter defaultErrorReporter0 = DefaultErrorReporter.instance;
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, defaultErrorReporter0);
SwitchStatement switchStatement0 = new SwitchStatement(4501);
// Undeclared exception!
try {
iRFactory0.transform(switchStatement0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test13() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
DefaultErrorReporter defaultErrorReporter0 = DefaultErrorReporter.instance;
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, defaultErrorReporter0);
StringLiteral stringLiteral0 = new StringLiteral((-2469), 65536);
// Undeclared exception!
try {
iRFactory0.transform(stringLiteral0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.Decompiler", e);
}
}
@Test(timeout = 4000)
public void test14() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, (ErrorReporter) null);
ReturnStatement returnStatement0 = new ReturnStatement((-1178), 15);
Node node0 = iRFactory0.transform(returnStatement0);
assertEquals(4, node0.getType());
}
@Test(timeout = 4000)
public void test15() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ContextFactory contextFactory0 = ContextFactory.getGlobal();
Context context0 = contextFactory0.makeContext();
ErrorReporter errorReporter0 = context0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
ObjectLiteral objectLiteral0 = new ObjectLiteral(170);
Node node0 = iRFactory0.transform(objectLiteral0);
assertEquals(67, node0.getType());
}
@Test(timeout = 4000)
public void test16() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
NumberLiteral numberLiteral0 = new NumberLiteral();
Node node0 = iRFactory0.transform(numberLiteral0);
assertEquals(13, Node.INCRDECR_PROP);
}
@Test(timeout = 4000)
public void test17() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
IRFactory iRFactory1 = new IRFactory();
AstRoot astRoot0 = iRFactory1.parse("XML", "l#[.", 65536);
iRFactory0.transformTree(astRoot0);
assertEquals(0, astRoot0.getEncodedSourceStart());
assertEquals("\u0089'\u0003XMLS\u0001", astRoot0.getEncodedSource());
}
@Test(timeout = 4000)
public void test18() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
ConditionalExpression conditionalExpression0 = new ConditionalExpression();
// Undeclared exception!
try {
iRFactory0.transform(conditionalExpression0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test19() throws Throwable {
PropertyGet propertyGet0 = new PropertyGet();
IRFactory iRFactory0 = new IRFactory();
// Undeclared exception!
try {
iRFactory0.transform(propertyGet0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test20() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
ElementGet elementGet0 = new ElementGet();
// Undeclared exception!
try {
iRFactory0.transform(elementGet0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test21() throws Throwable {
GeneratorExpression generatorExpression0 = new GeneratorExpression();
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
// Undeclared exception!
try {
iRFactory0.transform(generatorExpression0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test22() throws Throwable {
IRFactory iRFactory0 = new IRFactory((CompilerEnvirons) null, (ErrorReporter) null);
NewExpression newExpression0 = new NewExpression(65536, 4431);
FunctionNode functionNode0 = new FunctionNode();
newExpression0.setTarget(functionNode0);
// Undeclared exception!
try {
iRFactory0.transform(newExpression0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test23() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ContextFactory contextFactory0 = ContextFactory.getGlobal();
ForLoop forLoop0 = new ForLoop(143);
Context context0 = contextFactory0.makeContext();
ErrorReporter errorReporter0 = context0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
// Undeclared exception!
try {
iRFactory0.transform(forLoop0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test24() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
DefaultErrorReporter defaultErrorReporter0 = DefaultErrorReporter.instance;
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, defaultErrorReporter0);
EmptyExpression emptyExpression0 = new EmptyExpression(65536, 65536);
EmptyExpression emptyExpression1 = (EmptyExpression)iRFactory0.transform(emptyExpression0);
assertEquals(65536, emptyExpression1.getPosition());
}
@Test(timeout = 4000)
public void test25() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ErrorReporter errorReporter0 = compilerEnvirons0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
DoLoop doLoop0 = new DoLoop(65536, 1041);
// Undeclared exception!
try {
iRFactory0.transform(doLoop0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.Parser", e);
}
}
@Test(timeout = 4000)
public void test26() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
FunctionCall functionCall0 = new FunctionCall();
// Undeclared exception!
try {
iRFactory0.transform(functionCall0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test27() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ErrorReporter errorReporter0 = DefaultErrorReporter.forEval((ErrorReporter) null);
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
BreakStatement breakStatement0 = new BreakStatement();
Node node0 = iRFactory0.transform(breakStatement0);
assertEquals(2, Node.LOCAL_PROP);
}
@Test(timeout = 4000)
public void test28() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
ErrorReporter errorReporter0 = DefaultErrorReporter.forEval((ErrorReporter) null);
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
ArrayLiteral arrayLiteral0 = new ArrayLiteral(65536, 4);
Node node0 = iRFactory0.transform(arrayLiteral0);
assertEquals(66, node0.getType());
}
@Test(timeout = 4000)
public void test29() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
ArrayComprehension arrayComprehension0 = new ArrayComprehension();
// Undeclared exception!
try {
iRFactory0.transform(arrayComprehension0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test30() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
ErrorReporter errorReporter0 = compilerEnvirons0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
XmlElemRef xmlElemRef0 = new XmlElemRef(0, (-959));
// Undeclared exception!
try {
iRFactory0.transform(xmlElemRef0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test31() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ContextFactory contextFactory0 = ContextFactory.getGlobal();
Context context0 = contextFactory0.makeContext();
ErrorReporter errorReporter0 = context0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
ObjectLiteral objectLiteral0 = new ObjectLiteral(170);
boolean boolean0 = iRFactory0.isDestructuring(objectLiteral0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test32() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
Name name0 = new Name(65536, "/|SmK[Jp<l/\"_/I");
FunctionNode functionNode0 = new FunctionNode(1646, name0);
Node node0 = iRFactory0.decompileFunctionHeader(functionNode0);
assertNull(node0);
}
@Test(timeout = 4000)
public void test33() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
ElementGet elementGet0 = new ElementGet(65536, 65536);
// Undeclared exception!
try {
iRFactory0.decompile(elementGet0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test34() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
ErrorReporter errorReporter0 = compilerEnvirons0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
NumberLiteral numberLiteral0 = (NumberLiteral)iRFactory0.createNumber(2);
iRFactory0.decompile(numberLiteral0);
assertEquals(0, Node.NON_SPECIALCALL);
}
@Test(timeout = 4000)
public void test35() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ErrorReporter errorReporter0 = compilerEnvirons0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory((CompilerEnvirons) null, errorReporter0);
ObjectLiteral objectLiteral0 = new ObjectLiteral(0, (-2580));
Name name0 = new Name();
PropertyGet propertyGet0 = new PropertyGet(objectLiteral0, name0, 353);
// Undeclared exception!
try {
iRFactory0.decompilePropertyGet(propertyGet0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.Decompiler", e);
}
}
@Test(timeout = 4000)
public void test36() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
ErrorReporter errorReporter0 = compilerEnvirons0.getErrorReporter();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, errorReporter0);
ArrayLiteral arrayLiteral0 = new ArrayLiteral(65536);
ElementGet elementGet0 = new ElementGet(arrayLiteral0, arrayLiteral0);
iRFactory0.decompileElementGet(elementGet0);
assertEquals(6, Node.TARGETBLOCK_PROP);
}
@Test(timeout = 4000)
public void test37() throws Throwable {
CompilerEnvirons compilerEnvirons0 = new CompilerEnvirons();
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0);
AstRoot astRoot0 = new AstRoot();
// Undeclared exception!
try {
iRFactory0.decompile(astRoot0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// FAILED ASSERTION: unexpected token: SCRIPT
//
verifyException("org.mozilla.javascript.Kit", e);
}
}
@Test(timeout = 4000)
public void test38() throws Throwable {
IRFactory iRFactory0 = new IRFactory();
PropertyGet propertyGet0 = new PropertyGet();
// Undeclared exception!
try {
iRFactory0.decompile(propertyGet0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.IRFactory", e);
}
}
@Test(timeout = 4000)
public void test39() throws Throwable {
CompilerEnvirons compilerEnvirons0 = CompilerEnvirons.ideEnvirons();
DefaultErrorReporter defaultErrorReporter0 = DefaultErrorReporter.instance;
IRFactory iRFactory0 = new IRFactory(compilerEnvirons0, defaultErrorReporter0);
Name name0 = new Name(44, 1);
ContinueStatement continueStatement0 = new ContinueStatement(65536, name0);
// Undeclared exception!
try {
iRFactory0.transform(continueStatement0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.mozilla.javascript.Decompiler", e);
}
}
}
| [
"mmotwani@cs.umass.edu"
] | mmotwani@cs.umass.edu |
1707f928ae3020c8f4313b432b9551f7b7baf429 | 1cff1518ae1229d40b2e1a6cfb73c2bc51fb7217 | /app/src/main/java/com/example/mymoviecatalogue/adapter/FavoriteTVShowAdapter.java | a7a019fa8dca1a8fb7f47ed984c9407790320e04 | [] | no_license | reyhandoank/movie-catalogue | c487b90d611b67d3c6564c8f007d1557bc4dcd16 | d4b5ce60436a0002885d5c216addd02ee74cb4cf | refs/heads/master | 2020-07-21T08:10:36.158235 | 2019-09-06T12:45:19 | 2019-09-06T12:45:19 | 206,791,893 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,016 | java | package com.example.mymoviecatalogue.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.example.mymoviecatalogue.BuildConfig;
import com.example.mymoviecatalogue.R;
import com.example.mymoviecatalogue.activity.DetailTVShowActivity;
import com.example.mymoviecatalogue.database.TvShowEntity;
import java.util.ArrayList;
public class FavoriteTVShowAdapter extends RecyclerView.Adapter<FavoriteTVShowAdapter.ViewHolder> {
private Context context;
public FavoriteTVShowAdapter(Context context) {
this.context = context;
}
private ArrayList<TvShowEntity> tvshows = new ArrayList<>();
public void setTvShows(ArrayList<TvShowEntity> tvshows) {
this.tvshows.clear();
this.tvshows.addAll(tvshows);
notifyDataSetChanged();
}
@NonNull
@Override
public FavoriteTVShowAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_movie, viewGroup, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull FavoriteTVShowAdapter.ViewHolder holder, int position) {
holder.itemView.setAnimation(AnimationUtils.loadAnimation(context, R.anim.item_animation));
holder.imgPoster.setAnimation(AnimationUtils.loadAnimation(context, R.anim.item_animation));
Glide.with(holder.itemView.getContext())
.load(BuildConfig.POSTER_URL + tvshows.get(position).getTvshowPoster())
.into(holder.imgPoster);
holder.tvTitle.setText(tvshows.get(position).getTvshowTitle());
holder.tvDate.setText(tvshows.get(position).getTvshowDate());
holder.tvRate.setText(tvshows.get(position).getTvshowRate());
holder.itemView.setOnClickListener(view -> {
Intent intent = new Intent(context, DetailTVShowActivity.class);
intent.putExtra(DetailTVShowActivity.EXTRA_TV_SHOW, tvshows.get(position).getTvshowId());
context.startActivity(intent);
});
}
@Override
public int getItemCount() {
return tvshows.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
ImageView imgPoster;
TextView tvTitle, tvDate, tvRate;
ViewHolder(@NonNull View itemView) {
super(itemView);
context = itemView.getContext();
imgPoster = itemView.findViewById(R.id.img_poster);
tvTitle = itemView.findViewById(R.id.tv_title);
tvDate = itemView.findViewById(R.id.tv_date);
tvRate = itemView.findViewById(R.id.tv_rate);
}
}
}
| [
"mreyhanraflyansyah@gmail.com"
] | mreyhanraflyansyah@gmail.com |
769043d6d1734c34df3e1c8d4f934427c296ddff | 6f53535d466f3d082f597808d21f33de7f547ead | /src/main/java/io/rocketbase/toggl/ui/MainUI.java | 2f65c44c96b8179cf7a01c752e1f29165f9c08de | [] | no_license | rocketbase-io/toggl-reporter | 8e60d2d6e86a0ca76942dafe81ac2cf4099f09b8 | 3f85cd798e6dcb7512ed593ef2ba09811ca28946 | refs/heads/master | 2020-05-20T17:10:43.542783 | 2018-01-25T12:03:52 | 2018-01-25T12:03:52 | 84,492,150 | 13 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,409 | java | package io.rocketbase.toggl.ui;
import com.vaadin.annotations.StyleSheet;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.Responsive;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;
import com.vaadin.ui.themes.ValoTheme;
import io.rocketbase.toggl.backend.config.TogglService;
import io.rocketbase.toggl.ui.component.MainScreen;
import org.vaadin.viritin.button.MButton;
import org.vaadin.viritin.fields.MTextField;
import org.vaadin.viritin.layouts.MVerticalLayout;
import org.vaadin.viritin.layouts.MWindow;
import javax.annotation.Resource;
/**
* Created by marten on 20.02.17.
*/
@SpringUI(path = "/app")
@StyleSheet("design.css")
public class MainUI extends UI {
@Resource
private MainScreen mainScreen;
@Resource
private TogglService togglService;
@Override
protected void init(VaadinRequest vaadinRequest) {
Responsive.makeResponsive(this);
setLocale(vaadinRequest.getLocale());
addStyleName(ValoTheme.UI_WITH_MENU);
if (!togglService.isApiTokenAvailable()) {
initTokenWizard();
} else {
setContent(mainScreen.initWithUi(this));
}
}
private void initTokenWizard() {
MTextField apiToken = new MTextField("Api-Token").withFullWidth();
MWindow configWindow = new MWindow("Configure API-Token")
.withWidth("50%")
.withModal(true)
.withResizable(false)
.withDraggable(false)
.withClosable(false)
.withCenter();
configWindow.setContent(new MVerticalLayout()
.add(apiToken, Alignment.MIDDLE_CENTER, 1)
.add(new MButton(FontAwesome.SAVE, "Save", e -> {
try {
togglService.updateToken(apiToken.getValue());
configWindow.close();
setContent(mainScreen.initWithUi(this));
} catch (Exception exp) {
Notification.show("invalid api-token", Notification.Type.ERROR_MESSAGE);
}
}), Alignment.MIDDLE_CENTER));
UI.getCurrent()
.addWindow(configWindow);
setContent(new MVerticalLayout());
}
}
| [
"marten@rocketbase.io"
] | marten@rocketbase.io |
ae6ac36859131826be9bb2642f0b6393d5a4f8e6 | 2d3b571fa141d420b61004f44a36300ce81c30d9 | /ProjetoHistoricoEscolar/src/DAO/DBConnection.java | db38cf4fead4d46984f82a0881f7c33310302560 | [] | no_license | hugolyra/projetoescolar | 20e71f8e742d5aa91550ae731f4c10368ff22f1f | 8de579481c2af9faf83a8ef241236e599f1ec680 | refs/heads/master | 2022-10-03T16:15:40.164030 | 2020-05-25T20:48:23 | 2020-05-25T20:48:23 | 266,874,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,236 | java | package DAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DBConnection {
private static final String URL_MYSQL = "jdbc:mysql://localhost/faculdade";
private static final String DRIVER_CLASS_MYSQL = "com.mysql.jdbc.Driver";
private static final String USER = "root";
private static final String PASS = "";
public static Connection getConnection() {
System.out.println("Conectando ao Banco de Dados");
try {
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection("jdbc:mysql://localhost/faculdade", "root", "");
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
return null;
}
public static void close(Connection conn, Statement stmt, ResultSet rs) {
try {
if (conn != null) {
conn.close();
}
if (stmt != null) {
stmt.close();
}
if (rs != null) {
rs.close();
}
}
catch (SQLException e) {
e.printStackTrace();
}
}
public static void createTables() {
Connection connection = DBConnection.getConnection();
PreparedStatement stmt = null;
String sql = "CREATE TABLE IF NOT EXISTS Aluno(Matricula INT UNSIGNED AUTO_INCREMENT Primary key,Nome VARCHAR(100) NOT NULL,CPF VARCHAR(15) NOT NULL,DT_Nascimento DATE NOT NULL,Sexo VARCHAR(10) NOT NULL );";
String sql2 = "CREATE TABLE IF NOT EXISTS Contato_Aluno(Email VARCHAR(100) NOT NULL,Telefone VARCHAR(25) NOT NULL,Matricula_Aluno INT UNSIGNED NOT NULL,FOREIGN KEY (Matricula_Aluno) REFERENCES Aluno(Matricula) ON DELETE CASCADE);";
String sql3 = "CREATE TABLE IF NOT EXISTS Notas(ID MEDIUMINT(7) ZEROFILL UNSIGNED AUTO_INCREMENT Primary Key,Primeira_Unidade DECIMAL(5,2),Segunda_Unidade DECIMAL(5,2),Nota_Final DECIMAL(5,2));";
String sql4 = "CREATE TABLE IF NOT EXISTS Professor(ID SMALLINT(5) ZEROFILL UNSIGNED AUTO_INCREMENT Primary Key,CPF VARCHAR(15) NOT NULL,Nome VARCHAR(100) NOT NULL);";
String sql5 = "CREATE TABLE IF NOT EXISTS Disciplina(ID SMALLINT(5) ZEROFILL UNSIGNED AUTO_INCREMENT Primary Key,Nome VARCHAR(100) NOT NULL,Semestre TINYINT UNSIGNED NOT NULL);";
String sql6 = "CREATE TABLE IF NOT EXISTS Curso(ID TINYINT(3) ZEROFILL UNSIGNED AUTO_INCREMENT Primary Key,Nome VARCHAR(100) NOT NULL);";
String sql7 = "CREATE TABLE IF NOT EXISTS Cursa(Qtd_Faltas TINYINT NOT NULL,Situacao_Aluno ENUM('Aprovado por M\u00e9dia', 'Aprovado', 'Reprovado por M\u00e9dia', 'Reprovado por Falta', 'Reprovado', 'Cursando'),Matricula_Aluno INT UNSIGNED NOT NULL,ID_Notas MEDIUMINT(7) ZEROFILL UNSIGNED NOT NULL,ID_Disciplina SMALLINT(3) ZEROFILL UNSIGNED NOT NULL,PRIMARY KEY (Matricula_Aluno, ID_Notas, ID_Disciplina),FOREIGN KEY (Matricula_Aluno) REFERENCES Aluno(Matricula) ON DELETE CASCADE,FOREIGN KEY (ID_Notas) REFERENCES Notas(ID) ON DELETE CASCADE, FOREIGN KEY (ID_Disciplina) REFERENCES Disciplina(ID));";
String sql8 = "CREATE TABLE IF NOT EXISTS Leciona(ID_Disciplina SMALLINT(5) ZEROFILL UNSIGNED NOT NULL, ID_Professor SMALLINT(5) ZEROFILL UNSIGNED NOT NULL,PRIMARY KEY (ID_Disciplina, ID_Professor),FOREIGN KEY (ID_Disciplina) REFERENCES Disciplina(ID) ON DELETE CASCADE,FOREIGN KEY (ID_Professor) REFERENCES Professor(ID) ON DELETE CASCADE);";
String sql9 = "CREATE TABLE IF NOT EXISTS Curso_Disciplina(ID_Curso TINYINT(3) ZEROFILL UNSIGNED NOT NULL,ID_Disciplina SMALLINT(5) ZEROFILL UNSIGNED NOT NULL,PRIMARY KEY (ID_Curso, ID_Disciplina),FOREIGN KEY (ID_Curso) REFERENCES Curso(ID) ON DELETE CASCADE,FOREIGN KEY (ID_Disciplina) REFERENCES Disciplina(ID) ON DELETE CASCADE);";
try {
try {
stmt = connection.prepareStatement(sql);
stmt.execute();
stmt = connection.prepareStatement(sql2);
stmt.execute();
stmt = connection.prepareStatement(sql3);
stmt.execute();
stmt = connection.prepareStatement(sql4);
stmt.execute();
stmt = connection.prepareStatement(sql5);
stmt.execute();
stmt = connection.prepareStatement(sql6);
stmt.execute();
stmt = connection.prepareStatement(sql7);
stmt.execute();
stmt = connection.prepareStatement(sql8);
stmt.execute();
stmt = connection.prepareStatement(sql9);
stmt.execute();
System.out.println("Tables created with success!");
}
catch (SQLException e) {
e.printStackTrace();
DBConnection.close(connection, stmt, null);
}
}
finally {
DBConnection.close(connection, stmt, null);
}
}
} | [
"Hugo@DESKTOP-80EBH4H"
] | Hugo@DESKTOP-80EBH4H |
d7b6bf34193af9a803f99b652bc16e2c7db9d3e5 | 28cf026572221c9b0d7650ae68d5894e4c77a859 | /client/src/test/java/io/split/engine/matchers/strings/ContainsAnyOfMatcherTest.java | c93ef4874fc176b90d7e389fcb49cd0d0a957296 | [
"Apache-2.0"
] | permissive | JoshRosen/split-java-client | 065261796d042550a18d4d6a295292947263e749 | 9e52864b0d43e90801f616593ccc88c9a5020ddd | refs/heads/master | 2021-01-25T09:14:38.322798 | 2017-06-08T23:19:18 | 2017-06-08T23:19:18 | 93,802,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,859 | java | package io.split.engine.matchers.strings;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/**
* Created by adilaijaz on 4/18/17.
*/
public class ContainsAnyOfMatcherTest {
@Test
public void works_for_sets() {
Set<String> set = new HashSet<>();
set.add("first");
set.add("second");
ContainsAnyOfMatcher matcher = new ContainsAnyOfMatcher(set);
works(matcher);
}
@Test
public void works_for_lists() {
List<String> list = new ArrayList<>();
list.add("first");
list.add("second");
ContainsAnyOfMatcher matcher = new ContainsAnyOfMatcher(list);
works(matcher);
}
private void works(ContainsAnyOfMatcher matcher) {
assertThat(matcher.match(null), is(false));
assertThat(matcher.match(""), is(false));
assertThat(matcher.match("foo"), is(false));
assertThat(matcher.match("firstsecond"), is(true));
assertThat(matcher.match("secondfirst"), is(true));
assertThat(matcher.match("firstthird"), is(true));
assertThat(matcher.match("first"), is(true));
assertThat(matcher.match("second"), is(true));
}
@Test
public void works_for_empty_paramter() {
List<String> list = new ArrayList<>();
ContainsAnyOfMatcher matcher = new ContainsAnyOfMatcher(list);
assertThat(matcher.match(null), is(false));
assertThat(matcher.match(""), is(false));
assertThat(matcher.match("foo"), is(false));
assertThat(matcher.match("firstsecond"), is(false));
assertThat(matcher.match("firt"), is(false));
assertThat(matcher.match("secondfirst"), is(false));
}
}
| [
"patricioe@gmail.com"
] | patricioe@gmail.com |
db1163d6d547bb0478967b121c14e88366253ebf | b04471b102b2285f0b8a94ce6e3dc88fc9c750af | /rest-assert-unit/src/test/java/com/github/mjeanroy/restassert/unit/api/cookie/core/AssertHasDomainTest.java | 8fb2a93b8d495d59a096b01f4365f9f9174ef971 | [] | no_license | mjeanroy/rest-assert | 795f59cbb2e1b6fac59408439a1fae5ee97d88d1 | b9ea9318c1907cc45a6afd42ac200b1ead97f000 | refs/heads/master | 2022-12-25T06:02:07.555504 | 2022-05-21T14:25:43 | 2022-05-21T14:25:43 | 128,626,910 | 0 | 0 | null | 2022-11-16T03:00:14 | 2018-04-08T09:58:49 | Java | UTF-8 | Java | false | false | 2,396 | java | /**
* The MIT License (MIT)
*
* Copyright (c) 2014-2021 Mickael Jeanroy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.github.mjeanroy.restassert.unit.api.cookie.core;
import com.github.mjeanroy.restassert.core.internal.data.Cookie;
import com.github.mjeanroy.restassert.tests.builders.CookieBuilder;
import static com.github.mjeanroy.restassert.unit.api.cookie.CookieAssert.assertHasDomain;
public class AssertHasDomainTest extends AbstractCoreCookieTest {
@Override
protected void run(Cookie actual) {
assertHasDomain(actual, success().getDomain());
}
@Override
protected void run(String message, Cookie actual) {
assertHasDomain(message, actual, success().getDomain());
}
@Override
protected Cookie success() {
return cookie("foo");
}
@Override
protected Cookie failure() {
String expectedDomain = success().getDomain();
String actualDomain = expectedDomain + "foo";
return cookie(actualDomain);
}
@Override
protected String pattern() {
return "Expecting cookie to have domain %s but was %s";
}
@Override
protected Object[] placeholders() {
String expectedDomain = success().getDomain();
String actualDomain = failure().getDomain();
return new Object[]{
expectedDomain,
actualDomain
};
}
private Cookie cookie(String domain) {
return new CookieBuilder().setDomain(domain).build();
}
}
| [
"mickael.jeanroy@gmail.com"
] | mickael.jeanroy@gmail.com |
6bc740a785e6b135afa5e85ced7905892ab255b7 | 3b6f0416c917c80581232d2469ec3dfde5dacd46 | /src/org/tomokiyo/pjs/client/PublicBookInfoLookupService.java | 77cd44c1ccaf06ec9cf25376aa5e1e4510c302cb | [] | no_license | hidekishima/pjsbookshelf | 4dfa6c0187d8f57e0a813ecfd375b940946d2453 | 1ef244d18499da7b960e15a5aae1f70f42f82a34 | refs/heads/master | 2020-03-26T11:03:40.801313 | 2019-06-10T15:01:57 | 2019-06-10T15:01:57 | 144,826,075 | 0 | 1 | null | 2019-06-10T15:01:58 | 2018-08-15T08:21:09 | Java | UTF-8 | Java | false | false | 518 | java | package org.tomokiyo.pjs.client;
import com.google.gwt.user.client.rpc.RemoteService;
/**
* Service for looking up public book DB for retrieving book title etc given ISBN.
*
* @author Takashi Tomokiyo (tomokiyo@gmail.com)
*/
public interface PublicBookInfoLookupService extends RemoteService {
/**
* Describe <code>lookupByISBN</code> method here.
*
* @param isbn a <code>String</code> value
* @return an <code>PublicBookInfo</code> value
*/
public PublicBookInfo lookupByISBN(String isbn);
}
| [
"hideki@duolingo.com"
] | hideki@duolingo.com |
b6bce275a30863ec45b71fe52bc8b7320e07874d | fecc94abb0bc1d1cdfcdeb48a031c24483969b80 | /src/_945使数组唯一的最小增量/Solution2.java | a041787a101a3e26c53cbd94132aa2e0dcb76374 | [] | no_license | Iron-xin/Leetcode | 86670c9bba8f3efa7125da0af607e9e01df9d189 | 64e359c90a90965ed131a0ab96d0063ffb2652b9 | refs/heads/master | 2022-12-09T04:08:53.443331 | 2020-09-02T08:48:32 | 2020-09-02T08:48:32 | 292,228,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,255 | java | package _945使数组唯一的最小增量;
public class Solution2 {
public int minIncrementForUnique(int[] A) {
// counter数组统计每个数字的个数。
if (A.length <= 1){
return 0;
}
int[] counter = new int[40001];
int max = -1;
for (int i=0;i<A.length;i++) {
counter[A[i]]++;
max = Math.max(max, A[i]);
}
// 遍历counter数组,若当前数字的个数cnt大于1个,则只留下1个,其他的cnt-1个后移
int count = 0;
for (int num = 0; num < max; num++) {
if (counter[num] > 1) {
//没位置只能留一个数,其他的数都要往下一个大一点的索引移动
int d = counter[num] - 1;
count += d;
counter[num + 1] += d;
}
}
// 最后, counter[max+1]里可能会有从counter[max]后移过来的,counter[max+1]里只留下1个,其它的d个后移。
// 设 max+1 = x,那么后面的d个数就是[x+1,x+2,x+3,...,x+d],
// 因此操作次数是[1,2,3,...,d],用求和公式求和。
int d = counter[max] - 1;
count += (1 + d) * d / 2;
return count;
}
}
| [
"497731829@qq.com"
] | 497731829@qq.com |
8a284fb0499bae1c6218e05f836c4d721b21346b | 303049acc9a1be04c7603ade78c321c74c7ce988 | /insight_android_core/Insight/src/main/java/kr/co/wisetracker/insight/lib/util/TinyDB.java | b0ac20327adf4aadee2cee68f73704a74bbd2b5a | [] | no_license | bluelucifer/bs_insight_android | 5ab53d8e112fb435a0247a6ea639d26f226163a6 | ce590aef55293ec18045d8bc094e655212ef1a89 | refs/heads/master | 2020-05-27T08:36:43.846856 | 2015-06-22T05:53:12 | 2015-06-22T05:53:12 | 24,228,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,190 | java | package kr.co.wisetracker.insight.lib.util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import kr.co.wisetracker.insight.lib.util.BSDebugger;
/**
* Created by mac on 2014. 9. 21..
*/
public class TinyDB {
Context mContext;
SharedPreferences preferences;
String DEFAULT_APP_IMAGEDATA_DIRECTORY;
File mFolder = null;
public static String lastImagePath = "";
public TinyDB(Context appContext, String dbName) {
mContext = appContext;
preferences = mContext.getSharedPreferences(dbName+".WiseTracker",Context.MODE_PRIVATE);
}
public Bitmap getImage(String path) {
Bitmap theGottenBitmap = null;
try {
theGottenBitmap = BitmapFactory.decodeFile(path);
} catch (Exception e) {
BSDebugger.log(e,this);
}
return theGottenBitmap;
}
/**
* Returns the String path of the last image that was saved with this Object
* <p>
*
*/
public String getSavedImagePath() {
return lastImagePath;
}
/**
* Returns the String path of the last image that was saved with this
* tnydbobj
* <p>
*
* @param String
* the theFolder - the folder path dir you want to save it to e.g
* "DropBox/WorkImages"
* @param String
* the theImageName - the name you want to assign to the image file e.g
* "MeAtlunch.png"
*
*/
public String putImagePNG(String theFolder, String theImageName,
Bitmap theBitmap) {
this.DEFAULT_APP_IMAGEDATA_DIRECTORY = theFolder;
String mFullPath = setupFolderPath(theImageName);
saveBitmapPNG(mFullPath, theBitmap);
lastImagePath = mFullPath;
return mFullPath;
}
public Boolean putImagePNGwithfullPath(String fullPath, Bitmap theBitmap){
return saveBitmapPNG(fullPath, theBitmap);
}
private String setupFolderPath(String imageName) {
File sdcard_path = Environment.getExternalStorageDirectory();
mFolder = new File(sdcard_path, DEFAULT_APP_IMAGEDATA_DIRECTORY);
if (!mFolder.exists()) {
if (!mFolder.mkdirs()) {
Log.e("While creatingsave path",
"Default Save Path Creation Error");
// Toast("Default Save Path Creation Error");
}
}
String savePath = mFolder.getPath() + '/' + imageName;
return savePath;
}
private boolean saveBitmapPNG(String strFileName, Bitmap bitmap) {
if (strFileName == null || bitmap == null)
return false;
boolean bSuccess1 = false;
boolean bSuccess2;
boolean bSuccess3;
File saveFile = new File(strFileName);
if (saveFile.exists()) {
if (!saveFile.delete())
return false;
}
try {
bSuccess1 = saveFile.createNewFile();
} catch (IOException e1) {
BSDebugger.log(e1,this);
}
OutputStream out = null;
try {
out = new FileOutputStream(saveFile);
bSuccess2 = bitmap.compress(CompressFormat.PNG, 100, out);
} catch (Exception e) {
BSDebugger.log(e,this);
bSuccess2 = false;
}
try {
if (out != null) {
out.flush();
out.close();
bSuccess3 = true;
} else
bSuccess3 = false;
} catch (IOException e) {
BSDebugger.log(e,this);
bSuccess3 = false;
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
BSDebugger.log(e,this);
}
}
}
return (bSuccess1 && bSuccess2 && bSuccess3);
}
public int getInt(String key) {
return preferences.getInt(key, 0);
}
public long getLong(String key) {
return preferences.getLong(key, 0l);
}
public String getString(String key) {
return preferences.getString(key, "");
}
public double getDouble(String key) {
String number = getString(key);
try {
double value = Double.parseDouble(number);
return value;
}
catch(NumberFormatException e)
{
return 0;
}
}
public void putInt(String key, int value) {
SharedPreferences.Editor editor = preferences.edit();
editor.putInt(key, value);
editor.apply();
}
public void putLong(String key, long value) {
SharedPreferences.Editor editor = preferences.edit();
editor.putLong(key, value);
editor.apply();
}
public void putDouble(String key, double value) {
putString(key, String.valueOf(value));
}
public void putString(String key, String value) {
SharedPreferences.Editor editor = preferences.edit();
editor.putString(key, value);
editor.apply();
}
public void putList(String key, ArrayList<String> marray) {
SharedPreferences.Editor editor = preferences.edit();
String[] mystringlist = marray.toArray(new String[marray.size()]);
// the comma like character used below is not a comma it is the SINGLE
// LOW-9 QUOTATION MARK unicode 201A and unicode 2017 they are used for
// seprating the items in the list
editor.putString(key, TextUtils.join("‚‗‚", mystringlist));
try{
editor.apply();
}catch(Exception ex){
editor.commit();
}
}
public ArrayList<String> getList(String key) {
// the comma like character used below is not a comma it is the SINGLE
// LOW-9 QUOTATION MARK unicode 201A and unicode 2017 they are used for
// seprating the items in the list
String[] mylist = TextUtils
.split(preferences.getString(key, ""), "‚‗‚");
ArrayList<String> gottenlist = new ArrayList<String>(
Arrays.asList(mylist));
return gottenlist;
}
public void putListInt(String key, ArrayList<Integer> marray,
Context context) {
SharedPreferences.Editor editor = preferences.edit();
Integer[] mystringlist = marray.toArray(new Integer[marray.size()]);
// the comma like character used below is not a comma it is the SINGLE
// LOW-9 QUOTATION MARK unicode 201A and unicode 2017 they are used for
// seprating the items in the list
editor.putString(key, TextUtils.join("‚‗‚", mystringlist));
editor.apply();
}
public ArrayList<Integer> getListInt(String key,
Context context) {
// the comma like character used below is not a comma it is the SINGLE
// LOW-9 QUOTATION MARK unicode 201A and unicode 2017 they are used for
// seprating the items in the list
String[] mylist = TextUtils
.split(preferences.getString(key, ""), "‚‗‚");
ArrayList<String> gottenlist = new ArrayList<String>(
Arrays.asList(mylist));
ArrayList<Integer> gottenlist2 = new ArrayList<Integer>();
for (int i = 0; i < gottenlist.size(); i++) {
gottenlist2.add(Integer.parseInt(gottenlist.get(i)));
}
return gottenlist2;
}
public void putListBoolean(String key, ArrayList<Boolean> marray){
ArrayList<String> origList = new ArrayList<String>();
for(Boolean b : marray){
if(b==true){
origList.add("true");
}else{
origList.add("false");
}
}
putList(key, origList);
}
public ArrayList<Boolean> getListBoolean(String key) {
ArrayList<String> origList = getList(key);
ArrayList<Boolean> mBools = new ArrayList<Boolean>();
for(String b : origList){
if(b.equals("true")){
mBools.add(true);
}else{
mBools.add(false);
}
}
return mBools;
}
public void putBoolean(String key, boolean value) {
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(key, value);
editor.apply();
}
public boolean getBoolean(String key) {
return preferences.getBoolean(key, false);
}
public void putFloat(String key, float value) {
SharedPreferences.Editor editor = preferences.edit();
editor.putFloat(key, value);
editor.apply();
}
public float getFloat(String key) {
return preferences.getFloat(key, 0f);
}
public void remove(String key) {
SharedPreferences.Editor editor = preferences.edit();
editor.remove(key);
editor.apply();
}
public Boolean deleteImage(String path){
File tobedeletedImage = new File(path);
Boolean isDeleted = tobedeletedImage.delete();
return isDeleted;
}
public void clear() {
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.apply();
}
public Map<String, ?> getAll() {
return preferences.getAll();
}
public void registerOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener) {
preferences.registerOnSharedPreferenceChangeListener(listener);
}
public void unregisterOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener) {
preferences.unregisterOnSharedPreferenceChangeListener(listener);
}
} | [
"jih7hc@gmail.com"
] | jih7hc@gmail.com |
b6647cbaf882f3d405b94561cb67687fdd079212 | d829740ea8cd9b536e19f74e92119a8275fe1a94 | /jOOQ/src/main/java/org/jooq/impl/CombinedCondition.java | 55c59bc966c71dc7f1dc8354190d05ecffb8cef3 | [
"Apache-2.0"
] | permissive | djstjr14/jOOQ | 6938ed75759e90a2af7fb4c3aa1fc4fe20345539 | 7e0f06f31c3131ea6190129a09b311e682205acd | refs/heads/master | 2021-04-15T18:09:17.552253 | 2018-06-10T12:26:12 | 2018-06-10T12:26:12 | 126,758,643 | 2 | 8 | null | 2018-06-11T00:00:02 | 2018-03-26T01:46:12 | Java | UTF-8 | Java | false | false | 5,372 | 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.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq.impl;
import static org.jooq.Clause.CONDITION;
import static org.jooq.Clause.CONDITION_AND;
import static org.jooq.Clause.CONDITION_OR;
import static org.jooq.Operator.AND;
import static org.jooq.impl.DSL.falseCondition;
import static org.jooq.impl.DSL.noCondition;
import static org.jooq.impl.DSL.trueCondition;
import static org.jooq.impl.Keywords.K_AND;
import static org.jooq.impl.Keywords.K_OR;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.jooq.Clause;
import org.jooq.Condition;
import org.jooq.Context;
import org.jooq.Keyword;
import org.jooq.Operator;
/**
* @author Lukas Eder
*/
final class CombinedCondition extends AbstractCondition {
private static final long serialVersionUID = -7373293246207052549L;
private static final Clause[] CLAUSES_AND = { CONDITION, CONDITION_AND };
private static final Clause[] CLAUSES_OR = { CONDITION, CONDITION_OR };
private final Operator operator;
private final List<Condition> conditions;
static Condition of(Operator operator, Condition left, Condition right) {
if (left instanceof NoCondition)
return right;
else if (right instanceof NoCondition)
return left;
else
return new CombinedCondition(operator, left, right);
}
static Condition of(Operator operator, Collection<? extends Condition> conditions) {
if (conditions.isEmpty())
return noCondition();
CombinedCondition result = null;
Condition first = null;
for (Condition condition : conditions)
if (!(condition instanceof NoCondition))
if (first == null)
first = condition;
else if (result == null)
(result = new CombinedCondition(operator, conditions.size()))
.add(operator, first)
.add(operator, condition);
else
result.add(operator, condition);
if (result != null)
return result;
else if (first != null)
return first;
else
return noCondition();
}
private CombinedCondition(Operator operator, int size) {
if (operator == null)
throw new IllegalArgumentException("The argument 'operator' must not be null");
this.operator = operator;
this.conditions = new ArrayList<Condition>(size);
}
private CombinedCondition(Operator operator, Condition left, Condition right) {
this(operator, 2);
add(operator, left);
add(operator, right);
}
private final CombinedCondition add(Operator op, Condition condition) {
if (condition instanceof CombinedCondition) {
CombinedCondition combinedCondition = (CombinedCondition) condition;
if (combinedCondition.operator == op)
this.conditions.addAll(combinedCondition.conditions);
else
this.conditions.add(condition);
}
else if (condition == null)
throw new IllegalArgumentException("The argument 'conditions' must not contain null");
else
this.conditions.add(condition);
return this;
}
@Override
public final Clause[] clauses(Context<?> ctx) {
return operator == AND ? CLAUSES_AND : CLAUSES_OR;
}
@Override
public final void accept(Context<?> ctx) {
if (conditions.isEmpty()) {
if (operator == AND)
ctx.visit(trueCondition());
else
ctx.visit(falseCondition());
}
else if (conditions.size() == 1) {
ctx.visit(conditions.get(0));
}
else {
ctx.sql('(')
.formatIndentStart()
.formatNewLine();
Keyword op = operator == AND ? K_AND : K_OR;
Keyword separator = null;
for (int i = 0; i < conditions.size(); i++) {
if (i > 0)
ctx.formatSeparator();
if (separator != null)
ctx.visit(separator).sql(' ');
ctx.visit(conditions.get(i));
separator = op;
}
ctx.formatIndentEnd()
.formatNewLine()
.sql(')');
}
}
}
| [
"lukas.eder@gmail.com"
] | lukas.eder@gmail.com |
24103a3a6be6881864166d590311b1ce79d02049 | 8cfb692a40653e390b9d385cd2eda1efb2c2d17a | /06-JPA-DesignPatterns/src/br/com/fiap/jpa/dao/ProfissaoDAO.java | 16072e0e70332cce2957b4dce4ecb52ce717d0c7 | [] | no_license | bananiitas/2TDSG | 4423e5b1e9ebac53c241cf16922e339070fda970 | 29fa1a1c84aee510076949be4c6eda148a73c2f4 | refs/heads/master | 2022-04-16T22:06:20.525142 | 2020-04-14T12:34:21 | 2020-04-14T12:34:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 145 | java | package br.com.fiap.jpa.dao;
import br.com.fiap.jpa.entity.Profissao;
public interface ProfissaoDAO extends GenericDAO<Profissao, Integer> {
} | [
"profthiagoy@fiap.com.br"
] | profthiagoy@fiap.com.br |
4f532edc12b6a399323ee1f778cd2603e36a91da | c7b6d47745a3d3b7edd6248d2b2bcbb6b19239c1 | /src/matcher/StringMatcher.java | a4bc075a846da9f77b1eeace750b25b94d633f69 | [] | no_license | jiadong324/Mako | 02e638d4c353f7c62171a40e61587620f93629f6 | 9c0433e97801cec5e2575155746ad3327b4026b4 | refs/heads/master | 2021-07-09T03:01:39.862121 | 2021-03-03T05:43:14 | 2021-03-03T05:43:14 | 232,294,992 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,888 | 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 matcher;
import fspm.PseudoSuperItem;
import structures.Node;
import structures.SequenceDatabase;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;
import java.util.Map.Entry;
import utils.Candidate;
/**
* This is a class for scoring the string matching status based on k-mer.
* @author jiadonglin
*/
public class StringMatcher {
// Cross match used variables
Map<String, List<char[]>> stringsDB;
sharedString forwardSharedStrings;
sharedString reverseSharedStrings;
// Local alignment used variables
String maxForStrMatch;
String maxRevStrMatch;
int[] maxMatchAtRef = new int[]{-1,-1};
int[] maxMatchAtRead = new int[]{-1,-1,-1,-1};
char[] baseMap;
final int protecStrLength = 10;
final int maxMisMatch = 1;
boolean isPlusMatch = false;
boolean isMinusMatch = false;
AlignInfo plusAlignInfo;
AlignInfo minusAlignInfo;
public StringMatcher(){
baseMap = new char[256];
baseMap[(int)'A'] = 'T';
baseMap[(int)'T'] = 'A';
baseMap[(int)'C'] = 'G';
baseMap[(int)'G'] = 'C';
}
public void doStringAlign(List<String> readStrs, List<PseudoSuperItem> superitems, int refRegionLeft, String refStr, List<Candidate> alignedInfos, SequenceDatabase database){
for (int i = 0; i < readStrs.size(); i++){
String curRead = readStrs.get(i);
alignStrToRef(curRead, refStr);
if (maxMatchAtRef[0] != -1 && maxMatchAtRef[1] != -1){
if (maxMatchAtRead[1] + maxMatchAtRead[3] + 2 >= curRead.length()){
// AlignInfo -> [startPosAtRef, endPosAtRef, supSuperItemIdx]
int[] adjustedBpAtRead = bpAdjust(maxMatchAtRead[0], maxMatchAtRead[1],maxMatchAtRead[2],maxMatchAtRead[3], curRead.length());
// System.out.println(adjustedBpAtRead[0] + " " + adjustedBpAtRead[1]);
int newLeftBpAtRef;
int newRightBpAtRef;
// left Bp coords adjust
if (adjustedBpAtRead[0] < maxMatchAtRead[1]){
newLeftBpAtRef = maxMatchAtRef[0] - (maxMatchAtRead[1] - adjustedBpAtRead[0]);
}else{
newLeftBpAtRef = maxMatchAtRef[0] + (adjustedBpAtRead[0] - maxMatchAtRead[1]);
}
// right bp coords adjust
if (adjustedBpAtRead[1] < maxMatchAtRead[3]){
newRightBpAtRef = maxMatchAtRef[1] + (maxMatchAtRead[3] - adjustedBpAtRead[1]);
}else{
newRightBpAtRef = maxMatchAtRef[1] - (adjustedBpAtRead[1] - maxMatchAtRead[3]);
}
Node superitem = superitems.get(i).getSuperItem(database);
if (newLeftBpAtRef > newRightBpAtRef){
continue;
}
if (superitem.getWeight() < 5 || superitem.getNumMinusRead() < 1 || superitem.getNumPlusRead() < 1){
continue;
}
// svOutInfo curSV = new svOutInfo(refRegionLeft + newLeftBpAtRef, refRegionLeft + newRightBpAtRef, 10,
// superitem.getWeight(), superitem.getRatio(), superitem.getNumPlusRead(), superitem.getNumMinusRead());
// if (!alignedInfos.isEmpty()){
// boolean exist = false;
// for (svOutInfo preSV : alignedInfos){
// if (curSV.identicalSV(preSV)){
// exist = true;
// }
// }
// if (!exist){
// alignedInfos.add(curSV);
// }
// }else{
// alignedInfos.add(curSV);
// }
}
}
}
}
private String createRepeatStr(){
return new String(new char[protecStrLength]).replace("\0", "N");
}
public void alignStrToRef(String readStr, String refStr){
// int[] alignedPos = new int[]{-1,-1,-1,-1};
plusAlignInfo = new AlignInfo();
minusAlignInfo = new AlignInfo();
// SMS superitem does not save read string yet
if (("").equals(readStr)){
return;
}
// add "N" to ref at prefix and suffix
String protectStr = createRepeatStr();
StringBuilder sb = new StringBuilder(protectStr);
sb.append(refStr);
sb.append(protectStr);
char[] refArray = sb.toString().toCharArray();
// Align read from left to right
// System.out.println(sb.toString());
char[] readArray = readStr.toCharArray();
List<List<Integer>> baseMatchBothStrandAtRef = new ArrayList<>(maxMisMatch + 2);
findBaseAtRef(refArray, readArray[0], baseMatchBothStrandAtRef);
String plusPrefix = Character.toString(readArray[0]);
String minusPrefix = Character.toString(baseMap[(int)readArray[0]]);
expandMatchApprox(plusPrefix, minusPrefix, baseMatchBothStrandAtRef, baseMatchBothStrandAtRef, 1,
readArray, refArray, true);
// Align read from right to left
sb = new StringBuilder(readStr);
sb.reverse();
char[] readRevArray = sb.toString().toCharArray();
baseMatchBothStrandAtRef.clear();
findBaseAtRef(refArray, readRevArray[0], baseMatchBothStrandAtRef);
plusPrefix = Character.toString(readRevArray[0]);
minusPrefix = Character.toString(baseMap[(int)readRevArray[0]]);
expandMatchApprox(plusPrefix, minusPrefix, baseMatchBothStrandAtRef, baseMatchBothStrandAtRef, 1,
readRevArray, refArray, false);
// Matched string length >= 30bp
if (plusAlignInfo.getReadForMaxMatchLength() >= 30 || minusAlignInfo.getReadForMaxMatchLength() >= 30){
if (plusAlignInfo.getReadForMaxMatchLength() > minusAlignInfo.getReadForMaxMatchLength()){
maxMatchAtRef = plusAlignInfo.getMaxMatchIdxAtRef();
maxMatchAtRead = plusAlignInfo.getMaxMatchIdxAtRead();
isPlusMatch = true;
}
else{
maxMatchAtRef = minusAlignInfo.getMaxMatchIdxAtRef();
maxMatchAtRead = minusAlignInfo.getMaxMatchIdxAtRead();
isMinusMatch = true;
}
}
}
private void expandMatchApprox(String plusPrefix, String minusPrefix, List<List<Integer>> plusPosList, List<List<Integer>> minusPosList,
int baseAtReadIdx, char[] readArray, char[] refArray, boolean readForwardAlign){
if (baseAtReadIdx >= readArray.length){
return;
}
if (plusPosList.get(0).isEmpty() && plusPosList.get(1).isEmpty() && minusPosList.get(0).isEmpty() && minusPosList.get(1).isEmpty()){
return;
}
char baseAtRead = readArray[baseAtReadIdx];
char comBaseAtRead = baseMap[(int)readArray[baseAtReadIdx]];
List<List<Integer>> newPlusPosList = new ArrayList<>();
List<List<Integer>> newMinusPosList = new ArrayList<>();
for (int i = 0; i < plusPosList.size(); i++){
newPlusPosList.add(new ArrayList<>(plusPosList.get(i).size()));
newMinusPosList.add(new ArrayList<>(minusPosList.get(i).size()));
}
// plus strand alignment
for (int i = 0; i < plusPosList.size(); i++){
if (readForwardAlign) {
for (Integer idx : plusPosList.get(i)){
if (refArray[idx + 1] == baseAtRead){
newPlusPosList.get(i).add(idx + 1);
}else{
switch (i){
case 0:
newPlusPosList.get(1).add(idx + 1);
break;
case 1:
newPlusPosList.get(2).add(idx + 1);
break;
}
}
}
}else{
for (Integer idx : plusPosList.get(i)){
if (refArray[idx - 1] == baseAtRead){
newPlusPosList.get(i).add(idx - 1);
}else{
switch (i){
case 0:
newPlusPosList.get(1).add(idx - 1);
break;
case 1:
newPlusPosList.get(2).add(idx - 1);
break;
}
}
}
}
}
// minus strand alignment
for (int i = 0; i < minusPosList.size(); i ++){
if (readForwardAlign){
for (Integer idx : minusPosList.get(i)){
if (baseMap[(int)refArray[idx - 1]] == comBaseAtRead){
newMinusPosList.get(i).add(idx - 1);
}else{
switch (i){
case 0:
newMinusPosList.get(1).add(idx - 1);
break;
case 1:
newMinusPosList.get(2).add(idx - 1);
break;
}
}
}
}else{
for (Integer idx : minusPosList.get(i)){
if (baseMap[(int)refArray[idx + 1]] == comBaseAtRead){
newMinusPosList.get(i).add(idx + 1);
}else{
switch (i){
case 0:
newMinusPosList.get(1).add(idx + 1);
break;
case 1:
newMinusPosList.get(2).add(idx + 1);
break;
}
}
}
}
}
int levelZeroPlusMatch = newPlusPosList.get(0).size();
int levelOnePlusMatch = newPlusPosList.get(1).size();
// int levelTwoPlusMatch = newPlusPosList.get(2).size();
boolean plusAbleToExtend = levelZeroPlusMatch + levelOnePlusMatch > 0 ? true : false;
int levelZeroMinusMatch = newMinusPosList.get(0).size();
int levelOneMinusMatch = newMinusPosList.get(1).size();
// int levelTwoMinusMatch = newMinusPosList.get(2).size();
boolean minusAbleToExtend = levelZeroMinusMatch + levelOneMinusMatch > 0 ? true : false;
if (plusAbleToExtend && minusAbleToExtend){
plusAlignInfo.updateMatchInfoAtRead(plusPosList, newPlusPosList, baseAtReadIdx, readForwardAlign);
minusAlignInfo.updateMatchInfoAtRead(minusPosList, newMinusPosList, baseAtReadIdx, readForwardAlign);
plusAlignInfo.updateMaxMatchedStrInfo(plusPrefix + baseAtRead, newPlusPosList, baseAtReadIdx, readForwardAlign);
minusAlignInfo.updateMaxMatchedStrInfo(minusPrefix + comBaseAtRead, newMinusPosList, baseAtReadIdx, readForwardAlign);
expandMatchApprox(plusPrefix + baseAtRead, minusPrefix + comBaseAtRead, newPlusPosList, newMinusPosList,
baseAtReadIdx + 1, readArray, refArray, readForwardAlign);
}
else if (plusAbleToExtend && !minusAbleToExtend){
plusAlignInfo.updateMatchInfoAtRead(plusPosList, newPlusPosList, baseAtReadIdx, readForwardAlign);
plusAlignInfo.updateMaxMatchedStrInfo(plusPrefix + baseAtRead, newPlusPosList, baseAtReadIdx, readForwardAlign);
minusAlignInfo.updateMaxMatchedStrInfo(minusPrefix, minusPosList, baseAtReadIdx, readForwardAlign);
expandMatchApprox(plusPrefix + baseAtRead, minusPrefix, newPlusPosList, minusPosList, baseAtReadIdx + 1,
readArray, refArray, readForwardAlign);
}
else if (!plusAbleToExtend && minusAbleToExtend){
minusAlignInfo.updateMatchInfoAtRead(minusPosList, newMinusPosList, baseAtReadIdx, readForwardAlign);
plusAlignInfo.updateMaxMatchedStrInfo(plusPrefix, plusPosList, baseAtRead, readForwardAlign);
minusAlignInfo.updateMaxMatchedStrInfo(minusPrefix + comBaseAtRead, newMinusPosList, baseAtReadIdx, readForwardAlign);
expandMatchApprox(plusPrefix, minusPrefix + comBaseAtRead, plusPosList, newMinusPosList, baseAtReadIdx + 1,
readArray, refArray, readForwardAlign);
}
else{
expandMatchApprox(plusPrefix, minusPrefix, newPlusPosList, newMinusPosList, baseAtReadIdx + 1,
readArray, refArray, readForwardAlign);
}
}
private int[] bpAdjust(int forMin, int forMax, int revMin, int revMax, int readLen){
int[] bpPos = new int[]{forMax, revMax};
// read reverse align is longer than forward align
boolean isFound = false;
for (int i = forMin;i<=forMax;i++){
for (int j = revMax;j>=revMin;j--){
if (i + j == readLen){
bpPos[0] = i;
bpPos[1] = j;
isFound = true;
break;
}
}
if (isFound){
break;
}
}
return bpPos;
}
// private int bpLeftShift(int leftPosAtRef, int rightPosAtRef, String refStr){
// int shiftedLeft = leftPosAtRef;
// return shiftedLeft;
// }
private void findBaseAtRef(char[] refArray, char base, List<List<Integer>> baseMatchPos){
int len = refArray.length;
for (int i = 0; i < maxMisMatch + 2; i++){
baseMatchPos.add(new ArrayList<>());
}
for (int i = 0; i < len; i++){
if (refArray[i] == base){
baseMatchPos.get(0).add(i);
}
}
}
public void strCrossMatch(List<String> mStrings, List<String> sForwardStrings, List<String> sReverseStrings){
ReadStringDB mDB = new ReadStringDB(mStrings, "M");
ReadStringDB sForwardDB = new ReadStringDB(sForwardStrings, "SF");
ReadStringDB sReverseDB = new ReadStringDB(sReverseStrings, "SR");
stringsDB = new HashMap<>();
stringsDB.put("M", mDB.sequences);
stringsDB.put("SF", sForwardDB.sequences);
stringsDB.put("SR", sReverseDB.sequences);
List<StringIdentity> initialStringIds = new ArrayList<>();
for (Entry<String, List<char[]>> entry : stringsDB.entrySet()){
List<char[]> seqList = entry.getValue();
for (int i = 0; i < seqList.size(); i++){
initialStringIds.add(new StringIdentity(i, entry.getKey()));
}
}
List<PseudoRead> initialProjectDB = mDB.pseduoDB;
initialProjectDB.addAll(sForwardDB.pseduoDB);
initialProjectDB.addAll(sReverseDB.pseduoDB);
char initialPrefix[] = new char[]{'A','T','C','G'};
for (char prefix : initialPrefix){
String base = Character.toString(prefix);
List<PseudoRead> projectedDB = buildProjectedDB(base, initialProjectDB);
depthFirstSearch(base, projectedDB, true, true, initialStringIds);
}
}
private void depthFirstSearch(String prefix, List<PseudoRead> database, boolean isForward, boolean isBoth, List<StringIdentity> strList){
BaseMatchInfo commonCharInfo = mostCommonCharInProjectDB(database);
char sharedBase = commonCharInfo.base;
isForward &= commonCharInfo.isForward;
isBoth &= commonCharInfo.isBoth;
if (sharedBase != 'N'){
String newPrefix = prefix + sharedBase;
List<PseudoRead> projectDB = buildProjectedDB(newPrefix, database);
strList = commonCharInfo.baseStringIdentitys;
depthFirstSearch(newPrefix, projectDB, commonCharInfo.isForward, commonCharInfo.isBoth, strList);
}else{
saveString(isForward, isBoth, prefix, strList);
}
}
private List<PseudoRead> buildProjectedDB(String growthStr, List<PseudoRead> pseudoDB){
List<PseudoRead> newProjectDB = new ArrayList<>();
if (growthStr.length() == 1){
for (PseudoRead psRead : pseudoDB){
char[] oriSequence = stringsDB.get(psRead.dbId).get(psRead.seqId);
for (int i = 0; i < oriSequence.length; i++){
int idxOfItemInSeq = psRead.indexOf(growthStr, oriSequence, i);
if (idxOfItemInSeq != -1 && idxOfItemInSeq != psRead.seqSize - 1){
newProjectDB.add(new PseudoRead(psRead, idxOfItemInSeq + 1));
}
}
}
}else{
char lastChar = growthStr.charAt(growthStr.length() - 1);
String base = Character.toString(lastChar);
for (PseudoRead psRead : pseudoDB){
char[] oriSequence = stringsDB.get(psRead.dbId).get(psRead.seqId);
int idxOfItemInSeq = psRead.indexOf(base, oriSequence, psRead.firstBaseId);
if (idxOfItemInSeq != -1 && idxOfItemInSeq != oriSequence.length - 1){
newProjectDB.add(new PseudoRead(psRead, 1));
}
}
}
return newProjectDB;
}
private BaseMatchInfo mostCommonCharInProjectDB(List<PseudoRead> projectedDB){
int[] aCount = new int[3];
int[] tCount = new int[3];
int[] cCount = new int[3];
int[] gCount = new int[3];
List<StringIdentity> aAppearList = new ArrayList<>();
List<StringIdentity> tAppearList = new ArrayList<>();
List<StringIdentity> cAppearList = new ArrayList<>();
List<StringIdentity> gAppearList = new ArrayList<>();
for (PseudoRead pseudo : projectedDB){
char ch = pseudo.getBase(pseudo, stringsDB);
String dbId = pseudo.dbId;
if (dbId.equals("M")){
switch(ch){
case 'A':
aCount[0] += 1;
aAppearList.add(new StringIdentity(pseudo.seqId, "M"));
break;
case 'T':
tCount[0] += 1;
tAppearList.add(new StringIdentity(pseudo.seqId, "M"));
break;
case 'C':
cCount[0] += 1;
cAppearList.add(new StringIdentity(pseudo.seqId, "M"));
break;
case 'G':
gCount[0] += 1;
gAppearList.add(new StringIdentity(pseudo.seqId, "M"));
}
}
if (dbId.equals("SF")){
switch(ch){
case 'A':
aCount[1] += 1;
aAppearList.add(new StringIdentity(pseudo.seqId, "SF"));
break;
case 'T':
tCount[1] += 1;
tAppearList.add(new StringIdentity(pseudo.seqId, "SF"));
break;
case 'C':
cCount[1] += 1;
cAppearList.add(new StringIdentity(pseudo.seqId, "SF"));
break;
case 'G':
gCount[1] += 1;
gAppearList.add(new StringIdentity(pseudo.seqId, "SF"));
}
}
if (dbId.equals("SR")){
switch(ch){
case 'A':
aCount[2] += 1;
aAppearList.add(new StringIdentity(pseudo.seqId, "SR"));
break;
case 'T':
tCount[2] += 1;
tAppearList.add(new StringIdentity(pseudo.seqId, "SR"));
break;
case 'C':
cCount[2] += 1;
cAppearList.add(new StringIdentity(pseudo.seqId, "SR"));
break;
case 'G':
gCount[2] += 1;
gAppearList.add(new StringIdentity(pseudo.seqId, "SR"));
}
}
}
boolean isForward = true;
boolean isBoth = true;
if (!(aCount[0] != 0 && (aCount[1] != 0|| aCount[2] != 0))){
aCount = new int[3];
}
if (!(tCount[0] != 0 && (tCount[1] != 0|| tCount[2] != 0))){
tCount = new int[3];
}
if (!(cCount[0] != 0 && (cCount[1] != 0|| cCount[2] != 0))){
cCount = new int[3];
}
if (!(gCount[0] != 0 && (gCount[1] != 0|| gCount[2] != 0))){
gCount = new int[3];
}
int aSum = aCount[0] + aCount[1] + aCount[2];
int tSum = tCount[0] + tCount[1] + tCount[2];
int cSum = cCount[0] + cCount[1] + cCount[2];
int gSum = gCount[0] + gCount[1] + gCount[2];
int maxSum = Math.max(Math.max(aSum, tSum), Math.max(cSum, gSum));
char commonChar = 'N';
BaseMatchInfo matchInfo = new BaseMatchInfo(commonChar, isForward, isBoth);
if (maxSum == 0){
return matchInfo;
}
if (maxSum == aSum){
commonChar = 'A';
matchInfo.setBase(commonChar);
matchInfo.setBaseStringIDs(aAppearList);
if (aCount[1] == 0){
isForward = false;
}
if (aCount[1] == 0 || aCount[2] == 0){
isBoth = false;
}
matchInfo.setIsForward(isForward);
matchInfo.setIsBoth(isBoth);
}
if (maxSum == tSum){
commonChar = 'T';
matchInfo.setBase(commonChar);
matchInfo.setBaseStringIDs(tAppearList);
if (tCount[1] == 0){
isForward = false;
}
if (tCount[1] == 0 || tCount[2] == 0){
isBoth = false;
}
matchInfo.setIsForward(isForward);
matchInfo.setIsBoth(isBoth);
}
if (maxSum == cSum){
commonChar = 'C';
matchInfo.setBase(commonChar);
matchInfo.setBaseStringIDs(cAppearList);
if (cCount[1] == 0){
isForward = false;
}
if (cCount[1] == 0 || cCount[2] == 0){
isBoth = false;
}
matchInfo.setIsForward(isForward);
matchInfo.setIsBoth(isBoth);
}
if (maxSum == gSum){
commonChar = 'G';
matchInfo.setBase(commonChar);
matchInfo.setBaseStringIDs(gAppearList);
if (gCount[1] == 0){
isForward = false;
}
if (gCount[1] == 0 || gCount[2] == 0){
isBoth = false;
}
matchInfo.setIsForward(isForward);
matchInfo.setIsBoth(isBoth);
}
return matchInfo;
}
/**
* estimate the maximum length of a common string shared by a set of strings.
* @param numOfStrs
* @param avgOfStrLength
* @return
*/
public int estimateStrLength(int numOfStrs, int avgOfStrLength){
int length = 0;
return length;
}
public int[] isCrossLinked(){
// List<Integer> mCount = new ArrayList<>();
// List<Integer> sCount = new ArrayList<>();
int[] linkInfo = new int[]{0,0,0};
if (reverseSharedStrings != null && forwardSharedStrings != null){
return linkInfo;
}
if (forwardSharedStrings != null){
List<StringIdentity> identitys = forwardSharedStrings.strIdentitys;
for (StringIdentity id : identitys){
if (id.seqType.equals("M")){
// mCount.add(id.seqId);
linkInfo[0] += 1;
}
if (id.seqType.equals("SF")){
// sCount.add(id.seqId);
linkInfo[1] += 1;
}
}
// System.out.println("M size: " + mCount.size() + " S size: " + sCount.size());
// if (mCount.size() == sCount.size() && mCount.size() == 1){
// if (mCount.get(0) != sCount.get(0)){
// return true;
// }
// }
}
if (reverseSharedStrings != null){
List<StringIdentity> identitys = reverseSharedStrings.strIdentitys;
for (StringIdentity id : identitys){
if (id.seqType.equals("M")){
// mCount.add(id.seqId);
linkInfo[0] += 1;
}
if (id.seqType.equals("SR")){
// sCount.add(id.seqId);
linkInfo[2] += 1;
}
}
// System.out.println("M size: " + mCount.size() + " S size: " + sCount.size());
// if (mCount.size() == sCount.size() && mCount.size() == 1){
// if (mCount.get(0) != sCount.get(0)){
// return true;
// }
// }
}
return linkInfo;
}
private void saveString(boolean isForward, boolean isBoth, String prefix, List<StringIdentity> strList){
int preForwardStringLength = forwardSharedStrings == null? 0 : forwardSharedStrings.strLength;
int preReverseStringLength = reverseSharedStrings == null? 0 : reverseSharedStrings.strLength;
if (!isBoth){
if (isForward){
if (prefix.length() > preForwardStringLength){
forwardSharedStrings = new sharedString(strList, prefix);
}
}else{
if (prefix.length() > preReverseStringLength){
reverseSharedStrings = new sharedString(strList, prefix);
}
}
}
}
public List<StringIdentity> getForwardSharedStrIdentitys(){
List<StringIdentity> ids = new ArrayList<>();
if (forwardSharedStrings != null){
ids = forwardSharedStrings.strIdentitys;
}
return ids;
}
public boolean isForwardExist(){
boolean exist = false;
if (forwardSharedStrings != null){
exist = true;
}
return exist;
}
public List<StringIdentity> getReverseSharedStrIdentitys(){
List<StringIdentity> ids = new ArrayList<>();
if (reverseSharedStrings != null){
ids = reverseSharedStrings.strIdentitys;
}
return ids;
}
public String getForwardSharedString(){
return forwardSharedStrings.commonString;
}
public int getForwardSharedStrLength(){
String forwardStr = forwardSharedStrings.commonString;
char[] charArray = forwardStr.toCharArray();
int len = 1;
char initialCh = charArray[0];
for (char ch : charArray){
if (ch != initialCh){
len += 1;
initialCh = ch;
}
}
return len;
}
public String getReversedSharedString(){
return reverseSharedStrings.commonString;
}
public int getReverseSharedStrLength(){
String forwardStr = reverseSharedStrings.commonString;
char[] charArray = forwardStr.toCharArray();
int len = 1;
char initialCh = charArray[0];
for (char ch : charArray){
if (ch != initialCh){
len += 1;
initialCh = ch;
}
}
return len;
}
public int[] getEstimateBp(List<PseudoSuperItem> superItems, SequenceDatabase database){
int[] pos = new int[2];
if (forwardSharedStrings != null){
List<StringIdentity> identitys = forwardSharedStrings.strIdentitys;
Collections.sort(identitys, new Comparator<StringIdentity>(){
@Override
public int compare(StringIdentity o1, StringIdentity o2){
return o1.getSeqId() - o2.getSeqId();
}
});
PseudoSuperItem psLeftItem = superItems.get(identitys.get(0).seqId);
Node nodeLeft = psLeftItem.getSuperItem(database);
pos[0] = nodeLeft.getPos();
PseudoSuperItem psRightItem = superItems.get(identitys.get(identitys.size() - 1).seqId);
Node nodeRight = psRightItem.getSuperItem(database);
pos[1] = nodeRight.getPos();
}
if (reverseSharedStrings!= null){
List<StringIdentity> identitys = reverseSharedStrings.strIdentitys;
Collections.sort(identitys, new Comparator<StringIdentity>(){
@Override
public int compare(StringIdentity o1, StringIdentity o2){
return o1.getSeqId() - o2.getSeqId();
}
});
PseudoSuperItem psLeftItem = superItems.get(identitys.get(0).seqId);
Node nodeLeft = psLeftItem.getSuperItem(database);
pos[0] = nodeLeft.getPos();
PseudoSuperItem psRightItem = superItems.get(identitys.get(identitys.size() - 1).seqId);
Node nodeRight = psRightItem.getSuperItem(database);
pos[1] = nodeRight.getPos();
}
return pos;
}
public void printSharedString(List<PseudoSuperItem> superItems, SequenceDatabase database){
if (forwardSharedStrings != null){
StringBuilder sb = new StringBuilder();
for (StringIdentity id : forwardSharedStrings.strIdentitys){
PseudoSuperItem psItem = superItems.get(id.seqId);
Node node = psItem.getSuperItem(database);
sb.append(node.getType());
sb.append(",");
sb.append(node.getPos());
sb.append("\t");
}
sb.append(forwardSharedStrings.commonString);
sb.append("\t");
// sb.append(getForwardSharedStrLength());
System.out.println(sb.toString());
}
if (reverseSharedStrings!= null){
StringBuilder sb = new StringBuilder();
for (StringIdentity id : reverseSharedStrings.strIdentitys){
PseudoSuperItem psItem = superItems.get(id.seqId);
Node node = psItem.getSuperItem(database);
sb.append(node.getType());
sb.append(",");
sb.append(node.getPos());
sb.append("\t");
}
sb.append(reverseSharedStrings.commonString);
sb.append("\t");
// sb.append(getReverseSharedStrLength());
System.out.println(sb.toString());
}
}
class sharedString{
List<StringIdentity> strIdentitys = new ArrayList<>();
String commonString;
int strLength = 0;
public sharedString(){
}
public sharedString(List<StringIdentity> identity, String str) {
strIdentitys = identity;
commonString = str;
strLength = str.length();
}
public boolean inValid(){
return commonString == null;
}
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
for (StringIdentity identity : strIdentitys){
sb.append(identity.toString());
sb.append(" ");
}
sb.append("\n");
sb.append(commonString);
return sb.toString();
}
}
}
| [
"jdlin910324@gmail.com"
] | jdlin910324@gmail.com |
371b8e546cc200c685c77da1326f56b01ca65548 | 1f9efc022bfddc4b7f5b67b825ae7af481d2c444 | /app/src/main/java/com/lovelilu/model/Photo.java | b979db9ee6e439c04af3df9875a20069dede62c8 | [] | no_license | CKXY-525/LoveLilu | f8e0a16175c8d0d7946dd5c78458a7b800668b20 | 5872348b14806c231bdf1061b654b895bef46642 | refs/heads/master | 2021-07-13T23:23:44.774135 | 2017-10-20T02:43:19 | 2017-10-20T02:43:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package com.lovelilu.model;
import com.lovelilu.model.base.BaseModel;
/**
* Created by huannan on 2016/8/24.
*/
public class Photo extends BaseModel {
private String desc;
private String imageUrl;
private String smallImageUrl;
private Integer like;
private String date;
public String getSmallImageUrl() {
return smallImageUrl;
}
public void setSmallImageUrl(String smallImageUrl) {
this.smallImageUrl = smallImageUrl;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public Integer getLike() {
return like;
}
public void setLike(Integer like) {
this.like = like;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}
| [
"wuhuannan@meizu.com"
] | wuhuannan@meizu.com |
af26ce5040c46d8bbc1c2d5532c8b7ae8fa68b0a | d9074d16653797d5a24752cb41cabe613da45a81 | /AtividadeJavaModulo01/src/br/com/q4/Q4_Petronio_Fernandes.java | 8dc3d7a82bc629a421dc98ea255befeb2e27bed3 | [] | no_license | petronioFernandes/QuestionarioAula04Modulo01Java | 5cf490822d6fcf27d27bf32d819cff6a46f259f2 | 62256455943b6b9ada8aebadffc86c33bdf3d873 | refs/heads/main | 2023-06-02T09:29:50.495078 | 2021-06-22T03:25:04 | 2021-06-22T03:25:04 | 379,125,779 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 789 | java | /*
* Escreva um algoritomo utilizando Java que leia uma idade, caso a idade seja negativa você deve informar
* que não aceita valores negativos e peça para ele digitar o valor novamente e encerre a aplicação quando
* ele digitar um valor válido.
* */
package br.com.q4;
import java.util.Scanner;
public class Q4_Petronio_Fernandes {
public static void main(String[] args) {
Scanner entradaUsuario = new Scanner(System.in);
int idade;
System.out.println("Digite sua idade: ");
idade = entradaUsuario.nextInt();
while(idade < 0) {
System.out.println("Eu não aceito valores negativos!\n\nPor favor digite sua idade: ");
idade = entradaUsuario.nextInt();
}
System.out.println("Valor válido!");
System.out.println("\nPrograma finalizado!");
}
}
| [
"peufernandes89@gmail.com"
] | peufernandes89@gmail.com |
863cdd75e648dff1d9ddd89f025c815a47e705df | 91a0541f9f64aba26f598fb5784c89220e88a56d | /src/main/java/gabriel/betbot/dtos/tradefeed/HalfTimeHdp.java | 4cc8a093224d1c1648609b75599a01d8532268c2 | [] | no_license | glindstrom/betbot | 30206423503a3b5598fc6f0bdb6af6e74935661e | 2a2b96c82d30ed7b6607a18c6edfbf220e539b28 | refs/heads/master | 2022-12-21T21:43:51.905900 | 2020-07-01T19:13:51 | 2020-07-01T19:13:51 | 201,639,126 | 0 | 0 | null | 2022-12-10T03:35:16 | 2019-08-10T14:13:24 | Java | UTF-8 | Java | false | false | 863 | java |
package gabriel.betbot.dtos.tradefeed;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"BookieOdds",
"Handicap"
})
public class HalfTimeHdp {
@JsonProperty("BookieOdds")
public final String bookieOdds;
@JsonProperty("Handicap")
public final String handicap;
public HalfTimeHdp(final String bookieOdds, final String handicap) {
this.bookieOdds = bookieOdds;
this.handicap = handicap;
}
public HalfTimeHdp() {
this.bookieOdds = null;
this.handicap = null;
}
@Override
public String toString() {
return "HalfTimeHdp{" + "bookieOdds=" + bookieOdds + ", handicap=" + handicap + '}';
}
}
| [
"gabriel.lindstrom@helsinki.fi"
] | gabriel.lindstrom@helsinki.fi |
b57064a3cc1ab46e7130fc3bb34926cdf391a02d | a27a7e9a50849529a75a869e84fd01f2e9bbd4e4 | /src/test/java/guru/springframework/recipeproject/converters/UnitOfMeasureToUnitOfMeasureCommandTest.java | ad8d3e1bc59d8723b13ffa838c82d634ad327a18 | [] | no_license | lucascalsilva/spring-boot-recipe-project | 2960e3fd9f113a6fd3ebcbffde1bf53eb8710b9a | 086c9e3ee6aa2546f56f48d10ada06198f3bc541 | refs/heads/master | 2021-05-18T20:08:15.928341 | 2020-08-29T20:00:25 | 2020-08-29T20:00:25 | 251,396,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,384 | java | package guru.springframework.recipeproject.converters;
import guru.springframework.recipeproject.commands.UnitOfMeasureCommand;
import guru.springframework.recipeproject.model.UnitOfMeasure;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* Created by jt on 6/21/17.
*/
public class UnitOfMeasureToUnitOfMeasureCommandTest {
public static final String DESCRIPTION = "name";
public static final Long LONG_VALUE = 1L;
UnitOfMeasureToUnitOfMeasureCommand converter;
@BeforeEach
public void setUp() throws Exception {
converter = new UnitOfMeasureToUnitOfMeasureCommand();
}
@Test
public void testNullObjectConvert() throws Exception {
assertNull(converter.convert(null));
}
@Test
public void testEmptyObj() throws Exception {
assertNotNull(converter.convert(new UnitOfMeasure()));
}
@Test
public void convert() throws Exception {
//given
UnitOfMeasure uom = new UnitOfMeasure();
uom.setId(LONG_VALUE);
uom.setDescription(DESCRIPTION);
//when
UnitOfMeasureCommand uomc = converter.convert(uom);
//then
assertEquals(LONG_VALUE, uomc.getId());
assertEquals(DESCRIPTION, uomc.getDescription());
}
} | [
"lucasc.alm.silva@gmail.com"
] | lucasc.alm.silva@gmail.com |
35a6ff7027c01ae8aa723787fd1090997c47c3f8 | a2a6857000d1abc9907b42c4715e6badaddf83a3 | /src/main/java/com/commercetools/bulkpricer/apimodel/CtpExtensionValidationFailedResponseBody.java | ce6f6b8ed490d63c1e947f4bd2583f70c418996c | [
"Apache-2.0"
] | permissive | fossabot/commercetools-bulkpricer | ca70408bd5a8537e2794740725a5490427a57ee1 | 213411e9b345edc15c385e5a476efed002fab0ca | refs/heads/master | 2020-03-15T12:04:22.361704 | 2018-05-04T12:12:25 | 2018-05-04T12:12:25 | 132,135,800 | 0 | 0 | null | 2018-05-04T12:12:25 | 2018-05-04T12:12:24 | null | UTF-8 | Java | false | false | 454 | java | package com.commercetools.bulkpricer.apimodel;
import java.util.ArrayList;
/*
Implements this model:
https://docs.commercetools.com/http-api-projects-api-extensions.html#validation-failed
*/
public class CtpExtensionValidationFailedResponseBody {
private ArrayList<CtpExtensionError> errors;
public ArrayList<CtpExtensionError> getErrors() {
return errors;
}
public void appendError(CtpExtensionError error){
errors.add(error);
}
}
| [
"nikolaus.kuehn@commercetools.de"
] | nikolaus.kuehn@commercetools.de |
01064b113248821109fef3e37a7938bfe45514b2 | c171052a27baba6a0e423c55e45f34ab8504bb99 | /bin/custom/customStore/customStorestorefront/web/testsrc/ma/ensias/storefront/security/impl/WebHttpSessionRequestCacheUnitTest.java | 0c0e8bb1bc12485e4bc871b48032ababab6fc3a0 | [] | no_license | med4it/hybris-IsNewCustomization | 9cfb7b252767eac86347a0c1f74086a7719ad3e8 | b0552237fce83a3beec755b9c0d2d2820441c1ed | refs/heads/master | 2021-02-09T03:16:42.273659 | 2020-03-02T08:13:54 | 2020-03-02T08:13:54 | 244,233,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,395 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package ma.ensias.storefront.security.impl;
import static org.junit.Assert.assertEquals;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.acceleratorstorefrontcommons.constants.WebConstants;
import de.hybris.platform.servicelayer.session.SessionService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Answers;
import org.mockito.ArgumentMatcher;
import org.mockito.BDDMockito;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.savedrequest.DefaultSavedRequest;
@UnitTest
public class WebHttpSessionRequestCacheUnitTest
{
//
@InjectMocks
private final WebHttpSessionRequestCache cache = new WebHttpSessionRequestCache();
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private HttpServletRequest request;
@Mock
private HttpServletResponse response;
@Mock
private SessionService sessionService;
@Mock
private Authentication authentication;
@Before
public void prepare()
{
MockitoAnnotations.initMocks(this);
}
@Test
public void testSaveRequest()
{
SecurityContextHolder.getContext().setAuthentication(authentication);
BDDMockito.given(request.getRequestURL()).willReturn(new StringBuffer("dummy"));
BDDMockito.given(request.getScheme()).willReturn("dummy");
BDDMockito.given(request.getHeader("referer")).willReturn("some blah");
BDDMockito.given(request.getSession(false)).willReturn(null);
cache.saveRequest(request, response);
Mockito.verify(request.getSession()).setAttribute(Mockito.eq("SPRING_SECURITY_SAVED_REQUEST"),
Mockito.argThat(new DefaultSavedRequestArgumentMatcher("some blah")));
}
@Test
public void testCalcRedirectUrlWithEncodingAttrs()
{
assertEquals(
"/",
executeCalculateRelativeRedirectUrl("electronics/en", "/customStorestorefront/electronics/en",
"https://electronics.local:9002/customStorestorefront/electronics/en"));
assertEquals(
"/",
executeCalculateRelativeRedirectUrl("electronics/en", "/customStorestorefront/electronics/en",
"https://electronics.local:9002/customStorestorefront/electronics/en/"));
}
@Test
public void testCalcRedirectUrlWithMismatchEncodingAttrs()
{
assertEquals(
"electronics/en",
executeCalculateRelativeRedirectUrl("electronics/ja/Y/Z", "/customStorestorefront/electronics/ja/Y/Z",
"https://electronics.local:9002/customStorestorefront/electronics/en"));
assertEquals(
"/",
executeCalculateRelativeRedirectUrl("electronics/ja/Y/Z", "/customStorestorefront/electronics/en",
"https://electronics.local:9002/customStorestorefront/electronics/en/"));
}
@Test
public void testCalcRedirectUrlWithoutEncodingAttrs()
{
assertEquals(
"/",
executeCalculateRelativeRedirectUrl("", "/customStorestorefront",
"https://electronics.local:9002/customStorestorefront"));
assertEquals(
"/",
executeCalculateRelativeRedirectUrl("", "/customStorestorefront",
"https://electronics.local:9002/customStorestorefront/"));
}
@Test
public void testCalcRedirectUrlWithEncodingAttrsServletPath()
{
assertEquals(
"/Open-Catalogue/Cameras/Digital-Cameras/c/575",
executeCalculateRelativeRedirectUrl("electronics/en", "/customStorestorefront/electronics/en",
"https://electronics.local:9002/customStorestorefront/electronics/en/Open-Catalogue/Cameras/Digital-Cameras/c/575"));
}
@Test
public void testCalcRedirectUrlEmptyContextWithoutEncodingAttrs()
{
assertEquals("/", executeCalculateRelativeRedirectUrl("", "", "https://electronics.local:9002/"));
}
@Test
public void testCalcRedirectUrlEmptyContextWithEncodingAttrs()
{
assertEquals(
"/",
executeCalculateRelativeRedirectUrl("electronics/en", "/electronics/en",
"https://electronics.local:9002/electronics/en"));
assertEquals(
"/",
executeCalculateRelativeRedirectUrl("electronics/en", "/electronics/en",
"https://electronics.local:9002/electronics/en/"));
}
@Test
public void testCalcRedirectUrlEmptyContextWithEncAttrsServletPath()
{
assertEquals(
"/login",
executeCalculateRelativeRedirectUrl("electronics/en", "/electronics/en",
"https://electronics.local:9002/electronics/en/login"));
assertEquals(
"/login/",
executeCalculateRelativeRedirectUrl("electronics/en", "/electronics/en",
"https://electronics.local:9002/electronics/en/login/"));
assertEquals(
"/Open-Catalogue/Cameras/Hand-held-Camcorders/c/584",
executeCalculateRelativeRedirectUrl("electronics/en", "/electronics/en",
"https://electronics.local:9002/electronics/en/Open-Catalogue/Cameras/Hand-held-Camcorders/c/584"));
}
@Test
public void testCalcRedirectUrlEmptyContextWithoutEncAttrsServletPath()
{
assertEquals(
"Open-Catalogue/Cameras/Hand-held-Camcorders/c/584",
executeCalculateRelativeRedirectUrl("", "",
"https://electronics.local:9002/Open-Catalogue/Cameras/Hand-held-Camcorders/c/584"));
}
protected String executeCalculateRelativeRedirectUrl(final String urlEncodingAttrs, final String contextPath, final String url)
{
BDDMockito.given(sessionService.getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES)).willReturn(urlEncodingAttrs);
return cache.calculateRelativeRedirectUrl(contextPath, url);
}
class DefaultSavedRequestArgumentMatcher extends ArgumentMatcher<DefaultSavedRequest>
{
private final String url;
DefaultSavedRequestArgumentMatcher(final String url)
{
this.url = url;
}
@Override
public boolean matches(final Object argument)
{
if (argument instanceof DefaultSavedRequest)
{
final DefaultSavedRequest arg = (DefaultSavedRequest) argument;
return url.equals(arg.getRedirectUrl());
}
return false;
}
}
}
| [
"4itmed@gmail.com"
] | 4itmed@gmail.com |
cee7abdb829ade09c74df279c20edf893d840545 | 5d288b7047ae24013d1ad3b4bb51abdf449e1d48 | /HWA-Project/src/main/java/com/qa/HWA/persistance/domain/Coach.java | abddc41c7a50f757d56d0ac50ed27a65f4ca61c0 | [
"MIT"
] | permissive | LLow-QA/HWA | bf1a77bcbbba1726784f0ba9b8cdb1905aa234b9 | e390b506458f483782985f50c6ce1224af2f1016 | refs/heads/main | 2023-03-01T23:40:01.684837 | 2021-02-01T12:00:17 | 2021-02-01T12:00:17 | 331,294,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,383 | java | package com.qa.HWA.persistance.domain;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Coach {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long coachID;
private String startPoint;
private String endPoint;
@Pattern(regexp = "^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$")
private String departureTime;
@Pattern(regexp = "^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$")
private String arrivalTime;
@Min(10)
private int capacity;
@Max(20)
private float ticketCost;
@OneToMany(mappedBy = "coach", fetch = FetchType.EAGER)
@OnDelete(action = OnDeleteAction.CASCADE)
private List<Passenger> passengerList;
public Coach(String startPoint, String endPoint, String departureTime, String arrivalTime,
@Min(10) int capacity, @Max(20) float ticketCost) {
super();
this.startPoint = startPoint;
this.endPoint = endPoint;
this.departureTime = departureTime;
this.arrivalTime = arrivalTime;
this.capacity = capacity;
this.ticketCost = ticketCost;
}
public Coach(Long coachID) {
super();
this.coachID = coachID;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((arrivalTime == null) ? 0 : arrivalTime.hashCode());
result = prime * result + capacity;
result = prime * result + ((departureTime == null) ? 0 : departureTime.hashCode());
result = prime * result + ((endPoint == null) ? 0 : endPoint.hashCode());
result = prime * result + ((passengerList == null) ? 0 : passengerList.hashCode());
result = prime * result + ((startPoint == null) ? 0 : startPoint.hashCode());
result = prime * result + Float.floatToIntBits(ticketCost);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Coach other = (Coach) obj;
if (arrivalTime == null) {
if (other.arrivalTime != null)
return false;
} else if (!arrivalTime.equals(other.arrivalTime))
return false;
if (capacity != other.capacity)
return false;
if (departureTime == null) {
if (other.departureTime != null)
return false;
} else if (!departureTime.equals(other.departureTime))
return false;
if (endPoint == null) {
if (other.endPoint != null)
return false;
} else if (!endPoint.equals(other.endPoint))
return false;
if (passengerList == null) {
if (other.passengerList != null)
return false;
} else if (!passengerList.equals(other.passengerList))
return false;
if (startPoint == null) {
if (other.startPoint != null)
return false;
} else if (!startPoint.equals(other.startPoint))
return false;
if (Float.floatToIntBits(ticketCost) != Float.floatToIntBits(other.ticketCost))
return false;
return true;
}
}
| [
"LLow@qa.com"
] | LLow@qa.com |
6c0709c0f38e1e93458bd0e484bbf233d81a98db | 27a13543c5a21811e696278b5212755ecdebca53 | /hsco/src/main/java/hsco/pms/sls/lad/rqe/SLS090101/SLS090101Service.java | 1202cfe087575dadddfe43cdb0fa2e7e7cead4cb | [] | no_license | chaseDeveloper/hsco | 9dad73c971500c4bd98adfefa3e91a91d26ca318 | 7052d6da3ac772cd3b13ec391818139355935916 | refs/heads/master | 2023-06-15T23:55:10.592683 | 2021-07-06T07:46:07 | 2021-07-06T07:46:07 | 383,377,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 85 | java | package hsco.pms.sls.lad.rqe.SLS090101;
public interface SLS090101Service {
}
| [
"kdk@ichase.co.kr"
] | kdk@ichase.co.kr |
a6baee37b307834c9642cd87434e1daeb0c6e629 | b35a3818737dd7e21eace1abac7ba5bb832184a9 | /src/test/java/com/practice/arrays/RotateArrayByNTest.java | 9d81edd885100c7414b033f30620972f58c2686f | [] | no_license | thandra2809/cleanCodeJava | 93b72635cdc0456863bc978ed5d99a1b8103bce6 | 216f78b1f599cd4575f1c8de288fd792ddeff48a | refs/heads/master | 2022-12-29T10:34:09.216153 | 2020-05-10T04:45:34 | 2020-05-10T04:45:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.practice.arrays;
import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
public class RotateArrayByNTest {
@Test
public void testInput(){
int[] num = {1,2,3,4,5,6,7};
RotateArrayByN rotateArrayByN = new RotateArrayByN();
rotateArrayByN.rotateArray(num, 3);
Assert.assertEquals("[5, 6, 7, 1, 2, 3, 4]", Arrays.toString(num));
}
@Test
public void testWithNumberBiggerThanLength(){
int[] num = {1,2,3,4,5,6,7};
RotateArrayByN rotateArrayByN = new RotateArrayByN();
rotateArrayByN.rotateArray(num, 8);
Assert.assertEquals("[7, 1, 2, 3, 4, 5, 6]", Arrays.toString(num));
}
} | [
"arun.dandapani@siemens.com"
] | arun.dandapani@siemens.com |
b37cccf3c2435063b6b1bbcbfb61bb7c30491b7f | 0a9dcef1b2415e8ea48a30545ea245de30fcabba | /src/main/java/BlackFriday.java | b812b1453296d3cb22bb56a4f63fc3af9b4b56ac | [] | no_license | lukaszantkowiak/kattis | a7cc24ddb738be84ff6f8ffd70c58292e589acf3 | 011220a2c2aaf9fe8adda65abfb939f9da85206a | refs/heads/master | 2021-01-10T07:39:30.795457 | 2016-02-22T22:54:41 | 2016-02-22T22:54:41 | 44,443,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Solution for https://open.kattis.com/problems/blackfriday
*
* @author Lukasz Antkowiak (lukasz.patryk.antkowiak(at)gmail.com)
*
*/
public class BlackFriday {
public static void main(final String[] args) {
final Kattio io = new Kattio(System.in, System.out);
final int n = io.getInt();
final Map<Integer, Integer> results = new LinkedHashMap<Integer, Integer>();
final List<Integer> all = new ArrayList<Integer>();
for (int i = 0; i < n; i++) {
final Integer r = io.getInt();
all.add(r);
if (results.containsKey(r)) {
results.put(r, results.get(r) + 1);
} else {
results.put(r, 1);
}
}
int max = -1;
for (final Map.Entry<Integer, Integer> entry : results.entrySet()) {
if (entry.getValue() == 1 && entry.getKey() > max) {
max = entry.getKey();
}
}
if (max == -1) {
io.println("none");
} else {
io.println(all.indexOf(max) + 1);
}
io.flush();
io.close();
}
}
| [
"lantkowiak@infusion.com"
] | lantkowiak@infusion.com |
85549dada64593a49f5e9942938dbc67fae53cae | c81dd37adb032fb057d194b5383af7aa99f79c6a | /java/com/google/firebase/messaging/SendException.java | 46a853fa992edf661bcd3884f218251c5b9d3694 | [] | no_license | hongnam207/pi-network-source | 1415a955e37fe58ca42098967f0b3307ab0dc785 | 17dc583f08f461d4dfbbc74beb98331bf7f9e5e3 | refs/heads/main | 2023-03-30T07:49:35.920796 | 2021-03-28T06:56:24 | 2021-03-28T06:56:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,028 | java | package com.google.firebase.messaging;
import java.util.Locale;
/* compiled from: com.google.firebase:firebase-messaging@@21.0.0 */
public final class SendException extends Exception {
public static final int ERROR_INVALID_PARAMETERS = 1;
public static final int ERROR_SIZE = 2;
public static final int ERROR_TOO_MANY_MESSAGES = 4;
public static final int ERROR_TTL_EXCEEDED = 3;
public static final int ERROR_UNKNOWN = 0;
private final int errorCode;
SendException(String str) {
super(str);
this.errorCode = parseErrorCode(str);
}
public final int getErrorCode() {
return this.errorCode;
}
private final int parseErrorCode(String str) {
if (str == null) {
return 0;
}
String lowerCase = str.toLowerCase(Locale.US);
char c = 65535;
switch (lowerCase.hashCode()) {
case -1743242157:
if (lowerCase.equals("service_not_available")) {
c = 3;
break;
}
break;
case -1290953729:
if (lowerCase.equals("toomanymessages")) {
c = 4;
break;
}
break;
case -920906446:
if (lowerCase.equals("invalid_parameters")) {
c = 0;
break;
}
break;
case -617027085:
if (lowerCase.equals("messagetoobig")) {
c = 2;
break;
}
break;
case -95047692:
if (lowerCase.equals("missing_to")) {
c = 1;
break;
}
break;
}
if (c == 0 || c == 1) {
return 1;
}
if (c == 2) {
return 2;
}
if (c != 3) {
return c != 4 ? 0 : 4;
}
return 3;
}
}
| [
"nganht2@vng.com.vn"
] | nganht2@vng.com.vn |
5d10e2b37b3d11fed51130c557a75554bccd89fe | 3a93c78cbd8b9ab533210ae8cbfd6f08249b418c | /client/src/com/nikolaj/chat/clients/ClientWindow.java | b4c74a0bbeee62f0fd3b29338014d3dc2dcd330b | [] | no_license | nikolajred/Simple_chat | d988c78064fc13252ef145b86b44d4d9acc1d340 | ac0f4a16737b371d3939465c247734e52b1616f8 | refs/heads/master | 2020-08-10T08:17:01.341129 | 2019-10-10T23:30:04 | 2019-10-10T23:30:04 | 214,303,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package com.nikolaj.chat.clients;
public class ClientWindow {
public static void main(String[] args) {
}
}
| [
"nikolajred@gmail.com"
] | nikolajred@gmail.com |
638c21d56eae55370fb121f5ea327f1e93e60454 | a751e39ceae26c2756920edc0144f74c9fca26ed | /src/test/java/org/interview/twitter/TwitterStatusTaskTest.java | 203e2216179690425e290fd7b7536fd5630a5105 | [] | no_license | parthtrivedi2001/bieber-tweets | e90e83ee94f6bc381cb5268dd087f6baaab2c025 | 279dacb2670cfa8d9a59aecefb1f6b424d940b2c | refs/heads/master | 2023-05-14T03:19:37.904343 | 2018-07-10T07:13:22 | 2018-07-10T07:13:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,638 | java | /**
*
*/
package org.interview.twitter;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import org.interview.TestUtils;
import org.interview.model.Message;
import org.interview.repository.MessageRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.test.context.junit4.SpringRunner;
import twitter4j.Status;
import twitter4j.User;
/**
* @author resulav
*
*/
@RunWith(SpringRunner.class)
public class TwitterStatusTaskTest {
@Mock
private MessageRepository messageRepository;
private Executor executor = Executors.newFixedThreadPool(1);
private long userId = 5l;
private Status status;
private User user;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
Mockito.when(messageRepository.add(Mockito.any(Message.class))).thenReturn(true);
user = TestUtils.dummyUser(userId);
status = TestUtils.dummyStatus(user);
}
@Test
public void testSuccessfully() {
executor.execute(new TweetStatusTask(messageRepository, status));
}
@Test(expected = IllegalArgumentException.class)
public void testNullMessageRepository() {
executor.execute(new TweetStatusTask(null, status));
}
@Test(expected = IllegalArgumentException.class)
public void testNullStatus() {
executor.execute(new TweetStatusTask(messageRepository, null));
}
@Test(expected = IllegalArgumentException.class)
public void testNullUser() {
executor.execute(new TweetStatusTask(messageRepository, TestUtils.dummyStatus(null)));
}
}
| [
"Resul.Avan@argela.com.tr"
] | Resul.Avan@argela.com.tr |
f405ecafe65e06e0128f48628ea5ec4dbe307a02 | cd5dd3c9bff82bd4cdc30c05fd04d50d45ae5ee2 | /limits-service/src/main/java/com/mukesh/microservices/limitsservice/LimitsServiceApplication.java | 539e55133addb18ff59eeefe158be7e4f83123ed | [] | no_license | mukeshmgehani/springboot-microservices | a392997207b80062061129830dc90c910f664426 | 49d916f6c36f6418dd17a7c38e63973165af7760 | refs/heads/master | 2020-08-11T01:38:23.781550 | 2019-10-11T15:00:38 | 2019-10-11T15:00:38 | 214,463,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package com.mukesh.microservices.limitsservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author mukeshgehani
*
*/
@SpringBootApplication
@EnableDiscoveryClient
public class LimitsServiceApplication {
public static void main(String[] args) {
SpringApplication.run(LimitsServiceApplication.class, args);
}
}
| [
"mukeshmgehani@gmail.com"
] | mukeshmgehani@gmail.com |
8016c346e0bdcb871d3912c3e9b07095dea95112 | c3832083550275bf1e64a7deed0e047932f2c486 | /src/main/java/decodepcode/git/GitSubmitter.java | dbe16b0a8af71d31a6f82349f9483239be581938 | [
"ISC"
] | permissive | cache117/decode-pcode | 713e1d48e997cfb3ead288dd736b230d79c22ea4 | 70bd9300a4d8db2f18abbf71f4ad281f75322608 | refs/heads/master | 2021-03-22T04:03:36.263394 | 2017-06-09T23:44:21 | 2017-06-09T23:44:21 | 93,903,160 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,725 | java | package decodepcode.git;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.logging.Logger;
import org.eclipse.jgit.api.AddCommand;
import org.eclipse.jgit.api.CommitCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.UnmergedPathsException;
import decodepcode.CONTobject;
import decodepcode.ContainerProcessor;
import decodepcode.JDBCPeopleCodeContainer;
import decodepcode.PToolsObjectToFileMapper;
import decodepcode.PeopleCodeParser;
import decodepcode.PeopleToolsObject;
import decodepcode.ProjectReader;
import decodepcode.SQLobject;
import decodepcode.VersionControlSystem;
import decodepcode.git.GitProcessorFactory.GitUser;
/* Submit to local Git repository with JGit */
public class GitSubmitter
{
static Logger logger = Logger.getLogger(GitSubmitter.class.getName());
File gitWorkDir;
Git git;
HashMap<String, GitUser> userMap;
private void addFile( String psoft_user,
String filePath,
String commitStr,
byte[] data) throws UnmergedPathsException, GitAPIException, IOException
{
int lastSlash = filePath.lastIndexOf("/");
if (lastSlash < 1)
throw new IllegalArgumentException("Expected file name with directory path, got " + filePath);
String dirPath = filePath.substring(0, lastSlash), name = filePath.substring(lastSlash + 1);
String path1 = dirPath.replace("/", System.getProperty("file.separator"));
File dir1 = new File(gitWorkDir, path1);
dir1.mkdirs();
File myfile = new File(dir1, name);
FileOutputStream os = new FileOutputStream(myfile);
os.write(data);
os.close();
AddCommand add = git.add();
add.addFilepattern(filePath).call();
GitUser user = userMap.get(psoft_user);
if (user == null)
user = userMap.get("default");
CommitCommand commit = git.commit();
commit.setMessage(commitStr).setAuthor(user.user, user.email).setCommitter("Decode Peoplecode", "nobody@dummy.org").call();
}
private boolean fileExistsInRepository( String filePath)
{
int lastSlash = filePath.lastIndexOf("/");
if (lastSlash < 1)
throw new IllegalArgumentException("Expected file name with directory path, got " + filePath);
String dirPath = filePath.substring(0, lastSlash), name = filePath.substring(lastSlash + 1);
String path1 = dirPath.replace("/", System.getProperty("file.separator"));
File dir1 = new File(gitWorkDir, path1);
File myfile = new File(dir1, name);
return myfile.exists(); // only checks if file exists in work directory - room for improvement here
}
public class GitContainerProcessor extends ContainerProcessor implements VersionControlSystem
{
String basePath;
PToolsObjectToFileMapper mapper;
PeopleCodeParser parser = new PeopleCodeParser();
ContainerProcessor ancestor;
GitContainerProcessor(
HashMap<String, GitUser> _userMap,
File gitDir,
String _basePath,
PToolsObjectToFileMapper _mapper) throws IOException
{
basePath = _basePath;
mapper = _mapper;
git = Git.open(gitDir);
gitWorkDir = gitDir;
userMap = _userMap ;
if (basePath != null)
System.out.println("Submitting PeopleCode and SQL definitions to " + new File(gitDir, basePath));
}
public void process(decodepcode.PeopleCodeObject c) throws IOException
{
if (basePath == null)
return;
StringWriter w = new StringWriter();
if (c.hasPlainPeopleCode()) // why decode the bytecode if we have the plain text...
w.write(c.getPeopleCodeText());
else
{
parser.parse(((decodepcode.PeopleCodeContainer) c), w);
}
String path = basePath + mapper.getPath(c, "pcode");
try {
String comment = "";
if (c instanceof JDBCPeopleCodeContainer)
if (getJDBCconnection().equals(((JDBCPeopleCodeContainer) c).getOriginatingConnection()))
comment = "Saved at " + ProjectReader.df2.format(c.getLastChangedDtTm()) + " by " + c.getLastChangedBy();
else
comment = "Version in " + ((JDBCPeopleCodeContainer) c).getSource() + " retrieved on " + ProjectReader.df3.format(new Date());
addFile( c.getLastChangedBy(), path, comment, w.toString().getBytes() );
} catch (UnmergedPathsException se) {
IOException e = new IOException("Error submitting pcode to Git");
e.initCause(se);
throw e;
} catch (GitAPIException se) {
IOException e = new IOException("Error submitting pcode to Git");
e.initCause(se);
throw e;
}
}
public void processSQL(SQLobject sql) throws IOException
{
if (basePath == null)
return;
String path = basePath + mapper.getPathForSQL(sql, "sql");
try {
addFile(sql.getLastChangedBy(),
path,
"Saved at " + ProjectReader.df2.format(sql.getLastChangedDtTm()) + " by " + sql.getLastChangedBy(),
sql.getSql().getBytes());
} catch (UnmergedPathsException se) {
IOException e = new IOException("Error submitting SQL to Git");
e.initCause(se);
throw e;
} catch (GitAPIException se) {
IOException e = new IOException("Error submitting SQL to Git");
e.initCause(se);
throw e;
}
}
@Override
public void processCONT(CONTobject cont) throws IOException {
if (basePath == null)
return;
String path = basePath + mapper.getPathForCONT(cont, false);
try {
addFile(cont.getLastChangedBy(),
path,
"Saved at " + ProjectReader.df2.format(cont.getLastChangedDtTm()) + " by " + cont.getLastChangedBy(),
cont.getContDataBytes());
} catch (UnmergedPathsException se) {
IOException e = new IOException("Error submitting Content to Git");
e.initCause(se);
throw e;
} catch (GitAPIException se) {
IOException e = new IOException("Error submitting Content to Git");
e.initCause(se);
throw e;
}
}
@Override
public void aboutToProcess() {
if (basePath != null)
System.out.println("Submitting to Git, base path = " + basePath);
}
public boolean existsInBranch(PeopleToolsObject obj)
throws IOException {
if (basePath == null)
throw new IllegalArgumentException("No base path set for " + getTag());
return fileExistsInRepository(basePath + mapper.getPath(obj, "pcode"));
}
public ContainerProcessor getAncestor() {
return ancestor;
}
public void setAncestor(ContainerProcessor _ancestor) {
ancestor = _ancestor;
}
}
}
| [
"cache@byu.edu"
] | cache@byu.edu |
07022a8c7b85d76ee3dfbaf7d9e518883348547a | 6525f83892c45734c9e2304a9ed009b9c052e6c5 | /src/main/java/com/ln/servlet/AuthenticateServlet.java | 37e7dfa8e804c7e46249c058bfea9907f1f74cb4 | [] | no_license | paramsethi/linkedInDemo | ae4bc553f6e10efc8e27c3e383ac49592bafc7d7 | 637dd730bfa20eb25d91a50a0707b1fd63ee83d8 | refs/heads/master | 2016-08-04T01:44:52.191768 | 2011-09-27T03:38:27 | 2011-09-27T03:38:27 | 2,461,200 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 894 | java | package com.ln.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ln.dao.LoginDao;
import com.ln.utility.Constants;
import com.ln.utility.Utility;
/**
* For authentication
*
* @author parampreetsethi
*
*/
public class AuthenticateServlet extends HttpServlet implements Constants {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String[] data = new LoginDao().authenticate();
resp.addCookie(Utility.setCookie(data[0], data[1], req.getCookies()));
resp.sendRedirect(data[2]);
}
}
| [
"param.sethi@gmail.com"
] | param.sethi@gmail.com |
142768c038ac7a9fe29288db54bca2a2a3e019ac | 77525ad8d7317db1f8b468eea28c77750257d25c | /src/main/java/org/junngo/spring/springboot/web/dto/PostsUpdateRequestDto.java | f23c2af13a183c0be5bfb9b6be15dc153f4e3767 | [] | no_license | junngo/spring-blog | 73cfb8bc60da81a27165a2c2333b8a0ee448f6ba | 3cfc2357e19523cc1711544e8a38dbbe33f7d20a | refs/heads/master | 2022-12-29T07:45:00.098079 | 2020-10-10T05:06:56 | 2020-10-10T05:06:56 | 278,620,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package org.junngo.spring.springboot.web.dto;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@NoArgsConstructor
public class PostsUpdateRequestDto {
private String title;
private String content;
@Builder
public PostsUpdateRequestDto(String title, String content) {
this.title = title;
this.content = content;
}
}
| [
"myeongjun.ko@gmail.com"
] | myeongjun.ko@gmail.com |
ecca3c45ec1946c27ded7c3353a443f2c121d0bd | c6c7ffa014f9b8fd775b7ad42b44d1367dfc07e2 | /LinkedListCycle/src/com/xk/Solution.java | 4c790b459dcd3443c7eb4eed87ed15676069059b | [] | no_license | xukan/Algorithms | e9129166278c7a98ea9d0fb824793748958b44a4 | d36aee2dfbf9ba097cc990a74166398d711f3482 | refs/heads/master | 2021-01-10T21:56:33.642101 | 2016-08-24T14:54:57 | 2016-08-24T14:54:57 | 42,408,839 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,589 | java | package com.xk;
/*用两个指针p1、p2指向表头,每次循环时p1指向它的后继,p2指向它后继的后继。若p2的后继为NULL,表明链表没有环;否则有环且p1==p2时循环可以终止。
* 此时为了寻找环的入口,将p1重新指向表头且仍然每次循环都指向后继,p2每次也指向后继。当p1与p2再次相等时,相等点就是环的入口。
* http://www.cnblogs.com/wuyuegb2312/p/3183214.html 这篇博客讲的很清晰
* 解法上,看相对位移,由于fast比slow快一步,因此,如果有环,一定会在环上实现套圈的
*/
public class Solution {
public boolean hasCycle(ListNode head) {
if(head == null || head.next == null)
return false;
ListNode fast = head;
ListNode slow = head;
boolean flag = false;
while(fast.next!= null && fast.next.next!= null){
fast = fast.next.next;
slow = slow.next;
if(fast == slow)
return true;
}
return false;
}
public static void main(String[] args){
ListNode node1 = new ListNode(5);
ListNode node2 = new ListNode(15);
ListNode node3 = new ListNode(5);
ListNode node4 = new ListNode(7);
ListNode node5 = new ListNode(25);
ListNode node6 = new ListNode(1);
node1.next = node2;
node2.next = node3;
node3.next = node4;
node4.next = node5;
node5.next = node6;
//node6.next = node1;
Solution s = new Solution();
boolean res = s.hasCycle(node1);
System.out.println(res);
}
}
| [
"xukan111@gmail.com"
] | xukan111@gmail.com |
74ddc76526954843337a2350d65a94e367c715a3 | fb96302cfef7d0388ae8f8e0447d6bdcbf3a0b09 | /CROWN-BS-SYS-V1/src/main/java/com/bs/sys/service/FileService.java | 63bbc8d7a5fceb2b6d7f1ff5971dc69db0976a8c | [] | no_license | sentinelhaha/testworkspace | 24f93df9d24bdc2f61df9f1bd1e69d44903babdd | 15ad33f0fd26f04ba145c7feabed1dfc8601c555 | refs/heads/master | 2020-04-23T10:42:23.028938 | 2019-03-10T06:10:50 | 2019-03-10T06:10:50 | 171,112,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package com.bs.sys.service;
import org.springframework.web.multipart.MultipartFile;
import com.bs.sys.vo.PicUploadResult;
public interface FileService {
PicUploadResult uploadFile(MultipartFile uploadFile);
}
| [
"1510101226@qq.com"
] | 1510101226@qq.com |
fb51e65a44bb54678dcaf9c7100925a7fc2d106d | 324220b6f8c43714615d4acfe521db5ba295f039 | /src/main/java/com/forgestorm/rpg/entity/passive/EntityBabyChicken.java | 80b452c2c0247f0f1c5bb39427d81328816c6aa0 | [] | no_license | unenergizer/ForgeStorm-RPG | 1524390ef5d1d875f5578024c510001fbe51944a | 6fc23b26daf27adf08f89bdd2f205446454f6661 | refs/heads/master | 2022-09-02T06:25:07.669996 | 2016-10-23T20:27:39 | 2016-10-23T20:27:39 | 71,727,805 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | package com.forgestorm.rpg.entity.passive;
import org.bukkit.Location;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.EntityType;
import com.forgestorm.rpg.profile.Profile;
public class EntityBabyChicken extends PassiveEntity {
public EntityBabyChicken(String name, int level, Location location, Profile profile) {
super(name, level, location, profile);
entityType = EntityType.CHICKEN;
}
@Override
protected void createEntity() {
spawnEntity();
Chicken babyChicken = (Chicken) entity;
babyChicken.setBaby();
babyChicken.setAgeLock(true);
}
@Override
protected void killReward() {
// TODO Auto-generated method stub
}
}
| [
"unenergizer@gmail.com"
] | unenergizer@gmail.com |
df8007e4c44984368356512ab93720bb0c64bb8f | 15ce5d71b320fdae98b3143700bd99eb78b93bfa | /pinyougou-parent/pinyougou-seckill-web/src/main/java/com/pinyougou/seckill/controller/SeckillOrderController.java | 29052a734eb09e4f6920416ec74815a77f270ec0 | [] | no_license | ewenkai/- | cf8a5b514502d4e50ba09aaa062fe6e6e1f25b2e | 6f70767a19587e0afefbe9a49294b6779fcfdf25 | refs/heads/master | 2020-04-17T10:43:33.699497 | 2019-01-19T05:56:56 | 2019-01-19T05:56:56 | 166,511,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,167 | java | package com.pinyougou.seckill.controller;
import java.util.List;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.dubbo.config.annotation.Reference;
import com.pinyougou.pojo.TbSeckillOrder;
import com.pinyougou.seckill.service.SeckillOrderService;
import entity.PageResult;
import entity.Result;
/**
* controller
* @author Administrator
*
*/
@RestController
@RequestMapping("/seckillOrder")
public class SeckillOrderController {
@Reference
private SeckillOrderService seckillOrderService;
/**
* 返回全部列表
* @return
*/
@RequestMapping("/findAll")
public List<TbSeckillOrder> findAll(){
return seckillOrderService.findAll();
}
/**
* 返回全部列表
* @return
*/
@RequestMapping("/findPage")
public PageResult findPage(int page,int rows){
return seckillOrderService.findPage(page, rows);
}
/**
* 增加
* @param seckillOrder
* @return
*/
@RequestMapping("/add")
public Result add(@RequestBody TbSeckillOrder seckillOrder){
try {
seckillOrderService.add(seckillOrder);
return new Result(true, "增加成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "增加失败");
}
}
/**
* 修改
* @param seckillOrder
* @return
*/
@RequestMapping("/update")
public Result update(@RequestBody TbSeckillOrder seckillOrder){
try {
seckillOrderService.update(seckillOrder);
return new Result(true, "修改成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "修改失败");
}
}
/**
* 获取实体
* @param id
* @return
*/
@RequestMapping("/findOne")
public TbSeckillOrder findOne(Long id){
return seckillOrderService.findOne(id);
}
/**
* 批量删除
* @param ids
* @return
*/
@RequestMapping("/delete")
public Result delete(Long [] ids){
try {
seckillOrderService.delete(ids);
return new Result(true, "删除成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "删除失败");
}
}
/**
* 查询+分页
* @param seckillOrder
* @param page
* @param rows
* @return
*/
@RequestMapping("/search")
public PageResult search(@RequestBody TbSeckillOrder seckillOrder, int page, int rows ){
return seckillOrderService.findPage(seckillOrder, page, rows);
}
@RequestMapping("/submitOrder")
public Result submitOrder(Long seckillId){
//提取当前用户
String username = SecurityContextHolder.getContext().getAuthentication().getName();
if("anonymousUser".equals(username)){
return new Result(false, "当前用户未登录");
}
try {
seckillOrderService.submitOrder(seckillId, username);
return new Result(true, "提交订单成功");
}catch (RuntimeException e) {
e.printStackTrace();
return new Result(false, e.getMessage());
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "提交订单失败");
}
}
}
| [
"java_soldiers@163.com"
] | java_soldiers@163.com |
b3864bc44a436e9fa999664e6033f4f51931759e | 74ef6dd6d640b5550a7b7235b12e90da3f9c085b | /app/src/main/obsolete/test/org/test/zlibrary/model/TestTextParagraph.java | 663f10993c18a3f42f346e0752b4b7802730afd1 | [] | no_license | jaychou2012/FBReaderJ-aar-Android-Studio | dfa8dd8a684ba5c3d79e0fc700a69923ab09bb1e | 42eb6d94c762403a17ac47c5ff718008a4abad10 | refs/heads/master | 2021-05-04T11:40:14.349403 | 2020-08-25T13:23:38 | 2020-08-25T13:23:38 | 54,856,694 | 6 | 6 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package org.test.zlibrary.model;
import org.geometerplus.zlibrary.text.model.ZLTextParagraph;
import org.geometerplus.zlibrary.text.model.impl.ZLModelFactory;
import junit.framework.TestCase;
public class TestTextParagraph extends TestCase {
private ZLModelFactory factory = new ZLModelFactory();
public void test() {
/*
ZLTextParagraph paragraph = factory.createParagraph();
paragraph.addEntry(factory.createTextEntry("marina1"));
paragraph.addEntry(factory.createTextEntry("marina2"));
assertEquals(paragraph.getEntryNumber(), 2);
assertEquals(paragraph.getTextLength(),14);
*/
}
}
| [
"852041173@qq.com"
] | 852041173@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.