blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7122e8ba872742e22fe1ff801807fde2374d39e8 | 8daeb7879fef7f8651acbf6e3474662af66163c4 | /src/asafov/com/IsBeautifulString.java | b560bf5706e46d068b3d4d032f367f95c5c2ec24 | []
| no_license | naum43312016/CodeSignal-ProblemSolving | 8ecd5b464d5c832ddf46ddfc7e94e66297f317a3 | d15d528d8c6a98a8844070efbdd46086b764002f | refs/heads/master | 2021-05-16T19:13:16.224762 | 2020-06-02T20:53:32 | 2020-06-02T20:53:32 | 250,434,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package asafov.com;
import java.util.HashMap;
import java.util.Map;
public class IsBeautifulString {
static boolean isBeautifulString(String inputString) {
Map<Character,Integer> map = new HashMap<>();
for(char ch : inputString.toCharArray()){
map.put(ch,map.getOrDefault(ch,0)+1);
}
for (Map.Entry<Character,Integer> entry : map.entrySet()){
char let = entry.getKey();
int freq = entry.getValue();
if (let!='a'){
char prev = (char)(((int)let)-1);
if (!map.containsKey(prev)){
return false;
}else {
int count = map.get(prev);
if (count<freq) return false;
}
}
}
return true;
}
public static void main(String[] args) {
System.out.println(isBeautifulString("aabbb"));
}
}
| [
"[email protected]"
]
| |
a61d6f4b082ad303fb131a5a3ade37214e69262d | d4692be261739742257f24bd4df17defd70ce4de | /src/dao/storeDao/CategoryDao.java | c9ce0b075244109ba5ffbbc3772e3c3a782c04cd | []
| no_license | dd1227514920/SCM | 053253e29a95b2b8587df10a8724f02188f694d0 | bde80081d1927828cd0d329d7e70c40f3cb11ed1 | refs/heads/master | 2020-03-16T14:55:08.175562 | 2017-09-10T09:10:34 | 2017-09-10T09:10:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,560 | java | package dao.storeDao;
import model.storeModel.Category;
import util.DBUtil;
import java.sql.*;
import java.util.ArrayList;
/**
* Created by leo on 2017/6/29.
*/
public class CategoryDao {
public ArrayList<Category> query(){
ArrayList<Category> al=new ArrayList<Category>();
Connection conn= DBUtil.getConnection();
Statement stat=null;
ResultSet rs=null;
String sql="select * from category";
try {
stat=conn.createStatement();
rs=stat.executeQuery(sql);//发送查询语句生成ResultSet对象
while(rs.next()){
int categoryId=rs.getInt("CategoryID");
String name=rs.getString("Name");
String remark=rs.getString("Remark");
Category cate=new Category(categoryId,name,remark);
al.add(cate);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
DBUtil.close(rs, stat,conn);
}
return al;
}
public void addCategory(Category category){
Connection conn= DBUtil.getConnection();
PreparedStatement ps=null;
String sql="insert into category values(?,?,?)";
try {
ps=conn.prepareStatement(sql);
ps.setInt(1,category.getCategoryId());
ps.setString(2,category.getName());
ps.setString(3,category.getRemark());
ps.executeUpdate();
System.out.println("add succeed");
} catch (SQLException e) {
e.printStackTrace();
System.out.println("add failed");
}finally {
DBUtil.close(null,ps,conn);
}
}
public boolean deleteCategoryQuery(int categoryId){
boolean flag=false;
Connection conn= DBUtil.getConnection();
Statement stat=null;
ResultSet rs=null;
//先根据categoryId查询一下product表里是否含有数据,含有数据则不可删除
String sql="select * from product where CategoryID="+categoryId;
try {
stat=conn.createStatement();
rs=stat.executeQuery(sql);
if(rs.next()){
flag=true;
}
} catch (SQLException e) {
e.printStackTrace();
}finally {
DBUtil.close(rs,stat,conn);
}
return flag;
}
public void deleteCategory(int categoryId){
Connection conn= DBUtil.getConnection();
PreparedStatement ps=null;
String sql="delete from category where CategoryID=?";
try {
ps=conn.prepareStatement(sql);
ps.setInt(1,categoryId);
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}finally {
DBUtil.close(null,ps,conn);
}
}
public void updateCategory(Category category){
Connection conn= DBUtil.getConnection();
PreparedStatement ps=null;
String sql="update category set Name=?,Remark=? where CategoryID=?";
try {
ps=conn.prepareStatement(sql);
ps.setString(1,category.getName());
ps.setString(2,category.getRemark());
ps.setInt(3,category.getCategoryId());
ps.executeUpdate();
System.out.println("update succeed");
} catch (SQLException e) {
e.printStackTrace();
System.out.println("update failed");
}finally {
DBUtil.close(null,ps,conn);
}
}
}
| [
"[email protected]"
]
| |
ab71b1c986a496d8abe2e0e9df8cfe891ca329fa | ee8958533f72272c54474d2f8e9b71802244baef | /android/SmsBlocker/src/com/angelstone/android/smsblocker/provider/SmsBlockerProvider.java | 5c94e7ac95d2cf86d9b922ef92d4837b574a3add | []
| no_license | stonewell/mobilegdatasync | 0aa1a1f3599e00ab7395321b0513e3cb4e287299 | b70aa8de82402e6d7bf59a06e9d20c809b89762f | refs/heads/master | 2020-05-30T01:13:30.518889 | 2011-06-11T13:09:53 | 2011-06-11T13:09:53 | 32,113,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package com.angelstone.android.smsblocker.provider;
import java.util.ArrayList;
import java.util.List;
import com.angelstone.android.database.Entity;
import com.angelstone.android.database.GenericContentProvider;
import com.angelstone.android.database.GenericDatabaseHelper;
import com.angelstone.android.phonetools.store.BlackList;
import com.angelstone.android.phonetools.store.EventLog;
import com.angelstone.android.phonetools.store.Setting;
import com.angelstone.android.smsblocker.store.DatabaseValues;
public class SmsBlockerProvider extends GenericContentProvider implements
DatabaseValues {
@Override
public boolean onCreate() {
List<Entity> args = new ArrayList<Entity>();
args.add(new BlackList());
args.add(new EventLog());
args.add(new Setting());
mOpenHelper = new GenericDatabaseHelper(getContext(), DATABASE_NAME,
DATABASE_VERSION, args);
initialize(AUTHORITY, args);
return true;
}
}
| [
"[email protected]"
]
| |
0fb70d3af8b7520d0cfc6c8b3615f503861ccfb9 | 2294d667dcdadf90349a99ea3ad9b710f9767aa7 | /eclipse-workspace/Java22_Event/src/com/event/part02_howToUse/B_Run.java | 17acd0dd0fa3af03666684926e1bb58a90502cc2 | []
| no_license | lafayetteey/WorkSpace_Java | a3a8ef4e6d9b29502350de2ec76f558f729530f1 | ec2e0df912190495cd2013c6750eee59ef91b9c2 | refs/heads/master | 2022-11-29T05:26:15.233522 | 2020-08-05T03:32:13 | 2020-08-05T03:32:13 | 258,063,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package com.event.part02_howToUse;
public class B_Run {
public static void main(String[] args) {
new B_OtherClass();
}
}
| [
"[email protected]"
]
| |
e75918009e80cd0254523cda221b56c67d1ae70b | 2c835746382fc93391a7be909fd189ef0f3516bb | /src/entites/Funcionario.java | b0936b0fa293b6b2ab65dda9097579b012e48ce7 | []
| no_license | pauloricardolongi/ccc1 | b56127d161015d9ed55539c6e9a51fa83409a94d | 8b05c002134d2eb382eb69873c180012009b59a8 | refs/heads/master | 2023-04-22T09:52:11.317339 | 2021-05-13T03:33:49 | 2021-05-13T03:33:49 | 366,920,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 799 | java | package entites;
public class Funcionario {
private Integer id;
private String nome;
private Double salario;
public Funcionario() {
}
public Funcionario(Integer id, String nome, Double salario) {
this.id = id;
this.nome = nome;
this.salario = salario;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Double getSalario() {
return salario;
}
public void setSalario(Double salario) {
this.salario = salario;
}
public void aumentarSalario(double porcentagem) {
salario += salario * porcentagem / 100.0;
}
public String toString() {
return id + "," + nome + ","
+ String.format("%.2f",salario);
}
}
| [
"[email protected]"
]
| |
853cfbcae3d396807c65cf287d7f29f1c8d949a5 | aeef2494b283012ed619870c4275e7d015f4017a | /sdk/java/src/main/java/com/pulumi/gcp/dataloss/inputs/PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs.java | cdde8a4421edf7e6b321f749c05a779f79729a6a | [
"BSD-3-Clause",
"MPL-2.0",
"Apache-2.0"
]
| permissive | pulumi/pulumi-gcp | d4fd3f80c3df5290edaf33eb5eafe34e6699d0ff | 7deea0a50a4ee5ab7bd722a83eca01707e298f85 | refs/heads/master | 2023-08-31T07:12:45.921522 | 2023-08-31T06:16:27 | 2023-08-31T06:16:27 | 97,485,806 | 160 | 63 | Apache-2.0 | 2023-09-14T19:49:36 | 2017-07-17T14:28:37 | Java | UTF-8 | Java | false | false | 2,833 | java | // *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.gcp.dataloss.inputs;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import java.lang.String;
import java.util.Objects;
public final class PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs extends com.pulumi.resources.ResourceArgs {
public static final PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs Empty = new PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs();
/**
* Name describing the field.
*
*/
@Import(name="name", required=true)
private Output<String> name;
/**
* @return Name describing the field.
*
*/
public Output<String> name() {
return this.name;
}
private PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs() {}
private PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs(PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs $) {
this.name = $.name;
}
public static Builder builder() {
return new Builder();
}
public static Builder builder(PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs defaults) {
return new Builder(defaults);
}
public static final class Builder {
private PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs $;
public Builder() {
$ = new PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs();
}
public Builder(PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs defaults) {
$ = new PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs(Objects.requireNonNull(defaults));
}
/**
* @param name Name describing the field.
*
* @return builder
*
*/
public Builder name(Output<String> name) {
$.name = name;
return this;
}
/**
* @param name Name describing the field.
*
* @return builder
*
*/
public Builder name(String name) {
return name(Output.of(name));
}
public PreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldArgs build() {
$.name = Objects.requireNonNull($.name, "expected parameter 'name' to be non-null");
return $;
}
}
}
| [
"[email protected]"
]
| |
264bd0f45d3bc5dcd6d9a30ba98fabdaf811b127 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/test/org/pac4j/core/profile/converter/ColorConverterTests.java | 6187e5421e56e53c6dfcfb9e201a42479d1b07bd | []
| no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 1,672 | java | package org.pac4j.core.profile.converter;
import org.junit.Assert;
import org.junit.Test;
import org.pac4j.core.profile.Color;
/**
* This class tests the {@link ColorConverter} class.
*
* @author Jerome Leleu
* @since 1.1.0
*/
public final class ColorConverterTests {
private static final String BAD_LENGTH_COLOR = "12345";
private static final String BAD_COLOR = "zzzzzz";
private static final String GOOD_COLOR = "FF0005";
private final ColorConverter converter = new ColorConverter();
@Test
public void testNull() {
Assert.assertNull(this.converter.convert(null));
}
@Test
public void testNotAString() {
Assert.assertNull(this.converter.convert(Boolean.TRUE));
}
@Test
public void testStringBadLength() {
Assert.assertNull(this.converter.convert(ColorConverterTests.BAD_LENGTH_COLOR));
}
@Test
public void testBadString() {
Assert.assertNull(this.converter.convert(ColorConverterTests.BAD_COLOR));
}
@Test
public void testGoodString() {
final Color color = this.converter.convert(ColorConverterTests.GOOD_COLOR);
Assert.assertEquals(255, color.getRed());
Assert.assertEquals(0, color.getGreen());
Assert.assertEquals(5, color.getBlue());
}
@Test
public void testColorToString() {
final Color color = new Color(10, 20, 30);
final Color color2 = this.converter.convert(color.toString());
Assert.assertEquals(color.getRed(), color2.getRed());
Assert.assertEquals(color.getGreen(), color2.getGreen());
Assert.assertEquals(color.getBlue(), color2.getBlue());
}
}
| [
"[email protected]"
]
| |
a907bc1660c8b0e9c4485e1580c3af8dfa759693 | 0bf8d5ec6d47467e941a2b1e49f6a5f2442f3f10 | /app/src/main/java/com/control/yourself/db/DbUtils.java | 13d2d353e2190f1df4fe6cfc50209e7377dd2b21 | []
| no_license | Yorashe/ControlYourSelf | 63f6944ca877f9e2ca1623c1f49dcddd06554b8b | d45fe8989d827fca7e6b48936dbd1b0265a9b9c8 | refs/heads/master | 2020-06-03T10:58:29.354094 | 2019-06-14T06:32:54 | 2019-06-14T06:32:54 | 191,542,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,722 | java | package com.control.yourself.db;
import android.app.AlarmManager;
import android.app.Application;
import com.control.yourself.MyApplication;
import com.control.yourself.greendao.Entity.RemindBean;
import com.control.yourself.greendao.Entity.UserBean;
import com.control.yourself.greendao.gen.DaoSession;
import com.control.yourself.greendao.gen.RemindBeanDao;
import com.control.yourself.greendao.gen.UserBeanDao;
import org.greenrobot.greendao.query.QueryBuilder;
import java.util.List;
/**
* Created by Yorashe on 19-6-13.
*/
public class DbUtils {
public static UserBean queryUserByName(String name){
DaoSession daoSession = MyApplication.getInstance().getDaoSession();
QueryBuilder<UserBean> qb = daoSession.queryBuilder(UserBean.class);
QueryBuilder<UserBean> studentQueryBuilder = qb.where(UserBeanDao.Properties.Name.eq(name)).orderAsc(UserBeanDao.Properties.Name);
List<UserBean> userBeans = studentQueryBuilder.list(); //查出当前对应的数据
if (userBeans==null || userBeans.isEmpty()){
return null;
}
return userBeans.get(0);
}
public static void regist(UserBean user){
UserBeanDao daoSession = MyApplication.getInstance().getDaoSession().getUserBeanDao();
daoSession.insert(user);
}
public static void save(UserBean user){
UserBeanDao daoSession = MyApplication.getInstance().getDaoSession().getUserBeanDao();
daoSession.delete(MyApplication.getUserItem());
daoSession.insert(user);
}
public static void addMessage(RemindBean remindBean){
RemindBeanDao remindBeanDao = MyApplication.getInstance().getDaoSession().getRemindBeanDao();
remindBeanDao.insert(remindBean);
}
public static void deleteMessage(RemindBean remindBean){
RemindBeanDao remindBeanDao = MyApplication.getInstance().getDaoSession().getRemindBeanDao();
remindBeanDao.delete(remindBean);
}
public static void setTime(RemindBean remindBean){
RemindBeanDao remindBeanDao = MyApplication.getInstance().getDaoSession().getRemindBeanDao();
// remindBeanDao.delete(remindBean);
remindBeanDao.update(remindBean);
}
public static List<RemindBean> queryMessage(String name){
DaoSession daoSession = MyApplication.getInstance().getDaoSession();
QueryBuilder<RemindBean> qb = daoSession.queryBuilder(RemindBean.class);
QueryBuilder<RemindBean> studentQueryBuilder = qb.where(RemindBeanDao.Properties.Name.eq(name)).orderAsc(RemindBeanDao.Properties.Name);
List<RemindBean> remindBeanDaos = studentQueryBuilder.list(); //查出当前对应的数据
return remindBeanDaos;
}
}
| [
"[email protected]"
]
| |
39aa2105ffe9ff6f2c29da12312e04c31056e42a | abfe4c41fa530e653bd9dbadd888a7799e5fb424 | /src/graphAlgorithms/unweighted/FixedGraph.java | 34ebb0009df4f5bf8a5d862c6caf70474b886d66 | []
| no_license | DimitarHKostov/DSA | eae2e90a74a7b6a5f73fcfb38a28e9a7c37dd6b4 | e0d881bb1dee8a57704653803ba8792dd31757b5 | refs/heads/master | 2023-05-11T13:28:45.507487 | 2021-06-03T15:53:05 | 2021-06-03T15:53:05 | 373,262,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package graphAlgorithms.unweighted;
public class FixedGraph {
private static final DirectedGraph directedGraph = initialize();
private static DirectedGraph initialize() {
DirectedGraph graph = new DirectedGraph();
graph.addEdge(0, 1);
graph.addEdge(0, 2);
graph.addEdge(0, 3);
graph.addEdge(1, 2);
graph.addEdge(2, 3);
graph.addEdge(3,4);
graph.addEdge(3,5);
return graph;
}
public static DirectedGraph getInstance() {
return directedGraph;
}
}
| [
"[email protected]"
]
| |
861ba76ee966aed84d5fd24c228c9a397def608b | eb5f5353f49ee558e497e5caded1f60f32f536b5 | /com/sun/xml/internal/ws/encoding/xml/XMLMessage.java | 5286426409cc3dd1fa5e13d88ec82c6194f41796 | []
| no_license | mohitrajvardhan17/java1.8.0_151 | 6fc53e15354d88b53bd248c260c954807d612118 | 6eeab0c0fd20be34db653f4778f8828068c50c92 | refs/heads/master | 2020-03-18T09:44:14.769133 | 2018-05-23T14:28:24 | 2018-05-23T14:28:24 | 134,578,186 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 19,347 | java | package com.sun.xml.internal.ws.encoding.xml;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.bind.api.Bridge;
import com.sun.xml.internal.ws.api.SOAPVersion;
import com.sun.xml.internal.ws.api.WSFeatureList;
import com.sun.xml.internal.ws.api.message.Attachment;
import com.sun.xml.internal.ws.api.message.AttachmentSet;
import com.sun.xml.internal.ws.api.message.HeaderList;
import com.sun.xml.internal.ws.api.message.Message;
import com.sun.xml.internal.ws.api.message.MessageHeaders;
import com.sun.xml.internal.ws.api.message.Messages;
import com.sun.xml.internal.ws.api.message.Packet;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
import com.sun.xml.internal.ws.api.pipe.Codec;
import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory;
import com.sun.xml.internal.ws.developer.StreamingAttachmentFeature;
import com.sun.xml.internal.ws.encoding.MimeMultipartParser;
import com.sun.xml.internal.ws.encoding.XMLHTTPBindingCodec;
import com.sun.xml.internal.ws.message.AbstractMessageImpl;
import com.sun.xml.internal.ws.message.EmptyMessageImpl;
import com.sun.xml.internal.ws.message.MimeAttachmentSet;
import com.sun.xml.internal.ws.message.source.PayloadSourceMessage;
import com.sun.xml.internal.ws.util.ByteArrayBuffer;
import com.sun.xml.internal.ws.util.StreamUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.activation.DataSource;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.WebServiceException;
import org.xml.sax.ContentHandler;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
public final class XMLMessage
{
private static final int PLAIN_XML_FLAG = 1;
private static final int MIME_MULTIPART_FLAG = 2;
private static final int FI_ENCODED_FLAG = 16;
public XMLMessage() {}
public static Message create(String paramString, InputStream paramInputStream, WSFeatureList paramWSFeatureList)
{
Object localObject;
try
{
paramInputStream = StreamUtils.hasSomeData(paramInputStream);
if (paramInputStream == null) {
return Messages.createEmpty(SOAPVersion.SOAP_11);
}
if (paramString != null)
{
com.sun.xml.internal.ws.encoding.ContentType localContentType = new com.sun.xml.internal.ws.encoding.ContentType(paramString);
int i = identifyContentType(localContentType);
if ((i & 0x2) != 0) {
localObject = new XMLMultiPart(paramString, paramInputStream, paramWSFeatureList);
} else if ((i & 0x1) != 0) {
localObject = new XmlContent(paramString, paramInputStream, paramWSFeatureList);
} else {
localObject = new UnknownContent(paramString, paramInputStream);
}
}
else
{
localObject = new UnknownContent("application/octet-stream", paramInputStream);
}
}
catch (Exception localException)
{
throw new WebServiceException(localException);
}
return (Message)localObject;
}
public static Message create(Source paramSource)
{
return paramSource == null ? Messages.createEmpty(SOAPVersion.SOAP_11) : Messages.createUsingPayload(paramSource, SOAPVersion.SOAP_11);
}
public static Message create(DataSource paramDataSource, WSFeatureList paramWSFeatureList)
{
try
{
return paramDataSource == null ? Messages.createEmpty(SOAPVersion.SOAP_11) : create(paramDataSource.getContentType(), paramDataSource.getInputStream(), paramWSFeatureList);
}
catch (IOException localIOException)
{
throw new WebServiceException(localIOException);
}
}
public static Message create(Exception paramException)
{
return new FaultMessage(SOAPVersion.SOAP_11);
}
private static int getContentId(String paramString)
{
try
{
com.sun.xml.internal.ws.encoding.ContentType localContentType = new com.sun.xml.internal.ws.encoding.ContentType(paramString);
return identifyContentType(localContentType);
}
catch (Exception localException)
{
throw new WebServiceException(localException);
}
}
public static boolean isFastInfoset(String paramString)
{
return (getContentId(paramString) & 0x10) != 0;
}
public static int identifyContentType(com.sun.xml.internal.ws.encoding.ContentType paramContentType)
{
String str1 = paramContentType.getPrimaryType();
String str2 = paramContentType.getSubType();
if ((str1.equalsIgnoreCase("multipart")) && (str2.equalsIgnoreCase("related")))
{
String str3 = paramContentType.getParameter("type");
if (str3 != null)
{
if (isXMLType(str3)) {
return 3;
}
if (isFastInfosetType(str3)) {
return 18;
}
}
return 0;
}
if (isXMLType(str1, str2)) {
return 1;
}
if (isFastInfosetType(str1, str2)) {
return 16;
}
return 0;
}
protected static boolean isXMLType(@NotNull String paramString1, @NotNull String paramString2)
{
return ((paramString1.equalsIgnoreCase("text")) && (paramString2.equalsIgnoreCase("xml"))) || ((paramString1.equalsIgnoreCase("application")) && (paramString2.equalsIgnoreCase("xml"))) || ((paramString1.equalsIgnoreCase("application")) && (paramString2.toLowerCase().endsWith("+xml")));
}
protected static boolean isXMLType(String paramString)
{
String str = paramString.toLowerCase();
return (str.startsWith("text/xml")) || (str.startsWith("application/xml")) || ((str.startsWith("application/")) && (str.indexOf("+xml") != -1));
}
protected static boolean isFastInfosetType(String paramString1, String paramString2)
{
return (paramString1.equalsIgnoreCase("application")) && (paramString2.equalsIgnoreCase("fastinfoset"));
}
protected static boolean isFastInfosetType(String paramString)
{
return paramString.toLowerCase().startsWith("application/fastinfoset");
}
public static DataSource getDataSource(Message paramMessage, WSFeatureList paramWSFeatureList)
{
if (paramMessage == null) {
return null;
}
if ((paramMessage instanceof MessageDataSource)) {
return ((MessageDataSource)paramMessage).getDataSource();
}
AttachmentSet localAttachmentSet = paramMessage.getAttachments();
if ((localAttachmentSet != null) && (!localAttachmentSet.isEmpty()))
{
localByteArrayBuffer = new ByteArrayBuffer();
try
{
XMLHTTPBindingCodec localXMLHTTPBindingCodec = new XMLHTTPBindingCodec(paramWSFeatureList);
Packet localPacket = new Packet(paramMessage);
com.sun.xml.internal.ws.api.pipe.ContentType localContentType = localXMLHTTPBindingCodec.getStaticContentType(localPacket);
localXMLHTTPBindingCodec.encode(localPacket, localByteArrayBuffer);
return createDataSource(localContentType.getContentType(), localByteArrayBuffer.newInputStream());
}
catch (IOException localIOException)
{
throw new WebServiceException(localIOException);
}
}
ByteArrayBuffer localByteArrayBuffer = new ByteArrayBuffer();
XMLStreamWriter localXMLStreamWriter = XMLStreamWriterFactory.create(localByteArrayBuffer);
try
{
paramMessage.writePayloadTo(localXMLStreamWriter);
localXMLStreamWriter.flush();
}
catch (XMLStreamException localXMLStreamException)
{
throw new WebServiceException(localXMLStreamException);
}
return createDataSource("text/xml", localByteArrayBuffer.newInputStream());
}
public static DataSource createDataSource(String paramString, InputStream paramInputStream)
{
return new XmlDataSource(paramString, paramInputStream);
}
private static class FaultMessage
extends EmptyMessageImpl
{
public FaultMessage(SOAPVersion paramSOAPVersion)
{
super();
}
public boolean isFault()
{
return true;
}
}
public static abstract interface MessageDataSource
{
public abstract boolean hasUnconsumedDataSource();
public abstract DataSource getDataSource();
}
public static class UnknownContent
extends AbstractMessageImpl
implements XMLMessage.MessageDataSource
{
private final DataSource ds;
private final HeaderList headerList;
public UnknownContent(String paramString, InputStream paramInputStream)
{
this(XMLMessage.createDataSource(paramString, paramInputStream));
}
public UnknownContent(DataSource paramDataSource)
{
super();
ds = paramDataSource;
headerList = new HeaderList(SOAPVersion.SOAP_11);
}
private UnknownContent(UnknownContent paramUnknownContent)
{
super();
ds = ds;
headerList = HeaderList.copy(headerList);
}
public boolean hasUnconsumedDataSource()
{
return true;
}
public DataSource getDataSource()
{
assert (ds != null);
return ds;
}
protected void writePayloadTo(ContentHandler paramContentHandler, ErrorHandler paramErrorHandler, boolean paramBoolean)
throws SAXException
{
throw new UnsupportedOperationException();
}
public boolean hasHeaders()
{
return false;
}
public boolean isFault()
{
return false;
}
public MessageHeaders getHeaders()
{
return headerList;
}
public String getPayloadLocalPart()
{
throw new UnsupportedOperationException();
}
public String getPayloadNamespaceURI()
{
throw new UnsupportedOperationException();
}
public boolean hasPayload()
{
return false;
}
public Source readPayloadAsSource()
{
return null;
}
public XMLStreamReader readPayload()
throws XMLStreamException
{
throw new WebServiceException("There isn't XML payload. Shouldn't come here.");
}
public void writePayloadTo(XMLStreamWriter paramXMLStreamWriter)
throws XMLStreamException
{}
public Message copy()
{
return new UnknownContent(this);
}
}
public static final class XMLMultiPart
extends AbstractMessageImpl
implements XMLMessage.MessageDataSource
{
private final DataSource dataSource;
private final StreamingAttachmentFeature feature;
private Message delegate;
private HeaderList headerList = new HeaderList(SOAPVersion.SOAP_11);
private final WSFeatureList features;
public XMLMultiPart(String paramString, InputStream paramInputStream, WSFeatureList paramWSFeatureList)
{
super();
dataSource = XMLMessage.createDataSource(paramString, paramInputStream);
feature = ((StreamingAttachmentFeature)paramWSFeatureList.get(StreamingAttachmentFeature.class));
features = paramWSFeatureList;
}
private Message getMessage()
{
if (delegate == null)
{
MimeMultipartParser localMimeMultipartParser;
try
{
localMimeMultipartParser = new MimeMultipartParser(dataSource.getInputStream(), dataSource.getContentType(), feature);
}
catch (IOException localIOException)
{
throw new WebServiceException(localIOException);
}
InputStream localInputStream = localMimeMultipartParser.getRootPart().asInputStream();
assert (localInputStream != null);
delegate = new PayloadSourceMessage(headerList, new StreamSource(localInputStream), new MimeAttachmentSet(localMimeMultipartParser), SOAPVersion.SOAP_11);
}
return delegate;
}
public boolean hasUnconsumedDataSource()
{
return delegate == null;
}
public DataSource getDataSource()
{
return hasUnconsumedDataSource() ? dataSource : XMLMessage.getDataSource(getMessage(), features);
}
public boolean hasHeaders()
{
return false;
}
@NotNull
public MessageHeaders getHeaders()
{
return headerList;
}
public String getPayloadLocalPart()
{
return getMessage().getPayloadLocalPart();
}
public String getPayloadNamespaceURI()
{
return getMessage().getPayloadNamespaceURI();
}
public boolean hasPayload()
{
return true;
}
public boolean isFault()
{
return false;
}
public Source readEnvelopeAsSource()
{
return getMessage().readEnvelopeAsSource();
}
public Source readPayloadAsSource()
{
return getMessage().readPayloadAsSource();
}
public SOAPMessage readAsSOAPMessage()
throws SOAPException
{
return getMessage().readAsSOAPMessage();
}
public SOAPMessage readAsSOAPMessage(Packet paramPacket, boolean paramBoolean)
throws SOAPException
{
return getMessage().readAsSOAPMessage(paramPacket, paramBoolean);
}
public <T> T readPayloadAsJAXB(Unmarshaller paramUnmarshaller)
throws JAXBException
{
return (T)getMessage().readPayloadAsJAXB(paramUnmarshaller);
}
public <T> T readPayloadAsJAXB(Bridge<T> paramBridge)
throws JAXBException
{
return (T)getMessage().readPayloadAsJAXB(paramBridge);
}
public XMLStreamReader readPayload()
throws XMLStreamException
{
return getMessage().readPayload();
}
public void writePayloadTo(XMLStreamWriter paramXMLStreamWriter)
throws XMLStreamException
{
getMessage().writePayloadTo(paramXMLStreamWriter);
}
public void writeTo(XMLStreamWriter paramXMLStreamWriter)
throws XMLStreamException
{
getMessage().writeTo(paramXMLStreamWriter);
}
public void writeTo(ContentHandler paramContentHandler, ErrorHandler paramErrorHandler)
throws SAXException
{
getMessage().writeTo(paramContentHandler, paramErrorHandler);
}
public Message copy()
{
return getMessage().copy();
}
protected void writePayloadTo(ContentHandler paramContentHandler, ErrorHandler paramErrorHandler, boolean paramBoolean)
throws SAXException
{
throw new UnsupportedOperationException();
}
public boolean isOneWay(@NotNull WSDLPort paramWSDLPort)
{
return false;
}
@NotNull
public AttachmentSet getAttachments()
{
return getMessage().getAttachments();
}
}
private static class XmlContent
extends AbstractMessageImpl
implements XMLMessage.MessageDataSource
{
private final XMLMessage.XmlDataSource dataSource;
private boolean consumed;
private Message delegate;
private final HeaderList headerList;
private WSFeatureList features;
public XmlContent(String paramString, InputStream paramInputStream, WSFeatureList paramWSFeatureList)
{
super();
dataSource = new XMLMessage.XmlDataSource(paramString, paramInputStream);
headerList = new HeaderList(SOAPVersion.SOAP_11);
features = paramWSFeatureList;
}
private Message getMessage()
{
if (delegate == null)
{
InputStream localInputStream = dataSource.getInputStream();
assert (localInputStream != null);
delegate = Messages.createUsingPayload(new StreamSource(localInputStream), SOAPVersion.SOAP_11);
consumed = true;
}
return delegate;
}
public boolean hasUnconsumedDataSource()
{
return (!dataSource.consumed()) && (!consumed);
}
public DataSource getDataSource()
{
return hasUnconsumedDataSource() ? dataSource : XMLMessage.getDataSource(getMessage(), features);
}
public boolean hasHeaders()
{
return false;
}
@NotNull
public MessageHeaders getHeaders()
{
return headerList;
}
public String getPayloadLocalPart()
{
return getMessage().getPayloadLocalPart();
}
public String getPayloadNamespaceURI()
{
return getMessage().getPayloadNamespaceURI();
}
public boolean hasPayload()
{
return true;
}
public boolean isFault()
{
return false;
}
public Source readEnvelopeAsSource()
{
return getMessage().readEnvelopeAsSource();
}
public Source readPayloadAsSource()
{
return getMessage().readPayloadAsSource();
}
public SOAPMessage readAsSOAPMessage()
throws SOAPException
{
return getMessage().readAsSOAPMessage();
}
public SOAPMessage readAsSOAPMessage(Packet paramPacket, boolean paramBoolean)
throws SOAPException
{
return getMessage().readAsSOAPMessage(paramPacket, paramBoolean);
}
public <T> T readPayloadAsJAXB(Unmarshaller paramUnmarshaller)
throws JAXBException
{
return (T)getMessage().readPayloadAsJAXB(paramUnmarshaller);
}
/**
* @deprecated
*/
public <T> T readPayloadAsJAXB(Bridge<T> paramBridge)
throws JAXBException
{
return (T)getMessage().readPayloadAsJAXB(paramBridge);
}
public XMLStreamReader readPayload()
throws XMLStreamException
{
return getMessage().readPayload();
}
public void writePayloadTo(XMLStreamWriter paramXMLStreamWriter)
throws XMLStreamException
{
getMessage().writePayloadTo(paramXMLStreamWriter);
}
public void writeTo(XMLStreamWriter paramXMLStreamWriter)
throws XMLStreamException
{
getMessage().writeTo(paramXMLStreamWriter);
}
public void writeTo(ContentHandler paramContentHandler, ErrorHandler paramErrorHandler)
throws SAXException
{
getMessage().writeTo(paramContentHandler, paramErrorHandler);
}
public Message copy()
{
return getMessage().copy();
}
protected void writePayloadTo(ContentHandler paramContentHandler, ErrorHandler paramErrorHandler, boolean paramBoolean)
throws SAXException
{
throw new UnsupportedOperationException();
}
}
private static class XmlDataSource
implements DataSource
{
private final String contentType;
private final InputStream is;
private boolean consumed;
XmlDataSource(String paramString, InputStream paramInputStream)
{
contentType = paramString;
is = paramInputStream;
}
public boolean consumed()
{
return consumed;
}
public InputStream getInputStream()
{
consumed = (!consumed);
return is;
}
public OutputStream getOutputStream()
{
return null;
}
public String getContentType()
{
return contentType;
}
public String getName()
{
return "";
}
}
}
/* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\com\sun\xml\internal\ws\encoding\xml\XMLMessage.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
fe6fa119567da8dbb3a303a44279937546bcf32a | 43176d2d52b2c272c19016ecee63e83528eafe06 | /Restaurant/src/redixbit/restaurant/About.java | d887ba88b441bc4fb6d620cac23da46a3c82b080 | []
| no_license | KNIGHTTH0R/Eatsy | 35a1da95ede626e66e9dc6f909587255d26e727e | 0922885cd395f44b08d5eca12d4bae3755d16e57 | refs/heads/master | 2021-06-18T16:57:04.532143 | 2017-06-05T06:32:08 | 2017-06-05T06:32:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,486 | java | package redixbit.restaurant;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class About extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
if (getString(R.string.about_banner).equals("yes")) {
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.about, menu);
return true;
}
@Override
public void onBackPressed() {
super.onBackPressed();
/*
* Intent iv = new Intent(About.this, Home.class);
* iv.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
* Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(iv);
*/
}
@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);
}
}
| [
"[email protected]"
]
| |
1ee1fa4071c89d7a584c4c263ae1969a1efec04f | 9acc9dec34e2565d4a483a37868dba276f201d2b | /credentialstore/src/main/java/com/sos/keepass/SOSKeePassDatabase.java | 8a9913b3b9572150dbc257b971903c94abc18418 | []
| no_license | sudhakarvenkatesh/commons | 8c05bd502eabceed588b8d6142220af7436e0e74 | ac95ddfbd1fcf26ea03d5c4439dbd2bd6e1f3eea | refs/heads/master | 2020-04-27T03:43:52.160011 | 2018-03-23T14:40:27 | 2018-03-23T14:40:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,275 | java | package com.sos.keepass;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.List;
import org.linguafranca.pwdb.Credentials;
import org.linguafranca.pwdb.Database;
import org.linguafranca.pwdb.Entry;
import org.linguafranca.pwdb.kdb.KdbCredentials;
import org.linguafranca.pwdb.kdb.KdbDatabase;
import org.linguafranca.pwdb.kdb.KdbEntry;
import org.linguafranca.pwdb.kdbx.KdbxCreds;
import org.linguafranca.pwdb.kdbx.simple.SimpleDatabase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sos.util.SOSString;
public class SOSKeePassDatabase {
private static final Logger LOGGER = LoggerFactory.getLogger(SOSKeePassDatabase.class);
/* see KdbDatabase constructor: KDB files don't have a single root group, this is a synthetic surrogate */
public static final String KDB_ROOT_GROUP_NAME = "Root";
public static final String KDB_GROUP_TITLE = "Meta-Info";
public static final String STANDARD_PROPERTY_NAME_ATTACHMENT = "Attachment";
private Path _file;
private boolean _isKdbx;
private Database<?, ?, ?, ?> _database;
public SOSKeePassDatabase(final Path file) throws SOSKeePassDatabaseException {
if (file == null) {
throw new SOSKeePassDatabaseException("KeePass file is null");
}
_file = file;
_isKdbx = file.toString().toLowerCase().endsWith(".kdbx");
LOGGER.debug(String.format("file=%s, isKdbx=%s", _file, _isKdbx));
}
public void load(final String password) throws SOSKeePassDatabaseException {
load(password, null);
}
public void load(final String password, final Path keyFile) throws SOSKeePassDatabaseException {
LOGGER.debug(String.format("password=?, keyFile=%s", keyFile));
if (_isKdbx) {
_database = getKDBXDatabase(password, keyFile);
} else {
_database = getKDBDatabase(password, keyFile);
}
}
public List<? extends Entry<?, ?, ?, ?>> getEntries() {
LOGGER.debug(String.format("getEntries"));
if (_database == null) {
return null;
}
if (_isKdbx) {
return _database.findEntries("");
} else {
return _database.findEntries(new Entry.Matcher() {
public boolean matches(@SuppressWarnings("rawtypes") Entry entry) {
return !entry.getTitle().equals(KDB_GROUP_TITLE);
}
});
}
}
public List<? extends Entry<?, ?, ?, ?>> getEntriesByTitle(final String match) {
LOGGER.debug(String.format("match=%s", match));
if (_database == null) {
return null;
}
return _database.findEntries(new Entry.Matcher() {
public boolean matches(@SuppressWarnings("rawtypes") Entry entry) {
return entry.getTitle().matches(match == null ? "" : match);
}
});
}
public List<? extends Entry<?, ?, ?, ?>> getEntriesByUsername(final String match) {
LOGGER.debug(String.format("match=%s", match));
if (_database == null) {
return null;
}
return _database.findEntries(new Entry.Matcher() {
public boolean matches(@SuppressWarnings("rawtypes") Entry entry) {
return entry.getUsername().matches(match == null ? "" : match);
}
});
}
public List<? extends Entry<?, ?, ?, ?>> getEntriesByUrl(final String match) {
LOGGER.debug(String.format("match=%s", match));
if (_database == null) {
return null;
}
return _database.findEntries(new Entry.Matcher() {
public boolean matches(@SuppressWarnings("rawtypes") Entry entry) {
return entry.getUrl().matches(match == null ? "" : match);
}
});
}
public Entry<?, ?, ?, ?> getEntryByPath(final String path) {
LOGGER.debug(String.format("path=%s", path));
if (_database == null || path == null) {
return null;
}
List<? extends Entry<?, ?, ?, ?>> l = _database.findEntries(new Entry.Matcher() {
public boolean matches(@SuppressWarnings("rawtypes") Entry entry) {
String p = path.startsWith("/") ? path : "/" + path;
return _isKdbx ? entry.getPath().equals(p) : entry.getPath().equals("/" + KDB_ROOT_GROUP_NAME + p);
}
});
return l == null || l.size() == 0 ? null : l.get(0);
}
/** V1 KDB - returns the attachment data, V2 KDBX - returns the first attachment data */
public byte[] getAttachment(final String entryPath) throws SOSKeePassDatabaseException {
return getAttachment(getEntryByPath(entryPath), null);
}
/** V1 KDB - returns the attachment data, V2 KDBX - returns the attachment data of the propertyName */
public byte[] getAttachment(final String entryPath, final String propertyName) throws SOSKeePassDatabaseException {
return getAttachment(getEntryByPath(entryPath), propertyName);
}
/** V1 KDB - returns the attachment data, V2 KDBX - returns the first attachment data */
public byte[] getAttachment(final Entry<?, ?, ?, ?> entry) throws SOSKeePassDatabaseException {
return getAttachment(entry, null);
}
/** V1 KDB - returns the attachment data, V2 KDBX - returns the attachment data of the propertyName */
public byte[] getAttachment(final Entry<?, ?, ?, ?> entry, String propertyName) throws SOSKeePassDatabaseException {
if (entry == null) {
throw new SOSKeePassDatabaseException("entry is null");
}
LOGGER.debug(String.format("entryPath=%s, propertyName=%s", entry.getPath(), propertyName));
if (propertyName != null && propertyName.equalsIgnoreCase(STANDARD_PROPERTY_NAME_ATTACHMENT)) {
propertyName = null;
}
byte[] data = null;
try {
if (_isKdbx) {
if (propertyName == null) {
List<String> l = entry.getBinaryPropertyNames();
if (l != null && l.size() > 0) {
data = entry.getBinaryProperty(l.get(0));
}
} else {
data = entry.getBinaryProperty(propertyName);
}
} else {
data = ((KdbEntry) entry).getBinaryData();
}
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(e);
}
if (data == null || data.length == 0) {
if (propertyName == null) {
throw new SOSKeePassDatabaseException(String.format("[%s]attachment not found or is 0 bytes", entry.getPath()));
} else {
throw new SOSKeePassDatabaseException(String.format("[%s]attachment not found or is 0 bytes, property=%s", entry.getPath(),
propertyName));
}
}
return data;
}
/** V1 KDB - exports the attachment, V2 KDBX - exports the first attachment */
public void exportAttachment2File(final String entryPath, final Path targetFile) throws SOSKeePassDatabaseException {
exportAttachment2File(entryPath, targetFile, null);
}
/** V1 KDB - exports the attachment, V2 KDBX - exports the attachment of the propertyName */
public void exportAttachment2File(final String entryPath, final Path targetFile, final String propertyName) throws SOSKeePassDatabaseException {
exportAttachment2File(getEntryByPath(entryPath), targetFile, propertyName);
}
/** V1 KDB - exports the attachment, V2 KDBX - exports the first attachment */
public void exportAttachment2File(final Entry<?, ?, ?, ?> entry, final Path targetFile) throws SOSKeePassDatabaseException {
exportAttachment2File(entry, targetFile, null);
}
/** V1 KDB - exports the attachment, V2 KDBX - exports the attachment of the propertyName */
public void exportAttachment2File(final Entry<?, ?, ?, ?> entry, final Path targetFile, final String propertyName)
throws SOSKeePassDatabaseException {
LOGGER.debug(String.format("entryPath=%s, targetFile=%s, propertyName=%s", entry.getPath(), targetFile, propertyName));
byte[] data = getAttachment(entry, propertyName);
try (FileOutputStream fos = new FileOutputStream(targetFile.toFile())) {
fos.write(data);
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(String.format("[%s][%s][%s]can't write attachment to file: %s", entry.getPath(), propertyName,
targetFile, e.toString()), e);
}
}
public static String getPropertyName(String propertyName) {
if (SOSString.isEmpty(propertyName)) {
return propertyName;
}
switch (propertyName.toLowerCase()) {
case "title":
return Entry.STANDARD_PROPERTY_NAME_TITLE;
case "user":
case "username":
return Entry.STANDARD_PROPERTY_NAME_USER_NAME;
case "password":
return Entry.STANDARD_PROPERTY_NAME_PASSWORD;
case "url":
return Entry.STANDARD_PROPERTY_NAME_URL;
case "notes":
return Entry.STANDARD_PROPERTY_NAME_NOTES;
case "attach":
case "attachment":
return STANDARD_PROPERTY_NAME_ATTACHMENT;
default:
return propertyName;
}
}
private Credentials getKDBCredentials(final String pass, final Path keyFile) throws SOSKeePassDatabaseException {
Credentials cred = null;
String password = pass == null ? "" : pass;
if (keyFile == null) {
try {
cred = new KdbCredentials.Password(password.getBytes());
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(e);
}
} else {
InputStream is = null;
try {
is = new FileInputStream(keyFile.toFile());
cred = new KdbCredentials.KeyFile(password.getBytes(), is);
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(e);
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable te) {
}
}
}
}
return cred;
}
private KdbDatabase getKDBDatabase(final String pass, final Path keyFile) throws SOSKeePassDatabaseException {
Credentials cred = getKDBCredentials(pass, keyFile);
KdbDatabase database = null;
InputStream is = null;
try {
is = new FileInputStream(_file.toFile());
LOGGER.debug(String.format("KdbDatabase.load: file=%s", _file));
database = KdbDatabase.load(cred, is);
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(e);
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable te) {
}
}
}
return database;
}
private Credentials getKDBXCredentials(final String pass, final Path keyFile) throws SOSKeePassDatabaseException {
KdbxCreds cred = null;
if (keyFile == null) {
try {
cred = new KdbxCreds(pass == null ? "".getBytes() : pass.getBytes());
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(e);
}
} else {
InputStream is = null;
try {
is = new FileInputStream(keyFile.toFile());
if (pass == null) {
cred = new KdbxCreds(is);
} else {
cred = new KdbxCreds(pass.getBytes(), is);
}
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(e);
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable te) {
}
}
}
}
return cred;
}
private SimpleDatabase getKDBXDatabase(final String pass, final Path keyFile) throws SOSKeePassDatabaseException {
Credentials cred = getKDBXCredentials(pass, keyFile);
SimpleDatabase database = null;
InputStream is = null;
try {
is = new FileInputStream(_file.toFile());
LOGGER.debug(String.format("SimpleDatabase.load: file=%s", _file));
database = SimpleDatabase.load(cred, is);
} catch (Throwable e) {
throw new SOSKeePassDatabaseException(e);
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable te) {
}
}
}
return database;
}
public Path getFile() {
return _file;
}
public Database<?, ?, ?, ?> getDatabase() {
return _database;
}
public boolean isKDBX() {
return _isKdbx;
}
}
| [
"[email protected]"
]
| |
be88dbd8146d1a1619f125b25d022225c0a0d824 | 276dbcf05f1d60424e47fe1891098bd72990f508 | /src/main/java/Iterator/Sample/StringDisplay.java | 92af683670d7da44849314e4b28e14c7bd3c324e | []
| no_license | takehir00/javaTryAndErrorProjects | 34c01c0b3e82a4efa738c31946b75d07eb2757ef | 05b4e53e07fe95eb36309ec162789ef715d389cf | refs/heads/main | 2023-07-30T07:59:26.753142 | 2021-09-23T02:49:15 | 2021-09-23T02:49:15 | 409,425,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,287 | java | package Iterator.Sample;
public class StringDisplay extends AbstractDisplay { // StringDisplay�⡢AbstractDisplay�Υ��֥��饹��
private String string; // ɽ������٤�ʸ����
private int width; // �Х���ñ�̤Ƿ�����ʸ����Ρ����ס�
public StringDisplay(String string) { // ���ȥ饯�����Ϥ��줿ʸ����string��
this.string = string; // �ե�����ɤ˵�����
this.width = string.getBytes().length; // ���줫��Х���ñ�̤�����ե�����ɤ˵������Ƥ����ơ���ǻȤ���
}
public void open() { // �����С��饤�ɤ����������open��åɡ�
printLine(); // ���Υ��饹�Υ�å�printLine����������Ƥ��롣
}
public void print() { // print��åɤϡ�
System.out.println("|" + string + "|"); // �ե�����ɤ˵������Ƥ�����ʸ����������"|"��Ĥ���ɽ����
}
public void close() { // close��åɤϡ�
printLine(); // open��Ʊ����printLine��åɤ���������Ƥ��롣
}
private void printLine() { // open��close����ƤФ��printLine��åɤ���private�ʤΤǡ����Υ��饹��������ǻȤ��롣
System.out.print("+"); // �ȤγѤ�ɽ������"+"�ޡ�����ɽ����
for (int i = 0; i < width; i++) { // width�Ĥ�"-"��ɽ�����ơ�
System.out.print("-"); // �����Ȥ����Ѥ��롣
}
System.out.println("+"); // �ȤγѤ�ɽ������"+"�ޡ�����ɽ����
}
}
| [
"[email protected]"
]
| |
c4cc88a8fa3db8320c8c50515df2589e313dfd08 | 1a115fc134ec8e690caf653300e1aa2fbcec441e | /src/main/java/com/capstone/recipestashapi/security/oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java | c9e147174e444ed5df83607477c6a55d0c743550 | []
| no_license | jasyl/recipe-stash-api | 410db5fb853c421ffc4e059db387d15808b19916 | 45fb55a94f45e2ff989cc7fe9ee30eedf93cb3a5 | refs/heads/master | 2023-03-04T08:11:17.131833 | 2021-02-19T20:23:15 | 2021-02-19T20:23:15 | 333,558,774 | 0 | 0 | null | 2021-02-08T20:46:28 | 2021-01-27T21:00:43 | Java | UTF-8 | Java | false | false | 2,518 | java | package com.capstone.recipestashapi.security.oauth2;
import com.capstone.recipestashapi.util.CookieUtils;
import com.nimbusds.oauth2.sdk.util.StringUtils;
import org.springframework.security.oauth2.client.web.AuthorizationRequestRepository;
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class HttpCookieOAuth2AuthorizationRequestRepository implements AuthorizationRequestRepository<OAuth2AuthorizationRequest> {
public static final String OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME = "oauth_auth_request";
public static final String REDIRECT_URI_PARAM_COOKIE_NAME = "redirect_uri";
private static final int cookieExpireSeconds = 180;
@Override
public OAuth2AuthorizationRequest loadAuthorizationRequest(HttpServletRequest request) {
return CookieUtils.getCookie(request, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME)
.map(cookie -> CookieUtils.deserialize(cookie, OAuth2AuthorizationRequest.class))
.orElse(null);
}
@Override
public void saveAuthorizationRequest(OAuth2AuthorizationRequest authorizationRequest, HttpServletRequest request, HttpServletResponse response) {
if (authorizationRequest == null) {
CookieUtils.deleteCookie(request, response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME);
CookieUtils.deleteCookie(request, response, REDIRECT_URI_PARAM_COOKIE_NAME);
return;
}
CookieUtils.addCookie(response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME, CookieUtils.serialize(authorizationRequest), cookieExpireSeconds);
String redirectUriAfterLogin = request.getParameter(REDIRECT_URI_PARAM_COOKIE_NAME);
if (StringUtils.isNotBlank(redirectUriAfterLogin)) {
CookieUtils.addCookie(response, REDIRECT_URI_PARAM_COOKIE_NAME, redirectUriAfterLogin, cookieExpireSeconds);
}
}
@Override
public OAuth2AuthorizationRequest removeAuthorizationRequest(HttpServletRequest request) {
return this.loadAuthorizationRequest(request);
}
public void removeAuthorizationRequestCookies(HttpServletRequest request, HttpServletResponse response) {
CookieUtils.deleteCookie(request, response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME);
CookieUtils.deleteCookie(request, response, REDIRECT_URI_PARAM_COOKIE_NAME);
}
}
| [
"[email protected]"
]
| |
fc68aa7ed36621fab966871c42aeecc7e1c8d335 | 9fce4b94350f003d94b4da78dadc5615e8ca3e43 | /src/com/yybt/datastructure/hashtable/Info.java | cf1095daff7a40a6ba07593e5646713f6900a7e3 | []
| no_license | yybtlzh/- | 61590c113103bebed06438161fef8213e38160ed | 29a6ed86fa80a17a7695afffb7c4169a84b79a39 | refs/heads/master | 2020-09-15T18:40:22.006292 | 2020-01-09T01:06:15 | 2020-01-09T01:06:15 | 223,529,619 | 2 | 0 | null | 2019-11-23T12:29:23 | 2019-11-23T04:18:38 | Java | WINDOWS-1252 | Java | false | false | 485 | java | package com.yybt.datastructure.hashtable;
/**
* ÐÅÏ¢Àà
* @author Administrator
*
*/
public class Info {
private String key;
private String name;
public Info(String key, String name) {
this.key = key;
this.name = name;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"刘海@Admin"
]
| 刘海@Admin |
46912fa2c0eb0a3096627cd25e552eea031ec6e9 | b848478d7cee0bc4191d71b4502d10d06b89d4ae | /src/shared/communication/params/GetProjects_Params.java | 1395fae9b3e5a1494db56eb49d86a613fb936351 | []
| no_license | mn263/record-indexer | eff8e0878aa7a361fe3ba3ecfe516c89045f9822 | 4428000876a57b5488be5c474e484c66804a355d | refs/heads/master | 2016-09-08T01:40:55.868986 | 2014-02-22T00:17:42 | 2014-02-22T00:17:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package shared.communication.params;
/**
* User: mn263
* Date: 10/18/13
* Time: 12:04 PM
*/
public class GetProjects_Params {
private String userName;
private String password;
/**
* required parameters to get projects
*
* @param userName String
* @param password String
*/
public GetProjects_Params(String userName, String password) {
this.userName = userName;
this.password = password;
}
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;
}
}
| [
"[email protected]"
]
| |
6a756050fa7933c58880c3b76517d0c75a942208 | 12daebd5e6399d367c147ff88fad236c66b40786 | /src/main/java/com/refinedmods/refinedstorage/api/network/node/INetworkNodeFactory.java | 85d559e679b788e669d206a4cdecfcd5ba465bc0 | [
"MIT"
]
| permissive | refinedmods/refinedstorage | 767b2acbcc2bd498d7633308f589062b89e77ab8 | e46046418fca514b58c3abb93e1b9b98d5361ce7 | refs/heads/develop | 2023-09-01T14:33:35.870033 | 2023-07-08T13:02:37 | 2023-07-08T13:02:37 | 47,563,072 | 181 | 115 | MIT | 2023-07-05T09:32:58 | 2015-12-07T16:05:16 | Java | UTF-8 | Java | false | false | 612 | java | package com.refinedmods.refinedstorage.api.network.node;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
/**
* A factory for reading network nodes from the disk. Used in a {@link INetworkNodeRegistry}.
*/
public interface INetworkNodeFactory {
/**
* Creates a network node.
*
* @param tag the tag on disk
* @param level the level
* @param pos the pos
* @return the network node
*/
@Nonnull
INetworkNode create(CompoundTag tag, Level level, BlockPos pos);
}
| [
"[email protected]"
]
| |
34baefa0428069ce1b4ac82530855e29456b0831 | a04fa80d0e993a40ac34f26a8d55d4b6f0bf9b91 | /src/main/java/sima/core/exception/NotCorrectContextException.java | 3d147196bced0b4c8c545035e189b29d614fd2d2 | []
| no_license | SealAndBlock/Si-MA | e4697d0dde4ad5799b9d4e50c69038ce764b6de4 | 9aa8619875b383d7ff5c3d16e420dd26a2006d0a | refs/heads/master | 2023-09-05T09:56:11.660334 | 2021-11-25T12:38:49 | 2021-11-25T12:38:49 | 384,137,706 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 99 | java | package sima.core.exception;
public class NotCorrectContextException extends RuntimeException {
}
| [
"[email protected]"
]
| |
df20570e132ad842ab6e24f3aac74a9aaf5d18db | c413c4b8e6e1d03dbfd72355526b8cd806ebe732 | /java/PrimaDla/src/org/primaresearch/dla/page/MetaData.java | 5d380aba7c64d380c4ede20641398eb6e24af847 | [
"Apache-2.0"
]
| permissive | kba/prima-core-libs | 8cdc88852afec819caac9449c105362f5d87270c | 3f68361e2d8903a33937a5dad755f3d34a1bc173 | refs/heads/master | 2021-01-22T13:57:36.871271 | 2014-10-31T11:01:13 | 2014-10-31T11:01:13 | 56,372,857 | 1 | 0 | null | 2016-04-16T08:10:14 | 2016-04-16T08:10:13 | null | UTF-8 | Java | false | false | 2,905 | java | /*
* Copyright 2014 PRImA Research Lab, University of Salford, United Kingdom
*
* 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.primaresearch.dla.page;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Class for document metadata such as creation date, comments, ...
*
* @author Christian Clausner
*
*/
public class MetaData implements Serializable {
private static final long serialVersionUID = 1L;
public static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); //TODO cannot be used in GWT projects!
private String creator = null;
private long created = 0L;
private long lastModified = 0L;
private String comments = null;
/**
* Returns the creating person, institution, and/or tool
* @return Creator description
*/
public String getCreator() {
return creator;
}
/**
* Sets the creating person, institution, and/or tool
* @param creator Creator description
*/
public void setCreator(String creator) {
this.creator = creator;
}
/**
* Returns comments (generic)
* @return Comments text
*/
public String getComments() {
return comments;
}
/**
* Sets generic comments
* @param comments Comments text
*/
public void setComments(String comments) {
this.comments = comments;
}
/**
* Returns the creation date/time
* @return Date and time formatted according to the <code>DATE_FORMAT</code> constant
*/
public String getFormattedCreationTime() {
return DATE_FORMAT.format(new Date(created));
}
/**
* Returns the creation date/time
* @return Date object
*/
public Date getCreationTime() {
return new Date(created);
}
/**
* Returns the modification date/time
* @return Date and time formatted according to the <code>DATE_FORMAT</code> constant
*/
public String getFormattedLastModificationTime() {
return DATE_FORMAT.format(new Date(lastModified));
}
/**
* Returns the modification date/time
* @return Date object
*/
public Date getLastModificationTime() {
return new Date(lastModified);
}
/**
* Sets the creation date/time
* @param d Date object
*/
public void setCreationTime(Date d) {
created = d.getTime();
}
/**
* Sets the modification date/time
* @param d Date object
*/
public void setLastModifiedTime(Date d) {
lastModified = d.getTime();
}
}
| [
"[email protected]"
]
| |
b73b3842c5dda99e5e77216f2792ea0a8f8852c4 | c1374006c608859ac2e4f05765ddf25829e451e9 | /app/src/main/java/emerge/project/mrsolution/ui/adapters/visits/VisitsLocationAdapter.java | c65a87733c3b9143ddc651a9cfd2b7397542d117 | []
| no_license | himanshufernando/MR_Halcyon_User | 9b5625d0935bbc16b3d0c5ec1f5c532f34f0dd06 | d6591ab1d384c25eb7e110e2bc070ba3df17b3e4 | refs/heads/master | 2022-02-26T08:32:38.785633 | 2019-09-06T09:47:18 | 2019-09-06T09:47:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,105 | java | package emerge.project.mrsolution.ui.adapters.visits;
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
import emerge.project.mrsolution.R;
import emerge.project.mrsolution.ui.activity.visits.VisitsPresenter;
import emerge.project.mrsolution.ui.activity.visits.VisitsPresenterImpli;
import emerge.project.mrsolution.ui.activity.visits.VisitsView;
import emerge.project.mrsolution.utils.entittes.LocationEntitie;
/**
* Created by Himanshu on 4/10/2015.
*/
public class VisitsLocationAdapter extends RecyclerView.Adapter<VisitsLocationAdapter.MyViewHolder> {
Context mContext;
ArrayList<LocationEntitie> locItems;
VisitsPresenter visitsPresenter;
public VisitsLocationAdapter(Context mContext, ArrayList<LocationEntitie> item, VisitsView visitsView) {
this.mContext = mContext;
this.locItems = item;
visitsPresenter = new VisitsPresenterImpli(visitsView);
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.listview_visits_location, parent, false);
return new MyViewHolder(itemView);
}
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
final LocationEntitie loc = locItems.get(position);
holder.textviewAddress.setText(loc.getAddress());
holder.textviewLocation.setText(loc.getName());
if (loc.isSelect()) {
holder.cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.colorgold));
} else {
holder.cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.colorWhite));
}
holder.relativeLayoutMain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
for (LocationEntitie l : locItems) {
l.setSelect(false);
}
locItems.get(position).setSelect(true);
notifyDataSetChanged();
visitsPresenter.getSelectedLocation(loc);
}
});
}
@Override
public int getItemCount() {
return locItems.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.card_view)
CardView cardView;
@BindView(R.id.relativeLayout_main)
RelativeLayout relativeLayoutMain;
@BindView(R.id.textview_location_address)
TextView textviewAddress;
@BindView(R.id.textview_location)
TextView textviewLocation;
public MyViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
| [
"[email protected]"
]
| |
82f1f909d74014e2ae93dbbff0571aff97b44a53 | e9fcbafddd85af53d6921b3857d107b291c6920c | /base-game/src/main/java/fr/unice/miage/classloader/ClassLoaderCustom.java | d4c2518d585a5650cd83c82ee6aec17572774b7d | []
| no_license | ChrisTram/Advanced-Programmation-Project-Loader-M1 | 44d51dbc04d236dd27d2bf316f1d0e823f6b04a5 | ae9a7a3d9fd2f8eea101b354cba55f55266680ee | refs/heads/master | 2023-02-06T01:09:18.165935 | 2020-12-27T16:15:30 | 2020-12-27T16:15:30 | 324,799,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package fr.unice.miage.classloader;
public abstract class ClassLoaderCustom extends ClassLoader {
public Class<?> loadClassNoDeep(String name) throws ClassNotFoundException {
Class<?> cl = super.findLoadedClass(name);
if(cl != null)
return cl;
return findClassNoDeep(name);
}
public abstract Class<?> findClassNoDeep(String name) throws ClassNotFoundException;
}
| [
"[email protected]"
]
| |
1561d4616dcfbea65e0ce234e29133f0e9b7a5f4 | 7870efe9a75402f7f58f6ab135c31feb67b1b479 | /LinkUPTrans_newVersion/src/com/cq/game/trans/view/OnTimerListener.java | 2499528031b9ccba3de47e9fc1d765650919c533 | []
| no_license | verybig/ourfruit | 1a36938776b8e1492689b0cd5af5a94434798b23 | 87816c3b682c09d10926ae2d400b8378470aebf1 | refs/heads/master | 2021-01-10T02:13:36.253691 | 2013-03-05T13:35:26 | 2013-03-05T13:35:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package com.cq.game.trans.view;
public interface OnTimerListener{
public void onTimer(int leftTime);
}
| [
"[email protected]"
]
| |
891d99ec470a7305a543db2dff6e3382e28c3fd2 | 4c304a7a7aa8671d7d1b9353acf488fdd5008380 | /src/main/java/com/alipay/api/domain/DeviceInfo.java | 6ba0e1d510c97366439c0e2c5144ff07d17e5dba | [
"Apache-2.0"
]
| permissive | zhaorongxi/alipay-sdk-java-all | c658983d390e432c3787c76a50f4a8d00591cd5c | 6deda10cda38a25dcba3b61498fb9ea839903871 | refs/heads/master | 2021-02-15T19:39:11.858966 | 2020-02-16T10:44:38 | 2020-02-16T10:44:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,514 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 设备信息模型
*
* @author auto create
* @since 1.0, 2018-12-27 14:36:08
*/
public class DeviceInfo extends AlipayObject {
private static final long serialVersionUID = 7415749672859883141L;
/**
* 设备ID
*/
@ApiField("device_id")
private String deviceId;
/**
* 设备类型
*/
@ApiField("device_type")
private String deviceType;
/**
* 设备sn编号
*/
@ApiField("dv_sn")
private String dvSn;
/**
* 生产厂商
*/
@ApiField("manufacturer")
private String manufacturer;
/**
* 产品型号
*/
@ApiField("product_model")
private String productModel;
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceType() {
return this.deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public String getDvSn() {
return this.dvSn;
}
public void setDvSn(String dvSn) {
this.dvSn = dvSn;
}
public String getManufacturer() {
return this.manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getProductModel() {
return this.productModel;
}
public void setProductModel(String productModel) {
this.productModel = productModel;
}
}
| [
"[email protected]"
]
| |
45524bb6695e2956581038f3a148ce4e3b45f17a | 580384bf75942e02e474005a66ab90c4d7c1252a | /antioch-main/src/main/java/nl/knaw/huygens/antioch/endpoint/iiif/IIIFCollectionEndpoint.java | b1c3e30eb8a35b2ba8257c9c3316c9f66519c270 | [
"Apache-2.0"
]
| permissive | HuygensING/antioch | 57b3cabe0be51cda3510ee5208e36ad9ff3954b9 | dfa6af02ed964075054ba2b949310296c98b9f75 | refs/heads/master | 2018-12-24T19:21:34.810350 | 2017-09-06T15:11:52 | 2017-09-06T15:11:52 | 31,207,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,368 | java | package nl.knaw.huygens.antioch.endpoint.iiif;
/*
* #%L
* antioch-main
* =======
* Copyright (C) 2015 - 2017 Huygens ING (KNAW)
* =======
* 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.
* #L%
*/
import java.net.URI;
import java.util.Map;
import javax.ws.rs.GET;
import javax.ws.rs.core.Response;
import nl.knaw.huygens.antioch.service.AntiochService;
public class IIIFCollectionEndpoint extends AbstractIIIFEndpoint {
public IIIFCollectionEndpoint(String name, AntiochService service, URI id) {
super(id);
String name1 = name;
AntiochService service1 = service;
}
@GET
public Response get() {
return notImplemented(dummySequence());
}
private Map<String, Object> dummySequence() {
Map<String, Object> dummy = baseMap();
return dummy;
}
@Override
String getType() {
return "sc:Collection";
}
}
| [
"[email protected]"
]
| |
43bdbe13d708560c9aa5daf1d955915c615c3340 | 0c98cf3f64a72ceb4987f23936979d587183e269 | /services/vod/src/main/java/com/huaweicloud/sdk/vod/v1/model/VideoTypeRef.java | 26fc22536835a98ec3147d07cd39ae66afd52824 | [
"Apache-2.0"
]
| permissive | cwray01/huaweicloud-sdk-java-v3 | 765d08e4b6dfcd88c2654bdbf5eb2dd9db19f2ef | 01b5a3b4ea96f8770a2eaa882b244930e5fd03e7 | refs/heads/master | 2023-07-17T10:31:20.119625 | 2021-08-31T11:38:37 | 2021-08-31T11:38:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,268 | java | package com.huaweicloud.sdk.vod.v1.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
/** VideoTypeRef */
public class VideoTypeRef {
/** 转存的音视频文件类型。 取值如下: - 视频文件:MP4、TS、MOV、MXF、MPG、FLV、WMV、AVI、M4V、F4V、MPEG、3GP、ASF、MKV、HLS -
* 音频文件:MP3、OGG、WAV、WMA、APE、FLAC、AAC、AC3、MMF、AMR、M4A、M4R、WV、MP2 若上传格式为音频文件,则不支持转码、添加水印和字幕。 >
* 当**video_type**选择HLS时,**storage_mode**(存储模式)需选择存储在租户桶,且输出路径设置为和输入路径在同一个目录。 */
public static final class VideoTypeEnum {
/** Enum MP4 for value: "MP4" */
public static final VideoTypeEnum MP4 = new VideoTypeEnum("MP4");
/** Enum TS for value: "TS" */
public static final VideoTypeEnum TS = new VideoTypeEnum("TS");
/** Enum MOV for value: "MOV" */
public static final VideoTypeEnum MOV = new VideoTypeEnum("MOV");
/** Enum MXF for value: "MXF" */
public static final VideoTypeEnum MXF = new VideoTypeEnum("MXF");
/** Enum MPG for value: "MPG" */
public static final VideoTypeEnum MPG = new VideoTypeEnum("MPG");
/** Enum FLV for value: "FLV" */
public static final VideoTypeEnum FLV = new VideoTypeEnum("FLV");
/** Enum WMV for value: "WMV" */
public static final VideoTypeEnum WMV = new VideoTypeEnum("WMV");
/** Enum AVI for value: "AVI" */
public static final VideoTypeEnum AVI = new VideoTypeEnum("AVI");
/** Enum M4V for value: "M4V" */
public static final VideoTypeEnum M4V = new VideoTypeEnum("M4V");
/** Enum F4V for value: "F4V" */
public static final VideoTypeEnum F4V = new VideoTypeEnum("F4V");
/** Enum MPEG for value: "MPEG" */
public static final VideoTypeEnum MPEG = new VideoTypeEnum("MPEG");
/** Enum _3GP for value: "3GP" */
public static final VideoTypeEnum _3GP = new VideoTypeEnum("3GP");
/** Enum ASF for value: "ASF" */
public static final VideoTypeEnum ASF = new VideoTypeEnum("ASF");
/** Enum MKV for value: "MKV" */
public static final VideoTypeEnum MKV = new VideoTypeEnum("MKV");
/** Enum HLS for value: "HLS" */
public static final VideoTypeEnum HLS = new VideoTypeEnum("HLS");
/** Enum MP3 for value: "MP3" */
public static final VideoTypeEnum MP3 = new VideoTypeEnum("MP3");
/** Enum OGG for value: "OGG" */
public static final VideoTypeEnum OGG = new VideoTypeEnum("OGG");
/** Enum WAV for value: "WAV" */
public static final VideoTypeEnum WAV = new VideoTypeEnum("WAV");
/** Enum WMA for value: "WMA" */
public static final VideoTypeEnum WMA = new VideoTypeEnum("WMA");
/** Enum APE for value: "APE" */
public static final VideoTypeEnum APE = new VideoTypeEnum("APE");
/** Enum FLAC for value: "FLAC" */
public static final VideoTypeEnum FLAC = new VideoTypeEnum("FLAC");
/** Enum AAC for value: "AAC" */
public static final VideoTypeEnum AAC = new VideoTypeEnum("AAC");
/** Enum AC3 for value: "AC3" */
public static final VideoTypeEnum AC3 = new VideoTypeEnum("AC3");
/** Enum MMF for value: "MMF" */
public static final VideoTypeEnum MMF = new VideoTypeEnum("MMF");
/** Enum AMR for value: "AMR" */
public static final VideoTypeEnum AMR = new VideoTypeEnum("AMR");
/** Enum M4A for value: "M4A" */
public static final VideoTypeEnum M4A = new VideoTypeEnum("M4A");
/** Enum M4R for value: "M4R" */
public static final VideoTypeEnum M4R = new VideoTypeEnum("M4R");
/** Enum WV for value: "WV" */
public static final VideoTypeEnum WV = new VideoTypeEnum("WV");
/** Enum MP2 for value: "MP2" */
public static final VideoTypeEnum MP2 = new VideoTypeEnum("MP2");
private static final Map<String, VideoTypeEnum> STATIC_FIELDS = createStaticFields();
private static Map<String, VideoTypeEnum> createStaticFields() {
Map<String, VideoTypeEnum> map = new HashMap<>();
map.put("MP4", MP4);
map.put("TS", TS);
map.put("MOV", MOV);
map.put("MXF", MXF);
map.put("MPG", MPG);
map.put("FLV", FLV);
map.put("WMV", WMV);
map.put("AVI", AVI);
map.put("M4V", M4V);
map.put("F4V", F4V);
map.put("MPEG", MPEG);
map.put("3GP", _3GP);
map.put("ASF", ASF);
map.put("MKV", MKV);
map.put("HLS", HLS);
map.put("MP3", MP3);
map.put("OGG", OGG);
map.put("WAV", WAV);
map.put("WMA", WMA);
map.put("APE", APE);
map.put("FLAC", FLAC);
map.put("AAC", AAC);
map.put("AC3", AC3);
map.put("MMF", MMF);
map.put("AMR", AMR);
map.put("M4A", M4A);
map.put("M4R", M4R);
map.put("WV", WV);
map.put("MP2", MP2);
return Collections.unmodifiableMap(map);
}
private String value;
VideoTypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static VideoTypeEnum fromValue(String value) {
if (value == null) {
return null;
}
VideoTypeEnum result = STATIC_FIELDS.get(value);
if (result == null) {
result = new VideoTypeEnum(value);
}
return result;
}
public static VideoTypeEnum valueOf(String value) {
if (value == null) {
return null;
}
VideoTypeEnum result = STATIC_FIELDS.get(value);
if (result != null) {
return result;
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@Override
public boolean equals(Object obj) {
if (obj instanceof VideoTypeEnum) {
return this.value.equals(((VideoTypeEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "video_type")
private VideoTypeEnum videoType;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "title")
private String title;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "description")
private String description;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "category_id")
private Integer categoryId;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "tags")
private String tags;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "auto_publish")
private Integer autoPublish;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "template_group_name")
private String templateGroupName;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "auto_encrypt")
private Integer autoEncrypt;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "auto_preheat")
private Integer autoPreheat;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "thumbnail")
private Thumbnail thumbnail;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "review")
private Review review;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "workflow_name")
private String workflowName;
public VideoTypeRef withVideoType(VideoTypeEnum videoType) {
this.videoType = videoType;
return this;
}
/** 转存的音视频文件类型。 取值如下: - 视频文件:MP4、TS、MOV、MXF、MPG、FLV、WMV、AVI、M4V、F4V、MPEG、3GP、ASF、MKV、HLS -
* 音频文件:MP3、OGG、WAV、WMA、APE、FLAC、AAC、AC3、MMF、AMR、M4A、M4R、WV、MP2 若上传格式为音频文件,则不支持转码、添加水印和字幕。 >
* 当**video_type**选择HLS时,**storage_mode**(存储模式)需选择存储在租户桶,且输出路径设置为和输入路径在同一个目录。
*
* @return videoType */
public VideoTypeEnum getVideoType() {
return videoType;
}
public void setVideoType(VideoTypeEnum videoType) {
this.videoType = videoType;
}
public VideoTypeRef withTitle(String title) {
this.title = title;
return this;
}
/** 媒资标题,长度不超过128个字节,UTF-8编码。
*
* @return title */
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public VideoTypeRef withDescription(String description) {
this.description = description;
return this;
}
/** 视频描述,长度不超过1024个字节。
*
* @return description */
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public VideoTypeRef withCategoryId(Integer categoryId) {
this.categoryId = categoryId;
return this;
}
/** 媒资分类ID。
* 您可以调用[创建媒资分类](https://support.huaweicloud.com/api-vod/vod_04_0028.html)接口或在点播控制台的[分类设置](https://support.huaweicloud.com/usermanual-vod/vod010006.html)中创建对应的媒资分类,并获取分类ID。
* > 若不设置或者设置为-1,则上传的音视频归类到系统预置的“其它”分类中。
*
* @return categoryId */
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public VideoTypeRef withTags(String tags) {
this.tags = tags;
return this;
}
/** 视频标签。 单个标签不超过16个字节,最多不超过16个标签。 多个用逗号分隔,UTF8编码。
*
* @return tags */
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public VideoTypeRef withAutoPublish(Integer autoPublish) {
this.autoPublish = autoPublish;
return this;
}
/** 是否自动发布。 取值如下: - 0:表示不自动发布。 - 1:表示自动发布。 默认值:0。 minimum: 0 maximum: 1
*
* @return autoPublish */
public Integer getAutoPublish() {
return autoPublish;
}
public void setAutoPublish(Integer autoPublish) {
this.autoPublish = autoPublish;
}
public VideoTypeRef withTemplateGroupName(String templateGroupName) {
this.templateGroupName = templateGroupName;
return this;
}
/** 转码模板组名称。
* 若不为空,则使用指定的转码模板对上传的音视频进行转码,您可以在视频点播控制台配置转码模板,具体请参见[转码设置](https://support.huaweicloud.com/usermanual-vod/vod_01_0072.html)。
* > 若同时设置了“**template_group_name**”和“**workflow_name**”字段,则“**template_group_name**”字段生效。
*
* @return templateGroupName */
public String getTemplateGroupName() {
return templateGroupName;
}
public void setTemplateGroupName(String templateGroupName) {
this.templateGroupName = templateGroupName;
}
public VideoTypeRef withAutoEncrypt(Integer autoEncrypt) {
this.autoEncrypt = autoEncrypt;
return this;
}
/** 是否自动加密。 取值如下: - 0:表示不加密。 - 1:表示需要加密。 默认值:0。 若设置为需要加密,则必须配置转码模板,且转码的输出格式是HLS。 minimum: 0 maximum: 1
*
* @return autoEncrypt */
public Integer getAutoEncrypt() {
return autoEncrypt;
}
public void setAutoEncrypt(Integer autoEncrypt) {
this.autoEncrypt = autoEncrypt;
}
public VideoTypeRef withAutoPreheat(Integer autoPreheat) {
this.autoPreheat = autoPreheat;
return this;
}
/** 是否自动预热到CDN。 取值如下: - 0:表示不自动预热。 - 1:表示自动预热。 默认值:0。
*
* @return autoPreheat */
public Integer getAutoPreheat() {
return autoPreheat;
}
public void setAutoPreheat(Integer autoPreheat) {
this.autoPreheat = autoPreheat;
}
public VideoTypeRef withThumbnail(Thumbnail thumbnail) {
this.thumbnail = thumbnail;
return this;
}
public VideoTypeRef withThumbnail(Consumer<Thumbnail> thumbnailSetter) {
if (this.thumbnail == null) {
this.thumbnail = new Thumbnail();
thumbnailSetter.accept(this.thumbnail);
}
return this;
}
/** Get thumbnail
*
* @return thumbnail */
public Thumbnail getThumbnail() {
return thumbnail;
}
public void setThumbnail(Thumbnail thumbnail) {
this.thumbnail = thumbnail;
}
public VideoTypeRef withReview(Review review) {
this.review = review;
return this;
}
public VideoTypeRef withReview(Consumer<Review> reviewSetter) {
if (this.review == null) {
this.review = new Review();
reviewSetter.accept(this.review);
}
return this;
}
/** Get review
*
* @return review */
public Review getReview() {
return review;
}
public void setReview(Review review) {
this.review = review;
}
public VideoTypeRef withWorkflowName(String workflowName) {
this.workflowName = workflowName;
return this;
}
/** 工作流名称。
* 若不为空,则使用指定的工作流对上传的音视频进行处理,您可以在视频点播控制台配置工作流,具体请参见[工作流设置](https://support.huaweicloud.com/usermanual-vod/vod010041.html)。
*
* @return workflowName */
public String getWorkflowName() {
return workflowName;
}
public void setWorkflowName(String workflowName) {
this.workflowName = workflowName;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
VideoTypeRef videoTypeRef = (VideoTypeRef) o;
return Objects.equals(this.videoType, videoTypeRef.videoType) && Objects.equals(this.title, videoTypeRef.title)
&& Objects.equals(this.description, videoTypeRef.description)
&& Objects.equals(this.categoryId, videoTypeRef.categoryId) && Objects.equals(this.tags, videoTypeRef.tags)
&& Objects.equals(this.autoPublish, videoTypeRef.autoPublish)
&& Objects.equals(this.templateGroupName, videoTypeRef.templateGroupName)
&& Objects.equals(this.autoEncrypt, videoTypeRef.autoEncrypt)
&& Objects.equals(this.autoPreheat, videoTypeRef.autoPreheat)
&& Objects.equals(this.thumbnail, videoTypeRef.thumbnail)
&& Objects.equals(this.review, videoTypeRef.review)
&& Objects.equals(this.workflowName, videoTypeRef.workflowName);
}
@Override
public int hashCode() {
return Objects.hash(videoType,
title,
description,
categoryId,
tags,
autoPublish,
templateGroupName,
autoEncrypt,
autoPreheat,
thumbnail,
review,
workflowName);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class VideoTypeRef {\n");
sb.append(" videoType: ").append(toIndentedString(videoType)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" categoryId: ").append(toIndentedString(categoryId)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" autoPublish: ").append(toIndentedString(autoPublish)).append("\n");
sb.append(" templateGroupName: ").append(toIndentedString(templateGroupName)).append("\n");
sb.append(" autoEncrypt: ").append(toIndentedString(autoEncrypt)).append("\n");
sb.append(" autoPreheat: ").append(toIndentedString(autoPreheat)).append("\n");
sb.append(" thumbnail: ").append(toIndentedString(thumbnail)).append("\n");
sb.append(" review: ").append(toIndentedString(review)).append("\n");
sb.append(" workflowName: ").append(toIndentedString(workflowName)).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 ");
}
}
| [
"[email protected]"
]
| |
82fabd1895e8a305bb4dfa6c4aaf0360f491d320 | f27cb821dd601554bc8f9c112d9a55f32421b71b | /entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/remove/orphan/nested/EntityViewOrphanRemoveNestedSubviewCollectionsTest.java | 3c1982d40edc53858f348646fa11529f559a8887 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | Blazebit/blaze-persistence | 94f7e75154e80ce777a61eb3d436135ad6d7a497 | a9b1b6efdd7ae388e7624adc601a47d97609fdaa | refs/heads/main | 2023-08-31T22:41:17.134370 | 2023-07-14T15:31:39 | 2023-07-17T14:52:26 | 21,765,334 | 1,475 | 92 | Apache-2.0 | 2023-08-07T18:10:38 | 2014-07-12T11:08:47 | Java | UTF-8 | Java | false | false | 7,356 | java | /*
* Copyright 2014 - 2023 Blazebit.
*
* 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.blazebit.persistence.view.testsuite.update.remove.orphan.nested;
import com.blazebit.persistence.testsuite.base.jpa.assertion.AssertStatementBuilder;
import com.blazebit.persistence.testsuite.base.jpa.category.NoDatanucleus;
import com.blazebit.persistence.testsuite.base.jpa.category.NoEclipselink;
import com.blazebit.persistence.testsuite.entity.Document;
import com.blazebit.persistence.testsuite.entity.Person;
import com.blazebit.persistence.view.FlushMode;
import com.blazebit.persistence.view.FlushStrategy;
import com.blazebit.persistence.view.spi.EntityViewConfiguration;
import com.blazebit.persistence.view.testsuite.update.remove.orphan.AbstractEntityViewOrphanRemoveDocumentTest;
import com.blazebit.persistence.view.testsuite.update.remove.orphan.nested.model.FriendPersonCreateView;
import com.blazebit.persistence.view.testsuite.update.remove.orphan.nested.model.FriendPersonView;
import com.blazebit.persistence.view.testsuite.update.remove.orphan.nested.model.UpdatableDocumentWithCollectionsView;
import com.blazebit.persistence.view.testsuite.update.remove.orphan.nested.model.UpdatableResponsiblePersonView;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/**
*
* @author Christian Beikov
* @since 1.2.0
*/
@RunWith(Parameterized.class)
// NOTE: No Datanucleus support yet
@Category({ NoDatanucleus.class, NoEclipselink.class})
public class EntityViewOrphanRemoveNestedSubviewCollectionsTest extends AbstractEntityViewOrphanRemoveDocumentTest<UpdatableDocumentWithCollectionsView> {
public EntityViewOrphanRemoveNestedSubviewCollectionsTest(FlushMode mode, FlushStrategy strategy, boolean version) {
super(mode, strategy, version, UpdatableDocumentWithCollectionsView.class);
}
@Parameterized.Parameters(name = "{0} - {1} - VERSIONED={2}")
public static Object[][] combinations() {
return MODE_STRATEGY_VERSION_COMBINATIONS;
}
@Override
protected void registerViewTypes(EntityViewConfiguration cfg) {
cfg.addEntityView(UpdatableResponsiblePersonView.class);
cfg.addEntityView(FriendPersonView.class);
cfg.addEntityView(FriendPersonCreateView.class);
}
@Test
public void testSetNull() {
// Given
final UpdatableDocumentWithCollectionsView docView = getDoc1View();
clearQueries();
// When
docView.getPeople().get(1).setFriend(null);
update(docView);
// Then
AssertStatementBuilder builder = assertUpdateAndRemove();
builder.validate();
clearPersistenceContextAndReload();
assertNull(p4.getFriend());
assertNull(p8);
}
@Test
public void testSetOther() {
// Given
final UpdatableDocumentWithCollectionsView docView = getDoc1View();
FriendPersonView p5View = getPersonView(p5.getId(), FriendPersonView.class);
clearQueries();
// When
docView.getPeople().get(1).setFriend(p5View);
update(docView);
// Then
AssertStatementBuilder builder = assertUpdateAndRemove();
builder.validate();
clearPersistenceContextAndReload();
assertEquals(p5.getId(), p4.getFriend().getId());
assertNull(p8);
}
@Test
public void testSetNew() {
// Given
final UpdatableDocumentWithCollectionsView docView = getDoc1View();
FriendPersonCreateView newPersonView = evm.create(FriendPersonCreateView.class);
newPersonView.setName("new");
clearQueries();
// When
docView.getPeople().get(1).setFriend(newPersonView);
update(docView);
// Then
AssertStatementBuilder builder = assertUpdateAndRemove();
builder.insert(Person.class);
builder.validate();
clearPersistenceContextAndReload();
assertEquals("new", p4.getFriend().getName());
assertNull(p8);
}
@Test
public void testRemoveCascade() {
// Given
final UpdatableDocumentWithCollectionsView docView = getDoc1View();
clearQueries();
// When
docView.getPeople().remove(1);
update(docView);
// Then
AssertStatementBuilder builder = assertUnorderedQuerySequence();
if (isQueryStrategy()) {
if (isFullMode()) {
builder.update(Person.class);
builder.insert(Document.class, "people");
}
} else {
builder.assertSelect()
.fetching(Document.class)
.fetching(Document.class, "people")
.fetching(Person.class)
.and();
if (!supportsProxyRemoveWithoutLoading()) {
builder.select(Person.class);
}
}
if (version || isQueryStrategy() && isFullMode()) {
builder.update(Document.class);
}
deletePersonOwned(builder, true);
deletePersonOwned(builder, true);
builder.delete(Person.class);
builder.update(Document.class);
builder.delete(Person.class);
builder.update(Document.class);
builder.delete(Document.class, "people");
builder.validate();
clearPersistenceContextAndReload();
assertNull(p4);
assertNull(p8);
assertEquals(1, doc1.getPeople().size());
}
public AssertStatementBuilder assertUpdateAndRemove() {
AssertStatementBuilder builder = assertUnorderedQuerySequence();
if (isQueryStrategy()) {
if (isFullMode()) {
builder.delete(Document.class, "people");
for (Person person : doc1.getPeople()) {
builder.insert(Document.class, "people");
}
}
} else {
builder.assertSelect()
.fetching(Document.class)
.fetching(Document.class, "people")
.fetching(Person.class)
.and();
if (!supportsProxyRemoveWithoutLoading()) {
builder.select(Person.class);
}
}
if (isFullMode() && isQueryStrategy()) {
builder.update(Person.class);
}
if (version || isQueryStrategy() && isFullMode()) {
builder.update(Document.class);
}
deletePersonOwned(builder, true);
// document.responsiblePerson.friend
builder.delete(Person.class);
builder.update(Document.class);
builder.update(Person.class);
return builder;
}
}
| [
"[email protected]"
]
| |
b3568264ff1dfd13c01207ec9aa2989b3740abac | 74ae24d049cfcab4f477dde92367094890aec688 | /components/phase_management/src/java/tests/com/topcoder/management/phase/stresstests/DefaultPhaseValidatorStressTest.java | e3162426f4d57e77a349de67ce0fa14fb9d92fbe | []
| no_license | appirio-tech/direct-app | 8fa562f769db792eb244948f0d375604ac853ef1 | 002aa5e67064a85ed9752d651d86403b1268cf38 | refs/heads/dev | 2023-08-09T20:01:29.514463 | 2022-12-21T01:19:53 | 2022-12-21T01:19:53 | 23,885,120 | 21 | 78 | null | 2022-12-21T01:41:11 | 2014-09-10T17:49:11 | Java | UTF-8 | Java | false | false | 2,440 | java | /*
* Copyright (C) 2006 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.management.phase.stresstests;
import com.topcoder.management.phase.validation.DefaultPhaseValidator;
import com.topcoder.project.phases.Phase;
import com.topcoder.project.phases.PhaseStatus;
import com.topcoder.project.phases.PhaseType;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* <p>
* Stress tests for DefaultPhaseValidator.
* </p>
*
* @author still
* @version 1.0
*/
public class DefaultPhaseValidatorStressTest extends TestCase {
/** The number of times each method will be run. */
public static final int RUN_TIMES = 100000;
/** The DefaultPhaseValidator used in this test. */
private DefaultPhaseValidator validator;
/**
* Test suite of DefaultPhaseValidatorStressTest.
*
* @return Test suite of DefaultPhaseValidatorStressTest.
*/
public static Test suite() {
return new TestSuite(DefaultPhaseValidatorStressTest.class);
}
/**
* Initialization for all tests here.
* @throws Exception to Junit.
*/
protected void setUp() throws Exception {
validator = new DefaultPhaseValidator();
}
/**
* <p>Stress test for DefaultPhaseValidator#DefaultPhaseValidator().</p>
*
*/
public void testCtor() {
long start = System.currentTimeMillis();
for (int i = 0; i < RUN_TIMES; i++) {
assertNotNull("Failed to create DefaultPhaseValidator.",
new DefaultPhaseValidator());
}
long end = System.currentTimeMillis();
System.out.println("Testing DefaultPhaseValidator() for " + RUN_TIMES + " times costs "
+ (end - start) + "ms");
}
/**
* <p>Stress test for DefaultPhaseValidator#validate(Phase).</p>
*
* @throws Exception to junit.
*/
public void testValidate() throws Exception {
long start = System.currentTimeMillis();
Phase phase = new StressMockPhase();
phase.setPhaseStatus(PhaseStatus.SCHEDULED);
phase.setPhaseType(new PhaseType(101, "Type1"));
for (int i = 0; i < RUN_TIMES; i++) {
validator.validate(phase);
}
long end = System.currentTimeMillis();
System.out.println("Testing validate(Phase) for " + RUN_TIMES + " times costs "
+ (end - start) + "ms");
}
}
| [
"[email protected]"
]
| |
4374dfb634d6076fa456c7fc79821d24b63fce85 | 79aac454dbadd82c18d64bc675f7929c07b50ad8 | /src/main/java/service/impl/stockServiceimpl.java | c3efa4cf642f868bc3eb759f03bd47040e766151 | []
| no_license | HiteshPerishetty/ormLearn | 795cba83dc1159ba7e9873b420b77fa08c95335b | b6e8d2078e41458804faf49b9092c5ac7df975dd | refs/heads/main | 2023-06-01T04:54:33.565743 | 2021-06-24T13:41:37 | 2021-06-24T13:41:37 | 379,923,846 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | package com.cognizant.ormlearn.service.impl;
import java.util.Date;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cognizant.ormlearn.model.Stock;
import com.cognizant.ormlearn.repository.StockRepository;
import com.cognizant.ormlearn.service.StockService;
@Service
@Transactional
public class StockServiceImpl implements StockService {
@Autowired
private StockRepository stockRepo;
@Override
public List<Stock> getAllStockDetails() {
return stockRepo.findAll();
}
@Override
public List<Stock> findStockUsingCode(String code) {
return stockRepo.findStockByCode(code);
}
@Override
public List<Stock> findFBStockInSep19(String code, Date startDate, Date endDate) {
return stockRepo.fbStockInSep19(code, startDate, endDate);
}
@Override
public List<Stock> findGoogleStockGreaterThan1250(String code, double price) {
return stockRepo.googleStocks(code, price);
}
@Override
public List<Stock> findTop3VolumeStock() {
return stockRepo.topVolume();
}
@Override
public List<Stock> findLowest3NetflixStocks(String code) {
return stockRepo.lowNetflixStocks(code);
}
}
| [
"[email protected]"
]
| |
5ee07640e042fef9f4373cb300626c6bca94d016 | 9ff43cd795a11562a094466dc030163a2c7ed4b3 | /target/classes/com/jxedt/entity/Comments.java | ca02fd053ab125ad9a655c3a1e60a1f3e7d1a9b5 | []
| no_license | kei299/fahrschule | 191401e6042d4cf34a3bcdd42c29a032dc0d0b30 | a683efbb4666c602138e10ddce9b92c904ebe094 | refs/heads/master | 2022-12-22T23:48:41.644121 | 2019-11-11T03:06:38 | 2019-11-11T03:06:38 | 220,886,779 | 0 | 0 | null | 2022-12-16T06:47:22 | 2019-11-11T02:40:37 | Java | UTF-8 | Java | false | false | 1,689 | java | package com.jxedt.entity;
import java.util.Date;
public class Comments {
private Integer commentsId;//留言编号
private Integer userId;//用户编号
private String photo;//用户图像
private String words;//留言内容
private Integer pointRatio;//点赞数
private Date sending;//发表时间
private String viewName;//视频名称
public Comments() {
super();
// TODO Auto-generated constructor stub
}
public Comments(Integer commentsId, Integer userId, String photo,
String words, Integer pointRatio, Date sending, String viewName) {
super();
this.commentsId = commentsId;
this.userId = userId;
this.photo = photo;
this.words = words;
this.pointRatio = pointRatio;
this.sending = sending;
this.viewName = viewName;
}
public Integer getCommentsId() {
return commentsId;
}
public void setCommentsId(Integer commentsId) {
this.commentsId = commentsId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getWords() {
return words;
}
public void setWords(String words) {
this.words = words;
}
public Integer getPointRatio() {
return pointRatio;
}
public void setPointRatio(Integer pointRatio) {
this.pointRatio = pointRatio;
}
public Date getSending() {
return sending;
}
public void setSending(Date sending) {
this.sending = sending;
}
public String getViewName() {
return viewName;
}
public void setViewName(String viewName) {
this.viewName = viewName;
}
}
| [
"[email protected]"
]
| |
bc99287203ac5c115facae601fb263d0e2153686 | 8a040e5371e09083bbf5723d7dfa18f6b227f32e | /app/src/main/java/com/example/restfulapiandroid/api/ApiClient.java | 971cfc61e97cf5ef2c0ac895aae20930a3a26e40 | []
| no_license | ixiDev/RestfulApiAndroid | 21690fbd48fa2a2039974295a1fd603d320b35f1 | 06d3f91eea5d36c0c995fecdb416728cc891d6c4 | refs/heads/master | 2020-04-05T11:38:19.898083 | 2018-11-10T17:16:48 | 2018-11-10T17:16:48 | 156,842,408 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package com.example.restfulapiandroid.api;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by ixi.Dv on 09/11/2018.
* Email : [email protected]
*/
public class ApiClient {
public static final String API_BAS_URL = "http://10.0.3.2"; // change localhost to ip address
private static Retrofit.Builder getRetrofitInstance() {
return new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(API_BAS_URL);
}
public static ApiService getService() {
return getRetrofitInstance().build().create(ApiService.class);
}
}
| [
"[email protected]"
]
| |
1dd5d569eafd24cfac14e8de96107b23e2647c43 | 938f9f1d91150cd531e7607505dea9777a711c36 | /src/com/nicknackhacks/dailyburn/adapters/FoodWrapper.java | 8df33f241efa9c834025350c44f65ff8cc7fcea8 | []
| no_license | sporksmith/BurnBot | 106990a2ffffdc12208de8f902fe5d6f70964db1 | 6e19f2e603151189f505e3f38f2efec87ba0515d | refs/heads/master | 2021-01-16T22:48:56.341435 | 2010-08-15T05:19:49 | 2010-08-15T05:19:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,713 | java | package com.nicknackhacks.dailyburn.adapters;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.nicknackhacks.dailyburn.R;
import com.nicknackhacks.dailyburn.model.Food;
public class FoodWrapper {
TextView name;
TextView size;
TextView nutrition1;
TextView nutrition2;
ImageView icon;
View row;
public FoodWrapper(View row) {
this.row = row;
}
public void populateFrom(Food f) {
getName().setText(f.getName());
getSize().setText(f.getServingSize());
String tmp = "Cal: " + f.getCalories() + ", Fat: "
+ f.getTotalFat() + "g";
getNutrition1().setText(tmp);
tmp = "Carbs: " + f.getTotalCarbs() + "g, Protein: "
+ f.getProtein() + "g";
getNutrition2().setText(tmp);
if (f.getThumbUrl() != null) {
getIcon().setImageResource(R.drawable.icon);
getIcon().setTag("http://dailyburn.com" + f.getThumbUrl());
}
}
public TextView getName() {
if (name == null) {
name = (TextView) row.findViewById(R.id.foodrow_Name);
}
return name;
}
public TextView getSize() {
if (size == null) {
size = (TextView) row.findViewById(R.id.foodrow_Size);
}
return size;
}
public TextView getNutrition1() {
if (nutrition1 == null) {
nutrition1 = (TextView) row
.findViewById(R.id.foodrow_Nutrition1);
}
return nutrition1;
}
public TextView getNutrition2() {
if (nutrition2 == null) {
nutrition2 = (TextView) row
.findViewById(R.id.foodrow_Nutrition2);
}
return nutrition2;
}
public ImageView getIcon() {
if (icon == null) {
icon = (ImageView) row.findViewById(R.id.foodrow_Icon);
}
return (icon);
}
}
| [
"[email protected]"
]
| |
51c1b2d2d4a7cf9784d3c392fc0f37667ea09bed | bdf23ff1c84a320dfd6d7273b6e60715441872ee | /sunnyFrame/src/org/sunnyframework/core/common/model/json/Highchart.java | fdbf8207555f5c3dc97872478c143dc6f59a6727 | []
| no_license | myorgan1/myRep2 | 8b5658289d4a80cca7db0d0384971fc410d06961 | 4ba5704af34f05b53070b8cb1a1d5c9ed598de0d | refs/heads/master | 2020-03-09T05:11:16.440421 | 2018-12-28T03:45:03 | 2018-12-28T03:45:03 | 128,606,435 | 0 | 3 | null | 2018-04-08T14:32:10 | 2018-04-08T06:27:02 | JavaScript | UTF-8 | Java | false | false | 522 | java | package org.sunnyframework.core.common.model.json;
import java.util.List;
/**
* 统计报表模型
* @author sunyard
*
*/
public class Highchart {
private String name;
private String type;//类型
private List data;//数据
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List getData() {
return data;
}
public void setData(List data) {
this.data = data;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"[email protected]"
]
| |
465645067becc83de05a9db8d046e2ec37a1dcca | ee62b49485984f2e1bcac32d943c57ae43fee80f | /app/src/main/java/com/jasminelawrence/popularmoviesstage1/Movie.java | fdf0d9d2a935a56f6cd1f1260aa800d4990aa8b4 | []
| no_license | sunnyeyez123/popular-movies-stage1 | 16402ca6610477cb90b006559db494a4ab8f22f3 | 187c819129619a774c075dcf0c7d739bb123eb24 | refs/heads/master | 2020-03-15T10:28:19.428863 | 2018-07-26T06:45:39 | 2018-07-26T06:45:39 | 132,099,417 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,589 | java | package com.jasminelawrence.popularmoviesstage1;
import android.os.Parcel;
import android.os.Parcelable;
public class Movie implements Parcelable {
// After implementing the `Parcelable` interface, we need to create the
// `Parcelable.Creator<MyParcelable> CREATOR` constant for our class;
// Notice how it has our class specified as its type.
public static final Parcelable.Creator<Movie> CREATOR
= new Parcelable.Creator<Movie>() {
// This simply calls our new constructor (typically private) and
// passes along the unmarshalled `Parcel`, and then returns the new object!
@Override
public Movie createFromParcel(Parcel in) {
return new Movie(in);
}
// We just need to copy this and change the type to match our class.
@Override
public Movie[] newArray(int size) {
return new Movie[size];
}
};
private String originalTitle;
private String posterImage;
private String plotSynopsis;
private double userRating;
private String releaseDate;
public Movie(String originalTitle, String posterImage, String plotSynopsis, double userRating, String releaseDate) {
this.originalTitle = originalTitle;
this.posterImage = posterImage;
this.plotSynopsis = plotSynopsis;
this.userRating = userRating;
this.releaseDate = releaseDate;
}
// Using the `in` variable, we can retrieve the values that
// we originally wrote into the `Parcel`. This constructor is usually
// private so that only the `CREATOR` field can access.
private Movie(Parcel in) {
originalTitle = in.readString();
posterImage = in.readString();
plotSynopsis = in.readString();
userRating = in.readDouble();
releaseDate = in.readString();
}
public String getOriginalTitle() {
return originalTitle;
}
public String getPosterImage() {
return posterImage;
}
public String getPlotSynopsis() {
return plotSynopsis;
}
public double getUserRating() {
return userRating;
}
public String getReleaseDate() {
return releaseDate;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeString(originalTitle);
parcel.writeString(posterImage);
parcel.writeString(plotSynopsis);
parcel.writeDouble(userRating);
parcel.writeString(releaseDate);
}
}
| [
"[email protected]"
]
| |
2dccc2398787ac018312067450fa45e2612d057c | 2a55ca5fe8af7194c7ae2b3487b9176676bac487 | /Ramya_27-11-2018/iooperation/FileSeperatorDemo.java | df8669bbe348c5012f92bb7afe8916f6c3ec5e26 | []
| no_license | lavanya-gn/taranga-java-training | 2c858b75e3b7a06f8270c83d2d525f9ac0ae7c21 | 51868f77fc5c23f20a30d9eea82e663ad134e17b | refs/heads/master | 2020-05-24T08:22:12.372179 | 2019-02-18T08:20:03 | 2019-02-18T08:20:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package com.tharanga.iooperation;
import java.io.File;
public class FileSeperatorDemo {
public static void main(String[] args) {
System.out.println("File.separator = "+File.separator);
System.out.println("File.separatorChar = "+File.separatorChar);
System.out.println("File.pathSeparator = "+File.pathSeparator);
System.out.println("File.pathSeparatorChar = "+File.pathSeparatorChar);
}
}
| [
"[email protected]"
]
| |
ec82b28aeeb9528376a8d6952cb3c6214d8f3d43 | d05ac0e945576eb8e51cb38dcf7350296bacdba1 | /jboss-remoting/src/org/jboss/remoting/socketfactory/CreationListenerServerSocketFactory.java | af1b1b834d23d138b71d412704ecc421116773b8 | []
| no_license | Arckman/CBPM | 9b6a125ea2bebe44749c09cfc37f89fdc15d69b7 | 10663b40abf151c90d0b20878f8f7f20c8077b30 | refs/heads/master | 2016-09-06T09:02:15.819806 | 2014-05-22T02:40:16 | 2014-05-22T02:40:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,624 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.remoting.socketfactory;
import java.io.IOException;
import java.io.Serializable;
import java.net.InetAddress;
import java.net.ServerSocket;
import javax.net.ServerSocketFactory;
/**
* A CreationListenerServerSocketFactory wraps a ServerSocketFactory, and whenever
* the ServerSocketFactory creates a ServerSocket, the ServerSocket is wrapped in a
* CreationListenerServerSocket.
*
* @author <a href="[email protected]">Ron Sigal</a>
* @version $Revision: 1.1.2.2 $
* <p>
* Copyright Jan 10, 2007
* </p>
*/
public class CreationListenerServerSocketFactory
extends ServerSocketFactory
implements ServerSocketFactoryWrapper, Serializable
{
private static final long serialVersionUID = -7939318527267014514L;
private ServerSocketFactory factory;
private SocketCreationListener listener;
public CreationListenerServerSocketFactory(ServerSocketFactory factory,
SocketCreationListener listener)
{
this.factory = factory;
this.listener = listener;
}
public ServerSocketFactory getFactory()
{
return factory;
}
public SocketCreationListener getListener()
{
return listener;
}
public void setFactory(ServerSocketFactory factory)
{
this.factory = factory;
}
public void setListener(SocketCreationListener listener)
{
this.listener = listener;
}
public ServerSocket createServerSocket() throws IOException
{
ServerSocket serverSocket = factory.createServerSocket();
return new CreationListenerServerSocket(serverSocket, listener);
}
public ServerSocket createServerSocket(int port) throws IOException
{
ServerSocket serverSocket = factory.createServerSocket(port);
return new CreationListenerServerSocket(serverSocket, listener);
}
public ServerSocket createServerSocket(int port, int backlog) throws IOException
{
ServerSocket serverSocket = factory.createServerSocket(port, backlog);
return new CreationListenerServerSocket(serverSocket, listener);
}
public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress)
throws IOException
{
ServerSocket serverSocket = factory.createServerSocket(port, backlog, ifAddress);
return new CreationListenerServerSocket(serverSocket, listener);
}
public ServerSocketFactory getServerSocketFactory()
{
return factory;
}
public void setServerSocketFactory(ServerSocketFactory factory)
{
this.factory = factory;
}
}
| [
"[email protected]"
]
| |
619bcc73a4a8b0875657c03cf27a1b79b99b5576 | ec0cce44f1a3d70c1297afa7cdf2c3dfdcfb5e4d | /src/test/java/org/taxidermia/voteweekrestaurant/model/MemoryPersonRepositoryTest.java | 9f195a78f0d891166f66fb7896994faa09d58e6c | []
| no_license | rroldan/vote-week-restaurant | 24470f13719c48be3e40c15178a8a403cb0590ac | 73ab30881cfa6f079dc64a7e2659add9fb66b537 | refs/heads/master | 2021-01-20T11:04:46.728913 | 2015-08-06T22:45:41 | 2015-08-06T22:45:41 | 39,293,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,056 | java | package org.taxidermia.voteweekrestaurant.model;
import org.junit.Test;
import java.util.Collection;
import java.util.List;
import static org.junit.Assert.*;
public class MemoryPersonRepositoryTest {
@Test
public void testPersonRepositorySaveAndFindOneCorrect(){
PersonRepository personRepository = initPersonRepository();
Person personFixture = PersonTest.getPersonFixture(personRepository.nextIdentity(), "nickname");
personRepository.save(personFixture);
Person person = personRepository.personOfId(personFixture.getId());
assertNotNull(person);
assertEquals(personFixture.getId(), person.getId());
assertEquals(personFixture.getNickName(), person.getNickName());
}
@Test
public void testPersonRepositoryNextIdentity() {
long id=0;
PersonRepository personRepository = initPersonRepository();
long idNextIdentity = personRepository.nextIdentity();
assertNotEquals(id, personRepository.nextIdentity());
assertNotEquals(idNextIdentity, personRepository.nextIdentity());
}
@Test
public void testPersonRepositoryRemove(){
PersonRepository personRepository = initPersonRepository();
Person personFixture = PersonTest.getPersonFixture(personRepository.nextIdentity(), "nickname");
personRepository.save(personFixture);
personRepository.remove(personFixture);
Person person = personRepository.personOfId(personFixture.getId());
assertNull(person);
}
@Test
public void testPersonRepositoryAllPerson(){
PersonRepository personRepository = initPersonRepository();
Person personFixture = PersonTest.getPersonFixture(personRepository.nextIdentity(), "nickname");
personRepository.save(personFixture);
Collection<Person> personList = personRepository.allPerson();
assertEquals(1, personList.size());
Person person = personList.iterator().next();
assertNotNull(person);
assertEquals(personFixture.getId(), person.getId());
assertEquals(personFixture.getNickName(), person.getNickName());
}
@Test
public void testPersonRepositoryRemoveAll(){
PersonRepository personRepository = initPersonRepository();
Person personFixture = PersonTest.getPersonFixture(personRepository.nextIdentity(), "nickname");
personRepository.save(personFixture);
Person personFixture2 = PersonTest.getPersonFixture(personRepository.nextIdentity(), "nickname");
personRepository.save(personFixture2);
Collection<Person> personList = personRepository.allPerson();
assertEquals(2, personList.size());
personRepository.removeAll();
Collection<Person> personListRemove = personRepository.allPerson();
assertEquals(0, personListRemove.size());
}
private PersonRepository initPersonRepository(){
PersonRepository personRepository = new MemoryPersonRepository();
return personRepository;
}
}
| [
"[email protected]"
]
| |
f19ca06c95f20f7a132c8a83a1be7fc367484b45 | 89ac9deedf1de9580c75661f54160214b57b9a0b | /VDRMovie/src/net/go2mycloud/vdrmovie/MainVDRFragment.java | 394395eae2cfe0eb4063c72ed0e6c35a38eb67b5 | []
| no_license | MyCloud/VDR1 | c5d5b194816237b586e11d1ea3ad7b070a842c48 | 530fa18700967e54fdf24a5b07788343e66b8c90 | refs/heads/master | 2016-09-05T19:03:41.241142 | 2012-12-19T14:07:00 | 2012-12-19T14:07:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,712 | java | package net.go2mycloud.vdrmovie;
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.Fragment;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnCancelListener;
import android.database.SQLException;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.widget.CursorAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
public class MainVDRFragment extends Fragment {
/**
* The serialization (saved instance state) Bundle key representing the
* current dropdown position.
*/
private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item";
private DownloadVDR downloader;
private CustomEventAdapter customAdapter;
private DatabaseConnector datasource;
ListView listView;
ProgressDialog pleaseWaitDialog;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.fragment_vdrlist_overview,
container, false);
return view;
}
/**
* Backward-compatible version of {@link ActionBar#getThemedContext()} that
* simply returns the {@link android.app.Activity} if
* <code>getThemedContext</code> is unavailable.
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private Context getActionBarThemedContextCompat() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return super.getActivity().getActionBar().getThemedContext();
} else {
return super.getActivity();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId()) {
case R.id.menu_settings:
Toast.makeText(super.getActivity().getBaseContext(), "Menu settings", Toast.LENGTH_SHORT).show();
// The animation has ended, transition to the Main Menu screen
//startActivity(new Intent(QuizMenuActivity.this, QuizHelpActivity.class));
//QuizMenuActivity.this.finish();
break;
case R.id.menu_update:
Toast.makeText(super.getActivity().getBaseContext(), "Menu update", Toast.LENGTH_SHORT).show();
pleaseWaitDialog = ProgressDialog.show(super.getActivity().getBaseContext(),
"VDR Guid", "Downloading VDR Guid data", true, true);
pleaseWaitDialog.setOnCancelListener(new OnCancelListener() {
public void onCancel(DialogInterface dialog) {
Log.d("onOptionsItemSelected" , "onCancel ");
downloader.cancel(true);
}
});
if(downloader.getStatus() == AsyncTask.Status.FINISHED ) {
downloader = new DownloadVDR(super.getActivity().getBaseContext());
}
if(downloader.getStatus() == AsyncTask.Status.PENDING){
downloader.execute("");
}
break;
case android.R.id.home:
//Intent intent = new Intent(this, QuizSplashActivity.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//startActivity(intent);
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onSaveInstanceState(Bundle outState) {
// Serialize the current dropdown position.
outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, super.getActivity().getActionBar()
.getSelectedNavigationIndex());
}
}
| [
"[email protected]"
]
| |
a2c2a3237f637427c39ebc5000675ca899ea56ad | 9b365bd029284a46e79ca788f1b08588976656fc | /Week_04/个人每日刷题/P20200504/P78.java | c1a7ba6196ec20eef3de033c635b724bb8319973 | []
| no_license | wyc192273/algorithm008-class02 | 7a8415fd1ae43c1dfc6521754582e316fa2368dc | 1e4638609f8454c0c02202d660ea9eb103116fa6 | refs/heads/master | 2022-11-06T23:10:50.289261 | 2020-07-04T02:35:37 | 2020-07-04T02:35:37 | 255,090,685 | 0 | 0 | null | 2020-04-12T13:40:52 | 2020-04-12T13:40:52 | null | UTF-8 | Java | false | false | 804 | java | package leetcode.P20200504;
import java.util.ArrayList;
import java.util.List;
/**
* https://leetcode-cn.com/problems/subsets/
* Created by yuchen.wu on 2020-05-04
*/
public class P78 {
public List<List<Integer>> subsets(int[] nums) {
List<List<Integer>> result = new ArrayList<>();
result.add(new ArrayList<>());
subsets(0, result, new ArrayList<>(), nums);
return result;
}
private void subsets(int index, List<List<Integer>> result, List<Integer> list, int[] nums) {
if (index == nums.length) {
return;
}
subsets(index + 1, result, list, nums);
list.add(nums[index]);
result.add(new ArrayList<>(list));
subsets(index + 1, result, list, nums);
list.remove(list.size() - 1);
}
}
| [
"[email protected]"
]
| |
60e983bb5b13a0fbe5fa4fc5d5bc6ce9244a70f4 | 1bd86f837fdde15f035994b28d694adabc88004a | /JAVAEX2/src/com/javaex/exceptions/CustomArithmeticException.java | 922459e40b57a7fb95c1427b5b31c2f0c55e870c | []
| no_license | JM0222/JavaEx | c58ab0cd1d812ed58492df2db1817e7112a92591 | c61209847be55a394bb3e3160af681980dc565e7 | refs/heads/master | 2023-03-15T13:58:48.663638 | 2021-03-22T07:19:23 | 2021-03-22T07:19:23 | 342,141,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | package com.javaex.exceptions;
public class CustomArithmeticException extends ArithmeticException {
// 필드
private int num1;
private int num2;
// 생성자
public CustomArithmeticException(String message, int num1, int num2) {
super(message);
this.num1 = num1;
this.num2 = num2;
}
/**
* @return the num1
*/
public int getNum1() {
return num1;
}
/**
* @return the num2
*/
public int getNum2() {
return num2;
}
}
| [
"[email protected]"
]
| |
c80444316be11232c151397405a9ef64188d84e6 | fc58ffcbbc8aff4ea198d5e6f3d8e5f83177bdf4 | /config/src/main/java/org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerSecurity.java | 102078fbaa59f9a7c30430c308a95b962b12c818 | [
"Apache-2.0"
]
| permissive | lucasjo/spring-authorization-server | 003cc9f96430e0f3602866398e4532cb0a3ae675 | 1ecafc94205757a4ed53bb1ac1fc86c5740ce783 | refs/heads/master | 2022-11-28T16:05:27.601421 | 2020-08-12T20:26:27 | 2020-08-12T20:26:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,556 | java | /*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://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.springframework.security.config.annotation.web.configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer;
import static org.springframework.security.config.Customizer.withDefaults;
/**
* {@link WebSecurityConfigurerAdapter} providing default security configuration for OAuth 2.0 Authorization Server.
*
* @author Joe Grandja
* @since 0.0.1
*/
public class OAuth2AuthorizationServerSecurity extends WebSecurityConfigurerAdapter {
// @formatter:off
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests(authorizeRequests ->
authorizeRequests
.anyRequest().authenticated()
)
.formLogin(withDefaults())
.apply(new OAuth2AuthorizationServerConfigurer<>());
}
// @formatter:on
}
| [
"[email protected]"
]
| |
225e58437b741abbd89b852c890ff2e274baead9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/28/28_3812b03117130bd95ef16e8305ca3ab7bc8df4b1/SplashScreen/28_3812b03117130bd95ef16e8305ca3ab7bc8df4b1_SplashScreen_t.java | bd88dec6e97d155cbbc4c697045c76e135f2a449 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,628 | java | package com.gamelab.mmi;
import java.awt.List;
import java.sql.BatchUpdateException;
import java.util.Random;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Vector2;
public class SplashScreen implements Screen {
private Mmi game;
private SpriteBatch batch=new SpriteBatch();
private Texture texture;
private Sprite sprite;
private Button[] buttons=new Button[1];
public SplashScreen( Mmi game,String file) {
this.game=game;
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
texture = new Texture(Gdx.files.internal(file));
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion region = new TextureRegion(texture, 0, 0, 544, 338);
sprite = new Sprite(region);
sprite.setSize(0.9f, 0.9f * sprite.getHeight() / sprite.getWidth());
sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2);
sprite.setPosition(-sprite.getWidth()/2, -sprite.getHeight()/2);
Gdx.input.setInputProcessor(new InputProcessor() {
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
callback();
return false;
}
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean scrolled(int amount) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean mouseMoved(int screenX, int screenY) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean keyUp(int keycode) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean keyTyped(char character) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean keyDown(int keycode) {
// TODO Auto-generated method stub
return false;
}
});
}
@Override
public void render(float delta) {
update(delta);
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(sprite,Gdx.graphics.getWidth()/2-227,Gdx.graphics.getHeight()/2-338/2);
batch.end();
}
private void callback(){
game.showMenu();
}
public void update(float delta){
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void show() {
// TODO Auto-generated method stub
}
@Override
public void hide() {
// TODO Auto-generated method stub
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
batch.dispose();
texture.dispose();
}
}
| [
"[email protected]"
]
| |
2deef5e60de64fdb4f4129f99c99f6f01186ad58 | ceed28b7b586c381ba0dbd4e2f9e0cb27e1d3092 | /java1/src/ru/geekbrains/java1/dz/dz3/SerdakovAU/Main.java | 7ac6e61423efcdad5683a73aac9ecbb90186c335 | []
| no_license | serdakov/git-repo | b7e7656f38e6fe76d795ddb876dcfe8379d95d8e | 7f641558b0f09c913e4f5d9d573cbfd86dc269e9 | refs/heads/master | 2020-03-23T05:57:00.921690 | 2018-12-05T13:09:51 | 2018-12-05T13:09:51 | 141,178,803 | 0 | 0 | null | 2018-12-12T13:37:20 | 2018-07-16T18:37:27 | Java | UTF-8 | Java | false | false | 1,493 | java | package ru.geekbrains.java1.dz.dz3.SerdakovAU;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
while (true) {
guessNumber();
Scanner scanner = new Scanner(System.in);
System.out.println("Повторить игру еще раз? 1 – да / 0 – нет");
int n = scanner.nextInt();
if (n == 0) {
break;
}
}
}
public static void guessNumber() {
Scanner scanner = new Scanner(System.in);
Random rand = new Random();
int number = rand.nextInt(10);
int n = 1;
while (n < 4) {
System.out.println("Угадайте число от 0 до 9");
int input_number = scanner.nextInt();
if (input_number == number) {
System.out.println("Вы угадали");
break;
} else if (input_number > number) {
System.out.println("Загаданное число меньше");
n++;
if (n == 4) {
System.out.println("Вы проиграли");
}
} else {
System.out.println("Загаданное число больше");
n++;
if (n == 4) {
System.out.println("Вы проиграли");
}
}
}
}
}
| [
"[email protected]"
]
| |
b8696226f230781441a56bded0acecfb07525b81 | b906616e1f403bf4d284418deaea398b16b6a5e9 | /src/com/yuzx/taskcoach/weather/WeatherUtil.java | 61f619bdc10bd8aa10202eb120b7fb66a7e121c8 | []
| no_license | yuzx99/TaskCoach | 6ea2b4819939e4c6b4b15a50e4f1134c9c1f4e07 | c31caf39391de1a50608abe98fe1e9a304497fa6 | refs/heads/master | 2021-01-01T15:23:23.225398 | 2014-06-26T12:28:13 | 2014-06-26T12:28:13 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,437 | java | /**
*
*/
package com.yuzx.taskcoach.weather;
import java.util.ArrayList;
import java.util.List;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
/**
* @author yuzx
*
*/
public class WeatherUtil {
// 定义Web Service的命名空间
static final String SERVICE_NS = "http://WebXml.com.cn/";
// 定义Web Service提供服务的URL
static final String SERVICE_URL = "http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx";
/**
* 获得州,国内外省份和城市信息
*
* @return
*/
public static List<String> getProvinceList()
{
// 需要调用的方法名(获得本天气预报Web Services支持的洲、国内外省份和城市信息)
String methodName = "getRegionProvince";
// 创建HttpTransportSE传输对象
HttpTransportSE httpTranstation = new HttpTransportSE(SERVICE_URL);
httpTranstation.debug = true;
// 使用SOAP1.1协议创建Envelop对象
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
// 实例化SoapObject对象
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
envelope.bodyOut = soapObject;
// 设置与.Net提供的Web Service保持较好的兼容性
envelope.dotNet = true;
try
{
// 调用Web Service
httpTranstation.call(SERVICE_NS + methodName, envelope);
if (envelope.getResponse() != null)
{
// 获取服务器响应返回的SOAP消息
SoapObject result = (SoapObject) envelope.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(methodName
+ "Result");
// 解析服务器响应的SOAP消息。
return parseProvinceOrCity(detail);
}
} catch (Exception e)
{
e.printStackTrace();
}
return null;
}
/**
* 根据省份获取城市列表
*
* @param province
* @return
*/
public static List<String> getCityListByProvince(String province)
{
// 需要调用的方法名(获得本天气预报Web Services支持的城市信息,根据省份查询城市集合:带参数)
String methodName = "getSupportCityString";
HttpTransportSE httpTranstation = new HttpTransportSE(SERVICE_URL);
httpTranstation.debug = true;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
soapObject.addProperty("theRegionCode", province);
envelope.bodyOut = soapObject;
envelope.dotNet = true;
try
{
// 调用Web Service
httpTranstation.call(SERVICE_NS + methodName, envelope);
if (envelope.getResponse() != null)
{
// 获取服务器响应返回的SOAP消息
SoapObject result = (SoapObject) envelope.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(methodName
+ "Result");
// 解析服务器响应的SOAP消息。
return parseProvinceOrCity(detail);
}
} catch (Exception e)
{
e.printStackTrace();
}
return null;
}
private static List<String> parseProvinceOrCity(SoapObject detail)
{
ArrayList<String> result = new ArrayList<String>();
for (int i = 0; i < detail.getPropertyCount(); i++)
{
String str = detail.getProperty(i).toString();
// 解析出每个省份
result.add(str.split(",")[0]);
}
return result;
}
public static SoapObject getWeatherByCity(String cityName)
{
// 根据城市或地区名称查询获得未来三天内天气情况、现在的天气实况、天气和生活指数
String methodName = "getWeather";
HttpTransportSE httpTranstation = new HttpTransportSE(SERVICE_URL);
httpTranstation.debug = true;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
soapObject.addProperty("theCityCode", cityName);
envelope.bodyOut = soapObject;
envelope.dotNet = true;
try
{
// 调用Web Service
httpTranstation.call(SERVICE_NS + methodName, envelope);
if (envelope.getResponse() != null)
{
// 获取服务器响应返回的SOAP消息
SoapObject result = (SoapObject) envelope.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(methodName
+ "Result");
// 解析服务器响应的SOAP消息。
return detail;
}
} catch (Exception e)
{
e.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
]
| |
dc11759345ab53bbe921de250cb90cc38c5613fe | 9e3314ff3cf2160064ad6d09eb39ac012fdc735f | /Android/app/SettingProfile.java | 36e515be43126f7a8480ea806a126a45fd705d1f | [
"MIT"
]
| permissive | Prabodh12/VETO | 6f683bc6375c720bd70acf7df555cab1cb1901a9 | 1cec3c9d12700761adc951ec1cc6019642df2176 | refs/heads/master | 2020-06-28T07:35:48.919532 | 2019-03-17T06:59:36 | 2019-03-17T06:59:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,824 | java | package com.example.veto;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
public class SettingProfile extends AppCompatActivity {
TextView nameInput1,emailInput1,mobileInput1,genderInput1,addressInput1;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting_profile);
btn=(Button)findViewById(R.id.SPbutton1);
nameInput1=findViewById(R.id.SPText6);
emailInput1=findViewById(R.id.SPText8);
mobileInput1=findViewById(R.id.SPText10);
genderInput1=findViewById(R.id.SPText12);
addressInput1=findViewById(R.id.SPText14);
getFromMyServer();
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(getApplicationContext(),EditProfile.class);
startActivity(intent);
}
});
}
public void getFromMyServer(){
String server_url="http://192.168.42.156:8080/profile/view";
RequestQueue requestQueue= Volley.newRequestQueue(getApplicationContext());
final JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("username","sky44");
}catch(JSONException e){
e.printStackTrace();;
}
final String stringObject=jsonObject.toString();
StringRequest stringRequest=new StringRequest(Request.Method.POST, server_url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(getApplicationContext(),"Got some Response from server",Toast.LENGTH_SHORT).show();
try {
recievedData(response);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), error.toString(), Toast.LENGTH_SHORT).show();
}
})
{
@Override
public String getBodyContentType(){ return "application/json; charset=utf-8";}
@Override
public byte[] getBody() throws AuthFailureError {
try {
return stringObject == null ? null : stringObject.getBytes("utf-8");
}catch (UnsupportedEncodingException em){
return null;
}
}
};
requestQueue.add(stringRequest);
}
public void recievedData(String response) throws JSONException {
JSONObject jsonObject=new JSONObject(response);
nameInput1.setText(jsonObject.getString("name"));
genderInput1.setText(jsonObject.getString("gender"));
emailInput1.setText(jsonObject.getString("email"));
mobileInput1.setText(jsonObject.getString("mobile_no"));
addressInput1.setText(jsonObject.getString("address"));
}
}
| [
"[email protected]"
]
| |
3ac0ed4d2b8a896ad19c161da814dcf6adf40f42 | d34b097ecc98955dcd7b56fe18206c2757cd9c58 | /Aula130820AvaliacaoFinal/app/src/main/java/game/curso/aula130820avaliacaofinal/CheckListActivity.java | c162e2aecb389a0652105b05a1901261422d97d0 | []
| no_license | JeremiasNS/PDM_II_2020 | 9e3651335d4b8d9f570aa43e3fc7aa6e471cfa68 | 83ebc1a1fa851fde970f041f7159b1b88af02a85 | refs/heads/master | 2020-12-24T00:09:15.383988 | 2020-08-26T21:05:51 | 2020-08-26T21:05:51 | 237,316,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,125 | java | package game.curso.aula130820avaliacaofinal;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
public class CheckListActivity extends AppCompatActivity {
private ListView listView;
private FloatingActionButton floatingActionButton;
private final String CHANNEL_ID = "1";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_check_list);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
listView = findViewById(R.id.checkList);
floatingActionButton = findViewById(R.id.floating_action_button);
Intent i = getIntent();
toolbar.setTitle(i.getStringExtra("NOME"));
setSupportActionBar(toolbar);
ArrayList perguntasList = getListData();
listView.setAdapter(new CustomListAdapter(this, perguntasList));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
}
});
floatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/*createNotificationChannel();
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle("Possíveis sintomas do COVID")
.setContentText("Cique e descubra as recomendações.")
.setStyle(new NotificationCompat.BigTextStyle()
.bigText("De acordo com os sintomas apresentados,\n" +
" há de ser um possível resfriado"))
.setPriority(Notification.PRIORITY_DEFAULT);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplicationContext());
// notificationId is a unique int for each notification that you must define
notificationManager.notify(1, builder.build());
Intent i = new Intent(getApplicationContext(), RecomendacaoCovidActivity.class);
startActivity(i);
finish();*/
ListItem user = (ListItem) listView.getItemAtPosition(0);
Log.e("Name Tag: ", user.getNome() );
}
});
}
private ArrayList getListData() {
ArrayList<ListItem> results = new ArrayList<>();
String[] perguntasText = getResources().getStringArray(R.array.perguntas);
String[] perguntasIcone = getResources().getStringArray(R.array.iconePerguntas);
ListItem[] perguntas = new ListItem[perguntasText.length];
Spinner[] spinner = new Spinner[perguntasText.length];
//Integer perguntaId = getResources().getIdentifier("pergunta" + j,"string", getPackageName());
for (int j = 0; j < perguntasText.length; j++) {
perguntas[j] = new ListItem(perguntasText[j],
getResources().getIdentifier(perguntasIcone[j],
"drawable", getPackageName()), spinner[j]);
results.add(perguntas[j]);
}
return results;
}
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = getString(R.string.channel_name);
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
} | [
"[email protected]"
]
| |
6d9e59a78888fb466371ff42dbc1ae60529527a0 | 86f942558b8df61c565b5ea2d6f3ffa0848d5b1e | /src/main/java/com/yanxisir/neb/service/INebApiUserService.java | 5b42fa2e04696e3ca11ea851f83b098264a2a8ac | []
| no_license | YanxiSir/neb-api | 3a7d383f5e6e5d50a8580ead310fda2982e522ee | 970e183f0698a0d78ab895035362219b201ec431 | refs/heads/master | 2020-03-18T03:15:48.745068 | 2018-06-03T15:16:18 | 2018-06-03T15:16:18 | 134,231,112 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package com.yanxisir.neb.service;
import com.yanxisir.neb.bean.*;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import rx.Observable;
/**
* https://github.com/nebulasio/wiki/blob/master/rpc.md
*
* @author YanxiSir
* @since 2018/5/18
*/
public interface INebApiUserService {
@GET("/v1/user/nebstate")
Observable<NebResult<NebStateResp>> nebState();
@POST("/v1/user/accountstate")
Observable<NebResult<AccountStateResp>> accountState(@Body AccountStateReq req);
@GET("/v1/user/lib")
Observable<NebResult<LatestIrreversibleBlockResp>> lib();
@POST("/v1/user/call")
Observable<CallResp> call(@Body CallReq req);
@POST("/v1/user/rawtransaction")
Observable<NebResult<RawTransactionResp>> rawTransaction(@Body RawTransactionReq req);
@POST("/v1/user/getBlockByHash")
Observable<NebResult<BlockByHashResp>> blockByHash(@Body BlockByHashReq req);
@POST("/v1/user/getBlockByHeight")
Observable<NebResult<BlockByHeightResp>> blockByHeight(@Body BlockByHeightReq req);
@POST("/v1/user/getTransactionReceipt")
Observable<NebResult<TransactionReceiptResp>> transactionReceipt(@Body TransactionReceiptReq req);
@POST("/v1/user/getTransactionByContract")
Observable<NebResult<TransactionByContractResp>> transactionByContract(@Body TransactionByContractReq req);
@GET("/v1/user/getGasPrice")
Observable<NebResult<GasPriceResp>> gasPrice();
@POST("/v1/user/estimateGas")
Observable<EstimateGasResp> estimateGas(@Body EstimateGasReq req);
@POST("/v1/user/getEventsByHash")
Observable<NebResult<EventsByHashResp>> eventsByHash(@Body EventsByHashReq req);
@POST("/v1/user/dynasty")
Observable<NebResult<DynastyResp>> dynasty(@Body DynastyReq req);
}
| [
"[email protected]"
]
| |
8fbfca26b4c3813fbce0242e9917cf0927e58e99 | 029943a736db4a19700dc5e8093ffac451b0eec8 | /src/com/vidyo/webservices/user/SetMemberModeResponse.java | 90de5a13745d8579a9f6278c639fb99f0c36c22a | []
| no_license | hsolia/rankrepo | 8c051ba5704cc81c2d93c061b6c38931e564cb0a | 5a26c815a0e485d6a3294d4eaa7ac876a0ea7110 | refs/heads/master | 2021-01-25T07:19:47.078792 | 2012-09-21T06:56:47 | 2012-09-21T06:56:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,500 | java |
package com.vidyo.webservices.user;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://portal.vidyo.com/user/v1_1}OK"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"ok"
})
@XmlRootElement(name = "SetMemberModeResponse")
public class SetMemberModeResponse {
@XmlElement(name = "OK", required = true)
protected String ok;
/**
* Gets the value of the ok property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOK() {
return ok;
}
/**
* Sets the value of the ok property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOK(String value) {
this.ok = value;
}
}
| [
"[email protected]"
]
| |
5ab2bb9750ef1e681b0d0a456d9a0295d392c045 | e2f6808efac2bdfae8ddfd1be97ff1482d8c996c | /build/javasqlc/srcAD/org/openbravo/erpWindows/Reference/ListReferenceInstanceSpecificData.java | e7a5e20f8a4f1788dc6832f88799d9ba778c02b0 | []
| no_license | Omeru/ELREHA_ERP | 4741f6c88d6d76797e9e6386fe3d8162353e3eb7 | 0935d9598684dde1669cbddf85c82f49a080d85e | refs/heads/master | 2020-04-30T10:43:39.181327 | 2016-11-09T12:41:05 | 2016-11-09T12:41:05 | 64,836,671 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 36,413 | java | //Sqlc generated V1.O00-1
package org.openbravo.erpWindows.Reference;
import java.sql.*;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import org.openbravo.data.FieldProvider;
import org.openbravo.database.ConnectionProvider;
import org.openbravo.data.UtilSql;
import org.openbravo.data.FResponse;
import java.util.*;
/**
WAD Generated class
*/
class ListReferenceInstanceSpecificData implements FieldProvider {
static Logger log4j = Logger.getLogger(ListReferenceInstanceSpecificData.class);
private String InitRecordNumber="0";
public String created;
public String createdbyr;
public String updated;
public String updatedTimeStamp;
public String updatedby;
public String updatedbyr;
public String adRefListinstanceId;
public String adRefListId;
public String adRefListIdr;
public String adReferenceId;
public String adReferenceIdr;
public String adClientId;
public String adOrgId;
public String ishidden;
public String value;
public String isactive;
public String name;
public String seqno;
public String isdefault;
public String adWindowId;
public String adWindowIdr;
public String adTabId;
public String adTabIdr;
public String language;
public String adUserClient;
public String adOrgClient;
public String createdby;
public String trBgcolor;
public String totalCount;
public String dateTimeFormat;
public String getInitRecordNumber() {
return InitRecordNumber;
}
public String getField(String fieldName) {
if (fieldName.equalsIgnoreCase("created"))
return created;
else if (fieldName.equalsIgnoreCase("createdbyr"))
return createdbyr;
else if (fieldName.equalsIgnoreCase("updated"))
return updated;
else if (fieldName.equalsIgnoreCase("updated_time_stamp") || fieldName.equals("updatedTimeStamp"))
return updatedTimeStamp;
else if (fieldName.equalsIgnoreCase("updatedby"))
return updatedby;
else if (fieldName.equalsIgnoreCase("updatedbyr"))
return updatedbyr;
else if (fieldName.equalsIgnoreCase("ad_ref_listinstance_id") || fieldName.equals("adRefListinstanceId"))
return adRefListinstanceId;
else if (fieldName.equalsIgnoreCase("ad_ref_list_id") || fieldName.equals("adRefListId"))
return adRefListId;
else if (fieldName.equalsIgnoreCase("ad_ref_list_idr") || fieldName.equals("adRefListIdr"))
return adRefListIdr;
else if (fieldName.equalsIgnoreCase("ad_reference_id") || fieldName.equals("adReferenceId"))
return adReferenceId;
else if (fieldName.equalsIgnoreCase("ad_reference_idr") || fieldName.equals("adReferenceIdr"))
return adReferenceIdr;
else if (fieldName.equalsIgnoreCase("ad_client_id") || fieldName.equals("adClientId"))
return adClientId;
else if (fieldName.equalsIgnoreCase("ad_org_id") || fieldName.equals("adOrgId"))
return adOrgId;
else if (fieldName.equalsIgnoreCase("ishidden"))
return ishidden;
else if (fieldName.equalsIgnoreCase("value"))
return value;
else if (fieldName.equalsIgnoreCase("isactive"))
return isactive;
else if (fieldName.equalsIgnoreCase("name"))
return name;
else if (fieldName.equalsIgnoreCase("seqno"))
return seqno;
else if (fieldName.equalsIgnoreCase("isdefault"))
return isdefault;
else if (fieldName.equalsIgnoreCase("ad_window_id") || fieldName.equals("adWindowId"))
return adWindowId;
else if (fieldName.equalsIgnoreCase("ad_window_idr") || fieldName.equals("adWindowIdr"))
return adWindowIdr;
else if (fieldName.equalsIgnoreCase("ad_tab_id") || fieldName.equals("adTabId"))
return adTabId;
else if (fieldName.equalsIgnoreCase("ad_tab_idr") || fieldName.equals("adTabIdr"))
return adTabIdr;
else if (fieldName.equalsIgnoreCase("language"))
return language;
else if (fieldName.equals("adUserClient"))
return adUserClient;
else if (fieldName.equals("adOrgClient"))
return adOrgClient;
else if (fieldName.equals("createdby"))
return createdby;
else if (fieldName.equals("trBgcolor"))
return trBgcolor;
else if (fieldName.equals("totalCount"))
return totalCount;
else if (fieldName.equals("dateTimeFormat"))
return dateTimeFormat;
else {
log4j.debug("Field does not exist: " + fieldName);
return null;
}
}
/**
Select for edit
*/
public static ListReferenceInstanceSpecificData[] selectEdit(ConnectionProvider connectionProvider, String dateTimeFormat, String paramLanguage, String adRefListId, String key, String adUserClient, String adOrgClient) throws ServletException {
return selectEdit(connectionProvider, dateTimeFormat, paramLanguage, adRefListId, key, adUserClient, adOrgClient, 0, 0);
}
/**
Select for edit
*/
public static ListReferenceInstanceSpecificData[] selectEdit(ConnectionProvider connectionProvider, String dateTimeFormat, String paramLanguage, String adRefListId, String key, String adUserClient, String adOrgClient, int firstRegister, int numberRegisters) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT to_char(ad_ref_listinstance.Created, ?) as created, " +
" (SELECT NAME FROM AD_USER u WHERE AD_USER_ID = ad_ref_listinstance.CreatedBy) as CreatedByR, " +
" to_char(ad_ref_listinstance.Updated, ?) as updated, " +
" to_char(ad_ref_listinstance.Updated, 'YYYYMMDDHH24MISS') as Updated_Time_Stamp, " +
" ad_ref_listinstance.UpdatedBy, " +
" (SELECT NAME FROM AD_USER u WHERE AD_USER_ID = ad_ref_listinstance.UpdatedBy) as UpdatedByR," +
" ad_ref_listinstance.AD_Ref_Listinstance_ID, " +
"ad_ref_listinstance.AD_Ref_List_ID, " +
"(CASE WHEN ad_ref_listinstance.AD_Ref_List_ID IS NULL THEN '' ELSE (COALESCE(TO_CHAR(TO_CHAR(COALESCE(TO_CHAR((CASE WHEN tableTRL1.Name IS NULL THEN TO_CHAR(table1.Name) ELSE TO_CHAR(tableTRL1.Name) END)), ''))),'') ) END) AS AD_Ref_List_IDR, " +
"ad_ref_listinstance.AD_Reference_ID, " +
"(CASE WHEN ad_ref_listinstance.AD_Reference_ID IS NULL THEN '' ELSE (COALESCE(TO_CHAR(TO_CHAR(COALESCE(TO_CHAR((CASE WHEN tableTRL2.Name IS NULL THEN TO_CHAR(table2.Name) ELSE TO_CHAR(tableTRL2.Name) END)), ''))),'') || ' - ' || COALESCE(TO_CHAR(list1.name),'') ) END) AS AD_Reference_IDR, " +
"ad_ref_listinstance.AD_Client_ID, " +
"ad_ref_listinstance.AD_Org_ID, " +
"COALESCE(ad_ref_listinstance.Ishidden, 'N') AS Ishidden, " +
"ad_ref_listinstance.Value, " +
"COALESCE(ad_ref_listinstance.Isactive, 'N') AS Isactive, " +
"ad_ref_listinstance.Name, " +
"ad_ref_listinstance.Seqno, " +
"COALESCE(ad_ref_listinstance.Isdefault, 'N') AS Isdefault, " +
"ad_ref_listinstance.AD_Window_ID, " +
"(CASE WHEN ad_ref_listinstance.AD_Window_ID IS NULL THEN '' ELSE (COALESCE(TO_CHAR(TO_CHAR(COALESCE(TO_CHAR((CASE WHEN tableTRL3.Name IS NULL THEN TO_CHAR(table3.Name) ELSE TO_CHAR(tableTRL3.Name) END)), ''))),'') ) END) AS AD_Window_IDR, " +
"ad_ref_listinstance.AD_Tab_ID, " +
"(CASE WHEN ad_ref_listinstance.AD_Tab_ID IS NULL THEN '' ELSE (COALESCE(TO_CHAR(TO_CHAR(COALESCE(TO_CHAR((CASE WHEN tableTRL4.Name IS NULL THEN TO_CHAR(table4.Name) ELSE TO_CHAR(tableTRL4.Name) END)), ''))),'') || ' - ' || COALESCE(TO_CHAR(TO_CHAR(COALESCE(TO_CHAR((CASE WHEN tableTRL5.Name IS NULL THEN TO_CHAR(table5.Name) ELSE TO_CHAR(tableTRL5.Name) END)), ''))),'') ) END) AS AD_Tab_IDR, " +
" ? AS LANGUAGE " +
" FROM ad_ref_listinstance left join (select AD_Ref_List_ID, Name from AD_Ref_List) table1 on (ad_ref_listinstance.AD_Ref_List_ID = table1.AD_Ref_List_ID) left join (select AD_Ref_List_ID,AD_Language, Name from AD_Ref_List_TRL) tableTRL1 on (table1.AD_Ref_List_ID = tableTRL1.AD_Ref_List_ID and tableTRL1.AD_Language = ?) left join (select AD_Reference_ID, Name, ValidationType from AD_Reference) table2 on (ad_ref_listinstance.AD_Reference_ID = table2.AD_Reference_ID) left join (select AD_Reference_ID,AD_Language, Name from AD_Reference_TRL) tableTRL2 on (table2.AD_Reference_ID = tableTRL2.AD_Reference_ID and tableTRL2.AD_Language = ?) left join ad_ref_list_v list1 on (table2.ValidationType = list1.value and list1.ad_reference_id = '2' and list1.ad_language = ?) left join (select AD_Window_ID, Name from AD_Window) table3 on (ad_ref_listinstance.AD_Window_ID = table3.AD_Window_ID) left join (select AD_Window_ID,AD_Language, Name from AD_Window_TRL) tableTRL3 on (table3.AD_Window_ID = tableTRL3.AD_Window_ID and tableTRL3.AD_Language = ?) left join (select AD_Tab_ID, Name, AD_Window_ID from AD_Tab) table4 on (ad_ref_listinstance.AD_Tab_ID = table4.AD_Tab_ID) left join (select AD_Tab_ID,AD_Language, Name from AD_Tab_TRL) tableTRL4 on (table4.AD_Tab_ID = tableTRL4.AD_Tab_ID and tableTRL4.AD_Language = ?) left join (select AD_Window_ID, Name from AD_Window) table5 on (table4.AD_Window_ID = table5.AD_Window_ID) left join (select AD_Window_ID,AD_Language, Name from AD_Window_TRL) tableTRL5 on (table5.AD_Window_ID = tableTRL5.AD_Window_ID and tableTRL5.AD_Language = ?) " +
" WHERE 2=2 " +
" AND 1=1 ";
strSql = strSql + ((adRefListId==null || adRefListId.equals(""))?"":" AND ad_ref_listinstance.AD_Ref_List_ID = ? ");
strSql = strSql +
" AND ad_ref_listinstance.AD_Ref_Listinstance_ID = ? " +
" AND ad_ref_listinstance.AD_Client_ID IN (";
strSql = strSql + ((adUserClient==null || adUserClient.equals(""))?"":adUserClient);
strSql = strSql +
") " +
" AND ad_ref_listinstance.AD_Org_ID IN (";
strSql = strSql + ((adOrgClient==null || adOrgClient.equals(""))?"":adOrgClient);
strSql = strSql +
") ";
ResultSet result;
Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, dateTimeFormat);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, dateTimeFormat);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
if (adRefListId != null && !(adRefListId.equals(""))) {
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
}
iParameter++; UtilSql.setValue(st, iParameter, 12, null, key);
if (adUserClient != null && !(adUserClient.equals(""))) {
}
if (adOrgClient != null && !(adOrgClient.equals(""))) {
}
result = st.executeQuery();
long countRecord = 0;
long countRecordSkip = 1;
boolean continueResult = true;
while(countRecordSkip < firstRegister && continueResult) {
continueResult = result.next();
countRecordSkip++;
}
while(continueResult && result.next()) {
countRecord++;
ListReferenceInstanceSpecificData objectListReferenceInstanceSpecificData = new ListReferenceInstanceSpecificData();
objectListReferenceInstanceSpecificData.created = UtilSql.getValue(result, "created");
objectListReferenceInstanceSpecificData.createdbyr = UtilSql.getValue(result, "createdbyr");
objectListReferenceInstanceSpecificData.updated = UtilSql.getValue(result, "updated");
objectListReferenceInstanceSpecificData.updatedTimeStamp = UtilSql.getValue(result, "updated_time_stamp");
objectListReferenceInstanceSpecificData.updatedby = UtilSql.getValue(result, "updatedby");
objectListReferenceInstanceSpecificData.updatedbyr = UtilSql.getValue(result, "updatedbyr");
objectListReferenceInstanceSpecificData.adRefListinstanceId = UtilSql.getValue(result, "ad_ref_listinstance_id");
objectListReferenceInstanceSpecificData.adRefListId = UtilSql.getValue(result, "ad_ref_list_id");
objectListReferenceInstanceSpecificData.adRefListIdr = UtilSql.getValue(result, "ad_ref_list_idr");
objectListReferenceInstanceSpecificData.adReferenceId = UtilSql.getValue(result, "ad_reference_id");
objectListReferenceInstanceSpecificData.adReferenceIdr = UtilSql.getValue(result, "ad_reference_idr");
objectListReferenceInstanceSpecificData.adClientId = UtilSql.getValue(result, "ad_client_id");
objectListReferenceInstanceSpecificData.adOrgId = UtilSql.getValue(result, "ad_org_id");
objectListReferenceInstanceSpecificData.ishidden = UtilSql.getValue(result, "ishidden");
objectListReferenceInstanceSpecificData.value = UtilSql.getValue(result, "value");
objectListReferenceInstanceSpecificData.isactive = UtilSql.getValue(result, "isactive");
objectListReferenceInstanceSpecificData.name = UtilSql.getValue(result, "name");
objectListReferenceInstanceSpecificData.seqno = UtilSql.getValue(result, "seqno");
objectListReferenceInstanceSpecificData.isdefault = UtilSql.getValue(result, "isdefault");
objectListReferenceInstanceSpecificData.adWindowId = UtilSql.getValue(result, "ad_window_id");
objectListReferenceInstanceSpecificData.adWindowIdr = UtilSql.getValue(result, "ad_window_idr");
objectListReferenceInstanceSpecificData.adTabId = UtilSql.getValue(result, "ad_tab_id");
objectListReferenceInstanceSpecificData.adTabIdr = UtilSql.getValue(result, "ad_tab_idr");
objectListReferenceInstanceSpecificData.language = UtilSql.getValue(result, "language");
objectListReferenceInstanceSpecificData.adUserClient = "";
objectListReferenceInstanceSpecificData.adOrgClient = "";
objectListReferenceInstanceSpecificData.createdby = "";
objectListReferenceInstanceSpecificData.trBgcolor = "";
objectListReferenceInstanceSpecificData.totalCount = "";
objectListReferenceInstanceSpecificData.InitRecordNumber = Integer.toString(firstRegister);
vector.addElement(objectListReferenceInstanceSpecificData);
if (countRecord >= numberRegisters && numberRegisters != 0) {
continueResult = false;
}
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
ListReferenceInstanceSpecificData objectListReferenceInstanceSpecificData[] = new ListReferenceInstanceSpecificData[vector.size()];
vector.copyInto(objectListReferenceInstanceSpecificData);
return(objectListReferenceInstanceSpecificData);
}
/**
Create a registry
*/
public static ListReferenceInstanceSpecificData[] set(String adRefListId, String updatedby, String updatedbyr, String seqno, String adClientId, String isactive, String adTabId, String adWindowId, String adRefListinstanceId, String name, String value, String adOrgId, String adReferenceId, String ishidden, String isdefault, String createdby, String createdbyr) throws ServletException {
ListReferenceInstanceSpecificData objectListReferenceInstanceSpecificData[] = new ListReferenceInstanceSpecificData[1];
objectListReferenceInstanceSpecificData[0] = new ListReferenceInstanceSpecificData();
objectListReferenceInstanceSpecificData[0].created = "";
objectListReferenceInstanceSpecificData[0].createdbyr = createdbyr;
objectListReferenceInstanceSpecificData[0].updated = "";
objectListReferenceInstanceSpecificData[0].updatedTimeStamp = "";
objectListReferenceInstanceSpecificData[0].updatedby = updatedby;
objectListReferenceInstanceSpecificData[0].updatedbyr = updatedbyr;
objectListReferenceInstanceSpecificData[0].adRefListinstanceId = adRefListinstanceId;
objectListReferenceInstanceSpecificData[0].adRefListId = adRefListId;
objectListReferenceInstanceSpecificData[0].adRefListIdr = "";
objectListReferenceInstanceSpecificData[0].adReferenceId = adReferenceId;
objectListReferenceInstanceSpecificData[0].adReferenceIdr = "";
objectListReferenceInstanceSpecificData[0].adClientId = adClientId;
objectListReferenceInstanceSpecificData[0].adOrgId = adOrgId;
objectListReferenceInstanceSpecificData[0].ishidden = ishidden;
objectListReferenceInstanceSpecificData[0].value = value;
objectListReferenceInstanceSpecificData[0].isactive = isactive;
objectListReferenceInstanceSpecificData[0].name = name;
objectListReferenceInstanceSpecificData[0].seqno = seqno;
objectListReferenceInstanceSpecificData[0].isdefault = isdefault;
objectListReferenceInstanceSpecificData[0].adWindowId = adWindowId;
objectListReferenceInstanceSpecificData[0].adWindowIdr = "";
objectListReferenceInstanceSpecificData[0].adTabId = adTabId;
objectListReferenceInstanceSpecificData[0].adTabIdr = "";
objectListReferenceInstanceSpecificData[0].language = "";
return objectListReferenceInstanceSpecificData;
}
/**
Select for auxiliar field
*/
public static String selectDefAF3D277F70304A38964CAE2A24C8EC44_0(ConnectionProvider connectionProvider, String UpdatedbyR) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT ( COALESCE(TO_CHAR(table1.Name), '') ) as Updatedby FROM AD_User table1 WHERE table1.isActive='Y' AND table1.AD_User_ID = ? ";
ResultSet result;
String strReturn = "";
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, UpdatedbyR);
result = st.executeQuery();
if(result.next()) {
strReturn = UtilSql.getValue(result, "updatedby");
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(strReturn);
}
/**
Select for auxiliar field
*/
public static String selectDef57AA0E1D92A94D2EA1FF8A19A2F689C9_1(ConnectionProvider connectionProvider, String CreatedbyR) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT ( COALESCE(TO_CHAR(table1.Name), '') ) as Createdby FROM AD_User table1 WHERE table1.isActive='Y' AND table1.AD_User_ID = ? ";
ResultSet result;
String strReturn = "";
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, CreatedbyR);
result = st.executeQuery();
if(result.next()) {
strReturn = UtilSql.getValue(result, "createdby");
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(strReturn);
}
/**
return the parent ID
*/
public static String selectParentID(ConnectionProvider connectionProvider, String key) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT ad_ref_listinstance.AD_Ref_List_ID AS NAME" +
" FROM ad_ref_listinstance" +
" WHERE ad_ref_listinstance.AD_Ref_Listinstance_ID = ?";
ResultSet result;
String strReturn = "";
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, key);
result = st.executeQuery();
if(result.next()) {
strReturn = UtilSql.getValue(result, "name");
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(strReturn);
}
/**
Select for parent field
*/
public static String selectParent(ConnectionProvider connectionProvider, String paramLanguage, String adRefListId) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT (TO_CHAR(COALESCE(TO_CHAR((CASE WHEN tableTRL1.Name IS NULL THEN TO_CHAR(table1.Name) ELSE TO_CHAR(tableTRL1.Name) END)), ''))) AS NAME FROM AD_Ref_List left join (select AD_Ref_List_ID, Name from AD_Ref_List) table1 on (AD_Ref_List.AD_Ref_List_ID = table1.AD_Ref_List_ID) left join (select AD_Ref_List_ID,AD_Language, Name from AD_Ref_List_TRL) tableTRL1 on (table1.AD_Ref_List_ID = tableTRL1.AD_Ref_List_ID and tableTRL1.AD_Language = ?) WHERE AD_Ref_List.AD_Ref_List_ID = ? ";
ResultSet result;
String strReturn = "";
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
result = st.executeQuery();
if(result.next()) {
strReturn = UtilSql.getValue(result, "name");
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(strReturn);
}
/**
Select for parent field
*/
public static String selectParentTrl(ConnectionProvider connectionProvider, String paramLanguage, String adRefListId) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT (TO_CHAR(COALESCE(TO_CHAR((CASE WHEN tableTRL1.Name IS NULL THEN TO_CHAR(table1.Name) ELSE TO_CHAR(tableTRL1.Name) END)), ''))) AS NAME FROM AD_Ref_List left join (select AD_Ref_List_ID, Name from AD_Ref_List) table1 on (AD_Ref_List.AD_Ref_List_ID = table1.AD_Ref_List_ID) left join (select AD_Ref_List_ID,AD_Language, Name from AD_Ref_List_TRL) tableTRL1 on (table1.AD_Ref_List_ID = tableTRL1.AD_Ref_List_ID and tableTRL1.AD_Language = ?) WHERE AD_Ref_List.AD_Ref_List_ID = ? ";
ResultSet result;
String strReturn = "";
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, paramLanguage);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
result = st.executeQuery();
if(result.next()) {
strReturn = UtilSql.getValue(result, "name");
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(strReturn);
}
public int update(Connection conn, ConnectionProvider connectionProvider) throws ServletException {
String strSql = "";
strSql = strSql +
" UPDATE ad_ref_listinstance" +
" SET AD_Ref_Listinstance_ID = (?) , AD_Ref_List_ID = (?) , AD_Reference_ID = (?) , AD_Client_ID = (?) , AD_Org_ID = (?) , Ishidden = (?) , Value = (?) , Isactive = (?) , Name = (?) , Seqno = TO_NUMBER(?) , Isdefault = (?) , AD_Window_ID = (?) , AD_Tab_ID = (?) , updated = now(), updatedby = ? " +
" WHERE ad_ref_listinstance.AD_Ref_Listinstance_ID = ? " +
" AND ad_ref_listinstance.AD_Ref_List_ID = ? " +
" AND ad_ref_listinstance.AD_Client_ID IN (";
strSql = strSql + ((adUserClient==null || adUserClient.equals(""))?"":adUserClient);
strSql = strSql +
") " +
" AND ad_ref_listinstance.AD_Org_ID IN (";
strSql = strSql + ((adOrgClient==null || adOrgClient.equals(""))?"":adOrgClient);
strSql = strSql +
") ";
int updateCount = 0;
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(conn, strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListinstanceId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adReferenceId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adClientId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adOrgId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, ishidden);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, value);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, isactive);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, name);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, seqno);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, isdefault);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adWindowId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adTabId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, updatedby);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListinstanceId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
if (adUserClient != null && !(adUserClient.equals(""))) {
}
if (adOrgClient != null && !(adOrgClient.equals(""))) {
}
updateCount = st.executeUpdate();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releaseTransactionalPreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(updateCount);
}
public int insert(Connection conn, ConnectionProvider connectionProvider) throws ServletException {
String strSql = "";
strSql = strSql +
" INSERT INTO ad_ref_listinstance " +
" (AD_Ref_Listinstance_ID, AD_Ref_List_ID, AD_Reference_ID, AD_Client_ID, AD_Org_ID, Ishidden, Value, Isactive, Name, Seqno, Isdefault, AD_Window_ID, AD_Tab_ID, created, createdby, updated, updatedBy)" +
" VALUES ((?), (?), (?), (?), (?), (?), (?), (?), (?), TO_NUMBER(?), (?), (?), (?), now(), ?, now(), ?)";
int updateCount = 0;
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(conn, strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListinstanceId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adReferenceId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adClientId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adOrgId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, ishidden);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, value);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, isactive);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, name);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, seqno);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, isdefault);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adWindowId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adTabId);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, createdby);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, updatedby);
updateCount = st.executeUpdate();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releaseTransactionalPreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(updateCount);
}
public static int delete(ConnectionProvider connectionProvider, String param1, String adRefListId, String adUserClient, String adOrgClient) throws ServletException {
String strSql = "";
strSql = strSql +
" DELETE FROM ad_ref_listinstance" +
" WHERE ad_ref_listinstance.AD_Ref_Listinstance_ID = ? " +
" AND ad_ref_listinstance.AD_Ref_List_ID = ? " +
" AND ad_ref_listinstance.AD_Client_ID IN (";
strSql = strSql + ((adUserClient==null || adUserClient.equals(""))?"":adUserClient);
strSql = strSql +
") " +
" AND ad_ref_listinstance.AD_Org_ID IN (";
strSql = strSql + ((adOrgClient==null || adOrgClient.equals(""))?"":adOrgClient);
strSql = strSql +
") ";
int updateCount = 0;
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, param1);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
if (adUserClient != null && !(adUserClient.equals(""))) {
}
if (adOrgClient != null && !(adOrgClient.equals(""))) {
}
updateCount = st.executeUpdate();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(updateCount);
}
public static int deleteTransactional(Connection conn, ConnectionProvider connectionProvider, String param1, String adRefListId) throws ServletException {
String strSql = "";
strSql = strSql +
" DELETE FROM ad_ref_listinstance" +
" WHERE ad_ref_listinstance.AD_Ref_Listinstance_ID = ? " +
" AND ad_ref_listinstance.AD_Ref_List_ID = ? ";
int updateCount = 0;
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(conn, strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, param1);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, adRefListId);
updateCount = st.executeUpdate();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releaseTransactionalPreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(updateCount);
}
/**
Select for relation
*/
public static String selectOrg(ConnectionProvider connectionProvider, String id) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT AD_ORG_ID" +
" FROM ad_ref_listinstance" +
" WHERE ad_ref_listinstance.AD_Ref_Listinstance_ID = ? ";
ResultSet result;
String strReturn = null;
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, id);
result = st.executeQuery();
if(result.next()) {
strReturn = UtilSql.getValue(result, "ad_org_id");
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(strReturn);
}
public static String getCurrentDBTimestamp(ConnectionProvider connectionProvider, String id) throws ServletException {
String strSql = "";
strSql = strSql +
" SELECT to_char(Updated, 'YYYYMMDDHH24MISS') as Updated_Time_Stamp" +
" FROM ad_ref_listinstance" +
" WHERE ad_ref_listinstance.AD_Ref_Listinstance_ID = ? ";
ResultSet result;
String strReturn = null;
PreparedStatement st = null;
int iParameter = 0;
try {
st = connectionProvider.getPreparedStatement(strSql);
iParameter++; UtilSql.setValue(st, iParameter, 12, null, id);
result = st.executeQuery();
if(result.next()) {
strReturn = UtilSql.getValue(result, "updated_time_stamp");
}
result.close();
} catch(SQLException e){
log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
throw new ServletException("@CODE=" + e.getSQLState() + "@" + e.getMessage());
} catch(Exception ex){
log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
throw new ServletException("@CODE=@" + ex.getMessage());
} finally {
try {
connectionProvider.releasePreparedStatement(st);
} catch(Exception ignore){
ignore.printStackTrace();
}
}
return(strReturn);
}
}
| [
"[email protected]"
]
| |
0e0012d683018b3f599a5bd54c11d6dd1f01447b | 06430807b2402d0d0dd5a2eb526ac6a583ffa91e | /J2EE/glassfish5/samples/jsf/eventSource/src/main/java/stockticker/StockTickerBean.java | 2afdfd62fe1da97606364acc0a492d6100667580 | []
| no_license | what-yes/Junior-Year | 6f0a7e9ca5287e00eee915b6249e037d1485df69 | 17d9857cb7c70abfbc35060c6e0fbb953b304fea | refs/heads/master | 2023-07-18T07:25:57.439168 | 2021-09-10T02:32:27 | 2021-09-10T02:32:27 | 403,462,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,659 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
* or LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package stockticker;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import javax.faces.bean.ManagedBean;
//import javax.faces.bean.ApplicationScoped;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.glassfish.webcomm.api.ServerSentEventHandler;
import org.glassfish.webcomm.api.WebCommunicationContext;
import org.glassfish.webcomm.api.WebCommunicationHandler;
import org.glassfish.webcomm.annotation.WebHandlerContext;
/**
* StockTickerBean class
*/
@Named
@ApplicationScoped
public class StockTickerBean {
@Inject @WebHandlerContext("/stockticker")
private WebCommunicationContext wcc;
private Timer timer = null;
private Task task = null;
private String symbols = "";
private String openPrice = null;
private Map <String, String>symbolOpenPrice = null;
public StockTickerBean() {
}
public void getStockInfo() {
synchronized(this) {
if (symbolOpenPrice == null) {
symbolOpenPrice = new HashMap<String, String>();
}
if (null == timer) {
timer = new Timer();
if (null == task) {
task = new Task();
}
timer.schedule(task, 0, 3 * 1000);
}
}
}
public void reset() {
synchronized(this) {
setSymbols("");
}
}
public String getSymbols() {
return symbols;
}
public void setSymbols(String symbols) {
this.symbols = symbols;
}
// -- Message composition -------------------------------------------
private String composeMessage() {
String[] temp;
temp = symbols.split(" ");
StringBuilder sb = new StringBuilder();
String openPrice = null;
for (String t : temp) {
String sym = t.trim();
if (sym.length() > 0) {
openPrice = symbolOpenPrice.get(sym);
if (openPrice == null) {
openPrice = getTickerFromWebService(sym);
symbolOpenPrice.put(sym, openPrice);
}
String price = getTickerFromWebService(sym);
String chg = null;
if (Double.valueOf(openPrice.trim()).doubleValue() <
Double.valueOf(price.trim()).doubleValue()) {
chg = "up";
} else if (Double.valueOf(openPrice.trim()).doubleValue() >
Double.valueOf(price.trim()).doubleValue()) {
chg = "down";
} else {
chg = "";
}
sb.append(sym).append(':').append(openPrice).
append(':').append(price).append(':').append(chg);
sb.append(' ');
}
}
if (sb.length() > 0) {
return sb.substring(0, sb.length() - 1);
}
return "";
}
private String getTickerFromWebService(String symbol) {
Random r = new Random();
double q = symbol.hashCode() % 100 + r.nextFloat() * 5;
return Double.toString(q).substring(0, 5);
}
class Task extends TimerTask {
public void run() {
for (WebCommunicationHandler wch : wcc.getHandlers()) {
try {
String msg = composeMessage();
((ServerSentEventHandler)wch).sendMessage(msg, "stock");
} catch (IOException e) {
wch.close();
}
}
}
}
}
| [
"[email protected]"
]
| |
39256fef2a19e9870db7146c2518e68e5ceea017 | b80d5f3dfd48e859d14c7b53d529d9b99da2bf88 | /swing5-comp/UIUtil/src/swingutil/UiUtil.java | a1f321fd97d66702dded9e1eb1a737fd4b2e21b4 | []
| no_license | divannn/swng | 35f96d30e8e2187fad0cd8584b64c91cd910d579 | ed943181620e3dcc367def3c7db9cabc781d223f | refs/heads/master | 2021-01-21T13:11:47.130036 | 2012-10-28T21:48:56 | 2012-10-28T21:48:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,596 | java | package swingutil;
import java.awt.Component;
import java.awt.Container;
import java.awt.KeyboardFocusManager;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Stack;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
/**
* @author idanilov
* @jdk 1.5
*/
public abstract class UiUtil {
private static final int TAB_SIZE = 4;
private static PropertyChangeListener focusTracker = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Object newVal = evt.getNewValue();
String n = newVal != null ? newVal.getClass().toString() : "null";
Object oldVal = evt.getOldValue();
String o = oldVal != null ? oldVal.getClass().toString() : "null";
System.err.println(">>> focus owner: " + o + " -> " + n);
}
};
/**
* Prints <code>comp</code>'s up hierarchy starting from
* <code>comp</code>. Root container is printed first. <br>
* <code>comp</code> is marked as "|||".
*
* @param comp
*/
public static int printSupertypeHierarchy(final Component comp,
final boolean printSelf) {
if (comp == null) {
throw new IllegalArgumentException("Specify non-null component.");
}
// collect.
Stack<Component> stack = new Stack<Component>();
stack.push(comp);
Container parent = comp.getParent();
while (parent != null) {
stack.push(parent);
parent = parent.getParent();
}
// print.
int indent = 0;
Component next = null;
do {
next = stack.pop();
if (next == comp) {// start comp.
if (printSelf) {
printSelfComponent(comp,indent);
indent += TAB_SIZE;
}
} else {
printComponent(next,indent);
indent += TAB_SIZE;
}
} while (!stack.isEmpty());
return indent;
}
/**
* Prints <code>comp</code>'s down hierarchy starting from
* <code>comp</code>. Deepest component is printed last. <br>
* <code>comp</code> is marked as "|||".
*
* @param comp
*/
public static void printSubtypeHierarchy(final Component comp,
final boolean printSelf) {
printSubtypeHierarchy(comp, comp, 0, printSelf);
}
/**
* <code>c</code> needed for checking passed comp - because of recursion.
* <code>c</code> should be the same as <code>comp</code>.
*/
private static void printSubtypeHierarchy(final Component comp,
final Component c, int indent, final boolean printSelf) {
if (comp == null) {
throw new IllegalArgumentException("Specify non-null component.");
}
if (comp == c) {
if (printSelf) {
printSelfComponent(comp,indent);
indent += TAB_SIZE;
}
} else {
printComponent(comp,indent);
indent += TAB_SIZE;
}
if (comp instanceof Container) {
Container cont = (Container) comp;
for (int i = 0; i < cont.getComponentCount(); i++) {
Component next = cont.getComponent(i);
printSubtypeHierarchy(next, c, indent, printSelf);
}
}
}
/**
* Prints <code>comp</code>'s full hierarchy. Deepest component is
* printed last. <br>
* <code>comp</code> is marked as "|||".
*
* @param comp
*/
public static void printHierarchy(final Component comp) {
if (comp == null) {
throw new IllegalArgumentException("Specify non-null component.");
}
int indentation = printSupertypeHierarchy(comp, false);
printSubtypeHierarchy(comp, comp, indentation, true);
}
private static void printSelfComponent(final Component comp,int indent) {
printIndentation(indent);
System.err.println("||| comp:" + comp);
indent += TAB_SIZE;
}
private static void printComponent(final Component comp,int indent) {
printIndentation(indent);
System.err.println(">>> " + comp);
indent += TAB_SIZE;
}
private static void printIndentation(final int indent) {
for (int i = indent; i > 0; --i) {
System.err.print(" ");
}
}
/**
* @param comp
* target component
* @param when
* focus condition: <br>
* WHEN_IN_FOCUSED_WINDOW, WHEN_FOCUSED,
* WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
* @param showAll
* include parent maps
*/
public static void printInputMap(final JComponent comp, final int when,
final boolean showAll) {
if (comp == null) {
throw new IllegalArgumentException("Specify non-null component.");
}
System.out.println(">>> Input map for: " + when);
InputMap im = comp.getInputMap(when);
if (im != null) {
KeyStroke[] targetKeys = showAll ? im.allKeys() : im.keys();
if (targetKeys != null) {
for (KeyStroke nextStroke : targetKeys) {
System.out.println(" >>> key stroke: " + nextStroke
+ " action key: " + im.get(nextStroke));
}
} else {
System.out.println(" no key strokes");
}
} else {
System.out.println(" no key strokes");
}
}
/**
* @param comp
* target component
* @param when
* focus condition
* @param showAll
* include parent maps
*/
public static void printActionMap(final JComponent comp,
final boolean showAll) {
if (comp == null) {
throw new IllegalArgumentException("Specify non-null component.");
}
ActionMap am = comp.getActionMap();
if (am != null) {
Object[] targetKeys = showAll ? am.allKeys() : am.keys();
if (targetKeys != null) {
for (Object nextKey : am.allKeys()) {
System.out.println(">>> action key: " + nextKey
+ " action: " + am.get(nextKey).getClass());
}
} else {
System.out.println("no actions");
}
} else {
System.out.println("no actions");
}
}
/**
* Prints UI defaults for particular JComponent under current L&F. <br>
* Usage: <code>printDefaults(new JTable());</code>
*
* @param comp
* JComponent or null to get all UI default entries.
*/
public static void printDefaults(final JComponent comp) {
String prefix = null;
if (comp != null) {
prefix = comp.getClass().getSimpleName().substring(1);// cut first
// 'J'.
}
UIDefaults defaults = UIManager.getDefaults();
Enumeration e = defaults.keys();
ArrayList<String> entriesList = new ArrayList<String>();
while (e.hasMoreElements()) {
Object nextKey = e.nextElement();
String nextEntry = nextKey + " = " + defaults.get(nextKey);
if (prefix == null) {// get all keys.
entriesList.add(nextEntry);
} else {
if (nextKey.toString().startsWith(prefix)
&& ".".equals(nextKey.toString().substring(
prefix.length(), prefix.length() + 1))) {
entriesList.add(nextEntry);
}
}
}
Collections.sort(entriesList);
System.out.println(entriesList.size() + " entries found.");
for (String nextEntry : entriesList) {
System.out.println(nextEntry);
}
System.out
.println("-----------------------------------------------------------");
}
public static void startTrackingFocusOwnerChange() {
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addPropertyChangeListener("permanentFocusOwner", focusTracker);
}
public static void stopTrackingFocusOwnerChange() {
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.removePropertyChangeListener("permanentFocusOwner",
focusTracker);
}
/*
* For quick test, public static void main(String[] args) { try {
* UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
* catch (Exception e) { e.printStackTrace(); } printInputMap(new
* JFormattedTextField(),JComponent.WHEN_FOCUSED,true); }
*/
} | [
"[email protected]"
]
| |
c61f3d6afe10a8cd98fcd3f05bb9326465ec5fe2 | f17cd1a0b44e5f2f85986a8d614b09dd4967ad0e | /Bubble/app/src/main/java/kr/ac/kaist/vclab/bubble/Generators/MapGenerator.java | b0c363492d06e728b2fcf525aafa9a21106d3be5 | []
| no_license | snagna/kaist_cs482_2016_team4 | e4273740f689dae2f17fdc308ccc74d6e00d271a | ad53ae7281af136e765ab280ea04c18d233adab3 | refs/heads/master | 2021-06-07T16:24:51.314798 | 2016-11-29T14:46:57 | 2016-11-29T14:46:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,949 | java | package kr.ac.kaist.vclab.bubble.generators;
import android.opengl.GLES20;
import java.util.ArrayList;
import java.util.List;
import kr.ac.kaist.vclab.bubble.PerlinNoise;
import kr.ac.kaist.vclab.bubble.utils.VecOperator;
/**
* Created by avantgarde on 2016-11-02.
*/
public class MapGenerator {
// size
float sizeX;
float sizeY;
float sizeZ;
// dimension
int dimX;
int dimZ;
// unit length
float unit;
// height map (2D array of y values)
float[][] heightMap;
float normalRate;
// flag for filling the faces
boolean fill;
public MapGenerator(float sizeX, float sizeY, float sizeZ, // size of the map
float unit, // dist. between points
float maxHeight, // max height (not y value!)
float minHeight, // min height (can be negative)
float complexity, // complexity
float normalRate, // normal -> normal * normalRate + (0, 1, 0) * (1 - normalRate)
boolean fill) { // true : show all / false : show skeleton only
this.unit = unit;
this.fill = fill;
this.dimX = (int) (sizeX / this.unit);
this.dimZ = (int) (sizeZ / this.unit);
this.sizeX = this.dimX * this.unit;
this.sizeZ = this.dimZ * this.unit;
this.sizeY = sizeY;
this.normalRate = normalRate;
heightMap = new float[this.dimX + 1][this.dimZ + 1];
// seed for randomization
float seed = (float) Math.random();
for (int i = 0; i <= this.dimX; i++) {
for (int j = 0; j <= this.dimZ; j++) {
float nx = i / (float) dimX - 0.5f;
float nz = j / (float) dimZ - 0.5f;
heightMap[i][j] = maxHeight * (2.0f / (float) Math.sqrt(3)) * (
PerlinNoise.noise(nx * complexity, nz * complexity, seed)
+ 0.5f * PerlinNoise.noise(nx * complexity * 2, nz * complexity * 2, 2.0f * seed)
+ 0.25f * PerlinNoise.noise(nx * complexity * 4, nz * complexity * 4, 4.0f * seed)
);
if (heightMap[i][j] < minHeight) {
heightMap[i][j] = minHeight;
}
}
}
}
public float[] getVertices() {
List<float[]> buffer = new ArrayList<>();
if (fill) {
// top
for (int i = 0; i < dimX; i++) {
for (int j = 0; j < dimZ; j++) {
// lower triangle
buffer.add(new float[]{
unit * i, heightMap[i][j], unit * j,
unit * i, heightMap[i][j + 1], unit * (j + 1),
unit * (i + 1), heightMap[i + 1][j + 1], unit * (j + 1)
});
// upper triangle
buffer.add(new float[]{
unit * i, heightMap[i][j], unit * j,
unit * (i + 1), heightMap[i + 1][j + 1], unit * (j + 1),
unit * (i + 1), heightMap[i + 1][j], unit * j
});
}
}
// bottom
buffer.add(new float[]{
sizeX, -sizeY, sizeZ,
0, -sizeY, 0,
sizeX, -sizeY, 0
});
buffer.add(new float[]{
0, -sizeY, 0,
sizeX, -sizeY, sizeZ,
0, -sizeY, sizeZ
});
// front
for (int i = 0; i < dimX; i++) {
// lower triangle
buffer.add(new float[]{
unit * i, heightMap[i][dimZ], sizeZ,
unit * i, -sizeY, sizeZ,
unit * (i + 1), -sizeY, sizeZ
});
// upper triangle
buffer.add(new float[]{
unit * i, heightMap[i][dimZ], sizeZ,
unit * (i + 1), -sizeY, sizeZ,
unit * (i + 1), heightMap[i + 1][dimZ], sizeZ
});
}
// back
for (int i = 0; i < dimX; i++) {
// lower triangle
buffer.add(new float[]{
unit * (i + 1), -sizeY, 0,
unit * i, -sizeY, 0,
unit * i, heightMap[i][0], 0
});
// upper triangle
buffer.add(new float[]{
unit * (i + 1), heightMap[i + 1][0], 0,
unit * (i + 1), -sizeY, 0,
unit * i, heightMap[i][0], 0
});
}
// right
for (int j = 1; j <= dimZ; j++) {
// lower triangle
buffer.add(new float[]{
sizeX, heightMap[dimX][j], unit * j,
sizeX, -sizeY, unit * j,
sizeX, -sizeY, unit * (j - 1)
});
// upper triangle
buffer.add(new float[]{
sizeX, heightMap[dimX][j], unit * j,
sizeX, -sizeY, unit * (j - 1),
sizeX, heightMap[dimX][j - 1], unit * (j - 1)
});
}
// left
for (int j = 1; j <= dimZ; j++) {
// lower triangle
buffer.add(new float[]{
0, -sizeY, unit * (j - 1),
0, -sizeY, unit * j,
0, heightMap[0][j], unit * j
});
// upper triangle
buffer.add(new float[]{
0, heightMap[0][j - 1], unit * (j - 1),
0, -sizeY, unit * (j - 1),
0, heightMap[0][j], unit * j
});
}
return listToArray(buffer, 9);
} else {
// top
for (int i = 0; i <= dimX; i++) {
for (int j = 0; j <= dimZ; j++) {
// rows
if (i != dimX) {
buffer.add(new float[]{
unit * i, heightMap[i][j], unit * j,
unit * (i + 1), heightMap[i + 1][j], unit * j
});
}
// columns
if (j != dimZ) {
buffer.add(new float[]{
unit * i, heightMap[i][j], unit * j,
unit * i, heightMap[i][j + 1], unit * (j + 1)
});
}
// diagonals
if ((i != dimX) && (j != dimZ)) {
buffer.add(new float[]{
unit * i, heightMap[i][j], unit * j,
unit * (i + 1), heightMap[i + 1][j + 1], unit * (j + 1)
});
}
}
}
// bottom
buffer.add(new float[]{
0, -sizeY, 0,
sizeX, -sizeY, 0
});
buffer.add(new float[]{
sizeX, -sizeY, 0,
sizeX, -sizeY, sizeZ
});
buffer.add(new float[]{
sizeX, -sizeY, sizeZ,
0, -sizeY, sizeZ
});
buffer.add(new float[]{
0, -sizeY, sizeZ,
0, -sizeY, 0
});
// sides
buffer.add(new float[]{
0, heightMap[0][0], 0,
0, -sizeY, 0
});
buffer.add(new float[]{
sizeX, heightMap[dimX][0],
0, sizeX, -sizeY, 0
});
buffer.add(new float[]{
0, heightMap[0][dimZ],
sizeZ, 0, -sizeY, sizeZ
});
buffer.add(new float[]{
sizeX, heightMap[dimX][dimZ],
sizeZ, sizeX, -sizeY, sizeZ
});
return listToArray(buffer, 6);
}
}
public float[] getNormals() {
List<float[]> buffer = new ArrayList<>();
if (fill) {
// top
for (int i = 0; i < dimX; i++) {
for (int j = 0; j < dimZ; j++) {
// lower triangle
buffer.add(topNormal(i, j));
buffer.add(topNormal(i, j + 1));
buffer.add(topNormal(i + 1, j + 1));
// upper triangle
buffer.add(topNormal(i, j));
buffer.add(topNormal(i + 1, j + 1));
buffer.add(topNormal(i + 1, j));
}
}
// bottom
for (int i = 0; i < 2; i++) {
buffer.add(new float[]{0.0f, -1.0f, 0.0f});
}
// front
for (int i = 0; i < dimX * 6; i++) {
buffer.add(new float[]{0.0f, 0.0f, 1.0f});
}
// back
for (int i = 0; i < dimX * 6; i++) {
buffer.add(new float[]{0.0f, 0.0f, -1.0f});
}
// right
for (int i = 0; i < dimZ * 6; i++) {
buffer.add(new float[]{1.0f, 0.0f, 0.0f});
}
// left
for (int i = 0; i < dimZ * 6; i++) {
buffer.add(new float[]{-1.0f, 0.0f, 0.0f});
}
// normal -> normal * normalRate + (0, 1, 0) * (1 - normalRate)
for (int i = 0; i < buffer.size(); i++) {
float[] normal = buffer.get(i);
buffer.set(i, new float[]{
normal[0] * normalRate,
normal[1] * normalRate + (1.0f - normalRate),
normal[2] * normalRate
});
}
} else {
// top
for (int i = 0; i <= dimX; i++) {
for (int j = 0; j <= dimZ; j++) {
// rows
if (i != dimX) {
buffer.add(topNormal(i, j));
buffer.add(topNormal(i + 1, j));
}
// columns
if (j != dimZ) {
buffer.add(topNormal(i, j));
buffer.add(topNormal(i, j + 1));
}
// diagonals
if ((i != dimX) && (j != dimZ)) {
buffer.add(topNormal(i, j));
buffer.add(topNormal(i + 1, j + 1));
}
}
}
// bottom
for (int i = 0; i < 8; i++) {
buffer.add(new float[]{0.0f, -1.0f, 0.0f});
}
// sides
for (int i = 0; i < 8; i++) {
buffer.add(new float[]{0.0f, 1.0f, 0.0f});
}
}
return listToArray(buffer, 3);
}
public int getMode() {
if (fill) {
return GLES20.GL_TRIANGLES;
} else {
return GLES20.GL_LINES;
}
}
public float[] getTextureCoors() {
List<float[]> buffer = new ArrayList<>();
if (fill) {
float ratio = 1.0f;
for (int i = 0; i < dimX; i++) {
for (int j = 0; j < dimZ; j++) {
// lower triangle
buffer.add(new float[]{
unit * i / sizeX * ratio, unit * j / sizeZ * ratio, 0,
unit * i / sizeX * ratio, unit * (j + 1) / sizeZ * ratio, 0,
unit * (i + 1) / sizeX * ratio, unit * (j + 1) / sizeZ * ratio, 0
});
// upper triangle
buffer.add(new float[]{
unit * i / sizeX * ratio, unit * j / sizeZ * ratio, 0,
unit * (i + 1) / sizeX * ratio, unit * (j + 1) / sizeZ * ratio, 0,
unit * (i + 1) / sizeX * ratio, unit * j / sizeZ * ratio, 0
});
}
}
// bottom
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
// front
for (int i = 0; i < dimX; i++) {
// lower triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
// upper triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
}
// back
for (int i = 0; i < dimX; i++) {
// lower triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
// upper triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
}
// right
for (int j = 1; j <= dimZ; j++) {
// lower triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
// upper triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
}
// left
for (int j = 1; j <= dimZ; j++) {
// lower triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
// upper triangle
buffer.add(new float[]{
0, 0, 0,
0, 0, 0,
0, 0, 0
});
}
return listToArray(buffer, 9);
} else {
// top
for (int i = 0; i <= dimX; i++) {
for (int j = 0; j <= dimZ; j++) {
// rows
if (i != dimX) {
buffer.add(new float[]{0, 0, 0, 0, 0, 0});
}
// columns
if (j != dimZ) {
buffer.add(new float[]{0, 0, 0, 0, 0, 0});
}
// diagonals
if ((i != dimX) && (j != dimZ)) {
buffer.add(new float[]{0, 0, 0, 0, 0, 0});
}
}
}
// bottom
for (int i = 0; i < 4; i++) {
buffer.add(new float[]{0, 0, 0, 0, 0, 0});
}
// sides
for (int i = 0; i < 4; i++) {
buffer.add(new float[]{0, 0, 0, 0, 0, 0});
}
return listToArray(buffer, 6);
}
}
private float[] listToArray(List<float[]> buffer, int elemSize) {
int bufferSize = buffer.size();
float[] result = new float[bufferSize * elemSize];
for (int i = 0; i < bufferSize; i++) {
float[] elem = buffer.get(i);
for (int j = 0; j < elemSize; j++) {
result[i * elemSize + j] = elem[j];
}
}
return result;
}
private float[] topVertex(int i, int j) {
return new float[]{unit * i, heightMap[i][j], unit * j};
}
private float[] topNormal(int i, int j) {
float[][] vs = null;
float[] vc = null;
float[] sum = null;
// borders -> just return (0, 1, 0) for the sake of convenience
if ((i == 0) || (i == dimX) || (j == 0) || (j == dimZ)) {
return new float[]{0.0f, 1.0f, 0.0f};
} else {
vs = new float[][]{
topVertex(i - 1, j),
topVertex(i, j + 1),
topVertex(i + 1, j + 1),
topVertex(i + 1, j),
topVertex(i, j - 1),
topVertex(i - 1, j - 1),
topVertex(i - 1, j),
};
vc = topVertex(i, j);
sum = new float[]{0.0f, 0.0f, 0.0f};
for (int k = 0; k < 6; k++) {
float[] vec_1 = VecOperator.sub(vs[k], vc);
float[] vec_2 = VecOperator.sub(vs[k + 1], vc);
float weight = VecOperator.angle(vec_1, vec_2);
float[] faceNormal = VecOperator.cross(vec_1, vec_2);
sum = VecOperator.add(sum, VecOperator.scale(faceNormal, weight));
}
return VecOperator.normalize(sum);
}
}
}
| [
"[email protected]"
]
| |
de579f27107692d642d83ada1486a831f22dd020 | ec0c00ed43048f1a4e46719ff1ac628a4a1f323e | /oauth-server/src/main/java/com/zero/oauth/server/config/SwaggerConfig.java | 7c778b601f35c7c981774ab29916746dbc102f4f | [
"Apache-2.0"
]
| permissive | frozero/zero-cloud | 26cfcfbf890671291e2fe59233c7703a92395cdc | 2b8ebdf53083728288a58975989e510157182e9e | refs/heads/master | 2020-04-27T23:28:00.065830 | 2019-03-10T11:23:45 | 2019-03-10T11:23:45 | 174,777,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package com.zero.oauth.server.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* swagger文档
*
* @author zero
*
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket docket() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(new ApiInfoBuilder().title("认证中心swagger接口文档")
.contact(new Contact("zero", "", "")).version("1.0").build())
.select().paths(PathSelectors.any()).build();
}
}
| [
"[email protected]"
]
| |
93f3b00b498732995bc1473eed9bc19102f1ba1b | cacf9f692ac35c14f6af7510bc19fa40ca65dc8d | /ImplementacionJEE/LogicaNegocioCatalogo/src/casosDeUso/ObtenerCatalogoFranquiciaLocal.java | d8befa1525c4b9af7d40b108360ccdb132c140e9 | []
| no_license | SantiagoCaroprese/Arquitectura-de-software | faf21a2a7be9a8cdb0255b8882f3cd848c642697 | 89faf81fd63128bb4df00b72ffa31151b6ddd636 | refs/heads/main | 2023-05-13T14:05:47.855446 | 2021-06-03T20:11:49 | 2021-06-03T20:11:49 | 345,441,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package casosDeUso;
import java.util.List;
import javax.ejb.Local;
import model.Producto;
@Local
public interface ObtenerCatalogoFranquiciaLocal {
public List<Producto> execute(int idFranquicia);
}
| [
"[email protected]"
]
| |
3584147d6cdb7c9eb6dad2d5f1c1d470702e7582 | 3fbc3dcd2094d08d1890e353507196cfeeb1f801 | /src/com/company/Main32.java | cac2099495c7867583ec2c2fe0588cbe53c9f10d | []
| no_license | AndriiKovalBora-Bora/ExceptionPart1 | 73eb1452e25ebda73c6e928abf343d6da8575b2f | c6f33afc20fe681b8c149751414c33edeecacf06 | refs/heads/master | 2020-04-24T04:23:03.444933 | 2019-02-20T15:41:53 | 2019-02-20T15:41:53 | 171,700,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.company;
public class Main32 {
public static void main(String[] args) {
System.err.println(f());
}
public static int f() {
try {
throw new Error();
} finally {
throw new RuntimeException();
}
}
}
| [
"[email protected]"
]
| |
ce52eac5a95c7edf6df5695b28240e95366228a2 | 6c4bdf896fb2c7cc14e49e3edd3c650d08947b45 | /src/main/java/me/alexng/worldGen/sampler/PlaneSampler.java | 3ad9f7603314ec4adf92e170c9dac1dabe02759f | []
| no_license | Gnxela/WorldGen | 8852ae3ddfc591f608402313fcc45ab26edb4dce | e5cda4fdc106ae54a137758b1514b4c9d9959214 | refs/heads/master | 2023-02-21T13:00:22.278350 | 2021-01-28T11:36:46 | 2021-01-28T11:36:46 | 306,379,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,365 | java | package me.alexng.worldGen.sampler;
import java.util.Iterator;
/**
* A class that samples points from a plane. All coordinates are positive (subject to change).
*/
public class PlaneSampler implements Sampler {
private final int x, y, width, height, numPointsX, numPointsY, totalWidth, totalHeight;
public PlaneSampler(int x, int y, int width, int height, int numPointsX, int numPointsY, int totalWidth, int totalHeight) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.numPointsX = numPointsX;
this.numPointsY = numPointsY;
this.totalWidth = totalWidth;
this.totalHeight = totalHeight;
}
public PlaneSampler(int width, int height) {
this(0, 0, width, height, width, height, width, height);
}
public PlaneSampler sample(int x, int y, int width, int height, int numPointsX, int numPointsY) {
return new PlaneSampler(x, y, width, height, numPointsX, numPointsY, getTotalWidth(), getTotalHeight());
}
public PlaneSampler sample(int x, int y, int width, int height) {
return new PlaneSampler(x, y, width, height, width, height, getTotalWidth(), getTotalHeight());
}
public PlaneSampler sample(int numPointsX, int numPointsY) {
return new PlaneSampler(0, 0, getWidth(), getHeight(), numPointsX, numPointsY, getTotalWidth(), getTotalHeight());
}
public Iterator<Point> getPoints() {
return new Iterator<Point>() {
private final float sampleDistanceX = width / (float) numPointsX, sampleDistanceY = height / (float) numPointsY;
private int sampleX = 0, sampleY = 0, index = 0;
@Override
public boolean hasNext() {
return index < getSize();
}
@Override
public Point next() {
Point point = new PlanePoint((int) (x + sampleX * sampleDistanceX), (int) (y + sampleY * sampleDistanceY), index++);
if (++sampleX >= numPointsX) {
sampleY++;
sampleX = 0;
}
return point;
}
};
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public int getNumPointsX() {
return numPointsX;
}
public int getNumPointsY() {
return numPointsY;
}
public int getTotalWidth() {
return totalWidth;
}
public int getTotalHeight() {
return totalHeight;
}
/**
* Returns the number of points that will be sampled by this Sampler.
*/
@Override
public int getSize() {
return numPointsX * numPointsY;
}
}
| [
"[email protected]"
]
| |
bf1e822897985b4c299bef0283ab4fcce4fd3e40 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_fc3d887aaa8dd59cc7c1a46daad51d2cc76661a1/Activity/2_fc3d887aaa8dd59cc7c1a46daad51d2cc76661a1_Activity_s.java | 67ed3a7873c11839a7d609156f26bc0e1589ec7d | []
| 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 | 4,452 | java | package net.praqma;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
/**
*
* @author wolfgang
*
*/
class Activity extends ClearBase
{
private String fqactivity = null;
private String shortname = null;
private ArrayList<String> changeset = null;
private Stream stream = null;
private String pvob = null;
/**
* Constructor
* @param fqactivity
* @param trusted
*/
public Activity( String fqactivity, boolean trusted )
{
logger.trace_function();
String[] res = TestComponent( fqactivity );
if( res == null )
{
logger.log( "ERROR: Activity constructor: The first parameter ("+fqactivity+") must be a fully qualified activity in the format: activity\\@\\PVOB" + linesep, "error" );
System.err.println( "ERROR: Activity constructor: The first parameter ("+fqactivity+") must be a fully qualified activity in the format: activity\\@\\PVOB" + linesep );
System.exit( 1 );
}
this.fqactivity = fqactivity;
this.fqname = fqactivity;
this.shortname = res[0];
this.pvob = res[1];
if( !trusted )
{
// cleartool desc activity:$fqactivity
String cmd = "desc activity:" + fqactivity;
Cleartool.run( cmd );
}
}
/**
* Create an Activity
* @param id
* @param comment
*/
public void Create( String id, String comment )
{
logger.trace_function();
if( id == null )
{
logger.warning( "ERROR: Activity::create(): Nothing to create!" );
System.err.println( "ERROR: Activity::create(): Nothing to create!" );
return;
}
String commentswitch = comment != null ? " -comment " + comment : "";
Snapview view = new Snapview( null );
// my $cmd = 'cleartool mkact '.$commentswitch.' '.$options{'id'}.' 2>&1';
String cmd = "mkact " + commentswitch + " " + id;
String result = Cleartool.run( cmd );
/* CHW: I cannot figure out what is newed! */
// return $package->new($options{'id'}.'@'.$view->get_pvob(),1);
}
public String toString()
{
logger.trace_function();
StringBuffer tostr = new StringBuffer();
tostr.append( "fqactivity: " + this.fqactivity );
tostr.append( "shortname: " + this.shortname );
tostr.append( "changeset: " + ( changeset != null ? changeset.size() : "None" ) );
if( changeset != null )
{
for( int i = 0 ; i < changeset.size() ; i++ )
{
tostr.append( "["+i+"] " + changeset.get( i ).toString() );
}
}
tostr.append( "stream: " + this.stream );
tostr.append( "pvob: " + this.pvob );
return tostr.toString();
}
public ArrayList<String> GetChangeSet()
{
logger.trace_function();
if( this.changeset != null )
{
return this.changeset;
}
// cleartool desc -fmt %[versions]Cp activity:'.$self->{'fqactivity'}.' 2>&1';
String cmd = "desc -fmt %[versions]Cp activity:" + this.fqactivity;
String result = Cleartool.run( cmd );
ArrayList<String> cset = new ArrayList<String>();
String[] rs = result.split( ", " );
for( int i = 0 ; i < rs.length ; i++ )
{
cset.add( rs[i] );
}
logger.debug( "Applying cset to " );
this.changeset = cset;
return this.changeset;
}
public String GetShortname()
{
logger.trace_function();
return this.shortname;
}
public ArrayList<String> GetChangeSetAsElements()
{
logger.trace_function();
/* CHW: Shouldn't we check if the changelog exists? */
logger.debug( "Splitting changelog at \\@\\@" );
HashMap<String, String> cs = new HashMap<String, String>();
for( int i = 0 ; i < this.changeset.size() ; i++ )
{
// split /\@\@/, $cs;
String[] csa = this.changeset.get( i ).split( "\\@\\@@" );
cs.put( csa[0], "" );
}
/* CHW: Experimental sorting. UNTESTED! */
logger.debug( "Experimental sorting. UNTESTED!" );
SortedSet<String> sortedset = new TreeSet<String>( cs.keySet() );
Iterator<String> it = sortedset.iterator();
ArrayList<String> r = new ArrayList<String>();
while ( it.hasNext() )
{
r.add( cs.get( it.next() ) );
}
return r;
}
}
| [
"[email protected]"
]
| |
315d0c1048d83234dd2a4401fcd849b25ef598be | 2f84cc446f324146064fa8b1b1fa87b0c46e698d | /app/src/main/java/com/example/han/myapplication001/Global.java | b3d00d3d2c5f27d466aea388bf6ce5355d4a96c0 | []
| no_license | JHansol/X.M.P.P.Chat_A.ndroid_Client | 8b09a275fb125694b220ae502d935f805edcd332 | 3f4953ec723957ecef2aa0ef19f377161dd9246f | refs/heads/master | 2020-12-31T00:55:24.255889 | 2017-05-26T03:05:51 | 2017-05-26T03:05:51 | 80,599,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,438 | java | package com.example.han.myapplication001;
import android.app.Application;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;
import android.widget.ListView;
import android.widget.Toast;
import com.example.han.myapplication001.XMPP.FriendListClass;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ChatManager;
import org.jivesoftware.smack.ChatManagerListener;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.RosterListener;
import org.jivesoftware.smack.SASLAuthentication;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Registration;
import org.jivesoftware.smack.packet.RosterPacket;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.OfflineMessageManager;
import org.jivesoftware.smackx.RemoteRosterEntry;
import org.jivesoftware.smackx.RosterExchangeListener;
import org.jivesoftware.smackx.RosterExchangeManager;
import org.jivesoftware.smackx.ServiceDiscoveryManager;
import org.jivesoftware.smackx.packet.DiscoverInfo;
import org.jivesoftware.smackx.packet.OfflineMessageRequest;
public class Global extends Application {
ArrayList<BubbleAdapter> m_Adapter;
public static final String HOST = "210.99.254.154";
public static final int PORT = 5222;
public static final String SERVICE = "@han-pc";
public XMPPConnection connection;
private int state;
String id_st;
String ps_st;
public Context Friend_Context;
FriendActivity.CustomList adapter;
ListView list;
@Override
public void onCreate() {
//전역 변수 초기화
m_Adapter = new ArrayList<BubbleAdapter>();
state = 0;
id_st = "";
ps_st = "";
super.onCreate();
}
@Override
public void onTerminate() {
super.onTerminate();
}
public void setState(int state){
this.state = state;
}
public int getState(){
return state;
}
public boolean login(String apiKey, String accessToken) throws XMPPException {
if ((connection != null) && (connection.isConnected())) {
connection.login(apiKey, accessToken);
return true;
}
return false;
}
public void disconnect() {
if ((connection != null) && (connection.isConnected())) {
Presence presence = new Presence(Presence.Type.unavailable);
presence.setStatus("offline");
connection.disconnect(presence);
}
}
public boolean IsConnected(){
if ((connection != null) && (connection.isConnected())) {
return true;
}
return false;
}
Handler mHandler;
RosterListener Rosters = new RosterListener(){
public void entriesAdded(Collection<String> addresses) {}
public void entriesDeleted(Collection<String> addresses) {}
public void entriesUpdated(Collection<String> addresses) {}
public void presenceChanged(Presence presence) {
int count =0;
String temp_name = presence.getFrom().substring(0,presence.getFrom().indexOf("/"));
Iterator<FriendListClass> iter = Friends.iterator();
while(iter.hasNext()){
FriendListClass item = iter.next();
count = count + 1;
if(item.names.equals(temp_name)){
iter.remove();
break;
}
}
ArrayList<RosterEntry> sm = refreshFriend();
for (RosterEntry entry : sm) {
Roster roster = connection.getRoster();
if(temp_name.equals(entry.getUser())) { // 변경된 presense 이름과 로스터 이름 비교
if (presence.isAvailable()) Friends.add((count-1),new FriendListClass(entry.getUser(), 1,presence.getStatus()));
else Friends.add((count-1),new FriendListClass(entry.getUser(), 0,""));
}
Thread t = new Thread(new Runnable() {
@Override
public void run() {
mHandler.post( new Runnable() {
public void run() {
list.setAdapter(adapter);
}
});
}
});t.start();
}
count = 0;
Log.i("HANSOL----------LOG","Presence change detected for:" + presence.getFrom()+ "Type: " + presence.getType() + "Status: " + presence.getStatus());
}
};
public void connect(String a, String b) {
id_st = a;
id_st = id_st + "@han-pc";
ps_st = b;
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// Create a connection
ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT,"han-pc");
connConfig.setSASLAuthenticationEnabled(true);
connConfig.setSendPresence(true);
connection = new XMPPConnection(connConfig);
try {
connection.connect();
Log.i("XMPPChatDemoActivity", "[SettingsDialog] Connected to "+connection.getHost());
} catch (XMPPException ex) {
disconnect();
Log.e("XMPPChatDemoActivity", "[SettingsDialog] Failed to connect to "+ connection.getHost());
Log.e("XMPPChatDemoActivity", ex.toString());
}
try {
if (login(id_st, ps_st)) {
Log.i("XMPPChatDemoActivity", "성공소리질러222");
}
else {
Log.i("XMPPChatDemoActivity", "tttttttttttttttttt실패");
}
Roster roster = connection.getRoster();
roster.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
Log.i("XMPPChatDemoActivity", "Logged in as" + connection.getUser());
Presence presence = new Presence(Presence.Type.available);
presence.setType(Presence.Type.available);
presence.setMode(Presence.Mode.available);
presence.setPriority(24);
presence.setStatus("online");
connection.sendPacket(presence);
try{
Thread.sleep(100);
}catch (Exception e){}
roster.addRosterListener(Rosters);
// Presence p = new Presence(Presence.Type.available, "I am busy", 42, Presence.Mode.dnd);
// connection.sendPacket(p);
// OfflineMessageManager omm = new OfflineMessageManager(connection);
// DiscoverInfo var1 = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo((String)null);
// if (!omm.supportsFlexibleRetrieval()) {
// Log.i("XMPPChatDemoActivity", "Offline messages not supported");
// }
// if (omm.getMessageCount() == 0) {
// Log.i("XMPPChatDemoActivity", "No offline messages found on server");
// }
// OfflineMessageRequest omr = new OfflineMessageRequest();
// connection.sendPacket(omr);
// Iterator itr = omm.getMessages();
// while(itr.hasNext())
// {
// Message m =(Message) itr.next();
// Log.i("zzzzzzzzzzzzzzzz", m.getBody());
// }
} catch (XMPPException e) {
disconnect();
}
}
});
t.start();
}
private boolean setPresenceSubscription(String user, boolean subscriptionEnabled) {
Presence presence;
if (subscriptionEnabled) {
presence = new Presence(Presence.Type.subscribe);
} else {
presence = new Presence(Presence.Type.unsubscribe);
}
presence.setFrom(id_st);
presence.setTo(user);
try {
connection.sendPacket(presence);
return true;
} catch (Exception e) {
return false;
}
}
public enum ShowMode {
ONLINE, OFFLINE
};
public void Logs(String n){
Log.i("HANSOL_LOG",n);
}
public ArrayList<RosterEntry> filteredEntries;
protected ShowMode displayMode;
public boolean presenceCheck(String names){
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry entry : entries) {
Presence entryPresence = roster.getPresence(entry.getUser());
// Log.i("XMPPChatDemoActivity", "--------------------------------------");
// Log.i("XMPPChatDemoActivity", "RosterEntry " + entryPresence.getType());
// Log.i("XMPPChatDemoActivity", "User: " + entryPresence.getStatus());
// Log.i("XMPPChatDemoActivity", "Name: " + entry.getName());
// Log.i("XMPPChatDemoActivity", "Status: " + entry.getStatus());
// Log.i("XMPPChatDemoActivity", "Type: " + entry.getType());
if(entryPresence.isAvailable()) {
if (entry.getUser().equals(names)) {
Log.i("hs log", "User: " + entry.getUser() + "비교 : " + names + " 비교 " + entryPresence.getType() + entryPresence.getStatus());
return true;
}
}
}
return false;
}
public void refreshFriends(ShowMode sm) {
this.displayMode = sm;
this.filteredEntries = new ArrayList<RosterEntry>();
this.filteredEntries.clear();
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry entry : entries) {
// Log.i("XMPPChatDemoActivity", "--------------------------------------");
// Log.i("XMPPChatDemoActivity", "RosterEntry " + entry);
// Log.i("XMPPChatDemoActivity", "User: " + entry.getUser());
// Log.i("XMPPChatDemoActivity", "Name: " + entry.getName());
// Log.i("XMPPChatDemoActivity", "Status: " + entry.getStatus());
// Log.i("XMPPChatDemoActivity", "Type: " + entry.getType());
this.filteredEntries.add(entry);
// Presence p = roster.getPresence(entry.getUser());
//
// if ((this.displayMode == ShowMode.ONLINE) && (p.isAvailable())) {
// this.filteredEntries.add(entry);
// }
// if ((this.displayMode == ShowMode.OFFLINE) && (!p.isAvailable())) {
//// Log.i("HAAAAAAAAAAAAAAAN", "Type: " + entry.getUser());
// this.filteredEntries.add(entry);
// }
}
}
public ArrayList<RosterEntry> refreshFriend(){
refreshFriends(ShowMode.OFFLINE);
return filteredEntries;
}
ArrayList<FriendListClass> Friends = new ArrayList<FriendListClass>();
String Temp_names;
public ArrayList<FriendListClass> refreshFriend2(){
Friends.clear();
ArrayList<RosterEntry> sm = refreshFriend();
for (RosterEntry entry : sm) {
Roster roster = connection.getRoster();
Presence p = roster.getPresence(entry.getUser());
if(entry.getUser().indexOf("@") == -1)
Temp_names = entry.getUser();
else
Temp_names = entry.getUser().substring(0,entry.getUser().indexOf("@"));
if(p.isAvailable()) Friends.add(new FriendListClass(entry.getUser(),1,p.getStatus()));
else Friends.add(new FriendListClass(entry.getUser(),0,""));
}
return Friends;
}
public int FriendNew(String name){
Roster roster = connection.getRoster();
RosterEntry rosterEntry = roster.getEntry(name);
name= name+SERVICE;
if (rosterEntry == null) {
try {
RosterPacket.Item item = new RosterPacket.Item(name, name + "님"); // 뒤에는 닉네임
item.setItemType(RosterPacket.ItemType.both);
item.addGroupName("Major"); // 그룹 몌이저로
item.setItemStatus(RosterPacket.ItemStatus.SUBSCRIPTION_PENDING);
RosterPacket rosterPacket = new RosterPacket();
rosterPacket.setType(IQ.Type.SET);
rosterPacket.addRosterItem(item);
PacketCollector var10 = this.connection.createPacketCollector(new PacketIDFilter(rosterPacket.getPacketID()));
connection.sendPacket(rosterPacket);
IQ var11 = (IQ)var10.nextResult((long) SmackConfiguration.getPacketReplyTimeout());
var10.cancel();
if(var11 == null) {
throw new XMPPException("No response from the server.");
} else if(var11.getType() == IQ.Type.ERROR) {
throw new XMPPException(var11.getError());
} else {
Presence var12 = new Presence(Presence.Type.subscribe);
var12.setTo(name);
var12.setFrom(name);
this.connection.sendPacket(var12); // 구독하고 있다고 업데이트 패킷 전송
}
return 1;
}
catch (XMPPException e) {
return 2;
}
}
else{
return 0;
}
}
}
/* 친구추가
public static void admitFriendsRequest() {
connection.getRoster().setSubscriptionMode(Roster.SubscriptionMode.manual);
connection.addPacketListener(new PacketListener() {
public void processPacket(Packet paramPacket) {
System.out.println("\n\n");
if (paramPacket instanceof Presence) {
Presence presence = (Presence) paramPacket;
String email = presence.getFrom();
System.out.println("chat invite status changed by user: : "
+ email + " calling listner");
System.out.println("presence: " + presence.getFrom()
+ "; type: " + presence.getType() + "; to: "
+ presence.getTo() + "; " + presence.toXML());
Roster roster = connection.getRoster();
for (RosterEntry rosterEntry : roster.getEntries()) {
System.out.println("jid: " + rosterEntry.getUser()
+ "; type: " + rosterEntry.getType()
+ "; status: " + rosterEntry.getStatus());
}
System.out.println("\n\n\n");
if (presence.getType().equals(Presence.Type.subscribe)) {
Presence newp = new Presence(Presence.Type.subscribed);
newp.setMode(Presence.Mode.available);
newp.setPriority(24);
newp.setTo(presence.getFrom());
connection.sendPacket(newp);
Presence subscription = new Presence(
Presence.Type.subscribe);
subscription.setTo(presence.getFrom());
connection.sendPacket(subscription);
} else if (presence.getType().equals(
Presence.Type.unsubscribe)) {
Presence newp = new Presence(Presence.Type.unsubscribed);
newp.setMode(Presence.Mode.available);
newp.setPriority(24);
newp.setTo(presence.getFrom());
connection.sendPacket(newp);
}
}
}
}, new PacketFilter() {
public boolean accept(Packet packet) {
if (packet instanceof Presence) {
Presence presence = (Presence) packet;
if (presence.getType().equals(Presence.Type.subscribed)
|| presence.getType().equals(
Presence.Type.subscribe)
|| presence.getType().equals(
Presence.Type.unsubscribed)
|| presence.getType().equals(
Presence.Type.unsubscribe)) {
return true;
}
}
return false;
}
});
connection.getRoster().addRosterListener(new RosterListener() {
public void presenceChanged(Presence presence) {
System.out.println(presence.getFrom() + "presenceChanged");
}
public void entriesUpdated(Collection<String> presence) {
System.out.println("entriesUpdated");
}
public void entriesDeleted(Collection<String> presence) {
System.out.println("entriesDeleted");
}
public void entriesAdded(Collection<String> presence) {
System.out.println("entriesAdded");
}
});
}
*/ | [
"[email protected]"
]
| |
c4d75878098d39ac1fe1c7940107a5fa9075d4d7 | 6e08c5d4435482ddbd3c3b65dd9ee538248c8fb3 | /src/fr/uga/miashs/album/service/PictureAnnotationService.java | 0f24ba7af2d55231603288a9b91ad6970c3cd2a1 | []
| no_license | agnef/projet-jee | f36038a9581b8fec86806472b55b5961b0dc8924 | fd8901e6834a8d6857dba89ec0dc4c8e5468a6ba | refs/heads/master | 2021-01-11T22:13:29.600194 | 2017-01-17T11:53:23 | 2017-01-17T11:53:23 | 78,936,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,006 | java | package fr.uga.miashs.album.service;
import java.util.ArrayList;
import java.util.List;
import org.apache.jena.query.*;
import org.apache.jena.rdf.model.*;
import org.apache.jena.update.*;
import fr.uga.miashs.album.model.Album;
import fr.uga.miashs.album.model.Picture;
public class PictureAnnotationService extends JpaService<Long,Picture>{
// requetes sur les images
public List<Picture> queries(String requete) {
List<String> uriPictures = query(requete); // uri de l'ontologie
List<Picture> pictures = new ArrayList<Picture>(); // liste des images qu'on renvoie
//requete jpa
javax.persistence.Query queryJPA = getEm().createQuery("SELECT p FROM Picture p");
List<Picture> pictureList = queryJPA.getResultList(); // toutes les photos dans jpa
//Comparaison des uri dans l'ontologie et des uri dans jpa
for (int i=0; i<uriPictures.size(); i++){
for (int j=0; j<pictureList.size(); j++){
String uriOntologie = uriPictures.get(i).toString();
String uriJPA = pictureList.get(j).getUri().toString();
if(uriOntologie.equals(uriJPA)){
pictures.add(pictureList.get(j));
}
}
}
return pictures;
}
public List<String> query(String requete){
Query query = null;
if (requete.equals("query0")){
query = query0();
} else if (requete.equals("query1")){
query = query1();
} else if (requete.equals("query2")){
query = query2();
} else if (requete.equals("query3")){
query = query3();
} else if (requete.equals("query4")){
query = query4();
} else if (requete.equals("query5")){
query = query5();
} else if (requete.equals("query6")){
query = query6();
}
List<String> uriPictures = new ArrayList<String>();
try (QueryExecution qexec = QueryExecutionFactory.sparqlService("http://localhost:3030/ALBUM/sparql", query)) {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
RDFNode x = soln.get("s");
System.out.println(x + " ");
uriPictures.add(x.toString());
}
}
return uriPictures;
}
public Query query0(){
// On selectionne toutes les photos qui sont dans l'ontologie
Query query = QueryFactory
.create("PREFIX pa: <http://www.semanticweb.org/masterDCISS/projetAlbum#>"
+ "SELECT ?s WHERE {"
+ "?s a pa:Picture .}");
return query;
}
public Query query1(){
//Photos prises entre le 21 juin et le 11 novembre 2015.
Query query = QueryFactory
.create("PREFIX pa: <http://www.semanticweb.org/masterDCISS/projetAlbum#> "
+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>"
+ "SELECT ?s WHERE {"
+ "{?s a pa:Picture;"
+ "pa:pictureDate ?date. "
+ "FILTER ( ?date > \"2015-06-21T00:00:00\"^^xsd:dateTime && "
+ "?date < \"2015-11-11T00:00:00\"^^xsd:dateTime)."
+ "}UNION"
+ "{?s a pa:Picture;"
+ "pa:inYear 2015;"
+ "pa:during pa:summer.}"
+ "}");
return query;
}
public Query query2(){
//Photos contenant les amis de Marc Lebeau qui sont aussi des utilisateurs (triées par année).
Query query = QueryFactory
.create("PREFIX pa: <http://www.semanticweb.org/masterDCISS/projetAlbum#>"
+ "SELECT DISTINCT ?s WHERE {"
+ "?s a pa:Picture;"
+ "pa:hasInside ?p ."
+ "?p pa:isFriendOf pa:marcLebeau ;"
+ "a pa:User ."
+ " OPTIONAL { ?s pa:inYear ?y } "
+ "}"
+ "ORDER BY ?y");
return query;
}
public Query query3(){
//Photos prises par Jeanne Dupont contenant un membre de sa famille
Query query = QueryFactory
.create("PREFIX pa: <http://www.semanticweb.org/masterDCISS/projetAlbum#>"
+ "SELECT DISTINCT ?s WHERE {"
+ "?s a pa:Picture;"
+ "pa:isTakenBy pa:pierreDupont;"
+ "pa:hasInside ?p ."
+ "?p pa:belongsToTheSameFamily pa:pierreDupont. "
+ "}");
return query;
}
public Query query4(){
//Photos contenant des chevaux.
Query query = QueryFactory
.create("PREFIX pa: <http://www.semanticweb.org/masterDCISS/projetAlbum#>"
+ "SELECT DISTINCT ?s WHERE {"
+ "?s a pa:Picture;"
+ "pa:hasInside ?p."
+ "?p a pa:Horse. "
+ "}");
return query;
}
public Query query5(){
// Toute les photos à Paris
Query query = QueryFactory
.create("PREFIX dbpedia: <http://dbpedia.org/resource/>"
+ "PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>"
+ "PREFIX pa: <http://www.semanticweb.org/masterDCISS/projetAlbum#>"
+ "SELECT DISTINCT ?s WHERE {"
+ " {?s a pa:Picture. "
+ "{?s pa:hasInside dbpedia:Paris."
+ "}UNION"
+ "{?s pa:isTakenIn dbpedia:Paris.}"
+ "}UNION{"
+ "?s a pa:Picture ;"
+ "pa:hasInside ?something."
+ "SERVICE <http://dbpedia.org/sparql> {"
+ "?something dbpedia-owl:location dbpedia:Paris.}"
+ " }}");
return query;
}
public Query query6(){
// Toutes le photos dans une capitale
Query query = QueryFactory
.create("PREFIX dbpedia: <http://dbpedia.org/resource/>"
+ "PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>"
+ "PREFIX pa: <http://www.semanticweb.org/masterDCISS/projetAlbum#>"
+ "SELECT DISTINCT ?s "
+ "WHERE {"
+ "{?s a pa:Picture. "
+ "?capitale a pa:City. "
+ "{?s pa:hasInside ?capitale. }"
+ "UNION "
+ "{?s pa:isTakenIn ?capitale.} "
+ "SERVICE <http://dbpedia.org/sparql>{ "
+ "?pays dbpedia-owl:capital ?capitale.} "
+ "} UNION {"
+ "?s a pa:Picture. "
+ "?s pa:hasInside ?something. "
+ "SERVICE <http://dbpedia.org/sparql> { "
+ "?something dbpedia-owl:location ?capitale. "
+ "?pays dbpedia-owl:capital ?capitale. } "
+ "} }");
return query;
}
// insertion dans ontologie
public List<String> seeAnnotations(String uri){
System.out.println("pic annotation service : seeAnnotations");
List<String> annotations = new ArrayList<String>();
Query query = QueryFactory
.create( "SELECT ?p ?o WHERE {"
+ "<" + uri + ">"
+ "?p ?o"
+ " .}");
try (QueryExecution qexec = QueryExecutionFactory.sparqlService("http://localhost:3030/ALBUM/sparql", query)) {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
RDFNode x = soln.get("s"); //on recupere la photo;
Resource r = soln.getResource("p"); // une proppriete
RDFNode l = soln.get("o"); // valeur de la propriete
System.out.println(x + " " + r + " " + l);
annotations.add(r.toString());
annotations.add(l.toString());
}
System.out.println("URI : " + uri);
}
// query doit obtenir toutes les propriétés et les valeurs de la propriete de l'uri passée en paramètres
return annotations;
}
public void insertPictureOntology(String uri){
UpdateRequest request = UpdateFactory.create(
"INSERT DATA { "
+ "<" + uri + ">" + "a" + "<http://www.semanticweb.org/masterDCISS/projetAlbum#Picture>"
+ " .}");
UpdateProcessor up = UpdateExecutionFactory.createRemote(request, "http://localhost:3030/ALBUM/update");
up.execute();
}
public void insertOntology(String uriStr, String propriete, String valeurPropriete){
String subject = "<" + uriStr + ">";
String predicate = "<http://www.semanticweb.org/masterDCISS/projetAlbum#" + propriete + ">";
String object = "<http://www.semanticweb.org/masterDCISS/projetAlbum#" +valeurPropriete + ">";
UpdateRequest request = UpdateFactory.create(
"INSERT DATA { "
+ subject + predicate + object
+ " .}");
UpdateProcessor up = UpdateExecutionFactory.createRemote(request, "http://localhost:3030/ALBUM/update");
up.execute();
}
}
| [
"[email protected]"
]
| |
696f3542087ee2ec21788a7dbf28362c25109653 | 0117ec6c45490e611639cec4f7f3239095b2bbcd | /src/main/java/com/mmoreno/app/BowlingGame.java | dde557ad8473ff60ba8cb82691b72a9ff127663e | []
| no_license | MatiMorenoIglesias/tddJava | ada1266912c21d7b5496536e65e62271b75dee6a | 4cd7e04af45c46d4b1f3d05131a5d005c26bbbe7 | refs/heads/master | 2023-01-19T03:06:59.809759 | 2020-11-26T18:58:04 | 2020-11-26T18:58:04 | 316,312,446 | 0 | 0 | null | 2020-11-26T18:58:06 | 2020-11-26T18:45:23 | null | UTF-8 | Java | false | false | 1,447 | java | package com.mmoreno.app;
public class BowlingGame {
private int[] rolls;
private int currentRoll;
public BowlingGame() {
this.currentRoll = 0;
this.rolls = new int[21];
}
public void roll(int points) {
this.rolls[this.currentRoll++] = points;
}
public int[] getRolls() {
return rolls;
}
public int score() {
int score = 0;
int frameIndex = 0;
for (int frame = 0; frame < 10; frame++) {
if (isSpare(frameIndex)) {
score += 10 + getSpareBonus(frameIndex);
frameIndex += 2;
} else if (isStrike(frameIndex)) {
score += 10 + getStrikeBonus(frameIndex);
frameIndex++;
} else {
score += getSumOfBallsInFrame(frameIndex);
frameIndex += 2;
}
}
return score;
}
private int getSumOfBallsInFrame(int frameIndex) {
return rolls[frameIndex] + rolls[frameIndex + 1];
}
private int getSpareBonus(int frameIndex) {
return rolls[frameIndex + 2];
}
private boolean isStrike(int frameIndex) {
return rolls[frameIndex] == 10;
}
private int getStrikeBonus(int frameIndex) {
return rolls[frameIndex + 1] + rolls[frameIndex + 2];
}
private boolean isSpare(int frameIndex) {
return getSumOfBallsInFrame(frameIndex) == 10;
}
}
| [
"[email protected]"
]
| |
9d7ab7c1a25d1a60d233340e664c018709bc6101 | cd9fdd7bf5ec9b0dfdc08d9307cbf4611050c369 | /src/java/user/User.java | 03ebf58fd5d19356bc0542cc2c940dbb3649b930 | []
| no_license | peterFran/CaS_Assignment | 1198b4cfe7397b598b4e31948ab72923ff19d148 | 5e4e85be784691d3dac4b2b43ff4e4b4d5d71c6f | refs/heads/master | 2020-06-04T12:28:23.672426 | 2012-11-29T12:04:49 | 2012-11-29T12:04:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package user;
/**
*
* @author petermeckiffe
*/
public class User {
private String firstName;
private String lastName;
private int ID;
public User(int ID, String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.ID = ID;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public int getID() {
return ID;
}
}
| [
"[email protected]"
]
| |
c6e625e39e95b40200ef258d0043b864929c1103 | 101f07beca22533df20aa53d89bf14571863f153 | /cli/modules/driver/DriverTakeRequest.java | 14fa4d604c7529f43b034faf5ed8b207b9976108 | []
| no_license | Andrewfang21/CSCI3170-Introduction-to-Database-Systems-Project | a57c1247dfa7ba2e4c93ed6d8a8f932fb26dcc77 | 8c3024a8be750b46e4fdc7c022ee50419c10d943 | refs/heads/master | 2023-01-22T13:53:53.789585 | 2020-12-04T11:33:46 | 2020-12-04T11:33:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package cli.modules.driver;
import java.util.Scanner;
import cli.CLIInterface;
import service.DriverService;
public class DriverTakeRequest extends AbstractDriver implements CLIInterface {
private int requestID;
public DriverTakeRequest(Scanner sc, DriverService service) {
this.sc = sc;
this.service = service;
}
@Override
public void runCLI() {
setDriverID();
setRequestID();
execute();
}
private void setRequestID() {
System.out.println("Please enter the request ID.");
requestID = sc.nextInt();
}
@Override
public void execute() {
service.takeRequest(driverID, requestID);
}
}
| [
"[email protected]"
]
| |
2d0a3a4a39b1fb51f7b10c62abb8aac03b23cac2 | cf04cc7d6303533c4a094cd47e459950adb2b2ef | /app/src/main/java/com/example/doubtfire/Models/MyTag.java | 220b1431e18947df43698ebd9f1205950e2c2abe | []
| no_license | ayush-sharma2601/DoubtFire | 1775e6a5865081d67db70f2b7769091a88fa6ecd | 6c7755b16868885b345c915cdacba26dc17bf1f4 | refs/heads/master | 2022-11-14T19:05:43.925940 | 2020-07-04T07:50:10 | 2020-07-04T07:50:10 | 264,227,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 300 | java | package com.example.doubtfire.Models;
public class MyTag {
public String key;
public String magnifier;
public MyTag() {
key = "";
magnifier = "";
}
public MyTag(String key, String magnifier) {
this.key = key;
this.magnifier = magnifier;
}
}
| [
"[email protected]"
]
| |
d269cb4341a7dea63180fe9f098dd7c3a10f7fff | da505fd90305678c186f801a2173745554e08f69 | /Problem4/Problem4c.java | e03e9a21e0d54f58785e6bcea105044a954a011e | []
| no_license | np595/CS435Project2 | 73d86fede5aefc8125b473a4887f4063828cd479 | 93d559466ce71d753c3bb9a6bffcce571ca156bd | refs/heads/master | 2021-04-17T22:31:11.166519 | 2020-04-19T20:58:50 | 2020-04-19T20:58:50 | 249,480,645 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,079 | java | import java.util.*;
import java.util.Random;
class Edge{
public Node dest;
public String weight;
public Edge(Node d, String w){
this.dest = d;
this.weight = w;
}
}
class Node{
public String data;
public List<Edge> neighbors;
public Node(String d){
this.data = d;
}
}
class MazeGraph{
List<Node> nodes;
}
class DirectedGraph{
HashSet<Node> graph = new HashSet<Node>();
public int n = 0;
Node addNode(final String nodeVal){
Node temp = new Node(nodeVal);
temp.neighbors = new ArrayList<Edge>();
graph.add(temp);
n++;
return temp;
}
void addDirectedEdge(final Node first, final Node second){
first.neighbors.add(new Edge(second, second.data));
}
void removeDirectedEdge(final Node first, final Node second){
boolean check = false;
for(int i = 0; i < first.neighbors.size(); i++){
if(first.neighbors.get(i).dest == second){
first.neighbors.remove(i);
check = true;
break;
}
}
if(check == false){
System.out.println(first.data + " isn't connected to " + second.data);
}
}
HashSet<Node> getAllNodes(){
HashSet<Node> allNode = graph;
return allNode;
}
}
class Main{
DirectedGraph createRandomDAGIter(Node[] nodes, final int n){
Random rand = new Random();
DirectedGraph dirGraph = new DirectedGraph();
//String alp = "abcdefghijklmnopqrstuvxyz";
//int size = alp.length();
for(int i = 0; i < n; i++){
//char tempS = alp.charAt(rand.nextInt(size));
//String temp = String.valueOf(tempS);
int tempS = rand.nextInt(1000);
String temp = Integer.toString(tempS);
nodes[i] = dirGraph.addNode(temp);
}
for(int k = 0; k < (n*2); k++){
int firstNode = rand.nextInt(nodes.length);
int secondNode = rand.nextInt(nodes.length);
dirGraph.addDirectedEdge(nodes[firstNode], nodes[secondNode]);
}
System.out.println(nodes[0].data + " " + nodes[0].neighbors);
return dirGraph;
}
public static void main(String[] args){
int nodeSize = 5;
Node[] nodes = new Node[nodeSize];
Random rand = new Random();
DirectedGraph dirGraph = new DirectedGraph();
Main test = new Main();
dirGraph = test.createRandomDAGIter(nodes, nodeSize);
}
}
| [
"[email protected]"
]
| |
f216a61796acdfa87ae20eedee7ce05ea7d4f295 | 441cd00c59b8f2825ea70bbb2a743dfaaa8425d7 | /build/java/src/haxe/root/StringBuf.java | e267f0013d6664991633915e510d5f3043c0fa13 | []
| no_license | francescoagati/haxe-testing-erazor | a365ef4d9a2ee9157c10051609f67d3dae284cc9 | 52b733d02c3da82d53a7a4bd078ef47dc429e162 | refs/heads/master | 2021-01-10T11:45:23.631664 | 2015-06-05T01:27:33 | 2015-06-05T01:27:33 | 36,904,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,826 | java | package haxe.root;
import haxe.root.*;
@SuppressWarnings(value={"rawtypes", "unchecked"})
public class StringBuf extends haxe.lang.HxObject
{
public StringBuf(haxe.lang.EmptyObject empty)
{
}
public StringBuf()
{
//line 30 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
haxe.root.StringBuf.__hx_ctor__StringBuf(this);
}
public static void __hx_ctor__StringBuf(haxe.root.StringBuf __temp_me9)
{
//line 31 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
__temp_me9.b = new java.lang.StringBuilder();
}
public static java.lang.Object __hx_createEmpty()
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return new haxe.root.StringBuf(haxe.lang.EmptyObject.EMPTY);
}
public static java.lang.Object __hx_create(haxe.root.Array arr)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return new haxe.root.StringBuf();
}
public java.lang.StringBuilder b;
public <T> void add(T x)
{
//line 39 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (haxe.lang.Runtime.isInt(x))
{
//line 41 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
int x1 = ((int) (haxe.lang.Runtime.toInt(((java.lang.Object) (x) ))) );
//line 42 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
java.lang.Object xd = x1;
//line 43 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
this.b.append(((java.lang.Object) (xd) ));
}
else
{
//line 45 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
this.b.append(((java.lang.Object) (x) ));
}
}
@Override public java.lang.String toString()
{
//line 59 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return this.b.toString();
}
@Override public java.lang.Object __hx_setField(java.lang.String field, java.lang.Object value, boolean handleProperties)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
boolean __temp_executeDef1 = true;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
switch (field.hashCode())
{
case 98:
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (field.equals("b"))
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
__temp_executeDef1 = false;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
this.b = ((java.lang.StringBuilder) (value) );
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return value;
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
break;
}
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (__temp_executeDef1)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return super.__hx_setField(field, value, handleProperties);
}
else
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
throw null;
}
}
}
@Override public java.lang.Object __hx_getField(java.lang.String field, boolean throwErrors, boolean isCheck, boolean handleProperties)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
boolean __temp_executeDef1 = true;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
switch (field.hashCode())
{
case -1776922004:
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (field.equals("toString"))
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
__temp_executeDef1 = false;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return ((haxe.lang.Function) (new haxe.lang.Closure(this, "toString")) );
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
break;
}
case 98:
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (field.equals("b"))
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
__temp_executeDef1 = false;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return this.b;
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
break;
}
case 96417:
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (field.equals("add"))
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
__temp_executeDef1 = false;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return ((haxe.lang.Function) (new haxe.lang.Closure(this, "add")) );
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
break;
}
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (__temp_executeDef1)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return super.__hx_getField(field, throwErrors, isCheck, handleProperties);
}
else
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
throw null;
}
}
}
@Override public java.lang.Object __hx_invokeField(java.lang.String field, haxe.root.Array dynargs)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
boolean __temp_executeDef1 = true;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
switch (field.hashCode())
{
case -1776922004:
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (field.equals("toString"))
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
__temp_executeDef1 = false;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return this.toString();
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
break;
}
case 96417:
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (field.equals("add"))
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
__temp_executeDef1 = false;
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
this.add(dynargs.__get(0));
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return ((java.lang.Object) (null) );
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
break;
}
}
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
if (__temp_executeDef1)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
return super.__hx_invokeField(field, dynargs);
}
else
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
throw null;
}
}
}
@Override public void __hx_getFields(haxe.root.Array<java.lang.String> baseArr)
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
baseArr.push("length");
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
baseArr.push("b");
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
{
//line 24 "/usr/lib/haxe/std/java/_std/StringBuf.hx"
super.__hx_getFields(baseArr);
}
}
}
| [
"[email protected]"
]
| |
37cf2533510b5046dde2091e35aa32f347f3a084 | 13c82eeb3d6caaa31d88b52429ea4239f54f30cd | /chap004/src/main/java/java8_3/ch07_inheritance/interface_/unitEx/Unit.java | 099e745ac9bbc1eb85a131cf56092736257f1e77 | []
| no_license | nekisse-lee/java_study | 9d8c3735cc02c66a2c66210c4e3859727fee860c | b661a3b22e61e90f9134bc3d1229954c5672f024 | refs/heads/master | 2020-05-22T13:59:48.844596 | 2019-08-04T08:18:06 | 2019-08-04T08:18:06 | 186,373,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package java8_3.ch07_inheritance.interface_.unitEx;
public class Unit {
int hitPoint;
final int MAX_HP;
public Unit(int hp) {
MAX_HP = hp;
}
}
| [
"[email protected]"
]
| |
5954dd4091797c8444d17ead30da78f8aff51e43 | ca0e9689023cc9998c7f24b9e0532261fd976e0e | /src/com/tencent/mm/d/a/ez$b.java | 1de31c4bd6e21ce65f1fca5ef59606bb89938d50 | []
| no_license | honeyflyfish/com.tencent.mm | c7e992f51070f6ac5e9c05e9a2babd7b712cf713 | ce6e605ff98164359a7073ab9a62a3f3101b8c34 | refs/heads/master | 2020-03-28T15:42:52.284117 | 2016-07-19T16:33:30 | 2016-07-19T16:33:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.tencent.mm.d.a;
public final class ez$b
{
public int ret = 0;
}
/* Location:
* Qualified Name: com.tencent.mm.d.a.ez.b
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
aafb887b381acf8501abb59bc928ff9db02b0537 | e6c6061a2fcb2a1f5b861fdbe67ce7f8dc8a2b6a | /src/main/java/com/example/FlyAway/model/FlightBooking.java | 77c4c4caa6e2f22c96b72c1cc800feba7d7ea7b4 | []
| no_license | Asayel0/fly_away- | e68b0e3a7faddf53263686a0fda17393f5fa4b14 | 2956f640b550f3022025a6d05da04a94a4b6ac56 | refs/heads/main | 2023-07-24T10:39:15.589519 | 2021-09-06T20:13:55 | 2021-09-06T20:13:55 | 403,738,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,434 | java | package com.example.FlyAway.model;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.JoinColumn;
@Entity
@Table(name = "tbl_flight_booking")
public class FlightBooking {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@ManyToOne
private Passenger passenger;
@ManyToMany(cascade = { CascadeType.MERGE }, fetch = FetchType.EAGER)
@JoinTable(name = "booking_flights", joinColumns = @JoinColumn(name = "booking_id"), inverseJoinColumns = @JoinColumn(name = "flight_id"))
private Set<Flight> flights;
public FlightBooking() {
super();
}
public FlightBooking(Passenger passenger, Set<Flight> flights) {
super();
this.passenger = passenger;
this.flights = flights;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Passenger getPassenger() {
return passenger;
}
public void setPassenger(Passenger passenger) {
this.passenger = passenger;
}
public Set<Flight> getFlights() {
return flights;
}
public void setFlights(Set<Flight> flights) {
this.flights = flights;
}
} | [
"[email protected]"
]
| |
efd8625281b4c6a513723cdb6d9889833af17a3a | a6a90408407d5975ab6f23da7479f2517626ed16 | /src/MediClientdemo/LogTable.java | 5939bfbc8f6d4754edece033b6c304291d7d412c | []
| no_license | minionsrahat/Queue-Manager | 990f35c7bf70fedca473603ba98baaa550dd8a99 | a37720d52d45704114a38bb3df587c4a5ed4a86e | refs/heads/master | 2021-03-06T22:19:37.027796 | 2020-03-10T07:19:32 | 2020-03-10T07:19:32 | 246,228,676 | 1 | 0 | null | 2020-03-10T06:52:39 | 2020-03-10T06:52:39 | null | UTF-8 | Java | false | false | 3,428 | java |
package MediClientdemo;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import MediPopulate.*;
public class LogTable extends JFrame{
DefaultTableModel model=new DefaultTableModel();
JScrollPane scr;
Container c;
JPanel p;
TitledBorder border[] = new TitledBorder[10];
JTable tb;
String colms[] = {"Serial No.", "Customer Name", "Gender", "Description"};
Font f[]=new Font[10];
LogTable()
{
initcomponents();
}
public void initcomponents() {
// this.setVisible(true);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setBounds(500,100,700,900);
c=this.getContentPane();
c.setLayout(null);
p=new JPanel();
c.add(p);
p.setBounds(40,80,600,750);
tb = new JTable();
scr = new JScrollPane(tb);
p.setLayout(null);
p.add(scr);
scr.setBounds(10, 50, 580, 690);
tb.setBackground(Color.decode("#058dc7"));
tb.setForeground(Color.WHITE);
f[1] = new Font("Arial", Font.BOLD, 14);
f[2] = new Font("Arial", Font.BOLD, 20);
tb.setFont(f[1]);
tb.setRowHeight(tb.getRowHeight()+15);
model=(DefaultTableModel)tb.getModel();
for (int l = 0; l <4; l++) {
model.addColumn(colms[l]);
}
TableColumn column = null;
// column = table[1].getColumnModel().getColumn(0);
for (int t = 0; t < 4; t++) {
column = tb.getColumnModel().getColumn(t);
if (t == 0) {
column.setPreferredWidth(80);
}
if (t == 1) {
column.setPreferredWidth(220);
}
if (t == 2) {
column.setPreferredWidth(200);
}
if (t == 3) {
column.setPreferredWidth(300);
}
}
border[1] = new TitledBorder("LOG TABLE");
border[1].setTitleJustification(TitledBorder.LEFT);
border[1].setTitlePosition(TitledBorder.TOP);
border[1].setTitleColor(Color.RED);
border[1].setTitleFont(f[2]);
p.setBorder(border[1]);
}
public void populate(Medipopulate t1 )
{
String rows[]={t1.sn,t1.cn,t1.gen,t1.d};
model.addRow(rows);
this.filewriter(t1);
}
public void filewriter(Medipopulate t1)
{
String data[]={t1.sn,t1.cn,t1.gen,t1.d};
try {
FileWriter fr=new FileWriter("History.txt",true);
fr.write(t1.sn+" "+" ");
fr.write(t1.cn+" "+" ");
fr.write(t1.gen+" "+" ");
fr.write(t1.d+" "+" ");
fr.write(System.getProperty("line.separator"));
fr.close();
} catch (IOException ex) {
Logger.getLogger(LogTable.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void main(String[] args) {
//LogTable frame=new LogTable();
}
}
| [
"[email protected]"
]
| |
a5bf9ff09e02b7be431d8903ae8c96921ffdeac1 | d5a2b383109e16ebfb2b7f700a49ff7a4c44f182 | /app/src/main/java/com/example/whddu/project01/ui/SplashActivity.java | 07fc1454f8eef032988780b0ab5b8f72fe77d770 | []
| no_license | alattalatta/touriends-app | 41a4f7aef22b9796e109f16a31bef647a0050c73 | 806664de34f8f14d0dc3f2431fe5244f16de83a5 | refs/heads/master | 2021-07-25T21:34:00.234536 | 2017-11-04T03:43:25 | 2017-11-04T03:43:25 | 102,315,535 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package com.example.whddu.project01.ui;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;
import com.example.whddu.project01.R;
public class SplashActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Handler hd = new Handler();
hd.postDelayed(new splashhandler() , 1800);
}
private class splashhandler implements Runnable{
public void run() {
startActivity(new Intent(getApplication(), com.example.whddu.project01.ui.MainActivity.class));
SplashActivity.this.finish();
}
}
}
| [
"[email protected]"
]
| |
7e9270308cc921bd108ee99302c4269cfd4fefb1 | dab687fec11d993b98e95db9118558b59810ca4f | /Por/src/Mysql/MainSql.java | a89cf25f96af3232c0bb0af8088dde7f08b3a9ac | []
| no_license | mengporly-git/JavaSchoolWork | c48157a6cff8f95bd6f42d9b92b33540b15cafb8 | 218a2eb6ffb751a6a9ef0df27ee29395097c2527 | refs/heads/master | 2021-10-25T03:25:24.169175 | 2019-03-31T08:19:58 | 2019-03-31T08:19:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | 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 Mysql;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
/**
*
* @author Por
*/
public class MainSql {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
Connection dataCon;
Class.forName("com.mysql.jdbc.Driver").newInstance();
dataCon=DriverManager.getConnection("jdbc:mysql://localhost/dbpor","root","123");
Statement s=dataCon.createStatement(1004,1008);
ResultSet r=s.executeQuery("sql cmd");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
| [
"[email protected]"
]
| |
53027c085dda9a90966f7b8b3d51dd195dad1252 | c4500f535aa9d595f55b725aa1bac39589496c93 | /java/isp-01-initial/src/test/java/no/bouvet/solid/isp/JsonStoreTest.java | e320168c8e3aabb922883132ae1e9d8186b08407 | []
| no_license | bouvet/solid-3 | 6ca888adeea7b9c19075305d5eede26612782055 | 075bb34b236d1367c47e36eab859cf6d65f07c4c | refs/heads/master | 2020-08-06T19:26:21.527736 | 2015-04-28T13:29:15 | 2015-04-28T13:29:15 | 33,530,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | package no.bouvet.solid.isp;
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class JsonStoreTest {
private JsonStore subject;
@Before
public void beforeTest() {
subject = new JsonStore();
subject.open();
}
@After
public void afterTest() {
subject.close();
}
@Test
public void test() {
// when
String result = subject.readFile();
// then
assertEquals("File content!", result);
}
}
| [
"[email protected]"
]
| |
1f222e5f821b8b4da78454251f2e3607fc0d6bc8 | d868fdad46fc63cbd35b0f00df1b594a9a968d75 | /app/src/androidTest/java/com/example/rajan/hangingegg/ExampleInstrumentedTest.java | 64fa6007d10796adc3f0585356809e93dd22cfa0 | []
| no_license | RajanDey/Hanging-Egg | 8aac6d0fec59d3dec5a59e0ba86d34997fd4698a | b8c140f130e89945cbc53bbda061c4ea515bd247 | refs/heads/master | 2020-03-28T20:18:59.486262 | 2018-09-17T02:59:52 | 2018-09-17T02:59:52 | 149,058,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.example.rajan.hangingegg;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.rajan.hangingegg", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
49645e2b86ae30b7e461c878e86fadad54c7fac1 | 84b38ea2f96a9d9b7d6142a73fbf0b03db41a4a6 | /src/main/java/com/athena/chameleon/engine/entity/xml/ejbjar/jeus/v5_0/ColumnMapType.java | eedf2228cf128ca7c369c55dee9ecf86d395d66b | [
"Apache-2.0"
]
| permissive | OpenSourceConsulting/playce-chameleon | 06916eae62ba0bdf3088c5364544ae1f6acbe69b | 356a75674495d2946aaf2c2b40f78ecf388fefd0 | refs/heads/master | 2022-12-04T10:06:02.135611 | 2020-08-11T04:27:17 | 2020-08-11T04:27:17 | 5,478,313 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,062 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.09.04 at 12:32:21 오후 KST
//
package com.athena.chameleon.engine.entity.xml.ejbjar.jeus.v5_0;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for column-mapType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="column-mapType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="foreign-key-column" type="{http://www.w3.org/2001/XMLSchema}token"/>
* <element name="target-primary-key-column" type="{http://www.w3.org/2001/XMLSchema}token"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "column-mapType", propOrder = {
"foreignKeyColumn",
"targetPrimaryKeyColumn"
})
public class ColumnMapType {
@XmlElement(name = "foreign-key-column", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "token")
protected String foreignKeyColumn;
@XmlElement(name = "target-primary-key-column", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "token")
protected String targetPrimaryKeyColumn;
/**
* Gets the value of the foreignKeyColumn property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getForeignKeyColumn() {
return foreignKeyColumn;
}
/**
* Sets the value of the foreignKeyColumn property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setForeignKeyColumn(String value) {
this.foreignKeyColumn = value;
}
/**
* Gets the value of the targetPrimaryKeyColumn property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTargetPrimaryKeyColumn() {
return targetPrimaryKeyColumn;
}
/**
* Sets the value of the targetPrimaryKeyColumn property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTargetPrimaryKeyColumn(String value) {
this.targetPrimaryKeyColumn = value;
}
}
| [
"[email protected]"
]
| |
870c24b78f5117141c40af0b242fafc5f8f339b5 | 0e0949ffe6ad77023c03ff789b5e3589d70670c6 | /src/main/java/cn/du/dao/MenuDao.java | 44b1576d9ec19e3c2f771d4c997c1862c3cbae6d | []
| no_license | dumengzhen/sfsShop | 45b2c7ccdd8e0986768a56c073af24525ac18467 | dd46f93cb1b4f14496f9e66b318c615a8a28263d | refs/heads/master | 2021-01-24T06:21:49.511031 | 2017-06-05T09:07:50 | 2017-06-05T09:07:50 | 93,313,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package cn.du.dao;
import org.springframework.stereotype.Repository;
import cn.du.entity.Menu;
@Repository
public class MenuDao extends BaseDao<Menu>{
}
| [
"[email protected]"
]
| |
a50a2f91f0acdda81a0cf5144bc1da6e8979b67b | 7c0e66ca0dace8b1eb4cea9de861e31ef86117f7 | /src/lib/HelloPackages.java | df5cb7f14e8d51e7ada7092e4094d860812a2e0a | []
| no_license | Royal-lobster/java-lab-experiments | be5504c0e4d66b6078d7417ffe9f45612822c612 | 2274efe9d2dad9ec2606c0f579fc7664cb0c5f46 | refs/heads/main | 2023-06-30T14:12:07.274533 | 2021-08-08T11:19:48 | 2021-08-08T11:19:48 | 389,162,485 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | package lib;
public class HelloPackages {
public void sayHello() {
System.out.println("Hello 👋 from a different package");
}
}
| [
"[email protected]"
]
| |
5dcfba8054b7899599586b96abf08074d5cd7fdd | b41933455a3da03e06cda414a9f17b60c3a6a61c | /app/src/main/java/com/runjing/bean/response/good/SkuImageBean.java | 7876e3805c93ea13ef9485585479a9ff9e6473c1 | []
| no_license | GrassJuly/wineword | 62f5dc5735af5585ca29f954cefa8df2aaf97ccc | 5434648db10873e21f0957c849d6ac807ca57026 | refs/heads/master | 2022-12-01T13:00:12.498243 | 2020-07-28T17:53:53 | 2020-07-28T17:53:53 | 280,475,024 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.runjing.bean.response.good;
/**
* @Created: qianxs on 2020.07.23 13:39.
* @Describe:
* @Review:
* @Modify:
* @Version: v_1.0 on 2020.07.23 13:39.
* @Remark:
*/
public class SkuImageBean {
private String imgUrl;
private String sceneType;
private String tenantId;
private String index;
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getSceneType() {
return sceneType;
}
public void setSceneType(String sceneType) {
this.sceneType = sceneType;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getIndex() {
return index;
}
public void setIndex(String index) {
this.index = index;
}
@Override
public String toString() {
return "SkuImageBean{" +
"imgUrl='" + imgUrl + '\'' +
", sceneType='" + sceneType + '\'' +
", tenantId='" + tenantId + '\'' +
", index='" + index + '\'' +
'}';
}
}
| [
"[email protected]"
]
| |
065b0cd2e9509c699399593dff03bb94cda077f1 | 924d0030c94c7f14ae660fed8e061735e5b73c71 | /SpringBootMyBatis/config/PageBean.java | 9418b82836b39df9be6707b4b55efcf82397662c | []
| no_license | huhuiyu/TeachVideos | 7ac12ffc0ef9a220682a6c97779583779f7819ff | 8d72451e689a6cfd19ce12063d421e5a893d1054 | refs/heads/master | 2020-03-29T16:25:47.668847 | 2018-10-28T03:31:53 | 2018-10-28T03:31:53 | 150,113,434 | 15 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,283 | java | package top.huhuiyu.springboot.projects.util;
import java.io.Serializable;
import com.github.pagehelper.Page;
public class PageBean implements Serializable {
private static final long serialVersionUID = -2047703337735760044L;
private int total;
private int pageNumber;
private int pageSize = 5;
private int pageCount;
public PageBean() {
}
public PageBean setPageInfo(Page<?> page) {
total = (int) page.getTotal();
pageCount = page.getPages();
pageNumber = page.getPageNum();
pageSize = page.getPageSize();
return this;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getPageNumber() {
return pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
@Override
public String toString() {
return "PageBean [total=" + total + ", pageNumber=" + pageNumber + ", pageSize=" + pageSize + ", pageCount="
+ pageCount + "]";
}
}
| [
"[email protected]"
]
| |
f76d3786fb88df85709429db7a8b3f2eb82848a7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/32/32_11fdf2e01d95b874f493e0249a58e9d49eb9216b/Config/32_11fdf2e01d95b874f493e0249a58e9d49eb9216b_Config_s.java | 13eda0b92536cdd38c57a5377b7a68a8888b7e29 | []
| 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 | 20,596 | java | /*
* Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
*
* 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.hazelcast.config;
import com.hazelcast.core.HazelcastException;
import com.hazelcast.core.ManagedContext;
import com.hazelcast.util.PartitionKeyUtil;
import java.io.File;
import java.net.URL;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import static java.text.MessageFormat.format;
public class Config {
private URL configurationUrl;
private File configurationFile;
private ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
private Properties properties = new Properties();
private String instanceName = null;
private GroupConfig groupConfig = new GroupConfig();
private NetworkConfig networkConfig = new NetworkConfig();
private final Map<String, MapConfig> mapConfigs = new ConcurrentHashMap<String, MapConfig>();
private final Map<String, TopicConfig> topicConfigs = new ConcurrentHashMap<String, TopicConfig>();
private final Map<String, QueueConfig> queueConfigs = new ConcurrentHashMap<String, QueueConfig>();
private final Map<String, MultiMapConfig> multiMapConfigs = new ConcurrentHashMap<String, MultiMapConfig>();
private final Map<String, ExecutorConfig> executorConfigs = new ConcurrentHashMap<String, ExecutorConfig>();
private final Map<String, SemaphoreConfig> semaphoreConfigs = new ConcurrentHashMap<String, SemaphoreConfig>();
private final Map<String, WanReplicationConfig> wanReplicationConfigs = new ConcurrentHashMap<String, WanReplicationConfig>();
private ServicesConfig servicesConfig = new ServicesConfig();
private SecurityConfig securityConfig = new SecurityConfig();
private final List<ListenerConfig> listenerConfigs = new LinkedList<ListenerConfig>();
private PartitionGroupConfig partitionGroupConfig = new PartitionGroupConfig();
private ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig();
private SerializationConfig serializationConfig = new SerializationConfig();
private ManagedContext managedContext;
private ConcurrentMap<String, Object> userContext = new ConcurrentHashMap<String, Object>();
private String licenseKey;
public Config() {
}
public ClassLoader getClassLoader() {
return classLoader;
}
public Config setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
return this;
}
public String getProperty(String name) {
String value = properties.getProperty(name);
return value != null ? value : System.getProperty(name);
}
public Config setProperty(String name, String value) {
properties.put(name, value);
return this;
}
public Properties getProperties() {
return properties;
}
public Config setProperties(Properties properties) {
this.properties = properties;
return this;
}
public String getInstanceName() {
return instanceName;
}
public Config setInstanceName(String instanceName) {
this.instanceName = instanceName;
return this;
}
public GroupConfig getGroupConfig() {
return groupConfig;
}
public Config setGroupConfig(GroupConfig groupConfig) {
this.groupConfig = groupConfig;
return this;
}
public NetworkConfig getNetworkConfig() {
return networkConfig;
}
public Config setNetworkConfig(NetworkConfig networkConfig) {
this.networkConfig = networkConfig;
return this;
}
public MapConfig getMapConfig(String name) {
name = PartitionKeyUtil.getBaseName(name);
MapConfig config;
if ((config = lookupByPattern(mapConfigs, name)) != null) return config;
MapConfig defConfig = mapConfigs.get("default");
if (defConfig == null) {
defConfig = new MapConfig();
defConfig.setName("default");
addMapConfig(defConfig);
}
config = new MapConfig(defConfig);
config.setName(name);
addMapConfig(config);
return config;
}
public Config addMapConfig(MapConfig mapConfig) {
mapConfigs.put(mapConfig.getName(), mapConfig);
return this;
}
/**
* @return the mapConfigs
*/
public Map<String, MapConfig> getMapConfigs() {
return mapConfigs;
}
/**
* @param mapConfigs the mapConfigs to set
*/
public Config setMapConfigs(Map<String, MapConfig> mapConfigs) {
this.mapConfigs.clear();
this.mapConfigs.putAll(mapConfigs);
for (final Entry<String, MapConfig> entry : this.mapConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
public QueueConfig getQueueConfig(String name) {
name = PartitionKeyUtil.getBaseName(name);
QueueConfig config;
if ((config = lookupByPattern(queueConfigs, name)) != null) return config;
QueueConfig defConfig = queueConfigs.get("default");
if (defConfig == null) {
defConfig = new QueueConfig();
defConfig.setName("default");
addQueueConfig(defConfig);
}
config = new QueueConfig(defConfig);
config.setName(name);
addQueueConfig(config);
return config;
}
public Config addQueueConfig(QueueConfig queueConfig) {
queueConfigs.put(queueConfig.getName(), queueConfig);
return this;
}
/**
* @return the mapQConfigs
*/
public Map<String, QueueConfig> getQueueConfigs() {
return queueConfigs;
}
public Config setQueueConfigs(Map<String, QueueConfig> queueConfigs) {
this.queueConfigs.clear();
this.queueConfigs.putAll(queueConfigs);
for (Entry<String, QueueConfig> entry : queueConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
public MultiMapConfig getMultiMapConfig(String name) {
name = PartitionKeyUtil.getBaseName(name);
MultiMapConfig config;
if ((config = lookupByPattern(multiMapConfigs, name)) != null) return config;
MultiMapConfig defConfig = multiMapConfigs.get("default");
if (defConfig == null) {
defConfig = new MultiMapConfig();
defConfig.setName("default");
addMultiMapConfig(defConfig);
}
config = new MultiMapConfig(defConfig);
config.setName(name);
addMultiMapConfig(config);
return config;
}
public Config addMultiMapConfig(MultiMapConfig multiMapConfig) {
multiMapConfigs.put(multiMapConfig.getName(), multiMapConfig);
return this;
}
public Map<String, MultiMapConfig> getMultiMapConfigs() {
return multiMapConfigs;
}
public Config setMultiMapConfigs(Map<String, MultiMapConfig> multiMapConfigs) {
this.multiMapConfigs.clear();
this.multiMapConfigs.putAll(multiMapConfigs);
for (final Entry<String, MultiMapConfig> entry : this.multiMapConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
public TopicConfig getTopicConfig(String name) {
name = PartitionKeyUtil.getBaseName(name);
TopicConfig config;
if ((config = lookupByPattern(topicConfigs, name)) != null) {
return config;
}
TopicConfig defConfig = topicConfigs.get("default");
if (defConfig == null) {
defConfig = new TopicConfig();
defConfig.setName("default");
addTopicConfig(defConfig);
}
config = new TopicConfig(defConfig);
config.setName(name);
addTopicConfig(config);
return config;
}
public Config addTopicConfig(TopicConfig topicConfig) {
topicConfigs.put(topicConfig.getName(), topicConfig);
return this;
}
/**
* @return the topicConfigs
*/
public Map<String, TopicConfig> getTopicConfigs() {
return topicConfigs;
}
/**
* @param mapTopicConfigs the topicConfigs to set
*/
public Config setTopicConfigs(Map<String, TopicConfig> mapTopicConfigs) {
this.topicConfigs.clear();
this.topicConfigs.putAll(mapTopicConfigs);
for (final Entry<String, TopicConfig> entry : this.topicConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
/**
* Returns the ExecutorConfig for the given name
*
* @param name name of the executor config
* @return ExecutorConfig
*/
public ExecutorConfig getExecutorConfig(String name) {
name = PartitionKeyUtil.getBaseName(name);
ExecutorConfig ec = lookupByPattern(executorConfigs, name);
if (ec != null) {
return ec;
}
ExecutorConfig defaultConfig = executorConfigs.get("default");
if (defaultConfig != null) {
ec = new ExecutorConfig(name, defaultConfig.getPoolSize());
}
if (ec == null) {
ec = new ExecutorConfig(name);
executorConfigs.put(name, ec);
}
return ec;
}
/**
* Adds a new ExecutorConfig by name
*
* @param executorConfig executor config to add
* @return this config instance
*/
public Config addExecutorConfig(ExecutorConfig executorConfig) {
this.executorConfigs.put(executorConfig.getName(), executorConfig);
return this;
}
public Map<String, ExecutorConfig> getExecutorConfigs() {
return executorConfigs;
}
public Config setExecutorConfigs(Map<String, ExecutorConfig> executorConfigs) {
this.executorConfigs.clear();
this.executorConfigs.putAll(executorConfigs);
for (Entry<String, ExecutorConfig> entry : executorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
/**
* Returns the SemaphoreConfig for the given name
*
* @param name name of the semaphore config
* @return SemaphoreConfig
*/
public SemaphoreConfig getSemaphoreConfig(String name) {
name = PartitionKeyUtil.getBaseName(name);
SemaphoreConfig sc = lookupByPattern(semaphoreConfigs, name);
if (sc != null) {
return sc;
}
SemaphoreConfig defaultConfig = semaphoreConfigs.get("default");
if (defaultConfig == null) {
defaultConfig = new SemaphoreConfig();
defaultConfig.setName("default");
addSemaphoreConfig(defaultConfig);
}
sc = new SemaphoreConfig(defaultConfig);
addSemaphoreConfig(sc);
return sc;
}
/**
* Adds a new SemaphoreConfig by name
*
* @param semaphoreConfig semaphore config to add
* @return this config instance
*/
public Config addSemaphoreConfig(SemaphoreConfig semaphoreConfig) {
this.semaphoreConfigs.put(semaphoreConfig.getName(), semaphoreConfig);
return this;
}
/**
* Returns the collection of semaphore configs.
*
* @return collection of semaphore configs.
*/
public Collection<SemaphoreConfig> getSemaphoreConfigs() {
return semaphoreConfigs.values();
}
public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {
this.semaphoreConfigs.clear();
this.semaphoreConfigs.putAll(semaphoreConfigs);
for (final Entry<String, SemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
public WanReplicationConfig getWanReplicationConfig(String name) {
return wanReplicationConfigs.get(name);
}
public Config addWanReplicationConfig(WanReplicationConfig wanReplicationConfig) {
wanReplicationConfigs.put(wanReplicationConfig.getName(), wanReplicationConfig);
return this;
}
public Map<String, WanReplicationConfig> getWanReplicationConfigs() {
return wanReplicationConfigs;
}
public Config setWanReplicationConfigs(Map<String, WanReplicationConfig> wanReplicationConfigs) {
this.wanReplicationConfigs.clear();
this.wanReplicationConfigs.putAll(wanReplicationConfigs);
return this;
}
public ManagementCenterConfig getManagementCenterConfig() {
return managementCenterConfig;
}
public Config setManagementCenterConfig(ManagementCenterConfig managementCenterConfig) {
this.managementCenterConfig = managementCenterConfig;
return this;
}
public ServicesConfig getServicesConfig() {
return servicesConfig;
}
public Config setServicesConfig(ServicesConfig servicesConfig) {
this.servicesConfig = servicesConfig;
return this;
}
public SecurityConfig getSecurityConfig() {
return securityConfig;
}
public Config setSecurityConfig(SecurityConfig securityConfig) {
this.securityConfig = securityConfig;
return this;
}
public Config addListenerConfig(ListenerConfig listenerConfig) {
getListenerConfigs().add(listenerConfig);
return this;
}
public List<ListenerConfig> getListenerConfigs() {
return listenerConfigs;
}
public Config setListenerConfigs(List<ListenerConfig> listenerConfigs) {
this.listenerConfigs.clear();
this.listenerConfigs.addAll(listenerConfigs);
return this;
}
public SerializationConfig getSerializationConfig() {
return serializationConfig;
}
public Config setSerializationConfig(SerializationConfig serializationConfig) {
this.serializationConfig = serializationConfig;
return this;
}
public PartitionGroupConfig getPartitionGroupConfig() {
return partitionGroupConfig;
}
public Config setPartitionGroupConfig(PartitionGroupConfig partitionGroupConfig) {
this.partitionGroupConfig = partitionGroupConfig;
return this;
}
public ManagedContext getManagedContext() {
return managedContext;
}
public Config setManagedContext(final ManagedContext managedContext) {
this.managedContext = managedContext;
return this;
}
public ConcurrentMap<String, Object> getUserContext() {
return userContext;
}
public Config setUserContext(ConcurrentMap<String, Object> userContext) {
if(userContext == null){
throw new IllegalArgumentException("userContext can't be null");
}
this.userContext = userContext;
return this;
}
/**
* @return the configurationUrl
*/
public URL getConfigurationUrl() {
return configurationUrl;
}
/**
* @param configurationUrl the configurationUrl to set
*/
public Config setConfigurationUrl(URL configurationUrl) {
this.configurationUrl = configurationUrl;
return this;
}
/**
* @return the configurationFile
*/
public File getConfigurationFile() {
return configurationFile;
}
/**
* @param configurationFile the configurationFile to set
*/
public Config setConfigurationFile(File configurationFile) {
this.configurationFile = configurationFile;
return this;
}
public String getLicenseKey() {
return licenseKey;
}
public Config setLicenseKey(final String licenseKey) {
this.licenseKey = licenseKey;
return this;
}
private static <T> T lookupByPattern(Map<String, T> map, String name) {
name = PartitionKeyUtil.getBaseName(name);
T t = map.get(name);
if (t == null) {
final Set<String> tNames = map.keySet();
for (final String pattern : tNames) {
if (nameMatches(name, pattern)) {
return map.get(pattern);
}
}
}
return t;
}
private static boolean nameMatches(final String name, final String pattern) {
final int index = pattern.indexOf('*');
if (index == -1) {
return name.equals(pattern);
} else {
final String firstPart = pattern.substring(0, index);
final int indexFirstPart = name.indexOf(firstPart, 0);
if (indexFirstPart == -1) {
return false;
}
final String secondPart = pattern.substring(index + 1);
final int indexSecondPart = name.indexOf(secondPart, index + 1);
return indexSecondPart != -1;
}
}
/**
* @param config
* @return true if config is compatible with this one,
* false if config belongs to another group
* @throws RuntimeException if map, queue, topic configs are incompatible
*/
public boolean isCompatible(final Config config) {
if (config == null) {
throw new IllegalArgumentException("Expected not null config");
}
if (!this.groupConfig.getName().equals(config.getGroupConfig().getName())) {
return false;
}
if (!this.groupConfig.getPassword().equals(config.getGroupConfig().getPassword())) {
throw new HazelcastException("Incompatible group password");
}
checkMapConfigCompatible(config);
return true;
}
private void checkMapConfigCompatible(final Config config) {
Set<String> mapConfigNames = new HashSet<String>(mapConfigs.keySet());
mapConfigNames.addAll(config.mapConfigs.keySet());
for (final String name : mapConfigNames) {
final MapConfig thisMapConfig = lookupByPattern(mapConfigs, name);
final MapConfig thatMapConfig = lookupByPattern(config.mapConfigs, name);
if (thisMapConfig != null && thatMapConfig != null &&
!thisMapConfig.isCompatible(thatMapConfig)) {
throw new HazelcastException(format("Incompatible map config this:\n{0}\nanother:\n{1}",
thisMapConfig, thatMapConfig));
}
}
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Config");
sb.append("{groupConfig=").append(groupConfig);
sb.append(", properties=").append(properties);
sb.append(", networkConfig=").append(networkConfig);
sb.append(", mapConfigs=").append(mapConfigs);
sb.append(", topicConfigs=").append(topicConfigs);
sb.append(", queueConfigs=").append(queueConfigs);
sb.append(", multiMapConfigs=").append(multiMapConfigs);
sb.append(", executorConfigs=").append(executorConfigs);
sb.append(", semaphoreConfigs=").append(semaphoreConfigs);
sb.append(", wanReplicationConfigs=").append(wanReplicationConfigs);
sb.append(", listenerConfigs=").append(listenerConfigs);
sb.append(", partitionGroupConfig=").append(partitionGroupConfig);
sb.append(", managementCenterConfig=").append(managementCenterConfig);
sb.append(", securityConfig=").append(securityConfig);
sb.append('}');
return sb.toString();
}
}
| [
"[email protected]"
]
| |
450177d0325bb527803bbeb3410063ad792390ee | 34042bc54db1817cc616536c86e2d915210130b0 | /src/main/java/com/github/xjs/util/LogUtil.java | d0346d2f4ddd5218f37e1c2b3dd70ee322a39a75 | []
| no_license | kangaroo-lu/util | 682c12279f2640debc87fa2f76656873aab563c5 | 489c83a1416a7f295d59394d14e18cddf9c13d5f | refs/heads/master | 2021-01-13T05:55:41.973016 | 2017-06-16T00:52:48 | 2017-06-16T00:52:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,106 | java | package com.github.xjs.util;
import java.util.function.Supplier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author [email protected]
*
* 2017年6月5日 下午3:45:18
*/
public class LogUtil {
public static Logger log = LoggerFactory.getLogger(LogUtil.class);
public static void debug(Supplier<String> msgSupplier){
debug(msgSupplier, null);
}
public static void debug(Supplier<String> msgSupplier, Supplier<Exception> exceptionSupplier){
if(log.isDebugEnabled()){
if(exceptionSupplier == null){
log.debug(msgSupplier.get());
}else{
log.debug(msgSupplier.get(), exceptionSupplier.get());
}
}
}
public static void error(Supplier<String> msgSupplier){
error(msgSupplier, null);
}
public static void error(Supplier<String> msgSupplier, Supplier<Exception> exceptionSupplier){
if(log.isErrorEnabled()){
if(exceptionSupplier == null){
log.error(msgSupplier.get());
}else{
log.error(msgSupplier.get(), exceptionSupplier.get());
}
}
}
public static void info(Supplier<String> msgSupplier){
info(msgSupplier, null);
}
public static void info(Supplier<String> msgSupplier, Supplier<Exception> exceptionSupplier){
if(log.isInfoEnabled()){
if(exceptionSupplier == null){
log.info(msgSupplier.get());
}else{
log.info(msgSupplier.get(), exceptionSupplier.get());
}
}
}
public static void trace(Supplier<String> msgSupplier){
trace(msgSupplier, null);
}
public static void trace(Supplier<String> msgSupplier, Supplier<Exception> exceptionSupplier){
if(log.isTraceEnabled()){
if(exceptionSupplier == null){
log.trace(msgSupplier.get());
}else{
log.trace(msgSupplier.get(), exceptionSupplier.get());
}
}
}
public static void warn(Supplier<String> msgSupplier){
warn(msgSupplier, null);
}
public static void warn(Supplier<String> msgSupplier, Supplier<Exception> exceptionSupplier){
if(log.isWarnEnabled()){
if(exceptionSupplier == null){
log.warn(msgSupplier.get());
}else{
log.warn(msgSupplier.get(), exceptionSupplier.get());
}
}
}
}
| [
"[email protected]"
]
| |
982f0f30afa85dfecbbc37f67fe8ce41844a5000 | 400a3ffbc259861b41314b5fb486b21ba7acd675 | /app/src/androidTest/java/com/codelab/bottomnavigation/ExampleInstrumentedTest.java | cd18a760d210941b78cca40df51cd406ec6687e9 | []
| no_license | ahmfarisi/BottomNavigationDanFragment | c0f8aa586d14ce6a7e57e59fd32d8a5defb6bb8f | 04543b28e25b0b8d4920ecf05055e34bb8088c65 | refs/heads/main | 2023-03-17T14:19:22.269192 | 2021-02-28T14:03:27 | 2021-02-28T14:03:27 | 343,110,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package com.codelab.bottomnavigation;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.codelab.bottomnavigation", appContext.getPackageName());
}
} | [
"[email protected]"
]
| |
fd610ed4dc0bfe9f9b1120e3cd296f55dbd75002 | 96736f3d40d517b98472283c1b4f70f6bbd646cd | /Davinci/src/Prolog.java | 9bbae05eb550ff4e8e12e715fcd39b99ce9c7707 | []
| no_license | caskercasker/javaStudy | d77064e38372b1f405e45d6dde9fc5570ddea4ad | 3e153d227e043fa8cd2d5bc9c2dceb517e8162f1 | refs/heads/master | 2020-09-29T14:05:37.848322 | 2020-01-22T02:05:03 | 2020-01-22T02:05:03 | 227,052,024 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,800 | java | import java.util.Map;
import java.util.Vector;
import org.jpl7.Atom;
import org.jpl7.Compound;
import org.jpl7.JPL;
import org.jpl7.Query;
import org.jpl7.Term;
import org.jpl7.Variable;
public class Prolog
{
public static void init()
{
String[] args = {
"pl",
"-g", "true",
"-nosignals",
"-q"
};
JPL.init(args);
consult("game.pl");
}
public static boolean consult(String filename)
{
Atom file = new Atom("../prolog/" + filename);
Query q = new Query(new Compound("consult", new Term[] {file}));
return q.hasSolution();
}
public static boolean makePlayers(int numPlayers)
{
org.jpl7.Integer num = new org.jpl7.Integer(numPlayers);
Compound set_agents = new Compound("set_agents", new Term[] {num});
Query q = new Query(set_agents);
return q.hasSolution();
}
private static Compound createStone(int number, boolean open, boolean black)
{
Atom state;
Atom colour;
if (open)
state = new Atom("open");
else
state = new Atom("closed");
if (black)
colour = new Atom("black");
else
colour = new Atom("white");
org.jpl7.Integer num = new org.jpl7.Integer(number);
return new Compound("stone", new Term[] {colour, num, state});
}
public static boolean addTile(int playerIndex, int number, boolean open, boolean black)
{
org.jpl7.Integer idx = new org.jpl7.Integer(playerIndex);
Compound add_stone = new Compound("add_stone", new Term[]{idx, createStone(number, open, black)});
Query q = new Query(add_stone);
return q.hasSolution();
}
public static boolean addTile(int playerIndex, Tile tile)
{
//System.out.println("Adding tile: " + playerIndex + ", " + tile);
return addTile(playerIndex, tile.getValue(), tile.getOpen(), tile.getBlack());
}
public static boolean guessed(int playerIndex, int number, boolean black)
{
// playerIndex guessed something, so he/she can't have the tile
// him/her self
Variable Agent = new Variable("_");
Variable Position = new Variable("_");
org.jpl7.Integer Target = new org.jpl7.Integer(playerIndex);
org.jpl7.Integer Number = new org.jpl7.Integer(number);
Atom Colour;
if (black)
Colour = new Atom("black");
else
Colour = new Atom("white");
Compound is_stone = new Compound("is_stone", new Term[] {Target, Position, Colour, Number});
Compound not = new Compound("not", new Term[] {is_stone});
Compound knows = new Compound("knows", new Term[] {Agent, not});
Compound as = new Compound("assert", new Term[] {knows});
Query q = new Query(as);
return q.hasSolution();
}
public static Vector<Vector<java.lang.Integer>> sequences(int requestIndex, int targetIndex)
{
//System.out.println("Sequencing: " + requestIndex + ", " + targetIndex);
Variable Sequence = new Variable("Sequence");
org.jpl7.Integer req = new org.jpl7.Integer(requestIndex);
org.jpl7.Integer tar = new org.jpl7.Integer(targetIndex);
Compound sequence = new Compound("sequence", new Term[] {req, tar, Sequence});
Query q = new Query(sequence);
Vector<Vector<java.lang.Integer>> result = new Vector<Vector<java.lang.Integer>>();
//q.allSolutions()
for (Map<String, Term> binding : q.allSolutions() )
{
Term t = binding.get("Sequence");
Term[] terms = t.toTermArray();
Vector<java.lang.Integer> items = new Vector<java.lang.Integer>();
for (Term term : terms)
items.add(term.arg(2).intValue());
result.add(items);
}
return result;
}
private static Compound createIsStone(int targetIndex, int tileIndex, int number, boolean black)
{
Atom colour;
if (black)
colour = new Atom("black");
else
colour = new Atom("white");
return new Compound("is_stone", new Term[] {new org.jpl7.Integer(targetIndex), new org.jpl7.Integer(tileIndex), colour, new org.jpl7.Integer(number)});
}
public static boolean failedGuess(int targetIndex, int tileIndex, int number, boolean black)
{
//System.out.println("Guess failed: target: " + targetIndex + ", tile: " + tileIndex + ", number: " + number + ", black: " + black);
Variable Agent = new Variable("_");
Compound not = new Compound("not", new Term[] {createIsStone(targetIndex, tileIndex, number, black)});
Compound knows = new Compound("knows", new Term[] {Agent, not});
Compound as = new Compound("assert", new Term[] {knows});
Query q = new Query(as);
return q.hasSolution();
}
public static boolean setTileOpen(int targetIndex, int tileIndex)
{
//System.out.println("Setting tile open. target: " + targetIndex + ", tile: " + tileIndex);
org.jpl7.Integer Agent = new org.jpl7.Integer(targetIndex);
org.jpl7.Integer Position = new org.jpl7.Integer(tileIndex);
Compound set_stone_open = new Compound("set_stone_open", new Term[] {Agent, Position});
Query q = new Query(set_stone_open);
return q.hasSolution();
}
}
| [
"sist@DESKTOP-SM05CIM"
]
| sist@DESKTOP-SM05CIM |
0ddfa26c88797613c383d0471b7819a426920731 | 56b38fde5f18a14987c890827a0324c99b7cf223 | /lc-micro-service/lc-services/lc-service-xx-admin/src/main/java/com/lc/admin/domain/request/cms/DictRequest.java | 4d1daec85b6d2f1b1593cfdb45976ca35f508ebf | []
| no_license | lcliucheng/springboot-micro-service-temp | ee2b6cb97ad9044c417df11c2acdd5a7ebc9dd1f | ea9118595d7a3ba03d181dae3cf1ab80abf9e591 | refs/heads/master | 2022-10-02T14:37:50.162375 | 2019-12-29T06:35:19 | 2019-12-29T06:35:19 | 215,517,038 | 0 | 0 | null | 2022-06-21T04:10:06 | 2019-10-16T10:07:14 | Java | UTF-8 | Java | false | false | 1,279 | java | package com.lc.admin.domain.request.cms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Map;
/**
* 问题反馈
*
* @author yanghy
* @date 2019/05/13
*/
@ApiModel(value = "QuestionRequest", description = "传输对象")
@Data
@Accessors(chain = true)
public class DictRequest implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "代码")
private String code;
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String desc;
@ApiModelProperty(value = "排序号")
private Integer sortNo;
@ApiModelProperty(value = "是否禁用 0:否 1:是")
private Integer disabled;
@ApiModelProperty(value = "是否删除 0:否 1:是")
private Integer deleted;
@ApiModelProperty(value = "扩展字段", hidden = true)
private Map<String, Object> ext;
@ApiModelProperty(value = "是否设置值为ID")
private boolean generateId;
}
| [
"admin"
]
| admin |
f652c5d0b9d81c2e4f52a243d4a39e3b38793cdd | 7078d1a288ca49e83f6695a26e116264385754e6 | /Grading.java | 1559aa7611d33d26df3fdfcb4fbc229b38777f13 | []
| no_license | Unnatipate/Homeworkjava | 06fb99dcd34ab52542c88eb8f48a3fc690f7eb3e | e3f07279b67eaf37c3c6cb1749a8d3f346dba786 | refs/heads/main | 2023-08-25T18:18:44.489420 | 2021-10-27T17:21:24 | 2021-10-27T17:21:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,701 | java | import java.util.Scanner;
public class Grading {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int marks[] = new int[6];
int i;
float total = 0, avg;
System.out.print("Enter name of student: ");
String n = in.nextLine();
System.out.print("Enter roll no of student: ");
int r = in.nextInt();
System.out.print("Enter marks in 1st subject: ");
int m1 = in.nextInt();
System.out.print("Enter marks in 2nd subject: ");
int m2 = in.nextInt();
System.out.print("Enter marks in 3rd subject: ");
int m3 = in.nextInt();
int t = m1 + m2 + m3;
double p = t / 500.0 * 100.0;
String g = "";
avg=total/3;
System.out.print("The student Grade is: ");
if (p >= 80)
g = "A+";
else if (p >= 60)
g = "A";
else if (p >= 50)
g = "B";
else if (p >= 35)
g = "C";
System.out.println("Total Marks = " + t);
System.out.println("Percentage = " + p);
System.out.println("Grade = " + g);
}
//pass or fails on the basis of...student needs to pass all the subjects
int num;
Scanner reader = new Scanner(System.in);
{
System.out.println("Enter score: ");
num = reader.nextInt();
if (num >= 50) {
System.out.println("Pass!");
} else
System.out.println("Fail!");
}
}
| [
"[email protected]"
]
| |
71fea0d60442504c74eb586c5900c206d9f16429 | 606f6edd804ba920ff460d1ce1dfc2cdf7640957 | /ch.acanda.eclipse.pmd.core.swtbot/src/ch/acanda/eclipse/pmd/swtbot/bot/AddRuleSetConfigurationWizardBot.java | 63536b12e738fe19ad26c8987aca7be587a78189 | []
| no_license | cybernetics/eclipse-pmd | 690c0debf40c323c708f3589ee4e6401c539d001 | 431ca7e05bab53bf07499507c9f50bef6e078112 | refs/heads/master | 2021-01-12T22:14:37.431912 | 2014-03-01T12:26:21 | 2014-03-01T12:26:21 | 17,356,903 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,461 | java | // =====================================================================
//
// Copyright (C) 2012 - 2014, Philip Graf
//
// 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
//
// =====================================================================
package ch.acanda.eclipse.pmd.swtbot.bot;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withId;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.hamcrest.Matcher;
import ch.acanda.eclipse.pmd.swtbot.SWTBotID;
/**
* @author Philip Graf
*/
public final class AddRuleSetConfigurationWizardBot extends SWTBotShell {
public AddRuleSetConfigurationWizardBot(final Shell shell) throws WidgetNotFoundException {
super(shell);
}
public static AddRuleSetConfigurationWizardBot getActive() {
final SWTBotShell wizard = new SWTWorkbenchBot().shell("Add Rule Set Configuration");
return new AddRuleSetConfigurationWizardBot(wizard.widget);
}
public SWTBotText name() {
return bot().textWithId(SWTBotID.NAME.name());
}
public SWTBotText location() {
return bot().textWithId(SWTBotID.LOCATION.name());
}
public boolean isBrowseButtonVisible() {
@SuppressWarnings("unchecked")
final Matcher<Widget> matcher = allOf(widgetOfType(Button.class), withId(SWTBotID.BROWSE.name()));
return bot().getFinder().findControls(widget, matcher, true).size() == 1;
}
public SWTBotTable rules() {
return bot().tableWithId(SWTBotID.RULES.name());
}
public String[] ruleNames() {
final SWTBotTable table = rules();
final String[] names = new String[table.rowCount()];
for (int i = 0; i < table.rowCount(); i++) {
names[i] = table.cell(i, 0);
}
return names;
}
public SWTBotButton next() {
return bot().button("Next >");
}
public SWTBotButton finish() {
return bot().button("Finish");
}
public SWTBotRadio filesystem() {
return bot().radioWithId(SWTBotID.FILE_SYSTEM.name());
}
public SWTBotRadio workspace() {
return bot().radioWithId(SWTBotID.WORKSPACE.name());
}
public SWTBotRadio project() {
return bot().radioWithId(SWTBotID.PROJECT.name());
}
public SWTBotRadio remote() {
return bot().radioWithId(SWTBotID.REMOTE.name());
}
public SWTBotButton browse() {
return bot().buttonWithId(SWTBotID.BROWSE.name());
}
}
| [
"[email protected]"
]
| |
2e0d5938afaadfde33e3071d2ddf5e3d463a1651 | a074624e71667f40a445e98bf83776965875f308 | /MidiSong/src/de/free_creations/midisong/MidiTrack.java | 5027721f6220e4afd78b55abcc14266ba072b1d6 | [
"Apache-2.0"
]
| permissive | free-creations/Repetitor | 1d7ff96e21d235c989c54ccb67685fce6cb571dc | 0f9cb29f95f71236252cfc48e5bfe13574ebddb3 | refs/heads/master | 2021-06-02T00:06:45.412139 | 2019-06-10T16:23:55 | 2019-06-10T16:23:55 | 7,716,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,565 | java | /*
* Copyright 2011 Harald Postner <Harald at H-Postner.de>.
*
* 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.
* under the License.
*/
package de.free_creations.midisong;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Sequence;
import javax.sound.midi.Track;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.openide.filesystems.FileObject;
/**
* This class represents one single Track in a
* {@link Song song}.
* @author Harald Postner <Harald at H-Postner.de>
*/
@XmlRootElement
@XmlType
@XmlAccessorType(value = XmlAccessType.NONE)
public class MidiTrack extends GenericTrack implements Cloneable {
/**
* The path to a MIDI file. The Path must be expressed relatively to
* the path of the song file. For the master-track this
* parameter is mandatory, for all other tracks this parameter
* is optional. If this file is given, the track-data
* referenced by {@link #midiTrackIndex } is fetched from the given file.
* If no file is given, a midi-file is searched in the parent track.
* The given file must be compatible in timing with the midi-file
* in the master-track.
*/
@XmlElement(name = "sequencefile", required = false)
private String sequencefile = null;
public String getSequencefile() {
return sequencefile;
}
public void setSequencefile(String sequencefile) {
if (isImmutable()) {
throw new EIllegalUpdate("Internal Error: object is immutable.");
}
this.sequencefile = sequencefile;
}
@XmlTransient
private Sequence sequence = null;
/**
* Set the sequence from which this track fetches its Midi data.
* The concrete data is determined by {@link #midiTrackIndex}.
* Not every track needs its own sequence, if this parameter is
* null, the track data is fetched from a parent track.
* @param sequence
*/
public void setSequence(Sequence sequence) {
this.sequence = sequence;
}
/**
* This value links the track-data to a track in the sequence-file.
* Negative values indicate that there is no link to a track.
*/
@XmlElement(name = "midiTrackIndex", required = true)
private int midiTrackIndex = -1;
/**
* Determine the Midi sequence from which the Midi Tracks should
* be extracted.
* @return the Midi sequence to be used for this track.
* @throws EInvalidSongFile
*/
@Override
public Sequence getSequence() throws EInvalidSongFile {
if (sequence != null) {
// A midi-sequence has already been identified for this track.
return sequence;
}
if (sequencefile != null) {
// A midi-sequence is identified for this track.
// But it has not been loaded so far. Now it is time to load it.
loadSequenceFromFile();
return sequence;
}
if (getParentTrack() != null) {
// No midi-sequence is identified for this track, so try with the parent track.
return getParentTrack().getSequence();
}
// This must be the mastertrack because parentTrack == null.
// For the mastertrack there must be a sequence, so we have a problem.
throw new RuntimeException("Internal Error: No sequence for master-track.");
}
/**
* Defines which midi channel will be used by the events
* on this track. Although the MIDI specification allows
* to mix several channels on the same track, we'll use
* only one channel per track.
* Usable values range from 0 to 15.
*
* If no channel is defined this value is -1.
*/
@XmlElement(name = "midiChannel", required = false)
private int midiChannel = -1;
/**
* This variable can be used to indicate the patches that
* are used to render the track.
*/
@XmlElement(name = "instrumentDescription", required = false)
private String instrumentDescription = null;
/**
* This variable can be used to indicate the patches that
* are used to render the track.
* @param description a string indicating which patches are used
* to render the track.
*/
public void setInstrumentDescription(String description) {
if (isImmutable()) {
throw new EIllegalUpdate("Internal Error: object is immutable.");
}
this.instrumentDescription = StringUtil.cleanXmlString(description);
}
public MidiTrack() {
}
public int getMidiTrackIndex() {
return midiTrackIndex;
}
public void setMidiTrackIndex(int midiTrackIndex) {
if (isImmutable()) {
throw new EIllegalUpdate("Internal Error: object is immutable.");
}
this.midiTrackIndex = midiTrackIndex;
}
public Track getMidiTrack() throws EInvalidSongFile {
int index = getMidiTrackIndex();
if (index < 0) {
return null;
}
Sequence seq = getSequence();
if (seq == null) {
return null;
}
Track[] tracks = seq.getTracks();
if (index >= tracks.length) {
throw new RuntimeException("Wrong MidiTrackIndex " + index + " in \"" + getName() + "\".");
}
return tracks[index];
}
/**
* Set the midi channel used for this track.
* @param channel the midi channel used in this track
*/
public void setMidiChannel(int channel) {
if (isImmutable()) {
throw new EIllegalUpdate("Internal Error: object is immutable.");
}
this.midiChannel = channel;
}
/**
* Get the midi channel used for this track. Usually the whole track
* should use one and the same channel. Negative values indicate that
* the track has no channel-events (i.e. -2 for a master track)
* @return the midi channel used in this track
*/
public int getMidiChannel() {
return this.midiChannel;
}
/**
* This routine is called by MidiSythesizerTrack-objects which have
* an attached sequence and which are
* attempting to access the sequence but the sequence has
* not yet been loaded from file.
* sets the member {@link #sequence } by creating a
* {@link Sequence } object from the {@link #sequencefile }
* parameter.
*/
private void loadSequenceFromFile() throws EInvalidSongFile {
// as precondition we assume that this track has an attached sequence-file
if (sequencefile == null) {
throw new RuntimeException("Internal Error: member sequencefile is null.");
}
FileObject baseDir = getBaseDirectory();
//open an input stream for the midi file.
FileObject midiFile = baseDir.getFileObject(sequencefile);
if (midiFile == null) {
throw new EInvalidSongFile("Could not load file " + sequencefile);
}
InputStream stream;
try {
stream = midiFile.getInputStream();
} catch (FileNotFoundException ex) {
throw new EInvalidSongFile(ex);
}
// extract the midi sequence
try {
sequence = MidiSystem.getSequence(stream);
} catch (InvalidMidiDataException ex) {
throw new EInvalidSongFile(ex);
} catch (IOException ex) {
throw new EInvalidSongFile(ex);
}
}
@Override
public MidiTrack clone() {
MidiTrack clonedTrack = null;
try {
clonedTrack = (MidiTrack) super.clone();
// clonedTrack.sequence = this.sequence.???; shall we deep copy ?
} catch (CloneNotSupportedException ex) {
throw new RuntimeException(ex);
}
return clonedTrack;
}
@Override
public void detachAudio() {
super.detachAudio();
}
private GenericTrack.EventHandler requiemHandler=null;
/**
* @deprecated
* @param handler
*/
@Deprecated
public void addRequiemEventHandler(GenericTrack.EventHandler handler) {
requiemHandler = handler;
}
@Override
public void setMute(boolean value) {
super.setMute(value);
if(requiemHandler != null){
requiemHandler.onMuteChange(value);
}
}
}
| [
"[email protected]"
]
| |
e239f880c11a4c2387c138905b397ad78c4aff2c | 4cc67c134a3747b848a63d6c7b29659ffd5f3e04 | /src/api/src/netcraft/NetcraftPlugin.java | 9690ad0d1b64c3b87a44c2e05c3cb5fcd9538ae6 | []
| no_license | animaltier/Netcraft | cfdc7d9b596036832a8f8b5d74342707c75703a3 | b3b6b41da8a9eb501094f71e9e5b1bb2e61bb2d6 | refs/heads/master | 2021-03-22T03:15:18.514695 | 2018-06-30T12:41:39 | 2018-06-30T12:41:39 | 106,299,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package netcraft;
public class NetcraftPlugin {
private String id, version;
public NetcraftPlugin(String pluginID, String pluginVersion) {
this.id = pluginID;
this.version = pluginVersion;
}
public String getNetcraftVersion() {
return NetcraftCore.getNetcraftVersion();
}
}
| [
"[email protected]"
]
| |
6fb6ac23a71f20a39ddb13ec0f829eae522de2f5 | 2c93c69d484567480302e33f8564f63a04a6b967 | /src/main/java/node/MultNode.java | f1e5a8a4fff9d07a461669c6b139c31b6b3e2096 | []
| no_license | dmitrykolesnikovich/compiler | 80ee775c51ec7bd019e413a50ff6e46f2da9b2bd | 9143bd45ab95af83d742f8502b85de36efd26c61 | refs/heads/master | 2021-09-07T10:52:37.782814 | 2018-02-21T21:37:24 | 2018-02-21T21:37:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,581 | java | package node;
import javafx.util.Pair;
import java.util.ArrayList;
import java.util.List;
/**
* @author Rabo
*/
public class MultNode extends OperationNode {
public MultNode(Node left, Node right) {
super(left, right);
}
@Override
public Node simplify() {
left = left.simplify();
right = right.simplify();
if (left instanceof IntNode && right instanceof IntNode) {
Integer a = ((IntNode) left).getValue();
Integer b = ((IntNode) right).getValue();
return new IntNode(a * b);
}
if (left instanceof IntNode && ((IntNode) left).getValue().equals(0)) {
return new IntNode(0);
}
if (right instanceof IntNode && ((IntNode) right).getValue().equals(0)) {
return new IntNode(0);
}
return this;
}
@Override
public Pair<int[], Pair<Type, List<String>>> generateCode(int varCounter, int helpCounter, int constCounter, List<String> constants) {
List<String> code = new ArrayList<>();
Pair<int[], Pair<Type, List<String>>> leftGenerate = left.generateCode(varCounter, helpCounter, constCounter, constants);
varCounter = leftGenerate.getKey()[0];
helpCounter = leftGenerate.getKey()[1];
constCounter = leftGenerate.getKey()[2];
int leftCounter = varCounter - 1;
code.addAll(leftGenerate.getValue().getValue());
Pair<int[], Pair<Type, List<String>>> rightGenerate = right.generateCode(varCounter, helpCounter, constCounter, constants);
varCounter = rightGenerate.getKey()[0];
helpCounter = rightGenerate.getKey()[1];
constCounter = rightGenerate.getKey()[2];
int rightCounter = varCounter - 1;
code.addAll(rightGenerate.getValue().getValue());
code.add("\t%tmp" + varCounter++ + " = mul i32 %tmp" + leftCounter + ", %tmp" + rightCounter);
return new Pair<>(new int[]{varCounter, helpCounter, constCounter}, new Pair<>(Type.INT, code));
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof MultNode)) return false;
MultNode multNode = (MultNode) o;
return left.equals(multNode.left) && right.equals(multNode.right)
|| left.equals(multNode.right) && right.equals(multNode.left);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + left.hashCode();
result = 31 * result + right.hashCode();
return result;
}
}
| [
"[email protected]"
]
| |
95b21d2532af64400a9a7cdaeb711410be19c8b3 | 51837ac601a5b125e2788aca73859a25fadcec8d | /Java/danger_zone/DangerControl.java | 7542f76d4c5d346c62e843eb91379a1b4a96b5e0 | []
| no_license | EdgeCaseBerg/API-Page | e402a695df6140d07b9324b5dbf7b5751b175c6a | 49a8760c7f218bbfdf1d0d157b576cfbb62f3792 | refs/heads/master | 2020-06-03T14:03:04.777164 | 2012-12-06T02:05:51 | 2012-12-06T02:05:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,026 | java | package danger_zone;
import java.io.*;
import java.net.*;
import java.util.Timer;
import java.util.Stack;
import java.util.Map;
import java.util.ArrayList;
//http://code.google.com/p/json-simple/
import org.json.simple.JSONObject;
/**
*@author Ethan Eldridge <ejayeldridge @ gmail.com>
*@version 0.1
*@since 2012-10-5
*
* KD Tree / Listening Object Interface for the danger zone application.
* Interface providing functionality to DangerControl UDP and TCP
*/
public abstract class DangerControl{
/**
*Debug variable, if specified as true, output messages will be displayed.
*/
static boolean debugOn = true;
/**
*Socket to accept incoming queries to the Danger Control interface, listens on port 5480
*/
ServerSocket clientListener = null;
/**
*Timeout for the DangerControl program's clientListener, this must be set in integer form (Seconds)
*/
static int int_timeout = 5;
/**
*Timeout for the DangerControl program itself, this is used during debugging and will probably be removed in release implementations
*/
long long_timeout = System.currentTimeMillis() + 1000*int_timeout;
/**
*Socket that will hold the incoming traffic coming from the clientListener
*/
Socket incoming = null;
/**
*Data Structure to hold the dangerZones from the database.
*/
public DangerNode dangerZones = null;
/**
*Port number to communicate to the client with
*/
static int port_number = 5480;
/**
*Classifer interface to allow for feed back to the classifier from incoming command messages.
*/
BayesTrainer classifier = new BayesTrainer();
/**
*Variable to control continous listening by the server instead of a time out.
*/
static boolean continous = false;
public abstract void trainBayes(String password,boolean debugOn);
public abstract void run() throws Exception;
public abstract void run(boolean continous) throws Exception;
public abstract ArrayList<DangerNode> handleGeoCommand(String geoCommand);
public abstract DangerNode setRootNode(DangerNode dn);
/**
*Creates a small testing tree
*/
public void createTestTree(){
dangerZones = new DangerNode(9,9,1);
dangerZones.addNode(new DangerNode(7,2,4));
dangerZones.addNode(new DangerNode(12,12,5));
dangerZones.addNode(new DangerNode(15,13,6));
this.dangerZones = DangerNode.reBalanceTree(dangerZones);
}
/**
*Classifies the tweet from the passed in line using the classifier.
*@param line The line to be classified
*@result Returns a D or S depending on the category the line is classified into, or an empty string if the category is not recognized.
*/
public String handleClassify(int cat){
switch(cat){
case NaiveBayes.CAT_DANGER:
return "D";
case NaiveBayes.CAT_SAFE:
return "S";
case SubCategories.UNCLASSIFIED:
return "UNCLASSIFIED DANGER";
case SubCategories.WEATHER:
return "WEATHER DANGER";
case SubCategories.VIOLENCE:
return "VIOLENCE DANGER";
case SubCategories.ACCIDENT:
return "ACCIDENT DANGER";
default:
return "Ill Formed Request";
}
}
} | [
"[email protected]"
]
| |
364352a1214b56626cdabd873b51b7f703ca45aa | 161b6536ddcb9091a0a373dc5a607722aa703999 | /app/src/androidTest/java/ca/caffee/eventsearch/ExampleInstrumentedTest.java | 5ee5ca86a65226b5086a059952d0472bd8f7d0e7 | [
"MIT"
]
| permissive | hackaAICaffeeBabesTeam/EventSearch_Android | 74e90aa9025ad5e3b237f1015f76e3d0b2fa1aba | 3ae5131c81954e190c5a6e3b433cc31f99903010 | refs/heads/master | 2021-01-21T14:38:51.131951 | 2017-06-25T18:25:54 | 2017-06-25T18:25:54 | 95,313,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package ca.caffee.eventsearch;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest {
@Test public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ca.caffee.eventsearch", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
39cf265798ec42cf2294e00a514b9bac9574db57 | e5574b45d60fa932dcf9fc36e4d9c6922163765e | /joyo-monitor-mq/src/main/java/com/joyotime/net/monitor/exchange/mq/config/ActivemqConfig.java | c1b16d697619283122aadbc2c160a8a5817b2360 | []
| no_license | niubin0919/joyo-monitor-support | 2d876f5fbcf9999efaab28fd51383901d2139774 | 23e0eccfb121526b327492cde80bd821d1f8fd50 | refs/heads/master | 2020-04-19T09:08:00.582441 | 2019-01-29T08:24:48 | 2019-01-29T08:24:48 | 168,100,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,670 | java | /**
* com.joyotime.net Inc.
* Copyright (c) 2019-2019 All Rights Reserved.
*/
package com.joyotime.net.monitor.exchange.mq.config;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author nbin
* @version $Id: ActiveConfig.java, v 0.1 2019年1月23日 下午7:08:06 nbin Exp $
*/
@Slf4j
public class ActivemqConfig extends BaseConfig {
protected static Properties pro;
static {
try {
pro = new Properties();
InputStream fs = ActivemqConfig.class.getClassLoader().getResourceAsStream("mq-config.properties");
pro.load(fs);
} catch (IOException e) {
log.info("loading....mq-config.properties error...!", e);
}
}
/**
* 获取客户端ID
*
* @return
*/
public static String getClientID() {
return pro.getProperty("activemq.ClientID");
}
/**
* 获取MQ连接地址
*
* @return
*/
public static String getMqURI() {
return pro.getProperty("activemq.URI");
}
/**
* 获取本地错误数据缓存大小
*
* @return
*/
public static int getLocalBuffSize() {
int size = getSetInt(pro, "activemq.LocalBuffSize");
return size == -1 ? 5000 : size;
}
/**
* 获取MQ队列用户名
*
* @return
*/
public static String getUid() {
return pro.getProperty("activemq.Uid");
}
/**
* 获取MQ队列密码
*
* @return
*/
public static String getPwd() {
return pro.getProperty("activemq.Pwd");
}
}
| [
"[email protected]"
]
| |
54d3862d94d162441282008fa80e16f5a5cd9752 | 6888a877b5e49791af7046fd295b9e597d22492a | /subprojects/gradle-core/src/test/groovy/org/gradle/messaging/remote/internal/ChannelMessageMarshallingDispatchTest.java | f98d4925daed0fab9e8a085211b7729f3b663339 | []
| no_license | peas/gradle | c98d655efbb86c636c0a31bf09047325f39bba63 | 42c18c115912d891da9843ee9a785dfdd2e363f6 | refs/heads/master | 2021-01-17T23:02:04.476863 | 2010-08-04T08:40:09 | 2010-08-04T08:40:09 | 825,368 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,778 | java | /*
* Copyright 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.messaging.remote.internal;
import org.gradle.messaging.dispatch.Dispatch;
import org.jmock.Expectations;
import org.jmock.integration.junit4.JMock;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(JMock.class)
public class ChannelMessageMarshallingDispatchTest {
private final JUnit4Mockery context = new JUnit4Mockery();
private final Dispatch<Message> delegate = context.mock(Dispatch.class);
private final ChannelMessageMarshallingDispatch dispatch = new ChannelMessageMarshallingDispatch(delegate);
@Test
public void mapsChannelKeyToIntegerChannelId() {
final Message message1 = new TestMessage();
final Message message2 = new TestMessage();
context.checking(new Expectations() {{
one(delegate).dispatch(new ChannelMetaInfo("channel", 0));
one(delegate).dispatch(new ChannelMessage(0, message1));
one(delegate).dispatch(new ChannelMessage(0, message2));
}});
dispatch.dispatch(new ChannelMessage("channel", message1));
dispatch.dispatch(new ChannelMessage("channel", message2));
}
@Test
public void mapsMultipleChannelsToDifferentIds() {
final Message message1 = new TestMessage();
final Message message2 = new TestMessage();
context.checking(new Expectations() {{
one(delegate).dispatch(new ChannelMetaInfo("channel1", 0));
one(delegate).dispatch(new ChannelMessage(0, message1));
one(delegate).dispatch(new ChannelMetaInfo("channel2", 1));
one(delegate).dispatch(new ChannelMessage(1, message2));
}});
dispatch.dispatch(new ChannelMessage("channel1", message1));
dispatch.dispatch(new ChannelMessage("channel2", message2));
}
@Test
public void forwardsUnknownMessages() {
final Message message = new TestMessage();
context.checking(new Expectations() {{
one(delegate).dispatch(message);
}});
dispatch.dispatch(message);
}
private static class TestMessage extends Message {
}
}
| [
"[email protected]"
]
| |
9841a3cfde718034d7295f3faa33b5d08bbf1833 | 18e7aa27dd52a667f667ca88adc21b8d0a0892a3 | /src/main/java/edu/uab/registry/domain/RetrievedPatient.java | 20bf11d86728bd14bcf0a423253299e305788fa1 | []
| no_license | heenachitkara/PHEDRS | 4d4204977f77fb3d209f48ef83052624c9fc3cdc | 0c59f0d541f76278f719a072cfcba397b18a51fa | refs/heads/master | 2020-04-10T22:13:54.498135 | 2018-03-30T19:42:13 | 2018-03-30T19:42:13 | 124,298,911 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,796 | java | package edu.uab.registry.domain;
import java.util.List;
public class RetrievedPatient
{
public List<CrecPatient> getUnder_review() {
return under_review;
}
public void setUnder_review(List<CrecPatient> under_review) {
this.under_review = under_review;
}
public List<CrecPatient> getValidated() {
return validated;
}
public void setValidated(List<CrecPatient> validated) {
this.validated = validated;
}
public List<CrecPatient> getNew_patient() {
return new_patient;
}
public void setNew_patient(List<CrecPatient> new_patient) {
this.new_patient = new_patient;
}
public List<CrecPatient> getAccepated() {
return accepted;
}
public void setAccepated(List<CrecPatient> accepted) {
this.accepted = accepted;
}
public List<CrecPatient> getEnrolled() {
return enrolled;
}
public void setEnrolled(List<CrecPatient> enrolled) {
this.enrolled = enrolled;
}
public List<CrecPatient> getQuit() {
return quit;
}
public void setQuit(List<CrecPatient> quit) {
this.quit = quit;
}
public List<CrecPatient> getRejected() {
return rejected;
}
public void setRejected(List<CrecPatient> rejected) {
this.rejected = rejected;
}
public List<CrecPatient> getExpired() {
return expired;
}
public void setExpired(List<CrecPatient> expired) {
this.expired = expired;
}
public List<CrecPatient> getExited() {
return exited;
}
public void setExited(List<CrecPatient> exited) {
this.exited = exited;
}
private List<CrecPatient> under_review;
private List<CrecPatient> validated;
private List<CrecPatient> new_patient;
private List<CrecPatient> accepted;
private List<CrecPatient> enrolled;
private List<CrecPatient> quit;
private List<CrecPatient> rejected;
private List<CrecPatient> expired;
private List<CrecPatient> exited;
}
| [
"[email protected]"
]
| |
3c2383ff7548c606166f4297a946031256cc31c2 | 93295d5690037339f69adec76bd2292fa975e7de | /src/main/java/fauxspring/ModelMap.java | cbbb00969b67e844078526ee947d5b38b6502585 | []
| no_license | k-mendza/tddjunit5 | e0a8e4c94ce235f756efa29bf2e6e25277554145 | 0b582adb4770c5b37d169a628d99fe8d7e8cd70b | refs/heads/master | 2020-07-09T13:44:01.712449 | 2019-08-24T15:01:04 | 2019-08-24T15:01:04 | 203,985,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package fauxspring;
import model.Pet;
public interface ModelMap {
void put(String pet, Pet pet1);
}
| [
"[email protected]"
]
| |
10ce5311f469cc4881027f082ebda2a27cde83b4 | d00d3f3f64b1f078e53ce0e8b5c65193ece98a32 | /src/main/java/martin/site/documents/Estudiante.java | 81436e8768fa2656fbe3889ecc4a359b32c5c46a | []
| no_license | JHON-MAURICIO-MANCERA/spring-webflux-academia | 9e266287f8fa7382c59bdeaca1e59b648f819df3 | eac6fafd3da347e3ce6252709cc1f0d340bca841 | refs/heads/master | 2022-04-10T03:00:51.052533 | 2020-03-24T21:01:24 | 2020-03-24T21:01:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package martin.site.documents;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "estudiantes")
public class Estudiante {
@Id
private String id;
@NotEmpty
@Size(min = 3)
private String nombres;
@NotEmpty
@Size(min = 3)
private String apellidos;
@NotEmpty
@Size(min = 8)
private String dni;
@NotNull(message = "campo oligatorio")
private double edad;
public Estudiante() {}
public Estudiante(String nombres, String apellidos,String dni, double edad) {
super();
this.nombres = nombres;
this.apellidos = apellidos;
this.dni = dni;
this.edad = edad;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNombres() {
return nombres;
}
public void setNombres(String nombres) {
this.nombres = nombres;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public String getDni() {
return dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public double getEdad() {
return edad;
}
public void setEdad(double edad) {
this.edad = edad;
}
}
| [
"[email protected]"
]
| |
38b8734bb8145cd8683a469391b4439311bbb740 | 8c2fc839a283d7f9c2b4ab214f4cb9221f9aebef | /Week3/CodeInFigures/GetUserInfo2.java | d944d54d30288e3609a97ee037efc2995e4b00fd | []
| no_license | EthanHay/CP2406 | 7f08b0923523649409fd54b346a1ff3c87cf2242 | 007b13da376a2d1be834d9fb721886a723b152f8 | refs/heads/master | 2020-04-06T06:53:31.414619 | 2016-09-05T05:12:49 | 2016-09-05T05:12:49 | 65,521,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | package CodeInFigures;
import java.util.Scanner;
public class GetUserInfo2
{
public static void main(String[] args)
{
String name;
int age;
Scanner inputDevice = new Scanner(System.in);
System.out.print("Please enter your age >> ");
age = inputDevice.nextInt();
System.out.print("Please enter your name >> ");
name = inputDevice.nextLine();
System.out.println("Your name is " + name + " and you are " + age + " years old.");
}
}
| [
"[email protected]"
]
| |
c3ea2decb3e45c7d76673f0df3deb8a649404672 | a39e11f54f7fd25ba635ec42bcc577c1fbf30d81 | /app/src/main/java/com/myapps/toualbiamine/bouncy/C0000R.java | 86a08c8de4fc40f55a5d4111a6cedac041d0b2e0 | []
| no_license | AmineToualbi/Bouncy | f6a615830df0dc24254aa28f144f0c376774d8c9 | 9d48bc07977f8f41cc6fe87263de139fdd1fc88e | refs/heads/master | 2020-03-21T06:22:08.325665 | 2019-04-18T21:14:38 | 2019-04-18T21:14:38 | 138,215,076 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package com.myapps.toualbiamine.bouncy;
/* renamed from: com.myapps.toualbiamine.breakout.R */
public final class C0000R {
/* renamed from: com.myapps.toualbiamine.breakout.R$attr */
public static final class attr {
}
/* renamed from: com.myapps.toualbiamine.breakout.R$color */
public static final class color {
public static final int colorAccent = 2130968576;
public static final int colorPrimary = 2130968577;
public static final int colorPrimaryDark = 2130968578;
}
/* renamed from: com.myapps.toualbiamine.breakout.R$mipmap */
public static final class mipmap {
public static final int ic_launcher = 2130837504;
public static final int ic_launcher1 = 2130837505;
public static final int ic_launcher_round = 2130837506;
/* renamed from: x */
public static final int f3x = 2130837507;
}
/* renamed from: com.myapps.toualbiamine.breakout.R$raw */
public static final class raw {
public static final int ballbreak = 2130903040;
public static final int bouncesound = 2130903041;
public static final int gameover = 2130903042;
}
/* renamed from: com.myapps.toualbiamine.breakout.R$string */
public static final class string {
public static final int app_name = 2131034112;
}
/* renamed from: com.myapps.toualbiamine.breakout.R$style */
public static final class style {
public static final int AppTheme = 2131099648;
}
}
| [
"[email protected]"
]
| |
a608d07bccb2e5b4f36678176a67ebccc09622c8 | 3fbc9015328aeb73dc5fa95c7f749cbcbef8965c | /CommandServer/src/model/Address.java | c5f1c31c13f717b98963da3e3830617a905ad66a | []
| no_license | coopes-dev/hotelbooking | a40cf3f73038dd372103421c1bb3018191274a81 | 2b60c72320bd8ea7a5263bdf5d3f6f445749762f | refs/heads/master | 2023-03-17T11:35:01.141869 | 2021-03-08T12:13:22 | 2021-03-08T12:13:22 | 344,808,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,779 | java | package model;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "ADDRESS")
public class Address {
private int addressID;
private String houseNameOrNumber;
private String addressLine1;
private String addressLine2;
private String addressLine3;
private String postalTownCity;
private String postalOrZipCode;
private String countryCode;
private Person person;
public int getAddressID() {
return addressID;
}
public void setAddressID(int addressID) {
this.addressID = addressID;
}
public String getHouseNameOrNumber() {
return houseNameOrNumber;
}
public void setHouseNameOrNumber(String houseNameOrNumber) {
this.houseNameOrNumber = houseNameOrNumber;
}
public String getAddressLine1() {
return addressLine1;
}
public void setAddressLine1(String addressLine1) {
this.addressLine1 = addressLine1;
}
public String getAddressLine2() {
return addressLine2;
}
public void setAddressLine2(String addressLine2) {
this.addressLine2 = addressLine2;
}
public String getAddressLine3() {
return addressLine3;
}
public void setAddressLine3(String addressLine3) {
this.addressLine3 = addressLine3;
}
public String getPostalTownCity() {
return postalTownCity;
}
public void setPostalTownCity(String postalTownCity) {
this.postalTownCity = postalTownCity;
}
public String getPostalOrZipCode() {
return postalOrZipCode;
}
public void setPostalOrZipCode(String postalOrZipCode) {
this.postalOrZipCode = postalOrZipCode;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
}
| [
"[email protected]"
]
| |
2fe8785047b514f5eaac0edebc5ba233e74931a6 | 66880b4c06bf662d058b1184642e9f052779ea9e | /libcore/jsr166-tests/src/test/java/jsr166/ThreadLocalTest.java | 885c2b2b2210356a9ff1645a572aa518d71fc77f | [
"W3C-19980720",
"W3C",
"ICU",
"MIT",
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
]
| permissive | ParkHanbum/dex2ir | afa195163a048efa01c1cbd44c90ffd84565d053 | a4cc0fe939146ca258c50a6b52b8fa09313f5eb4 | refs/heads/master | 2022-07-02T20:28:19.323269 | 2022-05-30T09:22:33 | 2022-05-30T09:22:33 | 247,693,944 | 51 | 16 | null | null | null | null | UTF-8 | Java | false | false | 2,692 | java | /*
* Written by Doug Lea with assistance from members of JCP JSR-166
* Expert Group and released to the public domain, as explained at
* http://creativecommons.org/publicdomain/zero/1.0/
* Other contributors include Andrew Wright, Jeffrey Hayes,
* Pat Fisher, Mike Judd.
*/
package jsr166;
import junit.framework.*;
import java.util.concurrent.Semaphore;
public class ThreadLocalTest extends JSR166TestCase {
static ThreadLocal<Integer> tl = new ThreadLocal<Integer>() {
public Integer initialValue() {
return one;
}
};
static InheritableThreadLocal<Integer> itl =
new InheritableThreadLocal<Integer>() {
protected Integer initialValue() {
return zero;
}
protected Integer childValue(Integer parentValue) {
return new Integer(parentValue.intValue() + 1);
}
};
/**
* remove causes next access to return initial value
*/
public void testRemove() {
assertSame(tl.get(), one);
tl.set(two);
assertSame(tl.get(), two);
tl.remove();
assertSame(tl.get(), one);
}
/**
* remove in InheritableThreadLocal causes next access to return
* initial value
*/
public void testRemoveITL() {
assertSame(itl.get(), zero);
itl.set(two);
assertSame(itl.get(), two);
itl.remove();
assertSame(itl.get(), zero);
}
private class ITLThread extends Thread {
final int[] x;
ITLThread(int[] array) { x = array; }
public void run() {
Thread child = null;
if (itl.get().intValue() < x.length - 1) {
child = new ITLThread(x);
child.start();
}
Thread.yield();
int threadId = itl.get().intValue();
for (int j = 0; j < threadId; j++) {
x[threadId]++;
Thread.yield();
}
if (child != null) { // Wait for child (if any)
try {
child.join();
} catch (InterruptedException e) {
threadUnexpectedException(e);
}
}
}
}
/**
* InheritableThreadLocal propagates generic values.
*/
public void testGenericITL() throws InterruptedException {
final int threadCount = 10;
final int x[] = new int[threadCount];
Thread progenitor = new ITLThread(x);
progenitor.start();
progenitor.join();
for (int i = 0; i < threadCount; i++) {
assertEquals(i, x[i]);
}
}
}
| [
"[email protected]"
]
| |
6661695580445d0a0d4be1b4179ddf36bb45d329 | 3b5aa7b19ff6ed1a20617d2296e83666ade0250c | /src/test/java/pageobject/utils/AppDriver.java | 3a70dabc0cce89148ee33cc98747ed85f276ffe6 | []
| no_license | seveniruby/AppiumPageObjectDemo20180812 | 2fee8926f7603a47cc6a93b9b3f995acee52c9c4 | e3b2273f933e8e603bec25d130bc886c6a11f5af | refs/heads/master | 2020-03-26T03:14:15.099005 | 2018-08-12T10:08:01 | 2018-08-12T10:08:01 | 144,446,233 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,495 | java | package pageobject.utils;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class AppDriver {
public static AppiumDriver<WebElement> driver;
public static void launchApp() throws MalformedURLException {
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
//desiredCapabilities.setCapability("app", "/Users/seveniruby/Downloads/com.xueqiu.android_11.2_174.apk");
desiredCapabilities.setCapability("appPackage", "com.xueqiu.android");
desiredCapabilities.setCapability("appActivity", ".view.WelcomeActivityAlias");
desiredCapabilities.setCapability("platformName", "android");
desiredCapabilities.setCapability("deviceName", "emulator-5554");
desiredCapabilities.setCapability("avd", "Three");
desiredCapabilities.setCapability("automationName", "uiautomator2");
desiredCapabilities.setCapability("chromedriverExecutableDir", "/Users/seveniruby/projects/chromedriver/chromedrivers/");
URL remoteUrl = new URL("http://127.0.0.1:4723/wd/hub");
driver = new AndroidDriver(remoteUrl, desiredCapabilities);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElementById("cancel").click();
}
}
| [
"[email protected]"
]
| |
850e9f24a3c3f11fb7dc84602aa0c675d87e2750 | 311f1237e7498e7d1d195af5f4bcd49165afa63a | /sourcedata/jedit40source/jEdit/bsh/StringUtil.java | d4f0cfb5ffdb7610ad74c05eb71739c840f5c559 | [
"Apache-2.0"
]
| permissive | DXYyang/SDP | 86ee0e9fb7032a0638b8bd825bcf7585bccc8021 | 6ad0daf242d4062888ceca6d4a1bd4c41fd99b63 | refs/heads/master | 2023-01-11T02:29:36.328694 | 2019-11-02T09:38:34 | 2019-11-02T09:38:34 | 219,128,146 | 10 | 1 | Apache-2.0 | 2023-01-02T21:53:42 | 2019-11-02T08:54:26 | Java | UTF-8 | Java | false | false | 4,611 | java | /*****************************************************************************
* *
* This file is part of the BeanShell Java Scripting distribution. *
* Documentation and updates may be found at http://www.beanshell.org/ *
* *
* Sun Public License Notice: *
* *
* The contents of this file are subject to the Sun Public License Version *
* 1.0 (the "License"); you may not use this file except in compliance with *
* the License. A copy of the License is available at http://www.sun.com *
* *
* The Original Code is BeanShell. The Initial Developer of the Original *
* Code is Pat Niemeyer. Portions created by Pat Niemeyer are Copyright *
* (C) 2000. All Rights Reserved. *
* *
* GNU Public License Notice: *
* *
* Alternatively, the contents of this file may be used under the terms of *
* the GNU Lesser General Public License (the "LGPL"), in which case the *
* provisions of LGPL are applicable instead of those above. If you wish to *
* allow use of your version of this file only under the terms of the LGPL *
* and not to allow others to use your version of this file under the SPL, *
* indicate your decision by deleting the provisions above and replace *
* them with the notice and other provisions required by the LGPL. If you *
* do not delete the provisions above, a recipient may use your version of *
* this file under either the SPL or the LGPL. *
* *
* Patrick Niemeyer ([email protected]) *
* Author of Learning Java, O'Reilly & Associates *
* http://www.pat.net/~pat/ *
* *
*****************************************************************************/
package bsh;
import java.util.*;
public class StringUtil {
public static String [] split( String s, String delim) {
Vector v = new Vector();
StringTokenizer st = new StringTokenizer(s, delim);
while ( st.hasMoreTokens() )
v.addElement( st.nextToken() );
String [] sa = new String [ v.size() ];
v.copyInto( sa );
return sa;
}
public static String [] bubbleSort( String [] in ) {
Vector v = new Vector();
for(int i=0; i<in.length; i++)
v.addElement(in[i]);
int n = v.size();
boolean swap = true;
while ( swap ) {
swap = false;
for(int i=0; i<(n-1); i++)
if ( ((String)v.elementAt(i)).compareTo(
((String)v.elementAt(i+1)) ) > 0 ) {
String tmp = (String)v.elementAt(i+1);
v.removeElementAt( i+1 );
v.insertElementAt( tmp, i );
swap = true;
}
}
String [] out = new String [ n ];
v.copyInto(out);
return out;
}
public static String maxCommonPrefix( String one, String two ) {
int i=0;
while( one.regionMatches( 0, two, 0, i ) )
i++;
return one.substring(0, i-1);
}
// Clean this up later...
public static String methodString(String name, Class[] types)
{
StringBuffer sb = new StringBuffer(name + "(");
if(types.length > 0)
sb.append(" ");
for(int i=0; i<(types.length - 1); i++)
{
Class c = types[i];
sb.append(((c == null) ? "null" : c.getName()) + ", ");
}
if(types.length > 0)
{
Class c = types[types.length - 1];
sb.append(((c == null) ? "null" : c.getName()));
sb.append(" ");
}
sb.append(")");
return sb.toString();
}
/**
Split a filename into dirName, baseName
@return String [] { dirName, baseName }
public String [] splitFileName( String fileName )
{
String dirName, baseName;
int i = fileName.lastIndexOf( File.separator );
if ( i != -1 ) {
dirName = fileName.substring(0, i);
baseName = fileName.substring(i+1);
} else
baseName = fileName;
return new String[] { dirName, baseName };
}
*/
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.