blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
519b8bc6bcaea5277ceaa1e17d355da62fe2e84b | bfe08d0cdfc7e6aab28cc79e172903c3f8e69c29 | /src/main/java/com/aly/service/RecruitsService.java | c470c9cc9738cd920b3821cfa5262011695587c6 | [] | no_license | wongjohn/web-maven-demo | 10524c8f917d93d9b775f296de4874dac8dbf524 | b4ddc50a2db7f535fc539d67243ab44b4558b4c1 | refs/heads/master | 2021-01-21T12:59:30.658031 | 2015-12-05T00:50:41 | 2015-12-05T00:50:41 | 47,436,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package com.aly.service;
import com.aly.domain.Recruits;
import java.util.List;
public interface RecruitsService {
public int deleteByPrimaryKey(Integer recruitId);
public int insert(Recruits record);
public int insertSelective(Recruits record);
public Recruits selectByPrimaryKey(Integer recruitId);
public int updateByPrimaryKeySelective(Recruits record);
public int updateByPrimaryKey(Recruits record);
public List<Recruits> getAllRecruits();
public Recruits getRecruitsById(Integer id);
}
| [
"wangshijiang@eqxiu.com"
] | wangshijiang@eqxiu.com |
335dde07707f87f8d9df342f3a66b35a557980a6 | 9cda47fbab817b34c881d79ba952cc30a8b90482 | /src/main/java/a/FilterIcon.java | cec2c19c53748b54a9b38f4e87cfd76b542b2991 | [] | no_license | whelanc5/SelectFlightsMenu | b35a561e3903cf0a061ab26f800766b8228dcb2b | 6ea8204a52552d3cde78226fca09b592a5996c0b | refs/heads/master | 2020-03-08T04:20:44.982308 | 2018-04-09T18:37:20 | 2018-04-09T18:37:20 | 127,918,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,605 | java | import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.Icon;
import javax.swing.JComponent;
/**
* Icon for a FlightFilter
*
* @author cwhelan
*
*/
class FilterIcon implements Icon {
/**
*
*/
private static final long serialVersionUID = 1L;
private Color color;
private String shape;
private int width;
private int height;
/**
* @param colorIn
* - color of the Icon
*/
public FilterIcon(Color colorIn, String shapeIn, int widthIn, int heightIn) {
color = colorIn;
shape = shapeIn;
width = widthIn;
height = heightIn;
}
/**
* method to change the color of the FlightIcon
*
* @param colorIn
*/
public void setColor(Color colorIn) {
this.color = colorIn;
}
public Color getColor() {
return color;
}
public String getShape() {
return shape;
}
public void setShape(String str) {
shape = str;
}
@Override
public void paintIcon(Component aComponent, Graphics g, int anXCoord, int aYCoord) {
g.setColor(color);
if (this.shape.equals("circle")) {
g.drawOval(5, 5, getIconWidth(), getIconHeight());
} else
g.drawRect(5, 5, getIconWidth(), getIconHeight());
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public void setWidth(int w) {
width = w;
}
public void setHeight(int h) {
height = h;
}
@Override
public int getIconWidth() {
// TODO Auto-generated method stub
return height;
}
@Override
public int getIconHeight() {
// TODO Auto-generated method stub
return width;
}
} | [
"whelanc@cscfed.root.ad"
] | whelanc@cscfed.root.ad |
3d4cd3af342103e147caf0e1ab1b4a7194b1fe4e | e7b05b11ef7bd05fa4a45fe900d889d55919349e | /java-backend/src/main/java/com/happilyever/weddingplanner/config/SimpleCorsFile.java | 9516192d32fc434de8c2d320cc7bf59afa6e7191 | [] | no_license | Happily-Ever/Java-Back-End | 4e2d6647d9162ddc9b4de4f19b575acd43669932 | b525af52bab38f6329f5d3513092fe3cea8844d8 | refs/heads/master | 2022-12-17T09:08:17.683253 | 2019-08-29T17:39:22 | 2019-08-29T17:39:22 | 204,541,878 | 0 | 0 | null | 2022-11-16T12:26:13 | 2019-08-26T19:01:49 | Java | UTF-8 | Java | false | false | 1,671 | java | package com.happilyever.weddingplanner.config;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
class SimpleCorsFile implements Filter
{
public SimpleCorsFile()
{
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException
{
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Methods", "POST, PUT, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Allow-Methods", "*");
// response.setHeader("Access-Control-Allow-Headers", "x-requested-with, authorization, content-type, access_token");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Max-Age", "3600");
if (HttpMethod.OPTIONS.name().equalsIgnoreCase(((HttpServletRequest) req).getMethod()))
{
response.setStatus(HttpServletResponse.SC_OK);
} else
{
chain.doFilter(req, res);
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException
{
}
@Override
public void destroy()
{
}
} | [
"kimberlyswinton@gmail.com"
] | kimberlyswinton@gmail.com |
978d47d6dbfb20cd580d874d837cbfbe34a4e7e7 | 07e20db4aed4d867b6bd4513a17b9c67add0ae7c | /Matrix/src/matrix/DeterminantTest.java | fcbf584ea17e984a6c87f485521228ee183ab549 | [] | no_license | dv66/NetBeansProjects | 0e4de811cc463005f6d0d2c7e1d338f2a0db65e7 | a4a95a927246154657b7d088e89239bf2500bb87 | refs/heads/master | 2021-07-17T03:11:50.206750 | 2017-10-25T16:36:56 | 2017-10-25T16:36:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 975 | 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 matrix;
/**
*
* @author User
*/
public class DeterminantTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Matrix matrix = new Matrix(7);
int[][] arr = {
{1,2,3,4,5,6,7},
{9,8,7,6,5,4,3},
{2,1,6,8,9,0,7},
{9,6,4,5,6,7,7},
{8,6,4,2,-9,7,8},
{9,0,1,4,6,9,9},
{0,7,-6,8,9,0,0}
};
matrix.setSquareMatrix(arr);
Determinant determinant = new Determinant();
System.out.println(determinant.solveDeterminant(matrix));
System.out.println("Total Multiplication done = " + determinant.getTotalMultiplications());
}
}
| [
"mostofamonsur9396@gmail.com"
] | mostofamonsur9396@gmail.com |
59ae3dce8b47e848301dbaae1cd7d0bf106048f8 | 059d24c40488cf36887e63ee6e4f4cf1a00a77f3 | /JavaTest/src/main/java/com/ssyh/javatest/java7source/com/sun/corba/se/spi/activation/ServerHeldDown.java | d1031ffa78354af01fe893b34a47a04bb2581c8a | [] | no_license | 1522395053/MyDemo | b26917566a2bd949ef934c5b8fa000450c7f9fc7 | 5c155d8e8f9b3400b93088ab988526cd03a43de4 | refs/heads/master | 2023-01-31T02:33:17.773414 | 2020-12-11T12:16:52 | 2020-12-11T12:16:52 | 294,684,125 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | package com.sun.corba.se.spi.activation;
/**
* com/sun/corba/se/spi/activation/ServerHeldDown.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from ../../../../src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Friday, April 10, 2015 11:20:47 AM PDT
*/
public final class ServerHeldDown extends org.omg.CORBA.UserException
{
public int serverId = (int)0;
public ServerHeldDown ()
{
super(ServerHeldDownHelper.id());
} // ctor
public ServerHeldDown (int _serverId)
{
super(ServerHeldDownHelper.id());
serverId = _serverId;
} // ctor
public ServerHeldDown (String $reason, int _serverId)
{
super(ServerHeldDownHelper.id() + " " + $reason);
serverId = _serverId;
} // ctor
} // class ServerHeldDown
| [
"jinchen@liquidnetwork.com"
] | jinchen@liquidnetwork.com |
58c67cd3187f5488053769ac0950ddccde986087 | 4915e96f6d7d050653ae621bee102e9bafe26c7d | /src/main/java/pl/jacobscarf/myorchestra/MyorchestraApplication.java | 367605ba50ab4f70681ba1c9239ac0b6b2935a58 | [] | no_license | jacobscarf/myorchestra | 347ae4425662bafa1275db254da520eb6e46cc35 | f4919b1f3ef849ad0cd93768f8f4f1188294c096 | refs/heads/master | 2023-02-24T19:58:15.799360 | 2020-11-04T12:24:39 | 2020-11-04T12:24:39 | 309,995,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package pl.jacobscarf.myorchestra;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MyorchestraApplication {
public static void main(String[] args) {
SpringApplication.run(MyorchestraApplication.class, args);
}
}
| [
"jakubszalik@gmail.com"
] | jakubszalik@gmail.com |
7fd5ab9c28d79b7206d72f5d816a62361f179753 | 5f004279b0a989398ac0faab69bcf6a03a7b90ab | /app/src/main/java/com/homa/hls/database/Device.java | e1b2bad1a532c6b9d1defe8ba5dc17def9e46604 | [] | no_license | Valyao0823/HorizonILS_FC | f8a01732fb65908a545b49e9cf9e0424491bede4 | ac0651b44440e47921386ff7f6f3c707fd8399a3 | refs/heads/master | 2021-01-10T14:34:12.600751 | 2016-04-13T19:57:57 | 2016-04-13T19:57:57 | 55,625,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,902 | java | package com.homa.hls.database;
import android.support.v4.view.MotionEventCompat;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
public class Device implements Serializable, Comparable {
public static final short DEVICE_SIZE = (short) 99;
public static final int MACADDR_BUFFER_SIZE = 12;
public static final int NAME_BUFFER_SIZE = 50;
public static final int PASSWORD_BUFFER_SIZE = 8;
public static final int SSID_BUFFER_SIZE = 64;
private static final long serialVersionUID = 1;
private short ChannelInfo;
private short ChannelMark;
private byte[] CurrentParams;
private short DeviceAddress;
private short DeviceIndex;
private String DeviceName;
private byte[] DeviceNameBuffer;
private short DeviceType;
private short FatherAddress;
private byte[] GatewayMacAddress;
private byte[] GatewayPassword;
private byte[] GatewaySSID;
private byte[] LastCurrentParams;
private int[] MacAddress;
private short PanId;
private String PictureName;
private byte[] PictureNameBuffer;
private int[] SceneDeviceMac;
private short SceneId;
private byte[] SceneParams;
private short SubDeviceType;
boolean isClick;
boolean ischoose;
boolean isopen;
boolean isstart;
boolean ischecked;
public Device() {
byte[] bArr = new byte[5];
bArr[4] = (byte) 100;
this.CurrentParams = bArr;
bArr = new byte[5];
bArr[4] = (byte) 100;
this.LastCurrentParams = bArr;
bArr = new byte[5];
bArr[4] = (byte) 100;
this.SceneParams = bArr;
this.DeviceIndex = (short) 0;
this.DeviceName = null;
this.DeviceType = (short) 0;
this.SubDeviceType = (short) 0;
this.PanId = (short) 0;
this.DeviceAddress = (short) 0;
this.FatherAddress = (short) 0;
this.ChannelInfo = (short) 0;
this.ChannelMark = (short) 0;
this.PictureName = null;
this.DeviceNameBuffer = new byte[NAME_BUFFER_SIZE];
this.PictureNameBuffer = new byte[NAME_BUFFER_SIZE];
this.GatewayMacAddress = null;
this.GatewaySSID = null;
this.GatewayPassword = null;
this.MacAddress = new int[4];
this.SceneDeviceMac = new int[4];
this.ischoose = false;
this.isopen = false;
this.isClick = false;
this.isstart = false;
this.ischecked = false;
}
public boolean getChecked()
{
return ischecked;
}
public void setChecked(boolean ischecked)
{
this.ischecked = ischecked;
}
public static byte[] decodeDevice(Device device) throws UnsupportedEncodingException {
byte[] data = new byte[99];
int i = 0 + 1;
data[0] = (byte) 0;
int i2 = i + 1;
data[i] = (byte) ((device.getPanId() >> PASSWORD_BUFFER_SIZE) & MotionEventCompat.ACTION_MASK);
i = i2 + 1;
data[i2] = (byte) (device.getPanId() & MotionEventCompat.ACTION_MASK);
i2 = i + 1;
data[i] = (byte) ((device.getDeviceAddress() >> PASSWORD_BUFFER_SIZE) & MotionEventCompat.ACTION_MASK);
i = i2 + 1;
data[i2] = (byte) (device.getDeviceAddress() & MotionEventCompat.ACTION_MASK);
i2 = i + 1;
data[i] = (byte) ((device.getFatherAddress() >> PASSWORD_BUFFER_SIZE) & MotionEventCompat.ACTION_MASK);
i = i2 + 1;
data[i2] = (byte) (device.getFatherAddress() & MotionEventCompat.ACTION_MASK);
i2 = i + PASSWORD_BUFFER_SIZE;
i = i2 + 1;
data[i2] = (byte) (device.getChannelInfo() & MotionEventCompat.ACTION_MASK);
i2 = i + 1;
data[i] = (byte) (device.getDeviceType() & MotionEventCompat.ACTION_MASK);
i = i2 + 1;
data[i2] = (byte) (device.getSubDeviceType() & MotionEventCompat.ACTION_MASK);
return data;
}
public static Device createDeviceByDevice(byte[] device) {
if (device == null) {
return null;
}
int index = 0 + 1;
byte dataType = device[0];
int index2 = index + 1;
short panId = (short) (device[index] << PASSWORD_BUFFER_SIZE);
index = index2 + 1;
panId = (short) ((device[index2] & MotionEventCompat.ACTION_MASK) | panId);
index2 = index + 1;
short netAddress = (short) ((device[index] & MotionEventCompat.ACTION_MASK) << PASSWORD_BUFFER_SIZE);
index = index2 + 1;
netAddress = (short) ((device[index2] & MotionEventCompat.ACTION_MASK) | netAddress);
index2 = index + 1;
short parentAddress = (short) (device[index] << PASSWORD_BUFFER_SIZE);
index = index2 + 1;
parentAddress = (short) ((device[index2] & MotionEventCompat.ACTION_MASK) | parentAddress);
System.arraycopy(device, index, new byte[PASSWORD_BUFFER_SIZE], 0, PASSWORD_BUFFER_SIZE);
index2 = index + PASSWORD_BUFFER_SIZE;
index = index2 + 1;
short channelId = (short) (device[index2] & MotionEventCompat.ACTION_MASK);
index2 = index + 1;
byte deviceType = device[index];
index = index2 + 1;
byte subdeviceType = device[index2];
Device mDevice = new Device();
mDevice.setDeviceType(deviceType);
mDevice.setDeviceAddress(netAddress);
mDevice.setFatherAddress(parentAddress);
mDevice.setPanId(panId);
mDevice.setChannelInfo(channelId);
mDevice.setSubDeviceType(subdeviceType);
return mDevice;
}
public short getDeviceIndex() {
return this.DeviceIndex;
}
public void setDeviceIndex(short deviceIndex) {
this.DeviceIndex = deviceIndex;
}
public short getDeviceType() {
return this.DeviceType;
}
public void setDeviceType(short deviceType) {
this.DeviceType = deviceType;
}
public short getSubDeviceType() {
return this.SubDeviceType;
}
public void setSubDeviceType(short subDeviceType) {
this.SubDeviceType = subDeviceType;
}
public short getPanId() {
return this.PanId;
}
public void setPanId(short panId) {
this.PanId = panId;
}
public short getDeviceAddress() {
return this.DeviceAddress;
}
public void setDeviceAddress(short deviceAddress) {
this.DeviceAddress = deviceAddress;
}
public short getFatherAddress() {
return this.FatherAddress;
}
public void setFatherAddress(short fatherAddress) {
this.FatherAddress = fatherAddress;
}
public short getChannelInfo() {
return this.ChannelInfo;
}
public void setChannelInfo(short channelInfo) {
this.ChannelInfo = channelInfo;
}
public String getPictureName() {
return this.PictureName;
}
public void setPictureName(String pictureName) {
this.PictureName = pictureName;
}
public byte[] getCurrentParams() {
return this.CurrentParams;
}
public void setCurrentParams(byte[] currentParams) {
this.CurrentParams = currentParams;
}
public byte[] getDeviceNameBuffer() {
return this.DeviceNameBuffer;
}
public void setDeviceNameBuffer(byte[] deviceNameBuffer) {
this.DeviceNameBuffer = deviceNameBuffer;
}
public byte[] getPictureNameBuffer() {
return this.PictureNameBuffer;
}
public void setPictureNameBuffer(byte[] pictureNameBuffer) {
this.PictureNameBuffer = pictureNameBuffer;
}
public String getDeviceName() {
return this.DeviceName;
}
public short getChannelMark() {
return this.ChannelMark;
}
public void setChannelMark(short channelMark) {
this.ChannelMark = channelMark;
}
public short getSceneId() {
return this.SceneId;
}
public void setSceneId(short sceneId) {
this.SceneId = sceneId;
}
public byte[] getSceneParams() {
return this.SceneParams;
}
public void setSceneParams(byte[] sceneParams) {
this.SceneParams = sceneParams;
}
public boolean isIschoose() {
return this.ischoose;
}
public void setIschoose(boolean ischoose) {
this.ischoose = ischoose;
}
public boolean isIsopen() {
return this.isopen;
}
public void setIsopen(boolean isopen) {
this.isopen = isopen;
}
public boolean isClick() {
return this.isClick;
}
public void setClick(boolean isClick) {
this.isClick = isClick;
}
public boolean isIsstart() {
return this.isstart;
}
public void setIsstart(boolean isstart) {
this.isstart = isstart;
}
public void setDeviceName(String deviceName) {
try {
byte[] buf = deviceName.getBytes("UTF-16LE");
int length = buf.length;
Arrays.fill(this.DeviceNameBuffer, (byte) 0);
System.arraycopy(buf, 0, this.DeviceNameBuffer, 0, length);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
this.DeviceName = deviceName;
}
public int compareTo(Object arg0) {
return getDeviceName().compareTo(((Device) arg0).getDeviceName());
}
public int[] getMacAddress() {
return this.MacAddress;
}
public void setMacAddress(int[] macAddress) {
this.MacAddress = macAddress;
}
public int[] getSceneDeviceMac() {
return this.SceneDeviceMac;
}
public void setSceneDeviceMac(int[] sceneDeviceMac) {
this.SceneDeviceMac = sceneDeviceMac;
}
public byte[] getLastCurrentParams() {
return this.LastCurrentParams;
}
public void setLastCurrentParams(byte[] lastCurrentParams) {
this.LastCurrentParams = lastCurrentParams;
}
public byte[] getGatewayMacAddr() {
return this.GatewayMacAddress;
}
public void setGatewayMacAddr(byte[] gatewayMacAddress) {
if (this.GatewayMacAddress == null && gatewayMacAddress != null) {
this.GatewayMacAddress = new byte[MACADDR_BUFFER_SIZE];
}
this.GatewayMacAddress = gatewayMacAddress;
}
public byte[] getGatewaySSID() {
return this.GatewaySSID;
}
public void setGatewaySSID(byte[] gatewaySSID) {
if (this.GatewaySSID == null && gatewaySSID != null) {
this.GatewaySSID = new byte[SSID_BUFFER_SIZE];
}
this.GatewaySSID = gatewaySSID;
}
public byte[] getGatewayPassword() {
return this.GatewayPassword;
}
public void setGatewayPassword(byte[] gatewayPassword) {
if (this.GatewayPassword == null && gatewayPassword != null) {
this.GatewayPassword = new byte[PASSWORD_BUFFER_SIZE];
}
this.GatewayPassword = gatewayPassword;
}
}
| [
"yao_yiyu@live.com"
] | yao_yiyu@live.com |
c4b1443e92c1cb7c5368750821e5ee56eaa3428b | f3cedc00c536faf208f1f3135b6db2a4fcc6d614 | /src/main/java/br/com/simconsult/painel/payload/reponse/JwtResponse.java | 0b51a56287fa47e7a29cabfb0e6f77dd0fe4e806 | [] | no_license | adrianoaguiardez/painel-backed | bb96674f7541e339eb613672c240bb133836582c | 87ab23ed5f2e2fbb7b33f85b0b6e1f100709821a | refs/heads/main | 2023-04-16T04:34:15.989390 | 2021-04-30T13:29:12 | 2021-04-30T13:29:12 | 351,267,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | java | package br.com.simconsult.painel.payload.reponse;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import br.com.simconsult.painel.modelo.Role;
public class JwtResponse {
private String token;
private String type = "Bearer";
private Long id;
private String username;
private String email;
private Role role;
private boolean admin = true;
@JsonIgnore
private List<String> roles;
public JwtResponse(String accessToken, Long id, String username, String email, Role role, List<String> roles) {
this.token = accessToken;
this.id = id;
this.username = username;
this.email = email;
this.role = role;
this.roles = roles;
}
public String getAccessToken() {
return token;
}
public void setAccessToken(String accessToken) {
this.token = accessToken;
}
public String getTokenType() {
return type;
}
public void setTokenType(String tokenType) {
this.type = tokenType;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getUsername() {
return username;
}
public Role getRole() {
return role;
}
public void setUsername(String username) {
this.username = username;
}
public List<String> getRoles() {
return roles;
}
public boolean isAdmin() {
return role.equals(Role.ADMINISTRATOR);
}
}
| [
"adrianoaguiardez@gmail.com"
] | adrianoaguiardez@gmail.com |
b26976df1ba6afa79980c5f661895461b93a26fa | 3fc6179ca8e4d0a3dd7e4a01a7a63d2945f50e10 | /org.aion.avm.tooling/test/org/aion/avm/tooling/abi/ChattyCalculatorTarget.java | b5aec3904c7b60b84c30a0e2f23e7ce1fe954bed | [
"MIT"
] | permissive | ejhanrienaOut/AVM | b4fc06b20afa691f4226826f463068ff21841dfa | efbfe35483ab7726a08b857a9ed383f64e10312f | refs/heads/master | 2022-09-16T07:06:43.330444 | 2020-06-03T20:40:51 | 2020-06-03T20:40:51 | 269,189,842 | 1 | 0 | MIT | 2020-06-03T20:39:39 | 2020-06-03T20:39:39 | null | UTF-8 | Java | false | false | 366 | java | package org.aion.avm.tooling.abi;
public class ChattyCalculatorTarget {
@Callable()
public static String amIGreater(int a, int b) {
if (SilentCalculatorTarget.greaterThan(a, b)) {
return("Yes, " + a + ", you are greater than " + b);
} else {
return("No, " + a + ", you are NOT greater than " + b);
}
}
}
| [
"arajasek94@gmail.com"
] | arajasek94@gmail.com |
aa42e7eb4bdd241d924dd9221fd9efed3e99a899 | c976ec2596a167d11bb0624fa85aa9667ef1f0c5 | /zhang_pattern/src/main/java/com/bjsxt/flyweight/Coordinate.java | 796a72a4317b5fa4d1624f836df6787902beff43 | [] | no_license | dsczs/zhang_java | 4c875349033bce011c012190bf165ad49e469a27 | 744c663f5af4e22eea1cc9a0f0ca97ec8150d29d | refs/heads/master | 2021-07-08T14:28:23.494948 | 2017-10-07T13:22:02 | 2017-10-07T13:22:02 | 104,546,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package com.bjsxt.flyweight;
/**
* 外部状态UnSharedConcreteFlyWeight
*
* @author Administrator
*/
public class Coordinate {
private int x, y;
public Coordinate(int x, int y) {
super();
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
| [
"370637594@qq.com"
] | 370637594@qq.com |
f81c5be0917491f000dbc6062fa82b0231563a68 | 00c9bc05e5b2bc933979a895095ac1f867d4e125 | /QuestAluno/src/QuestAluno.java | 674603d73aa896a7a525d530818aaf1561b403e9 | [] | no_license | MarcelloJPA/Java-COMPLETO-2020-Programa-o-Orientada-a-Objetos-Projetos | 0ea468ed2928a1055b3df155b393a984f431a4a5 | cf3dd79e96307a2ba0f3aee0ebe3348eb30cf7c0 | refs/heads/master | 2023-03-22T11:21:45.373710 | 2021-03-19T21:34:52 | 2021-03-19T21:34:52 | 294,529,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | import java.util.Locale;
import java.util.Scanner;
import Entities.NotaAluno;
public class QuestAluno {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
NotaAluno notas = new NotaAluno();
System.out.println("Nome: ");
notas.nome = sc.nextLine();
System.out.println("Primeira Nota: ");
notas.primeiroTri = sc.nextDouble();
System.out.println("Segunda Nota: ");
notas.segundoTri = sc.nextDouble();
System.out.println("Terceira Nota: ");
notas.terceiroTri = sc.nextDouble();
System.out.printf("Final Grade: %.2f\n", notas.finalAno());
if(notas.finalAno()<60.00) {
System.out.println("Falhou");
System.out.printf("Falta %.2f", notas.pontosFaltam());
}
else {
System.out.println("Aprovado");
}
sc.close();
}
}
| [
"cellolim4jpa@gmail.com"
] | cellolim4jpa@gmail.com |
7862d12bbcfb442b4dbbb73dc91f5575e6709e78 | f95583a626b276f1162da812a9796ba483f0c0f0 | /SoundPlayApp/app/src/androidTest/java/cn/bjtu/edu/soundplayapp/ExampleInstrumentedTest.java | 7c30ce22a3c54a36730c8dff2225e5edee3ea00e | [] | no_license | GreyLiang/EmbeddedSystem | 20e287afebec764da9da47aa5e0e2e29042db841 | 5b4c7f249aeee85e0d8d2aa28fc9f7f08c061679 | refs/heads/master | 2020-05-04T21:55:56.027052 | 2019-04-04T12:36:53 | 2019-04-04T12:36:53 | 179,493,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package cn.bjtu.edu.soundplayapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cn.bjtu.edu.soundplayapp", appContext.getPackageName());
}
}
| [
"35129612+GreyLiang@users.noreply.github.com"
] | 35129612+GreyLiang@users.noreply.github.com |
30545999153a2bb9410c6bdc288e78a3d499ff17 | ebaea63fa34d1cec9907f5057679608df8e682d5 | /app/src/androidTest/java/com/example/funkym0nk3y/magicaltowns/ApplicationTest.java | 921ac068ed3943e346a93d0c6246e531b39f86ff | [] | no_license | FunkyM0nk3y/MagicalTowns | 8b516c62d72a188d2d73545b82967aa471eb8df7 | b2f20ccf669cc6593e09080c41739b22abbd835e | refs/heads/master | 2021-01-01T18:48:11.104523 | 2015-08-13T05:11:11 | 2015-08-13T05:11:11 | 40,640,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.example.funkym0nk3y.magicaltowns;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"funkymonster@linux.com"
] | funkymonster@linux.com |
25735fbc8609b979602b4f858046a04d485c65a6 | fb27d83f40b8982e01a4bdaea3f5d4a9a420fe97 | /src/fontMeshCreator/GUIText.java | 24b8b5f11814c5655a67302a338fa21547337734 | [] | no_license | AaronReginaldOsborne/Java-game-engine | 066bc19ab9ff55d9f5b7f2dba72a0c95258ce52b | 97cc1d7d83a08c42f719d5a11ad9b804791d8e67 | refs/heads/master | 2020-04-15T19:43:32.978940 | 2019-01-10T00:51:33 | 2019-01-10T00:51:33 | 164,961,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,683 | java | package fontMeshCreator;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
import fontRendering.TextMaster;
/**
* Represents a piece of text in the game.
*
* @author A GOLD FISH
*
*/
public class GUIText {
private String textString;
private float fontSize;
private int textMeshVao;
private int vertexCount;
private Vector3f colour = new Vector3f(0f, 0f, 0f);
private float width;
private float edge;
private float borderWidth;
private float borderEdge;
private Vector2f offset;
private Vector3f outlineColour;
private Vector2f position;
private float lineMaxSize;
private int numberOfLines;
private FontType font;
private boolean centerText = false;
/**
* Creates a new text, loads the text's quads into a VAO, and adds the text
* to the screen.
*
* @param text
* - the text.
* @param fontSize
* - the font size of the text, where a font size of 1 is the
* default size.
* @param font
* - the font that this text should use.
* @param position
* - the position on the screen where the top left corner of the
* text should be rendered. The top left corner of the screen is
* (0, 0) and the bottom right is (1, 1).
* @param maxLineLength
* - basically the width of the virtual page in terms of screen
* width (1 is full screen width, 0.5 is half the width of the
* screen, etc.) Text cannot go off the edge of the page, so if
* the text is longer than this length it will go onto the next
* line. When text is centered it is centered into the middle of
* the line, based on this line length value.
* @param centered
* - whether the text should be centered or not.
*/
public GUIText(String text, float fontSize, FontType font, Vector2f position, float maxLineLength,
boolean centered) {
this.textString = text;
this.fontSize = fontSize;
this.font = font;
this.position = position;
this.lineMaxSize = maxLineLength;
this.centerText = centered;
this.width = 0.5f;
this.edge = 0.1f;
this.borderWidth = 0.0f;
this.borderEdge = 0.0f;
this.offset = new Vector2f(0.0f,0.0f);
this.outlineColour = new Vector3f(1.0f,1.0f,1.0f);
TextMaster.loadText(this);
}
/**
* Remove the text from the screen.
*/
public void remove() {
TextMaster.removeText(this);
}
/**
* @return The font used by this text.
*/
public FontType getFont() {
return font;
}
/**
* Set the colour of the text.
*
* @param r
* - red value, between 0 and 1.
* @param g
* - green value, between 0 and 1.
* @param b
* - blue value, between 0 and 1.
*/
public void setColour(float r, float g, float b) {
colour.set(r, g, b);
}
/**
* @return the colour of the text.
*/
public Vector3f getColour() {
return colour;
}
/**
* @return The number of lines of text. This is determined when the text is
* loaded, based on the length of the text and the max line length
* that is set.
*/
public int getNumberOfLines() {
return numberOfLines;
}
/**
* @return The position of the top-left corner of the text in screen-space.
* (0, 0) is the top left corner of the screen, (1, 1) is the bottom
* right.
*/
public Vector2f getPosition() {
return position;
}
/**
* @return the ID of the text's VAO, which contains all the vertex data for
* the quads on which the text will be rendered.
*/
public int getMesh() {
return textMeshVao;
}
/**
* Set the VAO and vertex count for this text.
*
* @param vao
* - the VAO containing all the vertex data for the quads on
* which the text will be rendered.
* @param verticesCount
* - the total number of vertices in all of the quads.
*/
public void setMeshInfo(int vao, int verticesCount) {
this.textMeshVao = vao;
this.vertexCount = verticesCount;
}
/**
* @return The total number of vertices of all the text's quads.
*/
public int getVertexCount() {
return this.vertexCount;
}
/**
* @return the font size of the text (a font size of 1 is normal).
*/
protected float getFontSize() {
return fontSize;
}
/**
* Sets the number of lines that this text covers (method used only in
* loading).
*
* @param number
*/
protected void setNumberOfLines(int number) {
this.numberOfLines = number;
}
/**
* @return {@code true} if the text should be centered.
*/
protected boolean isCentered() {
return centerText;
}
/**
* @return The maximum length of a line of this text.
*/
protected float getMaxLineSize() {
return lineMaxSize;
}
/**
* @return The string of text.
*/
protected String getTextString() {
return textString;
}
public float getWidth() {
return width;
}
public void setWidth(float width) {
this.width = width;
}
public float getEdge() {
return edge;
}
public void setEdge(float edge) {
this.edge = edge;
}
public float getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(float borderWidth) {
this.borderWidth = borderWidth;
}
public float getBorderEdge() {
return borderEdge;
}
public void setBorderEdge(float borderEdge) {
this.borderEdge = borderEdge;
}
public Vector2f getOffset() {
return offset;
}
public void setOffset(float x, float y) {
this.offset = new Vector2f(x,y);
}
public Vector3f getOutlineColour() {
return outlineColour;
}
public void setOutlineColour(float r,float g, float b) {
this.outlineColour = new Vector3f(r,g,b);
}
}
| [
"osborne.aaron@hotmail.com"
] | osborne.aaron@hotmail.com |
5b68387a285854b69082a9be0bb4ba31a93984d9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/31/31_a55f62f86b939903fa810b7562415f156ec440a4/SchedulingBuilder/31_a55f62f86b939903fa810b7562415f156ec440a4_SchedulingBuilder_s.java | a7fcb2579c8eec11ff4ffdc9292b84510e4e7167 | [] | 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 | 5,181 | java | package org.icefaces.samples.showcase.example.ace.dataTable;
import entities.Backend;
import entities.Composite;
import entities.Mode;
import entities.Scheduling;
/*
* Builder class for creating a new scheduling.
*/
public class SchedulingBuilder {
private String name;
private boolean javaAgentPollable = false;
private boolean bankHolidayOnly = false;
private Mode mode;
private Composite composite;
private Backend source;
private Backend target;
private String requestURL;
private String cron = "*";
private String description = "";
private int id;
private static final String LINE_BREAK = "\n";
public SchedulingBuilder() {
}
public SchedulingBuilder(Scheduling s) {
this.name = s.getName();
if (s.getJavaAgentPollable() == 1)
this.javaAgentPollable = true;
if (s.getBankHolidayOnly() == 1)
this.bankHolidayOnly = true;
this.mode = SessionBean.MODES.get(s.getStatusID());
this.composite = SessionBean.COMPOSITES.get(s.getServiceID());
this.source = SessionBean.BACKENDS.get(s.getSource());
this.target = SessionBean.BACKENDS.get(s.getTarget());
this.requestURL = s.getRequestURL();
this.cron = s.getCron();
this.description = s.getDescription();
this.id = s.getId();
}
public boolean validate() throws IllegalOperationException {
String message = "";
boolean error = false;
if (this.name == null || this.name.isEmpty()) {
error = true;
message += "Name cannot be empty!" + LINE_BREAK;
}
if (this.mode == null) {
error = true;
message += "Mode was not selected!" + LINE_BREAK;
}
if (this.composite == null) {
error = true;
message += "Composite was not selected!" + LINE_BREAK;
}
if (this.source == null) {
error = true;
message += "Source was not selected!" + LINE_BREAK;
}
if (this.target == null) {
error = true;
message += "Target was not selected!" + LINE_BREAK;
}
if (this.cron == null || this.cron.isEmpty()) {
error = true;
message += "CRON cannot be empty!" + LINE_BREAK;
}
if (this.description == null || this.description.isEmpty()) {
error = true;
message += "Description cannot be empty!" + LINE_BREAK;
}
if (this.source.getBackend() == this.target.getBackend()) {
error = true;
message += "Source cannot be the same as target!" + LINE_BREAK;
}
if (error)
throw new IllegalOperationException(message);
return true;
}
public Scheduling build() throws IllegalOperationException {
this.validate();
Scheduling s = new Scheduling();
s.setName(name);
s.setId(id);
if (this.bankHolidayOnly)
s.setBankHolidayOnly(1);
else
s.setBankHolidayOnly(0);
if (this.javaAgentPollable)
s.setJavaAgentPollable(1);
else
s.setJavaAgentPollable(0);
s.setCron(cron);
s.setDescription(description);
s.setRequestURL(requestURL);
s.setServiceID(this.composite.getId());
s.setStatusID(this.mode.getId());
s.setSource(this.source.getId());
s.setTarget(this.target.getId());
return s;
}
public void sync(Scheduling s) throws IllegalOperationException {
this.validate();
s.setName(name);
s.setId(id);
if (this.bankHolidayOnly)
s.setBankHolidayOnly(1);
else
s.setBankHolidayOnly(0);
if (this.javaAgentPollable)
s.setJavaAgentPollable(1);
else
s.setJavaAgentPollable(0);
s.setCron(cron);
s.setDescription(description);
s.setRequestURL(requestURL);
s.setServiceID(this.composite.getId());
s.setStatusID(this.mode.getId());
s.setSource(this.source.getId());
s.setTarget(this.target.getId());
}
public String getName() {
return name;
}
public String getRequestURL() {
return requestURL;
}
public String getCron() {
return cron;
}
public String getDescription() {
return description;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setCron(String cron) {
this.cron = cron;
}
public void setRequestURL(String requestURL) {
this.requestURL = requestURL;
}
public boolean isJavaAgentPollable() {
return javaAgentPollable;
}
public void setJavaAgentPollable(boolean javaAgentPollable) {
this.javaAgentPollable = javaAgentPollable;
}
public boolean isBankHolidayOnly() {
return bankHolidayOnly;
}
public void setBankHolidayOnly(boolean bankHolidayOnly) {
this.bankHolidayOnly = bankHolidayOnly;
}
public Mode getMode() {
return mode;
}
public void setMode(Mode mode) {
this.mode = mode;
}
public Composite getComposite() {
return composite;
}
public void setComposite(Composite composite) {
this.composite = composite;
}
public Backend getSource() {
return source;
}
public void setSource(Backend source) {
this.source = source;
}
public Backend getTarget() {
return target;
}
public void setTarget(Backend target) {
this.target = target;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
4386afd0dff28fa49ecc5df356163344c391eeb8 | 5daafc7579686424eede1c5f9835c3f7e7b4668f | /niodal/icufangapp/src/main/java/com/example/icufangapp/base/BaseFragment.java | 531e6175221512465782d700ae912ed06a4908cb | [] | no_license | chenzhesheng/android | 2ca84957a34539b52ee0927795dad34b2f9d9153 | 4e98f8828e0c9a8a6f811570ddadf9802fc72f0e | refs/heads/master | 2021-01-20T13:45:00.377028 | 2017-05-15T04:21:31 | 2017-05-15T04:21:31 | 90,524,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,415 | java | package com.example.icufangapp.base;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.example.icufangapp.R;
import com.example.icufangapp.base.utils.LoadingUtils;
import com.lidroid.xutils.ViewUtils;
import com.netframe.core.BaseAction;
import com.netframe.core.Form;
import java.util.Observable;
import java.util.Observer;
/**
* Created by ChenZheSheng on 2016/4/25.
* 说明: ① Fragment v4包的基类,用于与ViewPager相配合
* ② 注解使用xUtils包,即 @ContentView(value = R.layout.xxx) 声明布局
* @ViewInject(value = R.id.xxx) 声明控件
*/
public abstract class BaseFragment extends Fragment implements Observer {
protected Toast toast;
private TextView tvToast;
public Activity context;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(setLayoutId(),container,false);
// ViewUtil.inject(this, super.onCreateView(inflater, container, savedInstanceState));
ViewUtils.inject(this,view);
initView(view);
return view;
}
public abstract int setLayoutId();
@Override
public void update(Observable observable, Object data) {
Form form = (Form) data;
if (form.isSuccess()) {
requestSuccess(form);
} else {
requestFail(form);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
context = activity;
}
/**
* action請求成功後的回調方法,需要重寫
*
* @param form 回調成功後返回的數據,裏面包含請求標識requestType和返回的數據data
*/
public abstract void requestSuccess(Form form);
/**
* 請求失敗後的回調方法,需要重寫
*
*/
public abstract void requestFail(Form form);
/**
* @说明:初始化view
*/
public abstract void initView(View view);
/**
* 顯示loading
*/
public void showLoading() {
LoadingUtils.startLoading(context);
}
/**
* 消除 loading
*/
protected void disLoading() {
LoadingUtils.dismiss();
}
/**
* toast提示信息。
*
* @param message
*/
public void showToast(String message) {
if (toast == null) {
toast = new Toast(getActivity());
View view = LayoutInflater.from(getActivity()).inflate(R.layout.toast_item, null);
tvToast = (TextView) view.findViewById(R.id.tvToast);
tvToast.setText(message);
toast.setView(view);
toast.setDuration(Toast.LENGTH_LONG);
} else
tvToast.setText(message);
toast.show();
}
/**
* 將action與view綁定起來的方法,交由註解綁定,不需要顯式調用
*
* @param action 需要與view綁定的action
* @return 返回綁定是否成功
*/
public boolean setAction(BaseAction action) {
if (action != null) {
action.addObserver(this);
} else {
return false;
}
return true;
}
}
| [
"czsprivatemail@sina.com"
] | czsprivatemail@sina.com |
ab674be534796870a015693d1baf34315f938b8f | bad35a494893a58443fcaaa18a1acdf7522d361c | /Hostel/src/java/bean/Room.java | 5b01220d4207d0fc296f60e567f9510b14d5d9a4 | [] | no_license | limit07065/Hostel | e5879b45f43cc5077470fe704c639842f9fdd5dd | a9326da4c18e0ac14f646342297fc9144a145d92 | refs/heads/master | 2021-01-11T11:40:43.661681 | 2017-01-04T04:21:53 | 2017-01-04T04:21:53 | 76,823,261 | 0 | 1 | null | 2017-01-04T14:01:02 | 2016-12-19T03:03:29 | Java | UTF-8 | Java | false | false | 2,169 | 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 bean;
/**
*
* @author Ryan Hoo
*/
public class Room {
private int room_PK;
private String block;
private String number;
private int gender;
private int roomType;
private int occupied;
private String createdDate;
/**
* @return the room_PK
*/
public int getRoom_PK() {
return room_PK;
}
/**
* @param room_PK the room_PK to set
*/
public void setRoom_PK(int room_PK) {
this.room_PK = room_PK;
}
/**
* @return the block
*/
public String getBlock() {
return block;
}
/**
* @param block the block to set
*/
public void setBlock(String block) {
this.block = block;
}
/**
* @return the number
*/
public String getNumber() {
return number;
}
/**
* @param number the number to set
*/
public void setNumber(String number) {
this.number = number;
}
/**
* @return the gender
*/
public int getGender() {
return gender;
}
/**
* @param gender the gender to set
*/
public void setGender(int gender) {
this.gender = gender;
}
/**
* @return the roomType
*/
public int getRoomType() {
return roomType;
}
/**
* @param roomType the roomType to set
*/
public void setRoomType(int roomType) {
this.roomType = roomType;
}
/**
* @return the occupied
*/
public int getOccupied() {
return occupied;
}
/**
* @param occupied the occupied to set
*/
public void setOccupied(int occupied) {
this.occupied = occupied;
}
/**
* @return the createdDate
*/
public String getCreatedDate() {
return createdDate;
}
/**
* @param createdDate the createdDate to set
*/
public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}
}
| [
"Ryan Hoo"
] | Ryan Hoo |
1fc8c1d349bf9a6b2875b9e0dea38695717e8f2b | 5e92cb0eb90f93af9b8dc62759d021fcc541796a | /src/Solution494.java | dccec3d97177f30481317df2bf4c5d135a5421da | [] | no_license | a5066987/Leetcode | a7803e10397104ac3282af3caa1d043459625e07 | a9ed2b98d16a478319e316bd414de10173b64625 | refs/heads/master | 2021-01-16T18:39:20.134803 | 2017-09-10T13:51:21 | 2017-09-10T13:51:21 | 100,106,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | import java.util.Arrays;
/**
* Created by cuibowu on 2017/8/25.
*/
public class Solution494 {
public int findTargetSumWays(int[] nums, int S) {
if(nums.length==0)
return 0;
int sum = Arrays.stream(nums).sum();
if(S>sum||S<-sum)
return 0;
int[][] dp = new int[nums.length+1][2*sum+1];
dp[0][sum]=1;
for(int i=1;i<nums.length+1;i++){
for(int j =0;j<2*sum+1;j++){
if(j-nums[i-1]>=0){
dp[i][j]+=dp[i-1][j-nums[i-1]];
}
if(j+nums[i-1]<=2*sum){
dp[i][j]+=dp[i-1][j+nums[i-1]];
}
}
}
return dp[nums.length][sum+S];
}
}
| [
"cuibowu@gmail.com"
] | cuibowu@gmail.com |
c651c735956486d01f19f6e4d6d552f141a10763 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_795c7688ff8d2a4bdd402b462317768921bbd257/LShapeSVGGenerator/9_795c7688ff8d2a4bdd402b462317768921bbd257_LShapeSVGGenerator_t.java | 3eea9d1ba08c58491dc01b5faa00dbc4df916119 | [] | 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 | 40,014 | java | package net.sf.latexdraw.generators.svg;
import static java.lang.Math.PI;
import static java.lang.Math.toDegrees;
import java.awt.Color;
import java.awt.geom.Point2D;
import java.text.ParseException;
import net.sf.latexdraw.badaboom.BadaboomCollector;
import net.sf.latexdraw.glib.models.interfaces.*;
import net.sf.latexdraw.glib.models.interfaces.IArrow.ArrowStyle;
import net.sf.latexdraw.glib.models.interfaces.IShape.BorderPos;
import net.sf.latexdraw.glib.models.interfaces.IShape.FillingStyle;
import net.sf.latexdraw.glib.models.interfaces.IShape.LineStyle;
import net.sf.latexdraw.glib.views.pst.PSTricksConstants;
import net.sf.latexdraw.parsers.svg.*;
import net.sf.latexdraw.parsers.svg.parsers.SVGLengthParser;
import net.sf.latexdraw.parsers.svg.parsers.URIReferenceParser;
import net.sf.latexdraw.parsers.svg.path.SVGPathSegLineto;
import net.sf.latexdraw.parsers.svg.path.SVGPathSegList;
import net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto;
import net.sf.latexdraw.util.LNamespace;
import net.sf.latexdraw.util.LNumber;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* This class allows the generation or the importation of SVG parameters to a general LaTeXDraw shape.<br>
*<br>
* This file is part of LaTeXDraw.<br>
* Copyright (c) 2005-2013 Arnaud BLOUIN<br>
*<br>
* LaTeXDraw is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.<br>
*<br>
* LaTeXDraw is distributed without any warranty; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.<br>
*<br>
* 05/30/10<br>
* @author Arnaud BLOUIN
* @version 3.0
*/
abstract class LShapeSVGGenerator<S extends IShape> {
/** The shape model use for the generation. */
protected S shape;
/** The beginning of the token used to declare a URL in an SVG document. */
protected static final String SVG_URL_TOKEN_BEGIN = "url(#"; //$NON-NLS-1$
/**
* Creates the SVG generator.
* @param sh The shape used for the generation.
* @throws IllegalArgumentException If the given shape is null.
* @since 2.0
*/
protected LShapeSVGGenerator(final S sh) {
if(sh==null)
throw new IllegalArgumentException();
shape = sh;
}
/**
* @return The SVG ID of the shape (starting with the token "id" followed by the number of the shape).
* @since 2.0.0
*/
public String getSVGID() {
return "id" + shape.getId(); //$NON-NLS-1$
}
/**
* Sets the ID of the figure according to the ID attribute of the SVGGElement, or an increment of meter if a problem occur.
* @param g The SVGGElement.
* @since 2.0.0
*/
public void setNumber(final SVGGElement g) {
if(g==null)
return;
final String nb = g.getAttribute(g.getUsablePrefix()+SVGAttributes.SVG_ID);
final String pref = "id"; //$NON-NLS-1$
if(nb==null)
shape.setNewId();
else
try{ shape.setId((int)Double.parseDouble(nb)); }
catch(final NumberFormatException e) {
if(nb.startsWith(pref))
try { shape.setId((int)Double.parseDouble(nb.substring(pref.length()))); }
catch(final NumberFormatException e2) { shape.setNewId(); }
else
shape.setNewId();
}
}
/**
* Applies the set of transformations that concerned the given SVG element to the shape.
* @param elt The element that contains the SVG transformation list.
* @since 2.0.0
*/
public void applyTransformations(final SVGElement elt) {
if(elt==null)
return ;
// The list of the transformations that are applied on the element.
SVGTransformList tl = elt.getWholeTransform();
for(int i = tl.size()-1; i>=0; i--)
applyTransformation(tl.get(i));
}
/**
* Applies an SVG transformation on the shape.
* @param t The SVG transformation to apply.
* @since 2.0.0
*/
public void applyTransformation(final SVGTransform t) {
if(t!=null)
switch(t.getType()) {
case SVGTransform.SVG_TRANSFORM_ROTATE:
getShape().rotate(DrawingTK.getFactory().createPoint(t.getMatrix().getE(), t.getMatrix().getF()), Math.toRadians(t.getRotationAngle()));
break;
case SVGTransform.SVG_TRANSFORM_SCALE:
break;
case SVGTransform.SVG_TRANSFORM_TRANSLATE:
getShape().translate(t.getTX(), t.getTY());
break;
default:
BadaboomCollector.INSTANCE.add(new IllegalArgumentException("Bad transformation type: " + t.getType())); //$NON-NLS-1$
}
}
/**
* When the arrows are read from an SVG document, we need to set the parameters of the first
* arrow to the second arrow and vise et versa; because the arrows of a shape share the same
* parameters. This method carries out this job.
* @param ah1 The first arrow.
* @param ah2 The second arrow.
* @since 2.0.0
*/
public void homogeniseArrows(final IArrow ah1, final IArrow ah2) {
if(ah1==null || ah2==null)
return ;
homogeniseArrowFrom(ah1, ah2);
homogeniseArrowFrom(ah2, ah1);
}
protected void setSVGArrow(final SVGElement parent, final int arrowPos, final boolean isShadow, final SVGDocument doc, final SVGDefsElement defs) {
final IArrow arrow = shape.getArrowAt(arrowPos);
if(arrow.getArrowStyle()!=ArrowStyle.NONE) {
String arrowName = "arrow" + arrowPos + (isShadow ? "Shad-" : "-") + shape.getId();
SVGElement arrowSVG = new LArrowSVGGenerator(arrow).toSVG(doc, isShadow);
arrowSVG.setAttribute(SVGAttributes.SVG_ID, arrowName);
defs.appendChild(arrowSVG);
parent.setAttribute(arrowPos==0 ? SVGAttributes.SVG_MARKER_START : SVGAttributes.SVG_MARKER_END, SVG_URL_TOKEN_BEGIN + arrowName + ')');
}
}
/**
* Copies the parameters of the first arrow to the second arrow (only
* the parameters of the current style are copied).
* @see #homogeniseArrows(IArrow, IArrow)
* @param source The arrow that will be copied.
* @param target The arrow that will be set.
* @since 2.0.0
*/
protected void homogeniseArrowFrom(final IArrow source, final IArrow target) {
if(source==null || target==null)
return ;
final ArrowStyle style = source.getArrowStyle();
if(style!=null && style!=ArrowStyle.NONE)
if(style.isBar()) {
target.setTBarSizeDim(source.getTBarSizeDim());
target.setTBarSizeNum(source.getTBarSizeNum());
} else if(style.isArrow()) {
target.setArrowInset(source.getArrowInset());
target.setArrowLength(source.getArrowLength());
target.setArrowSizeDim(source.getArrowSizeDim());
target.setArrowSizeNum(target.getArrowSizeNum());
} else if(style.isRoundBracket()) {
target.setRBracketNum(source.getRBracketNum());
target.setTBarSizeDim(source.getTBarSizeDim());
target.setTBarSizeNum(source.getTBarSizeNum());
} else if(style.isSquareBracket()) {
target.setBracketNum(source.getBracketNum());
target.setTBarSizeDim(source.getTBarSizeDim());
target.setTBarSizeNum(source.getTBarSizeNum());
} else {
target.setDotSizeDim(source.getDotSizeDim());
target.setDotSizeNum(source.getDotSizeNum());
}
}
/**
* Sets the shadow parameters of the figure by using an SVG element having "type:shadow".
* @param elt The source element.
* @since 2.0.0
*/
protected void setSVGShadowParameters(final SVGElement elt) {
if(elt==null || !shape.isShadowable())
return ;
final String fill = elt.getFill();
if(fill!=null && !fill.equals(SVGAttributes.SVG_VALUE_NONE) && !fill.startsWith(SVG_URL_TOKEN_BEGIN))
shape.setShadowCol(CSSColors.INSTANCE.getRGBColour(fill));
final SVGTransformList tl = elt.getTransform();
SVGTransform t;
double tx, ty;
boolean sSize = false, sAngle = false;
for(int i=0, size=tl.size(); i<size && (!sSize || !sAngle); i++ ) {
t = tl.get(i);
if(t.isTranslation()) {
tx = t.getTX();
ty = t.getTY();
if(LNumber.INSTANCE.equals(ty, 0.) && !sSize) { // It is shadowSize.
shape.setShadowSize(tx);
sSize = true;
}
else {
final IPoint gravityCenter = shape.getGravityCentre();
double angle = Double.NaN;
double shSize = shape.getShadowSize();
if(LNumber.INSTANCE.equals(ty, 0.))
angle = tx<0. ? Math.PI : 0.;
else
if(LNumber.INSTANCE.equals(shSize, Math.abs(tx)))
angle = ty>0. ? -Math.PI/2. : Math.PI/2.;
else {
angle = Math.acos(gravityCenter.distance(gravityCenter.getX()+tx+shSize, gravityCenter.getY())/
gravityCenter.distance(gravityCenter.getX()+tx+shSize, gravityCenter.getY()+ty));
if(tx+shSize<0) {
if(ty<0.)
angle = Math.PI - angle;
else
angle += Math.PI;
}
else
if(ty>0.)
angle *= -1;
}
shape.setShadowAngle(angle);
sAngle = true;
}
}
}
shape.setHasShadow(true);
}
/**
* Sets the double borders parameters of the figure by using an SVG element.
* @param elt The SVG element.
* @since 2.0.0
*/
protected void setSVGDbleBordersParameters(final SVGElement elt) {
if(elt==null)
return ;
shape.setDbleBordSep(elt.getStrokeWidth());
shape.setDbleBordCol(elt.getStroke());
shape.setThickness((shape.getThickness()-shape.getDbleBordSep())/2.);
shape.setHasDbleBord(true);
}
protected void setSVGLatexdrawParameters(final SVGElement elt) {
if(elt==null)
return ;
if(shape.isBordersMovable()) {
final String bp = elt.getAttribute(elt.getUsablePrefix(LNamespace.LATEXDRAW_NAMESPACE_URI)+LNamespace.XML_BORDERS_POS);
if(bp!=null)
shape.setBordersPosition(BorderPos.getStyle(bp));
}
}
/**
* Sets the global parameters of the figure by using an SVG element.
* @param elt The SVG element.
* @since 2.0.0
*/
protected void setSVGParameters(final SVGElement elt) {
if(elt==null)
return ;
if(shape.isThicknessable())
shape.setThickness(elt.getStrokeWidth());
if(shape.isBordersMovable()) {
final String bp = elt.getAttribute(elt.getUsablePrefix(LNamespace.LATEXDRAW_NAMESPACE_URI)+LNamespace.XML_BORDERS_POS);
if(bp!=null)
shape.setBordersPosition(BorderPos.getStyle(bp));
}
shape.setLineColour(elt.getStroke());
if(shape.isLineStylable())
LShapeSVGGenerator.setDashedDotted(shape, elt.getStrokeDasharray(), elt.getStrokeLinecap());
if(shape.isFillable())
LShapeSVGGenerator.setFill(shape, elt.getFill(), elt.getSVGRoot().getDefs());
CSSStylesGenerator.INSTANCE.setCSSStyles(shape, elt.getStylesCSS(), elt.getSVGRoot().getDefs());
}
/**
* Sets the given arrow head using the SVG arrow with the ID arrowID
* @param ah The arrow head to set.
* @param arrowID The SVG ID of the SVG arrow head.
* @param elt An element of the SVG document (useful to get the defs of the document).
* @since 2.0.0
*/
protected void setSVGArrow(final IArrow ah, final String arrowID, final SVGElement elt) {
if(ah==null || arrowID==null || elt==null)
return ;
final LArrowSVGGenerator arrGen = new LArrowSVGGenerator(ah);
arrGen.setArrow((SVGMarkerElement)elt.getDef(new URIReferenceParser(arrowID).getURI()), getShape());
}
/**
* @param elt The source <code>g</code> element.
* @param type The type of the latexdraw element (double borders, shadow, main), if null, the main element is returned.
* @return The Researched element.
* @since 2.0.0
*/
protected SVGElement getLaTeXDrawElement(final SVGGElement elt, final String type) {
if(elt==null)
return null;
final NodeList nl = elt.getChildNodes();
int i = 0;
final int size = nl.getLength();
Node ltdElt = null;
Node n;
final String bis = elt.lookupPrefixUsable(LNamespace.LATEXDRAW_NAMESPACE_URI);
if(type==null)
while(i<size && ltdElt==null) {
n = nl.item(i);
if(((SVGElement)n).getAttribute(bis+LNamespace.XML_TYPE)==null)
ltdElt = n;
else
i++;
}
else
while(i<size && ltdElt==null) {
n = nl.item(i);
if(type.equals(((SVGElement)n).getAttribute(bis+LNamespace.XML_TYPE)))
ltdElt = n;
else
i++;
}
return (SVGElement)ltdElt;
}
/**
* Sets the thickness of the given figure with the given SVG stroke-width.
* @param shape The figure to set.
* @param strokeWidth The SVG stroke-width to convert.
* @param stroke The stroke.
* @since 2.0.0
*/
public static void setThickness(final IShape shape, final String strokeWidth, final String stroke) {
if(shape==null || strokeWidth==null)
return;
if(stroke==null || !stroke.equals(SVGAttributes.SVG_VALUE_NONE))
try{ shape.setThickness(new SVGLengthParser(strokeWidth).parseLength().getValue()); }
catch(final ParseException e){ BadaboomCollector.INSTANCE.add(e); }
}
/**
* Creates an SVG element from the current latexdraw shape.
* @param doc The SVG document.
* @return The created SVGElement or null.
* @since 2.0.0
*/
public abstract SVGElement toSVG(final SVGDocument doc);
/**
* @param elt Rotates the SVG element.
* @exception IllegalArgumentException If elt is null.
* @since 2.0.0
*/
protected void setSVGRotationAttribute(final Element elt) {
if(elt==null)
throw new IllegalArgumentException();
final double rotationAngle = shape.getRotationAngle();
final IPoint gravityCenter = shape.getGravityCentre();
if(!LNumber.INSTANCE.equals(rotationAngle%(2*PI), 0.)) {
final double gcx = gravityCenter.getX();
final double gcy = gravityCenter.getY();
final double x = -Math.cos(-rotationAngle) * gcx + Math.sin(-rotationAngle) * gcy + gcx;
final double y = -Math.sin(-rotationAngle) * gcx - Math.cos(-rotationAngle) * gcy + gcy;
String transfo = elt.getAttribute(SVGAttributes.SVG_TRANSFORM);
final String rotation = SVGTransform.createRotation(toDegrees(rotationAngle), 0., 0.) + " " +//$NON-NLS-1$
SVGTransform.createTranslation(-x, -y);
if(transfo!=null && transfo.length()>0)
transfo = rotation + " " + transfo; //$NON-NLS-1$
else
transfo = rotation;
elt.setAttribute(SVGAttributes.SVG_TRANSFORM, transfo);
}
}
/**
* Sets the double borders parameters to the given SVG element if the current figure has double borders.
* @param elt The element to set.
* @exception IllegalArgumentException If elt is null.
* @since 2.0.0
*/
protected void setSVGDoubleBordersAttributes(final Element elt) {
if(elt==null)
throw new IllegalArgumentException();
if(shape.hasDbleBord()) {
elt.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.INSTANCE.getColorName(shape.getDbleBordCol(), true));
elt.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(shape.getDbleBordSep()));
elt.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE);
elt.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_DBLE_BORDERS);
}
}
/**
*
* @param elt The element to set if the current figure has a shadow.
* @param shadowFills True if a shadow must fill the figure.
* @exception IllegalArgumentException If elt is null.
* @since 2.0.0
*/
protected void setSVGShadowAttributes(final Element elt, final boolean shadowFills) {
if(elt==null)
throw new IllegalArgumentException();
if(shape.hasShadow()) {
final IPoint gravityCenter = shape.getGravityCentre();
final double gcx = gravityCenter.getX();
final double gcy = gravityCenter.getY();
IPoint pt = DrawingTK.getFactory().createPoint(
gcx+shape.getShadowSize(), gcy).rotatePoint(shape.getGravityCentre(), -shape.getShadowAngle());
elt.setAttribute(SVGAttributes.SVG_TRANSFORM,
SVGTransform.createTranslation(shape.getShadowSize(), 0.) + " " + //$NON-NLS-1$
SVGTransform.createTranslation(pt.getX()-gcx-shape.getShadowSize(), pt.getY()-gcy));
elt.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(shape.hasDbleBord() ?
shape.getThickness()*2+shape.getDbleBordSep() : shape.getThickness()));
elt.setAttribute(SVGAttributes.SVG_FILL, shadowFills || shape.isFilled() ? CSSColors.INSTANCE.getColorName(shape.getShadowCol(), true) : SVGAttributes.SVG_VALUE_NONE);
elt.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.INSTANCE.getColorName(shape.getShadowCol(), true));
elt.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_SHADOW);
}
}
/**
* Sets the SVG attribute of the current figure.
* @param doc The original document with which, all the elements will be created.
* @param root The root element of the document.
* @param shadowFills True if a shadow must fill the figure.
* @throws IllegalArgumentException If the root or the "defs" part of the document is null.
* @since 2.0.0
*/
protected void setSVGAttributes(final SVGDocument doc, final SVGElement root, final boolean shadowFills) {
if(root==null || doc.getFirstChild().getDefs()==null)
throw new IllegalArgumentException();
final SVGDefsElement defs = doc.getFirstChild().getDefs();
final FillingStyle fillStyle= shape.getFillingStyle();
// Setting the position of the borders.
if(shape.isBordersMovable())
root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE +':'+ LNamespace.XML_BORDERS_POS, shape.getBordersPosition().getLatexToken());
// Setting the thickness of the borders.
if(shape.isThicknessable()) {
LShapeSVGGenerator.setThickness(root, shape.getThickness(), shape.hasDbleBord(), shape.getDbleBordSep());
root.setStroke(shape.getLineColour());
}
// Setting the filling properties.
if(shape.isFillable())
if((shape.isFilled() || (shape.hasShadow() && shadowFills)) && !shape.hasHatchings() && !shape.hasGradient())
root.setAttribute(SVGAttributes.SVG_FILL, CSSColors.INSTANCE.getColorName(shape.getFillingCol(), true));
else
// Setting the filling colour.
if(fillStyle==FillingStyle.NONE)
root.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE);
else
// Setting the gradient properties.
if(fillStyle==FillingStyle.GRAD) {
final SVGElement grad = new SVGLinearGradientElement(doc);
SVGStopElement stop;
final String id = SVGElements.SVG_LINEAR_GRADIENT + shape.getId();
final double gradMidPt = shape.getGradAngle()>PI || (shape.getGradMidPt()<0 && shape.getGradMidPt()>-PI)?
1-shape.getGradMidPt() : shape.getGradMidPt();
grad.setAttribute(SVGAttributes.SVG_ID, id);
if(!LNumber.INSTANCE.equals(shape.getGradAngle()%(2*PI), PI/2.)) {
final Point2D.Float p1 = new Point2D.Float(), p2 = new Point2D.Float();
getGradientPoints(p1, p2, true);
grad.setAttribute(SVGAttributes.SVG_X1, String.valueOf(p1.x));
grad.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(p1.y));
grad.setAttribute(SVGAttributes.SVG_X2, String.valueOf(p2.x));
grad.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(p2.y));
grad.setAttribute(SVGAttributes.SVG_GRADIENT_UNITS, SVGAttributes.SVG_UNITS_VALUE_USR);
}
// Setting the middle point of the gradient and its colours.
if(!LNumber.INSTANCE.equals(gradMidPt, 0.)) {
stop = new SVGStopElement(doc);
stop.setAttribute(SVGAttributes.SVG_OFFSET, "0");//$NON-NLS-1$
stop.setAttribute(SVGAttributes.SVG_STOP_COLOR, CSSColors.INSTANCE.getColorName(shape.getGradColStart(), true));
grad.appendChild(stop);
}
stop = new SVGStopElement(doc);
stop.setAttribute(SVGAttributes.SVG_OFFSET, String.valueOf(gradMidPt));
stop.setAttribute(SVGAttributes.SVG_STOP_COLOR, CSSColors.INSTANCE.getColorName(shape.getGradColEnd(), true));
grad.appendChild(stop);
if(!LNumber.INSTANCE.equals(gradMidPt, 1.)) {
stop = new SVGStopElement(doc);
stop.setAttribute(SVGAttributes.SVG_OFFSET, "1");//$NON-NLS-1$
stop.setAttribute(SVGAttributes.SVG_STOP_COLOR, CSSColors.INSTANCE.getColorName(shape.getGradColStart(), true));
grad.appendChild(stop);
}
defs.appendChild(grad);
root.setAttribute(SVGAttributes.SVG_FILL, SVG_URL_TOKEN_BEGIN + id + ')');
}
else {
// Setting the hatchings.
if(shape.hasHatchings()) {
final String id = SVGElements.SVG_PATTERN + shape.getId();
final SVGPatternElement hatch = new SVGPatternElement(doc);
final SVGGElement gPath = new SVGGElement(doc);
final IPoint max = shape.getFullBottomRightPoint();
final SVGPathElement path = new SVGPathElement(doc);
root.setAttribute(SVGAttributes.SVG_FILL, SVG_URL_TOKEN_BEGIN + id + ')');
hatch.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, shape.getFillingStyle().getLatexToken());
hatch.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_ROTATION, String.valueOf(shape.getHatchingsAngle()));
hatch.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_SIZE, String.valueOf(shape.getHatchingsSep()));
hatch.setAttribute(SVGAttributes.SVG_PATTERN_UNITS, SVGAttributes.SVG_UNITS_VALUE_USR);
hatch.setAttribute(SVGAttributes.SVG_ID, id);
hatch.setAttribute(SVGAttributes.SVG_X, "0"); //$NON-NLS-1$
hatch.setAttribute(SVGAttributes.SVG_Y, "0"); //$NON-NLS-1$
hatch.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf((int)max.getX()));
hatch.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf((int)max.getY()));
gPath.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.INSTANCE.getColorName(shape.getHatchingsCol(), true));
gPath.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(shape.getHatchingsWidth()));
gPath.setAttribute(SVGAttributes.SVG_STROKE_DASHARRAY, SVGAttributes.SVG_VALUE_NONE);
path.setAttribute(SVGAttributes.SVG_D, getSVGHatchingsPath().toString());
gPath.appendChild(path);
// Several shapes having hatching must have their shadow filled.
if(shape.isFilled() || (shape.hasShadow() && shadowFills)) {
SVGRectElement fill = new SVGRectElement(doc);
fill.setAttribute(SVGAttributes.SVG_FILL, CSSColors.INSTANCE.getColorName(shape.getFillingCol(), true));
fill.setAttribute(SVGAttributes.SVG_STROKE, SVGAttributes.SVG_VALUE_NONE);
fill.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf((int)max.getX()));
fill.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf((int)max.getY()));
hatch.appendChild(fill);
}
defs.appendChild(hatch);
hatch.appendChild(gPath);
}
}//else
if(shape.isLineStylable())
LShapeSVGGenerator.setDashedDotted(root, shape.getDashSepBlack(), shape.getDashSepWhite(), shape.getDotSep(),
shape.getLineStyle().getLatexToken(), shape.hasDbleBord(), shape.getThickness(), shape.getDbleBordSep());
}
/**
* @return The path of the hatchings of the shape.
* @since 2.0.0
*/
public SVGPathSegList getSVGHatchingsPath() {
final SVGPathSegList path = new SVGPathSegList();
if(!shape.hasHatchings())
return path;
final String hatchingStyle = shape.getFillingStyle().getLatexToken();
final double hatchingAngle = shape.getHatchingsAngle();
final IRectangle bound = DrawingTK.getFactory().createRectangle(shape.getFullTopLeftPoint(), shape.getFullBottomRightPoint(), false);
if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES) ||
hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES_F))
getSVGHatchingsPath2(path, hatchingAngle, bound);
else
if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES) ||
hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES_F))
getSVGHatchingsPath2(path, hatchingAngle>0?hatchingAngle-Math.PI/2.:hatchingAngle+Math.PI/2., bound);
else
if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH) ||
hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F)) {
getSVGHatchingsPath2(path, hatchingAngle, bound);
getSVGHatchingsPath2(path, hatchingAngle>0?hatchingAngle-Math.PI/2.:hatchingAngle+Math.PI/2., bound);
}
return path;
}
/**
* @see LShapeSVGGenerator#getSVGHatchingsPath()
*/
private void getSVGHatchingsPath2(final SVGPathSegList path, final double hAngle, final IRectangle bound) {
if(path==null || bound==null)
return;
double angle2 = hAngle%(Math.PI*2.);
final double halphPI = Math.PI/2.;
final double hatchingWidth = shape.getHatchingsWidth();
final double hatchingSep = shape.getHatchingsSep();
final IPoint nw = bound.getTopLeftPoint();
final IPoint se = bound.getBottomRightPoint();
final double nwx = nw.getX();
final double nwy = nw.getY();
final double sex = se.getX();
final double sey = se.getY();
// Computing the angle.
if(angle2>0.) {
if(angle2>3.*halphPI)
angle2 = angle2-Math.PI*2.;
else
if(angle2>halphPI)
angle2 = angle2-Math.PI;
}
else
if(angle2<-3.*halphPI)
angle2 = angle2+Math.PI*2.;
else
if(angle2<-halphPI)
angle2 = angle2+Math.PI;
final double val = hatchingWidth+hatchingSep;
if(LNumber.INSTANCE.equals(angle2, 0.))
// Drawing the hatchings vertically.
for(double x = nwx; x<sex; x+=val) {
path.add(new SVGPathSegMoveto(x, nwy, false));
path.add(new SVGPathSegLineto(x, sey, false));
}
else
// Drawing the hatchings horizontally.
if(LNumber.INSTANCE.equals(angle2, halphPI) || LNumber.INSTANCE.equals(angle2, -halphPI))
for(double y = nwy; y<sey; y+=val) {
path.add(new SVGPathSegMoveto(nwx, y, false));
path.add(new SVGPathSegLineto(sex, y, false));
}
else {
// Drawing the hatchings by rotation.
final double incX = val/Math.cos(angle2);
final double incY = val/Math.sin(angle2);
double maxX;
double y1, x2, y2, x1;
if(angle2>0.) {
y1 = nwy;
maxX = sex + (sey-(nwy<0?nwy:0)) * Math.tan(angle2);
}
else {
y1 = sey;
maxX = sex - sey * Math.tan(angle2);
}
x1 = nwx;
x2 = x1;
y2 = y1;
if(incX<0. || LNumber.INSTANCE.equals(incX, 0.))
return ;
while(x2 < maxX) {
x2 += incX;
y1 += incY;
path.add(new SVGPathSegMoveto(x1, y1, false));
path.add(new SVGPathSegLineto(x2, y2, false));
}
}
}
/**
* Gets the points needed to the gradient definition. The given points must not be null, there value will be set in the method.
* @param p1 The first point to set.
* @param p2 The second point to set.
* @param ignoreMidPt True, gradientMidPt will be ignored.
* @throws IllegalArgumentException If p1 or p2 is null.
* @since 2.0.0
*/
protected void getGradientPoints(final Point2D.Float p1, final Point2D.Float p2, final boolean ignoreMidPt) {
if(p1==null || p2==null)
throw new IllegalArgumentException();
try {
final IShapeFactory factory = DrawingTK.getFactory();
final IPoint nw = shape.getTopLeftPoint();
final IPoint se = shape.getBottomRightPoint();
final double nwx = nw.getX();
final double nwy = nw.getY();
final double sex = se.getX();
final double sey = se.getY();
IPoint pt1 = factory.createPoint((nwx+sex)/2., nwy);
IPoint pt2 = factory.createPoint((nwx+sex)/2., sey);
double angle = shape.getGradAngle()%(2*PI);
double gradMidPt = shape.getGradMidPt();
// Transforming the negative angle in a positive angle.
if(angle<0.)
angle = 2*PI + angle;
if(angle>PI || LNumber.INSTANCE.equals(angle, PI)) {
gradMidPt = 1 - shape.getGradMidPt();
angle = angle-PI;
}
if(!LNumber.INSTANCE.equals(angle, 0.)) {
if(LNumber.INSTANCE.equals(angle%(PI/2.), 0.)) {
// The gradient is horizontal.
pt1 = factory.createPoint(nwx, (nwy+sey)/2.);
pt2 = factory.createPoint(sex, (nwy+sey)/2.);
if(!ignoreMidPt && gradMidPt<0.5)
pt1.setX(pt2.getX() - Point2D.distance(pt2.getX(), pt2.getY(), sex,(nwy+sey)/2.));
pt2.setX(nwx+(sex-nwx)*(ignoreMidPt ? 1 : gradMidPt));
}
else {
IPoint cg = shape.getGravityCentre();
ILine l2, l;
pt1 = pt1.rotatePoint(cg, -angle);
pt2 = pt2.rotatePoint(cg, -angle);
l = factory.createLine(pt1, pt2);
if(LNumber.INSTANCE.equals(angle, 0.) && angle>0. && angle<(PI/2.))
l2 = l.getPerpendicularLine(nw);
else l2 = l.getPerpendicularLine(factory.createPoint(nwx,sey));
pt1 = l.getIntersection(l2);
double distance = Point2D.distance(cg.getX(), cg.getY(), pt1.getX(), pt1.getY());
l.setP1(pt1);
IPoint[] pts = l.findPoints(pt1, 2*distance*(ignoreMidPt ? 1 : gradMidPt));
pt2 = pts[0];
if(!ignoreMidPt && gradMidPt<0.5)
pt1 = pt1.rotatePoint(cg, PI);
}
}//if(angle!=0)
else {
// The gradient is vertical.
if(!ignoreMidPt && gradMidPt<0.5)
pt1.setY(pt2.getY() - Point2D.distance(pt2.getX(), pt2.getY(), (nwx+sex)/2.,se.getY()));
pt2.setY(nwy+(sey-nwy)*(ignoreMidPt ? 1 : gradMidPt));
}
p1.setLocation(pt1.getX(), pt1.getY());
p2.setLocation(pt2.getX(), pt2.getY());
}catch(final Exception e) {
p1.setLocation(0f, 0f);
p2.setLocation(0f, 0f);
}
}
/**
* Sets the colour of the line of the shape with the given SVG stroke.
* @param shape The shape to set.
* @param stoke The stroke of the shape.
* @since 2.0.0
*/
public static void setLineColour(final IShape shape, final String stoke) {
if(shape!=null && stoke!=null)
shape.setLineColour(CSSColors.INSTANCE.getRGBColour(stoke));
}
/**
* Sets the fill properties to the given figure.
* @param shape The figure to set.
* @param fill The fill properties
* @param defs The definition that may be useful to the the fill properties (url), may be null.
* @since 2.0.0
*/
public static void setFill(final IShape shape, final String fill, final SVGDefsElement defs) {
if(fill==null || shape==null || fill.equals(SVGAttributes.SVG_VALUE_NONE))
return ;
// Getting the url to the SVG symbol of the filling.
if(fill.startsWith(SVG_URL_TOKEN_BEGIN) && fill.endsWith(")") && defs!=null) { //$NON-NLS-1$
final String uri = fill.substring(5, fill.length()-1);
final SVGElement def = defs.getDef(uri);
// A pattern means hatchings.
if(def instanceof SVGPatternElement) {
final SVGPatternElement pat = (SVGPatternElement)def;
final Color c = pat.getBackgroundColor();
final String str = pat.getAttribute(pat.getUsablePrefix(LNamespace.LATEXDRAW_NAMESPACE_URI)+LNamespace.XML_TYPE);
double angle;
double sep;
double width;
String attr;
try { angle = Double.parseDouble(pat.getAttribute(pat.getUsablePrefix(LNamespace.LATEXDRAW_NAMESPACE_URI)+ LNamespace.XML_ROTATION));
}catch(final Exception e) { angle = 0.; }
attr = pat.getAttribute(pat.getUsablePrefix(LNamespace.LATEXDRAW_NAMESPACE_URI)+LNamespace.XML_SIZE);
if(attr==null)
sep = pat.getHatchingSep();
else
try { sep = Double.parseDouble(attr); }
catch(final Exception e) { sep = 0.; }
if(PSTricksConstants.isValidFillStyle(str))
shape.setFillingStyle(FillingStyle.getStyleFromLatex(str));
if(!Double.isNaN(angle))
shape.setHatchingsAngle(angle);
shape.setFilled(c!=null);
shape.setFillingCol(c);
shape.setHatchingsCol(pat.getHatchingColor());
if(!Double.isNaN(sep))
shape.setHatchingsSep(sep);
width = pat.getHatchingStrokeWidth();
if(!Double.isNaN(width))
shape.setHatchingsWidth(width);
}
else
// A linear gradient means a gradient.
if(def instanceof SVGLinearGradientElement) {
final SVGLinearGradientElement grad = (SVGLinearGradientElement)def;
shape.setGradColStart(grad.getStartColor());
shape.setGradColEnd(grad.getEndColor());
shape.setFillingStyle(FillingStyle.getStyle(PSTricksConstants.TOKEN_FILL_GRADIENT));
shape.setGradMidPt(grad.getMiddlePoint());
shape.setGradAngle(grad.getAngle());
}
}
else {
// Just getting the filling colour.
final Color c = CSSColors.INSTANCE.getRGBColour(fill);
if(c!=null) {
shape.setFillingCol(c);
shape.setFilled(true);
}
}
}
/**
* Sets the figure properties concerning the line properties.
* @param shape The figure to set.
* @param dashArray The dash array SVG property.
* @param linecap The line cap SVG property.
* @since 2.0.0
*/
public static void setDashedDotted(final IShape shape, final String dashArray, final String linecap) {
if(shape==null || dashArray==null)
return ;
if(!dashArray.equals(SVGAttributes.SVG_VALUE_NONE))
if(linecap!=null && SVGAttributes.SVG_LINECAP_VALUE_ROUND.equals(linecap))
shape.setLineStyle(LineStyle.DOTTED);
else
shape.setLineStyle(LineStyle.DASHED);
}
/**
* Sets the given thickness to the given SVG element.
* @param elt The element to set.
* @param thickness The thickness to set.
* @param hasDoubleBorders True: the shape has double borders and it must be considered during the computation of the thickness.
* @param doubleSep The size of the double borders.
* @since 3.0
*/
public static void setThickness(final SVGElement elt, final double thickness, final boolean hasDoubleBorders, final double doubleSep) {
if(elt==null)
return ;
elt.setStrokeWidth(hasDoubleBorders ? thickness*2. + doubleSep : thickness);
}
/**
* Sets the line style to the given SVG element.
* @param elt The element to set.
* @param blackDash The black dash of the line for dashed line style.
* @param whiteDash The white dash of the line for dashed line style.
* @param dotSep The separation between dots for dotted line style.
* @param lineStyle The line style to set to the SVG element.
* @param hasDoubleBorders True: the shape has double borders.
* @param thickness The thickness to set to the element.
* @param doubleSep The size of the double borders.
* @since 3.0
*/
public static void setDashedDotted(final Element elt, final double blackDash, final double whiteDash, final double dotSep, final String lineStyle,
final boolean hasDoubleBorders, final double thickness, final double doubleSep) {
if(elt==null)
return ;
if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE))
elt.setAttribute(SVGAttributes.SVG_STROKE_DASHARRAY, blackDash + ", " + whiteDash);//$NON-NLS-1$
else
if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) {
elt.setAttribute(SVGAttributes.SVG_STROKE_LINECAP, SVGAttributes.SVG_LINECAP_VALUE_ROUND);
elt.setAttribute(SVGAttributes.SVG_STROKE_DASHARRAY, 1 + ", " + //$NON-NLS-1$
(dotSep + (hasDoubleBorders ? thickness*2f + doubleSep : thickness)));
}
}
/**
* If a figure can move its border, we have to compute the difference between the PSTricks shape and the SVG shape.
* @return The gap computed with the border position, the thickness and the double boundary. Or NaN if the shape cannot move
* its border.
* @since 2.0.0
*/
protected double getPositionGap() {
double gap;
if(!shape.isBordersMovable() || shape.getBordersPosition().getLatexToken().equals(PSTricksConstants.BORDERS_MIDDLE))
gap = 0.;
else
if(shape.getBordersPosition().getLatexToken().equals(PSTricksConstants.BORDERS_INSIDE))
gap = -shape.getThickness() - (shape.hasDbleBord() ? shape.getDbleBordSep() + shape.getThickness() : 0.) ;
else
gap = shape.getThickness() + (shape.hasDbleBord() ? shape.getDbleBordSep() + shape.getThickness() : 0.);
return gap;
}
/**
* Creates a line with the style of the 'show points' option.
* @param doc The document owner.
* @param thickness The thickness of the line to create.
* @param col The colour of the line.
* @param p1 The first point of the line.
* @param p2 The second point of the line.
* @param blackDash The black dash interval.
* @param whiteDash The white dash interval.
* @param hasDble Defines if the shape had double borders.
* @param dotSep The dot interval.
* @return The created SVG line or null.
* @since 2.0.0
*/
protected static SVGLineElement getShowPointsLine(final SVGDocument doc, final double thickness, final Color col,
final IPoint p1, final IPoint p2, final double blackDash, final double whiteDash,
final boolean hasDble, final double dotSep, final double doubleSep) {
if(doc==null)
return null;
final SVGLineElement line = new SVGLineElement(doc);
if(p1!=null) {
line.setX1(p1.getX());
line.setY1(p1.getY());
}
if(p2!=null) {
line.setX2(p2.getX());
line.setY2(p2.getY());
}
line.setStrokeWidth(thickness);
line.setStroke(col);
LShapeSVGGenerator.setDashedDotted(line, blackDash, whiteDash, dotSep,
PSTricksConstants.LINE_DASHED_STYLE, hasDble, thickness, doubleSep);
return line;
}
/**
* When a shape has a shadow and is filled, the background of its borders must be filled with the
* colour of the interior of the shape. This method does not test if it must be done, it sets a
* SVG element which carries out that.
* @param elt The element that will be set to define the background of the borders.
* @param root The root element to which 'elt' will be appended.
* @since 2.0.0
*/
protected void setSVGBorderBackground(final SVGElement elt, final SVGElement root) {
if(elt==null || root==null)
return ;
elt.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_BG);
elt.setFill(shape.getFillingCol());
elt.setStroke(shape.getFillingCol());
setThickness(elt, shape.getThickness(), shape.isDbleBorderable(), shape.getDbleBordSep());
root.appendChild(elt);
}
/**
* Creates an SVG circle that represents a dot for the option 'show points'.
* @param doc The document owner.
* @param rad The radius of the circle.
* @param pt The position of the point.
* @param col The colour of the dot.
* @return The created dot or null.
* @since 2.0.0
*/
protected static SVGCircleElement getShowPointsDot(final SVGDocument doc, final double rad, final IPoint pt, final Color col) {
if(doc==null)
return null;
final SVGCircleElement circle = new SVGCircleElement(doc);
circle.setR(rad);
if(pt!=null) {
circle.setCx(pt.getX());
circle.setCy(pt.getY());
}
circle.setFill(col);
return circle;
}
/**
* @return the shape.
* @since 2.0.0
*/
public S getShape() {
return shape;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
189f510e123a9f0379a7a01f3339d80c5be78a40 | a3790410d22d720ff6cf68ec3114663b1d4ef515 | /src/main/java/com/smartsoft/web/rest/ResourceResource.java | 39ef22dd4d0ff6a96a6004f759f143bd6c07b788 | [] | no_license | intkiran/SmartBase-Soft | 91115da910dc9f1b02038d61a8b1aee124fae261 | c44843846cdd9ed3c79ea16c296981dd4a99f28f | refs/heads/master | 2021-07-01T04:31:25.323414 | 2017-09-19T04:23:58 | 2017-09-19T04:23:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,131 | java | package com.smartsoft.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.smartsoft.service.ResourceService;
import com.smartsoft.web.rest.util.HeaderUtil;
import com.smartsoft.web.rest.util.PaginationUtil;
import com.smartsoft.service.dto.ResourceDTO;
import io.swagger.annotations.ApiParam;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Resource.
*/
@RestController
@RequestMapping("/api")
public class ResourceResource {
private final Logger log = LoggerFactory.getLogger(ResourceResource.class);
private static final String ENTITY_NAME = "resource";
private final ResourceService resourceService;
public ResourceResource(ResourceService resourceService) {
this.resourceService = resourceService;
}
/**
* POST /resources : Create a new resource.
*
* @param resourceDTO the resourceDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new resourceDTO, or with status 400 (Bad Request) if the resource has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/resources")
@Timed
public ResponseEntity<ResourceDTO> createResource(@RequestBody ResourceDTO resourceDTO) throws URISyntaxException {
log.debug("REST request to save Resource : {}", resourceDTO);
if (resourceDTO.getId() != null) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new resource cannot already have an ID")).body(null);
}
ResourceDTO result = resourceService.save(resourceDTO);
return ResponseEntity.created(new URI("/api/resources/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /resources : Updates an existing resource.
*
* @param resourceDTO the resourceDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated resourceDTO,
* or with status 400 (Bad Request) if the resourceDTO is not valid,
* or with status 500 (Internal Server Error) if the resourceDTO couldnt be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/resources")
@Timed
public ResponseEntity<ResourceDTO> updateResource(@RequestBody ResourceDTO resourceDTO) throws URISyntaxException {
log.debug("REST request to update Resource : {}", resourceDTO);
if (resourceDTO.getId() == null) {
return createResource(resourceDTO);
}
ResourceDTO result = resourceService.save(resourceDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, resourceDTO.getId().toString()))
.body(result);
}
/**
* GET /resources : get all the resources.
*
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and the list of resources in body
*/
@GetMapping("/resources")
@Timed
public ResponseEntity<List<ResourceDTO>> getAllResources(@ApiParam Pageable pageable) {
log.debug("REST request to get a page of Resources");
Page<ResourceDTO> page = resourceService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/resources");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /resources/:id : get the "id" resource.
*
* @param id the id of the resourceDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the resourceDTO, or with status 404 (Not Found)
*/
@GetMapping("/resources/{id}")
@Timed
public ResponseEntity<ResourceDTO> getResource(@PathVariable Long id) {
log.debug("REST request to get Resource : {}", id);
ResourceDTO resourceDTO = resourceService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(resourceDTO));
}
/**
* DELETE /resources/:id : delete the "id" resource.
*
* @param id the id of the resourceDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/resources/{id}")
@Timed
public ResponseEntity<Void> deleteResource(@PathVariable Long id) {
log.debug("REST request to delete Resource : {}", id);
resourceService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
| [
"736485499@qq.com"
] | 736485499@qq.com |
fd9727aa16134167dd1b746d187fd3d89b393de9 | f6c90281bbf2fdd02ed625425a564115a9768f5f | /app/src/main/java/com/example/phili/foodpaldemo/CreateGroupActivity.java | 5d02861437ad8811254d694719b89f4beefe73dc | [] | no_license | SlimShady01/FoodPal-Demo | 185bb37dfd01986f12995fd4bd4c6ddf58350ce4 | d41c9ba96221fc0c95be41d43b190a473f561ee2 | refs/heads/master | 2022-12-14T05:48:40.776609 | 2020-09-24T18:45:44 | 2020-09-24T18:45:44 | 298,366,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,606 | java | package com.example.phili.foodpaldemo;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.bigkoo.pickerview.TimePickerView;
import com.example.phili.foodpaldemo.models.ChatScreenActivity;
import com.example.phili.foodpaldemo.models.MyLatLng;
import com.example.phili.foodpaldemo.models.Restaurant;
import com.example.phili.foodpaldemo.models.UserGroup;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.Places;
import com.google.android.gms.location.places.ui.PlacePicker;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
/**
* Created by yiren on 2018-02-21.
*/
public class CreateGroupActivity extends AppCompatActivity implements View.OnClickListener{
public static boolean LOAD_MY_GROUP = false;
//EditText on this page
private EditText editTextGroupName;
private EditText editTextTime;
private EditText editTextRestaurant;
private TextView textViewEmail;
private EditText editTextDescription;
private Button btnCreate;
private TimePickerView timePickerView;
// google place
private ImageButton choosePlace;
private final static int PLACE_PICKER_REQUEST = 1;
private final static LatLngBounds bounds = new LatLngBounds(new LatLng( 44.623740,-63.645071), new LatLng(44.684002, -63.557137));
private TextView placeName;
private Place place;
//Dialog for redirecting
private ProgressDialog progressDialog;
//Firebase
private FirebaseAuth firebaseAuth;
private DatabaseReference databaseReference, userDataReference;
private FirebaseDatabase firebaseDatabase;
private FirebaseUser firebaseUser;
@Override
public void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_creat_group);
initFirebase();
initTimePicker();
editTextGroupName = findViewById(R.id.et_groupname);
editTextTime = findViewById(R.id.et_mealtime);
choosePlace = findViewById(R.id.create_res);
placeName = findViewById(R.id.place_name);
editTextDescription = findViewById(R.id.gp_descrip);
//textViewEmail = findViewById(R.id.textViewEmail);
btnCreate = findViewById(R.id.btn_create);
//textViewEmail.setText("Welcome" + firebaseUser.getEmail());
btnCreate.setOnClickListener(this);
editTextTime.setOnClickListener(this);
}
private void createGroup(){
String groupName = editTextGroupName.getText().toString().trim();
String mealTime = editTextTime.getText().toString().trim();
// String restaurantName = editTextRestaurant.getText().toString().trim();
String description = editTextDescription.getText().toString().trim();
if (!TextUtils.isEmpty(groupName) && place != null && mealTime!=null && description!=null) {
// android.os.TransactionTooLargeException: data parcel size 1163212 bytes
// get the restaurant
MyLatLng myLatLng = new MyLatLng(place.getLatLng().latitude, place.getLatLng().longitude);
Restaurant restaurant = new Restaurant(place.getId(), place.getName().toString(), place.getAddress().toString(),
place.getPhoneNumber().toString(), place.getWebsiteUri().toString(),myLatLng);
String gId = databaseReference.child("groups").push().getKey();
//Construct a map to manage users and groups
Map<String, Boolean> members = new HashMap<>();
String uId = firebaseUser.getUid();
// add the group id to the user
// update the user's group info
userDataReference.child(uId).child("joinedGroups").child(gId).setValue(true);
//Put user to the current group
members.put(uId,true);
UserGroup userGroup = new UserGroup(gId, uId, groupName, mealTime, place.getId(), members, description);
try {
// only store restaurant id in group.
databaseReference.child("groups").child(gId).setValue(userGroup);
databaseReference.child("restaurants").child(place.getId()).setValue(restaurant);
} catch (Exception e){
e.printStackTrace();
}
Toast.makeText(this, "create group success", Toast.LENGTH_SHORT).show();
// go to my groups
Intent intent = new Intent(this, MainHomeActivity.class);
Intent chat_intent = new Intent(this, DisplayGroupInfoActivity.class);
chat_intent.putExtra("GROUPNAME",groupName);
//LOAD_MY_GROUP = true;
// put id to intent
// intent.putExtra(LOAD_MY_GROUP, true);
startActivity(intent);
finish();
} else {
Toast.makeText(this, "Please enter required information", Toast.LENGTH_LONG).show();
}
}
private void chooseRestaurant(){
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
builder.setLatLngBounds(bounds);
try {
startActivityForResult(builder.build(this), PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
place = PlacePicker.getPlace(CreateGroupActivity.this, data);
// address=6299 South St, Halifax, NS B3H 4R2, Canada, phoneNumber=+1 902-494-2211,
// latlng=lat/lng: (44.636581199999995,-63.591655499999995), viewport=LatLngBounds{southwest=lat/lng: (44.63575445,-63.60206124999999),
if(place != null){
placeName.setText(place.getName());
}else {
Toast.makeText(this, "Please choose a restaurant", Toast.LENGTH_LONG).show();
return;
}
}
}
}
@Override
public void onClick(View view) {
if (view == btnCreate) {
createGroup();
}
if (view == choosePlace) {
// start the place picker
chooseRestaurant();
}
if (view == editTextTime) {
pickTime(view);
}
}
private void pickTime(View view) {
timePickerView.setDate(Calendar.getInstance());
timePickerView.show(view);
}
public void initFirebase() {
//Initialize firebase authentication
firebaseAuth = FirebaseAuth.getInstance();
firebaseDatabase = FirebaseDatabase.getInstance();
//If user is not logged on
if (firebaseAuth.getCurrentUser() == null){
//Finish the activity
finish();
startActivity(new Intent(this, LoginActivity.class));
}
databaseReference = firebaseDatabase.getReference();
userDataReference = firebaseDatabase.getReference("users");
firebaseUser = firebaseAuth.getCurrentUser();
}
public void initTimePicker() {
Calendar selectedDate = Calendar.getInstance();
timePickerView = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date, View v) {
EditText editText = (EditText) v;
editText.setText(getTime(date));
}
})
//year/month/day/hour/minute/second
.setType(new boolean[]{true,true,true,true,true,false})
.setLabel("","","","","","")
.isCenterLabel(false)
//IOS-liked color
.setDividerColor(Color.DKGRAY)
.setContentSize(18)
.setDate(selectedDate)
.setDecorView(null)
.build();
}
public String getTime(Date date) {
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return sdFormat.format(date);
}
}
| [
"zh961592@dal.ca"
] | zh961592@dal.ca |
53553c009898bbc101c85bd9d565e19272d07c5d | 59c6bee69c13df894645988c7dec00e91e9af857 | /demos/main/src/main/java/thai/Sample.java | 166f12c4abf35908b742cf79267083bbb4fd00c6 | [
"Apache-2.0"
] | permissive | WangXinjue/ThaiTvLive | 878ff9f3aa50b07038401c81c13cbe3e22cd5c77 | 07856a6d29ffcd3b2c7f3894454180c895296b98 | refs/heads/master | 2020-03-27T21:38:07.216448 | 2018-09-05T11:35:40 | 2018-09-05T11:35:40 | 147,162,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,013 | java | package thai;
import android.content.Context;
import android.content.Intent;
/**
* Created by 王心觉 on 2018/8/24.
*/
public abstract class Sample {
public final String name;
public final boolean preferExtensionDecoders;
public final String abrAlgorithm;
public final DrmInfo drmInfo;
public Sample(
String name, boolean preferExtensionDecoders, String abrAlgorithm, DrmInfo drmInfo) {
this.name = name;
this.preferExtensionDecoders = preferExtensionDecoders;
this.abrAlgorithm = abrAlgorithm;
this.drmInfo = drmInfo;
}
public Intent buildIntent(Context context) {
Intent intent= new Intent(context, ThaiPlayerActivity.class);
intent.putExtra(ThaiPlayerActivity.PREFER_EXTENSION_DECODERS_EXTRA, preferExtensionDecoders);
intent.putExtra(ThaiPlayerActivity.ABR_ALGORITHM_EXTRA, abrAlgorithm);
if (drmInfo != null) {
drmInfo.updateIntent(intent);
}
return intent;
}
}
| [
"604113855@qq.com"
] | 604113855@qq.com |
46659ca93451632f1358ff9831e557b3550b984c | 52b4e17a9982bd06042276368ff4b02cba7580b9 | /foundation-test/src/test/java/com/github/foundation/service/UserServiceTest.java | e8c2b43580f5006f2e5ce2eb45b6df8a948acd69 | [
"Apache-2.0"
] | permissive | zhaikevin/foundation | a36ca561febfd0d5020e6d90dc99cf3ec2a0f983 | b9a74d60a1f5110146ab8bcc15e74e9f5eb45415 | refs/heads/master | 2022-11-02T13:22:50.060309 | 2020-06-03T06:36:33 | 2020-06-03T06:36:33 | 220,131,340 | 1 | 0 | Apache-2.0 | 2022-10-12T20:34:04 | 2019-11-07T02:11:29 | Java | UTF-8 | Java | false | false | 1,615 | java | package com.github.foundation.service;
import com.github.foundation.SpringBootTestAbstract;
import com.github.foundation.pagination.model.Direction;
import com.github.foundation.pagination.model.Order;
import com.github.foundation.pagination.model.Pagination;
import com.github.foundation.pagination.model.SearchParams;
import com.github.foundation.pagination.model.Sort;
import com.github.foundation.test.model.User;
import com.github.foundation.test.service.UserService;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description:
* @Author: kevin
* @Date: 2019/11/8 14:59
*/
public class UserServiceTest extends SpringBootTestAbstract {
@Autowired
private UserService userService;
@Test
public void queryByPageTest() {
Sort sortObj = new Sort(new Order(Direction.fromString("desc"), "id"));
Pagination<User> pagination = new Pagination<>(1, 10, sortObj);
userService.queryByPage(pagination);
Assert.assertEquals(10, pagination.getDataset().size());
Assert.assertEquals(15, pagination.getTotal());
}
@Test
public void queryByPageSearchTest() {
Sort sortObj = new Sort(new Order(Direction.fromString("desc"), "id"));
Pagination<User> pagination = new Pagination<>(1, 10, sortObj);
pagination.addParam(new SearchParams.Param("name","kevin",SearchParams.Compare.EQUAL));
userService.queryByPage(pagination);
Assert.assertEquals(1, pagination.getDataset().size());
Assert.assertEquals(1, pagination.getTotal());
}
}
| [
"863551278@qq.com"
] | 863551278@qq.com |
165e75b69cb0eaaeae87896a9d4d5f10b9d35754 | 16ae92616ef352efd0964f6174517be48b49f945 | /MyLocation14/app/src/main/java/com/moonayoung/location/MainActivity.java | 1bd0952a8a9877ed6231c453719348b521c5dafa | [] | no_license | ayoung0073/AndroidStudy | 589f545863e645cdf8fcb43d08ca050e58d99788 | 8620a389e8dee974e550a1cb113e9e8352422298 | refs/heads/master | 2023-02-16T15:54:27.235287 | 2021-01-11T14:02:16 | 2021-01-11T14:02:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,275 | java | package com.moonayoung.location;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.pedro.library.AutoPermissions;
public class MainActivity extends AppCompatActivity {
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = findViewById(R.id.textView);
Button button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startLocationService();
}
});
AutoPermissions.Companion.loadAllPermissions(this,101);
}
//(내부 클래스로)위치 리스너 구현 -> 위치 관리자에서 전달하는 위치 정보를 받기 위해 정의된 인터페이스. onLocationChanged() 메서드 구현
class GPSListener implements LocationListener {
@Override
public void onLocationChanged(@NonNull Location location) {
Double latitude = location.getLatitude();
Double longitude = location.getLongitude();
String message = "< 내 위치 >\nLatitude : " + latitude + "\nLongitude : " + longitude;
}
@Override
public void onProviderEnabled(@NonNull String provider) {
}
@Override
public void onProviderDisabled(@NonNull String provider) {
}
}
public void startLocationService() {
LocationManager manager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
// LocationManager로 형변환 해주기
try {
Location location = manager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
double latitude = location.getLatitude();
double longitude = location.getLongitude();
String message = "< 최근 위치 >\nLatitude : " + latitude + "\nLongitude : " + longitude;
textView.setText(message);
}
// 위치 관리자는 일정한 간격으로 위치 정보를 확인하거나 일정 거리 이상을 이동했을 때 위치 정보를 전달하는 기능 D
// 위치 관리자에게 현재 위치를 알려달라고 요청하기 위핸 requestLocationUpdates() 메서드를 호출해야함
// 파라미터 -> 최소 시간, 최소 거리, 위치 리스너 객체
GPSListener gpsListener = new GPSListener();
long minTime = 1000; //최소 시간
float minDistance = 0; //최소 거리
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER,minTime,minDistance,gpsListener);
Toast.makeText(getApplicationContext(),"위치확인 요청",Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"ayong0310@naver.com"
] | ayong0310@naver.com |
0349b624d7eb671c57484d53f1fd69f334c1738c | b4f112829aabe9aae02f90f806cb977e3ce60c76 | /suneee-core/src/main/java/com/suneee/core/http/exception/HttpClientApplicationException.java | a8b8a523c0a96bc72014f5a62551ce09bbe2bfe9 | [
"Apache-2.0"
] | permissive | joesaas/suneee | 2ac08ee1e3dbbdd7b7c7c594e850c13cfa5ec8ba | f0487e5df22fa759a30db6ceec5401849410b5cb | refs/heads/master | 2021-01-19T17:44:45.356003 | 2014-12-15T01:28:35 | 2014-12-15T01:28:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | /**
* File Name:HttpApplicationException.java
* Package Name:com.suneee.core.http.utils
* Description: (That's the purpose of the file)
* Date:2014年12月3日下午4:39:49
* Copyright (c) 2014, forint.lee@qq.com All Rights Reserved.
*
*/
package com.suneee.core.http.exception;
import com.suneee.core.exception.ApplicationException;
/**
* ClassName:HttpApplicationException <br/>
* Description:That's the purpose of the class
* Date: 2014年12月3日 下午4:39:49 <br/>
* @author joe
* @version V1.0
* @see
*/
public class HttpClientApplicationException extends ApplicationException
{
/**
* serialVersionUID:That's the purpose of the variable.
*/
private static final long serialVersionUID = -5905428221844109513L;
/**
*
* Creates a new instance of HttpClientApplicationException.
* @param message
*/
public HttpClientApplicationException(String message){
super(message);
}
/**
*
* Creates a new instance of HttpClientApplicationException.
* @param message
* @param cause
*/
public HttpClientApplicationException(String message, Throwable cause){
super(message, cause);
}
/**
*
* Creates a new instance of HttpClientApplicationException.
* @param cause
*/
public HttpClientApplicationException(Throwable cause){
super(cause);
}
}
| [
"joesaas@gmail.com"
] | joesaas@gmail.com |
d2cf79f4ebb8dd34599dc4ea4e86b8564c216ffd | 18ea2e845c09035e73551b949128bcf408214519 | /Deployment/src/gui/URLparameters.java | 227159602de68d0fbce179c13efec3536f6235ae | [] | no_license | kulfon12/TestTool | 70fab1373354da26c45fdb8e6b22ba746d583de6 | b77eec183074be80ab7b80fa763fb3a01d208f22 | refs/heads/master | 2020-06-06T14:51:11.474984 | 2015-11-09T16:15:33 | 2015-11-09T16:15:33 | 32,980,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,224 | java | package gui;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class URLparameters
*/
public class URLparameters extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public URLparameters() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String user=request.getParameter("user");
PrintWriter out =response.getWriter();
out.println("<html>");
out.println("The 'user' parmetr is:" + user);
out.println("</html>");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
| [
"kulfon12@yahoo.co.uk"
] | kulfon12@yahoo.co.uk |
0e9245fe71ce94ee770cf3f73905a70cdea303bb | c488297b9dbdb84f7d50cf3c9a312b726b24056c | /src/test/java/dev/raggi/vesselapi/VesselapiApplicationTests.java | da6bcc0cd6bdf8f322a2a8e17bbc5c91e1598d1b | [] | no_license | ragnarls08/vesselapi | 9837fdcbab49e77b2369f9e106d67555bb2c0ccb | 0d8b3d8dc80aa8a0ea0e612a74b376243c65f6af | refs/heads/master | 2022-12-04T07:56:46.909348 | 2020-08-26T08:48:17 | 2020-08-26T08:48:17 | 290,323,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package dev.raggi.vesselapi;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class VesselapiApplicationTests {
@Test
void contextLoads() {
}
}
| [
"ragnarls08@gmail.com"
] | ragnarls08@gmail.com |
13ea10d342c4d7b241f1267d4d4de4a1482a8aa5 | 73c25fab626ede2ea2947ac2dcf47d0dd5acf93a | /src/main/java/token/service/MapServiceImpl.java | 0e20ba92539ed17026a977f0f3ca8d743bf8ec78 | [] | no_license | danielhurny/token | a303ec3e08d2c784dd8b376281045009d3c6cd9e | 5ed05d47e29c07052a8f95b4a3cffa25e322f700 | refs/heads/master | 2021-01-19T18:37:04.103897 | 2017-08-23T06:30:52 | 2017-08-23T06:30:52 | 101,145,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package token.service;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Component;
import token.dto.MapDTO;
@Component
public class MapServiceImpl implements MapService {
/* (non-Javadoc)
* @see token.service.MapService#getMap()
*/
@Override
public MapDTO getMap() {
Map<String, String> keys = new HashMap<>();
keys.put("a", "b");
keys.put("c", "d");
keys.put("e", "f");
keys.put("g", "h");
MapDTO mapDTO = new MapDTO();
mapDTO.setAge(35);
mapDTO.setName("Alfa");
mapDTO.setKeys(keys);
return mapDTO;
}
}
| [
"P3502712@ness.com"
] | P3502712@ness.com |
0f054236bf44ccf82f19d8f1ba0f944c0d22ca89 | a9e4aa1be167c438c647f3e24a2b2a17bd964cbd | /MarbleFun/lib/org/lwjgl/opengles/OESTextureBorderClamp.java | 8637258fbd9c186a9148a6ca752e2b15b63f4c10 | [] | no_license | sabir012/GP_Marble | 0879e2a6afcd656cbf3700f6a2adbc1c0c47e877 | 70ab8fa0e65cbd57aebac6e49ea931d60d30b86a | refs/heads/master | 2020-07-06T09:58:46.825698 | 2017-02-06T10:28:34 | 2017-02-06T10:28:34 | 74,048,246 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,635 | java | /*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.opengles;
import java.nio.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* Native bindings to the <a href="https://www.khronos.org/registry/gles/extensions/OES/OES_texture_border_clamp.txt">OES_texture_border_clamp</a> extension.
*
* <p>OpenGL ES provides only a single clamping wrap mode: CLAMP_TO_EDGE. However, the ability to clamp to a constant border color can be useful to quickly
* detect texture coordinates that exceed their expected limits or to dummy out any such accesses with transparency or a neutral color in tiling or light
* maps.</p>
*
* <p>This extension defines an additional texture clamping algorithm. CLAMP_TO_BORDER_OES clamps texture coordinates at all mipmap levels such that NEAREST
* and LINEAR filters of clamped coordinates return only the constant border color. This does not add the ability for textures to specify borders using
* glTexImage2D, but only to clamp to a constant border value set using glTexParameter and glSamplerParameter.</p>
*
* <p>Requires {@link GLES20 GLES 2.0}.</p>
*/
public class OESTextureBorderClamp {
/**
* Accepted by the {@code pname} parameter of TexParameteriv, TexParameterfv, SamplerParameteriv, SamplerParameterfv, TexParameterIivOES,
* TexParameterIuivOES, SamplerParameterIivOES, SamplerParameterIuivOES, GetTexParameteriv, GetTexParameterfv, GetTexParameterIivOES,
* GetTexParameterIuivOES, GetSamplerParameteriv, GetSamplerParameterfv, GetSamplerParameterIivOES, and GetSamplerParameterIuivOES.
*/
public static final int GL_TEXTURE_BORDER_COLOR_OES = 0x1004;
/**
* Accepted by the {@code param} parameter of TexParameteri, TexParameterf, SamplerParameteri and SamplerParameterf, and by the {@code params} parameter of
* TexParameteriv, TexParameterfv, TexParameterIivOES, TexParameterIuivOES, SamplerParameterIivOES, SamplerParameterIuivOES and returned by the
* {@code params} parameter of GetTexParameteriv, GetTexParameterfv, GetTexParameterIivOES, GetTexParameterIuivOES, GetSamplerParameteriv,
* GetSamplerParameterfv, GetSamplerParameterIivOES, and GetSamplerParameterIuivOES when their {@code pname} parameter is TEXTURE_WRAP_S, TEXTURE_WRAP_T,
* or TEXTURE_WRAP_R.
*/
public static final int GL_CLAMP_TO_BORDER_OES = 0x812D;
protected OESTextureBorderClamp() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(GLESCapabilities caps) {
return checkFunctions(
caps.glTexParameterIivOES, caps.glTexParameterIuivOES, caps.glGetTexParameterIivOES, caps.glGetTexParameterIuivOES, caps.glSamplerParameterIivOES,
caps.glSamplerParameterIuivOES, caps.glGetSamplerParameterIivOES, caps.glGetSamplerParameterIuivOES
);
}
// --- [ glTexParameterIivOES ] ---
public static void nglTexParameterIivOES(int target, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glTexParameterIivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, target, pname, params);
}
public static void glTexParameterIivOES(int target, int pname, IntBuffer params) {
nglTexParameterIivOES(target, pname, memAddress(params));
}
public static void glTexParameterIiOES(int target, int pname, int param) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.ints(param);
nglTexParameterIivOES(target, pname, memAddress(params));
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glTexParameterIuivOES ] ---
public static void nglTexParameterIuivOES(int target, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glTexParameterIuivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, target, pname, params);
}
public static void glTexParameterIuivOES(int target, int pname, IntBuffer params) {
nglTexParameterIuivOES(target, pname, memAddress(params));
}
public static void glTexParameterIuiOES(int target, int pname, int param) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.ints(param);
nglTexParameterIuivOES(target, pname, memAddress(params));
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetTexParameterIivOES ] ---
public static void nglGetTexParameterIivOES(int target, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glGetTexParameterIivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, target, pname, params);
}
public static void glGetTexParameterIivOES(int target, int pname, IntBuffer params) {
if ( CHECKS )
checkBuffer(params, 1);
nglGetTexParameterIivOES(target, pname, memAddress(params));
}
public static int glGetTexParameterIiOES(int target, int pname) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.callocInt(1);
nglGetTexParameterIivOES(target, pname, memAddress(params));
return params.get(0);
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetTexParameterIuivOES ] ---
public static void nglGetTexParameterIuivOES(int target, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glGetTexParameterIuivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, target, pname, params);
}
public static void glGetTexParameterIuivOES(int target, int pname, IntBuffer params) {
if ( CHECKS )
checkBuffer(params, 1);
nglGetTexParameterIuivOES(target, pname, memAddress(params));
}
public static int glGetTexParameterIuiOES(int target, int pname) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.callocInt(1);
nglGetTexParameterIuivOES(target, pname, memAddress(params));
return params.get(0);
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glSamplerParameterIivOES ] ---
public static void nglSamplerParameterIivOES(int sampler, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glSamplerParameterIivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, sampler, pname, params);
}
public static void glSamplerParameterIivOES(int sampler, int pname, IntBuffer params) {
nglSamplerParameterIivOES(sampler, pname, memAddress(params));
}
public static void glSamplerParameterIiOES(int sampler, int pname, int param) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.ints(param);
nglSamplerParameterIivOES(sampler, pname, memAddress(params));
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glSamplerParameterIuivOES ] ---
public static void nglSamplerParameterIuivOES(int sampler, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glSamplerParameterIuivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, sampler, pname, params);
}
public static void glSamplerParameterIuivOES(int sampler, int pname, IntBuffer params) {
nglSamplerParameterIuivOES(sampler, pname, memAddress(params));
}
public static void glSamplerParameterIuiOES(int sampler, int pname, int param) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.ints(param);
nglSamplerParameterIuivOES(sampler, pname, memAddress(params));
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetSamplerParameterIivOES ] ---
public static void nglGetSamplerParameterIivOES(int sampler, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glGetSamplerParameterIivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, sampler, pname, params);
}
public static void glGetSamplerParameterIivOES(int sampler, int pname, IntBuffer params) {
if ( CHECKS )
checkBuffer(params, 1);
nglGetSamplerParameterIivOES(sampler, pname, memAddress(params));
}
public static int glGetSamplerParameterIiOES(int sampler, int pname) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.callocInt(1);
nglGetSamplerParameterIivOES(sampler, pname, memAddress(params));
return params.get(0);
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetSamplerParameterIuivOES ] ---
public static void nglGetSamplerParameterIuivOES(int sampler, int pname, long params) {
long __functionAddress = GLES.getCapabilities().glGetSamplerParameterIuivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, sampler, pname, params);
}
public static void glGetSamplerParameterIuivOES(int sampler, int pname, IntBuffer params) {
if ( CHECKS )
checkBuffer(params, 1);
nglGetSamplerParameterIuivOES(sampler, pname, memAddress(params));
}
public static int glGetSamplerParameterIuiOES(int sampler, int pname) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.callocInt(1);
nglGetSamplerParameterIuivOES(sampler, pname, memAddress(params));
return params.get(0);
} finally {
stack.setPointer(stackPointer);
}
}
/** Array version of: {@link #glTexParameterIivOES TexParameterIivOES} */
public static void glTexParameterIivOES(int target, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glTexParameterIivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, target, pname, params);
}
/** Array version of: {@link #glTexParameterIuivOES TexParameterIuivOES} */
public static void glTexParameterIuivOES(int target, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glTexParameterIuivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, target, pname, params);
}
/** Array version of: {@link #glGetTexParameterIivOES GetTexParameterIivOES} */
public static void glGetTexParameterIivOES(int target, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glGetTexParameterIivOES;
if ( CHECKS ) {
checkFunctionAddress(__functionAddress);
checkBuffer(params, 1);
}
callPV(__functionAddress, target, pname, params);
}
/** Array version of: {@link #glGetTexParameterIuivOES GetTexParameterIuivOES} */
public static void glGetTexParameterIuivOES(int target, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glGetTexParameterIuivOES;
if ( CHECKS ) {
checkFunctionAddress(__functionAddress);
checkBuffer(params, 1);
}
callPV(__functionAddress, target, pname, params);
}
/** Array version of: {@link #glSamplerParameterIivOES SamplerParameterIivOES} */
public static void glSamplerParameterIivOES(int sampler, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glSamplerParameterIivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, sampler, pname, params);
}
/** Array version of: {@link #glSamplerParameterIuivOES SamplerParameterIuivOES} */
public static void glSamplerParameterIuivOES(int sampler, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glSamplerParameterIuivOES;
if ( CHECKS )
checkFunctionAddress(__functionAddress);
callPV(__functionAddress, sampler, pname, params);
}
/** Array version of: {@link #glGetSamplerParameterIivOES GetSamplerParameterIivOES} */
public static void glGetSamplerParameterIivOES(int sampler, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glGetSamplerParameterIivOES;
if ( CHECKS ) {
checkFunctionAddress(__functionAddress);
checkBuffer(params, 1);
}
callPV(__functionAddress, sampler, pname, params);
}
/** Array version of: {@link #glGetSamplerParameterIuivOES GetSamplerParameterIuivOES} */
public static void glGetSamplerParameterIuivOES(int sampler, int pname, int[] params) {
long __functionAddress = GLES.getCapabilities().glGetSamplerParameterIuivOES;
if ( CHECKS ) {
checkFunctionAddress(__functionAddress);
checkBuffer(params, 1);
}
callPV(__functionAddress, sampler, pname, params);
}
} | [
"sabir.alizadeh@gmail.com"
] | sabir.alizadeh@gmail.com |
0419d78a2971242df1cc0494d0b38ffd0b33462e | db20bc80adbd49d8c8e5b6aba47facbd2ec071f4 | /src/main/java/com/pearl/service/FundService.java | b684824cb72bd23138040e58c5c2b86e7a93afda | [] | no_license | meese-ha/showmeyourpearl | 4f3e9d0b02f8c4218d7adcdea5a8cfb70f255138 | 1fa0ace14d73f2e7b1d956f89aca116f4ce81f93 | refs/heads/master | 2023-05-09T19:21:27.776125 | 2021-06-03T06:51:16 | 2021-06-03T06:51:16 | 373,126,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | package com.pearl.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.pearl.domain.FundVO;
import com.pearl.domain.MemberVO;
import com.pearl.domain.RewardVO;
public interface FundService {
List<FundVO> getList(FundVO vo);
FundVO get(Long fundNum);
MemberVO artist(Long memNum);
FundVO getPay(FundVO vo);
void insert(FundVO vo);
int update(FundVO vo);
int delete(Long fundNum);
}
| [
"qskantt@naver.com"
] | qskantt@naver.com |
0f643b358ceb4f5dbfb99f87be3b55328429c2aa | 640c807eb0513218e6da27b454250ba9574db400 | /src/testNG/EmpBusinessLogic.java | 00a5ce1542ef5e256cb09582d63dbdd7ff054102 | [] | no_license | awalekar1992/Selenium-Projects | decb8436fc8b6a3981a7293d39f95fda79064666 | 71154bdb60f014573ea375528289ef9a9c488d74 | refs/heads/master | 2021-07-08T18:16:24.148090 | 2019-06-24T05:56:56 | 2019-06-24T05:56:56 | 193,093,657 | 0 | 0 | null | 2020-10-13T14:06:50 | 2019-06-21T12:23:54 | HTML | UTF-8 | Java | false | false | 657 | java | package testNG;
public class EmpBusinessLogic {
// Calculate the yearly salary of employee
public double calculateYearlySalary(EmployeeDetails employeeDetails) {
double yearlySalary = 0;
yearlySalary = employeeDetails.getMonthlySalary() * 12;
return yearlySalary;
}
// Calculate the appraisal amount of employee
public double calculateAppraisal(EmployeeDetails employeeDetails) {
double appraisal = 0;
if(employeeDetails.getMonthlySalary() < 10000) {
appraisal = 500;
} else {
appraisal = 1000;
}
return appraisal;
}
}
| [
"sawalekar@technosofteng.com"
] | sawalekar@technosofteng.com |
d8fb8eab9609b0f3d060cd0a2a84ebed71474675 | 463309624efc030f8fcf4b2850503ed784acd37c | /DatabaseCompiler.java | 9f1bfecc6e62b60b47ddf53fd9d980fbc286ff29 | [] | no_license | suyogm78/Advanced-Database-Project-1 | fcb80f75b0b2f4bdc76f692cd68b89338e220d53 | 364b572427b9cab784e8526fa3d6d3c132bdd91b | refs/heads/master | 2020-03-20T08:07:17.427013 | 2018-08-19T17:20:30 | 2018-08-19T17:20:30 | 137,299,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,591 | java | import java.io.*;
import java.sql.*;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Title: DatabaseCompiler
* SubClass of: mini1.java
* Class: CS522
* Date: 2/21/18
* @author Aaron B
*
*/
public class DatabaseCompiler {
/**
* Function: create the table found in the first line of the file submitted by the user
* @param fileName - name of file
* @param userName - Username input provided by the person currently running the program
* @param conn - Oracle connection
*/
public void createTable(String fileName, String userName, Connection conn){
//Read in the file
Scanner word;
try {
word = new Scanner(new File(fileName));
} catch (FileNotFoundException ex) {
Logger.getLogger(DatabaseCompiler.class.getName()).log(Level.SEVERE, null, ex);
System.out.print("FileNotFoundException");
return;
}
String tableType = word.next();
String tableName = word.next();
try{
Statement stmt = conn.createStatement();
//Check if the table exists already
ResultSet checkTableExists=stmt.executeQuery("SELECT * from Relation WHERE RName ='"+tableName+"'");
if(!checkTableExists.next()){
//EXECUTE ME
String query = "Insert INTO Relation(RName,Type,Username) VALUES('" + tableName + "', " + "'" + tableType + "', '" + userName + "')" ; //Add entry to Relation table
stmt.executeQuery (query);
System.out.println("Table "+tableName+" has been created.");
String fileEnd = word.next();
while(!fileEnd.equalsIgnoreCase("END")){ // This loop adds entries into the Attributes table for the table entered above
String aName = fileEnd;
String aType = word.next();
int aSize = Integer.parseInt(word.next());
query = "Insert INTO Attributes VALUES('" + tableName +"'," + "'" + aName + "'," + "'" + aType + "'," + aSize + ")";
// Execute the Query
stmt.executeQuery(query);
fileEnd = word.next();
}
stmt.executeQuery ("commit");
word.close();
}else {
System.out.println("Table already exists!");
}
}
catch(SQLException e){
System.out.println("Caught SQL Exception: \n" + e );
}
}
}
| [
"suyogm78@gmail.com"
] | suyogm78@gmail.com |
e2851e08e6bfd4ea9b64b1b9b184c0308bbacff0 | b18a33dbfbe6aa49645823cb6d34179b5a942910 | /task04decomposition/src/main/java/by/avdeev/task04decomposition/quadrangle/service/exception/ServiceException.java | 613d3b0e14580dc77a4f2e1d858a8f377bde687a | [] | no_license | Bogdan1506/24_JavaST | 587d0a31f625844804403803835a8ef60cc3f0cf | d9328b5bf726bb64fd329f2f52fb57ebf0cd03c8 | refs/heads/master | 2022-07-09T00:17:53.552808 | 2020-05-27T10:58:40 | 2020-05-27T10:58:40 | 227,462,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package by.avdeev.task04decomposition.quadrangle.service.exception;
public class ServiceException extends Exception {
public ServiceException() {
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
public ServiceException(Throwable cause) {
super(cause);
}
}
| [
"avdeev1506@mail.ru"
] | avdeev1506@mail.ru |
8373062954c6aefab78a4f6695d3ffe060d90f2c | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/spoon/learning/5239/CtFieldReferenceImpl.java | 828d64edd1d9421c8211fbbbe58fab4936e726ad | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,142 | java | /**
* Copyright (C) 2006-2018 INRIA and contributors
* Spoon - http://spoon.gforge.inria.fr/
*
* This software is governed by the CeCILL-C License under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/or redistribute the software under the terms of the CeCILL-C license as
* circulated by CEA, CNRS and INRIA at http://www.cecill.info.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/
package spoon.support.reflect.reference;
import spoon.Launcher;
import spoon.SpoonException;
import spoon.reflect.annotations.MetamodelPropertyField;
import spoon.reflect.declaration.CtEnum;
import spoon.reflect.declaration.CtField;
import spoon.reflect.declaration.CtType;
import spoon.reflect.declaration.CtVariable;
import spoon.reflect.declaration.ModifierKind;
import spoon.reflect.reference.CtFieldReference;
import spoon.reflect.reference.CtTypeReference;
import spoon.reflect.visitor.CtVisitor;
import spoon.support.SpoonClassNotFoundException;
import spoon.support.util.RtHelper;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Member;
import java.util.Collections;
import java.util.Set;
import static spoon.reflect.path.CtRole.DECLARING_TYPE;
import static spoon.reflect.path.CtRole.IS_FINAL;
import static spoon.reflect.path.CtRole.IS_STATIC;
public class CtFieldReferenceImpl<T> extends CtVariableReferenceImpl<T> implements CtFieldReference<T> {
private static final long serialVersionUID = 1L;
@MetamodelPropertyField(role = DECLARING_TYPE)
CtTypeReference<?> declaringType;
@MetamodelPropertyField(role = IS_FINAL)
boolean fina = false;
@MetamodelPropertyField(role = IS_STATIC)
boolean stat = false;
public CtFieldReferenceImpl() {
}
@Override
public void accept(CtVisitor visitor) {
visitor.visitCtFieldReference(this);
}
@Override
public Member getActualField() {
CtTypeReference<?> typeRef = getDeclaringType();
if (typeRef == null) {
throw new SpoonException("Declaring type of field " + getSimpleName() + " isn't defined");
}
Class<?> clazz;
try {
clazz = typeRef.getActualClass();
} catch (SpoonClassNotFoundException e) {
if (getFactory().getEnvironment().getNoClasspath()) {
Launcher.LOGGER.info("The class " + typeRef.getQualifiedName() + " of field " + getSimpleName() + " is not on class path. Problem ignored in noclasspath mode");
return null;
}
throw e;
}
try {
if (clazz.isAnnotation()) {
return clazz.getDeclaredMethod(getSimpleName());
} else {
return clazz.getDeclaredField(getSimpleName());
}
} catch (NoSuchMethodException | NoSuchFieldException e) {
throw new SpoonException("The field " + getQualifiedName() + " not found", e);
}
}
@Override
protected AnnotatedElement getActualAnnotatedElement() {
return (AnnotatedElement) getActualField();
}
// @Override
// public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
// A annotation = super.getAnnotation(annotationType);
// if (annotation != null) {
// return annotation;
// }
// // use reflection
// Class<?> c = getDeclaringType().getActualClass();
// if (c.isAnnotation()) {
// for (Method m : RtHelper.getAllMethods(c)) {
// if (!getSimpleName().equals(m.getName())) {
// continue;
// }
// m.setAccessible(true);
// return m.getAnnotation(annotationType);
// }
// } else {
// for (Field f : RtHelper.getAllFields(c)) {
// if (!getSimpleName().equals(f.getName())) {
// continue;
// }
// f.setAccessible(true);
// return f.getAnnotation(annotationType);
// }
// }
// return null;
// }
// @Override
// public Annotation[] getAnnotations() {
// Annotation[] annotations = super.getAnnotations();
// if (annotations != null) {
// return annotations;
// }
// // use reflection
// Class<?> c = getDeclaringType().getActualClass();
// for (Field f : RtHelper.getAllFields(c)) {
// if (!getSimpleName().equals(f.getName())) {
// continue;
// }
// f.setAccessible(true);
// return f.getAnnotations();
// }
// // If the fields belong to an annotation type, they are actually
// // methods
// for (Method m : RtHelper.getAllMethods(c)) {
// if (!getSimpleName().equals(m.getName())) {
// continue;
// }
// m.setAccessible(true);
// return m.getAnnotations();
// }
// return null;
// }
@Override
@SuppressWarnings("unchecked")
public CtField<T> getDeclaration() {
return fromDeclaringType();
}
private CtField<T> fromDeclaringType() {
if (declaringType == null) {
return null;
}
CtType<?> type = declaringType.getDeclaration();
if (type != null) {
return (CtField<T>) type.getField(getSimpleName());
}
return null;
}
@Override
public CtField<T> getFieldDeclaration() {
if (declaringType == null) {
return null;
}
CtType<?> type = declaringType.getTypeDeclaration();
if (type != null) {
final CtField<T> ctField = (CtField<T>) type.getField(getSimpleName());
if (ctField == null && type instanceof CtEnum) {
return ((CtEnum) type).getEnumValue(getSimpleName());
}
return ctField;
}
return null;
}
@Override
public CtTypeReference<?> getDeclaringType() {
return declaringType;
}
@Override
public String getQualifiedName() {
CtTypeReference<?> declaringType = getDeclaringType();
if (declaringType != null) {
return getDeclaringType().getQualifiedName() + "#" + getSimpleName();
} else {
return "<unknown>#" + getSimpleName();
}
}
@Override
public boolean isFinal() {
return fina;
}
/**
* Tells if the referenced field is static.
*/
@Override
public boolean isStatic() {
return stat;
}
@Override
public <C extends CtFieldReference<T>> C setDeclaringType(CtTypeReference<?> declaringType) {
if (declaringType != null) {
declaringType.setParent(this);
}
getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, DECLARING_TYPE, declaringType, this.declaringType);
this.declaringType = declaringType;
return (C) this;
}
@Override
public <C extends CtFieldReference<T>> C setFinal(boolean fina) {
getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, IS_FINAL, fina, this.fina);
this.fina = fina;
return (C) this;
}
@Override
public <C extends CtFieldReference<T>> C setStatic(boolean stat) {
getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, IS_STATIC, stat, this.stat);
this.stat = stat;
return (C) this;
}
@Override
public Set<ModifierKind> getModifiers() {
CtVariable<?> v = getDeclaration();
if (v != null) {
return v.getModifiers();
}
Member m = getActualField();
if (m != null) {
return RtHelper.getModifiers(m.getModifiers());
}
return Collections.emptySet();
}
@Override
public CtFieldReference<T> clone() {
return (CtFieldReference<T>) super.clone()
;
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
64953fd88caf7087de98e17d3f1466d625b1c6ea | bd269973faf84050ccd3e7bdd57b1b94d67f02c7 | /control/src/main/java/com/MAVLink/common/msg_position_target_local_ned0.java | 79552a3c3b5ee89a439f0ecd286aba1edcef220f | [] | no_license | guanqingguang0914/man5_sevice | 99b045ed6b30b85cf2e2cae1f0d9cb0ca2ca1375 | 740a7f71f80d6e50372ef5d0e5a203cc1be9bfe5 | refs/heads/master | 2023-08-31T18:23:27.689525 | 2018-12-04T06:18:35 | 2018-12-04T06:18:35 | 160,308,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,248 | java | //// MESSAGE POSITION_TARGET_LOCAL_NED PACKING
//package com.MAVLink.common;
//
//import com.MAVLink.MAVLinkPacket;
//import com.MAVLink.Messages.MAVLinkMessage;
//import com.MAVLink.Messages.MAVLinkPayload;
////import android.util.Log;
//
///**
// * Set vehicle position, velocity and acceleration setpoint in local frame.
// */
//public class msg_position_target_local_ned extends MAVLinkMessage {
//
// public static final int MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED = 85;
// public static final int MAVLINK_MSG_LENGTH = 43;
// private static final long serialVersionUID = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
//
//
// /**
// * Timestamp in milliseconds since system boot
// */
// public int time_boot_ms;
// /**
// * X Position in NED frame in meters
// */
// public float x;
// /**
// * Y Position in NED frame in meters
// */
// public float y;
// /**
// * Z Position in NED frame in meters (note, altitude is negative in NED)
// */
// public float z;
// /**
// * X velocity in NED frame in meter / s
// */
// public float vx;
// /**
// * Y velocity in NED frame in meter / s
// */
// public float vy;
// /**
// * Z velocity in NED frame in meter / s
// */
// public float vz;
// /**
// * X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
// */
// public float afx;
// /**
// * Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
// */
// public float afy;
// /**
// * Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
// */
// public float afz;
// /**
// * Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint
// */
// public short type_mask;
// /**
// * Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9
// */
// public byte coordinate_frame;
//
//
// /**
// * Generates the payload for a mavlink message for a message of this type
// *
// * @return
// */
// public MAVLinkPacket pack() {
// MAVLinkPacket packet = new MAVLinkPacket();
// packet.len = MAVLINK_MSG_LENGTH;
// packet.sysid = 255;
// packet.compid = 190;
// packet.msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
// packet.payload.putInt(time_boot_ms);
// packet.payload.putFloat(x);
// packet.payload.putFloat(y);
// packet.payload.putFloat(z);
// packet.payload.putFloat(vx);
// packet.payload.putFloat(vy);
// packet.payload.putFloat(vz);
// packet.payload.putFloat(afx);
// packet.payload.putFloat(afy);
// packet.payload.putFloat(afz);
// packet.payload.putShort(type_mask);
// packet.payload.putByte(coordinate_frame);
//
// return packet;
// }
//
// /**
// * Decode a position_target_local_ned message into this class fields
// *
// * @param payload The message to decode
// */
// public void unpack(MAVLinkPayload payload) {
// payload.resetIndex();
// this.time_boot_ms = payload.getInt();
// this.x = payload.getFloat();
// this.y = payload.getFloat();
// this.z = payload.getFloat();
// this.vx = payload.getFloat();
// this.vy = payload.getFloat();
// this.vz = payload.getFloat();
// this.afx = payload.getFloat();
// this.afy = payload.getFloat();
// this.afz = payload.getFloat();
// this.type_mask = payload.getShort();
// this.coordinate_frame = payload.getByte();
//
// }
//
// /**
// * Constructor for a new message, just initializes the msgid
// */
// public msg_position_target_local_ned() {
// msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
// }
//
// /**
// * Constructor for a new message, initializes the message with the payload
// * from a mavlink packet
// */
// public msg_position_target_local_ned(MAVLinkPacket mavLinkPacket) {
// this.sysid = mavLinkPacket.sysid;
// this.compid = mavLinkPacket.compid;
// this.msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
// unpack(mavLinkPacket.payload);
// //Log.d("MAVLink", "POSITION_TARGET_LOCAL_NED");
// //Log.d("MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED", toString());
// }
//
//
// /**
// * Returns a string with the MSG name and data
// */
// public String toString() {
// return "MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED -" + " time_boot_ms:" + time_boot_ms + " x:" + x + " y:" + y + " z:" + z + " vx:" + vx + " vy:" + vy + " vz:" + vz + " afx:" + afx + " afy:" + afy + " afz:" + afz + " type_mask:" + type_mask + " coordinate_frame:" + coordinate_frame + "";
// }
//}
// | [
"guanqingguang0914@163.com"
] | guanqingguang0914@163.com |
e4c8a845d44e5cd2a4d6cae33a1771d36df768ba | ac9df9d84b7c9da4921ab0613fb66ff806480f5e | /src/main/java/atlas/Controller.java | f9ef54802805e9004a1ee960d6d92ce152bdaa5b | [] | no_license | simagix/google-map-api | 7c4a18740b2ebce6fb90b0044fc4b023d76ddf3e | beade36c12d2f8b54be56ad4a2bbbb0191e893e2 | refs/heads/master | 2021-01-11T14:46:56.540018 | 2017-02-10T19:39:03 | 2017-02-10T19:39:03 | 80,215,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,523 | java | package atlas;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Component
public class Controller {
private AddressRepo repo;
public Controller(AddressRepo repo) {
this.repo = repo;
}
@RequestMapping("/geocode")
@ResponseBody
public ResponseEntity<String> geocode(@RequestParam(value = "latlng") String latLong, @RequestParam(value = "key") String apiKey,
HttpServletRequest request, HttpServletResponse response) {
try {
return new ResponseEntity<String>(repo.getAddress(latLong, apiKey).getFormattedAddress(), HttpStatus.OK);
} catch (IOException e) {
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
} catch (InvalidInputException e) {
return new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
}
}
@RequestMapping("/geocode/history")
@ResponseBody
public ResponseEntity<List<Address>> geocode(HttpServletRequest request, HttpServletResponse response) {
return new ResponseEntity<List<Address>>(repo.getCache(), HttpStatus.OK);
}
}
| [
"simagix@gmail.com"
] | simagix@gmail.com |
2519c23b007a1ec940bd339a54f60ef2691ceb02 | 735c1ab97f0c3001327b9be9465731c3d67e1d49 | /src/main/java/util/Loggers.java | 9780f332a3cc5b49644f0cc6d5589a6f4b73d5a2 | [
"Apache-2.0"
] | permissive | M-Razavi/spark-basic-structure | 35f0a8a0e486a8e8a650af0f71660e6081f6ea7d | 0b00170351fd4fec3d0a36938fbbc0e2e9c2c612 | refs/heads/master | 2023-06-25T02:59:04.761417 | 2022-04-11T08:54:23 | 2022-04-11T08:54:23 | 101,721,784 | 1 | 0 | Apache-2.0 | 2023-06-19T17:46:23 | 2017-08-29T05:19:31 | Java | UTF-8 | Java | false | false | 957 | java | /**
* Copyright (c) 2015 . All rights reserved.
*
*
* Part of project common LastEdit Jul 12, 2017-3:23:02 PM
*
*
*
* @author Mahdi
* @version 1.0
* @see
*/
package util;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
/**
* @author Mahdi
*
* Loggers
*/
public class Loggers {
public static final Logger defaultLogger = LoggerFactory.getLogger(Logger.class);
/** The Constant Access (logic based logger). */
public static final Logger Access = LoggerFactory.getLogger("access");
/** The Constant Application (section based logger). */
public static final Logger Application = LoggerFactory.getLogger("app");
/** The Constant Network (section based logger). */
public static final Logger Network = LoggerFactory.getLogger("net");
/** The Constant Packet (section based logger). */
public static final Logger Packet = LoggerFactory.getLogger("pkt");
}
| [
"razavi.dev@gmail.com"
] | razavi.dev@gmail.com |
4a220df22cbf3d46cb2869fbb6c05d96019712b7 | 224c3693c33633de5ff9fdcbc6a39bab04df01ca | /app/src/main/java/google/com/fabquiz/Login/Edit_Profile_Fragment.java | 7bd458750a513e9ab41e8df7c5a88b117f42d187 | [
"Apache-2.0"
] | permissive | pratiktimer/Fabquiz | 98be4787d9ba293d7b0c3fa4e9a9ec8b4fc53ad1 | 651be3532b219ac1308f07ca158b401643f47098 | refs/heads/master | 2020-04-23T06:23:01.470642 | 2019-02-17T12:31:52 | 2019-02-17T12:31:52 | 170,971,384 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,513 | java | package google.com.fabquiz.Login;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.OnProgressListener;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import google.com.fabquiz.MainActivity;
import google.com.fabquiz.R;
import google.com.fabquiz.Settings_Fragment;
import google.com.fabquiz.ToastPackage.CustomToast;
import google.com.fabquiz.ToastPackage.CustomToast2;
import google.com.fabquiz.database.Helper;
import google.com.fabquiz.multiplayers.multiplayers;
import jp.wasabeef.picasso.transformations.CropCircleTransformation;
import static android.app.Activity.RESULT_OK;
public class Edit_Profile_Fragment extends Fragment implements OnClickListener {
private static EditText username;
private static FragmentManager fragmentManager;
Animation zoomin, zoomout;
ImageView image;
FirebaseFirestore mFirestore;
private static View view;
private Button SaveinfoButton;
Uri photoURI;
FirebaseDatabase database;
DatabaseReference users,contacts;
private FirebaseAuth mAuth;
private StorageReference mStorage;
ProgressBar progressBar;
private static final int GALLERY_INTENT = 2;
private static final int CAPTURE_INTENT = 1;
private static int MY_PERMISSIONS_REQUEST_READ_CONTACTS=90;
String nametheimage, getprofile;
FirebaseAuth.AuthStateListener mAuthListener;
@Override
public void onStart() {
super.onStart();
mAuthListener.onAuthStateChanged(mAuth);
}
public Edit_Profile_Fragment() {
database = FirebaseDatabase.getInstance();
users = database.getReference("Users");
contacts = database.getReference("Contact");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.edit_user_profile, container, false);
((Login)getActivity()).updateStatusBarColor("#202021");
mAuth = FirebaseAuth.getInstance();
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
if (firebaseAuth.getCurrentUser() == null) {
startActivity(new Intent(getActivity(), MainActivity.class));
}
}
};
initViews();
setListeners();
getuserinfo();
getprofile();
return view;
}
private void initViews() {
fragmentManager = getActivity().getSupportFragmentManager();
progressBar=(ProgressBar) view.findViewById(R.id.progressBar2);
mStorage = FirebaseStorage.getInstance().getReference();
username = (EditText) view.findViewById(R.id.username);
SaveinfoButton = (Button) view.findViewById(R.id.save);
if (Settings_Fragment.comingfromsettings = true) {
SaveinfoButton.setText(R.string.Save);
} else {
SaveinfoButton.setText(R.string.Next);
}
image = (ImageView) view.findViewById(R.id.profilepic);
zoomin = AnimationUtils.loadAnimation(getActivity(), R.anim.zoom_in);
zoomout = AnimationUtils.loadAnimation(getActivity(), R.anim.zoom_out);
}
private void setListeners() {
image.setOnClickListener(this);
SaveinfoButton.setOnClickListener(this);
}
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case 90: {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
} else {
Toast.makeText(getActivity(),"Camera featured is Disabled ", Toast.LENGTH_LONG).show();
}
super.onRequestPermissionsResult(requestCode,permissions,grantResults);
}
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.profilepic:
if (ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
selectImage();
}
else{
Helper.hasPermissions2(getActivity(),MY_PERMISSIONS_REQUEST_READ_CONTACTS, android.Manifest.permission.CAMERA,(R.string.camera),(R.string.camera_disabled));
}
break;
case R.id.save:
updateinformation();
break;
}
}
private void updateinformation() {
final String getFullName = username.getText().toString();
if (getFullName.equals("") || getFullName.length() == 0
) {
new CustomToast().Show_Toast(getActivity(), view, "Username field is Required.");
} else {
changepassword(getFullName);
}
}
private void changepassword(final String getPassword) {
mAuth = FirebaseAuth.getInstance();
FirebaseUser user = mAuth.getCurrentUser();
updatedb(getPassword);
if (user != null) {
updatedb(getPassword);
if (Login.firstlogin == true) {
if (getPassword != null) {
String goto2= String.valueOf(2);
Intent i = new Intent(getActivity(), multiplayers.class);
i.putExtra("message", goto2);
startActivity(i);
getActivity().overridePendingTransition(R.anim.right_enter, R.anim.left_out);
}
}
// else if(Settings_Fragment.comingfromsettings==false){
// startActivity(new Intent(getActivity(), multiplayers.class));
// getActivity().finish();
// }
// else if(Settings_Fragment.comingfromsettings==true) {
// }
//
// }
}
}
private void updatedb(final String getPassword) {
final FirebaseUser user = mAuth.getCurrentUser();
users.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot zoneSnapshot : dataSnapshot.getChildren()) {
if (user.getPhoneNumber() != null && (user.getPhoneNumber().toString().equals(zoneSnapshot.child("phonenumber").getValue(String.class)))) {
zoneSnapshot.getRef().child("fullname").setValue(getPassword);
new CustomToast2().Show_Toast(getActivity(), view,
"Updated Information :(!!!.");
getuserinfo();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void getuserinfo() {
FirebaseUser user = mAuth.getCurrentUser();
final String getEmailId = user.getPhoneNumber();
users.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot zoneSnapshot : dataSnapshot.getChildren()) {
if (getEmailId.equals(zoneSnapshot.child("phonenumber").getValue(String.class))) {
nametheimage = (zoneSnapshot.child("phonenumber").getValue(String.class));
getprofile = zoneSnapshot.child("getprofile").getValue(String.class);
username.setText(zoneSnapshot.child("fullname").getValue(String.class));
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void dispatchTakePictureIntent() {
if(Helper.hasPermissions4(getActivity()) == false){
}
else {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException e) {
e.printStackTrace();
}
if (photoFile != null) {
//Toast.makeText(getActivity(),"image not null",Toast.LENGTH_SHORT).show();
// photoURI = FileProvider.getUriForFile(getActivity(),
// "com.example.android.fileprovider",
// photoFile);
photoURI = Uri.fromFile(photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, CAPTURE_INTENT);
}
}
}
}
private void getprofile() {
final FirebaseUser user = mAuth.getCurrentUser();
users.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot zoneSnapshot : dataSnapshot.getChildren()) {
if (user.getPhoneNumber().equals(zoneSnapshot.child("phonenumber").getValue(String.class))) {
String Profile=zoneSnapshot.child("getprofile").getValue(String.class);
if(Profile==null|Profile.equals("")) {
image.setImageResource(R.drawable.profilepic);
}
else{
Picasso.with(getActivity()).load(zoneSnapshot.child("getprofile").getValue(String.class))
.transform(new CropCircleTransformation())
.into(image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
}
});
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
} @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 1:
if (resultCode == RESULT_OK && requestCode == CAPTURE_INTENT) {
FirebaseUser user = mAuth.getCurrentUser();
final String getEmailId = user.getPhoneNumber();
StorageReference filepath = mStorage.child("Photos").child(getEmailId);
filepath.putFile(photoURI).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Uri downloadUri = taskSnapshot.getDownloadUrl();
setprofile(downloadUri);
}
});
}
else{
}
break;
case 2:
if (requestCode == GALLERY_INTENT && resultCode == RESULT_OK) {
FirebaseUser user = mAuth.getCurrentUser();
final String getEmailId = user.getPhoneNumber();
final Uri uri = data.getData();
StorageReference filepath = mStorage.child("Photos").child(getEmailId);
filepath.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Uri downloadUri = taskSnapshot.getDownloadUrl();
if(getActivity()!=null) {
progressBar.setVisibility(ProgressBar.INVISIBLE);
Toast.makeText(getActivity(), "Profile Picture Set Successfully", Toast.LENGTH_SHORT).show();
}
setprofile(downloadUri);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
if(getActivity()!=null) {
progressBar.setVisibility(ProgressBar.INVISIBLE);
Toast.makeText(getActivity(), "Failed To Set Profile ", Toast.LENGTH_SHORT).show();
}
}
}).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
@Override
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
progressBar.setVisibility(ProgressBar.VISIBLE);
double progresslength=(100*taskSnapshot.getBytesTransferred())/taskSnapshot.getTotalByteCount();
progressBar.setProgress((int)progresslength);
}
});
}
break;
}
}
private void uploadimage() {
if(Helper.hasPermissions4(getActivity()) == false){
}
else {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, GALLERY_INTENT);
}
}
private void selectImage() {
final CharSequence[] options = {"Take Photo", "Choose From Gallery"};
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(getActivity());
builder.setTitle("Select Option");
builder.setItems(options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
if (options[item].equals("Take Photo")) {
dialog.dismiss();
dispatchTakePictureIntent();
} else if (options[item].equals("Choose From Gallery")) {
dialog.dismiss();
uploadimage();
}
}
});
builder.show();
}
String mCurrentPhotoPath;
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = "file:" + image.getAbsolutePath();
return image;
}
private void setprofile(final Uri downloadUri) {
final String durl = String.valueOf(downloadUri);
FirebaseUser user = mAuth.getCurrentUser();
final String getEmailId = user.getPhoneNumber();
users.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot zoneSnapshot : dataSnapshot.getChildren()) {
if (getEmailId.equals(zoneSnapshot.child("phonenumber").getValue(String.class))) {
zoneSnapshot.getRef().child("getprofile").setValue(durl);
getprofile();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
| [
"pbanawalkar2@gmail.com"
] | pbanawalkar2@gmail.com |
efcc2101ba3143b564a27f071ccde839a71aac86 | fa86b8b2a82fdf880719a13bcfafaefb9bb8cb3b | /canal-client/canal-client-es/src/main/java/com/fanxuankai/zeus/canal/client/es/metadata/CanalToEsMetadata.java | b01c06c193fae687ed8e4e78b482a51cc4e40e97 | [] | no_license | yangfan19921108/zeus | 4bb0019730ac456f1372e2de2a53252522109011 | 46557ef3e7d747a8dfeb320e8938bd843cfae344 | refs/heads/master | 2022-09-23T00:47:45.080597 | 2020-06-01T08:47:22 | 2020-06-01T08:47:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | package com.fanxuankai.zeus.canal.client.es.metadata;
import com.fanxuankai.zeus.canal.client.core.metadata.FilterMetadata;
import com.fanxuankai.zeus.canal.client.es.annotation.CanalToEs;
import lombok.Getter;
/**
* CanalToEs 注解元数据
*
* @author fanxuankai
*/
@Getter
public class CanalToEsMetadata {
private FilterMetadata filterMetadata = new FilterMetadata();
public CanalToEsMetadata(CanalToEs canalToEs) {
if (canalToEs != null) {
this.filterMetadata = new FilterMetadata(canalToEs.filter());
}
}
}
| [
"fan_xuankai@126.com"
] | fan_xuankai@126.com |
1c0b56659ffc52a50983d22bf9a892018d9b2f50 | 69146b3b824eec12254b5482b832c56969be6cb7 | /src/main/java/org/simpleframework/xml/filter/MapFilter.java | 74df629a75466f2ec59f527f19f24952be9d2a4c | [
"Apache-2.0"
] | permissive | ngallagher/simplexml | 4f832ad3137bee24efcbe2558fe919db95126a9a | 01d47a6561bd5f7654b414591f8f02c66d316ab4 | refs/heads/master | 2023-08-24T19:28:49.794567 | 2019-03-26T00:50:25 | 2019-03-26T00:50:25 | 42,610,403 | 103 | 36 | Apache-2.0 | 2020-10-13T09:00:39 | 2015-09-16T20:02:45 | Java | UTF-8 | Java | false | false | 2,960 | java | /*
* MapFilter.java May 2006
*
* Copyright (C) 2006, Niall Gallagher <niallg@users.sf.net>
*
* 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.simpleframework.xml.filter;
import java.util.Map;
/**
* The <code>MapFilter</code> object is a filter that can make use
* of user specified mappings for replacement. This filter can be
* given a <code>Map</code> of name value pairs which will be used
* to resolve a value using the specified mappings. If there is
* no match found the filter will delegate to the provided filter.
*
* @author Niall Gallagher
*/
public class MapFilter implements Filter {
/**
* This will resolve the replacement if no mapping is found.
*/
private Filter filter;
/**
* This contains a collection of user specified mappings.
*/
private Map map;
/**
* Constructor for the <code>MapFilter</code> object. This will
* use the specified mappings to resolve replacements. If this
* map does not contain a requested mapping null is resolved.
*
* @param map this contains the user specified mappings
*/
public MapFilter(Map map) {
this(map, null);
}
/**
* Constructor for the <code>MapFilter</code> object. This will
* use the specified mappings to resolve replacements. If this
* map does not contain a requested mapping the provided filter
* is used to resolve the replacement text.
*
* @param map this contains the user specified mappings
* @param filter this is delegated to if the map fails
*/
public MapFilter(Map map, Filter filter) {
this.filter = filter;
this.map = map;
}
/**
* Replaces the text provided with the value resolved from the
* specified <code>Map</code>. If the map fails this will
* delegate to the specified <code>Filter</code> if it is not
* a null object. If no match is found a null is returned.
*
* @param text this is the text value to be replaced
*
* @return this will return the replacement text resolved
*/
public String replace(String text) {
Object value = null;
if(map != null) {
value = map.get(text);
}
if(value != null) {
return value.toString();
}
if(filter != null) {
return filter.replace(text);
}
return null;
}
}
| [
"niallg@124fc276-1b20-0410-8d16-dc08e6bff5e9"
] | niallg@124fc276-1b20-0410-8d16-dc08e6bff5e9 |
703d2a5d3242cbfb5c7de808b0a490af0d7e33d6 | 5d6b3ad627a778575c06850ed8a61dd42d696620 | /dbflute-postgresql-example/src/main/java/com/example/dbflute/postgresql/dbflute/bsbhv/BsWhiteCompoundPkBhv.java | 13c0c765c28774b5370a175b7f605e8ff08ca64a | [
"Apache-2.0"
] | permissive | hajimeni/dbflute-example-database | 9246ba7959b33e3b4eb470e9fd3e26aa78d0519a | 66b8fdf4fec3a63eb8fce1705e86061c88a216b1 | refs/heads/master | 2020-12-25T14:33:48.342906 | 2013-10-10T16:35:24 | 2013-10-10T16:35:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 72,475 | java | package com.example.dbflute.postgresql.dbflute.bsbhv;
import java.util.List;
import org.seasar.dbflute.*;
import org.seasar.dbflute.bhv.*;
import org.seasar.dbflute.cbean.*;
import org.seasar.dbflute.dbmeta.DBMeta;
import org.seasar.dbflute.outsidesql.executor.*;
import com.example.dbflute.postgresql.dbflute.exbhv.*;
import com.example.dbflute.postgresql.dbflute.exentity.*;
import com.example.dbflute.postgresql.dbflute.bsentity.dbmeta.*;
import com.example.dbflute.postgresql.dbflute.cbean.*;
/**
* The behavior of white_compound_pk as TABLE. <br />
* <pre>
* [primary key]
* pk_first_id, pk_second_id
*
* [column]
* pk_first_id, pk_second_id, pk_name
*
* [sequence]
*
*
* [identity]
*
*
* [version-no]
*
*
* [foreign table]
*
*
* [referrer table]
* white_compound_pk_ref
*
* [foreign property]
*
*
* [referrer property]
* whiteCompoundPkRefList
* </pre>
* @author DBFlute(AutoGenerator)
*/
public abstract class BsWhiteCompoundPkBhv extends AbstractBehaviorWritable {
// ===================================================================================
// Definition
// ==========
/*df:beginQueryPath*/
/*df:endQueryPath*/
// ===================================================================================
// Table name
// ==========
/** @return The name on database of table. (NotNull) */
public String getTableDbName() { return "white_compound_pk"; }
// ===================================================================================
// DBMeta
// ======
/** @return The instance of DBMeta. (NotNull) */
public DBMeta getDBMeta() { return WhiteCompoundPkDbm.getInstance(); }
/** @return The instance of DBMeta as my table type. (NotNull) */
public WhiteCompoundPkDbm getMyDBMeta() { return WhiteCompoundPkDbm.getInstance(); }
// ===================================================================================
// New Instance
// ============
/** {@inheritDoc} */
public Entity newEntity() { return newMyEntity(); }
/** {@inheritDoc} */
public ConditionBean newConditionBean() { return newMyConditionBean(); }
/** @return The instance of new entity as my table type. (NotNull) */
public WhiteCompoundPk newMyEntity() { return new WhiteCompoundPk(); }
/** @return The instance of new condition-bean as my table type. (NotNull) */
public WhiteCompoundPkCB newMyConditionBean() { return new WhiteCompoundPkCB(); }
// ===================================================================================
// Count Select
// ============
/**
* Select the count of uniquely-selected records by the condition-bean. {IgnorePagingCondition, IgnoreSpecifyColumn}<br />
* SpecifyColumn is ignored but you can use it only to remove text type column for union's distinct.
* <pre>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* int count = whiteCompoundPkBhv.<span style="color: #FD4747">selectCount</span>(cb);
* </pre>
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @return The count for the condition. (NotMinus)
*/
public int selectCount(WhiteCompoundPkCB cb) {
return doSelectCountUniquely(cb);
}
protected int doSelectCountUniquely(WhiteCompoundPkCB cb) { // called by selectCount(cb)
assertCBStateValid(cb);
return delegateSelectCountUniquely(cb);
}
protected int doSelectCountPlainly(WhiteCompoundPkCB cb) { // called by selectPage(cb)
assertCBStateValid(cb);
return delegateSelectCountPlainly(cb);
}
@Override
protected int doReadCount(ConditionBean cb) {
return selectCount(downcast(cb));
}
// ===================================================================================
// Entity Select
// =============
/**
* Select the entity by the condition-bean.
* <pre>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* WhiteCompoundPk whiteCompoundPk = whiteCompoundPkBhv.<span style="color: #FD4747">selectEntity</span>(cb);
* if (whiteCompoundPk != null) {
* ... = whiteCompoundPk.get...();
* } else {
* ...
* }
* </pre>
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @return The entity selected by the condition. (NullAllowed: if no data, it returns null)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
*/
public WhiteCompoundPk selectEntity(WhiteCompoundPkCB cb) {
return doSelectEntity(cb, WhiteCompoundPk.class);
}
protected <ENTITY extends WhiteCompoundPk> ENTITY doSelectEntity(final WhiteCompoundPkCB cb, Class<ENTITY> entityType) {
assertCBStateValid(cb);
return helpSelectEntityInternally(cb, entityType, new InternalSelectEntityCallback<ENTITY, WhiteCompoundPkCB>() {
public List<ENTITY> callbackSelectList(WhiteCompoundPkCB cb, Class<ENTITY> entityType) { return doSelectList(cb, entityType); } });
}
@Override
protected Entity doReadEntity(ConditionBean cb) {
return selectEntity(downcast(cb));
}
/**
* Select the entity by the condition-bean with deleted check.
* <pre>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* WhiteCompoundPk whiteCompoundPk = whiteCompoundPkBhv.<span style="color: #FD4747">selectEntityWithDeletedCheck</span>(cb);
* ... = whiteCompoundPk.get...(); <span style="color: #3F7E5E">// the entity always be not null</span>
* </pre>
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @return The entity selected by the condition. (NotNull: if no data, throws exception)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
*/
public WhiteCompoundPk selectEntityWithDeletedCheck(WhiteCompoundPkCB cb) {
return doSelectEntityWithDeletedCheck(cb, WhiteCompoundPk.class);
}
protected <ENTITY extends WhiteCompoundPk> ENTITY doSelectEntityWithDeletedCheck(final WhiteCompoundPkCB cb, Class<ENTITY> entityType) {
assertCBStateValid(cb);
return helpSelectEntityWithDeletedCheckInternally(cb, entityType, new InternalSelectEntityWithDeletedCheckCallback<ENTITY, WhiteCompoundPkCB>() {
public List<ENTITY> callbackSelectList(WhiteCompoundPkCB cb, Class<ENTITY> entityType) { return doSelectList(cb, entityType); } });
}
@Override
protected Entity doReadEntityWithDeletedCheck(ConditionBean cb) {
return selectEntityWithDeletedCheck(downcast(cb));
}
/**
* Select the entity by the primary-key value.
* @param pkFirstId The one of primary key. (NotNull)
* @param pkSecondId The one of primary key. (NotNull)
* @return The entity selected by the PK. (NullAllowed: if no data, it returns null)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
*/
public WhiteCompoundPk selectByPKValue(Integer pkFirstId, Integer pkSecondId) {
return doSelectByPKValue(pkFirstId, pkSecondId, WhiteCompoundPk.class);
}
protected <ENTITY extends WhiteCompoundPk> ENTITY doSelectByPKValue(Integer pkFirstId, Integer pkSecondId, Class<ENTITY> entityType) {
return doSelectEntity(buildPKCB(pkFirstId, pkSecondId), entityType);
}
/**
* Select the entity by the primary-key value with deleted check.
* @param pkFirstId The one of primary key. (NotNull)
* @param pkSecondId The one of primary key. (NotNull)
* @return The entity selected by the PK. (NotNull: if no data, throws exception)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found.
*/
public WhiteCompoundPk selectByPKValueWithDeletedCheck(Integer pkFirstId, Integer pkSecondId) {
return doSelectByPKValueWithDeletedCheck(pkFirstId, pkSecondId, WhiteCompoundPk.class);
}
protected <ENTITY extends WhiteCompoundPk> ENTITY doSelectByPKValueWithDeletedCheck(Integer pkFirstId, Integer pkSecondId, Class<ENTITY> entityType) {
return doSelectEntityWithDeletedCheck(buildPKCB(pkFirstId, pkSecondId), entityType);
}
private WhiteCompoundPkCB buildPKCB(Integer pkFirstId, Integer pkSecondId) {
assertObjectNotNull("pkFirstId", pkFirstId);assertObjectNotNull("pkSecondId", pkSecondId);
WhiteCompoundPkCB cb = newMyConditionBean();
cb.query().setPkFirstId_Equal(pkFirstId);cb.query().setPkSecondId_Equal(pkSecondId);
return cb;
}
// ===================================================================================
// List Select
// ===========
/**
* Select the list as result bean.
* <pre>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* cb.query().addOrderBy_Bar...();
* ListResultBean<WhiteCompoundPk> whiteCompoundPkList = whiteCompoundPkBhv.<span style="color: #FD4747">selectList</span>(cb);
* for (WhiteCompoundPk whiteCompoundPk : whiteCompoundPkList) {
* ... = whiteCompoundPk.get...();
* }
* </pre>
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @return The result bean of selected list. (NotNull: if no data, returns empty list)
* @exception org.seasar.dbflute.exception.DangerousResultSizeException When the result size is over the specified safety size.
*/
public ListResultBean<WhiteCompoundPk> selectList(WhiteCompoundPkCB cb) {
return doSelectList(cb, WhiteCompoundPk.class);
}
protected <ENTITY extends WhiteCompoundPk> ListResultBean<ENTITY> doSelectList(WhiteCompoundPkCB cb, Class<ENTITY> entityType) {
assertCBStateValid(cb); assertObjectNotNull("entityType", entityType);
assertSpecifyDerivedReferrerEntityProperty(cb, entityType);
return helpSelectListInternally(cb, entityType, new InternalSelectListCallback<ENTITY, WhiteCompoundPkCB>() {
public List<ENTITY> callbackSelectList(WhiteCompoundPkCB cb, Class<ENTITY> entityType) { return delegateSelectList(cb, entityType); } });
}
@Override
protected ListResultBean<? extends Entity> doReadList(ConditionBean cb) {
return selectList(downcast(cb));
}
// ===================================================================================
// Page Select
// ===========
/**
* Select the page as result bean. <br />
* (both count-select and paging-select are executed)
* <pre>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* cb.query().addOrderBy_Bar...();
* cb.<span style="color: #FD4747">paging</span>(20, 3); <span style="color: #3F7E5E">// 20 records per a page and current page number is 3</span>
* PagingResultBean<WhiteCompoundPk> page = whiteCompoundPkBhv.<span style="color: #FD4747">selectPage</span>(cb);
* int allRecordCount = page.getAllRecordCount();
* int allPageCount = page.getAllPageCount();
* boolean isExistPrePage = page.isExistPrePage();
* boolean isExistNextPage = page.isExistNextPage();
* ...
* for (WhiteCompoundPk whiteCompoundPk : page) {
* ... = whiteCompoundPk.get...();
* }
* </pre>
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @return The result bean of selected page. (NotNull: if no data, returns bean as empty list)
* @exception org.seasar.dbflute.exception.DangerousResultSizeException When the result size is over the specified safety size.
*/
public PagingResultBean<WhiteCompoundPk> selectPage(WhiteCompoundPkCB cb) {
return doSelectPage(cb, WhiteCompoundPk.class);
}
protected <ENTITY extends WhiteCompoundPk> PagingResultBean<ENTITY> doSelectPage(WhiteCompoundPkCB cb, Class<ENTITY> entityType) {
assertCBStateValid(cb); assertObjectNotNull("entityType", entityType);
return helpSelectPageInternally(cb, entityType, new InternalSelectPageCallback<ENTITY, WhiteCompoundPkCB>() {
public int callbackSelectCount(WhiteCompoundPkCB cb) { return doSelectCountPlainly(cb); }
public List<ENTITY> callbackSelectList(WhiteCompoundPkCB cb, Class<ENTITY> entityType) { return doSelectList(cb, entityType); }
});
}
@Override
protected PagingResultBean<? extends Entity> doReadPage(ConditionBean cb) {
return selectPage(downcast(cb));
}
// ===================================================================================
// Cursor Select
// =============
/**
* Select the cursor by the condition-bean.
* <pre>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* whiteCompoundPkBhv.<span style="color: #FD4747">selectCursor</span>(cb, new EntityRowHandler<WhiteCompoundPk>() {
* public void handle(WhiteCompoundPk entity) {
* ... = entity.getFoo...();
* }
* });
* </pre>
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @param entityRowHandler The handler of entity row of WhiteCompoundPk. (NotNull)
*/
public void selectCursor(WhiteCompoundPkCB cb, EntityRowHandler<WhiteCompoundPk> entityRowHandler) {
doSelectCursor(cb, entityRowHandler, WhiteCompoundPk.class);
}
protected <ENTITY extends WhiteCompoundPk> void doSelectCursor(WhiteCompoundPkCB cb, EntityRowHandler<ENTITY> entityRowHandler, Class<ENTITY> entityType) {
assertCBStateValid(cb); assertObjectNotNull("entityRowHandler<WhiteCompoundPk>", entityRowHandler); assertObjectNotNull("entityType", entityType);
assertSpecifyDerivedReferrerEntityProperty(cb, entityType);
helpSelectCursorInternally(cb, entityRowHandler, entityType, new InternalSelectCursorCallback<ENTITY, WhiteCompoundPkCB>() {
public void callbackSelectCursor(WhiteCompoundPkCB cb, EntityRowHandler<ENTITY> entityRowHandler, Class<ENTITY> entityType) { delegateSelectCursor(cb, entityRowHandler, entityType); }
public List<ENTITY> callbackSelectList(WhiteCompoundPkCB cb, Class<ENTITY> entityType) { return doSelectList(cb, entityType); }
});
}
// ===================================================================================
// Scalar Select
// =============
/**
* Select the scalar value derived by a function from uniquely-selected records. <br />
* You should call a function method after this method called like as follows:
* <pre>
* whiteCompoundPkBhv.<span style="color: #FD4747">scalarSelect</span>(Date.class).max(new ScalarQuery() {
* public void query(WhiteCompoundPkCB cb) {
* cb.specify().<span style="color: #FD4747">columnFooDatetime()</span>; <span style="color: #3F7E5E">// required for a function</span>
* cb.query().setBarName_PrefixSearch("S");
* }
* });
* </pre>
* @param <RESULT> The type of result.
* @param resultType The type of result. (NotNull)
* @return The scalar value derived by a function. (NullAllowed)
*/
public <RESULT> SLFunction<WhiteCompoundPkCB, RESULT> scalarSelect(Class<RESULT> resultType) {
return doScalarSelect(resultType, newMyConditionBean());
}
protected <RESULT, CB extends WhiteCompoundPkCB> SLFunction<CB, RESULT> doScalarSelect(Class<RESULT> resultType, CB cb) {
assertObjectNotNull("resultType", resultType); assertCBStateValid(cb);
cb.xsetupForScalarSelect(); cb.getSqlClause().disableSelectIndex(); // for when you use union
return new SLFunction<CB, RESULT>(cb, resultType);
}
// ===================================================================================
// Sequence
// ========
@Override
protected Number doReadNextVal() {
String msg = "This table is NOT related to sequence: " + getTableDbName();
throw new UnsupportedOperationException(msg);
}
// ===================================================================================
// Load Referrer
// =============
/**
* {Refer to overload method that has an argument of the list of entity.}
* @param whiteCompoundPk The entity of whiteCompoundPk. (NotNull)
* @param conditionBeanSetupper The instance of referrer condition-bean set-upper for registering referrer condition. (NotNull)
*/
public void loadWhiteCompoundPkRefList(WhiteCompoundPk whiteCompoundPk, ConditionBeanSetupper<WhiteCompoundPkRefCB> conditionBeanSetupper) {
xassLRArg(whiteCompoundPk, conditionBeanSetupper);
loadWhiteCompoundPkRefList(xnewLRLs(whiteCompoundPk), conditionBeanSetupper);
}
/**
* Load referrer of whiteCompoundPkRefList with the set-upper for condition-bean of referrer. <br />
* white_compound_pk_ref by ref_first_id, ref_second_id, named 'whiteCompoundPkRefList'.
* <pre>
* whiteCompoundPkBhv.<span style="color: #FD4747">loadWhiteCompoundPkRefList</span>(whiteCompoundPkList, new ConditionBeanSetupper<WhiteCompoundPkRefCB>() {
* public void setup(WhiteCompoundPkRefCB cb) {
* cb.setupSelect...();
* cb.query().setFoo...(value);
* cb.query().addOrderBy_Bar...(); <span style="color: #3F7E5E">// basically you should order referrer list</span>
* }
* });
* for (WhiteCompoundPk whiteCompoundPk : whiteCompoundPkList) {
* ... = whiteCompoundPk.<span style="color: #FD4747">getWhiteCompoundPkRefList()</span>;
* }
* </pre>
* About internal policy, the value of primary key(and others too) is treated as case-insensitive. <br />
* The condition-bean that the set-upper provides have settings before you touch it. It is as follows:
* <pre>
* cb.query().set[ForeignKey]_InScope(pkList);
* cb.query().addOrderBy_[ForeignKey]_Asc();
* </pre>
* @param whiteCompoundPkList The entity list of whiteCompoundPk. (NotNull)
* @param conditionBeanSetupper The instance of referrer condition-bean set-upper for registering referrer condition. (NotNull)
*/
public void loadWhiteCompoundPkRefList(List<WhiteCompoundPk> whiteCompoundPkList, ConditionBeanSetupper<WhiteCompoundPkRefCB> conditionBeanSetupper) {
xassLRArg(whiteCompoundPkList, conditionBeanSetupper);
loadWhiteCompoundPkRefList(whiteCompoundPkList, new LoadReferrerOption<WhiteCompoundPkRefCB, WhiteCompoundPkRef>().xinit(conditionBeanSetupper));
}
/**
* {Refer to overload method that has an argument of the list of entity.}
* @param whiteCompoundPk The entity of whiteCompoundPk. (NotNull)
* @param loadReferrerOption The option of load-referrer. (NotNull)
*/
public void loadWhiteCompoundPkRefList(WhiteCompoundPk whiteCompoundPk, LoadReferrerOption<WhiteCompoundPkRefCB, WhiteCompoundPkRef> loadReferrerOption) {
xassLRArg(whiteCompoundPk, loadReferrerOption);
loadWhiteCompoundPkRefList(xnewLRLs(whiteCompoundPk), loadReferrerOption);
}
/**
* {Refer to overload method that has an argument of condition-bean setupper.}
* @param whiteCompoundPkList The entity list of whiteCompoundPk. (NotNull)
* @param loadReferrerOption The option of load-referrer. (NotNull)
*/
public void loadWhiteCompoundPkRefList(List<WhiteCompoundPk> whiteCompoundPkList, LoadReferrerOption<WhiteCompoundPkRefCB, WhiteCompoundPkRef> loadReferrerOption) {
xassLRArg(whiteCompoundPkList, loadReferrerOption);
if (whiteCompoundPkList.isEmpty()) { return; }
final WhiteCompoundPkRefBhv referrerBhv = xgetBSFLR().select(WhiteCompoundPkRefBhv.class);
helpLoadReferrerInternally(whiteCompoundPkList, loadReferrerOption, new InternalLoadReferrerCallback<WhiteCompoundPk, java.util.Map<String, Object>, WhiteCompoundPkRefCB, WhiteCompoundPkRef>() {
public java.util.Map<String, Object> getPKVal(WhiteCompoundPk e) {
java.util.Map<String, Object> primaryKeyMap = new java.util.LinkedHashMap<String, Object>();
primaryKeyMap.put("PkFirstId", e.getPkFirstId());
primaryKeyMap.put("PkSecondId", e.getPkSecondId());
return primaryKeyMap;
}
public void setRfLs(WhiteCompoundPk e, List<WhiteCompoundPkRef> ls) { e.setWhiteCompoundPkRefList(ls); }
public WhiteCompoundPkRefCB newMyCB() { return referrerBhv.newMyConditionBean(); }
public void qyFKIn(WhiteCompoundPkRefCB cb, List<java.util.Map<String, Object>> ls) {
final String aliasName = cb.getSqlClause().getBasePointAliasName();
String identity = null;
StringBuilder sb = new StringBuilder();
for (java.util.Map<String, Object> primaryKeyMap : ls) {
if (sb.length() > 0) { sb.append(")").append(ln()).append(" or ("); }
sb.append(aliasName).append(".ref_first_id = ");
identity = "whiteCompoundPkRefListPkFirstId";
sb.append(cb.query().xregisterFreeParameterToThemeList(identity, primaryKeyMap.get("PkFirstId")));
sb.append(" and ");
sb.append(aliasName).append(".ref_second_id = ");
identity = "whiteCompoundPkRefListPkSecondId";
sb.append(cb.query().xregisterFreeParameterToThemeList(identity, primaryKeyMap.get("PkSecondId")));
}
sb.insert(0, "((").append("))");
cb.getSqlClause().registerWhereClause(sb.toString(), aliasName);
}
public void qyOdFKAsc(WhiteCompoundPkRefCB cb) {
cb.query().addOrderBy_RefFirstId_Asc();
cb.query().addOrderBy_RefSecondId_Asc();
}
public void spFKCol(WhiteCompoundPkRefCB cb) {
cb.specify().columnRefFirstId();
cb.specify().columnRefSecondId();
}
public List<WhiteCompoundPkRef> selRfLs(WhiteCompoundPkRefCB cb) { return referrerBhv.selectList(cb); }
public java.util.Map<String, Object> getFKVal(WhiteCompoundPkRef e) {
java.util.Map<String, Object> foreignKeyMap = new java.util.LinkedHashMap<String, Object>();
foreignKeyMap.put("PkFirstId", e.getRefFirstId());
foreignKeyMap.put("PkSecondId", e.getRefSecondId());
return foreignKeyMap;
}
public void setlcEt(WhiteCompoundPkRef re, WhiteCompoundPk le) { re.setWhiteCompoundPk(le); }
public String getRfPrNm() { return "whiteCompoundPkRefList"; }
});
}
// ===================================================================================
// Pull out Relation
// =================
// ===================================================================================
// Extract Column
// ==============
// ===================================================================================
// Entity Update
// =============
/**
* Insert the entity modified-only. (DefaultConstraintsEnabled)
* <pre>
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* <span style="color: #3F7E5E">// if auto-increment, you don't need to set the PK value</span>
* whiteCompoundPk.setFoo...(value);
* whiteCompoundPk.setBar...(value);
* <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setRegisterUser(value);</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.set...;</span>
* whiteCompoundPkBhv.<span style="color: #FD4747">insert</span>(whiteCompoundPk);
* ... = whiteCompoundPk.getPK...(); <span style="color: #3F7E5E">// if auto-increment, you can get the value after</span>
* </pre>
* <p>While, when the entity is created by select, all columns are registered.</p>
* @param whiteCompoundPk The entity of insert target. (NotNull, PrimaryKeyNullAllowed: when auto-increment)
* @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
*/
public void insert(WhiteCompoundPk whiteCompoundPk) {
doInsert(whiteCompoundPk, null);
}
protected void doInsert(WhiteCompoundPk whiteCompoundPk, InsertOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("whiteCompoundPk", whiteCompoundPk);
prepareInsertOption(option);
delegateInsert(whiteCompoundPk, option);
}
protected void prepareInsertOption(InsertOption<WhiteCompoundPkCB> option) {
if (option == null) { return; }
assertInsertOptionStatus(option);
if (option.hasSpecifiedInsertColumn()) {
option.resolveInsertColumnSpecification(createCBForSpecifiedUpdate());
}
}
@Override
protected void doCreate(Entity entity, InsertOption<? extends ConditionBean> option) {
if (option == null) { insert(downcast(entity)); }
else { varyingInsert(downcast(entity), downcast(option)); }
}
/**
* Update the entity modified-only. (ZeroUpdateException, NonExclusiveControl)
* <pre>
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* whiteCompoundPk.setPK...(value); <span style="color: #3F7E5E">// required</span>
* whiteCompoundPk.setFoo...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
* <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setRegisterUser(value);</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.set...;</span>
* <span style="color: #3F7E5E">// if exclusive control, the value of exclusive control column is required</span>
* whiteCompoundPk.<span style="color: #FD4747">setVersionNo</span>(value);
* try {
* whiteCompoundPkBhv.<span style="color: #FD4747">update</span>(whiteCompoundPk);
* } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span>
* ...
* }
* </pre>
* @param whiteCompoundPk The entity of update target. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnRequired)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
*/
public void update(final WhiteCompoundPk whiteCompoundPk) {
doUpdate(whiteCompoundPk, null);
}
protected void doUpdate(WhiteCompoundPk whiteCompoundPk, final UpdateOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("whiteCompoundPk", whiteCompoundPk);
prepareUpdateOption(option);
helpUpdateInternally(whiteCompoundPk, new InternalUpdateCallback<WhiteCompoundPk>() {
public int callbackDelegateUpdate(WhiteCompoundPk entity) { return delegateUpdate(entity, option); } });
}
protected void prepareUpdateOption(UpdateOption<WhiteCompoundPkCB> option) {
if (option == null) { return; }
assertUpdateOptionStatus(option);
if (option.hasSelfSpecification()) {
option.resolveSelfSpecification(createCBForVaryingUpdate());
}
if (option.hasSpecifiedUpdateColumn()) {
option.resolveUpdateColumnSpecification(createCBForSpecifiedUpdate());
}
}
protected WhiteCompoundPkCB createCBForVaryingUpdate() {
WhiteCompoundPkCB cb = newMyConditionBean();
cb.xsetupForVaryingUpdate();
return cb;
}
protected WhiteCompoundPkCB createCBForSpecifiedUpdate() {
WhiteCompoundPkCB cb = newMyConditionBean();
cb.xsetupForSpecifiedUpdate();
return cb;
}
@Override
protected void doModify(Entity entity, UpdateOption<? extends ConditionBean> option) {
if (option == null) { update(downcast(entity)); }
else { varyingUpdate(downcast(entity), downcast(option)); }
}
@Override
protected void doModifyNonstrict(Entity entity, UpdateOption<? extends ConditionBean> option) {
doModify(entity, option);
}
/**
* Insert or update the entity modified-only. (DefaultConstraintsEnabled, NonExclusiveControl) <br />
* if (the entity has no PK) { insert() } else { update(), but no data, insert() } <br />
* <p><span style="color: #FD4747; font-size: 120%">Attention, you cannot update by unique keys instead of PK.</span></p>
* @param whiteCompoundPk The entity of insert or update target. (NotNull)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
*/
public void insertOrUpdate(WhiteCompoundPk whiteCompoundPk) {
doInesrtOrUpdate(whiteCompoundPk, null, null);
}
protected void doInesrtOrUpdate(WhiteCompoundPk whiteCompoundPk, final InsertOption<WhiteCompoundPkCB> insertOption, final UpdateOption<WhiteCompoundPkCB> updateOption) {
helpInsertOrUpdateInternally(whiteCompoundPk, new InternalInsertOrUpdateCallback<WhiteCompoundPk, WhiteCompoundPkCB>() {
public void callbackInsert(WhiteCompoundPk entity) { doInsert(entity, insertOption); }
public void callbackUpdate(WhiteCompoundPk entity) { doUpdate(entity, updateOption); }
public WhiteCompoundPkCB callbackNewMyConditionBean() { return newMyConditionBean(); }
public int callbackSelectCount(WhiteCompoundPkCB cb) { return selectCount(cb); }
});
}
@Override
protected void doCreateOrModify(Entity entity, InsertOption<? extends ConditionBean> insertOption,
UpdateOption<? extends ConditionBean> updateOption) {
if (insertOption == null && updateOption == null) { insertOrUpdate(downcast(entity)); }
else {
insertOption = insertOption == null ? new InsertOption<WhiteCompoundPkCB>() : insertOption;
updateOption = updateOption == null ? new UpdateOption<WhiteCompoundPkCB>() : updateOption;
varyingInsertOrUpdate(downcast(entity), downcast(insertOption), downcast(updateOption));
}
}
@Override
protected void doCreateOrModifyNonstrict(Entity entity, InsertOption<? extends ConditionBean> insertOption,
UpdateOption<? extends ConditionBean> updateOption) {
doCreateOrModify(entity, insertOption, updateOption);
}
/**
* Delete the entity. (ZeroUpdateException, NonExclusiveControl)
* <pre>
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* whiteCompoundPk.setPK...(value); <span style="color: #3F7E5E">// required</span>
* <span style="color: #3F7E5E">// if exclusive control, the value of exclusive control column is required</span>
* whiteCompoundPk.<span style="color: #FD4747">setVersionNo</span>(value);
* try {
* whiteCompoundPkBhv.<span style="color: #FD4747">delete</span>(whiteCompoundPk);
* } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span>
* ...
* }
* </pre>
* @param whiteCompoundPk The entity of delete target. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnRequired)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
*/
public void delete(WhiteCompoundPk whiteCompoundPk) {
doDelete(whiteCompoundPk, null);
}
protected void doDelete(WhiteCompoundPk whiteCompoundPk, final DeleteOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("whiteCompoundPk", whiteCompoundPk);
prepareDeleteOption(option);
helpDeleteInternally(whiteCompoundPk, new InternalDeleteCallback<WhiteCompoundPk>() {
public int callbackDelegateDelete(WhiteCompoundPk entity) { return delegateDelete(entity, option); } });
}
protected void prepareDeleteOption(DeleteOption<WhiteCompoundPkCB> option) {
if (option == null) { return; }
assertDeleteOptionStatus(option);
}
@Override
protected void doRemove(Entity entity, DeleteOption<? extends ConditionBean> option) {
if (option == null) { delete(downcast(entity)); }
else { varyingDelete(downcast(entity), downcast(option)); }
}
@Override
protected void doRemoveNonstrict(Entity entity, DeleteOption<? extends ConditionBean> option) {
doRemove(entity, option);
}
// ===================================================================================
// Batch Update
// ============
/**
* Batch-insert the entity list modified-only of same-set columns. (DefaultConstraintsEnabled) <br />
* This method uses executeBatch() of java.sql.PreparedStatement. <br />
* <p><span style="color: #FD4747; font-size: 120%">The columns of least common multiple are registered like this:</span></p>
* <pre>
* for (... : ...) {
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* whiteCompoundPk.setFooName("foo");
* if (...) {
* whiteCompoundPk.setFooPrice(123);
* }
* <span style="color: #3F7E5E">// FOO_NAME and FOO_PRICE (and record meta columns) are registered</span>
* <span style="color: #3F7E5E">// FOO_PRICE not-called in any entities are registered as null without default value</span>
* <span style="color: #3F7E5E">// columns not-called in all entities are registered as null or default value</span>
* whiteCompoundPkList.add(whiteCompoundPk);
* }
* whiteCompoundPkBhv.<span style="color: #FD4747">batchInsert</span>(whiteCompoundPkList);
* </pre>
* <p>While, when the entities are created by select, all columns are registered.</p>
* <p>And if the table has an identity, entities after the process don't have incremented values.
* (When you use the (normal) insert(), you can get the incremented value from your entity)</p>
* @param whiteCompoundPkList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNullAllowed: when auto-increment)
* @return The array of inserted count. (NotNull, EmptyAllowed)
*/
public int[] batchInsert(List<WhiteCompoundPk> whiteCompoundPkList) {
InsertOption<WhiteCompoundPkCB> option = createInsertUpdateOption();
return doBatchInsert(whiteCompoundPkList, option);
}
protected int[] doBatchInsert(List<WhiteCompoundPk> whiteCompoundPkList, InsertOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("whiteCompoundPkList", whiteCompoundPkList);
prepareBatchInsertOption(whiteCompoundPkList, option);
return delegateBatchInsert(whiteCompoundPkList, option);
}
protected void prepareBatchInsertOption(List<WhiteCompoundPk> whiteCompoundPkList, InsertOption<WhiteCompoundPkCB> option) {
option.xallowInsertColumnModifiedPropertiesFragmented();
option.xacceptInsertColumnModifiedPropertiesIfNeeds(whiteCompoundPkList);
prepareInsertOption(option);
}
@Override
protected int[] doLumpCreate(List<Entity> ls, InsertOption<? extends ConditionBean> option) {
if (option == null) { return batchInsert(downcast(ls)); }
else { return varyingBatchInsert(downcast(ls), downcast(option)); }
}
/**
* Batch-update the entity list modified-only of same-set columns. (NonExclusiveControl) <br />
* This method uses executeBatch() of java.sql.PreparedStatement. <br />
* <span style="color: #FD4747; font-size: 120%">You should specify same-set columns to all entities like this:</span>
* <pre>
* for (... : ...) {
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* whiteCompoundPk.setFooName("foo");
* if (...) {
* whiteCompoundPk.setFooPrice(123);
* } else {
* whiteCompoundPk.setFooPrice(null); <span style="color: #3F7E5E">// updated as null</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setFooDate(...); // *not allowed, fragmented</span>
* }
* <span style="color: #3F7E5E">// FOO_NAME and FOO_PRICE (and record meta columns) are updated</span>
* <span style="color: #3F7E5E">// (others are not updated: their values are kept)</span>
* whiteCompoundPkList.add(whiteCompoundPk);
* }
* whiteCompoundPkBhv.<span style="color: #FD4747">batchUpdate</span>(whiteCompoundPkList);
* </pre>
* @param whiteCompoundPkList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
* @return The array of updated count. (NotNull, EmptyAllowed)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
*/
public int[] batchUpdate(List<WhiteCompoundPk> whiteCompoundPkList) {
UpdateOption<WhiteCompoundPkCB> option = createPlainUpdateOption();
return doBatchUpdate(whiteCompoundPkList, option);
}
protected int[] doBatchUpdate(List<WhiteCompoundPk> whiteCompoundPkList, UpdateOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("whiteCompoundPkList", whiteCompoundPkList);
prepareBatchUpdateOption(whiteCompoundPkList, option);
return delegateBatchUpdate(whiteCompoundPkList, option);
}
protected void prepareBatchUpdateOption(List<WhiteCompoundPk> whiteCompoundPkList, UpdateOption<WhiteCompoundPkCB> option) {
option.xacceptUpdateColumnModifiedPropertiesIfNeeds(whiteCompoundPkList);
prepareUpdateOption(option);
}
@Override
protected int[] doLumpModify(List<Entity> ls, UpdateOption<? extends ConditionBean> option) {
if (option == null) { return batchUpdate(downcast(ls)); }
else { return varyingBatchUpdate(downcast(ls), downcast(option)); }
}
/**
* Batch-update the entity list specified-only. (NonExclusiveControl) <br />
* This method uses executeBatch() of java.sql.PreparedStatement.
* <pre>
* <span style="color: #3F7E5E">// e.g. update two columns only</span>
* whiteCompoundPkBhv.<span style="color: #FD4747">batchUpdate</span>(whiteCompoundPkList, new SpecifyQuery<WhiteCompoundPkCB>() {
* public void specify(WhiteCompoundPkCB cb) { <span style="color: #3F7E5E">// the two only updated</span>
* cb.specify().<span style="color: #FD4747">columnFooStatusCode()</span>; <span style="color: #3F7E5E">// should be modified in any entities</span>
* cb.specify().<span style="color: #FD4747">columnBarDate()</span>; <span style="color: #3F7E5E">// should be modified in any entities</span>
* }
* });
* <span style="color: #3F7E5E">// e.g. update every column in the table</span>
* whiteCompoundPkBhv.<span style="color: #FD4747">batchUpdate</span>(whiteCompoundPkList, new SpecifyQuery<WhiteCompoundPkCB>() {
* public void specify(WhiteCompoundPkCB cb) { <span style="color: #3F7E5E">// all columns are updated</span>
* cb.specify().<span style="color: #FD4747">columnEveryColumn()</span>; <span style="color: #3F7E5E">// no check of modified properties</span>
* }
* });
* </pre>
* <p>You can specify update columns used on set clause of update statement.
* However you do not need to specify common columns for update
* and an optimistic lock column because they are specified implicitly.</p>
* <p>And you should specify columns that are modified in any entities (at least one entity).
* But if you specify every column, it has no check.</p>
* @param whiteCompoundPkList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
* @param updateColumnSpec The specification of update columns. (NotNull)
* @return The array of updated count. (NotNull, EmptyAllowed)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
*/
public int[] batchUpdate(List<WhiteCompoundPk> whiteCompoundPkList, SpecifyQuery<WhiteCompoundPkCB> updateColumnSpec) {
return doBatchUpdate(whiteCompoundPkList, createSpecifiedUpdateOption(updateColumnSpec));
}
@Override
protected int[] doLumpModifyNonstrict(List<Entity> ls, UpdateOption<? extends ConditionBean> option) {
return doLumpModify(ls, option);
}
/**
* Batch-delete the entity list. (NonExclusiveControl) <br />
* This method uses executeBatch() of java.sql.PreparedStatement.
* @param whiteCompoundPkList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
* @return The array of deleted count. (NotNull, EmptyAllowed)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
*/
public int[] batchDelete(List<WhiteCompoundPk> whiteCompoundPkList) {
return doBatchDelete(whiteCompoundPkList, null);
}
protected int[] doBatchDelete(List<WhiteCompoundPk> whiteCompoundPkList, DeleteOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("whiteCompoundPkList", whiteCompoundPkList);
prepareDeleteOption(option);
return delegateBatchDelete(whiteCompoundPkList, option);
}
@Override
protected int[] doLumpRemove(List<Entity> ls, DeleteOption<? extends ConditionBean> option) {
if (option == null) { return batchDelete(downcast(ls)); }
else { return varyingBatchDelete(downcast(ls), downcast(option)); }
}
@Override
protected int[] doLumpRemoveNonstrict(List<Entity> ls, DeleteOption<? extends ConditionBean> option) {
return doLumpRemove(ls, option);
}
// ===================================================================================
// Query Update
// ============
/**
* Insert the several entities by query (modified-only for fixed value).
* <pre>
* whiteCompoundPkBhv.<span style="color: #FD4747">queryInsert</span>(new QueryInsertSetupper<WhiteCompoundPk, WhiteCompoundPkCB>() {
* public ConditionBean setup(whiteCompoundPk entity, WhiteCompoundPkCB intoCB) {
* FooCB cb = FooCB();
* cb.setupSelect_Bar();
*
* <span style="color: #3F7E5E">// mapping</span>
* intoCB.specify().columnMyName().mappedFrom(cb.specify().columnFooName());
* intoCB.specify().columnMyCount().mappedFrom(cb.specify().columnFooCount());
* intoCB.specify().columnMyDate().mappedFrom(cb.specify().specifyBar().columnBarDate());
* entity.setMyFixedValue("foo"); <span style="color: #3F7E5E">// fixed value</span>
* <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
* <span style="color: #3F7E5E">//entity.setRegisterUser(value);</span>
* <span style="color: #3F7E5E">//entity.set...;</span>
* <span style="color: #3F7E5E">// you don't need to set a value of exclusive control column</span>
* <span style="color: #3F7E5E">//entity.setVersionNo(value);</span>
*
* return cb;
* }
* });
* </pre>
* @param setupper The setup-per of query-insert. (NotNull)
* @return The inserted count.
*/
public int queryInsert(QueryInsertSetupper<WhiteCompoundPk, WhiteCompoundPkCB> setupper) {
return doQueryInsert(setupper, null);
}
protected int doQueryInsert(QueryInsertSetupper<WhiteCompoundPk, WhiteCompoundPkCB> setupper, InsertOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("setupper", setupper);
prepareInsertOption(option);
WhiteCompoundPk entity = new WhiteCompoundPk();
WhiteCompoundPkCB intoCB = createCBForQueryInsert();
ConditionBean resourceCB = setupper.setup(entity, intoCB);
return delegateQueryInsert(entity, intoCB, resourceCB, option);
}
protected WhiteCompoundPkCB createCBForQueryInsert() {
WhiteCompoundPkCB cb = newMyConditionBean();
cb.xsetupForQueryInsert();
return cb;
}
@Override
protected int doRangeCreate(QueryInsertSetupper<? extends Entity, ? extends ConditionBean> setupper, InsertOption<? extends ConditionBean> option) {
if (option == null) { return queryInsert(downcast(setupper)); }
else { return varyingQueryInsert(downcast(setupper), downcast(option)); }
}
/**
* Update the several entities by query non-strictly modified-only. (NonExclusiveControl)
* <pre>
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* <span style="color: #3F7E5E">// you don't need to set PK value</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setPK...(value);</span>
* whiteCompoundPk.setFoo...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
* <span style="color: #3F7E5E">// you don't need to set values of common columns</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setRegisterUser(value);</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.set...;</span>
* <span style="color: #3F7E5E">// you don't need to set a value of exclusive control column</span>
* <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setVersionNo(value);</span>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* whiteCompoundPkBhv.<span style="color: #FD4747">queryUpdate</span>(whiteCompoundPk, cb);
* </pre>
* @param whiteCompoundPk The entity that contains update values. (NotNull, PrimaryKeyNullAllowed)
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @return The updated count.
* @exception org.seasar.dbflute.exception.NonQueryUpdateNotAllowedException When the query has no condition.
*/
public int queryUpdate(WhiteCompoundPk whiteCompoundPk, WhiteCompoundPkCB cb) {
return doQueryUpdate(whiteCompoundPk, cb, null);
}
protected int doQueryUpdate(WhiteCompoundPk whiteCompoundPk, WhiteCompoundPkCB cb, UpdateOption<WhiteCompoundPkCB> option) {
assertObjectNotNull("whiteCompoundPk", whiteCompoundPk); assertCBStateValid(cb);
prepareUpdateOption(option);
return checkCountBeforeQueryUpdateIfNeeds(cb) ? delegateQueryUpdate(whiteCompoundPk, cb, option) : 0;
}
@Override
protected int doRangeModify(Entity entity, ConditionBean cb, UpdateOption<? extends ConditionBean> option) {
if (option == null) { return queryUpdate(downcast(entity), (WhiteCompoundPkCB)cb); }
else { return varyingQueryUpdate(downcast(entity), (WhiteCompoundPkCB)cb, downcast(option)); }
}
/**
* Delete the several entities by query. (NonExclusiveControl)
* <pre>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* whiteCompoundPkBhv.<span style="color: #FD4747">queryDelete</span>(whiteCompoundPk, cb);
* </pre>
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @return The deleted count.
* @exception org.seasar.dbflute.exception.NonQueryDeleteNotAllowedException When the query has no condition.
*/
public int queryDelete(WhiteCompoundPkCB cb) {
return doQueryDelete(cb, null);
}
protected int doQueryDelete(WhiteCompoundPkCB cb, DeleteOption<WhiteCompoundPkCB> option) {
assertCBStateValid(cb);
prepareDeleteOption(option);
return checkCountBeforeQueryUpdateIfNeeds(cb) ? delegateQueryDelete(cb, option) : 0;
}
@Override
protected int doRangeRemove(ConditionBean cb, DeleteOption<? extends ConditionBean> option) {
if (option == null) { return queryDelete((WhiteCompoundPkCB)cb); }
else { return varyingQueryDelete((WhiteCompoundPkCB)cb, downcast(option)); }
}
// ===================================================================================
// Varying Update
// ==============
// -----------------------------------------------------
// Entity Update
// -------------
/**
* Insert the entity with varying requests. <br />
* For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity(). <br />
* Other specifications are same as insert(entity).
* <pre>
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* <span style="color: #3F7E5E">// if auto-increment, you don't need to set the PK value</span>
* whiteCompoundPk.setFoo...(value);
* whiteCompoundPk.setBar...(value);
* InsertOption<WhiteCompoundPkCB> option = new InsertOption<WhiteCompoundPkCB>();
* <span style="color: #3F7E5E">// you can insert by your values for common columns</span>
* option.disableCommonColumnAutoSetup();
* whiteCompoundPkBhv.<span style="color: #FD4747">varyingInsert</span>(whiteCompoundPk, option);
* ... = whiteCompoundPk.getPK...(); <span style="color: #3F7E5E">// if auto-increment, you can get the value after</span>
* </pre>
* @param whiteCompoundPk The entity of insert target. (NotNull, PrimaryKeyNullAllowed: when auto-increment)
* @param option The option of insert for varying requests. (NotNull)
* @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
*/
public void varyingInsert(WhiteCompoundPk whiteCompoundPk, InsertOption<WhiteCompoundPkCB> option) {
assertInsertOptionNotNull(option);
doInsert(whiteCompoundPk, option);
}
/**
* Update the entity with varying requests modified-only. (ZeroUpdateException, NonExclusiveControl) <br />
* For example, self(selfCalculationSpecification), specify(updateColumnSpecification), disableCommonColumnAutoSetup(). <br />
* Other specifications are same as update(entity).
* <pre>
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* whiteCompoundPk.setPK...(value); <span style="color: #3F7E5E">// required</span>
* whiteCompoundPk.setOther...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
* <span style="color: #3F7E5E">// if exclusive control, the value of exclusive control column is required</span>
* whiteCompoundPk.<span style="color: #FD4747">setVersionNo</span>(value);
* try {
* <span style="color: #3F7E5E">// you can update by self calculation values</span>
* UpdateOption<WhiteCompoundPkCB> option = new UpdateOption<WhiteCompoundPkCB>();
* option.self(new SpecifyQuery<WhiteCompoundPkCB>() {
* public void specify(WhiteCompoundPkCB cb) {
* cb.specify().<span style="color: #FD4747">columnXxxCount()</span>;
* }
* }).plus(1); <span style="color: #3F7E5E">// XXX_COUNT = XXX_COUNT + 1</span>
* whiteCompoundPkBhv.<span style="color: #FD4747">varyingUpdate</span>(whiteCompoundPk, option);
* } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span>
* ...
* }
* </pre>
* @param whiteCompoundPk The entity of update target. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnRequired)
* @param option The option of update for varying requests. (NotNull)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
*/
public void varyingUpdate(WhiteCompoundPk whiteCompoundPk, UpdateOption<WhiteCompoundPkCB> option) {
assertUpdateOptionNotNull(option);
doUpdate(whiteCompoundPk, option);
}
/**
* Insert or update the entity with varying requests. (ExclusiveControl: when update) <br />
* Other specifications are same as insertOrUpdate(entity).
* @param whiteCompoundPk The entity of insert or update target. (NotNull)
* @param insertOption The option of insert for varying requests. (NotNull)
* @param updateOption The option of update for varying requests. (NotNull)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
* @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (unique constraint violation)
*/
public void varyingInsertOrUpdate(WhiteCompoundPk whiteCompoundPk, InsertOption<WhiteCompoundPkCB> insertOption, UpdateOption<WhiteCompoundPkCB> updateOption) {
assertInsertOptionNotNull(insertOption); assertUpdateOptionNotNull(updateOption);
doInesrtOrUpdate(whiteCompoundPk, insertOption, updateOption);
}
/**
* Delete the entity with varying requests. (ZeroUpdateException, NonExclusiveControl) <br />
* Now a valid option does not exist. <br />
* Other specifications are same as delete(entity).
* @param whiteCompoundPk The entity of delete target. (NotNull, PrimaryKeyNotNull, ConcurrencyColumnRequired)
* @param option The option of update for varying requests. (NotNull)
* @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. (not found)
* @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.
*/
public void varyingDelete(WhiteCompoundPk whiteCompoundPk, DeleteOption<WhiteCompoundPkCB> option) {
assertDeleteOptionNotNull(option);
doDelete(whiteCompoundPk, option);
}
// -----------------------------------------------------
// Batch Update
// ------------
/**
* Batch-insert the list with varying requests. <br />
* For example, disableCommonColumnAutoSetup()
* , disablePrimaryKeyIdentity(), limitBatchInsertLogging(). <br />
* Other specifications are same as batchInsert(entityList).
* @param whiteCompoundPkList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
* @param option The option of insert for varying requests. (NotNull)
* @return The array of updated count. (NotNull, EmptyAllowed)
*/
public int[] varyingBatchInsert(List<WhiteCompoundPk> whiteCompoundPkList, InsertOption<WhiteCompoundPkCB> option) {
assertInsertOptionNotNull(option);
return doBatchInsert(whiteCompoundPkList, option);
}
/**
* Batch-update the list with varying requests. <br />
* For example, self(selfCalculationSpecification), specify(updateColumnSpecification)
* , disableCommonColumnAutoSetup(), limitBatchUpdateLogging(). <br />
* Other specifications are same as batchUpdate(entityList).
* @param whiteCompoundPkList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
* @param option The option of update for varying requests. (NotNull)
* @return The array of updated count. (NotNull, EmptyAllowed)
*/
public int[] varyingBatchUpdate(List<WhiteCompoundPk> whiteCompoundPkList, UpdateOption<WhiteCompoundPkCB> option) {
assertUpdateOptionNotNull(option);
return doBatchUpdate(whiteCompoundPkList, option);
}
/**
* Batch-delete the list with varying requests. <br />
* For example, limitBatchDeleteLogging(). <br />
* Other specifications are same as batchDelete(entityList).
* @param whiteCompoundPkList The list of the entity. (NotNull, EmptyAllowed, PrimaryKeyNotNull)
* @param option The option of delete for varying requests. (NotNull)
* @return The array of deleted count. (NotNull, EmptyAllowed)
*/
public int[] varyingBatchDelete(List<WhiteCompoundPk> whiteCompoundPkList, DeleteOption<WhiteCompoundPkCB> option) {
assertDeleteOptionNotNull(option);
return doBatchDelete(whiteCompoundPkList, option);
}
// -----------------------------------------------------
// Query Update
// ------------
/**
* Insert the several entities by query with varying requests (modified-only for fixed value). <br />
* For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity(). <br />
* Other specifications are same as queryInsert(entity, setupper).
* @param setupper The setup-per of query-insert. (NotNull)
* @param option The option of insert for varying requests. (NotNull)
* @return The inserted count.
*/
public int varyingQueryInsert(QueryInsertSetupper<WhiteCompoundPk, WhiteCompoundPkCB> setupper, InsertOption<WhiteCompoundPkCB> option) {
assertInsertOptionNotNull(option);
return doQueryInsert(setupper, option);
}
/**
* Update the several entities by query with varying requests non-strictly modified-only. {NonExclusiveControl} <br />
* For example, self(selfCalculationSpecification), specify(updateColumnSpecification)
* , disableCommonColumnAutoSetup(), allowNonQueryUpdate(). <br />
* Other specifications are same as queryUpdate(entity, cb).
* <pre>
* <span style="color: #3F7E5E">// ex) you can update by self calculation values</span>
* WhiteCompoundPk whiteCompoundPk = new WhiteCompoundPk();
* <span style="color: #3F7E5E">// you don't need to set PK value</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setPK...(value);</span>
* whiteCompoundPk.setOther...(value); <span style="color: #3F7E5E">// you should set only modified columns</span>
* <span style="color: #3F7E5E">// you don't need to set a value of exclusive control column</span>
* <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span>
* <span style="color: #3F7E5E">//whiteCompoundPk.setVersionNo(value);</span>
* WhiteCompoundPkCB cb = new WhiteCompoundPkCB();
* cb.query().setFoo...(value);
* UpdateOption<WhiteCompoundPkCB> option = new UpdateOption<WhiteCompoundPkCB>();
* option.self(new SpecifyQuery<WhiteCompoundPkCB>() {
* public void specify(WhiteCompoundPkCB cb) {
* cb.specify().<span style="color: #FD4747">columnFooCount()</span>;
* }
* }).plus(1); <span style="color: #3F7E5E">// FOO_COUNT = FOO_COUNT + 1</span>
* whiteCompoundPkBhv.<span style="color: #FD4747">varyingQueryUpdate</span>(whiteCompoundPk, cb, option);
* </pre>
* @param whiteCompoundPk The entity that contains update values. (NotNull) {PrimaryKeyNotRequired}
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @param option The option of update for varying requests. (NotNull)
* @return The updated count.
* @exception org.seasar.dbflute.exception.NonQueryUpdateNotAllowedException When the query has no condition (if not allowed).
*/
public int varyingQueryUpdate(WhiteCompoundPk whiteCompoundPk, WhiteCompoundPkCB cb, UpdateOption<WhiteCompoundPkCB> option) {
assertUpdateOptionNotNull(option);
return doQueryUpdate(whiteCompoundPk, cb, option);
}
/**
* Delete the several entities by query with varying requests non-strictly. <br />
* For example, allowNonQueryDelete(). <br />
* Other specifications are same as batchUpdateNonstrict(entityList).
* @param cb The condition-bean of WhiteCompoundPk. (NotNull)
* @param option The option of delete for varying requests. (NotNull)
* @return The deleted count.
* @exception org.seasar.dbflute.exception.NonQueryDeleteNotAllowedException When the query has no condition (if not allowed).
*/
public int varyingQueryDelete(WhiteCompoundPkCB cb, DeleteOption<WhiteCompoundPkCB> option) {
assertDeleteOptionNotNull(option);
return doQueryDelete(cb, option);
}
// ===================================================================================
// OutsideSql
// ==========
/**
* Prepare the basic executor of outside-SQL to execute it. <br />
* The invoker of behavior command should be not null when you call this method.
* <pre>
* You can use the methods for outside-SQL are as follows:
* {Basic}
* o selectList()
* o execute()
* o call()
*
* {Entity}
* o entityHandling().selectEntity()
* o entityHandling().selectEntityWithDeletedCheck()
*
* {Paging}
* o autoPaging().selectList()
* o autoPaging().selectPage()
* o manualPaging().selectList()
* o manualPaging().selectPage()
*
* {Cursor}
* o cursorHandling().selectCursor()
*
* {Option}
* o dynamicBinding().selectList()
* o removeBlockComment().selectList()
* o removeLineComment().selectList()
* o formatSql().selectList()
* </pre>
* @return The basic executor of outside-SQL. (NotNull)
*/
public OutsideSqlBasicExecutor<WhiteCompoundPkBhv> outsideSql() {
return doOutsideSql();
}
// ===================================================================================
// Delegate Method
// ===============
// [Behavior Command]
// -----------------------------------------------------
// Select
// ------
protected int delegateSelectCountUniquely(WhiteCompoundPkCB cb) { return invoke(createSelectCountCBCommand(cb, true)); }
protected int delegateSelectCountPlainly(WhiteCompoundPkCB cb) { return invoke(createSelectCountCBCommand(cb, false)); }
protected <ENTITY extends WhiteCompoundPk> void delegateSelectCursor(WhiteCompoundPkCB cb, EntityRowHandler<ENTITY> erh, Class<ENTITY> et)
{ invoke(createSelectCursorCBCommand(cb, erh, et)); }
protected <ENTITY extends WhiteCompoundPk> List<ENTITY> delegateSelectList(WhiteCompoundPkCB cb, Class<ENTITY> et)
{ return invoke(createSelectListCBCommand(cb, et)); }
// -----------------------------------------------------
// Update
// ------
protected int delegateInsert(WhiteCompoundPk e, InsertOption<WhiteCompoundPkCB> op)
{ if (!processBeforeInsert(e, op)) { return 0; }
return invoke(createInsertEntityCommand(e, op)); }
protected int delegateUpdate(WhiteCompoundPk e, UpdateOption<WhiteCompoundPkCB> op)
{ if (!processBeforeUpdate(e, op)) { return 0; }
return delegateUpdateNonstrict(e, op); }
protected int delegateUpdateNonstrict(WhiteCompoundPk e, UpdateOption<WhiteCompoundPkCB> op)
{ if (!processBeforeUpdate(e, op)) { return 0; }
return invoke(createUpdateNonstrictEntityCommand(e, op)); }
protected int delegateDelete(WhiteCompoundPk e, DeleteOption<WhiteCompoundPkCB> op)
{ if (!processBeforeDelete(e, op)) { return 0; }
return delegateDeleteNonstrict(e, op); }
protected int delegateDeleteNonstrict(WhiteCompoundPk e, DeleteOption<WhiteCompoundPkCB> op)
{ if (!processBeforeDelete(e, op)) { return 0; }
return invoke(createDeleteNonstrictEntityCommand(e, op)); }
protected int[] delegateBatchInsert(List<WhiteCompoundPk> ls, InsertOption<WhiteCompoundPkCB> op)
{ if (ls.isEmpty()) { return new int[]{}; }
return invoke(createBatchInsertCommand(processBatchInternally(ls, op), op)); }
protected int[] delegateBatchUpdate(List<WhiteCompoundPk> ls, UpdateOption<WhiteCompoundPkCB> op)
{ if (ls.isEmpty()) { return new int[]{}; }
return delegateBatchUpdateNonstrict(ls, op); }
protected int[] delegateBatchUpdateNonstrict(List<WhiteCompoundPk> ls, UpdateOption<WhiteCompoundPkCB> op)
{ if (ls.isEmpty()) { return new int[]{}; }
return invoke(createBatchUpdateNonstrictCommand(processBatchInternally(ls, op, true), op)); }
protected int[] delegateBatchDelete(List<WhiteCompoundPk> ls, DeleteOption<WhiteCompoundPkCB> op)
{ if (ls.isEmpty()) { return new int[]{}; }
return delegateBatchDeleteNonstrict(ls, op); }
protected int[] delegateBatchDeleteNonstrict(List<WhiteCompoundPk> ls, DeleteOption<WhiteCompoundPkCB> op)
{ if (ls.isEmpty()) { return new int[]{}; }
return invoke(createBatchDeleteNonstrictCommand(processBatchInternally(ls, op, true), op)); }
protected int delegateQueryInsert(WhiteCompoundPk e, WhiteCompoundPkCB inCB, ConditionBean resCB, InsertOption<WhiteCompoundPkCB> op)
{ if (!processBeforeQueryInsert(e, inCB, resCB, op)) { return 0; } return invoke(createQueryInsertCBCommand(e, inCB, resCB, op)); }
protected int delegateQueryUpdate(WhiteCompoundPk e, WhiteCompoundPkCB cb, UpdateOption<WhiteCompoundPkCB> op)
{ if (!processBeforeQueryUpdate(e, cb, op)) { return 0; } return invoke(createQueryUpdateCBCommand(e, cb, op)); }
protected int delegateQueryDelete(WhiteCompoundPkCB cb, DeleteOption<WhiteCompoundPkCB> op)
{ if (!processBeforeQueryDelete(cb, op)) { return 0; } return invoke(createQueryDeleteCBCommand(cb, op)); }
// ===================================================================================
// Optimistic Lock Info
// ====================
/**
* {@inheritDoc}
*/
@Override
protected boolean hasVersionNoValue(Entity entity) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
protected boolean hasUpdateDateValue(Entity entity) {
return false;
}
// ===================================================================================
// Downcast Helper
// ===============
protected WhiteCompoundPk downcast(Entity entity) {
return helpEntityDowncastInternally(entity, WhiteCompoundPk.class);
}
protected WhiteCompoundPkCB downcast(ConditionBean cb) {
return helpConditionBeanDowncastInternally(cb, WhiteCompoundPkCB.class);
}
@SuppressWarnings("unchecked")
protected List<WhiteCompoundPk> downcast(List<? extends Entity> entityList) {
return (List<WhiteCompoundPk>)entityList;
}
@SuppressWarnings("unchecked")
protected InsertOption<WhiteCompoundPkCB> downcast(InsertOption<? extends ConditionBean> option) {
return (InsertOption<WhiteCompoundPkCB>)option;
}
@SuppressWarnings("unchecked")
protected UpdateOption<WhiteCompoundPkCB> downcast(UpdateOption<? extends ConditionBean> option) {
return (UpdateOption<WhiteCompoundPkCB>)option;
}
@SuppressWarnings("unchecked")
protected DeleteOption<WhiteCompoundPkCB> downcast(DeleteOption<? extends ConditionBean> option) {
return (DeleteOption<WhiteCompoundPkCB>)option;
}
@SuppressWarnings("unchecked")
protected QueryInsertSetupper<WhiteCompoundPk, WhiteCompoundPkCB> downcast(QueryInsertSetupper<? extends Entity, ? extends ConditionBean> option) {
return (QueryInsertSetupper<WhiteCompoundPk, WhiteCompoundPkCB>)option;
}
}
| [
"dbflute@gmail.com"
] | dbflute@gmail.com |
36d46f95d7de6f8735ece6a10ba331efd2bb3cbd | 55a44ae477d4f352553995b37426eaef25a82345 | /com.fattin.hotspot-157dede5b87b49f9a50e62c2fa3a235a_source_from_JADX/jnamed$2.java | d33f9a2fa13935a15321d59b76184c1ab6bf106f | [] | no_license | xxwikkixx/InternetBnB | 9d1d7ea5af803d78f2663c20e2467b4da08067bf | 50a8d54851d47e52c41847f55b98d87a188f4e9a | refs/heads/master | 2020-12-25T13:23:58.053661 | 2016-10-30T20:00:36 | 2016-10-30T20:00:36 | 67,858,939 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | import java.net.InetAddress;
class jnamed$2 implements Runnable {
private final jnamed this$0;
private final InetAddress val$addr;
private final int val$port;
jnamed$2(jnamed jnamed, InetAddress inetAddress, int i) {
this.this$0 = jnamed;
this.val$addr = inetAddress;
this.val$port = i;
}
public void run() {
this.this$0.serveTCP(this.val$addr, this.val$port);
}
}
| [
"wikki_1@hotmail.com"
] | wikki_1@hotmail.com |
fa59126156f068d6a7f0e05194ccfe340ddf2bc2 | ef428e91dc589a8548ac04e0f3743fffefdcc58b | /app/src/test/java/com/example/pc/chatapp/ExampleUnitTest.java | 9e5a966880c08d54539c6c4cf358fef973de21e0 | [] | no_license | valakhushbu/Firebase | 0c069d5cbeb1b6bc2229edfb30c32c3750378565 | 2bd6e428e3a06bd04229068fad1d132ddcd2b002 | refs/heads/master | 2020-04-26T17:19:34.553172 | 2019-03-04T09:15:45 | 2019-03-04T09:15:45 | 173,709,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.example.pc.chatapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"valakhushbu@gmail.com"
] | valakhushbu@gmail.com |
dab0ae4d22e22e05c58d04e3e179a41c6446366e | 2107ad640971d7e85f361b28771e1c151a972ad2 | /app/src/main/java/com/pzr/mvpdemo/model/SecondModel.java | 1af0708a111ca4c8bb6ad7f53b0afcedcef8497c | [] | no_license | pzr110/EDU | e9ee042e1e6ae4c3d1a897aeb8a670f64bf4ef66 | 5e3fd38e89c1921443354ec7fb08894f07e85fcb | refs/heads/master | 2022-11-27T15:41:18.947494 | 2020-08-06T15:05:40 | 2020-08-06T15:05:40 | 279,911,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | package com.pzr.mvpdemo.model;
import com.pzr.mvpdemo.contract.SecondContract;
import com.pzr.mvpdemo.basemvp.BaseModel;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
public class SecondModel extends BaseModel implements SecondContract.ISecondModel {
@Override
public void requestBaidu(Callback callback) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://blog.csdn.net/smile_running")
.build();
client.newCall(request).enqueue(callback);
}
}
| [
"1171228190@qq.com"
] | 1171228190@qq.com |
8405764e4f5fc137c4aad4aab1b4df9929f3938e | 1164569e3b1e78ed0847bca0f4b3eeea55adcedb | /Java/ICSI-518-Software-Engineering/Individual-Project/src/main/java/ualbanycsi518/NBATrackr/Final/Controllers/TeamController.java | d24d98e91e187e5c1985c3790030d0785f3e856d | [] | no_license | santhosh-r/Assorted | c62ae89faa82785b3a72ea66cff61501df596fc0 | 719a70ded4c3abe37c60b0dfd942d57f590c788a | refs/heads/main | 2023-04-10T05:06:10.681038 | 2021-04-29T14:17:01 | 2021-04-29T14:17:01 | 361,071,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,255 | java | package ualbanycsi518.NBATrackr.Final.Controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import ualbanycsi518.NBATrackr.Final.Entities.User;
import ualbanycsi518.NBATrackr.Final.Entities.NBATeamStandings;
import ualbanycsi518.NBATrackr.Final.Services.NBATeamService;
import ualbanycsi518.NBATrackr.Final.Services.UserService;
@Controller
public class TeamController {
@Autowired
NBATeamService nbaTeamService;
@Autowired
UserService userService;
@GetMapping("/team")
public String showTeamProfile(@RequestParam("id") int teamID, Model model) {
return "TeamProfilePage";
}
@GetMapping("/teams")
public String listTeams(Model model) {
User user = userService.getCurrentUser();
NBATeamStandings nbaTeamStandings = nbaTeamService.fetchNBATeamStandings();
model.addAttribute("user", user);
model.addAttribute("teamStandings", nbaTeamStandings.getOverallteamstandings().getTeamstandingsentry());
return "TeamListPage";
}
} | [
"santhosh-r@users.noreply.github.com"
] | santhosh-r@users.noreply.github.com |
fbd283fb42e81fb04a175f29f6f00a2b5f551739 | 6e8cab23f6fd6ccff47ef3f02f9a67d87e3ef694 | /src/main/java/com/footballpredict/util/StartRserve.java | cfba9900b056bd097693d2c64be3da8dd40a38e5 | [] | no_license | omerbuyuksar/FootballPredict | dd797ce614ded91ff768a8565b00a84854193510 | 1ef28672ae066b1d67cc0b48ebfb679cc4d5d0e0 | refs/heads/master | 2021-01-10T05:54:54.057109 | 2016-01-05T06:03:57 | 2016-01-05T06:03:57 | 45,621,720 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,110 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.footballpredict.util;
import java.io.*;
import java.util.*;
import org.rosuda.REngine.Rserve.RConnection;
/** helper class that consumes output of a process. In addition, it filter output of the REG command on Windows to look for InstallPath registry entry which specifies the location of R. */
class StreamHog extends Thread {
InputStream is;
boolean capture;
String installPath;
StreamHog(InputStream is, boolean capture) {
this.is = is;
this.capture = capture;
start();
}
public String getInstallPath() {
return installPath;
}
public void run()
{
try {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ( (line = br.readLine()) != null) {
if (capture) { // we are supposed to capture the output from REG command
int i = line.indexOf("InstallPath");
if (i >= 0) {
String s = line.substring(i + 11).trim();
int j = s.indexOf("REG_SZ");
if (j >= 0)
s = s.substring(j + 6).trim();
installPath = s;
System.out.println("R InstallPath = "+s);
}
} else
System.out.println("Rserve>" + line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/** simple class that start Rserve locally if it's not running already - see mainly <code>checkLocalRserve</code> method. It spits out quite some debugging outout of the console, so feel free to modify it for your application if desired.<p>
<i>Important:</i> All applications should shutdown every Rserve that they started! Never leave Rserve running if you started it after your application quits since it may pose a security risk. Inform the user if you started an Rserve instance.
*/
public class StartRserve {
/** shortcut to <code>launchRserve(cmd, "--no-save --slave", "--no-save --slave", false)</code> */
public static boolean launchRserve(String cmd) { return launchRserve(cmd, "--no-save --slave","--no-save --slave",false); }
/** attempt to start Rserve. Note: parameters are <b>not</b> quoted, so avoid using any quotes in arguments
@param cmd command necessary to start R
@param rargs arguments are are to be passed to R
@param rsrvargs arguments to be passed to Rserve
@return <code>true</code> if Rserve is running or was successfully started, <code>false</code> otherwise.
*/
public static boolean launchRserve(String cmd, String rargs, String rsrvargs, boolean debug) {
try {
Process p;
boolean isWindows = false;
String osname = System.getProperty("os.name");
if (osname != null && osname.length() >= 7 && osname.substring(0,7).equals("Windows")) {
isWindows = true; /* Windows startup */
p = Runtime.getRuntime().exec("\""+cmd+"\" -e \"library(Rserve);Rserve("+(debug?"TRUE":"FALSE")+",args='"+rsrvargs+"')\" "+rargs);
} else /* unix startup */
p = Runtime.getRuntime().exec(new String[] {
"/bin/sh", "-c",
"echo 'library(Rserve);Rserve("+(debug?"TRUE":"FALSE")+",args=\""+rsrvargs+"\")'|"+cmd+" "+rargs
});
System.out.println("waiting for Rserve to start ... ("+p+")");
// we need to fetch the output - some platforms will die if you don't ...
StreamHog errorHog = new StreamHog(p.getErrorStream(), false);
StreamHog outputHog = new StreamHog(p.getInputStream(), false);
if (!isWindows) /* on Windows the process will never return, so we cannot wait */
p.waitFor();
System.out.println("call terminated, let us try to connect ...");
} catch (Exception x) {
System.out.println("failed to start Rserve process with "+x.getMessage());
return false;
}
int attempts = 5; /* try up to 5 times before giving up. We can be conservative here, because at this point the process execution itself was successful and the start up is usually asynchronous */
while (attempts > 0) {
try {
RConnection c = new RConnection();
System.out.println("Rserve is running.");
c.close();
return true;
} catch (Exception e2) {
System.out.println("Try failed with: "+e2.getMessage());
}
/* a safety sleep just in case the start up is delayed or asynchronous */
try { Thread.sleep(500); } catch (InterruptedException ix) { };
attempts--;
}
return false;
}
/** checks whether Rserve is running and if that's not the case it attempts to start it using the defaults for the platform where it is run on. This method is meant to be set-and-forget and cover most default setups. For special setups you may get more control over R with <<code>launchRserve</code> instead. */
public static boolean checkLocalRserve() {
if (isRserveRunning()) return true;
String osname = System.getProperty("os.name");
if (osname != null && osname.length() >= 7 && osname.substring(0,7).equals("Windows")) {
System.out.println("Windows: query registry to find where R is installed ...");
String installPath = null;
try {
Process rp = Runtime.getRuntime().exec("reg query HKLM\\Software\\R-core\\R");
StreamHog regHog = new StreamHog(rp.getInputStream(), true);
rp.waitFor();
regHog.join();
installPath = regHog.getInstallPath();
} catch (Exception rge) {
System.out.println("ERROR: unable to run REG to find the location of R: "+rge);
return false;
}
if (installPath == null) {
System.out.println("ERROR: canot find path to R. Make sure reg is available and R was installed with registry settings.");
return false;
}
return launchRserve(installPath+"\\bin\\R.exe");
}
return (launchRserve("R") || /* try some common unix locations of R */
((new File("/Library/Frameworks/R.framework/Resources/bin/R")).exists() && launchRserve("/Library/Frameworks/R.framework/Resources/bin/R")) ||
((new File("/usr/local/lib/R/bin/R")).exists() && launchRserve("/usr/local/lib/R/bin/R")) ||
((new File("/usr/lib/R/bin/R")).exists() && launchRserve("/usr/lib/R/bin/R")) ||
((new File("/usr/local/bin/R")).exists() && launchRserve("/usr/local/bin/R")) ||
((new File("/sw/bin/R")).exists() && launchRserve("/sw/bin/R")) ||
((new File("/usr/common/bin/R")).exists() && launchRserve("/usr/common/bin/R")) ||
((new File("/opt/bin/R")).exists() && launchRserve("/opt/bin/R"))
);
}
/** check whether Rserve is currently running (on local machine and default port).
@return <code>true</code> if local Rserve instance is running, <code>false</code> otherwise
*/
public static boolean isRserveRunning() {
try {
RConnection c = new RConnection();
System.out.println("Rserve is running.");
c.close();
return true;
} catch (Exception e) {
System.out.println("First connect try failed with: "+e.getMessage());
}
return false;
}
/** just a demo main method which starts Rserve and shuts it down again */
public static void main(String[] args) {
System.out.println("result="+checkLocalRserve());
try {
RConnection c=new RConnection();
c.shutdown();
} catch (Exception x) {};
}
} | [
"omer-pc@debian"
] | omer-pc@debian |
9ab92420edecd7e7734cd273a6ab253ef646adee | 692b0cfed0d78cf2c8cc947dc8cb781bcdb291a0 | /src/test/java/org/jose4j/jws/JwsUnencodedPayloadOptionTest.java | 5cdc366d0e6f82205ded46ced9354c5522abf79f | [
"Apache-2.0"
] | permissive | njc-gov/jose4j | 250edc818f4dc13d2e045b45a636b555a61b2abe | 939342207e090a04a2d242dd2d117e9881a1a892 | refs/heads/master | 2023-01-02T05:37:12.535788 | 2020-10-24T01:11:14 | 2020-10-24T01:11:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,495 | java | package org.jose4j.jws;
import org.jose4j.base64url.Base64Url;
import org.jose4j.jca.ProviderContext;
import org.jose4j.jwa.AlgorithmConstraints;
import org.jose4j.jwk.JsonWebKey;
import org.jose4j.jwx.HeaderParameterNames;
import org.jose4j.keys.ExampleRsaKeyFromJws;
import org.jose4j.lang.JoseException;
import org.jose4j.lang.StringUtil;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.security.Key;
import static org.hamcrest.CoreMatchers.*;
import static org.jose4j.jwa.AlgorithmConstraints.ConstraintType.*;
import static org.junit.Assert.*;
/**
*
*/
public class JwsUnencodedPayloadOptionTest
{
@Test
public void rfc7797Examples() throws Exception
{
// the key and payload are from https://tools.ietf.org/html/rfc7797#section-4
String payload = "$.02";
JsonWebKey jwk = JsonWebKey.Factory.newJwk(
" {\n" +
" \"kty\":\"oct\",\n" +
" \"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75\n" +
" aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n" +
" }\n");
// Test the "control" JWS from https://tools.ietf.org/html/rfc7797#section-4.1
String controlCompactSerialization = "eyJhbGciOiJIUzI1NiJ9.JC4wMg.5mvfOroL-g7HyqJoozehmsaqmvTYGEq5jTI1gVvoEoQ";
JsonWebSignature controlJws = new JsonWebSignature();
controlJws.setCompactSerialization(controlCompactSerialization);
controlJws.setKey(jwk.getKey());
controlJws.setPayloadCharEncoding(StringUtil.US_ASCII);
assertTrue(controlJws.verifySignature());
assertThat(payload, equalTo(controlJws.getPayload()));
// Test verifying the example with unencoded and detached payload from https://tools.ietf.org/html/rfc7797#section-4.2
String detachedUnencoded = "eyJhbGciOiJIUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..A5dxf2s96_n5FLueVuW1Z_vh161FwXZC4YLPff6dmDY";
JsonWebSignature jws = new JsonWebSignature();
jws.setAlgorithmConstraints(new AlgorithmConstraints(WHITELIST, AlgorithmIdentifiers.HMAC_SHA256));
jws.setPayloadCharEncoding(StringUtil.US_ASCII);
jws.setCompactSerialization(detachedUnencoded);
jws.setKey(jwk.getKey());
jws.setPayload(payload);
assertTrue(jws.verifySignature());
assertThat(payload, equalTo(jws.getPayload()));
// reconstruct the example with unencoded and detached payload from https://tools.ietf.org/html/rfc7797#section-4.2
// the header just works out being the same based on (a little luck and) setting headers order and how the JSON is produced
jws = new JsonWebSignature();
jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.HMAC_SHA256);
jws.getHeaders().setObjectHeaderValue(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD, false);
jws.setCriticalHeaderNames(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD);
jws.setPayloadCharEncoding(StringUtil.US_ASCII);
jws.setKey(jwk.getKey());
jws.setPayload(payload);
String detachedContentCompactSerialization = jws.getDetachedContentCompactSerialization();
assertThat(detachedUnencoded, equalTo(detachedContentCompactSerialization));
assertThat(payload, equalTo(jws.getUnverifiedPayload()));
}
@Test
public void rfc7797ExampleWithDirectJwsSetHeader() throws Exception
{
// the key and payload are from https://tools.ietf.org/html/rfc7797#section-4
String payload = "$.02";
JsonWebKey jwk = JsonWebKey.Factory.newJwk(
" {\n" +
" \"kty\":\"oct\",\n" +
" \"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75\n" +
" aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n" +
" }\n");
// Test verifying the example with unencoded and detached payload from https://tools.ietf.org/html/rfc7797#section-4.2
String detachedUnencoded = "eyJhbGciOiJIUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..A5dxf2s96_n5FLueVuW1Z_vh161FwXZC4YLPff6dmDY";
// reconstruct the example with unencoded and detached payload from https://tools.ietf.org/html/rfc7797#section-4.2
// the header just works out being the same based on (a little luck and) setting headers order and how the JSON is produced
JsonWebSignature jws = new JsonWebSignature();
jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.HMAC_SHA256);
jws.setHeader(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD, false);
jws.setCriticalHeaderNames(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD);
jws.setPayloadCharEncoding(StringUtil.US_ASCII);
jws.setKey(jwk.getKey());
jws.setPayload(payload);
String detachedContentCompactSerialization = jws.getDetachedContentCompactSerialization();
assertThat(detachedUnencoded, equalTo(detachedContentCompactSerialization));
assertThat(payload, equalTo(jws.getUnverifiedPayload()));
jws = new JsonWebSignature();
jws.setAlgorithmConstraints(new AlgorithmConstraints(WHITELIST, AlgorithmIdentifiers.HMAC_SHA256));
jws.setPayloadCharEncoding(StringUtil.US_ASCII);
jws.setCompactSerialization(detachedUnencoded);
jws.setKey(jwk.getKey());
jws.setPayload(payload);
assertTrue(jws.verifySignature());
assertThat(payload, equalTo(jws.getPayload()));
Object objectHeader = jws.getObjectHeader(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD);
assertFalse((boolean)objectHeader);
}
@Test
public void testExamplesFromDraftEvenWithoutDirectSupportForTheHeader() throws Exception
{
// a test of sorts to verify the examples from
// http://tools.ietf.org/html/draft-ietf-jose-jws-signing-input-options-09#section-4
// at Mike's request
String jwkJson =
"{" +
" \"kty\":\"oct\"," +
" \"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75" +
" aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"" +
"}";
final JsonWebKey jsonWebKey = JsonWebKey.Factory.newJwk(jwkJson);
final Key key = jsonWebKey.getKey();
String payload = "$.02";
final String encodedPayload = Base64Url.encode(payload, StringUtil.US_ASCII);
assertThat(encodedPayload, equalTo("JC4wMg"));
String jwscsWithB64 = "eyJhbGciOiJIUzI1NiJ9.JC4wMg.5mvfOroL-g7HyqJoozehmsaqmvTYGEq5jTI1gVvoEoQ";
JsonWebSignature jws = new JsonWebSignature();
jws.setCompactSerialization(jwscsWithB64);
jws.setKey(key);
assertThat(jws.getPayload(), equalTo(payload));
assertTrue(jws.verifySignature());
jws = new JsonWebSignature();
jws.setPayload(payload);
jws.setKey(key);
jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.HMAC_SHA256);
assertThat(jws.getCompactSerialization(), equalTo(jwscsWithB64));
String jwscsWithoutB64andDetachedPaylod = "eyJhbGciOiJIUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19.." +
"A5dxf2s96_n5FLueVuW1Z_vh161FwXZC4YLPff6dmDY";
jws = new JsonWebSignature();
jws.setCompactSerialization(jwscsWithoutB64andDetachedPaylod);
assertThat(jws.getHeaders().getFullHeaderAsJsonString(), equalTo("{\"alg\":\"HS256\",\"b64\":false,\"crit\":[\"b64\"]}"));
HmacUsingShaAlgorithm.HmacSha256 hmacSha256 = new HmacUsingShaAlgorithm.HmacSha256();
final String signingInputString = jws.getHeaders().getEncodedHeader() + "." + payload;
final byte[] signatureBytes = Base64Url.decode(jws.getEncodedSignature());
final byte[] securedInputBytes = StringUtil.getBytesAscii(signingInputString);
final ProviderContext providerContext = new ProviderContext();
boolean okay = hmacSha256.verifySignature(signatureBytes, key, securedInputBytes, providerContext);
assertTrue(okay);
final byte[] signed = hmacSha256.sign(key, securedInputBytes, providerContext);
assertThat(Base64Url.encode(signed), equalTo(jws.getEncodedSignature()));
}
@Test
public void compactSerializationUnencodedPayload() throws JoseException
{
// https://bitbucket.org/b_c/jose4j/issues/156 shows the b64:false didn't work (0.6.5 and prior)
// with compact serialization.
String payload = "{\"key\": \"value\"}";
JsonWebSignature signerJws = new JsonWebSignature();
signerJws.setPayload(payload);
signerJws.getHeaders().setObjectHeaderValue(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD, false);
signerJws.setCriticalHeaderNames(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD);
signerJws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256);
signerJws.setKey(ExampleRsaKeyFromJws.PRIVATE_KEY);
String compactSerialization = signerJws.getCompactSerialization();
assertThat(compactSerialization, containsString(payload));
JsonWebSignature verifierJws = new JsonWebSignature();
verifierJws.setCompactSerialization(compactSerialization);
verifierJws.setKey(ExampleRsaKeyFromJws.PUBLIC_KEY);
assertTrue(verifierJws.verifySignature());
assertThat(payload, is(equalTo(verifierJws.getPayload())));
payload = "I want a hamburger. No, a cheeseburger. I want a hotdog. I want a milkshake.";
signerJws = new JsonWebSignature();
signerJws.setPayload(payload);
signerJws.getHeaders().setObjectHeaderValue(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD, false);
signerJws.setCriticalHeaderNames(HeaderParameterNames.BASE64URL_ENCODE_PAYLOAD);
signerJws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256);
signerJws.setKey(ExampleRsaKeyFromJws.PRIVATE_KEY);
try
{
compactSerialization = signerJws.getCompactSerialization();
fail("JWS Compact Serialization with unencoded non-detached payloads cannot have period ('.') characters but " + compactSerialization);
}
catch (JoseException e)
{
Logger log = LoggerFactory.getLogger(this.getClass());
log.debug("Expected exception because JWS Compact Serialization with unencoded non-detached payloads cannot have period ('.') characters : {}", e.toString());
}
}
}
| [
"brian.d.campbell@gmail.com"
] | brian.d.campbell@gmail.com |
3326c97df7148259ac9c1c0976314bc9ee9dec1c | a2aad4ae315fd85fbf5ad8f2cb9523b25fd8e047 | /springboot-highcharts/src/main/java/com/jk/service/CarServiceImpl.java | 26f980d9e05e0ef752908b14eac63f4c0e1c997a | [] | no_license | zhengjinhu/1905 | 85ebb4ad510319a889c0d9f14f2c020f93cdaa17 | 223c7e34985e6d8e7836593009117d13e37f5f43 | refs/heads/master | 2022-10-21T21:08:08.536491 | 2019-11-13T01:32:58 | 2019-11-13T01:32:58 | 221,123,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.jk.service;
import com.jk.mapper.CarMapper;
import com.jk.model.Car;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @ClassName CarServiceImpl
* @Description: TODO
* @Author zjh
* @Date 2019/11/7 17:02
* @Version V1.0
**/
@Service
public class CarServiceImpl implements CarService {
@Autowired
private CarMapper carMapper;
@Override
public List<Map<String, Object>> queryCar() {
return carMapper.queryCar();
}
@Override
public List<Map<String, Object>> queryCarAll() {
return carMapper.queryCarAll();
}
}
| [
"939785976@qq.com"
] | 939785976@qq.com |
0cf5ec1a52efb7c93c1ddd537ca8c7d411058050 | a764ce91d5eef2ccdb757daa4e5e2bb81fdb9ad5 | /yiyuanview/src/androidTest/java/com/yiyuan/imageviewcircular/ExampleInstrumentedTest.java | 0ec66d854a0aa0e91e42e0174c2060545a3a807e | [] | no_license | yiyuan1990/YiYuanViewDemo | 5fed19ffb575a058c9dc6461cfb282d5ddd46e6f | 3d65c20aa52f24223698086caf2b121678837b64 | refs/heads/master | 2020-06-12T08:54:32.991098 | 2019-09-10T01:41:54 | 2019-09-10T01:41:54 | 194,251,147 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.yiyuan.imageviewcircular;
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.yiyuan.imageviewcircular.test", appContext.getPackageName());
}
}
| [
"18024550106@163.com"
] | 18024550106@163.com |
32ad5993c47d1992bbb6e3027c81569e4f63e393 | 593b7c486f168ec98e0f9606f23693387ec01ef3 | /app/src/main/java/com/quizz/biblegame/quizz/biblegame/R.java | 6da5e3b0dd823661b70ead78badf54cfd8ca646b | [] | no_license | judekay/BibleGame | 7887cf254667b10958c287cd268c946849a158ca | 5e9734ec01e8a390fef336ecbc694b5887fd7525 | refs/heads/master | 2021-01-11T04:41:48.880075 | 2016-10-14T17:33:28 | 2016-10-14T17:33:28 | 71,111,659 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,180 | java | package com.quizz.biblegame.quizz.biblegame;
public final class R
{
public static final class anim
{
public static final int custom_anim = 2130968576;
public static final int fade_in = 2130968577;
public static final int fade_in2 = 2130968578;
}
public static final class attr {}
public static final class color
{
public static final int link_color = 2131099654;
public static final int logo_color = 2131099648;
public static final int menu_color = 2131099652;
public static final int menu_glow = 2131099653;
public static final int question_color = 2131099655;
public static final int title_color = 2131099650;
public static final int title_glow = 2131099651;
public static final int version_color = 2131099649;
}
public static final class dimen
{
public static final int activity_horizontal_margin = 2131165184;
public static final int activity_vertical_margin = 2131165185;
public static final int logo_size = 2131165186;
public static final int logo_sizes = 2131165187;
public static final int menu_item = 2131165193;
public static final int menu_item_size = 2131165192;
public static final int question = 2131165189;
public static final int screen_title_size = 2131165191;
public static final int version_size = 2131165188;
public static final int version_spacing = 2131165190;
}
public static final class drawable
{
public static final int about = 2130837504;
public static final int about2 = 2130837505;
public static final int aboutbut = 2130837506;
public static final int answer = 2130837507;
public static final int answer2 = 2130837508;
public static final int answerbut = 2130837509;
public static final int answerbut1 = 2130837510;
public static final int back = 2130837511;
public static final int back2 = 2130837512;
public static final int backbut = 2130837513;
public static final int backbut2 = 2130837514;
public static final int background = 2130837515;
public static final int backgroung = 2130837516;
public static final int bg2 = 2130837517;
public static final int bib = 2130837518;
public static final int bible1 = 2130837519;
public static final int biblebg = 2130837520;
public static final int biblelogoedit = 2130837521;
public static final int biblogo = 2130837522;
public static final int bibq = 2130837523;
public static final int bibtex = 2130837524;
public static final int bibtex1 = 2130837525;
public static final int black_button = 2130837526;
public static final int exit = 2130837527;
public static final int exit2 = 2130837528;
public static final int exitbut = 2130837529;
public static final int green_button = 2130837530;
public static final int help = 2130837531;
public static final int help2 = 2130837532;
public static final int helpbut = 2130837533;
public static final int ic_launcher = 2130837534;
public static final int menu = 2130837535;
public static final int menu2 = 2130837536;
public static final int menubut = 2130837537;
public static final int menubut1 = 2130837538;
public static final int nextbut = 2130837539;
public static final int nextbut2 = 2130837540;
public static final int nextbutx = 2130837541;
public static final int pla = 2130837542;
public static final int play = 2130837543;
public static final int play2 = 2130837544;
public static final int questionla = 2130837545;
public static final int scrollcor = 2130837546;
public static final int scrollcorlay = 2130837547;
public static final int set = 2130837548;
public static final int set2 = 2130837549;
public static final int setbut = 2130837550;
public static final int update = 2130837551;
public static final int update2 = 2130837552;
public static final int updatebut = 2130837553;
}
public static final class id
{
public static final int ScrollView01 = 2131361794;
public static final int aboutText = 2131361792;
public static final int abtbut = 2131361820;
public static final int answer1 = 2131361807;
public static final int answer2 = 2131361808;
public static final int answer3 = 2131361809;
public static final int answer4 = 2131361810;
public static final int answerBtn = 2131361803;
public static final int answers = 2131361795;
public static final int backBtn = 2131361793;
public static final int easySetting = 2131361815;
public static final int endgameResult = 2131361801;
public static final int exitBtn = 2131361821;
public static final int finishBtn = 2131361796;
public static final int group1 = 2131361806;
public static final int hardSetting = 2131361816;
public static final int imageView1 = 2131361799;
public static final int logo = 2131361813;
public static final int mediumSetting = 2131361814;
public static final int nextBtn = 2131361811;
public static final int playBtn = 2131361817;
public static final int question = 2131361805;
public static final int questionnumber = 2131361804;
public static final int resultPage = 2131361802;
public static final int rulesBtn = 2131361819;
public static final int rulesText = 2131361812;
public static final int settingsBtn = 2131361818;
public static final int textView1 = 2131361797;
public static final int textView2 = 2131361800;
public static final int textView3 = 2131361798;
}
public static final class layout
{
public static final int about = 2130903040;
public static final int answer = 2130903041;
public static final int answers = 2130903042;
public static final int bible_splash = 2130903043;
public static final int endgame = 2130903044;
public static final int question = 2130903045;
public static final int rules = 2130903046;
public static final int settings = 2130903047;
public static final int welcome = 2130903048;
}
public static final class raw
{
public static final int bibleabout = 2131034112;
public static final int biblehelp = 2131034113;
}
public static final class string
{
public static final int about = 2131230723;
public static final int app_name = 2131230721;
public static final int app_version = 2131230728;
public static final int hello = 2131230720;
public static final int help = 2131230722;
public static final int menu = 2131230730;
public static final int menu_item_about = 2131230735;
public static final int menu_item_help = 2131230734;
public static final int menu_item_play = 2131230732;
public static final int menu_item_play_10 = 2131230742;
public static final int menu_item_play_20 = 2131230743;
public static final int menu_item_play_30 = 2131230744;
public static final int menu_item_play_40 = 2131230745;
public static final int menu_item_play_50 = 2131230746;
public static final int menu_item_play_subtitle = 2131230741;
public static final int menu_item_play_title = 2131230740;
public static final int menu_item_scores = 2131230733;
public static final int menu_item_scores_name = 2131230738;
public static final int menu_item_scores_ranking = 2131230737;
public static final int menu_item_scores_score = 2131230739;
public static final int menu_item_scores_title = 2131230736;
public static final int menu_item_settings = 2131230731;
public static final int question = 2131230747;
public static final int scores = 2131230724;
public static final int splashbottom = 2131230726;
public static final int splashtogether = 2131230727;
public static final int splashtop = 2131230725;
public static final int str_next = 2131230729;
}
public static final class style
{
public static final int AppBaseTheme = 2131296256;
public static final int AppTheme = 2131296257;
}
}
/* Location: C:\Users\Kayode\Desktop\com.quizz.biblegame\dex2jar-0.0.9.15\classes_dex2jar.jar!\com\quizz\biblegame\R.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"jkayogunz@gmail.com"
] | jkayogunz@gmail.com |
31c9906fc0b6a4c222a2084642c37f6d408fedcc | 070070b7bdf5a63c1c418070a60d5ac0a8a5b7ee | /BCH/plugin/crypto_vault/fermat-bch-plugin-crypto-vault-bitcoin-currency-bitdubai/src/main/java/com/bitdubai/fermat_bch_plugin/layer/crypto_vault/developer/bitdubai/version_1/structure/BitcoinCurrencyCryptoVaultManager.java | 56d56512a69186fa5fc8cf7c809ee329c759f723 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | orlando711/fermat | 1f04bf34e59a460491841aff07f07d333afd84a7 | 6209184a9645f71c58cdc857738fa4ee0fbca42c | refs/heads/master | 2020-12-28T04:45:15.239382 | 2016-05-19T15:30:56 | 2016-05-19T15:30:56 | 53,953,922 | 0 | 0 | null | 2016-03-15T15:01:38 | 2016-03-15T15:01:38 | null | UTF-8 | Java | false | false | 19,326 | java | package com.bitdubai.fermat_bch_plugin.layer.crypto_vault.developer.bitdubai.version_1.structure;
import com.bitdubai.fermat_api.layer.all_definition.enums.BlockchainNetworkType;
import com.bitdubai.fermat_api.layer.all_definition.enums.VaultType;
import com.bitdubai.fermat_api.layer.all_definition.money.CryptoAddress;
import com.bitdubai.fermat_api.layer.osa_android.database_system.PluginDatabaseSystem;
import com.bitdubai.fermat_api.layer.osa_android.file_system.PluginFileSystem;
import com.bitdubai.fermat_bch_api.layer.crypto_network.bitcoin.BitcoinNetworkSelector;
import com.bitdubai.fermat_bch_api.layer.crypto_network.bitcoin.exceptions.CantBroadcastTransactionException;
import com.bitdubai.fermat_bch_api.layer.crypto_network.bitcoin.interfaces.BitcoinNetworkManager;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.HierarchyAccount.HierarchyAccountType;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.vault_seed.VaultSeedGenerator;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.vault_seed.exceptions.CantCreateAssetVaultSeed;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.vault_seed.exceptions.CantLoadExistingVaultSeed;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.exceptions.CouldNotSendMoneyException;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.exceptions.CryptoTransactionAlreadySentException;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.exceptions.GetNewCryptoAddressException;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.exceptions.InsufficientCryptoFundsException;
import com.bitdubai.fermat_bch_api.layer.crypto_vault.exceptions.InvalidSendToAddressException;
import com.bitdubai.fermat_bch_plugin.layer.crypto_vault.developer.bitdubai.version_1.database.BitcoinCurrencyCryptoVaultDao;
import com.bitdubai.fermat_bch_plugin.layer.crypto_vault.developer.bitdubai.version_1.exceptions.CantExecuteDatabaseOperationException;
import com.bitdubai.fermat_bch_plugin.layer.crypto_vault.developer.bitdubai.version_1.exceptions.CantInitializeBitcoinCurrencyCryptoVaultDatabaseException;
import com.bitdubai.fermat_bch_plugin.layer.crypto_vault.developer.bitdubai.version_1.exceptions.CantValidateCryptoNetworkIsActiveException;
import com.bitdubai.fermat_bch_plugin.layer.crypto_vault.developer.bitdubai.version_1.exceptions.InvalidSeedException;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.InsufficientMoneyException;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionOutput;
import org.bitcoinj.core.Wallet;
import org.bitcoinj.crypto.DeterministicKey;
import org.bitcoinj.crypto.MnemonicException;
import org.bitcoinj.script.ScriptBuilder;
import org.bitcoinj.script.ScriptOpCodes;
import org.bitcoinj.wallet.DeterministicSeed;
import org.bitcoinj.wallet.KeyChain;
import org.bitcoinj.wallet.WalletTransaction;
import java.util.List;
import java.util.UUID;
/**
* Created by rodrigo on 12/17/15.
*/
public class BitcoinCurrencyCryptoVaultManager {
/**
* BitcoinCurrencyCryptoVaultManager variables
*/
UUID pluginId;
VaultKeyHierarchyGenerator vaultKeyHierarchyGenerator;
BitcoinCurrencyCryptoVaultDao dao;
/**
* File name information where the seed will be stored
*/
private final String BITCOIN_VAULT_SEED_FILEPATH = "BitcoinVaultSeed";
private final String BITCOIN_VAULT_SEED_FILENAME;
/**
* platform interfaces definition
*/
BitcoinNetworkManager bitcoinNetworkManager;
PluginFileSystem pluginFileSystem;
PluginDatabaseSystem pluginDatabaseSystem;
/**
* Constructor
* @param pluginId
* @param pluginFileSystem
*/
public BitcoinCurrencyCryptoVaultManager(UUID pluginId,
PluginFileSystem pluginFileSystem,
PluginDatabaseSystem pluginDatabaseSystem,
String seedFileName,
BitcoinNetworkManager bitcoinNetworkManager) throws InvalidSeedException {
this.pluginId = pluginId;
BITCOIN_VAULT_SEED_FILENAME = seedFileName;
this.pluginFileSystem = pluginFileSystem;
this.pluginDatabaseSystem = pluginDatabaseSystem;
this.bitcoinNetworkManager = bitcoinNetworkManager;
/**
* I will let the VaultKeyHierarchyGenerator to start and generate the hierarchy in a new thread
*/
vaultKeyHierarchyGenerator = new VaultKeyHierarchyGenerator(getBitcoinVaultSeed(), pluginDatabaseSystem, this.bitcoinNetworkManager, this.pluginId);
new Thread(vaultKeyHierarchyGenerator).start();
}
/**
* Creates a new Seed or loads and existing one for the user logged.
* @return
* @throws CantCreateAssetVaultSeed
* @throws CantLoadExistingVaultSeed
*/
private DeterministicSeed getBitcoinVaultSeed() throws InvalidSeedException{
try{
VaultSeedGenerator vaultSeedGenerator = new VaultSeedGenerator(this.pluginFileSystem, this.pluginId, BITCOIN_VAULT_SEED_FILEPATH, BITCOIN_VAULT_SEED_FILENAME);
if (!vaultSeedGenerator.seedExists()){
vaultSeedGenerator.create();
/**
* I realod it to make sure I'm using the seed I will start using from now on. Issue #3330
*/
vaultSeedGenerator.load();
} else
vaultSeedGenerator.load();
DeterministicSeed seed = new DeterministicSeed(vaultSeedGenerator.getSeedBytes(), vaultSeedGenerator.getMnemonicCode(), vaultSeedGenerator.getCreationTimeSeconds());
seed.check();
return seed;
} catch (CantLoadExistingVaultSeed cantLoadExistingVaultSeed) {
throw new InvalidSeedException(InvalidSeedException.DEFAULT_MESSAGE, cantLoadExistingVaultSeed, "there was an error trying to load an existing seed.", null);
} catch (CantCreateAssetVaultSeed cantCreateAssetVaultSeed) {
throw new InvalidSeedException(InvalidSeedException.DEFAULT_MESSAGE, cantCreateAssetVaultSeed, "there was an error trying to create a new seed.", null);
} catch (MnemonicException e) {
throw new InvalidSeedException(InvalidSeedException.DEFAULT_MESSAGE, e, "the seed that was generated is not valid.", null);
}
}
/**
* Will get a new crypto address from the Bitcoin vault account.
* @param blockchainNetworkType
* @return
* @throws GetNewCryptoAddressException
*/
public CryptoAddress getNewBitcoinVaultCryptoAddress(BlockchainNetworkType blockchainNetworkType) throws GetNewCryptoAddressException {
/**
* I create the account manually instead of getting it from the database because this method always returns addresses
* from the Bitcoin vault account with Id 0.
*/
com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.HierarchyAccount.HierarchyAccount vaultAccount = new com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.HierarchyAccount.HierarchyAccount(0, "Bitcoin Vault account", HierarchyAccountType.MASTER_ACCOUNT);
return vaultKeyHierarchyGenerator.getVaultKeyHierarchy().getBitcoinAddress(blockchainNetworkType, vaultAccount);
}
/**
* Creates a bitcoinj Wallet from the already derived keys of the specified account.
* @param vaultAccount
* @param networkParameters
* @return
*/
private Wallet getWalletForAccount(com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.HierarchyAccount.HierarchyAccount vaultAccount, NetworkParameters networkParameters) {
List<ECKey> derivedKeys = vaultKeyHierarchyGenerator.getVaultKeyHierarchy().getDerivedKeys(vaultAccount);
Wallet wallet = Wallet.fromKeys(networkParameters, derivedKeys);
return wallet;
}
/**
* Transform a CryptoAddress into a BitcoinJ Address
* * @param networkParameters the network parameters where we are using theis address.
* @param cryptoAddress the Crypto Address
* @return a bitcoinJ address.
*/
private Address getBitcoinAddress(NetworkParameters networkParameters, CryptoAddress cryptoAddress) throws AddressFormatException {
Address address = new Address(networkParameters, cryptoAddress.getAddress());
return address;
}
/**
* Gets the next available key from the specified account.
* @return
*/
private ECKey getNextAvailableECKey(com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.HierarchyAccount.HierarchyAccount hierarchyAccount) throws CantExecuteDatabaseOperationException {
ECKey ecKey = vaultKeyHierarchyGenerator.getVaultKeyHierarchy().getNextAvailableKey(hierarchyAccount);
return ecKey;
}
/**
* Will make sure that we have a listening network running for this address that we are trying to send bitcoins to.
* @param cryptoAddress
*/
private BlockchainNetworkType validateNetorkIsActiveForCryptoAddress(CryptoAddress cryptoAddress) throws CantValidateCryptoNetworkIsActiveException {
/**
* I need to make sure that we have generated a key on the network type to which the address belongs
* to, so we can be sure that the Crypto Network is listening on this network.
*/
try {
List<BlockchainNetworkType> networkTypes = getDao().getActiveNetworkTypes();
BlockchainNetworkType addressNetworkType = BitcoinNetworkSelector.getBlockchainNetworkType(getNetworkParametersFromAddress(cryptoAddress.getAddress()));
/**
* If the address Network Type is not registered, then I won't go on because I know I'm not listening to it.
*/
if (!networkTypes.contains(addressNetworkType)){
StringBuilder output = new StringBuilder("The specified address belongs to a Bitcoin network we are not listening to.");
output.append(System.lineSeparator());
output.append("BlockchainNetworkType: " + addressNetworkType.toString());
output.append(System.lineSeparator());
output.append("Active Networks are: " + networkTypes.toString());
throw new CantValidateCryptoNetworkIsActiveException(CantValidateCryptoNetworkIsActiveException.DEFAULT_MESSAGE, null, output.toString(), null);
}
return addressNetworkType;
} catch (CantExecuteDatabaseOperationException e) {
/**
* If I can't validate this. I will continue because I may be listening to this network already.
*/
e.printStackTrace();
return BlockchainNetworkType.DEFAULT;
} catch (AddressFormatException e) {
/**
* If the passed address doesn't have the correct format, I can't go on.
*/
throw new CantValidateCryptoNetworkIsActiveException(CantValidateCryptoNetworkIsActiveException.DEFAULT_MESSAGE, e, "The specified address is not in the right format: " + cryptoAddress.getAddress(), null);
}
}
/**
* Calculates the network parameters from the specified address.
* @param addressTo
* @return
* @throws AddressFormatException in case the address is not in the correct format.
*/
private NetworkParameters getNetworkParametersFromAddress(String addressTo) throws AddressFormatException {
NetworkParameters networkParameters = Address.getParametersFromAddress(addressTo);
/**
* if the network parameters calculated is different that the Default network I will double check
*/
if (BitcoinNetworkSelector.getBlockchainNetworkType(networkParameters) != BlockchainNetworkType.DEFAULT){
return BitcoinNetworkSelector.getNetworkParameter(BlockchainNetworkType.DEFAULT);
} else
return networkParameters;
}
/**
* instantiates and creates the dao object to access the database
* @return
*/
private BitcoinCurrencyCryptoVaultDao getDao(){
if (dao == null){
try {
dao = new BitcoinCurrencyCryptoVaultDao(this.pluginDatabaseSystem, this.pluginId);
} catch (CantInitializeBitcoinCurrencyCryptoVaultDatabaseException e) {
e.printStackTrace();
}
}
return dao;
}
/**
* Determines if the passsed CryptoAddress is valid.
* @param addressTo the address to validate
* @return true if valid, false if it is not.
*/
public boolean isValidAddress(CryptoAddress addressTo) {
/**
* I extract the network Parameter from the address
*/
NetworkParameters networkParameters;
try {
networkParameters = getNetworkParametersFromAddress(addressTo.getAddress());
} catch (AddressFormatException e) {
/**
* If there is an error, I will use the default parameters.
*/
networkParameters = BitcoinNetworkSelector.getNetworkParameter(BlockchainNetworkType.DEFAULT);
}
/**
* If the address is correct, then no exception raised.
*/
try {
Address address = new Address(networkParameters, addressTo.getAddress());
return true;
} catch (AddressFormatException e) {
return false;
}
}
/**
* gets a fresh un used crypto Address from the vault
*/
public CryptoAddress getAddress() {
try {
return this.getNewBitcoinVaultCryptoAddress(BlockchainNetworkType.DEFAULT);
} catch (GetNewCryptoAddressException e) {
e.printStackTrace();
return null;
}
}
/**
* Send bitcoins to the specified address. The Address must be a valid address in the network being used
* and we must have enought funds to send this money. It allows including an Op_return output value.
* @param walletPublicKey
* @param FermatTrId
* @param addressTo
* @param satoshis
* @param op_Return
* @return
* @throws InsufficientCryptoFundsException
* @throws InvalidSendToAddressException
* @throws CouldNotSendMoneyException
* @throws CryptoTransactionAlreadySentException
*/
public String sendBitcoins (String walletPublicKey, UUID FermatTrId, CryptoAddress addressTo, long satoshis, String op_Return)
throws InsufficientCryptoFundsException,
InvalidSendToAddressException,
CouldNotSendMoneyException,
CryptoTransactionAlreadySentException {
/**
* I get the network for this address and validate that is active
*/
BlockchainNetworkType networkType = null;
try {
networkType = validateNetorkIsActiveForCryptoAddress(addressTo);
} catch (CantValidateCryptoNetworkIsActiveException e) {
throw new CouldNotSendMoneyException(CouldNotSendMoneyException.DEFAULT_MESSAGE, e, "The network to which this address belongs to, is not active!", null);
}
/**
* I get the networkParameter
*/
final NetworkParameters networkParameters = BitcoinNetworkSelector.getNetworkParameter(networkType);
/**
* I get the bitcoin address
*/
Address address = null;
try {
address = getBitcoinAddress(networkParameters,addressTo);
} catch (AddressFormatException e) {
throw new InvalidSendToAddressException(e, "The specified address " + addressTo.getAddress() + " is not valid.", null);
}
/**
* I get the Bitcoin Transactions stored in the CryptoNetwork for this vault.
*/
List<Transaction> transactions = bitcoinNetworkManager.getBitcoinTransaction(networkType, VaultType.CRYPTO_CURRENCY_VAULT);
/**
* Create the bitcoinj wallet from the keys of this account
*/
com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.HierarchyAccount.HierarchyAccount vaultAccount = new com.bitdubai.fermat_bch_api.layer.crypto_vault.classes.HierarchyAccount.HierarchyAccount(0, "Bitcoin Vault account", HierarchyAccountType.MASTER_ACCOUNT);
//final Wallet wallet = getWalletForAccount(vaultAccount, networkParameters);
Wallet wallet = null;
try {
wallet = Wallet.fromSeed(networkParameters, getBitcoinVaultSeed());
} catch (InvalidSeedException e) {
e.printStackTrace();
}
wallet.importKeys(vaultKeyHierarchyGenerator.getVaultKeyHierarchy().getDerivedKeys(vaultAccount));
/**
* Add transactions to the wallet that we can use to spend.
*/
for (Transaction transaction : transactions){
if (!transaction.isEveryOwnedOutputSpent(wallet)){
WalletTransaction walletTransaction = new WalletTransaction(WalletTransaction.Pool.UNSPENT, transaction);
wallet.addWalletTransaction(walletTransaction);
}
}
/**
* sets the fee and value to send
*/
Coin fee = Coin.valueOf(10000);
final Coin coinToSend = Coin.valueOf(satoshis);
/**
* creates the send request and broadcast it on the network.
*/
Wallet.SendRequest sendRequest = Wallet.SendRequest.to(address, coinToSend);
/**
* I set SendRequest properties
*/
sendRequest.fee = fee;
sendRequest.feePerKb = Coin.ZERO;
sendRequest.shuffleOutputs = false;
/**
* I will add the OP_Return output if any
*/
if (op_Return != null){
sendRequest.tx.addOutput(Coin.ZERO, new ScriptBuilder().op(ScriptOpCodes.OP_RETURN).data(op_Return.getBytes()).build());
}
try {
wallet.completeTx(sendRequest);
} catch (InsufficientMoneyException e) {
StringBuilder output = new StringBuilder("Not enought money to send bitcoins.");
output.append(System.lineSeparator());
output.append("Current balance available for this vault: " + wallet.getBalance().getValue());
output.append(System.lineSeparator());
output.append("Current value to send: " + coinToSend.getValue() + " (+fee: " + fee.getValue() + ")");
throw new InsufficientCryptoFundsException(InsufficientCryptoFundsException.DEFAULT_MESSAGE, e, output.toString(), null);
}
try {
bitcoinNetworkManager.broadcastTransaction(networkType, sendRequest.tx, FermatTrId);
} catch (CantBroadcastTransactionException e) {
throw new CouldNotSendMoneyException(CouldNotSendMoneyException.DEFAULT_MESSAGE, e, "There was an error broadcasting the transaction.", "Crypto Network error");
} catch (Exception e){
throw new CouldNotSendMoneyException(CouldNotSendMoneyException.DEFAULT_MESSAGE, e, "There was an error broadcasting the transaction.", "Crypto Network error");
}
return sendRequest.tx.getHashAsString();
}
}
| [
"acosta_rodrigo@hotmail.com"
] | acosta_rodrigo@hotmail.com |
fa5321f1664f349f49777a4d4ef168a1352109fa | 6d608140b87bcd8a8caf34d7f653dfb5a4703ec3 | /src/test/ProductTest.java | e41da67151042499cbc74263a038af8845fa1abc | [] | no_license | dlopeznev/DesafioSelenium | ce00d11321b1d6671b3bdfe3eb1407b8299b9f13 | 4b46e52ae8b30a5c51f463188b58b2f3f1e2e46e | refs/heads/master | 2021-01-01T05:16:03.316221 | 2016-04-24T15:43:03 | 2016-04-24T15:43:03 | 56,195,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,154 | java | package test;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.openqa.selenium.WebElement;
import files.FileHandler;
import pageobject.HomePage;
@RunWith(value = Parameterized.class)
public class ProductTest
{
HomePage homePage;
String product;
public ProductTest (String product)
{
this.product = product;
}
@Parameters(name = "Producto -> {0}")
public static Iterable<Object[]> fileProducts()
{
HomePage homePage = new HomePage();
FileHandler fh = new FileHandler();
//Obtengo todos los productos
List<String> allProducts = homePage.getAllProductsTitles();
homePage.quit();
//Guardo los mismos
fh.writeFile("/file/allProducts.txt", ",", allProducts);
//Los levanto del archivo
List<String> products = fh.readFile("/file/allProducts.txt", ",");
Collection<String> c = products;
Collection<Object[]> co = c.stream()
.map(ele -> new Object[]{ele})
.collect(Collectors.toList());
return co;
}
@Before
public void setUp() throws Exception
{
this.homePage = new HomePage();
}
@Test
public void Test()
{
try
{
this.homePage.open();
this.homePage.getSearchInput().sendKeys(product);
this.homePage.getSearchButton().click();
List<WebElement> products = this.homePage.getProducts();
if (products != null && products.size() == 1)
Assert.assertEquals(products.get(0).getAttribute("title").trim().toLowerCase(), product.trim().toLowerCase());
else
Assert.assertNotNull(products);
}
catch (Exception e)
{
System.out.println(e);
Assert.fail();
}
}
@After
public void tearDown()
{
this.homePage.quit();
}
} | [
"dlopeznev@gmail.com"
] | dlopeznev@gmail.com |
299ebaea0986742542bc8ea0ee9d51d09ddd37d3 | 0447e7abd4bc0c96764042d8d181d18089d303cb | /src/main/java/uz/daba/gateway/transports/court/BaseCourtResult.java | cf302c41c472e457805a46aca8b87cc288e54ea2 | [] | no_license | sardorsamadov926611/DABAWS | e21f578b7da3e776b9f6a9f33123137349f992de | 4b50fa23bdf7c269517bc8875b4f0936d6b7eca2 | refs/heads/main | 2023-07-13T07:22:05.660114 | 2021-08-13T06:15:52 | 2021-08-13T06:15:52 | 373,740,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package uz.daba.gateway.transports.court;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
public class BaseCourtResult implements Serializable {
@JsonProperty("result_code")
private Integer result_code;
@JsonProperty("result_message")
private String result_message;
public Integer getResult_code() {
return result_code;
}
public void setResult_code(Integer result_code) {
this.result_code = result_code;
}
public String getResult_message() {
return result_message;
}
public void setResult_message(String result_message) {
this.result_message = result_message;
}
}
| [
"sardor@mail.ru"
] | sardor@mail.ru |
a3ef917a0e6a0acd663c89baa55a861d2d5137fa | 7682bac9a7530c7f1a5d6a883c4c92c7c5e737e7 | /albumlib/src/main/java/com/woshiku/albumlibrary/model/AlbumGridModel.java | 0f91dbb4340c76c75da7b8e8861475887547ed99 | [] | no_license | woshiku110/JksHospticalDoctor | 41efdfe65bbf9783cef356b8937877db55ee66fe | f215e04915b55b44dc2fc005494bda88c6594359 | refs/heads/master | 2021-01-19T04:57:22.679860 | 2017-06-20T01:51:05 | 2017-06-20T01:51:05 | 87,404,425 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,551 | java | package com.woshiku.albumlibrary.model;
import com.woshiku.albumlibrary.domain.ImageInfo;
import java.util.List;
import rx.Observable;
import rx.Subscriber;
/**
* Created by Administrator on 2016/8/12.
*/
public class AlbumGridModel {
public Observable setEmptyData(){
return Observable.create(new MyEmptySubscriber());
}
//创建数字变化观察者
public Observable setTextAmount(List<String> msg){
return Observable.create(new MyTextSubscriber(msg));
}
//创建list变化观察者
public Observable setGridData(List<ImageInfo> mList){
return Observable.create(new MyListSubscriber(mList));
}
//刷新单个item
public Observable freshSingleItem(int pos){
return Observable.create(new MyMsgSubscriber(pos));
}
public Observable freshGridView(){
return Observable.create(new MyEmptySubscriber());
}
//创建Text订阅者
class MyMsgSubscriber implements Observable.OnSubscribe<String>{
private int pos;
public MyMsgSubscriber(int pos) {
this.pos = pos;
}
@Override
public void call(Subscriber<? super String> subscriber) {
subscriber.onNext(pos+"");
}
}
//创建Text订阅者
class MyEmptySubscriber implements Observable.OnSubscribe<Void>{
@Override
public void call(Subscriber<? super Void> subscriber) {
subscriber.onCompleted();
}
}
//创建Text订阅者
class MyTextSubscriber implements Observable.OnSubscribe<List<String>>{
private List<String> msg;
public MyTextSubscriber(List<String> msg) {
this.msg = msg;
}
@Override
public void call(Subscriber<? super List<String>> subscriber) {
if(msg == null){
subscriber.onError(new Exception("msg == null"));
}else{
subscriber.onNext(msg);
subscriber.onCompleted();
}
}
}
//创建listview订阅者
class MyListSubscriber implements Observable.OnSubscribe<List<ImageInfo>>{
private List<ImageInfo> mList;
public MyListSubscriber(List<ImageInfo> mList) {
this.mList = mList;
}
@Override
public void call(Subscriber<? super List<ImageInfo>> subscriber) {
if(mList == null){
subscriber.onError(new Exception("mlist == null"));
}else{
subscriber.onNext(mList);
}
}
}
}
| [
"849383208@qq.com"
] | 849383208@qq.com |
91bb512094dca36d56aa2488804af27a0b1196e8 | 51732703280fbfed2bd952b750bec4956a36d991 | /grocessoryshop/src/main/java/com/niit/groccessory/model/Category.java | 16769fa71949c50430f7192a61275e8a4999a07c | [] | no_license | coolprocess/Groccessory_ACE_PROJECT_2019_july | b691b2219ed6cf390e64bf6538ce7cd2b3196670 | a51ca839d072e8bc7a9e5dbd570de8923b044874 | refs/heads/master | 2022-12-26T19:13:40.500181 | 2019-08-21T04:31:23 | 2019-08-21T04:31:23 | 198,664,567 | 0 | 0 | null | 2022-12-16T04:46:14 | 2019-07-24T15:41:10 | Java | UTF-8 | Java | false | false | 1,140 | java | package com.niit.groccessory.model;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
@Entity
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int cid;
@NotNull
private String cname;
@NotNull
private String cdesc;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "category")
private Collection<Product> products= new ArrayList<Product>();
public Collection<Product> getProducts() {
return products;
}
public void setProducts(Collection<Product> products) {
this.products = products;
}
public int getCid() {
return cid;
}
public void setCid(int cid) {
this.cid = cid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
public String getCdesc() {
return cdesc;
}
public void setCdesc(String cdesc) {
this.cdesc = cdesc;
}
}
| [
"ramachetan11@gmail.com"
] | ramachetan11@gmail.com |
a240cc8dbe687cf40227051e41b06464fade23f6 | 22d6d9e189b642378ac820ecc5b5627a9db785ab | /src/cn/itcast/homework/jdbc/JDBCTest16_04.java | ef190b99447b5be4881f16885d08dd4617eee0b0 | [] | no_license | Simon199201/JavaWeb | 7656963e0aa0eb2124d5e1c6f8786bb9ef4108d4 | d239da012fbc372f077265e07099c4b55fd77de5 | refs/heads/master | 2020-07-30T08:52:42.705105 | 2019-11-29T06:43:52 | 2019-11-29T06:43:52 | 210,162,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,535 | java | package cn.itcast.homework.jdbc;
import cn.itcast.jdbc.bean.Student;
import cn.itcast.jdbc.util.JDBCUtils;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* 使用PreparedStatement对象完成数据库的增删改查
* <p>
* 1.添加一个学生到学生表
* <p>
* 2.删除id=1的学生信息
* <p>
* 3.修改id=2学生的姓名为”jack”
* <p>
* 4.查询所有的学生信息
*/
public class JDBCTest16_04 {
public static void main(String[] args) {
System.out.println(new JDBCTest16_04().getAllStudent());
}
public List<Student> getAllStudent(){
Connection conn = null;
List<Student> list = new ArrayList<>();
try {
conn = JDBCUtils.getConnection();
//添加一张学生表
// String sql = "create table student5(id int primary key auto_increment,nama varchar(20))";
//添加一个学生到学生表
// String sql = "insert into student5 values(null,'zhangsan')";
//删除id=1的学生信息
// String sql = "delete from student5 where id = ?";
// PreparedStatement preparedStatement = conn.prepareStatement(sql);
// preparedStatement.setInt(1, 1);
//修改id=2学生的姓名为”jack”
// String sql = "update student5 set name = ? where id = 2 ";
// PreparedStatement preparedStatement = conn.prepareStatement(sql);
// preparedStatement.setString(1, "jack");
//查询所有的学生信息
String sql = "select * from student5 ";
PreparedStatement preparedStatement = conn.prepareStatement(sql);
// boolean execute = preparedStatement.execute();
// System.out.println(execute);
ResultSet resultSet = preparedStatement.executeQuery();
Student student = null;
while (resultSet.next()) {
student = new Student();
int id = resultSet.getInt(1);
String name = resultSet.getString(2);
System.out.println("id is " + id + "\tname is " + name);
student.setId(id);
student.setName(name);
list.add(student);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
JDBCUtils.close(null, conn);
}
return list;
}
}
| [
"zhangxinmeng@ainirobot.com"
] | zhangxinmeng@ainirobot.com |
9916633c05654087144aea596a748907a14a40a5 | 6bd5574ed166e043edf9796e8dff5b92a6f30d2a | /src/main/java/com/rmgx/myapp/repository/UserRepository.java | 442acd3050b28c0cf9008a0eefa385161d50c669 | [] | no_license | HarshitChhipa/jhipster-demo-application | 3fb3ff9b44a474c0e6a3dedbc859d528f7da6d78 | 4347011328a42c1ab158ee142b947da875b933d3 | refs/heads/master | 2020-04-15T16:18:31.229412 | 2019-01-31T06:28:54 | 2019-01-31T06:28:54 | 164,829,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | package com.rmgx.myapp.repository;
import com.rmgx.myapp.domain.User;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import java.time.Instant;
/**
* Spring Data MongoDB repository for the User entity.
*/
@Repository
public interface UserRepository extends MongoRepository<User, String> {
String USERS_BY_LOGIN_CACHE = "usersByLogin";
String USERS_BY_EMAIL_CACHE = "usersByEmail";
Optional<User> findOneByActivationKey(String activationKey);
List<User> findAllByActivatedIsFalseAndCreatedDateBefore(Instant dateTime);
Optional<User> findOneByResetKey(String resetKey);
@Cacheable(cacheNames = USERS_BY_EMAIL_CACHE)
Optional<User> findOneByEmailIgnoreCase(String email);
@Cacheable(cacheNames = USERS_BY_LOGIN_CACHE)
Optional<User> findOneByLogin(String login);
Page<User> findAllByLoginNot(Pageable pageable, String login);
}
| [
"hchippa@expedien.in"
] | hchippa@expedien.in |
4f30a99612e0d8028332a6041878a955b69dc45c | d282f9af906748b3dd345bffe8713ec164b4e742 | /src/com/millersvillecs/moleculeandroid/graphics/Color.java | cd06dbd16f678f46859928f2aa657839f3f09617 | [] | no_license | MillersvilleCS/MoleculeFlashcardsAndroid | 0d6ee2408d0f3594c65a6b532a51b5e49f597db7 | 7df2fab5b59a9fbf9da41f6c1d6f10295597998a | refs/heads/master | 2021-01-20T08:48:46.461971 | 2014-08-30T00:17:07 | 2014-08-30T00:17:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,606 | java | package com.millersvillecs.moleculeandroid.graphics;
import com.millersvillecs.moleculeandroid.util.RangeUtils;
/**
* @author William Gervasio
*/
public class Color implements Cloneable {
public static final float MINIMUM_CHANNEL_VALUE = 0.0f;
public static final float MAXIMUM_CHANNEL_VALUE = 1.0f;
private float r, g, b, a;
public Color() {
this(MINIMUM_CHANNEL_VALUE, MINIMUM_CHANNEL_VALUE, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
}
public Color(float r, float g, float b) {
this(r, g, b, 1);
}
public Color(float r, float g, float b, float a) {
set(r, g, b, a);
}
public Color brighten(float percentage) {
percentage += 1;
r *= percentage;
g *= percentage;
b *= percentage;
return clamp();
}
public Color darken(float percentage) {
percentage = 1 - percentage;
r *= percentage;
g *= percentage;
b *= percentage;
return clamp();
}
public final Color set(float r, float g, float b, float a) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
return clamp();
}
public Color setRed(float r) {
this.r = RangeUtils.forceIntoRange(r, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
return this;
}
public float getRed() {
return r;
}
public Color setGreen(float g) {
this.g = RangeUtils.forceIntoRange(g, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
return this;
}
public float getGreen() {
return g;
}
public Color setBlue(float b) {
this.b = RangeUtils.forceIntoRange(b, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
return this;
}
public float getBlue() {
return b;
}
public Color setAlpha(float a) {
this.a = RangeUtils.forceIntoRange(a, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
return this;
}
public float getAlpha() {
return a;
}
public float[] getElements() {
return new float[]{r, g, b, a};
}
public Color clone() {
return new Color(r, g, b, a);
}
private Color clamp() {
r = RangeUtils.forceIntoRange(r, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
g = RangeUtils.forceIntoRange(g, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
b = RangeUtils.forceIntoRange(b, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
a = RangeUtils.forceIntoRange(a, MINIMUM_CHANNEL_VALUE, MAXIMUM_CHANNEL_VALUE);
return this;
}
} | [
"wpgervasio@gmail.com"
] | wpgervasio@gmail.com |
fe38a57c59d7a9ffb0402bf1edb95927ab27c81b | 4e744d2ea54c5e5515170c5b67a38442371e6fc2 | /src/main/java/com/qigu/readword/web/rest/MessageContentResource.java | 30281fd604eb11aa550d55919303b89ed21c2a6e | [] | no_license | BulkSecurityGeneratorProject/readWord | c49c825f4461bdb57f438545f895b1ff95cd97c3 | d24ad490077ae41f05d4c99dd3989a62cb506122 | refs/heads/master | 2022-12-22T00:00:32.341169 | 2018-06-13T07:40:41 | 2018-06-13T07:40:41 | 296,523,975 | 0 | 0 | null | 2020-09-18T05:36:26 | 2020-09-18T05:36:25 | null | UTF-8 | Java | false | false | 7,108 | java | package com.qigu.readword.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.qigu.readword.service.MessageContentService;
import com.qigu.readword.web.rest.errors.BadRequestAlertException;
import com.qigu.readword.web.rest.util.HeaderUtil;
import com.qigu.readword.web.rest.util.PaginationUtil;
import com.qigu.readword.service.dto.MessageContentDTO;
import com.qigu.readword.service.dto.MessageContentCriteria;
import com.qigu.readword.service.MessageContentQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
import java.util.stream.StreamSupport;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* REST controller for managing MessageContent.
*/
@RestController
@RequestMapping("/api")
public class MessageContentResource {
private final Logger log = LoggerFactory.getLogger(MessageContentResource.class);
private static final String ENTITY_NAME = "messageContent";
private final MessageContentService messageContentService;
private final MessageContentQueryService messageContentQueryService;
public MessageContentResource(MessageContentService messageContentService, MessageContentQueryService messageContentQueryService) {
this.messageContentService = messageContentService;
this.messageContentQueryService = messageContentQueryService;
}
/**
* POST /message-contents : Create a new messageContent.
*
* @param messageContentDTO the messageContentDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new messageContentDTO, or with status 400 (Bad Request) if the messageContent has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/message-contents")
@Timed
public ResponseEntity<MessageContentDTO> createMessageContent(@Valid @RequestBody MessageContentDTO messageContentDTO) throws URISyntaxException {
log.debug("REST request to save MessageContent : {}", messageContentDTO);
if (messageContentDTO.getId() != null) {
throw new BadRequestAlertException("A new messageContent cannot already have an ID", ENTITY_NAME, "idexists");
}
MessageContentDTO result = messageContentService.save(messageContentDTO);
return ResponseEntity.created(new URI("/api/message-contents/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /message-contents : Updates an existing messageContent.
*
* @param messageContentDTO the messageContentDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated messageContentDTO,
* or with status 400 (Bad Request) if the messageContentDTO is not valid,
* or with status 500 (Internal Server Error) if the messageContentDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/message-contents")
@Timed
public ResponseEntity<MessageContentDTO> updateMessageContent(@Valid @RequestBody MessageContentDTO messageContentDTO) throws URISyntaxException {
log.debug("REST request to update MessageContent : {}", messageContentDTO);
if (messageContentDTO.getId() == null) {
return createMessageContent(messageContentDTO);
}
MessageContentDTO result = messageContentService.save(messageContentDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, messageContentDTO.getId().toString()))
.body(result);
}
/**
* GET /message-contents : get all the messageContents.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of messageContents in body
*/
@GetMapping("/message-contents")
@Timed
public ResponseEntity<List<MessageContentDTO>> getAllMessageContents(MessageContentCriteria criteria, Pageable pageable) {
log.debug("REST request to get MessageContents by criteria: {}", criteria);
Page<MessageContentDTO> page = messageContentQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/message-contents");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /message-contents/:id : get the "id" messageContent.
*
* @param id the id of the messageContentDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the messageContentDTO, or with status 404 (Not Found)
*/
@GetMapping("/message-contents/{id}")
@Timed
public ResponseEntity<MessageContentDTO> getMessageContent(@PathVariable Long id) {
log.debug("REST request to get MessageContent : {}", id);
MessageContentDTO messageContentDTO = messageContentService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(messageContentDTO));
}
/**
* DELETE /message-contents/:id : delete the "id" messageContent.
*
* @param id the id of the messageContentDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/message-contents/{id}")
@Timed
public ResponseEntity<Void> deleteMessageContent(@PathVariable Long id) {
log.debug("REST request to delete MessageContent : {}", id);
messageContentService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
/**
* SEARCH /_search/message-contents?query=:query : search for the messageContent corresponding
* to the query.
*
* @param query the query of the messageContent search
* @param pageable the pagination information
* @return the result of the search
*/
@GetMapping("/_search/message-contents")
@Timed
public ResponseEntity<List<MessageContentDTO>> searchMessageContents(@RequestParam String query, Pageable pageable) {
log.debug("REST request to search for a page of MessageContents for query {}", query);
Page<MessageContentDTO> page = messageContentService.search(query, pageable);
HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/message-contents");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
}
| [
"hupanpan@nipponpaint.com.cn"
] | hupanpan@nipponpaint.com.cn |
62877804b3200d8f678da359d2f240fe8f7a57be | 27d8c9749c9756882679e313a94eed5d963ab3a2 | /app/src/main/java/com/example/rodri/filmesseries/Activity/DetalhesFilmeActivity.java | a3fc76277fbe576b5b113b2c72815790a9e2c0d2 | [] | no_license | ufjf-dcc196/dcc196-2018-3-trb3-rodrigo-raiza | b95150e9bb918faa23b9ad474dadd5ca431c789a | 4959786f6f5ffb980fd360ac6b260ccd3e5f1e68 | refs/heads/master | 2020-04-09T19:35:59.832394 | 2018-12-05T22:31:14 | 2018-12-05T22:31:14 | 160,547,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,768 | java | package com.example.rodri.filmesseries.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.rodri.filmesseries.Classe.Filmes;
import com.example.rodri.filmesseries.DAO.VideoQuery;
import com.example.rodri.filmesseries.DAO.VideosContract;
import com.example.rodri.filmesseries.DAO.VideosDbHelper;
import com.example.rodri.filmesseries.R;
public class DetalhesFilmeActivity extends AppCompatActivity {
private VideosDbHelper dbHelper;
private Button btnInserir;
private Filmes f;
private TextView txtTitulo;
private TextView txtData;
private TextView txtDescricao;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detalhes_filme);
f = (Filmes) getIntent().getSerializableExtra("Detalhe Filme");
dbHelper = new VideosDbHelper(getApplicationContext());
txtTitulo = findViewById(R.id.txt_filme_detalhes_titulo);
txtData = findViewById(R.id.txt_filme_detalhes_data);
txtDescricao = findViewById(R.id.txt_filme_detalhes_descricao);
txtTitulo.setText(f.getTitulo());
txtDescricao.setText(f.getDescricao());
txtData.setText(f.getDate());
btnInserir = findViewById(R.id.btn_detalhes_inserir);
btnInserir.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
VideoQuery.InserirFilme(dbHelper.getReadableDatabase(),f.getTitulo(),f.getDate(),f.getId(),f.getImagem(),f.getDescricao());
finish();
}
});
}
}
| [
"rodrigopitubasouza@live.com"
] | rodrigopitubasouza@live.com |
c9ed16c93851e4e71ee23904e443bbe0cd5f5bcf | 7e422ce578649c945e627240ae16b9f0d5269ee4 | /src/controller/AccessConfig.java | ee0cfbae888159980fcd4d3855d789d1a6f95cb4 | [] | no_license | ericMouss/Chat_Room | 93c9ae5a68d38ed303c6053b142be822dae088a2 | d75564856aa4169554f1def915f5587f89392a44 | refs/heads/master | 2022-11-10T14:29:19.838784 | 2020-06-21T21:45:56 | 2020-06-21T21:45:56 | 273,800,169 | 0 | 3 | null | 2020-06-21T21:44:23 | 2020-06-20T23:25:07 | Java | UTF-8 | Java | false | false | 2,978 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controller;
import java.io.FileInputStream;
import java.io.InputStream;
/**
*
* @author Manfo
*/
class AccessConfig {
//singleton
private static AccessConfig dbAccess = new AccessConfig();
private static String DB_DRIVER_CLASS;
private static String DB_URL;
private static String DB_USERNAME;
private static String DB_PASSWORD;
private static int INITIAL_SIZE;
private static int MAX_SIZE;
private static int PORT_SERVER;
private static long INITIAL_DELAY;
private static long LAST_SIGNAL_DELAY;
private static long DEFAULT_DELAY;
//private Constructor
private AccessConfig(){
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream("./ressources/server.properties");
// load a properties file
prop.load(input);
// get the property value and print it out
DB_DRIVER_CLASS = prop.getProperty("DB_DRIVER_CLASS");
DB_URL = prop.getProperty("DB_URL");
DB_USERNAME = prop.getProperty("DB_USERNAME");
DB_PASSWORD = prop.getProperty("DB_PASSWORD");
INITIAL_SIZE = Integer.parseInt(prop.getProperty("INITIAL_POOL_SIZE"));
MAX_SIZE = Integer.parseInt(prop.getProperty("MAX_POOL_SIZE"));
PORT_SERVER = Integer.parseInt(prop.getProperty("PORT_SERVER"));
INITIAL_DELAY=Long.parseLong(prop.getProperty("INITIAL_DELAY"));
LAST_SIGNAL_DELAY=Long.parseLong(prop.getProperty("LAST_SIGNAL_DELAY"));
DEFAULT_DELAY=Long.parseLong(prop.getProperty("DEFAULT_DELAY"));
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//getters
public static AccessConfig getInstance(){
if(dbAccess == null)
dbAccess = new AccessConfig();
return dbAccess;
}
public static String getDB_DRIVER_CLASS() {
return DB_DRIVER_CLASS;
}
public static String getDB_URL() {
return DB_URL;
}
public static String getDB_USERNAME() {
return DB_USERNAME;
}
public static String getDB_PASSWORD() {
return DB_PASSWORD;
}
public static int getINITIAL_SIZE() {
return INITIAL_SIZE;
}
public static int getMAX_SIZE() {
return MAX_SIZE;
}
@Override
public String toString() {
return "DBAccess [dbType=" + DB_DRIVER_CLASS + ", url=" + DB_URL + ", user=" + DB_USERNAME + ", password=" + DB_PASSWORD + "]";
}
public static int getPORT_SERVER() {
return PORT_SERVER;
}
public static long getINITIAL_DELAY() {
return INITIAL_DELAY;
}
public static long getLAST_SIGNAL_DELAY() {
return LAST_SIGNAL_DELAY;
}
public static long getDEFAULT_DELAY() {
return DEFAULT_DELAY;
}
}
| [
"Manfoumbieric@gmail.com"
] | Manfoumbieric@gmail.com |
ce7be51be6b4ab4a8e12a55ac568d75e954af5af | 731a89b4709aef2c069083aee1f789afc1fc25ad | /app/src/androidTest/java/com/mateusz/grabarski/dagger2tests/ExampleInstrumentedTest.java | 53377578ea746ad0a98a1eb7cfaa77bc611725c0 | [] | no_license | mgrabarski/android-dagger2-tests | 5c1bbf61ce96de6fda71175bbe3ee97f7f5e5917 | 1eb5209dc6113b73b597404ede313374f6b83c00 | refs/heads/master | 2020-03-23T07:50:37.980108 | 2018-07-17T13:19:59 | 2018-07-17T13:19:59 | 141,292,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.mateusz.grabarski.dagger2tests;
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.mateusz.grabarski.dagger2tests", appContext.getPackageName());
}
}
| [
"mateusz.grabarski@gmail.com"
] | mateusz.grabarski@gmail.com |
49d41c5740033a2ee7d89fc597b268d562b22f90 | a3f41aea2dd0681c7e7d95d24434ab6dcfda54eb | /Data Structures (Java & C++)/Project 7/Project 7 Java/main.java | 2d11b5a0c71912beabf1a0f7f6b88a390ca58084 | [] | no_license | thegutuproject/Academic-Projects | f76967860a3537e28b10fe12c18cae27672927ae | 5575273144a529ea5dce7d2c284bc554827257c7 | refs/heads/master | 2021-01-15T08:05:10.411378 | 2018-02-28T17:06:17 | 2018-02-28T17:06:17 | 47,661,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,383 | java | /**
* Created by Alexandru Gutu on 12/1/14.
* Copyright (c) 2014 Alexandru Gutu. All rights reserved.
*/
import java.io.*;
import java.util.*;
public class main
{
public static void main(String[] args)
{
// Step 0: Prepare everything
Scanner userInput = new Scanner(System.in);
System.out.println("What is the location of the hash data file: ");
String fileLocation = userInput.nextLine();
int userChoice;
int bucketSize;
int data;
boolean validOption = true;
// Step 1: Attempt to open file
try
{
Scanner fileReading = new Scanner(new FileReader(fileLocation));
System.out.println();
System.out.println("Hast One: Data % Number of Buckets:");
System.out.println("Hash Two: Sum of digits in Data % Number of Buckets");
System.out.println("Hash Three: Sum of digits in Data modified by 32 % Number of Buckets");
// Step 2: Ask user for bucket size
System.out.println();
System.out.println("Bucket Size: ");
bucketSize = userInput.nextInt();
// Step 3: Ask user which Hash Function to use
System.out.println();
System.out.println("Please pick a Hash Function to use (1 - 3)");
System.out.println();
System.out.println("Hash Function: ");
while (validOption)
{
userChoice = Integer.parseInt(userInput.next());
// Step 4: Depending on which function the user choose, run respective code
switch(userChoice)
{
case 1:
{
// Step 5: Dynamically allocate bucket size
HashOne hashOne = new HashOne(bucketSize);
System.out.println();
// Step 6: Print entire Hash Table
while (fileReading.hasNextInt())
{
data = fileReading.nextInt();
hashOne.insert(data);
hashOne.printList(data);
}
hashOne.printHashTable();
validOption = false;
break;
}
case 2:
{
// Step 5: Dynamically allocate bucket size
HashTwo hashTwo = new HashTwo(bucketSize);
System.out.println();
// Step 6: Print entire Hash Table
while (fileReading.hasNextInt())
{
data = fileReading.nextInt();
hashTwo.insert(data);
hashTwo.printList(data);
}
hashTwo.printHashTable();
validOption = false;
break;
}
case 3:
{
// Step 5: Dynamically allocate bucket size
HashThree hashThree = new HashThree(bucketSize);
System.out.println();
// Step 6: Print entire Hash Table
while (fileReading.hasNextInt())
{
data = fileReading.nextInt();
hashThree.insert(fileReading.nextInt());
hashThree.printList(data);
}
hashThree.printHashTable();
validOption = false;
break;
}
default:
{
System.out.println();
System.out.print("Incorrect input, please pick a Hash Function to use (1 - 3): ");
}
}
}
fileReading.close();
}
catch (FileNotFoundException e)
{
System.out.println("File not found!");
}
}
}
| [
"alex.s.gutu@gmail.com"
] | alex.s.gutu@gmail.com |
b10168875b88c0c6d3a5e4aae5576cf8a53a7fb9 | 7037cf84c17d9bbdd8a3cbcd5bce79956324e6fa | /src/socketgameServer/Operation.java | 76a70ec7b5e066971cc7af862568ddd353a9194a | [] | no_license | Placideh/socket-quiz-game-swing-api | 3d059da7adefbd52157f31fbd9c3f8c113da9de5 | 8527b52719a716e802cf86e0c95072092eee9512 | refs/heads/main | 2023-04-11T23:05:49.537500 | 2021-04-25T00:23:29 | 2021-04-25T00:23:29 | 361,294,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,012 | 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 socketgameServer;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
import model.GuessGame;
/**
*
* @author placideh
*/
public class Operation extends Thread {
Socket s;
OutputStream out;
InputStream in;
DataOutputStream dout;
DataInputStream din;
PrintWriter pout;
BufferedReader bin;
ObjectOutputStream obout;
ObjectInputStream obin ;
int counter=0;
private static int result;
GuessGame gues;
ArrayList<GuessGame> guesList=new ArrayList<>();
Operation(Socket s){
this.s=s;
}
public Operation() {
}
@Override
public void run() {
super.run(); //To change body of generated methods, choose Tools | Templates.
try{
while(true){
in = s.getInputStream();
bin = new BufferedReader(new InputStreamReader(in));
out = s.getOutputStream();
pout = new PrintWriter(out,true);
if(bin.readLine().contains("users")){
String question,answer;
// name=bin.readLine();
// date=bin.readLine();
answer=bin.readLine();
question=bin.readLine();
// long date2=Long.parseLong(date);
int ans=Integer.parseInt(answer);
int que=Integer.parseInt(question);
int res=que-1;
pout.println("users");
int answerReturned=answers(res,ans);
if(counter!=6&&res!=6){
pout.println(answerReturned);
pout.println(questions(que));
pout.flush();
counter++;
}
// gues=new GuessGame(name,result,date2);
// guesList.add(gues);
// pout.println(guesList);
ListThread list=new ListThread();
list.showWinner(guesList);
if(counter>=5&&res>=5){
result=0;
counter=0;
}
} else{
break;
}
}
s.close();
// pout.println(userReply(bin));
// userReplyObject(obin);
}catch(Exception e){
e.printStackTrace();
}
}
public PrintWriter userReply(BufferedReader bin){
try{
while (true) {
in = s.getInputStream();
bin = new BufferedReader(new InputStreamReader(in));
out = s.getOutputStream();
pout = new PrintWriter(out, true);
if (bin.readLine().contains("users")) {
String question, answer;
answer = bin.readLine();
question = bin.readLine();
int ans = Integer.parseInt(answer);
int que = Integer.parseInt(question);
int res = que - 1;
pout.println("users");
int answerReturned = answers(res, ans);
pout.println(answerReturned);
pout.println(questions(que));
pout.flush();
return pout;
} else {
break;
}
}
s.close();
}catch(Exception e){
}
return pout;
}
public ObjectOutputStream userReplyObject(ObjectInputStream obin){
try{
while(true){
obout = new ObjectOutputStream(out);
obin = new ObjectInputStream(in);
GuessGame game=(GuessGame)obin.readObject();
System.out.println(game);
obout.writeObject(game);
return obout;
}
}catch(Exception e){
}
return obout;
}
public String questions(int question){
String q="";
switch(question){
case 1:{
q="12*3+10=?";
break;
}
case 2:{
q="4*4=?";
break;
}
case 3:{
q="1+5*5=?";
break;
}
case 4:{
q="11*5=?";
break;
}
case 5:{
q="15/3=?";
break;
}
default:
{
q="you have reached to the end of question JUST SUBMIT";
break;
}
}
return q;
}
public int answers(int question,int answer){
int q=0;
switch (question) {
case 0:{
result+=0;
break;
}
case 1: {
q = 12*3+10;
if (q == answer) {
result += 10;
}else{
result+=0;
}
break;
}
case 2: {
q = 4*4;
if (q == answer) {
result += 10;
}else {
result += 0;
}
break;
}
case 3: {
q =1+5*5;
if (q == answer) {
result += 10;
}else {
result += 0;
}
break;
}
case 4: {
q = 11*5;
if (q == answer) {
result += 10;
}else {
result += 0;
}
break;
}
case 5: {
q = 15/3;
if (q == answer) {
result += 10;
}else {
result += 0;
}
break;
}
default: {
break;
}
}
return result;
}
// public ArrayList showWinner(ArrayList<GuessGame> list){
// GuessGame temp=new GuessGame();
// GuessGame[] geussArr=(GuessGame[]) list.toArray();
// for(int i=0;i<geussArr.length;i++){
// for(int j=0;j<geussArr.length;j++){
// if(geussArr[j].getMarks()+geussArr[j].getTimeTaken()>geussArr[j+1].getMarks()+geussArr[j+1].getTimeTaken()){
// temp=geussArr[j];
// geussArr[j]=geussArr[j+1];
// geussArr[j+1]=temp;
// }
// }
// }
// ArrayList<GuessGame> glist=new ArrayList<>();
// for(int i=0;i<geussArr.length;i++){
// long markPercent=(geussArr[i].getMarks()*100)/50;
// geussArr[i].setMarks(markPercent);
// glist.add(geussArr[i]);
//
// }
// return glist;
// }
public ArrayList showWinner(GuessGame game){
// GuessGame temp=new GuessGame();
// GuessGame temp2=new GuessGame();
// GuessGame temp3=new GuessGame();
// ArrayList<GuessGame> list=new ArrayList<>();
// list.add(game);
// for(int i=0;i<list.size();i++){
// for(int j=0;j<list.size()-1;j++){
// if(list.get(j).getMarks()+list.get(j).getTimeTaken()>list.get(j+1).getMarks()+list.get(j+1).getTimeTaken()){
// Arrays.sort(list.toArray());
// temp=list.get(j);
// temp2=list.get(j+1);
// temp3=temp;
// temp=temp2;
// temp2=temp3;
//
// }
// }
// }
ArrayList<GuessGame> glist=new ArrayList<>();
// ArrayList<GuessGame> list=new ArrayList<>();
glist.add(game);
for(int i=0;i<glist.size();i++){
long markPercent=(glist.get(i).getMarks()*100)/50;
glist.get(i).setMarks(markPercent);
glist.add(glist.get(i));
}
return glist;
}
}
| [
"h.uwizeyeplacide@gmail.com"
] | h.uwizeyeplacide@gmail.com |
31717e0d1cf2684272b0d7bd4bb7add7ced2da8a | c7464e7d694effe28a1fd4d839814a3f11451eb5 | /src/test/java/stepDefinitions/StepDefinition.java | 7957a1a7ea3ad70dc009504d72397819f1b0801c | [] | no_license | BonuEswararao/RestAssured-Cucumber-Framework | a3fabc16004d0a16864b0198048c11331905caa8 | 7ed384dc3514df4e3dfc5a0b6d87cce1e79454d3 | refs/heads/master | 2023-07-09T07:54:07.358011 | 2021-08-07T11:50:27 | 2021-08-07T11:50:27 | 369,061,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,846 | java | package stepDefinitions;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.ContentType;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import resources.APIResources;
import resources.TestDataBuild;
import resources.Utils;
import static io.restassured.RestAssured.given;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
public class StepDefinition extends Utils{
RequestSpecification req;
ResponseSpecification resspec;
TestDataBuild data = new TestDataBuild();
Response response;
static String place_id;
@Given("Add Place Payload with {string} {string} {string}")
public void add_Place_Payload_with(String name, String language, String address) throws IOException {
req = given().spec(requestSpecification()).body(data.addPlacePayLoad(name, language, address));
}
@When("user calls {string} with {string} http request")
public void user_calls_with_http_request(String resource, String httpMethod) {
APIResources resourceAPI = APIResources.valueOf(resource);
resspec = new ResponseSpecBuilder().expectStatusCode(200).expectContentType(ContentType.JSON).build();
if(httpMethod.equalsIgnoreCase("POST")) {
response = req.when().post(resourceAPI.getResource()).then().spec(resspec).extract().response();
}else if(httpMethod.equalsIgnoreCase("GET")) {
response = req.when().get(resourceAPI.getResource()).then().spec(resspec).extract().response();
}
}
@Then("the API call got success with status code {int}")
public void the_API_call_got_success_with_status_code(Integer statusCode) {
// Write code here that turns the phrase above into concrete actions
assertEquals(response.getStatusCode(),200);
}
@Then("{string} in response body is {string}")
public void in_response_body_is(String keyValue, String expectedValue) {
System.out.println("key value is :"+getJsonPath(response,keyValue));
assertEquals(expectedValue,getJsonPath(response,keyValue));
}
@Then("verify placeId created maps to {string} using {string}")
public void verify_placeId_created_maps_to_using(String name, String resource) throws IOException {
place_id = getJsonPath(response,"place_id");
req = given().spec(requestSpecification()).queryParam("place_id", place_id);
user_calls_with_http_request(resource,"GET");
String actualName = getJsonPath(response,"name");
assertEquals(name,actualName);
}
@Given("deletePlace Payload")
public void deleteplace_Payload() throws IOException {
req = given().spec(requestSpecification()).body(data.deletePlacePayload(place_id));
}
}
| [
"eswararao.bonu@gmail.com"
] | eswararao.bonu@gmail.com |
04a293f14503092a50bf8c195825e795d5c9bbb7 | c0f6cb24e846717fb8c957cd7ef0a0b8e8bb233b | /src/main/java/factory/AudiFactory.java | ba2a0260c3d480079ebbf504613339ef9a64fafc | [] | no_license | wujiezero/patterns | 18aa5a7f7f9f3f0f91144494848c036a6bdc377b | 86c56fe58d103e4418d315a9e4b281217580399e | refs/heads/master | 2023-03-22T16:48:06.462642 | 2017-06-19T16:15:59 | 2017-06-19T16:15:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package factory;
/**
* Created by doobo@foxmail.com on 2017/6/3.
*/
public class AudiFactory implements CarFactory{
@Override
public Car createCar() {
return new Audi();
}
}
| [
"doobo@foxmail.com"
] | doobo@foxmail.com |
1a06985dd4cfbf8616b80a353b9df1c31b825ef2 | cd9081677fa8ddb33f4112ed1d6de5a23143d509 | /Lab 3/LabsCM20172/Lab1-UI/src/main/java/co/edu/udea/compumovil/gr06_20172/lab1/ExtendedSimpleAdapter.java | f0427838938c3e802b2deb0f253bdf9c7a5361ca | [] | no_license | vivianalondo/CompuMovil | 35483cb8741a8e03ca9d6722cb2fab89a46f50a9 | 43a496a95ddd0122ac0120b0cfe4c722b03164f5 | refs/heads/master | 2021-08-19T06:31:20.923846 | 2017-10-12T07:15:17 | 2017-10-12T07:15:17 | 104,794,013 | 0 | 0 | null | 2017-10-23T22:49:58 | 2017-09-25T19:38:52 | Java | UTF-8 | Java | false | false | 3,981 | java | package co.edu.udea.compumovil.gr06_20172.lab1;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.ImageView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import java.util.List;
import java.util.Map;
/**
* Created by joan.morales on 31/08/17.
*/
public class ExtendedSimpleAdapter extends SimpleAdapter {
List<? extends Map<String, ?>> map; // if fails to compile, replace with List<HashMap<String, Object>> map
String[] from;
int layout;
int[] to;
Context context;
LayoutInflater mInflater;
public ExtendedSimpleAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to) {
super(context, data, resource, from, to);
layout = resource;
map = data;
this.from = from;
this.to = to;
this.context = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return this.createViewFromResource(position, convertView, parent, layout);
}
private View createViewFromResource(int position, View convertView,
ViewGroup parent, int resource) {
View v;
if (convertView == null) {
v = mInflater.inflate(resource, parent, false);
} else {
v = convertView;
}
this.bindView(position, v);
return v;
}
private void bindView(int position, View view) {
final Map dataSet = map.get(position);
if (dataSet == null) {
return;
}
final ViewBinder binder = super.getViewBinder();
final int count = to.length;
for (int i = 0; i < count; i++) {
final View v = view.findViewById(to[i]);
if (v != null) {
final Object data = dataSet.get(from[i]);
String text = data == null ? "" : data.toString();
if (text == null) {
text = "";
}
boolean bound = false;
if (binder != null) {
bound = binder.setViewValue(v, data, text);
}
if (!bound) {
if (v instanceof Checkable) {
if (data instanceof Boolean) {
((Checkable) v).setChecked((Boolean) data);
} else if (v instanceof TextView) {
setViewText((TextView) v, text);
} else {
throw new IllegalStateException(v.getClass().getName() +
" should be bound to a Boolean, not a " +
(data == null ? "<unknown type>" : data.getClass()));
}
} else if (v instanceof TextView) {
setViewText((TextView) v, text);
} else if (v instanceof ImageView) {
if (data instanceof Integer) {
setViewImage((ImageView) v, (Integer) data);
} else if (data instanceof Bitmap){
setViewImage((ImageView) v, (Bitmap)data);
} else {
setViewImage((ImageView) v, text);
}
} else {
throw new IllegalStateException(v.getClass().getName() + " is not a " +
" view that can be bounds by this SimpleAdapter");
}
}
}
}
}
private void setViewImage(ImageView v, Bitmap bmp){
v.setImageBitmap(bmp);
}
}
| [
"sandrislc@gmail.com"
] | sandrislc@gmail.com |
fbe9b0145d9739303661b1058010136e4aa4d891 | 1578b9c48d2482b82465ae373144d6db43429d5f | /src/main/java/Wk6/Ex1.java | a5f98660f50fb124fbbbe0b981c5bab817bb67a4 | [] | no_license | nhat117/OOP_NEW | 538ce75058411a4c67832443b87e0c56ae34bda7 | ce075521b9f0bcf86b688491bc28a71d779dce3a | refs/heads/master | 2023-07-16T08:15:16.355247 | 2021-09-07T09:54:19 | 2021-09-07T09:54:19 | 373,016,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,503 | java | package Wk6;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class Ex1 extends Application {
public static void main(String[] args) {
launch(args);
}
public GridPane imageDispl() {
String[] url = {
"https://cdn.britannica.com/79/4479-050-6EF87027/flag-Stars-and-Stripes-May-1-1795.jpg",
"https://live.staticflickr.com/3213/2654355921_d5d8773f33_b.jpg",
"https://i.pinimg.com/originals/3c/e9/45/3ce9451d8b900bcc09b10143a2fc2c6c.png",
"https://lh3.googleusercontent.com/proxy/_-tIk1JnrpRCAfCqyGE0CYFQFrZj4Efawtwe4Mjd0X_XDx_OKbvLxErqlXd9PUZQVVULy4Pv852GCvk3BMsOoeVPIpaXXlw_hxeOWa5auYZVFAK-Zfxgig"
};
ImageView image = new ImageView();
GridPane gridPane = new GridPane();
//LOOPS
for (int i = 0; i < 4; i++) {
image = new ImageView(url[i]);
image.setFitWidth(400);
image.setPreserveRatio(true);
image.setSmooth(true);
//Formula to add to gridpane
gridPane.add(image, ((i % 2 == 0) ? i / 2 : (i - 1) / 2), i % 2 + 1);
}
return gridPane;
}
@Override
public void start(Stage stage) throws Exception {
Scene scene = new Scene(imageDispl());
stage.setScene(scene);
stage.setTitle("Flags");
stage.show();
}
}
| [
"s3878174@rmit.edu.vn"
] | s3878174@rmit.edu.vn |
8d45361eb73dfbccabb2baa19aeccc51b63375a5 | eaf1bc4353fde65f8647728c68193a8b37abd3bb | /backend-app/src/main/java/com/example/oauth/oauth2/jsonFilter/MyServletRequestWrapper.java | 8c11f7759f6200d3e7c35f3d88723e7b06b4e357 | [] | no_license | dossiersolutions/OAuth2 | af2f8cf14f665b5fc7e1363666a89faef40bc98a | 08ee37a6debe3a52271fb2a4eb5e137cda077324 | refs/heads/master | 2023-01-31T15:14:20.132691 | 2020-12-09T10:40:35 | 2020-12-09T10:40:35 | 316,829,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package com.example.oauth.oauth2.jsonFilter;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import org.springframework.security.web.savedrequest.Enumerator;
public class MyServletRequestWrapper extends HttpServletRequestWrapper {
private final HashMap<String, String[]> params;
public MyServletRequestWrapper(HttpServletRequest request, HashMap<String, String[]> params) {
super(request);
this.params = params;
}
@Override
public String getParameter(String name) {
if (this.params.containsKey(name)) {
return this.params.get(name)[0];
}
return "";
}
@Override
public Map<String, String[]> getParameterMap() {
return this.params;
}
@Override
public Enumeration<String> getParameterNames() {
return new Enumerator<>(params.keySet());
}
@Override
public String[] getParameterValues(String name) {
return params.get(name);
}
}
| [
"jovan.milutinovic@boutsourcing.com"
] | jovan.milutinovic@boutsourcing.com |
b5a988b85e7b4eb24e186110fb1ecb9304435f26 | f7868e85f6c451617ba2f35a0537334eee447760 | /app/src/main/java/com/example/BaiduMap/clusterutil/clustering/algo/StaticCluster.java | 2f792c1178d94d42b66a1f636f59c0f84d5838be | [] | no_license | heweichang/task | 3820fbae8aa5cb415e6035dcc15a42852f1be686 | 6ae4e223957d20d4b15aa795464e476075ac2580 | refs/heads/master | 2020-04-15T01:52:10.051721 | 2019-06-11T10:59:40 | 2019-06-11T11:07:06 | 164,294,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,246 | java | /*
* Copyright (C) 2015 Baidu, Inc. All Rights Reserved.
*/
package com.example.BaiduMap.clusterutil.clustering.algo;
import com.baidu.mapapi.model.LatLng;
import com.example.BaiduMap.clusterutil.clustering.Cluster;
import com.example.BaiduMap.clusterutil.clustering.ClusterItem;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* A cluster whose center is determined upon creation.
*/
public class StaticCluster<T extends ClusterItem> implements Cluster<T> {
private final LatLng mCenter;
private final List<T> mItems = new ArrayList<T>();
public StaticCluster(LatLng center) {
mCenter = center;
}
public boolean add(T t) {
return mItems.add(t);
}
@Override
public LatLng getPosition() {
return mCenter;
}
public boolean remove(T t) {
return mItems.remove(t);
}
@Override
public Collection<T> getItems() {
return mItems;
}
@Override
public int getSize() {
return mItems.size();
}
@Override
public String toString() {
return "StaticCluster{"
+ "mCenter=" + mCenter
+ ", mItems.size=" + mItems.size()
+ '}';
}
} | [
"877639001@qq.com"
] | 877639001@qq.com |
fb06ab0c410bf3305e0e008917ae03f18ce327d8 | c07718a1efd309db53e17169996f5c0e8bff75d4 | /Java-exercises/Oracle_Fundamentals/Exercise04/src/PersonTwo.java | ed2a682c10c9db4f42f84d068741f428a2d9d8bd | [] | no_license | wues4/Java | 6422df1a5f2565212a3a7927661cc72e63a7e212 | c81ae036a4d49238f7e1d830b9791e4230681079 | refs/heads/master | 2020-06-30T17:24:40.846821 | 2019-08-28T17:39:52 | 2019-08-28T17:39:52 | 200,896,196 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | public class PersonTwo {
public StringBuilder name = new StringBuilder(8);
public StringBuilder phoneNumber = new StringBuilder();
public void displayPersonInfo(){
name.append("Bogumił");
name.append(" ");
name.append("Wytrych");
System.out.println("Name: " + name.toString());
System.out.println("Name capacity: " + name.capacity());
phoneNumber.append("877895263");
phoneNumber.insert(3,"-");
phoneNumber.insert(7,"-");
System.out.println("Phone number: " + phoneNumber.toString());
System.out.println("First name: " + name.substring(0, 8));
System.out.println("Last name: " + name.substring(8));
}
} | [
"wojciech.sikora@globallogic.com"
] | wojciech.sikora@globallogic.com |
f02ad7df75a475a543c883b3ce096946777b66d5 | fcbbe4b590c04bab008c08daa9137546dc198464 | /src/main/java/flavydudu/sos/controllers/UsuarioSetorController.java | f75d6da91edc4836d1751b977b9a523e6bed2cca | [] | no_license | flaviannyodeiajava/soslp4back | cbad0198c49a5990e3721491d4a91a0a9e590102 | fed0ca0ef0f69dfadf08423c2340d9193af59da0 | refs/heads/master | 2022-12-01T13:06:32.039188 | 2019-07-01T16:48:08 | 2019-07-01T16:48:08 | 194,561,643 | 0 | 0 | null | 2022-11-24T09:36:40 | 2019-06-30T21:10:10 | TSQL | UTF-8 | Java | false | false | 1,855 | java | package flavydudu.sos.controllers;
import java.awt.print.Pageable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import flavydudu.sos.models.UsuarioSetor;
import flavydudu.sos.repository.UsuarioSetorRepository;
@RestController
@RequestMapping("/api")
@CrossOrigin
public class UsuarioSetorController {
@Autowired
private UsuarioSetorRepository usuarioSetorRepository;
@GetMapping("/usuariosetor")
public List<UsuarioSetor> getAllOcorrencia() {
return usuarioSetorRepository.findAll();
}
@GetMapping("/usuariosetor/{setor}")
public ResponseEntity<UsuarioSetor> getUsuarioSetorbySetor(@PathVariable(value = "setor") String setor){
UsuarioSetor usuarioSetor = usuarioSetorRepository.findBySetor(setor);
return ResponseEntity.ok().body(usuarioSetor);
}
@PostMapping("/usuariosetor")
public UsuarioSetor createUsuarioSetor(@Valid @RequestBody UsuarioSetor usuarioSetor) {
return usuarioSetorRepository.save((UsuarioSetor) usuarioSetor);
}
} | [
"samuel-hc@hotmail.com"
] | samuel-hc@hotmail.com |
7360282f6c60041f4ba431493093785b3aa4dc70 | d427352149cd3070b583b64b8d805d30e421b27d | /MaterialTracker/src/main/java/mmt/model/delegate/ShipmentDelegate.java | 0060445e16031d58c46d3439bc3cd508b4c98fdb | [] | no_license | tylercaro/RESTful_Tracker | c8f6983a6de9487d38b0f5a98894b4ea72569d88 | 7763a146f480793dbbf8821e4251cf8d0aca0485 | refs/heads/master | 2021-06-27T16:13:33.989150 | 2016-09-12T21:42:45 | 2016-09-12T21:42:45 | 41,045,583 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 813 | java | package mmt.model.delegate;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import mmt.data.dao.ShipmentCrudRepo;
import mmt.data.dao.WarehouseCrudRepo;
import mmt.data.entity.Shipment;
import mmt.data.entity.Warehouse;
@Component
public class ShipmentDelegate {
@Autowired
private ShipmentCrudRepo shipmentCrud;
@Autowired
private WarehouseCrudRepo whCrud;
public Shipment saveShipment(Shipment shipment,long warehouseid){
Warehouse foundWh=whCrud.findOne(warehouseid);
System.out.println("============>"+foundWh.getWarehouseName());
foundWh.getShipments().add(shipment);
whCrud.save(foundWh);
return shipment;
}
public Iterable<Shipment> getAllShipment(){
return shipmentCrud.findAll();
}
}
| [
"tylercaro@gmail.com"
] | tylercaro@gmail.com |
c800822dbe27229c7ccee6fb9812c81e4cfb38fb | 97b3e17a4ff2bbe14c13668a1cca3e8abd3e0e31 | /GrapheProjet/src/com/domduf/grapheProjet/Pile.java | fe3504d0be600f457438a92e8102bc2e3df72cd1 | [] | no_license | domduf/Java | 1e632acc817955a40732bc987ad0df501a2b2637 | 793c0cc4c744a357cca77c64e0e71973f596273e | refs/heads/master | 2021-05-16T07:42:07.492364 | 2018-05-06T09:48:54 | 2018-05-06T09:48:54 | 103,843,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package com.domduf.grapheProjet;
public class Pile {
private int profondeur=100;
private int[] tabValeur= new int[profondeur];
private int pointeur=0;
Pile(){
//Terminal.ecrireStringln("Instanciation d'une pile de calcul");
for (int i = 0; i < this.profondeur; i++) {
tabValeur[i]=0;
}
}
// affiche le contenu de la pile
public int getPile(){
if (!pileVide()) {
//Terminal.ecrireStringln("sommet de la pile ->"+this.tabValeur[this.pointeur-1]);
return this.tabValeur[this.pointeur-1];
}
else
//Terminal.ecrireStringln("Pile vide");
return 9999;
}
// test pile vide
public boolean pileVide(){
return this.pointeur==0;
}
// Push
public void pushPile(int v){
//Terminal.ecrireStringln("Push--->"+v);
tabValeur[pointeur]=v;
this.pointeur++;
}
// Pop
public int popPile(){
if (!pileVide()) {
this.pointeur-- ;
//Terminal.ecrireStringln(tabValeur[pointeur]+"<---Pop");
return tabValeur[pointeur];
}
else return 0;
}
}
| [
"minique.duf@gmail.com"
] | minique.duf@gmail.com |
731ebb5ff2038035a505573794a18dbba9d4c36e | 83985060b6c895024e389755c028d778d90e9cd9 | /src/nl/jeroennijs/adventofcode2016/Day06.java | 60b40ef245a7e05f6c238b45b67c8b14fbb8a47e | [] | no_license | heejeroen/AdventOfCode2016 | 7b776eb0ea0e6180591ff92a952565e35cd83c8f | 9e2fe6a5a17edeb78c9367d0970bb8488c8535c5 | refs/heads/master | 2021-01-12T09:10:32.870377 | 2016-12-23T14:56:00 | 2016-12-23T14:56:00 | 76,783,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,899 | java | package nl.jeroennijs.adventofcode2016;
import java.io.IOException;
import static nl.jeroennijs.adventofcode2016.Utils.readLines;
public class Day06 {
public static void main(String[] args) throws IOException {
String[] messageParts = readLines("day06.txt");
StringBuilder result1 = new StringBuilder();
StringBuilder result2 = new StringBuilder();
for (int i = 0; i < messageParts[0].length(); i++) {
int[] frequencies = getFrequencies(messageParts, i);
int index1 = getIndexWithHighestFrequency(frequencies);
result1.append((char) (index1 + 'a'));
int index2 = getIndexWithLowestFrequency(frequencies, frequencies[index1]);
result2.append((char) (index2 + 'a'));
}
System.out.println("Message 1 = " + result1);
System.out.println("Message 2 = " + result2);
}
private static int[] getFrequencies(String[] messageParts, int index) {
int[] frequencies = new int[26];
for (String messagePart : messageParts) {
frequencies[messagePart.charAt(index) - 'a']++;
}
return frequencies;
}
private static int getIndexWithHighestFrequency(int[] frequencies) {
int j = 0;
int max = 0;
int index = 0;
for (int frequency : frequencies) {
if (frequency > max) {
max = frequency;
index = j;
}
j++;
}
return index;
}
private static int getIndexWithLowestFrequency(int[] frequencies, int maxFrequency) {
int j = 0;
int min = maxFrequency;
int index = 0;
for (int frequency : frequencies) {
if (frequency > 0 && frequency < min) {
min = frequency;
index = j;
}
j++;
}
return index;
}
}
| [
"jnijs@bol.com"
] | jnijs@bol.com |
5ff9f4d4bdf42e6f6601c49976726c11308873b0 | 70aa2d61438feba7cbe6c7277df85ac545b74fd0 | /app/src/main/java/com/sanchez/fmf/MainActivity.java | 552039bb49b8874cca1938b0ee35edf8d90e71fc | [
"Apache-2.0"
] | permissive | weddingjuma/farmers-market-finder | 8e7d87f1383dcf6dd7d914f033f76d3f015c9b8a | 65d66357637ddf9cd9f0b01ff60abea88f4342b5 | refs/heads/master | 2021-05-02T04:11:00.022579 | 2016-04-09T05:50:13 | 2016-04-09T05:50:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,086 | java | package com.sanchez.fmf;
import android.Manifest;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.os.Build;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatDialogFragment;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import com.sanchez.fmf.event.PermissionResultEvent;
import com.sanchez.fmf.fragment.MainFragment;
import java.util.HashMap;
import java.util.Map;
import butterknife.Bind;
import butterknife.ButterKnife;
import de.greenrobot.event.EventBus;
public class MainActivity extends AppCompatActivity {
@Bind(R.id.toolbar_main_activity)
Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
// color nav and status bar with app color
Window w = getWindow();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
w.setNavigationBarColor(getResources().getColor(R.color.primary_dark));
}
FragmentManager fm = getSupportFragmentManager();
Fragment mainFragment = fm.findFragmentById(R.id.container_main_activity);
if (mainFragment == null) {
mainFragment = MainFragment.newInstance();
fm.beginTransaction()
.add(R.id.container_main_activity, mainFragment)
.commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
return true;
case R.id.action_about:
AppCompatDialogFragment frag = new AboutDialogFragment();
frag.show(getSupportFragmentManager(), "dialog1");
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
case MainFragment.REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS:
Map<String, Integer> perms = new HashMap<>();
// Initial state
perms.put(Manifest.permission.ACCESS_COARSE_LOCATION, PackageManager.PERMISSION_GRANTED);
perms.put(Manifest.permission.ACCESS_FINE_LOCATION, PackageManager.PERMISSION_GRANTED);
for (int i = 0; i < permissions.length; i++) {
perms.put(permissions[i], grantResults[i]);
}
if (perms.get(Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& perms.get(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
EventBus.getDefault().post(new PermissionResultEvent(true));
} else {
EventBus.getDefault().post(new PermissionResultEvent(false));
}
break;
default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
public static class AboutDialogFragment extends AppCompatDialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_about, null);
TextView licenseText = (TextView) dialogView.findViewById(R.id.license);
licenseText.setText(Html.fromHtml(
"<a href=\"https://github.com/dakotasanchez/farmers-market-finder/blob/master/README.md#license\">LICENSE</a>"
));
licenseText.setMovementMethod(LinkMovementMethod.getInstance());
TextView sourceText = (TextView) dialogView.findViewById(R.id.source);
sourceText.setText(Html.fromHtml(
"<a href=\"https://github.com/dakotasanchez/farmers-market-finder\">SOURCE</a>"
));
sourceText.setMovementMethod(LinkMovementMethod.getInstance());
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.about)
.setView(dialogView)
.setPositiveButton(R.string.ok, null)
.create();
}
}
}
| [
"dakota@dakotasanchez.com"
] | dakota@dakotasanchez.com |
9c8c7ce6d66bb196d9bb3caaf854975f8af7092a | 04cc48bf942a6cd9e225de7565b817eade5a5994 | /NachtDerWissenschaft/src/com/example/fragments/FragmentEventDetails.java | 84070e8d86e24e8c9e2d0e4b3a51b89a237dab86 | [] | no_license | DerLetzteLude/NachDerWissenschaft | 9f2f2e0213f2af54f963d6ef032f5e2b9ac3e4bd | 094df72a811a2b239881140c05366e5a938f82b3 | refs/heads/master | 2021-01-01T06:27:52.472062 | 2014-06-29T15:15:11 | 2014-06-29T15:15:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,432 | java | package com.example.fragments;
import com.cengalabs.flatui.views.FlatTextView;
import com.example.dao.Institut;
import com.example.dao.InstitutDao;
import com.example.dao.Veranstaltung;
import com.example.dao.VeranstaltungDao;
import com.example.nachtderwissenschaft.ActivityInterface;
import com.example.nachtderwissenschaft.R;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.gson.Gson;
import com.nirhart.parallaxscroll.views.ParallaxScrollView;
import com.squareup.picasso.Picasso;
import de.greenrobot.event.EventBus;
import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;
import icepick.Icepick;
import Events.EventCheckFavorites;
import Events.EventFullScreenMap;
import Events.EventOnMapTouch;
import Events.EventOpenMap;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import butterknife.ButterKnife;
import butterknife.InjectView;
public class FragmentEventDetails extends Fragment {
@InjectView(R.id.detailtitle) FlatTextView txtVeranstaltungTitle;
@InjectView(R.id.detailtext) FlatTextView txtVeranstaltungText;
@InjectView(R.id.zeit) FlatTextView txtZeit;
@InjectView(R.id.imageHeader) ImageView imgHeader;
@InjectView(R.id.detailscrollview) ParallaxScrollView mScrollView;
@InjectView(R.id.mapcontainer) FrameLayout mMapContainer;
@InjectView(R.id.haltestelle) FlatTextView txtHaltestelle;
@InjectView(R.id.institutname) FlatTextView txtInstitutName;
@InjectView(R.id.buttonfullscreenmap) ImageButton btnFullScreenMap;
public static final String TAG = "FRAGMENTEVENTDETAILS";
VeranstaltungDao mVeranstaltungsDao;
InstitutDao mInstitutDao;
ActivityInterface mInterface;
Veranstaltung mVeranstaltung;
Institut mInstitut;
Veranstaltung mEvent;
MenuItem menuFavorite;
public static FragmentEventDetails newInstance(String jsonEvent) {
FragmentEventDetails f = new FragmentEventDetails();
Bundle args = new Bundle();
args.putString("EVENT", jsonEvent);
f.setArguments(args);
return f;
}
@Override
public void onAttach(Activity activity) {
// TODO Auto-generated method stub
super.onAttach(activity);
try {
mInterface = (ActivityInterface) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement ActivityInterface");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_eventdetails, container, false);
ButterKnife.inject(this, v);
return v;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mVeranstaltungsDao = mInterface.getDaoSession().getVeranstaltungDao();
mInstitutDao = mInterface.getDaoSession().getInstitutDao();
String jsonevent = getArguments().getString("EVENT");
Gson gson = new Gson();
mVeranstaltung = gson.fromJson(jsonevent, Veranstaltung.class);
mInstitut = mInstitutDao.load(mVeranstaltung.getInstitutId());
txtVeranstaltungTitle.setText(mVeranstaltung.getTitel());
txtVeranstaltungText.setText(mVeranstaltung.getInhalt());
txtHaltestelle.setText(mInstitut.getHaltestelleName());
txtInstitutName.setText(mInstitut.getName());
txtZeit.setText(mVeranstaltung.getZeit());
Picasso.with(getActivity()).load(R.drawable.img_halle_night).centerCrop().fit().into(imgHeader);
// Playservice check
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
if (status == ConnectionResult.SUCCESS) {
EventBus bus = EventBus.getDefault();
bus.post(new EventOpenMap(mInstitut, mVeranstaltung));
btnFullScreenMap.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
EventBus bus2 = EventBus.getDefault();
bus2.post(new EventFullScreenMap(mInstitut,mVeranstaltung));
}
});
} else {
ImageView imageView = new ImageView(getActivity());
imageView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
Picasso.with(getActivity()).load(mVeranstaltung.getMapUrl()).into(imageView);
mMapContainer.addView(imageView);
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
setHasOptionsMenu(true);
EventBus.getDefault().register(this);
super.onCreate(savedInstanceState);
Icepick.restoreInstanceState(this, savedInstanceState);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Icepick.saveInstanceState(this, outState);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_favorite:
mVeranstaltung.setFavorit(!mVeranstaltung.getFavorit());
mVeranstaltungsDao.update(mVeranstaltung);
if (mVeranstaltung.getFavorit()) {
Crouton.makeText(getActivity(), "gespeicher in Favoriten", Style.CONFIRM).show();
}
EventBus.getDefault().post(new EventCheckFavorites());
favoriteCheck();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
menuFavorite = menu.findItem(R.id.action_favorite);
menuFavorite.setVisible(true);
favoriteCheck();
super.onPrepareOptionsMenu(menu);
}
@Override
public void onPause() {
Crouton.cancelAllCroutons();
super.onPause();
}
public void favoriteCheck() {
if (mVeranstaltung != null && mVeranstaltung.getFavorit() != null) {
if (mVeranstaltung.getFavorit()) {
menuFavorite.setIcon(android.R.drawable.btn_star_big_on);
} else {
menuFavorite.setIcon(android.R.drawable.btn_star_big_off);
}
}
}
public void onEvent(EventOnMapTouch maptouch) {
mScrollView.requestDisallowInterceptTouchEvent(true);
}
}
| [
"Christianweier@gmail.com"
] | Christianweier@gmail.com |
7bf83206bc845b3038982855cc1fbf99d72f7336 | 44e7afe073a7555c84cb94cf0b4e5efca28789a5 | /src/main/java/cn/tukk/netty/nio/NioServer.java | 350dc8f1e8e1df65983a3d787f4a101298cf8dfe | [] | no_license | lovedworking/netty_practice | bd6b35c9d53267d0d59d7cb26749c145c9041da1 | 3d1dfe68856c4d6f942583e943c8f02481688606 | refs/heads/master | 2020-06-18T05:23:58.847785 | 2019-07-22T08:57:36 | 2019-07-22T08:57:36 | 196,178,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,122 | java | package cn.tukk.netty.nio;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/**
* @program: netty_practice
* @description
* @author: tkk fendoukaoziji
* @create: 2019-07-12 14:25
**/
public class NioServer {
private static Map<String,SocketChannel> clientMap=new HashMap<>();
public static void main(String[] args) throws IOException {
ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();//创建serverSocketChannel
serverSocketChannel.configureBlocking(false); //配置为非阻塞
ServerSocket serverSocket = serverSocketChannel.socket();//获取serverSocket
serverSocket.bind(new InetSocketAddress(8899));//绑定端口
Selector selector = Selector.open();//获取selector
serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);//将serverSocketChannel 注册到 Selector选择器上
while(true){
try{
selector.select();
Set<SelectionKey> selectionKeys = selector.selectedKeys();//获取到 selectkey
selectionKeys.forEach(selectionKey -> {
final SocketChannel client;
try {
if(selectionKey.isAcceptable()){//新建立连接
ServerSocketChannel server = (ServerSocketChannel) selectionKey.channel();//因为前面注册就是serverSocketChannel 向下转型就知道是ServerSocketChannel
client = server.accept();
client.configureBlocking(false);
client.register(selector,SelectionKey.OP_READ);//又注册一个事件到selector上,注册的是socketChannel 关注数据读取事件
String key="【"+ UUID.randomUUID().toString()+"】";
clientMap.put(key,client);//客户端注册
}else if(selectionKey.isReadable()){
client=(SocketChannel) selectionKey.channel();
ByteBuffer readBuffer = ByteBuffer.allocate(1024);
int count = client.read(readBuffer);
if(count>0){
readBuffer.flip();
Charset charset=Charset.forName("utf-8");
String receivedMessage = String.valueOf(charset.decode(readBuffer).array());
System.out.println(client+" :"+receivedMessage);
String sendKey=null;
for (Map.Entry<String,SocketChannel> entry : clientMap.entrySet()) {
if(client==entry.getValue()){
sendKey=entry.getKey();
break;
}
}
for (Map.Entry<String,SocketChannel> entry : clientMap.entrySet()) {
SocketChannel value = entry.getValue();
ByteBuffer writeBuffer = ByteBuffer.allocate(1024);
writeBuffer.put((sendKey+":"+receivedMessage).getBytes());
writeBuffer.flip();
value.write(writeBuffer);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
});
selectionKeys.clear();
}catch (Exception e){
e.printStackTrace();
}
}
}
}
| [
"17600189961@163.com"
] | 17600189961@163.com |
2de6eb1437b70600f759e1fd0eb443fbcb04a3ab | fab4c6d25597857f6d7a91fee50eb4779458e749 | /03-Merge/Merge.java | 1430d62437680063a289d9fded13bedd3fed3b98 | [] | no_license | stanlok237/apcs-spring | eb7c4164ef880305f830357bfaa54cfaeec865dd | ad7630e2cb0350fcec2890887a5b98feddf5a88b | refs/heads/master | 2020-07-02T03:53:58.662326 | 2014-05-12T13:59:07 | 2014-05-12T13:59:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | public class Merge{
public int[] merge(int[]a, int[]b){
int[] ans = new int[a.length + b.length];
int anspos = 0;
int apos = 0;
int bpos = 0;
while(anspos < ans.length){
if(a[apos] < b[bpos]){
ans[anspos] = a[apos];
if(apos + 1 < a.length){
apos++;
anspos++;
}
else{
a[apos] = 999999999;
anspos++;
}
}
else{
ans[anspos] = b[bpos];
if(bpos + 1 < b.length){
bpos++;
anspos++;
}
else{
anspos++;
b[bpos] = 100;
}
}
}
return ans;
}
} | [
"stanlok237@gmail.com"
] | stanlok237@gmail.com |
2077eb39a9dc5c70c1b817357767d148dfaa482a | 58558513bbd69fe99463b4895bc5078dbe09596a | /src/us/jaba/titaniumblocks/core/tickmarks/marks/types/clock/round/DashCirclesTicks.java | 054ad0da1b921ffedd44a011b4b173f934ec31e2 | [] | no_license | tonybeckett/TitaniumBlocks | 16fdd135b46cb2e4b534a7b5ea36c3ee7e2c7139 | 32354597255b007a67fed500a707538509c5bfb5 | refs/heads/master | 2020-05-21T13:43:54.732539 | 2016-12-08T23:21:09 | 2016-12-08T23:21:09 | 48,827,953 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,073 | java | /*
* Copyright (c) 2015, Tony Beckett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* The names of its contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package us.jaba.titaniumblocks.core.tickmarks.marks.types.clock.round;
import java.awt.BasicStroke;
import java.awt.Dimension;
import java.awt.Graphics2D;
import us.jaba.titaniumblocks.core.shape.ShapeUtils;
import us.jaba.titaniumblocks.core.tickmarks.marks.types.AbstractRadialTickmark;
public class DashCirclesTicks extends AbstractRadialTickmark
{
private static final double DEFAULT_TEXT_POSITION = 0.85;
public DashCirclesTicks()
{
//intentional
}
@Override
public void subPaint(Graphics2D graphics, Dimension dimensions)
{
mediumStroke = new BasicStroke(((float) dimensions.width / 500.0f * 2.0F), BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
majorStroke = new BasicStroke(((float) dimensions.width / 500.0f * 5.0F), BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
final float tickRadius = (float) (dimensions.getWidth() * 0.485f * this.ticksPositionScale.getValue());
graphics.setColor(mediumColor);
graphics.setStroke(mediumStroke);
ShapeUtils.drawRadialLines(graphics, centerPoint, tickRadius * 0.9, tickRadius * 0.95, 0.0, 6.0, 60);
graphics.setColor(majorColor);
graphics.setStroke(majorStroke);
for (int i = 0; i < 4; i++)
{
ShapeUtils.placeCirclesOnRadius(graphics, centerPoint, tickRadius * 0.750, tickRadius * 0.075, (90.0 * i) + 30.0, 30.0, false, 2);
}
ShapeUtils.drawRadialLines(graphics, centerPoint, tickRadius * 0.65, tickRadius * 0.85, 0, 90.0, 4);
graphics.dispose();
}
}
| [
"tonybeckett@yahoo.com"
] | tonybeckett@yahoo.com |
d75102da886cae7e068c41dac2cff0d3f3c1925c | 28ab6df47431de9fe21140d605f9e2c7864ceb45 | /app/src/main/java/mocha/yusuf/jetpack3/Utils/EspressoIdlingResource.java | 2f476ea482525da0f03f81362a0d3f4c5570c02f | [] | no_license | mochyusuf/Jetpack | 17b733e53da644f07d8243ab67687d72862ed971 | 63dc02530a1dbe43f5e1b35baf041d0038ccb49c | refs/heads/master | 2021-01-04T07:45:29.083653 | 2019-12-20T09:31:03 | 2019-12-20T09:31:03 | 240,452,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package mocha.yusuf.jetpack3.Utils;
import androidx.test.espresso.IdlingResource;
import androidx.test.espresso.idling.CountingIdlingResource;
public class EspressoIdlingResource {
private static final String RESOURCE = "GLOBAL";
private static CountingIdlingResource countingIdlingResource = new CountingIdlingResource(RESOURCE);
public static void increment() {
countingIdlingResource.increment();
}
public static void decrement() {
countingIdlingResource.decrement();
}
public static IdlingResource getEspressoIdlingResource() {
return countingIdlingResource;
}
}
| [
"mochyusuf100@gmail.com"
] | mochyusuf100@gmail.com |
e2acf02b64bf6698affed78a721a87fb03eb8470 | dedd8b238961dbb6889a864884e011ce152d1d5c | /src/com/seeclickfix/ma/android/fragments/FeedFrag$11.java | 8b7ef1ae097d8cb174077d556dcd9d0085b8c979 | [] | no_license | reverseengineeringer/gov.cityofboston.commonwealthconnect | d553a8a7a4fcd7b846eebadb6c1e3e9294919eb7 | 1a829995d5527f4d5798fa578ca1b0fe499839e1 | refs/heads/master | 2021-01-10T05:08:31.188375 | 2016-03-19T20:37:17 | 2016-03-19T20:37:17 | 54,285,966 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package com.seeclickfix.ma.android.fragments;
import com.seeclickfix.ma.android.fragments.interfaces.CommentCardClickListener;
import com.seeclickfix.ma.android.fragments.interfaces.HomeButtonsInterface;
import com.seeclickfix.ma.android.objects.issue.Comment;
class FeedFrag$11
implements CommentCardClickListener
{
FeedFrag$11(FeedFrag paramFeedFrag) {}
public void onCommentCardClick(Comment paramComment)
{
((HomeButtonsInterface)this$0.getActivity()).onClickButton(4, Integer.valueOf(paramComment.getIssueId()));
}
}
/* Location:
* Qualified Name: com.seeclickfix.ma.android.fragments.FeedFrag.11
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
7b7dd5d7ca620363f057f3115a6bd9c39560e359 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a183/A183207Test.java | b5cc45cbaa1f6c8469d7c6debff2d5d4d9a084af | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a183;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A183207Test extends AbstractSequenceTest {
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
038e2466903ef3cecedda849709f01563880a31f | bea8fec82e7c871b357fa31acc785c2f09fd1edb | /ant/telenor-sff三层打包编译脚本/bin/process/src/com/asiainfo/crm/so/vm/rboss/fixedline/CancelVoipTermination_AIProcess.java | 287ab6d7b51c9a30c792f599f43aafed1824bf84 | [] | no_license | gufeiyue/scripts | d4aab403fd672d2b12cb8d4c5953f94d684379e4 | cd8ae35061773565d2ccec08181b37bc755f7dcc | refs/heads/master | 2021-01-25T06:49:06.430054 | 2017-06-17T08:13:56 | 2017-06-17T08:13:56 | 93,611,870 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,549 | java | package com.asiainfo.crm.so.vm.rboss.fixedline;
import java.util.Map;
import java.util.HashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ai.appframe2.service.ServiceFactory;
import com.ai.comframe.vm.common.VMDataType;
import com.ai.comframe.vm.processflow.ProcessInstance;
import com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV;
import com.ai.omframe.order.service.interfaces.IOrdOffOrdUserCreater;
import com.ai.omframe.order.service.interfaces.IOrdOfferCreater;
import com.ai.omframe.order.data.ivalues.ISoOfferData;
import com.ai.omframe.order.valuebean.OrderValueChain;
import com.ai.omframe.order.ivalues.IOVOrderOffer;
import com.ai.omframe.order.ivalues.IOrdUserValue;
import com.ai.omframe.order.ivalues.IOVOrdOffOrdUser;
import com.ai.omframe.order.ivalues.IOVOrderCustomer;
import com.ai.omframe.order.data.ivalues.ISoOrderData;
import com.ai.omframe.order.data.ivalues.ISoUserData;
import com.ai.omframe.order.ivalues.IOrdUserOsStateValue;
import java.sql.Timestamp;
public class CancelVoipTermination_AIProcess implements ProcessInstance{
private static transient Log logger = LogFactory.getLog(CancelVoipTermination_AIProcess.class);
protected void executeInner(long customerOrderId,IOVOrderCustomer aOVOrderCustomer,ISoOrderData aSoOrderData,String REGION_ID,String aBillId) throws Exception{
String _TASK_JUGE_RESULT = "";
ISoOfferData aSoOfferData = null;
OrderValueChain aOrderValueChain = new OrderValueChain();
IOVOrderOffer aOVOrderOffer = null;
IOrdUserValue aOrdUserValue = null;
IOVOrdOffOrdUser aOVOrdOffOrdUser = null;
ISoUserData aSoUserData = null;
IOrdUserOsStateValue aOrdUserOsStateValue = null;
Timestamp aCurDateTime = null;
long aOfferInstId = 0;
long aUserId = 0;
ISoOfferData[] aSoOfferDatas = null;
aSoOfferData=com.asiainfo.crm.so.util.RbossServiceFactory.getPrjOrderVmHelper().createSoOfferDataByOfferInstIdIngoreValidType(aSoOrderData.getMainInsOfferId(),REGION_ID); aSoOfferData.setBusinessId(aSoOrderData.getMainBusinessId()); aSoOfferData.setParentBceData(aSoOrderData); aSoOfferData.setMainBillId(aBillId); aSoUserData = aSoOfferData.getSoRoleData()[0].getSoUserData()[0]; java.util.Map map=new java.util.HashMap(); map.put("OFFER_ID",String.valueOf(aSoOrderData.getMainInsOfferId())); map.put("BUSINESS_ID",String.valueOf(aSoOrderData.getMainBusinessId())); aOrderValueChain=com.ai.omframe.util.OrderProcUtil.processNewPrdOVChain(aOrderValueChain,map); aCurDateTime=com.ai.appframe2.common.ServiceManager.getIdGenerator().getSysDate();aUserId=aSoOrderData.getMainUserId();aOfferInstId=aSoOrderData.getMainInsOfferId();;
aSoUserData = ((com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV)com.ai.comframe.vm.common.ServiceUtil.getService("com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV",com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV.class)).modifySoUserData4BusiPrice(customerOrderId,aSoUserData,REGION_ID);
aOVOrderOffer = ((com.ai.omframe.order.service.interfaces.IOrdOfferCreater)com.ai.comframe.vm.common.ServiceUtil.getService("com.ai.omframe.order.service.OrdOfferCreater",com.ai.omframe.order.service.interfaces.IOrdOfferCreater.class)).createOVOrderOfferFromInst(aOVOrderCustomer,aSoOfferData,aOrderValueChain,REGION_ID);
aOrdUserValue = ((com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV)com.ai.comframe.vm.common.ServiceUtil.getService("com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV",com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV.class)).createOrdUserValueFromInst(aOVOrderOffer,aSoUserData,aOrderValueChain,REGION_ID);
aOVOrdOffOrdUser = ((com.ai.omframe.order.service.interfaces.IOrdOffOrdUserCreater)com.ai.comframe.vm.common.ServiceUtil.getService("com.ai.omframe.order.service.OrdOffOrdUserCreater",com.ai.omframe.order.service.interfaces.IOrdOffOrdUserCreater.class)).createOVOrderOfferUserFromInst(aOVOrderOffer,aOrdUserValue,aSoUserData,aOrderValueChain,REGION_ID);
((com.ai.omframe.order.service.interfaces.IOrdOffOrdUserCreater)com.ai.comframe.vm.common.ServiceUtil.getService("com.ai.omframe.order.service.OrdOffOrdUserCreater",com.ai.omframe.order.service.interfaces.IOrdOffOrdUserCreater.class)).createOrdUserExtValue(aOVOrdOffOrdUser,aSoUserData,REGION_ID,true);
com.ai.omframe.instance.ivalues.IInsAccrelValue[] insAccRelValues=com.ai.omframe.util.InsServiceFactory.getInstanceAccrelService().getInstAccrelByUserId(aSoUserData.getUserId(),com.ai.omframe.order.valuebean.OrderConst.ACCT_BASE_PAY_TYPE); if(insAccRelValues!=null&&insAccRelValues.length>0){ com.ai.appframe2.common.DataContainerInterface[] acctDCs = new com.ai.appframe2.bo.DataContainer[1]; com.ai.appframe2.common.DataContainerInterface acctDc = new com.ai.appframe2.bo.DataContainer(); acctDc.set("ACCT_ID",String.valueOf(insAccRelValues[0].getAcctId())); acctDCs[0] = acctDc; aSoUserData.setAcctInfoDC(acctDCs); };
((com.ai.omframe.order.service.interfaces.IOrdOffOrdUserCreater)com.ai.comframe.vm.common.ServiceUtil.getService("com.ai.omframe.order.service.OrdOffOrdUserCreater",com.ai.omframe.order.service.interfaces.IOrdOffOrdUserCreater.class)).createOrdAccrelValueFromIns(aOVOrderOffer,aSoUserData,aOrdUserValue,aOrderValueChain,REGION_ID);
{//Call the sub-processes新建营业费用
Map tmpMap21 = new HashMap();
Object loopVar21 = null;
int loopCount21 = 0;
loopVar21 = new Object[]{null};
loopCount21 = 1;
for(int i=0;i < loopCount21;i++){
tmpMap21.clear();
tmpMap21.put("aSoUserData",aSoUserData);
tmpMap21.put("aOVOrdOffOrdUser",aOVOrdOffOrdUser);
tmpMap21.put("aOrderValueChain",aOrderValueChain);
tmpMap21.put("REGION_ID",REGION_ID);
com.ai.comframe.vm.processflow.ProcessEngineFactory.getProcessEngine().executeProcess("com.ai.omframe.order.vm.lib0.OrdOfferUserPrice",tmpMap21);
tmpMap21.clear();
} }
((com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV)com.ai.comframe.vm.common.ServiceUtil.getService("com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV",com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV.class)).updateInsxUserRelatState(aUserId);
aSoOfferDatas = ((com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV)com.ai.comframe.vm.common.ServiceUtil.getService("com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV",com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV.class)).createDelSoOfferData4Voip(aSoOfferData,REGION_ID);
{//Call the sub-processesBatchDropOffer
Map tmpMap25 = new HashMap();
Object loopVar25 = null;
int loopCount25 = 0;
loopVar25 = new Object[]{null};
loopCount25 = 1;
for(int i=0;i < loopCount25;i++){
tmpMap25.clear();
tmpMap25.put("aSoOfferDatas",aSoOfferDatas);
tmpMap25.put("REGION_ID",REGION_ID);
tmpMap25.put("aOVOrderCustomer",aOVOrderCustomer);
tmpMap25.put("aSoUserData",aSoUserData);
tmpMap25.put("aOrderValueChain",aOrderValueChain);
com.ai.comframe.vm.processflow.ProcessEngineFactory.getProcessEngine().executeProcess("com.asiainfo.crm.so.vm.rboss.fixedline.BatchDropOffer",tmpMap25);
aOVOrderCustomer = (tmpMap25.get("aOVOrderCustomer") == null)?null:(IOVOrderCustomer)VMDataType.transfer(tmpMap25.get("aOVOrderCustomer"),IOVOrderCustomer.class);
tmpMap25.clear();
} }
((com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV)com.ai.comframe.vm.common.ServiceUtil.getService("com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV",com.asiainfo.crm.so.order.rboss.service.interfaces.IFixedLineVmSV.class)).saveOVOrdOffer(aOVOrderCustomer,REGION_ID);
}
public void execute(long customerOrderId,IOVOrderCustomer aOVOrderCustomer,ISoOrderData aSoOrderData,String REGION_ID,String aBillId) throws Exception{
Map $inParameter = new HashMap();
Map $returnParameter = new HashMap();
$inParameter.put("customerOrderId",new Long(customerOrderId));
$inParameter.put("aOVOrderCustomer",aOVOrderCustomer);
$inParameter.put("aSoOrderData",aSoOrderData);
$inParameter.put("REGION_ID",REGION_ID);
$inParameter.put("aBillId",aBillId);
try{
executeInner( customerOrderId, aOVOrderCustomer, aSoOrderData, REGION_ID, aBillId);
}catch(Exception ex ){
throw ex;
}catch(Throwable e ){
if(e instanceof RuntimeException){
throw (RuntimeException)e ;
} else {
throw new RuntimeException(e);
}
}
}
public Map execute(Map $vmParameters) throws Exception{
long customerOrderId = ($vmParameters.get("customerOrderId") == null)?0:((Long)VMDataType.transfer($vmParameters.get("customerOrderId"),long.class)).longValue();
IOVOrderCustomer aOVOrderCustomer = ($vmParameters.get("aOVOrderCustomer") == null)?null:(IOVOrderCustomer)VMDataType.transfer($vmParameters.get("aOVOrderCustomer"),IOVOrderCustomer.class);
ISoOrderData aSoOrderData = ($vmParameters.get("aSoOrderData") == null)?null:(ISoOrderData)VMDataType.transfer($vmParameters.get("aSoOrderData"),ISoOrderData.class);
String REGION_ID = ($vmParameters.get("REGION_ID") == null)?"":(String)VMDataType.transfer($vmParameters.get("REGION_ID"),String.class);
String aBillId = ($vmParameters.get("aBillId") == null)?"":(String)VMDataType.transfer($vmParameters.get("aBillId"),String.class);
execute(customerOrderId,aOVOrderCustomer,aSoOrderData,REGION_ID,aBillId);
return $vmParameters;
}
} | [
"gufeiyue238@126.com"
] | gufeiyue238@126.com |
4b9c554eab962cfffd73d9622df60863c6f3037e | bc51d4c5a4c334d1149ff1d4197bcab9202dda30 | /app/src/androidTest/java/com/dicoding/annasblackhat/customadapterlistview/ApplicationTest.java | dd31b03af91e769498fe30446cdfbe6c71c30b2e | [] | no_license | ANNASBlackHat/CustomAdapterListView | 67d213f285f74b57f722c5923b4bbc11a4d12248 | 1685ccd9f5658bf197adb66a7070b5f9a6a63322 | refs/heads/master | 2021-01-13T00:42:04.944727 | 2015-09-28T08:16:18 | 2015-09-28T08:16:18 | 43,288,453 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.dicoding.annasblackhat.customadapterlistview;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"annasblackhat@INTEC.(none)"
] | annasblackhat@INTEC.(none) |
08b08ca9bec99873a44f5accfb25fbbc284731e0 | 2dfb6d4c2b9255754f2e8801cb1483fd23e3915f | /src/org/iesapp/clients/sgd7/clases/ClasesCollection.java | 4b8a5613a0a3bb595d56833dd424493fc1736675 | [] | no_license | jmulet/sgd-client | 4a36c1bd2b5e9d98b6640d9c1153e0ab26c6b0e2 | 1a055a396f04ab6d78f36cc22497eb27f9fffdb4 | refs/heads/master | 2020-05-18T21:55:51.913760 | 2013-07-31T15:22:25 | 2013-07-31T15:22:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,508 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.iesapp.clients.sgd7.clases;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.iesapp.clients.sgd7.IClient;
import org.iesapp.clients.sgd7.IClientController;
import org.iesapp.clients.sgd7.base.SgdBase;
import org.iesapp.clients.sgd7.logger.Log;
import org.iesapp.clients.sgd7.profesores.BeanFaltasProfesores;
import org.iesapp.database.MyDatabase;
import org.iesapp.util.DataCtrl;
/**
*
* @author Josep
*/
public class ClasesCollection implements IClientController {
private final IClient client;
public ClasesCollection()
{
this.client = null;
}
public ClasesCollection(IClient client)
{
this.client = client;
}
/**
*
* @param idProfesor
* @return
*/
public ArrayList<BeanClase> getClasesProfe(String idProfesor)
{
return new Clases(idProfesor,-1, client).getHorario();
}
public int findIdConceptoEvaluable(String grupo) {
int id = 0;
String nivel="";
String estudis="";
if(grupo.contains("1")) {
nivel="1r";
}
else if(grupo.contains("2")) {
nivel="2n";
}
else if(grupo.contains("3")) {
nivel="3r";
}
else if(grupo.contains("4")) {
nivel="4t";
}
if(grupo.toUpperCase().contains("ESO")) {
estudis="ESO";
}
else if(grupo.toUpperCase().contains("BAT")) {
estudis="BAT";
}
String SQL1 = "Select id from tiponota where descripcion like '%"+nivel+"%"+estudis+"%'";
try {
Statement st = getSgd().createStatement();
ResultSet rs1 = getSgd().getResultSet(SQL1,st);
if(rs1!=null && rs1.next())
{
id = rs1.getInt("id");
}
if(rs1!=null) {
rs1.close();
st.close();
}
} catch (SQLException ex) {
Logger.getLogger(ClasesCollection.class.getName()).log(Level.SEVERE, null, ex);
}
return id;
}
//Obté una llista de clases de guardia
//Omple el bean clase guardia i a mes crea un beanFaltaProfe
public ArrayList<BeanClaseGuardia> getSubstitucionesByProfeGuardia(final MyDatabase sgd,
final int idDias, final java.util.Date fecha, final String idProfesores2)
{
ArrayList<BeanClaseGuardia> list = new ArrayList<BeanClaseGuardia>();
String SQL1 = "SELECT DISTINCT "
+ " horascentro.inicio, "
+ " horascentro.fin, "
+ " clases.nombre AS grupo, "
+ " aulas.descripcionLarga AS aula, "
+ " clases.id AS idClase, "
+ " horarios.idHorasCentro, "
+ " horarios.idProfesores, "
+ " profesores.nombre, "
+ " fp.idProfesores2, "
+ " fp.idTipoIncidencias, "
+ " fp.observaciones, "
+ " fp.fecha, "
+ " fp.hora, "
+ " ti.descripcion, "
+ " ti.simbolo "
+ " FROM "
+ " horarios "
+ " INNER JOIN "
+ " profesores "
+ " ON profesores.id = horarios.idProfesores "
+ " LEFT JOIN "
+ " aulas "
+ " ON (horarios.idAulas = aulas.id) "
+ " LEFT JOIN "
+ " horascentro "
+ " ON ( "
+ " horarios.idHorascentro = horascentro.id "
+ " ) "
+ " INNER JOIN "
+ " clases "
+ " ON (horarios.idClases = clases.id) "
+ " LEFT JOIN "
+ " clasesdetalle AS cd "
+ " ON cd.idClases = clases.id "
+ " LEFT JOIN "
+ " grupasig AS ga "
+ " ON ga.id = cd.idGrupasig "
+ " LEFT JOIN "
+ " asignaturas AS asig "
+ " ON asig.id = ga.idAsignaturas "
+ " INNER JOIN "
+ " faltasprofesores AS fp "
+ " ON (fp.idProfesores=horarios.idProfesores "
+ " AND fp.idHorasCentro=horarios.idHorascentro AND cd.idGrupasig=fp.idGrupAsig) "
+ " LEFT JOIN "
+ " tipoincidencias as ti"
+ " ON ti.id=fp.idTipoIncidencias "
+ " WHERE (horarios.idDias="+idDias+" AND fp.fecha='"+new DataCtrl(fecha).getDataSQL()+"' "
+ " AND idProfesores2="+idProfesores2+" )"
+ " ORDER BY inicio, profesores.nombre ";
try {
Statement st = sgd.createStatement();
ResultSet rs1 = sgd.getResultSet(SQL1,st);
while(rs1!=null && rs1.next())
{
//Construeix el bean base
BeanClaseGuardia bh = new BeanClaseGuardia();
bh.setAula(rs1.getString("aula"));
bh.setInicio(rs1.getTime("inicio"));
bh.setFin(rs1.getTime("fin"));
bh.setGrupo(rs1.getString("grupo"));
int idClase = rs1.getInt("idClase");
bh.setIdClase(idClase);
bh.setIdHorasCentro(rs1.getInt("idHorasCentro"));
//bh.setMateria(""); //no aplica
bh.setIdProfesor(rs1.getString("idProfesores"));
bh.setNombreProfesor(rs1.getString("nombre"));
//Aqui carrega la informacio del BeanFaltasProfesores
BeanFaltasProfesores beanfp = new BeanFaltasProfesores();
beanfp.setIdTipoIncidencias(rs1.getInt("idTipoIncidencias"));
beanfp.setObservaciones(rs1.getString("observaciones"));
beanfp.setDescripcion(rs1.getString("descripcion"));
beanfp.setSimbolo(rs1.getString("simbolo"));
beanfp.setIdProfesores2(rs1.getString("idProfesores2"));
beanfp.setIdProfesores(rs1.getString("idProfesores"));
beanfp.setFecha(rs1.getDate("fecha"));
beanfp.setHora(rs1.getTime("hora"));
beanfp.setIdHorasCentro(rs1.getInt("idHorasCentro"));
bh.setBeanFProf(beanfp);
list.add(bh);
}
if(rs1!=null){
rs1.close();
st.close();
}
} catch (SQLException ex) {
Logger.getLogger(ClasesCollection.class.getName()).log(Level.SEVERE, null, ex);
}
return list;
}
@Override
public MyDatabase getMysql() {
if(client==null)
{
return SgdBase.getMysql();
}
else
{
return client.getMysql();
}
}
@Override
public MyDatabase getSgd() {
if(client==null)
{
return SgdBase.getSgd();
}
else
{
return client.getSgd();
}
}
@Override
public Log getLogger() {
if(client==null)
{
return new Log();
}
else
{
return client.getLogger();
}
}
}
| [
"Josep@hpjosep"
] | Josep@hpjosep |
8a870d9b15d077823661a7e6ce5cd1eacfac5be7 | 0202c4db6dd78f8877a104e479f897d170a98463 | /src/main/java/nyc/NYCLoaderJava.java | 5018ddaa27051a8f350ac5eec8cc0fdd92b9a9ad | [
"Apache-2.0"
] | permissive | assaad/NYCtaxiJava | 93c9b8a300c8efc732ef4382094d63159ce7059a | c86c953c455218eb7e94d2b15b17943ac03ca152 | refs/heads/master | 2021-01-19T23:40:23.734589 | 2017-04-25T14:07:37 | 2017-04-25T14:07:37 | 89,004,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package nyc;
import com.sun.org.apache.regexp.internal.RE;
import java.io.*;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
/**
* Created by assaad on 21/04/2017.
*/
public class NYCLoaderJava {
private static String path = "/Volumes/SSD/data/";
// private static String path = "/Volumes/SSD/testdata/";
public static void main(String[] args) {
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
long totallines = 0;
long lineinfile = 0;
String line;
Logger.start();
try {
for (File listOfFile : listOfFiles) {
if (!listOfFile.getName().contains("yellow_tripdata")) {
continue;
}
BufferedReader br = new BufferedReader(new FileReader(listOfFile));
lineinfile = 0;
String[] headers = null;
String[] fields = null;
while ((line = br.readLine()) != null) {
lineinfile++;
totallines++;
if (lineinfile == 1) {
headers = line.split(",");
for (int j = 0; j < headers.length; j++) {
headers[j] = headers[j].toLowerCase().trim();
}
} else {
fields = line.split(",");
for (int j = 0; j < fields.length; j++) {
fields[j] = fields[j].trim();
}
TripRecord r = new TripRecord(headers, fields, listOfFile.getName(), lineinfile);
}
if (totallines % 1000000 == 0) {
Logger.printSpeed(totallines, listOfFile.getName(), true);
}
}
Logger.printSpeed(totallines, listOfFile.getName(), false);
}
Logger.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
| [
"assaad.moawad@uni.lu"
] | assaad.moawad@uni.lu |
fd569ed7148d9765922074c59c5548c0dad51612 | 48e011ae5583b1a2a0d48be6631b642a40b53a4d | /app/src/main/java/com/hanzheng/facedetectapplication/camrea/NV21ToBitmap.java | 6a0d5c63f205abb81f885a9b8cf0e1585674b7fb | [] | no_license | xunroudabing/FaceDetectApplication | 38f07dd05885e24aeb63751ad7d8f11eb9744180 | 252ba9cf6c4686708fadfc8c7cc72d40a9226297 | refs/heads/master | 2020-04-12T14:44:32.566635 | 2018-12-21T01:36:54 | 2018-12-21T01:36:54 | 162,560,108 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,258 | java | package com.hanzheng.facedetectapplication.camrea;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.ImageFormat;
import android.graphics.Rect;
import android.graphics.YuvImage;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicYuvToRGB;
import android.renderscript.Type;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/**
* Created by HanZheng(305058709@qq.com) on 2018-12-13.
*/
public class NV21ToBitmap {
private RenderScript rs;
private ScriptIntrinsicYuvToRGB yuvToRgbIntrinsic;
private Type.Builder yuvType, rgbaType;
private Allocation in, out;
public NV21ToBitmap(Context context) {
rs = RenderScript.create(context);
yuvToRgbIntrinsic = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs));
}
public Bitmap nv21ToBitmap(byte[] nv21, int width, int height){
if (yuvType == null){
yuvType = new Type.Builder(rs, Element.U8(rs)).setX(nv21.length);
in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);
rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs)).setX(width).setY(height);
out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);
}
in.copyFrom(nv21);
yuvToRgbIntrinsic.setInput(in);
yuvToRgbIntrinsic.forEach(out);
Bitmap bmpout = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
out.copyTo(bmpout);
return bmpout;
}
private static Bitmap nv21ToBitmap2(byte[] nv21, int width, int height) {
Bitmap bitmap = null;
try {
YuvImage image = new YuvImage(nv21, ImageFormat.NV21, width, height, null);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image.compressToJpeg(new Rect(0, 0, width, height), 80, stream);
bitmap = BitmapFactory.decodeByteArray(stream.toByteArray(), 0, stream.size());
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}
}
| [
"hzroom110@163.com"
] | hzroom110@163.com |
ab2a6ad93d64e697c385946ff901536e1261cc10 | 9579cd96f460f65c1e384c4aca09007c019ed1a5 | /modules/ng-expense-user-views/src/main/java/com/liferay/me/expense/manager/web/asset/model/ExpenseAssetRenderer.java | 0d26e8b9f3298ae41b8283082bced856d7a72a55 | [] | no_license | mahmoudhtayem87/expense-manager | e81e6a319113877fc07f24ead1221d915d7ed748 | 8f8630202ac70b20c818a338617c44f2c11c8794 | refs/heads/master | 2022-07-30T00:43:02.920618 | 2021-09-26T07:39:17 | 2021-09-26T07:39:17 | 410,471,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,192 | java | package com.liferay.me.expense.manager.web.asset.model;
import com.liferay.asset.display.page.portlet.AssetDisplayPageFriendlyURLProvider;
import com.liferay.asset.kernel.model.BaseJSPAssetRenderer;
import com.liferay.asset.util.AssetHelper;
import com.liferay.me.expense.manager.web.users.view.permission.resource.definition.ExpensePermission;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.model.Group;
import com.liferay.portal.kernel.model.LayoutConstants;
import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil;
import com.liferay.portal.kernel.security.permission.ActionKeys;
import com.liferay.portal.kernel.security.permission.PermissionChecker;
import com.liferay.portal.kernel.service.GroupLocalServiceUtil;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.me.expense.manager.model.Expense;
import com.liferay.me.expense.manager.constants.NgExpenseUserViewsPortletKeys;
import java.util.Locale;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.PortletURL;
import javax.portlet.WindowState;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ExpenseAssetRenderer extends BaseJSPAssetRenderer<Expense> {
public ExpenseAssetRenderer(
Expense assignment) {
_expense = assignment;
}
@Override
public Expense getAssetObject() {
return _expense;
}
@Override
public String getClassName() {
return Expense.class.getName();
}
@Override
public long getClassPK() {
return _expense.getExpenseId();
}
@Override
public long getGroupId() {
return _expense.getGroupId();
}
@Override
public String getJspPath(HttpServletRequest request, String template) {
if (template.equals(TEMPLATE_ABSTRACT) ||
template.equals(TEMPLATE_FULL_CONTENT)) {
return "/META-INF/resources/asset/" + template + ".jsp";
}
return null;
}
@Override
public int getStatus() {
return _expense.getStatus();
}
@Override
public String getSummary(
PortletRequest portletRequest, PortletResponse portletResponse) {
ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
WebKeys.THEME_DISPLAY);
int abstractLength = AssetHelper.ASSET_ENTRY_ABSTRACT_LENGTH;
String summary = HtmlUtil.stripHtml(
StringUtil.shorten(
_expense.getDescription(),
abstractLength));
return summary;
}
@Override
public String getTitle(Locale locale) {
return _expense.getTitle();
}
@Override
public PortletURL getURLEdit(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse)
throws Exception {
Group group = GroupLocalServiceUtil.fetchGroup(_expense.getGroupId());
if (group.isCompany()) {
ThemeDisplay themeDisplay =
(ThemeDisplay)liferayPortletRequest.getAttribute(
WebKeys.THEME_DISPLAY);
group = themeDisplay.getScopeGroup();
}
PortletURL portletURL = PortalUtil.getControlPanelPortletURL(
liferayPortletRequest, group, NgExpenseUserViewsPortletKeys.NgExpenseUserViews, 0, 0,
PortletRequest.RENDER_PHASE);
portletURL.setParameter(
"mvcRenderCommandName"," MVCCommandNames.EDIT_ASSIGNMENT");
portletURL.setParameter(
"expenseId", String.valueOf(_expense.getExpenseId()));
portletURL.setParameter("showback", Boolean.FALSE.toString());
return portletURL;
}
@Override
public String getURLView(
LiferayPortletResponse liferayPortletResponse,
WindowState windowState)
throws Exception {
return super.getURLView(liferayPortletResponse, windowState);
}
@Override
public String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect)
throws Exception {
if (_assetDisplayPageFriendlyURLProvider != null) {
ThemeDisplay themeDisplay =
(ThemeDisplay)liferayPortletRequest.getAttribute(
WebKeys.THEME_DISPLAY);
String friendlyURL =
_assetDisplayPageFriendlyURLProvider.getFriendlyURL(
getClassName(), getClassPK(), themeDisplay);
if (Validator.isNotNull(friendlyURL)) {
return friendlyURL;
}
}
try {
long plid = PortalUtil.getPlidFromPortletId(
_expense.getGroupId(), NgExpenseUserViewsPortletKeys.NgExpenseUserViews
);
PortletURL portletURL;
if (plid == LayoutConstants.DEFAULT_PLID) {
portletURL = liferayPortletResponse.createLiferayPortletURL(
getControlPanelPlid(liferayPortletRequest),
NgExpenseUserViewsPortletKeys.NgExpenseUserViews,
PortletRequest.RENDER_PHASE);
}
else {
portletURL =
PortletURLFactoryUtil.getPortletURLFactory(
).create(
liferayPortletRequest, NgExpenseUserViewsPortletKeys.NgExpenseUserViews,
plid, PortletRequest.RENDER_PHASE
);
}
portletURL.setParameter(
"mvcRenderCommandName", "MVCCommandNames.VIEW_ASSIGNMENT");
portletURL.setParameter(
"expenseId", String.valueOf(_expense.getExpenseId()));
String currentUrl = PortalUtil.getCurrentURL(
liferayPortletRequest
);
portletURL.setParameter("redirect", currentUrl);
return portletURL.toString();
}
catch (PortalException pe) {
}
catch (SystemException se) {
}
return null;
}
@Override
public long getUserId() {
return _expense.getUserId();
}
@Override
public String getUserName() {
return _expense.getUserName();
}
@Override
public String getUuid() {
return _expense.getUserUuid();
}
@Override
public boolean hasEditPermission(PermissionChecker permissionChecker)
throws PortalException {
return ExpensePermission.contains(
permissionChecker, _expense, ActionKeys.UPDATE);
}
@Override
public boolean hasViewPermission(PermissionChecker permissionChecker)
throws PortalException {
return ExpensePermission.contains(
permissionChecker, _expense, ActionKeys.VIEW);
}
@Override
public boolean include(
HttpServletRequest request, HttpServletResponse response,
String template)
throws Exception {
request.setAttribute("assignment", _expense);
return super.include(request, response, template);
}
public void setAssetDisplayPageFriendlyURLProvider(
AssetDisplayPageFriendlyURLProvider
assetDisplayPageFriendlyURLProvider) {
_assetDisplayPageFriendlyURLProvider =
assetDisplayPageFriendlyURLProvider;
}
private AssetDisplayPageFriendlyURLProvider
_assetDisplayPageFriendlyURLProvider;
private Expense _expense;
}
| [
"tayemmahmoud87@gmail.com"
] | tayemmahmoud87@gmail.com |
aa6c54b9d36abbc9b6f124f72f77f23f1450db26 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mobileqqi/classes.jar/com/tencent/mobileqq/servlet/QQLevelACCServlet.java | a7dd47ea4ff61b9082fcb8daa4919329b29d6d1e | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 4,076 | java | package com.tencent.mobileqq.servlet;
import android.content.Intent;
import android.os.Bundle;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.observer.QQLevelACCObserver;
import com.tencent.mobileqq.pb.ByteStringMicro;
import com.tencent.mobileqq.pb.PBBytesField;
import com.tencent.mobileqq.pb.PBUInt32Field;
import com.tencent.qphone.base.remote.FromServiceMsg;
import com.tencent.qphone.base.util.QLog;
import java.nio.ByteBuffer;
import mqq.app.MSFServlet;
import mqq.app.NewIntent;
import mqq.app.Packet;
import tencent.im.oidb.oidb_sso.OIDBSSOPkg;
public class QQLevelACCServlet
extends MSFServlet
{
private static String a = "QQLevelACCServlet";
private static final String b = "OidbSvc.0x826_0";
private static final String c = "k_uin";
public static void a(QQAppInterface paramQQAppInterface)
{
NewIntent localNewIntent = new NewIntent(paramQQAppInterface.a(), QQLevelACCServlet.class);
localNewIntent.putExtra("k_uin", paramQQAppInterface.a());
paramQQAppInterface.startServlet(localNewIntent);
if (QLog.isColorLevel()) {
QLog.d(a, 2, "getLevelACCInfo:--startServlet--");
}
}
byte[] a(long paramLong)
{
Object localObject = new oidb_sso.OIDBSSOPkg();
((oidb_sso.OIDBSSOPkg)localObject).uint32_command.set(2086);
((oidb_sso.OIDBSSOPkg)localObject).uint32_service_type.set(0);
ByteBuffer localByteBuffer = ByteBuffer.allocate(8);
localByteBuffer.putInt((int)paramLong);
((oidb_sso.OIDBSSOPkg)localObject).bytes_bodybuffer.set(ByteStringMicro.copyFrom(localByteBuffer.array()));
localObject = ((oidb_sso.OIDBSSOPkg)localObject).toByteArray();
localByteBuffer = ByteBuffer.allocate(localObject.length + 4);
localByteBuffer.putInt(localObject.length + 4);
localByteBuffer.put((byte[])localObject);
return localByteBuffer.array();
}
public void onReceive(Intent paramIntent, FromServiceMsg paramFromServiceMsg)
{
bool = paramFromServiceMsg.isSuccess();
if (QLog.isColorLevel()) {
QLog.d(a, 2, "onReceive:--success=" + bool);
}
Bundle localBundle = new Bundle();
try
{
paramFromServiceMsg = ByteBuffer.wrap(paramFromServiceMsg.getWupBuffer());
paramFromServiceMsg.clear();
byte[] arrayOfByte = new byte[paramFromServiceMsg.getInt() - 4];
paramFromServiceMsg.get(arrayOfByte);
paramFromServiceMsg = ByteBuffer.wrap(((oidb_sso.OIDBSSOPkg)new oidb_sso.OIDBSSOPkg().mergeFrom(arrayOfByte)).bytes_bodybuffer.get().toByteArray());
if (paramFromServiceMsg.get() != 0) {
break label237;
}
paramFromServiceMsg.getInt();
int j = paramFromServiceMsg.getShort();
i = 0;
for (;;)
{
if (i >= j) {
break label237;
}
if (paramFromServiceMsg.getShort() == 5) {
break;
}
paramFromServiceMsg.position(paramFromServiceMsg.getShort() + paramFromServiceMsg.position());
i += 1;
}
paramFromServiceMsg.getShort();
i = paramFromServiceMsg.getShort();
}
catch (Exception paramFromServiceMsg)
{
for (;;)
{
paramFromServiceMsg.printStackTrace();
int i = 0;
bool = false;
continue;
i = 0;
}
}
if (QLog.isColorLevel()) {
QLog.d(a, 2, "onReceive:--speed=" + i);
}
localBundle.putInt("key_qqlevelacc", i);
notifyObserver(paramIntent, 1, bool, localBundle, QQLevelACCObserver.class);
}
public void onSend(Intent paramIntent, Packet paramPacket)
{
paramPacket.putSendData(a(Long.parseLong(paramIntent.getStringExtra("k_uin"))));
paramPacket.setSSOCommand("OidbSvc.0x826_0");
if (QLog.isColorLevel()) {
QLog.d(a, 2, "--onSend--");
}
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mobileqqi\classes.jar
* Qualified Name: com.tencent.mobileqq.servlet.QQLevelACCServlet
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
81dfdc084588be9872a325f6c76301b9c279b84a | 9254e7279570ac8ef687c416a79bb472146e9b35 | /edas-20170801/src/main/java/com/aliyun/edas20170801/models/ListEcsNotInClusterResponse.java | 6d2e6913a88d84f2ea1cb8665d2217c07981b3b0 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,098 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.edas20170801.models;
import com.aliyun.tea.*;
public class ListEcsNotInClusterResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("body")
@Validation(required = true)
public ListEcsNotInClusterResponseBody body;
public static ListEcsNotInClusterResponse build(java.util.Map<String, ?> map) throws Exception {
ListEcsNotInClusterResponse self = new ListEcsNotInClusterResponse();
return TeaModel.build(map, self);
}
public ListEcsNotInClusterResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public ListEcsNotInClusterResponse setBody(ListEcsNotInClusterResponseBody body) {
this.body = body;
return this;
}
public ListEcsNotInClusterResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
da609306658c1146bc1c810bd4c2a19934837e57 | 8ff6390e8b200f095ceb43b67932009c5a6b8779 | /Master_Of_Mons/core/src/be/ac/umons/mom/g05/instance/mob/NPCType.java | 3d2e7b58fc9b8113f4aca8e7b94aa28e0b403ad5 | [] | no_license | Junior-comp/github-provisoire-2.0 | ee48436c12543fc44eb9fab3e9b0fefb1991a105 | 79db5504498d9aeea2ea7b4e226dfcf8c837c008 | refs/heads/master | 2020-08-30T09:34:03.533404 | 2019-11-20T18:18:34 | 2019-11-20T18:18:34 | 218,335,113 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package be.ac.umons.mom.g05.instance.mob;
public enum NPCType {Boss, Student, Enemies}
| [
"191492@umons.ac.be"
] | 191492@umons.ac.be |
29c227ac142a7e599178e2069af980d4607c43ec | c5bf8d9f3b065ff07c25a4e570688e017a767617 | /src/main/java/br/edu/ifpi/capar/uri/online/judge/URI_2544.java | 1731f5950da19b633955c9e7863be58ebc5d57e5 | [] | no_license | denylsonmelo/uri-online-judge | 78d3deb7a59e9070c1cfd1f6c5ff5dcb764635f3 | ebd4067a64e8dae68182ba9df47842fdaee99b44 | refs/heads/master | 2021-04-29T08:42:26.909872 | 2017-09-06T19:21:46 | 2017-09-06T19:21:46 | 77,671,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 616 | java | package br.edu.ifpi.capar.uri.online.judge;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author Denylson Melo
*/
public class URI_2544 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int quantidadeNinjas;
String linhaLida;
while ((linhaLida = br.readLine()) != null) {
quantidadeNinjas = Integer.parseInt(linhaLida);
System.out.println((int)(Math.log(quantidadeNinjas) / Math.log(2)));
}
}
}
| [
"denylson.melo@ifpi.edu.br"
] | denylson.melo@ifpi.edu.br |
da56ecdb4d6a6f0f95534d0c268dc2702b87b3c9 | 4c36efede2dab82dedd65655035a958a2029b0a3 | /src/VentanaCreacion.java | 7ed56d2be4742e084d955c44bc65897bb8b93ba0 | [] | no_license | Robertoper/SegundosEjerciciosEntornosGraficos | 30f6f55f7a1c23fc6ae5c813f64a5005b51c1e4d | 6fbc10d91e5e6c9d4f768ab83735364aec22d509 | refs/heads/master | 2023-05-06T02:38:42.276004 | 2021-06-03T16:30:03 | 2021-06-03T16:30:03 | 373,574,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
public class VentanaCreacion extends JDialog {
private JPanel pnlBase;
private JLabel iblNombrePersonaje;
private JButton btnCrearPersonaje;
private JTextField txtNombrePersoje;
public VentanaCreacion(ArrayList<String> listaPersonajes){
setTitle("Ventana Creacion Personajes");
setContentPane(pnlBase);
setBounds(100,100,400,100);
setVisible(true);
btnCrearPersonaje.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
listaPersonajes.add(txtNombrePersoje.getText());
JOptionPane.showMessageDialog(null,"Personaje "+txtNombrePersoje.getText()+" creado perfectamente");
}
});
}
}
| [
"aluper5445@ieselcaminas.org"
] | aluper5445@ieselcaminas.org |
0c3654c4c4b2f758868469552cc9415e5d52280b | c3ca4268b6a619ff4b30608f8801d3973a9c5413 | /gateway/src/main/java/com/matchforecast/contrader/security/SpringSecurityAuditorAware.java | 6c13f3869d4184bbfc923fef6d25829693021a2e | [] | no_license | AnthonyContrader/MatchForecast | c7aa4eb26b625b8a4588a5624602c0245ed90b6a | 13e2c74dedcfe14f62fc6583865bf7a475142e3b | refs/heads/master | 2022-12-26T16:36:01.384783 | 2019-11-08T11:44:31 | 2019-11-08T11:44:31 | 211,833,160 | 1 | 0 | null | 2022-12-10T08:15:29 | 2019-09-30T10:17:13 | Java | UTF-8 | Java | false | false | 556 | java | package com.matchforecast.contrader.security;
import com.matchforecast.contrader.config.Constants;
import java.util.Optional;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
/**
* Implementation of AuditorAware based on Spring Security.
*/
@Component
public class SpringSecurityAuditorAware implements AuditorAware<String> {
@Override
public Optional<String> getCurrentAuditor() {
return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM_ACCOUNT));
}
}
| [
"lorenzo.tonietti@gmail.com"
] | lorenzo.tonietti@gmail.com |
050870e79bc42e32d1767aa9b82ba5e561eadc3a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/12/12_c14002106f4fdcfd069858b9d9b95da177e9284f/StateBasedGame/12_c14002106f4fdcfd069858b9d9b95da177e9284f_StateBasedGame_t.java | 97823d9bd1f63db5246656fa9bb47d28ce67b0b9 | [] | 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 | 13,974 | java | package org.newdawn.slick.state;
import java.util.HashMap;
import java.util.Iterator;
import org.newdawn.slick.Game;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.InputListener;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.transition.EmptyTransition;
import org.newdawn.slick.state.transition.Transition;
/**
* A state based game isolated different stages of the game (menu, ingame, hiscores, etc) into
* different states so they can be easily managed and maintained.
*
* @author kevin
*/
public abstract class StateBasedGame implements Game, InputListener {
/** The list of states making up this game */
private HashMap states = new HashMap();
/** The current state */
private GameState currentState;
/** The next state we're moving into */
private GameState nextState;
/** The container holding this game */
private GameContainer container;
/** The title of the game */
private String title;
/** The transition being used to enter the state */
private Transition enterTransition;
/** The transition being used to leave the state */
private Transition leaveTransition;
/**
* Create a new state based game
*
* @param name The name of the game
*/
public StateBasedGame(String name) {
this.title = name;
currentState = new BasicGameState() {
public int getID() {
return -1;
}
public void init(GameContainer container, StateBasedGame game) throws SlickException {
}
public void render(StateBasedGame game, Graphics g) throws SlickException {
}
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
}
public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
}
};
}
/**
* Get the number of states that have been added to this game
*
* @return The number of states that have been added to this game
*/
public int getStateCount() {
return states.keySet().size();
}
/**
* Get the ID of the state the game is currently in
*
* @return The ID of the state the game is currently in
*/
public int getCurrentStateID() {
return currentState.getID();
}
/**
* Get the state the game is currently in
*
* @return The state the game is currently in
*/
public GameState getCurrentState() {
return currentState;
}
/**
* @see org.newdawn.slick.InputListener#setInput(org.newdawn.slick.Input)
*/
public void setInput(Input input) {
}
/**
* Add a state to the game. The state will be updated and maintained
* by the game
*
* @param state The state to be added
*/
public void addState(GameState state) {
states.put(new Integer(state.getID()), state);
if (currentState.getID() == -1) {
currentState = state;
}
}
/**
* Get a state based on it's identifier
*
* @param id The ID of the state to retrieve
* @return The state requested or null if no state with the specified ID exists
*/
public GameState getState(int id) {
return (GameState) states.get(new Integer(id));
}
/**
* Enter a particular game state with no transition
*
* @param id The ID of the state to enter
*/
public void enterState(int id) {
enterState(id, new EmptyTransition(), new EmptyTransition());
}
/**
* Enter a particular game state with the transitions provided
*
* @param id The ID of the state to enter
* @param leave The transition to use when leaving the current state
* @param enter The transition to use when entering the new state
*/
public void enterState(int id, Transition leave, Transition enter) {
if (leave == null) {
leave = new EmptyTransition();
}
if (enter == null) {
enter = new EmptyTransition();
}
leaveTransition = leave;
enterTransition = enter;
nextState = getState(id);
if (nextState == null) {
throw new RuntimeException("No game state registered with the ID: "+id);
}
leaveTransition.init(currentState, nextState);
}
/**
* @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
*/
public final void init(GameContainer container) throws SlickException {
this.container = container;
initStatesList(container);
Iterator gameStates = states.values().iterator();
while (gameStates.hasNext()) {
GameState state = (GameState) gameStates.next();
state.init(container, this);
}
if (currentState != null) {
currentState.enter(container, this);
}
}
/**
* Initialise the list of states making up this game
*
* @param container The container holding the game
* @throws SlickException Indicates a failure to initialise the state based game resources
*/
public abstract void initStatesList(GameContainer container) throws SlickException;
/**
* @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public final void render(GameContainer container, Graphics g) throws SlickException {
preRenderState(container, g);
if (leaveTransition != null) {
leaveTransition.preRender(this, container, g);
} else if (enterTransition != null) {
enterTransition.preRender(this, container, g);
}
currentState.render(container, this, g);
if (leaveTransition != null) {
leaveTransition.postRender(this, container, g);
} else if (enterTransition != null) {
enterTransition.postRender(this, container, g);
}
postRenderState(container, g);
}
/**
* User hook for rendering at the before the current state
* and/or transition have been rendered
*
* @param container The container in which the game is hosted
* @param g The graphics context on which to draw
* @throws SlickException Indicates a failure within render
*/
protected void preRenderState(GameContainer container, Graphics g) throws SlickException {
// NO-OP
}
/**
* User hook for rendering at the game level after the current state
* and/or transition have been rendered
*
* @param container The container in which the game is hosted
* @param g The graphics context on which to draw
* @throws SlickException Indicates a failure within render
*/
protected void postRenderState(GameContainer container, Graphics g) throws SlickException {
// NO-OP
}
/**
* @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
*/
public final void update(GameContainer container, int delta) throws SlickException {
preUpdateState(container, delta);
if (leaveTransition != null) {
leaveTransition.update(this, container, delta);
if (leaveTransition.isComplete()) {
currentState.leave(container, this);
GameState prevState = currentState;
currentState = nextState;
nextState = null;
leaveTransition = null;
if (enterTransition == null) {
currentState.enter(container, this);
} else {
enterTransition.init(currentState, prevState);
}
} else {
return;
}
}
if (enterTransition != null) {
enterTransition.update(this, container, delta);
if (enterTransition.isComplete()) {
currentState.enter(container, this);
enterTransition = null;
} else {
return;
}
}
currentState.update(container, this, delta);
postUpdateState(container, delta);
}
/**
* User hook for updating at the game before the current state
* and/or transition have been updated
*
* @param container The container in which the game is hosted
* @param delta The amount of time in milliseconds since last update
* @throws SlickException Indicates a failure within render
*/
protected void preUpdateState(GameContainer container, int delta) throws SlickException {
// NO-OP
}
/**
* User hook for rendering at the game level after the current state
* and/or transition have been updated
*
* @param container The container in which the game is hosted
* @param delta The amount of time in milliseconds since last update
* @throws SlickException Indicates a failure within render
*/
protected void postUpdateState(GameContainer container, int delta) throws SlickException {
// NO-OP
}
/**
* Check if the game is transitioning between states
*
* @return True if we're transitioning between states
*/
private boolean transitioning() {
return (leaveTransition != null) || (enterTransition != null);
}
/**
* @see org.newdawn.slick.Game#closeRequested()
*/
public boolean closeRequested() {
return true;
}
/**
* @see org.newdawn.slick.Game#getTitle()
*/
public String getTitle() {
return title;
}
/**
* Get the container holding this game
*
* @return The game container holding this game
*/
public GameContainer getContainer() {
return container;
}
/**
* @see org.newdawn.slick.InputListener#controllerButtonPressed(int, int)
*/
public void controllerButtonPressed(int controller, int button) {
if (transitioning()) {
return;
}
currentState.controllerButtonPressed(controller, button);
}
/**
* @see org.newdawn.slick.InputListener#controllerButtonReleased(int, int)
*/
public void controllerButtonReleased(int controller, int button) {
if (transitioning()) {
return;
}
currentState.controllerButtonReleased(controller, button);
}
/**
* @see org.newdawn.slick.InputListener#controllerDownPressed(int)
*/
public void controllerDownPressed(int controller) {
if (transitioning()) {
return;
}
currentState.controllerDownPressed(controller);
}
/**
* @see org.newdawn.slick.InputListener#controllerDownReleased(int)
*/
public void controllerDownReleased(int controller) {
if (transitioning()) {
return;
}
currentState.controllerDownPressed(controller);
}
/**
* @see org.newdawn.slick.InputListener#controllerLeftPressed(int)
*/
public void controllerLeftPressed(int controller) {
if (transitioning()) {
return;
}
currentState.controllerLeftPressed(controller);
}
/**
* @see org.newdawn.slick.InputListener#controllerLeftReleased(int)
*/
public void controllerLeftReleased(int controller) {
if (transitioning()) {
return;
}
currentState.controllerLeftReleased(controller);
}
/**
* @see org.newdawn.slick.InputListener#controllerRightPressed(int)
*/
public void controllerRightPressed(int controller) {
if (transitioning()) {
return;
}
currentState.controllerRightPressed(controller);
}
/**
* @see org.newdawn.slick.InputListener#controllerRightReleased(int)
*/
public void controllerRightReleased(int controller) {
if (transitioning()) {
return;
}
currentState.controllerRightReleased(controller);
}
/**
* @see org.newdawn.slick.InputListener#controllerUpPressed(int)
*/
public void controllerUpPressed(int controller) {
if (transitioning()) {
return;
}
currentState.controllerUpPressed(controller);
}
/**
* @see org.newdawn.slick.InputListener#controllerUpReleased(int)
*/
public void controllerUpReleased(int controller) {
if (transitioning()) {
return;
}
currentState.controllerUpReleased(controller);
}
/**
* @see org.newdawn.slick.InputListener#keyPressed(int, char)
*/
public void keyPressed(int key, char c) {
if (transitioning()) {
return;
}
currentState.keyPressed(key, c);
}
/**
* @see org.newdawn.slick.InputListener#keyReleased(int, char)
*/
public void keyReleased(int key, char c) {
if (transitioning()) {
return;
}
currentState.keyReleased(key, c);
}
/**
* @see org.newdawn.slick.InputListener#mouseMoved(int, int, int, int)
*/
public void mouseMoved(int oldx, int oldy, int newx, int newy) {
if (transitioning()) {
return;
}
currentState.mouseMoved(oldx, oldy, newx, newy);
}
/**
* @see org.newdawn.slick.InputListener#mouseClicked(int, int, int, int)
*/
public void mouseClicked(int button, int x, int y, int clickCount) {
if (transitioning()) {
return;
}
currentState.mouseClicked(button, x, y, clickCount);
}
/**
* @see org.newdawn.slick.InputListener#mousePressed(int, int, int)
*/
public void mousePressed(int button, int x, int y) {
if (transitioning()) {
return;
}
currentState.mousePressed(button, x, y);
}
/**
* @see org.newdawn.slick.InputListener#mouseReleased(int, int, int)
*/
public void mouseReleased(int button, int x, int y) {
if (transitioning()) {
return;
}
currentState.mouseReleased(button, x, y);
}
/**
* @see org.newdawn.slick.InputListener#isAcceptingInput()
*/
public boolean isAcceptingInput() {
if (transitioning()) {
return false;
}
return currentState.isAcceptingInput();
}
/**
* @see org.newdawn.slick.InputListener#inputEnded()
*/
public void inputEnded() {
}
/**
* @see org.newdawn.slick.InputListener#mouseWheelMoved(int)
*/
public void mouseWheelMoved(int newValue) {
currentState.mouseWheelMoved(newValue);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
2b1bc36da66156372aaaf602ef1bee39d13cb036 | 094f4e61f2f4e8cdd64024b42f475e1ea468273e | /src/java/connection/AutoID.java | 7fb556303910fd51f70e6db68bd1377380e4e030 | [] | no_license | vikashkm070/Secure-File-Storage-using-Hybrid-Cryptography | 3c66108942965a959f112d716bd2c2eec5a902d0 | de8d28ba64ac4c5927d358c94306a0bfbd0e3e07 | refs/heads/master | 2023-01-27T19:58:31.932229 | 2020-12-01T18:41:36 | 2020-12-01T18:41:36 | 317,634,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,992 | java | /**
* @author Subhadeep Dan
* All Rights Reserved.
*/
package connection;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
public class AutoID {
static Connection con = null;
static ResultSet rs = null;
static PreparedStatement ps = null;
static String genID = "";
static String generateid = "";
public static String globalGenId(String form_name) {
try {
con = connection.dbConnection.makeConnection();
//genID = pref;
String temp = null;
String num = null;
int r = 1;
String sql = "select prefix from auto_id where form_name='" + form_name + "'";
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
if (rs.next()) {
temp = rs.getString(1).trim();
//String auto_id[] = temp.split("-");
//num = auto_id[1];
r = Integer.parseInt(temp) + 1;
}
generateid = "";
if (r < 10) {
generateid = genID + "0000" + r;
} else if (r < 100) {
generateid = genID + "000" + r;
} else if (r < 1000) {
generateid = genID + "00" + r;
} else if (r < 10000) {
generateid = genID + "0" + r;
} else {
generateid = genID + r;
}
} catch (Exception e) {
}
return (generateid);
}
/********************** Method for update Auto generate id ***************************/
public static void updateAutoID(String form_name, String id) {
try {
Connection con22 = connection.dbConnection.makeConnection();
PreparedStatement pst22 = con22.prepareStatement("update auto_id set prefix='" + id + "' where form_name='" + form_name + "'");
pst22.executeUpdate();
} catch (Exception e) {
}
}
}
| [
"vikashkmr070@gmail.com"
] | vikashkmr070@gmail.com |
32e0123a5a03008f508dd9a4a1ae777cde152f58 | 0635803119ce6a2a4500bf70638d4735d018b40b | /labs/Openshift/OperationalModernization/app/CustomerOrderServices/ejbModule/org/pwte/example/service/ProductSearchService.java | d014e65fb40ebc13a9a2938d16d86df6069c496a | [
"Apache-2.0"
] | permissive | kellyyfoo/openshift-workshop-was | 9dd7afbb027d7c66876b0195fb2661aafd9240d9 | c7d716887d619397ab48322864efd71c0d451b69 | refs/heads/master | 2023-06-28T16:12:17.869094 | 2021-08-04T13:45:38 | 2021-08-04T13:45:38 | 381,515,754 | 0 | 3 | Apache-2.0 | 2021-08-02T13:56:48 | 2021-06-29T22:50:04 | null | UTF-8 | Java | false | false | 579 | java | package org.pwte.example.service;
import java.util.List;
import org.pwte.example.domain.Category;
import org.pwte.example.domain.Product;
import org.pwte.example.exception.CategoryDoesNotExist;
import org.pwte.example.exception.ProductDoesNotExistException;
public interface ProductSearchService
{
public Product loadProduct(int productId) throws ProductDoesNotExistException;
public List<Product> loadProductsByCategory(int categoryId);
public Category loadCategory(int categoryId) throws CategoryDoesNotExist;
public java.util.List<Category> getTopLevelCategories();
}
| [
"mcheng@us.ibm.com"
] | mcheng@us.ibm.com |
2a90740175504674badae17160c829f272ae6474 | 5d6405209ae74d96a0482270563cd33d0a3290ca | /patrick/src/main/java/mapwiki/layout/hexagon/HexDir.java | 1f955b66b63b0d44bd5823acf5a26a66c2309588 | [] | no_license | cipang/mapvis | 17985c641ff558d33fd0dcdb9755e22644629975 | e594346d4f82bd1806b76eb380a36f8e88d491f4 | refs/heads/master | 2020-04-06T07:39:03.133702 | 2018-11-18T11:43:26 | 2018-11-18T11:43:26 | 157,280,143 | 0 | 0 | null | 2018-11-12T21:36:20 | 2018-11-12T21:36:19 | null | UTF-8 | Java | false | false | 123 | java | package mapwiki.layout.hexagon;
public enum HexDir {
NORTH,
NORTH_EAST,
SOUTH_EAST,
SOUTH,
SOUTH_WEST,
NORTH_WEST
}
| [
"muye.yang@gmail.com"
] | muye.yang@gmail.com |
dd2397f11c0885e826d83d5b22264e3be89eef3f | 0a47f91d3ae7c2e38785e5084d813fe35ff46e99 | /springBootProject/src/main/java/cn/itcast/HelloController.java | 7cc4d05f57564f22e5a7fc1e0fd2f16e48bb5c9c | [] | no_license | tanxuanyong/testssh | b04ee889acb7549a18abfd9481db86129e017230 | 032c8f8c7163eda9d3c13601d82c9f322cf57ee2 | refs/heads/master | 2022-06-28T17:22:11.750916 | 2019-06-22T04:55:03 | 2019-06-22T04:55:03 | 193,174,692 | 1 | 0 | null | 2022-06-17T02:12:34 | 2019-06-22T00:36:55 | Java | UTF-8 | Java | false | false | 1,054 | java | package cn.itcast;
import java.util.Date;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 在这里我们使用RestController (等待于 @Controller 和 @RequestBody)
* @author Angel -- 守护天使
* @version v.0.1
* @date 2016年12月10日
*/
@RestController
public class HelloController {
/**
* 在这里我们使用@RequestMapping 建立请求映射:
* http://127.0.0.1:8080/hello
* @return
*/
@RequestMapping("/hello")
public String hello(){
return "hello-2016-12-11.v.0";
}
@RequestMapping("/hello2")
public String hello2(){
return "hello2-2016";
}
@RequestMapping("/hello3")
public String hello3(){
return "hello3";
}
/**
* Spring Boot默认使用的json解析框架是jackson
* @return
*/
@RequestMapping("/getDemo")
public Demo getDemo(){
Demo demo = new Demo();
demo.setId(1);
demo.setName("张三");
demo.setCreateTime(new Date());
demo.setRemarks("这是备注信息");
return demo;
}
}
| [
"13430717395@163.com"
] | 13430717395@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.